diff --git a/.gitignore b/.gitignore index 8084eda55..cb8d6eb5d 100644 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,4 @@ bin/ *.class target/ .cproject +Cargo.lock diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0aa89cbe7..fc5a4839c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -6,6 +6,7 @@ stages: - build - bindings - wasm + - rust - python - dotnet - java @@ -23,6 +24,7 @@ include: - local: "/java/ci.yml" - local: "/python/ci.yml" - local: "/dotnet/ci.yml" + - local: "/rust/ci.yml" ##### local_docker_deploy_and_vulnerability_analysis ##### ##### analyse ##### diff --git a/CMakeLists.txt b/CMakeLists.txt index 0af86601a..56e0cf803 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,6 +67,7 @@ option(CODE_COVERAGE "Builds targets with code coverage instrumentation. (Requi option(PAY_ETH "support for direct Eth-Payment" OFF) option(USE_SCRYPT "integrate scrypt into the build in order to allow decrypt_key for scrypt encoded keys." ON) option(USE_CURL "if true the curl transport will be built (with a dependency to libcurl)" ON) +option(DEV_NO_INTRN_PTR "(*dev option*) if true the client will NOT include a void pointer (named internal) for use by devs)" ON) if (USE_PRECOMPUTED_EC) ADD_DEFINITIONS(-DUSE_PRECOMPUTED_CP=1) @@ -145,6 +146,11 @@ if(SEGGER_RTT) ADD_DEFINITIONS(-DSEGGER_RTT) endif(SEGGER_RTT) +if (DEV_NO_INTRN_PTR) + MESSAGE(STATUS "Disable dev opt (internal ptr)") + ADD_DEFINITIONS(-DDEV_NO_INTRN_PTR) +endif() + # handle version if (TAG_VERSION) set(PROJECT_VERSION "${TAG_VERSION}") diff --git a/c/include/in3.rs.h b/c/include/in3.rs.h new file mode 100644 index 000000000..fc87c0243 --- /dev/null +++ b/c/include/in3.rs.h @@ -0,0 +1,10 @@ +// AUTO-GENERATED FILE +// See scripts/build_includeh.sh +#include "../src/core/client/context_internal.h" +#include "in3/bytes.h" +#include "in3/client.h" +#include "in3/context.h" +#include "in3/error.h" +#include "in3/eth_api.h" +#include "in3/in3_init.h" +#include "in3/in3_curl.h" diff --git a/c/include/in3/bytes.h b/c/include/in3/bytes.h index 66d74b956..d2dd1d3a9 100644 --- a/c/include/in3/bytes.h +++ b/c/include/in3/bytes.h @@ -69,11 +69,11 @@ typedef struct bytes { /** a byte-buffer to attach byte-functions. */ typedef struct { - uint32_t bsize; /**< size of the currently allocated bytes */ - bytes_t b; /**< the bytes struct */ + size_t bsize; /**< size of the currently allocated bytes */ + bytes_t b; /**< the bytes struct */ } bytes_builder_t; -bytes_t* b_new(const char* data, int len); /**< allocates a new byte array with 0 filled */ +bytes_t* b_new(const uint8_t* data, uint32_t len); /**< allocates a new byte array with 0 filled */ void b_print(const bytes_t* a); /**< prints a the bytes as hex to stdout */ void ba_print(const uint8_t* a, size_t l); /**< prints a the bytes as hex to stdout */ int b_cmp(const bytes_t* a, const bytes_t* b); /**< compares 2 byte arrays and returns 1 for equal and 0 for not equal*/ diff --git a/c/include/in3/client.h b/c/include/in3/client.h index 3d37f109b..8958315c4 100644 --- a/c/include/in3/client.h +++ b/c/include/in3/client.h @@ -187,6 +187,10 @@ typedef struct in3_node_weight { uint32_t response_count; /**< counter for responses */ uint32_t total_response_time; /**< total of all response times */ uint64_t blacklisted_until; /**< if >0 this node is blacklisted until k. k is a unix timestamp */ +#ifdef PAY + uint32_t price; /**< the price per request unit */ + uint64_t payed; /**< already payed */ +#endif } in3_node_weight_t; /** @@ -271,17 +275,17 @@ typedef struct in3_chain { * @returns the found result. if the key is found this function should return the values as bytes otherwise `NULL`. **/ typedef bytes_t* (*in3_storage_get_item)( - void* cptr, /**< a custom pointer as set in the storage handler*/ - char* key /**< the key to search in the cache */ + void* cptr, /**< a custom pointer as set in the storage handler*/ + const char* key /**< the key to search in the cache */ ); /** * storage handler function for writing to the cache. **/ typedef void (*in3_storage_set_item)( - void* cptr, /**< a custom pointer as set in the storage handler*/ - char* key, /**< the key to store the value.*/ - bytes_t* value /**< the value to store.*/ + void* cptr, /**< a custom pointer as set in the storage handler*/ + const char* key, /**< the key to store the value.*/ + bytes_t* value /**< the value to store.*/ ); /** @@ -343,26 +347,89 @@ typedef struct in3_signer { } in3_signer_t; +/** + * + * payment prepearation function. + * + * allows the payment to handle things before the request will be send. + * +*/ +typedef in3_ret_t (*in3_pay_prepare)(void* ctx, void* cptr); + +/** + * + * called after receiving a parseable response with a in3-section. + * + * +*/ +typedef in3_ret_t (*in3_pay_follow_up)(void* ctx, void* node, d_token_t* in3, d_token_t* error, void* cptr); + +/** + * + * free function for the custom pointer. + * + * +*/ +typedef void (*in3_pay_free)(void* cptr); + +/** + * + * handles the request. + * + * this function is called when the in3-section of payload of the request is built and allows the handler to add properties. + * +*/ +typedef in3_ret_t (*in3_pay_handle_request)(void* ctx, sb_t* sb, in3_request_config_t* rc, void* cptr); + +/** + * + * the payment handler. + * + * if a payment handler is set it will be used when generating the request. + * +*/ +typedef struct in3_pay { + /* payment prepearation function.*/ + in3_pay_prepare prepare; + + /* payment prepearation function.*/ + in3_pay_follow_up follow_up; + + /* this function is called when the in3-section of payload of the request is built and allows the handler to add properties. .*/ + in3_pay_handle_request handle_request; + + /* frees the custom pointer (cptr).*/ + in3_pay_free free; + + /* custom object whill will be passed to functions */ + void* cptr; + +} in3_pay_t; + /** response-object. * * if the error has a length>0 the response will be rejected */ -typedef struct n3_response { +typedef struct in3_response { sb_t error; /**< a stringbuilder to add any errors! */ sb_t result; /**< a stringbuilder to add the result */ } in3_response_t; +/* forward decl */ +typedef struct in3_t_ in3_t; + /** request-object. * * represents a RPC-request */ -typedef struct n3_request { +typedef struct in3_request { char* payload; /**< the payload to send */ char** urls; /**< array of urls */ int urls_len; /**< number of urls */ in3_response_t* results; /**< the responses*/ uint32_t timeout; /**< the timeout 0= no timeout*/ uint32_t* times; /**< measured times (in ms) which will be used for ajusting the weights */ + in3_t* in3; /**< pointer to associated IN3 instance */ } in3_request_t; /** the transport function to be implemented by the transport provider. @@ -408,7 +475,7 @@ typedef struct in3_filter_handler_t_ { * This struct holds the configuration and also point to internal resources such as filters or chain configs. * */ -typedef struct in3_t_ { +struct in3_t_ { /** number of seconds requests can be cached. */ uint32_t cache_timeout; @@ -460,6 +527,10 @@ typedef struct in3_t_ { /** signer-struct managing a wallet */ in3_signer_t* signer; +#ifdef PAY + /** payment handler. if set it will add payment to each request */ + in3_pay_t* pay; +#endif /** the transporthandler sending requests */ in3_transport_send transport; @@ -478,7 +549,11 @@ typedef struct in3_t_ { /** used to identify the capabilities of the node. */ in3_node_props_t node_props; -} in3_t; +#ifndef DEV_NO_INTRN_PTR + /** pointer to internal data */ + void* internal; +#endif +}; /** creates a new Incubes configuration and returns the pointer. * @@ -496,20 +571,11 @@ typedef struct in3_t_ { * // create new client * in3_t* client = in3_new(); * - * // configure storage... - * in3_storage_handler_t storage_handler; - * storage_handler.get_item = storage_get_item; - * storage_handler.set_item = storage_set_item; - * storage_handler.clear = storage_clear; - * * // configure transport * client->transport = send_curl; * * // configure storage - * client->cache = &storage_handler; - * - * // init cache - * in3_cache_init(client); + * in3_set_storage_handler(c, storage_get_item, storage_set_item, storage_clear, NULL); * * // ready to use ... * ``` @@ -534,20 +600,11 @@ in3_t* in3_new() __attribute__((deprecated("use in3_for_chain(ETH_CHAIN_ID_MULTI * // create new client * in3_t* client = in3_for_chain(ETH_CHAIN_ID_MAINNET); * - * // configure storage... - * in3_storage_handler_t storage_handler; - * storage_handler.get_item = storage_get_item; - * storage_handler.set_item = storage_set_item; - * storage_handler.clear = storage_clear; - * * // configure transport * client->transport = send_curl; * * // configure storage - * client->cache = &storage_handler; - * - * // init cache - * in3_cache_init(client); + * in3_set_storage_handler(c, storage_get_item, storage_set_item, storage_clear, NULL); * * // ready to use ... * ``` @@ -563,18 +620,18 @@ in3_t* in3_for_chain_default( /** sends a request and stores the result in the provided buffer */ in3_ret_t in3_client_rpc( - in3_t* c, /**< [in] the pointer to the incubed client config. */ - char* method, /**< [in] the name of the rpc-funcgtion to call. */ - char* params, /**< [in] docs for input parameter v. */ - char** result, /**< [in] pointer to string which will be set if the request was successfull. This will hold the result as json-rpc-string. (make sure you free this after use!) */ - char** error /**< [in] pointer to a string containg the error-message. (make sure you free it after use!) */); + in3_t* c, /**< [in] the pointer to the incubed client config. */ + const char* method, /**< [in] the name of the rpc-funcgtion to call. */ + const char* params, /**< [in] docs for input parameter v. */ + char** result, /**< [in] pointer to string which will be set if the request was successfull. This will hold the result as json-rpc-string. (make sure you free this after use!) */ + char** error /**< [in] pointer to a string containg the error-message. (make sure you free it after use!) */); /** sends a request and stores the result in the provided buffer */ in3_ret_t in3_client_rpc_raw( - in3_t* c, /**< [in] the pointer to the incubed client config. */ - char* request, /**< [in] the rpc request including method and params. */ - char** result, /**< [in] pointer to string which will be set if the request was successfull. This will hold the result as json-rpc-string. (make sure you free this after use!) */ - char** error /**< [in] pointer to a string containg the error-message. (make sure you free it after use!) */); + in3_t* c, /**< [in] the pointer to the incubed client config. */ + const char* request, /**< [in] the rpc request including method and params. */ + char** result, /**< [in] pointer to string which will be set if the request was successfull. This will hold the result as json-rpc-string. (make sure you free this after use!) */ + char** error /**< [in] pointer to a string containg the error-message. (make sure you free it after use!) */); /** executes a request and returns result as string. in case of an error, the error-property of the result will be set. * The resulting string must be free by the the caller of this function! @@ -693,10 +750,26 @@ in3_signer_t* in3_create_signer( * create a new storage handler-object to be set on the client. * the caller will need to free this pointer after usage. */ -in3_storage_handler_t* in3_create_storage_handler( +in3_storage_handler_t* in3_set_storage_handler( + in3_t* c, /**< the incubed client */ in3_storage_get_item get_item, /**< function pointer returning a stored value for the given key.*/ in3_storage_set_item set_item, /**< function pointer setting a stored value for the given key.*/ in3_storage_clear clear, /**< function pointer clearing all contents of cache.*/ void* cptr /**< custom pointer which will will be passed to functions */ ); +#ifdef PAY +/** + * configure function for a payment. + */ +typedef char* (*pay_configure)(in3_t* c, d_token_t* config); + +/** + * registers a payment provider + */ +void in3_register_payment( + char* name, /**< name of the payment-type */ + pay_configure handler /**< pointer to the handler- */ +); +#endif + #endif diff --git a/c/include/in3/context.h b/c/include/in3/context.h index 8745630ba..2a5687364 100644 --- a/c/include/in3/context.h +++ b/c/include/in3/context.h @@ -147,8 +147,8 @@ typedef enum state { * *Important*: the req_data will not be cloned but used during the execution. The caller of the this function is also responsible for freeing this string afterwards. */ in3_ctx_t* ctx_new( - in3_t* client, /**< [in] the client-config. */ - char* req_data /**< [in] the rpc-request as json string. */ + in3_t* client, /**< [in] the client-config. */ + const char* req_data /**< [in] the rpc-request as json string. */ ); /** * sends a previously created context to nodes and verifies it. @@ -357,8 +357,8 @@ in3_ret_t ctx_get_error( * This context *MUST* be freed with ctx_free(ctx) after usage to release the resources. */ in3_ctx_t* in3_client_rpc_ctx_raw( - in3_t* c, /**< [in] the client config. */ - char* request /**< [in] rpc request. */ + in3_t* c, /**< [in] the client config. */ + const char* request /**< [in] rpc request. */ ); /** @@ -367,9 +367,9 @@ in3_ctx_t* in3_client_rpc_ctx_raw( * This context *MUST* be freed with ctx_free(ctx) after usage to release the resources. */ in3_ctx_t* in3_client_rpc_ctx( - in3_t* c, /**< [in] the clientt config. */ - char* method, /**< [in] rpc method. */ - char* params /**< [in] params as string. */ + in3_t* c, /**< [in] the clientt config. */ + const char* method, /**< [in] rpc method. */ + const char* params /**< [in] params as string. */ ); #endif diff --git a/c/include/in3/data.h b/c/include/in3/data.h index 99cd01a58..789e71b2b 100644 --- a/c/include/in3/data.h +++ b/c/include/in3/data.h @@ -126,7 +126,7 @@ d_token_t* d_next(d_token_t* item); void d_serialize_binary(bytes_builder_t* bb, d_token_t* t); /**< write the token as binary data into the builder */ json_ctx_t* parse_binary(const bytes_t* data); /**< parses the data and returns the context with the token, which needs to be freed after usage! */ json_ctx_t* parse_binary_str(const char* data, int len); /**< parses the data and returns the context with the token, which needs to be freed after usage! */ -json_ctx_t* parse_json(char* js); /**< parses json-data, which needs to be freed after usage! */ +json_ctx_t* parse_json(const char* js); /**< parses json-data, which needs to be freed after usage! */ void json_free(json_ctx_t* parser_ctx); /**< frees the parse-context after usage */ str_range_t d_to_json(const d_token_t* item); /**< returns the string for a object or array. This only works for json as string. For binary it will not work! */ char* d_create_json(d_token_t* item); /**< creates a json-string. It does not work for objects if the parsed data were binary!*/ diff --git a/c/include/in3/error.h b/c/include/in3/error.h index fdb58ee4f..e973f4d81 100644 --- a/c/include/in3/error.h +++ b/c/include/in3/error.h @@ -50,24 +50,25 @@ */ typedef enum { /* On success positive values (impl. defined) upto INT_MAX maybe returned */ - IN3_OK = 0, /**< Success */ - IN3_EUNKNOWN = -1, /**< Unknown error - usually accompanied with specific error msg */ - IN3_ENOMEM = -2, /**< No memory */ - IN3_ENOTSUP = -3, /**< Not supported */ - IN3_EINVAL = -4, /**< Invalid value */ - IN3_EFIND = -5, /**< Not found */ - IN3_ECONFIG = -6, /**< Invalid config */ - IN3_ELIMIT = -7, /**< Limit reached */ - IN3_EVERS = -8, /**< Version mismatch */ - IN3_EINVALDT = -9, /**< Data invalid, eg. invalid/incomplete JSON */ - IN3_EPASS = -10, /**< Wrong password */ - IN3_ERPC = -11, /**< RPC error (i.e. in3_ctx_t::error set) */ - IN3_ERPCNRES = -12, /**< RPC no response */ - IN3_EUSNURL = -13, /**< USN URL parse error */ - IN3_ETRANS = -14, /**< Transport error */ - IN3_ERANGE = -15, /**< Not in range */ - IN3_WAITING = -16, /**< the process can not be finished since we are waiting for responses */ - IN3_EIGNORE = -17, /**< Ignorable error */ + IN3_OK = 0, /**< Success */ + IN3_EUNKNOWN = -1, /**< Unknown error - usually accompanied with specific error msg */ + IN3_ENOMEM = -2, /**< No memory */ + IN3_ENOTSUP = -3, /**< Not supported */ + IN3_EINVAL = -4, /**< Invalid value */ + IN3_EFIND = -5, /**< Not found */ + IN3_ECONFIG = -6, /**< Invalid config */ + IN3_ELIMIT = -7, /**< Limit reached */ + IN3_EVERS = -8, /**< Version mismatch */ + IN3_EINVALDT = -9, /**< Data invalid, eg. invalid/incomplete JSON */ + IN3_EPASS = -10, /**< Wrong password */ + IN3_ERPC = -11, /**< RPC error (i.e. in3_ctx_t::error set) */ + IN3_ERPCNRES = -12, /**< RPC no response */ + IN3_EUSNURL = -13, /**< USN URL parse error */ + IN3_ETRANS = -14, /**< Transport error */ + IN3_ERANGE = -15, /**< Not in range */ + IN3_WAITING = -16, /**< the process can not be finished since we are waiting for responses */ + IN3_EIGNORE = -17, /**< Ignorable error */ + IN3_EPAYMENT_REQUIRED = -18, /**< payment required */ } in3_ret_t; /** Optional type similar to C++ std::optional diff --git a/c/include/in3/pay_eth.h b/c/include/in3/pay_eth.h new file mode 100644 index 000000000..aa044659c --- /dev/null +++ b/c/include/in3/pay_eth.h @@ -0,0 +1,58 @@ +/******************************************************************************* + * This file is part of the Incubed project. + * Sources: https://github.com/slockit/in3-c + * + * Copyright (C) 2018-2019 slock.it GmbH, Blockchains LLC + * + * + * COMMERCIAL LICENSE USAGE + * + * Licensees holding a valid commercial license may use this file in accordance + * with the commercial license agreement provided with the Software or, alternatively, + * in accordance with the terms contained in a written agreement between you and + * slock.it GmbH/Blockchains LLC. For licensing terms and conditions or further + * information please contact slock.it at in3@slock.it. + * + * Alternatively, this file may be used under the AGPL license as follows: + * + * AGPL LICENSE USAGE + * + * This program is free software: you can redistribute it and/or modify it under the + * terms of the GNU Affero General Public License as published by the Free Software + * Foundation, either version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. + * [Permissions of this strong copyleft license are conditioned on making available + * complete source code of licensed works and modifications, which include larger + * works using a licensed work, under the same license. Copyright and license notices + * must be preserved. Contributors provide an express grant of patent rights.] + * You should have received a copy of the GNU Affero General Public License along + * with this program. If not, see . + *******************************************************************************/ + +// @PUBLIC_HEADER +/** @file + * USN API. + * + * This header-file defines easy to use function, which are verifying USN-Messages. + * */ + +#ifndef PAY_ETH_H +#define PAY_ETH_H + +#include "client.h" + +typedef struct in3_pay_eth_config { + uint64_t bulk_size; + uint64_t max_price; + uint64_t nonce; + uint64_t gas_price; +} in3_pay_eth_config_t; + +void in3_register_pay_eth(); + +char* pay_eth_configure(in3_t* c, d_token_t* cconfig); + +#endif diff --git a/c/src/api/eth1/rpc_api.c b/c/src/api/eth1/rpc_api.c index cb4127083..0a8b61699 100644 --- a/c/src/api/eth1/rpc_api.c +++ b/c/src/api/eth1/rpc_api.c @@ -50,7 +50,7 @@ #include #define ETH_SIGN_PREFIX "\x19" \ - "Ethereum Signed Message:\n%i" + "Ethereum Signed Message:\n%u" #define RESPONSE_START() \ do { \ diff --git a/c/src/api/ipfs/ipfs_api.c b/c/src/api/ipfs/ipfs_api.c index 081d85271..5a76e0943 100644 --- a/c/src/api/ipfs/ipfs_api.c +++ b/c/src/api/ipfs/ipfs_api.c @@ -41,7 +41,7 @@ static bytes_t* b64_to_bytes(const char* b64) { size_t l = 0; uint8_t* data = base64_decode(b64, &l); - bytes_t* b = b_new((char*) data, l); + bytes_t* b = b_new(data, l); free(data); return b; } diff --git a/c/src/api/usn/usn_api.c b/c/src/api/usn/usn_api.c index 4fedf462b..7eb18c37c 100644 --- a/c/src/api/usn/usn_api.c +++ b/c/src/api/usn/usn_api.c @@ -173,7 +173,7 @@ static void verify_action_message(usn_device_conf_t* conf, d_token_t* msg, usn_m // prepare message hash //TODO the timestamp would run out space around 2106 ! sprintf(tmp, "%s%u%s{}", result->device->url, d_get_intk(msg, K_TIMESTAMP), d_get_stringk(msg, K_ACTION)); - sprintf(mhash, "\031Ethereum Signed Message:\n%u%s", (unsigned int) strlen(tmp), tmp); + sprintf(mhash, "\031Ethereum Signed Message:\n%zu%s", strlen(tmp), tmp); bytes_t msg_data = {.data = (uint8_t*) mhash, .len = strlen(mhash)}; sha3_to(&msg_data, hash); msg_data = bytes(hash, 32); diff --git a/c/src/cmd/in3/in3_storage.c b/c/src/cmd/in3/in3_storage.c index a43ec165d..7ecb64be5 100644 --- a/c/src/cmd/in3/in3_storage.c +++ b/c/src/cmd/in3/in3_storage.c @@ -73,13 +73,13 @@ static char* get_storage_dir() { return _HOME_DIR; } -static char* create_path(char* key) { +static char* create_path(const char* key) { char* path = _malloc(strlen(get_storage_dir()) + strlen(key) + 5); sprintf(path, "%s%s", get_storage_dir(), key); return path; } -bytes_t* storage_get_item(void* cptr, char* key) { +bytes_t* storage_get_item(void* cptr, const char* key) { UNUSED_VAR(cptr); char* path = create_path(key); @@ -108,7 +108,7 @@ bytes_t* storage_get_item(void* cptr, char* key) { return NULL; } -void storage_set_item(void* cptr, char* key, bytes_t* content) { +void storage_set_item(void* cptr, const char* key, bytes_t* content) { UNUSED_VAR(cptr); char* path = create_path(key); FILE* file = fopen(path, "wb"); diff --git a/c/src/cmd/in3/in3_storage.h b/c/src/cmd/in3/in3_storage.h index aee393ddd..6143a54c2 100644 --- a/c/src/cmd/in3/in3_storage.h +++ b/c/src/cmd/in3/in3_storage.h @@ -38,8 +38,8 @@ #include "../../core/client/client.h" -bytes_t* storage_get_item(void* cptr, char* key); +bytes_t* storage_get_item(void* cptr, const char* key); -void storage_set_item(void* cptr, char* key, bytes_t* content); +void storage_set_item(void* cptr, const char* key, bytes_t* content); void storage_clear(void* cptr); \ No newline at end of file diff --git a/c/src/cmd/in3/main.c b/c/src/cmd/in3/main.c index fe726cf15..518f014ee 100644 --- a/c/src/cmd/in3/main.c +++ b/c/src/cmd/in3/main.c @@ -549,7 +549,7 @@ static in3_ret_t debug_transport(in3_request_t* req) { #else in3_ret_t r = send_http(req); #endif - last_response = b_new(req->results[0].result.data, req->results[0].result.len); + last_response = b_new((uint8_t*) req->results[0].result.data, req->results[0].result.len); #ifndef DEBUG if (debug_mode) { if (req->results[0].result.len) @@ -616,13 +616,6 @@ int main(int argc, char* argv[]) { int p = 1, i; bytes32_t pk; - // use the storagehandler to cache data in .in3 - in3_storage_handler_t storage_handler; - storage_handler.get_item = storage_get_item; - storage_handler.set_item = storage_set_item; - storage_handler.clear = storage_clear; - storage_handler.cptr = NULL; - // we want to verify all in3_register_eth_full(); #ifdef IPFS @@ -642,7 +635,6 @@ int main(int argc, char* argv[]) { in3_t* c = in3_for_chain(0); c->transport = debug_transport; c->request_count = 1; - c->cache = &storage_handler; bool out_response = false; bool run_test_request = false; bool force_hex = false; @@ -662,6 +654,10 @@ int main(int argc, char* argv[]) { char* port = NULL; char* sig_type = "raw"; bool to_eth = false; + + // use the storagehandler to cache data in .in3 + in3_set_storage_handler(c, storage_get_item, storage_set_item, storage_clear, NULL); + #ifdef __MINGW32__ c->flags |= FLAGS_HTTP; #endif @@ -673,9 +669,6 @@ int main(int argc, char* argv[]) { if (strcmp(argv[i], "-ccache") == 0) c->cache->clear(c->cache->cptr); - // read data from cache - in3_cache_init(c); - // check env if (getenv("IN3_PK")) { hex_to_bytes(getenv("IN3_PK"), -1, pk, 32); @@ -789,7 +782,7 @@ int main(int argc, char* argv[]) { else if (strcmp(method, "keystore") == 0 || strcmp(method, "key") == 0) pk_file = argv[i]; else if (strcmp(method, "sign") == 0 && !data) - data = b_new(argv[i], strlen(argv[i])); + data = b_new((uint8_t*) argv[i], strlen(argv[i])); else if (sig == NULL && (strcmp(method, "call") == 0 || strcmp(method, "send") == 0 || strcmp(method, "abi_encode") == 0 || strcmp(method, "abi_decode") == 0)) sig = argv[i]; else { @@ -958,10 +951,10 @@ int main(int argc, char* argv[]) { if (strcmp(sig_type, "eth_sign") == 0) { char* tmp = alloca(data->len + 30); int l = sprintf(tmp, "\x19" - "Ethereum Signed Message:\n%i", + "Ethereum Signed Message:\n%u", data->len); memcpy(tmp + l, data->data, data->len); - data = b_new(tmp, l + data->len); + data = b_new((uint8_t*) tmp, l + data->len); sig_type = "raw"; } @@ -1049,10 +1042,10 @@ int main(int argc, char* argv[]) { if (strcmp(sig_type, "eth_sign") == 0) { char* tmp = alloca(msg.len + 30); int l = sprintf(tmp, "\x19" - "Ethereum Signed Message:\n%i", + "Ethereum Signed Message:\n%u", msg.len); memcpy(tmp + l, msg.data, msg.len); - msg = *b_new(tmp, l + msg.len); + msg = *b_new((uint8_t*) tmp, l + msg.len); } if (strcmp(sig_type, "hash") == 0) { if (msg.len != 32) die("The message hash must be 32 byte"); diff --git a/c/src/cmd/tools/rlp.c b/c/src/cmd/tools/rlp.c index 3c8caa41f..ed70506ea 100644 --- a/c/src/cmd/tools/rlp.c +++ b/c/src/cmd/tools/rlp.c @@ -245,7 +245,7 @@ void write(bytes_t* data, char* l, char** tt) { else if (t.len == 32) d = printf(""); else - d = printf("", t.len); + d = printf("", t.len); for (j = d; j < 17; j++) printf(" "); if (t.len > 0) diff --git a/c/src/core/client/cache.h b/c/src/core/client/cache.h index e76d05beb..53c60faef 100644 --- a/c/src/core/client/cache.h +++ b/c/src/core/client/cache.h @@ -51,7 +51,7 @@ * * This function is usually called internally to fill the weights * and nodelist from the the cache. - * If you call `in3_cache_init` there is no need to call this explicitly. + * If you call `in3_set_storage_handler` there is no need to call this explicitly. */ in3_ret_t in3_cache_update_nodelist( in3_t* c, /**< the incubed client */ @@ -72,7 +72,7 @@ in3_ret_t in3_cache_store_nodelist( * * This function is usually called internally to fill the weights * and whitelist from the the cache. - * If you call `in3_cache_init` there is no need to call this explicitly. + * If you call `in3_set_storage_handler` there is no need to call this explicitly. */ in3_ret_t in3_cache_update_whitelist( in3_t* c, /**< the incubed client */ diff --git a/c/src/core/client/client.c b/c/src/core/client/client.c index 1ecb0c3ee..4499c50a4 100644 --- a/c/src/core/client/client.c +++ b/c/src/core/client/client.c @@ -42,7 +42,7 @@ #include #include -in3_ctx_t* in3_client_rpc_ctx_raw(in3_t* c, char* req) { +in3_ctx_t* in3_client_rpc_ctx_raw(in3_t* c, const char* req) { // create a new context by parsing the request in3_ctx_t* ctx = ctx_new(c, req); @@ -64,7 +64,7 @@ in3_ctx_t* in3_client_rpc_ctx_raw(in3_t* c, char* req) { return ctx; // return context and hope the calle will clean it. } -in3_ctx_t* in3_client_rpc_ctx(in3_t* c, char* method, char* params) { +in3_ctx_t* in3_client_rpc_ctx(in3_t* c, const char* method, const char* params) { // generate the rpc-request const int max = strlen(method) + strlen(params) + 200; // determine the max length of the request string const bool heap = max > 500; // if we need more than 500 bytes, we better put it in the heap @@ -131,12 +131,12 @@ static in3_ret_t ctx_rpc(in3_ctx_t* ctx, char** result, char** error) { return res; } -in3_ret_t in3_client_rpc(in3_t* c, char* method, char* params, char** result, char** error) { +in3_ret_t in3_client_rpc(in3_t* c, const char* method, const char* params, char** result, char** error) { if (!error) return IN3_EINVAL; return ctx_rpc(in3_client_rpc_ctx(c, method, params), result, error); } -in3_ret_t in3_client_rpc_raw(in3_t* c, char* request, char** result, char** error) { +in3_ret_t in3_client_rpc_raw(in3_t* c, const char* request, char** result, char** error) { if (!error) return IN3_EINVAL; return ctx_rpc(in3_client_rpc_ctx_raw(c, request), result, error); } @@ -213,7 +213,8 @@ in3_signer_t* in3_create_signer( return signer; } -in3_storage_handler_t* in3_create_storage_handler( +in3_storage_handler_t* in3_set_storage_handler( + in3_t* c, /**< the incubed client */ in3_storage_get_item get_item, /**< function pointer returning a stored value for the given key.*/ in3_storage_set_item set_item, /**< function pointer setting a stored value for the given key.*/ in3_storage_clear clear, /**< function pointer setting a stored value for the given key.*/ @@ -224,5 +225,7 @@ in3_storage_handler_t* in3_create_storage_handler( handler->get_item = get_item; handler->set_item = set_item; handler->clear = clear; + c->cache = handler; + in3_cache_init(c); return handler; } diff --git a/c/src/core/client/client.h b/c/src/core/client/client.h index 3d0624392..a108ff4fc 100644 --- a/c/src/core/client/client.h +++ b/c/src/core/client/client.h @@ -275,17 +275,17 @@ typedef struct in3_chain { * @returns the found result. if the key is found this function should return the values as bytes otherwise `NULL`. **/ typedef bytes_t* (*in3_storage_get_item)( - void* cptr, /**< a custom pointer as set in the storage handler*/ - char* key /**< the key to search in the cache */ + void* cptr, /**< a custom pointer as set in the storage handler*/ + const char* key /**< the key to search in the cache */ ); /** * storage handler function for writing to the cache. **/ typedef void (*in3_storage_set_item)( - void* cptr, /**< a custom pointer as set in the storage handler*/ - char* key, /**< the key to store the value.*/ - bytes_t* value /**< the value to store.*/ + void* cptr, /**< a custom pointer as set in the storage handler*/ + const char* key, /**< the key to store the value.*/ + bytes_t* value /**< the value to store.*/ ); /** @@ -410,22 +410,26 @@ typedef struct in3_pay { * * if the error has a length>0 the response will be rejected */ -typedef struct n3_response { +typedef struct in3_response { sb_t error; /**< a stringbuilder to add any errors! */ sb_t result; /**< a stringbuilder to add the result */ } in3_response_t; +/* forward decl */ +typedef struct in3_t_ in3_t; + /** request-object. * * represents a RPC-request */ -typedef struct n3_request { +typedef struct in3_request { char* payload; /**< the payload to send */ char** urls; /**< array of urls */ int urls_len; /**< number of urls */ in3_response_t* results; /**< the responses*/ uint32_t timeout; /**< the timeout 0= no timeout*/ uint32_t* times; /**< measured times (in ms) which will be used for ajusting the weights */ + in3_t* in3; /**< pointer to associated IN3 instance */ } in3_request_t; /** the transport function to be implemented by the transport provider. @@ -471,7 +475,7 @@ typedef struct in3_filter_handler_t_ { * This struct holds the configuration and also point to internal resources such as filters or chain configs. * */ -typedef struct in3_t_ { +struct in3_t_ { /** number of seconds requests can be cached. */ uint32_t cache_timeout; @@ -545,7 +549,11 @@ typedef struct in3_t_ { /** used to identify the capabilities of the node. */ in3_node_props_t node_props; -} in3_t; +#ifndef DEV_NO_INTRN_PTR + /** pointer to internal data */ + void* internal; +#endif +}; /** creates a new Incubes configuration and returns the pointer. * @@ -563,20 +571,11 @@ typedef struct in3_t_ { * // create new client * in3_t* client = in3_new(); * - * // configure storage... - * in3_storage_handler_t storage_handler; - * storage_handler.get_item = storage_get_item; - * storage_handler.set_item = storage_set_item; - * storage_handler.clear = storage_clear; - * * // configure transport * client->transport = send_curl; * * // configure storage - * client->cache = &storage_handler; - * - * // init cache - * in3_cache_init(client); + * in3_set_storage_handler(c, storage_get_item, storage_set_item, storage_clear, NULL); * * // ready to use ... * ``` @@ -601,20 +600,11 @@ in3_t* in3_new() __attribute__((deprecated("use in3_for_chain(ETH_CHAIN_ID_MULTI * // create new client * in3_t* client = in3_for_chain(ETH_CHAIN_ID_MAINNET); * - * // configure storage... - * in3_storage_handler_t storage_handler; - * storage_handler.get_item = storage_get_item; - * storage_handler.set_item = storage_set_item; - * storage_handler.clear = storage_clear; - * * // configure transport * client->transport = send_curl; * * // configure storage - * client->cache = &storage_handler; - * - * // init cache - * in3_cache_init(client); + * in3_set_storage_handler(c, storage_get_item, storage_set_item, storage_clear, NULL); * * // ready to use ... * ``` @@ -630,18 +620,18 @@ in3_t* in3_for_chain_default( /** sends a request and stores the result in the provided buffer */ in3_ret_t in3_client_rpc( - in3_t* c, /**< [in] the pointer to the incubed client config. */ - char* method, /**< [in] the name of the rpc-funcgtion to call. */ - char* params, /**< [in] docs for input parameter v. */ - char** result, /**< [in] pointer to string which will be set if the request was successfull. This will hold the result as json-rpc-string. (make sure you free this after use!) */ - char** error /**< [in] pointer to a string containg the error-message. (make sure you free it after use!) */); + in3_t* c, /**< [in] the pointer to the incubed client config. */ + const char* method, /**< [in] the name of the rpc-funcgtion to call. */ + const char* params, /**< [in] docs for input parameter v. */ + char** result, /**< [in] pointer to string which will be set if the request was successfull. This will hold the result as json-rpc-string. (make sure you free this after use!) */ + char** error /**< [in] pointer to a string containg the error-message. (make sure you free it after use!) */); /** sends a request and stores the result in the provided buffer */ in3_ret_t in3_client_rpc_raw( - in3_t* c, /**< [in] the pointer to the incubed client config. */ - char* request, /**< [in] the rpc request including method and params. */ - char** result, /**< [in] pointer to string which will be set if the request was successfull. This will hold the result as json-rpc-string. (make sure you free this after use!) */ - char** error /**< [in] pointer to a string containg the error-message. (make sure you free it after use!) */); + in3_t* c, /**< [in] the pointer to the incubed client config. */ + const char* request, /**< [in] the rpc request including method and params. */ + char** result, /**< [in] pointer to string which will be set if the request was successfull. This will hold the result as json-rpc-string. (make sure you free this after use!) */ + char** error /**< [in] pointer to a string containg the error-message. (make sure you free it after use!) */); /** executes a request and returns result as string. in case of an error, the error-property of the result will be set. * The resulting string must be free by the the caller of this function! @@ -760,7 +750,8 @@ in3_signer_t* in3_create_signer( * create a new storage handler-object to be set on the client. * the caller will need to free this pointer after usage. */ -in3_storage_handler_t* in3_create_storage_handler( +in3_storage_handler_t* in3_set_storage_handler( + in3_t* c, /**< the incubed client */ in3_storage_get_item get_item, /**< function pointer returning a stored value for the given key.*/ in3_storage_set_item set_item, /**< function pointer setting a stored value for the given key.*/ in3_storage_clear clear, /**< function pointer clearing all contents of cache.*/ diff --git a/c/src/core/client/client_init.c b/c/src/core/client/client_init.c index 9247f952f..b686496e5 100644 --- a/c/src/core/client/client_init.c +++ b/c/src/core/client/client_init.c @@ -339,7 +339,7 @@ in3_ret_t in3_client_register_chain(in3_t* c, chain_id_t chain_id, in3_chain_typ } chain->chain_id = chain_id; - chain->contract = b_new((char*) contract, 20); + chain->contract = b_new(contract, 20); chain->type = type; chain->version = version; chain->whitelist = NULL; @@ -380,7 +380,7 @@ in3_ret_t in3_client_add_node(in3_t* c, chain_id_t chain_id, char* url, in3_node : _calloc(chain->nodelist_length + 1, sizeof(in3_node_weight_t)); if (!chain->nodelist || !chain->weights) return IN3_ENOMEM; node = chain->nodelist + chain->nodelist_length; - node->address = b_new((char*) address, 20); + node->address = b_new(address, 20); node->index = chain->nodelist_length; node->capacity = 1; node->deposit = 0; @@ -452,6 +452,7 @@ void in3_free(in3_t* a) { _free(a->chains[i].nodelist_upd8_params); } if (a->signer) _free(a->signer); + if (a->cache) _free(a->cache); if (a->chains) _free(a->chains); if (a->filters) { diff --git a/c/src/core/client/context.c b/c/src/core/client/context.c index c0c7ebf3a..0403ded1f 100644 --- a/c/src/core/client/context.c +++ b/c/src/core/client/context.c @@ -43,7 +43,7 @@ #include #include -in3_ctx_t* ctx_new(in3_t* client, char* req_data) { +in3_ctx_t* ctx_new(in3_t* client, const char* req_data) { in3_ctx_t* ctx = _calloc(1, sizeof(in3_ctx_t)); if (!ctx) return NULL; diff --git a/c/src/core/client/context.h b/c/src/core/client/context.h index 37b059ac3..90838f0df 100644 --- a/c/src/core/client/context.h +++ b/c/src/core/client/context.h @@ -147,8 +147,8 @@ typedef enum state { * *Important*: the req_data will not be cloned but used during the execution. The caller of the this function is also responsible for freeing this string afterwards. */ in3_ctx_t* ctx_new( - in3_t* client, /**< [in] the client-config. */ - char* req_data /**< [in] the rpc-request as json string. */ + in3_t* client, /**< [in] the client-config. */ + const char* req_data /**< [in] the rpc-request as json string. */ ); /** * sends a previously created context to nodes and verifies it. @@ -357,8 +357,8 @@ in3_ret_t ctx_get_error( * This context *MUST* be freed with ctx_free(ctx) after usage to release the resources. */ in3_ctx_t* in3_client_rpc_ctx_raw( - in3_t* c, /**< [in] the client config. */ - char* request /**< [in] rpc request. */ + in3_t* c, /**< [in] the client config. */ + const char* request /**< [in] rpc request. */ ); /** @@ -367,9 +367,9 @@ in3_ctx_t* in3_client_rpc_ctx_raw( * This context *MUST* be freed with ctx_free(ctx) after usage to release the resources. */ in3_ctx_t* in3_client_rpc_ctx( - in3_t* c, /**< [in] the clientt config. */ - char* method, /**< [in] rpc method. */ - char* params /**< [in] params as string. */ + in3_t* c, /**< [in] the clientt config. */ + const char* method, /**< [in] rpc method. */ + const char* params /**< [in] params as string. */ ); #endif diff --git a/c/src/core/client/execute.c b/c/src/core/client/execute.c index c848a87ee..42e09150d 100644 --- a/c/src/core/client/execute.c +++ b/c/src/core/client/execute.c @@ -527,6 +527,7 @@ in3_request_t* in3_create_request(in3_ctx_t* ctx) { // prepare response-object in3_request_t* request = _malloc(sizeof(in3_request_t)); + request->in3 = ctx->client; request->payload = payload->data; request->urls_len = nodes_count; request->urls = urls; diff --git a/c/src/core/util/bytes.c b/c/src/core/util/bytes.c index fe5658fa6..1beedea0d 100644 --- a/c/src/core/util/bytes.c +++ b/c/src/core/util/bytes.c @@ -40,7 +40,7 @@ #include #include -bytes_t* b_new(const char* data, int len) { +bytes_t* b_new(const uint8_t* data, uint32_t len) { bytes_t* b = _calloc(1, sizeof(bytes_t)); b->len = len; diff --git a/c/src/core/util/bytes.h b/c/src/core/util/bytes.h index 66d74b956..d2dd1d3a9 100644 --- a/c/src/core/util/bytes.h +++ b/c/src/core/util/bytes.h @@ -69,11 +69,11 @@ typedef struct bytes { /** a byte-buffer to attach byte-functions. */ typedef struct { - uint32_t bsize; /**< size of the currently allocated bytes */ - bytes_t b; /**< the bytes struct */ + size_t bsize; /**< size of the currently allocated bytes */ + bytes_t b; /**< the bytes struct */ } bytes_builder_t; -bytes_t* b_new(const char* data, int len); /**< allocates a new byte array with 0 filled */ +bytes_t* b_new(const uint8_t* data, uint32_t len); /**< allocates a new byte array with 0 filled */ void b_print(const bytes_t* a); /**< prints a the bytes as hex to stdout */ void ba_print(const uint8_t* a, size_t l); /**< prints a the bytes as hex to stdout */ int b_cmp(const bytes_t* a, const bytes_t* b); /**< compares 2 byte arrays and returns 1 for equal and 0 for not equal*/ diff --git a/c/src/core/util/data.c b/c/src/core/util/data.c index e530c6cd0..718ba2762 100644 --- a/c/src/core/util/data.c +++ b/c/src/core/util/data.c @@ -601,12 +601,12 @@ void json_free(json_ctx_t* jp) { _free(jp); } -json_ctx_t* parse_json(char* js) { +json_ctx_t* parse_json(const char* js) { json_ctx_t* parser = _malloc(sizeof(json_ctx_t)); // new parser if (!parser) return NULL; // not enoug memory? parser->len = 0; // initial length parser->depth = 0; // initial depth - parser->c = js; // the pointer to the string to parse + parser->c = (char*) js; // the pointer to the string to parse parser->allocated = JSON_INIT_TOKENS; // keep track of how many tokens we allocated memory for parser->result = _malloc(sizeof(d_token_t) * JSON_INIT_TOKENS); // we allocate memory for the tokens and reallocate if needed. if (!parser->result) { // not enough memory? @@ -618,7 +618,7 @@ json_ctx_t* parse_json(char* js) { json_free(parser); // clean up return NULL; // and return null } // - parser->c = js; // since this pointer changed during parsing, we set it back to the original string + parser->c = (char*) js; // since this pointer changed during parsing, we set it back to the original string return parser; } diff --git a/c/src/core/util/data.h b/c/src/core/util/data.h index aaf253f67..6039c43c4 100644 --- a/c/src/core/util/data.h +++ b/c/src/core/util/data.h @@ -126,7 +126,7 @@ d_token_t* d_next(d_token_t* item); void d_serialize_binary(bytes_builder_t* bb, d_token_t* t); /**< write the token as binary data into the builder */ json_ctx_t* parse_binary(const bytes_t* data); /**< parses the data and returns the context with the token, which needs to be freed after usage! */ json_ctx_t* parse_binary_str(const char* data, int len); /**< parses the data and returns the context with the token, which needs to be freed after usage! */ -json_ctx_t* parse_json(char* js); /**< parses json-data, which needs to be freed after usage! */ +json_ctx_t* parse_json(const char* js); /**< parses json-data, which needs to be freed after usage! */ void json_free(json_ctx_t* parser_ctx); /**< frees the parse-context after usage */ str_range_t d_to_json(const d_token_t* item); /**< returns the string for a object or array. This only works for json as string. For binary it will not work! */ char* d_create_json(d_token_t* item); /**< creates a json-string. It does not work for objects if the parsed data were binary!*/ diff --git a/c/src/verifier/eth1/nano/signature.c b/c/src/verifier/eth1/nano/signature.c index 82b32023e..d2ebe6745 100644 --- a/c/src/verifier/eth1/nano/signature.c +++ b/c/src/verifier/eth1/nano/signature.c @@ -65,7 +65,7 @@ bytes_t* ecrecover_signature(bytes_t* msg_hash, d_token_t* sig) { // verify signature if (ecdsa_recover_pub_from_sig(&secp256k1, pubkey, sdata, msg_hash->data, v) == 0) // hash it and return the last 20 bytes as address - return sha3_to(&pubkey_bytes, sdata) == 0 ? b_new((char*) sdata + 12, 20) : NULL; + return sha3_to(&pubkey_bytes, sdata) == 0 ? b_new(sdata + 12, 20) : NULL; else return NULL; } diff --git a/c/src/verifier/ipfs/ipfs.c b/c/src/verifier/ipfs/ipfs.c index e8568f6f4..0527ad350 100644 --- a/c/src/verifier/ipfs/ipfs.c +++ b/c/src/verifier/ipfs/ipfs.c @@ -112,11 +112,11 @@ in3_ret_t ipfs_verify_hash(const char* content, const char* encoding, const char if (!strcmp(encoding, "hex")) buf = hex_to_new_bytes(content, strlen(content)); else if (!strcmp(encoding, "utf8")) - buf = b_new(content, strlen(content)); + buf = b_new((uint8_t*) content, strlen(content)); else if (!strcmp(encoding, "base64")) { size_t l = 0; uint8_t* data = base64_decode(content, &l); - buf = b_new((char*) data, l); + buf = b_new(data, l); free(data); } else return IN3_ENOTSUP; diff --git a/c/test/runner.c b/c/test/runner.c index 0bb357e17..7ce567607 100644 --- a/c/test/runner.c +++ b/c/test/runner.c @@ -360,7 +360,7 @@ int run_test(d_token_t* test, int counter, char* fuzz_prop, in3_proof_t proof) { d_serialize_binary(bb, response); - printf(" ( heap: %zu json: %lu bin: %i) ", max_heap, res_size.len, bb->b.len); + printf(" ( heap: %zu json: %lu bin: %u) ", max_heap, res_size.len, bb->b.len); bb_free(bb); return fail; } diff --git a/c/test/unit_tests/test_cache.c b/c/test/unit_tests/test_cache.c index af53e5120..258dfff02 100644 --- a/c/test/unit_tests/test_cache.c +++ b/c/test/unit_tests/test_cache.c @@ -93,7 +93,9 @@ typedef struct cache_s { bytes_t values[MAX_ENTRIES]; char* keys[MAX_ENTRIES]; } cache_t; -static bytes_t* cache_get_item(void* cptr, char* key) { +static cache_t cache; + +static bytes_t* cache_get_item(void* cptr, const char* key) { cache_t* cache = (cache_t*) cptr; for (int i = 0; i < MAX_ENTRIES && cache->keys[i]; i++) { if (strcmp(cache->keys[i], key) == 0) @@ -101,7 +103,7 @@ static bytes_t* cache_get_item(void* cptr, char* key) { } return NULL; } -static void cache_set_item(void* cptr, char* key, bytes_t* value) { +static void cache_set_item(void* cptr, const char* key, bytes_t* value) { cache_t* cache = (cache_t*) cptr; int i = 0; while (i < MAX_ENTRIES && cache->keys[i]) { @@ -118,11 +120,14 @@ static void cache_set_item(void* cptr, char* key, bytes_t* value) { } void static setup_test_cache(in3_t* c) { - cache_t* cache = calloc(1, sizeof(cache_t)); - c->cache = _malloc(sizeof(in3_storage_handler_t)); - c->cache->cptr = cache; - c->cache->get_item = cache_get_item; - c->cache->set_item = cache_set_item; + if (!memiszero((uint8_t*) &cache, sizeof(cache))) { + for (int i = 0; i < MAX_ENTRIES; ++i) { + free(cache.keys[i]); + free(cache.values[i].data); + } + memset(&cache, 0, sizeof(cache)); + } + in3_set_storage_handler(c, cache_get_item, cache_set_item, NULL, &cache); } static void test_cache() { @@ -291,7 +296,7 @@ static void test_whitelist_cache() { in3_t* c2 = in3_for_chain(0); c2->chain_id = c->chain_id; - c2->cache = c->cache; + in3_set_storage_handler(c2, cache_get_item, cache_set_item, NULL, c->cache->cptr); in3_client_register_chain(c2, 0x8, CHAIN_ETH, contract, registry_id, 2, wlc); TEST_ASSERT_EQUAL(IN3_OK, in3_cache_update_whitelist(c2, in3_find_chain(c2, 0x8))); TEST_ASSERT_EQUAL_MEMORY(in3_find_chain(c2, 0x8)->whitelist->contract, wlc, 20); diff --git a/c/test/unit_tests/test_request.c b/c/test/unit_tests/test_request.c index d5e016ad9..255263bcd 100644 --- a/c/test/unit_tests/test_request.c +++ b/c/test/unit_tests/test_request.c @@ -505,7 +505,6 @@ static void test_configure_validation() { */ int main() { _free(in3_create_signer(NULL, NULL, NULL)); - _free(in3_create_storage_handler(NULL, NULL, NULL, NULL)); in3_log_set_quiet(true); in3_register_eth_basic(); diff --git a/java/src/in3_jni.c b/java/src/in3_jni.c index be4f47fb4..c8be9b7f9 100644 --- a/java/src/in3_jni.c +++ b/java/src/in3_jni.c @@ -389,12 +389,13 @@ JNIEXPORT jobject JNICALL Java_in3_IN3_getStorageProvider(JNIEnv* env, jobject o static JNIEnv* jni = NULL; static jobject get_storage_handler(void* cptr) { + if (!jni || !cptr) return NULL; jclass cls = (*jni)->GetObjectClass(jni, (jobject) cptr); jmethodID mid = (*jni)->GetMethodID(jni, cls, "getStorageProvider", "()Lin3/utils/StorageProvider;"); return (*jni)->CallObjectMethod(jni, (jobject) cptr, mid); } -bytes_t* storage_get_item(void* cptr, char* key) { +bytes_t* storage_get_item(void* cptr, const char* key) { jobject handler = get_storage_handler(cptr); if (!handler) return NULL; @@ -412,7 +413,7 @@ bytes_t* storage_get_item(void* cptr, char* key) { return res; } -void storage_set_item(void* cptr, char* key, bytes_t* content) { +void storage_set_item(void* cptr, const char* key, bytes_t* content) { jobject handler = get_storage_handler(cptr); if (!handler) return; @@ -980,12 +981,8 @@ JNIEXPORT jlong JNICALL Java_in3_IN3_init(JNIEnv* env, jobject ob, jlong jchain) in3_t* in3 = in3_for_chain(jchain); in3_register_eth_api(); in3_log_set_level(LOG_DEBUG); + in3_set_storage_handler(in3, storage_get_item, storage_set_item, storage_clear, (*env)->NewGlobalRef(env, ob)); in3->transport = Java_in3_IN3_transport; - in3->cache = _malloc(sizeof(in3_storage_handler_t)); - in3->cache->cptr = (*env)->NewGlobalRef(env, ob); - in3->cache->get_item = storage_get_item; - in3->cache->set_item = storage_set_item; - in3->cache->clear = storage_clear; in3->signer = _malloc(sizeof(in3_signer_t)); in3->signer->sign = jsign; in3->signer->prepare_tx = NULL; diff --git a/rust/Cargo.toml b/rust/Cargo.toml new file mode 100644 index 000000000..88e1b4b1e --- /dev/null +++ b/rust/Cargo.toml @@ -0,0 +1,6 @@ +[workspace] + +members = [ + "in3-rs", + "in3-sys", +] diff --git a/rust/ci.yml b/rust/ci.yml new file mode 100644 index 000000000..e01829557 --- /dev/null +++ b/rust/ci.yml @@ -0,0 +1,51 @@ +rust: + image: docker.slock.it/build-images/cmake:rust + stage: bindings + needs: [] + tags: + - short-jobs + script: + - rm -rf rust/in3-sys/pre_generated + - mkdir -p rust/in3-sys/pre_generated + - chmod -R 0755 rust/in3-sys/pre_generated + - mkdir -p build_rust + - cd build_rust + - rm -rf * + - cmake -DCMAKE_BUILD_TYPE=MINSIZEREL -DDEV_NO_INTRN_PTR=OFF -DUSE_CURL=false .. + - make -j8 + - cd ../rust/ + - cargo clean + - export UPDATE_IN3_BINDINGS=1 + - cargo build + + artifacts: + paths: + - build_rust/lib + - rust/in3-sys/pre_generated + - rust/target + +test_rust: + image: docker.slock.it/build-images/cmake:rust + stage: rust + needs: + - rust + tags: + - short-jobs + script: + - chmod -R 0755 rust/in3-sys/pre_generated + - cd rust/in3-rs + - unset UPDATE_IN3_BINDINGS + - cargo test --lib + +examples_rust: + image: docker.slock.it/build-images/cmake:rust + stage: rust + needs: + - rust + tags: + - short-jobs + script: + - chmod -R 0755 rust/in3-sys/pre_generated + - cd rust/in3-rs + - unset UPDATE_IN3_BINDINGS + - cargo build --examples --features=blocking diff --git a/rust/in3-rs/Cargo.toml b/rust/in3-rs/Cargo.toml new file mode 100644 index 000000000..1d32c8602 --- /dev/null +++ b/rust/in3-rs/Cargo.toml @@ -0,0 +1,21 @@ +[package] +name = "in3" +version = "0.1.0" +authors = ["slock.it "] +description = "High level bindings to IN3 library" +edition = "2018" + +[features] +blocking = ["reqwest"] + +[dependencies] +in3-sys = { path = "../in3-sys" } +libc = { version = "0.2", default-features = false } +reqwest = { version = "0.10", features = ["blocking","json"], optional = true } +serde_json = "1.0" +openssl = {version = "0.10", features = ["vendored"]} +surf = "1.0.3" +serde = "1.0.106" + +[dev-dependencies] +async-std = "1.5.0" \ No newline at end of file diff --git a/rust/in3-rs/examples/custom_storage.rs b/rust/in3-rs/examples/custom_storage.rs new file mode 100644 index 000000000..4084cd78e --- /dev/null +++ b/rust/in3-rs/examples/custom_storage.rs @@ -0,0 +1,33 @@ +extern crate in3; + +use std::fs; + +use in3::prelude::*; + +const CACHE_PATH: &str = "cache"; + +fn main() { + let mut c = Client::new(chain::MAINNET); + fs::create_dir_all(CACHE_PATH).unwrap(); + c.set_storage( + Box::new(|key| -> Vec { + println!("get {}", key); + match fs::read(format!("{}/{}", CACHE_PATH, key)) { + Ok(value) => value, + Err(_) => vec![], + } + }), + Box::new(|key, value| { + println!("set {} -> {:?}", key, value); + fs::write(format!("{}/{}", CACHE_PATH, key), value).expect("Unable to write file"); + }), + Box::new(|| { + println!("clear"); + fs::remove_dir_all(format!("{}", CACHE_PATH)).unwrap(); + }), + ); + match c.rpc(r#"{"method": "eth_blockNumber", "params": []}"#) { + Ok(res) => println!("{}", res), + Err(err) => println!("{}", err), + } +} diff --git a/rust/in3-rs/examples/custom_transport.rs b/rust/in3-rs/examples/custom_transport.rs new file mode 100644 index 000000000..8332876a1 --- /dev/null +++ b/rust/in3-rs/examples/custom_transport.rs @@ -0,0 +1,17 @@ +extern crate in3; + +use in3::prelude::*; + +fn main() { + let mut c = Client::new(chain::MAINNET); + let _ = c.configure(r#"{"autoUpdateList":false,"nodes":{"0x1":{"needsUpdate":false}}}}"#); + c.set_transport(Box::new(|_payload: &str, _urls: &[&str]| { + let mut responses = vec![]; + responses.push(Ok(r#"{"jsonrpc":"2.0","id":1,"result":"0x948f0d","in3":{"lastValidatorChange":0,"lastNodeList":9698978,"execTime":454,"rpcTime":454,"rpcCount":1,"currentBlock":9735949,"version":"2.1.0"}}"#.to_string())); + responses + })); + match c.rpc(r#"{"method": "eth_blockNumber", "params": []}"#) { + Ok(res) => println!("{}", res), + Err(err) => println!("{}", err), + } +} diff --git a/rust/in3-rs/examples/eth_block_number.rs b/rust/in3-rs/examples/eth_block_number.rs new file mode 100644 index 000000000..065dc0115 --- /dev/null +++ b/rust/in3-rs/examples/eth_block_number.rs @@ -0,0 +1,14 @@ +// Make sure you build the in3 crate with blocking feature enabled to make this example work +// cargo run --example eth_block_number --features=blocking +extern crate in3; + +use in3::prelude::*; + +fn main() { + let mut c = Client::new(chain::MAINNET); + let _ = c.configure(r#"{"autoUpdateList":false,"nodes":{"0x1":{"needsUpdate":false}}}}"#); + match c.rpc(r#"{"method": "eth_blockNumber", "params": []}"#) { + Ok(res) => println!("{}", res), + Err(err) => println!("{}", err), + } +} diff --git a/rust/in3-rs/examples/send.rs b/rust/in3-rs/examples/send.rs new file mode 100644 index 000000000..0441d4e18 --- /dev/null +++ b/rust/in3-rs/examples/send.rs @@ -0,0 +1,43 @@ +extern crate in3; + +use async_std::task; + +use in3::prelude::*; + +fn send() { + let mut c = Client::new(chain::MAINNET); + let _ = c.configure(r#"{"autoUpdateList":false,"nodes":{"0x1":{"needsUpdate":false}}}}"#); + let mut ctx = Ctx::new(&mut c, r#"{"method": "eth_blockNumber", "params": []}"#); + c.send(&mut ctx); +} + +async fn send_request() { + let mut c = Client::new(chain::MAINNET); + let _ = c.configure(r#"{"autoUpdateList":false,"nodes":{"0x1":{"needsUpdate":false}}}}"#); + c.send_request(r#"{"method": "eth_blockNumber", "params": []}"#) + .await; +} + +fn send_execute() { + let mut c = Client::new(chain::MAINNET); + let _ = c.configure(r#"{"autoUpdateList":false,"nodes":{"0x1":{"needsUpdate":false}}}}"#); + let mut ctx = Ctx::new(&mut c, r#"{"method": "eth_blockNumber", "params": []}"#); + let _res = ctx.execute(); +} + +fn rpc_call() { + let mut c = Client::new(chain::MAINNET); + let _ = c.configure(r#"{"autoUpdateList":false,"nodes":{"0x1":{"needsUpdate":false}}}}"#); + match c.rpc(r#"{"method": "eth_blockNumber", "params": []}"#) { + Ok(res) => println!("{}", res), + Err(err) => println!("{}", err), + } +} + +fn main() { + //rpc_call(); + let future = send_request(); + task::block_on(future); + // add tasks and run on executor. + //send_request(); +} diff --git a/rust/in3-rs/src/api.rs b/rust/in3-rs/src/api.rs new file mode 100644 index 000000000..56e46aaa4 --- /dev/null +++ b/rust/in3-rs/src/api.rs @@ -0,0 +1,74 @@ +use std::i64; + +use serde_json::{Result, Value}; +use serde_json::json; + +use crate::error::*; +use crate::error::In3Result; +use crate::in3::*; + +pub struct EthApi { + client: Box, +} + +impl EthApi { + pub fn new(config_str: &str) -> EthApi { + let mut client = Client::new(chain::MAINNET); + let _ = client.configure(config_str); + EthApi { client } + } + + async fn send(mut self, params: &str) -> In3Result { + self.client.send_request(params).await + } + + pub async fn block_number(self) -> i64 { + let response = + self.send(r#"{"method": "eth_blockNumber", "params": []}"#).await; + let v: Value = serde_json::from_str(&response.unwrap()).unwrap(); + let ret = v[0]["result"].as_str().unwrap(); + let without_prefix = ret.trim_start_matches("0x"); + let blocknum = i64::from_str_radix(without_prefix, 16); + blocknum.unwrap_or(-1) + } + + pub async fn getBalance(self, address: String) -> String { + let payload = json!({ + "method": "eth_getBalance", + "params": [ + address, + "latest" + ] + }); + let serialized = serde_json::to_string(&payload).unwrap(); + let response = self.send(&serialized).await; + let v: Value = serde_json::from_str(&response.unwrap()).unwrap(); + let balance = v[0]["result"].as_str().unwrap(); + balance.to_string() + } +} + +#[cfg(test)] +mod tests { + use async_std::task; + + use super::*; + + #[test] + fn test_block_number() { + let api = EthApi::new(r#"{"autoUpdateList":false,"nodes":{"0x1":{"needsUpdate":false}}}}"#); + //execute the call to the api on task::block_on + let num = task::block_on(api.block_number()); + assert!(num > 9000000, "Block number is not correct"); + } + + #[test] + fn test_get_balance() { + let api = EthApi::new(r#"{"autoUpdateList":false,"nodes":{"0x1":{"needsUpdate":false}}}}"#); + //execute the call to the api on task::block_on + let num = task::block_on( + api.getBalance("0xc94770007dda54cF92009BFF0dE90c06F603a09f".to_string()), + ); + assert!(num != "", "Balance is not correct"); + } +} diff --git a/rust/in3-rs/src/error.rs b/rust/in3-rs/src/error.rs new file mode 100644 index 000000000..a897ae458 --- /dev/null +++ b/rust/in3-rs/src/error.rs @@ -0,0 +1,111 @@ +use core::fmt; +use core::result; +use std::ffi; + +use in3_sys::in3_ret_t::*; + +macro_rules! in3_error_def { + ( $( $( #[$attr:meta] )* => $rust_variant:ident = $cs_variant:ident; )* ) => { + #[derive(Copy, Clone, Debug, Eq, Hash, PartialEq)] + + pub enum Error { + $( + $( + #[$attr] + )* + $rust_variant, + )* + + UnknownIn3Error, + CustomError(&'static str), + } + + impl From for Error { + fn from(err: in3_sys::in3_ret_t::Type) -> Self { + match err { + $( + $cs_variant => Error::$rust_variant, + )* + _ => Error::UnknownIn3Error, + } + } + } + + impl From<&Error> for i32 { + fn from(err: &Error) -> i32 { + match err { + $( + Error::$rust_variant => $cs_variant, + )* + _ => std::i32::MIN, + } + } + } + } +} + +in3_error_def!( + => NoMemory = IN3_ENOMEM; + => UnknownError = IN3_EUNKNOWN; + => NotSupported = IN3_ENOTSUP; + => InvalidValue = IN3_EINVAL; + => NotFound = IN3_EFIND; + => InvalidConfig = IN3_ECONFIG; + => LimitReached = IN3_ELIMIT; + => VersionMismatch = IN3_EVERS; + => DataInvalid = IN3_EINVALDT; + => WrongPassword = IN3_EPASS; + => RpcError = IN3_ERPC; + => RpcNoResponse = IN3_ERPCNRES; + => UsnUrlParseError = IN3_EUSNURL; + => TransportError = IN3_ETRANS; + => OutOfRange = IN3_ERANGE; + => Waiting = IN3_WAITING; + => IgnorableError = IN3_EIGNORE; +); + +#[must_use] +pub type In3Result = result::Result; + +impl fmt::Display for Error { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + write!(fmt, "{}", self.description()) + } +} + +impl Error { + fn description(&self) -> &str { + use self::Error::*; + match *self { + CustomError(msg) => msg, + UnknownIn3Error => "Unknown error", + _ => unsafe { + ffi::CStr::from_ptr(in3_sys::in3_errmsg(self.into())) + .to_str() + .unwrap() + }, + } + } +} + +#[cfg(test)] +mod tests { + use in3_sys::in3_ret_t; + + use super::Error; + + #[test] + fn test_error() { + let errors = [ + Error::NoMemory, + Error::UnknownIn3Error, + Error::CustomError("Custom error"), + Error::from(in3_ret_t::IN3_ECONFIG), + Error::from(500 as in3_ret_t::Type), + ]; + + for error in errors.iter() { + println!("{}", error); + } + } +} diff --git a/rust/in3-rs/src/in3.rs b/rust/in3-rs/src/in3.rs new file mode 100644 index 000000000..b499c6ce9 --- /dev/null +++ b/rust/in3-rs/src/in3.rs @@ -0,0 +1,395 @@ +use std::ffi; + +use crate::error::In3Result; +use crate::transport_async; + +pub mod chain { + pub type ChainId = u32; + + pub const MULTICHAIN: u32 = 0x0; + pub const MAINNET: u32 = 0x01; + pub const KOVAN: u32 = 0x2a; + pub const TOBALABA: u32 = 0x44d; + pub const GOERLI: u32 = 0x5; + pub const EVAN: u32 = 0x4b1; + pub const IPFS: u32 = 0x7d0; + pub const BTC: u32 = 0x99; + pub const LOCAL: u32 = 0xffff; +} + +pub struct Ctx { + ptr: *mut in3_sys::in3_ctx_t, + config: ffi::CString, +} + +impl Ctx { + pub fn new(in3: &mut Client, config_str: &str) -> Ctx { + let config = ffi::CString::new(config_str).expect("CString::new failed"); + let ptr: *mut in3_sys::in3_ctx_t; + unsafe { + ptr = in3_sys::ctx_new(in3.ptr, config.as_ptr()); + } + Ctx { ptr, config } + } + + pub async fn execute(&mut self) -> In3Result { + unsafe { + let mut ctx_ret; + let ret = loop { + ctx_ret = in3_sys::in3_ctx_execute(self.ptr); + let mut last_waiting: *mut in3_sys::in3_ctx_t; + let mut p: *mut in3_sys::in3_ctx_t; + last_waiting = (*self.ptr).required; + p = self.ptr; + match ctx_ret { + in3_sys::in3_ret_t::IN3_EIGNORE => { + while p != std::ptr::null_mut() { + let p_req = (*p).required; + if p_req != std::ptr::null_mut() + && (*p_req).verification_state == in3_sys::in3_ret_t::IN3_EIGNORE + { + last_waiting = p; + } + p = (*last_waiting).required; + } + if last_waiting == std::ptr::null_mut() { + break Err("Cound not find the last waiting context"); + } else { + in3_sys::ctx_handle_failable(last_waiting); + } + } + in3_sys::in3_ret_t::IN3_WAITING => { + while p != std::ptr::null_mut() { + let state = in3_sys::in3_ctx_state(p); + let res = (*p).raw_response; + if res == std::ptr::null_mut() + && state == in3_sys::state::CTX_WAITING_FOR_RESPONSE + { + last_waiting = p; + } + p = (*last_waiting).required; + } + if last_waiting == std::ptr::null_mut() { + break Err("Cound not find the last waiting context"); + } + } + in3_sys::in3_ret_t::IN3_OK => { + let result = (*(*self.ptr).response_context).c; + let data = ffi::CStr::from_ptr(result).to_str().unwrap(); + println!("{}", data); + break Ok(data); + } + _ => { + break Err("EIGNORE"); + } + } + + if last_waiting != std::ptr::null_mut() { + let req_type = (*last_waiting).type_; + match req_type { + in3_sys::ctx_type::CT_SIGN => { + println!("TODO CT_SIGN"); + break Ok("TODO"); + } + in3_sys::ctx_type::CT_RPC => { + let req = in3_sys::in3_create_request(last_waiting); + let payload = ffi::CStr::from_ptr((*req).payload).to_str().unwrap(); + let urls_len = (*req).urls_len; + let mut urls = Vec::new(); + for i in 0..urls_len as usize { + let url = ffi::CStr::from_ptr(*(*req).urls.add(i)) + .to_str() + .unwrap(); + urls.push(url); + } + let responses = transport_async::transport_http(payload, &urls).await; + let mut any_err = false; + for (i, resp) in responses.iter().enumerate() { + match resp { + Err(err) => { + any_err = true; + let err_str = ffi::CString::new(err.to_string()).unwrap(); + in3_sys::sb_add_chars( + &mut (*(*req).results.add(i)).error, + err_str.as_ptr(), + ); + } + Ok(res) => { + let res_str = ffi::CString::new(res.to_string()).unwrap(); + in3_sys::sb_add_chars( + &mut (*(*req).results.add(i)).result, + res_str.as_ptr(), + ); + } + } + } + let result = (*(*req).results.offset(0)).result; + let len = result.len; + let data = ffi::CStr::from_ptr(result.data).to_str().unwrap(); + println!("{}", data); + if len != 0 { + break Ok(data); + } else { + let error = (*(*req).results.offset(0)).error; + let err = ffi::CStr::from_ptr(error.data).to_str().unwrap(); + break Err(err); + } + } + } + } + }; + let ret_str: String = ret.unwrap().to_owned(); + Ok(ret_str) + } + } +} + +impl Drop for Ctx { + fn drop(&mut self) { + unsafe { + in3_sys::ctx_free(self.ptr); + } + } +} + +pub struct Request { + ptr: *mut in3_sys::in3_request_t, + ctx_ptr: *const in3_sys::in3_ctx_t, +} + +impl Request { + pub fn new(ctx: &mut Ctx) -> Request { + unsafe { + Request { + ptr: in3_sys::in3_create_request(ctx.ptr), + ctx_ptr: ctx.ptr, + } + } + } +} + +impl Drop for Request { + fn drop(&mut self) { + unsafe { + in3_sys::request_free(self.ptr, self.ctx_ptr, false); + } + } +} + +pub struct Client { + ptr: *mut in3_sys::in3_t, + transport: Option Vec>>>, + storage_get: Option Vec>>, + storage_set: Option>, + storage_clear: Option>, +} + +impl Client { + pub async fn send_request(&mut self, config_str: &str) -> In3Result { + let mut ctx = Ctx::new(self, config_str); + let _res = ctx.execute().await; + _res + } + + #[cfg(feature = "blocking")] + pub fn send(&self, ctx: &mut Ctx) -> In3Result<()> { + unsafe { + let ret = in3_sys::in3_send_ctx(ctx.ptr); + match ret { + in3_sys::in3_ret_t::IN3_OK => Ok(()), + _ => Err(ret.into()), + } + } + } + + pub fn new(chain_id: chain::ChainId) -> Box { + unsafe { + let mut c = Box::new(Client { + ptr: in3_sys::in3_for_chain_auto_init(chain_id), + transport: None, + storage_get: None, + storage_set: None, + storage_clear: None, + }); + let c_ptr: *mut ffi::c_void = &mut *c as *mut _ as *mut ffi::c_void; + (*c.ptr).internal = c_ptr; + (*c.ptr).cache = in3_sys::in3_set_storage_handler(c.ptr, Some(Client::in3_rust_storage_get), + Some(Client::in3_rust_storage_set), + Some(Client::in3_rust_storage_clear), + c.ptr as *mut libc::c_void); + (*c.ptr).transport = Some(Client::in3_rust_transport); + + #[cfg(feature = "blocking")] { + c.set_transport(Box::new(crate::transport::transport_http)); + } + + c + } + } + + pub fn set_transport( + &mut self, + transport: Box Vec>>, + ) { + self.transport = Some(transport); + } + + pub fn set_storage( + &mut self, + get: Box Vec>, + set: Box, + clear: Box, + ) { + self.storage_get = Some(get); + self.storage_set = Some(set); + self.storage_clear = Some(clear); + } + + unsafe extern "C" fn in3_rust_storage_get( + cptr: *mut libc::c_void, + key: *const libc::c_char, + ) -> *mut in3_sys::bytes_t { + let key = ffi::CStr::from_ptr(key).to_str().unwrap(); + let client = cptr as *mut in3_sys::in3_t; + let c = (*client).internal as *mut Client; + let val: Option> = match &mut (*c).storage_get { + None => None, + Some(get) => Some((*get)(key)), + }; + match val { + Some(val) => in3_sys::b_new(val.as_ptr(), val.len() as u32), + None => std::ptr::null_mut(), + } + } + + unsafe extern "C" fn in3_rust_storage_set( + cptr: *mut libc::c_void, + key: *const libc::c_char, + value: *mut in3_sys::bytes_t, + ) { + let key = ffi::CStr::from_ptr(key).to_str().unwrap(); + let value = std::slice::from_raw_parts_mut((*value).data, (*value).len as usize); + let client = cptr as *mut in3_sys::in3_t; + let c = (*client).internal as *mut Client; + match &mut (*c).storage_set { + None => None, + Some(set) => Some((*set)(key, value)), + }; + } + + unsafe extern "C" fn in3_rust_storage_clear(cptr: *mut libc::c_void) { + let client = cptr as *mut in3_sys::in3_t; + let c = (*client).internal as *mut Client; + match &mut (*c).storage_clear { + None => None, + Some(clear) => Some((*clear)()), + }; + } + + extern "C" fn in3_rust_transport( + request: *mut in3_sys::in3_request_t, + ) -> in3_sys::in3_ret_t::Type { + // internally calls the rust transport impl, i.e. Client.transport + let mut urls = Vec::new(); + + unsafe { + let payload = ffi::CStr::from_ptr((*request).payload).to_str().unwrap(); + let urls_len = (*request).urls_len; + for i in 0..urls_len as usize { + let url = ffi::CStr::from_ptr(*(*request).urls.add(i)) + .to_str() + .unwrap(); + urls.push(url); + } + + let c = (*(*request).in3).internal as *mut Client; + let responses: Vec> = match &mut (*c).transport { + None => panic!("Missing transport!"), + Some(transport) => (*transport)(payload, &urls), + }; + + let mut any_err = false; + for (i, resp) in responses.iter().enumerate() { + match resp { + Err(err) => { + any_err = true; + let err_str = ffi::CString::new(err.to_string()).unwrap(); + in3_sys::sb_add_chars( + &mut (*(*request).results.add(i)).error, + err_str.as_ptr(), + ); + } + Ok(res) => { + let res_str = ffi::CString::new(res.to_string()).unwrap(); + in3_sys::sb_add_chars( + &mut (*(*request).results.add(i)).result, + res_str.as_ptr(), + ); + } + } + } + + if urls_len as usize != responses.len() || any_err { + return in3_sys::in3_ret_t::IN3_ETRANS; + } + } + + in3_sys::in3_ret_t::IN3_OK + } + + // in3 client config + pub fn configure(&mut self, config: &str) -> Result<(), String> { + unsafe { + let config_c = ffi::CString::new(config).expect("CString::new failed"); + let err = in3_sys::in3_configure(self.ptr, config_c.as_ptr()); + if err.as_ref().is_some() { + return Err(ffi::CStr::from_ptr(err).to_str().unwrap().to_string()); + } + } + Ok(()) + } + + #[cfg(feature = "blocking")] + pub fn rpc(&mut self, request: &str) -> Result { + let mut null: *mut i8 = std::ptr::null_mut(); + let res: *mut *mut i8 = &mut null; + let err: *mut *mut i8 = &mut null; + let req_str = ffi::CString::new(request).unwrap(); + unsafe { + let ret = in3_sys::in3_client_rpc_raw(self.ptr, req_str.as_ptr(), res, err); + return if ret == in3_sys::in3_ret_t::IN3_OK { + Ok(ffi::CStr::from_ptr(*res).to_str().unwrap().to_string()) + } else { + Err(ffi::CStr::from_ptr(*err).to_str().unwrap().to_string()) + }; + } + } +} + +impl Drop for Client { + fn drop(&mut self) { + unsafe { + in3_sys::in3_free(self.ptr); + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_in3_config() { + let mut in3 = Client::new(chain::MAINNET); + let c = in3.configure(r#"{"autoUpdateList":false}"#); + assert_eq!(c.is_err(), false); + } + + #[test] + fn test_in3_create_request() { + let mut in3 = Client::new(chain::MAINNET); + let mut ctx = Ctx::new(&mut in3, r#"{"method":"eth_blockNumber","params":[]}"#); + let _request = Request::new(&mut ctx); + let _ = ctx.execute(); + } +} diff --git a/rust/in3-rs/src/lib.rs b/rust/in3-rs/src/lib.rs new file mode 100644 index 000000000..92c9ab8c0 --- /dev/null +++ b/rust/in3-rs/src/lib.rs @@ -0,0 +1,14 @@ +#![allow(dead_code)] + +pub mod api; +pub mod error; +pub mod in3; + +#[cfg(feature = "blocking")] +mod transport; + +mod transport_async; + +pub mod prelude { + pub use crate::in3::*; +} diff --git a/rust/in3-rs/src/transport.rs b/rust/in3-rs/src/transport.rs new file mode 100644 index 000000000..6cad5b1f9 --- /dev/null +++ b/rust/in3-rs/src/transport.rs @@ -0,0 +1,39 @@ +extern crate reqwest; + +use reqwest::{blocking, header}; + +fn http_send(url: &str, payload: &str) -> Result> { + let header_json = header::HeaderValue::from_static("application/json"); + let client = blocking::Client::new(); + let res = client + .post(url) + .body(payload.to_string()) + .header(header::CONTENT_TYPE, header_json) + .send()?; + Ok(res.text().unwrap()) +} + +pub(crate) fn transport_http(payload: &str, urls: &[&str]) -> Vec> { + let mut responses = vec![]; + for url in urls { + match http_send(url, payload) { + Err(_) => responses.push(Err("Transport error".to_string())), + Ok(res) => responses.push(Ok(res)), + } + } + responses +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_transport_http() { + let res = transport_http( + r#"{"id":1,"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"in3":{"verification":"proof","version": "2.1.0"}}"#, + &["https://in3-v2.slock.it/mainnet/nd-3"], + ); + println!("{:?}", res); + } +} diff --git a/rust/in3-rs/src/transport_async.rs b/rust/in3-rs/src/transport_async.rs new file mode 100644 index 000000000..4f0ba7f81 --- /dev/null +++ b/rust/in3-rs/src/transport_async.rs @@ -0,0 +1,41 @@ +extern crate surf; + +async fn http_async( + url: &str, + payload: &str, +) -> Result> { + let res = surf::post(url) + .body_string(payload.to_string()) + .set_header("content-type", "application/json") + .recv_string() + .await?; + Ok(res.to_string()) +} + +pub(crate) async fn transport_http(payload: &str, urls: &[&str]) -> Vec> { + let mut responses = vec![]; + for url in urls { + let res = http_async(url, payload).await; + match res { + Err(_) => responses.push(Err("Transport error".to_string())), + Ok(res) => responses.push(Ok(res)), + } + } + responses +} + +#[cfg(test)] +mod tests { + use async_std::task; + + use super::*; + + #[test] + fn test_transport_http_async() { + let res = task::block_on(transport_http( + r#"{"id":1,"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"in3":{"verification":"proof","version": "2.1.0"}}"#, + &["https://in3-v2.slock.it/mainnet/nd-3"], + )); + println!("----- >{:?}", res); + } +} diff --git a/rust/in3-sys/Cargo.toml b/rust/in3-sys/Cargo.toml new file mode 100644 index 000000000..39cbfb9b5 --- /dev/null +++ b/rust/in3-sys/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "in3-sys" +version = "0.1.0" +authors = ["slock.it "] +description = "System bindings to the IN3 library" +build = "build.rs" +links = "in3" + +[dependencies] +libc = { version = "0.2" } + +[build-dependencies] +bindgen = "0.53.0" diff --git a/rust/in3-sys/build.rs b/rust/in3-sys/build.rs new file mode 100644 index 000000000..e4bd64384 --- /dev/null +++ b/rust/in3-sys/build.rs @@ -0,0 +1,131 @@ +//! The following environment variables affect the build: +//! +//! * `UPDATE_IN3_BINDINGS`: setting indicates that the pre-generated `in3.rs` should be +//! updated with the output bindgen +//! +//! # Bindgen enum mapping +//! +//! Bindgen can convert C enums in several ways: +//! +//! 1. **"Rustified" enum**: Bindgen creates a Rust enum, which provides the most "type safety" and +//! reduces the chance of confusing variants for a different type. For variants whose +//! discriminant values are not distinct, bindgen defines constants. +//! 2. **"Constified" enum**: Bindgen defines constants for each enum variant. +//! 3. **"Constified" enum module**: Bindgen defines constants for each enum variant in a separate +//! module. +//! +//! # Rationale for enum types +//! +//! Rustified enum: these have distinct variant discriminants +//! +//! * `cs_arch` +//! * `cs_op_type` +//! * `cs_opt_type` +//! +//! Constified enum module: +//! +//! * `cs_err`: avoid undefined behavior in case an error is instantiated with an invalid value; the +//! compiler could make false assumptions that the value is only within a certain range. +//! * `cs_group_type`/`ARCH_insn_group`: each architecture adds group types to the `cs_group_type`, +//! so we constify to avoid needing to transmute. +//! * `cs_mode`: used as a bitmask; when values are OR'd together, they are not a valid discriminant +//! value +//! * `cs_opt_value`/`ARCH_reg`: variant discriminants are not unique +//! +//! Bitfield enum: fields are OR'd together to form new values +//! * `cs_mode` + +extern crate bindgen; + +use std::env; +use std::fs::copy; +use std::path::PathBuf; + +include!("common.rs"); + +const IN3_DIR: &'static str = "../../c"; + +/// Indicates how in3 library should be linked +#[allow(dead_code)] +enum LinkType { + Dynamic, + Static, +} + +/// Search for header in search paths +fn find_in3_header(header_search_paths: &Vec, name: &str) -> Option { + for search_path in header_search_paths.iter() { + let potential_file = search_path.join(name); + if potential_file.is_file() { + return Some(potential_file); + } + } + None +} + +/// Gets environment variable value. Panics if variable is not set. +fn env_var(var: &str) -> String { + env::var(var).expect(&format!("Environment variable {} is not set", var)) +} + +/// Create bindings using bindgen +fn write_bindgen_bindings(header_search_paths: &Vec, out_bindings_path: PathBuf) { + let pregenerated_bindgen_header: PathBuf = [ + env_var("CARGO_MANIFEST_DIR"), + "pre_generated".into(), + BINDINGS_FILE.into(), + ] + .iter() + .collect(); + let mut builder = bindgen::Builder::default() + .rust_target(bindgen::RustTarget::Stable_1_19) + .size_t_is_usize(true) + .use_core() + .ctypes_prefix("libc") + .header( + find_in3_header(header_search_paths, "in3.rs.h") + .expect("Could not find header") + .to_str() + .unwrap(), + ) + .disable_name_namespacing() + .prepend_enum_name(false) + .generate_comments(true) + .impl_debug(true) + .constified_enum_module("in3_ret_t") + .rustified_enum(".*"); + + // Whitelist cs_.* functions and types + let pattern = String::from(".*"); + builder = builder + .whitelist_function(&pattern) + .whitelist_type(&pattern); + + let bindings = builder.generate().expect("Unable to generate bindings"); + + // Write bindings to $OUT_DIR/bindings.rs + println!("{:?} {:?}", out_bindings_path, pregenerated_bindgen_header); + bindings + .write_to_file(&out_bindings_path) + .expect("Unable to write bindings"); + //Copy binding to other path + copy(out_bindings_path, pregenerated_bindgen_header).expect("Unable to update in3 bindings"); +} + +fn main() { + // C header search paths + let mut header_search_paths: Vec = Vec::new(); + + header_search_paths.push([IN3_DIR, "include"].iter().collect()); + println!("cargo:rustc-link-lib=static=in3"); + println!( + "cargo:rustc-link-search={}/../../build_rust/lib", + env_var("CARGO_MANIFEST_DIR") + ); + + if env::var("UPDATE_IN3_BINDINGS").is_ok() { + let out_bindings_path = PathBuf::from(env_var("OUT_DIR")).join(BINDINGS_FILE); + // Only run bindgen if we are *not* using the bundled in3 bindings + write_bindgen_bindings(&header_search_paths, out_bindings_path); + } +} diff --git a/rust/in3-sys/common.rs b/rust/in3-sys/common.rs new file mode 100644 index 000000000..36f6c509e --- /dev/null +++ b/rust/in3-sys/common.rs @@ -0,0 +1,27 @@ +// Contains code common to the build script and main crate +// +// Needs to be included with include! macro + +#[derive(Clone, Copy, PartialEq, Eq, Debug, Hash)] +/// Information specific to architecture +pub struct In3ArchInfo<'a> { + /// name of C header + header_name: &'a str, + + /// name used within in3 C library + cs_name: &'a str, +} + +impl<'a> In3ArchInfo<'a> { + /// Get the name of the C header + pub fn header_name(&self) -> &str { + self.header_name + } + + /// Get the arch name used in In3 types + pub fn cs_name(&self) -> &str { + self.cs_name + } +} + +pub static BINDINGS_FILE: &'static str = "in3.rs"; diff --git a/rust/in3-sys/pre_generated/in3.rs b/rust/in3-sys/pre_generated/in3.rs new file mode 100644 index 000000000..b6267f22f --- /dev/null +++ b/rust/in3-sys/pre_generated/in3.rs @@ -0,0 +1,16945 @@ +/* automatically generated by rust-bindgen */ + +#[repr(C)] +#[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] +pub struct __BindgenBitfieldUnit { + storage: Storage, + align: [Align; 0], +} +impl __BindgenBitfieldUnit { + #[inline] + pub fn new(storage: Storage) -> Self { + Self { storage, align: [] } + } +} +impl __BindgenBitfieldUnit +where + Storage: AsRef<[u8]> + AsMut<[u8]>, +{ + #[inline] + pub fn get_bit(&self, index: usize) -> bool { + debug_assert!(index / 8 < self.storage.as_ref().len()); + let byte_index = index / 8; + let byte = self.storage.as_ref()[byte_index]; + let bit_index = if cfg!(target_endian = "big") { + 7 - (index % 8) + } else { + index % 8 + }; + let mask = 1 << bit_index; + byte & mask == mask + } + #[inline] + pub fn set_bit(&mut self, index: usize, val: bool) { + debug_assert!(index / 8 < self.storage.as_ref().len()); + let byte_index = index / 8; + let byte = &mut self.storage.as_mut()[byte_index]; + let bit_index = if cfg!(target_endian = "big") { + 7 - (index % 8) + } else { + index % 8 + }; + let mask = 1 << bit_index; + if val { + *byte |= mask; + } else { + *byte &= !mask; + } + } + #[inline] + pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 { + debug_assert!(bit_width <= 64); + debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); + debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + let mut val = 0; + for i in 0..(bit_width as usize) { + if self.get_bit(i + bit_offset) { + let index = if cfg!(target_endian = "big") { + bit_width as usize - 1 - i + } else { + i + }; + val |= 1 << index; + } + } + val + } + #[inline] + pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) { + debug_assert!(bit_width <= 64); + debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); + debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + for i in 0..(bit_width as usize) { + let mask = 1 << i; + let val_bit_is_set = val & mask == mask; + let index = if cfg!(target_endian = "big") { + bit_width as usize - 1 - i + } else { + i + }; + self.set_bit(index + bit_offset, val_bit_is_set); + } + } +} +pub type int_least8_t = i8; +pub type int_least16_t = i16; +pub type int_least32_t = i32; +pub type int_least64_t = i64; +pub type uint_least8_t = u8; +pub type uint_least16_t = u16; +pub type uint_least32_t = u32; +pub type uint_least64_t = u64; +pub type int_fast8_t = i8; +pub type int_fast16_t = i16; +pub type int_fast32_t = i32; +pub type int_fast64_t = i64; +pub type uint_fast8_t = u8; +pub type uint_fast16_t = u16; +pub type uint_fast32_t = u32; +pub type uint_fast64_t = u64; +pub type __int8_t = libc::c_schar; +pub type __uint8_t = libc::c_uchar; +pub type __int16_t = libc::c_short; +pub type __uint16_t = libc::c_ushort; +pub type __int32_t = libc::c_int; +pub type __uint32_t = libc::c_uint; +pub type __int64_t = libc::c_longlong; +pub type __uint64_t = libc::c_ulonglong; +pub type __darwin_intptr_t = libc::c_long; +pub type __darwin_natural_t = libc::c_uint; +pub type __darwin_ct_rune_t = libc::c_int; +#[repr(C)] +#[derive(Copy)] +pub union __mbstate_t { + pub __mbstate8: [libc::c_char; 128usize], + pub _mbstateL: libc::c_longlong, + _bindgen_union_align: [u64; 16usize], +} +#[test] +fn bindgen_test_layout___mbstate_t() { + assert_eq!( + ::core::mem::size_of::<__mbstate_t>(), + 128usize, + concat!("Size of: ", stringify!(__mbstate_t)) + ); + assert_eq!( + ::core::mem::align_of::<__mbstate_t>(), + 8usize, + concat!("Alignment of ", stringify!(__mbstate_t)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__mbstate_t>())).__mbstate8 as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__mbstate_t), + "::", + stringify!(__mbstate8) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__mbstate_t>()))._mbstateL as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__mbstate_t), + "::", + stringify!(_mbstateL) + ) + ); +} +impl Clone for __mbstate_t { + fn clone(&self) -> Self { + *self + } +} +impl ::core::fmt::Debug for __mbstate_t { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + write!(f, "__mbstate_t {{ union }}") + } +} +pub type __darwin_mbstate_t = __mbstate_t; +pub type __darwin_ptrdiff_t = libc::c_long; +pub type __darwin_size_t = libc::c_ulong; +pub type __darwin_va_list = __builtin_va_list; +pub type __darwin_wchar_t = libc::c_int; +pub type __darwin_rune_t = __darwin_wchar_t; +pub type __darwin_wint_t = libc::c_int; +pub type __darwin_clock_t = libc::c_ulong; +pub type __darwin_socklen_t = __uint32_t; +pub type __darwin_ssize_t = libc::c_long; +pub type __darwin_time_t = libc::c_long; +pub type __darwin_blkcnt_t = __int64_t; +pub type __darwin_blksize_t = __int32_t; +pub type __darwin_dev_t = __int32_t; +pub type __darwin_fsblkcnt_t = libc::c_uint; +pub type __darwin_fsfilcnt_t = libc::c_uint; +pub type __darwin_gid_t = __uint32_t; +pub type __darwin_id_t = __uint32_t; +pub type __darwin_ino64_t = __uint64_t; +pub type __darwin_ino_t = __darwin_ino64_t; +pub type __darwin_mach_port_name_t = __darwin_natural_t; +pub type __darwin_mach_port_t = __darwin_mach_port_name_t; +pub type __darwin_mode_t = __uint16_t; +pub type __darwin_off_t = __int64_t; +pub type __darwin_pid_t = __int32_t; +pub type __darwin_sigset_t = __uint32_t; +pub type __darwin_suseconds_t = __int32_t; +pub type __darwin_uid_t = __uint32_t; +pub type __darwin_useconds_t = __uint32_t; +pub type __darwin_uuid_t = [libc::c_uchar; 16usize]; +pub type __darwin_uuid_string_t = [libc::c_char; 37usize]; +#[repr(C)] +#[derive(Debug, Copy)] +pub struct __darwin_pthread_handler_rec { + pub __routine: ::core::option::Option, + pub __arg: *mut libc::c_void, + pub __next: *mut __darwin_pthread_handler_rec, +} +#[test] +fn bindgen_test_layout___darwin_pthread_handler_rec() { + assert_eq!( + ::core::mem::size_of::<__darwin_pthread_handler_rec>(), + 24usize, + concat!("Size of: ", stringify!(__darwin_pthread_handler_rec)) + ); + assert_eq!( + ::core::mem::align_of::<__darwin_pthread_handler_rec>(), + 8usize, + concat!("Alignment of ", stringify!(__darwin_pthread_handler_rec)) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_pthread_handler_rec>())).__routine as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__darwin_pthread_handler_rec), + "::", + stringify!(__routine) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_pthread_handler_rec>())).__arg as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(__darwin_pthread_handler_rec), + "::", + stringify!(__arg) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_pthread_handler_rec>())).__next as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(__darwin_pthread_handler_rec), + "::", + stringify!(__next) + ) + ); +} +impl Clone for __darwin_pthread_handler_rec { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +#[derive(Copy)] +pub struct _opaque_pthread_attr_t { + pub __sig: libc::c_long, + pub __opaque: [libc::c_char; 56usize], +} +#[test] +fn bindgen_test_layout__opaque_pthread_attr_t() { + assert_eq!( + ::core::mem::size_of::<_opaque_pthread_attr_t>(), + 64usize, + concat!("Size of: ", stringify!(_opaque_pthread_attr_t)) + ); + assert_eq!( + ::core::mem::align_of::<_opaque_pthread_attr_t>(), + 8usize, + concat!("Alignment of ", stringify!(_opaque_pthread_attr_t)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<_opaque_pthread_attr_t>())).__sig as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_opaque_pthread_attr_t), + "::", + stringify!(__sig) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<_opaque_pthread_attr_t>())).__opaque as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_opaque_pthread_attr_t), + "::", + stringify!(__opaque) + ) + ); +} +impl Clone for _opaque_pthread_attr_t { + fn clone(&self) -> Self { + *self + } +} +impl ::core::fmt::Debug for _opaque_pthread_attr_t { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + write!( + f, + "_opaque_pthread_attr_t {{ __sig: {:?}, __opaque: [...] }}", + self.__sig + ) + } +} +#[repr(C)] +#[derive(Copy)] +pub struct _opaque_pthread_cond_t { + pub __sig: libc::c_long, + pub __opaque: [libc::c_char; 40usize], +} +#[test] +fn bindgen_test_layout__opaque_pthread_cond_t() { + assert_eq!( + ::core::mem::size_of::<_opaque_pthread_cond_t>(), + 48usize, + concat!("Size of: ", stringify!(_opaque_pthread_cond_t)) + ); + assert_eq!( + ::core::mem::align_of::<_opaque_pthread_cond_t>(), + 8usize, + concat!("Alignment of ", stringify!(_opaque_pthread_cond_t)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<_opaque_pthread_cond_t>())).__sig as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_opaque_pthread_cond_t), + "::", + stringify!(__sig) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<_opaque_pthread_cond_t>())).__opaque as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_opaque_pthread_cond_t), + "::", + stringify!(__opaque) + ) + ); +} +impl Clone for _opaque_pthread_cond_t { + fn clone(&self) -> Self { + *self + } +} +impl ::core::fmt::Debug for _opaque_pthread_cond_t { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + write!( + f, + "_opaque_pthread_cond_t {{ __sig: {:?}, __opaque: [...] }}", + self.__sig + ) + } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct _opaque_pthread_condattr_t { + pub __sig: libc::c_long, + pub __opaque: [libc::c_char; 8usize], +} +#[test] +fn bindgen_test_layout__opaque_pthread_condattr_t() { + assert_eq!( + ::core::mem::size_of::<_opaque_pthread_condattr_t>(), + 16usize, + concat!("Size of: ", stringify!(_opaque_pthread_condattr_t)) + ); + assert_eq!( + ::core::mem::align_of::<_opaque_pthread_condattr_t>(), + 8usize, + concat!("Alignment of ", stringify!(_opaque_pthread_condattr_t)) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<_opaque_pthread_condattr_t>())).__sig as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_opaque_pthread_condattr_t), + "::", + stringify!(__sig) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<_opaque_pthread_condattr_t>())).__opaque as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_opaque_pthread_condattr_t), + "::", + stringify!(__opaque) + ) + ); +} +impl Clone for _opaque_pthread_condattr_t { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +#[derive(Copy)] +pub struct _opaque_pthread_mutex_t { + pub __sig: libc::c_long, + pub __opaque: [libc::c_char; 56usize], +} +#[test] +fn bindgen_test_layout__opaque_pthread_mutex_t() { + assert_eq!( + ::core::mem::size_of::<_opaque_pthread_mutex_t>(), + 64usize, + concat!("Size of: ", stringify!(_opaque_pthread_mutex_t)) + ); + assert_eq!( + ::core::mem::align_of::<_opaque_pthread_mutex_t>(), + 8usize, + concat!("Alignment of ", stringify!(_opaque_pthread_mutex_t)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<_opaque_pthread_mutex_t>())).__sig as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_opaque_pthread_mutex_t), + "::", + stringify!(__sig) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<_opaque_pthread_mutex_t>())).__opaque as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_opaque_pthread_mutex_t), + "::", + stringify!(__opaque) + ) + ); +} +impl Clone for _opaque_pthread_mutex_t { + fn clone(&self) -> Self { + *self + } +} +impl ::core::fmt::Debug for _opaque_pthread_mutex_t { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + write!( + f, + "_opaque_pthread_mutex_t {{ __sig: {:?}, __opaque: [...] }}", + self.__sig + ) + } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct _opaque_pthread_mutexattr_t { + pub __sig: libc::c_long, + pub __opaque: [libc::c_char; 8usize], +} +#[test] +fn bindgen_test_layout__opaque_pthread_mutexattr_t() { + assert_eq!( + ::core::mem::size_of::<_opaque_pthread_mutexattr_t>(), + 16usize, + concat!("Size of: ", stringify!(_opaque_pthread_mutexattr_t)) + ); + assert_eq!( + ::core::mem::align_of::<_opaque_pthread_mutexattr_t>(), + 8usize, + concat!("Alignment of ", stringify!(_opaque_pthread_mutexattr_t)) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<_opaque_pthread_mutexattr_t>())).__sig as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_opaque_pthread_mutexattr_t), + "::", + stringify!(__sig) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<_opaque_pthread_mutexattr_t>())).__opaque as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_opaque_pthread_mutexattr_t), + "::", + stringify!(__opaque) + ) + ); +} +impl Clone for _opaque_pthread_mutexattr_t { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct _opaque_pthread_once_t { + pub __sig: libc::c_long, + pub __opaque: [libc::c_char; 8usize], +} +#[test] +fn bindgen_test_layout__opaque_pthread_once_t() { + assert_eq!( + ::core::mem::size_of::<_opaque_pthread_once_t>(), + 16usize, + concat!("Size of: ", stringify!(_opaque_pthread_once_t)) + ); + assert_eq!( + ::core::mem::align_of::<_opaque_pthread_once_t>(), + 8usize, + concat!("Alignment of ", stringify!(_opaque_pthread_once_t)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<_opaque_pthread_once_t>())).__sig as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_opaque_pthread_once_t), + "::", + stringify!(__sig) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<_opaque_pthread_once_t>())).__opaque as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_opaque_pthread_once_t), + "::", + stringify!(__opaque) + ) + ); +} +impl Clone for _opaque_pthread_once_t { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +#[derive(Copy)] +pub struct _opaque_pthread_rwlock_t { + pub __sig: libc::c_long, + pub __opaque: [libc::c_char; 192usize], +} +#[test] +fn bindgen_test_layout__opaque_pthread_rwlock_t() { + assert_eq!( + ::core::mem::size_of::<_opaque_pthread_rwlock_t>(), + 200usize, + concat!("Size of: ", stringify!(_opaque_pthread_rwlock_t)) + ); + assert_eq!( + ::core::mem::align_of::<_opaque_pthread_rwlock_t>(), + 8usize, + concat!("Alignment of ", stringify!(_opaque_pthread_rwlock_t)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<_opaque_pthread_rwlock_t>())).__sig as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_opaque_pthread_rwlock_t), + "::", + stringify!(__sig) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<_opaque_pthread_rwlock_t>())).__opaque as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_opaque_pthread_rwlock_t), + "::", + stringify!(__opaque) + ) + ); +} +impl Clone for _opaque_pthread_rwlock_t { + fn clone(&self) -> Self { + *self + } +} +impl ::core::fmt::Debug for _opaque_pthread_rwlock_t { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + write!( + f, + "_opaque_pthread_rwlock_t {{ __sig: {:?}, __opaque: [...] }}", + self.__sig + ) + } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct _opaque_pthread_rwlockattr_t { + pub __sig: libc::c_long, + pub __opaque: [libc::c_char; 16usize], +} +#[test] +fn bindgen_test_layout__opaque_pthread_rwlockattr_t() { + assert_eq!( + ::core::mem::size_of::<_opaque_pthread_rwlockattr_t>(), + 24usize, + concat!("Size of: ", stringify!(_opaque_pthread_rwlockattr_t)) + ); + assert_eq!( + ::core::mem::align_of::<_opaque_pthread_rwlockattr_t>(), + 8usize, + concat!("Alignment of ", stringify!(_opaque_pthread_rwlockattr_t)) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<_opaque_pthread_rwlockattr_t>())).__sig as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_opaque_pthread_rwlockattr_t), + "::", + stringify!(__sig) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<_opaque_pthread_rwlockattr_t>())).__opaque as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_opaque_pthread_rwlockattr_t), + "::", + stringify!(__opaque) + ) + ); +} +impl Clone for _opaque_pthread_rwlockattr_t { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +#[derive(Copy)] +pub struct _opaque_pthread_t { + pub __sig: libc::c_long, + pub __cleanup_stack: *mut __darwin_pthread_handler_rec, + pub __opaque: [libc::c_char; 8176usize], +} +#[test] +fn bindgen_test_layout__opaque_pthread_t() { + assert_eq!( + ::core::mem::size_of::<_opaque_pthread_t>(), + 8192usize, + concat!("Size of: ", stringify!(_opaque_pthread_t)) + ); + assert_eq!( + ::core::mem::align_of::<_opaque_pthread_t>(), + 8usize, + concat!("Alignment of ", stringify!(_opaque_pthread_t)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<_opaque_pthread_t>())).__sig as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_opaque_pthread_t), + "::", + stringify!(__sig) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<_opaque_pthread_t>())).__cleanup_stack as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_opaque_pthread_t), + "::", + stringify!(__cleanup_stack) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<_opaque_pthread_t>())).__opaque as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(_opaque_pthread_t), + "::", + stringify!(__opaque) + ) + ); +} +impl Clone for _opaque_pthread_t { + fn clone(&self) -> Self { + *self + } +} +impl ::core::fmt::Debug for _opaque_pthread_t { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + write!( + f, + "_opaque_pthread_t {{ __sig: {:?}, __cleanup_stack: {:?}, __opaque: [...] }}", + self.__sig, self.__cleanup_stack + ) + } +} +pub type __darwin_pthread_attr_t = _opaque_pthread_attr_t; +pub type __darwin_pthread_cond_t = _opaque_pthread_cond_t; +pub type __darwin_pthread_condattr_t = _opaque_pthread_condattr_t; +pub type __darwin_pthread_key_t = libc::c_ulong; +pub type __darwin_pthread_mutex_t = _opaque_pthread_mutex_t; +pub type __darwin_pthread_mutexattr_t = _opaque_pthread_mutexattr_t; +pub type __darwin_pthread_once_t = _opaque_pthread_once_t; +pub type __darwin_pthread_rwlock_t = _opaque_pthread_rwlock_t; +pub type __darwin_pthread_rwlockattr_t = _opaque_pthread_rwlockattr_t; +pub type __darwin_pthread_t = *mut _opaque_pthread_t; +pub type u_int8_t = libc::c_uchar; +pub type u_int16_t = libc::c_ushort; +pub type u_int32_t = libc::c_uint; +pub type u_int64_t = libc::c_ulonglong; +pub type register_t = i64; +pub type user_addr_t = u_int64_t; +pub type user_size_t = u_int64_t; +pub type user_ssize_t = i64; +pub type user_long_t = i64; +pub type user_ulong_t = u_int64_t; +pub type user_time_t = i64; +pub type user_off_t = i64; +pub type syscall_arg_t = u_int64_t; +pub type intmax_t = libc::c_long; +pub type uintmax_t = libc::c_ulong; +pub type __darwin_nl_item = libc::c_int; +pub type __darwin_wctrans_t = libc::c_int; +pub type __darwin_wctype_t = __uint32_t; +pub type va_list = __darwin_va_list; +extern "C" { + pub fn renameat( + arg1: libc::c_int, + arg2: *const libc::c_char, + arg3: libc::c_int, + arg4: *const libc::c_char, + ) -> libc::c_int; +} +extern "C" { + pub fn renamex_np( + arg1: *const libc::c_char, + arg2: *const libc::c_char, + arg3: libc::c_uint, + ) -> libc::c_int; +} +extern "C" { + pub fn renameatx_np( + arg1: libc::c_int, + arg2: *const libc::c_char, + arg3: libc::c_int, + arg4: *const libc::c_char, + arg5: libc::c_uint, + ) -> libc::c_int; +} +pub type fpos_t = __darwin_off_t; +#[repr(C)] +#[derive(Debug, Copy)] +pub struct __sbuf { + pub _base: *mut libc::c_uchar, + pub _size: libc::c_int, +} +#[test] +fn bindgen_test_layout___sbuf() { + assert_eq!( + ::core::mem::size_of::<__sbuf>(), + 16usize, + concat!("Size of: ", stringify!(__sbuf)) + ); + assert_eq!( + ::core::mem::align_of::<__sbuf>(), + 8usize, + concat!("Alignment of ", stringify!(__sbuf)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__sbuf>()))._base as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__sbuf), + "::", + stringify!(_base) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__sbuf>()))._size as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(__sbuf), + "::", + stringify!(_size) + ) + ); +} +impl Clone for __sbuf { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct __sFILEX { + _unused: [u8; 0], +} +impl Clone for __sFILEX { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct __sFILE { + pub _p: *mut libc::c_uchar, + pub _r: libc::c_int, + pub _w: libc::c_int, + pub _flags: libc::c_short, + pub _file: libc::c_short, + pub _bf: __sbuf, + pub _lbfsize: libc::c_int, + pub _cookie: *mut libc::c_void, + pub _close: + ::core::option::Option libc::c_int>, + pub _read: ::core::option::Option< + unsafe extern "C" fn( + arg1: *mut libc::c_void, + arg2: *mut libc::c_char, + arg3: libc::c_int, + ) -> libc::c_int, + >, + pub _seek: ::core::option::Option< + unsafe extern "C" fn(arg1: *mut libc::c_void, arg2: fpos_t, arg3: libc::c_int) -> fpos_t, + >, + pub _write: ::core::option::Option< + unsafe extern "C" fn( + arg1: *mut libc::c_void, + arg2: *const libc::c_char, + arg3: libc::c_int, + ) -> libc::c_int, + >, + pub _ub: __sbuf, + pub _extra: *mut __sFILEX, + pub _ur: libc::c_int, + pub _ubuf: [libc::c_uchar; 3usize], + pub _nbuf: [libc::c_uchar; 1usize], + pub _lb: __sbuf, + pub _blksize: libc::c_int, + pub _offset: fpos_t, +} +#[test] +fn bindgen_test_layout___sFILE() { + assert_eq!( + ::core::mem::size_of::<__sFILE>(), + 152usize, + concat!("Size of: ", stringify!(__sFILE)) + ); + assert_eq!( + ::core::mem::align_of::<__sFILE>(), + 8usize, + concat!("Alignment of ", stringify!(__sFILE)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__sFILE>()))._p as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__sFILE), + "::", + stringify!(_p) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__sFILE>()))._r as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(__sFILE), + "::", + stringify!(_r) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__sFILE>()))._w as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(__sFILE), + "::", + stringify!(_w) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__sFILE>()))._flags as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(__sFILE), + "::", + stringify!(_flags) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__sFILE>()))._file as *const _ as usize }, + 18usize, + concat!( + "Offset of field: ", + stringify!(__sFILE), + "::", + stringify!(_file) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__sFILE>()))._bf as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(__sFILE), + "::", + stringify!(_bf) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__sFILE>()))._lbfsize as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(__sFILE), + "::", + stringify!(_lbfsize) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__sFILE>()))._cookie as *const _ as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(__sFILE), + "::", + stringify!(_cookie) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__sFILE>()))._close as *const _ as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(__sFILE), + "::", + stringify!(_close) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__sFILE>()))._read as *const _ as usize }, + 64usize, + concat!( + "Offset of field: ", + stringify!(__sFILE), + "::", + stringify!(_read) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__sFILE>()))._seek as *const _ as usize }, + 72usize, + concat!( + "Offset of field: ", + stringify!(__sFILE), + "::", + stringify!(_seek) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__sFILE>()))._write as *const _ as usize }, + 80usize, + concat!( + "Offset of field: ", + stringify!(__sFILE), + "::", + stringify!(_write) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__sFILE>()))._ub as *const _ as usize }, + 88usize, + concat!( + "Offset of field: ", + stringify!(__sFILE), + "::", + stringify!(_ub) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__sFILE>()))._extra as *const _ as usize }, + 104usize, + concat!( + "Offset of field: ", + stringify!(__sFILE), + "::", + stringify!(_extra) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__sFILE>()))._ur as *const _ as usize }, + 112usize, + concat!( + "Offset of field: ", + stringify!(__sFILE), + "::", + stringify!(_ur) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__sFILE>()))._ubuf as *const _ as usize }, + 116usize, + concat!( + "Offset of field: ", + stringify!(__sFILE), + "::", + stringify!(_ubuf) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__sFILE>()))._nbuf as *const _ as usize }, + 119usize, + concat!( + "Offset of field: ", + stringify!(__sFILE), + "::", + stringify!(_nbuf) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__sFILE>()))._lb as *const _ as usize }, + 120usize, + concat!( + "Offset of field: ", + stringify!(__sFILE), + "::", + stringify!(_lb) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__sFILE>()))._blksize as *const _ as usize }, + 136usize, + concat!( + "Offset of field: ", + stringify!(__sFILE), + "::", + stringify!(_blksize) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__sFILE>()))._offset as *const _ as usize }, + 144usize, + concat!( + "Offset of field: ", + stringify!(__sFILE), + "::", + stringify!(_offset) + ) + ); +} +impl Clone for __sFILE { + fn clone(&self) -> Self { + *self + } +} +pub type FILE = __sFILE; +extern "C" { + pub fn clearerr(arg1: *mut FILE); +} +extern "C" { + pub fn fclose(arg1: *mut FILE) -> libc::c_int; +} +extern "C" { + pub fn feof(arg1: *mut FILE) -> libc::c_int; +} +extern "C" { + pub fn ferror(arg1: *mut FILE) -> libc::c_int; +} +extern "C" { + pub fn fflush(arg1: *mut FILE) -> libc::c_int; +} +extern "C" { + pub fn fgetc(arg1: *mut FILE) -> libc::c_int; +} +extern "C" { + pub fn fgetpos(arg1: *mut FILE, arg2: *mut fpos_t) -> libc::c_int; +} +extern "C" { + pub fn fgets(arg1: *mut libc::c_char, arg2: libc::c_int, arg3: *mut FILE) -> *mut libc::c_char; +} +extern "C" { + pub fn fopen(__filename: *const libc::c_char, __mode: *const libc::c_char) -> *mut FILE; +} +extern "C" { + pub fn fprintf(arg1: *mut FILE, arg2: *const libc::c_char, ...) -> libc::c_int; +} +extern "C" { + pub fn fputc(arg1: libc::c_int, arg2: *mut FILE) -> libc::c_int; +} +extern "C" { + pub fn fputs(arg1: *const libc::c_char, arg2: *mut FILE) -> libc::c_int; +} +extern "C" { + pub fn fread( + __ptr: *mut libc::c_void, + __size: libc::c_ulong, + __nitems: libc::c_ulong, + __stream: *mut FILE, + ) -> libc::c_ulong; +} +extern "C" { + pub fn freopen( + arg1: *const libc::c_char, + arg2: *const libc::c_char, + arg3: *mut FILE, + ) -> *mut FILE; +} +extern "C" { + pub fn fscanf(arg1: *mut FILE, arg2: *const libc::c_char, ...) -> libc::c_int; +} +extern "C" { + pub fn fseek(arg1: *mut FILE, arg2: libc::c_long, arg3: libc::c_int) -> libc::c_int; +} +extern "C" { + pub fn fsetpos(arg1: *mut FILE, arg2: *const fpos_t) -> libc::c_int; +} +extern "C" { + pub fn ftell(arg1: *mut FILE) -> libc::c_long; +} +extern "C" { + pub fn fwrite( + __ptr: *const libc::c_void, + __size: libc::c_ulong, + __nitems: libc::c_ulong, + __stream: *mut FILE, + ) -> libc::c_ulong; +} +extern "C" { + pub fn getc(arg1: *mut FILE) -> libc::c_int; +} +extern "C" { + pub fn getchar() -> libc::c_int; +} +extern "C" { + pub fn gets(arg1: *mut libc::c_char) -> *mut libc::c_char; +} +extern "C" { + pub fn perror(arg1: *const libc::c_char); +} +extern "C" { + pub fn printf(arg1: *const libc::c_char, ...) -> libc::c_int; +} +extern "C" { + pub fn putc(arg1: libc::c_int, arg2: *mut FILE) -> libc::c_int; +} +extern "C" { + pub fn putchar(arg1: libc::c_int) -> libc::c_int; +} +extern "C" { + pub fn puts(arg1: *const libc::c_char) -> libc::c_int; +} +extern "C" { + pub fn remove(arg1: *const libc::c_char) -> libc::c_int; +} +extern "C" { + pub fn rename(__old: *const libc::c_char, __new: *const libc::c_char) -> libc::c_int; +} +extern "C" { + pub fn rewind(arg1: *mut FILE); +} +extern "C" { + pub fn scanf(arg1: *const libc::c_char, ...) -> libc::c_int; +} +extern "C" { + pub fn setbuf(arg1: *mut FILE, arg2: *mut libc::c_char); +} +extern "C" { + pub fn setvbuf( + arg1: *mut FILE, + arg2: *mut libc::c_char, + arg3: libc::c_int, + arg4: usize, + ) -> libc::c_int; +} +extern "C" { + pub fn sprintf(arg1: *mut libc::c_char, arg2: *const libc::c_char, ...) -> libc::c_int; +} +extern "C" { + pub fn sscanf(arg1: *const libc::c_char, arg2: *const libc::c_char, ...) -> libc::c_int; +} +extern "C" { + pub fn tmpfile() -> *mut FILE; +} +extern "C" { + pub fn tmpnam(arg1: *mut libc::c_char) -> *mut libc::c_char; +} +extern "C" { + pub fn ungetc(arg1: libc::c_int, arg2: *mut FILE) -> libc::c_int; +} +extern "C" { + pub fn vfprintf( + arg1: *mut FILE, + arg2: *const libc::c_char, + arg3: *mut __va_list_tag, + ) -> libc::c_int; +} +extern "C" { + pub fn vprintf(arg1: *const libc::c_char, arg2: *mut __va_list_tag) -> libc::c_int; +} +extern "C" { + pub fn vsprintf( + arg1: *mut libc::c_char, + arg2: *const libc::c_char, + arg3: *mut __va_list_tag, + ) -> libc::c_int; +} +extern "C" { + pub fn ctermid(arg1: *mut libc::c_char) -> *mut libc::c_char; +} +extern "C" { + pub fn fdopen(arg1: libc::c_int, arg2: *const libc::c_char) -> *mut FILE; +} +extern "C" { + pub fn fileno(arg1: *mut FILE) -> libc::c_int; +} +extern "C" { + pub fn pclose(arg1: *mut FILE) -> libc::c_int; +} +extern "C" { + pub fn popen(arg1: *const libc::c_char, arg2: *const libc::c_char) -> *mut FILE; +} +extern "C" { + pub fn __srget(arg1: *mut FILE) -> libc::c_int; +} +extern "C" { + pub fn __svfscanf( + arg1: *mut FILE, + arg2: *const libc::c_char, + arg3: *mut __va_list_tag, + ) -> libc::c_int; +} +extern "C" { + pub fn __swbuf(arg1: libc::c_int, arg2: *mut FILE) -> libc::c_int; +} +extern "C" { + pub fn flockfile(arg1: *mut FILE); +} +extern "C" { + pub fn ftrylockfile(arg1: *mut FILE) -> libc::c_int; +} +extern "C" { + pub fn funlockfile(arg1: *mut FILE); +} +extern "C" { + pub fn getc_unlocked(arg1: *mut FILE) -> libc::c_int; +} +extern "C" { + pub fn getchar_unlocked() -> libc::c_int; +} +extern "C" { + pub fn putc_unlocked(arg1: libc::c_int, arg2: *mut FILE) -> libc::c_int; +} +extern "C" { + pub fn putchar_unlocked(arg1: libc::c_int) -> libc::c_int; +} +extern "C" { + pub fn getw(arg1: *mut FILE) -> libc::c_int; +} +extern "C" { + pub fn putw(arg1: libc::c_int, arg2: *mut FILE) -> libc::c_int; +} +extern "C" { + pub fn tempnam(__dir: *const libc::c_char, __prefix: *const libc::c_char) -> *mut libc::c_char; +} +pub type off_t = __darwin_off_t; +extern "C" { + pub fn fseeko(__stream: *mut FILE, __offset: off_t, __whence: libc::c_int) -> libc::c_int; +} +extern "C" { + pub fn ftello(__stream: *mut FILE) -> off_t; +} +extern "C" { + pub fn snprintf( + __str: *mut libc::c_char, + __size: libc::c_ulong, + __format: *const libc::c_char, + ... + ) -> libc::c_int; +} +extern "C" { + pub fn vfscanf( + __stream: *mut FILE, + __format: *const libc::c_char, + arg1: *mut __va_list_tag, + ) -> libc::c_int; +} +extern "C" { + pub fn vscanf(__format: *const libc::c_char, arg1: *mut __va_list_tag) -> libc::c_int; +} +extern "C" { + pub fn vsnprintf( + __str: *mut libc::c_char, + __size: libc::c_ulong, + __format: *const libc::c_char, + arg1: *mut __va_list_tag, + ) -> libc::c_int; +} +extern "C" { + pub fn vsscanf( + __str: *const libc::c_char, + __format: *const libc::c_char, + arg1: *mut __va_list_tag, + ) -> libc::c_int; +} +extern "C" { + pub fn dprintf(arg1: libc::c_int, arg2: *const libc::c_char, ...) -> libc::c_int; +} +extern "C" { + pub fn vdprintf( + arg1: libc::c_int, + arg2: *const libc::c_char, + arg3: *mut __va_list_tag, + ) -> libc::c_int; +} +extern "C" { + pub fn getdelim( + __linep: *mut *mut libc::c_char, + __linecapp: *mut usize, + __delimiter: libc::c_int, + __stream: *mut FILE, + ) -> isize; +} +extern "C" { + pub fn getline( + __linep: *mut *mut libc::c_char, + __linecapp: *mut usize, + __stream: *mut FILE, + ) -> isize; +} +extern "C" { + pub fn fmemopen( + __buf: *mut libc::c_void, + __size: usize, + __mode: *const libc::c_char, + ) -> *mut FILE; +} +extern "C" { + pub fn open_memstream(__bufp: *mut *mut libc::c_char, __sizep: *mut usize) -> *mut FILE; +} +extern "C" { + pub fn asprintf(arg1: *mut *mut libc::c_char, arg2: *const libc::c_char, ...) -> libc::c_int; +} +extern "C" { + pub fn ctermid_r(arg1: *mut libc::c_char) -> *mut libc::c_char; +} +extern "C" { + pub fn fgetln(arg1: *mut FILE, arg2: *mut usize) -> *mut libc::c_char; +} +extern "C" { + pub fn fmtcheck(arg1: *const libc::c_char, arg2: *const libc::c_char) -> *const libc::c_char; +} +extern "C" { + pub fn fpurge(arg1: *mut FILE) -> libc::c_int; +} +extern "C" { + pub fn setbuffer(arg1: *mut FILE, arg2: *mut libc::c_char, arg3: libc::c_int); +} +extern "C" { + pub fn setlinebuf(arg1: *mut FILE) -> libc::c_int; +} +extern "C" { + pub fn vasprintf( + arg1: *mut *mut libc::c_char, + arg2: *const libc::c_char, + arg3: *mut __va_list_tag, + ) -> libc::c_int; +} +extern "C" { + pub fn zopen( + arg1: *const libc::c_char, + arg2: *const libc::c_char, + arg3: libc::c_int, + ) -> *mut FILE; +} +extern "C" { + pub fn funopen( + arg1: *const libc::c_void, + arg2: ::core::option::Option< + unsafe extern "C" fn( + arg1: *mut libc::c_void, + arg2: *mut libc::c_char, + arg3: libc::c_int, + ) -> libc::c_int, + >, + arg3: ::core::option::Option< + unsafe extern "C" fn( + arg1: *mut libc::c_void, + arg2: *const libc::c_char, + arg3: libc::c_int, + ) -> libc::c_int, + >, + arg4: ::core::option::Option< + unsafe extern "C" fn( + arg1: *mut libc::c_void, + arg2: fpos_t, + arg3: libc::c_int, + ) -> fpos_t, + >, + arg5: ::core::option::Option libc::c_int>, + ) -> *mut FILE; +} +extern "C" { + pub fn __sprintf_chk( + arg1: *mut libc::c_char, + arg2: libc::c_int, + arg3: usize, + arg4: *const libc::c_char, + ... + ) -> libc::c_int; +} +extern "C" { + pub fn __snprintf_chk( + arg1: *mut libc::c_char, + arg2: usize, + arg3: libc::c_int, + arg4: usize, + arg5: *const libc::c_char, + ... + ) -> libc::c_int; +} +extern "C" { + pub fn __vsprintf_chk( + arg1: *mut libc::c_char, + arg2: libc::c_int, + arg3: usize, + arg4: *const libc::c_char, + arg5: *mut __va_list_tag, + ) -> libc::c_int; +} +extern "C" { + pub fn __vsnprintf_chk( + arg1: *mut libc::c_char, + arg2: usize, + arg3: libc::c_int, + arg4: usize, + arg5: *const libc::c_char, + arg6: *mut __va_list_tag, + ) -> libc::c_int; +} +#[repr(u32)] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub enum idtype_t { + P_ALL = 0, + P_PID = 1, + P_PGID = 2, +} +pub type pid_t = __darwin_pid_t; +pub type id_t = __darwin_id_t; +pub type sig_atomic_t = libc::c_int; +#[repr(C)] +#[derive(Debug, Copy)] +pub struct __darwin_i386_thread_state { + pub __eax: libc::c_uint, + pub __ebx: libc::c_uint, + pub __ecx: libc::c_uint, + pub __edx: libc::c_uint, + pub __edi: libc::c_uint, + pub __esi: libc::c_uint, + pub __ebp: libc::c_uint, + pub __esp: libc::c_uint, + pub __ss: libc::c_uint, + pub __eflags: libc::c_uint, + pub __eip: libc::c_uint, + pub __cs: libc::c_uint, + pub __ds: libc::c_uint, + pub __es: libc::c_uint, + pub __fs: libc::c_uint, + pub __gs: libc::c_uint, +} +#[test] +fn bindgen_test_layout___darwin_i386_thread_state() { + assert_eq!( + ::core::mem::size_of::<__darwin_i386_thread_state>(), + 64usize, + concat!("Size of: ", stringify!(__darwin_i386_thread_state)) + ); + assert_eq!( + ::core::mem::align_of::<__darwin_i386_thread_state>(), + 4usize, + concat!("Alignment of ", stringify!(__darwin_i386_thread_state)) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_thread_state>())).__eax as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_thread_state), + "::", + stringify!(__eax) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_thread_state>())).__ebx as *const _ as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_thread_state), + "::", + stringify!(__ebx) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_thread_state>())).__ecx as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_thread_state), + "::", + stringify!(__ecx) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_thread_state>())).__edx as *const _ as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_thread_state), + "::", + stringify!(__edx) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_thread_state>())).__edi as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_thread_state), + "::", + stringify!(__edi) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_thread_state>())).__esi as *const _ as usize + }, + 20usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_thread_state), + "::", + stringify!(__esi) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_thread_state>())).__ebp as *const _ as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_thread_state), + "::", + stringify!(__ebp) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_thread_state>())).__esp as *const _ as usize + }, + 28usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_thread_state), + "::", + stringify!(__esp) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_thread_state>())).__ss as *const _ as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_thread_state), + "::", + stringify!(__ss) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_thread_state>())).__eflags as *const _ as usize + }, + 36usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_thread_state), + "::", + stringify!(__eflags) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_thread_state>())).__eip as *const _ as usize + }, + 40usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_thread_state), + "::", + stringify!(__eip) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_thread_state>())).__cs as *const _ as usize + }, + 44usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_thread_state), + "::", + stringify!(__cs) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_thread_state>())).__ds as *const _ as usize + }, + 48usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_thread_state), + "::", + stringify!(__ds) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_thread_state>())).__es as *const _ as usize + }, + 52usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_thread_state), + "::", + stringify!(__es) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_thread_state>())).__fs as *const _ as usize + }, + 56usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_thread_state), + "::", + stringify!(__fs) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_thread_state>())).__gs as *const _ as usize + }, + 60usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_thread_state), + "::", + stringify!(__gs) + ) + ); +} +impl Clone for __darwin_i386_thread_state { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct __darwin_fp_control { + pub _bitfield_1: __BindgenBitfieldUnit<[u8; 2usize], u8>, + pub __bindgen_align: [u16; 0usize], +} +#[test] +fn bindgen_test_layout___darwin_fp_control() { + assert_eq!( + ::core::mem::size_of::<__darwin_fp_control>(), + 2usize, + concat!("Size of: ", stringify!(__darwin_fp_control)) + ); + assert_eq!( + ::core::mem::align_of::<__darwin_fp_control>(), + 2usize, + concat!("Alignment of ", stringify!(__darwin_fp_control)) + ); +} +impl Clone for __darwin_fp_control { + fn clone(&self) -> Self { + *self + } +} +impl __darwin_fp_control { + #[inline] + pub fn __invalid(&self) -> libc::c_ushort { + unsafe { ::core::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u16) } + } + #[inline] + pub fn set___invalid(&mut self, val: libc::c_ushort) { + unsafe { + let val: u16 = ::core::mem::transmute(val); + self._bitfield_1.set(0usize, 1u8, val as u64) + } + } + #[inline] + pub fn __denorm(&self) -> libc::c_ushort { + unsafe { ::core::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u16) } + } + #[inline] + pub fn set___denorm(&mut self, val: libc::c_ushort) { + unsafe { + let val: u16 = ::core::mem::transmute(val); + self._bitfield_1.set(1usize, 1u8, val as u64) + } + } + #[inline] + pub fn __zdiv(&self) -> libc::c_ushort { + unsafe { ::core::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u16) } + } + #[inline] + pub fn set___zdiv(&mut self, val: libc::c_ushort) { + unsafe { + let val: u16 = ::core::mem::transmute(val); + self._bitfield_1.set(2usize, 1u8, val as u64) + } + } + #[inline] + pub fn __ovrfl(&self) -> libc::c_ushort { + unsafe { ::core::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u16) } + } + #[inline] + pub fn set___ovrfl(&mut self, val: libc::c_ushort) { + unsafe { + let val: u16 = ::core::mem::transmute(val); + self._bitfield_1.set(3usize, 1u8, val as u64) + } + } + #[inline] + pub fn __undfl(&self) -> libc::c_ushort { + unsafe { ::core::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u16) } + } + #[inline] + pub fn set___undfl(&mut self, val: libc::c_ushort) { + unsafe { + let val: u16 = ::core::mem::transmute(val); + self._bitfield_1.set(4usize, 1u8, val as u64) + } + } + #[inline] + pub fn __precis(&self) -> libc::c_ushort { + unsafe { ::core::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u16) } + } + #[inline] + pub fn set___precis(&mut self, val: libc::c_ushort) { + unsafe { + let val: u16 = ::core::mem::transmute(val); + self._bitfield_1.set(5usize, 1u8, val as u64) + } + } + #[inline] + pub fn __pc(&self) -> libc::c_ushort { + unsafe { ::core::mem::transmute(self._bitfield_1.get(8usize, 2u8) as u16) } + } + #[inline] + pub fn set___pc(&mut self, val: libc::c_ushort) { + unsafe { + let val: u16 = ::core::mem::transmute(val); + self._bitfield_1.set(8usize, 2u8, val as u64) + } + } + #[inline] + pub fn __rc(&self) -> libc::c_ushort { + unsafe { ::core::mem::transmute(self._bitfield_1.get(10usize, 2u8) as u16) } + } + #[inline] + pub fn set___rc(&mut self, val: libc::c_ushort) { + unsafe { + let val: u16 = ::core::mem::transmute(val); + self._bitfield_1.set(10usize, 2u8, val as u64) + } + } + #[inline] + pub fn new_bitfield_1( + __invalid: libc::c_ushort, + __denorm: libc::c_ushort, + __zdiv: libc::c_ushort, + __ovrfl: libc::c_ushort, + __undfl: libc::c_ushort, + __precis: libc::c_ushort, + __pc: libc::c_ushort, + __rc: libc::c_ushort, + ) -> __BindgenBitfieldUnit<[u8; 2usize], u8> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 2usize], u8> = + Default::default(); + __bindgen_bitfield_unit.set(0usize, 1u8, { + let __invalid: u16 = unsafe { ::core::mem::transmute(__invalid) }; + __invalid as u64 + }); + __bindgen_bitfield_unit.set(1usize, 1u8, { + let __denorm: u16 = unsafe { ::core::mem::transmute(__denorm) }; + __denorm as u64 + }); + __bindgen_bitfield_unit.set(2usize, 1u8, { + let __zdiv: u16 = unsafe { ::core::mem::transmute(__zdiv) }; + __zdiv as u64 + }); + __bindgen_bitfield_unit.set(3usize, 1u8, { + let __ovrfl: u16 = unsafe { ::core::mem::transmute(__ovrfl) }; + __ovrfl as u64 + }); + __bindgen_bitfield_unit.set(4usize, 1u8, { + let __undfl: u16 = unsafe { ::core::mem::transmute(__undfl) }; + __undfl as u64 + }); + __bindgen_bitfield_unit.set(5usize, 1u8, { + let __precis: u16 = unsafe { ::core::mem::transmute(__precis) }; + __precis as u64 + }); + __bindgen_bitfield_unit.set(8usize, 2u8, { + let __pc: u16 = unsafe { ::core::mem::transmute(__pc) }; + __pc as u64 + }); + __bindgen_bitfield_unit.set(10usize, 2u8, { + let __rc: u16 = unsafe { ::core::mem::transmute(__rc) }; + __rc as u64 + }); + __bindgen_bitfield_unit + } +} +pub type __darwin_fp_control_t = __darwin_fp_control; +#[repr(C)] +#[derive(Debug, Copy)] +pub struct __darwin_fp_status { + pub _bitfield_1: __BindgenBitfieldUnit<[u8; 2usize], u8>, + pub __bindgen_align: [u16; 0usize], +} +#[test] +fn bindgen_test_layout___darwin_fp_status() { + assert_eq!( + ::core::mem::size_of::<__darwin_fp_status>(), + 2usize, + concat!("Size of: ", stringify!(__darwin_fp_status)) + ); + assert_eq!( + ::core::mem::align_of::<__darwin_fp_status>(), + 2usize, + concat!("Alignment of ", stringify!(__darwin_fp_status)) + ); +} +impl Clone for __darwin_fp_status { + fn clone(&self) -> Self { + *self + } +} +impl __darwin_fp_status { + #[inline] + pub fn __invalid(&self) -> libc::c_ushort { + unsafe { ::core::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u16) } + } + #[inline] + pub fn set___invalid(&mut self, val: libc::c_ushort) { + unsafe { + let val: u16 = ::core::mem::transmute(val); + self._bitfield_1.set(0usize, 1u8, val as u64) + } + } + #[inline] + pub fn __denorm(&self) -> libc::c_ushort { + unsafe { ::core::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u16) } + } + #[inline] + pub fn set___denorm(&mut self, val: libc::c_ushort) { + unsafe { + let val: u16 = ::core::mem::transmute(val); + self._bitfield_1.set(1usize, 1u8, val as u64) + } + } + #[inline] + pub fn __zdiv(&self) -> libc::c_ushort { + unsafe { ::core::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u16) } + } + #[inline] + pub fn set___zdiv(&mut self, val: libc::c_ushort) { + unsafe { + let val: u16 = ::core::mem::transmute(val); + self._bitfield_1.set(2usize, 1u8, val as u64) + } + } + #[inline] + pub fn __ovrfl(&self) -> libc::c_ushort { + unsafe { ::core::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u16) } + } + #[inline] + pub fn set___ovrfl(&mut self, val: libc::c_ushort) { + unsafe { + let val: u16 = ::core::mem::transmute(val); + self._bitfield_1.set(3usize, 1u8, val as u64) + } + } + #[inline] + pub fn __undfl(&self) -> libc::c_ushort { + unsafe { ::core::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u16) } + } + #[inline] + pub fn set___undfl(&mut self, val: libc::c_ushort) { + unsafe { + let val: u16 = ::core::mem::transmute(val); + self._bitfield_1.set(4usize, 1u8, val as u64) + } + } + #[inline] + pub fn __precis(&self) -> libc::c_ushort { + unsafe { ::core::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u16) } + } + #[inline] + pub fn set___precis(&mut self, val: libc::c_ushort) { + unsafe { + let val: u16 = ::core::mem::transmute(val); + self._bitfield_1.set(5usize, 1u8, val as u64) + } + } + #[inline] + pub fn __stkflt(&self) -> libc::c_ushort { + unsafe { ::core::mem::transmute(self._bitfield_1.get(6usize, 1u8) as u16) } + } + #[inline] + pub fn set___stkflt(&mut self, val: libc::c_ushort) { + unsafe { + let val: u16 = ::core::mem::transmute(val); + self._bitfield_1.set(6usize, 1u8, val as u64) + } + } + #[inline] + pub fn __errsumm(&self) -> libc::c_ushort { + unsafe { ::core::mem::transmute(self._bitfield_1.get(7usize, 1u8) as u16) } + } + #[inline] + pub fn set___errsumm(&mut self, val: libc::c_ushort) { + unsafe { + let val: u16 = ::core::mem::transmute(val); + self._bitfield_1.set(7usize, 1u8, val as u64) + } + } + #[inline] + pub fn __c0(&self) -> libc::c_ushort { + unsafe { ::core::mem::transmute(self._bitfield_1.get(8usize, 1u8) as u16) } + } + #[inline] + pub fn set___c0(&mut self, val: libc::c_ushort) { + unsafe { + let val: u16 = ::core::mem::transmute(val); + self._bitfield_1.set(8usize, 1u8, val as u64) + } + } + #[inline] + pub fn __c1(&self) -> libc::c_ushort { + unsafe { ::core::mem::transmute(self._bitfield_1.get(9usize, 1u8) as u16) } + } + #[inline] + pub fn set___c1(&mut self, val: libc::c_ushort) { + unsafe { + let val: u16 = ::core::mem::transmute(val); + self._bitfield_1.set(9usize, 1u8, val as u64) + } + } + #[inline] + pub fn __c2(&self) -> libc::c_ushort { + unsafe { ::core::mem::transmute(self._bitfield_1.get(10usize, 1u8) as u16) } + } + #[inline] + pub fn set___c2(&mut self, val: libc::c_ushort) { + unsafe { + let val: u16 = ::core::mem::transmute(val); + self._bitfield_1.set(10usize, 1u8, val as u64) + } + } + #[inline] + pub fn __tos(&self) -> libc::c_ushort { + unsafe { ::core::mem::transmute(self._bitfield_1.get(11usize, 3u8) as u16) } + } + #[inline] + pub fn set___tos(&mut self, val: libc::c_ushort) { + unsafe { + let val: u16 = ::core::mem::transmute(val); + self._bitfield_1.set(11usize, 3u8, val as u64) + } + } + #[inline] + pub fn __c3(&self) -> libc::c_ushort { + unsafe { ::core::mem::transmute(self._bitfield_1.get(14usize, 1u8) as u16) } + } + #[inline] + pub fn set___c3(&mut self, val: libc::c_ushort) { + unsafe { + let val: u16 = ::core::mem::transmute(val); + self._bitfield_1.set(14usize, 1u8, val as u64) + } + } + #[inline] + pub fn __busy(&self) -> libc::c_ushort { + unsafe { ::core::mem::transmute(self._bitfield_1.get(15usize, 1u8) as u16) } + } + #[inline] + pub fn set___busy(&mut self, val: libc::c_ushort) { + unsafe { + let val: u16 = ::core::mem::transmute(val); + self._bitfield_1.set(15usize, 1u8, val as u64) + } + } + #[inline] + pub fn new_bitfield_1( + __invalid: libc::c_ushort, + __denorm: libc::c_ushort, + __zdiv: libc::c_ushort, + __ovrfl: libc::c_ushort, + __undfl: libc::c_ushort, + __precis: libc::c_ushort, + __stkflt: libc::c_ushort, + __errsumm: libc::c_ushort, + __c0: libc::c_ushort, + __c1: libc::c_ushort, + __c2: libc::c_ushort, + __tos: libc::c_ushort, + __c3: libc::c_ushort, + __busy: libc::c_ushort, + ) -> __BindgenBitfieldUnit<[u8; 2usize], u8> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 2usize], u8> = + Default::default(); + __bindgen_bitfield_unit.set(0usize, 1u8, { + let __invalid: u16 = unsafe { ::core::mem::transmute(__invalid) }; + __invalid as u64 + }); + __bindgen_bitfield_unit.set(1usize, 1u8, { + let __denorm: u16 = unsafe { ::core::mem::transmute(__denorm) }; + __denorm as u64 + }); + __bindgen_bitfield_unit.set(2usize, 1u8, { + let __zdiv: u16 = unsafe { ::core::mem::transmute(__zdiv) }; + __zdiv as u64 + }); + __bindgen_bitfield_unit.set(3usize, 1u8, { + let __ovrfl: u16 = unsafe { ::core::mem::transmute(__ovrfl) }; + __ovrfl as u64 + }); + __bindgen_bitfield_unit.set(4usize, 1u8, { + let __undfl: u16 = unsafe { ::core::mem::transmute(__undfl) }; + __undfl as u64 + }); + __bindgen_bitfield_unit.set(5usize, 1u8, { + let __precis: u16 = unsafe { ::core::mem::transmute(__precis) }; + __precis as u64 + }); + __bindgen_bitfield_unit.set(6usize, 1u8, { + let __stkflt: u16 = unsafe { ::core::mem::transmute(__stkflt) }; + __stkflt as u64 + }); + __bindgen_bitfield_unit.set(7usize, 1u8, { + let __errsumm: u16 = unsafe { ::core::mem::transmute(__errsumm) }; + __errsumm as u64 + }); + __bindgen_bitfield_unit.set(8usize, 1u8, { + let __c0: u16 = unsafe { ::core::mem::transmute(__c0) }; + __c0 as u64 + }); + __bindgen_bitfield_unit.set(9usize, 1u8, { + let __c1: u16 = unsafe { ::core::mem::transmute(__c1) }; + __c1 as u64 + }); + __bindgen_bitfield_unit.set(10usize, 1u8, { + let __c2: u16 = unsafe { ::core::mem::transmute(__c2) }; + __c2 as u64 + }); + __bindgen_bitfield_unit.set(11usize, 3u8, { + let __tos: u16 = unsafe { ::core::mem::transmute(__tos) }; + __tos as u64 + }); + __bindgen_bitfield_unit.set(14usize, 1u8, { + let __c3: u16 = unsafe { ::core::mem::transmute(__c3) }; + __c3 as u64 + }); + __bindgen_bitfield_unit.set(15usize, 1u8, { + let __busy: u16 = unsafe { ::core::mem::transmute(__busy) }; + __busy as u64 + }); + __bindgen_bitfield_unit + } +} +pub type __darwin_fp_status_t = __darwin_fp_status; +#[repr(C)] +#[derive(Debug, Copy)] +pub struct __darwin_mmst_reg { + pub __mmst_reg: [libc::c_char; 10usize], + pub __mmst_rsrv: [libc::c_char; 6usize], +} +#[test] +fn bindgen_test_layout___darwin_mmst_reg() { + assert_eq!( + ::core::mem::size_of::<__darwin_mmst_reg>(), + 16usize, + concat!("Size of: ", stringify!(__darwin_mmst_reg)) + ); + assert_eq!( + ::core::mem::align_of::<__darwin_mmst_reg>(), + 1usize, + concat!("Alignment of ", stringify!(__darwin_mmst_reg)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__darwin_mmst_reg>())).__mmst_reg as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__darwin_mmst_reg), + "::", + stringify!(__mmst_reg) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__darwin_mmst_reg>())).__mmst_rsrv as *const _ as usize }, + 10usize, + concat!( + "Offset of field: ", + stringify!(__darwin_mmst_reg), + "::", + stringify!(__mmst_rsrv) + ) + ); +} +impl Clone for __darwin_mmst_reg { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct __darwin_xmm_reg { + pub __xmm_reg: [libc::c_char; 16usize], +} +#[test] +fn bindgen_test_layout___darwin_xmm_reg() { + assert_eq!( + ::core::mem::size_of::<__darwin_xmm_reg>(), + 16usize, + concat!("Size of: ", stringify!(__darwin_xmm_reg)) + ); + assert_eq!( + ::core::mem::align_of::<__darwin_xmm_reg>(), + 1usize, + concat!("Alignment of ", stringify!(__darwin_xmm_reg)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__darwin_xmm_reg>())).__xmm_reg as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__darwin_xmm_reg), + "::", + stringify!(__xmm_reg) + ) + ); +} +impl Clone for __darwin_xmm_reg { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct __darwin_ymm_reg { + pub __ymm_reg: [libc::c_char; 32usize], +} +#[test] +fn bindgen_test_layout___darwin_ymm_reg() { + assert_eq!( + ::core::mem::size_of::<__darwin_ymm_reg>(), + 32usize, + concat!("Size of: ", stringify!(__darwin_ymm_reg)) + ); + assert_eq!( + ::core::mem::align_of::<__darwin_ymm_reg>(), + 1usize, + concat!("Alignment of ", stringify!(__darwin_ymm_reg)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__darwin_ymm_reg>())).__ymm_reg as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__darwin_ymm_reg), + "::", + stringify!(__ymm_reg) + ) + ); +} +impl Clone for __darwin_ymm_reg { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +#[derive(Copy)] +pub struct __darwin_zmm_reg { + pub __zmm_reg: [libc::c_char; 64usize], +} +#[test] +fn bindgen_test_layout___darwin_zmm_reg() { + assert_eq!( + ::core::mem::size_of::<__darwin_zmm_reg>(), + 64usize, + concat!("Size of: ", stringify!(__darwin_zmm_reg)) + ); + assert_eq!( + ::core::mem::align_of::<__darwin_zmm_reg>(), + 1usize, + concat!("Alignment of ", stringify!(__darwin_zmm_reg)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__darwin_zmm_reg>())).__zmm_reg as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__darwin_zmm_reg), + "::", + stringify!(__zmm_reg) + ) + ); +} +impl Clone for __darwin_zmm_reg { + fn clone(&self) -> Self { + *self + } +} +impl ::core::fmt::Debug for __darwin_zmm_reg { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + write!(f, "__darwin_zmm_reg {{ __zmm_reg: [...] }}") + } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct __darwin_opmask_reg { + pub __opmask_reg: [libc::c_char; 8usize], +} +#[test] +fn bindgen_test_layout___darwin_opmask_reg() { + assert_eq!( + ::core::mem::size_of::<__darwin_opmask_reg>(), + 8usize, + concat!("Size of: ", stringify!(__darwin_opmask_reg)) + ); + assert_eq!( + ::core::mem::align_of::<__darwin_opmask_reg>(), + 1usize, + concat!("Alignment of ", stringify!(__darwin_opmask_reg)) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_opmask_reg>())).__opmask_reg as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__darwin_opmask_reg), + "::", + stringify!(__opmask_reg) + ) + ); +} +impl Clone for __darwin_opmask_reg { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +#[derive(Copy)] +pub struct __darwin_i386_float_state { + pub __fpu_reserved: [libc::c_int; 2usize], + pub __fpu_fcw: __darwin_fp_control, + pub __fpu_fsw: __darwin_fp_status, + pub __fpu_ftw: __uint8_t, + pub __fpu_rsrv1: __uint8_t, + pub __fpu_fop: __uint16_t, + pub __fpu_ip: __uint32_t, + pub __fpu_cs: __uint16_t, + pub __fpu_rsrv2: __uint16_t, + pub __fpu_dp: __uint32_t, + pub __fpu_ds: __uint16_t, + pub __fpu_rsrv3: __uint16_t, + pub __fpu_mxcsr: __uint32_t, + pub __fpu_mxcsrmask: __uint32_t, + pub __fpu_stmm0: __darwin_mmst_reg, + pub __fpu_stmm1: __darwin_mmst_reg, + pub __fpu_stmm2: __darwin_mmst_reg, + pub __fpu_stmm3: __darwin_mmst_reg, + pub __fpu_stmm4: __darwin_mmst_reg, + pub __fpu_stmm5: __darwin_mmst_reg, + pub __fpu_stmm6: __darwin_mmst_reg, + pub __fpu_stmm7: __darwin_mmst_reg, + pub __fpu_xmm0: __darwin_xmm_reg, + pub __fpu_xmm1: __darwin_xmm_reg, + pub __fpu_xmm2: __darwin_xmm_reg, + pub __fpu_xmm3: __darwin_xmm_reg, + pub __fpu_xmm4: __darwin_xmm_reg, + pub __fpu_xmm5: __darwin_xmm_reg, + pub __fpu_xmm6: __darwin_xmm_reg, + pub __fpu_xmm7: __darwin_xmm_reg, + pub __fpu_rsrv4: [libc::c_char; 224usize], + pub __fpu_reserved1: libc::c_int, +} +#[test] +fn bindgen_test_layout___darwin_i386_float_state() { + assert_eq!( + ::core::mem::size_of::<__darwin_i386_float_state>(), + 524usize, + concat!("Size of: ", stringify!(__darwin_i386_float_state)) + ); + assert_eq!( + ::core::mem::align_of::<__darwin_i386_float_state>(), + 4usize, + concat!("Alignment of ", stringify!(__darwin_i386_float_state)) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_float_state>())).__fpu_reserved as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_float_state), + "::", + stringify!(__fpu_reserved) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_float_state>())).__fpu_fcw as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_float_state), + "::", + stringify!(__fpu_fcw) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_float_state>())).__fpu_fsw as *const _ as usize + }, + 10usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_float_state), + "::", + stringify!(__fpu_fsw) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_float_state>())).__fpu_ftw as *const _ as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_float_state), + "::", + stringify!(__fpu_ftw) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_float_state>())).__fpu_rsrv1 as *const _ as usize + }, + 13usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_float_state), + "::", + stringify!(__fpu_rsrv1) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_float_state>())).__fpu_fop as *const _ as usize + }, + 14usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_float_state), + "::", + stringify!(__fpu_fop) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_float_state>())).__fpu_ip as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_float_state), + "::", + stringify!(__fpu_ip) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_float_state>())).__fpu_cs as *const _ as usize + }, + 20usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_float_state), + "::", + stringify!(__fpu_cs) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_float_state>())).__fpu_rsrv2 as *const _ as usize + }, + 22usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_float_state), + "::", + stringify!(__fpu_rsrv2) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_float_state>())).__fpu_dp as *const _ as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_float_state), + "::", + stringify!(__fpu_dp) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_float_state>())).__fpu_ds as *const _ as usize + }, + 28usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_float_state), + "::", + stringify!(__fpu_ds) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_float_state>())).__fpu_rsrv3 as *const _ as usize + }, + 30usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_float_state), + "::", + stringify!(__fpu_rsrv3) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_float_state>())).__fpu_mxcsr as *const _ as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_float_state), + "::", + stringify!(__fpu_mxcsr) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_float_state>())).__fpu_mxcsrmask as *const _ + as usize + }, + 36usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_float_state), + "::", + stringify!(__fpu_mxcsrmask) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_float_state>())).__fpu_stmm0 as *const _ as usize + }, + 40usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_float_state), + "::", + stringify!(__fpu_stmm0) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_float_state>())).__fpu_stmm1 as *const _ as usize + }, + 56usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_float_state), + "::", + stringify!(__fpu_stmm1) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_float_state>())).__fpu_stmm2 as *const _ as usize + }, + 72usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_float_state), + "::", + stringify!(__fpu_stmm2) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_float_state>())).__fpu_stmm3 as *const _ as usize + }, + 88usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_float_state), + "::", + stringify!(__fpu_stmm3) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_float_state>())).__fpu_stmm4 as *const _ as usize + }, + 104usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_float_state), + "::", + stringify!(__fpu_stmm4) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_float_state>())).__fpu_stmm5 as *const _ as usize + }, + 120usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_float_state), + "::", + stringify!(__fpu_stmm5) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_float_state>())).__fpu_stmm6 as *const _ as usize + }, + 136usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_float_state), + "::", + stringify!(__fpu_stmm6) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_float_state>())).__fpu_stmm7 as *const _ as usize + }, + 152usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_float_state), + "::", + stringify!(__fpu_stmm7) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_float_state>())).__fpu_xmm0 as *const _ as usize + }, + 168usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_float_state), + "::", + stringify!(__fpu_xmm0) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_float_state>())).__fpu_xmm1 as *const _ as usize + }, + 184usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_float_state), + "::", + stringify!(__fpu_xmm1) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_float_state>())).__fpu_xmm2 as *const _ as usize + }, + 200usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_float_state), + "::", + stringify!(__fpu_xmm2) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_float_state>())).__fpu_xmm3 as *const _ as usize + }, + 216usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_float_state), + "::", + stringify!(__fpu_xmm3) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_float_state>())).__fpu_xmm4 as *const _ as usize + }, + 232usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_float_state), + "::", + stringify!(__fpu_xmm4) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_float_state>())).__fpu_xmm5 as *const _ as usize + }, + 248usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_float_state), + "::", + stringify!(__fpu_xmm5) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_float_state>())).__fpu_xmm6 as *const _ as usize + }, + 264usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_float_state), + "::", + stringify!(__fpu_xmm6) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_float_state>())).__fpu_xmm7 as *const _ as usize + }, + 280usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_float_state), + "::", + stringify!(__fpu_xmm7) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_float_state>())).__fpu_rsrv4 as *const _ as usize + }, + 296usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_float_state), + "::", + stringify!(__fpu_rsrv4) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_float_state>())).__fpu_reserved1 as *const _ + as usize + }, + 520usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_float_state), + "::", + stringify!(__fpu_reserved1) + ) + ); +} +impl Clone for __darwin_i386_float_state { + fn clone(&self) -> Self { + *self + } +} +impl ::core::fmt::Debug for __darwin_i386_float_state { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + write ! ( f , "__darwin_i386_float_state {{ __fpu_reserved: {:?}, __fpu_fcw: {:?}, __fpu_fsw: {:?}, __fpu_ftw: {:?}, __fpu_rsrv1: {:?}, __fpu_fop: {:?}, __fpu_ip: {:?}, __fpu_cs: {:?}, __fpu_rsrv2: {:?}, __fpu_dp: {:?}, __fpu_ds: {:?}, __fpu_rsrv3: {:?}, __fpu_mxcsr: {:?}, __fpu_mxcsrmask: {:?}, __fpu_stmm0: {:?}, __fpu_stmm1: {:?}, __fpu_stmm2: {:?}, __fpu_stmm3: {:?}, __fpu_stmm4: {:?}, __fpu_stmm5: {:?}, __fpu_stmm6: {:?}, __fpu_stmm7: {:?}, __fpu_xmm0: {:?}, __fpu_xmm1: {:?}, __fpu_xmm2: {:?}, __fpu_xmm3: {:?}, __fpu_xmm4: {:?}, __fpu_xmm5: {:?}, __fpu_xmm6: {:?}, __fpu_xmm7: {:?}, __fpu_rsrv4: [...], __fpu_reserved1: {:?} }}" , self . __fpu_reserved , self . __fpu_fcw , self . __fpu_fsw , self . __fpu_ftw , self . __fpu_rsrv1 , self . __fpu_fop , self . __fpu_ip , self . __fpu_cs , self . __fpu_rsrv2 , self . __fpu_dp , self . __fpu_ds , self . __fpu_rsrv3 , self . __fpu_mxcsr , self . __fpu_mxcsrmask , self . __fpu_stmm0 , self . __fpu_stmm1 , self . __fpu_stmm2 , self . __fpu_stmm3 , self . __fpu_stmm4 , self . __fpu_stmm5 , self . __fpu_stmm6 , self . __fpu_stmm7 , self . __fpu_xmm0 , self . __fpu_xmm1 , self . __fpu_xmm2 , self . __fpu_xmm3 , self . __fpu_xmm4 , self . __fpu_xmm5 , self . __fpu_xmm6 , self . __fpu_xmm7 , self . __fpu_reserved1 ) + } +} +#[repr(C)] +#[derive(Copy)] +pub struct __darwin_i386_avx_state { + pub __fpu_reserved: [libc::c_int; 2usize], + pub __fpu_fcw: __darwin_fp_control, + pub __fpu_fsw: __darwin_fp_status, + pub __fpu_ftw: __uint8_t, + pub __fpu_rsrv1: __uint8_t, + pub __fpu_fop: __uint16_t, + pub __fpu_ip: __uint32_t, + pub __fpu_cs: __uint16_t, + pub __fpu_rsrv2: __uint16_t, + pub __fpu_dp: __uint32_t, + pub __fpu_ds: __uint16_t, + pub __fpu_rsrv3: __uint16_t, + pub __fpu_mxcsr: __uint32_t, + pub __fpu_mxcsrmask: __uint32_t, + pub __fpu_stmm0: __darwin_mmst_reg, + pub __fpu_stmm1: __darwin_mmst_reg, + pub __fpu_stmm2: __darwin_mmst_reg, + pub __fpu_stmm3: __darwin_mmst_reg, + pub __fpu_stmm4: __darwin_mmst_reg, + pub __fpu_stmm5: __darwin_mmst_reg, + pub __fpu_stmm6: __darwin_mmst_reg, + pub __fpu_stmm7: __darwin_mmst_reg, + pub __fpu_xmm0: __darwin_xmm_reg, + pub __fpu_xmm1: __darwin_xmm_reg, + pub __fpu_xmm2: __darwin_xmm_reg, + pub __fpu_xmm3: __darwin_xmm_reg, + pub __fpu_xmm4: __darwin_xmm_reg, + pub __fpu_xmm5: __darwin_xmm_reg, + pub __fpu_xmm6: __darwin_xmm_reg, + pub __fpu_xmm7: __darwin_xmm_reg, + pub __fpu_rsrv4: [libc::c_char; 224usize], + pub __fpu_reserved1: libc::c_int, + pub __avx_reserved1: [libc::c_char; 64usize], + pub __fpu_ymmh0: __darwin_xmm_reg, + pub __fpu_ymmh1: __darwin_xmm_reg, + pub __fpu_ymmh2: __darwin_xmm_reg, + pub __fpu_ymmh3: __darwin_xmm_reg, + pub __fpu_ymmh4: __darwin_xmm_reg, + pub __fpu_ymmh5: __darwin_xmm_reg, + pub __fpu_ymmh6: __darwin_xmm_reg, + pub __fpu_ymmh7: __darwin_xmm_reg, +} +#[test] +fn bindgen_test_layout___darwin_i386_avx_state() { + assert_eq!( + ::core::mem::size_of::<__darwin_i386_avx_state>(), + 716usize, + concat!("Size of: ", stringify!(__darwin_i386_avx_state)) + ); + assert_eq!( + ::core::mem::align_of::<__darwin_i386_avx_state>(), + 4usize, + concat!("Alignment of ", stringify!(__darwin_i386_avx_state)) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx_state>())).__fpu_reserved as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx_state), + "::", + stringify!(__fpu_reserved) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx_state>())).__fpu_fcw as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx_state), + "::", + stringify!(__fpu_fcw) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx_state>())).__fpu_fsw as *const _ as usize + }, + 10usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx_state), + "::", + stringify!(__fpu_fsw) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx_state>())).__fpu_ftw as *const _ as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx_state), + "::", + stringify!(__fpu_ftw) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx_state>())).__fpu_rsrv1 as *const _ as usize + }, + 13usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx_state), + "::", + stringify!(__fpu_rsrv1) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx_state>())).__fpu_fop as *const _ as usize + }, + 14usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx_state), + "::", + stringify!(__fpu_fop) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx_state>())).__fpu_ip as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx_state), + "::", + stringify!(__fpu_ip) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx_state>())).__fpu_cs as *const _ as usize + }, + 20usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx_state), + "::", + stringify!(__fpu_cs) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx_state>())).__fpu_rsrv2 as *const _ as usize + }, + 22usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx_state), + "::", + stringify!(__fpu_rsrv2) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx_state>())).__fpu_dp as *const _ as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx_state), + "::", + stringify!(__fpu_dp) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx_state>())).__fpu_ds as *const _ as usize + }, + 28usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx_state), + "::", + stringify!(__fpu_ds) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx_state>())).__fpu_rsrv3 as *const _ as usize + }, + 30usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx_state), + "::", + stringify!(__fpu_rsrv3) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx_state>())).__fpu_mxcsr as *const _ as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx_state), + "::", + stringify!(__fpu_mxcsr) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx_state>())).__fpu_mxcsrmask as *const _ + as usize + }, + 36usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx_state), + "::", + stringify!(__fpu_mxcsrmask) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx_state>())).__fpu_stmm0 as *const _ as usize + }, + 40usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx_state), + "::", + stringify!(__fpu_stmm0) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx_state>())).__fpu_stmm1 as *const _ as usize + }, + 56usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx_state), + "::", + stringify!(__fpu_stmm1) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx_state>())).__fpu_stmm2 as *const _ as usize + }, + 72usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx_state), + "::", + stringify!(__fpu_stmm2) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx_state>())).__fpu_stmm3 as *const _ as usize + }, + 88usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx_state), + "::", + stringify!(__fpu_stmm3) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx_state>())).__fpu_stmm4 as *const _ as usize + }, + 104usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx_state), + "::", + stringify!(__fpu_stmm4) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx_state>())).__fpu_stmm5 as *const _ as usize + }, + 120usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx_state), + "::", + stringify!(__fpu_stmm5) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx_state>())).__fpu_stmm6 as *const _ as usize + }, + 136usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx_state), + "::", + stringify!(__fpu_stmm6) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx_state>())).__fpu_stmm7 as *const _ as usize + }, + 152usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx_state), + "::", + stringify!(__fpu_stmm7) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx_state>())).__fpu_xmm0 as *const _ as usize + }, + 168usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx_state), + "::", + stringify!(__fpu_xmm0) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx_state>())).__fpu_xmm1 as *const _ as usize + }, + 184usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx_state), + "::", + stringify!(__fpu_xmm1) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx_state>())).__fpu_xmm2 as *const _ as usize + }, + 200usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx_state), + "::", + stringify!(__fpu_xmm2) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx_state>())).__fpu_xmm3 as *const _ as usize + }, + 216usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx_state), + "::", + stringify!(__fpu_xmm3) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx_state>())).__fpu_xmm4 as *const _ as usize + }, + 232usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx_state), + "::", + stringify!(__fpu_xmm4) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx_state>())).__fpu_xmm5 as *const _ as usize + }, + 248usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx_state), + "::", + stringify!(__fpu_xmm5) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx_state>())).__fpu_xmm6 as *const _ as usize + }, + 264usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx_state), + "::", + stringify!(__fpu_xmm6) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx_state>())).__fpu_xmm7 as *const _ as usize + }, + 280usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx_state), + "::", + stringify!(__fpu_xmm7) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx_state>())).__fpu_rsrv4 as *const _ as usize + }, + 296usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx_state), + "::", + stringify!(__fpu_rsrv4) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx_state>())).__fpu_reserved1 as *const _ + as usize + }, + 520usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx_state), + "::", + stringify!(__fpu_reserved1) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx_state>())).__avx_reserved1 as *const _ + as usize + }, + 524usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx_state), + "::", + stringify!(__avx_reserved1) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx_state>())).__fpu_ymmh0 as *const _ as usize + }, + 588usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx_state), + "::", + stringify!(__fpu_ymmh0) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx_state>())).__fpu_ymmh1 as *const _ as usize + }, + 604usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx_state), + "::", + stringify!(__fpu_ymmh1) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx_state>())).__fpu_ymmh2 as *const _ as usize + }, + 620usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx_state), + "::", + stringify!(__fpu_ymmh2) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx_state>())).__fpu_ymmh3 as *const _ as usize + }, + 636usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx_state), + "::", + stringify!(__fpu_ymmh3) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx_state>())).__fpu_ymmh4 as *const _ as usize + }, + 652usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx_state), + "::", + stringify!(__fpu_ymmh4) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx_state>())).__fpu_ymmh5 as *const _ as usize + }, + 668usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx_state), + "::", + stringify!(__fpu_ymmh5) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx_state>())).__fpu_ymmh6 as *const _ as usize + }, + 684usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx_state), + "::", + stringify!(__fpu_ymmh6) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx_state>())).__fpu_ymmh7 as *const _ as usize + }, + 700usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx_state), + "::", + stringify!(__fpu_ymmh7) + ) + ); +} +impl Clone for __darwin_i386_avx_state { + fn clone(&self) -> Self { + *self + } +} +impl ::core::fmt::Debug for __darwin_i386_avx_state { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + write ! ( f , "__darwin_i386_avx_state {{ __fpu_reserved: {:?}, __fpu_fcw: {:?}, __fpu_fsw: {:?}, __fpu_ftw: {:?}, __fpu_rsrv1: {:?}, __fpu_fop: {:?}, __fpu_ip: {:?}, __fpu_cs: {:?}, __fpu_rsrv2: {:?}, __fpu_dp: {:?}, __fpu_ds: {:?}, __fpu_rsrv3: {:?}, __fpu_mxcsr: {:?}, __fpu_mxcsrmask: {:?}, __fpu_stmm0: {:?}, __fpu_stmm1: {:?}, __fpu_stmm2: {:?}, __fpu_stmm3: {:?}, __fpu_stmm4: {:?}, __fpu_stmm5: {:?}, __fpu_stmm6: {:?}, __fpu_stmm7: {:?}, __fpu_xmm0: {:?}, __fpu_xmm1: {:?}, __fpu_xmm2: {:?}, __fpu_xmm3: {:?}, __fpu_xmm4: {:?}, __fpu_xmm5: {:?}, __fpu_xmm6: {:?}, __fpu_xmm7: {:?}, __fpu_rsrv4: [...], __fpu_reserved1: {:?}, __avx_reserved1: [...], __fpu_ymmh0: {:?}, __fpu_ymmh1: {:?}, __fpu_ymmh2: {:?}, __fpu_ymmh3: {:?}, __fpu_ymmh4: {:?}, __fpu_ymmh5: {:?}, __fpu_ymmh6: {:?}, __fpu_ymmh7: {:?} }}" , self . __fpu_reserved , self . __fpu_fcw , self . __fpu_fsw , self . __fpu_ftw , self . __fpu_rsrv1 , self . __fpu_fop , self . __fpu_ip , self . __fpu_cs , self . __fpu_rsrv2 , self . __fpu_dp , self . __fpu_ds , self . __fpu_rsrv3 , self . __fpu_mxcsr , self . __fpu_mxcsrmask , self . __fpu_stmm0 , self . __fpu_stmm1 , self . __fpu_stmm2 , self . __fpu_stmm3 , self . __fpu_stmm4 , self . __fpu_stmm5 , self . __fpu_stmm6 , self . __fpu_stmm7 , self . __fpu_xmm0 , self . __fpu_xmm1 , self . __fpu_xmm2 , self . __fpu_xmm3 , self . __fpu_xmm4 , self . __fpu_xmm5 , self . __fpu_xmm6 , self . __fpu_xmm7 , self . __fpu_reserved1 , self . __fpu_ymmh0 , self . __fpu_ymmh1 , self . __fpu_ymmh2 , self . __fpu_ymmh3 , self . __fpu_ymmh4 , self . __fpu_ymmh5 , self . __fpu_ymmh6 , self . __fpu_ymmh7 ) + } +} +#[repr(C)] +#[derive(Copy)] +pub struct __darwin_i386_avx512_state { + pub __fpu_reserved: [libc::c_int; 2usize], + pub __fpu_fcw: __darwin_fp_control, + pub __fpu_fsw: __darwin_fp_status, + pub __fpu_ftw: __uint8_t, + pub __fpu_rsrv1: __uint8_t, + pub __fpu_fop: __uint16_t, + pub __fpu_ip: __uint32_t, + pub __fpu_cs: __uint16_t, + pub __fpu_rsrv2: __uint16_t, + pub __fpu_dp: __uint32_t, + pub __fpu_ds: __uint16_t, + pub __fpu_rsrv3: __uint16_t, + pub __fpu_mxcsr: __uint32_t, + pub __fpu_mxcsrmask: __uint32_t, + pub __fpu_stmm0: __darwin_mmst_reg, + pub __fpu_stmm1: __darwin_mmst_reg, + pub __fpu_stmm2: __darwin_mmst_reg, + pub __fpu_stmm3: __darwin_mmst_reg, + pub __fpu_stmm4: __darwin_mmst_reg, + pub __fpu_stmm5: __darwin_mmst_reg, + pub __fpu_stmm6: __darwin_mmst_reg, + pub __fpu_stmm7: __darwin_mmst_reg, + pub __fpu_xmm0: __darwin_xmm_reg, + pub __fpu_xmm1: __darwin_xmm_reg, + pub __fpu_xmm2: __darwin_xmm_reg, + pub __fpu_xmm3: __darwin_xmm_reg, + pub __fpu_xmm4: __darwin_xmm_reg, + pub __fpu_xmm5: __darwin_xmm_reg, + pub __fpu_xmm6: __darwin_xmm_reg, + pub __fpu_xmm7: __darwin_xmm_reg, + pub __fpu_rsrv4: [libc::c_char; 224usize], + pub __fpu_reserved1: libc::c_int, + pub __avx_reserved1: [libc::c_char; 64usize], + pub __fpu_ymmh0: __darwin_xmm_reg, + pub __fpu_ymmh1: __darwin_xmm_reg, + pub __fpu_ymmh2: __darwin_xmm_reg, + pub __fpu_ymmh3: __darwin_xmm_reg, + pub __fpu_ymmh4: __darwin_xmm_reg, + pub __fpu_ymmh5: __darwin_xmm_reg, + pub __fpu_ymmh6: __darwin_xmm_reg, + pub __fpu_ymmh7: __darwin_xmm_reg, + pub __fpu_k0: __darwin_opmask_reg, + pub __fpu_k1: __darwin_opmask_reg, + pub __fpu_k2: __darwin_opmask_reg, + pub __fpu_k3: __darwin_opmask_reg, + pub __fpu_k4: __darwin_opmask_reg, + pub __fpu_k5: __darwin_opmask_reg, + pub __fpu_k6: __darwin_opmask_reg, + pub __fpu_k7: __darwin_opmask_reg, + pub __fpu_zmmh0: __darwin_ymm_reg, + pub __fpu_zmmh1: __darwin_ymm_reg, + pub __fpu_zmmh2: __darwin_ymm_reg, + pub __fpu_zmmh3: __darwin_ymm_reg, + pub __fpu_zmmh4: __darwin_ymm_reg, + pub __fpu_zmmh5: __darwin_ymm_reg, + pub __fpu_zmmh6: __darwin_ymm_reg, + pub __fpu_zmmh7: __darwin_ymm_reg, +} +#[test] +fn bindgen_test_layout___darwin_i386_avx512_state() { + assert_eq!( + ::core::mem::size_of::<__darwin_i386_avx512_state>(), + 1036usize, + concat!("Size of: ", stringify!(__darwin_i386_avx512_state)) + ); + assert_eq!( + ::core::mem::align_of::<__darwin_i386_avx512_state>(), + 4usize, + concat!("Alignment of ", stringify!(__darwin_i386_avx512_state)) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__fpu_reserved as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__fpu_reserved) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__fpu_fcw as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__fpu_fcw) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__fpu_fsw as *const _ as usize + }, + 10usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__fpu_fsw) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__fpu_ftw as *const _ as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__fpu_ftw) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__fpu_rsrv1 as *const _ as usize + }, + 13usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__fpu_rsrv1) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__fpu_fop as *const _ as usize + }, + 14usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__fpu_fop) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__fpu_ip as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__fpu_ip) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__fpu_cs as *const _ as usize + }, + 20usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__fpu_cs) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__fpu_rsrv2 as *const _ as usize + }, + 22usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__fpu_rsrv2) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__fpu_dp as *const _ as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__fpu_dp) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__fpu_ds as *const _ as usize + }, + 28usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__fpu_ds) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__fpu_rsrv3 as *const _ as usize + }, + 30usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__fpu_rsrv3) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__fpu_mxcsr as *const _ as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__fpu_mxcsr) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__fpu_mxcsrmask as *const _ + as usize + }, + 36usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__fpu_mxcsrmask) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__fpu_stmm0 as *const _ as usize + }, + 40usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__fpu_stmm0) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__fpu_stmm1 as *const _ as usize + }, + 56usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__fpu_stmm1) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__fpu_stmm2 as *const _ as usize + }, + 72usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__fpu_stmm2) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__fpu_stmm3 as *const _ as usize + }, + 88usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__fpu_stmm3) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__fpu_stmm4 as *const _ as usize + }, + 104usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__fpu_stmm4) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__fpu_stmm5 as *const _ as usize + }, + 120usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__fpu_stmm5) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__fpu_stmm6 as *const _ as usize + }, + 136usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__fpu_stmm6) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__fpu_stmm7 as *const _ as usize + }, + 152usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__fpu_stmm7) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__fpu_xmm0 as *const _ as usize + }, + 168usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__fpu_xmm0) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__fpu_xmm1 as *const _ as usize + }, + 184usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__fpu_xmm1) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__fpu_xmm2 as *const _ as usize + }, + 200usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__fpu_xmm2) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__fpu_xmm3 as *const _ as usize + }, + 216usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__fpu_xmm3) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__fpu_xmm4 as *const _ as usize + }, + 232usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__fpu_xmm4) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__fpu_xmm5 as *const _ as usize + }, + 248usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__fpu_xmm5) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__fpu_xmm6 as *const _ as usize + }, + 264usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__fpu_xmm6) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__fpu_xmm7 as *const _ as usize + }, + 280usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__fpu_xmm7) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__fpu_rsrv4 as *const _ as usize + }, + 296usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__fpu_rsrv4) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__fpu_reserved1 as *const _ + as usize + }, + 520usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__fpu_reserved1) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__avx_reserved1 as *const _ + as usize + }, + 524usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__avx_reserved1) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__fpu_ymmh0 as *const _ as usize + }, + 588usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__fpu_ymmh0) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__fpu_ymmh1 as *const _ as usize + }, + 604usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__fpu_ymmh1) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__fpu_ymmh2 as *const _ as usize + }, + 620usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__fpu_ymmh2) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__fpu_ymmh3 as *const _ as usize + }, + 636usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__fpu_ymmh3) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__fpu_ymmh4 as *const _ as usize + }, + 652usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__fpu_ymmh4) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__fpu_ymmh5 as *const _ as usize + }, + 668usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__fpu_ymmh5) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__fpu_ymmh6 as *const _ as usize + }, + 684usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__fpu_ymmh6) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__fpu_ymmh7 as *const _ as usize + }, + 700usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__fpu_ymmh7) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__fpu_k0 as *const _ as usize + }, + 716usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__fpu_k0) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__fpu_k1 as *const _ as usize + }, + 724usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__fpu_k1) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__fpu_k2 as *const _ as usize + }, + 732usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__fpu_k2) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__fpu_k3 as *const _ as usize + }, + 740usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__fpu_k3) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__fpu_k4 as *const _ as usize + }, + 748usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__fpu_k4) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__fpu_k5 as *const _ as usize + }, + 756usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__fpu_k5) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__fpu_k6 as *const _ as usize + }, + 764usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__fpu_k6) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__fpu_k7 as *const _ as usize + }, + 772usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__fpu_k7) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__fpu_zmmh0 as *const _ as usize + }, + 780usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__fpu_zmmh0) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__fpu_zmmh1 as *const _ as usize + }, + 812usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__fpu_zmmh1) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__fpu_zmmh2 as *const _ as usize + }, + 844usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__fpu_zmmh2) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__fpu_zmmh3 as *const _ as usize + }, + 876usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__fpu_zmmh3) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__fpu_zmmh4 as *const _ as usize + }, + 908usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__fpu_zmmh4) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__fpu_zmmh5 as *const _ as usize + }, + 940usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__fpu_zmmh5) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__fpu_zmmh6 as *const _ as usize + }, + 972usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__fpu_zmmh6) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_avx512_state>())).__fpu_zmmh7 as *const _ as usize + }, + 1004usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_avx512_state), + "::", + stringify!(__fpu_zmmh7) + ) + ); +} +impl Clone for __darwin_i386_avx512_state { + fn clone(&self) -> Self { + *self + } +} +impl ::core::fmt::Debug for __darwin_i386_avx512_state { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + write ! ( f , "__darwin_i386_avx512_state {{ __fpu_reserved: {:?}, __fpu_fcw: {:?}, __fpu_fsw: {:?}, __fpu_ftw: {:?}, __fpu_rsrv1: {:?}, __fpu_fop: {:?}, __fpu_ip: {:?}, __fpu_cs: {:?}, __fpu_rsrv2: {:?}, __fpu_dp: {:?}, __fpu_ds: {:?}, __fpu_rsrv3: {:?}, __fpu_mxcsr: {:?}, __fpu_mxcsrmask: {:?}, __fpu_stmm0: {:?}, __fpu_stmm1: {:?}, __fpu_stmm2: {:?}, __fpu_stmm3: {:?}, __fpu_stmm4: {:?}, __fpu_stmm5: {:?}, __fpu_stmm6: {:?}, __fpu_stmm7: {:?}, __fpu_xmm0: {:?}, __fpu_xmm1: {:?}, __fpu_xmm2: {:?}, __fpu_xmm3: {:?}, __fpu_xmm4: {:?}, __fpu_xmm5: {:?}, __fpu_xmm6: {:?}, __fpu_xmm7: {:?}, __fpu_rsrv4: [...], __fpu_reserved1: {:?}, __avx_reserved1: [...], __fpu_ymmh0: {:?}, __fpu_ymmh1: {:?}, __fpu_ymmh2: {:?}, __fpu_ymmh3: {:?}, __fpu_ymmh4: {:?}, __fpu_ymmh5: {:?}, __fpu_ymmh6: {:?}, __fpu_ymmh7: {:?}, __fpu_k0: {:?}, __fpu_k1: {:?}, __fpu_k2: {:?}, __fpu_k3: {:?}, __fpu_k4: {:?}, __fpu_k5: {:?}, __fpu_k6: {:?}, __fpu_k7: {:?}, __fpu_zmmh0: {:?}, __fpu_zmmh1: {:?}, __fpu_zmmh2: {:?}, __fpu_zmmh3: {:?}, __fpu_zmmh4: {:?}, __fpu_zmmh5: {:?}, __fpu_zmmh6: {:?}, __fpu_zmmh7: {:?} }}" , self . __fpu_reserved , self . __fpu_fcw , self . __fpu_fsw , self . __fpu_ftw , self . __fpu_rsrv1 , self . __fpu_fop , self . __fpu_ip , self . __fpu_cs , self . __fpu_rsrv2 , self . __fpu_dp , self . __fpu_ds , self . __fpu_rsrv3 , self . __fpu_mxcsr , self . __fpu_mxcsrmask , self . __fpu_stmm0 , self . __fpu_stmm1 , self . __fpu_stmm2 , self . __fpu_stmm3 , self . __fpu_stmm4 , self . __fpu_stmm5 , self . __fpu_stmm6 , self . __fpu_stmm7 , self . __fpu_xmm0 , self . __fpu_xmm1 , self . __fpu_xmm2 , self . __fpu_xmm3 , self . __fpu_xmm4 , self . __fpu_xmm5 , self . __fpu_xmm6 , self . __fpu_xmm7 , self . __fpu_reserved1 , self . __fpu_ymmh0 , self . __fpu_ymmh1 , self . __fpu_ymmh2 , self . __fpu_ymmh3 , self . __fpu_ymmh4 , self . __fpu_ymmh5 , self . __fpu_ymmh6 , self . __fpu_ymmh7 , self . __fpu_k0 , self . __fpu_k1 , self . __fpu_k2 , self . __fpu_k3 , self . __fpu_k4 , self . __fpu_k5 , self . __fpu_k6 , self . __fpu_k7 , self . __fpu_zmmh0 , self . __fpu_zmmh1 , self . __fpu_zmmh2 , self . __fpu_zmmh3 , self . __fpu_zmmh4 , self . __fpu_zmmh5 , self . __fpu_zmmh6 , self . __fpu_zmmh7 ) + } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct __darwin_i386_exception_state { + pub __trapno: __uint16_t, + pub __cpu: __uint16_t, + pub __err: __uint32_t, + pub __faultvaddr: __uint32_t, +} +#[test] +fn bindgen_test_layout___darwin_i386_exception_state() { + assert_eq!( + ::core::mem::size_of::<__darwin_i386_exception_state>(), + 12usize, + concat!("Size of: ", stringify!(__darwin_i386_exception_state)) + ); + assert_eq!( + ::core::mem::align_of::<__darwin_i386_exception_state>(), + 4usize, + concat!("Alignment of ", stringify!(__darwin_i386_exception_state)) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_exception_state>())).__trapno as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_exception_state), + "::", + stringify!(__trapno) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_exception_state>())).__cpu as *const _ as usize + }, + 2usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_exception_state), + "::", + stringify!(__cpu) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_exception_state>())).__err as *const _ as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_exception_state), + "::", + stringify!(__err) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_i386_exception_state>())).__faultvaddr as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(__darwin_i386_exception_state), + "::", + stringify!(__faultvaddr) + ) + ); +} +impl Clone for __darwin_i386_exception_state { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct __darwin_x86_debug_state32 { + pub __dr0: libc::c_uint, + pub __dr1: libc::c_uint, + pub __dr2: libc::c_uint, + pub __dr3: libc::c_uint, + pub __dr4: libc::c_uint, + pub __dr5: libc::c_uint, + pub __dr6: libc::c_uint, + pub __dr7: libc::c_uint, +} +#[test] +fn bindgen_test_layout___darwin_x86_debug_state32() { + assert_eq!( + ::core::mem::size_of::<__darwin_x86_debug_state32>(), + 32usize, + concat!("Size of: ", stringify!(__darwin_x86_debug_state32)) + ); + assert_eq!( + ::core::mem::align_of::<__darwin_x86_debug_state32>(), + 4usize, + concat!("Alignment of ", stringify!(__darwin_x86_debug_state32)) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_debug_state32>())).__dr0 as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_debug_state32), + "::", + stringify!(__dr0) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_debug_state32>())).__dr1 as *const _ as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_debug_state32), + "::", + stringify!(__dr1) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_debug_state32>())).__dr2 as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_debug_state32), + "::", + stringify!(__dr2) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_debug_state32>())).__dr3 as *const _ as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_debug_state32), + "::", + stringify!(__dr3) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_debug_state32>())).__dr4 as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_debug_state32), + "::", + stringify!(__dr4) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_debug_state32>())).__dr5 as *const _ as usize + }, + 20usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_debug_state32), + "::", + stringify!(__dr5) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_debug_state32>())).__dr6 as *const _ as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_debug_state32), + "::", + stringify!(__dr6) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_debug_state32>())).__dr7 as *const _ as usize + }, + 28usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_debug_state32), + "::", + stringify!(__dr7) + ) + ); +} +impl Clone for __darwin_x86_debug_state32 { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct __darwin_x86_thread_state64 { + pub __rax: __uint64_t, + pub __rbx: __uint64_t, + pub __rcx: __uint64_t, + pub __rdx: __uint64_t, + pub __rdi: __uint64_t, + pub __rsi: __uint64_t, + pub __rbp: __uint64_t, + pub __rsp: __uint64_t, + pub __r8: __uint64_t, + pub __r9: __uint64_t, + pub __r10: __uint64_t, + pub __r11: __uint64_t, + pub __r12: __uint64_t, + pub __r13: __uint64_t, + pub __r14: __uint64_t, + pub __r15: __uint64_t, + pub __rip: __uint64_t, + pub __rflags: __uint64_t, + pub __cs: __uint64_t, + pub __fs: __uint64_t, + pub __gs: __uint64_t, +} +#[test] +fn bindgen_test_layout___darwin_x86_thread_state64() { + assert_eq!( + ::core::mem::size_of::<__darwin_x86_thread_state64>(), + 168usize, + concat!("Size of: ", stringify!(__darwin_x86_thread_state64)) + ); + assert_eq!( + ::core::mem::align_of::<__darwin_x86_thread_state64>(), + 8usize, + concat!("Alignment of ", stringify!(__darwin_x86_thread_state64)) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_thread_state64>())).__rax as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_thread_state64), + "::", + stringify!(__rax) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_thread_state64>())).__rbx as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_thread_state64), + "::", + stringify!(__rbx) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_thread_state64>())).__rcx as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_thread_state64), + "::", + stringify!(__rcx) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_thread_state64>())).__rdx as *const _ as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_thread_state64), + "::", + stringify!(__rdx) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_thread_state64>())).__rdi as *const _ as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_thread_state64), + "::", + stringify!(__rdi) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_thread_state64>())).__rsi as *const _ as usize + }, + 40usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_thread_state64), + "::", + stringify!(__rsi) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_thread_state64>())).__rbp as *const _ as usize + }, + 48usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_thread_state64), + "::", + stringify!(__rbp) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_thread_state64>())).__rsp as *const _ as usize + }, + 56usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_thread_state64), + "::", + stringify!(__rsp) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_thread_state64>())).__r8 as *const _ as usize + }, + 64usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_thread_state64), + "::", + stringify!(__r8) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_thread_state64>())).__r9 as *const _ as usize + }, + 72usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_thread_state64), + "::", + stringify!(__r9) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_thread_state64>())).__r10 as *const _ as usize + }, + 80usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_thread_state64), + "::", + stringify!(__r10) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_thread_state64>())).__r11 as *const _ as usize + }, + 88usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_thread_state64), + "::", + stringify!(__r11) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_thread_state64>())).__r12 as *const _ as usize + }, + 96usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_thread_state64), + "::", + stringify!(__r12) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_thread_state64>())).__r13 as *const _ as usize + }, + 104usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_thread_state64), + "::", + stringify!(__r13) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_thread_state64>())).__r14 as *const _ as usize + }, + 112usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_thread_state64), + "::", + stringify!(__r14) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_thread_state64>())).__r15 as *const _ as usize + }, + 120usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_thread_state64), + "::", + stringify!(__r15) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_thread_state64>())).__rip as *const _ as usize + }, + 128usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_thread_state64), + "::", + stringify!(__rip) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_thread_state64>())).__rflags as *const _ as usize + }, + 136usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_thread_state64), + "::", + stringify!(__rflags) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_thread_state64>())).__cs as *const _ as usize + }, + 144usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_thread_state64), + "::", + stringify!(__cs) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_thread_state64>())).__fs as *const _ as usize + }, + 152usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_thread_state64), + "::", + stringify!(__fs) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_thread_state64>())).__gs as *const _ as usize + }, + 160usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_thread_state64), + "::", + stringify!(__gs) + ) + ); +} +impl Clone for __darwin_x86_thread_state64 { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct __darwin_x86_thread_full_state64 { + pub ss64: __darwin_x86_thread_state64, + pub __ds: __uint64_t, + pub __es: __uint64_t, + pub __ss: __uint64_t, + pub __gsbase: __uint64_t, +} +#[test] +fn bindgen_test_layout___darwin_x86_thread_full_state64() { + assert_eq!( + ::core::mem::size_of::<__darwin_x86_thread_full_state64>(), + 200usize, + concat!("Size of: ", stringify!(__darwin_x86_thread_full_state64)) + ); + assert_eq!( + ::core::mem::align_of::<__darwin_x86_thread_full_state64>(), + 8usize, + concat!( + "Alignment of ", + stringify!(__darwin_x86_thread_full_state64) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_thread_full_state64>())).ss64 as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_thread_full_state64), + "::", + stringify!(ss64) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_thread_full_state64>())).__ds as *const _ as usize + }, + 168usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_thread_full_state64), + "::", + stringify!(__ds) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_thread_full_state64>())).__es as *const _ as usize + }, + 176usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_thread_full_state64), + "::", + stringify!(__es) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_thread_full_state64>())).__ss as *const _ as usize + }, + 184usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_thread_full_state64), + "::", + stringify!(__ss) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_thread_full_state64>())).__gsbase as *const _ + as usize + }, + 192usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_thread_full_state64), + "::", + stringify!(__gsbase) + ) + ); +} +impl Clone for __darwin_x86_thread_full_state64 { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +#[derive(Copy)] +pub struct __darwin_x86_float_state64 { + pub __fpu_reserved: [libc::c_int; 2usize], + pub __fpu_fcw: __darwin_fp_control, + pub __fpu_fsw: __darwin_fp_status, + pub __fpu_ftw: __uint8_t, + pub __fpu_rsrv1: __uint8_t, + pub __fpu_fop: __uint16_t, + pub __fpu_ip: __uint32_t, + pub __fpu_cs: __uint16_t, + pub __fpu_rsrv2: __uint16_t, + pub __fpu_dp: __uint32_t, + pub __fpu_ds: __uint16_t, + pub __fpu_rsrv3: __uint16_t, + pub __fpu_mxcsr: __uint32_t, + pub __fpu_mxcsrmask: __uint32_t, + pub __fpu_stmm0: __darwin_mmst_reg, + pub __fpu_stmm1: __darwin_mmst_reg, + pub __fpu_stmm2: __darwin_mmst_reg, + pub __fpu_stmm3: __darwin_mmst_reg, + pub __fpu_stmm4: __darwin_mmst_reg, + pub __fpu_stmm5: __darwin_mmst_reg, + pub __fpu_stmm6: __darwin_mmst_reg, + pub __fpu_stmm7: __darwin_mmst_reg, + pub __fpu_xmm0: __darwin_xmm_reg, + pub __fpu_xmm1: __darwin_xmm_reg, + pub __fpu_xmm2: __darwin_xmm_reg, + pub __fpu_xmm3: __darwin_xmm_reg, + pub __fpu_xmm4: __darwin_xmm_reg, + pub __fpu_xmm5: __darwin_xmm_reg, + pub __fpu_xmm6: __darwin_xmm_reg, + pub __fpu_xmm7: __darwin_xmm_reg, + pub __fpu_xmm8: __darwin_xmm_reg, + pub __fpu_xmm9: __darwin_xmm_reg, + pub __fpu_xmm10: __darwin_xmm_reg, + pub __fpu_xmm11: __darwin_xmm_reg, + pub __fpu_xmm12: __darwin_xmm_reg, + pub __fpu_xmm13: __darwin_xmm_reg, + pub __fpu_xmm14: __darwin_xmm_reg, + pub __fpu_xmm15: __darwin_xmm_reg, + pub __fpu_rsrv4: [libc::c_char; 96usize], + pub __fpu_reserved1: libc::c_int, +} +#[test] +fn bindgen_test_layout___darwin_x86_float_state64() { + assert_eq!( + ::core::mem::size_of::<__darwin_x86_float_state64>(), + 524usize, + concat!("Size of: ", stringify!(__darwin_x86_float_state64)) + ); + assert_eq!( + ::core::mem::align_of::<__darwin_x86_float_state64>(), + 4usize, + concat!("Alignment of ", stringify!(__darwin_x86_float_state64)) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_float_state64>())).__fpu_reserved as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_float_state64), + "::", + stringify!(__fpu_reserved) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_float_state64>())).__fpu_fcw as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_float_state64), + "::", + stringify!(__fpu_fcw) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_float_state64>())).__fpu_fsw as *const _ as usize + }, + 10usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_float_state64), + "::", + stringify!(__fpu_fsw) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_float_state64>())).__fpu_ftw as *const _ as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_float_state64), + "::", + stringify!(__fpu_ftw) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_float_state64>())).__fpu_rsrv1 as *const _ as usize + }, + 13usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_float_state64), + "::", + stringify!(__fpu_rsrv1) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_float_state64>())).__fpu_fop as *const _ as usize + }, + 14usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_float_state64), + "::", + stringify!(__fpu_fop) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_float_state64>())).__fpu_ip as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_float_state64), + "::", + stringify!(__fpu_ip) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_float_state64>())).__fpu_cs as *const _ as usize + }, + 20usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_float_state64), + "::", + stringify!(__fpu_cs) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_float_state64>())).__fpu_rsrv2 as *const _ as usize + }, + 22usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_float_state64), + "::", + stringify!(__fpu_rsrv2) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_float_state64>())).__fpu_dp as *const _ as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_float_state64), + "::", + stringify!(__fpu_dp) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_float_state64>())).__fpu_ds as *const _ as usize + }, + 28usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_float_state64), + "::", + stringify!(__fpu_ds) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_float_state64>())).__fpu_rsrv3 as *const _ as usize + }, + 30usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_float_state64), + "::", + stringify!(__fpu_rsrv3) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_float_state64>())).__fpu_mxcsr as *const _ as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_float_state64), + "::", + stringify!(__fpu_mxcsr) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_float_state64>())).__fpu_mxcsrmask as *const _ + as usize + }, + 36usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_float_state64), + "::", + stringify!(__fpu_mxcsrmask) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_float_state64>())).__fpu_stmm0 as *const _ as usize + }, + 40usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_float_state64), + "::", + stringify!(__fpu_stmm0) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_float_state64>())).__fpu_stmm1 as *const _ as usize + }, + 56usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_float_state64), + "::", + stringify!(__fpu_stmm1) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_float_state64>())).__fpu_stmm2 as *const _ as usize + }, + 72usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_float_state64), + "::", + stringify!(__fpu_stmm2) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_float_state64>())).__fpu_stmm3 as *const _ as usize + }, + 88usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_float_state64), + "::", + stringify!(__fpu_stmm3) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_float_state64>())).__fpu_stmm4 as *const _ as usize + }, + 104usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_float_state64), + "::", + stringify!(__fpu_stmm4) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_float_state64>())).__fpu_stmm5 as *const _ as usize + }, + 120usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_float_state64), + "::", + stringify!(__fpu_stmm5) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_float_state64>())).__fpu_stmm6 as *const _ as usize + }, + 136usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_float_state64), + "::", + stringify!(__fpu_stmm6) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_float_state64>())).__fpu_stmm7 as *const _ as usize + }, + 152usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_float_state64), + "::", + stringify!(__fpu_stmm7) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_float_state64>())).__fpu_xmm0 as *const _ as usize + }, + 168usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_float_state64), + "::", + stringify!(__fpu_xmm0) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_float_state64>())).__fpu_xmm1 as *const _ as usize + }, + 184usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_float_state64), + "::", + stringify!(__fpu_xmm1) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_float_state64>())).__fpu_xmm2 as *const _ as usize + }, + 200usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_float_state64), + "::", + stringify!(__fpu_xmm2) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_float_state64>())).__fpu_xmm3 as *const _ as usize + }, + 216usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_float_state64), + "::", + stringify!(__fpu_xmm3) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_float_state64>())).__fpu_xmm4 as *const _ as usize + }, + 232usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_float_state64), + "::", + stringify!(__fpu_xmm4) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_float_state64>())).__fpu_xmm5 as *const _ as usize + }, + 248usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_float_state64), + "::", + stringify!(__fpu_xmm5) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_float_state64>())).__fpu_xmm6 as *const _ as usize + }, + 264usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_float_state64), + "::", + stringify!(__fpu_xmm6) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_float_state64>())).__fpu_xmm7 as *const _ as usize + }, + 280usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_float_state64), + "::", + stringify!(__fpu_xmm7) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_float_state64>())).__fpu_xmm8 as *const _ as usize + }, + 296usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_float_state64), + "::", + stringify!(__fpu_xmm8) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_float_state64>())).__fpu_xmm9 as *const _ as usize + }, + 312usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_float_state64), + "::", + stringify!(__fpu_xmm9) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_float_state64>())).__fpu_xmm10 as *const _ as usize + }, + 328usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_float_state64), + "::", + stringify!(__fpu_xmm10) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_float_state64>())).__fpu_xmm11 as *const _ as usize + }, + 344usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_float_state64), + "::", + stringify!(__fpu_xmm11) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_float_state64>())).__fpu_xmm12 as *const _ as usize + }, + 360usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_float_state64), + "::", + stringify!(__fpu_xmm12) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_float_state64>())).__fpu_xmm13 as *const _ as usize + }, + 376usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_float_state64), + "::", + stringify!(__fpu_xmm13) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_float_state64>())).__fpu_xmm14 as *const _ as usize + }, + 392usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_float_state64), + "::", + stringify!(__fpu_xmm14) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_float_state64>())).__fpu_xmm15 as *const _ as usize + }, + 408usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_float_state64), + "::", + stringify!(__fpu_xmm15) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_float_state64>())).__fpu_rsrv4 as *const _ as usize + }, + 424usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_float_state64), + "::", + stringify!(__fpu_rsrv4) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_float_state64>())).__fpu_reserved1 as *const _ + as usize + }, + 520usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_float_state64), + "::", + stringify!(__fpu_reserved1) + ) + ); +} +impl Clone for __darwin_x86_float_state64 { + fn clone(&self) -> Self { + *self + } +} +impl ::core::fmt::Debug for __darwin_x86_float_state64 { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + write ! ( f , "__darwin_x86_float_state64 {{ __fpu_reserved: {:?}, __fpu_fcw: {:?}, __fpu_fsw: {:?}, __fpu_ftw: {:?}, __fpu_rsrv1: {:?}, __fpu_fop: {:?}, __fpu_ip: {:?}, __fpu_cs: {:?}, __fpu_rsrv2: {:?}, __fpu_dp: {:?}, __fpu_ds: {:?}, __fpu_rsrv3: {:?}, __fpu_mxcsr: {:?}, __fpu_mxcsrmask: {:?}, __fpu_stmm0: {:?}, __fpu_stmm1: {:?}, __fpu_stmm2: {:?}, __fpu_stmm3: {:?}, __fpu_stmm4: {:?}, __fpu_stmm5: {:?}, __fpu_stmm6: {:?}, __fpu_stmm7: {:?}, __fpu_xmm0: {:?}, __fpu_xmm1: {:?}, __fpu_xmm2: {:?}, __fpu_xmm3: {:?}, __fpu_xmm4: {:?}, __fpu_xmm5: {:?}, __fpu_xmm6: {:?}, __fpu_xmm7: {:?}, __fpu_xmm8: {:?}, __fpu_xmm9: {:?}, __fpu_xmm10: {:?}, __fpu_xmm11: {:?}, __fpu_xmm12: {:?}, __fpu_xmm13: {:?}, __fpu_xmm14: {:?}, __fpu_xmm15: {:?}, __fpu_rsrv4: [...], __fpu_reserved1: {:?} }}" , self . __fpu_reserved , self . __fpu_fcw , self . __fpu_fsw , self . __fpu_ftw , self . __fpu_rsrv1 , self . __fpu_fop , self . __fpu_ip , self . __fpu_cs , self . __fpu_rsrv2 , self . __fpu_dp , self . __fpu_ds , self . __fpu_rsrv3 , self . __fpu_mxcsr , self . __fpu_mxcsrmask , self . __fpu_stmm0 , self . __fpu_stmm1 , self . __fpu_stmm2 , self . __fpu_stmm3 , self . __fpu_stmm4 , self . __fpu_stmm5 , self . __fpu_stmm6 , self . __fpu_stmm7 , self . __fpu_xmm0 , self . __fpu_xmm1 , self . __fpu_xmm2 , self . __fpu_xmm3 , self . __fpu_xmm4 , self . __fpu_xmm5 , self . __fpu_xmm6 , self . __fpu_xmm7 , self . __fpu_xmm8 , self . __fpu_xmm9 , self . __fpu_xmm10 , self . __fpu_xmm11 , self . __fpu_xmm12 , self . __fpu_xmm13 , self . __fpu_xmm14 , self . __fpu_xmm15 , self . __fpu_reserved1 ) + } +} +#[repr(C)] +#[derive(Copy)] +pub struct __darwin_x86_avx_state64 { + pub __fpu_reserved: [libc::c_int; 2usize], + pub __fpu_fcw: __darwin_fp_control, + pub __fpu_fsw: __darwin_fp_status, + pub __fpu_ftw: __uint8_t, + pub __fpu_rsrv1: __uint8_t, + pub __fpu_fop: __uint16_t, + pub __fpu_ip: __uint32_t, + pub __fpu_cs: __uint16_t, + pub __fpu_rsrv2: __uint16_t, + pub __fpu_dp: __uint32_t, + pub __fpu_ds: __uint16_t, + pub __fpu_rsrv3: __uint16_t, + pub __fpu_mxcsr: __uint32_t, + pub __fpu_mxcsrmask: __uint32_t, + pub __fpu_stmm0: __darwin_mmst_reg, + pub __fpu_stmm1: __darwin_mmst_reg, + pub __fpu_stmm2: __darwin_mmst_reg, + pub __fpu_stmm3: __darwin_mmst_reg, + pub __fpu_stmm4: __darwin_mmst_reg, + pub __fpu_stmm5: __darwin_mmst_reg, + pub __fpu_stmm6: __darwin_mmst_reg, + pub __fpu_stmm7: __darwin_mmst_reg, + pub __fpu_xmm0: __darwin_xmm_reg, + pub __fpu_xmm1: __darwin_xmm_reg, + pub __fpu_xmm2: __darwin_xmm_reg, + pub __fpu_xmm3: __darwin_xmm_reg, + pub __fpu_xmm4: __darwin_xmm_reg, + pub __fpu_xmm5: __darwin_xmm_reg, + pub __fpu_xmm6: __darwin_xmm_reg, + pub __fpu_xmm7: __darwin_xmm_reg, + pub __fpu_xmm8: __darwin_xmm_reg, + pub __fpu_xmm9: __darwin_xmm_reg, + pub __fpu_xmm10: __darwin_xmm_reg, + pub __fpu_xmm11: __darwin_xmm_reg, + pub __fpu_xmm12: __darwin_xmm_reg, + pub __fpu_xmm13: __darwin_xmm_reg, + pub __fpu_xmm14: __darwin_xmm_reg, + pub __fpu_xmm15: __darwin_xmm_reg, + pub __fpu_rsrv4: [libc::c_char; 96usize], + pub __fpu_reserved1: libc::c_int, + pub __avx_reserved1: [libc::c_char; 64usize], + pub __fpu_ymmh0: __darwin_xmm_reg, + pub __fpu_ymmh1: __darwin_xmm_reg, + pub __fpu_ymmh2: __darwin_xmm_reg, + pub __fpu_ymmh3: __darwin_xmm_reg, + pub __fpu_ymmh4: __darwin_xmm_reg, + pub __fpu_ymmh5: __darwin_xmm_reg, + pub __fpu_ymmh6: __darwin_xmm_reg, + pub __fpu_ymmh7: __darwin_xmm_reg, + pub __fpu_ymmh8: __darwin_xmm_reg, + pub __fpu_ymmh9: __darwin_xmm_reg, + pub __fpu_ymmh10: __darwin_xmm_reg, + pub __fpu_ymmh11: __darwin_xmm_reg, + pub __fpu_ymmh12: __darwin_xmm_reg, + pub __fpu_ymmh13: __darwin_xmm_reg, + pub __fpu_ymmh14: __darwin_xmm_reg, + pub __fpu_ymmh15: __darwin_xmm_reg, +} +#[test] +fn bindgen_test_layout___darwin_x86_avx_state64() { + assert_eq!( + ::core::mem::size_of::<__darwin_x86_avx_state64>(), + 844usize, + concat!("Size of: ", stringify!(__darwin_x86_avx_state64)) + ); + assert_eq!( + ::core::mem::align_of::<__darwin_x86_avx_state64>(), + 4usize, + concat!("Alignment of ", stringify!(__darwin_x86_avx_state64)) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__fpu_reserved as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__fpu_reserved) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__fpu_fcw as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__fpu_fcw) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__fpu_fsw as *const _ as usize + }, + 10usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__fpu_fsw) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__fpu_ftw as *const _ as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__fpu_ftw) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__fpu_rsrv1 as *const _ as usize + }, + 13usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__fpu_rsrv1) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__fpu_fop as *const _ as usize + }, + 14usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__fpu_fop) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__fpu_ip as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__fpu_ip) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__fpu_cs as *const _ as usize + }, + 20usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__fpu_cs) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__fpu_rsrv2 as *const _ as usize + }, + 22usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__fpu_rsrv2) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__fpu_dp as *const _ as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__fpu_dp) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__fpu_ds as *const _ as usize + }, + 28usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__fpu_ds) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__fpu_rsrv3 as *const _ as usize + }, + 30usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__fpu_rsrv3) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__fpu_mxcsr as *const _ as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__fpu_mxcsr) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__fpu_mxcsrmask as *const _ + as usize + }, + 36usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__fpu_mxcsrmask) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__fpu_stmm0 as *const _ as usize + }, + 40usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__fpu_stmm0) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__fpu_stmm1 as *const _ as usize + }, + 56usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__fpu_stmm1) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__fpu_stmm2 as *const _ as usize + }, + 72usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__fpu_stmm2) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__fpu_stmm3 as *const _ as usize + }, + 88usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__fpu_stmm3) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__fpu_stmm4 as *const _ as usize + }, + 104usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__fpu_stmm4) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__fpu_stmm5 as *const _ as usize + }, + 120usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__fpu_stmm5) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__fpu_stmm6 as *const _ as usize + }, + 136usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__fpu_stmm6) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__fpu_stmm7 as *const _ as usize + }, + 152usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__fpu_stmm7) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__fpu_xmm0 as *const _ as usize + }, + 168usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__fpu_xmm0) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__fpu_xmm1 as *const _ as usize + }, + 184usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__fpu_xmm1) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__fpu_xmm2 as *const _ as usize + }, + 200usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__fpu_xmm2) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__fpu_xmm3 as *const _ as usize + }, + 216usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__fpu_xmm3) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__fpu_xmm4 as *const _ as usize + }, + 232usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__fpu_xmm4) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__fpu_xmm5 as *const _ as usize + }, + 248usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__fpu_xmm5) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__fpu_xmm6 as *const _ as usize + }, + 264usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__fpu_xmm6) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__fpu_xmm7 as *const _ as usize + }, + 280usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__fpu_xmm7) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__fpu_xmm8 as *const _ as usize + }, + 296usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__fpu_xmm8) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__fpu_xmm9 as *const _ as usize + }, + 312usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__fpu_xmm9) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__fpu_xmm10 as *const _ as usize + }, + 328usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__fpu_xmm10) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__fpu_xmm11 as *const _ as usize + }, + 344usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__fpu_xmm11) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__fpu_xmm12 as *const _ as usize + }, + 360usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__fpu_xmm12) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__fpu_xmm13 as *const _ as usize + }, + 376usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__fpu_xmm13) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__fpu_xmm14 as *const _ as usize + }, + 392usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__fpu_xmm14) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__fpu_xmm15 as *const _ as usize + }, + 408usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__fpu_xmm15) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__fpu_rsrv4 as *const _ as usize + }, + 424usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__fpu_rsrv4) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__fpu_reserved1 as *const _ + as usize + }, + 520usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__fpu_reserved1) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__avx_reserved1 as *const _ + as usize + }, + 524usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__avx_reserved1) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__fpu_ymmh0 as *const _ as usize + }, + 588usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__fpu_ymmh0) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__fpu_ymmh1 as *const _ as usize + }, + 604usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__fpu_ymmh1) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__fpu_ymmh2 as *const _ as usize + }, + 620usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__fpu_ymmh2) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__fpu_ymmh3 as *const _ as usize + }, + 636usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__fpu_ymmh3) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__fpu_ymmh4 as *const _ as usize + }, + 652usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__fpu_ymmh4) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__fpu_ymmh5 as *const _ as usize + }, + 668usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__fpu_ymmh5) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__fpu_ymmh6 as *const _ as usize + }, + 684usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__fpu_ymmh6) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__fpu_ymmh7 as *const _ as usize + }, + 700usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__fpu_ymmh7) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__fpu_ymmh8 as *const _ as usize + }, + 716usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__fpu_ymmh8) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__fpu_ymmh9 as *const _ as usize + }, + 732usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__fpu_ymmh9) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__fpu_ymmh10 as *const _ as usize + }, + 748usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__fpu_ymmh10) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__fpu_ymmh11 as *const _ as usize + }, + 764usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__fpu_ymmh11) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__fpu_ymmh12 as *const _ as usize + }, + 780usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__fpu_ymmh12) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__fpu_ymmh13 as *const _ as usize + }, + 796usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__fpu_ymmh13) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__fpu_ymmh14 as *const _ as usize + }, + 812usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__fpu_ymmh14) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx_state64>())).__fpu_ymmh15 as *const _ as usize + }, + 828usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx_state64), + "::", + stringify!(__fpu_ymmh15) + ) + ); +} +impl Clone for __darwin_x86_avx_state64 { + fn clone(&self) -> Self { + *self + } +} +impl ::core::fmt::Debug for __darwin_x86_avx_state64 { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + write ! ( f , "__darwin_x86_avx_state64 {{ __fpu_reserved: {:?}, __fpu_fcw: {:?}, __fpu_fsw: {:?}, __fpu_ftw: {:?}, __fpu_rsrv1: {:?}, __fpu_fop: {:?}, __fpu_ip: {:?}, __fpu_cs: {:?}, __fpu_rsrv2: {:?}, __fpu_dp: {:?}, __fpu_ds: {:?}, __fpu_rsrv3: {:?}, __fpu_mxcsr: {:?}, __fpu_mxcsrmask: {:?}, __fpu_stmm0: {:?}, __fpu_stmm1: {:?}, __fpu_stmm2: {:?}, __fpu_stmm3: {:?}, __fpu_stmm4: {:?}, __fpu_stmm5: {:?}, __fpu_stmm6: {:?}, __fpu_stmm7: {:?}, __fpu_xmm0: {:?}, __fpu_xmm1: {:?}, __fpu_xmm2: {:?}, __fpu_xmm3: {:?}, __fpu_xmm4: {:?}, __fpu_xmm5: {:?}, __fpu_xmm6: {:?}, __fpu_xmm7: {:?}, __fpu_xmm8: {:?}, __fpu_xmm9: {:?}, __fpu_xmm10: {:?}, __fpu_xmm11: {:?}, __fpu_xmm12: {:?}, __fpu_xmm13: {:?}, __fpu_xmm14: {:?}, __fpu_xmm15: {:?}, __fpu_rsrv4: [...], __fpu_reserved1: {:?}, __avx_reserved1: [...], __fpu_ymmh0: {:?}, __fpu_ymmh1: {:?}, __fpu_ymmh2: {:?}, __fpu_ymmh3: {:?}, __fpu_ymmh4: {:?}, __fpu_ymmh5: {:?}, __fpu_ymmh6: {:?}, __fpu_ymmh7: {:?}, __fpu_ymmh8: {:?}, __fpu_ymmh9: {:?}, __fpu_ymmh10: {:?}, __fpu_ymmh11: {:?}, __fpu_ymmh12: {:?}, __fpu_ymmh13: {:?}, __fpu_ymmh14: {:?}, __fpu_ymmh15: {:?} }}" , self . __fpu_reserved , self . __fpu_fcw , self . __fpu_fsw , self . __fpu_ftw , self . __fpu_rsrv1 , self . __fpu_fop , self . __fpu_ip , self . __fpu_cs , self . __fpu_rsrv2 , self . __fpu_dp , self . __fpu_ds , self . __fpu_rsrv3 , self . __fpu_mxcsr , self . __fpu_mxcsrmask , self . __fpu_stmm0 , self . __fpu_stmm1 , self . __fpu_stmm2 , self . __fpu_stmm3 , self . __fpu_stmm4 , self . __fpu_stmm5 , self . __fpu_stmm6 , self . __fpu_stmm7 , self . __fpu_xmm0 , self . __fpu_xmm1 , self . __fpu_xmm2 , self . __fpu_xmm3 , self . __fpu_xmm4 , self . __fpu_xmm5 , self . __fpu_xmm6 , self . __fpu_xmm7 , self . __fpu_xmm8 , self . __fpu_xmm9 , self . __fpu_xmm10 , self . __fpu_xmm11 , self . __fpu_xmm12 , self . __fpu_xmm13 , self . __fpu_xmm14 , self . __fpu_xmm15 , self . __fpu_reserved1 , self . __fpu_ymmh0 , self . __fpu_ymmh1 , self . __fpu_ymmh2 , self . __fpu_ymmh3 , self . __fpu_ymmh4 , self . __fpu_ymmh5 , self . __fpu_ymmh6 , self . __fpu_ymmh7 , self . __fpu_ymmh8 , self . __fpu_ymmh9 , self . __fpu_ymmh10 , self . __fpu_ymmh11 , self . __fpu_ymmh12 , self . __fpu_ymmh13 , self . __fpu_ymmh14 , self . __fpu_ymmh15 ) + } +} +#[repr(C)] +#[derive(Copy)] +pub struct __darwin_x86_avx512_state64 { + pub __fpu_reserved: [libc::c_int; 2usize], + pub __fpu_fcw: __darwin_fp_control, + pub __fpu_fsw: __darwin_fp_status, + pub __fpu_ftw: __uint8_t, + pub __fpu_rsrv1: __uint8_t, + pub __fpu_fop: __uint16_t, + pub __fpu_ip: __uint32_t, + pub __fpu_cs: __uint16_t, + pub __fpu_rsrv2: __uint16_t, + pub __fpu_dp: __uint32_t, + pub __fpu_ds: __uint16_t, + pub __fpu_rsrv3: __uint16_t, + pub __fpu_mxcsr: __uint32_t, + pub __fpu_mxcsrmask: __uint32_t, + pub __fpu_stmm0: __darwin_mmst_reg, + pub __fpu_stmm1: __darwin_mmst_reg, + pub __fpu_stmm2: __darwin_mmst_reg, + pub __fpu_stmm3: __darwin_mmst_reg, + pub __fpu_stmm4: __darwin_mmst_reg, + pub __fpu_stmm5: __darwin_mmst_reg, + pub __fpu_stmm6: __darwin_mmst_reg, + pub __fpu_stmm7: __darwin_mmst_reg, + pub __fpu_xmm0: __darwin_xmm_reg, + pub __fpu_xmm1: __darwin_xmm_reg, + pub __fpu_xmm2: __darwin_xmm_reg, + pub __fpu_xmm3: __darwin_xmm_reg, + pub __fpu_xmm4: __darwin_xmm_reg, + pub __fpu_xmm5: __darwin_xmm_reg, + pub __fpu_xmm6: __darwin_xmm_reg, + pub __fpu_xmm7: __darwin_xmm_reg, + pub __fpu_xmm8: __darwin_xmm_reg, + pub __fpu_xmm9: __darwin_xmm_reg, + pub __fpu_xmm10: __darwin_xmm_reg, + pub __fpu_xmm11: __darwin_xmm_reg, + pub __fpu_xmm12: __darwin_xmm_reg, + pub __fpu_xmm13: __darwin_xmm_reg, + pub __fpu_xmm14: __darwin_xmm_reg, + pub __fpu_xmm15: __darwin_xmm_reg, + pub __fpu_rsrv4: [libc::c_char; 96usize], + pub __fpu_reserved1: libc::c_int, + pub __avx_reserved1: [libc::c_char; 64usize], + pub __fpu_ymmh0: __darwin_xmm_reg, + pub __fpu_ymmh1: __darwin_xmm_reg, + pub __fpu_ymmh2: __darwin_xmm_reg, + pub __fpu_ymmh3: __darwin_xmm_reg, + pub __fpu_ymmh4: __darwin_xmm_reg, + pub __fpu_ymmh5: __darwin_xmm_reg, + pub __fpu_ymmh6: __darwin_xmm_reg, + pub __fpu_ymmh7: __darwin_xmm_reg, + pub __fpu_ymmh8: __darwin_xmm_reg, + pub __fpu_ymmh9: __darwin_xmm_reg, + pub __fpu_ymmh10: __darwin_xmm_reg, + pub __fpu_ymmh11: __darwin_xmm_reg, + pub __fpu_ymmh12: __darwin_xmm_reg, + pub __fpu_ymmh13: __darwin_xmm_reg, + pub __fpu_ymmh14: __darwin_xmm_reg, + pub __fpu_ymmh15: __darwin_xmm_reg, + pub __fpu_k0: __darwin_opmask_reg, + pub __fpu_k1: __darwin_opmask_reg, + pub __fpu_k2: __darwin_opmask_reg, + pub __fpu_k3: __darwin_opmask_reg, + pub __fpu_k4: __darwin_opmask_reg, + pub __fpu_k5: __darwin_opmask_reg, + pub __fpu_k6: __darwin_opmask_reg, + pub __fpu_k7: __darwin_opmask_reg, + pub __fpu_zmmh0: __darwin_ymm_reg, + pub __fpu_zmmh1: __darwin_ymm_reg, + pub __fpu_zmmh2: __darwin_ymm_reg, + pub __fpu_zmmh3: __darwin_ymm_reg, + pub __fpu_zmmh4: __darwin_ymm_reg, + pub __fpu_zmmh5: __darwin_ymm_reg, + pub __fpu_zmmh6: __darwin_ymm_reg, + pub __fpu_zmmh7: __darwin_ymm_reg, + pub __fpu_zmmh8: __darwin_ymm_reg, + pub __fpu_zmmh9: __darwin_ymm_reg, + pub __fpu_zmmh10: __darwin_ymm_reg, + pub __fpu_zmmh11: __darwin_ymm_reg, + pub __fpu_zmmh12: __darwin_ymm_reg, + pub __fpu_zmmh13: __darwin_ymm_reg, + pub __fpu_zmmh14: __darwin_ymm_reg, + pub __fpu_zmmh15: __darwin_ymm_reg, + pub __fpu_zmm16: __darwin_zmm_reg, + pub __fpu_zmm17: __darwin_zmm_reg, + pub __fpu_zmm18: __darwin_zmm_reg, + pub __fpu_zmm19: __darwin_zmm_reg, + pub __fpu_zmm20: __darwin_zmm_reg, + pub __fpu_zmm21: __darwin_zmm_reg, + pub __fpu_zmm22: __darwin_zmm_reg, + pub __fpu_zmm23: __darwin_zmm_reg, + pub __fpu_zmm24: __darwin_zmm_reg, + pub __fpu_zmm25: __darwin_zmm_reg, + pub __fpu_zmm26: __darwin_zmm_reg, + pub __fpu_zmm27: __darwin_zmm_reg, + pub __fpu_zmm28: __darwin_zmm_reg, + pub __fpu_zmm29: __darwin_zmm_reg, + pub __fpu_zmm30: __darwin_zmm_reg, + pub __fpu_zmm31: __darwin_zmm_reg, +} +#[test] +fn bindgen_test_layout___darwin_x86_avx512_state64() { + assert_eq!( + ::core::mem::size_of::<__darwin_x86_avx512_state64>(), + 2444usize, + concat!("Size of: ", stringify!(__darwin_x86_avx512_state64)) + ); + assert_eq!( + ::core::mem::align_of::<__darwin_x86_avx512_state64>(), + 4usize, + concat!("Alignment of ", stringify!(__darwin_x86_avx512_state64)) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_reserved as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_reserved) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_fcw as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_fcw) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_fsw as *const _ as usize + }, + 10usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_fsw) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_ftw as *const _ as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_ftw) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_rsrv1 as *const _ + as usize + }, + 13usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_rsrv1) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_fop as *const _ as usize + }, + 14usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_fop) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_ip as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_ip) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_cs as *const _ as usize + }, + 20usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_cs) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_rsrv2 as *const _ + as usize + }, + 22usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_rsrv2) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_dp as *const _ as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_dp) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_ds as *const _ as usize + }, + 28usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_ds) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_rsrv3 as *const _ + as usize + }, + 30usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_rsrv3) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_mxcsr as *const _ + as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_mxcsr) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_mxcsrmask as *const _ + as usize + }, + 36usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_mxcsrmask) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_stmm0 as *const _ + as usize + }, + 40usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_stmm0) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_stmm1 as *const _ + as usize + }, + 56usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_stmm1) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_stmm2 as *const _ + as usize + }, + 72usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_stmm2) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_stmm3 as *const _ + as usize + }, + 88usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_stmm3) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_stmm4 as *const _ + as usize + }, + 104usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_stmm4) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_stmm5 as *const _ + as usize + }, + 120usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_stmm5) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_stmm6 as *const _ + as usize + }, + 136usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_stmm6) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_stmm7 as *const _ + as usize + }, + 152usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_stmm7) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_xmm0 as *const _ as usize + }, + 168usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_xmm0) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_xmm1 as *const _ as usize + }, + 184usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_xmm1) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_xmm2 as *const _ as usize + }, + 200usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_xmm2) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_xmm3 as *const _ as usize + }, + 216usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_xmm3) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_xmm4 as *const _ as usize + }, + 232usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_xmm4) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_xmm5 as *const _ as usize + }, + 248usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_xmm5) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_xmm6 as *const _ as usize + }, + 264usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_xmm6) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_xmm7 as *const _ as usize + }, + 280usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_xmm7) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_xmm8 as *const _ as usize + }, + 296usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_xmm8) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_xmm9 as *const _ as usize + }, + 312usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_xmm9) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_xmm10 as *const _ + as usize + }, + 328usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_xmm10) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_xmm11 as *const _ + as usize + }, + 344usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_xmm11) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_xmm12 as *const _ + as usize + }, + 360usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_xmm12) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_xmm13 as *const _ + as usize + }, + 376usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_xmm13) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_xmm14 as *const _ + as usize + }, + 392usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_xmm14) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_xmm15 as *const _ + as usize + }, + 408usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_xmm15) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_rsrv4 as *const _ + as usize + }, + 424usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_rsrv4) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_reserved1 as *const _ + as usize + }, + 520usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_reserved1) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__avx_reserved1 as *const _ + as usize + }, + 524usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__avx_reserved1) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_ymmh0 as *const _ + as usize + }, + 588usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_ymmh0) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_ymmh1 as *const _ + as usize + }, + 604usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_ymmh1) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_ymmh2 as *const _ + as usize + }, + 620usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_ymmh2) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_ymmh3 as *const _ + as usize + }, + 636usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_ymmh3) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_ymmh4 as *const _ + as usize + }, + 652usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_ymmh4) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_ymmh5 as *const _ + as usize + }, + 668usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_ymmh5) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_ymmh6 as *const _ + as usize + }, + 684usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_ymmh6) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_ymmh7 as *const _ + as usize + }, + 700usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_ymmh7) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_ymmh8 as *const _ + as usize + }, + 716usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_ymmh8) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_ymmh9 as *const _ + as usize + }, + 732usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_ymmh9) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_ymmh10 as *const _ + as usize + }, + 748usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_ymmh10) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_ymmh11 as *const _ + as usize + }, + 764usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_ymmh11) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_ymmh12 as *const _ + as usize + }, + 780usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_ymmh12) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_ymmh13 as *const _ + as usize + }, + 796usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_ymmh13) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_ymmh14 as *const _ + as usize + }, + 812usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_ymmh14) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_ymmh15 as *const _ + as usize + }, + 828usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_ymmh15) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_k0 as *const _ as usize + }, + 844usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_k0) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_k1 as *const _ as usize + }, + 852usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_k1) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_k2 as *const _ as usize + }, + 860usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_k2) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_k3 as *const _ as usize + }, + 868usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_k3) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_k4 as *const _ as usize + }, + 876usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_k4) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_k5 as *const _ as usize + }, + 884usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_k5) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_k6 as *const _ as usize + }, + 892usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_k6) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_k7 as *const _ as usize + }, + 900usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_k7) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_zmmh0 as *const _ + as usize + }, + 908usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_zmmh0) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_zmmh1 as *const _ + as usize + }, + 940usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_zmmh1) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_zmmh2 as *const _ + as usize + }, + 972usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_zmmh2) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_zmmh3 as *const _ + as usize + }, + 1004usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_zmmh3) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_zmmh4 as *const _ + as usize + }, + 1036usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_zmmh4) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_zmmh5 as *const _ + as usize + }, + 1068usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_zmmh5) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_zmmh6 as *const _ + as usize + }, + 1100usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_zmmh6) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_zmmh7 as *const _ + as usize + }, + 1132usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_zmmh7) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_zmmh8 as *const _ + as usize + }, + 1164usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_zmmh8) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_zmmh9 as *const _ + as usize + }, + 1196usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_zmmh9) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_zmmh10 as *const _ + as usize + }, + 1228usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_zmmh10) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_zmmh11 as *const _ + as usize + }, + 1260usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_zmmh11) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_zmmh12 as *const _ + as usize + }, + 1292usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_zmmh12) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_zmmh13 as *const _ + as usize + }, + 1324usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_zmmh13) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_zmmh14 as *const _ + as usize + }, + 1356usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_zmmh14) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_zmmh15 as *const _ + as usize + }, + 1388usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_zmmh15) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_zmm16 as *const _ + as usize + }, + 1420usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_zmm16) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_zmm17 as *const _ + as usize + }, + 1484usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_zmm17) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_zmm18 as *const _ + as usize + }, + 1548usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_zmm18) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_zmm19 as *const _ + as usize + }, + 1612usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_zmm19) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_zmm20 as *const _ + as usize + }, + 1676usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_zmm20) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_zmm21 as *const _ + as usize + }, + 1740usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_zmm21) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_zmm22 as *const _ + as usize + }, + 1804usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_zmm22) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_zmm23 as *const _ + as usize + }, + 1868usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_zmm23) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_zmm24 as *const _ + as usize + }, + 1932usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_zmm24) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_zmm25 as *const _ + as usize + }, + 1996usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_zmm25) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_zmm26 as *const _ + as usize + }, + 2060usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_zmm26) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_zmm27 as *const _ + as usize + }, + 2124usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_zmm27) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_zmm28 as *const _ + as usize + }, + 2188usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_zmm28) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_zmm29 as *const _ + as usize + }, + 2252usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_zmm29) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_zmm30 as *const _ + as usize + }, + 2316usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_zmm30) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_avx512_state64>())).__fpu_zmm31 as *const _ + as usize + }, + 2380usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_avx512_state64), + "::", + stringify!(__fpu_zmm31) + ) + ); +} +impl Clone for __darwin_x86_avx512_state64 { + fn clone(&self) -> Self { + *self + } +} +impl ::core::fmt::Debug for __darwin_x86_avx512_state64 { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + write ! ( f , "__darwin_x86_avx512_state64 {{ __fpu_reserved: {:?}, __fpu_fcw: {:?}, __fpu_fsw: {:?}, __fpu_ftw: {:?}, __fpu_rsrv1: {:?}, __fpu_fop: {:?}, __fpu_ip: {:?}, __fpu_cs: {:?}, __fpu_rsrv2: {:?}, __fpu_dp: {:?}, __fpu_ds: {:?}, __fpu_rsrv3: {:?}, __fpu_mxcsr: {:?}, __fpu_mxcsrmask: {:?}, __fpu_stmm0: {:?}, __fpu_stmm1: {:?}, __fpu_stmm2: {:?}, __fpu_stmm3: {:?}, __fpu_stmm4: {:?}, __fpu_stmm5: {:?}, __fpu_stmm6: {:?}, __fpu_stmm7: {:?}, __fpu_xmm0: {:?}, __fpu_xmm1: {:?}, __fpu_xmm2: {:?}, __fpu_xmm3: {:?}, __fpu_xmm4: {:?}, __fpu_xmm5: {:?}, __fpu_xmm6: {:?}, __fpu_xmm7: {:?}, __fpu_xmm8: {:?}, __fpu_xmm9: {:?}, __fpu_xmm10: {:?}, __fpu_xmm11: {:?}, __fpu_xmm12: {:?}, __fpu_xmm13: {:?}, __fpu_xmm14: {:?}, __fpu_xmm15: {:?}, __fpu_rsrv4: [...], __fpu_reserved1: {:?}, __avx_reserved1: [...], __fpu_ymmh0: {:?}, __fpu_ymmh1: {:?}, __fpu_ymmh2: {:?}, __fpu_ymmh3: {:?}, __fpu_ymmh4: {:?}, __fpu_ymmh5: {:?}, __fpu_ymmh6: {:?}, __fpu_ymmh7: {:?}, __fpu_ymmh8: {:?}, __fpu_ymmh9: {:?}, __fpu_ymmh10: {:?}, __fpu_ymmh11: {:?}, __fpu_ymmh12: {:?}, __fpu_ymmh13: {:?}, __fpu_ymmh14: {:?}, __fpu_ymmh15: {:?}, __fpu_k0: {:?}, __fpu_k1: {:?}, __fpu_k2: {:?}, __fpu_k3: {:?}, __fpu_k4: {:?}, __fpu_k5: {:?}, __fpu_k6: {:?}, __fpu_k7: {:?}, __fpu_zmmh0: {:?}, __fpu_zmmh1: {:?}, __fpu_zmmh2: {:?}, __fpu_zmmh3: {:?}, __fpu_zmmh4: {:?}, __fpu_zmmh5: {:?}, __fpu_zmmh6: {:?}, __fpu_zmmh7: {:?}, __fpu_zmmh8: {:?}, __fpu_zmmh9: {:?}, __fpu_zmmh10: {:?}, __fpu_zmmh11: {:?}, __fpu_zmmh12: {:?}, __fpu_zmmh13: {:?}, __fpu_zmmh14: {:?}, __fpu_zmmh15: {:?}, __fpu_zmm16: {:?}, __fpu_zmm17: {:?}, __fpu_zmm18: {:?}, __fpu_zmm19: {:?}, __fpu_zmm20: {:?}, __fpu_zmm21: {:?}, __fpu_zmm22: {:?}, __fpu_zmm23: {:?}, __fpu_zmm24: {:?}, __fpu_zmm25: {:?}, __fpu_zmm26: {:?}, __fpu_zmm27: {:?}, __fpu_zmm28: {:?}, __fpu_zmm29: {:?}, __fpu_zmm30: {:?}, __fpu_zmm31: {:?} }}" , self . __fpu_reserved , self . __fpu_fcw , self . __fpu_fsw , self . __fpu_ftw , self . __fpu_rsrv1 , self . __fpu_fop , self . __fpu_ip , self . __fpu_cs , self . __fpu_rsrv2 , self . __fpu_dp , self . __fpu_ds , self . __fpu_rsrv3 , self . __fpu_mxcsr , self . __fpu_mxcsrmask , self . __fpu_stmm0 , self . __fpu_stmm1 , self . __fpu_stmm2 , self . __fpu_stmm3 , self . __fpu_stmm4 , self . __fpu_stmm5 , self . __fpu_stmm6 , self . __fpu_stmm7 , self . __fpu_xmm0 , self . __fpu_xmm1 , self . __fpu_xmm2 , self . __fpu_xmm3 , self . __fpu_xmm4 , self . __fpu_xmm5 , self . __fpu_xmm6 , self . __fpu_xmm7 , self . __fpu_xmm8 , self . __fpu_xmm9 , self . __fpu_xmm10 , self . __fpu_xmm11 , self . __fpu_xmm12 , self . __fpu_xmm13 , self . __fpu_xmm14 , self . __fpu_xmm15 , self . __fpu_reserved1 , self . __fpu_ymmh0 , self . __fpu_ymmh1 , self . __fpu_ymmh2 , self . __fpu_ymmh3 , self . __fpu_ymmh4 , self . __fpu_ymmh5 , self . __fpu_ymmh6 , self . __fpu_ymmh7 , self . __fpu_ymmh8 , self . __fpu_ymmh9 , self . __fpu_ymmh10 , self . __fpu_ymmh11 , self . __fpu_ymmh12 , self . __fpu_ymmh13 , self . __fpu_ymmh14 , self . __fpu_ymmh15 , self . __fpu_k0 , self . __fpu_k1 , self . __fpu_k2 , self . __fpu_k3 , self . __fpu_k4 , self . __fpu_k5 , self . __fpu_k6 , self . __fpu_k7 , self . __fpu_zmmh0 , self . __fpu_zmmh1 , self . __fpu_zmmh2 , self . __fpu_zmmh3 , self . __fpu_zmmh4 , self . __fpu_zmmh5 , self . __fpu_zmmh6 , self . __fpu_zmmh7 , self . __fpu_zmmh8 , self . __fpu_zmmh9 , self . __fpu_zmmh10 , self . __fpu_zmmh11 , self . __fpu_zmmh12 , self . __fpu_zmmh13 , self . __fpu_zmmh14 , self . __fpu_zmmh15 , self . __fpu_zmm16 , self . __fpu_zmm17 , self . __fpu_zmm18 , self . __fpu_zmm19 , self . __fpu_zmm20 , self . __fpu_zmm21 , self . __fpu_zmm22 , self . __fpu_zmm23 , self . __fpu_zmm24 , self . __fpu_zmm25 , self . __fpu_zmm26 , self . __fpu_zmm27 , self . __fpu_zmm28 , self . __fpu_zmm29 , self . __fpu_zmm30 , self . __fpu_zmm31 ) + } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct __darwin_x86_exception_state64 { + pub __trapno: __uint16_t, + pub __cpu: __uint16_t, + pub __err: __uint32_t, + pub __faultvaddr: __uint64_t, +} +#[test] +fn bindgen_test_layout___darwin_x86_exception_state64() { + assert_eq!( + ::core::mem::size_of::<__darwin_x86_exception_state64>(), + 16usize, + concat!("Size of: ", stringify!(__darwin_x86_exception_state64)) + ); + assert_eq!( + ::core::mem::align_of::<__darwin_x86_exception_state64>(), + 8usize, + concat!("Alignment of ", stringify!(__darwin_x86_exception_state64)) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_exception_state64>())).__trapno as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_exception_state64), + "::", + stringify!(__trapno) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_exception_state64>())).__cpu as *const _ as usize + }, + 2usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_exception_state64), + "::", + stringify!(__cpu) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_exception_state64>())).__err as *const _ as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_exception_state64), + "::", + stringify!(__err) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_exception_state64>())).__faultvaddr as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_exception_state64), + "::", + stringify!(__faultvaddr) + ) + ); +} +impl Clone for __darwin_x86_exception_state64 { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct __darwin_x86_debug_state64 { + pub __dr0: __uint64_t, + pub __dr1: __uint64_t, + pub __dr2: __uint64_t, + pub __dr3: __uint64_t, + pub __dr4: __uint64_t, + pub __dr5: __uint64_t, + pub __dr6: __uint64_t, + pub __dr7: __uint64_t, +} +#[test] +fn bindgen_test_layout___darwin_x86_debug_state64() { + assert_eq!( + ::core::mem::size_of::<__darwin_x86_debug_state64>(), + 64usize, + concat!("Size of: ", stringify!(__darwin_x86_debug_state64)) + ); + assert_eq!( + ::core::mem::align_of::<__darwin_x86_debug_state64>(), + 8usize, + concat!("Alignment of ", stringify!(__darwin_x86_debug_state64)) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_debug_state64>())).__dr0 as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_debug_state64), + "::", + stringify!(__dr0) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_debug_state64>())).__dr1 as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_debug_state64), + "::", + stringify!(__dr1) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_debug_state64>())).__dr2 as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_debug_state64), + "::", + stringify!(__dr2) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_debug_state64>())).__dr3 as *const _ as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_debug_state64), + "::", + stringify!(__dr3) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_debug_state64>())).__dr4 as *const _ as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_debug_state64), + "::", + stringify!(__dr4) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_debug_state64>())).__dr5 as *const _ as usize + }, + 40usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_debug_state64), + "::", + stringify!(__dr5) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_debug_state64>())).__dr6 as *const _ as usize + }, + 48usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_debug_state64), + "::", + stringify!(__dr6) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_debug_state64>())).__dr7 as *const _ as usize + }, + 56usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_debug_state64), + "::", + stringify!(__dr7) + ) + ); +} +impl Clone for __darwin_x86_debug_state64 { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct __darwin_x86_cpmu_state64 { + pub __ctrs: [__uint64_t; 16usize], +} +#[test] +fn bindgen_test_layout___darwin_x86_cpmu_state64() { + assert_eq!( + ::core::mem::size_of::<__darwin_x86_cpmu_state64>(), + 128usize, + concat!("Size of: ", stringify!(__darwin_x86_cpmu_state64)) + ); + assert_eq!( + ::core::mem::align_of::<__darwin_x86_cpmu_state64>(), + 8usize, + concat!("Alignment of ", stringify!(__darwin_x86_cpmu_state64)) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_x86_cpmu_state64>())).__ctrs as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__darwin_x86_cpmu_state64), + "::", + stringify!(__ctrs) + ) + ); +} +impl Clone for __darwin_x86_cpmu_state64 { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +#[derive(Copy)] +pub struct __darwin_mcontext32 { + pub __es: __darwin_i386_exception_state, + pub __ss: __darwin_i386_thread_state, + pub __fs: __darwin_i386_float_state, +} +#[test] +fn bindgen_test_layout___darwin_mcontext32() { + assert_eq!( + ::core::mem::size_of::<__darwin_mcontext32>(), + 600usize, + concat!("Size of: ", stringify!(__darwin_mcontext32)) + ); + assert_eq!( + ::core::mem::align_of::<__darwin_mcontext32>(), + 4usize, + concat!("Alignment of ", stringify!(__darwin_mcontext32)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__darwin_mcontext32>())).__es as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__darwin_mcontext32), + "::", + stringify!(__es) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__darwin_mcontext32>())).__ss as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(__darwin_mcontext32), + "::", + stringify!(__ss) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__darwin_mcontext32>())).__fs as *const _ as usize }, + 76usize, + concat!( + "Offset of field: ", + stringify!(__darwin_mcontext32), + "::", + stringify!(__fs) + ) + ); +} +impl Clone for __darwin_mcontext32 { + fn clone(&self) -> Self { + *self + } +} +impl ::core::fmt::Debug for __darwin_mcontext32 { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + write!( + f, + "__darwin_mcontext32 {{ __es: {:?}, __ss: {:?}, __fs: {:?} }}", + self.__es, self.__ss, self.__fs + ) + } +} +#[repr(C)] +#[derive(Copy)] +pub struct __darwin_mcontext_avx32 { + pub __es: __darwin_i386_exception_state, + pub __ss: __darwin_i386_thread_state, + pub __fs: __darwin_i386_avx_state, +} +#[test] +fn bindgen_test_layout___darwin_mcontext_avx32() { + assert_eq!( + ::core::mem::size_of::<__darwin_mcontext_avx32>(), + 792usize, + concat!("Size of: ", stringify!(__darwin_mcontext_avx32)) + ); + assert_eq!( + ::core::mem::align_of::<__darwin_mcontext_avx32>(), + 4usize, + concat!("Alignment of ", stringify!(__darwin_mcontext_avx32)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__darwin_mcontext_avx32>())).__es as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__darwin_mcontext_avx32), + "::", + stringify!(__es) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__darwin_mcontext_avx32>())).__ss as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(__darwin_mcontext_avx32), + "::", + stringify!(__ss) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__darwin_mcontext_avx32>())).__fs as *const _ as usize }, + 76usize, + concat!( + "Offset of field: ", + stringify!(__darwin_mcontext_avx32), + "::", + stringify!(__fs) + ) + ); +} +impl Clone for __darwin_mcontext_avx32 { + fn clone(&self) -> Self { + *self + } +} +impl ::core::fmt::Debug for __darwin_mcontext_avx32 { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + write!( + f, + "__darwin_mcontext_avx32 {{ __es: {:?}, __ss: {:?}, __fs: {:?} }}", + self.__es, self.__ss, self.__fs + ) + } +} +#[repr(C)] +#[derive(Copy)] +pub struct __darwin_mcontext_avx512_32 { + pub __es: __darwin_i386_exception_state, + pub __ss: __darwin_i386_thread_state, + pub __fs: __darwin_i386_avx512_state, +} +#[test] +fn bindgen_test_layout___darwin_mcontext_avx512_32() { + assert_eq!( + ::core::mem::size_of::<__darwin_mcontext_avx512_32>(), + 1112usize, + concat!("Size of: ", stringify!(__darwin_mcontext_avx512_32)) + ); + assert_eq!( + ::core::mem::align_of::<__darwin_mcontext_avx512_32>(), + 4usize, + concat!("Alignment of ", stringify!(__darwin_mcontext_avx512_32)) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_mcontext_avx512_32>())).__es as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__darwin_mcontext_avx512_32), + "::", + stringify!(__es) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_mcontext_avx512_32>())).__ss as *const _ as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(__darwin_mcontext_avx512_32), + "::", + stringify!(__ss) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_mcontext_avx512_32>())).__fs as *const _ as usize + }, + 76usize, + concat!( + "Offset of field: ", + stringify!(__darwin_mcontext_avx512_32), + "::", + stringify!(__fs) + ) + ); +} +impl Clone for __darwin_mcontext_avx512_32 { + fn clone(&self) -> Self { + *self + } +} +impl ::core::fmt::Debug for __darwin_mcontext_avx512_32 { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + write!( + f, + "__darwin_mcontext_avx512_32 {{ __es: {:?}, __ss: {:?}, __fs: {:?} }}", + self.__es, self.__ss, self.__fs + ) + } +} +#[repr(C)] +#[derive(Copy)] +pub struct __darwin_mcontext64 { + pub __es: __darwin_x86_exception_state64, + pub __ss: __darwin_x86_thread_state64, + pub __fs: __darwin_x86_float_state64, +} +#[test] +fn bindgen_test_layout___darwin_mcontext64() { + assert_eq!( + ::core::mem::size_of::<__darwin_mcontext64>(), + 712usize, + concat!("Size of: ", stringify!(__darwin_mcontext64)) + ); + assert_eq!( + ::core::mem::align_of::<__darwin_mcontext64>(), + 8usize, + concat!("Alignment of ", stringify!(__darwin_mcontext64)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__darwin_mcontext64>())).__es as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__darwin_mcontext64), + "::", + stringify!(__es) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__darwin_mcontext64>())).__ss as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(__darwin_mcontext64), + "::", + stringify!(__ss) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__darwin_mcontext64>())).__fs as *const _ as usize }, + 184usize, + concat!( + "Offset of field: ", + stringify!(__darwin_mcontext64), + "::", + stringify!(__fs) + ) + ); +} +impl Clone for __darwin_mcontext64 { + fn clone(&self) -> Self { + *self + } +} +impl ::core::fmt::Debug for __darwin_mcontext64 { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + write!( + f, + "__darwin_mcontext64 {{ __es: {:?}, __ss: {:?}, __fs: {:?} }}", + self.__es, self.__ss, self.__fs + ) + } +} +#[repr(C)] +#[derive(Copy)] +pub struct __darwin_mcontext64_full { + pub __es: __darwin_x86_exception_state64, + pub __ss: __darwin_x86_thread_full_state64, + pub __fs: __darwin_x86_float_state64, +} +#[test] +fn bindgen_test_layout___darwin_mcontext64_full() { + assert_eq!( + ::core::mem::size_of::<__darwin_mcontext64_full>(), + 744usize, + concat!("Size of: ", stringify!(__darwin_mcontext64_full)) + ); + assert_eq!( + ::core::mem::align_of::<__darwin_mcontext64_full>(), + 8usize, + concat!("Alignment of ", stringify!(__darwin_mcontext64_full)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__darwin_mcontext64_full>())).__es as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__darwin_mcontext64_full), + "::", + stringify!(__es) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__darwin_mcontext64_full>())).__ss as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(__darwin_mcontext64_full), + "::", + stringify!(__ss) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__darwin_mcontext64_full>())).__fs as *const _ as usize }, + 216usize, + concat!( + "Offset of field: ", + stringify!(__darwin_mcontext64_full), + "::", + stringify!(__fs) + ) + ); +} +impl Clone for __darwin_mcontext64_full { + fn clone(&self) -> Self { + *self + } +} +impl ::core::fmt::Debug for __darwin_mcontext64_full { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + write!( + f, + "__darwin_mcontext64_full {{ __es: {:?}, __ss: {:?}, __fs: {:?} }}", + self.__es, self.__ss, self.__fs + ) + } +} +#[repr(C)] +#[derive(Copy)] +pub struct __darwin_mcontext_avx64 { + pub __es: __darwin_x86_exception_state64, + pub __ss: __darwin_x86_thread_state64, + pub __fs: __darwin_x86_avx_state64, +} +#[test] +fn bindgen_test_layout___darwin_mcontext_avx64() { + assert_eq!( + ::core::mem::size_of::<__darwin_mcontext_avx64>(), + 1032usize, + concat!("Size of: ", stringify!(__darwin_mcontext_avx64)) + ); + assert_eq!( + ::core::mem::align_of::<__darwin_mcontext_avx64>(), + 8usize, + concat!("Alignment of ", stringify!(__darwin_mcontext_avx64)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__darwin_mcontext_avx64>())).__es as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__darwin_mcontext_avx64), + "::", + stringify!(__es) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__darwin_mcontext_avx64>())).__ss as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(__darwin_mcontext_avx64), + "::", + stringify!(__ss) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__darwin_mcontext_avx64>())).__fs as *const _ as usize }, + 184usize, + concat!( + "Offset of field: ", + stringify!(__darwin_mcontext_avx64), + "::", + stringify!(__fs) + ) + ); +} +impl Clone for __darwin_mcontext_avx64 { + fn clone(&self) -> Self { + *self + } +} +impl ::core::fmt::Debug for __darwin_mcontext_avx64 { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + write!( + f, + "__darwin_mcontext_avx64 {{ __es: {:?}, __ss: {:?}, __fs: {:?} }}", + self.__es, self.__ss, self.__fs + ) + } +} +#[repr(C)] +#[derive(Copy)] +pub struct __darwin_mcontext_avx64_full { + pub __es: __darwin_x86_exception_state64, + pub __ss: __darwin_x86_thread_full_state64, + pub __fs: __darwin_x86_avx_state64, +} +#[test] +fn bindgen_test_layout___darwin_mcontext_avx64_full() { + assert_eq!( + ::core::mem::size_of::<__darwin_mcontext_avx64_full>(), + 1064usize, + concat!("Size of: ", stringify!(__darwin_mcontext_avx64_full)) + ); + assert_eq!( + ::core::mem::align_of::<__darwin_mcontext_avx64_full>(), + 8usize, + concat!("Alignment of ", stringify!(__darwin_mcontext_avx64_full)) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_mcontext_avx64_full>())).__es as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__darwin_mcontext_avx64_full), + "::", + stringify!(__es) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_mcontext_avx64_full>())).__ss as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(__darwin_mcontext_avx64_full), + "::", + stringify!(__ss) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_mcontext_avx64_full>())).__fs as *const _ as usize + }, + 216usize, + concat!( + "Offset of field: ", + stringify!(__darwin_mcontext_avx64_full), + "::", + stringify!(__fs) + ) + ); +} +impl Clone for __darwin_mcontext_avx64_full { + fn clone(&self) -> Self { + *self + } +} +impl ::core::fmt::Debug for __darwin_mcontext_avx64_full { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + write!( + f, + "__darwin_mcontext_avx64_full {{ __es: {:?}, __ss: {:?}, __fs: {:?} }}", + self.__es, self.__ss, self.__fs + ) + } +} +#[repr(C)] +#[derive(Copy)] +pub struct __darwin_mcontext_avx512_64 { + pub __es: __darwin_x86_exception_state64, + pub __ss: __darwin_x86_thread_state64, + pub __fs: __darwin_x86_avx512_state64, +} +#[test] +fn bindgen_test_layout___darwin_mcontext_avx512_64() { + assert_eq!( + ::core::mem::size_of::<__darwin_mcontext_avx512_64>(), + 2632usize, + concat!("Size of: ", stringify!(__darwin_mcontext_avx512_64)) + ); + assert_eq!( + ::core::mem::align_of::<__darwin_mcontext_avx512_64>(), + 8usize, + concat!("Alignment of ", stringify!(__darwin_mcontext_avx512_64)) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_mcontext_avx512_64>())).__es as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__darwin_mcontext_avx512_64), + "::", + stringify!(__es) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_mcontext_avx512_64>())).__ss as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(__darwin_mcontext_avx512_64), + "::", + stringify!(__ss) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_mcontext_avx512_64>())).__fs as *const _ as usize + }, + 184usize, + concat!( + "Offset of field: ", + stringify!(__darwin_mcontext_avx512_64), + "::", + stringify!(__fs) + ) + ); +} +impl Clone for __darwin_mcontext_avx512_64 { + fn clone(&self) -> Self { + *self + } +} +impl ::core::fmt::Debug for __darwin_mcontext_avx512_64 { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + write!( + f, + "__darwin_mcontext_avx512_64 {{ __es: {:?}, __ss: {:?}, __fs: {:?} }}", + self.__es, self.__ss, self.__fs + ) + } +} +#[repr(C)] +#[derive(Copy)] +pub struct __darwin_mcontext_avx512_64_full { + pub __es: __darwin_x86_exception_state64, + pub __ss: __darwin_x86_thread_full_state64, + pub __fs: __darwin_x86_avx512_state64, +} +#[test] +fn bindgen_test_layout___darwin_mcontext_avx512_64_full() { + assert_eq!( + ::core::mem::size_of::<__darwin_mcontext_avx512_64_full>(), + 2664usize, + concat!("Size of: ", stringify!(__darwin_mcontext_avx512_64_full)) + ); + assert_eq!( + ::core::mem::align_of::<__darwin_mcontext_avx512_64_full>(), + 8usize, + concat!( + "Alignment of ", + stringify!(__darwin_mcontext_avx512_64_full) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_mcontext_avx512_64_full>())).__es as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__darwin_mcontext_avx512_64_full), + "::", + stringify!(__es) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_mcontext_avx512_64_full>())).__ss as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(__darwin_mcontext_avx512_64_full), + "::", + stringify!(__ss) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__darwin_mcontext_avx512_64_full>())).__fs as *const _ as usize + }, + 216usize, + concat!( + "Offset of field: ", + stringify!(__darwin_mcontext_avx512_64_full), + "::", + stringify!(__fs) + ) + ); +} +impl Clone for __darwin_mcontext_avx512_64_full { + fn clone(&self) -> Self { + *self + } +} +impl ::core::fmt::Debug for __darwin_mcontext_avx512_64_full { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + write!( + f, + "__darwin_mcontext_avx512_64_full {{ __es: {:?}, __ss: {:?}, __fs: {:?} }}", + self.__es, self.__ss, self.__fs + ) + } +} +pub type mcontext_t = *mut __darwin_mcontext64; +pub type pthread_attr_t = __darwin_pthread_attr_t; +#[repr(C)] +#[derive(Debug, Copy)] +pub struct __darwin_sigaltstack { + pub ss_sp: *mut libc::c_void, + pub ss_size: __darwin_size_t, + pub ss_flags: libc::c_int, +} +#[test] +fn bindgen_test_layout___darwin_sigaltstack() { + assert_eq!( + ::core::mem::size_of::<__darwin_sigaltstack>(), + 24usize, + concat!("Size of: ", stringify!(__darwin_sigaltstack)) + ); + assert_eq!( + ::core::mem::align_of::<__darwin_sigaltstack>(), + 8usize, + concat!("Alignment of ", stringify!(__darwin_sigaltstack)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__darwin_sigaltstack>())).ss_sp as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__darwin_sigaltstack), + "::", + stringify!(ss_sp) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__darwin_sigaltstack>())).ss_size as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(__darwin_sigaltstack), + "::", + stringify!(ss_size) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__darwin_sigaltstack>())).ss_flags as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(__darwin_sigaltstack), + "::", + stringify!(ss_flags) + ) + ); +} +impl Clone for __darwin_sigaltstack { + fn clone(&self) -> Self { + *self + } +} +pub type stack_t = __darwin_sigaltstack; +#[repr(C)] +#[derive(Debug, Copy)] +pub struct __darwin_ucontext { + pub uc_onstack: libc::c_int, + pub uc_sigmask: __darwin_sigset_t, + pub uc_stack: __darwin_sigaltstack, + pub uc_link: *mut __darwin_ucontext, + pub uc_mcsize: __darwin_size_t, + pub uc_mcontext: *mut __darwin_mcontext64, +} +#[test] +fn bindgen_test_layout___darwin_ucontext() { + assert_eq!( + ::core::mem::size_of::<__darwin_ucontext>(), + 56usize, + concat!("Size of: ", stringify!(__darwin_ucontext)) + ); + assert_eq!( + ::core::mem::align_of::<__darwin_ucontext>(), + 8usize, + concat!("Alignment of ", stringify!(__darwin_ucontext)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__darwin_ucontext>())).uc_onstack as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__darwin_ucontext), + "::", + stringify!(uc_onstack) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__darwin_ucontext>())).uc_sigmask as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(__darwin_ucontext), + "::", + stringify!(uc_sigmask) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__darwin_ucontext>())).uc_stack as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(__darwin_ucontext), + "::", + stringify!(uc_stack) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__darwin_ucontext>())).uc_link as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(__darwin_ucontext), + "::", + stringify!(uc_link) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__darwin_ucontext>())).uc_mcsize as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(__darwin_ucontext), + "::", + stringify!(uc_mcsize) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__darwin_ucontext>())).uc_mcontext as *const _ as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(__darwin_ucontext), + "::", + stringify!(uc_mcontext) + ) + ); +} +impl Clone for __darwin_ucontext { + fn clone(&self) -> Self { + *self + } +} +pub type ucontext_t = __darwin_ucontext; +pub type sigset_t = __darwin_sigset_t; +pub type uid_t = __darwin_uid_t; +#[repr(C)] +#[derive(Copy)] +pub union sigval { + pub sival_int: libc::c_int, + pub sival_ptr: *mut libc::c_void, + _bindgen_union_align: u64, +} +#[test] +fn bindgen_test_layout_sigval() { + assert_eq!( + ::core::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(sigval)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(sigval)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).sival_int as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(sigval), + "::", + stringify!(sival_int) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).sival_ptr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(sigval), + "::", + stringify!(sival_ptr) + ) + ); +} +impl Clone for sigval { + fn clone(&self) -> Self { + *self + } +} +impl ::core::fmt::Debug for sigval { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + write!(f, "sigval {{ union }}") + } +} +#[repr(C)] +#[derive(Copy)] +pub struct sigevent { + pub sigev_notify: libc::c_int, + pub sigev_signo: libc::c_int, + pub sigev_value: sigval, + pub sigev_notify_function: ::core::option::Option, + pub sigev_notify_attributes: *mut pthread_attr_t, +} +#[test] +fn bindgen_test_layout_sigevent() { + assert_eq!( + ::core::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(sigevent)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(sigevent)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).sigev_notify as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(sigevent), + "::", + stringify!(sigev_notify) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).sigev_signo as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(sigevent), + "::", + stringify!(sigev_signo) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).sigev_value as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(sigevent), + "::", + stringify!(sigev_value) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).sigev_notify_function as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(sigevent), + "::", + stringify!(sigev_notify_function) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).sigev_notify_attributes as *const _ as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(sigevent), + "::", + stringify!(sigev_notify_attributes) + ) + ); +} +impl Clone for sigevent { + fn clone(&self) -> Self { + *self + } +} +impl ::core::fmt::Debug for sigevent { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + write ! ( f , "sigevent {{ sigev_notify: {:?}, sigev_signo: {:?}, sigev_value: {:?}, sigev_notify_function: {:?}, sigev_notify_attributes: {:?} }}" , self . sigev_notify , self . sigev_signo , self . sigev_value , self . sigev_notify_function , self . sigev_notify_attributes ) + } +} +#[repr(C)] +#[derive(Copy)] +pub struct __siginfo { + pub si_signo: libc::c_int, + pub si_errno: libc::c_int, + pub si_code: libc::c_int, + pub si_pid: pid_t, + pub si_uid: uid_t, + pub si_status: libc::c_int, + pub si_addr: *mut libc::c_void, + pub si_value: sigval, + pub si_band: libc::c_long, + pub __pad: [libc::c_ulong; 7usize], +} +#[test] +fn bindgen_test_layout___siginfo() { + assert_eq!( + ::core::mem::size_of::<__siginfo>(), + 104usize, + concat!("Size of: ", stringify!(__siginfo)) + ); + assert_eq!( + ::core::mem::align_of::<__siginfo>(), + 8usize, + concat!("Alignment of ", stringify!(__siginfo)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__siginfo>())).si_signo as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__siginfo), + "::", + stringify!(si_signo) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__siginfo>())).si_errno as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(__siginfo), + "::", + stringify!(si_errno) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__siginfo>())).si_code as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(__siginfo), + "::", + stringify!(si_code) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__siginfo>())).si_pid as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(__siginfo), + "::", + stringify!(si_pid) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__siginfo>())).si_uid as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(__siginfo), + "::", + stringify!(si_uid) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__siginfo>())).si_status as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(__siginfo), + "::", + stringify!(si_status) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__siginfo>())).si_addr as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(__siginfo), + "::", + stringify!(si_addr) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__siginfo>())).si_value as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(__siginfo), + "::", + stringify!(si_value) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__siginfo>())).si_band as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(__siginfo), + "::", + stringify!(si_band) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__siginfo>())).__pad as *const _ as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(__siginfo), + "::", + stringify!(__pad) + ) + ); +} +impl Clone for __siginfo { + fn clone(&self) -> Self { + *self + } +} +impl ::core::fmt::Debug for __siginfo { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + write ! ( f , "__siginfo {{ si_signo: {:?}, si_errno: {:?}, si_code: {:?}, si_pid: {:?}, si_uid: {:?}, si_status: {:?}, si_addr: {:?}, si_value: {:?}, si_band: {:?}, __pad: {:?} }}" , self . si_signo , self . si_errno , self . si_code , self . si_pid , self . si_uid , self . si_status , self . si_addr , self . si_value , self . si_band , self . __pad ) + } +} +pub type siginfo_t = __siginfo; +#[repr(C)] +#[derive(Copy)] +pub union __sigaction_u { + pub __sa_handler: ::core::option::Option, + pub __sa_sigaction: ::core::option::Option< + unsafe extern "C" fn(arg1: libc::c_int, arg2: *mut __siginfo, arg3: *mut libc::c_void), + >, + _bindgen_union_align: u64, +} +#[test] +fn bindgen_test_layout___sigaction_u() { + assert_eq!( + ::core::mem::size_of::<__sigaction_u>(), + 8usize, + concat!("Size of: ", stringify!(__sigaction_u)) + ); + assert_eq!( + ::core::mem::align_of::<__sigaction_u>(), + 8usize, + concat!("Alignment of ", stringify!(__sigaction_u)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__sigaction_u>())).__sa_handler as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__sigaction_u), + "::", + stringify!(__sa_handler) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__sigaction_u>())).__sa_sigaction as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__sigaction_u), + "::", + stringify!(__sa_sigaction) + ) + ); +} +impl Clone for __sigaction_u { + fn clone(&self) -> Self { + *self + } +} +impl ::core::fmt::Debug for __sigaction_u { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + write!(f, "__sigaction_u {{ union }}") + } +} +#[repr(C)] +#[derive(Copy)] +pub struct __sigaction { + pub __sigaction_u: __sigaction_u, + pub sa_tramp: ::core::option::Option< + unsafe extern "C" fn( + arg1: *mut libc::c_void, + arg2: libc::c_int, + arg3: libc::c_int, + arg4: *mut siginfo_t, + arg5: *mut libc::c_void, + ), + >, + pub sa_mask: sigset_t, + pub sa_flags: libc::c_int, +} +#[test] +fn bindgen_test_layout___sigaction() { + assert_eq!( + ::core::mem::size_of::<__sigaction>(), + 24usize, + concat!("Size of: ", stringify!(__sigaction)) + ); + assert_eq!( + ::core::mem::align_of::<__sigaction>(), + 8usize, + concat!("Alignment of ", stringify!(__sigaction)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__sigaction>())).__sigaction_u as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__sigaction), + "::", + stringify!(__sigaction_u) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__sigaction>())).sa_tramp as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(__sigaction), + "::", + stringify!(sa_tramp) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__sigaction>())).sa_mask as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(__sigaction), + "::", + stringify!(sa_mask) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__sigaction>())).sa_flags as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(__sigaction), + "::", + stringify!(sa_flags) + ) + ); +} +impl Clone for __sigaction { + fn clone(&self) -> Self { + *self + } +} +impl ::core::fmt::Debug for __sigaction { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + write!( + f, + "__sigaction {{ __sigaction_u: {:?}, sa_tramp: {:?}, sa_mask: {:?}, sa_flags: {:?} }}", + self.__sigaction_u, self.sa_tramp, self.sa_mask, self.sa_flags + ) + } +} +#[repr(C)] +#[derive(Copy)] +pub struct sigaction { + pub __sigaction_u: __sigaction_u, + pub sa_mask: sigset_t, + pub sa_flags: libc::c_int, +} +#[test] +fn bindgen_test_layout_sigaction() { + assert_eq!( + ::core::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(sigaction)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(sigaction)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).__sigaction_u as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(sigaction), + "::", + stringify!(__sigaction_u) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).sa_mask as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(sigaction), + "::", + stringify!(sa_mask) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).sa_flags as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(sigaction), + "::", + stringify!(sa_flags) + ) + ); +} +impl Clone for sigaction { + fn clone(&self) -> Self { + *self + } +} +impl ::core::fmt::Debug for sigaction { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + write!( + f, + "sigaction {{ __sigaction_u: {:?}, sa_mask: {:?}, sa_flags: {:?} }}", + self.__sigaction_u, self.sa_mask, self.sa_flags + ) + } +} +pub type sig_t = ::core::option::Option; +#[repr(C)] +#[derive(Debug, Copy)] +pub struct sigvec { + pub sv_handler: ::core::option::Option, + pub sv_mask: libc::c_int, + pub sv_flags: libc::c_int, +} +#[test] +fn bindgen_test_layout_sigvec() { + assert_eq!( + ::core::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(sigvec)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(sigvec)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).sv_handler as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(sigvec), + "::", + stringify!(sv_handler) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).sv_mask as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(sigvec), + "::", + stringify!(sv_mask) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).sv_flags as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(sigvec), + "::", + stringify!(sv_flags) + ) + ); +} +impl Clone for sigvec { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct sigstack { + pub ss_sp: *mut libc::c_char, + pub ss_onstack: libc::c_int, +} +#[test] +fn bindgen_test_layout_sigstack() { + assert_eq!( + ::core::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(sigstack)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(sigstack)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).ss_sp as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(sigstack), + "::", + stringify!(ss_sp) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).ss_onstack as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(sigstack), + "::", + stringify!(ss_onstack) + ) + ); +} +impl Clone for sigstack { + fn clone(&self) -> Self { + *self + } +} +extern "C" { + pub fn signal( + arg1: libc::c_int, + arg2: ::core::option::Option, + ) -> ::core::option::Option< + unsafe extern "C" fn( + arg1: libc::c_int, + arg2: ::core::option::Option, + ), + >; +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct timeval { + pub tv_sec: __darwin_time_t, + pub tv_usec: __darwin_suseconds_t, +} +#[test] +fn bindgen_test_layout_timeval() { + assert_eq!( + ::core::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(timeval)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(timeval)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).tv_sec as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(timeval), + "::", + stringify!(tv_sec) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).tv_usec as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(timeval), + "::", + stringify!(tv_usec) + ) + ); +} +impl Clone for timeval { + fn clone(&self) -> Self { + *self + } +} +pub type rlim_t = __uint64_t; +#[repr(C)] +#[derive(Debug, Copy)] +pub struct rusage { + pub ru_utime: timeval, + pub ru_stime: timeval, + pub ru_maxrss: libc::c_long, + pub ru_ixrss: libc::c_long, + pub ru_idrss: libc::c_long, + pub ru_isrss: libc::c_long, + pub ru_minflt: libc::c_long, + pub ru_majflt: libc::c_long, + pub ru_nswap: libc::c_long, + pub ru_inblock: libc::c_long, + pub ru_oublock: libc::c_long, + pub ru_msgsnd: libc::c_long, + pub ru_msgrcv: libc::c_long, + pub ru_nsignals: libc::c_long, + pub ru_nvcsw: libc::c_long, + pub ru_nivcsw: libc::c_long, +} +#[test] +fn bindgen_test_layout_rusage() { + assert_eq!( + ::core::mem::size_of::(), + 144usize, + concat!("Size of: ", stringify!(rusage)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(rusage)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).ru_utime as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(rusage), + "::", + stringify!(ru_utime) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).ru_stime as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(rusage), + "::", + stringify!(ru_stime) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).ru_maxrss as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(rusage), + "::", + stringify!(ru_maxrss) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).ru_ixrss as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(rusage), + "::", + stringify!(ru_ixrss) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).ru_idrss as *const _ as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(rusage), + "::", + stringify!(ru_idrss) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).ru_isrss as *const _ as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(rusage), + "::", + stringify!(ru_isrss) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).ru_minflt as *const _ as usize }, + 64usize, + concat!( + "Offset of field: ", + stringify!(rusage), + "::", + stringify!(ru_minflt) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).ru_majflt as *const _ as usize }, + 72usize, + concat!( + "Offset of field: ", + stringify!(rusage), + "::", + stringify!(ru_majflt) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).ru_nswap as *const _ as usize }, + 80usize, + concat!( + "Offset of field: ", + stringify!(rusage), + "::", + stringify!(ru_nswap) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).ru_inblock as *const _ as usize }, + 88usize, + concat!( + "Offset of field: ", + stringify!(rusage), + "::", + stringify!(ru_inblock) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).ru_oublock as *const _ as usize }, + 96usize, + concat!( + "Offset of field: ", + stringify!(rusage), + "::", + stringify!(ru_oublock) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).ru_msgsnd as *const _ as usize }, + 104usize, + concat!( + "Offset of field: ", + stringify!(rusage), + "::", + stringify!(ru_msgsnd) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).ru_msgrcv as *const _ as usize }, + 112usize, + concat!( + "Offset of field: ", + stringify!(rusage), + "::", + stringify!(ru_msgrcv) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).ru_nsignals as *const _ as usize }, + 120usize, + concat!( + "Offset of field: ", + stringify!(rusage), + "::", + stringify!(ru_nsignals) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).ru_nvcsw as *const _ as usize }, + 128usize, + concat!( + "Offset of field: ", + stringify!(rusage), + "::", + stringify!(ru_nvcsw) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).ru_nivcsw as *const _ as usize }, + 136usize, + concat!( + "Offset of field: ", + stringify!(rusage), + "::", + stringify!(ru_nivcsw) + ) + ); +} +impl Clone for rusage { + fn clone(&self) -> Self { + *self + } +} +pub type rusage_info_t = *mut libc::c_void; +#[repr(C)] +#[derive(Debug, Copy)] +pub struct rusage_info_v0 { + pub ri_uuid: [u8; 16usize], + pub ri_user_time: u64, + pub ri_system_time: u64, + pub ri_pkg_idle_wkups: u64, + pub ri_interrupt_wkups: u64, + pub ri_pageins: u64, + pub ri_wired_size: u64, + pub ri_resident_size: u64, + pub ri_phys_footprint: u64, + pub ri_proc_start_abstime: u64, + pub ri_proc_exit_abstime: u64, +} +#[test] +fn bindgen_test_layout_rusage_info_v0() { + assert_eq!( + ::core::mem::size_of::(), + 96usize, + concat!("Size of: ", stringify!(rusage_info_v0)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(rusage_info_v0)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).ri_uuid as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v0), + "::", + stringify!(ri_uuid) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).ri_user_time as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v0), + "::", + stringify!(ri_user_time) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).ri_system_time as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v0), + "::", + stringify!(ri_system_time) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_pkg_idle_wkups as *const _ as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v0), + "::", + stringify!(ri_pkg_idle_wkups) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_interrupt_wkups as *const _ as usize + }, + 40usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v0), + "::", + stringify!(ri_interrupt_wkups) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).ri_pageins as *const _ as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v0), + "::", + stringify!(ri_pageins) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).ri_wired_size as *const _ as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v0), + "::", + stringify!(ri_wired_size) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_resident_size as *const _ as usize + }, + 64usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v0), + "::", + stringify!(ri_resident_size) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_phys_footprint as *const _ as usize + }, + 72usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v0), + "::", + stringify!(ri_phys_footprint) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_proc_start_abstime as *const _ as usize + }, + 80usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v0), + "::", + stringify!(ri_proc_start_abstime) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_proc_exit_abstime as *const _ as usize + }, + 88usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v0), + "::", + stringify!(ri_proc_exit_abstime) + ) + ); +} +impl Clone for rusage_info_v0 { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct rusage_info_v1 { + pub ri_uuid: [u8; 16usize], + pub ri_user_time: u64, + pub ri_system_time: u64, + pub ri_pkg_idle_wkups: u64, + pub ri_interrupt_wkups: u64, + pub ri_pageins: u64, + pub ri_wired_size: u64, + pub ri_resident_size: u64, + pub ri_phys_footprint: u64, + pub ri_proc_start_abstime: u64, + pub ri_proc_exit_abstime: u64, + pub ri_child_user_time: u64, + pub ri_child_system_time: u64, + pub ri_child_pkg_idle_wkups: u64, + pub ri_child_interrupt_wkups: u64, + pub ri_child_pageins: u64, + pub ri_child_elapsed_abstime: u64, +} +#[test] +fn bindgen_test_layout_rusage_info_v1() { + assert_eq!( + ::core::mem::size_of::(), + 144usize, + concat!("Size of: ", stringify!(rusage_info_v1)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(rusage_info_v1)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).ri_uuid as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v1), + "::", + stringify!(ri_uuid) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).ri_user_time as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v1), + "::", + stringify!(ri_user_time) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).ri_system_time as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v1), + "::", + stringify!(ri_system_time) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_pkg_idle_wkups as *const _ as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v1), + "::", + stringify!(ri_pkg_idle_wkups) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_interrupt_wkups as *const _ as usize + }, + 40usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v1), + "::", + stringify!(ri_interrupt_wkups) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).ri_pageins as *const _ as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v1), + "::", + stringify!(ri_pageins) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).ri_wired_size as *const _ as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v1), + "::", + stringify!(ri_wired_size) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_resident_size as *const _ as usize + }, + 64usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v1), + "::", + stringify!(ri_resident_size) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_phys_footprint as *const _ as usize + }, + 72usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v1), + "::", + stringify!(ri_phys_footprint) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_proc_start_abstime as *const _ as usize + }, + 80usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v1), + "::", + stringify!(ri_proc_start_abstime) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_proc_exit_abstime as *const _ as usize + }, + 88usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v1), + "::", + stringify!(ri_proc_exit_abstime) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_child_user_time as *const _ as usize + }, + 96usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v1), + "::", + stringify!(ri_child_user_time) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_child_system_time as *const _ as usize + }, + 104usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v1), + "::", + stringify!(ri_child_system_time) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_child_pkg_idle_wkups as *const _ as usize + }, + 112usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v1), + "::", + stringify!(ri_child_pkg_idle_wkups) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_child_interrupt_wkups as *const _ + as usize + }, + 120usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v1), + "::", + stringify!(ri_child_interrupt_wkups) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_child_pageins as *const _ as usize + }, + 128usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v1), + "::", + stringify!(ri_child_pageins) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_child_elapsed_abstime as *const _ + as usize + }, + 136usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v1), + "::", + stringify!(ri_child_elapsed_abstime) + ) + ); +} +impl Clone for rusage_info_v1 { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct rusage_info_v2 { + pub ri_uuid: [u8; 16usize], + pub ri_user_time: u64, + pub ri_system_time: u64, + pub ri_pkg_idle_wkups: u64, + pub ri_interrupt_wkups: u64, + pub ri_pageins: u64, + pub ri_wired_size: u64, + pub ri_resident_size: u64, + pub ri_phys_footprint: u64, + pub ri_proc_start_abstime: u64, + pub ri_proc_exit_abstime: u64, + pub ri_child_user_time: u64, + pub ri_child_system_time: u64, + pub ri_child_pkg_idle_wkups: u64, + pub ri_child_interrupt_wkups: u64, + pub ri_child_pageins: u64, + pub ri_child_elapsed_abstime: u64, + pub ri_diskio_bytesread: u64, + pub ri_diskio_byteswritten: u64, +} +#[test] +fn bindgen_test_layout_rusage_info_v2() { + assert_eq!( + ::core::mem::size_of::(), + 160usize, + concat!("Size of: ", stringify!(rusage_info_v2)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(rusage_info_v2)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).ri_uuid as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v2), + "::", + stringify!(ri_uuid) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).ri_user_time as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v2), + "::", + stringify!(ri_user_time) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).ri_system_time as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v2), + "::", + stringify!(ri_system_time) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_pkg_idle_wkups as *const _ as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v2), + "::", + stringify!(ri_pkg_idle_wkups) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_interrupt_wkups as *const _ as usize + }, + 40usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v2), + "::", + stringify!(ri_interrupt_wkups) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).ri_pageins as *const _ as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v2), + "::", + stringify!(ri_pageins) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).ri_wired_size as *const _ as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v2), + "::", + stringify!(ri_wired_size) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_resident_size as *const _ as usize + }, + 64usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v2), + "::", + stringify!(ri_resident_size) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_phys_footprint as *const _ as usize + }, + 72usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v2), + "::", + stringify!(ri_phys_footprint) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_proc_start_abstime as *const _ as usize + }, + 80usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v2), + "::", + stringify!(ri_proc_start_abstime) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_proc_exit_abstime as *const _ as usize + }, + 88usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v2), + "::", + stringify!(ri_proc_exit_abstime) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_child_user_time as *const _ as usize + }, + 96usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v2), + "::", + stringify!(ri_child_user_time) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_child_system_time as *const _ as usize + }, + 104usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v2), + "::", + stringify!(ri_child_system_time) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_child_pkg_idle_wkups as *const _ as usize + }, + 112usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v2), + "::", + stringify!(ri_child_pkg_idle_wkups) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_child_interrupt_wkups as *const _ + as usize + }, + 120usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v2), + "::", + stringify!(ri_child_interrupt_wkups) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_child_pageins as *const _ as usize + }, + 128usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v2), + "::", + stringify!(ri_child_pageins) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_child_elapsed_abstime as *const _ + as usize + }, + 136usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v2), + "::", + stringify!(ri_child_elapsed_abstime) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_diskio_bytesread as *const _ as usize + }, + 144usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v2), + "::", + stringify!(ri_diskio_bytesread) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_diskio_byteswritten as *const _ as usize + }, + 152usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v2), + "::", + stringify!(ri_diskio_byteswritten) + ) + ); +} +impl Clone for rusage_info_v2 { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct rusage_info_v3 { + pub ri_uuid: [u8; 16usize], + pub ri_user_time: u64, + pub ri_system_time: u64, + pub ri_pkg_idle_wkups: u64, + pub ri_interrupt_wkups: u64, + pub ri_pageins: u64, + pub ri_wired_size: u64, + pub ri_resident_size: u64, + pub ri_phys_footprint: u64, + pub ri_proc_start_abstime: u64, + pub ri_proc_exit_abstime: u64, + pub ri_child_user_time: u64, + pub ri_child_system_time: u64, + pub ri_child_pkg_idle_wkups: u64, + pub ri_child_interrupt_wkups: u64, + pub ri_child_pageins: u64, + pub ri_child_elapsed_abstime: u64, + pub ri_diskio_bytesread: u64, + pub ri_diskio_byteswritten: u64, + pub ri_cpu_time_qos_default: u64, + pub ri_cpu_time_qos_maintenance: u64, + pub ri_cpu_time_qos_background: u64, + pub ri_cpu_time_qos_utility: u64, + pub ri_cpu_time_qos_legacy: u64, + pub ri_cpu_time_qos_user_initiated: u64, + pub ri_cpu_time_qos_user_interactive: u64, + pub ri_billed_system_time: u64, + pub ri_serviced_system_time: u64, +} +#[test] +fn bindgen_test_layout_rusage_info_v3() { + assert_eq!( + ::core::mem::size_of::(), + 232usize, + concat!("Size of: ", stringify!(rusage_info_v3)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(rusage_info_v3)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).ri_uuid as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v3), + "::", + stringify!(ri_uuid) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).ri_user_time as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v3), + "::", + stringify!(ri_user_time) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).ri_system_time as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v3), + "::", + stringify!(ri_system_time) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_pkg_idle_wkups as *const _ as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v3), + "::", + stringify!(ri_pkg_idle_wkups) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_interrupt_wkups as *const _ as usize + }, + 40usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v3), + "::", + stringify!(ri_interrupt_wkups) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).ri_pageins as *const _ as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v3), + "::", + stringify!(ri_pageins) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).ri_wired_size as *const _ as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v3), + "::", + stringify!(ri_wired_size) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_resident_size as *const _ as usize + }, + 64usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v3), + "::", + stringify!(ri_resident_size) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_phys_footprint as *const _ as usize + }, + 72usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v3), + "::", + stringify!(ri_phys_footprint) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_proc_start_abstime as *const _ as usize + }, + 80usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v3), + "::", + stringify!(ri_proc_start_abstime) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_proc_exit_abstime as *const _ as usize + }, + 88usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v3), + "::", + stringify!(ri_proc_exit_abstime) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_child_user_time as *const _ as usize + }, + 96usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v3), + "::", + stringify!(ri_child_user_time) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_child_system_time as *const _ as usize + }, + 104usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v3), + "::", + stringify!(ri_child_system_time) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_child_pkg_idle_wkups as *const _ as usize + }, + 112usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v3), + "::", + stringify!(ri_child_pkg_idle_wkups) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_child_interrupt_wkups as *const _ + as usize + }, + 120usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v3), + "::", + stringify!(ri_child_interrupt_wkups) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_child_pageins as *const _ as usize + }, + 128usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v3), + "::", + stringify!(ri_child_pageins) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_child_elapsed_abstime as *const _ + as usize + }, + 136usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v3), + "::", + stringify!(ri_child_elapsed_abstime) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_diskio_bytesread as *const _ as usize + }, + 144usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v3), + "::", + stringify!(ri_diskio_bytesread) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_diskio_byteswritten as *const _ as usize + }, + 152usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v3), + "::", + stringify!(ri_diskio_byteswritten) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_cpu_time_qos_default as *const _ as usize + }, + 160usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v3), + "::", + stringify!(ri_cpu_time_qos_default) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_cpu_time_qos_maintenance as *const _ + as usize + }, + 168usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v3), + "::", + stringify!(ri_cpu_time_qos_maintenance) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_cpu_time_qos_background as *const _ + as usize + }, + 176usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v3), + "::", + stringify!(ri_cpu_time_qos_background) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_cpu_time_qos_utility as *const _ as usize + }, + 184usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v3), + "::", + stringify!(ri_cpu_time_qos_utility) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_cpu_time_qos_legacy as *const _ as usize + }, + 192usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v3), + "::", + stringify!(ri_cpu_time_qos_legacy) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_cpu_time_qos_user_initiated as *const _ + as usize + }, + 200usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v3), + "::", + stringify!(ri_cpu_time_qos_user_initiated) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_cpu_time_qos_user_interactive as *const _ + as usize + }, + 208usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v3), + "::", + stringify!(ri_cpu_time_qos_user_interactive) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_billed_system_time as *const _ as usize + }, + 216usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v3), + "::", + stringify!(ri_billed_system_time) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_serviced_system_time as *const _ as usize + }, + 224usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v3), + "::", + stringify!(ri_serviced_system_time) + ) + ); +} +impl Clone for rusage_info_v3 { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct rusage_info_v4 { + pub ri_uuid: [u8; 16usize], + pub ri_user_time: u64, + pub ri_system_time: u64, + pub ri_pkg_idle_wkups: u64, + pub ri_interrupt_wkups: u64, + pub ri_pageins: u64, + pub ri_wired_size: u64, + pub ri_resident_size: u64, + pub ri_phys_footprint: u64, + pub ri_proc_start_abstime: u64, + pub ri_proc_exit_abstime: u64, + pub ri_child_user_time: u64, + pub ri_child_system_time: u64, + pub ri_child_pkg_idle_wkups: u64, + pub ri_child_interrupt_wkups: u64, + pub ri_child_pageins: u64, + pub ri_child_elapsed_abstime: u64, + pub ri_diskio_bytesread: u64, + pub ri_diskio_byteswritten: u64, + pub ri_cpu_time_qos_default: u64, + pub ri_cpu_time_qos_maintenance: u64, + pub ri_cpu_time_qos_background: u64, + pub ri_cpu_time_qos_utility: u64, + pub ri_cpu_time_qos_legacy: u64, + pub ri_cpu_time_qos_user_initiated: u64, + pub ri_cpu_time_qos_user_interactive: u64, + pub ri_billed_system_time: u64, + pub ri_serviced_system_time: u64, + pub ri_logical_writes: u64, + pub ri_lifetime_max_phys_footprint: u64, + pub ri_instructions: u64, + pub ri_cycles: u64, + pub ri_billed_energy: u64, + pub ri_serviced_energy: u64, + pub ri_interval_max_phys_footprint: u64, + pub ri_unused: [u64; 1usize], +} +#[test] +fn bindgen_test_layout_rusage_info_v4() { + assert_eq!( + ::core::mem::size_of::(), + 296usize, + concat!("Size of: ", stringify!(rusage_info_v4)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(rusage_info_v4)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).ri_uuid as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v4), + "::", + stringify!(ri_uuid) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).ri_user_time as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v4), + "::", + stringify!(ri_user_time) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).ri_system_time as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v4), + "::", + stringify!(ri_system_time) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_pkg_idle_wkups as *const _ as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v4), + "::", + stringify!(ri_pkg_idle_wkups) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_interrupt_wkups as *const _ as usize + }, + 40usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v4), + "::", + stringify!(ri_interrupt_wkups) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).ri_pageins as *const _ as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v4), + "::", + stringify!(ri_pageins) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).ri_wired_size as *const _ as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v4), + "::", + stringify!(ri_wired_size) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_resident_size as *const _ as usize + }, + 64usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v4), + "::", + stringify!(ri_resident_size) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_phys_footprint as *const _ as usize + }, + 72usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v4), + "::", + stringify!(ri_phys_footprint) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_proc_start_abstime as *const _ as usize + }, + 80usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v4), + "::", + stringify!(ri_proc_start_abstime) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_proc_exit_abstime as *const _ as usize + }, + 88usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v4), + "::", + stringify!(ri_proc_exit_abstime) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_child_user_time as *const _ as usize + }, + 96usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v4), + "::", + stringify!(ri_child_user_time) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_child_system_time as *const _ as usize + }, + 104usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v4), + "::", + stringify!(ri_child_system_time) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_child_pkg_idle_wkups as *const _ as usize + }, + 112usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v4), + "::", + stringify!(ri_child_pkg_idle_wkups) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_child_interrupt_wkups as *const _ + as usize + }, + 120usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v4), + "::", + stringify!(ri_child_interrupt_wkups) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_child_pageins as *const _ as usize + }, + 128usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v4), + "::", + stringify!(ri_child_pageins) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_child_elapsed_abstime as *const _ + as usize + }, + 136usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v4), + "::", + stringify!(ri_child_elapsed_abstime) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_diskio_bytesread as *const _ as usize + }, + 144usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v4), + "::", + stringify!(ri_diskio_bytesread) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_diskio_byteswritten as *const _ as usize + }, + 152usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v4), + "::", + stringify!(ri_diskio_byteswritten) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_cpu_time_qos_default as *const _ as usize + }, + 160usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v4), + "::", + stringify!(ri_cpu_time_qos_default) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_cpu_time_qos_maintenance as *const _ + as usize + }, + 168usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v4), + "::", + stringify!(ri_cpu_time_qos_maintenance) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_cpu_time_qos_background as *const _ + as usize + }, + 176usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v4), + "::", + stringify!(ri_cpu_time_qos_background) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_cpu_time_qos_utility as *const _ as usize + }, + 184usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v4), + "::", + stringify!(ri_cpu_time_qos_utility) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_cpu_time_qos_legacy as *const _ as usize + }, + 192usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v4), + "::", + stringify!(ri_cpu_time_qos_legacy) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_cpu_time_qos_user_initiated as *const _ + as usize + }, + 200usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v4), + "::", + stringify!(ri_cpu_time_qos_user_initiated) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_cpu_time_qos_user_interactive as *const _ + as usize + }, + 208usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v4), + "::", + stringify!(ri_cpu_time_qos_user_interactive) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_billed_system_time as *const _ as usize + }, + 216usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v4), + "::", + stringify!(ri_billed_system_time) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_serviced_system_time as *const _ as usize + }, + 224usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v4), + "::", + stringify!(ri_serviced_system_time) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_logical_writes as *const _ as usize + }, + 232usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v4), + "::", + stringify!(ri_logical_writes) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_lifetime_max_phys_footprint as *const _ + as usize + }, + 240usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v4), + "::", + stringify!(ri_lifetime_max_phys_footprint) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).ri_instructions as *const _ as usize }, + 248usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v4), + "::", + stringify!(ri_instructions) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).ri_cycles as *const _ as usize }, + 256usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v4), + "::", + stringify!(ri_cycles) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_billed_energy as *const _ as usize + }, + 264usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v4), + "::", + stringify!(ri_billed_energy) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_serviced_energy as *const _ as usize + }, + 272usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v4), + "::", + stringify!(ri_serviced_energy) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).ri_interval_max_phys_footprint as *const _ + as usize + }, + 280usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v4), + "::", + stringify!(ri_interval_max_phys_footprint) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).ri_unused as *const _ as usize }, + 288usize, + concat!( + "Offset of field: ", + stringify!(rusage_info_v4), + "::", + stringify!(ri_unused) + ) + ); +} +impl Clone for rusage_info_v4 { + fn clone(&self) -> Self { + *self + } +} +pub type rusage_info_current = rusage_info_v4; +#[repr(C)] +#[derive(Debug, Copy)] +pub struct rlimit { + pub rlim_cur: rlim_t, + pub rlim_max: rlim_t, +} +#[test] +fn bindgen_test_layout_rlimit() { + assert_eq!( + ::core::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(rlimit)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(rlimit)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).rlim_cur as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(rlimit), + "::", + stringify!(rlim_cur) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).rlim_max as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(rlimit), + "::", + stringify!(rlim_max) + ) + ); +} +impl Clone for rlimit { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct proc_rlimit_control_wakeupmon { + pub wm_flags: u32, + pub wm_rate: i32, +} +#[test] +fn bindgen_test_layout_proc_rlimit_control_wakeupmon() { + assert_eq!( + ::core::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(proc_rlimit_control_wakeupmon)) + ); + assert_eq!( + ::core::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(proc_rlimit_control_wakeupmon)) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).wm_flags as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(proc_rlimit_control_wakeupmon), + "::", + stringify!(wm_flags) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).wm_rate as *const _ as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(proc_rlimit_control_wakeupmon), + "::", + stringify!(wm_rate) + ) + ); +} +impl Clone for proc_rlimit_control_wakeupmon { + fn clone(&self) -> Self { + *self + } +} +extern "C" { + pub fn getpriority(arg1: libc::c_int, arg2: id_t) -> libc::c_int; +} +extern "C" { + pub fn getiopolicy_np(arg1: libc::c_int, arg2: libc::c_int) -> libc::c_int; +} +extern "C" { + pub fn getrlimit(arg1: libc::c_int, arg2: *mut rlimit) -> libc::c_int; +} +extern "C" { + pub fn getrusage(arg1: libc::c_int, arg2: *mut rusage) -> libc::c_int; +} +extern "C" { + pub fn setpriority(arg1: libc::c_int, arg2: id_t, arg3: libc::c_int) -> libc::c_int; +} +extern "C" { + pub fn setiopolicy_np(arg1: libc::c_int, arg2: libc::c_int, arg3: libc::c_int) -> libc::c_int; +} +extern "C" { + pub fn setrlimit(arg1: libc::c_int, arg2: *const rlimit) -> libc::c_int; +} +#[repr(C)] +#[derive(Copy)] +pub union wait { + pub w_status: libc::c_int, + pub w_T: wait__bindgen_ty_1, + pub w_S: wait__bindgen_ty_2, + _bindgen_union_align: u32, +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct wait__bindgen_ty_1 { + pub _bitfield_1: __BindgenBitfieldUnit<[u8; 4usize], u16>, + pub __bindgen_align: [u32; 0usize], +} +#[test] +fn bindgen_test_layout_wait__bindgen_ty_1() { + assert_eq!( + ::core::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(wait__bindgen_ty_1)) + ); + assert_eq!( + ::core::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(wait__bindgen_ty_1)) + ); +} +impl Clone for wait__bindgen_ty_1 { + fn clone(&self) -> Self { + *self + } +} +impl wait__bindgen_ty_1 { + #[inline] + pub fn w_Termsig(&self) -> libc::c_uint { + unsafe { ::core::mem::transmute(self._bitfield_1.get(0usize, 7u8) as u32) } + } + #[inline] + pub fn set_w_Termsig(&mut self, val: libc::c_uint) { + unsafe { + let val: u32 = ::core::mem::transmute(val); + self._bitfield_1.set(0usize, 7u8, val as u64) + } + } + #[inline] + pub fn w_Coredump(&self) -> libc::c_uint { + unsafe { ::core::mem::transmute(self._bitfield_1.get(7usize, 1u8) as u32) } + } + #[inline] + pub fn set_w_Coredump(&mut self, val: libc::c_uint) { + unsafe { + let val: u32 = ::core::mem::transmute(val); + self._bitfield_1.set(7usize, 1u8, val as u64) + } + } + #[inline] + pub fn w_Retcode(&self) -> libc::c_uint { + unsafe { ::core::mem::transmute(self._bitfield_1.get(8usize, 8u8) as u32) } + } + #[inline] + pub fn set_w_Retcode(&mut self, val: libc::c_uint) { + unsafe { + let val: u32 = ::core::mem::transmute(val); + self._bitfield_1.set(8usize, 8u8, val as u64) + } + } + #[inline] + pub fn w_Filler(&self) -> libc::c_uint { + unsafe { ::core::mem::transmute(self._bitfield_1.get(16usize, 16u8) as u32) } + } + #[inline] + pub fn set_w_Filler(&mut self, val: libc::c_uint) { + unsafe { + let val: u32 = ::core::mem::transmute(val); + self._bitfield_1.set(16usize, 16u8, val as u64) + } + } + #[inline] + pub fn new_bitfield_1( + w_Termsig: libc::c_uint, + w_Coredump: libc::c_uint, + w_Retcode: libc::c_uint, + w_Filler: libc::c_uint, + ) -> __BindgenBitfieldUnit<[u8; 4usize], u16> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 4usize], u16> = + Default::default(); + __bindgen_bitfield_unit.set(0usize, 7u8, { + let w_Termsig: u32 = unsafe { ::core::mem::transmute(w_Termsig) }; + w_Termsig as u64 + }); + __bindgen_bitfield_unit.set(7usize, 1u8, { + let w_Coredump: u32 = unsafe { ::core::mem::transmute(w_Coredump) }; + w_Coredump as u64 + }); + __bindgen_bitfield_unit.set(8usize, 8u8, { + let w_Retcode: u32 = unsafe { ::core::mem::transmute(w_Retcode) }; + w_Retcode as u64 + }); + __bindgen_bitfield_unit.set(16usize, 16u8, { + let w_Filler: u32 = unsafe { ::core::mem::transmute(w_Filler) }; + w_Filler as u64 + }); + __bindgen_bitfield_unit + } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct wait__bindgen_ty_2 { + pub _bitfield_1: __BindgenBitfieldUnit<[u8; 4usize], u16>, + pub __bindgen_align: [u32; 0usize], +} +#[test] +fn bindgen_test_layout_wait__bindgen_ty_2() { + assert_eq!( + ::core::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(wait__bindgen_ty_2)) + ); + assert_eq!( + ::core::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(wait__bindgen_ty_2)) + ); +} +impl Clone for wait__bindgen_ty_2 { + fn clone(&self) -> Self { + *self + } +} +impl wait__bindgen_ty_2 { + #[inline] + pub fn w_Stopval(&self) -> libc::c_uint { + unsafe { ::core::mem::transmute(self._bitfield_1.get(0usize, 8u8) as u32) } + } + #[inline] + pub fn set_w_Stopval(&mut self, val: libc::c_uint) { + unsafe { + let val: u32 = ::core::mem::transmute(val); + self._bitfield_1.set(0usize, 8u8, val as u64) + } + } + #[inline] + pub fn w_Stopsig(&self) -> libc::c_uint { + unsafe { ::core::mem::transmute(self._bitfield_1.get(8usize, 8u8) as u32) } + } + #[inline] + pub fn set_w_Stopsig(&mut self, val: libc::c_uint) { + unsafe { + let val: u32 = ::core::mem::transmute(val); + self._bitfield_1.set(8usize, 8u8, val as u64) + } + } + #[inline] + pub fn w_Filler(&self) -> libc::c_uint { + unsafe { ::core::mem::transmute(self._bitfield_1.get(16usize, 16u8) as u32) } + } + #[inline] + pub fn set_w_Filler(&mut self, val: libc::c_uint) { + unsafe { + let val: u32 = ::core::mem::transmute(val); + self._bitfield_1.set(16usize, 16u8, val as u64) + } + } + #[inline] + pub fn new_bitfield_1( + w_Stopval: libc::c_uint, + w_Stopsig: libc::c_uint, + w_Filler: libc::c_uint, + ) -> __BindgenBitfieldUnit<[u8; 4usize], u16> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 4usize], u16> = + Default::default(); + __bindgen_bitfield_unit.set(0usize, 8u8, { + let w_Stopval: u32 = unsafe { ::core::mem::transmute(w_Stopval) }; + w_Stopval as u64 + }); + __bindgen_bitfield_unit.set(8usize, 8u8, { + let w_Stopsig: u32 = unsafe { ::core::mem::transmute(w_Stopsig) }; + w_Stopsig as u64 + }); + __bindgen_bitfield_unit.set(16usize, 16u8, { + let w_Filler: u32 = unsafe { ::core::mem::transmute(w_Filler) }; + w_Filler as u64 + }); + __bindgen_bitfield_unit + } +} +#[test] +fn bindgen_test_layout_wait() { + assert_eq!( + ::core::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(wait)) + ); + assert_eq!( + ::core::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(wait)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).w_status as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(wait), + "::", + stringify!(w_status) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).w_T as *const _ as usize }, + 0usize, + concat!("Offset of field: ", stringify!(wait), "::", stringify!(w_T)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).w_S as *const _ as usize }, + 0usize, + concat!("Offset of field: ", stringify!(wait), "::", stringify!(w_S)) + ); +} +impl Clone for wait { + fn clone(&self) -> Self { + *self + } +} +impl ::core::fmt::Debug for wait { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + write!(f, "wait {{ union }}") + } +} +extern "C" { + pub fn wait(arg1: *mut libc::c_int) -> pid_t; +} +extern "C" { + pub fn waitpid(arg1: pid_t, arg2: *mut libc::c_int, arg3: libc::c_int) -> pid_t; +} +extern "C" { + pub fn waitid( + arg1: idtype_t, + arg2: id_t, + arg3: *mut siginfo_t, + arg4: libc::c_int, + ) -> libc::c_int; +} +extern "C" { + pub fn wait3(arg1: *mut libc::c_int, arg2: libc::c_int, arg3: *mut rusage) -> pid_t; +} +extern "C" { + pub fn wait4( + arg1: pid_t, + arg2: *mut libc::c_int, + arg3: libc::c_int, + arg4: *mut rusage, + ) -> pid_t; +} +extern "C" { + pub fn alloca(arg1: libc::c_ulong) -> *mut libc::c_void; +} +pub type ct_rune_t = __darwin_ct_rune_t; +pub type rune_t = __darwin_rune_t; +pub type wchar_t = __darwin_wchar_t; +#[repr(C)] +#[derive(Debug, Copy)] +pub struct div_t { + pub quot: libc::c_int, + pub rem: libc::c_int, +} +#[test] +fn bindgen_test_layout_div_t() { + assert_eq!( + ::core::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(div_t)) + ); + assert_eq!( + ::core::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(div_t)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).quot as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(div_t), + "::", + stringify!(quot) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).rem as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(div_t), + "::", + stringify!(rem) + ) + ); +} +impl Clone for div_t { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct ldiv_t { + pub quot: libc::c_long, + pub rem: libc::c_long, +} +#[test] +fn bindgen_test_layout_ldiv_t() { + assert_eq!( + ::core::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(ldiv_t)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(ldiv_t)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).quot as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ldiv_t), + "::", + stringify!(quot) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).rem as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(ldiv_t), + "::", + stringify!(rem) + ) + ); +} +impl Clone for ldiv_t { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct lldiv_t { + pub quot: libc::c_longlong, + pub rem: libc::c_longlong, +} +#[test] +fn bindgen_test_layout_lldiv_t() { + assert_eq!( + ::core::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(lldiv_t)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(lldiv_t)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).quot as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(lldiv_t), + "::", + stringify!(quot) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).rem as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(lldiv_t), + "::", + stringify!(rem) + ) + ); +} +impl Clone for lldiv_t { + fn clone(&self) -> Self { + *self + } +} +extern "C" { + pub fn malloc(__size: libc::c_ulong) -> *mut libc::c_void; +} +extern "C" { + pub fn calloc(__count: libc::c_ulong, __size: libc::c_ulong) -> *mut libc::c_void; +} +extern "C" { + pub fn free(arg1: *mut libc::c_void); +} +extern "C" { + pub fn realloc(__ptr: *mut libc::c_void, __size: libc::c_ulong) -> *mut libc::c_void; +} +extern "C" { + pub fn valloc(arg1: usize) -> *mut libc::c_void; +} +extern "C" { + pub fn posix_memalign( + __memptr: *mut *mut libc::c_void, + __alignment: usize, + __size: usize, + ) -> libc::c_int; +} +extern "C" { + pub fn abort(); +} +extern "C" { + pub fn abs(arg1: libc::c_int) -> libc::c_int; +} +extern "C" { + pub fn atexit(arg1: ::core::option::Option) -> libc::c_int; +} +extern "C" { + pub fn atof(arg1: *const libc::c_char) -> f64; +} +extern "C" { + pub fn atoi(arg1: *const libc::c_char) -> libc::c_int; +} +extern "C" { + pub fn atol(arg1: *const libc::c_char) -> libc::c_long; +} +extern "C" { + pub fn atoll(arg1: *const libc::c_char) -> libc::c_longlong; +} +extern "C" { + pub fn bsearch( + __key: *const libc::c_void, + __base: *const libc::c_void, + __nel: usize, + __width: usize, + __compar: ::core::option::Option< + unsafe extern "C" fn( + arg1: *const libc::c_void, + arg2: *const libc::c_void, + ) -> libc::c_int, + >, + ) -> *mut libc::c_void; +} +extern "C" { + pub fn div(arg1: libc::c_int, arg2: libc::c_int) -> div_t; +} +extern "C" { + pub fn exit(arg1: libc::c_int); +} +extern "C" { + pub fn getenv(arg1: *const libc::c_char) -> *mut libc::c_char; +} +extern "C" { + pub fn labs(arg1: libc::c_long) -> libc::c_long; +} +extern "C" { + pub fn ldiv(arg1: libc::c_long, arg2: libc::c_long) -> ldiv_t; +} +extern "C" { + pub fn llabs(arg1: libc::c_longlong) -> libc::c_longlong; +} +extern "C" { + pub fn lldiv(arg1: libc::c_longlong, arg2: libc::c_longlong) -> lldiv_t; +} +extern "C" { + pub fn mblen(__s: *const libc::c_char, __n: usize) -> libc::c_int; +} +extern "C" { + pub fn mbstowcs(arg1: *mut wchar_t, arg2: *const libc::c_char, arg3: usize) -> usize; +} +extern "C" { + pub fn mbtowc(arg1: *mut wchar_t, arg2: *const libc::c_char, arg3: usize) -> libc::c_int; +} +extern "C" { + pub fn qsort( + __base: *mut libc::c_void, + __nel: usize, + __width: usize, + __compar: ::core::option::Option< + unsafe extern "C" fn( + arg1: *const libc::c_void, + arg2: *const libc::c_void, + ) -> libc::c_int, + >, + ); +} +extern "C" { + pub fn rand() -> libc::c_int; +} +extern "C" { + pub fn srand(arg1: libc::c_uint); +} +extern "C" { + pub fn strtod(arg1: *const libc::c_char, arg2: *mut *mut libc::c_char) -> f64; +} +extern "C" { + pub fn strtof(arg1: *const libc::c_char, arg2: *mut *mut libc::c_char) -> f32; +} +extern "C" { + pub fn strtol( + __str: *const libc::c_char, + __endptr: *mut *mut libc::c_char, + __base: libc::c_int, + ) -> libc::c_long; +} +extern "C" { + pub fn strtold(arg1: *const libc::c_char, arg2: *mut *mut libc::c_char) -> f64; +} +extern "C" { + pub fn strtoll( + __str: *const libc::c_char, + __endptr: *mut *mut libc::c_char, + __base: libc::c_int, + ) -> libc::c_longlong; +} +extern "C" { + pub fn strtoul( + __str: *const libc::c_char, + __endptr: *mut *mut libc::c_char, + __base: libc::c_int, + ) -> libc::c_ulong; +} +extern "C" { + pub fn strtoull( + __str: *const libc::c_char, + __endptr: *mut *mut libc::c_char, + __base: libc::c_int, + ) -> libc::c_ulonglong; +} +extern "C" { + pub fn system(arg1: *const libc::c_char) -> libc::c_int; +} +extern "C" { + pub fn wcstombs(arg1: *mut libc::c_char, arg2: *const wchar_t, arg3: usize) -> usize; +} +extern "C" { + pub fn wctomb(arg1: *mut libc::c_char, arg2: wchar_t) -> libc::c_int; +} +extern "C" { + pub fn _Exit(arg1: libc::c_int); +} +extern "C" { + pub fn a64l(arg1: *const libc::c_char) -> libc::c_long; +} +extern "C" { + pub fn drand48() -> f64; +} +extern "C" { + pub fn ecvt( + arg1: f64, + arg2: libc::c_int, + arg3: *mut libc::c_int, + arg4: *mut libc::c_int, + ) -> *mut libc::c_char; +} +extern "C" { + pub fn erand48(arg1: *mut libc::c_ushort) -> f64; +} +extern "C" { + pub fn fcvt( + arg1: f64, + arg2: libc::c_int, + arg3: *mut libc::c_int, + arg4: *mut libc::c_int, + ) -> *mut libc::c_char; +} +extern "C" { + pub fn gcvt(arg1: f64, arg2: libc::c_int, arg3: *mut libc::c_char) -> *mut libc::c_char; +} +extern "C" { + pub fn getsubopt( + arg1: *mut *mut libc::c_char, + arg2: *const *mut libc::c_char, + arg3: *mut *mut libc::c_char, + ) -> libc::c_int; +} +extern "C" { + pub fn grantpt(arg1: libc::c_int) -> libc::c_int; +} +extern "C" { + pub fn initstate(arg1: libc::c_uint, arg2: *mut libc::c_char, arg3: usize) + -> *mut libc::c_char; +} +extern "C" { + pub fn jrand48(arg1: *mut libc::c_ushort) -> libc::c_long; +} +extern "C" { + pub fn l64a(arg1: libc::c_long) -> *mut libc::c_char; +} +extern "C" { + pub fn lcong48(arg1: *mut libc::c_ushort); +} +extern "C" { + pub fn lrand48() -> libc::c_long; +} +extern "C" { + pub fn mktemp(arg1: *mut libc::c_char) -> *mut libc::c_char; +} +extern "C" { + pub fn mkstemp(arg1: *mut libc::c_char) -> libc::c_int; +} +extern "C" { + pub fn mrand48() -> libc::c_long; +} +extern "C" { + pub fn nrand48(arg1: *mut libc::c_ushort) -> libc::c_long; +} +extern "C" { + pub fn posix_openpt(arg1: libc::c_int) -> libc::c_int; +} +extern "C" { + pub fn ptsname(arg1: libc::c_int) -> *mut libc::c_char; +} +extern "C" { + pub fn ptsname_r(fildes: libc::c_int, buffer: *mut libc::c_char, buflen: usize) -> libc::c_int; +} +extern "C" { + pub fn putenv(arg1: *mut libc::c_char) -> libc::c_int; +} +extern "C" { + pub fn random() -> libc::c_long; +} +extern "C" { + pub fn rand_r(arg1: *mut libc::c_uint) -> libc::c_int; +} +extern "C" { + #[link_name = "\u{1}_realpath$DARWIN_EXTSN"] + pub fn realpath(arg1: *const libc::c_char, arg2: *mut libc::c_char) -> *mut libc::c_char; +} +extern "C" { + pub fn seed48(arg1: *mut libc::c_ushort) -> *mut libc::c_ushort; +} +extern "C" { + pub fn setenv( + __name: *const libc::c_char, + __value: *const libc::c_char, + __overwrite: libc::c_int, + ) -> libc::c_int; +} +extern "C" { + pub fn setkey(arg1: *const libc::c_char); +} +extern "C" { + pub fn setstate(arg1: *const libc::c_char) -> *mut libc::c_char; +} +extern "C" { + pub fn srand48(arg1: libc::c_long); +} +extern "C" { + pub fn srandom(arg1: libc::c_uint); +} +extern "C" { + pub fn unlockpt(arg1: libc::c_int) -> libc::c_int; +} +extern "C" { + pub fn unsetenv(arg1: *const libc::c_char) -> libc::c_int; +} +pub type dev_t = __darwin_dev_t; +pub type mode_t = __darwin_mode_t; +extern "C" { + pub fn arc4random() -> u32; +} +extern "C" { + pub fn arc4random_addrandom(arg1: *mut libc::c_uchar, arg2: libc::c_int); +} +extern "C" { + pub fn arc4random_buf(__buf: *mut libc::c_void, __nbytes: usize); +} +extern "C" { + pub fn arc4random_stir(); +} +extern "C" { + pub fn arc4random_uniform(__upper_bound: u32) -> u32; +} +extern "C" { + pub fn atexit_b(arg1: *mut libc::c_void) -> libc::c_int; +} +extern "C" { + pub fn bsearch_b( + __key: *const libc::c_void, + __base: *const libc::c_void, + __nel: usize, + __width: usize, + __compar: *mut libc::c_void, + ) -> *mut libc::c_void; +} +extern "C" { + pub fn cgetcap( + arg1: *mut libc::c_char, + arg2: *const libc::c_char, + arg3: libc::c_int, + ) -> *mut libc::c_char; +} +extern "C" { + pub fn cgetclose() -> libc::c_int; +} +extern "C" { + pub fn cgetent( + arg1: *mut *mut libc::c_char, + arg2: *mut *mut libc::c_char, + arg3: *const libc::c_char, + ) -> libc::c_int; +} +extern "C" { + pub fn cgetfirst(arg1: *mut *mut libc::c_char, arg2: *mut *mut libc::c_char) -> libc::c_int; +} +extern "C" { + pub fn cgetmatch(arg1: *const libc::c_char, arg2: *const libc::c_char) -> libc::c_int; +} +extern "C" { + pub fn cgetnext(arg1: *mut *mut libc::c_char, arg2: *mut *mut libc::c_char) -> libc::c_int; +} +extern "C" { + pub fn cgetnum( + arg1: *mut libc::c_char, + arg2: *const libc::c_char, + arg3: *mut libc::c_long, + ) -> libc::c_int; +} +extern "C" { + pub fn cgetset(arg1: *const libc::c_char) -> libc::c_int; +} +extern "C" { + pub fn cgetstr( + arg1: *mut libc::c_char, + arg2: *const libc::c_char, + arg3: *mut *mut libc::c_char, + ) -> libc::c_int; +} +extern "C" { + pub fn cgetustr( + arg1: *mut libc::c_char, + arg2: *const libc::c_char, + arg3: *mut *mut libc::c_char, + ) -> libc::c_int; +} +extern "C" { + #[link_name = "\u{1}_daemon$1050"] + pub fn daemon(arg1: libc::c_int, arg2: libc::c_int) -> libc::c_int; +} +extern "C" { + pub fn devname(arg1: dev_t, arg2: mode_t) -> *mut libc::c_char; +} +extern "C" { + pub fn devname_r( + arg1: dev_t, + arg2: mode_t, + buf: *mut libc::c_char, + len: libc::c_int, + ) -> *mut libc::c_char; +} +extern "C" { + pub fn getbsize(arg1: *mut libc::c_int, arg2: *mut libc::c_long) -> *mut libc::c_char; +} +extern "C" { + pub fn getloadavg(arg1: *mut f64, arg2: libc::c_int) -> libc::c_int; +} +extern "C" { + pub fn getprogname() -> *const libc::c_char; +} +extern "C" { + pub fn heapsort( + __base: *mut libc::c_void, + __nel: usize, + __width: usize, + __compar: ::core::option::Option< + unsafe extern "C" fn( + arg1: *const libc::c_void, + arg2: *const libc::c_void, + ) -> libc::c_int, + >, + ) -> libc::c_int; +} +extern "C" { + pub fn heapsort_b( + __base: *mut libc::c_void, + __nel: usize, + __width: usize, + __compar: *mut libc::c_void, + ) -> libc::c_int; +} +extern "C" { + pub fn mergesort( + __base: *mut libc::c_void, + __nel: usize, + __width: usize, + __compar: ::core::option::Option< + unsafe extern "C" fn( + arg1: *const libc::c_void, + arg2: *const libc::c_void, + ) -> libc::c_int, + >, + ) -> libc::c_int; +} +extern "C" { + pub fn mergesort_b( + __base: *mut libc::c_void, + __nel: usize, + __width: usize, + __compar: *mut libc::c_void, + ) -> libc::c_int; +} +extern "C" { + pub fn psort( + __base: *mut libc::c_void, + __nel: usize, + __width: usize, + __compar: ::core::option::Option< + unsafe extern "C" fn( + arg1: *const libc::c_void, + arg2: *const libc::c_void, + ) -> libc::c_int, + >, + ); +} +extern "C" { + pub fn psort_b( + __base: *mut libc::c_void, + __nel: usize, + __width: usize, + __compar: *mut libc::c_void, + ); +} +extern "C" { + pub fn psort_r( + __base: *mut libc::c_void, + __nel: usize, + __width: usize, + arg1: *mut libc::c_void, + __compar: ::core::option::Option< + unsafe extern "C" fn( + arg1: *mut libc::c_void, + arg2: *const libc::c_void, + arg3: *const libc::c_void, + ) -> libc::c_int, + >, + ); +} +extern "C" { + pub fn qsort_b( + __base: *mut libc::c_void, + __nel: usize, + __width: usize, + __compar: *mut libc::c_void, + ); +} +extern "C" { + pub fn qsort_r( + __base: *mut libc::c_void, + __nel: usize, + __width: usize, + arg1: *mut libc::c_void, + __compar: ::core::option::Option< + unsafe extern "C" fn( + arg1: *mut libc::c_void, + arg2: *const libc::c_void, + arg3: *const libc::c_void, + ) -> libc::c_int, + >, + ); +} +extern "C" { + pub fn radixsort( + __base: *mut *const libc::c_uchar, + __nel: libc::c_int, + __table: *const libc::c_uchar, + __endbyte: libc::c_uint, + ) -> libc::c_int; +} +extern "C" { + pub fn setprogname(arg1: *const libc::c_char); +} +extern "C" { + pub fn sradixsort( + __base: *mut *const libc::c_uchar, + __nel: libc::c_int, + __table: *const libc::c_uchar, + __endbyte: libc::c_uint, + ) -> libc::c_int; +} +extern "C" { + pub fn sranddev(); +} +extern "C" { + pub fn srandomdev(); +} +extern "C" { + pub fn reallocf(__ptr: *mut libc::c_void, __size: usize) -> *mut libc::c_void; +} +extern "C" { + pub fn strtoq( + __str: *const libc::c_char, + __endptr: *mut *mut libc::c_char, + __base: libc::c_int, + ) -> libc::c_longlong; +} +extern "C" { + pub fn strtouq( + __str: *const libc::c_char, + __endptr: *mut *mut libc::c_char, + __base: libc::c_int, + ) -> libc::c_ulonglong; +} +pub type address_t = [u8; 20usize]; +pub type bytes32_t = [u8; 32usize]; +pub type wlen_t = uint_fast8_t; +#[doc = " a byte array"] +#[repr(C)] +#[derive(Debug, Copy)] +pub struct bytes { + #[doc = "< the byte-data"] + pub data: *mut u8, + #[doc = "< the length of the array ion bytes"] + pub len: u32, +} +#[test] +fn bindgen_test_layout_bytes() { + assert_eq!( + ::core::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(bytes)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(bytes)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).data as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(bytes), + "::", + stringify!(data) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).len as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(bytes), + "::", + stringify!(len) + ) + ); +} +impl Clone for bytes { + fn clone(&self) -> Self { + *self + } +} +pub type bytes_t = bytes; +#[doc = " a byte-buffer to attach byte-functions."] +#[repr(C)] +#[derive(Debug, Copy)] +pub struct bytes_builder_t { + #[doc = "< size of the currently allocated bytes"] + pub bsize: usize, + #[doc = "< the bytes struct"] + pub b: bytes_t, +} +#[test] +fn bindgen_test_layout_bytes_builder_t() { + assert_eq!( + ::core::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(bytes_builder_t)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(bytes_builder_t)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).bsize as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(bytes_builder_t), + "::", + stringify!(bsize) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).b as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(bytes_builder_t), + "::", + stringify!(b) + ) + ); +} +impl Clone for bytes_builder_t { + fn clone(&self) -> Self { + *self + } +} +extern "C" { + pub fn b_new(data: *const u8, len: u32) -> *mut bytes_t; +} +extern "C" { + pub fn b_print(a: *const bytes_t); +} +extern "C" { + pub fn ba_print(a: *const u8, l: usize); +} +extern "C" { + pub fn b_cmp(a: *const bytes_t, b: *const bytes_t) -> libc::c_int; +} +extern "C" { + pub fn bytes_cmp(a: bytes_t, b: bytes_t) -> libc::c_int; +} +extern "C" { + pub fn b_free(a: *mut bytes_t); +} +extern "C" { + pub fn b_dup(a: *const bytes_t) -> *mut bytes_t; +} +extern "C" { + pub fn b_read_byte(b: *mut bytes_t, pos: *mut usize) -> u8; +} +extern "C" { + pub fn b_read_int(b: *mut bytes_t, pos: *mut usize) -> u32; +} +extern "C" { + pub fn b_read_long(b: *mut bytes_t, pos: *mut usize) -> u64; +} +extern "C" { + pub fn b_new_chars(b: *mut bytes_t, pos: *mut usize) -> *mut libc::c_char; +} +extern "C" { + pub fn b_new_fixed_bytes(b: *mut bytes_t, pos: *mut usize, len: libc::c_int) -> *mut bytes_t; +} +extern "C" { + pub fn bb_newl(l: usize) -> *mut bytes_builder_t; +} +extern "C" { + pub fn bb_free(bb: *mut bytes_builder_t); +} +extern "C" { + pub fn bb_check_size(bb: *mut bytes_builder_t, len: usize) -> libc::c_int; +} +extern "C" { + pub fn bb_write_chars(bb: *mut bytes_builder_t, c: *mut libc::c_char, len: libc::c_int); +} +extern "C" { + pub fn bb_write_dyn_bytes(bb: *mut bytes_builder_t, src: *const bytes_t); +} +extern "C" { + pub fn bb_write_fixed_bytes(bb: *mut bytes_builder_t, src: *const bytes_t); +} +extern "C" { + pub fn bb_write_int(bb: *mut bytes_builder_t, val: u32); +} +extern "C" { + pub fn bb_write_long(bb: *mut bytes_builder_t, val: u64); +} +extern "C" { + pub fn bb_write_long_be(bb: *mut bytes_builder_t, val: u64, len: libc::c_int); +} +extern "C" { + pub fn bb_write_byte(bb: *mut bytes_builder_t, val: u8); +} +extern "C" { + pub fn bb_write_raw_bytes(bb: *mut bytes_builder_t, ptr: *mut libc::c_void, len: usize); +} +extern "C" { + pub fn bb_clear(bb: *mut bytes_builder_t); +} +extern "C" { + pub fn bb_replace( + bb: *mut bytes_builder_t, + offset: libc::c_int, + delete_len: libc::c_int, + data: *mut u8, + data_len: libc::c_int, + ); +} +extern "C" { + pub fn bb_move_to_bytes(bb: *mut bytes_builder_t) -> *mut bytes_t; +} +extern "C" { + pub fn bb_read_long(bb: *mut bytes_builder_t, i: *mut usize) -> u64; +} +extern "C" { + pub fn bb_read_int(bb: *mut bytes_builder_t, i: *mut usize) -> u32; +} +extern "C" { + pub fn cloned_bytes(data: bytes_t) -> bytes_t; +} +pub type rsize_t = libc::c_ulong; +pub type max_align_t = f64; +#[doc = " string build struct, which is able to hold and modify a growing string."] +#[repr(C)] +#[derive(Debug, Copy)] +pub struct sb { + #[doc = "< the current string (null terminated)"] + pub data: *mut libc::c_char, + #[doc = "< number of bytes currently allocated"] + pub allocted: usize, + #[doc = "< the current length of the string"] + pub len: usize, +} +#[test] +fn bindgen_test_layout_sb() { + assert_eq!( + ::core::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(sb)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(sb)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).data as *const _ as usize }, + 0usize, + concat!("Offset of field: ", stringify!(sb), "::", stringify!(data)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).allocted as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(sb), + "::", + stringify!(allocted) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).len as *const _ as usize }, + 16usize, + concat!("Offset of field: ", stringify!(sb), "::", stringify!(len)) + ); +} +impl Clone for sb { + fn clone(&self) -> Self { + *self + } +} +pub type sb_t = sb; +extern "C" { + pub fn sb_new(chars: *const libc::c_char) -> *mut sb_t; +} +extern "C" { + pub fn sb_init(sb: *mut sb_t) -> *mut sb_t; +} +extern "C" { + pub fn sb_free(sb: *mut sb_t); +} +extern "C" { + pub fn sb_add_char(sb: *mut sb_t, c: libc::c_char) -> *mut sb_t; +} +extern "C" { + pub fn sb_add_chars(sb: *mut sb_t, chars: *const libc::c_char) -> *mut sb_t; +} +extern "C" { + pub fn sb_add_range( + sb: *mut sb_t, + chars: *const libc::c_char, + start: libc::c_int, + len: libc::c_int, + ) -> *mut sb_t; +} +extern "C" { + pub fn sb_add_key_value( + sb: *mut sb_t, + key: *const libc::c_char, + value: *const libc::c_char, + value_len: libc::c_int, + as_string: bool, + ) -> *mut sb_t; +} +extern "C" { + pub fn sb_add_bytes( + sb: *mut sb_t, + prefix: *const libc::c_char, + bytes: *const bytes_t, + len: libc::c_int, + as_array: bool, + ) -> *mut sb_t; +} +extern "C" { + pub fn sb_add_hexuint_l(sb: *mut sb_t, uint: uintmax_t, l: usize) -> *mut sb_t; +} +extern "C" { + pub fn memchr( + __s: *const libc::c_void, + __c: libc::c_int, + __n: libc::c_ulong, + ) -> *mut libc::c_void; +} +extern "C" { + pub fn memcmp( + __s1: *const libc::c_void, + __s2: *const libc::c_void, + __n: libc::c_ulong, + ) -> libc::c_int; +} +extern "C" { + pub fn memcpy( + __dst: *mut libc::c_void, + __src: *const libc::c_void, + __n: libc::c_ulong, + ) -> *mut libc::c_void; +} +extern "C" { + pub fn memmove( + __dst: *mut libc::c_void, + __src: *const libc::c_void, + __len: libc::c_ulong, + ) -> *mut libc::c_void; +} +extern "C" { + pub fn memset( + __b: *mut libc::c_void, + __c: libc::c_int, + __len: libc::c_ulong, + ) -> *mut libc::c_void; +} +extern "C" { + pub fn strcat(__s1: *mut libc::c_char, __s2: *const libc::c_char) -> *mut libc::c_char; +} +extern "C" { + pub fn strchr(__s: *const libc::c_char, __c: libc::c_int) -> *mut libc::c_char; +} +extern "C" { + pub fn strcmp(__s1: *const libc::c_char, __s2: *const libc::c_char) -> libc::c_int; +} +extern "C" { + pub fn strcoll(__s1: *const libc::c_char, __s2: *const libc::c_char) -> libc::c_int; +} +extern "C" { + pub fn strcpy(__dst: *mut libc::c_char, __src: *const libc::c_char) -> *mut libc::c_char; +} +extern "C" { + pub fn strcspn(__s: *const libc::c_char, __charset: *const libc::c_char) -> libc::c_ulong; +} +extern "C" { + pub fn strerror(__errnum: libc::c_int) -> *mut libc::c_char; +} +extern "C" { + pub fn strlen(__s: *const libc::c_char) -> libc::c_ulong; +} +extern "C" { + pub fn strncat( + __s1: *mut libc::c_char, + __s2: *const libc::c_char, + __n: libc::c_ulong, + ) -> *mut libc::c_char; +} +extern "C" { + pub fn strncmp( + __s1: *const libc::c_char, + __s2: *const libc::c_char, + __n: libc::c_ulong, + ) -> libc::c_int; +} +extern "C" { + pub fn strncpy( + __dst: *mut libc::c_char, + __src: *const libc::c_char, + __n: libc::c_ulong, + ) -> *mut libc::c_char; +} +extern "C" { + pub fn strpbrk(__s: *const libc::c_char, __charset: *const libc::c_char) -> *mut libc::c_char; +} +extern "C" { + pub fn strrchr(__s: *const libc::c_char, __c: libc::c_int) -> *mut libc::c_char; +} +extern "C" { + pub fn strspn(__s: *const libc::c_char, __charset: *const libc::c_char) -> libc::c_ulong; +} +extern "C" { + pub fn strstr(__big: *const libc::c_char, __little: *const libc::c_char) -> *mut libc::c_char; +} +extern "C" { + pub fn strtok(__str: *mut libc::c_char, __sep: *const libc::c_char) -> *mut libc::c_char; +} +extern "C" { + pub fn strxfrm( + __s1: *mut libc::c_char, + __s2: *const libc::c_char, + __n: libc::c_ulong, + ) -> libc::c_ulong; +} +extern "C" { + pub fn strtok_r( + __str: *mut libc::c_char, + __sep: *const libc::c_char, + __lasts: *mut *mut libc::c_char, + ) -> *mut libc::c_char; +} +extern "C" { + pub fn strerror_r( + __errnum: libc::c_int, + __strerrbuf: *mut libc::c_char, + __buflen: usize, + ) -> libc::c_int; +} +extern "C" { + pub fn strdup(__s1: *const libc::c_char) -> *mut libc::c_char; +} +extern "C" { + pub fn memccpy( + __dst: *mut libc::c_void, + __src: *const libc::c_void, + __c: libc::c_int, + __n: usize, + ) -> *mut libc::c_void; +} +extern "C" { + pub fn stpcpy(__dst: *mut libc::c_char, __src: *const libc::c_char) -> *mut libc::c_char; +} +extern "C" { + pub fn stpncpy( + __dst: *mut libc::c_char, + __src: *const libc::c_char, + __n: libc::c_ulong, + ) -> *mut libc::c_char; +} +extern "C" { + pub fn strndup(__s1: *const libc::c_char, __n: libc::c_ulong) -> *mut libc::c_char; +} +extern "C" { + pub fn strnlen(__s1: *const libc::c_char, __n: usize) -> usize; +} +extern "C" { + pub fn strsignal(__sig: libc::c_int) -> *mut libc::c_char; +} +pub type errno_t = libc::c_int; +extern "C" { + pub fn memset_s( + __s: *mut libc::c_void, + __smax: rsize_t, + __c: libc::c_int, + __n: rsize_t, + ) -> errno_t; +} +extern "C" { + pub fn memmem( + __big: *const libc::c_void, + __big_len: usize, + __little: *const libc::c_void, + __little_len: usize, + ) -> *mut libc::c_void; +} +extern "C" { + pub fn memset_pattern4(__b: *mut libc::c_void, __pattern4: *const libc::c_void, __len: usize); +} +extern "C" { + pub fn memset_pattern8(__b: *mut libc::c_void, __pattern8: *const libc::c_void, __len: usize); +} +extern "C" { + pub fn memset_pattern16(__b: *mut libc::c_void, __pattern16: *const libc::c_void, __len: usize); +} +extern "C" { + pub fn strcasestr( + __big: *const libc::c_char, + __little: *const libc::c_char, + ) -> *mut libc::c_char; +} +extern "C" { + pub fn strnstr( + __big: *const libc::c_char, + __little: *const libc::c_char, + __len: usize, + ) -> *mut libc::c_char; +} +extern "C" { + pub fn strlcat( + __dst: *mut libc::c_char, + __source: *const libc::c_char, + __size: libc::c_ulong, + ) -> libc::c_ulong; +} +extern "C" { + pub fn strlcpy( + __dst: *mut libc::c_char, + __source: *const libc::c_char, + __size: libc::c_ulong, + ) -> libc::c_ulong; +} +extern "C" { + pub fn strmode(__mode: libc::c_int, __bp: *mut libc::c_char); +} +extern "C" { + pub fn strsep( + __stringp: *mut *mut libc::c_char, + __delim: *const libc::c_char, + ) -> *mut libc::c_char; +} +extern "C" { + pub fn swab(arg1: *const libc::c_void, arg2: *mut libc::c_void, arg3: isize); +} +extern "C" { + pub fn timingsafe_bcmp( + __b1: *const libc::c_void, + __b2: *const libc::c_void, + __len: usize, + ) -> libc::c_int; +} +extern "C" { + pub fn bcmp(arg1: *const libc::c_void, arg2: *const libc::c_void, arg3: usize) -> libc::c_int; +} +extern "C" { + pub fn bcopy(arg1: *const libc::c_void, arg2: *mut libc::c_void, arg3: usize); +} +extern "C" { + pub fn bzero(arg1: *mut libc::c_void, arg2: libc::c_ulong); +} +extern "C" { + pub fn index(arg1: *const libc::c_char, arg2: libc::c_int) -> *mut libc::c_char; +} +extern "C" { + pub fn rindex(arg1: *const libc::c_char, arg2: libc::c_int) -> *mut libc::c_char; +} +extern "C" { + pub fn ffs(arg1: libc::c_int) -> libc::c_int; +} +extern "C" { + pub fn strcasecmp(arg1: *const libc::c_char, arg2: *const libc::c_char) -> libc::c_int; +} +extern "C" { + pub fn strncasecmp( + arg1: *const libc::c_char, + arg2: *const libc::c_char, + arg3: libc::c_ulong, + ) -> libc::c_int; +} +extern "C" { + pub fn ffsl(arg1: libc::c_long) -> libc::c_int; +} +extern "C" { + pub fn ffsll(arg1: libc::c_longlong) -> libc::c_int; +} +extern "C" { + pub fn fls(arg1: libc::c_int) -> libc::c_int; +} +extern "C" { + pub fn flsl(arg1: libc::c_long) -> libc::c_int; +} +extern "C" { + pub fn flsll(arg1: libc::c_longlong) -> libc::c_int; +} +pub type d_key_t = u16; +#[repr(u32)] +#[doc = " type of a token."] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub enum d_type_t { + #[doc = "< content is stored as data ptr."] + T_BYTES = 0, + #[doc = "(), + 16usize, + concat!("Size of: ", stringify!(item)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(item)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).data as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(item), + "::", + stringify!(data) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).len as *const _ as usize }, + 8usize, + concat!("Offset of field: ", stringify!(item), "::", stringify!(len)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).key as *const _ as usize }, + 12usize, + concat!("Offset of field: ", stringify!(item), "::", stringify!(key)) + ); +} +impl Clone for item { + fn clone(&self) -> Self { + *self + } +} +pub type d_token_t = item; +#[doc = " internal type used to represent the a range within a string."] +#[repr(C)] +#[derive(Debug, Copy)] +pub struct str_range { + #[doc = "< pointer to the start of the string"] + pub data: *mut libc::c_char, + #[doc = "< len of the characters"] + pub len: usize, +} +#[test] +fn bindgen_test_layout_str_range() { + assert_eq!( + ::core::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(str_range)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(str_range)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).data as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(str_range), + "::", + stringify!(data) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).len as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(str_range), + "::", + stringify!(len) + ) + ); +} +impl Clone for str_range { + fn clone(&self) -> Self { + *self + } +} +pub type str_range_t = str_range; +#[doc = " parser for json or binary-data. it needs to freed after usage."] +#[repr(C)] +#[derive(Debug, Copy)] +pub struct json_parser { + #[doc = "< the list of all tokens. the first token is the main-token as returned by the parser."] + pub result: *mut d_token_t, + pub c: *mut libc::c_char, + #[doc = " pointer to the src-data"] + pub allocated: usize, + #[doc = " amount of tokens allocated result"] + pub len: usize, + #[doc = " number of tokens in result"] + pub depth: usize, +} +#[test] +fn bindgen_test_layout_json_parser() { + assert_eq!( + ::core::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(json_parser)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(json_parser)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).result as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(json_parser), + "::", + stringify!(result) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).c as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(json_parser), + "::", + stringify!(c) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).allocated as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(json_parser), + "::", + stringify!(allocated) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).len as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(json_parser), + "::", + stringify!(len) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).depth as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(json_parser), + "::", + stringify!(depth) + ) + ); +} +impl Clone for json_parser { + fn clone(&self) -> Self { + *self + } +} +pub type json_ctx_t = json_parser; +extern "C" { + #[doc = " returns the byte-representation of token."] + #[doc = ""] + #[doc = " In case of a number it is returned as bigendian."] + #[doc = " booleans as 0x01 or 0x00"] + #[doc = " and NULL as 0x."] + #[doc = " Objects or arrays will return 0x."] + pub fn d_to_bytes(item: *mut d_token_t) -> bytes_t; +} +extern "C" { + pub fn d_bytes_to(item: *mut d_token_t, dst: *mut u8, max: libc::c_int) -> libc::c_int; +} +extern "C" { + pub fn d_bytes(item: *const d_token_t) -> *mut bytes_t; +} +extern "C" { + pub fn d_bytesl(item: *mut d_token_t, l: usize) -> *mut bytes_t; +} +extern "C" { + pub fn d_string(item: *const d_token_t) -> *mut libc::c_char; +} +extern "C" { + pub fn d_int(item: *const d_token_t) -> i32; +} +extern "C" { + pub fn d_intd(item: *const d_token_t, def_val: u32) -> i32; +} +extern "C" { + pub fn d_long(item: *const d_token_t) -> u64; +} +extern "C" { + pub fn d_longd(item: *const d_token_t, def_val: u64) -> u64; +} +extern "C" { + pub fn d_create_bytes_vec(arr: *const d_token_t) -> *mut *mut bytes_t; +} +extern "C" { + pub fn d_eq(a: *const d_token_t, b: *const d_token_t) -> bool; +} +extern "C" { + pub fn keyn(c: *const libc::c_char, len: usize) -> d_key_t; +} +extern "C" { + pub fn d_get(item: *mut d_token_t, key: u16) -> *mut d_token_t; +} +extern "C" { + pub fn d_get_or(item: *mut d_token_t, key1: u16, key2: u16) -> *mut d_token_t; +} +extern "C" { + pub fn d_get_at(item: *mut d_token_t, index: u32) -> *mut d_token_t; +} +extern "C" { + pub fn d_next(item: *mut d_token_t) -> *mut d_token_t; +} +extern "C" { + pub fn d_serialize_binary(bb: *mut bytes_builder_t, t: *mut d_token_t); +} +extern "C" { + pub fn parse_binary(data: *const bytes_t) -> *mut json_ctx_t; +} +extern "C" { + pub fn parse_binary_str(data: *const libc::c_char, len: libc::c_int) -> *mut json_ctx_t; +} +extern "C" { + pub fn parse_json(js: *const libc::c_char) -> *mut json_ctx_t; +} +extern "C" { + pub fn json_free(parser_ctx: *mut json_ctx_t); +} +extern "C" { + pub fn d_to_json(item: *const d_token_t) -> str_range_t; +} +extern "C" { + pub fn d_create_json(item: *mut d_token_t) -> *mut libc::c_char; +} +extern "C" { + pub fn json_create() -> *mut json_ctx_t; +} +extern "C" { + pub fn json_create_null(jp: *mut json_ctx_t) -> *mut d_token_t; +} +extern "C" { + pub fn json_create_bool(jp: *mut json_ctx_t, value: bool) -> *mut d_token_t; +} +extern "C" { + pub fn json_create_int(jp: *mut json_ctx_t, value: u64) -> *mut d_token_t; +} +extern "C" { + pub fn json_create_string(jp: *mut json_ctx_t, value: *mut libc::c_char) -> *mut d_token_t; +} +extern "C" { + pub fn json_create_bytes(jp: *mut json_ctx_t, value: bytes_t) -> *mut d_token_t; +} +extern "C" { + pub fn json_create_object(jp: *mut json_ctx_t) -> *mut d_token_t; +} +extern "C" { + pub fn json_create_array(jp: *mut json_ctx_t) -> *mut d_token_t; +} +extern "C" { + pub fn json_object_add_prop( + object: *mut d_token_t, + key: d_key_t, + value: *mut d_token_t, + ) -> *mut d_token_t; +} +extern "C" { + pub fn json_array_add_value(object: *mut d_token_t, value: *mut d_token_t) -> *mut d_token_t; +} +extern "C" { + pub fn d_get_keystr(k: d_key_t) -> *mut libc::c_char; +} +extern "C" { + pub fn d_track_keynames(v: u8); +} +extern "C" { + pub fn d_clear_keynames(); +} +extern "C" { + pub fn d_get_byteskl(r: *mut d_token_t, k: d_key_t, minl: u32) -> *mut bytes_t; +} +extern "C" { + pub fn d_getl(item: *mut d_token_t, k: u16, minl: u32) -> *mut d_token_t; +} +#[doc = " iterator over elements of a array opf object."] +#[doc = ""] +#[doc = " usage:"] +#[doc = " ```c"] +#[doc = " for (d_iterator_t iter = d_iter( parent ); iter.left ; d_iter_next(&iter)) {"] +#[doc = " uint32_t val = d_int(iter.token);"] +#[doc = " }"] +#[doc = " ```"] +#[repr(C)] +#[derive(Debug, Copy)] +pub struct d_iterator { + #[doc = "< current token"] + pub token: *mut d_token_t, + #[doc = "< number of result left"] + pub left: libc::c_int, +} +#[test] +fn bindgen_test_layout_d_iterator() { + assert_eq!( + ::core::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(d_iterator)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(d_iterator)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).token as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(d_iterator), + "::", + stringify!(token) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).left as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(d_iterator), + "::", + stringify!(left) + ) + ); +} +impl Clone for d_iterator { + fn clone(&self) -> Self { + *self + } +} +pub type d_iterator_t = d_iterator; +#[doc = " represents a single cache entry in a linked list."] +#[doc = " These are used within a request context to cache values and automaticly free them."] +#[repr(C)] +#[derive(Debug, Copy)] +pub struct cache_entry { + #[doc = "< an optional key of the entry"] + pub key: bytes_t, + #[doc = "< the value"] + pub value: bytes_t, + #[doc = "< the buffer is used to store extra data, which will be cleaned when freed."] + pub buffer: [u8; 4usize], + #[doc = "< if true, the cache-entry will be freed when the request context is cleaned up."] + pub must_free: bool, + #[doc = "< pointer to the next entry."] + pub next: *mut cache_entry, +} +#[test] +fn bindgen_test_layout_cache_entry() { + assert_eq!( + ::core::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(cache_entry)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(cache_entry)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).key as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(cache_entry), + "::", + stringify!(key) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).value as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(cache_entry), + "::", + stringify!(value) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).buffer as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(cache_entry), + "::", + stringify!(buffer) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).must_free as *const _ as usize }, + 36usize, + concat!( + "Offset of field: ", + stringify!(cache_entry), + "::", + stringify!(must_free) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).next as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(cache_entry), + "::", + stringify!(next) + ) + ); +} +impl Clone for cache_entry { + fn clone(&self) -> Self { + *self + } +} +pub type cache_entry_t = cache_entry; +extern "C" { + #[doc = " get the entry for a given key."] + pub fn in3_cache_get_entry(cache: *mut cache_entry_t, key: *mut bytes_t) -> *mut bytes_t; +} +extern "C" { + #[doc = " adds an entry to the linked list."] + pub fn in3_cache_add_entry( + cache: *mut *mut cache_entry_t, + key: bytes_t, + value: bytes_t, + ) -> *mut cache_entry_t; +} +extern "C" { + #[doc = " clears all entries in the linked list."] + pub fn in3_cache_free(cache: *mut cache_entry_t); +} +extern "C" { + #[doc = " converts the bytes to a unsigned long (at least the last max len bytes)"] + pub fn bytes_to_long(data: *const u8, len: libc::c_int) -> u64; +} +extern "C" { + #[doc = " converts a character into a uint64_t"] + pub fn char_to_long(a: *const libc::c_char, l: libc::c_int) -> u64; +} +extern "C" { + #[doc = " converts a hexchar to byte (4bit)"] + pub fn hexchar_to_int(c: libc::c_char) -> u8; +} +extern "C" { + #[doc = " converts a uint64_t to string (char*); buffer-size min. 21 bytes"] + pub fn u64_to_str( + value: u64, + pBuf: *mut libc::c_char, + szBuf: libc::c_int, + ) -> *const libc::c_char; +} +extern "C" { + #[doc = " convert a c hex string to a byte array storing it into an existing buffer."] + #[doc = ""] + #[doc = " @param hexdata: the hex string"] + #[doc = " @param hexlen: the len of the string to read. -1 will use strlen to determine the length."] + #[doc = " @param out: the byte buffer"] + #[doc = " @param outlen: the length of the buffer to write into"] + #[doc = " @retval the number of bytes written"] + pub fn hex_to_bytes( + hexdata: *const libc::c_char, + hexlen: libc::c_int, + out: *mut u8, + outlen: libc::c_int, + ) -> libc::c_int; +} +extern "C" { + #[doc = " convert a c string to a byte array creating a new buffer"] + pub fn hex_to_new_bytes(buf: *const libc::c_char, len: libc::c_int) -> *mut bytes_t; +} +extern "C" { + #[doc = " convefrts a bytes into hex"] + pub fn bytes_to_hex(buffer: *const u8, len: libc::c_int, out: *mut libc::c_char) + -> libc::c_int; +} +extern "C" { + #[doc = " hashes the bytes and creates a new bytes_t"] + pub fn sha3(data: *const bytes_t) -> *mut bytes_t; +} +extern "C" { + #[doc = " writes 32 bytes to the pointer."] + pub fn sha3_to(data: *mut bytes_t, dst: *mut libc::c_void) -> libc::c_int; +} +extern "C" { + #[doc = " converts a long to 8 bytes"] + pub fn long_to_bytes(val: u64, dst: *mut u8); +} +extern "C" { + #[doc = " converts a int to 4 bytes"] + pub fn int_to_bytes(val: u32, dst: *mut u8); +} +extern "C" { + #[doc = " duplicate the string"] + pub fn _strdupn(src: *const libc::c_char, len: libc::c_int) -> *mut libc::c_char; +} +extern "C" { + #[doc = " calculate the min number of byte to represents the len"] + pub fn min_bytes_len(val: u64) -> libc::c_int; +} +extern "C" { + #[doc = " sets a variable value to 32byte word."] + pub fn uint256_set(src: *const u8, src_len: wlen_t, dst: *mut u8); +} +extern "C" { + #[doc = " replaces a string and returns a copy."] + #[doc = " @retval"] + pub fn str_replace( + orig: *mut libc::c_char, + rep: *const libc::c_char, + with: *const libc::c_char, + ) -> *mut libc::c_char; +} +extern "C" { + #[doc = " replaces a string at the given position."] + pub fn str_replace_pos( + orig: *mut libc::c_char, + pos: usize, + len: usize, + rep: *const libc::c_char, + ) -> *mut libc::c_char; +} +extern "C" { + #[doc = " lightweight strstr() replacements"] + pub fn str_find(haystack: *mut libc::c_char, needle: *const libc::c_char) -> *mut libc::c_char; +} +extern "C" { + #[doc = " remove all html-tags in the text."] + pub fn str_remove_html(data: *mut libc::c_char) -> *mut libc::c_char; +} +extern "C" { + #[doc = " current timestamp in ms."] + pub fn current_ms() -> u64; +} +#[doc = " time function"] +#[doc = " defaults to k_uptime_get() for zeohyr and time(NULL) for other platforms"] +#[doc = " expected to return a u64 value representative of time (from epoch/start)"] +pub type time_func = ::core::option::Option u64>; +extern "C" { + pub fn in3_set_func_time(fn_: time_func); +} +extern "C" { + pub fn in3_time(t: *mut libc::c_void) -> u64; +} +#[doc = " rand function"] +#[doc = " defaults to k_uptime_get() for zeohyr and rand() for other platforms"] +#[doc = " expected to return a random number"] +pub type rand_func = + ::core::option::Option libc::c_int>; +extern "C" { + pub fn in3_set_func_rand(fn_: rand_func); +} +extern "C" { + pub fn in3_rand(s: *mut libc::c_void) -> libc::c_int; +} +#[doc = " srand function"] +#[doc = " defaults to NOOP for zephyr and srand() for other platforms"] +#[doc = " expected to set the seed for a new sequence of random numbers to be returned by in3_rand()"] +pub type srand_func = ::core::option::Option; +extern "C" { + pub fn in3_set_func_srand(fn_: srand_func); +} +extern "C" { + pub fn in3_srand(s: libc::c_uint); +} +pub mod in3_ret_t { + #[doc = " ERROR types used as return values."] + #[doc = ""] + #[doc = " All values (except IN3_OK) indicate an error."] + #[doc = " IN3_WAITING may be treated like an error, since we have stop executing until the response has arrived, but it is a valid return value."] + pub type Type = i32; + #[doc = "< Success"] + pub const IN3_OK: Type = 0; + #[doc = "< Unknown error - usually accompanied with specific error msg"] + pub const IN3_EUNKNOWN: Type = -1; + #[doc = "< No memory"] + pub const IN3_ENOMEM: Type = -2; + #[doc = "< Not supported"] + pub const IN3_ENOTSUP: Type = -3; + #[doc = "< Invalid value"] + pub const IN3_EINVAL: Type = -4; + #[doc = "< Not found"] + pub const IN3_EFIND: Type = -5; + #[doc = "< Invalid config"] + pub const IN3_ECONFIG: Type = -6; + #[doc = "< Limit reached"] + pub const IN3_ELIMIT: Type = -7; + #[doc = "< Version mismatch"] + pub const IN3_EVERS: Type = -8; + #[doc = "< Data invalid, eg. invalid/incomplete JSON"] + pub const IN3_EINVALDT: Type = -9; + #[doc = "< Wrong password"] + pub const IN3_EPASS: Type = -10; + #[doc = "< RPC error (i.e. in3_ctx_t::error set)"] + pub const IN3_ERPC: Type = -11; + #[doc = "< RPC no response"] + pub const IN3_ERPCNRES: Type = -12; + #[doc = "< USN URL parse error"] + pub const IN3_EUSNURL: Type = -13; + #[doc = "< Transport error"] + pub const IN3_ETRANS: Type = -14; + #[doc = "< Not in range"] + pub const IN3_ERANGE: Type = -15; + #[doc = "< the process can not be finished since we are waiting for responses"] + pub const IN3_WAITING: Type = -16; + #[doc = "< Ignorable error"] + pub const IN3_EIGNORE: Type = -17; + #[doc = "< payment required"] + pub const IN3_EPAYMENT_REQUIRED: Type = -18; +} +extern "C" { + #[doc = " converts a error code into a string."] + #[doc = " These strings are constants and do not need to be freed."] + pub fn in3_errmsg(err: in3_ret_t::Type) -> *mut libc::c_char; +} +pub type clock_t = __darwin_clock_t; +pub type time_t = __darwin_time_t; +#[repr(C)] +#[derive(Debug, Copy)] +pub struct timespec { + pub tv_sec: __darwin_time_t, + pub tv_nsec: libc::c_long, +} +#[test] +fn bindgen_test_layout_timespec() { + assert_eq!( + ::core::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(timespec)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(timespec)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).tv_sec as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(timespec), + "::", + stringify!(tv_sec) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).tv_nsec as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(timespec), + "::", + stringify!(tv_nsec) + ) + ); +} +impl Clone for timespec { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct tm { + pub tm_sec: libc::c_int, + pub tm_min: libc::c_int, + pub tm_hour: libc::c_int, + pub tm_mday: libc::c_int, + pub tm_mon: libc::c_int, + pub tm_year: libc::c_int, + pub tm_wday: libc::c_int, + pub tm_yday: libc::c_int, + pub tm_isdst: libc::c_int, + pub tm_gmtoff: libc::c_long, + pub tm_zone: *mut libc::c_char, +} +#[test] +fn bindgen_test_layout_tm() { + assert_eq!( + ::core::mem::size_of::(), + 56usize, + concat!("Size of: ", stringify!(tm)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(tm)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).tm_sec as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(tm), + "::", + stringify!(tm_sec) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).tm_min as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(tm), + "::", + stringify!(tm_min) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).tm_hour as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(tm), + "::", + stringify!(tm_hour) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).tm_mday as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(tm), + "::", + stringify!(tm_mday) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).tm_mon as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(tm), + "::", + stringify!(tm_mon) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).tm_year as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(tm), + "::", + stringify!(tm_year) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).tm_wday as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(tm), + "::", + stringify!(tm_wday) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).tm_yday as *const _ as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(tm), + "::", + stringify!(tm_yday) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).tm_isdst as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(tm), + "::", + stringify!(tm_isdst) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).tm_gmtoff as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(tm), + "::", + stringify!(tm_gmtoff) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).tm_zone as *const _ as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(tm), + "::", + stringify!(tm_zone) + ) + ); +} +impl Clone for tm { + fn clone(&self) -> Self { + *self + } +} +extern "C" { + pub fn asctime(arg1: *const tm) -> *mut libc::c_char; +} +extern "C" { + pub fn clock() -> clock_t; +} +extern "C" { + pub fn ctime(arg1: *const time_t) -> *mut libc::c_char; +} +extern "C" { + pub fn difftime(arg1: time_t, arg2: time_t) -> f64; +} +extern "C" { + pub fn getdate(arg1: *const libc::c_char) -> *mut tm; +} +extern "C" { + pub fn gmtime(arg1: *const time_t) -> *mut tm; +} +extern "C" { + pub fn localtime(arg1: *const time_t) -> *mut tm; +} +extern "C" { + pub fn mktime(arg1: *mut tm) -> time_t; +} +extern "C" { + pub fn strftime( + arg1: *mut libc::c_char, + arg2: usize, + arg3: *const libc::c_char, + arg4: *const tm, + ) -> usize; +} +extern "C" { + pub fn strptime( + arg1: *const libc::c_char, + arg2: *const libc::c_char, + arg3: *mut tm, + ) -> *mut libc::c_char; +} +extern "C" { + pub fn time(arg1: *mut time_t) -> time_t; +} +extern "C" { + pub fn tzset(); +} +extern "C" { + pub fn asctime_r(arg1: *const tm, arg2: *mut libc::c_char) -> *mut libc::c_char; +} +extern "C" { + pub fn ctime_r(arg1: *const time_t, arg2: *mut libc::c_char) -> *mut libc::c_char; +} +extern "C" { + pub fn gmtime_r(arg1: *const time_t, arg2: *mut tm) -> *mut tm; +} +extern "C" { + pub fn localtime_r(arg1: *const time_t, arg2: *mut tm) -> *mut tm; +} +extern "C" { + pub fn posix2time(arg1: time_t) -> time_t; +} +extern "C" { + pub fn tzsetwall(); +} +extern "C" { + pub fn time2posix(arg1: time_t) -> time_t; +} +extern "C" { + pub fn timelocal(arg1: *mut tm) -> time_t; +} +extern "C" { + pub fn timegm(arg1: *mut tm) -> time_t; +} +extern "C" { + pub fn nanosleep(__rqtp: *const timespec, __rmtp: *mut timespec) -> libc::c_int; +} +#[repr(u32)] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub enum clockid_t { + _CLOCK_REALTIME = 0, + _CLOCK_MONOTONIC = 6, + _CLOCK_MONOTONIC_RAW = 4, + _CLOCK_MONOTONIC_RAW_APPROX = 5, + _CLOCK_UPTIME_RAW = 8, + _CLOCK_UPTIME_RAW_APPROX = 9, + _CLOCK_PROCESS_CPUTIME_ID = 12, + _CLOCK_THREAD_CPUTIME_ID = 16, +} +extern "C" { + pub fn clock_getres(__clock_id: clockid_t, __res: *mut timespec) -> libc::c_int; +} +extern "C" { + pub fn clock_gettime(__clock_id: clockid_t, __tp: *mut timespec) -> libc::c_int; +} +extern "C" { + pub fn clock_gettime_nsec_np(__clock_id: clockid_t) -> __uint64_t; +} +extern "C" { + pub fn clock_settime(__clock_id: clockid_t, __tp: *const timespec) -> libc::c_int; +} +#[doc = " type for a chain_id."] +pub type chain_id_t = u32; +#[repr(u32)] +#[doc = " the type of the chain."] +#[doc = ""] +#[doc = " for incubed a chain can be any distributed network or database with incubed support."] +#[doc = " Depending on this chain-type the previously registered verifyer will be choosen and used."] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub enum in3_chain_type_t { + #[doc = "< Ethereum chain"] + CHAIN_ETH = 0, + #[doc = "< substrate chain"] + CHAIN_SUBSTRATE = 1, + #[doc = "< ipfs verifiaction"] + CHAIN_IPFS = 2, + #[doc = "< Bitcoin chain"] + CHAIN_BTC = 3, + #[doc = "< EOS chain"] + CHAIN_EOS = 4, + #[doc = "< IOTA chain"] + CHAIN_IOTA = 5, + #[doc = "< other chains"] + CHAIN_GENERIC = 6, +} +#[repr(u32)] +#[doc = " the type of proof."] +#[doc = ""] +#[doc = " Depending on the proof-type different levels of proof will be requested from the node."] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub enum in3_proof_t { + #[doc = "< No Verification"] + PROOF_NONE = 0, + #[doc = "< Standard Verification of the important properties"] + PROOF_STANDARD = 1, + #[doc = "< All field will be validated including uncles"] + PROOF_FULL = 2, +} +#[repr(u32)] +#[doc = " verification as delivered by the server."] +#[doc = ""] +#[doc = " This will be part of the in3-request and will be generated based on the prooftype."] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub enum in3_verification_t { + #[doc = "< No Verifacation"] + VERIFICATION_NEVER = 0, + #[doc = "< Includes the proof of the data"] + VERIFICATION_PROOF = 1, +} +#[doc = " the configuration as part of each incubed request."] +#[doc = " This will be generated for each request based on the client-configuration. the verifier may access this during verification in order to check against the request."] +#[doc = ""] +#[repr(C)] +#[derive(Debug, Copy)] +pub struct in3_request_config { + #[doc = "< the chain to be used. this is holding the integer-value of the hexstring."] + pub chain_id: chain_id_t, + #[doc = "< the current flags from the client."] + pub flags: uint_fast8_t, + #[doc = "< this flaqg is set, if the proof is set to \"PROOF_FULL\""] + pub use_full_proof: u8, + #[doc = "< a list of blockhashes already verified. The Server will not send any proof for them again ."] + pub verified_hashes: *mut bytes_t, + #[doc = "< number of verified blockhashes"] + pub verified_hashes_length: u16, + #[doc = "< the last blocknumber the nodelistz changed"] + pub latest_block: u8, + #[doc = "< number of signatures( in percent) needed in order to reach finality."] + pub finality: u16, + #[doc = "< Verification-type"] + pub verification: in3_verification_t, + #[doc = "< the addresses of servers requested to sign the blockhash"] + pub signers: *mut bytes_t, + #[doc = "< number or addresses"] + pub signers_length: u8, + #[doc = "< meassured time in ms for the request"] + pub time: u32, +} +#[test] +fn bindgen_test_layout_in3_request_config() { + assert_eq!( + ::core::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(in3_request_config)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(in3_request_config)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).chain_id as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(in3_request_config), + "::", + stringify!(chain_id) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(in3_request_config), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).use_full_proof as *const _ as usize + }, + 5usize, + concat!( + "Offset of field: ", + stringify!(in3_request_config), + "::", + stringify!(use_full_proof) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).verified_hashes as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(in3_request_config), + "::", + stringify!(verified_hashes) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).verified_hashes_length as *const _ + as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(in3_request_config), + "::", + stringify!(verified_hashes_length) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).latest_block as *const _ as usize + }, + 18usize, + concat!( + "Offset of field: ", + stringify!(in3_request_config), + "::", + stringify!(latest_block) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).finality as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(in3_request_config), + "::", + stringify!(finality) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).verification as *const _ as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(in3_request_config), + "::", + stringify!(verification) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).signers as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(in3_request_config), + "::", + stringify!(signers) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).signers_length as *const _ as usize + }, + 40usize, + concat!( + "Offset of field: ", + stringify!(in3_request_config), + "::", + stringify!(signers_length) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).time as *const _ as usize }, + 44usize, + concat!( + "Offset of field: ", + stringify!(in3_request_config), + "::", + stringify!(time) + ) + ); +} +impl Clone for in3_request_config { + fn clone(&self) -> Self { + *self + } +} +pub type in3_request_config_t = in3_request_config; +#[doc = " Node capabilities"] +#[doc = " @note Always access using getters/setters in nodelist.h"] +pub type in3_node_props_t = u64; +#[repr(u32)] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub enum in3_node_props_type_t { + #[doc = "< filter out nodes which are providing no proof"] + NODE_PROP_PROOF = 1, + #[doc = "< filter out nodes other then which have capability of the same RPC endpoint may also accept requests for different chains"] + NODE_PROP_MULTICHAIN = 2, + #[doc = "< filter out non-archive supporting nodes"] + NODE_PROP_ARCHIVE = 4, + #[doc = "< filter out non-http nodes"] + NODE_PROP_HTTP = 8, + #[doc = "< filter out nodes that don't support binary encoding"] + NODE_PROP_BINARY = 16, + #[doc = "< filter out non-onion nodes"] + NODE_PROP_ONION = 32, + #[doc = "< filter out non-signer nodes"] + NODE_PROP_SIGNER = 64, + #[doc = "< filter out non-data provider nodes"] + NODE_PROP_DATA = 128, + #[doc = "< filter out nodes that do not provide stats"] + NODE_PROP_STATS = 256, + #[doc = "< filter out nodes that will sign blocks with lower min block height than specified"] + NODE_PROP_MIN_BLOCK_HEIGHT = 1024, +} +#[repr(u32)] +#[doc = " a list of flags definiing the behavior of the incubed client. They should be used as bitmask for the flags-property."] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub enum in3_flags_type_t { + #[doc = "< the in3-section with the proof will also returned"] + FLAGS_KEEP_IN3 = 1, + #[doc = "< the nodelist will be automaticly updated if the last_block is newer"] + FLAGS_AUTO_UPDATE_LIST = 2, + #[doc = "< the code is included when sending eth_call-requests"] + FLAGS_INCLUDE_CODE = 4, + #[doc = "< the client will use binary format"] + FLAGS_BINARY = 8, + #[doc = "< the client will try to use http instead of https"] + FLAGS_HTTP = 16, + #[doc = "< nodes will keep track of the stats (default=true)"] + FLAGS_STATS = 32, + #[doc = "< nodelist update request will not automatically ask for signatures and proof"] + FLAGS_NODE_LIST_NO_SIG = 64, +} +#[repr(u32)] +#[doc = " a list of node attributes (mostly used internally)"] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub enum in3_node_attr_type_t { + #[doc = "< indicates if node exists in whiteList"] + ATTR_WHITELISTED = 1, + #[doc = "< used to avoid filtering manually added nodes before first nodeList update"] + ATTR_BOOT_NODE = 2, +} +pub type in3_node_attr_t = u8; +#[doc = " incubed node-configuration."] +#[doc = ""] +#[doc = " These information are read from the Registry contract and stored in this struct representing a server or node."] +#[repr(C)] +#[derive(Debug, Copy)] +pub struct in3_node { + #[doc = "< address of the server"] + pub address: *mut bytes_t, + #[doc = "< the deposit stored in the registry contract, which this would lose if it sends a wrong blockhash"] + pub deposit: u64, + #[doc = "< index within the nodelist, also used in the contract as key"] + pub index: u32, + #[doc = "< the maximal capacity able to handle"] + pub capacity: u32, + #[doc = "< used to identify the capabilities of the node. See in3_node_props_type_t in nodelist.h"] + pub props: in3_node_props_t, + #[doc = "< the url of the node"] + pub url: *mut libc::c_char, + #[doc = "< bitmask of internal attributes"] + pub attrs: u8, +} +#[test] +fn bindgen_test_layout_in3_node() { + assert_eq!( + ::core::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(in3_node)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(in3_node)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).address as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(in3_node), + "::", + stringify!(address) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).deposit as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(in3_node), + "::", + stringify!(deposit) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).index as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(in3_node), + "::", + stringify!(index) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).capacity as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(in3_node), + "::", + stringify!(capacity) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).props as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(in3_node), + "::", + stringify!(props) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).url as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(in3_node), + "::", + stringify!(url) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).attrs as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(in3_node), + "::", + stringify!(attrs) + ) + ); +} +impl Clone for in3_node { + fn clone(&self) -> Self { + *self + } +} +pub type in3_node_t = in3_node; +#[doc = " Weight or reputation of a node."] +#[doc = ""] +#[doc = " Based on the past performance of the node a weight is calculated given faster nodes a higher weight"] +#[doc = " and chance when selecting the next node from the nodelist."] +#[doc = " These weights will also be stored in the cache (if available)"] +#[repr(C)] +#[derive(Debug, Copy)] +pub struct in3_node_weight { + #[doc = "< counter for responses"] + pub response_count: u32, + #[doc = "< total of all response times"] + pub total_response_time: u32, + #[doc = "< if >0 this node is blacklisted until k. k is a unix timestamp"] + pub blacklisted_until: u64, +} +#[test] +fn bindgen_test_layout_in3_node_weight() { + assert_eq!( + ::core::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(in3_node_weight)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(in3_node_weight)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).response_count as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(in3_node_weight), + "::", + stringify!(response_count) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).total_response_time as *const _ as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(in3_node_weight), + "::", + stringify!(total_response_time) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).blacklisted_until as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(in3_node_weight), + "::", + stringify!(blacklisted_until) + ) + ); +} +impl Clone for in3_node_weight { + fn clone(&self) -> Self { + *self + } +} +pub type in3_node_weight_t = in3_node_weight; +extern "C" { + #[doc = " setter method for interacting with in3_node_props_t."] + #[doc = " @param[out] node_props"] + #[doc = " @param type"] + #[doc = " @param"] + pub fn in3_node_props_set( + node_props: *mut in3_node_props_t, + type_: in3_node_props_type_t, + value: u8, + ); +} +#[doc = " defines a whitelist structure used for the nodelist."] +#[repr(C)] +#[derive(Debug, Copy)] +pub struct in3_whitelist { + #[doc = "< address of whiteList contract. If specified, whiteList is always auto-updated and manual whiteList is overridden"] + pub contract: address_t, + #[doc = "< serialized list of node addresses that constitute the whiteList"] + pub addresses: bytes_t, + #[doc = "< last blocknumber the whiteList was updated, which is used to detect changed in the whitelist"] + pub last_block: u64, + #[doc = "< if true the nodelist should be updated and will trigger a `in3_nodeList`-request before the next request is send."] + pub needs_update: bool, +} +#[test] +fn bindgen_test_layout_in3_whitelist() { + assert_eq!( + ::core::mem::size_of::(), + 56usize, + concat!("Size of: ", stringify!(in3_whitelist)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(in3_whitelist)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).contract as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(in3_whitelist), + "::", + stringify!(contract) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).addresses as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(in3_whitelist), + "::", + stringify!(addresses) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).last_block as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(in3_whitelist), + "::", + stringify!(last_block) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).needs_update as *const _ as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(in3_whitelist), + "::", + stringify!(needs_update) + ) + ); +} +impl Clone for in3_whitelist { + fn clone(&self) -> Self { + *self + } +} +pub type in3_whitelist_t = in3_whitelist; +#[doc = "represents a blockhash which was previously verified"] +#[repr(C)] +#[derive(Debug, Copy)] +pub struct in3_verified_hash { + #[doc = "< the number of the block"] + pub block_number: u64, + #[doc = "< the blockhash"] + pub hash: bytes32_t, +} +#[test] +fn bindgen_test_layout_in3_verified_hash() { + assert_eq!( + ::core::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(in3_verified_hash)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(in3_verified_hash)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).block_number as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(in3_verified_hash), + "::", + stringify!(block_number) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).hash as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(in3_verified_hash), + "::", + stringify!(hash) + ) + ); +} +impl Clone for in3_verified_hash { + fn clone(&self) -> Self { + *self + } +} +pub type in3_verified_hash_t = in3_verified_hash; +#[doc = " Chain definition inside incubed."] +#[doc = ""] +#[doc = " for incubed a chain can be any distributed network or database with incubed support."] +#[repr(C)] +#[derive(Debug, Copy)] +pub struct in3_chain { + #[doc = "< chain_id, which could be a free or based on the public ethereum networkId"] + pub chain_id: chain_id_t, + #[doc = "< chaintype"] + pub type_: in3_chain_type_t, + #[doc = "< last blocknumber the nodeList was updated, which is used to detect changed in the nodelist"] + pub last_block: u64, + #[doc = "< number of nodes in the nodeList"] + pub nodelist_length: libc::c_int, + #[doc = "< array of nodes"] + pub nodelist: *mut in3_node_t, + #[doc = "< stats and weights recorded for each node"] + pub weights: *mut in3_node_weight_t, + #[doc = "< array of addresses of nodes that should always part of the nodeList"] + pub init_addresses: *mut *mut bytes_t, + #[doc = "< the address of the registry contract"] + pub contract: *mut bytes_t, + #[doc = "< the identifier of the registry"] + pub registry_id: bytes32_t, + #[doc = "< version of the chain"] + pub version: u8, + #[doc = "< contains the list of already verified blockhashes"] + pub verified_hashes: *mut in3_verified_hash_t, + #[doc = "< if set the whitelist of the addresses."] + pub whitelist: *mut in3_whitelist_t, + #[doc = "< average block time (seconds) for this chain (calculated internally)"] + pub avg_block_time: u16, + pub nodelist_upd8_params: *mut in3_chain__bindgen_ty_1, +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct in3_chain__bindgen_ty_1 { + #[doc = "< node that reported the last_block which necessitated a nodeList update"] + pub node: address_t, + #[doc = "< the last_block when the nodelist last changed reported by this node"] + pub exp_last_block: u64, + #[doc = "< approx. time when nodelist must be updated (i.e. when reported last_block will be considered final)"] + pub timestamp: u64, +} +#[test] +fn bindgen_test_layout_in3_chain__bindgen_ty_1() { + assert_eq!( + ::core::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(in3_chain__bindgen_ty_1)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(in3_chain__bindgen_ty_1)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).node as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(in3_chain__bindgen_ty_1), + "::", + stringify!(node) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).exp_last_block as *const _ as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(in3_chain__bindgen_ty_1), + "::", + stringify!(exp_last_block) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).timestamp as *const _ as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(in3_chain__bindgen_ty_1), + "::", + stringify!(timestamp) + ) + ); +} +impl Clone for in3_chain__bindgen_ty_1 { + fn clone(&self) -> Self { + *self + } +} +#[test] +fn bindgen_test_layout_in3_chain() { + assert_eq!( + ::core::mem::size_of::(), + 128usize, + concat!("Size of: ", stringify!(in3_chain)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(in3_chain)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).chain_id as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(in3_chain), + "::", + stringify!(chain_id) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).type_ as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(in3_chain), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).last_block as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(in3_chain), + "::", + stringify!(last_block) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).nodelist_length as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(in3_chain), + "::", + stringify!(nodelist_length) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).nodelist as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(in3_chain), + "::", + stringify!(nodelist) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).weights as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(in3_chain), + "::", + stringify!(weights) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).init_addresses as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(in3_chain), + "::", + stringify!(init_addresses) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).contract as *const _ as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(in3_chain), + "::", + stringify!(contract) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).registry_id as *const _ as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(in3_chain), + "::", + stringify!(registry_id) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).version as *const _ as usize }, + 88usize, + concat!( + "Offset of field: ", + stringify!(in3_chain), + "::", + stringify!(version) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).verified_hashes as *const _ as usize }, + 96usize, + concat!( + "Offset of field: ", + stringify!(in3_chain), + "::", + stringify!(verified_hashes) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).whitelist as *const _ as usize }, + 104usize, + concat!( + "Offset of field: ", + stringify!(in3_chain), + "::", + stringify!(whitelist) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).avg_block_time as *const _ as usize }, + 112usize, + concat!( + "Offset of field: ", + stringify!(in3_chain), + "::", + stringify!(avg_block_time) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).nodelist_upd8_params as *const _ as usize }, + 120usize, + concat!( + "Offset of field: ", + stringify!(in3_chain), + "::", + stringify!(nodelist_upd8_params) + ) + ); +} +impl Clone for in3_chain { + fn clone(&self) -> Self { + *self + } +} +pub type in3_chain_t = in3_chain; +#[doc = " storage handler function for reading from cache."] +#[doc = " @returns the found result. if the key is found this function should return the values as bytes otherwise `NULL`."] +pub type in3_storage_get_item = ::core::option::Option< + unsafe extern "C" fn(cptr: *mut libc::c_void, key: *const libc::c_char) -> *mut bytes_t, +>; +#[doc = " storage handler function for writing to the cache."] +pub type in3_storage_set_item = ::core::option::Option< + unsafe extern "C" fn(cptr: *mut libc::c_void, key: *const libc::c_char, value: *mut bytes_t), +>; +#[doc = " storage handler function for clearing the cache."] +pub type in3_storage_clear = ::core::option::Option; +#[doc = " storage handler to handle cache."] +#[repr(C)] +#[derive(Debug, Copy)] +pub struct in3_storage_handler { + #[doc = "< function pointer returning a stored value for the given key."] + pub get_item: in3_storage_get_item, + #[doc = "< function pointer setting a stored value for the given key."] + pub set_item: in3_storage_set_item, + #[doc = "< function pointer clearing all contents of cache."] + pub clear: in3_storage_clear, + #[doc = "< custom pointer which will be passed to functions"] + pub cptr: *mut libc::c_void, +} +#[test] +fn bindgen_test_layout_in3_storage_handler() { + assert_eq!( + ::core::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(in3_storage_handler)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(in3_storage_handler)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).get_item as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(in3_storage_handler), + "::", + stringify!(get_item) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).set_item as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(in3_storage_handler), + "::", + stringify!(set_item) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).clear as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(in3_storage_handler), + "::", + stringify!(clear) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).cptr as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(in3_storage_handler), + "::", + stringify!(cptr) + ) + ); +} +impl Clone for in3_storage_handler { + fn clone(&self) -> Self { + *self + } +} +pub type in3_storage_handler_t = in3_storage_handler; +#[repr(u32)] +#[doc = " type of the requested signature"] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub enum d_signature_type_t { + #[doc = "< sign the data directly"] + SIGN_EC_RAW = 0, + #[doc = "< hash and sign the data"] + SIGN_EC_HASH = 1, +} +#[doc = " signing function."] +#[doc = ""] +#[doc = " signs the given data and write the signature to dst."] +#[doc = " the return value must be the number of bytes written to dst."] +#[doc = " In case of an error a negativ value must be returned. It should be one of the IN3_SIGN_ERR... values."] +pub type in3_sign = ::core::option::Option< + unsafe extern "C" fn( + ctx: *mut libc::c_void, + type_: d_signature_type_t, + message: bytes_t, + account: bytes_t, + dst: *mut u8, + ) -> in3_ret_t::Type, +>; +#[doc = " transform transaction function."] +#[doc = ""] +#[doc = " for multisigs, we need to change the transaction to gro through the ms."] +#[doc = " if the new_tx is not set within the function, it will use the old_tx."] +pub type in3_prepare_tx = ::core::option::Option< + unsafe extern "C" fn( + ctx: *mut libc::c_void, + old_tx: *mut d_token_t, + new_tx: *mut *mut json_ctx_t, + ) -> in3_ret_t::Type, +>; +#[repr(C)] +#[derive(Debug, Copy)] +pub struct in3_signer { + pub sign: in3_sign, + pub prepare_tx: in3_prepare_tx, + pub wallet: *mut libc::c_void, +} +#[test] +fn bindgen_test_layout_in3_signer() { + assert_eq!( + ::core::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(in3_signer)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(in3_signer)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).sign as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(in3_signer), + "::", + stringify!(sign) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).prepare_tx as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(in3_signer), + "::", + stringify!(prepare_tx) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).wallet as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(in3_signer), + "::", + stringify!(wallet) + ) + ); +} +impl Clone for in3_signer { + fn clone(&self) -> Self { + *self + } +} +pub type in3_signer_t = in3_signer; +#[doc = " payment prepearation function."] +#[doc = ""] +#[doc = " allows the payment to handle things before the request will be send."] +pub type in3_pay_prepare = ::core::option::Option< + unsafe extern "C" fn(ctx: *mut libc::c_void, cptr: *mut libc::c_void) -> in3_ret_t::Type, +>; +#[doc = " called after receiving a parseable response with a in3-section."] +#[doc = ""] +pub type in3_pay_follow_up = ::core::option::Option< + unsafe extern "C" fn( + ctx: *mut libc::c_void, + node: *mut libc::c_void, + in3: *mut d_token_t, + error: *mut d_token_t, + cptr: *mut libc::c_void, + ) -> in3_ret_t::Type, +>; +#[doc = " free function for the custom pointer."] +#[doc = ""] +pub type in3_pay_free = ::core::option::Option; +#[doc = " handles the request."] +#[doc = ""] +#[doc = " this function is called when the in3-section of payload of the request is built and allows the handler to add properties."] +pub type in3_pay_handle_request = ::core::option::Option< + unsafe extern "C" fn( + ctx: *mut libc::c_void, + sb: *mut sb_t, + rc: *mut in3_request_config_t, + cptr: *mut libc::c_void, + ) -> in3_ret_t::Type, +>; +#[doc = " the payment handler."] +#[doc = ""] +#[doc = " if a payment handler is set it will be used when generating the request."] +#[repr(C)] +#[derive(Debug, Copy)] +pub struct in3_pay { + pub prepare: in3_pay_prepare, + pub follow_up: in3_pay_follow_up, + pub handle_request: in3_pay_handle_request, + pub free: in3_pay_free, + pub cptr: *mut libc::c_void, +} +#[test] +fn bindgen_test_layout_in3_pay() { + assert_eq!( + ::core::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(in3_pay)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(in3_pay)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).prepare as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(in3_pay), + "::", + stringify!(prepare) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).follow_up as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(in3_pay), + "::", + stringify!(follow_up) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).handle_request as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(in3_pay), + "::", + stringify!(handle_request) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).free as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(in3_pay), + "::", + stringify!(free) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).cptr as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(in3_pay), + "::", + stringify!(cptr) + ) + ); +} +impl Clone for in3_pay { + fn clone(&self) -> Self { + *self + } +} +pub type in3_pay_t = in3_pay; +#[doc = " response-object."] +#[doc = ""] +#[doc = " if the error has a length>0 the response will be rejected"] +#[repr(C)] +#[derive(Debug, Copy)] +pub struct n3_response { + #[doc = "< a stringbuilder to add any errors!"] + pub error: sb_t, + #[doc = "< a stringbuilder to add the result"] + pub result: sb_t, +} +#[test] +fn bindgen_test_layout_n3_response() { + assert_eq!( + ::core::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(n3_response)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(n3_response)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).error as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(n3_response), + "::", + stringify!(error) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).result as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(n3_response), + "::", + stringify!(result) + ) + ); +} +impl Clone for n3_response { + fn clone(&self) -> Self { + *self + } +} +pub type in3_response_t = n3_response; +#[doc = " request-object."] +#[doc = ""] +#[doc = " represents a RPC-request"] +#[repr(C)] +#[derive(Debug, Copy)] +pub struct n3_request { + #[doc = "< the payload to send"] + pub payload: *mut libc::c_char, + #[doc = "< array of urls"] + pub urls: *mut *mut libc::c_char, + #[doc = "< number of urls"] + pub urls_len: libc::c_int, + #[doc = "< the responses"] + pub results: *mut in3_response_t, + #[doc = "< the timeout 0= no timeout"] + pub timeout: u32, + #[doc = "< measured times (in ms) which will be used for ajusting the weights"] + pub times: *mut u32, +} +#[test] +fn bindgen_test_layout_n3_request() { + assert_eq!( + ::core::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(n3_request)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(n3_request)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).payload as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(n3_request), + "::", + stringify!(payload) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).urls as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(n3_request), + "::", + stringify!(urls) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).urls_len as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(n3_request), + "::", + stringify!(urls_len) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).results as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(n3_request), + "::", + stringify!(results) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).timeout as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(n3_request), + "::", + stringify!(timeout) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).times as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(n3_request), + "::", + stringify!(times) + ) + ); +} +impl Clone for n3_request { + fn clone(&self) -> Self { + *self + } +} +pub type in3_request_t = n3_request; +pub type in3_t = in3_t_; +#[doc = " the transport function to be implemented by the transport provider."] +pub type in3_transport_send = ::core::option::Option< + unsafe extern "C" fn(in3: *mut in3_t, request: *mut in3_request_t) -> in3_ret_t::Type, +>; +#[repr(u32)] +#[doc = " Filter type used internally when managing filters."] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub enum in3_filter_type_t { + #[doc = "< Event filter"] + FILTER_EVENT = 0, + #[doc = "< Block filter"] + FILTER_BLOCK = 1, + #[doc = "< Pending filter (Unsupported)"] + FILTER_PENDING = 2, +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct in3_filter_t_ { + #[doc = " filter type: (event, block or pending)"] + pub type_: in3_filter_type_t, + #[doc = " associated filter options"] + pub options: *mut libc::c_char, + #[doc = " block no. when filter was created OR eth_getFilterChanges was called"] + pub last_block: u64, + #[doc = " if true the filter was not used previously"] + pub is_first_usage: bool, + #[doc = " method to release owned resources"] + pub release: ::core::option::Option, +} +#[test] +fn bindgen_test_layout_in3_filter_t_() { + assert_eq!( + ::core::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(in3_filter_t_)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(in3_filter_t_)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).type_ as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(in3_filter_t_), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).options as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(in3_filter_t_), + "::", + stringify!(options) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).last_block as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(in3_filter_t_), + "::", + stringify!(last_block) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).is_first_usage as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(in3_filter_t_), + "::", + stringify!(is_first_usage) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).release as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(in3_filter_t_), + "::", + stringify!(release) + ) + ); +} +impl Clone for in3_filter_t_ { + fn clone(&self) -> Self { + *self + } +} +pub type in3_filter_t = in3_filter_t_; +#[doc = " Handler which is added to client config in order to handle filter."] +#[repr(C)] +#[derive(Debug, Copy)] +pub struct in3_filter_handler_t_ { + pub array: *mut *mut in3_filter_t, + #[doc = " array of filters"] + pub count: usize, +} +#[test] +fn bindgen_test_layout_in3_filter_handler_t_() { + assert_eq!( + ::core::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(in3_filter_handler_t_)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(in3_filter_handler_t_)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).array as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(in3_filter_handler_t_), + "::", + stringify!(array) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).count as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(in3_filter_handler_t_), + "::", + stringify!(count) + ) + ); +} +impl Clone for in3_filter_handler_t_ { + fn clone(&self) -> Self { + *self + } +} +pub type in3_filter_handler_t = in3_filter_handler_t_; +#[doc = " Incubed Configuration."] +#[doc = ""] +#[doc = " This struct holds the configuration and also point to internal resources such as filters or chain configs."] +#[doc = ""] +#[repr(C)] +#[derive(Debug, Copy)] +pub struct in3_t_ { + #[doc = " number of seconds requests can be cached."] + pub cache_timeout: u32, + #[doc = " the limit of nodes to store in the client."] + pub node_limit: u16, + #[doc = " the client key to sign requests (pointer to 32bytes private key seed)"] + pub key: *mut libc::c_void, + #[doc = " number of max bytes used to cache the code in memory"] + pub max_code_cache: u32, + #[doc = " number of number of blocks cached in memory"] + pub max_block_cache: u32, + #[doc = " the type of proof used"] + pub proof: in3_proof_t, + #[doc = " the number of request send when getting a first answer"] + pub request_count: u8, + #[doc = " the number of signatures used to proof the blockhash."] + pub signature_count: u8, + #[doc = " min stake of the server. Only nodes owning at least this amount will be chosen."] + pub min_deposit: u64, + #[doc = " if specified, the blocknumber *latest* will be replaced by blockNumber- specified value"] + pub replace_latest_block: u8, + #[doc = " the number of signatures in percent required for the request"] + pub finality: u16, + #[doc = " the max number of attempts before giving up"] + pub max_attempts: uint_fast16_t, + #[doc = " max number of verified hashes to cache"] + pub max_verified_hashes: uint_fast16_t, + #[doc = " specifies the number of milliseconds before the request times out. increasing may be helpful if the device uses a slow connection."] + pub timeout: u32, + #[doc = " servers to filter for the given chain. The chain-id based on EIP-155."] + pub chain_id: chain_id_t, + #[doc = " a cache handler offering 2 functions ( setItem(string,string), getItem(string) )"] + pub cache: *mut in3_storage_handler_t, + #[doc = " signer-struct managing a wallet"] + pub signer: *mut in3_signer_t, + #[doc = " the transporthandler sending requests"] + pub transport: in3_transport_send, + #[doc = " a bit mask with flags defining the behavior of the incubed client. See the FLAG...-defines"] + pub flags: uint_fast8_t, + #[doc = " chain spec and nodeList definitions"] + pub chains: *mut in3_chain_t, + #[doc = " number of configured chains"] + pub chains_length: u16, + #[doc = " filter handler"] + pub filters: *mut in3_filter_handler_t, + #[doc = " used to identify the capabilities of the node."] + pub node_props: in3_node_props_t, + #[doc = " pointer to internal data"] + pub internal: *mut libc::c_void, +} +#[test] +fn bindgen_test_layout_in3_t_() { + assert_eq!( + ::core::mem::size_of::(), + 128usize, + concat!("Size of: ", stringify!(in3_t_)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(in3_t_)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).cache_timeout as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(in3_t_), + "::", + stringify!(cache_timeout) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).node_limit as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(in3_t_), + "::", + stringify!(node_limit) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).key as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(in3_t_), + "::", + stringify!(key) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).max_code_cache as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(in3_t_), + "::", + stringify!(max_code_cache) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).max_block_cache as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(in3_t_), + "::", + stringify!(max_block_cache) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).proof as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(in3_t_), + "::", + stringify!(proof) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).request_count as *const _ as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(in3_t_), + "::", + stringify!(request_count) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).signature_count as *const _ as usize }, + 29usize, + concat!( + "Offset of field: ", + stringify!(in3_t_), + "::", + stringify!(signature_count) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).min_deposit as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(in3_t_), + "::", + stringify!(min_deposit) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).replace_latest_block as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(in3_t_), + "::", + stringify!(replace_latest_block) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).finality as *const _ as usize }, + 42usize, + concat!( + "Offset of field: ", + stringify!(in3_t_), + "::", + stringify!(finality) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).max_attempts as *const _ as usize }, + 44usize, + concat!( + "Offset of field: ", + stringify!(in3_t_), + "::", + stringify!(max_attempts) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).max_verified_hashes as *const _ as usize }, + 46usize, + concat!( + "Offset of field: ", + stringify!(in3_t_), + "::", + stringify!(max_verified_hashes) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).timeout as *const _ as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(in3_t_), + "::", + stringify!(timeout) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).chain_id as *const _ as usize }, + 52usize, + concat!( + "Offset of field: ", + stringify!(in3_t_), + "::", + stringify!(chain_id) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).cache as *const _ as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(in3_t_), + "::", + stringify!(cache) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).signer as *const _ as usize }, + 64usize, + concat!( + "Offset of field: ", + stringify!(in3_t_), + "::", + stringify!(signer) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).transport as *const _ as usize }, + 72usize, + concat!( + "Offset of field: ", + stringify!(in3_t_), + "::", + stringify!(transport) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, + 80usize, + concat!( + "Offset of field: ", + stringify!(in3_t_), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).chains as *const _ as usize }, + 88usize, + concat!( + "Offset of field: ", + stringify!(in3_t_), + "::", + stringify!(chains) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).chains_length as *const _ as usize }, + 96usize, + concat!( + "Offset of field: ", + stringify!(in3_t_), + "::", + stringify!(chains_length) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).filters as *const _ as usize }, + 104usize, + concat!( + "Offset of field: ", + stringify!(in3_t_), + "::", + stringify!(filters) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).node_props as *const _ as usize }, + 112usize, + concat!( + "Offset of field: ", + stringify!(in3_t_), + "::", + stringify!(node_props) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).internal as *const _ as usize }, + 120usize, + concat!( + "Offset of field: ", + stringify!(in3_t_), + "::", + stringify!(internal) + ) + ); +} +impl Clone for in3_t_ { + fn clone(&self) -> Self { + *self + } +} +extern "C" { + #[doc = " creates a new Incubes configuration and returns the pointer."] + #[doc = ""] + #[doc = " This Method is depricated. you should use `in3_for_chain(ETH_CHAIN_ID_MULTICHAIN)` instead."] + #[doc = ""] + #[doc = " you need to free this instance with `in3_free` after use!"] + #[doc = ""] + #[doc = " Before using the client you still need to set the tramsport and optional the storage handlers:"] + #[doc = ""] + #[doc = " * example of initialization:"] + #[doc = " ```c"] + #[doc = " // register verifiers"] + #[doc = " in3_register_eth_full();"] + #[doc = ""] + #[doc = " // create new client"] + #[doc = " in3_t* client = in3_new();"] + #[doc = ""] + #[doc = " // configure transport"] + #[doc = " client->transport = send_curl;"] + #[doc = ""] + #[doc = " // configure storage"] + #[doc = " in3_set_storage_handler(c, storage_get_item, storage_set_item, storage_clear, NULL);"] + #[doc = ""] + #[doc = " // ready to use ..."] + #[doc = " ```"] + #[doc = ""] + #[doc = " @returns the incubed instance."] + pub fn in3_new() -> *mut in3_t; +} +extern "C" { + pub fn in3_for_chain_default(chain_id: chain_id_t) -> *mut in3_t; +} +extern "C" { + #[doc = " sends a request and stores the result in the provided buffer"] + pub fn in3_client_rpc( + c: *mut in3_t, + method: *const libc::c_char, + params: *const libc::c_char, + result: *mut *mut libc::c_char, + error: *mut *mut libc::c_char, + ) -> in3_ret_t::Type; +} +extern "C" { + #[doc = " sends a request and stores the result in the provided buffer"] + pub fn in3_client_rpc_raw( + c: *mut in3_t, + request: *const libc::c_char, + result: *mut *mut libc::c_char, + error: *mut *mut libc::c_char, + ) -> in3_ret_t::Type; +} +extern "C" { + #[doc = " executes a request and returns result as string. in case of an error, the error-property of the result will be set."] + #[doc = " The resulting string must be free by the the caller of this function!"] + pub fn in3_client_exec_req(c: *mut in3_t, req: *mut libc::c_char) -> *mut libc::c_char; +} +extern "C" { + #[doc = " adds a response for a request-object."] + #[doc = " This function should be used in the transport-function to set the response."] + pub fn in3_req_add_response( + res: *mut in3_response_t, + index: libc::c_int, + is_error: bool, + data: *mut libc::c_void, + data_len: libc::c_int, + ); +} +extern "C" { + #[doc = " registers a new chain or replaces a existing (but keeps the nodelist)"] + pub fn in3_client_register_chain( + client: *mut in3_t, + chain_id: chain_id_t, + type_: in3_chain_type_t, + contract: *mut u8, + registry_id: *mut u8, + version: u8, + wl_contract: *mut u8, + ) -> in3_ret_t::Type; +} +extern "C" { + #[doc = " adds a node to a chain ore updates a existing node"] + pub fn in3_client_add_node( + client: *mut in3_t, + chain_id: chain_id_t, + url: *mut libc::c_char, + props: in3_node_props_t, + address: *mut u8, + ) -> in3_ret_t::Type; +} +extern "C" { + #[doc = " removes a node from a nodelist"] + pub fn in3_client_remove_node( + client: *mut in3_t, + chain_id: chain_id_t, + address: *mut u8, + ) -> in3_ret_t::Type; +} +extern "C" { + #[doc = " removes all nodes from the nodelist"] + pub fn in3_client_clear_nodes(client: *mut in3_t, chain_id: chain_id_t) -> in3_ret_t::Type; +} +extern "C" { + #[doc = " frees the references of the client"] + pub fn in3_free(a: *mut in3_t); +} +extern "C" { + #[doc = " inits the cache."] + #[doc = ""] + #[doc = " this will try to read the nodelist from cache."] + pub fn in3_cache_init(c: *mut in3_t) -> in3_ret_t::Type; +} +extern "C" { + #[doc = " finds the chain-config for the given chain_id."] + #[doc = ""] + #[doc = " My return NULL if not found."] + pub fn in3_find_chain(c: *mut in3_t, chain_id: chain_id_t) -> *mut in3_chain_t; +} +extern "C" { + #[doc = " configures the clent based on a json-config."] + #[doc = ""] + #[doc = " For details about the structure of ther config see https://in3.readthedocs.io/en/develop/api-ts.html#type-in3config"] + #[doc = " Returns NULL on success, and error string on failure (to be freed by caller) - in which case the client state is undefined"] + pub fn in3_configure(c: *mut in3_t, config: *const libc::c_char) -> *mut libc::c_char; +} +extern "C" { + #[doc = " defines a default transport which is used when creating a new client."] + pub fn in3_set_default_transport(transport: in3_transport_send); +} +extern "C" { + #[doc = " defines a default storage handler which is used when creating a new client."] + pub fn in3_set_default_storage(cacheStorage: *mut in3_storage_handler_t); +} +extern "C" { + #[doc = " defines a default signer which is used when creating a new client."] + pub fn in3_set_default_signer(signer: *mut in3_signer_t); +} +extern "C" { + #[doc = " create a new signer-object to be set on the client."] + #[doc = " the caller will need to free this pointer after usage."] + pub fn in3_create_signer( + sign: in3_sign, + prepare_tx: in3_prepare_tx, + wallet: *mut libc::c_void, + ) -> *mut in3_signer_t; +} +extern "C" { + #[doc = " create a new storage handler-object to be set on the client."] + #[doc = " the caller will need to free this pointer after usage."] + pub fn in3_set_storage_handler( + c: *mut in3_t, + get_item: in3_storage_get_item, + set_item: in3_storage_set_item, + clear: in3_storage_clear, + cptr: *mut libc::c_void, + ) -> *mut in3_storage_handler_t; +} +#[repr(u32)] +#[doc = " type of the request context,"] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub enum ctx_type { + #[doc = "< a json-rpc request, which needs to be send to a incubed node"] + CT_RPC = 0, + #[doc = "< a sign request"] + CT_SIGN = 1, +} +pub use self::ctx_type as ctx_type_t; +#[doc = " the weight of a certain node as linked list."] +#[doc = ""] +#[doc = " This will be used when picking the nodes to send the request to. A linked list of these structs desribe the result."] +#[repr(C)] +#[derive(Debug, Copy)] +pub struct weight { + #[doc = "< the node definition including the url"] + pub node: *mut in3_node_t, + #[doc = "< the current weight and blacklisting-stats"] + pub weight: *mut in3_node_weight_t, + #[doc = "< The starting value"] + pub s: f32, + #[doc = "< weight value"] + pub w: f32, + #[doc = "< next in the linkedlist or NULL if this is the last element"] + pub next: *mut weight, +} +#[test] +fn bindgen_test_layout_weight() { + assert_eq!( + ::core::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(weight)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(weight)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).node as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(weight), + "::", + stringify!(node) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).weight as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(weight), + "::", + stringify!(weight) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).s as *const _ as usize }, + 16usize, + concat!("Offset of field: ", stringify!(weight), "::", stringify!(s)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).w as *const _ as usize }, + 20usize, + concat!("Offset of field: ", stringify!(weight), "::", stringify!(w)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).next as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(weight), + "::", + stringify!(next) + ) + ); +} +impl Clone for weight { + fn clone(&self) -> Self { + *self + } +} +pub type node_match_t = weight; +#[doc = " The Request config."] +#[doc = ""] +#[doc = " This is generated for each request and represents the current state. it holds the state until the request is finished and must be freed afterwards."] +#[repr(C)] +#[derive(Debug, Copy)] +pub struct in3_ctx { + #[doc = " the type of the request"] + pub type_: ctx_type_t, + #[doc = " reference to the client"] + pub client: *mut in3_t, + #[doc = " the result of the json-parser for the request."] + pub request_context: *mut json_ctx_t, + #[doc = " the result of the json-parser for the response."] + pub response_context: *mut json_ctx_t, + #[doc = " in case of an error this will hold the message, if not it points to `NULL`"] + pub error: *mut libc::c_char, + #[doc = " the number of requests"] + pub len: libc::c_int, + #[doc = " the number of attempts"] + pub attempt: libc::c_uint, + #[doc = " references to the tokens representring the parsed responses"] + pub responses: *mut *mut d_token_t, + #[doc = " references to the tokens representring the requests"] + pub requests: *mut *mut d_token_t, + #[doc = " array of configs adjusted for each request."] + pub requests_configs: *mut in3_request_config_t, + pub nodes: *mut node_match_t, + #[doc = " optional cache-entries."] + #[doc = ""] + #[doc = " These entries will be freed when cleaning up the context."] + pub cache: *mut cache_entry_t, + #[doc = " the raw response-data, which should be verified."] + pub raw_response: *mut in3_response_t, + #[doc = " pointer to the next required context. if not NULL the data from this context need get finished first, before being able to resume this context."] + pub required: *mut in3_ctx, + #[doc = " state of the verification"] + pub verification_state: in3_ret_t::Type, +} +#[test] +fn bindgen_test_layout_in3_ctx() { + assert_eq!( + ::core::mem::size_of::(), + 112usize, + concat!("Size of: ", stringify!(in3_ctx)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(in3_ctx)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).type_ as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(in3_ctx), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).client as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(in3_ctx), + "::", + stringify!(client) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).request_context as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(in3_ctx), + "::", + stringify!(request_context) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).response_context as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(in3_ctx), + "::", + stringify!(response_context) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).error as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(in3_ctx), + "::", + stringify!(error) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).len as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(in3_ctx), + "::", + stringify!(len) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).attempt as *const _ as usize }, + 44usize, + concat!( + "Offset of field: ", + stringify!(in3_ctx), + "::", + stringify!(attempt) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).responses as *const _ as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(in3_ctx), + "::", + stringify!(responses) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).requests as *const _ as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(in3_ctx), + "::", + stringify!(requests) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).requests_configs as *const _ as usize }, + 64usize, + concat!( + "Offset of field: ", + stringify!(in3_ctx), + "::", + stringify!(requests_configs) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).nodes as *const _ as usize }, + 72usize, + concat!( + "Offset of field: ", + stringify!(in3_ctx), + "::", + stringify!(nodes) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).cache as *const _ as usize }, + 80usize, + concat!( + "Offset of field: ", + stringify!(in3_ctx), + "::", + stringify!(cache) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).raw_response as *const _ as usize }, + 88usize, + concat!( + "Offset of field: ", + stringify!(in3_ctx), + "::", + stringify!(raw_response) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).required as *const _ as usize }, + 96usize, + concat!( + "Offset of field: ", + stringify!(in3_ctx), + "::", + stringify!(required) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).verification_state as *const _ as usize }, + 104usize, + concat!( + "Offset of field: ", + stringify!(in3_ctx), + "::", + stringify!(verification_state) + ) + ); +} +impl Clone for in3_ctx { + fn clone(&self) -> Self { + *self + } +} +pub type in3_ctx_t = in3_ctx; +#[repr(i32)] +#[doc = " The current state of the context."] +#[doc = ""] +#[doc = " you can check this state after each execute-call."] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub enum state { + #[doc = "< The ctx has a verified result."] + CTX_SUCCESS = 0, + #[doc = "< there are required contexts, which need to be resolved first"] + CTX_WAITING_FOR_REQUIRED_CTX = 1, + #[doc = "< the response is not set yet"] + CTX_WAITING_FOR_RESPONSE = 2, + #[doc = "< the request has a error"] + CTX_ERROR = -1, +} +pub use self::state as in3_ctx_state_t; +extern "C" { + #[doc = " creates a new context."] + #[doc = ""] + #[doc = " the request data will be parsed and represented in the context."] + #[doc = " calling this function will only parse the request data, but not send anything yet."] + #[doc = ""] + #[doc = " *Important*: the req_data will not be cloned but used during the execution. The caller of the this function is also responsible for freeing this string afterwards."] + pub fn ctx_new(client: *mut in3_t, req_data: *const libc::c_char) -> *mut in3_ctx_t; +} +extern "C" { + #[doc = " sends a previously created context to nodes and verifies it."] + #[doc = ""] + #[doc = " The execution happens within the same thread, thich mean it will be blocked until the response ha beedn received and verified."] + #[doc = " In order to handle calls asynchronously, you need to call the `in3_ctx_execute` function and provide the data as needed."] + pub fn in3_send_ctx(ctx: *mut in3_ctx_t) -> in3_ret_t::Type; +} +extern "C" { + #[doc = " tries to execute the context, but stops whenever data are required."] + #[doc = ""] + #[doc = " This function should be used in order to call data in a asyncronous way,"] + #[doc = " since this function will not use the transport-function to actually send it."] + #[doc = ""] + #[doc = " The caller is responsible for delivering the required responses."] + #[doc = " After calling you need to check the return-value:"] + #[doc = " - IN3_WAITING : provide the required data and then call in3_ctx_execute again."] + #[doc = " - IN3_OK : success, we have a result."] + #[doc = " - any other status = error"] + #[doc = ""] + #[doc = " Here is a example how to use this function:"] + #[doc = ""] + #[doc = " ```c"] + #[doc = ""] + #[doc = "in3_ret_t in3_send_ctx(in3_ctx_t* ctx) {"] + #[doc = "in3_ret_t ret;"] + #[doc = "while ((ret = in3_ctx_execute(ctx))) {"] + #[doc = "if (ret != IN3_WAITING) return ret;"] + #[doc = ""] + #[doc = "while (ctx->required && in3_ctx_state(ctx->required) != CTX_SUCCESS) {"] + #[doc = "if ((ret = in3_send_ctx(ctx->required))) return ret;"] + #[doc = ""] + #[doc = "if ((ret = in3_ctx_execute(ctx)) != IN3_WAITING) return ret;"] + #[doc = "}"] + #[doc = ""] + #[doc = "if (!ctx->raw_response) {"] + #[doc = ""] + #[doc = "switch (ctx->type) {"] + #[doc = ""] + #[doc = "case CT_RPC: {"] + #[doc = ""] + #[doc = "in3_request_t* request = in3_create_request(ctx);"] + #[doc = ""] + #[doc = "ctx->client->transport(request);"] + #[doc = ""] + #[doc = "request_free(request, ctx, false);"] + #[doc = "break;"] + #[doc = "}"] + #[doc = ""] + #[doc = "case CT_SIGN: {"] + #[doc = "d_token_t* params = d_get(ctx->requests[0], K_PARAMS);"] + #[doc = "bytes_t data = d_to_bytes(d_get_at(params, 0));"] + #[doc = "bytes_t from = d_to_bytes(d_get_at(params, 1));"] + #[doc = ""] + #[doc = "ctx->raw_response = _malloc(sizeof(in3_response_t));"] + #[doc = "sb_init(&ctx->raw_response[0].error);"] + #[doc = "sb_init(&ctx->raw_response[0].result);"] + #[doc = ""] + #[doc = "uint8_t sig[65];"] + #[doc = "ret = ctx->client->signer->sign(ctx, SIGN_EC_HASH, data, from, sig);"] + #[doc = "if (ret < 0) return ctx_set_error(ctx, ctx->raw_response->error.data, ret);"] + #[doc = "sb_add_range(&ctx->raw_response->result, (char*) sig, 0, 65);"] + #[doc = "}"] + #[doc = "}"] + #[doc = "}"] + #[doc = "}"] + #[doc = "return ret;"] + #[doc = "}"] + #[doc = " ```"] + pub fn in3_ctx_execute(ctx: *mut in3_ctx_t) -> in3_ret_t::Type; +} +extern "C" { + #[doc = " returns the current state of the context."] + pub fn in3_ctx_state(ctx: *mut in3_ctx_t) -> in3_ctx_state_t; +} +extern "C" { + #[doc = " frees all resources allocated during the request."] + #[doc = ""] + #[doc = " But this will not free the request string passed when creating the context!"] + pub fn ctx_free(ctx: *mut in3_ctx_t); +} +extern "C" { + #[doc = " adds a new context as a requirment."] + #[doc = ""] + #[doc = " Whenever a verifier needs more data and wants to send a request, we should create the request and add it as dependency and stop."] + #[doc = ""] + #[doc = " If the function is called again, we need to search and see if the required status is now useable."] + #[doc = ""] + #[doc = " Here is an example of how to use it:"] + #[doc = ""] + #[doc = " ```c"] + #[doc = "in3_ret_t get_from_nodes(in3_ctx_t* parent, char* method, char* params, bytes_t* dst) {"] + #[doc = "in3_ctx_t* ctx = ctx_find_required(parent, method);"] + #[doc = "if (ctx) {"] + #[doc = "switch (in3_ctx_state(ctx)) {"] + #[doc = "case CTX_ERROR:"] + #[doc = "return ctx_set_error(parent, ctx->error, IN3_EUNKNOWN);"] + #[doc = "case CTX_WAITING_FOR_REQUIRED_CTX:"] + #[doc = "case CTX_WAITING_FOR_RESPONSE:"] + #[doc = "return IN3_WAITING;"] + #[doc = ""] + #[doc = "case CTX_SUCCESS: {"] + #[doc = "d_token_t* r = d_get(ctx->responses[0], K_RESULT);"] + #[doc = "if (r) {"] + #[doc = "dst = d_to_bytes(r);"] + #[doc = "return IN3_OK;"] + #[doc = "} else"] + #[doc = "return ctx_check_response_error(parent, 0);"] + #[doc = "}"] + #[doc = "}"] + #[doc = "}"] + #[doc = ""] + #[doc = ""] + #[doc = "char* req = _malloc(strlen(method) + strlen(params) + 200);"] + #[doc = "sprintf(req, \"{\\\"method\\\":\\\"%s\\\",\\\"jsonrpc\\\":\\\"2.0\\\",\\\"id\\\":1,\\\"params\\\":%s}\", method, params);"] + #[doc = "return ctx_add_required(parent, ctx_new(parent->client, req));"] + #[doc = "}"] + #[doc = " ```"] + pub fn ctx_add_required(parent: *mut in3_ctx_t, ctx: *mut in3_ctx_t) -> in3_ret_t::Type; +} +extern "C" { + #[doc = " searches within the required request contextes for one with the given method."] + #[doc = ""] + #[doc = " This method is used internaly to find a previously added context."] + pub fn ctx_find_required( + parent: *const in3_ctx_t, + method: *const libc::c_char, + ) -> *mut in3_ctx_t; +} +extern "C" { + #[doc = " removes a required context after usage."] + #[doc = " removing will also call free_ctx to free resources."] + pub fn ctx_remove_required(parent: *mut in3_ctx_t, ctx: *mut in3_ctx_t) -> in3_ret_t::Type; +} +extern "C" { + #[doc = " check if the response contains a error-property and reports this as error in the context."] + pub fn ctx_check_response_error(c: *mut in3_ctx_t, i: libc::c_int) -> in3_ret_t::Type; +} +extern "C" { + #[doc = " determins the errorcode for the given request."] + pub fn ctx_get_error(ctx: *mut in3_ctx_t, id: libc::c_int) -> in3_ret_t::Type; +} +extern "C" { + #[doc = " sends a request and returns a context used to access the result or errors."] + #[doc = ""] + #[doc = " This context *MUST* be freed with ctx_free(ctx) after usage to release the resources."] + pub fn in3_client_rpc_ctx_raw(c: *mut in3_t, request: *const libc::c_char) -> *mut in3_ctx_t; +} +extern "C" { + #[doc = " sends a request and returns a context used to access the result or errors."] + #[doc = ""] + #[doc = " This context *MUST* be freed with ctx_free(ctx) after usage to release the resources."] + pub fn in3_client_rpc_ctx( + c: *mut in3_t, + method: *const libc::c_char, + params: *const libc::c_char, + ) -> *mut in3_ctx_t; +} +extern "C" { + #[doc = " creates a request-object, which then need to be filled with the responses."] + #[doc = ""] + #[doc = " each request object contains a array of reponse-objects. In order to set the response, you need to call"] + #[doc = ""] + #[doc = " ```c"] + #[doc = " // set a succesfull response"] + #[doc = " sb_add_chars(&request->results[0].result, my_response);"] + #[doc = " // set a error response"] + #[doc = " sb_add_chars(&request->results[0].error, my_error);"] + #[doc = " ```"] + pub fn in3_create_request(ctx: *mut in3_ctx_t) -> *mut in3_request_t; +} +extern "C" { + #[doc = " frees a previuosly allocated request."] + pub fn request_free(req: *mut in3_request_t, ctx: *const in3_ctx_t, response_free: bool); +} +extern "C" { + #[doc = " sets the error message in the context."] + #[doc = ""] + #[doc = " If there is a previous error it will append it."] + #[doc = " the return value will simply be passed so you can use it like"] + #[doc = ""] + #[doc = " ```c"] + #[doc = " return ctx_set_error(ctx, \"wrong number of arguments\", IN3_EINVAL)"] + #[doc = " ```"] + pub fn ctx_set_error_intern( + c: *mut in3_ctx_t, + msg: *mut libc::c_char, + errnumber: in3_ret_t::Type, + ) -> in3_ret_t::Type; +} +extern "C" { + #[doc = " handles a failable context"] + #[doc = ""] + #[doc = " This context *MUST* be freed with ctx_free(ctx) after usage to release the resources."] + pub fn ctx_handle_failable(ctx: *mut in3_ctx_t) -> in3_ret_t::Type; +} +#[doc = " a 32 byte long integer used to store ethereum-numbers."] +#[doc = ""] +#[doc = " use the as_long() or as_double() to convert this to a useable number."] +#[repr(C)] +#[derive(Debug, Copy)] +pub struct uint256_t { + pub data: [u8; 32usize], +} +#[test] +fn bindgen_test_layout_uint256_t() { + assert_eq!( + ::core::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(uint256_t)) + ); + assert_eq!( + ::core::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(uint256_t)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).data as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(uint256_t), + "::", + stringify!(data) + ) + ); +} +impl Clone for uint256_t { + fn clone(&self) -> Self { + *self + } +} +extern "C" { + pub fn as_double(d: uint256_t) -> f64; +} +extern "C" { + pub fn as_long(d: uint256_t) -> u64; +} +extern "C" { + pub fn to_uint256(value: u64) -> uint256_t; +} +extern "C" { + pub fn decrypt_key( + key_data: *mut d_token_t, + password: *mut libc::c_char, + dst: *mut u8, + ) -> in3_ret_t::Type; +} +extern "C" { + pub fn to_checksum( + adr: *mut u8, + chain_id: chain_id_t, + out: *mut libc::c_char, + ) -> in3_ret_t::Type; +} +#[doc = " function to set error. Will only be called internally."] +#[doc = " default implementation is NOT MT safe!"] +pub type set_error_fn = + ::core::option::Option; +extern "C" { + pub fn api_set_error_fn(fn_: set_error_fn); +} +#[doc = " function to get last error message."] +#[doc = " default implementation is NOT MT safe!"] +pub type get_error_fn = ::core::option::Option *mut libc::c_char>; +extern "C" { + pub fn api_get_error_fn(fn_: get_error_fn); +} +extern "C" { + #[doc = " returns current error or null if all is ok"] + pub fn api_last_error() -> *mut libc::c_char; +} +pub type __gnuc_va_list = __builtin_va_list; +#[repr(C)] +#[derive(Debug, Copy)] +pub struct opt_uint64_t { + pub value: u64, + pub defined: bool, +} +#[test] +fn bindgen_test_layout_opt_uint64_t() { + assert_eq!( + ::core::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(opt_uint64_t)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(opt_uint64_t)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).value as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(opt_uint64_t), + "::", + stringify!(value) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).defined as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(opt_uint64_t), + "::", + stringify!(defined) + ) + ); +} +impl Clone for opt_uint64_t { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct opt_bytes_t { + pub value: bytes_t, + pub defined: bool, +} +#[test] +fn bindgen_test_layout_opt_bytes_t() { + assert_eq!( + ::core::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(opt_bytes_t)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(opt_bytes_t)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).value as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(opt_bytes_t), + "::", + stringify!(value) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).defined as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(opt_bytes_t), + "::", + stringify!(defined) + ) + ); +} +impl Clone for opt_bytes_t { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct opt_address_t { + pub value: address_t, + pub defined: bool, +} +#[test] +fn bindgen_test_layout_opt_address_t() { + assert_eq!( + ::core::mem::size_of::(), + 21usize, + concat!("Size of: ", stringify!(opt_address_t)) + ); + assert_eq!( + ::core::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(opt_address_t)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).value as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(opt_address_t), + "::", + stringify!(value) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).defined as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(opt_address_t), + "::", + stringify!(defined) + ) + ); +} +impl Clone for opt_address_t { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct opt_uint256_t { + pub value: uint256_t, + pub defined: bool, +} +#[test] +fn bindgen_test_layout_opt_uint256_t() { + assert_eq!( + ::core::mem::size_of::(), + 33usize, + concat!("Size of: ", stringify!(opt_uint256_t)) + ); + assert_eq!( + ::core::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(opt_uint256_t)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).value as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(opt_uint256_t), + "::", + stringify!(value) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).defined as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(opt_uint256_t), + "::", + stringify!(defined) + ) + ); +} +impl Clone for opt_uint256_t { + fn clone(&self) -> Self { + *self + } +} +#[doc = " A transaction"] +#[repr(C)] +#[derive(Copy)] +pub struct eth_tx { + #[doc = "< the blockhash"] + pub hash: bytes32_t, + #[doc = "< hash of ther containnig block"] + pub block_hash: bytes32_t, + #[doc = "< number of the containing block"] + pub block_number: u64, + #[doc = "< sender of the tx"] + pub from: address_t, + #[doc = "< gas send along"] + pub gas: u64, + #[doc = "< gas price used"] + pub gas_price: u64, + #[doc = "< data send along with the transaction"] + pub data: bytes_t, + #[doc = "< nonce of the transaction"] + pub nonce: u64, + #[doc = "< receiver of the address 0x0000.. -Address is used for contract creation."] + pub to: address_t, + #[doc = "< the value in wei send"] + pub value: uint256_t, + #[doc = "< the transaction index"] + pub transaction_index: libc::c_int, + #[doc = "< signature of the transaction"] + pub signature: [u8; 65usize], +} +#[test] +fn bindgen_test_layout_eth_tx() { + assert_eq!( + ::core::mem::size_of::(), + 264usize, + concat!("Size of: ", stringify!(eth_tx)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(eth_tx)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).hash as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(eth_tx), + "::", + stringify!(hash) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).block_hash as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(eth_tx), + "::", + stringify!(block_hash) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).block_number as *const _ as usize }, + 64usize, + concat!( + "Offset of field: ", + stringify!(eth_tx), + "::", + stringify!(block_number) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).from as *const _ as usize }, + 72usize, + concat!( + "Offset of field: ", + stringify!(eth_tx), + "::", + stringify!(from) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).gas as *const _ as usize }, + 96usize, + concat!( + "Offset of field: ", + stringify!(eth_tx), + "::", + stringify!(gas) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).gas_price as *const _ as usize }, + 104usize, + concat!( + "Offset of field: ", + stringify!(eth_tx), + "::", + stringify!(gas_price) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).data as *const _ as usize }, + 112usize, + concat!( + "Offset of field: ", + stringify!(eth_tx), + "::", + stringify!(data) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).nonce as *const _ as usize }, + 128usize, + concat!( + "Offset of field: ", + stringify!(eth_tx), + "::", + stringify!(nonce) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).to as *const _ as usize }, + 136usize, + concat!( + "Offset of field: ", + stringify!(eth_tx), + "::", + stringify!(to) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).value as *const _ as usize }, + 156usize, + concat!( + "Offset of field: ", + stringify!(eth_tx), + "::", + stringify!(value) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).transaction_index as *const _ as usize }, + 188usize, + concat!( + "Offset of field: ", + stringify!(eth_tx), + "::", + stringify!(transaction_index) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).signature as *const _ as usize }, + 192usize, + concat!( + "Offset of field: ", + stringify!(eth_tx), + "::", + stringify!(signature) + ) + ); +} +impl Clone for eth_tx { + fn clone(&self) -> Self { + *self + } +} +impl ::core::fmt::Debug for eth_tx { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + write ! ( f , "eth_tx {{ hash: [...], block_hash: [...], block_number: {:?}, from: {:?}, gas: {:?}, gas_price: {:?}, data: {:?}, nonce: {:?}, to: {:?}, value: {:?}, transaction_index: {:?}, signature: [...] }}" , self . block_number , self . from , self . gas , self . gas_price , self . data , self . nonce , self . to , self . value , self . transaction_index ) + } +} +pub type eth_tx_t = eth_tx; +#[doc = " An Ethereum Block"] +#[repr(C)] +#[derive(Copy)] +pub struct eth_block { + #[doc = "< the blockNumber"] + pub number: u64, + #[doc = "< the blockhash"] + pub hash: bytes32_t, + #[doc = "< gas used by all the transactions"] + pub gasUsed: u64, + #[doc = "< gasLimit"] + pub gasLimit: u64, + #[doc = "< the author of the block."] + pub author: address_t, + #[doc = "< the difficulty of the block."] + pub difficulty: uint256_t, + #[doc = "< the extra_data of the block."] + pub extra_data: bytes_t, + #[doc = "< the logsBloom-data"] + pub logsBloom: [u8; 256usize], + #[doc = "< the hash of the parent-block"] + pub parent_hash: bytes32_t, + #[doc = "< root hash of the uncle-trie"] + pub sha3_uncles: bytes32_t, + #[doc = "< root hash of the state-trie"] + pub state_root: bytes32_t, + #[doc = "< root of the receipts trie"] + pub receipts_root: bytes32_t, + #[doc = "< root of the transaction trie"] + pub transaction_root: bytes32_t, + #[doc = "< number of transactions in the block"] + pub tx_count: libc::c_int, + #[doc = "< array of transaction data or NULL if not requested"] + pub tx_data: *mut eth_tx_t, + #[doc = "< array of transaction hashes or NULL if not requested"] + pub tx_hashes: *mut bytes32_t, + #[doc = "< the unix timestamp of the block"] + pub timestamp: u64, + #[doc = "< sealed fields"] + pub seal_fields: *mut bytes_t, + #[doc = "< number of seal fields"] + pub seal_fields_count: libc::c_int, +} +#[test] +fn bindgen_test_layout_eth_block() { + assert_eq!( + ::core::mem::size_of::(), + 592usize, + concat!("Size of: ", stringify!(eth_block)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(eth_block)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).number as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(eth_block), + "::", + stringify!(number) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).hash as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(eth_block), + "::", + stringify!(hash) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).gasUsed as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(eth_block), + "::", + stringify!(gasUsed) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).gasLimit as *const _ as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(eth_block), + "::", + stringify!(gasLimit) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).author as *const _ as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(eth_block), + "::", + stringify!(author) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).difficulty as *const _ as usize }, + 76usize, + concat!( + "Offset of field: ", + stringify!(eth_block), + "::", + stringify!(difficulty) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).extra_data as *const _ as usize }, + 112usize, + concat!( + "Offset of field: ", + stringify!(eth_block), + "::", + stringify!(extra_data) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).logsBloom as *const _ as usize }, + 128usize, + concat!( + "Offset of field: ", + stringify!(eth_block), + "::", + stringify!(logsBloom) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).parent_hash as *const _ as usize }, + 384usize, + concat!( + "Offset of field: ", + stringify!(eth_block), + "::", + stringify!(parent_hash) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).sha3_uncles as *const _ as usize }, + 416usize, + concat!( + "Offset of field: ", + stringify!(eth_block), + "::", + stringify!(sha3_uncles) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).state_root as *const _ as usize }, + 448usize, + concat!( + "Offset of field: ", + stringify!(eth_block), + "::", + stringify!(state_root) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).receipts_root as *const _ as usize }, + 480usize, + concat!( + "Offset of field: ", + stringify!(eth_block), + "::", + stringify!(receipts_root) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).transaction_root as *const _ as usize }, + 512usize, + concat!( + "Offset of field: ", + stringify!(eth_block), + "::", + stringify!(transaction_root) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).tx_count as *const _ as usize }, + 544usize, + concat!( + "Offset of field: ", + stringify!(eth_block), + "::", + stringify!(tx_count) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).tx_data as *const _ as usize }, + 552usize, + concat!( + "Offset of field: ", + stringify!(eth_block), + "::", + stringify!(tx_data) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).tx_hashes as *const _ as usize }, + 560usize, + concat!( + "Offset of field: ", + stringify!(eth_block), + "::", + stringify!(tx_hashes) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).timestamp as *const _ as usize }, + 568usize, + concat!( + "Offset of field: ", + stringify!(eth_block), + "::", + stringify!(timestamp) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).seal_fields as *const _ as usize }, + 576usize, + concat!( + "Offset of field: ", + stringify!(eth_block), + "::", + stringify!(seal_fields) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).seal_fields_count as *const _ as usize }, + 584usize, + concat!( + "Offset of field: ", + stringify!(eth_block), + "::", + stringify!(seal_fields_count) + ) + ); +} +impl Clone for eth_block { + fn clone(&self) -> Self { + *self + } +} +impl ::core::fmt::Debug for eth_block { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + write ! ( f , "eth_block {{ number: {:?}, hash: [...], gasUsed: {:?}, gasLimit: {:?}, author: {:?}, difficulty: {:?}, extra_data: {:?}, logsBloom: [...], parent_hash: [...], sha3_uncles: [...], state_root: [...], receipts_root: [...], transaction_root: [...], tx_count: {:?}, tx_data: {:?}, tx_hashes: {:?}, timestamp: {:?}, seal_fields: {:?}, seal_fields_count: {:?} }}" , self . number , self . gasUsed , self . gasLimit , self . author , self . difficulty , self . extra_data , self . tx_count , self . tx_data , self . tx_hashes , self . timestamp , self . seal_fields , self . seal_fields_count ) + } +} +pub type eth_block_t = eth_block; +#[doc = " A linked list of Ethereum Logs"] +#[repr(C)] +#[derive(Debug, Copy)] +pub struct eth_log { + #[doc = "< true when the log was removed, due to a chain reorganization. false if its a valid log"] + pub removed: bool, + #[doc = "< log index position in the block"] + pub log_index: usize, + #[doc = "< transactions index position log was created from"] + pub transaction_index: usize, + #[doc = "< hash of the transactions this log was created from"] + pub transaction_hash: bytes32_t, + #[doc = "< hash of the block where this log was in"] + pub block_hash: bytes32_t, + #[doc = "< the block number where this log was in"] + pub block_number: u64, + #[doc = "< address from which this log originated"] + pub address: address_t, + #[doc = "< non-indexed arguments of the log"] + pub data: bytes_t, + #[doc = "< array of 0 to 4 32 Bytes DATA of indexed log arguments"] + pub topics: *mut bytes32_t, + #[doc = "< counter for topics"] + pub topic_count: usize, + #[doc = "< pointer to next log in list or NULL"] + pub next: *mut eth_log, +} +#[test] +fn bindgen_test_layout_eth_log() { + assert_eq!( + ::core::mem::size_of::(), + 160usize, + concat!("Size of: ", stringify!(eth_log)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(eth_log)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).removed as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(eth_log), + "::", + stringify!(removed) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).log_index as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(eth_log), + "::", + stringify!(log_index) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).transaction_index as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(eth_log), + "::", + stringify!(transaction_index) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).transaction_hash as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(eth_log), + "::", + stringify!(transaction_hash) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).block_hash as *const _ as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(eth_log), + "::", + stringify!(block_hash) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).block_number as *const _ as usize }, + 88usize, + concat!( + "Offset of field: ", + stringify!(eth_log), + "::", + stringify!(block_number) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).address as *const _ as usize }, + 96usize, + concat!( + "Offset of field: ", + stringify!(eth_log), + "::", + stringify!(address) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).data as *const _ as usize }, + 120usize, + concat!( + "Offset of field: ", + stringify!(eth_log), + "::", + stringify!(data) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).topics as *const _ as usize }, + 136usize, + concat!( + "Offset of field: ", + stringify!(eth_log), + "::", + stringify!(topics) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).topic_count as *const _ as usize }, + 144usize, + concat!( + "Offset of field: ", + stringify!(eth_log), + "::", + stringify!(topic_count) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).next as *const _ as usize }, + 152usize, + concat!( + "Offset of field: ", + stringify!(eth_log), + "::", + stringify!(next) + ) + ); +} +impl Clone for eth_log { + fn clone(&self) -> Self { + *self + } +} +pub type eth_log_t = eth_log; +#[doc = " A transaction receipt"] +#[repr(C)] +#[derive(Debug, Copy)] +pub struct eth_tx_receipt { + #[doc = "< the transaction hash"] + pub transaction_hash: bytes32_t, + #[doc = "< the transaction index"] + pub transaction_index: libc::c_int, + #[doc = "< hash of ther containnig block"] + pub block_hash: bytes32_t, + #[doc = "< number of the containing block"] + pub block_number: u64, + #[doc = "< total amount of gas used by block"] + pub cumulative_gas_used: u64, + #[doc = "< amount of gas used by this specific transaction"] + pub gas_used: u64, + #[doc = "< contract address created (if the transaction was a contract creation) or NULL"] + pub contract_address: *mut bytes_t, + #[doc = "< 1 if transaction succeeded, 0 otherwise."] + pub status: bool, + #[doc = "< array of log objects, which this transaction generated"] + pub logs: *mut eth_log_t, +} +#[test] +fn bindgen_test_layout_eth_tx_receipt() { + assert_eq!( + ::core::mem::size_of::(), + 120usize, + concat!("Size of: ", stringify!(eth_tx_receipt)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(eth_tx_receipt)) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).transaction_hash as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(eth_tx_receipt), + "::", + stringify!(transaction_hash) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).transaction_index as *const _ as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(eth_tx_receipt), + "::", + stringify!(transaction_index) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).block_hash as *const _ as usize }, + 36usize, + concat!( + "Offset of field: ", + stringify!(eth_tx_receipt), + "::", + stringify!(block_hash) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).block_number as *const _ as usize }, + 72usize, + concat!( + "Offset of field: ", + stringify!(eth_tx_receipt), + "::", + stringify!(block_number) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).cumulative_gas_used as *const _ as usize + }, + 80usize, + concat!( + "Offset of field: ", + stringify!(eth_tx_receipt), + "::", + stringify!(cumulative_gas_used) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).gas_used as *const _ as usize }, + 88usize, + concat!( + "Offset of field: ", + stringify!(eth_tx_receipt), + "::", + stringify!(gas_used) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::())).contract_address as *const _ as usize + }, + 96usize, + concat!( + "Offset of field: ", + stringify!(eth_tx_receipt), + "::", + stringify!(contract_address) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).status as *const _ as usize }, + 104usize, + concat!( + "Offset of field: ", + stringify!(eth_tx_receipt), + "::", + stringify!(status) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).logs as *const _ as usize }, + 112usize, + concat!( + "Offset of field: ", + stringify!(eth_tx_receipt), + "::", + stringify!(logs) + ) + ); +} +impl Clone for eth_tx_receipt { + fn clone(&self) -> Self { + *self + } +} +pub type eth_tx_receipt_t = eth_tx_receipt; +#[repr(u32)] +#[doc = " Abstract type for holding a block number"] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub enum eth_blknum_def_t { + BLK_LATEST = 0, + BLK_EARLIEST = 1, + BLK_PENDING = 2, +} +#[repr(C)] +#[derive(Copy)] +pub struct eth_blknum_t { + pub __bindgen_anon_1: eth_blknum_t__bindgen_ty_1, + pub is_u64: bool, +} +#[repr(C)] +#[derive(Copy)] +pub union eth_blknum_t__bindgen_ty_1 { + pub u64: u64, + pub def: eth_blknum_def_t, + _bindgen_union_align: u64, +} +#[test] +fn bindgen_test_layout_eth_blknum_t__bindgen_ty_1() { + assert_eq!( + ::core::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(eth_blknum_t__bindgen_ty_1)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(eth_blknum_t__bindgen_ty_1)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).u64 as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(eth_blknum_t__bindgen_ty_1), + "::", + stringify!(u64) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).def as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(eth_blknum_t__bindgen_ty_1), + "::", + stringify!(def) + ) + ); +} +impl Clone for eth_blknum_t__bindgen_ty_1 { + fn clone(&self) -> Self { + *self + } +} +impl ::core::fmt::Debug for eth_blknum_t__bindgen_ty_1 { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + write!(f, "eth_blknum_t__bindgen_ty_1 {{ union }}") + } +} +#[test] +fn bindgen_test_layout_eth_blknum_t() { + assert_eq!( + ::core::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(eth_blknum_t)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(eth_blknum_t)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).is_u64 as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(eth_blknum_t), + "::", + stringify!(is_u64) + ) + ); +} +impl Clone for eth_blknum_t { + fn clone(&self) -> Self { + *self + } +} +impl ::core::fmt::Debug for eth_blknum_t { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + write!( + f, + "eth_blknum_t {{ __bindgen_anon_1: {:?}, is_u64: {:?} }}", + self.__bindgen_anon_1, self.is_u64 + ) + } +} +extern "C" { + pub fn eth_getStorageAt( + in3: *mut in3_t, + account: *mut u8, + key: *mut u8, + block: eth_blknum_t, + ) -> uint256_t; +} +extern "C" { + pub fn eth_getCode(in3: *mut in3_t, account: *mut u8, block: eth_blknum_t) -> bytes_t; +} +extern "C" { + pub fn eth_getBalance(in3: *mut in3_t, account: *mut u8, block: eth_blknum_t) -> uint256_t; +} +extern "C" { + pub fn eth_blockNumber(in3: *mut in3_t) -> u64; +} +extern "C" { + pub fn eth_gasPrice(in3: *mut in3_t) -> u64; +} +extern "C" { + pub fn eth_getBlockByNumber( + in3: *mut in3_t, + number: eth_blknum_t, + include_tx: bool, + ) -> *mut eth_block_t; +} +extern "C" { + pub fn eth_getBlockByHash(in3: *mut in3_t, hash: *mut u8, include_tx: bool) + -> *mut eth_block_t; +} +extern "C" { + pub fn eth_getLogs(in3: *mut in3_t, fopt: *mut libc::c_char) -> *mut eth_log_t; +} +extern "C" { + pub fn eth_newFilter(in3: *mut in3_t, options: *mut json_ctx_t) -> in3_ret_t::Type; +} +extern "C" { + pub fn eth_newBlockFilter(in3: *mut in3_t) -> in3_ret_t::Type; +} +extern "C" { + pub fn eth_newPendingTransactionFilter(in3: *mut in3_t) -> in3_ret_t::Type; +} +extern "C" { + pub fn eth_uninstallFilter(in3: *mut in3_t, id: usize) -> bool; +} +extern "C" { + pub fn eth_getFilterChanges( + in3: *mut in3_t, + id: usize, + block_hashes: *mut *mut bytes32_t, + logs: *mut *mut eth_log_t, + ) -> in3_ret_t::Type; +} +extern "C" { + pub fn eth_getFilterLogs( + in3: *mut in3_t, + id: usize, + logs: *mut *mut eth_log_t, + ) -> in3_ret_t::Type; +} +extern "C" { + pub fn eth_chainId(in3: *mut in3_t) -> u64; +} +extern "C" { + pub fn eth_getBlockTransactionCountByHash(in3: *mut in3_t, hash: *mut u8) -> u64; +} +extern "C" { + pub fn eth_getBlockTransactionCountByNumber(in3: *mut in3_t, block: eth_blknum_t) -> u64; +} +extern "C" { + pub fn eth_call_fn( + in3: *mut in3_t, + contract: *mut u8, + block: eth_blknum_t, + fn_sig: *mut libc::c_char, + ... + ) -> *mut json_ctx_t; +} +extern "C" { + pub fn eth_estimate_fn( + in3: *mut in3_t, + contract: *mut u8, + block: eth_blknum_t, + fn_sig: *mut libc::c_char, + ... + ) -> u64; +} +extern "C" { + pub fn eth_getTransactionByHash(in3: *mut in3_t, tx_hash: *mut u8) -> *mut eth_tx_t; +} +extern "C" { + pub fn eth_getTransactionByBlockHashAndIndex( + in3: *mut in3_t, + block_hash: *mut u8, + index: usize, + ) -> *mut eth_tx_t; +} +extern "C" { + pub fn eth_getTransactionByBlockNumberAndIndex( + in3: *mut in3_t, + block: eth_blknum_t, + index: usize, + ) -> *mut eth_tx_t; +} +extern "C" { + pub fn eth_getTransactionCount(in3: *mut in3_t, address: *mut u8, block: eth_blknum_t) -> u64; +} +extern "C" { + pub fn eth_getUncleByBlockNumberAndIndex( + in3: *mut in3_t, + block: eth_blknum_t, + index: usize, + ) -> *mut eth_block_t; +} +extern "C" { + pub fn eth_getUncleCountByBlockHash(in3: *mut in3_t, hash: *mut u8) -> u64; +} +extern "C" { + pub fn eth_getUncleCountByBlockNumber(in3: *mut in3_t, block: eth_blknum_t) -> u64; +} +extern "C" { + pub fn eth_sendTransaction( + in3: *mut in3_t, + from: *mut u8, + to: *mut u8, + gas: opt_uint64_t, + gas_price: opt_uint64_t, + value: opt_uint256_t, + data: opt_bytes_t, + nonce: opt_uint64_t, + ) -> *mut bytes_t; +} +extern "C" { + pub fn eth_sendRawTransaction(in3: *mut in3_t, data: bytes_t) -> *mut bytes_t; +} +extern "C" { + pub fn eth_getTransactionReceipt(in3: *mut in3_t, tx_hash: *mut u8) -> *mut eth_tx_receipt_t; +} +extern "C" { + pub fn eth_wait_for_receipt(in3: *mut in3_t, tx_hash: *mut u8) -> *mut libc::c_char; +} +extern "C" { + pub fn eth_log_free(log: *mut eth_log_t); +} +extern "C" { + pub fn eth_tx_receipt_free(txr: *mut eth_tx_receipt_t); +} +extern "C" { + #[doc = " this function should only be called once and will register the eth-API verifier."] + pub fn in3_register_eth_api(); +} +extern "C" { + pub fn in3_for_chain_auto_init(chain_id: chain_id_t) -> *mut in3_t; +} +extern "C" { + #[doc = " a transport function using curl."] + #[doc = ""] + #[doc = " You can use it by setting the transport-function-pointer in the in3_t->transport to this function:"] + #[doc = ""] + #[doc = " ```c"] + #[doc = " #include "] + #[doc = " ..."] + #[doc = " c->transport = send_curl;"] + #[doc = " ```"] + pub fn send_curl(c: *mut in3_t, req: *mut in3_request_t) -> in3_ret_t::Type; +} +extern "C" { + #[doc = " registers curl as a default transport."] + pub fn in3_register_curl(); +} +pub type __builtin_va_list = [__va_list_tag; 1usize]; +#[repr(C)] +#[derive(Debug, Copy)] +pub struct __va_list_tag { + pub gp_offset: libc::c_uint, + pub fp_offset: libc::c_uint, + pub overflow_arg_area: *mut libc::c_void, + pub reg_save_area: *mut libc::c_void, +} +#[test] +fn bindgen_test_layout___va_list_tag() { + assert_eq!( + ::core::mem::size_of::<__va_list_tag>(), + 24usize, + concat!("Size of: ", stringify!(__va_list_tag)) + ); + assert_eq!( + ::core::mem::align_of::<__va_list_tag>(), + 8usize, + concat!("Alignment of ", stringify!(__va_list_tag)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__va_list_tag>())).gp_offset as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__va_list_tag), + "::", + stringify!(gp_offset) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__va_list_tag>())).fp_offset as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(__va_list_tag), + "::", + stringify!(fp_offset) + ) + ); + assert_eq!( + unsafe { + &(*(::core::ptr::null::<__va_list_tag>())).overflow_arg_area as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(__va_list_tag), + "::", + stringify!(overflow_arg_area) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::<__va_list_tag>())).reg_save_area as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(__va_list_tag), + "::", + stringify!(reg_save_area) + ) + ); +} +impl Clone for __va_list_tag { + fn clone(&self) -> Self { + *self + } +} diff --git a/rust/in3-sys/src/lib.rs b/rust/in3-sys/src/lib.rs new file mode 100644 index 000000000..c98fc1c2a --- /dev/null +++ b/rust/in3-sys/src/lib.rs @@ -0,0 +1,28 @@ +//! Low-level, unsafe Rust bindings for the [`In3`][in3] disassembly library. +//! +//! +//! We recommend against using this crate directly. +//! Instead, consider using [in3-rs], which provides a high-level, safe, "Rusty" interface. +//! +//! [in3-rs]: https://github.com/in3-rust/in3-rs +//! +//! **Note**: documentation for functions/types was taken directly from +//! [In3 C headers][in3 headers]. +//! +//! [in3 headers]: https://github.com/in3-rust/in3-sys/blob/master/in3/include/in3.h +//! 1: Defined as a ["constified" enum modules](https://docs.rs/bindgen/0.30.0/bindgen/struct.Builder.html#method.constified_enum_module) +//! because discriminant values are not unique. Rust requires discriminant values to be unique. + +// Suppress errors from In3 names +#![allow(non_upper_case_globals)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(improper_ctypes)] +#![no_std] + +extern crate libc; + +// Bindings should be copied here +include!(concat!(env!("OUT_DIR"), "/in3.rs")); + +include!(concat!(env!("CARGO_MANIFEST_DIR"), "/common.rs")); diff --git a/scripts/build_includeh.sh b/scripts/build_includeh.sh index 021419c60..749957a81 100755 --- a/scripts/build_includeh.sh +++ b/scripts/build_includeh.sh @@ -29,3 +29,17 @@ while read path; do done' none {} \; done ../c/include/in3.rs.h +// AUTO-GENERATED FILE +// See scripts/build_includeh.sh +#include "../src/core/client/context_internal.h" +#include "in3/bytes.h" +#include "in3/client.h" +#include "in3/context.h" +#include "in3/error.h" +#include "in3/eth_api.h" +#include "in3/in3_init.h" +#include "in3/in3_curl.h" +EOF diff --git a/scripts/build_rust.sh b/scripts/build_rust.sh new file mode 100755 index 000000000..3cfcd9a05 --- /dev/null +++ b/scripts/build_rust.sh @@ -0,0 +1,8 @@ +#!/bin/sh +cd .. +mkdir -p build_rust +cd build_rust +rm -rf * +export UPDATE_IN3_BINDINGS=1 +cmake -DCMAKE_BUILD_TYPE=MINSIZEREL -DDEV_NO_INTRN_PTR=OFF -DUSE_CURL=false .. && make -j8 && cd ../rust/ && cargo clean && cargo build +cd ../scripts diff --git a/scripts/rust.sh b/scripts/rust.sh new file mode 100755 index 000000000..14a315e03 --- /dev/null +++ b/scripts/rust.sh @@ -0,0 +1,8 @@ +#!/bin/sh +cd .. +docker run \ + --rm \ + -it \ + -v $(pwd):/in3-core \ + docker.slock.it/build-images/cmake:rust +cd scripts diff --git a/wasm/src/wasm.c b/wasm/src/wasm.c index 03ff15dee..eb14cb5a0 100644 --- a/wasm/src/wasm.c +++ b/wasm/src/wasm.c @@ -77,7 +77,7 @@ static char* to_hex_string(uint8_t* data, int l) { */ // --------------- storage ------------------- // clang-format off -EM_JS(char*, in3_cache_get, (char* key), { +EM_JS(char*, in3_cache_get, (const char* key), { var val = Module.in3_cache.get(UTF8ToString(key)); if (val) { var len = (val.length << 2) + 1; @@ -88,7 +88,7 @@ EM_JS(char*, in3_cache_get, (char* key), { return 0; }) -EM_JS(void, in3_cache_set, (char* key, char* val), { +EM_JS(void, in3_cache_set, (const char* key, char* val), { Module.in3_cache.set(UTF8ToString(key),UTF8ToString(val)); }) @@ -97,14 +97,14 @@ char* EMSCRIPTEN_KEEPALIVE in3_version() { } // clang-format on -bytes_t* storage_get_item(void* cptr, char* key) { +bytes_t* storage_get_item(void* cptr, const char* key) { UNUSED_VAR(cptr); char* val = in3_cache_get(key); bytes_t* res = val ? hex_to_new_bytes(val, strlen(val)) : NULL; return res; } -void storage_set_item(void* cptr, char* key, bytes_t* content) { +void storage_set_item(void* cptr, const char* key, bytes_t* content) { UNUSED_VAR(cptr); char buffer[content->len * 2 + 1]; bytes_to_hex(content->data, content->len, buffer); @@ -218,12 +218,8 @@ char* EMSCRIPTEN_KEEPALIVE base64Encode(uint8_t* input, int len) { } #endif in3_t* EMSCRIPTEN_KEEPALIVE in3_create(chain_id_t chain) { - in3_t* c = in3_for_chain(chain); - c->cache = malloc(sizeof(in3_storage_handler_t)); - c->cache->get_item = storage_get_item; - c->cache->set_item = storage_set_item; - - in3_cache_init(c); + in3_t* c = in3_for_chain(chain); + in3_set_storage_handler(c, storage_get_item, storage_set_item, NULL, NULL); in3_set_error(NULL); return c; }