github.com/jdgcs/sqlite3@v1.12.1-0.20210908114423-bc5f96e4dd51/internal/mptest/main_freebsd_amd64.go (about)

     1  // Code generated by 'ccgo -export-defines "" -o internal/mptest/main_freebsd_amd64.go -trace-translation-units testdata/sqlite-src-3360000/mptest/mptest.c -Itestdata/sqlite-amalgamation-3360000 -l modernc.org/sqlite/lib -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.
     2  
     3  package main
     4  
     5  import (
     6  	"math"
     7  	"reflect"
     8  	"sync/atomic"
     9  	"unsafe"
    10  
    11  	"modernc.org/libc"
    12  	"modernc.org/libc/sys/types"
    13  	"modernc.org/sqlite/lib"
    14  )
    15  
    16  var _ = math.Pi
    17  var _ reflect.Kind
    18  var _ atomic.Value
    19  var _ unsafe.Pointer
    20  var _ types.Size_t
    21  
    22  func main() { libc.Start(main1) }
    23  
    24  const (
    25  	BIG_ENDIAN                            = 4321
    26  	BUFSIZ                                = 1024
    27  	BYTE_ORDER                            = 1234
    28  	DEFAULT_TIMEOUT                       = 10000
    29  	E2BIG                                 = 7
    30  	EACCES                                = 13
    31  	EADDRINUSE                            = 48
    32  	EADDRNOTAVAIL                         = 49
    33  	EAFNOSUPPORT                          = 47
    34  	EAGAIN                                = 35
    35  	EALREADY                              = 37
    36  	EAUTH                                 = 80
    37  	EBADF                                 = 9
    38  	EBADMSG                               = 89
    39  	EBADRPC                               = 72
    40  	EBUSY                                 = 16
    41  	ECANCELED                             = 85
    42  	ECAPMODE                              = 94
    43  	ECHILD                                = 10
    44  	ECONNABORTED                          = 53
    45  	ECONNREFUSED                          = 61
    46  	ECONNRESET                            = 54
    47  	EDEADLK                               = 11
    48  	EDESTADDRREQ                          = 39
    49  	EDOM                                  = 33
    50  	EDOOFUS                               = 88
    51  	EDQUOT                                = 69
    52  	EEXIST                                = 17
    53  	EFAULT                                = 14
    54  	EFBIG                                 = 27
    55  	EFTYPE                                = 79
    56  	EHOSTDOWN                             = 64
    57  	EHOSTUNREACH                          = 65
    58  	EIDRM                                 = 82
    59  	EILSEQ                                = 86
    60  	EINPROGRESS                           = 36
    61  	EINTEGRITY                            = 97
    62  	EINTR                                 = 4
    63  	EINVAL                                = 22
    64  	EIO                                   = 5
    65  	EISCONN                               = 56
    66  	EISDIR                                = 21
    67  	ELAST                                 = 97
    68  	ELOOP                                 = 62
    69  	EMFILE                                = 24
    70  	EMLINK                                = 31
    71  	EMSGSIZE                              = 40
    72  	EMULTIHOP                             = 90
    73  	ENAMETOOLONG                          = 63
    74  	ENEEDAUTH                             = 81
    75  	ENETDOWN                              = 50
    76  	ENETRESET                             = 52
    77  	ENETUNREACH                           = 51
    78  	ENFILE                                = 23
    79  	ENOATTR                               = 87
    80  	ENOBUFS                               = 55
    81  	ENODEV                                = 19
    82  	ENOENT                                = 2
    83  	ENOEXEC                               = 8
    84  	ENOLCK                                = 77
    85  	ENOLINK                               = 91
    86  	ENOMEM                                = 12
    87  	ENOMSG                                = 83
    88  	ENOPROTOOPT                           = 42
    89  	ENOSPC                                = 28
    90  	ENOSYS                                = 78
    91  	ENOTBLK                               = 15
    92  	ENOTCAPABLE                           = 93
    93  	ENOTCONN                              = 57
    94  	ENOTDIR                               = 20
    95  	ENOTEMPTY                             = 66
    96  	ENOTRECOVERABLE                       = 95
    97  	ENOTSOCK                              = 38
    98  	ENOTSUP                               = 45
    99  	ENOTTY                                = 25
   100  	ENXIO                                 = 6
   101  	EOF                                   = -1
   102  	EOPNOTSUPP                            = 45
   103  	EOVERFLOW                             = 84
   104  	EOWNERDEAD                            = 96
   105  	EPERM                                 = 1
   106  	EPFNOSUPPORT                          = 46
   107  	EPIPE                                 = 32
   108  	EPROCLIM                              = 67
   109  	EPROCUNAVAIL                          = 76
   110  	EPROGMISMATCH                         = 75
   111  	EPROGUNAVAIL                          = 74
   112  	EPROTO                                = 92
   113  	EPROTONOSUPPORT                       = 43
   114  	EPROTOTYPE                            = 41
   115  	ERANGE                                = 34
   116  	EREMOTE                               = 71
   117  	EROFS                                 = 30
   118  	ERPCMISMATCH                          = 73
   119  	ESHUTDOWN                             = 58
   120  	ESOCKTNOSUPPORT                       = 44
   121  	ESPIPE                                = 29
   122  	ESRCH                                 = 3
   123  	ESTALE                                = 70
   124  	ETIMEDOUT                             = 60
   125  	ETOOMANYREFS                          = 59
   126  	ETXTBSY                               = 26
   127  	EUSERS                                = 68
   128  	EWOULDBLOCK                           = 35
   129  	EXDEV                                 = 18
   130  	EXIT_FAILURE                          = 1
   131  	EXIT_SUCCESS                          = 0
   132  	FD_SETSIZE                            = 1024
   133  	FILENAME_MAX                          = 1024
   134  	FOPEN_MAX                             = 20
   135  	FTS5_TOKENIZE_AUX                     = 0x0008
   136  	FTS5_TOKENIZE_DOCUMENT                = 0x0004
   137  	FTS5_TOKENIZE_PREFIX                  = 0x0002
   138  	FTS5_TOKENIZE_QUERY                   = 0x0001
   139  	FTS5_TOKEN_COLOCATED                  = 0x0001
   140  	FULLY_WITHIN                          = 2
   141  	F_LOCK                                = 1
   142  	F_OK                                  = 0
   143  	F_TEST                                = 3
   144  	F_TLOCK                               = 2
   145  	F_ULOCK                               = 0
   146  	HAVE_USLEEP                           = 1
   147  	LITTLE_ENDIAN                         = 1234
   148  	L_INCR                                = 1
   149  	L_SET                                 = 0
   150  	L_XTND                                = 2
   151  	L_ctermid                             = 1024
   152  	L_cuserid                             = 17
   153  	L_tmpnam                              = 1024
   154  	MX_ARG                                = 2
   155  	NDEBUG                                = 1
   156  	NOT_WITHIN                            = 0
   157  	PARTLY_WITHIN                         = 1
   158  	PDP_ENDIAN                            = 3412
   159  	P_tmpdir                              = "/tmp/"
   160  	RAND_MAX                              = 0x7fffffff
   161  	RFCENVG                               = 2048
   162  	RFCFDG                                = 4096
   163  	RFCNAMEG                              = 1024
   164  	RFENVG                                = 2
   165  	RFFDG                                 = 4
   166  	RFFLAGS                               = 2416930932
   167  	RFHIGHPID                             = 262144
   168  	RFKERNELONLY                          = 268828672
   169  	RFLINUXTHPN                           = 65536
   170  	RFMEM                                 = 32
   171  	RFNAMEG                               = 1
   172  	RFNOTEG                               = 8
   173  	RFNOWAIT                              = 64
   174  	RFPPWAIT                              = 2147483648
   175  	RFPROC                                = 16
   176  	RFPROCDESC                            = 268435456
   177  	RFSIGSHARE                            = 16384
   178  	RFSPAWN                               = 2147483648
   179  	RFSTOPPED                             = 131072
   180  	RFTHREAD                              = 8192
   181  	RFTSIGMASK                            = 0xFF
   182  	RFTSIGSHIFT                           = 20
   183  	RFTSIGZMB                             = 524288
   184  	R_OK                                  = 0x04
   185  	SEEK_CUR                              = 1
   186  	SEEK_DATA                             = 3
   187  	SEEK_END                              = 2
   188  	SEEK_HOLE                             = 4
   189  	SEEK_SET                              = 0
   190  	SQLITE3_H                             = 0
   191  	SQLITE3_TEXT                          = 3
   192  	SQLITE_ABORT                          = 4
   193  	SQLITE_ABORT_ROLLBACK                 = 516
   194  	SQLITE_ACCESS_EXISTS                  = 0
   195  	SQLITE_ACCESS_READ                    = 2
   196  	SQLITE_ACCESS_READWRITE               = 1
   197  	SQLITE_ALTER_TABLE                    = 26
   198  	SQLITE_ANALYZE                        = 28
   199  	SQLITE_ANY                            = 5
   200  	SQLITE_API                            = 0
   201  	SQLITE_APICALL                        = 0
   202  	SQLITE_ATTACH                         = 24
   203  	SQLITE_AUTH                           = 23
   204  	SQLITE_AUTH_USER                      = 279
   205  	SQLITE_BLOB                           = 4
   206  	SQLITE_BUSY                           = 5
   207  	SQLITE_BUSY_RECOVERY                  = 261
   208  	SQLITE_BUSY_SNAPSHOT                  = 517
   209  	SQLITE_BUSY_TIMEOUT                   = 773
   210  	SQLITE_CALLBACK                       = 0
   211  	SQLITE_CANTOPEN                       = 14
   212  	SQLITE_CANTOPEN_CONVPATH              = 1038
   213  	SQLITE_CANTOPEN_DIRTYWAL              = 1294
   214  	SQLITE_CANTOPEN_FULLPATH              = 782
   215  	SQLITE_CANTOPEN_ISDIR                 = 526
   216  	SQLITE_CANTOPEN_NOTEMPDIR             = 270
   217  	SQLITE_CANTOPEN_SYMLINK               = 1550
   218  	SQLITE_CDECL                          = 0
   219  	SQLITE_CHANGESETAPPLY_INVERT          = 0x0002
   220  	SQLITE_CHANGESETAPPLY_NOSAVEPOINT     = 0x0001
   221  	SQLITE_CHANGESETSTART_INVERT          = 0x0002
   222  	SQLITE_CHANGESET_ABORT                = 2
   223  	SQLITE_CHANGESET_CONFLICT             = 3
   224  	SQLITE_CHANGESET_CONSTRAINT           = 4
   225  	SQLITE_CHANGESET_DATA                 = 1
   226  	SQLITE_CHANGESET_FOREIGN_KEY          = 5
   227  	SQLITE_CHANGESET_NOTFOUND             = 2
   228  	SQLITE_CHANGESET_OMIT                 = 0
   229  	SQLITE_CHANGESET_REPLACE              = 1
   230  	SQLITE_CHECKPOINT_FULL                = 1
   231  	SQLITE_CHECKPOINT_PASSIVE             = 0
   232  	SQLITE_CHECKPOINT_RESTART             = 2
   233  	SQLITE_CHECKPOINT_TRUNCATE            = 3
   234  	SQLITE_CONFIG_COVERING_INDEX_SCAN     = 20
   235  	SQLITE_CONFIG_GETMALLOC               = 5
   236  	SQLITE_CONFIG_GETMUTEX                = 11
   237  	SQLITE_CONFIG_GETPCACHE               = 15
   238  	SQLITE_CONFIG_GETPCACHE2              = 19
   239  	SQLITE_CONFIG_HEAP                    = 8
   240  	SQLITE_CONFIG_LOG                     = 16
   241  	SQLITE_CONFIG_LOOKASIDE               = 13
   242  	SQLITE_CONFIG_MALLOC                  = 4
   243  	SQLITE_CONFIG_MEMDB_MAXSIZE           = 29
   244  	SQLITE_CONFIG_MEMSTATUS               = 9
   245  	SQLITE_CONFIG_MMAP_SIZE               = 22
   246  	SQLITE_CONFIG_MULTITHREAD             = 2
   247  	SQLITE_CONFIG_MUTEX                   = 10
   248  	SQLITE_CONFIG_PAGECACHE               = 7
   249  	SQLITE_CONFIG_PCACHE                  = 14
   250  	SQLITE_CONFIG_PCACHE2                 = 18
   251  	SQLITE_CONFIG_PCACHE_HDRSZ            = 24
   252  	SQLITE_CONFIG_PMASZ                   = 25
   253  	SQLITE_CONFIG_SCRATCH                 = 6
   254  	SQLITE_CONFIG_SERIALIZED              = 3
   255  	SQLITE_CONFIG_SINGLETHREAD            = 1
   256  	SQLITE_CONFIG_SMALL_MALLOC            = 27
   257  	SQLITE_CONFIG_SORTERREF_SIZE          = 28
   258  	SQLITE_CONFIG_SQLLOG                  = 21
   259  	SQLITE_CONFIG_STMTJRNL_SPILL          = 26
   260  	SQLITE_CONFIG_URI                     = 17
   261  	SQLITE_CONFIG_WIN32_HEAPSIZE          = 23
   262  	SQLITE_CONSTRAINT                     = 19
   263  	SQLITE_CONSTRAINT_CHECK               = 275
   264  	SQLITE_CONSTRAINT_COMMITHOOK          = 531
   265  	SQLITE_CONSTRAINT_FOREIGNKEY          = 787
   266  	SQLITE_CONSTRAINT_FUNCTION            = 1043
   267  	SQLITE_CONSTRAINT_NOTNULL             = 1299
   268  	SQLITE_CONSTRAINT_PINNED              = 2835
   269  	SQLITE_CONSTRAINT_PRIMARYKEY          = 1555
   270  	SQLITE_CONSTRAINT_ROWID               = 2579
   271  	SQLITE_CONSTRAINT_TRIGGER             = 1811
   272  	SQLITE_CONSTRAINT_UNIQUE              = 2067
   273  	SQLITE_CONSTRAINT_VTAB                = 2323
   274  	SQLITE_COPY                           = 0
   275  	SQLITE_CORE                           = 1
   276  	SQLITE_CORRUPT                        = 11
   277  	SQLITE_CORRUPT_INDEX                  = 779
   278  	SQLITE_CORRUPT_SEQUENCE               = 523
   279  	SQLITE_CORRUPT_VTAB                   = 267
   280  	SQLITE_CREATE_INDEX                   = 1
   281  	SQLITE_CREATE_TABLE                   = 2
   282  	SQLITE_CREATE_TEMP_INDEX              = 3
   283  	SQLITE_CREATE_TEMP_TABLE              = 4
   284  	SQLITE_CREATE_TEMP_TRIGGER            = 5
   285  	SQLITE_CREATE_TEMP_VIEW               = 6
   286  	SQLITE_CREATE_TRIGGER                 = 7
   287  	SQLITE_CREATE_VIEW                    = 8
   288  	SQLITE_CREATE_VTABLE                  = 29
   289  	SQLITE_DBCONFIG_DEFENSIVE             = 1010
   290  	SQLITE_DBCONFIG_DQS_DDL               = 1014
   291  	SQLITE_DBCONFIG_DQS_DML               = 1013
   292  	SQLITE_DBCONFIG_ENABLE_FKEY           = 1002
   293  	SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER = 1004
   294  	SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION = 1005
   295  	SQLITE_DBCONFIG_ENABLE_QPSG           = 1007
   296  	SQLITE_DBCONFIG_ENABLE_TRIGGER        = 1003
   297  	SQLITE_DBCONFIG_ENABLE_VIEW           = 1015
   298  	SQLITE_DBCONFIG_LEGACY_ALTER_TABLE    = 1012
   299  	SQLITE_DBCONFIG_LEGACY_FILE_FORMAT    = 1016
   300  	SQLITE_DBCONFIG_LOOKASIDE             = 1001
   301  	SQLITE_DBCONFIG_MAINDBNAME            = 1000
   302  	SQLITE_DBCONFIG_MAX                   = 1017
   303  	SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE      = 1006
   304  	SQLITE_DBCONFIG_RESET_DATABASE        = 1009
   305  	SQLITE_DBCONFIG_TRIGGER_EQP           = 1008
   306  	SQLITE_DBCONFIG_TRUSTED_SCHEMA        = 1017
   307  	SQLITE_DBCONFIG_WRITABLE_SCHEMA       = 1011
   308  	SQLITE_DBSTATUS_CACHE_HIT             = 7
   309  	SQLITE_DBSTATUS_CACHE_MISS            = 8
   310  	SQLITE_DBSTATUS_CACHE_SPILL           = 12
   311  	SQLITE_DBSTATUS_CACHE_USED            = 1
   312  	SQLITE_DBSTATUS_CACHE_USED_SHARED     = 11
   313  	SQLITE_DBSTATUS_CACHE_WRITE           = 9
   314  	SQLITE_DBSTATUS_DEFERRED_FKS          = 10
   315  	SQLITE_DBSTATUS_LOOKASIDE_HIT         = 4
   316  	SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL   = 6
   317  	SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE   = 5
   318  	SQLITE_DBSTATUS_LOOKASIDE_USED        = 0
   319  	SQLITE_DBSTATUS_MAX                   = 12
   320  	SQLITE_DBSTATUS_SCHEMA_USED           = 2
   321  	SQLITE_DBSTATUS_STMT_USED             = 3
   322  	SQLITE_DELETE                         = 9
   323  	SQLITE_DENY                           = 1
   324  	SQLITE_DEPRECATED                     = 0
   325  	SQLITE_DESERIALIZE_FREEONCLOSE        = 1
   326  	SQLITE_DESERIALIZE_READONLY           = 4
   327  	SQLITE_DESERIALIZE_RESIZEABLE         = 2
   328  	SQLITE_DETACH                         = 25
   329  	SQLITE_DETERMINISTIC                  = 0x000000800
   330  	SQLITE_DIRECTONLY                     = 0x000080000
   331  	SQLITE_DONE                           = 101
   332  	SQLITE_DROP_INDEX                     = 10
   333  	SQLITE_DROP_TABLE                     = 11
   334  	SQLITE_DROP_TEMP_INDEX                = 12
   335  	SQLITE_DROP_TEMP_TABLE                = 13
   336  	SQLITE_DROP_TEMP_TRIGGER              = 14
   337  	SQLITE_DROP_TEMP_VIEW                 = 15
   338  	SQLITE_DROP_TRIGGER                   = 16
   339  	SQLITE_DROP_VIEW                      = 17
   340  	SQLITE_DROP_VTABLE                    = 30
   341  	SQLITE_EMPTY                          = 16
   342  	SQLITE_ENABLE_COLUMN_METADATA         = 1
   343  	SQLITE_ENABLE_FTS5                    = 1
   344  	SQLITE_ENABLE_GEOPOLY                 = 1
   345  	SQLITE_ENABLE_JSON1                   = 1
   346  	SQLITE_ENABLE_MEMORY_MANAGEMENT       = 1
   347  	SQLITE_ENABLE_OFFSET_SQL_FUNC         = 1
   348  	SQLITE_ENABLE_PREUPDATE_HOOK          = 1
   349  	SQLITE_ENABLE_RBU                     = 1
   350  	SQLITE_ENABLE_RTREE                   = 1
   351  	SQLITE_ENABLE_SESSION                 = 1
   352  	SQLITE_ENABLE_SNAPSHOT                = 1
   353  	SQLITE_ENABLE_STAT4                   = 1
   354  	SQLITE_ENABLE_UNLOCK_NOTIFY           = 1
   355  	SQLITE_ERROR                          = 1
   356  	SQLITE_ERROR_MISSING_COLLSEQ          = 257
   357  	SQLITE_ERROR_RETRY                    = 513
   358  	SQLITE_ERROR_SNAPSHOT                 = 769
   359  	SQLITE_EXPERIMENTAL                   = 0
   360  	SQLITE_FAIL                           = 3
   361  	SQLITE_FCNTL_BEGIN_ATOMIC_WRITE       = 31
   362  	SQLITE_FCNTL_BUSYHANDLER              = 15
   363  	SQLITE_FCNTL_CHUNK_SIZE               = 6
   364  	SQLITE_FCNTL_CKPT_DONE                = 37
   365  	SQLITE_FCNTL_CKPT_START               = 39
   366  	SQLITE_FCNTL_CKSM_FILE                = 41
   367  	SQLITE_FCNTL_COMMIT_ATOMIC_WRITE      = 32
   368  	SQLITE_FCNTL_COMMIT_PHASETWO          = 22
   369  	SQLITE_FCNTL_DATA_VERSION             = 35
   370  	SQLITE_FCNTL_EXTERNAL_READER          = 40
   371  	SQLITE_FCNTL_FILE_POINTER             = 7
   372  	SQLITE_FCNTL_GET_LOCKPROXYFILE        = 2
   373  	SQLITE_FCNTL_HAS_MOVED                = 20
   374  	SQLITE_FCNTL_JOURNAL_POINTER          = 28
   375  	SQLITE_FCNTL_LAST_ERRNO               = 4
   376  	SQLITE_FCNTL_LOCKSTATE                = 1
   377  	SQLITE_FCNTL_LOCK_TIMEOUT             = 34
   378  	SQLITE_FCNTL_MMAP_SIZE                = 18
   379  	SQLITE_FCNTL_OVERWRITE                = 11
   380  	SQLITE_FCNTL_PDB                      = 30
   381  	SQLITE_FCNTL_PERSIST_WAL              = 10
   382  	SQLITE_FCNTL_POWERSAFE_OVERWRITE      = 13
   383  	SQLITE_FCNTL_PRAGMA                   = 14
   384  	SQLITE_FCNTL_RBU                      = 26
   385  	SQLITE_FCNTL_RESERVE_BYTES            = 38
   386  	SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE    = 33
   387  	SQLITE_FCNTL_SET_LOCKPROXYFILE        = 3
   388  	SQLITE_FCNTL_SIZE_HINT                = 5
   389  	SQLITE_FCNTL_SIZE_LIMIT               = 36
   390  	SQLITE_FCNTL_SYNC                     = 21
   391  	SQLITE_FCNTL_SYNC_OMITTED             = 8
   392  	SQLITE_FCNTL_TEMPFILENAME             = 16
   393  	SQLITE_FCNTL_TRACE                    = 19
   394  	SQLITE_FCNTL_VFSNAME                  = 12
   395  	SQLITE_FCNTL_VFS_POINTER              = 27
   396  	SQLITE_FCNTL_WAL_BLOCK                = 24
   397  	SQLITE_FCNTL_WIN32_AV_RETRY           = 9
   398  	SQLITE_FCNTL_WIN32_GET_HANDLE         = 29
   399  	SQLITE_FCNTL_WIN32_SET_HANDLE         = 23
   400  	SQLITE_FCNTL_ZIPVFS                   = 25
   401  	SQLITE_FLOAT                          = 2
   402  	SQLITE_FORMAT                         = 24
   403  	SQLITE_FULL                           = 13
   404  	SQLITE_FUNCTION                       = 31
   405  	SQLITE_GET_LOCKPROXYFILE              = 2
   406  	SQLITE_IGNORE                         = 2
   407  	SQLITE_INDEX_CONSTRAINT_EQ            = 2
   408  	SQLITE_INDEX_CONSTRAINT_FUNCTION      = 150
   409  	SQLITE_INDEX_CONSTRAINT_GE            = 32
   410  	SQLITE_INDEX_CONSTRAINT_GLOB          = 66
   411  	SQLITE_INDEX_CONSTRAINT_GT            = 4
   412  	SQLITE_INDEX_CONSTRAINT_IS            = 72
   413  	SQLITE_INDEX_CONSTRAINT_ISNOT         = 69
   414  	SQLITE_INDEX_CONSTRAINT_ISNOTNULL     = 70
   415  	SQLITE_INDEX_CONSTRAINT_ISNULL        = 71
   416  	SQLITE_INDEX_CONSTRAINT_LE            = 8
   417  	SQLITE_INDEX_CONSTRAINT_LIKE          = 65
   418  	SQLITE_INDEX_CONSTRAINT_LT            = 16
   419  	SQLITE_INDEX_CONSTRAINT_MATCH         = 64
   420  	SQLITE_INDEX_CONSTRAINT_NE            = 68
   421  	SQLITE_INDEX_CONSTRAINT_REGEXP        = 67
   422  	SQLITE_INDEX_SCAN_UNIQUE              = 1
   423  	SQLITE_INNOCUOUS                      = 0x000200000
   424  	SQLITE_INSERT                         = 18
   425  	SQLITE_INTEGER                        = 1
   426  	SQLITE_INTERNAL                       = 2
   427  	SQLITE_INTERRUPT                      = 9
   428  	SQLITE_IOCAP_ATOMIC                   = 0x00000001
   429  	SQLITE_IOCAP_ATOMIC16K                = 0x00000040
   430  	SQLITE_IOCAP_ATOMIC1K                 = 0x00000004
   431  	SQLITE_IOCAP_ATOMIC2K                 = 0x00000008
   432  	SQLITE_IOCAP_ATOMIC32K                = 0x00000080
   433  	SQLITE_IOCAP_ATOMIC4K                 = 0x00000010
   434  	SQLITE_IOCAP_ATOMIC512                = 0x00000002
   435  	SQLITE_IOCAP_ATOMIC64K                = 0x00000100
   436  	SQLITE_IOCAP_ATOMIC8K                 = 0x00000020
   437  	SQLITE_IOCAP_BATCH_ATOMIC             = 0x00004000
   438  	SQLITE_IOCAP_IMMUTABLE                = 0x00002000
   439  	SQLITE_IOCAP_POWERSAFE_OVERWRITE      = 0x00001000
   440  	SQLITE_IOCAP_SAFE_APPEND              = 0x00000200
   441  	SQLITE_IOCAP_SEQUENTIAL               = 0x00000400
   442  	SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN    = 0x00000800
   443  	SQLITE_IOERR                          = 10
   444  	SQLITE_IOERR_ACCESS                   = 3338
   445  	SQLITE_IOERR_AUTH                     = 7178
   446  	SQLITE_IOERR_BEGIN_ATOMIC             = 7434
   447  	SQLITE_IOERR_BLOCKED                  = 2826
   448  	SQLITE_IOERR_CHECKRESERVEDLOCK        = 3594
   449  	SQLITE_IOERR_CLOSE                    = 4106
   450  	SQLITE_IOERR_COMMIT_ATOMIC            = 7690
   451  	SQLITE_IOERR_CONVPATH                 = 6666
   452  	SQLITE_IOERR_CORRUPTFS                = 8458
   453  	SQLITE_IOERR_DATA                     = 8202
   454  	SQLITE_IOERR_DELETE                   = 2570
   455  	SQLITE_IOERR_DELETE_NOENT             = 5898
   456  	SQLITE_IOERR_DIR_CLOSE                = 4362
   457  	SQLITE_IOERR_DIR_FSYNC                = 1290
   458  	SQLITE_IOERR_FSTAT                    = 1802
   459  	SQLITE_IOERR_FSYNC                    = 1034
   460  	SQLITE_IOERR_GETTEMPPATH              = 6410
   461  	SQLITE_IOERR_LOCK                     = 3850
   462  	SQLITE_IOERR_MMAP                     = 6154
   463  	SQLITE_IOERR_NOMEM                    = 3082
   464  	SQLITE_IOERR_RDLOCK                   = 2314
   465  	SQLITE_IOERR_READ                     = 266
   466  	SQLITE_IOERR_ROLLBACK_ATOMIC          = 7946
   467  	SQLITE_IOERR_SEEK                     = 5642
   468  	SQLITE_IOERR_SHMLOCK                  = 5130
   469  	SQLITE_IOERR_SHMMAP                   = 5386
   470  	SQLITE_IOERR_SHMOPEN                  = 4618
   471  	SQLITE_IOERR_SHMSIZE                  = 4874
   472  	SQLITE_IOERR_SHORT_READ               = 522
   473  	SQLITE_IOERR_TRUNCATE                 = 1546
   474  	SQLITE_IOERR_UNLOCK                   = 2058
   475  	SQLITE_IOERR_VNODE                    = 6922
   476  	SQLITE_IOERR_WRITE                    = 778
   477  	SQLITE_LAST_ERRNO                     = 4
   478  	SQLITE_LIKE_DOESNT_MATCH_BLOBS        = 1
   479  	SQLITE_LIMIT_ATTACHED                 = 7
   480  	SQLITE_LIMIT_COLUMN                   = 2
   481  	SQLITE_LIMIT_COMPOUND_SELECT          = 4
   482  	SQLITE_LIMIT_EXPR_DEPTH               = 3
   483  	SQLITE_LIMIT_FUNCTION_ARG             = 6
   484  	SQLITE_LIMIT_LENGTH                   = 0
   485  	SQLITE_LIMIT_LIKE_PATTERN_LENGTH      = 8
   486  	SQLITE_LIMIT_SQL_LENGTH               = 1
   487  	SQLITE_LIMIT_TRIGGER_DEPTH            = 10
   488  	SQLITE_LIMIT_VARIABLE_NUMBER          = 9
   489  	SQLITE_LIMIT_VDBE_OP                  = 5
   490  	SQLITE_LIMIT_WORKER_THREADS           = 11
   491  	SQLITE_LOCKED                         = 6
   492  	SQLITE_LOCKED_SHAREDCACHE             = 262
   493  	SQLITE_LOCKED_VTAB                    = 518
   494  	SQLITE_LOCK_EXCLUSIVE                 = 4
   495  	SQLITE_LOCK_NONE                      = 0
   496  	SQLITE_LOCK_PENDING                   = 3
   497  	SQLITE_LOCK_RESERVED                  = 2
   498  	SQLITE_LOCK_SHARED                    = 1
   499  	SQLITE_MISMATCH                       = 20
   500  	SQLITE_MISUSE                         = 21
   501  	SQLITE_MUTEX_APPDEF                   = 1
   502  	SQLITE_MUTEX_FAST                     = 0
   503  	SQLITE_MUTEX_NOOP                     = 1
   504  	SQLITE_MUTEX_RECURSIVE                = 1
   505  	SQLITE_MUTEX_STATIC_APP1              = 8
   506  	SQLITE_MUTEX_STATIC_APP2              = 9
   507  	SQLITE_MUTEX_STATIC_APP3              = 10
   508  	SQLITE_MUTEX_STATIC_LRU               = 6
   509  	SQLITE_MUTEX_STATIC_LRU2              = 7
   510  	SQLITE_MUTEX_STATIC_MAIN              = 2
   511  	SQLITE_MUTEX_STATIC_MASTER            = 2
   512  	SQLITE_MUTEX_STATIC_MEM               = 3
   513  	SQLITE_MUTEX_STATIC_MEM2              = 4
   514  	SQLITE_MUTEX_STATIC_OPEN              = 4
   515  	SQLITE_MUTEX_STATIC_PMEM              = 7
   516  	SQLITE_MUTEX_STATIC_PRNG              = 5
   517  	SQLITE_MUTEX_STATIC_VFS1              = 11
   518  	SQLITE_MUTEX_STATIC_VFS2              = 12
   519  	SQLITE_MUTEX_STATIC_VFS3              = 13
   520  	SQLITE_NOLFS                          = 22
   521  	SQLITE_NOMEM                          = 7
   522  	SQLITE_NOTADB                         = 26
   523  	SQLITE_NOTFOUND                       = 12
   524  	SQLITE_NOTICE                         = 27
   525  	SQLITE_NOTICE_RECOVER_ROLLBACK        = 539
   526  	SQLITE_NOTICE_RECOVER_WAL             = 283
   527  	SQLITE_NULL                           = 5
   528  	SQLITE_OK                             = 0
   529  	SQLITE_OK_LOAD_PERMANENTLY            = 256
   530  	SQLITE_OK_SYMLINK                     = 512
   531  	SQLITE_OPEN_AUTOPROXY                 = 0x00000020
   532  	SQLITE_OPEN_CREATE                    = 0x00000004
   533  	SQLITE_OPEN_DELETEONCLOSE             = 0x00000008
   534  	SQLITE_OPEN_EXCLUSIVE                 = 0x00000010
   535  	SQLITE_OPEN_FULLMUTEX                 = 0x00010000
   536  	SQLITE_OPEN_MAIN_DB                   = 0x00000100
   537  	SQLITE_OPEN_MAIN_JOURNAL              = 0x00000800
   538  	SQLITE_OPEN_MASTER_JOURNAL            = 0x00004000
   539  	SQLITE_OPEN_MEMORY                    = 0x00000080
   540  	SQLITE_OPEN_NOFOLLOW                  = 0x01000000
   541  	SQLITE_OPEN_NOMUTEX                   = 0x00008000
   542  	SQLITE_OPEN_PRIVATECACHE              = 0x00040000
   543  	SQLITE_OPEN_READONLY                  = 0x00000001
   544  	SQLITE_OPEN_READWRITE                 = 0x00000002
   545  	SQLITE_OPEN_SHAREDCACHE               = 0x00020000
   546  	SQLITE_OPEN_SUBJOURNAL                = 0x00002000
   547  	SQLITE_OPEN_SUPER_JOURNAL             = 0x00004000
   548  	SQLITE_OPEN_TEMP_DB                   = 0x00000200
   549  	SQLITE_OPEN_TEMP_JOURNAL              = 0x00001000
   550  	SQLITE_OPEN_TRANSIENT_DB              = 0x00000400
   551  	SQLITE_OPEN_URI                       = 0x00000040
   552  	SQLITE_OPEN_WAL                       = 0x00080000
   553  	SQLITE_OS_UNIX                        = 1
   554  	SQLITE_PERM                           = 3
   555  	SQLITE_PRAGMA                         = 19
   556  	SQLITE_PREPARE_NORMALIZE              = 0x02
   557  	SQLITE_PREPARE_NO_VTAB                = 0x04
   558  	SQLITE_PREPARE_PERSISTENT             = 0x01
   559  	SQLITE_PROTOCOL                       = 15
   560  	SQLITE_RANGE                          = 25
   561  	SQLITE_READ                           = 20
   562  	SQLITE_READONLY                       = 8
   563  	SQLITE_READONLY_CANTINIT              = 1288
   564  	SQLITE_READONLY_CANTLOCK              = 520
   565  	SQLITE_READONLY_DBMOVED               = 1032
   566  	SQLITE_READONLY_DIRECTORY             = 1544
   567  	SQLITE_READONLY_RECOVERY              = 264
   568  	SQLITE_READONLY_ROLLBACK              = 776
   569  	SQLITE_RECURSIVE                      = 33
   570  	SQLITE_REINDEX                        = 27
   571  	SQLITE_REPLACE                        = 5
   572  	SQLITE_ROLLBACK                       = 1
   573  	SQLITE_ROW                            = 100
   574  	SQLITE_SAVEPOINT                      = 32
   575  	SQLITE_SCANSTAT_EST                   = 2
   576  	SQLITE_SCANSTAT_EXPLAIN               = 4
   577  	SQLITE_SCANSTAT_NAME                  = 3
   578  	SQLITE_SCANSTAT_NLOOP                 = 0
   579  	SQLITE_SCANSTAT_NVISIT                = 1
   580  	SQLITE_SCANSTAT_SELECTID              = 5
   581  	SQLITE_SCHEMA                         = 17
   582  	SQLITE_SELECT                         = 21
   583  	SQLITE_SERIALIZE_NOCOPY               = 0x001
   584  	SQLITE_SESSION_CONFIG_STRMSIZE        = 1
   585  	SQLITE_SESSION_OBJCONFIG_SIZE         = 1
   586  	SQLITE_SET_LOCKPROXYFILE              = 3
   587  	SQLITE_SHM_EXCLUSIVE                  = 8
   588  	SQLITE_SHM_LOCK                       = 2
   589  	SQLITE_SHM_NLOCK                      = 8
   590  	SQLITE_SHM_SHARED                     = 4
   591  	SQLITE_SHM_UNLOCK                     = 1
   592  	SQLITE_SOUNDEX                        = 1
   593  	SQLITE_SOURCE_ID                      = "2021-06-18 18:36:39 5c9a6c06871cb9fe42814af9c039eb6da5427a6ec28f187af7ebfb62eafa66e5"
   594  	SQLITE_STATUS_MALLOC_COUNT            = 9
   595  	SQLITE_STATUS_MALLOC_SIZE             = 5
   596  	SQLITE_STATUS_MEMORY_USED             = 0
   597  	SQLITE_STATUS_PAGECACHE_OVERFLOW      = 2
   598  	SQLITE_STATUS_PAGECACHE_SIZE          = 7
   599  	SQLITE_STATUS_PAGECACHE_USED          = 1
   600  	SQLITE_STATUS_PARSER_STACK            = 6
   601  	SQLITE_STATUS_SCRATCH_OVERFLOW        = 4
   602  	SQLITE_STATUS_SCRATCH_SIZE            = 8
   603  	SQLITE_STATUS_SCRATCH_USED            = 3
   604  	SQLITE_STDCALL                        = 0
   605  	SQLITE_STMTSTATUS_AUTOINDEX           = 3
   606  	SQLITE_STMTSTATUS_FULLSCAN_STEP       = 1
   607  	SQLITE_STMTSTATUS_MEMUSED             = 99
   608  	SQLITE_STMTSTATUS_REPREPARE           = 5
   609  	SQLITE_STMTSTATUS_RUN                 = 6
   610  	SQLITE_STMTSTATUS_SORT                = 2
   611  	SQLITE_STMTSTATUS_VM_STEP             = 4
   612  	SQLITE_SUBTYPE                        = 0x000100000
   613  	SQLITE_SYNC_DATAONLY                  = 0x00010
   614  	SQLITE_SYNC_FULL                      = 0x00003
   615  	SQLITE_SYNC_NORMAL                    = 0x00002
   616  	SQLITE_SYSAPI                         = 0
   617  	SQLITE_TESTCTRL_ALWAYS                = 13
   618  	SQLITE_TESTCTRL_ASSERT                = 12
   619  	SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS   = 10
   620  	SQLITE_TESTCTRL_BITVEC_TEST           = 8
   621  	SQLITE_TESTCTRL_BYTEORDER             = 22
   622  	SQLITE_TESTCTRL_EXPLAIN_STMT          = 19
   623  	SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS   = 29
   624  	SQLITE_TESTCTRL_FAULT_INSTALL         = 9
   625  	SQLITE_TESTCTRL_FIRST                 = 5
   626  	SQLITE_TESTCTRL_IMPOSTER              = 25
   627  	SQLITE_TESTCTRL_INTERNAL_FUNCTIONS    = 17
   628  	SQLITE_TESTCTRL_ISINIT                = 23
   629  	SQLITE_TESTCTRL_ISKEYWORD             = 16
   630  	SQLITE_TESTCTRL_LAST                  = 32
   631  	SQLITE_TESTCTRL_LOCALTIME_FAULT       = 18
   632  	SQLITE_TESTCTRL_NEVER_CORRUPT         = 20
   633  	SQLITE_TESTCTRL_ONCE_RESET_THRESHOLD  = 19
   634  	SQLITE_TESTCTRL_OPTIMIZATIONS         = 15
   635  	SQLITE_TESTCTRL_PARSER_COVERAGE       = 26
   636  	SQLITE_TESTCTRL_PENDING_BYTE          = 11
   637  	SQLITE_TESTCTRL_PRNG_RESET            = 7
   638  	SQLITE_TESTCTRL_PRNG_RESTORE          = 6
   639  	SQLITE_TESTCTRL_PRNG_SAVE             = 5
   640  	SQLITE_TESTCTRL_PRNG_SEED             = 28
   641  	SQLITE_TESTCTRL_RESERVE               = 14
   642  	SQLITE_TESTCTRL_RESULT_INTREAL        = 27
   643  	SQLITE_TESTCTRL_SCRATCHMALLOC         = 17
   644  	SQLITE_TESTCTRL_SEEK_COUNT            = 30
   645  	SQLITE_TESTCTRL_SORTER_MMAP           = 24
   646  	SQLITE_TESTCTRL_TRACEFLAGS            = 31
   647  	SQLITE_TESTCTRL_TUNE                  = 32
   648  	SQLITE_TESTCTRL_VDBE_COVERAGE         = 21
   649  	SQLITE_TEXT                           = 3
   650  	SQLITE_THREADSAFE                     = 1
   651  	SQLITE_TOOBIG                         = 18
   652  	SQLITE_TRACE_CLOSE                    = 0x08
   653  	SQLITE_TRACE_PROFILE                  = 0x02
   654  	SQLITE_TRACE_ROW                      = 0x04
   655  	SQLITE_TRACE_STMT                     = 0x01
   656  	SQLITE_TRANSACTION                    = 22
   657  	SQLITE_TXN_NONE                       = 0
   658  	SQLITE_TXN_READ                       = 1
   659  	SQLITE_TXN_WRITE                      = 2
   660  	SQLITE_UPDATE                         = 23
   661  	SQLITE_UTF16                          = 4
   662  	SQLITE_UTF16BE                        = 3
   663  	SQLITE_UTF16LE                        = 2
   664  	SQLITE_UTF16_ALIGNED                  = 8
   665  	SQLITE_UTF8                           = 1
   666  	SQLITE_VERSION                        = "3.36.0"
   667  	SQLITE_VERSION_NUMBER                 = 3036000
   668  	SQLITE_VTAB_CONSTRAINT_SUPPORT        = 1
   669  	SQLITE_VTAB_DIRECTONLY                = 3
   670  	SQLITE_VTAB_INNOCUOUS                 = 2
   671  	SQLITE_WARNING                        = 28
   672  	SQLITE_WARNING_AUTOINDEX              = 284
   673  	SQLITE_WIN32_DATA_DIRECTORY_TYPE      = 1
   674  	SQLITE_WIN32_TEMP_DIRECTORY_TYPE      = 2
   675  	STDERR_FILENO                         = 2
   676  	STDIN_FILENO                          = 0
   677  	STDOUT_FILENO                         = 1
   678  	TMP_MAX                               = 308915776
   679  	W_OK                                  = 0x02
   680  	X_OK                                  = 0x01
   681  	X_ACCMODE_T_DECLARED                  = 0
   682  	X_ANSI_STDARG_H_                      = 0
   683  	X_ASSERT_H_                           = 0
   684  	X_BIG_ENDIAN                          = 4321
   685  	X_BLKCNT_T_DECLARED                   = 0
   686  	X_BLKSIZE_T_DECLARED                  = 0
   687  	X_BYTE_ORDER                          = 1234
   688  	X_CACHED_RUNES                        = 256
   689  	X_CAP_IOCTL_T_DECLARED                = 0
   690  	X_CAP_RIGHTS_T_DECLARED               = 0
   691  	X_CLOCKID_T_DECLARED                  = 0
   692  	X_CLOCK_T_DECLARED                    = 0
   693  	X_CRMASK                              = -256
   694  	X_CS_PATH                             = 1
   695  	X_CS_POSIX_V6_ILP32_OFF32_CFLAGS      = 2
   696  	X_CS_POSIX_V6_ILP32_OFF32_LDFLAGS     = 3
   697  	X_CS_POSIX_V6_ILP32_OFF32_LIBS        = 4
   698  	X_CS_POSIX_V6_ILP32_OFFBIG_CFLAGS     = 5
   699  	X_CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS    = 6
   700  	X_CS_POSIX_V6_ILP32_OFFBIG_LIBS       = 7
   701  	X_CS_POSIX_V6_LP64_OFF64_CFLAGS       = 8
   702  	X_CS_POSIX_V6_LP64_OFF64_LDFLAGS      = 9
   703  	X_CS_POSIX_V6_LP64_OFF64_LIBS         = 10
   704  	X_CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS     = 11
   705  	X_CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS    = 12
   706  	X_CS_POSIX_V6_LPBIG_OFFBIG_LIBS       = 13
   707  	X_CS_POSIX_V6_WIDTH_RESTRICTED_ENVS   = 14
   708  	X_CTYPE_A                             = 0x00000100
   709  	X_CTYPE_B                             = 0x00020000
   710  	X_CTYPE_C                             = 0x00000200
   711  	X_CTYPE_D                             = 0x00000400
   712  	X_CTYPE_G                             = 0x00000800
   713  	X_CTYPE_H_                            = 0
   714  	X_CTYPE_I                             = 0x00080000
   715  	X_CTYPE_L                             = 0x00001000
   716  	X_CTYPE_N                             = 0x00400000
   717  	X_CTYPE_P                             = 0x00002000
   718  	X_CTYPE_Q                             = 0x00200000
   719  	X_CTYPE_R                             = 0x00040000
   720  	X_CTYPE_S                             = 0x00004000
   721  	X_CTYPE_SW0                           = 0x20000000
   722  	X_CTYPE_SW1                           = 0x40000000
   723  	X_CTYPE_SW2                           = 0x80000000
   724  	X_CTYPE_SW3                           = 0xc0000000
   725  	X_CTYPE_SWM                           = 0xe0000000
   726  	X_CTYPE_SWS                           = 30
   727  	X_CTYPE_T                             = 0x00100000
   728  	X_CTYPE_U                             = 0x00008000
   729  	X_CTYPE_X                             = 0x00010000
   730  	X_DEV_T_DECLARED                      = 0
   731  	X_ERRNO_T_DEFINED                     = 0
   732  	X_FFLAGS_T_DECLARED                   = 0
   733  	X_FILE_OFFSET_BITS                    = 64
   734  	X_FSBLKCNT_T_DECLARED                 = 0
   735  	X_FSTDIO                              = 0
   736  	X_FTRUNCATE_DECLARED                  = 0
   737  	X_FTS5_H                              = 0
   738  	X_GETOPT_DECLARED                     = 0
   739  	X_GID_T_DECLARED                      = 0
   740  	X_ID_T_DECLARED                       = 0
   741  	X_INO_T_DECLARED                      = 0
   742  	X_INT16_T_DECLARED                    = 0
   743  	X_INT32_T_DECLARED                    = 0
   744  	X_INT64_T_DECLARED                    = 0
   745  	X_INT8_T_DECLARED                     = 0
   746  	X_INTMAX_T_DECLARED                   = 0
   747  	X_INTPTR_T_DECLARED                   = 0
   748  	X_IN_ADDR_T_DECLARED                  = 0
   749  	X_IN_PORT_T_DECLARED                  = 0
   750  	X_IOFBF                               = 0
   751  	X_IOLBF                               = 1
   752  	X_IONBF                               = 2
   753  	X_KEY_T_DECLARED                      = 0
   754  	X_LITTLE_ENDIAN                       = 1234
   755  	X_LOCALE_T_DEFINED                    = 0
   756  	X_LP64                                = 1
   757  	X_LSEEK_DECLARED                      = 0
   758  	X_LWPID_T_DECLARED                    = 0
   759  	X_MACHINE_ENDIAN_H_                   = 0
   760  	X_MACHINE__LIMITS_H_                  = 0
   761  	X_MACHINE__TYPES_H_                   = 0
   762  	X_MKDTEMP_DECLARED                    = 0
   763  	X_MKNOD_DECLARED                      = 0
   764  	X_MKSTEMP_DECLARED                    = 0
   765  	X_MKTEMP_DECLARED                     = 0
   766  	X_MMAP_DECLARED                       = 0
   767  	X_MODE_T_DECLARED                     = 0
   768  	X_MQD_T_DECLARED                      = 0
   769  	X_NLINK_T_DECLARED                    = 0
   770  	X_Nonnull                             = 0
   771  	X_Null_unspecified                    = 0
   772  	X_Nullable                            = 0
   773  	X_OFF64_T_DECLARED                    = 0
   774  	X_OFF_T_DECLARED                      = 0
   775  	X_OPTRESET_DECLARED                   = 0
   776  	X_PC_ACL_EXTENDED                     = 59
   777  	X_PC_ACL_NFS4                         = 64
   778  	X_PC_ACL_PATH_MAX                     = 60
   779  	X_PC_ALLOC_SIZE_MIN                   = 10
   780  	X_PC_ASYNC_IO                         = 53
   781  	X_PC_CAP_PRESENT                      = 61
   782  	X_PC_CHOWN_RESTRICTED                 = 7
   783  	X_PC_FILESIZEBITS                     = 12
   784  	X_PC_INF_PRESENT                      = 62
   785  	X_PC_LINK_MAX                         = 1
   786  	X_PC_MAC_PRESENT                      = 63
   787  	X_PC_MAX_CANON                        = 2
   788  	X_PC_MAX_INPUT                        = 3
   789  	X_PC_MIN_HOLE_SIZE                    = 21
   790  	X_PC_NAME_MAX                         = 4
   791  	X_PC_NO_TRUNC                         = 8
   792  	X_PC_PATH_MAX                         = 5
   793  	X_PC_PIPE_BUF                         = 6
   794  	X_PC_PRIO_IO                          = 54
   795  	X_PC_REC_INCR_XFER_SIZE               = 14
   796  	X_PC_REC_MAX_XFER_SIZE                = 15
   797  	X_PC_REC_MIN_XFER_SIZE                = 16
   798  	X_PC_REC_XFER_ALIGN                   = 17
   799  	X_PC_SYMLINK_MAX                      = 18
   800  	X_PC_SYNC_IO                          = 55
   801  	X_PC_VDISABLE                         = 9
   802  	X_PDP_ENDIAN                          = 3412
   803  	X_PID_T_DECLARED                      = 0
   804  	X_POSIX2_CHAR_TERM                    = 1
   805  	X_POSIX2_C_BIND                       = 200112
   806  	X_POSIX2_C_DEV                        = -1
   807  	X_POSIX2_FORT_DEV                     = -1
   808  	X_POSIX2_FORT_RUN                     = 200112
   809  	X_POSIX2_LOCALEDEF                    = -1
   810  	X_POSIX2_PBS                          = -1
   811  	X_POSIX2_PBS_ACCOUNTING               = -1
   812  	X_POSIX2_PBS_CHECKPOINT               = -1
   813  	X_POSIX2_PBS_LOCATE                   = -1
   814  	X_POSIX2_PBS_MESSAGE                  = -1
   815  	X_POSIX2_PBS_TRACK                    = -1
   816  	X_POSIX2_SW_DEV                       = -1
   817  	X_POSIX2_UPE                          = 200112
   818  	X_POSIX2_VERSION                      = 199212
   819  	X_POSIX_ADVISORY_INFO                 = 200112
   820  	X_POSIX_ASYNCHRONOUS_IO               = 200112
   821  	X_POSIX_BARRIERS                      = 200112
   822  	X_POSIX_CHOWN_RESTRICTED              = 1
   823  	X_POSIX_CLOCK_SELECTION               = -1
   824  	X_POSIX_CPUTIME                       = 200112
   825  	X_POSIX_FSYNC                         = 200112
   826  	X_POSIX_IPV6                          = 0
   827  	X_POSIX_JOB_CONTROL                   = 1
   828  	X_POSIX_MAPPED_FILES                  = 200112
   829  	X_POSIX_MEMLOCK                       = -1
   830  	X_POSIX_MEMLOCK_RANGE                 = 200112
   831  	X_POSIX_MEMORY_PROTECTION             = 200112
   832  	X_POSIX_MESSAGE_PASSING               = 200112
   833  	X_POSIX_MONOTONIC_CLOCK               = 200112
   834  	X_POSIX_NO_TRUNC                      = 1
   835  	X_POSIX_PRIORITIZED_IO                = -1
   836  	X_POSIX_PRIORITY_SCHEDULING           = 0
   837  	X_POSIX_RAW_SOCKETS                   = 200112
   838  	X_POSIX_READER_WRITER_LOCKS           = 200112
   839  	X_POSIX_REALTIME_SIGNALS              = 200112
   840  	X_POSIX_REGEXP                        = 1
   841  	X_POSIX_SEMAPHORES                    = 200112
   842  	X_POSIX_SHARED_MEMORY_OBJECTS         = 200112
   843  	X_POSIX_SHELL                         = 1
   844  	X_POSIX_SPAWN                         = 200112
   845  	X_POSIX_SPIN_LOCKS                    = 200112
   846  	X_POSIX_SPORADIC_SERVER               = -1
   847  	X_POSIX_SYNCHRONIZED_IO               = -1
   848  	X_POSIX_THREADS                       = 200112
   849  	X_POSIX_THREAD_ATTR_STACKADDR         = 200112
   850  	X_POSIX_THREAD_ATTR_STACKSIZE         = 200112
   851  	X_POSIX_THREAD_CPUTIME                = 200112
   852  	X_POSIX_THREAD_PRIORITY_SCHEDULING    = 200112
   853  	X_POSIX_THREAD_PRIO_INHERIT           = 200112
   854  	X_POSIX_THREAD_PRIO_PROTECT           = 200112
   855  	X_POSIX_THREAD_PROCESS_SHARED         = 200112
   856  	X_POSIX_THREAD_SAFE_FUNCTIONS         = -1
   857  	X_POSIX_THREAD_SPORADIC_SERVER        = -1
   858  	X_POSIX_TIMEOUTS                      = 200112
   859  	X_POSIX_TIMERS                        = 200112
   860  	X_POSIX_TRACE                         = -1
   861  	X_POSIX_TRACE_EVENT_FILTER            = -1
   862  	X_POSIX_TRACE_INHERIT                 = -1
   863  	X_POSIX_TRACE_LOG                     = -1
   864  	X_POSIX_TYPED_MEMORY_OBJECTS          = -1
   865  	X_POSIX_VDISABLE                      = 0xff
   866  	X_POSIX_VERSION                       = 200112
   867  	X_PTHREAD_T_DECLARED                  = 0
   868  	X_QUAD_HIGHWORD                       = 1
   869  	X_QUAD_LOWWORD                        = 0
   870  	X_RLIM_T_DECLARED                     = 0
   871  	X_RSIZE_T_DEFINED                     = 0
   872  	X_RUNETYPE_H_                         = 0
   873  	X_RUNE_MAGIC_1                        = "RuneMagi"
   874  	X_RUNE_T_DECLARED                     = 0
   875  	X_SC_2_CHAR_TERM                      = 20
   876  	X_SC_2_C_BIND                         = 18
   877  	X_SC_2_C_DEV                          = 19
   878  	X_SC_2_FORT_DEV                       = 21
   879  	X_SC_2_FORT_RUN                       = 22
   880  	X_SC_2_LOCALEDEF                      = 23
   881  	X_SC_2_PBS                            = 59
   882  	X_SC_2_PBS_ACCOUNTING                 = 60
   883  	X_SC_2_PBS_CHECKPOINT                 = 61
   884  	X_SC_2_PBS_LOCATE                     = 62
   885  	X_SC_2_PBS_MESSAGE                    = 63
   886  	X_SC_2_PBS_TRACK                      = 64
   887  	X_SC_2_SW_DEV                         = 24
   888  	X_SC_2_UPE                            = 25
   889  	X_SC_2_VERSION                        = 17
   890  	X_SC_ADVISORY_INFO                    = 65
   891  	X_SC_AIO_LISTIO_MAX                   = 42
   892  	X_SC_AIO_MAX                          = 43
   893  	X_SC_AIO_PRIO_DELTA_MAX               = 44
   894  	X_SC_ARG_MAX                          = 1
   895  	X_SC_ASYNCHRONOUS_IO                  = 28
   896  	X_SC_ATEXIT_MAX                       = 107
   897  	X_SC_BARRIERS                         = 66
   898  	X_SC_BC_BASE_MAX                      = 9
   899  	X_SC_BC_DIM_MAX                       = 10
   900  	X_SC_BC_SCALE_MAX                     = 11
   901  	X_SC_BC_STRING_MAX                    = 12
   902  	X_SC_CHILD_MAX                        = 2
   903  	X_SC_CLK_TCK                          = 3
   904  	X_SC_CLOCK_SELECTION                  = 67
   905  	X_SC_COLL_WEIGHTS_MAX                 = 13
   906  	X_SC_CPUSET_SIZE                      = 122
   907  	X_SC_CPUTIME                          = 68
   908  	X_SC_DELAYTIMER_MAX                   = 45
   909  	X_SC_EXPR_NEST_MAX                    = 14
   910  	X_SC_FILE_LOCKING                     = 69
   911  	X_SC_FSYNC                            = 38
   912  	X_SC_GETGR_R_SIZE_MAX                 = 70
   913  	X_SC_GETPW_R_SIZE_MAX                 = 71
   914  	X_SC_HOST_NAME_MAX                    = 72
   915  	X_SC_IOV_MAX                          = 56
   916  	X_SC_IPV6                             = 118
   917  	X_SC_JOB_CONTROL                      = 6
   918  	X_SC_LINE_MAX                         = 15
   919  	X_SC_LOGIN_NAME_MAX                   = 73
   920  	X_SC_MAPPED_FILES                     = 29
   921  	X_SC_MEMLOCK                          = 30
   922  	X_SC_MEMLOCK_RANGE                    = 31
   923  	X_SC_MEMORY_PROTECTION                = 32
   924  	X_SC_MESSAGE_PASSING                  = 33
   925  	X_SC_MONOTONIC_CLOCK                  = 74
   926  	X_SC_MQ_OPEN_MAX                      = 46
   927  	X_SC_MQ_PRIO_MAX                      = 75
   928  	X_SC_NGROUPS_MAX                      = 4
   929  	X_SC_NPROCESSORS_CONF                 = 57
   930  	X_SC_NPROCESSORS_ONLN                 = 58
   931  	X_SC_OPEN_MAX                         = 5
   932  	X_SC_PAGESIZE                         = 47
   933  	X_SC_PAGE_SIZE                        = 47
   934  	X_SC_PHYS_PAGES                       = 121
   935  	X_SC_PRIORITIZED_IO                   = 34
   936  	X_SC_PRIORITY_SCHEDULING              = 35
   937  	X_SC_RAW_SOCKETS                      = 119
   938  	X_SC_READER_WRITER_LOCKS              = 76
   939  	X_SC_REALTIME_SIGNALS                 = 36
   940  	X_SC_REGEXP                           = 77
   941  	X_SC_RE_DUP_MAX                       = 16
   942  	X_SC_RTSIG_MAX                        = 48
   943  	X_SC_SAVED_IDS                        = 7
   944  	X_SC_SEMAPHORES                       = 37
   945  	X_SC_SEM_NSEMS_MAX                    = 49
   946  	X_SC_SEM_VALUE_MAX                    = 50
   947  	X_SC_SHARED_MEMORY_OBJECTS            = 39
   948  	X_SC_SHELL                            = 78
   949  	X_SC_SIGQUEUE_MAX                     = 51
   950  	X_SC_SPAWN                            = 79
   951  	X_SC_SPIN_LOCKS                       = 80
   952  	X_SC_SPORADIC_SERVER                  = 81
   953  	X_SC_STREAM_MAX                       = 26
   954  	X_SC_SYMLOOP_MAX                      = 120
   955  	X_SC_SYNCHRONIZED_IO                  = 40
   956  	X_SC_THREADS                          = 96
   957  	X_SC_THREAD_ATTR_STACKADDR            = 82
   958  	X_SC_THREAD_ATTR_STACKSIZE            = 83
   959  	X_SC_THREAD_CPUTIME                   = 84
   960  	X_SC_THREAD_DESTRUCTOR_ITERATIONS     = 85
   961  	X_SC_THREAD_KEYS_MAX                  = 86
   962  	X_SC_THREAD_PRIORITY_SCHEDULING       = 89
   963  	X_SC_THREAD_PRIO_INHERIT              = 87
   964  	X_SC_THREAD_PRIO_PROTECT              = 88
   965  	X_SC_THREAD_PROCESS_SHARED            = 90
   966  	X_SC_THREAD_SAFE_FUNCTIONS            = 91
   967  	X_SC_THREAD_SPORADIC_SERVER           = 92
   968  	X_SC_THREAD_STACK_MIN                 = 93
   969  	X_SC_THREAD_THREADS_MAX               = 94
   970  	X_SC_TIMEOUTS                         = 95
   971  	X_SC_TIMERS                           = 41
   972  	X_SC_TIMER_MAX                        = 52
   973  	X_SC_TRACE                            = 97
   974  	X_SC_TRACE_EVENT_FILTER               = 98
   975  	X_SC_TRACE_INHERIT                    = 99
   976  	X_SC_TRACE_LOG                        = 100
   977  	X_SC_TTY_NAME_MAX                     = 101
   978  	X_SC_TYPED_MEMORY_OBJECTS             = 102
   979  	X_SC_TZNAME_MAX                       = 27
   980  	X_SC_V6_ILP32_OFF32                   = 103
   981  	X_SC_V6_ILP32_OFFBIG                  = 104
   982  	X_SC_V6_LP64_OFF64                    = 105
   983  	X_SC_V6_LPBIG_OFFBIG                  = 106
   984  	X_SC_VERSION                          = 8
   985  	X_SC_XOPEN_CRYPT                      = 108
   986  	X_SC_XOPEN_ENH_I18N                   = 109
   987  	X_SC_XOPEN_LEGACY                     = 110
   988  	X_SC_XOPEN_REALTIME                   = 111
   989  	X_SC_XOPEN_REALTIME_THREADS           = 112
   990  	X_SC_XOPEN_SHM                        = 113
   991  	X_SC_XOPEN_STREAMS                    = 114
   992  	X_SC_XOPEN_UNIX                       = 115
   993  	X_SC_XOPEN_VERSION                    = 116
   994  	X_SC_XOPEN_XCU_VERSION                = 117
   995  	X_SELECT_DECLARED                     = 0
   996  	X_SIGSET_T_DECLARED                   = 0
   997  	X_SIG_MAXSIG                          = 128
   998  	X_SIG_WORDS                           = 4
   999  	X_SIZE_T_DECLARED                     = 0
  1000  	X_SQLITE3RTREE_H_                     = 0
  1001  	X_SSIZE_T_DECLARED                    = 0
  1002  	X_STDARG_H                            = 0
  1003  	X_STDFILE_DECLARED                    = 0
  1004  	X_STDIO_H_                            = 0
  1005  	X_STDLIB_H_                           = 0
  1006  	X_STDSTREAM_DECLARED                  = 0
  1007  	X_STRINGS_H_                          = 0
  1008  	X_STRING_H_                           = 0
  1009  	X_SUSECONDS_T_DECLARED                = 0
  1010  	X_SWAB_DECLARED                       = 0
  1011  	X_SYS_CDEFS_H_                        = 0
  1012  	X_SYS_ERRNO_H_                        = 0
  1013  	X_SYS_SELECT_H_                       = 0
  1014  	X_SYS_TIMESPEC_H_                     = 0
  1015  	X_SYS_TYPES_H_                        = 0
  1016  	X_SYS_UNISTD_H_                       = 0
  1017  	X_SYS__PTHREADTYPES_H_                = 0
  1018  	X_SYS__SIGSET_H_                      = 0
  1019  	X_SYS__STDINT_H_                      = 0
  1020  	X_SYS__TIMESPEC_H_                    = 0
  1021  	X_SYS__TIMEVAL_H_                     = 0
  1022  	X_SYS__TYPES_H_                       = 0
  1023  	X_TIMER_T_DECLARED                    = 0
  1024  	X_TIME_T_DECLARED                     = 0
  1025  	X_TRUNCATE_DECLARED                   = 0
  1026  	X_UID_T_DECLARED                      = 0
  1027  	X_UINT16_T_DECLARED                   = 0
  1028  	X_UINT32_T_DECLARED                   = 0
  1029  	X_UINT64_T_DECLARED                   = 0
  1030  	X_UINT8_T_DECLARED                    = 0
  1031  	X_UINTMAX_T_DECLARED                  = 0
  1032  	X_UINTPTR_T_DECLARED                  = 0
  1033  	X_UNISTD_H_                           = 0
  1034  	X_USECONDS_T_DECLARED                 = 0
  1035  	X_V6_ILP32_OFF32                      = -1
  1036  	X_V6_ILP32_OFFBIG                     = 0
  1037  	X_V6_LP64_OFF64                       = 0
  1038  	X_V6_LPBIG_OFFBIG                     = -1
  1039  	X_VA_LIST                             = 0
  1040  	X_VA_LIST_DECLARED                    = 0
  1041  	X_VA_LIST_DEFINED                     = 0
  1042  	X_VA_LIST_T_H                         = 0
  1043  	X_WCHAR_T_DECLARED                    = 0
  1044  	X_XLOCALE_CTYPE_H                     = 0
  1045  	X_XLOCALE_RUN_FUNCTIONS_DEFINED       = 1
  1046  	X_XLOCALE_STRING1_H                   = 0
  1047  	X_XLOCALE_STRINGS1_H                  = 0
  1048  	X_XOPEN_CRYPT                         = -1
  1049  	X_XOPEN_ENH_I18N                      = -1
  1050  	X_XOPEN_LEGACY                        = -1
  1051  	X_XOPEN_REALTIME                      = -1
  1052  	X_XOPEN_REALTIME_THREADS              = -1
  1053  	X_XOPEN_SHM                           = 1
  1054  	X_XOPEN_STREAMS                       = -1
  1055  	X_XOPEN_UNIX                          = -1
  1056  	Unix                                  = 1
  1057  )
  1058  
  1059  type ptrdiff_t = int64 /* <builtin>:3:26 */
  1060  
  1061  type size_t = uint64 /* <builtin>:9:23 */
  1062  
  1063  type wchar_t = int32 /* <builtin>:15:24 */
  1064  
  1065  // Define the standard macros for the user,
  1066  //    if this invocation was from the user program.
  1067  
  1068  // Define va_list, if desired, from __gnuc_va_list.
  1069  // We deliberately do not define va_list when called from
  1070  //    stdio.h, because ANSI C says that stdio.h is not supposed to define
  1071  //    va_list.  stdio.h needs to have access to that data type,
  1072  //    but must not use that name.  It should use the name __gnuc_va_list,
  1073  //    which is safe because it is reserved for the implementation.
  1074  
  1075  // The macro _VA_LIST_ is the same thing used by this file in Ultrix.
  1076  //    But on BSD NET2 we must not test or define or undef it.
  1077  //    (Note that the comments in NET 2's ansi.h
  1078  //    are incorrect for _VA_LIST_--see stdio.h!)
  1079  // The macro _VA_LIST_DEFINED is used in Windows NT 3.5
  1080  // The macro _VA_LIST is used in SCO Unix 3.2.
  1081  // The macro _VA_LIST_T_H is used in the Bull dpx2
  1082  // The macro __va_list__ is used by BeOS.
  1083  type va_list = uintptr /* stdarg.h:99:24 */
  1084  
  1085  // CAPI3REF: 64-Bit Integer Types
  1086  // KEYWORDS: sqlite_int64 sqlite_uint64
  1087  //
  1088  // Because there is no cross-platform way to specify 64-bit integer types
  1089  // SQLite includes typedefs for 64-bit signed and unsigned integers.
  1090  //
  1091  // The sqlite3_int64 and sqlite3_uint64 are the preferred type definitions.
  1092  // The sqlite_int64 and sqlite_uint64 types are supported for backwards
  1093  // compatibility only.
  1094  //
  1095  // ^The sqlite3_int64 and sqlite_int64 types can store integer values
  1096  // between -9223372036854775808 and +9223372036854775807 inclusive.  ^The
  1097  // sqlite3_uint64 and sqlite_uint64 types can store integer values
  1098  // between 0 and +18446744073709551615 inclusive.
  1099  type sqlite_int64 = int64           /* sqlite3.h:278:25 */
  1100  type sqlite_uint64 = uint64         /* sqlite3.h:279:34 */
  1101  type sqlite3_int64 = sqlite_int64   /* sqlite3.h:281:22 */
  1102  type sqlite3_uint64 = sqlite_uint64 /* sqlite3.h:282:23 */
  1103  
  1104  // The type for a callback function.
  1105  // This is legacy and deprecated.  It is included for historical
  1106  // compatibility and is not documented.
  1107  type sqlite3_callback = uintptr /* sqlite3.h:338:13 */
  1108  
  1109  // CAPI3REF: Result Codes
  1110  // KEYWORDS: {result code definitions}
  1111  //
  1112  // Many SQLite functions return an integer result code from the set shown
  1113  // here in order to indicate success or failure.
  1114  //
  1115  // New error codes may be added in future versions of SQLite.
  1116  //
  1117  // See also: [extended result code definitions]
  1118  // beginning-of-error-codes
  1119  // end-of-error-codes
  1120  
  1121  // CAPI3REF: Extended Result Codes
  1122  // KEYWORDS: {extended result code definitions}
  1123  //
  1124  // In its default configuration, SQLite API routines return one of 30 integer
  1125  // [result codes].  However, experience has shown that many of
  1126  // these result codes are too coarse-grained.  They do not provide as
  1127  // much information about problems as programmers might like.  In an effort to
  1128  // address this, newer versions of SQLite (version 3.3.8 [dateof:3.3.8]
  1129  // and later) include
  1130  // support for additional result codes that provide more detailed information
  1131  // about errors. These [extended result codes] are enabled or disabled
  1132  // on a per database connection basis using the
  1133  // [sqlite3_extended_result_codes()] API.  Or, the extended code for
  1134  // the most recent error can be obtained using
  1135  // [sqlite3_extended_errcode()].
  1136  
  1137  // CAPI3REF: Flags For File Open Operations
  1138  //
  1139  // These bit values are intended for use in the
  1140  // 3rd parameter to the [sqlite3_open_v2()] interface and
  1141  // in the 4th parameter to the [sqlite3_vfs.xOpen] method.
  1142  
  1143  // Reserved:                         0x00F00000
  1144  // Legacy compatibility:
  1145  
  1146  // CAPI3REF: Device Characteristics
  1147  //
  1148  // The xDeviceCharacteristics method of the [sqlite3_io_methods]
  1149  // object returns an integer which is a vector of these
  1150  // bit values expressing I/O characteristics of the mass storage
  1151  // device that holds the file that the [sqlite3_io_methods]
  1152  // refers to.
  1153  //
  1154  // The SQLITE_IOCAP_ATOMIC property means that all writes of
  1155  // any size are atomic.  The SQLITE_IOCAP_ATOMICnnn values
  1156  // mean that writes of blocks that are nnn bytes in size and
  1157  // are aligned to an address which is an integer multiple of
  1158  // nnn are atomic.  The SQLITE_IOCAP_SAFE_APPEND value means
  1159  // that when data is appended to a file, the data is appended
  1160  // first then the size of the file is extended, never the other
  1161  // way around.  The SQLITE_IOCAP_SEQUENTIAL property means that
  1162  // information is written to disk in the same order as calls
  1163  // to xWrite().  The SQLITE_IOCAP_POWERSAFE_OVERWRITE property means that
  1164  // after reboot following a crash or power loss, the only bytes in a
  1165  // file that were written at the application level might have changed
  1166  // and that adjacent bytes, even bytes within the same sector are
  1167  // guaranteed to be unchanged.  The SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN
  1168  // flag indicates that a file cannot be deleted when open.  The
  1169  // SQLITE_IOCAP_IMMUTABLE flag indicates that the file is on
  1170  // read-only media and cannot be changed even by processes with
  1171  // elevated privileges.
  1172  //
  1173  // The SQLITE_IOCAP_BATCH_ATOMIC property means that the underlying
  1174  // filesystem supports doing multiple write operations atomically when those
  1175  // write operations are bracketed by [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] and
  1176  // [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE].
  1177  
  1178  // CAPI3REF: File Locking Levels
  1179  //
  1180  // SQLite uses one of these integer values as the second
  1181  // argument to calls it makes to the xLock() and xUnlock() methods
  1182  // of an [sqlite3_io_methods] object.
  1183  
  1184  // CAPI3REF: Synchronization Type Flags
  1185  //
  1186  // When SQLite invokes the xSync() method of an
  1187  // [sqlite3_io_methods] object it uses a combination of
  1188  // these integer values as the second argument.
  1189  //
  1190  // When the SQLITE_SYNC_DATAONLY flag is used, it means that the
  1191  // sync operation only needs to flush data to mass storage.  Inode
  1192  // information need not be flushed. If the lower four bits of the flag
  1193  // equal SQLITE_SYNC_NORMAL, that means to use normal fsync() semantics.
  1194  // If the lower four bits equal SQLITE_SYNC_FULL, that means
  1195  // to use Mac OS X style fullsync instead of fsync().
  1196  //
  1197  // Do not confuse the SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL flags
  1198  // with the [PRAGMA synchronous]=NORMAL and [PRAGMA synchronous]=FULL
  1199  // settings.  The [synchronous pragma] determines when calls to the
  1200  // xSync VFS method occur and applies uniformly across all platforms.
  1201  // The SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL flags determine how
  1202  // energetic or rigorous or forceful the sync operations are and
  1203  // only make a difference on Mac OSX for the default SQLite code.
  1204  // (Third-party VFS implementations might also make the distinction
  1205  // between SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL, but among the
  1206  // operating systems natively supported by SQLite, only Mac OSX
  1207  // cares about the difference.)
  1208  
  1209  // CAPI3REF: OS Interface Open File Handle
  1210  //
  1211  // An [sqlite3_file] object represents an open file in the
  1212  // [sqlite3_vfs | OS interface layer].  Individual OS interface
  1213  // implementations will
  1214  // want to subclass this object by appending additional fields
  1215  // for their own use.  The pMethods entry is a pointer to an
  1216  // [sqlite3_io_methods] object that defines methods for performing
  1217  // I/O operations on the open file.
  1218  type sqlite3_file1 = struct{ pMethods uintptr } /* sqlite3.h:684:9 */
  1219  
  1220  // CAPI3REF: Result Codes
  1221  // KEYWORDS: {result code definitions}
  1222  //
  1223  // Many SQLite functions return an integer result code from the set shown
  1224  // here in order to indicate success or failure.
  1225  //
  1226  // New error codes may be added in future versions of SQLite.
  1227  //
  1228  // See also: [extended result code definitions]
  1229  // beginning-of-error-codes
  1230  // end-of-error-codes
  1231  
  1232  // CAPI3REF: Extended Result Codes
  1233  // KEYWORDS: {extended result code definitions}
  1234  //
  1235  // In its default configuration, SQLite API routines return one of 30 integer
  1236  // [result codes].  However, experience has shown that many of
  1237  // these result codes are too coarse-grained.  They do not provide as
  1238  // much information about problems as programmers might like.  In an effort to
  1239  // address this, newer versions of SQLite (version 3.3.8 [dateof:3.3.8]
  1240  // and later) include
  1241  // support for additional result codes that provide more detailed information
  1242  // about errors. These [extended result codes] are enabled or disabled
  1243  // on a per database connection basis using the
  1244  // [sqlite3_extended_result_codes()] API.  Or, the extended code for
  1245  // the most recent error can be obtained using
  1246  // [sqlite3_extended_errcode()].
  1247  
  1248  // CAPI3REF: Flags For File Open Operations
  1249  //
  1250  // These bit values are intended for use in the
  1251  // 3rd parameter to the [sqlite3_open_v2()] interface and
  1252  // in the 4th parameter to the [sqlite3_vfs.xOpen] method.
  1253  
  1254  // Reserved:                         0x00F00000
  1255  // Legacy compatibility:
  1256  
  1257  // CAPI3REF: Device Characteristics
  1258  //
  1259  // The xDeviceCharacteristics method of the [sqlite3_io_methods]
  1260  // object returns an integer which is a vector of these
  1261  // bit values expressing I/O characteristics of the mass storage
  1262  // device that holds the file that the [sqlite3_io_methods]
  1263  // refers to.
  1264  //
  1265  // The SQLITE_IOCAP_ATOMIC property means that all writes of
  1266  // any size are atomic.  The SQLITE_IOCAP_ATOMICnnn values
  1267  // mean that writes of blocks that are nnn bytes in size and
  1268  // are aligned to an address which is an integer multiple of
  1269  // nnn are atomic.  The SQLITE_IOCAP_SAFE_APPEND value means
  1270  // that when data is appended to a file, the data is appended
  1271  // first then the size of the file is extended, never the other
  1272  // way around.  The SQLITE_IOCAP_SEQUENTIAL property means that
  1273  // information is written to disk in the same order as calls
  1274  // to xWrite().  The SQLITE_IOCAP_POWERSAFE_OVERWRITE property means that
  1275  // after reboot following a crash or power loss, the only bytes in a
  1276  // file that were written at the application level might have changed
  1277  // and that adjacent bytes, even bytes within the same sector are
  1278  // guaranteed to be unchanged.  The SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN
  1279  // flag indicates that a file cannot be deleted when open.  The
  1280  // SQLITE_IOCAP_IMMUTABLE flag indicates that the file is on
  1281  // read-only media and cannot be changed even by processes with
  1282  // elevated privileges.
  1283  //
  1284  // The SQLITE_IOCAP_BATCH_ATOMIC property means that the underlying
  1285  // filesystem supports doing multiple write operations atomically when those
  1286  // write operations are bracketed by [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] and
  1287  // [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE].
  1288  
  1289  // CAPI3REF: File Locking Levels
  1290  //
  1291  // SQLite uses one of these integer values as the second
  1292  // argument to calls it makes to the xLock() and xUnlock() methods
  1293  // of an [sqlite3_io_methods] object.
  1294  
  1295  // CAPI3REF: Synchronization Type Flags
  1296  //
  1297  // When SQLite invokes the xSync() method of an
  1298  // [sqlite3_io_methods] object it uses a combination of
  1299  // these integer values as the second argument.
  1300  //
  1301  // When the SQLITE_SYNC_DATAONLY flag is used, it means that the
  1302  // sync operation only needs to flush data to mass storage.  Inode
  1303  // information need not be flushed. If the lower four bits of the flag
  1304  // equal SQLITE_SYNC_NORMAL, that means to use normal fsync() semantics.
  1305  // If the lower four bits equal SQLITE_SYNC_FULL, that means
  1306  // to use Mac OS X style fullsync instead of fsync().
  1307  //
  1308  // Do not confuse the SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL flags
  1309  // with the [PRAGMA synchronous]=NORMAL and [PRAGMA synchronous]=FULL
  1310  // settings.  The [synchronous pragma] determines when calls to the
  1311  // xSync VFS method occur and applies uniformly across all platforms.
  1312  // The SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL flags determine how
  1313  // energetic or rigorous or forceful the sync operations are and
  1314  // only make a difference on Mac OSX for the default SQLite code.
  1315  // (Third-party VFS implementations might also make the distinction
  1316  // between SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL, but among the
  1317  // operating systems natively supported by SQLite, only Mac OSX
  1318  // cares about the difference.)
  1319  
  1320  // CAPI3REF: OS Interface Open File Handle
  1321  //
  1322  // An [sqlite3_file] object represents an open file in the
  1323  // [sqlite3_vfs | OS interface layer].  Individual OS interface
  1324  // implementations will
  1325  // want to subclass this object by appending additional fields
  1326  // for their own use.  The pMethods entry is a pointer to an
  1327  // [sqlite3_io_methods] object that defines methods for performing
  1328  // I/O operations on the open file.
  1329  type sqlite3_file = sqlite3_file1 /* sqlite3.h:684:29 */
  1330  type sqlite3_io_methods1 = struct {
  1331  	iVersion               int32
  1332  	_                      [4]byte
  1333  	xClose                 uintptr
  1334  	xRead                  uintptr
  1335  	xWrite                 uintptr
  1336  	xTruncate              uintptr
  1337  	xSync                  uintptr
  1338  	xFileSize              uintptr
  1339  	xLock                  uintptr
  1340  	xUnlock                uintptr
  1341  	xCheckReservedLock     uintptr
  1342  	xFileControl           uintptr
  1343  	xSectorSize            uintptr
  1344  	xDeviceCharacteristics uintptr
  1345  	xShmMap                uintptr
  1346  	xShmLock               uintptr
  1347  	xShmBarrier            uintptr
  1348  	xShmUnmap              uintptr
  1349  	xFetch                 uintptr
  1350  	xUnfetch               uintptr
  1351  } /* sqlite3.h:684:9 */
  1352  
  1353  // CAPI3REF: OS Interface File Virtual Methods Object
  1354  //
  1355  // Every file opened by the [sqlite3_vfs.xOpen] method populates an
  1356  // [sqlite3_file] object (or, more commonly, a subclass of the
  1357  // [sqlite3_file] object) with a pointer to an instance of this object.
  1358  // This object defines the methods used to perform various operations
  1359  // against the open file represented by the [sqlite3_file] object.
  1360  //
  1361  // If the [sqlite3_vfs.xOpen] method sets the sqlite3_file.pMethods element
  1362  // to a non-NULL pointer, then the sqlite3_io_methods.xClose method
  1363  // may be invoked even if the [sqlite3_vfs.xOpen] reported that it failed.  The
  1364  // only way to prevent a call to xClose following a failed [sqlite3_vfs.xOpen]
  1365  // is for the [sqlite3_vfs.xOpen] to set the sqlite3_file.pMethods element
  1366  // to NULL.
  1367  //
  1368  // The flags argument to xSync may be one of [SQLITE_SYNC_NORMAL] or
  1369  // [SQLITE_SYNC_FULL].  The first choice is the normal fsync().
  1370  // The second choice is a Mac OS X style fullsync.  The [SQLITE_SYNC_DATAONLY]
  1371  // flag may be ORed in to indicate that only the data of the file
  1372  // and not its inode needs to be synced.
  1373  //
  1374  // The integer values to xLock() and xUnlock() are one of
  1375  // <ul>
  1376  // <li> [SQLITE_LOCK_NONE],
  1377  // <li> [SQLITE_LOCK_SHARED],
  1378  // <li> [SQLITE_LOCK_RESERVED],
  1379  // <li> [SQLITE_LOCK_PENDING], or
  1380  // <li> [SQLITE_LOCK_EXCLUSIVE].
  1381  // </ul>
  1382  // xLock() increases the lock. xUnlock() decreases the lock.
  1383  // The xCheckReservedLock() method checks whether any database connection,
  1384  // either in this process or in some other process, is holding a RESERVED,
  1385  // PENDING, or EXCLUSIVE lock on the file.  It returns true
  1386  // if such a lock exists and false otherwise.
  1387  //
  1388  // The xFileControl() method is a generic interface that allows custom
  1389  // VFS implementations to directly control an open file using the
  1390  // [sqlite3_file_control()] interface.  The second "op" argument is an
  1391  // integer opcode.  The third argument is a generic pointer intended to
  1392  // point to a structure that may contain arguments or space in which to
  1393  // write return values.  Potential uses for xFileControl() might be
  1394  // functions to enable blocking locks with timeouts, to change the
  1395  // locking strategy (for example to use dot-file locks), to inquire
  1396  // about the status of a lock, or to break stale locks.  The SQLite
  1397  // core reserves all opcodes less than 100 for its own use.
  1398  // A [file control opcodes | list of opcodes] less than 100 is available.
  1399  // Applications that define a custom xFileControl method should use opcodes
  1400  // greater than 100 to avoid conflicts.  VFS implementations should
  1401  // return [SQLITE_NOTFOUND] for file control opcodes that they do not
  1402  // recognize.
  1403  //
  1404  // The xSectorSize() method returns the sector size of the
  1405  // device that underlies the file.  The sector size is the
  1406  // minimum write that can be performed without disturbing
  1407  // other bytes in the file.  The xDeviceCharacteristics()
  1408  // method returns a bit vector describing behaviors of the
  1409  // underlying device:
  1410  //
  1411  // <ul>
  1412  // <li> [SQLITE_IOCAP_ATOMIC]
  1413  // <li> [SQLITE_IOCAP_ATOMIC512]
  1414  // <li> [SQLITE_IOCAP_ATOMIC1K]
  1415  // <li> [SQLITE_IOCAP_ATOMIC2K]
  1416  // <li> [SQLITE_IOCAP_ATOMIC4K]
  1417  // <li> [SQLITE_IOCAP_ATOMIC8K]
  1418  // <li> [SQLITE_IOCAP_ATOMIC16K]
  1419  // <li> [SQLITE_IOCAP_ATOMIC32K]
  1420  // <li> [SQLITE_IOCAP_ATOMIC64K]
  1421  // <li> [SQLITE_IOCAP_SAFE_APPEND]
  1422  // <li> [SQLITE_IOCAP_SEQUENTIAL]
  1423  // <li> [SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN]
  1424  // <li> [SQLITE_IOCAP_POWERSAFE_OVERWRITE]
  1425  // <li> [SQLITE_IOCAP_IMMUTABLE]
  1426  // <li> [SQLITE_IOCAP_BATCH_ATOMIC]
  1427  // </ul>
  1428  //
  1429  // The SQLITE_IOCAP_ATOMIC property means that all writes of
  1430  // any size are atomic.  The SQLITE_IOCAP_ATOMICnnn values
  1431  // mean that writes of blocks that are nnn bytes in size and
  1432  // are aligned to an address which is an integer multiple of
  1433  // nnn are atomic.  The SQLITE_IOCAP_SAFE_APPEND value means
  1434  // that when data is appended to a file, the data is appended
  1435  // first then the size of the file is extended, never the other
  1436  // way around.  The SQLITE_IOCAP_SEQUENTIAL property means that
  1437  // information is written to disk in the same order as calls
  1438  // to xWrite().
  1439  //
  1440  // If xRead() returns SQLITE_IOERR_SHORT_READ it must also fill
  1441  // in the unread portions of the buffer with zeros.  A VFS that
  1442  // fails to zero-fill short reads might seem to work.  However,
  1443  // failure to zero-fill short reads will eventually lead to
  1444  // database corruption.
  1445  type sqlite3_io_methods = sqlite3_io_methods1 /* sqlite3.h:783:35 */
  1446  
  1447  // CAPI3REF: OS Interface Object
  1448  //
  1449  // An instance of the sqlite3_vfs object defines the interface between
  1450  // the SQLite core and the underlying operating system.  The "vfs"
  1451  // in the name of the object stands for "virtual file system".  See
  1452  // the [VFS | VFS documentation] for further information.
  1453  //
  1454  // The VFS interface is sometimes extended by adding new methods onto
  1455  // the end.  Each time such an extension occurs, the iVersion field
  1456  // is incremented.  The iVersion value started out as 1 in
  1457  // SQLite [version 3.5.0] on [dateof:3.5.0], then increased to 2
  1458  // with SQLite [version 3.7.0] on [dateof:3.7.0], and then increased
  1459  // to 3 with SQLite [version 3.7.6] on [dateof:3.7.6].  Additional fields
  1460  // may be appended to the sqlite3_vfs object and the iVersion value
  1461  // may increase again in future versions of SQLite.
  1462  // Note that due to an oversight, the structure
  1463  // of the sqlite3_vfs object changed in the transition from
  1464  // SQLite [version 3.5.9] to [version 3.6.0] on [dateof:3.6.0]
  1465  // and yet the iVersion field was not increased.
  1466  //
  1467  // The szOsFile field is the size of the subclassed [sqlite3_file]
  1468  // structure used by this VFS.  mxPathname is the maximum length of
  1469  // a pathname in this VFS.
  1470  //
  1471  // Registered sqlite3_vfs objects are kept on a linked list formed by
  1472  // the pNext pointer.  The [sqlite3_vfs_register()]
  1473  // and [sqlite3_vfs_unregister()] interfaces manage this list
  1474  // in a thread-safe way.  The [sqlite3_vfs_find()] interface
  1475  // searches the list.  Neither the application code nor the VFS
  1476  // implementation should use the pNext pointer.
  1477  //
  1478  // The pNext field is the only field in the sqlite3_vfs
  1479  // structure that SQLite will ever modify.  SQLite will only access
  1480  // or modify this field while holding a particular static mutex.
  1481  // The application should never modify anything within the sqlite3_vfs
  1482  // object once the object has been registered.
  1483  //
  1484  // The zName field holds the name of the VFS module.  The name must
  1485  // be unique across all VFS modules.
  1486  //
  1487  // [[sqlite3_vfs.xOpen]]
  1488  // ^SQLite guarantees that the zFilename parameter to xOpen
  1489  // is either a NULL pointer or string obtained
  1490  // from xFullPathname() with an optional suffix added.
  1491  // ^If a suffix is added to the zFilename parameter, it will
  1492  // consist of a single "-" character followed by no more than
  1493  // 11 alphanumeric and/or "-" characters.
  1494  // ^SQLite further guarantees that
  1495  // the string will be valid and unchanged until xClose() is
  1496  // called. Because of the previous sentence,
  1497  // the [sqlite3_file] can safely store a pointer to the
  1498  // filename if it needs to remember the filename for some reason.
  1499  // If the zFilename parameter to xOpen is a NULL pointer then xOpen
  1500  // must invent its own temporary name for the file.  ^Whenever the
  1501  // xFilename parameter is NULL it will also be the case that the
  1502  // flags parameter will include [SQLITE_OPEN_DELETEONCLOSE].
  1503  //
  1504  // The flags argument to xOpen() includes all bits set in
  1505  // the flags argument to [sqlite3_open_v2()].  Or if [sqlite3_open()]
  1506  // or [sqlite3_open16()] is used, then flags includes at least
  1507  // [SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE].
  1508  // If xOpen() opens a file read-only then it sets *pOutFlags to
  1509  // include [SQLITE_OPEN_READONLY].  Other bits in *pOutFlags may be set.
  1510  //
  1511  // ^(SQLite will also add one of the following flags to the xOpen()
  1512  // call, depending on the object being opened:
  1513  //
  1514  // <ul>
  1515  // <li>  [SQLITE_OPEN_MAIN_DB]
  1516  // <li>  [SQLITE_OPEN_MAIN_JOURNAL]
  1517  // <li>  [SQLITE_OPEN_TEMP_DB]
  1518  // <li>  [SQLITE_OPEN_TEMP_JOURNAL]
  1519  // <li>  [SQLITE_OPEN_TRANSIENT_DB]
  1520  // <li>  [SQLITE_OPEN_SUBJOURNAL]
  1521  // <li>  [SQLITE_OPEN_SUPER_JOURNAL]
  1522  // <li>  [SQLITE_OPEN_WAL]
  1523  // </ul>)^
  1524  //
  1525  // The file I/O implementation can use the object type flags to
  1526  // change the way it deals with files.  For example, an application
  1527  // that does not care about crash recovery or rollback might make
  1528  // the open of a journal file a no-op.  Writes to this journal would
  1529  // also be no-ops, and any attempt to read the journal would return
  1530  // SQLITE_IOERR.  Or the implementation might recognize that a database
  1531  // file will be doing page-aligned sector reads and writes in a random
  1532  // order and set up its I/O subsystem accordingly.
  1533  //
  1534  // SQLite might also add one of the following flags to the xOpen method:
  1535  //
  1536  // <ul>
  1537  // <li> [SQLITE_OPEN_DELETEONCLOSE]
  1538  // <li> [SQLITE_OPEN_EXCLUSIVE]
  1539  // </ul>
  1540  //
  1541  // The [SQLITE_OPEN_DELETEONCLOSE] flag means the file should be
  1542  // deleted when it is closed.  ^The [SQLITE_OPEN_DELETEONCLOSE]
  1543  // will be set for TEMP databases and their journals, transient
  1544  // databases, and subjournals.
  1545  //
  1546  // ^The [SQLITE_OPEN_EXCLUSIVE] flag is always used in conjunction
  1547  // with the [SQLITE_OPEN_CREATE] flag, which are both directly
  1548  // analogous to the O_EXCL and O_CREAT flags of the POSIX open()
  1549  // API.  The SQLITE_OPEN_EXCLUSIVE flag, when paired with the
  1550  // SQLITE_OPEN_CREATE, is used to indicate that file should always
  1551  // be created, and that it is an error if it already exists.
  1552  // It is <i>not</i> used to indicate the file should be opened
  1553  // for exclusive access.
  1554  //
  1555  // ^At least szOsFile bytes of memory are allocated by SQLite
  1556  // to hold the [sqlite3_file] structure passed as the third
  1557  // argument to xOpen.  The xOpen method does not have to
  1558  // allocate the structure; it should just fill it in.  Note that
  1559  // the xOpen method must set the sqlite3_file.pMethods to either
  1560  // a valid [sqlite3_io_methods] object or to NULL.  xOpen must do
  1561  // this even if the open fails.  SQLite expects that the sqlite3_file.pMethods
  1562  // element will be valid after xOpen returns regardless of the success
  1563  // or failure of the xOpen call.
  1564  //
  1565  // [[sqlite3_vfs.xAccess]]
  1566  // ^The flags argument to xAccess() may be [SQLITE_ACCESS_EXISTS]
  1567  // to test for the existence of a file, or [SQLITE_ACCESS_READWRITE] to
  1568  // test whether a file is readable and writable, or [SQLITE_ACCESS_READ]
  1569  // to test whether a file is at least readable.  The SQLITE_ACCESS_READ
  1570  // flag is never actually used and is not implemented in the built-in
  1571  // VFSes of SQLite.  The file is named by the second argument and can be a
  1572  // directory. The xAccess method returns [SQLITE_OK] on success or some
  1573  // non-zero error code if there is an I/O error or if the name of
  1574  // the file given in the second argument is illegal.  If SQLITE_OK
  1575  // is returned, then non-zero or zero is written into *pResOut to indicate
  1576  // whether or not the file is accessible.
  1577  //
  1578  // ^SQLite will always allocate at least mxPathname+1 bytes for the
  1579  // output buffer xFullPathname.  The exact size of the output buffer
  1580  // is also passed as a parameter to both  methods. If the output buffer
  1581  // is not large enough, [SQLITE_CANTOPEN] should be returned. Since this is
  1582  // handled as a fatal error by SQLite, vfs implementations should endeavor
  1583  // to prevent this by setting mxPathname to a sufficiently large value.
  1584  //
  1585  // The xRandomness(), xSleep(), xCurrentTime(), and xCurrentTimeInt64()
  1586  // interfaces are not strictly a part of the filesystem, but they are
  1587  // included in the VFS structure for completeness.
  1588  // The xRandomness() function attempts to return nBytes bytes
  1589  // of good-quality randomness into zOut.  The return value is
  1590  // the actual number of bytes of randomness obtained.
  1591  // The xSleep() method causes the calling thread to sleep for at
  1592  // least the number of microseconds given.  ^The xCurrentTime()
  1593  // method returns a Julian Day Number for the current date and time as
  1594  // a floating point value.
  1595  // ^The xCurrentTimeInt64() method returns, as an integer, the Julian
  1596  // Day Number multiplied by 86400000 (the number of milliseconds in
  1597  // a 24-hour day).
  1598  // ^SQLite will use the xCurrentTimeInt64() method to get the current
  1599  // date and time if that method is available (if iVersion is 2 or
  1600  // greater and the function pointer is not NULL) and will fall back
  1601  // to xCurrentTime() if xCurrentTimeInt64() is unavailable.
  1602  //
  1603  // ^The xSetSystemCall(), xGetSystemCall(), and xNestSystemCall() interfaces
  1604  // are not used by the SQLite core.  These optional interfaces are provided
  1605  // by some VFSes to facilitate testing of the VFS code. By overriding
  1606  // system calls with functions under its control, a test program can
  1607  // simulate faults and error conditions that would otherwise be difficult
  1608  // or impossible to induce.  The set of system calls that can be overridden
  1609  // varies from one VFS to another, and from one version of the same VFS to the
  1610  // next.  Applications that use these interfaces must be prepared for any
  1611  // or all of these interfaces to be NULL or for their behavior to change
  1612  // from one release to the next.  Applications must not attempt to access
  1613  // any of these methods if the iVersion of the VFS is less than 3.
  1614  type sqlite3_vfs1 = struct {
  1615  	iVersion          int32
  1616  	szOsFile          int32
  1617  	mxPathname        int32
  1618  	_                 [4]byte
  1619  	pNext             uintptr
  1620  	zName             uintptr
  1621  	pAppData          uintptr
  1622  	xOpen             uintptr
  1623  	xDelete           uintptr
  1624  	xAccess           uintptr
  1625  	xFullPathname     uintptr
  1626  	xDlOpen           uintptr
  1627  	xDlError          uintptr
  1628  	xDlSym            uintptr
  1629  	xDlClose          uintptr
  1630  	xRandomness       uintptr
  1631  	xSleep            uintptr
  1632  	xCurrentTime      uintptr
  1633  	xGetLastError     uintptr
  1634  	xCurrentTimeInt64 uintptr
  1635  	xSetSystemCall    uintptr
  1636  	xGetSystemCall    uintptr
  1637  	xNextSystemCall   uintptr
  1638  } /* sqlite3.h:1387:9 */
  1639  
  1640  // CAPI3REF: OS Interface Object
  1641  //
  1642  // An instance of the sqlite3_vfs object defines the interface between
  1643  // the SQLite core and the underlying operating system.  The "vfs"
  1644  // in the name of the object stands for "virtual file system".  See
  1645  // the [VFS | VFS documentation] for further information.
  1646  //
  1647  // The VFS interface is sometimes extended by adding new methods onto
  1648  // the end.  Each time such an extension occurs, the iVersion field
  1649  // is incremented.  The iVersion value started out as 1 in
  1650  // SQLite [version 3.5.0] on [dateof:3.5.0], then increased to 2
  1651  // with SQLite [version 3.7.0] on [dateof:3.7.0], and then increased
  1652  // to 3 with SQLite [version 3.7.6] on [dateof:3.7.6].  Additional fields
  1653  // may be appended to the sqlite3_vfs object and the iVersion value
  1654  // may increase again in future versions of SQLite.
  1655  // Note that due to an oversight, the structure
  1656  // of the sqlite3_vfs object changed in the transition from
  1657  // SQLite [version 3.5.9] to [version 3.6.0] on [dateof:3.6.0]
  1658  // and yet the iVersion field was not increased.
  1659  //
  1660  // The szOsFile field is the size of the subclassed [sqlite3_file]
  1661  // structure used by this VFS.  mxPathname is the maximum length of
  1662  // a pathname in this VFS.
  1663  //
  1664  // Registered sqlite3_vfs objects are kept on a linked list formed by
  1665  // the pNext pointer.  The [sqlite3_vfs_register()]
  1666  // and [sqlite3_vfs_unregister()] interfaces manage this list
  1667  // in a thread-safe way.  The [sqlite3_vfs_find()] interface
  1668  // searches the list.  Neither the application code nor the VFS
  1669  // implementation should use the pNext pointer.
  1670  //
  1671  // The pNext field is the only field in the sqlite3_vfs
  1672  // structure that SQLite will ever modify.  SQLite will only access
  1673  // or modify this field while holding a particular static mutex.
  1674  // The application should never modify anything within the sqlite3_vfs
  1675  // object once the object has been registered.
  1676  //
  1677  // The zName field holds the name of the VFS module.  The name must
  1678  // be unique across all VFS modules.
  1679  //
  1680  // [[sqlite3_vfs.xOpen]]
  1681  // ^SQLite guarantees that the zFilename parameter to xOpen
  1682  // is either a NULL pointer or string obtained
  1683  // from xFullPathname() with an optional suffix added.
  1684  // ^If a suffix is added to the zFilename parameter, it will
  1685  // consist of a single "-" character followed by no more than
  1686  // 11 alphanumeric and/or "-" characters.
  1687  // ^SQLite further guarantees that
  1688  // the string will be valid and unchanged until xClose() is
  1689  // called. Because of the previous sentence,
  1690  // the [sqlite3_file] can safely store a pointer to the
  1691  // filename if it needs to remember the filename for some reason.
  1692  // If the zFilename parameter to xOpen is a NULL pointer then xOpen
  1693  // must invent its own temporary name for the file.  ^Whenever the
  1694  // xFilename parameter is NULL it will also be the case that the
  1695  // flags parameter will include [SQLITE_OPEN_DELETEONCLOSE].
  1696  //
  1697  // The flags argument to xOpen() includes all bits set in
  1698  // the flags argument to [sqlite3_open_v2()].  Or if [sqlite3_open()]
  1699  // or [sqlite3_open16()] is used, then flags includes at least
  1700  // [SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE].
  1701  // If xOpen() opens a file read-only then it sets *pOutFlags to
  1702  // include [SQLITE_OPEN_READONLY].  Other bits in *pOutFlags may be set.
  1703  //
  1704  // ^(SQLite will also add one of the following flags to the xOpen()
  1705  // call, depending on the object being opened:
  1706  //
  1707  // <ul>
  1708  // <li>  [SQLITE_OPEN_MAIN_DB]
  1709  // <li>  [SQLITE_OPEN_MAIN_JOURNAL]
  1710  // <li>  [SQLITE_OPEN_TEMP_DB]
  1711  // <li>  [SQLITE_OPEN_TEMP_JOURNAL]
  1712  // <li>  [SQLITE_OPEN_TRANSIENT_DB]
  1713  // <li>  [SQLITE_OPEN_SUBJOURNAL]
  1714  // <li>  [SQLITE_OPEN_SUPER_JOURNAL]
  1715  // <li>  [SQLITE_OPEN_WAL]
  1716  // </ul>)^
  1717  //
  1718  // The file I/O implementation can use the object type flags to
  1719  // change the way it deals with files.  For example, an application
  1720  // that does not care about crash recovery or rollback might make
  1721  // the open of a journal file a no-op.  Writes to this journal would
  1722  // also be no-ops, and any attempt to read the journal would return
  1723  // SQLITE_IOERR.  Or the implementation might recognize that a database
  1724  // file will be doing page-aligned sector reads and writes in a random
  1725  // order and set up its I/O subsystem accordingly.
  1726  //
  1727  // SQLite might also add one of the following flags to the xOpen method:
  1728  //
  1729  // <ul>
  1730  // <li> [SQLITE_OPEN_DELETEONCLOSE]
  1731  // <li> [SQLITE_OPEN_EXCLUSIVE]
  1732  // </ul>
  1733  //
  1734  // The [SQLITE_OPEN_DELETEONCLOSE] flag means the file should be
  1735  // deleted when it is closed.  ^The [SQLITE_OPEN_DELETEONCLOSE]
  1736  // will be set for TEMP databases and their journals, transient
  1737  // databases, and subjournals.
  1738  //
  1739  // ^The [SQLITE_OPEN_EXCLUSIVE] flag is always used in conjunction
  1740  // with the [SQLITE_OPEN_CREATE] flag, which are both directly
  1741  // analogous to the O_EXCL and O_CREAT flags of the POSIX open()
  1742  // API.  The SQLITE_OPEN_EXCLUSIVE flag, when paired with the
  1743  // SQLITE_OPEN_CREATE, is used to indicate that file should always
  1744  // be created, and that it is an error if it already exists.
  1745  // It is <i>not</i> used to indicate the file should be opened
  1746  // for exclusive access.
  1747  //
  1748  // ^At least szOsFile bytes of memory are allocated by SQLite
  1749  // to hold the [sqlite3_file] structure passed as the third
  1750  // argument to xOpen.  The xOpen method does not have to
  1751  // allocate the structure; it should just fill it in.  Note that
  1752  // the xOpen method must set the sqlite3_file.pMethods to either
  1753  // a valid [sqlite3_io_methods] object or to NULL.  xOpen must do
  1754  // this even if the open fails.  SQLite expects that the sqlite3_file.pMethods
  1755  // element will be valid after xOpen returns regardless of the success
  1756  // or failure of the xOpen call.
  1757  //
  1758  // [[sqlite3_vfs.xAccess]]
  1759  // ^The flags argument to xAccess() may be [SQLITE_ACCESS_EXISTS]
  1760  // to test for the existence of a file, or [SQLITE_ACCESS_READWRITE] to
  1761  // test whether a file is readable and writable, or [SQLITE_ACCESS_READ]
  1762  // to test whether a file is at least readable.  The SQLITE_ACCESS_READ
  1763  // flag is never actually used and is not implemented in the built-in
  1764  // VFSes of SQLite.  The file is named by the second argument and can be a
  1765  // directory. The xAccess method returns [SQLITE_OK] on success or some
  1766  // non-zero error code if there is an I/O error or if the name of
  1767  // the file given in the second argument is illegal.  If SQLITE_OK
  1768  // is returned, then non-zero or zero is written into *pResOut to indicate
  1769  // whether or not the file is accessible.
  1770  //
  1771  // ^SQLite will always allocate at least mxPathname+1 bytes for the
  1772  // output buffer xFullPathname.  The exact size of the output buffer
  1773  // is also passed as a parameter to both  methods. If the output buffer
  1774  // is not large enough, [SQLITE_CANTOPEN] should be returned. Since this is
  1775  // handled as a fatal error by SQLite, vfs implementations should endeavor
  1776  // to prevent this by setting mxPathname to a sufficiently large value.
  1777  //
  1778  // The xRandomness(), xSleep(), xCurrentTime(), and xCurrentTimeInt64()
  1779  // interfaces are not strictly a part of the filesystem, but they are
  1780  // included in the VFS structure for completeness.
  1781  // The xRandomness() function attempts to return nBytes bytes
  1782  // of good-quality randomness into zOut.  The return value is
  1783  // the actual number of bytes of randomness obtained.
  1784  // The xSleep() method causes the calling thread to sleep for at
  1785  // least the number of microseconds given.  ^The xCurrentTime()
  1786  // method returns a Julian Day Number for the current date and time as
  1787  // a floating point value.
  1788  // ^The xCurrentTimeInt64() method returns, as an integer, the Julian
  1789  // Day Number multiplied by 86400000 (the number of milliseconds in
  1790  // a 24-hour day).
  1791  // ^SQLite will use the xCurrentTimeInt64() method to get the current
  1792  // date and time if that method is available (if iVersion is 2 or
  1793  // greater and the function pointer is not NULL) and will fall back
  1794  // to xCurrentTime() if xCurrentTimeInt64() is unavailable.
  1795  //
  1796  // ^The xSetSystemCall(), xGetSystemCall(), and xNestSystemCall() interfaces
  1797  // are not used by the SQLite core.  These optional interfaces are provided
  1798  // by some VFSes to facilitate testing of the VFS code. By overriding
  1799  // system calls with functions under its control, a test program can
  1800  // simulate faults and error conditions that would otherwise be difficult
  1801  // or impossible to induce.  The set of system calls that can be overridden
  1802  // varies from one VFS to another, and from one version of the same VFS to the
  1803  // next.  Applications that use these interfaces must be prepared for any
  1804  // or all of these interfaces to be NULL or for their behavior to change
  1805  // from one release to the next.  Applications must not attempt to access
  1806  // any of these methods if the iVersion of the VFS is less than 3.
  1807  type sqlite3_vfs = sqlite3_vfs1    /* sqlite3.h:1387:28 */
  1808  type sqlite3_syscall_ptr = uintptr /* sqlite3.h:1388:14 */
  1809  
  1810  // CAPI3REF: Memory Allocation Routines
  1811  //
  1812  // An instance of this object defines the interface between SQLite
  1813  // and low-level memory allocation routines.
  1814  //
  1815  // This object is used in only one place in the SQLite interface.
  1816  // A pointer to an instance of this object is the argument to
  1817  // [sqlite3_config()] when the configuration option is
  1818  // [SQLITE_CONFIG_MALLOC] or [SQLITE_CONFIG_GETMALLOC].
  1819  // By creating an instance of this object
  1820  // and passing it to [sqlite3_config]([SQLITE_CONFIG_MALLOC])
  1821  // during configuration, an application can specify an alternative
  1822  // memory allocation subsystem for SQLite to use for all of its
  1823  // dynamic memory needs.
  1824  //
  1825  // Note that SQLite comes with several [built-in memory allocators]
  1826  // that are perfectly adequate for the overwhelming majority of applications
  1827  // and that this object is only useful to a tiny minority of applications
  1828  // with specialized memory allocation requirements.  This object is
  1829  // also used during testing of SQLite in order to specify an alternative
  1830  // memory allocator that simulates memory out-of-memory conditions in
  1831  // order to verify that SQLite recovers gracefully from such
  1832  // conditions.
  1833  //
  1834  // The xMalloc, xRealloc, and xFree methods must work like the
  1835  // malloc(), realloc() and free() functions from the standard C library.
  1836  // ^SQLite guarantees that the second argument to
  1837  // xRealloc is always a value returned by a prior call to xRoundup.
  1838  //
  1839  // xSize should return the allocated size of a memory allocation
  1840  // previously obtained from xMalloc or xRealloc.  The allocated size
  1841  // is always at least as big as the requested size but may be larger.
  1842  //
  1843  // The xRoundup method returns what would be the allocated size of
  1844  // a memory allocation given a particular requested size.  Most memory
  1845  // allocators round up memory allocations at least to the next multiple
  1846  // of 8.  Some allocators round up to a larger multiple or to a power of 2.
  1847  // Every memory allocation request coming in through [sqlite3_malloc()]
  1848  // or [sqlite3_realloc()] first calls xRoundup.  If xRoundup returns 0,
  1849  // that causes the corresponding memory allocation to fail.
  1850  //
  1851  // The xInit method initializes the memory allocator.  For example,
  1852  // it might allocate any required mutexes or initialize internal data
  1853  // structures.  The xShutdown method is invoked (indirectly) by
  1854  // [sqlite3_shutdown()] and should deallocate any resources acquired
  1855  // by xInit.  The pAppData pointer is used as the only parameter to
  1856  // xInit and xShutdown.
  1857  //
  1858  // SQLite holds the [SQLITE_MUTEX_STATIC_MAIN] mutex when it invokes
  1859  // the xInit method, so the xInit method need not be threadsafe.  The
  1860  // xShutdown method is only called from [sqlite3_shutdown()] so it does
  1861  // not need to be threadsafe either.  For all other methods, SQLite
  1862  // holds the [SQLITE_MUTEX_STATIC_MEM] mutex as long as the
  1863  // [SQLITE_CONFIG_MEMSTATUS] configuration option is turned on (which
  1864  // it is by default) and so the methods are automatically serialized.
  1865  // However, if [SQLITE_CONFIG_MEMSTATUS] is disabled, then the other
  1866  // methods must be threadsafe or else make their own arrangements for
  1867  // serialization.
  1868  //
  1869  // SQLite will never invoke xInit() more than once without an intervening
  1870  // call to xShutdown().
  1871  type sqlite3_mem_methods1 = struct {
  1872  	xMalloc   uintptr
  1873  	xFree     uintptr
  1874  	xRealloc  uintptr
  1875  	xSize     uintptr
  1876  	xRoundup  uintptr
  1877  	xInit     uintptr
  1878  	xShutdown uintptr
  1879  	pAppData  uintptr
  1880  } /* sqlite3.h:1685:9 */
  1881  
  1882  // CAPI3REF: Memory Allocation Routines
  1883  //
  1884  // An instance of this object defines the interface between SQLite
  1885  // and low-level memory allocation routines.
  1886  //
  1887  // This object is used in only one place in the SQLite interface.
  1888  // A pointer to an instance of this object is the argument to
  1889  // [sqlite3_config()] when the configuration option is
  1890  // [SQLITE_CONFIG_MALLOC] or [SQLITE_CONFIG_GETMALLOC].
  1891  // By creating an instance of this object
  1892  // and passing it to [sqlite3_config]([SQLITE_CONFIG_MALLOC])
  1893  // during configuration, an application can specify an alternative
  1894  // memory allocation subsystem for SQLite to use for all of its
  1895  // dynamic memory needs.
  1896  //
  1897  // Note that SQLite comes with several [built-in memory allocators]
  1898  // that are perfectly adequate for the overwhelming majority of applications
  1899  // and that this object is only useful to a tiny minority of applications
  1900  // with specialized memory allocation requirements.  This object is
  1901  // also used during testing of SQLite in order to specify an alternative
  1902  // memory allocator that simulates memory out-of-memory conditions in
  1903  // order to verify that SQLite recovers gracefully from such
  1904  // conditions.
  1905  //
  1906  // The xMalloc, xRealloc, and xFree methods must work like the
  1907  // malloc(), realloc() and free() functions from the standard C library.
  1908  // ^SQLite guarantees that the second argument to
  1909  // xRealloc is always a value returned by a prior call to xRoundup.
  1910  //
  1911  // xSize should return the allocated size of a memory allocation
  1912  // previously obtained from xMalloc or xRealloc.  The allocated size
  1913  // is always at least as big as the requested size but may be larger.
  1914  //
  1915  // The xRoundup method returns what would be the allocated size of
  1916  // a memory allocation given a particular requested size.  Most memory
  1917  // allocators round up memory allocations at least to the next multiple
  1918  // of 8.  Some allocators round up to a larger multiple or to a power of 2.
  1919  // Every memory allocation request coming in through [sqlite3_malloc()]
  1920  // or [sqlite3_realloc()] first calls xRoundup.  If xRoundup returns 0,
  1921  // that causes the corresponding memory allocation to fail.
  1922  //
  1923  // The xInit method initializes the memory allocator.  For example,
  1924  // it might allocate any required mutexes or initialize internal data
  1925  // structures.  The xShutdown method is invoked (indirectly) by
  1926  // [sqlite3_shutdown()] and should deallocate any resources acquired
  1927  // by xInit.  The pAppData pointer is used as the only parameter to
  1928  // xInit and xShutdown.
  1929  //
  1930  // SQLite holds the [SQLITE_MUTEX_STATIC_MAIN] mutex when it invokes
  1931  // the xInit method, so the xInit method need not be threadsafe.  The
  1932  // xShutdown method is only called from [sqlite3_shutdown()] so it does
  1933  // not need to be threadsafe either.  For all other methods, SQLite
  1934  // holds the [SQLITE_MUTEX_STATIC_MEM] mutex as long as the
  1935  // [SQLITE_CONFIG_MEMSTATUS] configuration option is turned on (which
  1936  // it is by default) and so the methods are automatically serialized.
  1937  // However, if [SQLITE_CONFIG_MEMSTATUS] is disabled, then the other
  1938  // methods must be threadsafe or else make their own arrangements for
  1939  // serialization.
  1940  //
  1941  // SQLite will never invoke xInit() more than once without an intervening
  1942  // call to xShutdown().
  1943  type sqlite3_mem_methods = sqlite3_mem_methods1 /* sqlite3.h:1685:36 */
  1944  
  1945  // CAPI3REF: Constants Defining Special Destructor Behavior
  1946  //
  1947  // These are special values for the destructor that is passed in as the
  1948  // final argument to routines like [sqlite3_result_blob()].  ^If the destructor
  1949  // argument is SQLITE_STATIC, it means that the content pointer is constant
  1950  // and will never change.  It does not need to be destroyed.  ^The
  1951  // SQLITE_TRANSIENT value means that the content will likely change in
  1952  // the near future and that SQLite should make its own private copy of
  1953  // the content before returning.
  1954  //
  1955  // The typedef is necessary to work around problems in certain
  1956  // C++ compilers.
  1957  type sqlite3_destructor_type = uintptr /* sqlite3.h:5665:14 */
  1958  
  1959  // The interface to the virtual-table mechanism is currently considered
  1960  // to be experimental.  The interface might change in incompatible ways.
  1961  // If this is a problem for you, do not use the interface at this time.
  1962  //
  1963  // When the virtual-table mechanism stabilizes, we will declare the
  1964  // interface fixed, support it indefinitely, and remove this comment.
  1965  
  1966  // Structures used by the virtual table interface
  1967  type sqlite3_vtab1 = struct {
  1968  	pModule uintptr
  1969  	nRef    int32
  1970  	_       [4]byte
  1971  	zErrMsg uintptr
  1972  } /* sqlite3.h:6784:9 */
  1973  
  1974  // The interface to the virtual-table mechanism is currently considered
  1975  // to be experimental.  The interface might change in incompatible ways.
  1976  // If this is a problem for you, do not use the interface at this time.
  1977  //
  1978  // When the virtual-table mechanism stabilizes, we will declare the
  1979  // interface fixed, support it indefinitely, and remove this comment.
  1980  
  1981  // Structures used by the virtual table interface
  1982  type sqlite3_vtab = sqlite3_vtab1 /* sqlite3.h:6784:29 */
  1983  type sqlite3_index_info1 = struct {
  1984  	nConstraint      int32
  1985  	_                [4]byte
  1986  	aConstraint      uintptr
  1987  	nOrderBy         int32
  1988  	_                [4]byte
  1989  	aOrderBy         uintptr
  1990  	aConstraintUsage uintptr
  1991  	idxNum           int32
  1992  	_                [4]byte
  1993  	idxStr           uintptr
  1994  	needToFreeIdxStr int32
  1995  	orderByConsumed  int32
  1996  	estimatedCost    float64
  1997  	estimatedRows    sqlite3_int64
  1998  	idxFlags         int32
  1999  	_                [4]byte
  2000  	colUsed          sqlite3_uint64
  2001  } /* sqlite3.h:6785:9 */
  2002  
  2003  type sqlite3_index_info = sqlite3_index_info1       /* sqlite3.h:6785:35 */
  2004  type sqlite3_vtab_cursor1 = struct{ pVtab uintptr } /* sqlite3.h:6786:9 */
  2005  
  2006  type sqlite3_vtab_cursor = sqlite3_vtab_cursor1 /* sqlite3.h:6786:36 */
  2007  type sqlite3_module1 = struct {
  2008  	iVersion      int32
  2009  	_             [4]byte
  2010  	xCreate       uintptr
  2011  	xConnect      uintptr
  2012  	xBestIndex    uintptr
  2013  	xDisconnect   uintptr
  2014  	xDestroy      uintptr
  2015  	xOpen         uintptr
  2016  	xClose        uintptr
  2017  	xFilter       uintptr
  2018  	xNext         uintptr
  2019  	xEof          uintptr
  2020  	xColumn       uintptr
  2021  	xRowid        uintptr
  2022  	xUpdate       uintptr
  2023  	xBegin        uintptr
  2024  	xSync         uintptr
  2025  	xCommit       uintptr
  2026  	xRollback     uintptr
  2027  	xFindFunction uintptr
  2028  	xRename       uintptr
  2029  	xSavepoint    uintptr
  2030  	xRelease      uintptr
  2031  	xRollbackTo   uintptr
  2032  	xShadowName   uintptr
  2033  } /* sqlite3.h:6784:9 */
  2034  
  2035  type sqlite3_module = sqlite3_module1 /* sqlite3.h:6787:31 */
  2036  
  2037  // CAPI3REF: Virtual Table Indexing Information
  2038  // KEYWORDS: sqlite3_index_info
  2039  //
  2040  // The sqlite3_index_info structure and its substructures is used as part
  2041  // of the [virtual table] interface to
  2042  // pass information into and receive the reply from the [xBestIndex]
  2043  // method of a [virtual table module].  The fields under **Inputs** are the
  2044  // inputs to xBestIndex and are read-only.  xBestIndex inserts its
  2045  // results into the **Outputs** fields.
  2046  //
  2047  // ^(The aConstraint[] array records WHERE clause constraints of the form:
  2048  //
  2049  // <blockquote>column OP expr</blockquote>
  2050  //
  2051  // where OP is =, &lt;, &lt;=, &gt;, or &gt;=.)^  ^(The particular operator is
  2052  // stored in aConstraint[].op using one of the
  2053  // [SQLITE_INDEX_CONSTRAINT_EQ | SQLITE_INDEX_CONSTRAINT_ values].)^
  2054  // ^(The index of the column is stored in
  2055  // aConstraint[].iColumn.)^  ^(aConstraint[].usable is TRUE if the
  2056  // expr on the right-hand side can be evaluated (and thus the constraint
  2057  // is usable) and false if it cannot.)^
  2058  //
  2059  // ^The optimizer automatically inverts terms of the form "expr OP column"
  2060  // and makes other simplifications to the WHERE clause in an attempt to
  2061  // get as many WHERE clause terms into the form shown above as possible.
  2062  // ^The aConstraint[] array only reports WHERE clause terms that are
  2063  // relevant to the particular virtual table being queried.
  2064  //
  2065  // ^Information about the ORDER BY clause is stored in aOrderBy[].
  2066  // ^Each term of aOrderBy records a column of the ORDER BY clause.
  2067  //
  2068  // The colUsed field indicates which columns of the virtual table may be
  2069  // required by the current scan. Virtual table columns are numbered from
  2070  // zero in the order in which they appear within the CREATE TABLE statement
  2071  // passed to sqlite3_declare_vtab(). For the first 63 columns (columns 0-62),
  2072  // the corresponding bit is set within the colUsed mask if the column may be
  2073  // required by SQLite. If the table has at least 64 columns and any column
  2074  // to the right of the first 63 is required, then bit 63 of colUsed is also
  2075  // set. In other words, column iCol may be required if the expression
  2076  // (colUsed & ((sqlite3_uint64)1 << (iCol>=63 ? 63 : iCol))) evaluates to
  2077  // non-zero.
  2078  //
  2079  // The [xBestIndex] method must fill aConstraintUsage[] with information
  2080  // about what parameters to pass to xFilter.  ^If argvIndex>0 then
  2081  // the right-hand side of the corresponding aConstraint[] is evaluated
  2082  // and becomes the argvIndex-th entry in argv.  ^(If aConstraintUsage[].omit
  2083  // is true, then the constraint is assumed to be fully handled by the
  2084  // virtual table and might not be checked again by the byte code.)^ ^(The
  2085  // aConstraintUsage[].omit flag is an optimization hint. When the omit flag
  2086  // is left in its default setting of false, the constraint will always be
  2087  // checked separately in byte code.  If the omit flag is change to true, then
  2088  // the constraint may or may not be checked in byte code.  In other words,
  2089  // when the omit flag is true there is no guarantee that the constraint will
  2090  // not be checked again using byte code.)^
  2091  //
  2092  // ^The idxNum and idxPtr values are recorded and passed into the
  2093  // [xFilter] method.
  2094  // ^[sqlite3_free()] is used to free idxPtr if and only if
  2095  // needToFreeIdxPtr is true.
  2096  //
  2097  // ^The orderByConsumed means that output from [xFilter]/[xNext] will occur in
  2098  // the correct order to satisfy the ORDER BY clause so that no separate
  2099  // sorting step is required.
  2100  //
  2101  // ^The estimatedCost value is an estimate of the cost of a particular
  2102  // strategy. A cost of N indicates that the cost of the strategy is similar
  2103  // to a linear scan of an SQLite table with N rows. A cost of log(N)
  2104  // indicates that the expense of the operation is similar to that of a
  2105  // binary search on a unique indexed field of an SQLite table with N rows.
  2106  //
  2107  // ^The estimatedRows value is an estimate of the number of rows that
  2108  // will be returned by the strategy.
  2109  //
  2110  // The xBestIndex method may optionally populate the idxFlags field with a
  2111  // mask of SQLITE_INDEX_SCAN_* flags. Currently there is only one such flag -
  2112  // SQLITE_INDEX_SCAN_UNIQUE. If the xBestIndex method sets this flag, SQLite
  2113  // assumes that the strategy may visit at most one row.
  2114  //
  2115  // Additionally, if xBestIndex sets the SQLITE_INDEX_SCAN_UNIQUE flag, then
  2116  // SQLite also assumes that if a call to the xUpdate() method is made as
  2117  // part of the same statement to delete or update a virtual table row and the
  2118  // implementation returns SQLITE_CONSTRAINT, then there is no need to rollback
  2119  // any database changes. In other words, if the xUpdate() returns
  2120  // SQLITE_CONSTRAINT, the database contents must be exactly as they were
  2121  // before xUpdate was called. By contrast, if SQLITE_INDEX_SCAN_UNIQUE is not
  2122  // set and xUpdate returns SQLITE_CONSTRAINT, any database changes made by
  2123  // the xUpdate method are automatically rolled back by SQLite.
  2124  //
  2125  // IMPORTANT: The estimatedRows field was added to the sqlite3_index_info
  2126  // structure for SQLite [version 3.8.2] ([dateof:3.8.2]).
  2127  // If a virtual table extension is
  2128  // used with an SQLite version earlier than 3.8.2, the results of attempting
  2129  // to read or write the estimatedRows field are undefined (but are likely
  2130  // to include crashing the application). The estimatedRows field should
  2131  // therefore only be used if [sqlite3_libversion_number()] returns a
  2132  // value greater than or equal to 3008002. Similarly, the idxFlags field
  2133  // was added for [version 3.9.0] ([dateof:3.9.0]).
  2134  // It may therefore only be used if
  2135  // sqlite3_libversion_number() returns a value greater than or equal to
  2136  // 3009000.
  2137  type sqlite3_index_constraint = struct {
  2138  	iColumn     int32
  2139  	op          uint8
  2140  	usable      uint8
  2141  	_           [2]byte
  2142  	iTermOffset int32
  2143  } /* sqlite3.h:6785:9 */
  2144  
  2145  // CAPI3REF: Virtual Table Indexing Information
  2146  // KEYWORDS: sqlite3_index_info
  2147  //
  2148  // The sqlite3_index_info structure and its substructures is used as part
  2149  // of the [virtual table] interface to
  2150  // pass information into and receive the reply from the [xBestIndex]
  2151  // method of a [virtual table module].  The fields under **Inputs** are the
  2152  // inputs to xBestIndex and are read-only.  xBestIndex inserts its
  2153  // results into the **Outputs** fields.
  2154  //
  2155  // ^(The aConstraint[] array records WHERE clause constraints of the form:
  2156  //
  2157  // <blockquote>column OP expr</blockquote>
  2158  //
  2159  // where OP is =, &lt;, &lt;=, &gt;, or &gt;=.)^  ^(The particular operator is
  2160  // stored in aConstraint[].op using one of the
  2161  // [SQLITE_INDEX_CONSTRAINT_EQ | SQLITE_INDEX_CONSTRAINT_ values].)^
  2162  // ^(The index of the column is stored in
  2163  // aConstraint[].iColumn.)^  ^(aConstraint[].usable is TRUE if the
  2164  // expr on the right-hand side can be evaluated (and thus the constraint
  2165  // is usable) and false if it cannot.)^
  2166  //
  2167  // ^The optimizer automatically inverts terms of the form "expr OP column"
  2168  // and makes other simplifications to the WHERE clause in an attempt to
  2169  // get as many WHERE clause terms into the form shown above as possible.
  2170  // ^The aConstraint[] array only reports WHERE clause terms that are
  2171  // relevant to the particular virtual table being queried.
  2172  //
  2173  // ^Information about the ORDER BY clause is stored in aOrderBy[].
  2174  // ^Each term of aOrderBy records a column of the ORDER BY clause.
  2175  //
  2176  // The colUsed field indicates which columns of the virtual table may be
  2177  // required by the current scan. Virtual table columns are numbered from
  2178  // zero in the order in which they appear within the CREATE TABLE statement
  2179  // passed to sqlite3_declare_vtab(). For the first 63 columns (columns 0-62),
  2180  // the corresponding bit is set within the colUsed mask if the column may be
  2181  // required by SQLite. If the table has at least 64 columns and any column
  2182  // to the right of the first 63 is required, then bit 63 of colUsed is also
  2183  // set. In other words, column iCol may be required if the expression
  2184  // (colUsed & ((sqlite3_uint64)1 << (iCol>=63 ? 63 : iCol))) evaluates to
  2185  // non-zero.
  2186  //
  2187  // The [xBestIndex] method must fill aConstraintUsage[] with information
  2188  // about what parameters to pass to xFilter.  ^If argvIndex>0 then
  2189  // the right-hand side of the corresponding aConstraint[] is evaluated
  2190  // and becomes the argvIndex-th entry in argv.  ^(If aConstraintUsage[].omit
  2191  // is true, then the constraint is assumed to be fully handled by the
  2192  // virtual table and might not be checked again by the byte code.)^ ^(The
  2193  // aConstraintUsage[].omit flag is an optimization hint. When the omit flag
  2194  // is left in its default setting of false, the constraint will always be
  2195  // checked separately in byte code.  If the omit flag is change to true, then
  2196  // the constraint may or may not be checked in byte code.  In other words,
  2197  // when the omit flag is true there is no guarantee that the constraint will
  2198  // not be checked again using byte code.)^
  2199  //
  2200  // ^The idxNum and idxPtr values are recorded and passed into the
  2201  // [xFilter] method.
  2202  // ^[sqlite3_free()] is used to free idxPtr if and only if
  2203  // needToFreeIdxPtr is true.
  2204  //
  2205  // ^The orderByConsumed means that output from [xFilter]/[xNext] will occur in
  2206  // the correct order to satisfy the ORDER BY clause so that no separate
  2207  // sorting step is required.
  2208  //
  2209  // ^The estimatedCost value is an estimate of the cost of a particular
  2210  // strategy. A cost of N indicates that the cost of the strategy is similar
  2211  // to a linear scan of an SQLite table with N rows. A cost of log(N)
  2212  // indicates that the expense of the operation is similar to that of a
  2213  // binary search on a unique indexed field of an SQLite table with N rows.
  2214  //
  2215  // ^The estimatedRows value is an estimate of the number of rows that
  2216  // will be returned by the strategy.
  2217  //
  2218  // The xBestIndex method may optionally populate the idxFlags field with a
  2219  // mask of SQLITE_INDEX_SCAN_* flags. Currently there is only one such flag -
  2220  // SQLITE_INDEX_SCAN_UNIQUE. If the xBestIndex method sets this flag, SQLite
  2221  // assumes that the strategy may visit at most one row.
  2222  //
  2223  // Additionally, if xBestIndex sets the SQLITE_INDEX_SCAN_UNIQUE flag, then
  2224  // SQLite also assumes that if a call to the xUpdate() method is made as
  2225  // part of the same statement to delete or update a virtual table row and the
  2226  // implementation returns SQLITE_CONSTRAINT, then there is no need to rollback
  2227  // any database changes. In other words, if the xUpdate() returns
  2228  // SQLITE_CONSTRAINT, the database contents must be exactly as they were
  2229  // before xUpdate was called. By contrast, if SQLITE_INDEX_SCAN_UNIQUE is not
  2230  // set and xUpdate returns SQLITE_CONSTRAINT, any database changes made by
  2231  // the xUpdate method are automatically rolled back by SQLite.
  2232  //
  2233  // IMPORTANT: The estimatedRows field was added to the sqlite3_index_info
  2234  // structure for SQLite [version 3.8.2] ([dateof:3.8.2]).
  2235  // If a virtual table extension is
  2236  // used with an SQLite version earlier than 3.8.2, the results of attempting
  2237  // to read or write the estimatedRows field are undefined (but are likely
  2238  // to include crashing the application). The estimatedRows field should
  2239  // therefore only be used if [sqlite3_libversion_number()] returns a
  2240  // value greater than or equal to 3008002. Similarly, the idxFlags field
  2241  // was added for [version 3.9.0] ([dateof:3.9.0]).
  2242  // It may therefore only be used if
  2243  // sqlite3_libversion_number() returns a value greater than or equal to
  2244  // 3009000.
  2245  type sqlite3_index_orderby = struct {
  2246  	iColumn int32
  2247  	desc    uint8
  2248  	_       [3]byte
  2249  } /* sqlite3.h:6785:9 */
  2250  
  2251  // CAPI3REF: Virtual Table Indexing Information
  2252  // KEYWORDS: sqlite3_index_info
  2253  //
  2254  // The sqlite3_index_info structure and its substructures is used as part
  2255  // of the [virtual table] interface to
  2256  // pass information into and receive the reply from the [xBestIndex]
  2257  // method of a [virtual table module].  The fields under **Inputs** are the
  2258  // inputs to xBestIndex and are read-only.  xBestIndex inserts its
  2259  // results into the **Outputs** fields.
  2260  //
  2261  // ^(The aConstraint[] array records WHERE clause constraints of the form:
  2262  //
  2263  // <blockquote>column OP expr</blockquote>
  2264  //
  2265  // where OP is =, &lt;, &lt;=, &gt;, or &gt;=.)^  ^(The particular operator is
  2266  // stored in aConstraint[].op using one of the
  2267  // [SQLITE_INDEX_CONSTRAINT_EQ | SQLITE_INDEX_CONSTRAINT_ values].)^
  2268  // ^(The index of the column is stored in
  2269  // aConstraint[].iColumn.)^  ^(aConstraint[].usable is TRUE if the
  2270  // expr on the right-hand side can be evaluated (and thus the constraint
  2271  // is usable) and false if it cannot.)^
  2272  //
  2273  // ^The optimizer automatically inverts terms of the form "expr OP column"
  2274  // and makes other simplifications to the WHERE clause in an attempt to
  2275  // get as many WHERE clause terms into the form shown above as possible.
  2276  // ^The aConstraint[] array only reports WHERE clause terms that are
  2277  // relevant to the particular virtual table being queried.
  2278  //
  2279  // ^Information about the ORDER BY clause is stored in aOrderBy[].
  2280  // ^Each term of aOrderBy records a column of the ORDER BY clause.
  2281  //
  2282  // The colUsed field indicates which columns of the virtual table may be
  2283  // required by the current scan. Virtual table columns are numbered from
  2284  // zero in the order in which they appear within the CREATE TABLE statement
  2285  // passed to sqlite3_declare_vtab(). For the first 63 columns (columns 0-62),
  2286  // the corresponding bit is set within the colUsed mask if the column may be
  2287  // required by SQLite. If the table has at least 64 columns and any column
  2288  // to the right of the first 63 is required, then bit 63 of colUsed is also
  2289  // set. In other words, column iCol may be required if the expression
  2290  // (colUsed & ((sqlite3_uint64)1 << (iCol>=63 ? 63 : iCol))) evaluates to
  2291  // non-zero.
  2292  //
  2293  // The [xBestIndex] method must fill aConstraintUsage[] with information
  2294  // about what parameters to pass to xFilter.  ^If argvIndex>0 then
  2295  // the right-hand side of the corresponding aConstraint[] is evaluated
  2296  // and becomes the argvIndex-th entry in argv.  ^(If aConstraintUsage[].omit
  2297  // is true, then the constraint is assumed to be fully handled by the
  2298  // virtual table and might not be checked again by the byte code.)^ ^(The
  2299  // aConstraintUsage[].omit flag is an optimization hint. When the omit flag
  2300  // is left in its default setting of false, the constraint will always be
  2301  // checked separately in byte code.  If the omit flag is change to true, then
  2302  // the constraint may or may not be checked in byte code.  In other words,
  2303  // when the omit flag is true there is no guarantee that the constraint will
  2304  // not be checked again using byte code.)^
  2305  //
  2306  // ^The idxNum and idxPtr values are recorded and passed into the
  2307  // [xFilter] method.
  2308  // ^[sqlite3_free()] is used to free idxPtr if and only if
  2309  // needToFreeIdxPtr is true.
  2310  //
  2311  // ^The orderByConsumed means that output from [xFilter]/[xNext] will occur in
  2312  // the correct order to satisfy the ORDER BY clause so that no separate
  2313  // sorting step is required.
  2314  //
  2315  // ^The estimatedCost value is an estimate of the cost of a particular
  2316  // strategy. A cost of N indicates that the cost of the strategy is similar
  2317  // to a linear scan of an SQLite table with N rows. A cost of log(N)
  2318  // indicates that the expense of the operation is similar to that of a
  2319  // binary search on a unique indexed field of an SQLite table with N rows.
  2320  //
  2321  // ^The estimatedRows value is an estimate of the number of rows that
  2322  // will be returned by the strategy.
  2323  //
  2324  // The xBestIndex method may optionally populate the idxFlags field with a
  2325  // mask of SQLITE_INDEX_SCAN_* flags. Currently there is only one such flag -
  2326  // SQLITE_INDEX_SCAN_UNIQUE. If the xBestIndex method sets this flag, SQLite
  2327  // assumes that the strategy may visit at most one row.
  2328  //
  2329  // Additionally, if xBestIndex sets the SQLITE_INDEX_SCAN_UNIQUE flag, then
  2330  // SQLite also assumes that if a call to the xUpdate() method is made as
  2331  // part of the same statement to delete or update a virtual table row and the
  2332  // implementation returns SQLITE_CONSTRAINT, then there is no need to rollback
  2333  // any database changes. In other words, if the xUpdate() returns
  2334  // SQLITE_CONSTRAINT, the database contents must be exactly as they were
  2335  // before xUpdate was called. By contrast, if SQLITE_INDEX_SCAN_UNIQUE is not
  2336  // set and xUpdate returns SQLITE_CONSTRAINT, any database changes made by
  2337  // the xUpdate method are automatically rolled back by SQLite.
  2338  //
  2339  // IMPORTANT: The estimatedRows field was added to the sqlite3_index_info
  2340  // structure for SQLite [version 3.8.2] ([dateof:3.8.2]).
  2341  // If a virtual table extension is
  2342  // used with an SQLite version earlier than 3.8.2, the results of attempting
  2343  // to read or write the estimatedRows field are undefined (but are likely
  2344  // to include crashing the application). The estimatedRows field should
  2345  // therefore only be used if [sqlite3_libversion_number()] returns a
  2346  // value greater than or equal to 3008002. Similarly, the idxFlags field
  2347  // was added for [version 3.9.0] ([dateof:3.9.0]).
  2348  // It may therefore only be used if
  2349  // sqlite3_libversion_number() returns a value greater than or equal to
  2350  // 3009000.
  2351  type sqlite3_index_constraint_usage = struct {
  2352  	argvIndex int32
  2353  	omit      uint8
  2354  	_         [3]byte
  2355  } /* sqlite3.h:6785:9 */
  2356  
  2357  // CAPI3REF: Mutex Methods Object
  2358  //
  2359  // An instance of this structure defines the low-level routines
  2360  // used to allocate and use mutexes.
  2361  //
  2362  // Usually, the default mutex implementations provided by SQLite are
  2363  // sufficient, however the application has the option of substituting a custom
  2364  // implementation for specialized deployments or systems for which SQLite
  2365  // does not provide a suitable implementation. In this case, the application
  2366  // creates and populates an instance of this structure to pass
  2367  // to sqlite3_config() along with the [SQLITE_CONFIG_MUTEX] option.
  2368  // Additionally, an instance of this structure can be used as an
  2369  // output variable when querying the system for the current mutex
  2370  // implementation, using the [SQLITE_CONFIG_GETMUTEX] option.
  2371  //
  2372  // ^The xMutexInit method defined by this structure is invoked as
  2373  // part of system initialization by the sqlite3_initialize() function.
  2374  // ^The xMutexInit routine is called by SQLite exactly once for each
  2375  // effective call to [sqlite3_initialize()].
  2376  //
  2377  // ^The xMutexEnd method defined by this structure is invoked as
  2378  // part of system shutdown by the sqlite3_shutdown() function. The
  2379  // implementation of this method is expected to release all outstanding
  2380  // resources obtained by the mutex methods implementation, especially
  2381  // those obtained by the xMutexInit method.  ^The xMutexEnd()
  2382  // interface is invoked exactly once for each call to [sqlite3_shutdown()].
  2383  //
  2384  // ^(The remaining seven methods defined by this structure (xMutexAlloc,
  2385  // xMutexFree, xMutexEnter, xMutexTry, xMutexLeave, xMutexHeld and
  2386  // xMutexNotheld) implement the following interfaces (respectively):
  2387  //
  2388  // <ul>
  2389  //   <li>  [sqlite3_mutex_alloc()] </li>
  2390  //   <li>  [sqlite3_mutex_free()] </li>
  2391  //   <li>  [sqlite3_mutex_enter()] </li>
  2392  //   <li>  [sqlite3_mutex_try()] </li>
  2393  //   <li>  [sqlite3_mutex_leave()] </li>
  2394  //   <li>  [sqlite3_mutex_held()] </li>
  2395  //   <li>  [sqlite3_mutex_notheld()] </li>
  2396  // </ul>)^
  2397  //
  2398  // The only difference is that the public sqlite3_XXX functions enumerated
  2399  // above silently ignore any invocations that pass a NULL pointer instead
  2400  // of a valid mutex handle. The implementations of the methods defined
  2401  // by this structure are not required to handle this case. The results
  2402  // of passing a NULL pointer instead of a valid mutex handle are undefined
  2403  // (i.e. it is acceptable to provide an implementation that segfaults if
  2404  // it is passed a NULL pointer).
  2405  //
  2406  // The xMutexInit() method must be threadsafe.  It must be harmless to
  2407  // invoke xMutexInit() multiple times within the same process and without
  2408  // intervening calls to xMutexEnd().  Second and subsequent calls to
  2409  // xMutexInit() must be no-ops.
  2410  //
  2411  // xMutexInit() must not use SQLite memory allocation ([sqlite3_malloc()]
  2412  // and its associates).  Similarly, xMutexAlloc() must not use SQLite memory
  2413  // allocation for a static mutex.  ^However xMutexAlloc() may use SQLite
  2414  // memory allocation for a fast or recursive mutex.
  2415  //
  2416  // ^SQLite will invoke the xMutexEnd() method when [sqlite3_shutdown()] is
  2417  // called, but only if the prior call to xMutexInit returned SQLITE_OK.
  2418  // If xMutexInit fails in any way, it is expected to clean up after itself
  2419  // prior to returning.
  2420  type sqlite3_mutex_methods1 = struct {
  2421  	xMutexInit    uintptr
  2422  	xMutexEnd     uintptr
  2423  	xMutexAlloc   uintptr
  2424  	xMutexFree    uintptr
  2425  	xMutexEnter   uintptr
  2426  	xMutexTry     uintptr
  2427  	xMutexLeave   uintptr
  2428  	xMutexHeld    uintptr
  2429  	xMutexNotheld uintptr
  2430  } /* sqlite3.h:7619:9 */
  2431  
  2432  // CAPI3REF: Mutex Methods Object
  2433  //
  2434  // An instance of this structure defines the low-level routines
  2435  // used to allocate and use mutexes.
  2436  //
  2437  // Usually, the default mutex implementations provided by SQLite are
  2438  // sufficient, however the application has the option of substituting a custom
  2439  // implementation for specialized deployments or systems for which SQLite
  2440  // does not provide a suitable implementation. In this case, the application
  2441  // creates and populates an instance of this structure to pass
  2442  // to sqlite3_config() along with the [SQLITE_CONFIG_MUTEX] option.
  2443  // Additionally, an instance of this structure can be used as an
  2444  // output variable when querying the system for the current mutex
  2445  // implementation, using the [SQLITE_CONFIG_GETMUTEX] option.
  2446  //
  2447  // ^The xMutexInit method defined by this structure is invoked as
  2448  // part of system initialization by the sqlite3_initialize() function.
  2449  // ^The xMutexInit routine is called by SQLite exactly once for each
  2450  // effective call to [sqlite3_initialize()].
  2451  //
  2452  // ^The xMutexEnd method defined by this structure is invoked as
  2453  // part of system shutdown by the sqlite3_shutdown() function. The
  2454  // implementation of this method is expected to release all outstanding
  2455  // resources obtained by the mutex methods implementation, especially
  2456  // those obtained by the xMutexInit method.  ^The xMutexEnd()
  2457  // interface is invoked exactly once for each call to [sqlite3_shutdown()].
  2458  //
  2459  // ^(The remaining seven methods defined by this structure (xMutexAlloc,
  2460  // xMutexFree, xMutexEnter, xMutexTry, xMutexLeave, xMutexHeld and
  2461  // xMutexNotheld) implement the following interfaces (respectively):
  2462  //
  2463  // <ul>
  2464  //   <li>  [sqlite3_mutex_alloc()] </li>
  2465  //   <li>  [sqlite3_mutex_free()] </li>
  2466  //   <li>  [sqlite3_mutex_enter()] </li>
  2467  //   <li>  [sqlite3_mutex_try()] </li>
  2468  //   <li>  [sqlite3_mutex_leave()] </li>
  2469  //   <li>  [sqlite3_mutex_held()] </li>
  2470  //   <li>  [sqlite3_mutex_notheld()] </li>
  2471  // </ul>)^
  2472  //
  2473  // The only difference is that the public sqlite3_XXX functions enumerated
  2474  // above silently ignore any invocations that pass a NULL pointer instead
  2475  // of a valid mutex handle. The implementations of the methods defined
  2476  // by this structure are not required to handle this case. The results
  2477  // of passing a NULL pointer instead of a valid mutex handle are undefined
  2478  // (i.e. it is acceptable to provide an implementation that segfaults if
  2479  // it is passed a NULL pointer).
  2480  //
  2481  // The xMutexInit() method must be threadsafe.  It must be harmless to
  2482  // invoke xMutexInit() multiple times within the same process and without
  2483  // intervening calls to xMutexEnd().  Second and subsequent calls to
  2484  // xMutexInit() must be no-ops.
  2485  //
  2486  // xMutexInit() must not use SQLite memory allocation ([sqlite3_malloc()]
  2487  // and its associates).  Similarly, xMutexAlloc() must not use SQLite memory
  2488  // allocation for a static mutex.  ^However xMutexAlloc() may use SQLite
  2489  // memory allocation for a fast or recursive mutex.
  2490  //
  2491  // ^SQLite will invoke the xMutexEnd() method when [sqlite3_shutdown()] is
  2492  // called, but only if the prior call to xMutexInit returned SQLITE_OK.
  2493  // If xMutexInit fails in any way, it is expected to clean up after itself
  2494  // prior to returning.
  2495  type sqlite3_mutex_methods = sqlite3_mutex_methods1 /* sqlite3.h:7619:38 */
  2496  
  2497  // CAPI3REF: Custom Page Cache Object
  2498  //
  2499  // The sqlite3_pcache_page object represents a single page in the
  2500  // page cache.  The page cache will allocate instances of this
  2501  // object.  Various methods of the page cache use pointers to instances
  2502  // of this object as parameters or as their return value.
  2503  //
  2504  // See [sqlite3_pcache_methods2] for additional information.
  2505  type sqlite3_pcache_page1 = struct {
  2506  	pBuf   uintptr
  2507  	pExtra uintptr
  2508  } /* sqlite3.h:8375:9 */
  2509  
  2510  // CAPI3REF: Custom Page Cache Object
  2511  //
  2512  // The sqlite3_pcache_page object represents a single page in the
  2513  // page cache.  The page cache will allocate instances of this
  2514  // object.  Various methods of the page cache use pointers to instances
  2515  // of this object as parameters or as their return value.
  2516  //
  2517  // See [sqlite3_pcache_methods2] for additional information.
  2518  type sqlite3_pcache_page = sqlite3_pcache_page1 /* sqlite3.h:8375:36 */
  2519  
  2520  // CAPI3REF: Application Defined Page Cache.
  2521  // KEYWORDS: {page cache}
  2522  //
  2523  // ^(The [sqlite3_config]([SQLITE_CONFIG_PCACHE2], ...) interface can
  2524  // register an alternative page cache implementation by passing in an
  2525  // instance of the sqlite3_pcache_methods2 structure.)^
  2526  // In many applications, most of the heap memory allocated by
  2527  // SQLite is used for the page cache.
  2528  // By implementing a
  2529  // custom page cache using this API, an application can better control
  2530  // the amount of memory consumed by SQLite, the way in which
  2531  // that memory is allocated and released, and the policies used to
  2532  // determine exactly which parts of a database file are cached and for
  2533  // how long.
  2534  //
  2535  // The alternative page cache mechanism is an
  2536  // extreme measure that is only needed by the most demanding applications.
  2537  // The built-in page cache is recommended for most uses.
  2538  //
  2539  // ^(The contents of the sqlite3_pcache_methods2 structure are copied to an
  2540  // internal buffer by SQLite within the call to [sqlite3_config].  Hence
  2541  // the application may discard the parameter after the call to
  2542  // [sqlite3_config()] returns.)^
  2543  //
  2544  // [[the xInit() page cache method]]
  2545  // ^(The xInit() method is called once for each effective
  2546  // call to [sqlite3_initialize()])^
  2547  // (usually only once during the lifetime of the process). ^(The xInit()
  2548  // method is passed a copy of the sqlite3_pcache_methods2.pArg value.)^
  2549  // The intent of the xInit() method is to set up global data structures
  2550  // required by the custom page cache implementation.
  2551  // ^(If the xInit() method is NULL, then the
  2552  // built-in default page cache is used instead of the application defined
  2553  // page cache.)^
  2554  //
  2555  // [[the xShutdown() page cache method]]
  2556  // ^The xShutdown() method is called by [sqlite3_shutdown()].
  2557  // It can be used to clean up
  2558  // any outstanding resources before process shutdown, if required.
  2559  // ^The xShutdown() method may be NULL.
  2560  //
  2561  // ^SQLite automatically serializes calls to the xInit method,
  2562  // so the xInit method need not be threadsafe.  ^The
  2563  // xShutdown method is only called from [sqlite3_shutdown()] so it does
  2564  // not need to be threadsafe either.  All other methods must be threadsafe
  2565  // in multithreaded applications.
  2566  //
  2567  // ^SQLite will never invoke xInit() more than once without an intervening
  2568  // call to xShutdown().
  2569  //
  2570  // [[the xCreate() page cache methods]]
  2571  // ^SQLite invokes the xCreate() method to construct a new cache instance.
  2572  // SQLite will typically create one cache instance for each open database file,
  2573  // though this is not guaranteed. ^The
  2574  // first parameter, szPage, is the size in bytes of the pages that must
  2575  // be allocated by the cache.  ^szPage will always a power of two.  ^The
  2576  // second parameter szExtra is a number of bytes of extra storage
  2577  // associated with each page cache entry.  ^The szExtra parameter will
  2578  // a number less than 250.  SQLite will use the
  2579  // extra szExtra bytes on each page to store metadata about the underlying
  2580  // database page on disk.  The value passed into szExtra depends
  2581  // on the SQLite version, the target platform, and how SQLite was compiled.
  2582  // ^The third argument to xCreate(), bPurgeable, is true if the cache being
  2583  // created will be used to cache database pages of a file stored on disk, or
  2584  // false if it is used for an in-memory database. The cache implementation
  2585  // does not have to do anything special based with the value of bPurgeable;
  2586  // it is purely advisory.  ^On a cache where bPurgeable is false, SQLite will
  2587  // never invoke xUnpin() except to deliberately delete a page.
  2588  // ^In other words, calls to xUnpin() on a cache with bPurgeable set to
  2589  // false will always have the "discard" flag set to true.
  2590  // ^Hence, a cache created with bPurgeable false will
  2591  // never contain any unpinned pages.
  2592  //
  2593  // [[the xCachesize() page cache method]]
  2594  // ^(The xCachesize() method may be called at any time by SQLite to set the
  2595  // suggested maximum cache-size (number of pages stored by) the cache
  2596  // instance passed as the first argument. This is the value configured using
  2597  // the SQLite "[PRAGMA cache_size]" command.)^  As with the bPurgeable
  2598  // parameter, the implementation is not required to do anything with this
  2599  // value; it is advisory only.
  2600  //
  2601  // [[the xPagecount() page cache methods]]
  2602  // The xPagecount() method must return the number of pages currently
  2603  // stored in the cache, both pinned and unpinned.
  2604  //
  2605  // [[the xFetch() page cache methods]]
  2606  // The xFetch() method locates a page in the cache and returns a pointer to
  2607  // an sqlite3_pcache_page object associated with that page, or a NULL pointer.
  2608  // The pBuf element of the returned sqlite3_pcache_page object will be a
  2609  // pointer to a buffer of szPage bytes used to store the content of a
  2610  // single database page.  The pExtra element of sqlite3_pcache_page will be
  2611  // a pointer to the szExtra bytes of extra storage that SQLite has requested
  2612  // for each entry in the page cache.
  2613  //
  2614  // The page to be fetched is determined by the key. ^The minimum key value
  2615  // is 1.  After it has been retrieved using xFetch, the page is considered
  2616  // to be "pinned".
  2617  //
  2618  // If the requested page is already in the page cache, then the page cache
  2619  // implementation must return a pointer to the page buffer with its content
  2620  // intact.  If the requested page is not already in the cache, then the
  2621  // cache implementation should use the value of the createFlag
  2622  // parameter to help it determined what action to take:
  2623  //
  2624  // <table border=1 width=85% align=center>
  2625  // <tr><th> createFlag <th> Behavior when page is not already in cache
  2626  // <tr><td> 0 <td> Do not allocate a new page.  Return NULL.
  2627  // <tr><td> 1 <td> Allocate a new page if it easy and convenient to do so.
  2628  //                 Otherwise return NULL.
  2629  // <tr><td> 2 <td> Make every effort to allocate a new page.  Only return
  2630  //                 NULL if allocating a new page is effectively impossible.
  2631  // </table>
  2632  //
  2633  // ^(SQLite will normally invoke xFetch() with a createFlag of 0 or 1.  SQLite
  2634  // will only use a createFlag of 2 after a prior call with a createFlag of 1
  2635  // failed.)^  In between the xFetch() calls, SQLite may
  2636  // attempt to unpin one or more cache pages by spilling the content of
  2637  // pinned pages to disk and synching the operating system disk cache.
  2638  //
  2639  // [[the xUnpin() page cache method]]
  2640  // ^xUnpin() is called by SQLite with a pointer to a currently pinned page
  2641  // as its second argument.  If the third parameter, discard, is non-zero,
  2642  // then the page must be evicted from the cache.
  2643  // ^If the discard parameter is
  2644  // zero, then the page may be discarded or retained at the discretion of
  2645  // page cache implementation. ^The page cache implementation
  2646  // may choose to evict unpinned pages at any time.
  2647  //
  2648  // The cache must not perform any reference counting. A single
  2649  // call to xUnpin() unpins the page regardless of the number of prior calls
  2650  // to xFetch().
  2651  //
  2652  // [[the xRekey() page cache methods]]
  2653  // The xRekey() method is used to change the key value associated with the
  2654  // page passed as the second argument. If the cache
  2655  // previously contains an entry associated with newKey, it must be
  2656  // discarded. ^Any prior cache entry associated with newKey is guaranteed not
  2657  // to be pinned.
  2658  //
  2659  // When SQLite calls the xTruncate() method, the cache must discard all
  2660  // existing cache entries with page numbers (keys) greater than or equal
  2661  // to the value of the iLimit parameter passed to xTruncate(). If any
  2662  // of these pages are pinned, they are implicitly unpinned, meaning that
  2663  // they can be safely discarded.
  2664  //
  2665  // [[the xDestroy() page cache method]]
  2666  // ^The xDestroy() method is used to delete a cache allocated by xCreate().
  2667  // All resources associated with the specified cache should be freed. ^After
  2668  // calling the xDestroy() method, SQLite considers the [sqlite3_pcache*]
  2669  // handle invalid, and will not use it with any other sqlite3_pcache_methods2
  2670  // functions.
  2671  //
  2672  // [[the xShrink() page cache method]]
  2673  // ^SQLite invokes the xShrink() method when it wants the page cache to
  2674  // free up as much of heap memory as possible.  The page cache implementation
  2675  // is not obligated to free any memory, but well-behaved implementations should
  2676  // do their best.
  2677  type sqlite3_pcache_methods21 = struct {
  2678  	iVersion   int32
  2679  	_          [4]byte
  2680  	pArg       uintptr
  2681  	xInit      uintptr
  2682  	xShutdown  uintptr
  2683  	xCreate    uintptr
  2684  	xCachesize uintptr
  2685  	xPagecount uintptr
  2686  	xFetch     uintptr
  2687  	xUnpin     uintptr
  2688  	xRekey     uintptr
  2689  	xTruncate  uintptr
  2690  	xDestroy   uintptr
  2691  	xShrink    uintptr
  2692  } /* sqlite3.h:8540:9 */
  2693  
  2694  // CAPI3REF: Application Defined Page Cache.
  2695  // KEYWORDS: {page cache}
  2696  //
  2697  // ^(The [sqlite3_config]([SQLITE_CONFIG_PCACHE2], ...) interface can
  2698  // register an alternative page cache implementation by passing in an
  2699  // instance of the sqlite3_pcache_methods2 structure.)^
  2700  // In many applications, most of the heap memory allocated by
  2701  // SQLite is used for the page cache.
  2702  // By implementing a
  2703  // custom page cache using this API, an application can better control
  2704  // the amount of memory consumed by SQLite, the way in which
  2705  // that memory is allocated and released, and the policies used to
  2706  // determine exactly which parts of a database file are cached and for
  2707  // how long.
  2708  //
  2709  // The alternative page cache mechanism is an
  2710  // extreme measure that is only needed by the most demanding applications.
  2711  // The built-in page cache is recommended for most uses.
  2712  //
  2713  // ^(The contents of the sqlite3_pcache_methods2 structure are copied to an
  2714  // internal buffer by SQLite within the call to [sqlite3_config].  Hence
  2715  // the application may discard the parameter after the call to
  2716  // [sqlite3_config()] returns.)^
  2717  //
  2718  // [[the xInit() page cache method]]
  2719  // ^(The xInit() method is called once for each effective
  2720  // call to [sqlite3_initialize()])^
  2721  // (usually only once during the lifetime of the process). ^(The xInit()
  2722  // method is passed a copy of the sqlite3_pcache_methods2.pArg value.)^
  2723  // The intent of the xInit() method is to set up global data structures
  2724  // required by the custom page cache implementation.
  2725  // ^(If the xInit() method is NULL, then the
  2726  // built-in default page cache is used instead of the application defined
  2727  // page cache.)^
  2728  //
  2729  // [[the xShutdown() page cache method]]
  2730  // ^The xShutdown() method is called by [sqlite3_shutdown()].
  2731  // It can be used to clean up
  2732  // any outstanding resources before process shutdown, if required.
  2733  // ^The xShutdown() method may be NULL.
  2734  //
  2735  // ^SQLite automatically serializes calls to the xInit method,
  2736  // so the xInit method need not be threadsafe.  ^The
  2737  // xShutdown method is only called from [sqlite3_shutdown()] so it does
  2738  // not need to be threadsafe either.  All other methods must be threadsafe
  2739  // in multithreaded applications.
  2740  //
  2741  // ^SQLite will never invoke xInit() more than once without an intervening
  2742  // call to xShutdown().
  2743  //
  2744  // [[the xCreate() page cache methods]]
  2745  // ^SQLite invokes the xCreate() method to construct a new cache instance.
  2746  // SQLite will typically create one cache instance for each open database file,
  2747  // though this is not guaranteed. ^The
  2748  // first parameter, szPage, is the size in bytes of the pages that must
  2749  // be allocated by the cache.  ^szPage will always a power of two.  ^The
  2750  // second parameter szExtra is a number of bytes of extra storage
  2751  // associated with each page cache entry.  ^The szExtra parameter will
  2752  // a number less than 250.  SQLite will use the
  2753  // extra szExtra bytes on each page to store metadata about the underlying
  2754  // database page on disk.  The value passed into szExtra depends
  2755  // on the SQLite version, the target platform, and how SQLite was compiled.
  2756  // ^The third argument to xCreate(), bPurgeable, is true if the cache being
  2757  // created will be used to cache database pages of a file stored on disk, or
  2758  // false if it is used for an in-memory database. The cache implementation
  2759  // does not have to do anything special based with the value of bPurgeable;
  2760  // it is purely advisory.  ^On a cache where bPurgeable is false, SQLite will
  2761  // never invoke xUnpin() except to deliberately delete a page.
  2762  // ^In other words, calls to xUnpin() on a cache with bPurgeable set to
  2763  // false will always have the "discard" flag set to true.
  2764  // ^Hence, a cache created with bPurgeable false will
  2765  // never contain any unpinned pages.
  2766  //
  2767  // [[the xCachesize() page cache method]]
  2768  // ^(The xCachesize() method may be called at any time by SQLite to set the
  2769  // suggested maximum cache-size (number of pages stored by) the cache
  2770  // instance passed as the first argument. This is the value configured using
  2771  // the SQLite "[PRAGMA cache_size]" command.)^  As with the bPurgeable
  2772  // parameter, the implementation is not required to do anything with this
  2773  // value; it is advisory only.
  2774  //
  2775  // [[the xPagecount() page cache methods]]
  2776  // The xPagecount() method must return the number of pages currently
  2777  // stored in the cache, both pinned and unpinned.
  2778  //
  2779  // [[the xFetch() page cache methods]]
  2780  // The xFetch() method locates a page in the cache and returns a pointer to
  2781  // an sqlite3_pcache_page object associated with that page, or a NULL pointer.
  2782  // The pBuf element of the returned sqlite3_pcache_page object will be a
  2783  // pointer to a buffer of szPage bytes used to store the content of a
  2784  // single database page.  The pExtra element of sqlite3_pcache_page will be
  2785  // a pointer to the szExtra bytes of extra storage that SQLite has requested
  2786  // for each entry in the page cache.
  2787  //
  2788  // The page to be fetched is determined by the key. ^The minimum key value
  2789  // is 1.  After it has been retrieved using xFetch, the page is considered
  2790  // to be "pinned".
  2791  //
  2792  // If the requested page is already in the page cache, then the page cache
  2793  // implementation must return a pointer to the page buffer with its content
  2794  // intact.  If the requested page is not already in the cache, then the
  2795  // cache implementation should use the value of the createFlag
  2796  // parameter to help it determined what action to take:
  2797  //
  2798  // <table border=1 width=85% align=center>
  2799  // <tr><th> createFlag <th> Behavior when page is not already in cache
  2800  // <tr><td> 0 <td> Do not allocate a new page.  Return NULL.
  2801  // <tr><td> 1 <td> Allocate a new page if it easy and convenient to do so.
  2802  //                 Otherwise return NULL.
  2803  // <tr><td> 2 <td> Make every effort to allocate a new page.  Only return
  2804  //                 NULL if allocating a new page is effectively impossible.
  2805  // </table>
  2806  //
  2807  // ^(SQLite will normally invoke xFetch() with a createFlag of 0 or 1.  SQLite
  2808  // will only use a createFlag of 2 after a prior call with a createFlag of 1
  2809  // failed.)^  In between the xFetch() calls, SQLite may
  2810  // attempt to unpin one or more cache pages by spilling the content of
  2811  // pinned pages to disk and synching the operating system disk cache.
  2812  //
  2813  // [[the xUnpin() page cache method]]
  2814  // ^xUnpin() is called by SQLite with a pointer to a currently pinned page
  2815  // as its second argument.  If the third parameter, discard, is non-zero,
  2816  // then the page must be evicted from the cache.
  2817  // ^If the discard parameter is
  2818  // zero, then the page may be discarded or retained at the discretion of
  2819  // page cache implementation. ^The page cache implementation
  2820  // may choose to evict unpinned pages at any time.
  2821  //
  2822  // The cache must not perform any reference counting. A single
  2823  // call to xUnpin() unpins the page regardless of the number of prior calls
  2824  // to xFetch().
  2825  //
  2826  // [[the xRekey() page cache methods]]
  2827  // The xRekey() method is used to change the key value associated with the
  2828  // page passed as the second argument. If the cache
  2829  // previously contains an entry associated with newKey, it must be
  2830  // discarded. ^Any prior cache entry associated with newKey is guaranteed not
  2831  // to be pinned.
  2832  //
  2833  // When SQLite calls the xTruncate() method, the cache must discard all
  2834  // existing cache entries with page numbers (keys) greater than or equal
  2835  // to the value of the iLimit parameter passed to xTruncate(). If any
  2836  // of these pages are pinned, they are implicitly unpinned, meaning that
  2837  // they can be safely discarded.
  2838  //
  2839  // [[the xDestroy() page cache method]]
  2840  // ^The xDestroy() method is used to delete a cache allocated by xCreate().
  2841  // All resources associated with the specified cache should be freed. ^After
  2842  // calling the xDestroy() method, SQLite considers the [sqlite3_pcache*]
  2843  // handle invalid, and will not use it with any other sqlite3_pcache_methods2
  2844  // functions.
  2845  //
  2846  // [[the xShrink() page cache method]]
  2847  // ^SQLite invokes the xShrink() method when it wants the page cache to
  2848  // free up as much of heap memory as possible.  The page cache implementation
  2849  // is not obligated to free any memory, but well-behaved implementations should
  2850  // do their best.
  2851  type sqlite3_pcache_methods2 = sqlite3_pcache_methods21 /* sqlite3.h:8540:40 */
  2852  
  2853  // This is the obsolete pcache_methods object that has now been replaced
  2854  // by sqlite3_pcache_methods2.  This object is not used by SQLite.  It is
  2855  // retained in the header file for backwards compatibility only.
  2856  type sqlite3_pcache_methods1 = struct {
  2857  	pArg       uintptr
  2858  	xInit      uintptr
  2859  	xShutdown  uintptr
  2860  	xCreate    uintptr
  2861  	xCachesize uintptr
  2862  	xPagecount uintptr
  2863  	xFetch     uintptr
  2864  	xUnpin     uintptr
  2865  	xRekey     uintptr
  2866  	xTruncate  uintptr
  2867  	xDestroy   uintptr
  2868  } /* sqlite3.h:8563:9 */
  2869  
  2870  // This is the obsolete pcache_methods object that has now been replaced
  2871  // by sqlite3_pcache_methods2.  This object is not used by SQLite.  It is
  2872  // retained in the header file for backwards compatibility only.
  2873  type sqlite3_pcache_methods = sqlite3_pcache_methods1 /* sqlite3.h:8563:39 */
  2874  
  2875  // CAPI3REF: Database Snapshot
  2876  // KEYWORDS: {snapshot} {sqlite3_snapshot}
  2877  //
  2878  // An instance of the snapshot object records the state of a [WAL mode]
  2879  // database for some specific point in history.
  2880  //
  2881  // In [WAL mode], multiple [database connections] that are open on the
  2882  // same database file can each be reading a different historical version
  2883  // of the database file.  When a [database connection] begins a read
  2884  // transaction, that connection sees an unchanging copy of the database
  2885  // as it existed for the point in time when the transaction first started.
  2886  // Subsequent changes to the database from other connections are not seen
  2887  // by the reader until a new read transaction is started.
  2888  //
  2889  // The sqlite3_snapshot object records state information about an historical
  2890  // version of the database file so that it is possible to later open a new read
  2891  // transaction that sees that historical version of the database rather than
  2892  // the most recent version.
  2893  type sqlite3_snapshot1 = struct{ hidden [48]uint8 } /* sqlite3.h:9630:9 */
  2894  
  2895  // CAPI3REF: Database Snapshot
  2896  // KEYWORDS: {snapshot} {sqlite3_snapshot}
  2897  //
  2898  // An instance of the snapshot object records the state of a [WAL mode]
  2899  // database for some specific point in history.
  2900  //
  2901  // In [WAL mode], multiple [database connections] that are open on the
  2902  // same database file can each be reading a different historical version
  2903  // of the database file.  When a [database connection] begins a read
  2904  // transaction, that connection sees an unchanging copy of the database
  2905  // as it existed for the point in time when the transaction first started.
  2906  // Subsequent changes to the database from other connections are not seen
  2907  // by the reader until a new read transaction is started.
  2908  //
  2909  // The sqlite3_snapshot object records state information about an historical
  2910  // version of the database file so that it is possible to later open a new read
  2911  // transaction that sees that historical version of the database rather than
  2912  // the most recent version.
  2913  type sqlite3_snapshot = sqlite3_snapshot1 /* sqlite3.h:9632:3 */
  2914  
  2915  // CAPI3REF: Flags for sqlite3_deserialize()
  2916  //
  2917  // The following are allowed values for 6th argument (the F argument) to
  2918  // the [sqlite3_deserialize(D,S,P,N,M,F)] interface.
  2919  //
  2920  // The SQLITE_DESERIALIZE_FREEONCLOSE means that the database serialization
  2921  // in the P argument is held in memory obtained from [sqlite3_malloc64()]
  2922  // and that SQLite should take ownership of this memory and automatically
  2923  // free it when it has finished using it.  Without this flag, the caller
  2924  // is responsible for freeing any dynamically allocated memory.
  2925  //
  2926  // The SQLITE_DESERIALIZE_RESIZEABLE flag means that SQLite is allowed to
  2927  // grow the size of the database using calls to [sqlite3_realloc64()].  This
  2928  // flag should only be used if SQLITE_DESERIALIZE_FREEONCLOSE is also used.
  2929  // Without this flag, the deserialized database cannot increase in size beyond
  2930  // the number of bytes specified by the M parameter.
  2931  //
  2932  // The SQLITE_DESERIALIZE_READONLY flag means that the deserialized database
  2933  // should be treated as read-only.
  2934  
  2935  // Undo the hack that converts floating point types to integer for
  2936  // builds on processors without floating point support.
  2937  
  2938  //******* Begin file sqlite3rtree.h ********
  2939  // 2010 August 30
  2940  //
  2941  // The author disclaims copyright to this source code.  In place of
  2942  // a legal notice, here is a blessing:
  2943  //
  2944  //    May you do good and not evil.
  2945  //    May you find forgiveness for yourself and forgive others.
  2946  //    May you share freely, never taking more than you give.
  2947  //
  2948  //
  2949  
  2950  type sqlite3_rtree_geometry1 = struct {
  2951  	pContext uintptr
  2952  	nParam   int32
  2953  	_        [4]byte
  2954  	aParam   uintptr
  2955  	pUser    uintptr
  2956  	xDelUser uintptr
  2957  } /* sqlite3.h:9957:9 */
  2958  
  2959  // CAPI3REF: Flags for sqlite3_deserialize()
  2960  //
  2961  // The following are allowed values for 6th argument (the F argument) to
  2962  // the [sqlite3_deserialize(D,S,P,N,M,F)] interface.
  2963  //
  2964  // The SQLITE_DESERIALIZE_FREEONCLOSE means that the database serialization
  2965  // in the P argument is held in memory obtained from [sqlite3_malloc64()]
  2966  // and that SQLite should take ownership of this memory and automatically
  2967  // free it when it has finished using it.  Without this flag, the caller
  2968  // is responsible for freeing any dynamically allocated memory.
  2969  //
  2970  // The SQLITE_DESERIALIZE_RESIZEABLE flag means that SQLite is allowed to
  2971  // grow the size of the database using calls to [sqlite3_realloc64()].  This
  2972  // flag should only be used if SQLITE_DESERIALIZE_FREEONCLOSE is also used.
  2973  // Without this flag, the deserialized database cannot increase in size beyond
  2974  // the number of bytes specified by the M parameter.
  2975  //
  2976  // The SQLITE_DESERIALIZE_READONLY flag means that the deserialized database
  2977  // should be treated as read-only.
  2978  
  2979  // Undo the hack that converts floating point types to integer for
  2980  // builds on processors without floating point support.
  2981  
  2982  //******* Begin file sqlite3rtree.h ********
  2983  // 2010 August 30
  2984  //
  2985  // The author disclaims copyright to this source code.  In place of
  2986  // a legal notice, here is a blessing:
  2987  //
  2988  //    May you do good and not evil.
  2989  //    May you find forgiveness for yourself and forgive others.
  2990  //    May you share freely, never taking more than you give.
  2991  //
  2992  //
  2993  
  2994  type sqlite3_rtree_geometry = sqlite3_rtree_geometry1 /* sqlite3.h:9957:39 */
  2995  type sqlite3_rtree_query_info1 = struct {
  2996  	pContext      uintptr
  2997  	nParam        int32
  2998  	_             [4]byte
  2999  	aParam        uintptr
  3000  	pUser         uintptr
  3001  	xDelUser      uintptr
  3002  	aCoord        uintptr
  3003  	anQueue       uintptr
  3004  	nCoord        int32
  3005  	iLevel        int32
  3006  	mxLevel       int32
  3007  	_             [4]byte
  3008  	iRowid        sqlite3_int64
  3009  	rParentScore  sqlite3_rtree_dbl
  3010  	eParentWithin int32
  3011  	eWithin       int32
  3012  	rScore        sqlite3_rtree_dbl
  3013  	apSqlParam    uintptr
  3014  } /* sqlite3.h:9958:9 */
  3015  
  3016  type sqlite3_rtree_query_info = sqlite3_rtree_query_info1 /* sqlite3.h:9958:41 */
  3017  
  3018  // The double-precision datatype used by RTree depends on the
  3019  // SQLITE_RTREE_INT_ONLY compile-time option.
  3020  type sqlite3_rtree_dbl = float64 /* sqlite3.h:9966:18 */
  3021  
  3022  // CAPI3REF: Values for sqlite3session_config().
  3023  
  3024  // Make sure we can call this stuff from C++.
  3025  
  3026  //******* End of sqlite3session.h ********
  3027  //******* Begin file fts5.h ********
  3028  // 2014 May 31
  3029  //
  3030  // The author disclaims copyright to this source code.  In place of
  3031  // a legal notice, here is a blessing:
  3032  //
  3033  //    May you do good and not evil.
  3034  //    May you find forgiveness for yourself and forgive others.
  3035  //    May you share freely, never taking more than you give.
  3036  //
  3037  //
  3038  //
  3039  // Interfaces to extend FTS5. Using the interfaces defined in this file,
  3040  // FTS5 may be extended with:
  3041  //
  3042  //     * custom tokenizers, and
  3043  //     * custom auxiliary functions.
  3044  
  3045  // ************************************************************************
  3046  //
  3047  // CUSTOM AUXILIARY FUNCTIONS
  3048  //
  3049  // Virtual table implementations may overload SQL functions by implementing
  3050  // the sqlite3_module.xFindFunction() method.
  3051  
  3052  type Fts5ExtensionApi1 = struct {
  3053  	iVersion           int32
  3054  	_                  [4]byte
  3055  	xUserData          uintptr
  3056  	xColumnCount       uintptr
  3057  	xRowCount          uintptr
  3058  	xColumnTotalSize   uintptr
  3059  	xTokenize          uintptr
  3060  	xPhraseCount       uintptr
  3061  	xPhraseSize        uintptr
  3062  	xInstCount         uintptr
  3063  	xInst              uintptr
  3064  	xRowid             uintptr
  3065  	xColumnText        uintptr
  3066  	xColumnSize        uintptr
  3067  	xQueryPhrase       uintptr
  3068  	xSetAuxdata        uintptr
  3069  	xGetAuxdata        uintptr
  3070  	xPhraseFirst       uintptr
  3071  	xPhraseNext        uintptr
  3072  	xPhraseFirstColumn uintptr
  3073  	xPhraseNextColumn  uintptr
  3074  } /* sqlite3.h:11813:9 */
  3075  
  3076  // CAPI3REF: Values for sqlite3session_config().
  3077  
  3078  // Make sure we can call this stuff from C++.
  3079  
  3080  //******* End of sqlite3session.h ********
  3081  //******* Begin file fts5.h ********
  3082  // 2014 May 31
  3083  //
  3084  // The author disclaims copyright to this source code.  In place of
  3085  // a legal notice, here is a blessing:
  3086  //
  3087  //    May you do good and not evil.
  3088  //    May you find forgiveness for yourself and forgive others.
  3089  //    May you share freely, never taking more than you give.
  3090  //
  3091  //
  3092  //
  3093  // Interfaces to extend FTS5. Using the interfaces defined in this file,
  3094  // FTS5 may be extended with:
  3095  //
  3096  //     * custom tokenizers, and
  3097  //     * custom auxiliary functions.
  3098  
  3099  // ************************************************************************
  3100  //
  3101  // CUSTOM AUXILIARY FUNCTIONS
  3102  //
  3103  // Virtual table implementations may overload SQL functions by implementing
  3104  // the sqlite3_module.xFindFunction() method.
  3105  
  3106  type Fts5ExtensionApi = Fts5ExtensionApi1 /* sqlite3.h:11813:33 */
  3107  type Fts5PhraseIter1 = struct {
  3108  	a uintptr
  3109  	b uintptr
  3110  } /* sqlite3.h:11815:9 */
  3111  
  3112  type Fts5PhraseIter = Fts5PhraseIter1 /* sqlite3.h:11815:31 */
  3113  
  3114  type fts5_extension_function = uintptr /* sqlite3.h:11817:14 */
  3115  type fts5_tokenizer1 = struct {
  3116  	xCreate   uintptr
  3117  	xDelete   uintptr
  3118  	xTokenize uintptr
  3119  } /* sqlite3.h:12276:9 */
  3120  
  3121  type fts5_tokenizer = fts5_tokenizer1 /* sqlite3.h:12276:31 */
  3122  
  3123  // Flags that may be passed as the third argument to xTokenize()
  3124  
  3125  // Flags that may be passed by the tokenizer implementation back to FTS5
  3126  // as the third argument to the supplied xToken callback.
  3127  
  3128  //
  3129  // END OF CUSTOM TOKENIZERS
  3130  //
  3131  
  3132  // ************************************************************************
  3133  //
  3134  // FTS5 EXTENSION REGISTRATION API
  3135  type fts5_api1 = struct {
  3136  	iVersion         int32
  3137  	_                [4]byte
  3138  	xCreateTokenizer uintptr
  3139  	xFindTokenizer   uintptr
  3140  	xCreateFunction  uintptr
  3141  } /* sqlite3.h:12312:9 */
  3142  
  3143  // Flags that may be passed as the third argument to xTokenize()
  3144  
  3145  // Flags that may be passed by the tokenizer implementation back to FTS5
  3146  // as the third argument to the supplied xToken callback.
  3147  
  3148  //
  3149  // END OF CUSTOM TOKENIZERS
  3150  //
  3151  
  3152  // ************************************************************************
  3153  //
  3154  // FTS5 EXTENSION REGISTRATION API
  3155  type fts5_api = fts5_api1 /* sqlite3.h:12312:25 */ // internally known to gcc
  3156  
  3157  // When the following macro is defined, the system uses 64-bit inode numbers.
  3158  // Programs can use this to avoid including <sys/param.h>, with its associated
  3159  // namespace pollution.
  3160  
  3161  type fpos_t = int64 /* stdio.h:47:18 */
  3162  
  3163  type rsize_t = size_t /* stdio.h:56:16 */
  3164  
  3165  type off_t = int64   /* stdio.h:62:18 */
  3166  type ssize_t = int64 /* stdio.h:66:19 */
  3167  
  3168  type off64_t = int64 /* stdio.h:72:19 */
  3169  
  3170  // NB: to fit things in six character monocase externals, the stdio
  3171  // code uses the prefix `__s' for stdio objects, typically followed
  3172  // by a three-character attempt at a mnemonic.
  3173  
  3174  // stdio buffers
  3175  type __sbuf = struct {
  3176  	_base uintptr
  3177  	_size int32
  3178  	_     [4]byte
  3179  } /* stdio.h:91:1 */
  3180  
  3181  // stdio state variables.
  3182  //
  3183  // The following always hold:
  3184  //
  3185  //	if (_flags&(__SLBF|__SWR)) == (__SLBF|__SWR),
  3186  //		_lbfsize is -_bf._size, else _lbfsize is 0
  3187  //	if _flags&__SRD, _w is 0
  3188  //	if _flags&__SWR, _r is 0
  3189  //
  3190  // This ensures that the getc and putc macros (or inline functions) never
  3191  // try to write or read from a file that is in `read' or `write' mode.
  3192  // (Moreover, they can, and do, automatically switch from read mode to
  3193  // write mode, and back, on "r+" and "w+" files.)
  3194  //
  3195  // _lbfsize is used only to make the inline line-buffered output stream
  3196  // code as compact as possible.
  3197  //
  3198  // _ub, _up, and _ur are used when ungetc() pushes back more characters
  3199  // than fit in the current _bf, or when ungetc() pushes back a character
  3200  // that does not match the previous one in _bf.  When this happens,
  3201  // _ub._base becomes non-nil (i.e., a stream has ungetc() data iff
  3202  // _ub._base!=NULL) and _up and _ur save the current values of _p and _r.
  3203  //
  3204  // Certain members of __sFILE are accessed directly via macros or
  3205  // inline functions.  To preserve ABI compat, these members must not
  3206  // be disturbed.  These members are marked below with (*).
  3207  type __sFILE = struct {
  3208  	_p     uintptr
  3209  	_r     int32
  3210  	_w     int32
  3211  	_flags int16
  3212  	_file  int16
  3213  	_      [4]byte
  3214  	_bf    struct {
  3215  		_base uintptr
  3216  		_size int32
  3217  		_     [4]byte
  3218  	}
  3219  	_lbfsize int32
  3220  	_        [4]byte
  3221  	_cookie  uintptr
  3222  	_close   uintptr
  3223  	_read    uintptr
  3224  	_seek    uintptr
  3225  	_write   uintptr
  3226  	_ub      struct {
  3227  		_base uintptr
  3228  		_size int32
  3229  		_     [4]byte
  3230  	}
  3231  	_up   uintptr
  3232  	_ur   int32
  3233  	_ubuf [3]uint8
  3234  	_nbuf [1]uint8
  3235  	_lb   struct {
  3236  		_base uintptr
  3237  		_size int32
  3238  		_     [4]byte
  3239  	}
  3240  	_blksize     int32
  3241  	_            [4]byte
  3242  	_offset      fpos_t
  3243  	_fl_mutex    uintptr
  3244  	_fl_owner    uintptr
  3245  	_fl_count    int32
  3246  	_orientation int32
  3247  	_mbstate     struct {
  3248  		_          [0]uint64
  3249  		__mbstate8 [128]int8
  3250  	}
  3251  	_flags2 int32
  3252  	_       [4]byte
  3253  } /* stdio.h:124:1 */
  3254  
  3255  type FILE = __sFILE /* stdio.h:165:24 */
  3256  type cookie_io_functions_t = struct {
  3257  	read  uintptr
  3258  	write uintptr
  3259  	seek  uintptr
  3260  	close uintptr
  3261  } /* stdio.h:428:3 */
  3262  type pthread_once = struct {
  3263  	state int32
  3264  	_     [4]byte
  3265  	mutex pthread_mutex_t
  3266  } /* _pthreadtypes.h:52:1 */
  3267  
  3268  // Primitive system data type definitions required by P1003.1c.
  3269  //
  3270  // Note that P1003.1c specifies that there are no defined comparison
  3271  // or assignment operators for the types pthread_attr_t, pthread_cond_t,
  3272  // pthread_condattr_t, pthread_mutex_t, pthread_mutexattr_t.
  3273  type pthread_t = uintptr             /* _pthreadtypes.h:67:26 */
  3274  type pthread_attr_t = uintptr        /* _pthreadtypes.h:70:30 */
  3275  type pthread_mutex_t = uintptr       /* _pthreadtypes.h:71:31 */
  3276  type pthread_mutexattr_t = uintptr   /* _pthreadtypes.h:72:35 */
  3277  type pthread_cond_t = uintptr        /* _pthreadtypes.h:73:30 */
  3278  type pthread_condattr_t = uintptr    /* _pthreadtypes.h:74:34 */
  3279  type pthread_key_t = int32           /* _pthreadtypes.h:75:20 */
  3280  type pthread_once_t = pthread_once   /* _pthreadtypes.h:76:30 */
  3281  type pthread_rwlock_t = uintptr      /* _pthreadtypes.h:77:32 */
  3282  type pthread_rwlockattr_t = uintptr  /* _pthreadtypes.h:78:35 */
  3283  type pthread_barrier_t = uintptr     /* _pthreadtypes.h:79:33 */
  3284  type pthread_barrierattr_t = uintptr /* _pthreadtypes.h:80:36 */
  3285  type pthread_spinlock_t = uintptr    /* _pthreadtypes.h:81:33 */
  3286  
  3287  // Additional type definitions:
  3288  //
  3289  // Note that P1003.1c reserves the prefixes pthread_ and PTHREAD_ for
  3290  // use in header symbols.
  3291  type pthread_addr_t = uintptr         /* _pthreadtypes.h:89:14 */
  3292  type pthread_startroutine_t = uintptr /* _pthreadtypes.h:90:14 */
  3293  
  3294  type u_char = uint8   /* types.h:52:23 */
  3295  type u_short = uint16 /* types.h:53:24 */
  3296  type u_int = uint32   /* types.h:54:22 */
  3297  type u_long = uint64  /* types.h:55:23 */
  3298  type ushort = uint16  /* types.h:57:24 */ // Sys V compatibility
  3299  type uint = uint32    /* types.h:58:22 */ // Sys V compatibility
  3300  
  3301  // XXX POSIX sized integrals that should appear only in <sys/stdint.h>.
  3302  // -
  3303  // SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  3304  //
  3305  // Copyright (c) 2011 David E. O'Brien <obrien@FreeBSD.org>
  3306  // Copyright (c) 2001 Mike Barcroft <mike@FreeBSD.org>
  3307  // All rights reserved.
  3308  //
  3309  // Redistribution and use in source and binary forms, with or without
  3310  // modification, are permitted provided that the following conditions
  3311  // are met:
  3312  // 1. Redistributions of source code must retain the above copyright
  3313  //    notice, this list of conditions and the following disclaimer.
  3314  // 2. Redistributions in binary form must reproduce the above copyright
  3315  //    notice, this list of conditions and the following disclaimer in the
  3316  //    documentation and/or other materials provided with the distribution.
  3317  //
  3318  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  3319  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  3320  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  3321  // ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  3322  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  3323  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  3324  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  3325  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  3326  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  3327  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  3328  // SUCH DAMAGE.
  3329  //
  3330  // $FreeBSD$
  3331  
  3332  type int8_t = int8 /* _stdint.h:36:19 */
  3333  
  3334  type int16_t = int16 /* _stdint.h:41:20 */
  3335  
  3336  type int32_t = int32 /* _stdint.h:46:20 */
  3337  
  3338  type int64_t = int64 /* _stdint.h:51:20 */
  3339  
  3340  type uint8_t = uint8 /* _stdint.h:56:20 */
  3341  
  3342  type uint16_t = uint16 /* _stdint.h:61:21 */
  3343  
  3344  type uint32_t = uint32 /* _stdint.h:66:21 */
  3345  
  3346  type uint64_t = uint64 /* _stdint.h:71:21 */
  3347  
  3348  type intptr_t = int64   /* _stdint.h:76:21 */
  3349  type uintptr_t = uint64 /* _stdint.h:80:22 */
  3350  type intmax_t = int64   /* _stdint.h:84:21 */
  3351  type uintmax_t = uint64 /* _stdint.h:88:22 */
  3352  
  3353  type u_int8_t = uint8   /* types.h:67:19 */ // unsigned integrals (deprecated)
  3354  type u_int16_t = uint16 /* types.h:68:20 */
  3355  type u_int32_t = uint32 /* types.h:69:20 */
  3356  type u_int64_t = uint64 /* types.h:70:20 */
  3357  
  3358  type u_quad_t = uint64 /* types.h:72:20 */ // quads (deprecated)
  3359  type quad_t = int64    /* types.h:73:19 */
  3360  type qaddr_t = uintptr /* types.h:74:16 */
  3361  
  3362  type caddr_t = uintptr   /* types.h:76:14 */ // core address
  3363  type c_caddr_t = uintptr /* types.h:77:20 */ // core address, pointer to const
  3364  
  3365  type blksize_t = int32 /* types.h:80:21 */
  3366  
  3367  type cpuwhich_t = int32 /* types.h:84:22 */
  3368  type cpulevel_t = int32 /* types.h:85:22 */
  3369  type cpusetid_t = int32 /* types.h:86:22 */
  3370  
  3371  type blkcnt_t = int64 /* types.h:89:20 */
  3372  
  3373  type clock_t = int32 /* types.h:94:19 */
  3374  
  3375  type clockid_t = int32 /* types.h:99:21 */
  3376  
  3377  type critical_t = int64 /* types.h:103:22 */ // Critical section value
  3378  type daddr_t = int64    /* types.h:104:19 */ // disk address
  3379  
  3380  type dev_t = uint64 /* types.h:107:18 */ // device number or struct cdev
  3381  
  3382  type fflags_t = uint32 /* types.h:112:20 */ // file flags
  3383  
  3384  type fixpt_t = uint32 /* types.h:116:19 */ // fixed point number
  3385  
  3386  type fsblkcnt_t = uint64 /* types.h:119:22 */
  3387  type fsfilcnt_t = uint64 /* types.h:120:22 */
  3388  
  3389  type gid_t = uint32 /* types.h:125:18 */ // group id
  3390  
  3391  type in_addr_t = uint32 /* types.h:130:20 */ // base type for internet address
  3392  
  3393  type in_port_t = uint16 /* types.h:135:20 */
  3394  
  3395  type id_t = int64 /* types.h:140:17 */ // can hold a uid_t or pid_t
  3396  
  3397  type ino_t = uint64 /* types.h:145:18 */ // inode number
  3398  
  3399  type key_t = int64 /* types.h:150:18 */ // IPC key (for Sys V IPC)
  3400  
  3401  type lwpid_t = int32 /* types.h:155:19 */ // Thread ID (a.k.a. LWP)
  3402  
  3403  type mode_t = uint16 /* types.h:160:18 */ // permissions
  3404  
  3405  type accmode_t = int32 /* types.h:165:21 */ // access permissions
  3406  
  3407  type nlink_t = uint64 /* types.h:170:19 */ // link count
  3408  
  3409  type pid_t = int32 /* types.h:185:18 */ // process id
  3410  
  3411  type register_t = int64 /* types.h:189:22 */
  3412  
  3413  type rlim_t = int64 /* types.h:192:18 */ // resource limit
  3414  
  3415  type sbintime_t = int64 /* types.h:196:19 */
  3416  
  3417  type segsz_t = int64 /* types.h:198:19 */ // segment size (in pages)
  3418  
  3419  type suseconds_t = int64 /* types.h:211:23 */ // microseconds (signed)
  3420  
  3421  type time_t = int64 /* types.h:216:18 */
  3422  
  3423  type timer_t = uintptr /* types.h:221:19 */
  3424  
  3425  type mqd_t = uintptr /* types.h:226:17 */
  3426  
  3427  type u_register_t = uint64 /* types.h:230:24 */
  3428  
  3429  type uid_t = uint32 /* types.h:233:18 */ // user id
  3430  
  3431  type useconds_t = uint32 /* types.h:238:22 */ // microseconds (unsigned)
  3432  
  3433  type cap_ioctl_t = uint64 /* types.h:244:23 */
  3434  
  3435  // Types suitable for exporting physical addresses, virtual addresses
  3436  // (pointers), and memory object sizes from the kernel independent of native
  3437  // word size.  These should be used in place of vm_paddr_t, (u)intptr_t, and
  3438  // size_t in structs which contain such types that are shared with userspace.
  3439  type kpaddr_t = uint64 /* types.h:260:20 */
  3440  type kvaddr_t = uint64 /* types.h:261:20 */
  3441  type ksize_t = uint64  /* types.h:262:20 */
  3442  type kssize_t = int64  /* types.h:263:19 */
  3443  
  3444  type vm_offset_t = uint64  /* types.h:265:23 */
  3445  type vm_ooffset_t = uint64 /* types.h:266:20 */
  3446  type vm_paddr_t = uint64   /* types.h:267:22 */
  3447  type vm_pindex_t = uint64  /* types.h:268:20 */
  3448  type vm_size_t = uint64    /* types.h:269:21 */
  3449  
  3450  type rman_res_t = uint64 /* types.h:271:25 */
  3451  
  3452  // -
  3453  // SPDX-License-Identifier: BSD-3-Clause
  3454  //
  3455  // Copyright (c) 1992, 1993
  3456  //	The Regents of the University of California.  All rights reserved.
  3457  //
  3458  // Redistribution and use in source and binary forms, with or without
  3459  // modification, are permitted provided that the following conditions
  3460  // are met:
  3461  // 1. Redistributions of source code must retain the above copyright
  3462  //    notice, this list of conditions and the following disclaimer.
  3463  // 2. Redistributions in binary form must reproduce the above copyright
  3464  //    notice, this list of conditions and the following disclaimer in the
  3465  //    documentation and/or other materials provided with the distribution.
  3466  // 3. Neither the name of the University nor the names of its contributors
  3467  //    may be used to endorse or promote products derived from this software
  3468  //    without specific prior written permission.
  3469  //
  3470  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  3471  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  3472  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  3473  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  3474  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  3475  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  3476  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  3477  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  3478  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  3479  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  3480  // SUCH DAMAGE.
  3481  //
  3482  // $FreeBSD$
  3483  
  3484  // -
  3485  // SPDX-License-Identifier: BSD-3-Clause
  3486  //
  3487  // Copyright (c) 1991, 1993
  3488  //	The Regents of the University of California.  All rights reserved.
  3489  //
  3490  // This code is derived from software contributed to Berkeley by
  3491  // Berkeley Software Design, Inc.
  3492  //
  3493  // Redistribution and use in source and binary forms, with or without
  3494  // modification, are permitted provided that the following conditions
  3495  // are met:
  3496  // 1. Redistributions of source code must retain the above copyright
  3497  //    notice, this list of conditions and the following disclaimer.
  3498  // 2. Redistributions in binary form must reproduce the above copyright
  3499  //    notice, this list of conditions and the following disclaimer in the
  3500  //    documentation and/or other materials provided with the distribution.
  3501  // 3. Neither the name of the University nor the names of its contributors
  3502  //    may be used to endorse or promote products derived from this software
  3503  //    without specific prior written permission.
  3504  //
  3505  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  3506  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  3507  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  3508  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  3509  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  3510  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  3511  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  3512  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  3513  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  3514  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  3515  // SUCH DAMAGE.
  3516  //
  3517  //	@(#)cdefs.h	8.8 (Berkeley) 1/9/95
  3518  // $FreeBSD$
  3519  
  3520  // -
  3521  // SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  3522  //
  3523  // Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
  3524  // All rights reserved.
  3525  //
  3526  // Redistribution and use in source and binary forms, with or without
  3527  // modification, are permitted provided that the following conditions
  3528  // are met:
  3529  // 1. Redistributions of source code must retain the above copyright
  3530  //    notice, this list of conditions and the following disclaimer.
  3531  // 2. Redistributions in binary form must reproduce the above copyright
  3532  //    notice, this list of conditions and the following disclaimer in the
  3533  //    documentation and/or other materials provided with the distribution.
  3534  //
  3535  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  3536  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  3537  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  3538  // ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  3539  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  3540  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  3541  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  3542  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  3543  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  3544  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  3545  // SUCH DAMAGE.
  3546  //
  3547  // $FreeBSD$
  3548  
  3549  // -
  3550  // SPDX-License-Identifier: BSD-3-Clause
  3551  //
  3552  // Copyright (c) 1982, 1986, 1989, 1991, 1993
  3553  //	The Regents of the University of California.  All rights reserved.
  3554  // (c) UNIX System Laboratories, Inc.
  3555  // All or some portions of this file are derived from material licensed
  3556  // to the University of California by American Telephone and Telegraph
  3557  // Co. or Unix System Laboratories, Inc. and are reproduced herein with
  3558  // the permission of UNIX System Laboratories, Inc.
  3559  //
  3560  // Redistribution and use in source and binary forms, with or without
  3561  // modification, are permitted provided that the following conditions
  3562  // are met:
  3563  // 1. Redistributions of source code must retain the above copyright
  3564  //    notice, this list of conditions and the following disclaimer.
  3565  // 2. Redistributions in binary form must reproduce the above copyright
  3566  //    notice, this list of conditions and the following disclaimer in the
  3567  //    documentation and/or other materials provided with the distribution.
  3568  // 3. Neither the name of the University nor the names of its contributors
  3569  //    may be used to endorse or promote products derived from this software
  3570  //    without specific prior written permission.
  3571  //
  3572  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  3573  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  3574  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  3575  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  3576  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  3577  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  3578  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  3579  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  3580  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  3581  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  3582  // SUCH DAMAGE.
  3583  //
  3584  //	@(#)signal.h	8.4 (Berkeley) 5/4/95
  3585  // $FreeBSD$
  3586  
  3587  // sigset_t macros.
  3588  
  3589  type __sigset = struct{ __bits [4]uint32 } /* _sigset.h:53:9 */
  3590  
  3591  // -
  3592  // SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  3593  //
  3594  // Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
  3595  // All rights reserved.
  3596  //
  3597  // Redistribution and use in source and binary forms, with or without
  3598  // modification, are permitted provided that the following conditions
  3599  // are met:
  3600  // 1. Redistributions of source code must retain the above copyright
  3601  //    notice, this list of conditions and the following disclaimer.
  3602  // 2. Redistributions in binary form must reproduce the above copyright
  3603  //    notice, this list of conditions and the following disclaimer in the
  3604  //    documentation and/or other materials provided with the distribution.
  3605  //
  3606  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  3607  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  3608  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  3609  // ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  3610  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  3611  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  3612  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  3613  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  3614  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  3615  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  3616  // SUCH DAMAGE.
  3617  //
  3618  // $FreeBSD$
  3619  
  3620  // -
  3621  // SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  3622  //
  3623  // Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
  3624  // All rights reserved.
  3625  //
  3626  // Redistribution and use in source and binary forms, with or without
  3627  // modification, are permitted provided that the following conditions
  3628  // are met:
  3629  // 1. Redistributions of source code must retain the above copyright
  3630  //    notice, this list of conditions and the following disclaimer.
  3631  // 2. Redistributions in binary form must reproduce the above copyright
  3632  //    notice, this list of conditions and the following disclaimer in the
  3633  //    documentation and/or other materials provided with the distribution.
  3634  //
  3635  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  3636  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  3637  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  3638  // ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  3639  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  3640  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  3641  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  3642  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  3643  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  3644  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  3645  // SUCH DAMAGE.
  3646  //
  3647  // $FreeBSD$
  3648  
  3649  // Structure returned by gettimeofday(2) system call, and used in other calls.
  3650  type timeval = struct {
  3651  	tv_sec  time_t
  3652  	tv_usec suseconds_t
  3653  } /* _timeval.h:49:1 */
  3654  
  3655  // -
  3656  // SPDX-License-Identifier: BSD-3-Clause
  3657  //
  3658  // Copyright (c) 1982, 1986, 1993
  3659  //	The Regents of the University of California.  All rights reserved.
  3660  //
  3661  // Redistribution and use in source and binary forms, with or without
  3662  // modification, are permitted provided that the following conditions
  3663  // are met:
  3664  // 1. Redistributions of source code must retain the above copyright
  3665  //    notice, this list of conditions and the following disclaimer.
  3666  // 2. Redistributions in binary form must reproduce the above copyright
  3667  //    notice, this list of conditions and the following disclaimer in the
  3668  //    documentation and/or other materials provided with the distribution.
  3669  // 3. Neither the name of the University nor the names of its contributors
  3670  //    may be used to endorse or promote products derived from this software
  3671  //    without specific prior written permission.
  3672  //
  3673  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  3674  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  3675  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  3676  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  3677  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  3678  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  3679  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  3680  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  3681  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  3682  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  3683  // SUCH DAMAGE.
  3684  //
  3685  //	@(#)time.h	8.5 (Berkeley) 5/4/95
  3686  // from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp
  3687  //	$FreeBSD$
  3688  
  3689  // -
  3690  // SPDX-License-Identifier: BSD-3-Clause
  3691  //
  3692  // Copyright (c) 1991, 1993
  3693  //	The Regents of the University of California.  All rights reserved.
  3694  //
  3695  // This code is derived from software contributed to Berkeley by
  3696  // Berkeley Software Design, Inc.
  3697  //
  3698  // Redistribution and use in source and binary forms, with or without
  3699  // modification, are permitted provided that the following conditions
  3700  // are met:
  3701  // 1. Redistributions of source code must retain the above copyright
  3702  //    notice, this list of conditions and the following disclaimer.
  3703  // 2. Redistributions in binary form must reproduce the above copyright
  3704  //    notice, this list of conditions and the following disclaimer in the
  3705  //    documentation and/or other materials provided with the distribution.
  3706  // 3. Neither the name of the University nor the names of its contributors
  3707  //    may be used to endorse or promote products derived from this software
  3708  //    without specific prior written permission.
  3709  //
  3710  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  3711  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  3712  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  3713  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  3714  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  3715  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  3716  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  3717  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  3718  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  3719  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  3720  // SUCH DAMAGE.
  3721  //
  3722  //	@(#)cdefs.h	8.8 (Berkeley) 1/9/95
  3723  // $FreeBSD$
  3724  
  3725  // -
  3726  // SPDX-License-Identifier: BSD-3-Clause
  3727  //
  3728  // Copyright (c) 1982, 1986, 1993
  3729  //	The Regents of the University of California.  All rights reserved.
  3730  //
  3731  // Redistribution and use in source and binary forms, with or without
  3732  // modification, are permitted provided that the following conditions
  3733  // are met:
  3734  // 1. Redistributions of source code must retain the above copyright
  3735  //    notice, this list of conditions and the following disclaimer.
  3736  // 2. Redistributions in binary form must reproduce the above copyright
  3737  //    notice, this list of conditions and the following disclaimer in the
  3738  //    documentation and/or other materials provided with the distribution.
  3739  // 3. Neither the name of the University nor the names of its contributors
  3740  //    may be used to endorse or promote products derived from this software
  3741  //    without specific prior written permission.
  3742  //
  3743  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  3744  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  3745  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  3746  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  3747  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  3748  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  3749  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  3750  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  3751  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  3752  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  3753  // SUCH DAMAGE.
  3754  //
  3755  //	@(#)time.h	8.5 (Berkeley) 5/4/95
  3756  // from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp
  3757  //	$FreeBSD$
  3758  
  3759  // -
  3760  // SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  3761  //
  3762  // Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
  3763  // All rights reserved.
  3764  //
  3765  // Redistribution and use in source and binary forms, with or without
  3766  // modification, are permitted provided that the following conditions
  3767  // are met:
  3768  // 1. Redistributions of source code must retain the above copyright
  3769  //    notice, this list of conditions and the following disclaimer.
  3770  // 2. Redistributions in binary form must reproduce the above copyright
  3771  //    notice, this list of conditions and the following disclaimer in the
  3772  //    documentation and/or other materials provided with the distribution.
  3773  //
  3774  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  3775  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  3776  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  3777  // ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  3778  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  3779  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  3780  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  3781  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  3782  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  3783  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  3784  // SUCH DAMAGE.
  3785  //
  3786  // $FreeBSD$
  3787  
  3788  type timespec = struct {
  3789  	tv_sec  time_t
  3790  	tv_nsec int64
  3791  } /* _timespec.h:46:1 */
  3792  
  3793  // Structure defined by POSIX.1b to be like a itimerval, but with
  3794  // timespecs. Used in the timer_*() system calls.
  3795  type itimerspec = struct {
  3796  	it_interval struct {
  3797  		tv_sec  time_t
  3798  		tv_nsec int64
  3799  	}
  3800  	it_value struct {
  3801  		tv_sec  time_t
  3802  		tv_nsec int64
  3803  	}
  3804  } /* timespec.h:60:1 */
  3805  
  3806  type fd_mask = uint64 /* select.h:46:19 */
  3807  
  3808  type sigset_t = __sigset /* select.h:51:20 */
  3809  
  3810  // Select uses bit masks of file descriptors in longs.  These macros
  3811  // manipulate such bit fields (the filesystem macros use chars).
  3812  // FD_SETSIZE may be defined by the user, but the default here should
  3813  // be enough for most uses.
  3814  
  3815  type fd_set1 = struct{ __fds_bits [16]uint64 } /* select.h:73:9 */
  3816  
  3817  // Select uses bit masks of file descriptors in longs.  These macros
  3818  // manipulate such bit fields (the filesystem macros use chars).
  3819  // FD_SETSIZE may be defined by the user, but the default here should
  3820  // be enough for most uses.
  3821  
  3822  type fd_set = fd_set1 /* select.h:75:3 */ // select(2)
  3823  
  3824  type crypt_data = struct {
  3825  	initialized int32
  3826  	__buf       [256]int8
  3827  } /* unistd.h:489:1 */
  3828  
  3829  // 11 was EAGAIN
  3830  
  3831  // math software
  3832  
  3833  // non-blocking and interrupt i/o
  3834  
  3835  // ipc/network software -- argument errors
  3836  
  3837  // ipc/network software -- operational errors
  3838  
  3839  // should be rearranged
  3840  
  3841  // quotas & mush
  3842  
  3843  // Network File System
  3844  
  3845  // ISO/IEC 9899:2011 K.3.2.2
  3846  type errno_t = int32 /* errno.h:204:13 */
  3847  
  3848  // -
  3849  // SPDX-License-Identifier: BSD-3-Clause
  3850  //
  3851  // Copyright (c) 1990, 1993
  3852  //	The Regents of the University of California.  All rights reserved.
  3853  //
  3854  // Redistribution and use in source and binary forms, with or without
  3855  // modification, are permitted provided that the following conditions
  3856  // are met:
  3857  // 1. Redistributions of source code must retain the above copyright
  3858  //    notice, this list of conditions and the following disclaimer.
  3859  // 2. Redistributions in binary form must reproduce the above copyright
  3860  //    notice, this list of conditions and the following disclaimer in the
  3861  //    documentation and/or other materials provided with the distribution.
  3862  // 3. Neither the name of the University nor the names of its contributors
  3863  //    may be used to endorse or promote products derived from this software
  3864  //    without specific prior written permission.
  3865  //
  3866  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  3867  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  3868  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  3869  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  3870  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  3871  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  3872  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  3873  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  3874  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  3875  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  3876  // SUCH DAMAGE.
  3877  //
  3878  //	@(#)stdlib.h	8.5 (Berkeley) 5/19/95
  3879  // $FreeBSD$
  3880  
  3881  // -
  3882  // SPDX-License-Identifier: BSD-3-Clause
  3883  //
  3884  // Copyright (c) 1991, 1993
  3885  //	The Regents of the University of California.  All rights reserved.
  3886  //
  3887  // This code is derived from software contributed to Berkeley by
  3888  // Berkeley Software Design, Inc.
  3889  //
  3890  // Redistribution and use in source and binary forms, with or without
  3891  // modification, are permitted provided that the following conditions
  3892  // are met:
  3893  // 1. Redistributions of source code must retain the above copyright
  3894  //    notice, this list of conditions and the following disclaimer.
  3895  // 2. Redistributions in binary form must reproduce the above copyright
  3896  //    notice, this list of conditions and the following disclaimer in the
  3897  //    documentation and/or other materials provided with the distribution.
  3898  // 3. Neither the name of the University nor the names of its contributors
  3899  //    may be used to endorse or promote products derived from this software
  3900  //    without specific prior written permission.
  3901  //
  3902  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  3903  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  3904  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  3905  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  3906  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  3907  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  3908  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  3909  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  3910  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  3911  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  3912  // SUCH DAMAGE.
  3913  //
  3914  //	@(#)cdefs.h	8.8 (Berkeley) 1/9/95
  3915  // $FreeBSD$
  3916  
  3917  // -
  3918  // SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  3919  //
  3920  // Copyright (c) 2003 Marcel Moolenaar
  3921  // All rights reserved.
  3922  //
  3923  // Redistribution and use in source and binary forms, with or without
  3924  // modification, are permitted provided that the following conditions
  3925  // are met:
  3926  //
  3927  // 1. Redistributions of source code must retain the above copyright
  3928  //    notice, this list of conditions and the following disclaimer.
  3929  // 2. Redistributions in binary form must reproduce the above copyright
  3930  //    notice, this list of conditions and the following disclaimer in the
  3931  //    documentation and/or other materials provided with the distribution.
  3932  //
  3933  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  3934  // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  3935  // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  3936  // IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  3937  // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  3938  // NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  3939  // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  3940  // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  3941  // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  3942  // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  3943  //
  3944  // $FreeBSD$
  3945  
  3946  // -
  3947  // SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  3948  //
  3949  // Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
  3950  // All rights reserved.
  3951  //
  3952  // Redistribution and use in source and binary forms, with or without
  3953  // modification, are permitted provided that the following conditions
  3954  // are met:
  3955  // 1. Redistributions of source code must retain the above copyright
  3956  //    notice, this list of conditions and the following disclaimer.
  3957  // 2. Redistributions in binary form must reproduce the above copyright
  3958  //    notice, this list of conditions and the following disclaimer in the
  3959  //    documentation and/or other materials provided with the distribution.
  3960  //
  3961  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  3962  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  3963  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  3964  // ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  3965  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  3966  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  3967  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  3968  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  3969  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  3970  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  3971  // SUCH DAMAGE.
  3972  //
  3973  // $FreeBSD$
  3974  
  3975  type rune_t = int32 /* stdlib.h:46:18 */
  3976  
  3977  type div_t = struct {
  3978  	quot int32
  3979  	rem  int32
  3980  } /* stdlib.h:66:3 */
  3981  
  3982  type ldiv_t = struct {
  3983  	quot int64
  3984  	rem  int64
  3985  } /* stdlib.h:71:3 */
  3986  
  3987  // Functions added in C99 which we make conditionally available in the
  3988  // BSD^C89 namespace if the compiler supports `long long'.
  3989  // The #if test is more complicated than it ought to be because
  3990  // __BSD_VISIBLE implies __ISO_C_VISIBLE == 1999 *even if* `long long'
  3991  // is not supported in the compilation environment (which therefore means
  3992  // that it can't really be ISO C99).
  3993  //
  3994  // (The only other extension made by C99 in thie header is _Exit().)
  3995  // LONGLONG
  3996  type lldiv_t = struct {
  3997  	quot int64
  3998  	rem  int64
  3999  } /* stdlib.h:142:3 */ // getsubopt(3) external variable
  4000  
  4001  // K.3.6
  4002  type constraint_handler_t = uintptr /* stdlib.h:349:14 */
  4003  
  4004  // -
  4005  // Copyright (c) 2011, 2012 The FreeBSD Foundation
  4006  // All rights reserved.
  4007  //
  4008  // Redistribution and use in source and binary forms, with or without
  4009  // modification, are permitted provided that the following conditions
  4010  // are met:
  4011  // 1. Redistributions of source code must retain the above copyright
  4012  //    notice, this list of conditions and the following disclaimer.
  4013  // 2. Redistributions in binary form must reproduce the above copyright
  4014  //    notice, this list of conditions and the following disclaimer in the
  4015  //    documentation and/or other materials provided with the distribution.
  4016  //
  4017  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  4018  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  4019  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  4020  // ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  4021  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  4022  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  4023  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  4024  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  4025  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  4026  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  4027  // SUCH DAMAGE.
  4028  //
  4029  // $FreeBSD$
  4030  
  4031  type locale_t = uintptr /* _strings.h:31:25 */
  4032  
  4033  // Use inline functions if we are allowed to and the compiler supports them.
  4034  
  4035  // -
  4036  // SPDX-License-Identifier: BSD-3-Clause
  4037  //
  4038  // Copyright (c) 1993
  4039  //	The Regents of the University of California.  All rights reserved.
  4040  //
  4041  // This code is derived from software contributed to Berkeley by
  4042  // Paul Borman at Krystal Technologies.
  4043  //
  4044  // Redistribution and use in source and binary forms, with or without
  4045  // modification, are permitted provided that the following conditions
  4046  // are met:
  4047  // 1. Redistributions of source code must retain the above copyright
  4048  //    notice, this list of conditions and the following disclaimer.
  4049  // 2. Redistributions in binary form must reproduce the above copyright
  4050  //    notice, this list of conditions and the following disclaimer in the
  4051  //    documentation and/or other materials provided with the distribution.
  4052  // 3. Neither the name of the University nor the names of its contributors
  4053  //    may be used to endorse or promote products derived from this software
  4054  //    without specific prior written permission.
  4055  //
  4056  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  4057  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  4058  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  4059  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  4060  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  4061  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  4062  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  4063  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  4064  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  4065  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  4066  // SUCH DAMAGE.
  4067  //
  4068  //	@(#)runetype.h	8.1 (Berkeley) 6/2/93
  4069  // $FreeBSD$
  4070  
  4071  // -
  4072  // SPDX-License-Identifier: BSD-3-Clause
  4073  //
  4074  // Copyright (c) 1991, 1993
  4075  //	The Regents of the University of California.  All rights reserved.
  4076  //
  4077  // This code is derived from software contributed to Berkeley by
  4078  // Berkeley Software Design, Inc.
  4079  //
  4080  // Redistribution and use in source and binary forms, with or without
  4081  // modification, are permitted provided that the following conditions
  4082  // are met:
  4083  // 1. Redistributions of source code must retain the above copyright
  4084  //    notice, this list of conditions and the following disclaimer.
  4085  // 2. Redistributions in binary form must reproduce the above copyright
  4086  //    notice, this list of conditions and the following disclaimer in the
  4087  //    documentation and/or other materials provided with the distribution.
  4088  // 3. Neither the name of the University nor the names of its contributors
  4089  //    may be used to endorse or promote products derived from this software
  4090  //    without specific prior written permission.
  4091  //
  4092  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  4093  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  4094  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  4095  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  4096  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  4097  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  4098  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  4099  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  4100  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  4101  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  4102  // SUCH DAMAGE.
  4103  //
  4104  //	@(#)cdefs.h	8.8 (Berkeley) 1/9/95
  4105  // $FreeBSD$
  4106  
  4107  // -
  4108  // SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  4109  //
  4110  // Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
  4111  // All rights reserved.
  4112  //
  4113  // Redistribution and use in source and binary forms, with or without
  4114  // modification, are permitted provided that the following conditions
  4115  // are met:
  4116  // 1. Redistributions of source code must retain the above copyright
  4117  //    notice, this list of conditions and the following disclaimer.
  4118  // 2. Redistributions in binary form must reproduce the above copyright
  4119  //    notice, this list of conditions and the following disclaimer in the
  4120  //    documentation and/or other materials provided with the distribution.
  4121  //
  4122  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  4123  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  4124  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  4125  // ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  4126  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  4127  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  4128  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  4129  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  4130  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  4131  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  4132  // SUCH DAMAGE.
  4133  //
  4134  // $FreeBSD$
  4135  
  4136  // The lower 8 bits of runetype[] contain the digit value of the rune.
  4137  type _RuneEntry = struct {
  4138  	__min   int32
  4139  	__max   int32
  4140  	__map   int32
  4141  	_       [4]byte
  4142  	__types uintptr
  4143  } /* runetype.h:55:3 */
  4144  
  4145  type _RuneRange = struct {
  4146  	__nranges int32
  4147  	_         [4]byte
  4148  	__ranges  uintptr
  4149  } /* runetype.h:60:3 */
  4150  
  4151  type _RuneLocale = struct {
  4152  	__magic        [8]int8
  4153  	__encoding     [32]int8
  4154  	__sgetrune     uintptr
  4155  	__sputrune     uintptr
  4156  	__invalid_rune int32
  4157  	_              [4]byte
  4158  	__runetype     [256]uint64
  4159  	__maplower     [256]int32
  4160  	__mapupper     [256]int32
  4161  	__runetype_ext _RuneRange
  4162  	__maplower_ext _RuneRange
  4163  	__mapupper_ext _RuneRange
  4164  	__variable     uintptr
  4165  	__variable_len int32
  4166  	_              [4]byte
  4167  } /* runetype.h:85:3 */
  4168  
  4169  func __getCurrentRuneLocale(tls *libc.TLS) uintptr { /* runetype.h:95:35: */
  4170  
  4171  	if libc.X_ThreadRuneLocale != 0 {
  4172  		return libc.X_ThreadRuneLocale
  4173  	}
  4174  	return libc.X_CurrentRuneLocale
  4175  }
  4176  
  4177  func __maskrune(tls *libc.TLS, _c int32, _f uint64) int32 { /* _ctype.h:100:1: */
  4178  	return (int32((func() uint64 {
  4179  		if (_c < 0) || (_c >= (int32(1) << 8)) {
  4180  			return libc.X___runetype(tls, _c)
  4181  		}
  4182  		return *(*uint64)(unsafe.Pointer((__getCurrentRuneLocale(tls) + 64 /* &.__runetype */) + uintptr(_c)*8))
  4183  	}()) & _f))
  4184  }
  4185  
  4186  func __sbmaskrune(tls *libc.TLS, _c int32, _f uint64) int32 { /* _ctype.h:107:1: */
  4187  	if (_c < 0) || (_c >= libc.X__mb_sb_limit) {
  4188  		return 0
  4189  	}
  4190  	return (int32(*(*uint64)(unsafe.Pointer((__getCurrentRuneLocale(tls) + 64 /* &.__runetype */) + uintptr(_c)*8)) & _f))
  4191  }
  4192  
  4193  func __sbistype(tls *libc.TLS, _c int32, _f uint64) int32 { /* _ctype.h:120:1: */
  4194  	return libc.BoolInt32(!(!(__sbmaskrune(tls, _c, _f) != 0)))
  4195  }
  4196  
  4197  func __sbmaskrune_l(tls *libc.TLS, __c int32, __f uint64, __loc locale_t) int32 { /* _ctype.h:104:1: */
  4198  	bp := tls.Alloc(4)
  4199  	defer tls.Free(4)
  4200  
  4201  	// var __limit int32 at bp, 4
  4202  
  4203  	var runes uintptr = libc.X__runes_for_locale(tls, __loc, bp /* &__limit */)
  4204  	if (__c < 0) || (__c >= *(*int32)(unsafe.Pointer(bp /* __limit */))) {
  4205  		return 0
  4206  	}
  4207  	return (int32(*(*uint64)(unsafe.Pointer((runes + 64 /* &.__runetype */) + uintptr(__c)*8)) & __f))
  4208  }
  4209  
  4210  func __sbistype_l(tls *libc.TLS, __c int32, __f uint64, __loc locale_t) int32 { /* _ctype.h:113:1: */
  4211  	return libc.BoolInt32(!(!(__sbmaskrune_l(tls, __c, __f, __loc) != 0)))
  4212  }
  4213  
  4214  // POSIX.1-2001 specifies _tolower() and _toupper() to be macros equivalent to
  4215  // tolower() and toupper() respectively, minus extra checking to ensure that
  4216  // the argument is a lower or uppercase letter respectively.  We've chosen to
  4217  // implement these macros with the same error checking as tolower() and
  4218  // toupper() since this doesn't violate the specification itself, only its
  4219  // intent.  We purposely leave _tolower() and _toupper() undocumented to
  4220  // discourage their use.
  4221  //
  4222  // XXX isascii() and toascii() should similarly be undocumented.
  4223  
  4224  // The suffix to append to the child command lines, if any
  4225  
  4226  // The directory separator character(s)
  4227  
  4228  // Mark a parameter as unused to suppress compiler warnings
  4229  
  4230  // Global data
  4231  type Global = struct {
  4232  	argv0            uintptr
  4233  	zVfs             uintptr
  4234  	zDbFile          uintptr
  4235  	db               uintptr
  4236  	zErrLog          uintptr
  4237  	pErrLog          uintptr
  4238  	zLog             uintptr
  4239  	pLog             uintptr
  4240  	zName            [32]int8
  4241  	taskId           int32
  4242  	iTrace           int32
  4243  	bSqlTrace        int32
  4244  	bIgnoreSqlErrors int32
  4245  	nError           int32
  4246  	nTest            int32
  4247  	iTimeout         int32
  4248  	bSync            int32
  4249  } /* mptest.c:72:8 */
  4250  
  4251  // POSIX.1-2001 specifies _tolower() and _toupper() to be macros equivalent to
  4252  // tolower() and toupper() respectively, minus extra checking to ensure that
  4253  // the argument is a lower or uppercase letter respectively.  We've chosen to
  4254  // implement these macros with the same error checking as tolower() and
  4255  // toupper() since this doesn't violate the specification itself, only its
  4256  // intent.  We purposely leave _tolower() and _toupper() undocumented to
  4257  // discourage their use.
  4258  //
  4259  // XXX isascii() and toascii() should similarly be undocumented.
  4260  
  4261  // The suffix to append to the child command lines, if any
  4262  
  4263  // The directory separator character(s)
  4264  
  4265  // Mark a parameter as unused to suppress compiler warnings
  4266  
  4267  // Global data
  4268  var g Global /* mptest.c:90:3: */
  4269  
  4270  // Default timeout
  4271  
  4272  // Print a message adding zPrefix[] to the beginning of every line.
  4273  func printWithPrefix(tls *libc.TLS, pOut uintptr, zPrefix uintptr, zMsg uintptr) { /* mptest.c:98:13: */
  4274  	bp := tls.Alloc(24)
  4275  	defer tls.Free(24)
  4276  
  4277  	for (zMsg != 0) && (*(*int8)(unsafe.Pointer(zMsg)) != 0) {
  4278  		var i int32
  4279  		for i = 0; ((*(*int8)(unsafe.Pointer(zMsg + uintptr(i))) != 0) && (int32(*(*int8)(unsafe.Pointer(zMsg + uintptr(i)))) != '\n')) && (int32(*(*int8)(unsafe.Pointer(zMsg + uintptr(i)))) != '\r'); i++ {
  4280  		}
  4281  		libc.Xfprintf(tls, pOut, ts /* "%s%.*s\n" */, libc.VaList(bp, zPrefix, i, zMsg))
  4282  		zMsg += uintptr(i)
  4283  		for (int32(*(*int8)(unsafe.Pointer(zMsg))) == '\n') || (int32(*(*int8)(unsafe.Pointer(zMsg))) == '\r') {
  4284  			zMsg++
  4285  		}
  4286  	}
  4287  }
  4288  
  4289  // Compare two pointers to strings, where the pointers might be NULL.
  4290  func safe_strcmp(tls *libc.TLS, a uintptr, b uintptr) int32 { /* mptest.c:111:12: */
  4291  	if a == b {
  4292  		return 0
  4293  	}
  4294  	if a == uintptr(0) {
  4295  		return -1
  4296  	}
  4297  	if b == uintptr(0) {
  4298  		return 1
  4299  	}
  4300  	return libc.Xstrcmp(tls, a, b)
  4301  }
  4302  
  4303  // Return TRUE if string z[] matches glob pattern zGlob[].
  4304  // Return FALSE if the pattern does not match.
  4305  //
  4306  // Globbing rules:
  4307  //
  4308  //      '*'       Matches any sequence of zero or more characters.
  4309  //
  4310  //      '?'       Matches exactly one character.
  4311  //
  4312  //     [...]      Matches one character from the enclosed list of
  4313  //                characters.
  4314  //
  4315  //     [^...]     Matches one character not in the enclosed list.
  4316  //
  4317  //      '#'       Matches any sequence of one or more digits with an
  4318  //                optional + or - sign in front
  4319  func strglob(tls *libc.TLS, zGlob uintptr, z uintptr) int32 { /* mptest.c:136:5: */
  4320  	var c int32
  4321  	var c2 int32
  4322  	var invert int32
  4323  	var seen int32
  4324  
  4325  	for (libc.AssignInt32(&c, int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zGlob, 1)))))) != 0 {
  4326  		if c == '*' {
  4327  			for ((libc.AssignInt32(&c, int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zGlob, 1)))))) == '*') || (c == '?') {
  4328  				if (c == '?') && ((int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))))) == 0) {
  4329  					return 0
  4330  				}
  4331  			}
  4332  			if c == 0 {
  4333  				return 1
  4334  			} else if c == '[' {
  4335  				for (*(*int8)(unsafe.Pointer(z)) != 0) && (strglob(tls, (zGlob-uintptr(1)), z) != 0) {
  4336  					z++
  4337  				}
  4338  				return (libc.Bool32((int32(*(*int8)(unsafe.Pointer(z)))) != 0))
  4339  			}
  4340  			for (libc.AssignInt32(&c2, int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1)))))) != 0 {
  4341  				for c2 != c {
  4342  					c2 = int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))))
  4343  					if c2 == 0 {
  4344  						return 0
  4345  					}
  4346  				}
  4347  				if strglob(tls, zGlob, z) != 0 {
  4348  					return 1
  4349  				}
  4350  			}
  4351  			return 0
  4352  		} else if c == '?' {
  4353  			if (int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))))) == 0 {
  4354  				return 0
  4355  			}
  4356  		} else if c == '[' {
  4357  			var prior_c int32 = 0
  4358  			seen = 0
  4359  			invert = 0
  4360  			c = int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))))
  4361  			if c == 0 {
  4362  				return 0
  4363  			}
  4364  			c2 = int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zGlob, 1))))
  4365  			if c2 == '^' {
  4366  				invert = 1
  4367  				c2 = int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zGlob, 1))))
  4368  			}
  4369  			if c2 == ']' {
  4370  				if c == ']' {
  4371  					seen = 1
  4372  				}
  4373  				c2 = int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zGlob, 1))))
  4374  			}
  4375  			for (c2 != 0) && (c2 != ']') {
  4376  				if (((c2 == '-') && (int32(*(*int8)(unsafe.Pointer(zGlob))) != ']')) && (int32(*(*int8)(unsafe.Pointer(zGlob))) != 0)) && (prior_c > 0) {
  4377  					c2 = int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zGlob, 1))))
  4378  					if (c >= prior_c) && (c <= c2) {
  4379  						seen = 1
  4380  					}
  4381  					prior_c = 0
  4382  				} else {
  4383  					if c == c2 {
  4384  						seen = 1
  4385  					}
  4386  					prior_c = c2
  4387  				}
  4388  				c2 = int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zGlob, 1))))
  4389  			}
  4390  			if (c2 == 0) || ((seen ^ invert) == 0) {
  4391  				return 0
  4392  			}
  4393  		} else if c == '#' {
  4394  			if ((int32(*(*int8)(unsafe.Pointer(z))) == '-') || (int32(*(*int8)(unsafe.Pointer(z))) == '+')) && (__sbistype(tls, int32(uint8(*(*int8)(unsafe.Pointer(z + 1)))), uint64(X_CTYPE_D)) != 0) {
  4395  				z++
  4396  			}
  4397  			if !(__sbistype(tls, int32(uint8(*(*int8)(unsafe.Pointer(z)))), uint64(X_CTYPE_D)) != 0) {
  4398  				return 0
  4399  			}
  4400  			z++
  4401  			for __sbistype(tls, int32(uint8(*(*int8)(unsafe.Pointer(z)))), uint64(X_CTYPE_D)) != 0 {
  4402  				z++
  4403  			}
  4404  		} else {
  4405  			if c != (int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))))) {
  4406  				return 0
  4407  			}
  4408  		}
  4409  	}
  4410  	return (libc.Bool32(int32(*(*int8)(unsafe.Pointer(z))) == 0))
  4411  }
  4412  
  4413  // Close output stream pOut if it is not stdout or stderr
  4414  func maybeClose(tls *libc.TLS, pOut uintptr) { /* mptest.c:208:13: */
  4415  	if (pOut != libc.X__stdoutp) && (pOut != libc.X__stderrp) {
  4416  		libc.Xfclose(tls, pOut)
  4417  	}
  4418  }
  4419  
  4420  // Print an error message
  4421  func errorMessage(tls *libc.TLS, zFormat uintptr, va uintptr) { /* mptest.c:215:13: */
  4422  	bp := tls.Alloc(38)
  4423  	defer tls.Free(38)
  4424  
  4425  	var ap va_list
  4426  	_ = ap
  4427  	var zMsg uintptr
  4428  	// var zPrefix [30]int8 at bp+8, 30
  4429  
  4430  	ap = va
  4431  	zMsg = sqlite3.Xsqlite3_vmprintf(tls, zFormat, ap)
  4432  	_ = ap
  4433  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([30]int8{})), bp+8 /* &zPrefix[0] */, ts+8 /* "%s:ERROR: " */, libc.VaList(bp, uintptr(unsafe.Pointer(&g))+64 /* &.zName */))
  4434  	if g.pLog != 0 {
  4435  		printWithPrefix(tls, g.pLog, bp+8 /* &zPrefix[0] */, zMsg)
  4436  		libc.Xfflush(tls, g.pLog)
  4437  	}
  4438  	if (g.pErrLog != 0) && (safe_strcmp(tls, g.zErrLog, g.zLog) != 0) {
  4439  		printWithPrefix(tls, g.pErrLog, bp+8 /* &zPrefix[0] */, zMsg)
  4440  		libc.Xfflush(tls, g.pErrLog)
  4441  	}
  4442  	sqlite3.Xsqlite3_free(tls, zMsg)
  4443  	g.nError++
  4444  }
  4445  
  4446  // Print an error message and then quit.
  4447  func fatalError(tls *libc.TLS, zFormat uintptr, va uintptr) { /* mptest.c:241:13: */
  4448  	bp := tls.Alloc(38)
  4449  	defer tls.Free(38)
  4450  
  4451  	var ap va_list
  4452  	_ = ap
  4453  	var zMsg uintptr
  4454  	// var zPrefix [30]int8 at bp+8, 30
  4455  
  4456  	ap = va
  4457  	zMsg = sqlite3.Xsqlite3_vmprintf(tls, zFormat, ap)
  4458  	_ = ap
  4459  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([30]int8{})), bp+8 /* &zPrefix[0] */, ts+19 /* "%s:FATAL: " */, libc.VaList(bp, uintptr(unsafe.Pointer(&g))+64 /* &.zName */))
  4460  	if g.pLog != 0 {
  4461  		printWithPrefix(tls, g.pLog, bp+8 /* &zPrefix[0] */, zMsg)
  4462  		libc.Xfflush(tls, g.pLog)
  4463  		maybeClose(tls, g.pLog)
  4464  	}
  4465  	if (g.pErrLog != 0) && (safe_strcmp(tls, g.zErrLog, g.zLog) != 0) {
  4466  		printWithPrefix(tls, g.pErrLog, bp+8 /* &zPrefix[0] */, zMsg)
  4467  		libc.Xfflush(tls, g.pErrLog)
  4468  		maybeClose(tls, g.pErrLog)
  4469  	}
  4470  	sqlite3.Xsqlite3_free(tls, zMsg)
  4471  	if g.db != 0 {
  4472  		var nTry int32 = 0
  4473  		g.iTimeout = 0
  4474  		for (trySql(tls, ts+30 /* "UPDATE client SE..." */, 0) == SQLITE_BUSY) &&
  4475  			((libc.PostIncInt32(&nTry, 1)) < 100) {
  4476  			sqlite3.Xsqlite3_sleep(tls, 10)
  4477  		}
  4478  	}
  4479  	sqlite3.Xsqlite3_close(tls, g.db)
  4480  	libc.Xexit(tls, 1)
  4481  }
  4482  
  4483  // Print a log message
  4484  func logMessage(tls *libc.TLS, zFormat uintptr, va uintptr) { /* mptest.c:276:13: */
  4485  	bp := tls.Alloc(38)
  4486  	defer tls.Free(38)
  4487  
  4488  	var ap va_list
  4489  	_ = ap
  4490  	var zMsg uintptr
  4491  	// var zPrefix [30]int8 at bp+8, 30
  4492  
  4493  	ap = va
  4494  	zMsg = sqlite3.Xsqlite3_vmprintf(tls, zFormat, ap)
  4495  	_ = ap
  4496  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([30]int8{})), bp+8 /* &zPrefix[0] */, ts+60 /* "%s: " */, libc.VaList(bp, uintptr(unsafe.Pointer(&g))+64 /* &.zName */))
  4497  	if g.pLog != 0 {
  4498  		printWithPrefix(tls, g.pLog, bp+8 /* &zPrefix[0] */, zMsg)
  4499  		libc.Xfflush(tls, g.pLog)
  4500  	}
  4501  	sqlite3.Xsqlite3_free(tls, zMsg)
  4502  }
  4503  
  4504  // Return the length of a string omitting trailing whitespace
  4505  func clipLength(tls *libc.TLS, z uintptr) int32 { /* mptest.c:294:12: */
  4506  	var n int32 = int32(libc.Xstrlen(tls, z))
  4507  	for (n > 0) && (__sbistype(tls, int32(uint8(*(*int8)(unsafe.Pointer(z + uintptr((n - 1)))))), uint64(X_CTYPE_S)) != 0) {
  4508  		n--
  4509  	}
  4510  	return n
  4511  }
  4512  
  4513  // Auxiliary SQL function to return the name of the VFS
  4514  func vfsNameFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* mptest.c:303:13: */
  4515  	bp := tls.Alloc(8)
  4516  	defer tls.Free(8)
  4517  
  4518  	var db uintptr = sqlite3.Xsqlite3_context_db_handle(tls, context)
  4519  	*(*uintptr)(unsafe.Pointer(bp /* zVfs */)) = uintptr(0)
  4520  	_ = argc
  4521  	_ = argv
  4522  	sqlite3.Xsqlite3_file_control(tls, db, ts+65 /* "main" */, SQLITE_FCNTL_VFSNAME, bp /* &zVfs */)
  4523  	if *(*uintptr)(unsafe.Pointer(bp /* zVfs */)) != 0 {
  4524  		sqlite3.Xsqlite3_result_text(tls, context, *(*uintptr)(unsafe.Pointer(bp /* zVfs */)), -1, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{sqlite3.Xsqlite3_free})))
  4525  	}
  4526  }
  4527  
  4528  // Busy handler with a g.iTimeout-millisecond timeout
  4529  func busyHandler(tls *libc.TLS, pCD uintptr, count int32) int32 { /* mptest.c:321:12: */
  4530  	bp := tls.Alloc(8)
  4531  	defer tls.Free(8)
  4532  
  4533  	_ = pCD
  4534  	if (count * 10) > g.iTimeout {
  4535  		if g.iTimeout > 0 {
  4536  			errorMessage(tls, ts+70 /* "timeout after %d..." */, libc.VaList(bp, g.iTimeout))
  4537  		}
  4538  		return 0
  4539  	}
  4540  	sqlite3.Xsqlite3_sleep(tls, 10)
  4541  	return 1
  4542  }
  4543  
  4544  // SQL Trace callback
  4545  func sqlTraceCallback(tls *libc.TLS, NotUsed1 uintptr, zSql uintptr) { /* mptest.c:334:13: */
  4546  	bp := tls.Alloc(16)
  4547  	defer tls.Free(16)
  4548  
  4549  	_ = NotUsed1
  4550  	logMessage(tls, ts+89 /* "[%.*s]" */, libc.VaList(bp, clipLength(tls, zSql), zSql))
  4551  }
  4552  
  4553  // SQL error log callback
  4554  func sqlErrorCallback(tls *libc.TLS, pArg uintptr, iErrCode int32, zMsg uintptr) { /* mptest.c:342:13: */
  4555  	bp := tls.Alloc(24)
  4556  	defer tls.Free(24)
  4557  
  4558  	_ = pArg
  4559  	if (iErrCode == SQLITE_ERROR) && (g.bIgnoreSqlErrors != 0) {
  4560  		return
  4561  	}
  4562  	if ((iErrCode & 0xff) == SQLITE_SCHEMA) && (g.iTrace < 3) {
  4563  		return
  4564  	}
  4565  	if ((g.iTimeout == 0) && ((iErrCode & 0xff) == SQLITE_BUSY)) && (g.iTrace < 3) {
  4566  		return
  4567  	}
  4568  	if (iErrCode & 0xff) == SQLITE_NOTICE {
  4569  		logMessage(tls, ts+96 /* "(info) %s" */, libc.VaList(bp, zMsg))
  4570  	} else {
  4571  		errorMessage(tls, ts+106 /* "(errcode=%d) %s" */, libc.VaList(bp+8, iErrCode, zMsg))
  4572  	}
  4573  }
  4574  
  4575  // Prepare an SQL statement.  Issue a fatal error if unable.
  4576  func prepareSql(tls *libc.TLS, zFormat uintptr, va uintptr) uintptr { /* mptest.c:357:21: */
  4577  	bp := tls.Alloc(24)
  4578  	defer tls.Free(24)
  4579  
  4580  	var ap va_list
  4581  	_ = ap
  4582  	var zSql uintptr
  4583  	var rc int32
  4584  	*(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)) = uintptr(0)
  4585  	ap = va
  4586  	zSql = sqlite3.Xsqlite3_vmprintf(tls, zFormat, ap)
  4587  	_ = ap
  4588  	rc = sqlite3.Xsqlite3_prepare_v2(tls, g.db, zSql, -1, bp+16 /* &pStmt */, uintptr(0))
  4589  	if rc != SQLITE_OK {
  4590  		sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)))
  4591  		fatalError(tls, ts+122 /* "%s\n%s\n" */, libc.VaList(bp, sqlite3.Xsqlite3_errmsg(tls, g.db), zSql))
  4592  	}
  4593  	sqlite3.Xsqlite3_free(tls, zSql)
  4594  	return *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))
  4595  }
  4596  
  4597  // Run arbitrary SQL.  Issue a fatal error on failure.
  4598  func runSql(tls *libc.TLS, zFormat uintptr, va uintptr) { /* mptest.c:377:13: */
  4599  	bp := tls.Alloc(16)
  4600  	defer tls.Free(16)
  4601  
  4602  	var ap va_list
  4603  	_ = ap
  4604  	var zSql uintptr
  4605  	var rc int32
  4606  	ap = va
  4607  	zSql = sqlite3.Xsqlite3_vmprintf(tls, zFormat, ap)
  4608  	_ = ap
  4609  	rc = sqlite3.Xsqlite3_exec(tls, g.db, zSql, uintptr(0), uintptr(0), uintptr(0))
  4610  	if rc != SQLITE_OK {
  4611  		fatalError(tls, ts+122 /* "%s\n%s\n" */, libc.VaList(bp, sqlite3.Xsqlite3_errmsg(tls, g.db), zSql))
  4612  	}
  4613  	sqlite3.Xsqlite3_free(tls, zSql)
  4614  }
  4615  
  4616  // Try to run arbitrary SQL.  Return success code.
  4617  func trySql(tls *libc.TLS, zFormat uintptr, va uintptr) int32 { /* mptest.c:394:12: */
  4618  	var ap va_list
  4619  	_ = ap
  4620  	var zSql uintptr
  4621  	var rc int32
  4622  	ap = va
  4623  	zSql = sqlite3.Xsqlite3_vmprintf(tls, zFormat, ap)
  4624  	_ = ap
  4625  	rc = sqlite3.Xsqlite3_exec(tls, g.db, zSql, uintptr(0), uintptr(0), uintptr(0))
  4626  	sqlite3.Xsqlite3_free(tls, zSql)
  4627  	return rc
  4628  }
  4629  
  4630  // Structure for holding an arbitrary length string
  4631  type String1 = struct {
  4632  	z      uintptr
  4633  	n      int32
  4634  	nAlloc int32
  4635  } /* mptest.c:408:9 */
  4636  
  4637  // Structure for holding an arbitrary length string
  4638  type String = String1 /* mptest.c:408:23 */
  4639  
  4640  // Free a string
  4641  func stringFree(tls *libc.TLS, p uintptr) { /* mptest.c:416:13: */
  4642  	if (*String)(unsafe.Pointer(p)).z != 0 {
  4643  		sqlite3.Xsqlite3_free(tls, (*String)(unsafe.Pointer(p)).z)
  4644  	}
  4645  	libc.Xmemset(tls, p, 0, uint64(unsafe.Sizeof(String{})))
  4646  }
  4647  
  4648  // Append n bytes of text to a string.  If n<0 append the entire string.
  4649  func stringAppend(tls *libc.TLS, p uintptr, z uintptr, n int32) { /* mptest.c:422:13: */
  4650  	if n < 0 {
  4651  		n = int32(libc.Xstrlen(tls, z))
  4652  	}
  4653  	if ((*String)(unsafe.Pointer(p)).n + n) >= (*String)(unsafe.Pointer(p)).nAlloc {
  4654  		var nAlloc int32 = ((((*String)(unsafe.Pointer(p)).nAlloc * 2) + n) + 100)
  4655  		var zNew uintptr = sqlite3.Xsqlite3_realloc(tls, (*String)(unsafe.Pointer(p)).z, nAlloc)
  4656  		if zNew == uintptr(0) {
  4657  			fatalError(tls, ts+129 /* "out of memory" */, 0)
  4658  		}
  4659  		(*String)(unsafe.Pointer(p)).z = zNew
  4660  		(*String)(unsafe.Pointer(p)).nAlloc = nAlloc
  4661  	}
  4662  	libc.Xmemcpy(tls, ((*String)(unsafe.Pointer(p)).z + uintptr((*String)(unsafe.Pointer(p)).n)), z, uint64(n))
  4663  	*(*int32)(unsafe.Pointer(p + 8 /* &.n */)) += (n)
  4664  	*(*int8)(unsafe.Pointer((*String)(unsafe.Pointer(p)).z + uintptr((*String)(unsafe.Pointer(p)).n))) = int8(0)
  4665  }
  4666  
  4667  // Reset a string to an empty string
  4668  func stringReset(tls *libc.TLS, p uintptr) { /* mptest.c:437:13: */
  4669  	if (*String)(unsafe.Pointer(p)).z == uintptr(0) {
  4670  		stringAppend(tls, p, ts+143 /* " " */, 1)
  4671  	}
  4672  	(*String)(unsafe.Pointer(p)).n = 0
  4673  	*(*int8)(unsafe.Pointer((*String)(unsafe.Pointer(p)).z)) = int8(0)
  4674  }
  4675  
  4676  // Append a new token onto the end of the string
  4677  func stringAppendTerm(tls *libc.TLS, p uintptr, z uintptr) { /* mptest.c:444:13: */
  4678  	var i int32
  4679  	if (*String)(unsafe.Pointer(p)).n != 0 {
  4680  		stringAppend(tls, p, ts+143 /* " " */, 1)
  4681  	}
  4682  	if z == uintptr(0) {
  4683  		stringAppend(tls, p, ts+145 /* "nil" */, 3)
  4684  		return
  4685  	}
  4686  	for i = 0; (*(*int8)(unsafe.Pointer(z + uintptr(i))) != 0) && !(__sbistype(tls, int32(uint8(*(*int8)(unsafe.Pointer(z + uintptr(i))))), uint64(X_CTYPE_S)) != 0); i++ {
  4687  	}
  4688  	if (i > 0) && (int32(*(*int8)(unsafe.Pointer(z + uintptr(i)))) == 0) {
  4689  		stringAppend(tls, p, z, i)
  4690  		return
  4691  	}
  4692  	stringAppend(tls, p, ts+149 /* "'" */, 1)
  4693  	for *(*int8)(unsafe.Pointer(z)) != 0 {
  4694  		for i = 0; (*(*int8)(unsafe.Pointer(z + uintptr(i))) != 0) && (int32(*(*int8)(unsafe.Pointer(z + uintptr(i)))) != '\''); i++ {
  4695  		}
  4696  		if *(*int8)(unsafe.Pointer(z + uintptr(i))) != 0 {
  4697  			stringAppend(tls, p, z, (i + 1))
  4698  			stringAppend(tls, p, ts+149 /* "'" */, 1)
  4699  			z += (uintptr(i + 1))
  4700  		} else {
  4701  			stringAppend(tls, p, z, i)
  4702  			break
  4703  		}
  4704  	}
  4705  	stringAppend(tls, p, ts+149 /* "'" */, 1)
  4706  }
  4707  
  4708  // Callback function for evalSql()
  4709  func evalCallback(tls *libc.TLS, pCData uintptr, argc int32, argv uintptr, azCol uintptr) int32 { /* mptest.c:474:12: */
  4710  	var p uintptr = pCData
  4711  	var i int32
  4712  	_ = azCol
  4713  	for i = 0; i < argc; i++ {
  4714  		stringAppendTerm(tls, p, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)))
  4715  	}
  4716  	return 0
  4717  }
  4718  
  4719  // Run arbitrary SQL and record the results in an output string
  4720  // given by the first parameter.
  4721  func evalSql(tls *libc.TLS, p uintptr, zFormat uintptr, va uintptr) int32 { /* mptest.c:486:12: */
  4722  	bp := tls.Alloc(46)
  4723  	defer tls.Free(46)
  4724  
  4725  	var ap va_list
  4726  	_ = ap
  4727  	var zSql uintptr
  4728  	var rc int32
  4729  	*(*uintptr)(unsafe.Pointer(bp + 8 /* zErrMsg */)) = uintptr(0)
  4730  	ap = va
  4731  	zSql = sqlite3.Xsqlite3_vmprintf(tls, zFormat, ap)
  4732  	_ = ap
  4733  
  4734  	rc = sqlite3.Xsqlite3_exec(tls, g.db, zSql, *(*uintptr)(unsafe.Pointer(&struct {
  4735  		f func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32
  4736  	}{evalCallback})), p, bp+8 /* &zErrMsg */)
  4737  	sqlite3.Xsqlite3_free(tls, zSql)
  4738  	if rc != 0 {
  4739  		// var zErr [30]int8 at bp+16, 30
  4740  
  4741  		sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([30]int8{})), bp+16 /* &zErr[0] */, ts+151 /* "error(%d)" */, libc.VaList(bp, rc))
  4742  		stringAppendTerm(tls, p, bp+16 /* &zErr[0] */)
  4743  		if *(*uintptr)(unsafe.Pointer(bp + 8 /* zErrMsg */)) != 0 {
  4744  			stringAppendTerm(tls, p, *(*uintptr)(unsafe.Pointer(bp + 8 /* zErrMsg */)))
  4745  			sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* zErrMsg */)))
  4746  		}
  4747  	}
  4748  	return rc
  4749  }
  4750  
  4751  // Auxiliary SQL function to recursively evaluate SQL.
  4752  func evalFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* mptest.c:512:13: */
  4753  	bp := tls.Alloc(24)
  4754  	defer tls.Free(24)
  4755  
  4756  	var db uintptr = sqlite3.Xsqlite3_context_db_handle(tls, context)
  4757  	var zSql uintptr = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
  4758  	// var res String at bp, 16
  4759  
  4760  	*(*uintptr)(unsafe.Pointer(bp + 16 /* zErrMsg */)) = uintptr(0)
  4761  	var rc int32
  4762  	_ = argc
  4763  	libc.Xmemset(tls, bp /* &res */, 0, uint64(unsafe.Sizeof(String{})))
  4764  	rc = sqlite3.Xsqlite3_exec(tls, db, zSql, *(*uintptr)(unsafe.Pointer(&struct {
  4765  		f func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32
  4766  	}{evalCallback})), bp /* &res */, bp+16 /* &zErrMsg */)
  4767  	if *(*uintptr)(unsafe.Pointer(bp + 16 /* zErrMsg */)) != 0 {
  4768  		sqlite3.Xsqlite3_result_error(tls, context, *(*uintptr)(unsafe.Pointer(bp + 16 /* zErrMsg */)), -1)
  4769  		sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* zErrMsg */)))
  4770  	} else if rc != 0 {
  4771  		sqlite3.Xsqlite3_result_error_code(tls, context, rc)
  4772  	} else {
  4773  		sqlite3.Xsqlite3_result_text(tls, context, (*String)(unsafe.Pointer(bp /* &res */)).z, -1, libc.UintptrFromInt32(-1))
  4774  	}
  4775  	stringFree(tls, bp /* &res */)
  4776  }
  4777  
  4778  // Look up the next task for client iClient in the database.
  4779  // Return the task script and the task number and mark that
  4780  // task as being under way.
  4781  func startScript(tls *libc.TLS, iClient int32, pzScript uintptr, pTaskId uintptr, pzTaskName uintptr) int32 { /* mptest.c:541:12: */
  4782  	bp := tls.Alloc(80)
  4783  	defer tls.Free(80)
  4784  
  4785  	var pStmt uintptr = uintptr(0)
  4786  	var taskId int32
  4787  	var rc int32
  4788  	var totalTime int32 = 0
  4789  
  4790  	*(*uintptr)(unsafe.Pointer(pzScript)) = uintptr(0)
  4791  	g.iTimeout = 0
  4792  	for 1 != 0 {
  4793  		rc = trySql(tls, ts+161 /* "BEGIN IMMEDIATE" */, 0)
  4794  		if rc == SQLITE_BUSY {
  4795  			sqlite3.Xsqlite3_sleep(tls, 10)
  4796  			totalTime = totalTime + (10)
  4797  			continue
  4798  		}
  4799  		if rc != SQLITE_OK {
  4800  			fatalError(tls, ts+177 /* "in startScript: ..." */, libc.VaList(bp, sqlite3.Xsqlite3_errmsg(tls, g.db)))
  4801  		}
  4802  		if (g.nError != 0) || (g.nTest != 0) {
  4803  			runSql(tls, ts+196, /* "UPDATE counters ..." */
  4804  				libc.VaList(bp+8, g.nError, g.nTest))
  4805  			g.nError = 0
  4806  			g.nTest = 0
  4807  		}
  4808  		pStmt = prepareSql(tls, ts+249 /* "SELECT 1 FROM cl..." */, libc.VaList(bp+24, iClient))
  4809  		rc = sqlite3.Xsqlite3_step(tls, pStmt)
  4810  		sqlite3.Xsqlite3_finalize(tls, pStmt)
  4811  		if rc == SQLITE_ROW {
  4812  			runSql(tls, ts+295 /* "DELETE FROM clie..." */, libc.VaList(bp+32, iClient))
  4813  			g.iTimeout = DEFAULT_TIMEOUT
  4814  			runSql(tls, ts+326 /* "COMMIT TRANSACTI..." */, 0)
  4815  			return SQLITE_DONE
  4816  		}
  4817  		pStmt = prepareSql(tls,
  4818  
  4819  			ts+346 /* "SELECT script, i..." */, libc.VaList(bp+40, iClient))
  4820  		rc = sqlite3.Xsqlite3_step(tls, pStmt)
  4821  		if rc == SQLITE_ROW {
  4822  			var n int32 = sqlite3.Xsqlite3_column_bytes(tls, pStmt, 0)
  4823  			*(*uintptr)(unsafe.Pointer(pzScript)) = sqlite3.Xsqlite3_malloc(tls, (n + 1))
  4824  			libc.Xstrcpy(tls, *(*uintptr)(unsafe.Pointer(pzScript)), sqlite3.Xsqlite3_column_text(tls, pStmt, 0))
  4825  			*(*int32)(unsafe.Pointer(pTaskId)) = libc.AssignInt32(&taskId, sqlite3.Xsqlite3_column_int(tls, pStmt, 1))
  4826  			*(*uintptr)(unsafe.Pointer(pzTaskName)) = sqlite3.Xsqlite3_mprintf(tls, ts+438 /* "%s" */, libc.VaList(bp+48, sqlite3.Xsqlite3_column_text(tls, pStmt, 2)))
  4827  			sqlite3.Xsqlite3_finalize(tls, pStmt)
  4828  			runSql(tls,
  4829  
  4830  				ts+441 /* "UPDATE task   SE..." */, libc.VaList(bp+56, taskId))
  4831  			g.iTimeout = DEFAULT_TIMEOUT
  4832  			runSql(tls, ts+326 /* "COMMIT TRANSACTI..." */, 0)
  4833  			return SQLITE_OK
  4834  		}
  4835  		sqlite3.Xsqlite3_finalize(tls, pStmt)
  4836  		if rc == SQLITE_DONE {
  4837  			if totalTime > 30000 {
  4838  				errorMessage(tls, ts+524 /* "Waited over 30 s..." */, 0)
  4839  				runSql(tls, ts+573 /* "DELETE FROM clie..." */, libc.VaList(bp+64, iClient))
  4840  				sqlite3.Xsqlite3_close(tls, g.db)
  4841  				libc.Xexit(tls, 1)
  4842  			}
  4843  			for trySql(tls, ts+613 /* "COMMIT" */, 0) == SQLITE_BUSY {
  4844  				sqlite3.Xsqlite3_sleep(tls, 10)
  4845  				totalTime = totalTime + (10)
  4846  			}
  4847  			sqlite3.Xsqlite3_sleep(tls, 100)
  4848  			totalTime = totalTime + (100)
  4849  			continue
  4850  		}
  4851  		fatalError(tls, ts+438 /* "%s" */, libc.VaList(bp+72, sqlite3.Xsqlite3_errmsg(tls, g.db)))
  4852  	}
  4853  	g.iTimeout = DEFAULT_TIMEOUT
  4854  	return int32(0)
  4855  }
  4856  
  4857  // Mark a script as having finished.   Remove the CLIENT table entry
  4858  // if bShutdown is true.
  4859  func finishScript(tls *libc.TLS, iClient int32, taskId int32, bShutdown int32) int32 { /* mptest.c:623:12: */
  4860  	bp := tls.Alloc(16)
  4861  	defer tls.Free(16)
  4862  
  4863  	runSql(tls,
  4864  
  4865  		ts+620 /* "UPDATE task   SE..." */, libc.VaList(bp, taskId))
  4866  	if bShutdown != 0 {
  4867  		runSql(tls, ts+295 /* "DELETE FROM clie..." */, libc.VaList(bp+8, iClient))
  4868  	}
  4869  	return SQLITE_OK
  4870  }
  4871  
  4872  // Start up a client process for iClient, if it is not already
  4873  // running.  If the client is already running, then this routine
  4874  // is a no-op.
  4875  func startClient(tls *libc.TLS, iClient int32) { /* mptest.c:638:13: */
  4876  	bp := tls.Alloc(96)
  4877  	defer tls.Free(96)
  4878  
  4879  	runSql(tls, ts+701 /* "INSERT OR IGNORE..." */, libc.VaList(bp, iClient))
  4880  	if sqlite3.Xsqlite3_changes(tls, g.db) != 0 {
  4881  		var zSys uintptr
  4882  		var rc int32
  4883  		zSys = sqlite3.Xsqlite3_mprintf(tls, ts+743, /* "%s \"%s\" --client..." */
  4884  			libc.VaList(bp+8, g.argv0, g.zDbFile, iClient, g.iTrace))
  4885  		if g.bSqlTrace != 0 {
  4886  			zSys = sqlite3.Xsqlite3_mprintf(tls, ts+774 /* "%z --sqltrace" */, libc.VaList(bp+40, zSys))
  4887  		}
  4888  		if g.bSync != 0 {
  4889  			zSys = sqlite3.Xsqlite3_mprintf(tls, ts+788 /* "%z --sync" */, libc.VaList(bp+48, zSys))
  4890  		}
  4891  		if g.zVfs != 0 {
  4892  			zSys = sqlite3.Xsqlite3_mprintf(tls, ts+798 /* "%z --vfs \"%s\"" */, libc.VaList(bp+56, zSys, g.zVfs))
  4893  		}
  4894  		if g.iTrace >= 2 {
  4895  			logMessage(tls, ts+812 /* "system('%q')" */, libc.VaList(bp+72, zSys))
  4896  		}
  4897  		zSys = sqlite3.Xsqlite3_mprintf(tls, ts+825 /* "%z &" */, libc.VaList(bp+80, zSys))
  4898  		rc = libc.Xsystem(tls, zSys)
  4899  		if rc != 0 {
  4900  			errorMessage(tls, ts+830 /* "system() fails w..." */, libc.VaList(bp+88, rc))
  4901  		}
  4902  		sqlite3.Xsqlite3_free(tls, zSys)
  4903  	}
  4904  }
  4905  
  4906  // Read the entire content of a file into memory
  4907  func readFile(tls *libc.TLS, zFilename uintptr) uintptr { /* mptest.c:684:13: */
  4908  	bp := tls.Alloc(8)
  4909  	defer tls.Free(8)
  4910  
  4911  	var in uintptr = libc.Xfopen(tls, zFilename, ts+864 /* "rb" */)
  4912  	var sz int64
  4913  	var z uintptr
  4914  	if in == uintptr(0) {
  4915  		fatalError(tls, ts+867 /* "cannot open \"%s\"..." */, libc.VaList(bp, zFilename))
  4916  	}
  4917  	libc.Xfseek(tls, in, int64(0), SEEK_END)
  4918  	sz = libc.Xftell(tls, in)
  4919  	libc.Xrewind(tls, in)
  4920  	z = sqlite3.Xsqlite3_malloc(tls, (int32(sz + int64(1))))
  4921  	sz = int64(libc.Xfread(tls, z, uint64(1), uint64(sz), in))
  4922  	*(*int8)(unsafe.Pointer(z + uintptr(sz))) = int8(0)
  4923  	libc.Xfclose(tls, in)
  4924  	return z
  4925  }
  4926  
  4927  // Return the length of the next token.
  4928  func tokenLength(tls *libc.TLS, z uintptr, pnLine uintptr) int32 { /* mptest.c:704:12: */
  4929  	var n int32 = 0
  4930  	if (__sbistype(tls, int32(uint8(*(*int8)(unsafe.Pointer(z)))), uint64(X_CTYPE_S)) != 0) || ((int32(*(*int8)(unsafe.Pointer(z))) == '/') && (int32(*(*int8)(unsafe.Pointer(z + 1))) == '*')) {
  4931  		var inC int32 = 0
  4932  		var c int32
  4933  		if int32(*(*int8)(unsafe.Pointer(z))) == '/' {
  4934  			inC = 1
  4935  			n = 2
  4936  		}
  4937  		for (libc.AssignInt32(&c, int32(*(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&n, 1))))))) != 0 {
  4938  			if c == '\n' {
  4939  				(*(*int32)(unsafe.Pointer(pnLine)))++
  4940  			}
  4941  			if __sbistype(tls, int32(uint8(c)), uint64(X_CTYPE_S)) != 0 {
  4942  				continue
  4943  			}
  4944  			if ((inC != 0) && (c == '*')) && (int32(*(*int8)(unsafe.Pointer(z + uintptr(n)))) == '/') {
  4945  				n++
  4946  				inC = 0
  4947  			} else if (!(inC != 0) && (c == '/')) && (int32(*(*int8)(unsafe.Pointer(z + uintptr(n)))) == '*') {
  4948  				n++
  4949  				inC = 1
  4950  			} else if !(inC != 0) {
  4951  				break
  4952  			}
  4953  		}
  4954  		n--
  4955  	} else if (int32(*(*int8)(unsafe.Pointer(z))) == '-') && (int32(*(*int8)(unsafe.Pointer(z + 1))) == '-') {
  4956  		for n = 2; (*(*int8)(unsafe.Pointer(z + uintptr(n))) != 0) && (int32(*(*int8)(unsafe.Pointer(z + uintptr(n)))) != '\n'); n++ {
  4957  		}
  4958  		if *(*int8)(unsafe.Pointer(z + uintptr(n))) != 0 {
  4959  			(*(*int32)(unsafe.Pointer(pnLine)))++
  4960  			n++
  4961  		}
  4962  	} else if (int32(*(*int8)(unsafe.Pointer(z))) == '"') || (int32(*(*int8)(unsafe.Pointer(z))) == '\'') {
  4963  		var delim int32 = int32(*(*int8)(unsafe.Pointer(z)))
  4964  		for n = 1; *(*int8)(unsafe.Pointer(z + uintptr(n))) != 0; n++ {
  4965  			if int32(*(*int8)(unsafe.Pointer(z + uintptr(n)))) == '\n' {
  4966  				(*(*int32)(unsafe.Pointer(pnLine)))++
  4967  			}
  4968  			if int32(*(*int8)(unsafe.Pointer(z + uintptr(n)))) == delim {
  4969  				n++
  4970  				if int32(*(*int8)(unsafe.Pointer(z + uintptr((n + 1))))) != delim {
  4971  					break
  4972  				}
  4973  			}
  4974  		}
  4975  	} else {
  4976  		var c int32
  4977  		for n = 1; (((((libc.AssignInt32(&c, int32(*(*int8)(unsafe.Pointer(z + uintptr(n)))))) != 0) && !(__sbistype(tls, int32(uint8(c)), uint64(X_CTYPE_S)) != 0)) && (c != '"')) && (c != '\'')) && (c != ';'); n++ {
  4978  		}
  4979  	}
  4980  	return n
  4981  }
  4982  
  4983  // Copy a single token into a string buffer.
  4984  func extractToken(tls *libc.TLS, zIn uintptr, nIn int32, zOut uintptr, nOut int32) int32 { /* mptest.c:749:12: */
  4985  	var i int32
  4986  	if nIn <= 0 {
  4987  		*(*int8)(unsafe.Pointer(zOut)) = int8(0)
  4988  		return 0
  4989  	}
  4990  	for i = 0; ((i < nIn) && (i < (nOut - 1))) && !(__sbistype(tls, int32(uint8(*(*int8)(unsafe.Pointer(zIn + uintptr(i))))), uint64(X_CTYPE_S)) != 0); i++ {
  4991  		*(*int8)(unsafe.Pointer(zOut + uintptr(i))) = *(*int8)(unsafe.Pointer(zIn + uintptr(i)))
  4992  	}
  4993  	*(*int8)(unsafe.Pointer(zOut + uintptr(i))) = int8(0)
  4994  	return i
  4995  }
  4996  
  4997  // Find the number of characters up to the start of the next "--end" token.
  4998  func findEnd(tls *libc.TLS, z uintptr, pnLine uintptr) int32 { /* mptest.c:763:12: */
  4999  	var n int32 = 0
  5000  	for (*(*int8)(unsafe.Pointer(z + uintptr(n))) != 0) && ((libc.Xstrncmp(tls, (z+uintptr(n)), ts+896 /* "--end" */, uint64(5)) != 0) || !(__sbistype(tls, int32(uint8(*(*int8)(unsafe.Pointer(z + uintptr((n + 5)))))), uint64(X_CTYPE_S)) != 0)) {
  5001  		n = n + (tokenLength(tls, (z + uintptr(n)), pnLine))
  5002  	}
  5003  	return n
  5004  }
  5005  
  5006  // Find the number of characters up to the first character past the
  5007  // of the next "--endif"  or "--else" token. Nested --if commands are
  5008  // also skipped.
  5009  func findEndif(tls *libc.TLS, z uintptr, stopAtElse int32, pnLine uintptr) int32 { /* mptest.c:776:12: */
  5010  	var n int32 = 0
  5011  	for *(*int8)(unsafe.Pointer(z + uintptr(n))) != 0 {
  5012  		var len int32 = tokenLength(tls, (z + uintptr(n)), pnLine)
  5013  		if ((libc.Xstrncmp(tls, (z+uintptr(n)), ts+902 /* "--endif" */, uint64(7)) == 0) && (__sbistype(tls, int32(uint8(*(*int8)(unsafe.Pointer(z + uintptr((n + 7)))))), uint64(X_CTYPE_S)) != 0)) ||
  5014  			(((stopAtElse != 0) && (libc.Xstrncmp(tls, (z+uintptr(n)), ts+910 /* "--else" */, uint64(6)) == 0)) && (__sbistype(tls, int32(uint8(*(*int8)(unsafe.Pointer(z + uintptr((n + 6)))))), uint64(X_CTYPE_S)) != 0)) {
  5015  			return (n + len)
  5016  		}
  5017  		if (libc.Xstrncmp(tls, (z+uintptr(n)), ts+917 /* "--if" */, uint64(4)) == 0) && (__sbistype(tls, int32(uint8(*(*int8)(unsafe.Pointer(z + uintptr((n + 4)))))), uint64(X_CTYPE_S)) != 0) {
  5018  			var skip int32 = findEndif(tls, ((z + uintptr(n)) + uintptr(len)), 0, pnLine)
  5019  			n = n + (skip + len)
  5020  		} else {
  5021  			n = n + (len)
  5022  		}
  5023  	}
  5024  	return n
  5025  }
  5026  
  5027  // Wait for a client process to complete all its tasks
  5028  func waitForClient(tls *libc.TLS, iClient int32, iTimeout int32, zErrPrefix uintptr) { /* mptest.c:798:13: */
  5029  	bp := tls.Alloc(32)
  5030  	defer tls.Free(32)
  5031  
  5032  	var pStmt uintptr
  5033  	var rc int32
  5034  	if iClient > 0 {
  5035  		pStmt = prepareSql(tls,
  5036  
  5037  			ts+922, /* "SELECT 1 FROM ta..." */
  5038  			libc.VaList(bp, iClient))
  5039  	} else {
  5040  		pStmt = prepareSql(tls,
  5041  
  5042  			ts+1018 /* "SELECT 1 FROM ta..." */, 0)
  5043  	}
  5044  	g.iTimeout = 0
  5045  	for (((libc.AssignInt32(&rc, sqlite3.Xsqlite3_step(tls, pStmt))) == SQLITE_BUSY) || (rc == SQLITE_ROW)) &&
  5046  		(iTimeout > 0) {
  5047  		sqlite3.Xsqlite3_reset(tls, pStmt)
  5048  		sqlite3.Xsqlite3_sleep(tls, 50)
  5049  		iTimeout = iTimeout - (50)
  5050  	}
  5051  	sqlite3.Xsqlite3_finalize(tls, pStmt)
  5052  	g.iTimeout = DEFAULT_TIMEOUT
  5053  	if rc != SQLITE_DONE {
  5054  		if zErrPrefix == uintptr(0) {
  5055  			zErrPrefix = ts + 1099 /* "" */
  5056  		}
  5057  		if iClient > 0 {
  5058  			errorMessage(tls, ts+1100 /* "%stimeout waitin..." */, libc.VaList(bp+8, zErrPrefix, iClient))
  5059  		} else {
  5060  			errorMessage(tls, ts+1132 /* "%stimeout waitin..." */, libc.VaList(bp+24, zErrPrefix))
  5061  		}
  5062  	}
  5063  }
  5064  
  5065  // Return a pointer to the tail of a filename
  5066  func filenameTail(tls *libc.TLS, z uintptr) uintptr { /* mptest.c:836:13: */
  5067  	var i int32
  5068  	var j int32
  5069  	for i = libc.AssignInt32(&j, 0); *(*int8)(unsafe.Pointer(z + uintptr(i))) != 0; i++ {
  5070  		if (int32(*(*int8)(unsafe.Pointer(z + uintptr(i))))) == '/' {
  5071  			j = (i + 1)
  5072  		}
  5073  	}
  5074  	return (z + uintptr(j))
  5075  }
  5076  
  5077  // Interpret zArg as a boolean value.  Return either 0 or 1.
  5078  func booleanValue(tls *libc.TLS, zArg uintptr) int32 { /* mptest.c:845:12: */
  5079  	bp := tls.Alloc(8)
  5080  	defer tls.Free(8)
  5081  
  5082  	var i int32
  5083  	if zArg == uintptr(0) {
  5084  		return 0
  5085  	}
  5086  	for i = 0; (int32(*(*int8)(unsafe.Pointer(zArg + uintptr(i)))) >= '0') && (int32(*(*int8)(unsafe.Pointer(zArg + uintptr(i)))) <= '9'); i++ {
  5087  	}
  5088  	if (i > 0) && (int32(*(*int8)(unsafe.Pointer(zArg + uintptr(i)))) == 0) {
  5089  		return libc.Xatoi(tls, zArg)
  5090  	}
  5091  	if (sqlite3.Xsqlite3_stricmp(tls, zArg, ts+1166 /* "on" */) == 0) || (sqlite3.Xsqlite3_stricmp(tls, zArg, ts+1169 /* "yes" */) == 0) {
  5092  		return 1
  5093  	}
  5094  	if (sqlite3.Xsqlite3_stricmp(tls, zArg, ts+1173 /* "off" */) == 0) || (sqlite3.Xsqlite3_stricmp(tls, zArg, ts+1177 /* "no" */) == 0) {
  5095  		return 0
  5096  	}
  5097  	errorMessage(tls, ts+1180 /* "unknown boolean:..." */, libc.VaList(bp, zArg))
  5098  	return 0
  5099  }
  5100  
  5101  // This routine exists as a convenient place to set a debugger
  5102  // breakpoint.
  5103  func test_breakpoint(tls *libc.TLS) { /* mptest.c:864:13: */
  5104  	atomic.AddInt32(&cnt, 1)
  5105  }
  5106  
  5107  var cnt int32 = 0 /* mptest.c:864:56 */
  5108  
  5109  // Maximum number of arguments to a --command
  5110  
  5111  // Run a script.
  5112  func runScript(tls *libc.TLS, iClient int32, taskId int32, zScript uintptr, zFilename uintptr) { /* mptest.c:872:13: */
  5113  	bp := tls.Alloc(1610)
  5114  	defer tls.Free(1610)
  5115  
  5116  	*(*int32)(unsafe.Pointer(bp + 376 /* lineno */)) = 1
  5117  	var prevLine int32 = 1
  5118  	var ii int32 = 0
  5119  	var iBegin int32 = 0
  5120  	var n int32
  5121  	var c int32
  5122  	var j int32
  5123  	var len int32
  5124  	var nArg int32
  5125  	// var sResult String at bp+360, 16
  5126  
  5127  	// var zCmd [30]int8 at bp+380, 30
  5128  
  5129  	// var zError [1000]int8 at bp+610, 1000
  5130  
  5131  	// var azArg [2][100]int8 at bp+410, 200
  5132  
  5133  	libc.Xmemset(tls, bp+360 /* &sResult */, 0, uint64(unsafe.Sizeof(String{})))
  5134  	stringReset(tls, bp+360 /* &sResult */)
  5135  	for (libc.AssignInt32(&c, int32(*(*int8)(unsafe.Pointer(zScript + uintptr(ii)))))) != 0 {
  5136  		prevLine = *(*int32)(unsafe.Pointer(bp + 376 /* lineno */))
  5137  		len = tokenLength(tls, (zScript + uintptr(ii)), bp+376 /* &lineno */)
  5138  		if (__sbistype(tls, int32(uint8(c)), uint64(X_CTYPE_S)) != 0) || ((c == '/') && (int32(*(*int8)(unsafe.Pointer(zScript + uintptr((ii + 1))))) == '*')) {
  5139  			ii = ii + (len)
  5140  			continue
  5141  		}
  5142  		if ((c != '-') || (int32(*(*int8)(unsafe.Pointer(zScript + uintptr((ii + 1))))) != '-')) || !(__sbistype(tls, int32(*(*int8)(unsafe.Pointer(zScript + uintptr((ii + 2))))), uint64(X_CTYPE_A)) != 0) {
  5143  			ii = ii + (len)
  5144  			continue
  5145  		}
  5146  
  5147  		// Run any prior SQL before processing the new --command
  5148  		if ii > iBegin {
  5149  			var zSql uintptr = sqlite3.Xsqlite3_mprintf(tls, ts+1202 /* "%.*s" */, libc.VaList(bp, (ii-iBegin), (zScript+uintptr(iBegin))))
  5150  			evalSql(tls, bp+360 /* &sResult */, zSql, 0)
  5151  			sqlite3.Xsqlite3_free(tls, zSql)
  5152  			iBegin = (ii + len)
  5153  		}
  5154  
  5155  		// Parse the --command
  5156  		if g.iTrace >= 2 {
  5157  			logMessage(tls, ts+1202 /* "%.*s" */, libc.VaList(bp+16, len, (zScript+uintptr(ii))))
  5158  		}
  5159  		n = extractToken(tls, ((zScript + uintptr(ii)) + uintptr(2)), (len - 2), bp+380 /* &zCmd[0] */, int32(unsafe.Sizeof([30]int8{})))
  5160  		for nArg = 0; (n < (len - 2)) && (nArg < MX_ARG); nArg++ {
  5161  			for (n < (len - 2)) && (__sbistype(tls, int32(uint8(*(*int8)(unsafe.Pointer(zScript + uintptr(((ii + 2) + n)))))), uint64(X_CTYPE_S)) != 0) {
  5162  				n++
  5163  			}
  5164  			if n >= (len - 2) {
  5165  				break
  5166  			}
  5167  			n = n + (extractToken(tls, (((zScript + uintptr(ii)) + uintptr(2)) + uintptr(n)), ((len - 2) - n),
  5168  				(bp + 410 /* &azArg[0] */ + uintptr(nArg)*100), int32(unsafe.Sizeof([100]int8{}))))
  5169  		}
  5170  		for j = nArg; j < MX_ARG; j++ {
  5171  			*(*int8)(unsafe.Pointer((bp + 410 /* &azArg[0] */ + uintptr(libc.PostIncInt32(&j, 1))*100))) = int8(0)
  5172  		}
  5173  
  5174  		//  --sleep N
  5175  		//
  5176  		// Pause for N milliseconds
  5177  		if libc.Xstrcmp(tls, bp+380 /* &zCmd[0] */, ts+1207 /* "sleep" */) == 0 {
  5178  			sqlite3.Xsqlite3_sleep(tls, libc.Xatoi(tls, (bp+410 /* &azArg[0] */)))
  5179  		} else
  5180  
  5181  		//   --exit N
  5182  		//
  5183  		// Exit this process.  If N>0 then exit without shutting down
  5184  		// SQLite.  (In other words, simulate a crash.)
  5185  		if libc.Xstrcmp(tls, bp+380 /* &zCmd[0] */, ts+1213 /* "exit" */) == 0 {
  5186  			var rc int32 = libc.Xatoi(tls, (bp + 410 /* &azArg[0] */))
  5187  			finishScript(tls, iClient, taskId, 1)
  5188  			if rc == 0 {
  5189  				sqlite3.Xsqlite3_close(tls, g.db)
  5190  			}
  5191  			libc.Xexit(tls, rc)
  5192  		} else
  5193  
  5194  		//   --testcase NAME
  5195  		//
  5196  		// Begin a new test case.  Announce in the log that the test case
  5197  		// has begun.
  5198  		if libc.Xstrcmp(tls, bp+380 /* &zCmd[0] */, ts+1218 /* "testcase" */) == 0 {
  5199  			if g.iTrace == 1 {
  5200  				logMessage(tls, ts+1202 /* "%.*s" */, libc.VaList(bp+32, (len-1), (zScript+uintptr(ii))))
  5201  			}
  5202  			stringReset(tls, bp+360 /* &sResult */)
  5203  		} else
  5204  
  5205  		//   --finish
  5206  		//
  5207  		// Mark the current task as having finished, even if it is not.
  5208  		// This can be used in conjunction with --exit to simulate a crash.
  5209  		if (libc.Xstrcmp(tls, bp+380 /* &zCmd[0] */, ts+1227 /* "finish" */) == 0) && (iClient > 0) {
  5210  			finishScript(tls, iClient, taskId, 1)
  5211  		} else
  5212  
  5213  		//  --reset
  5214  		//
  5215  		// Reset accumulated results back to an empty string
  5216  		if libc.Xstrcmp(tls, bp+380 /* &zCmd[0] */, ts+1234 /* "reset" */) == 0 {
  5217  			stringReset(tls, bp+360 /* &sResult */)
  5218  		} else
  5219  
  5220  		//  --match ANSWER...
  5221  		//
  5222  		// Check to see if output matches ANSWER.  Report an error if not.
  5223  		if libc.Xstrcmp(tls, bp+380 /* &zCmd[0] */, ts+1240 /* "match" */) == 0 {
  5224  			var jj int32
  5225  			var zAns uintptr = (zScript + uintptr(ii))
  5226  			for jj = 7; (jj < (len - 1)) && (__sbistype(tls, int32(uint8(*(*int8)(unsafe.Pointer(zAns + uintptr(jj))))), uint64(X_CTYPE_S)) != 0); jj++ {
  5227  			}
  5228  			zAns += uintptr(jj)
  5229  			if (((len - jj) - 1) != (*String)(unsafe.Pointer(bp+360 /* &sResult */)).n) || (libc.Xstrncmp(tls, (*String)(unsafe.Pointer(bp+360 /* &sResult */)).z, zAns, (uint64((len-jj)-1))) != 0) {
  5230  				errorMessage(tls, ts+1246, /* "line %d of %s:\nE..." */
  5231  					libc.VaList(bp+48, prevLine, zFilename, ((len-jj)-1), zAns, (*String)(unsafe.Pointer(bp+360 /* &sResult */)).z))
  5232  			}
  5233  			g.nTest++
  5234  			stringReset(tls, bp+360 /* &sResult */)
  5235  		} else
  5236  
  5237  		//  --glob ANSWER...
  5238  		//  --notglob ANSWER....
  5239  		//
  5240  		// Check to see if output does or does not match the glob pattern
  5241  		// ANSWER.
  5242  		if (libc.Xstrcmp(tls, bp+380 /* &zCmd[0] */, ts+1291 /* "glob" */) == 0) || (libc.Xstrcmp(tls, bp+380 /* &zCmd[0] */, ts+1296 /* "notglob" */) == 0) {
  5243  			var jj int32
  5244  			var zAns uintptr = (zScript + uintptr(ii))
  5245  			var zCopy uintptr
  5246  			var isGlob int32 = (libc.Bool32(int32(*(*int8)(unsafe.Pointer(bp + 380 /* &zCmd[0] */))) == 'g'))
  5247  			for jj = (9 - (3 * isGlob)); (jj < (len - 1)) && (__sbistype(tls, int32(uint8(*(*int8)(unsafe.Pointer(zAns + uintptr(jj))))), uint64(X_CTYPE_S)) != 0); jj++ {
  5248  			}
  5249  			zAns += uintptr(jj)
  5250  			zCopy = sqlite3.Xsqlite3_mprintf(tls, ts+1202 /* "%.*s" */, libc.VaList(bp+88, ((len-jj)-1), zAns))
  5251  			if ((libc.Bool32(sqlite3.Xsqlite3_strglob(tls, zCopy, (*String)(unsafe.Pointer(bp+360 /* &sResult */)).z) == 0)) ^ isGlob) != 0 {
  5252  				errorMessage(tls, ts+1304, /* "line %d of %s:\nE..." */
  5253  					libc.VaList(bp+104, prevLine, zFilename, zCopy, (*String)(unsafe.Pointer(bp+360 /* &sResult */)).z))
  5254  			}
  5255  			sqlite3.Xsqlite3_free(tls, zCopy)
  5256  			g.nTest++
  5257  			stringReset(tls, bp+360 /* &sResult */)
  5258  		} else
  5259  
  5260  		//  --output
  5261  		//
  5262  		// Output the result of the previous SQL.
  5263  		if libc.Xstrcmp(tls, bp+380 /* &zCmd[0] */, ts+1347 /* "output" */) == 0 {
  5264  			logMessage(tls, ts+438 /* "%s" */, libc.VaList(bp+136, (*String)(unsafe.Pointer(bp+360 /* &sResult */)).z))
  5265  		} else
  5266  
  5267  		//  --source FILENAME
  5268  		//
  5269  		// Run a subscript from a separate file.
  5270  		if libc.Xstrcmp(tls, bp+380 /* &zCmd[0] */, ts+1354 /* "source" */) == 0 {
  5271  			var zNewFile uintptr
  5272  			var zNewScript uintptr
  5273  			var zToDel uintptr = uintptr(0)
  5274  			zNewFile = (bp + 410 /* &azArg[0] */)
  5275  			if !((int32(*(*int8)(unsafe.Pointer(zNewFile)))) == '/') {
  5276  				var k int32
  5277  				for k = (int32(libc.Xstrlen(tls, zFilename)) - 1); (k >= 0) && !((int32(*(*int8)(unsafe.Pointer(zFilename + uintptr(k))))) == '/'); k-- {
  5278  				}
  5279  				if k > 0 {
  5280  					zNewFile = libc.AssignUintptr(&zToDel, sqlite3.Xsqlite3_mprintf(tls, ts+1361 /* "%.*s/%s" */, libc.VaList(bp+144, k, zFilename, zNewFile)))
  5281  				}
  5282  			}
  5283  			zNewScript = readFile(tls, zNewFile)
  5284  			if g.iTrace != 0 {
  5285  				logMessage(tls, ts+1369 /* "begin script [%s..." */, libc.VaList(bp+168, zNewFile))
  5286  			}
  5287  			runScript(tls, 0, 0, zNewScript, zNewFile)
  5288  			sqlite3.Xsqlite3_free(tls, zNewScript)
  5289  			if g.iTrace != 0 {
  5290  				logMessage(tls, ts+1388 /* "end script [%s]\n" */, libc.VaList(bp+176, zNewFile))
  5291  			}
  5292  			sqlite3.Xsqlite3_free(tls, zToDel)
  5293  		} else
  5294  
  5295  		//  --print MESSAGE....
  5296  		//
  5297  		// Output the remainder of the line to the log file
  5298  		if libc.Xstrcmp(tls, bp+380 /* &zCmd[0] */, ts+1405 /* "print" */) == 0 {
  5299  			var jj int32
  5300  			for jj = 7; (jj < len) && (__sbistype(tls, int32(uint8(*(*int8)(unsafe.Pointer(zScript + uintptr((ii + jj)))))), uint64(X_CTYPE_S)) != 0); jj++ {
  5301  			}
  5302  			logMessage(tls, ts+1202 /* "%.*s" */, libc.VaList(bp+184, (len-jj), ((zScript+uintptr(ii))+uintptr(jj))))
  5303  		} else
  5304  
  5305  		//  --if EXPR
  5306  		//
  5307  		// Skip forward to the next matching --endif or --else if EXPR is false.
  5308  		if libc.Xstrcmp(tls, bp+380 /* &zCmd[0] */, ts+1411 /* "if" */) == 0 {
  5309  			var jj int32
  5310  			var rc int32
  5311  			var pStmt uintptr
  5312  			for jj = 4; (jj < len) && (__sbistype(tls, int32(uint8(*(*int8)(unsafe.Pointer(zScript + uintptr((ii + jj)))))), uint64(X_CTYPE_S)) != 0); jj++ {
  5313  			}
  5314  			pStmt = prepareSql(tls, ts+1414 /* "SELECT %.*s" */, libc.VaList(bp+200, (len-jj), ((zScript+uintptr(ii))+uintptr(jj))))
  5315  			rc = sqlite3.Xsqlite3_step(tls, pStmt)
  5316  			if (rc != SQLITE_ROW) || (sqlite3.Xsqlite3_column_int(tls, pStmt, 0) == 0) {
  5317  				ii = ii + (findEndif(tls, ((zScript + uintptr(ii)) + uintptr(len)), 1, bp+376 /* &lineno */))
  5318  			}
  5319  			sqlite3.Xsqlite3_finalize(tls, pStmt)
  5320  		} else
  5321  
  5322  		//  --else
  5323  		//
  5324  		// This command can only be encountered if currently inside an --if that
  5325  		// is true.  Skip forward to the next matching --endif.
  5326  		if libc.Xstrcmp(tls, bp+380 /* &zCmd[0] */, ts+1426 /* "else" */) == 0 {
  5327  			ii = ii + (findEndif(tls, ((zScript + uintptr(ii)) + uintptr(len)), 0, bp+376 /* &lineno */))
  5328  		} else
  5329  
  5330  		//  --endif
  5331  		//
  5332  		// This command can only be encountered if currently inside an --if that
  5333  		// is true or an --else of a false if.  This is a no-op.
  5334  		if libc.Xstrcmp(tls, bp+380 /* &zCmd[0] */, ts+1431 /* "endif" */) == 0 {
  5335  			// no-op
  5336  		} else
  5337  
  5338  		//  --start CLIENT
  5339  		//
  5340  		// Start up the given client.
  5341  		if (libc.Xstrcmp(tls, bp+380 /* &zCmd[0] */, ts+1437 /* "start" */) == 0) && (iClient == 0) {
  5342  			var iNewClient int32 = libc.Xatoi(tls, (bp + 410 /* &azArg[0] */))
  5343  			if iNewClient > 0 {
  5344  				startClient(tls, iNewClient)
  5345  			}
  5346  		} else
  5347  
  5348  		//  --wait CLIENT TIMEOUT
  5349  		//
  5350  		// Wait until all tasks complete for the given client.  If CLIENT is
  5351  		// "all" then wait for all clients to complete.  Wait no longer than
  5352  		// TIMEOUT milliseconds (default 10,000)
  5353  		if (libc.Xstrcmp(tls, bp+380 /* &zCmd[0] */, ts+1443 /* "wait" */) == 0) && (iClient == 0) {
  5354  			var iTimeout int32
  5355  			if nArg >= 2 {
  5356  				iTimeout = libc.Xatoi(tls, (bp + 410 /* &azArg[0] */ + 1*100))
  5357  			} else {
  5358  				iTimeout = 10000
  5359  			}
  5360  			sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([1000]int8{})), bp+610 /* &zError[0] */, ts+1448, /* "line %d of %s\n" */
  5361  				libc.VaList(bp+216, prevLine, zFilename))
  5362  			waitForClient(tls, libc.Xatoi(tls, (bp+410 /* &azArg[0] */)), iTimeout, bp+610 /* &zError[0] */)
  5363  		} else
  5364  
  5365  		//  --task CLIENT
  5366  		//     <task-content-here>
  5367  		//  --end
  5368  		//
  5369  		// Assign work to a client.  Start the client if it is not running
  5370  		// already.
  5371  		if (libc.Xstrcmp(tls, bp+380 /* &zCmd[0] */, ts+1463 /* "task" */) == 0) && (iClient == 0) {
  5372  			var iTarget int32 = libc.Xatoi(tls, (bp + 410 /* &azArg[0] */))
  5373  			var iEnd int32
  5374  			var zTask uintptr
  5375  			var zTName uintptr
  5376  			iEnd = findEnd(tls, ((zScript + uintptr(ii)) + uintptr(len)), bp+376 /* &lineno */)
  5377  			if iTarget < 0 {
  5378  				errorMessage(tls, ts+1468, /* "line %d of %s: b..." */
  5379  					libc.VaList(bp+232, prevLine, zFilename, iTarget))
  5380  			} else {
  5381  				zTask = sqlite3.Xsqlite3_mprintf(tls, ts+1202 /* "%.*s" */, libc.VaList(bp+256, iEnd, ((zScript+uintptr(ii))+uintptr(len))))
  5382  				if nArg > 1 {
  5383  					zTName = sqlite3.Xsqlite3_mprintf(tls, ts+438 /* "%s" */, libc.VaList(bp+272, (bp+410 /* &azArg[0] */ +1*100)))
  5384  				} else {
  5385  					zTName = sqlite3.Xsqlite3_mprintf(tls, ts+1505 /* "%s:%d" */, libc.VaList(bp+280, filenameTail(tls, zFilename), prevLine))
  5386  				}
  5387  				startClient(tls, iTarget)
  5388  				runSql(tls,
  5389  					ts+1511 /* "INSERT INTO task..." */, libc.VaList(bp+296, iTarget, zTask, zTName))
  5390  				sqlite3.Xsqlite3_free(tls, zTask)
  5391  				sqlite3.Xsqlite3_free(tls, zTName)
  5392  			}
  5393  			iEnd = iEnd + (tokenLength(tls, (((zScript + uintptr(ii)) + uintptr(len)) + uintptr(iEnd)), bp+376 /* &lineno */))
  5394  			len = len + (iEnd)
  5395  			iBegin = (ii + len)
  5396  		} else
  5397  
  5398  		//  --breakpoint
  5399  		//
  5400  		// This command calls "test_breakpoint()" which is a routine provided
  5401  		// as a convenient place to set a debugger breakpoint.
  5402  		if libc.Xstrcmp(tls, bp+380 /* &zCmd[0] */, ts+1567 /* "breakpoint" */) == 0 {
  5403  			test_breakpoint(tls)
  5404  		} else
  5405  
  5406  		//  --show-sql-errors BOOLEAN
  5407  		//
  5408  		// Turn display of SQL errors on and off.
  5409  		if libc.Xstrcmp(tls, bp+380 /* &zCmd[0] */, ts+1578 /* "show-sql-errors" */) == 0 {
  5410  			g.bIgnoreSqlErrors = func() int32 {
  5411  				if nArg >= 1 {
  5412  					return libc.BoolInt32(!(booleanValue(tls, (bp+410 /* &azArg[0] */)) != 0))
  5413  				}
  5414  				return 1
  5415  			}()
  5416  		} else {
  5417  			errorMessage(tls, ts+1594, /* "line %d of %s: u..." */
  5418  				libc.VaList(bp+320, prevLine, zFilename, bp+380 /* &zCmd[0] */))
  5419  		}
  5420  		ii = ii + (len)
  5421  	}
  5422  	if iBegin < ii {
  5423  		var zSql uintptr = sqlite3.Xsqlite3_mprintf(tls, ts+1202 /* "%.*s" */, libc.VaList(bp+344, (ii-iBegin), (zScript+uintptr(iBegin))))
  5424  		runSql(tls, zSql, 0)
  5425  		sqlite3.Xsqlite3_free(tls, zSql)
  5426  	}
  5427  	stringFree(tls, bp+360 /* &sResult */)
  5428  }
  5429  
  5430  // Look for a command-line option.  If present, return a pointer.
  5431  // Return NULL if missing.
  5432  //
  5433  // hasArg==0 means the option is a flag.  It is either present or not.
  5434  // hasArg==1 means the option has an argument.  Return a pointer to the
  5435  // argument.
  5436  func findOption(tls *libc.TLS, azArg uintptr, pnArg uintptr, zOption uintptr, hasArg int32) uintptr { /* mptest.c:1201:13: */
  5437  	bp := tls.Alloc(8)
  5438  	defer tls.Free(8)
  5439  
  5440  	var i int32
  5441  	var j int32
  5442  	var zReturn uintptr = uintptr(0)
  5443  	var nArg int32 = *(*int32)(unsafe.Pointer(pnArg))
  5444  
  5445  	for i = 0; i < nArg; i++ {
  5446  		var z uintptr
  5447  		if (i + hasArg) >= nArg {
  5448  			break
  5449  		}
  5450  		z = *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8))
  5451  		if int32(*(*int8)(unsafe.Pointer(z))) != '-' {
  5452  			continue
  5453  		}
  5454  		z++
  5455  		if int32(*(*int8)(unsafe.Pointer(z))) == '-' {
  5456  			if int32(*(*int8)(unsafe.Pointer(z + 1))) == 0 {
  5457  				break
  5458  			}
  5459  			z++
  5460  		}
  5461  		if libc.Xstrcmp(tls, z, zOption) == 0 {
  5462  			if (hasArg != 0) && (i == (nArg - 1)) {
  5463  				fatalError(tls, ts+1630 /* "command-line opt..." */, libc.VaList(bp, z))
  5464  			}
  5465  			if hasArg != 0 {
  5466  				zReturn = *(*uintptr)(unsafe.Pointer(azArg + uintptr((i+1))*8))
  5467  			} else {
  5468  				zReturn = *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8))
  5469  			}
  5470  			j = ((i + 1) + (libc.Bool32(hasArg != 0)))
  5471  			for j < nArg {
  5472  				*(*uintptr)(unsafe.Pointer(azArg + uintptr(libc.PostIncInt32(&i, 1))*8)) = *(*uintptr)(unsafe.Pointer(azArg + uintptr(libc.PostIncInt32(&j, 1))*8))
  5473  			}
  5474  			*(*int32)(unsafe.Pointer(pnArg)) = i
  5475  			return zReturn
  5476  		}
  5477  	}
  5478  	return zReturn
  5479  }
  5480  
  5481  // Print a usage message for the program and exit
  5482  func usage(tls *libc.TLS, argv0 uintptr) { /* mptest.c:1241:13: */
  5483  	bp := tls.Alloc(8)
  5484  	defer tls.Free(8)
  5485  
  5486  	var i int32
  5487  	var zTail uintptr = argv0
  5488  	for i = 0; *(*int8)(unsafe.Pointer(argv0 + uintptr(i))) != 0; i++ {
  5489  		if (int32(*(*int8)(unsafe.Pointer(argv0 + uintptr(i))))) == '/' {
  5490  			zTail = ((argv0 + uintptr(i)) + uintptr(1))
  5491  		}
  5492  	}
  5493  	libc.Xfprintf(tls, libc.X__stderrp, ts+1678 /* "Usage: %s DATABA..." */, libc.VaList(bp, zTail))
  5494  	libc.Xfprintf(tls, libc.X__stderrp,
  5495  
  5496  		ts+1717 /* "Options:\n   --er..." */, 0)
  5497  	libc.Xexit(tls, 1)
  5498  }
  5499  
  5500  // Report on unrecognized arguments
  5501  func unrecognizedArguments(tls *libc.TLS, argv0 uintptr, nArg int32, azArg uintptr) { /* mptest.c:1265:13: */
  5502  	bp := tls.Alloc(16)
  5503  	defer tls.Free(16)
  5504  
  5505  	var i int32
  5506  	libc.Xfprintf(tls, libc.X__stderrp, ts+2289 /* "%s: unrecognized..." */, libc.VaList(bp, argv0))
  5507  	for i = 0; i < nArg; i++ {
  5508  		libc.Xfprintf(tls, libc.X__stderrp, ts+2317 /* " %s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8))))
  5509  	}
  5510  	libc.Xfprintf(tls, libc.X__stderrp, ts+2321 /* "\n" */, 0)
  5511  	libc.Xexit(tls, 1)
  5512  }
  5513  
  5514  func main1(tls *libc.TLS, argc int32, argv uintptr) int32 { /* mptest.c:1279:18: */
  5515  	bp := tls.Alloc(264)
  5516  	defer tls.Free(264)
  5517  
  5518  	var zClient uintptr
  5519  	var iClient int32
  5520  	// var n int32 at bp+232, 4
  5521  
  5522  	var i int32
  5523  	var openFlags int32 = SQLITE_OPEN_READWRITE
  5524  	var rc int32
  5525  	// var zScript uintptr at bp+240, 8
  5526  
  5527  	// var taskId int32 at bp+248, 4
  5528  
  5529  	var zTrace uintptr
  5530  	var zCOption uintptr
  5531  	var zJMode uintptr
  5532  	var zNRep uintptr
  5533  	var nRep int32 = 1
  5534  	var iRep int32
  5535  	var iTmout int32 = 0 // Default: no timeout
  5536  	var zTmout uintptr
  5537  
  5538  	g.argv0 = *(*uintptr)(unsafe.Pointer(argv))
  5539  	g.iTrace = 1
  5540  	if argc < 2 {
  5541  		usage(tls, *(*uintptr)(unsafe.Pointer(argv)))
  5542  	}
  5543  	g.zDbFile = *(*uintptr)(unsafe.Pointer(argv + 1*8))
  5544  	if strglob(tls, ts+2323 /* "*.test" */, g.zDbFile) != 0 {
  5545  		usage(tls, *(*uintptr)(unsafe.Pointer(argv)))
  5546  	}
  5547  	if libc.Xstrcmp(tls, sqlite3.Xsqlite3_sourceid(tls), ts+2330 /* "2021-06-18 18:36..." */) != 0 {
  5548  		libc.Xfprintf(tls, libc.X__stderrp,
  5549  
  5550  			ts+2415, /* "SQLite library a..." */
  5551  			libc.VaList(bp, sqlite3.Xsqlite3_sourceid(tls), ts+2330 /* "2021-06-18 18:36..." */))
  5552  		libc.Xexit(tls, 1)
  5553  	}
  5554  	*(*int32)(unsafe.Pointer(bp + 232 /* n */)) = (argc - 2)
  5555  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([32]int8{})), uintptr(unsafe.Pointer(&g))+64 /* &.zName */, ts+2475 /* "%05d.mptest" */, libc.VaList(bp+16, libc.Xgetpid(tls)))
  5556  	zJMode = findOption(tls, (argv + uintptr(2)*8), bp+232 /* &n */, ts+2487 /* "journalmode" */, 1)
  5557  	zNRep = findOption(tls, (argv + uintptr(2)*8), bp+232 /* &n */, ts+2499 /* "repeat" */, 1)
  5558  	if zNRep != 0 {
  5559  		nRep = libc.Xatoi(tls, zNRep)
  5560  	}
  5561  	if nRep < 1 {
  5562  		nRep = 1
  5563  	}
  5564  	g.zVfs = findOption(tls, (argv + uintptr(2)*8), bp+232 /* &n */, ts+2506 /* "vfs" */, 1)
  5565  	zClient = findOption(tls, (argv + uintptr(2)*8), bp+232 /* &n */, ts+2510 /* "client" */, 1)
  5566  	g.zErrLog = findOption(tls, (argv + uintptr(2)*8), bp+232 /* &n */, ts+2517 /* "errlog" */, 1)
  5567  	g.zLog = findOption(tls, (argv + uintptr(2)*8), bp+232 /* &n */, ts+2524 /* "log" */, 1)
  5568  	zTrace = findOption(tls, (argv + uintptr(2)*8), bp+232 /* &n */, ts+2528 /* "trace" */, 1)
  5569  	if zTrace != 0 {
  5570  		g.iTrace = libc.Xatoi(tls, zTrace)
  5571  	}
  5572  	if findOption(tls, (argv+uintptr(2)*8), bp+232 /* &n */, ts+2534 /* "quiet" */, 0) != uintptr(0) {
  5573  		g.iTrace = 0
  5574  	}
  5575  	zTmout = findOption(tls, (argv + uintptr(2)*8), bp+232 /* &n */, ts+2540 /* "timeout" */, 1)
  5576  	if zTmout != 0 {
  5577  		iTmout = libc.Xatoi(tls, zTmout)
  5578  	}
  5579  	g.bSqlTrace = (libc.Bool32(findOption(tls, (argv+uintptr(2)*8), bp+232 /* &n */, ts+2548 /* "sqltrace" */, 0) != uintptr(0)))
  5580  	g.bSync = (libc.Bool32(findOption(tls, (argv+uintptr(2)*8), bp+232 /* &n */, ts+2557 /* "sync" */, 0) != uintptr(0)))
  5581  	if g.zErrLog != 0 {
  5582  		g.pErrLog = libc.Xfopen(tls, g.zErrLog, ts+2562 /* "a" */)
  5583  	} else {
  5584  		g.pErrLog = libc.X__stderrp
  5585  	}
  5586  	if g.zLog != 0 {
  5587  		g.pLog = libc.Xfopen(tls, g.zLog, ts+2562 /* "a" */)
  5588  	} else {
  5589  		g.pLog = libc.X__stdoutp
  5590  	}
  5591  
  5592  	sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_LOG, libc.VaList(bp+24, *(*uintptr)(unsafe.Pointer(&struct {
  5593  		f func(*libc.TLS, uintptr, int32, uintptr)
  5594  	}{sqlErrorCallback})), 0))
  5595  	if zClient != 0 {
  5596  		iClient = libc.Xatoi(tls, zClient)
  5597  		if iClient < 1 {
  5598  			fatalError(tls, ts+2564 /* "illegal client n..." */, libc.VaList(bp+40, iClient))
  5599  		}
  5600  		sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([32]int8{})), uintptr(unsafe.Pointer(&g))+64 /* &.zName */, ts+2591, /* "%05d.client%02d" */
  5601  			libc.VaList(bp+48, libc.Xgetpid(tls), iClient))
  5602  	} else {
  5603  		var nTry int32 = 0
  5604  		if g.iTrace > 0 {
  5605  			libc.Xprintf(tls, ts+2607 /* "BEGIN: %s" */, libc.VaList(bp+64, *(*uintptr)(unsafe.Pointer(argv))))
  5606  			for i = 1; i < argc; i++ {
  5607  				libc.Xprintf(tls, ts+2317 /* " %s" */, libc.VaList(bp+72, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))))
  5608  			}
  5609  			libc.Xprintf(tls, ts+2321 /* "\n" */, 0)
  5610  			libc.Xprintf(tls, ts+2617 /* "With SQLite 3.36..." */, 0)
  5611  			for i = 0; (libc.AssignUintptr(&zCOption, sqlite3.Xsqlite3_compileoption_get(tls, i))) != uintptr(0); i++ {
  5612  				libc.Xprintf(tls, ts+2722 /* "-DSQLITE_%s\n" */, libc.VaList(bp+80, zCOption))
  5613  			}
  5614  			libc.Xfflush(tls, libc.X__stdoutp)
  5615  		}
  5616  		iClient = 0
  5617  		for ok := true; ok; ok = (((rc != 0) && ((libc.PreIncInt32(&nTry, 1)) < 60)) && (sqlite3.Xsqlite3_sleep(tls, 1000) > 0)) {
  5618  			if (nTry % 5) == 4 {
  5619  				libc.Xprintf(tls, ts+2735, /* "... %strying to ..." */
  5620  					libc.VaList(bp+88, func() uintptr {
  5621  						if nTry > 5 {
  5622  							return ts + 2764 /* "still " */
  5623  						}
  5624  						return ts + 1099 /* "" */
  5625  					}(), g.zDbFile))
  5626  			}
  5627  			rc = libc.Xunlink(tls, g.zDbFile)
  5628  			if (rc != 0) && ((*(*int32)(unsafe.Pointer(libc.X__error(tls)))) == ENOENT) {
  5629  				rc = 0
  5630  			}
  5631  		}
  5632  		if rc != 0 {
  5633  			fatalError(tls, ts+2771, /* "unable to unlink..." */
  5634  				libc.VaList(bp+104, g.zDbFile, nTry))
  5635  		}
  5636  		openFlags = openFlags | (SQLITE_OPEN_CREATE)
  5637  	}
  5638  	rc = sqlite3.Xsqlite3_open_v2(tls, g.zDbFile, (uintptr(unsafe.Pointer(&g)) + 24 /* &.db */), openFlags, g.zVfs)
  5639  	if rc != 0 {
  5640  		fatalError(tls, ts+2812 /* "cannot open [%s]" */, libc.VaList(bp+120, g.zDbFile))
  5641  	}
  5642  	if iTmout > 0 {
  5643  		sqlite3.Xsqlite3_busy_timeout(tls, g.db, iTmout)
  5644  	}
  5645  
  5646  	if zJMode != 0 {
  5647  		runSql(tls, ts+2829 /* "PRAGMA journal_m..." */, libc.VaList(bp+128, zJMode))
  5648  	}
  5649  	if !(g.bSync != 0) {
  5650  		trySql(tls, ts+2853 /* "PRAGMA synchrono..." */, 0)
  5651  	}
  5652  	sqlite3.Xsqlite3_enable_load_extension(tls, g.db, 1)
  5653  	sqlite3.Xsqlite3_busy_handler(tls, g.db, *(*uintptr)(unsafe.Pointer(&struct {
  5654  		f func(*libc.TLS, uintptr, int32) int32
  5655  	}{busyHandler})), uintptr(0))
  5656  	sqlite3.Xsqlite3_create_function(tls, g.db, ts+2876 /* "vfsname" */, 0, SQLITE_UTF8, uintptr(0),
  5657  		*(*uintptr)(unsafe.Pointer(&struct {
  5658  			f func(*libc.TLS, uintptr, int32, uintptr)
  5659  		}{vfsNameFunc})), uintptr(0), uintptr(0))
  5660  	sqlite3.Xsqlite3_create_function(tls, g.db, ts+2884 /* "eval" */, 1, SQLITE_UTF8, uintptr(0),
  5661  		*(*uintptr)(unsafe.Pointer(&struct {
  5662  			f func(*libc.TLS, uintptr, int32, uintptr)
  5663  		}{evalFunc})), uintptr(0), uintptr(0))
  5664  	g.iTimeout = DEFAULT_TIMEOUT
  5665  	if g.bSqlTrace != 0 {
  5666  		sqlite3.Xsqlite3_trace(tls, g.db, *(*uintptr)(unsafe.Pointer(&struct {
  5667  			f func(*libc.TLS, uintptr, uintptr)
  5668  		}{sqlTraceCallback})), uintptr(0))
  5669  	}
  5670  	if iClient > 0 {
  5671  		if *(*int32)(unsafe.Pointer(bp + 232 /* n */)) > 0 {
  5672  			unrecognizedArguments(tls, *(*uintptr)(unsafe.Pointer(argv)), *(*int32)(unsafe.Pointer(bp + 232 /* n */)), (argv + uintptr(2)*8))
  5673  		}
  5674  		if g.iTrace != 0 {
  5675  			logMessage(tls, ts+2889 /* "start-client" */, 0)
  5676  		}
  5677  		for 1 != 0 {
  5678  			*(*uintptr)(unsafe.Pointer(bp + 256 /* zTaskName */)) = uintptr(0)
  5679  			rc = startScript(tls, iClient, bp+240 /* &zScript */, bp+248 /* &taskId */, bp+256 /* &zTaskName */)
  5680  			if rc == SQLITE_DONE {
  5681  				break
  5682  			}
  5683  			if g.iTrace != 0 {
  5684  				logMessage(tls, ts+2902 /* "begin %s (%d)" */, libc.VaList(bp+136, *(*uintptr)(unsafe.Pointer(bp + 256 /* zTaskName */)), *(*int32)(unsafe.Pointer(bp + 248 /* taskId */))))
  5685  			}
  5686  			runScript(tls, iClient, *(*int32)(unsafe.Pointer(bp + 248 /* taskId */)), *(*uintptr)(unsafe.Pointer(bp + 240 /* zScript */)), *(*uintptr)(unsafe.Pointer(bp + 256 /* zTaskName */)))
  5687  			if g.iTrace != 0 {
  5688  				logMessage(tls, ts+2916 /* "end %s (%d)" */, libc.VaList(bp+152, *(*uintptr)(unsafe.Pointer(bp + 256 /* zTaskName */)), *(*int32)(unsafe.Pointer(bp + 248 /* taskId */))))
  5689  			}
  5690  			finishScript(tls, iClient, *(*int32)(unsafe.Pointer(bp + 248 /* taskId */)), 0)
  5691  			sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 256 /* zTaskName */)))
  5692  			sqlite3.Xsqlite3_sleep(tls, 10)
  5693  		}
  5694  		if g.iTrace != 0 {
  5695  			logMessage(tls, ts+2928 /* "end-client" */, 0)
  5696  		}
  5697  	} else {
  5698  		var pStmt uintptr
  5699  		var iTimeout int32
  5700  		if *(*int32)(unsafe.Pointer(bp + 232 /* n */)) == 0 {
  5701  			fatalError(tls, ts+2939 /* "missing script f..." */, 0)
  5702  		}
  5703  		if *(*int32)(unsafe.Pointer(bp + 232 /* n */)) > 1 {
  5704  			unrecognizedArguments(tls, *(*uintptr)(unsafe.Pointer(argv)), *(*int32)(unsafe.Pointer(bp + 232 /* n */)), (argv + uintptr(2)*8))
  5705  		}
  5706  		runSql(tls,
  5707  
  5708  			ts+2963 /* "DROP TABLE IF EX..." */, 0)
  5709  		*(*uintptr)(unsafe.Pointer(bp + 240 /* zScript */)) = readFile(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8)))
  5710  		for iRep = 1; iRep <= nRep; iRep++ {
  5711  			if g.iTrace != 0 {
  5712  				logMessage(tls, ts+3399 /* "begin script [%s..." */, libc.VaList(bp+168, *(*uintptr)(unsafe.Pointer(argv + 2*8)), iRep))
  5713  			}
  5714  			runScript(tls, 0, 0, *(*uintptr)(unsafe.Pointer(bp + 240 /* zScript */)), *(*uintptr)(unsafe.Pointer(argv + 2*8)))
  5715  			if g.iTrace != 0 {
  5716  				logMessage(tls, ts+3427 /* "end script [%s] ..." */, libc.VaList(bp+184, *(*uintptr)(unsafe.Pointer(argv + 2*8)), iRep))
  5717  			}
  5718  		}
  5719  		sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 240 /* zScript */)))
  5720  		waitForClient(tls, 0, 2000, ts+3453 /* "during shutdown...." */)
  5721  		trySql(tls, ts+3473 /* "UPDATE client SE..." */, 0)
  5722  		sqlite3.Xsqlite3_sleep(tls, 10)
  5723  		g.iTimeout = 0
  5724  		iTimeout = 1000
  5725  		for (((libc.AssignInt32(&rc, trySql(tls, ts+3502 /* "SELECT 1 FROM cl..." */, 0))) == SQLITE_BUSY) ||
  5726  			(rc == SQLITE_ROW)) && (iTimeout > 0) {
  5727  			sqlite3.Xsqlite3_sleep(tls, 10)
  5728  			iTimeout = iTimeout - (10)
  5729  		}
  5730  		sqlite3.Xsqlite3_sleep(tls, 100)
  5731  		pStmt = prepareSql(tls, ts+3523 /* "SELECT nError, n..." */, 0)
  5732  		iTimeout = 1000
  5733  		for ((libc.AssignInt32(&rc, sqlite3.Xsqlite3_step(tls, pStmt))) == SQLITE_BUSY) && (iTimeout > 0) {
  5734  			sqlite3.Xsqlite3_sleep(tls, 10)
  5735  			iTimeout = iTimeout - (10)
  5736  		}
  5737  		if rc == SQLITE_ROW {
  5738  			*(*int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&g)) + 112 /* &.nError */)) += (sqlite3.Xsqlite3_column_int(tls, pStmt, 0))
  5739  			*(*int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&g)) + 116 /* &.nTest */)) += (sqlite3.Xsqlite3_column_int(tls, pStmt, 1))
  5740  		}
  5741  		sqlite3.Xsqlite3_finalize(tls, pStmt)
  5742  	}
  5743  	sqlite3.Xsqlite3_close(tls, g.db)
  5744  	maybeClose(tls, g.pLog)
  5745  	maybeClose(tls, g.pErrLog)
  5746  	if iClient == 0 {
  5747  		libc.Xprintf(tls, ts+3558 /* "Summary: %d erro..." */, libc.VaList(bp+200, g.nError, g.nTest))
  5748  		libc.Xprintf(tls, ts+3594 /* "END: %s" */, libc.VaList(bp+216, *(*uintptr)(unsafe.Pointer(argv))))
  5749  		for i = 1; i < argc; i++ {
  5750  			libc.Xprintf(tls, ts+2317 /* " %s" */, libc.VaList(bp+224, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))))
  5751  		}
  5752  		libc.Xprintf(tls, ts+2321 /* "\n" */, 0)
  5753  	}
  5754  	return (libc.Bool32(g.nError > 0))
  5755  }
  5756  
  5757  var ts1 = "%s%.*s\n\x00%s:ERROR: \x00%s:FATAL: \x00UPDATE client SET wantHalt=1;\x00%s: \x00main\x00timeout after %dms\x00[%.*s]\x00(info) %s\x00(errcode=%d) %s\x00%s\n%s\n\x00out of memory\x00 \x00nil\x00'\x00error(%d)\x00BEGIN IMMEDIATE\x00in startScript: %s\x00UPDATE counters SET nError=nError+%d, nTest=nTest+%d\x00SELECT 1 FROM client WHERE id=%d AND wantHalt\x00DELETE FROM client WHERE id=%d\x00COMMIT TRANSACTION;\x00SELECT script, id, name FROM task WHERE client=%d AND starttime IS NULL ORDER BY id LIMIT 1\x00%s\x00UPDATE task   SET starttime=strftime('%%Y-%%m-%%d %%H:%%M:%%f','now') WHERE id=%d;\x00Waited over 30 seconds with no work.  Giving up.\x00DELETE FROM client WHERE id=%d; COMMIT;\x00COMMIT\x00UPDATE task   SET endtime=strftime('%%Y-%%m-%%d %%H:%%M:%%f','now') WHERE id=%d;\x00INSERT OR IGNORE INTO client VALUES(%d,0)\x00%s \"%s\" --client %d --trace %d\x00%z --sqltrace\x00%z --sync\x00%z --vfs \"%s\"\x00system('%q')\x00%z &\x00system() fails with error code %d\x00rb\x00cannot open \"%s\" for reading\x00--end\x00--endif\x00--else\x00--if\x00SELECT 1 FROM task WHERE client=%d   AND client IN (SELECT id FROM client)  AND endtime IS NULL\x00SELECT 1 FROM task WHERE client IN (SELECT id FROM client)   AND endtime IS NULL\x00\x00%stimeout waiting for client %d\x00%stimeout waiting for all clients\x00on\x00yes\x00off\x00no\x00unknown boolean: [%s]\x00%.*s\x00sleep\x00exit\x00testcase\x00finish\x00reset\x00match\x00line %d of %s:\nExpected [%.*s]\n     Got [%s]\x00glob\x00notglob\x00line %d of %s:\nExpected [%s]\n     Got [%s]\x00output\x00source\x00%.*s/%s\x00begin script [%s]\n\x00end script [%s]\n\x00print\x00if\x00SELECT %.*s\x00else\x00endif\x00start\x00wait\x00line %d of %s\n\x00task\x00line %d of %s: bad client number: %d\x00%s:%d\x00INSERT INTO task(client,script,name) VALUES(%d,'%q',%Q)\x00breakpoint\x00show-sql-errors\x00line %d of %s: unknown command --%s\x00command-line option \"--%s\" requires an argument\x00Usage: %s DATABASE ?OPTIONS? ?SCRIPT?\n\x00Options:\n   --errlog FILENAME           Write errors to FILENAME\n   --journalmode MODE          Use MODE as the journal_mode\n   --log FILENAME              Log messages to FILENAME\n   --quiet                     Suppress unnecessary output\n   --vfs NAME                  Use NAME as the VFS\n   --repeat N                  Repeat the test N times\n   --sqltrace                  Enable SQL tracing\n   --sync                      Enable synchronous disk writes\n   --timeout MILLISEC          Busy timeout is MILLISEC\n   --trace BOOLEAN             Enable or disable tracing\n\x00%s: unrecognized arguments:\x00 %s\x00\n\x00*.test\x002021-06-18 18:36:39 5c9a6c06871cb9fe42814af9c039eb6da5427a6ec28f187af7ebfb62eafa66e5\x00SQLite library and header mismatch\nLibrary: %s\nHeader:  %s\n\x00%05d.mptest\x00journalmode\x00repeat\x00vfs\x00client\x00errlog\x00log\x00trace\x00quiet\x00timeout\x00sqltrace\x00sync\x00a\x00illegal client number: %d\n\x00%05d.client%02d\x00BEGIN: %s\x00With SQLite 3.36.0 2021-06-18 18:36:39 5c9a6c06871cb9fe42814af9c039eb6da5427a6ec28f187af7ebfb62eafa66e5\n\x00-DSQLITE_%s\n\x00... %strying to unlink '%s'\n\x00still \x00unable to unlink '%s' after %d attempts\n\x00cannot open [%s]\x00PRAGMA journal_mode=%Q;\x00PRAGMA synchronous=OFF\x00vfsname\x00eval\x00start-client\x00begin %s (%d)\x00end %s (%d)\x00end-client\x00missing script filename\x00DROP TABLE IF EXISTS task;\nDROP TABLE IF EXISTS counters;\nDROP TABLE IF EXISTS client;\nCREATE TABLE task(\n  id INTEGER PRIMARY KEY,\n  name TEXT,\n  client INTEGER,\n  starttime DATE,\n  endtime DATE,\n  script TEXT\n);CREATE INDEX task_i1 ON task(client, starttime);\nCREATE INDEX task_i2 ON task(client, endtime);\nCREATE TABLE counters(nError,nTest);\nINSERT INTO counters VALUES(0,0);\nCREATE TABLE client(id INTEGER PRIMARY KEY, wantHalt);\n\x00begin script [%s] cycle %d\n\x00end script [%s] cycle %d\n\x00during shutdown...\n\x00UPDATE client SET wantHalt=1\x00SELECT 1 FROM client\x00SELECT nError, nTest FROM counters\x00Summary: %d errors out of %d tests\n\x00END: %s\x00"
  5758  var ts = (*reflect.StringHeader)(unsafe.Pointer(&ts1)).Data