diff --git a/.drone.yml b/.drone.yml index 2b6ec3c58..616e797fa 100644 --- a/.drone.yml +++ b/.drone.yml @@ -21,10 +21,6 @@ steps: - LDFLAGS=-L/usr/local/lib CFLAGS=-I/usr/local/include python3 setup.py sdist build install - env LD_LIBRARY_PATH=/usr/local/lib ./notcurses-pydemo > /dev/null - env LD_LIBRARY_PATH=/usr/local/lib ./ncdirect-pydemo > /dev/null - - cd ../rust - - rustc --version - - cargo build - - cargo t_all --- kind: pipeline type: docker @@ -43,10 +39,6 @@ steps: - ctest --output-on-failure - make install - ldconfig - - cd ../rust - - rustc --version - - cargo build - - cargo t_all - cd ../cffi - LDFLAGS=-L/usr/local/lib CFLAGS=-I/usr/local/include python3 setup.py sdist build install - cd ../python diff --git a/.github/workflows/macos_test.yml b/.github/workflows/macos_test.yml index fd06536ff..8100d1132 100644 --- a/.github/workflows/macos_test.yml +++ b/.github/workflows/macos_test.yml @@ -27,8 +27,7 @@ jobs: libunistring \ ncurses \ pandoc \ - readline \ - rust + readline - uses: actions/checkout@v2 @@ -69,11 +68,3 @@ jobs: python3 setup.py build #sudo python3 setup.py install #python3 examples/000-print-version.py - - - name: rust wrappers - run: | - export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig" - cd rust - rustc --version - cargo build - cargo t_all diff --git a/.github/workflows/ubuntu_test.yml b/.github/workflows/ubuntu_test.yml index 1c1ec972a..d6fac59b4 100644 --- a/.github/workflows/ubuntu_test.yml +++ b/.github/workflows/ubuntu_test.yml @@ -81,10 +81,3 @@ jobs: python3 setup.py build sudo python3 setup.py install python3 examples/000-print-version.py - - - name: rust wrappers - run: | - cd rust - rustc --version - cargo build - cargo t_all diff --git a/.github/workflows/windows_test.yml b/.github/workflows/windows_test.yml index 34f4c9292..cd7913279 100644 --- a/.github/workflows/windows_test.yml +++ b/.github/workflows/windows_test.yml @@ -85,11 +85,3 @@ jobs: #python3 setup.py install #notcurses-pydemo > /dev/null #ncdirect-pydemo > /dev/null - - - name: rust wrappers - run: | - cd rust - #rustc --version - #cargo build - #cargo t_all - #mingw-w64-ucrt-x86_64-rust diff --git a/USAGE.md b/USAGE.md index 95e09cbd8..905f25215 100644 --- a/USAGE.md +++ b/USAGE.md @@ -690,9 +690,9 @@ typedef struct ncinput { // Read a UTF-32-encoded Unicode codepoint from input. This might only be part // of a larger EGC. Provide a NULL 'ts' to block at length, and otherwise a // timespec to bound blocking. Returns a single Unicode code point, or -// (uint32_t)-1 on error. 'sigmask' may be NULL. Returns 0 on a timeout. If an -// event is processed, the return value is the 'id' field from that event. -// 'ni' may be NULL. +// (uint32_t)-1 on error. Returns 0 on a timeout. If an event is processed, the +// return value is the 'id' field from that event. 'ni' may be NULL. 'ts' is an +// *absolute* time relative to gettimeofday() (see pthread_cond_timedwait(3)). uint32_t notcurses_get(struct notcurses* n, const struct timespec* ts, ncinput* ni); diff --git a/include/notcurses/notcurses.h b/include/notcurses/notcurses.h index bf3f0c7f3..4a8596b84 100644 --- a/include/notcurses/notcurses.h +++ b/include/notcurses/notcurses.h @@ -1068,10 +1068,9 @@ ncinput_equal_p(const ncinput* n1, const ncinput* n2){ // Read a UTF-32-encoded Unicode codepoint from input. This might only be part // of a larger EGC. Provide a NULL 'ts' to block at length, and otherwise a // timespec to bound blocking. Returns a single Unicode code point, or -// (uint32_t)-1 on error. 'sigmask' may be NULL. Returns 0 on a timeout. If an -// event is processed, the return value is the 'id' field from that event. -// 'ni' may be NULL. 'ts' is an *absolute* time relative to gettimeofday() -// (see pthread_cond_timedwait(3)). +// (uint32_t)-1 on error. Returns 0 on a timeout. If an event is processed, the +// return value is the 'id' field from that event. 'ni' may be NULL. 'ts' is an +// *absolute* time relative to gettimeofday() (see pthread_cond_timedwait(3)). API uint32_t notcurses_get(struct notcurses* n, const struct timespec* ts, ncinput* ni) __attribute__ ((nonnull (1))); diff --git a/rust/.cargo/config.toml b/rust/.cargo/config.toml deleted file mode 100644 index e0c40bc08..000000000 --- a/rust/.cargo/config.toml +++ /dev/null @@ -1,14 +0,0 @@ -[alias] -d = "doc --no-deps" -do = "doc --no-deps --open" - -re = "run --example" -rre = "run --release --example" - -rqe = "run --quiet --example " -req = "rqe" - -# TEST -# fix IO errors: https://github.com/dankamongmen/notcurses/issues/766 -t = "test -- --test-threads 1 --nocapture" -t_all = "test --no-fail-fast -- --test-threads 1 --nocapture" diff --git a/rust/Cargo.toml b/rust/Cargo.toml deleted file mode 100644 index a8a3604a8..000000000 --- a/rust/Cargo.toml +++ /dev/null @@ -1,48 +0,0 @@ -[package] -name = "libnotcurses-sys" -version = "2.4.1" -authors = [ - "nick black ", - "José Luis Cruz " -] -license = "MIT OR Apache-2.0" -edition = "2018" -description = "Low-level Rust bindings for the notcurses C library." -documentation = "https://dankamongmen.github.io/notcurses/rustdoc/libnotcurses_sys/" -repository = "https://github.com/dankamongmen/notcurses" -homepage = "https://nick-black.com/dankwiki/index.php/Notcurses" -readme = "./README.md" -links = "notcurses" -build = "build/build.rs" -categories = [ - "external-ffi-bindings", - "command-line-interface", - "visualization", - "multimedia", - "rendering", - ] -keywords = ["tui", "cli", "terminal", "ncurses", "ffi"] -include = ["build/", "examples/", "src/", "LICENSE-*", "README.md"] - -[dependencies] -libc = { version = "^0.2.80", default-features = false } -cty = "^0.2.1" - -[build-dependencies] -bindgen = "^0.57" -pkg-config = "^0.3.18" - -[dev-dependencies] -serial_test = "^0.5.0" -serial_test_derive = "^0.5.0" - -rand = "^0.8" - -# https://doc.rust-lang.org/cargo/reference/profiles.html -[profile.dev] -# -[profile.release] -# opt-level = 0 # [0-*3 | s | z] -# lto = "fat" # [*fat | thin] -# debug = 1 # [*0/false | 1 | 2/true] -# debug-assertions = true # [*false | true] diff --git a/rust/LICENSE-APACHE b/rust/LICENSE-APACHE deleted file mode 100644 index d64569567..000000000 --- a/rust/LICENSE-APACHE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/rust/LICENSE-MIT b/rust/LICENSE-MIT deleted file mode 100644 index db21131ba..000000000 --- a/rust/LICENSE-MIT +++ /dev/null @@ -1,25 +0,0 @@ -Copyright 2020-2021 José Luis Cruz and Nick Black - -Permission is hereby granted, free of charge, to any -person obtaining a copy of this software and associated -documentation files (the "Software"), to deal in the -Software without restriction, including without -limitation the rights to use, copy, modify, merge, -publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software -is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice -shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF -ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED -TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT -SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. diff --git a/rust/README.md b/rust/README.md deleted file mode 100644 index cc6710a99..000000000 --- a/rust/README.md +++ /dev/null @@ -1,105 +0,0 @@ -[![Crate](https://img.shields.io/crates/v/libnotcurses-sys.svg)](https://crates.io/crates/libnotcurses-sys) -[![API](https://docs.rs/libnotcurses-sys/badge.svg)](https://dankamongmen.github.io/notcurses/rustdoc/libnotcurses_sys/) -[![MSRV: 1.48.0](https://flat.badgen.net/badge/MSRV/1.48.0/purple)](https://blog.rust-lang.org/2020/11/19/Rust-1.48.html) - -`libnotcurses-sys` is a low-level Rust wrapper for the -[notcurses C library](https://www.github.com/dankamongmen/notcurses/) - -This library is built with several layers of zero-overhead abstractions -over the C functions and pointers accessed through FFI. - -# How to use this library - -There are basically two ways: The [**Rust way**](#1-the-rust-way), -and the [**C way**](#2-the-c-way). (Or a mix of both). - -## 1. The Rust way - -Where you use the more safely wrapped types, with its methods and constructors, -and painless error handling, like this: - -```rust -use libnotcurses_sys::*; - -fn main() -> NcResult<()> { - let mut nc = Nc::with_flags(NCOPTION_NO_ALTERNATE_SCREEN)?; - let plane = nc.stdplane(); - plane.putstr("hello world")?; - nc.render()?; - nc.stop()?; - Ok(()) -} -``` - -Although you still have to manually call the `stop()` method for `Nc` -and `NcDirect` objects, and the `destroy()` method for the rest of types that -allocate, (like `NcPlane`, `NcMenu`…) at the end of their scope, since the Drop -trait is not implemented for any wrapping type in libnotcurses-sys. - -But they do implement methods and use `NcResult` as the return type, -for handling errors in the way we are used to in Rust. - -For the types that don't allocate, most are based on primitives like `i32`, -`u32`, `u64`… without a name in the C library. In Rust they are type aliased -(e.g.: `NcChannel`, `NcChannelPair`, `NcRgb`, `NcColor`…), to -leverage type checking, and they implement methods through traits -(e.g. `NcChannelMethods` must be in scope to use the `NcChannel` methods. - -## 2. The C way - -You can always use the C API functions directly if you prefer, -in a very similar way as the C library is used. - -It requires the use of unsafe, since most functions are wrapped directly -by `bindgen` marked as such. - -Error handling is done this way by checking the returned `NcIntResult`, -or in case of receiving a pointer, by comparing it to `null_mut()`. - -### Example - -```rust -use core::ptr::{null, null_mut}; -use std::process::exit; - -use libnotcurses_sys::*; - -fn main() { - let options = ffi::notcurses_options { - termtype: null(), - loglevel: 0, - margin_t: 0, - margin_r: 0, - margin_b: 0, - margin_l: 0, - flags: NCOPTION_NO_ALTERNATE_SCREEN, - }; - unsafe { - let nc = notcurses_init(&options, null_mut()); - if nc == null_mut() { - exit(1); - } - let plane = notcurses_stdplane(nc); - let cols = ncplane_putstr(&mut *plane, "hello world"); - if cols < NCRESULT_OK { - notcurses_stop(nc); - exit(cols.abs()); - } - if notcurses_stop(nc) < NCRESULT_OK { - exit(2); - } - } -} - -``` - -### The `notcurses` C API docs - -- [API reference (man pages)](https://notcurses.com/) -- [Wiki Page](https://nick-black.com/dankwiki/index.php/Notcurses) -- [The Book Guide (pdf)](https://nick-black.com/htp-notcurses.pdf) -- [USAGE.md](https://github.com/dankamongmen/notcurses/blob/master/USAGE.md) -- [HACKING.md](https://github.com/dankamongmen/notcurses/blob/master/doc/HACKING.md) -- [Doxygen Documentation](https://nick-black.com/notcurses/html/index.html) -- [FOSDEM 2021 presentation](https://fosdem.org/2021/schedule/event/notcurses/) - diff --git a/rust/build/build.rs b/rust/build/build.rs deleted file mode 100644 index a53b501c7..000000000 --- a/rust/build/build.rs +++ /dev/null @@ -1,99 +0,0 @@ -extern crate bindgen; -extern crate pkg_config; - -use std::env; -use std::path::PathBuf; - -// largely taken from https://rust-lang.github.io/rust-bindgen/tutorial-3.html -fn main() { - let plib = pkg_config::Config::new() - .atleast_version("2.4.1") - .probe("notcurses") - .unwrap(); - - // Tell cargo to invalidate the built crate whenever the wrapper changes - println!("cargo:rerun-if-changed=build/wrapper.h"); - - // The bindgen::Builder is the main entry point to bindgen, and lets you - // build up options for the resulting bindings. - // - // https://docs.rs/bindgen/*/bindgen/struct.Builder.html - // - // allow .blacklist_function instead of .blocklist_function for now, - // until we update bindgen to >= 0.58. - #[allow(deprecated)] - let mut builder = bindgen::Builder::default() - .use_core() - .ctypes_prefix("cty") - .clang_arg("-D_XOPEN_SOURCE") - // The input header we would like to generate builder for. - .header("build/wrapper.h") - // generate comments, also from headers and not just doc comments (///) - .generate_comments(true) - .clang_arg("-fretain-comments-from-system-headers") - .clang_arg("-fparse-all-comments") - // Remove warnings about improper_ctypes - .blacklist_function("strtold") - .blacklist_function("wcstold") - .blacklist_function("socketpair") - // only import functions from notcurses public API - .blacklist_function("[^ns].*") - .blacklist_function("n[^co].*") - .blacklist_function("s[^i].*") // allow sig* - // clean more unneeded types - .blacklist_item("B[0-9]+") - .blacklist_item("_BITS.*") - .blacklist_item("_POSIX.*") - .blacklist_item("__[A-Z].*") - .blacklist_item("[ADHJ-MQ-Z].*") - .blacklist_item("IN.*") - .blacklist_item("IP[^R].*") - .blacklist_item("ip.*") - .blacklist_item("m.*") - .blacklist_item("PF.*") - .blacklist_item("MSG_.*") - .blacklist_item("N[^C].*") - .blacklist_type("_bindgen.*") - // https://github.com/dankamongmen/notcurses/pull/1937 - // https://github.com/rust-lang/rust-bindgen/issues/1651 - .layout_tests(false) - // Don't derive the Copy trait on types with destructors. - .no_copy("ncdirect") - .no_copy("ncdplot") - .no_copy("ncfdplane") - .no_copy("ncmenu") - .no_copy("ncmultiselector") - .no_copy("ncplane") - .no_copy("ncreader") - .no_copy("ncreel") - .no_copy("ncselector") - .no_copy("ncuplot") - .no_copy("ncvisual") - .no_copy("notcurses") - // try to derive more traits - .derive_default(true) - .derive_hash(true) - .derive_partialord(true) - .derive_ord(true) - .derive_partialeq(true) - .derive_eq(true) - // Tell cargo to invalidate the built crate whenever any of the - // included header files changed. - .parse_callbacks(Box::new(bindgen::CargoCallbacks)); - - for d in plib.include_paths { - builder = builder.clang_arg(format!("-I{}", d.to_string_lossy())); - } - - // Finish the builder and generate the builder. - let bindings = builder - .generate() - // Unwrap the Result and panic on failure. - .expect("Unable to generate bindings"); - - // Write the bindings to the $OUT_DIR/bindings.rs file. - let out_path = PathBuf::from(env::var("OUT_DIR").unwrap()); - bindings - .write_to_file(out_path.join("bindings.rs")) - .expect("Couldn't write bindings!"); -} diff --git a/rust/build/wrapper.h b/rust/build/wrapper.h deleted file mode 100644 index 831a234f2..000000000 --- a/rust/build/wrapper.h +++ /dev/null @@ -1,2 +0,0 @@ -#include -#include diff --git a/rust/examples/direct-capabilities.rs b/rust/examples/direct-capabilities.rs deleted file mode 100644 index 9795c4e9c..000000000 --- a/rust/examples/direct-capabilities.rs +++ /dev/null @@ -1,22 +0,0 @@ -use libnotcurses_sys::*; - -fn main() -> NcResult<()> { - let dm = NcDirect::new()?; - - let (t_rows, t_cols) = dm.dim_yx(); - println!("Terminal rows={0}, cols={1}", t_rows, t_cols); - - println!( - "Can display UTF-8: {0} -Can open images: {1} -Supports Pixels: {2:?} -Palette size: {3:?} -", - dm.canutf8(), - dm.canopen_images(), - dm.check_pixel_support(), - dm.palette_size(), - ); - - Ok(()) -} diff --git a/rust/examples/direct-cursor.rs b/rust/examples/direct-cursor.rs deleted file mode 100644 index bb10ae9d1..000000000 --- a/rust/examples/direct-cursor.rs +++ /dev/null @@ -1,61 +0,0 @@ -//! Example 'direct-cursor' -//! -//! Explore cursor functions in direct mode -//! - -use rand::{thread_rng, Rng}; - -use libnotcurses_sys::*; - -fn main() -> NcResult<()> { - let mut rng = thread_rng(); - - let ncd = NcDirect::new()?; - - let cols = ncd.dim_x(); - let rows = ncd.dim_y(); - println!("terminal size (rows, cols): {}, {}", rows, cols); - - let mut channels = - NcChannels::combine(NcChannel::from_rgb(0xAA2244), NcChannel::from_rgb(0x112233)); - ncd.putstr(channels, "The current coordinates are")?; - - for _n in 0..40 { - ncd.flush()?; - sleep![0, 30]; - channels.set_fg_rgb8( - rng.gen_range(0x66..=0xEE), - rng.gen_range(0x66..=0xEE), - rng.gen_range(0x66..=0xEE), - ); - channels.set_bg_rgb8( - rng.gen_range(0..=0x9), - rng.gen_range(0..=0x9), - rng.gen_range(0..=0x9), - ); - ncd.putstr(channels, ".")?; - } - - let (cy, cx) = ncd.cursor_yx()?; - ncd.putstr(channels, &format!(" ({},{})\n", cy, cx))?; - sleep![1]; - - let sentence = vec![ - "And", "now", "I", "will", "clear", "the", "screen", ".", ".", ".", - ]; - for word in sentence { - channels.set_fg_rgb(channels.fg_rgb().wrapping_sub(0x050505)); - channels.set_bg_rgb(channels.bg_rgb().wrapping_add(0x090909)); - ncd.putstr(channels, &format!["{} ", word])?; - ncd.flush()?; - sleep![0, 150]; - } - sleep![0, 300]; - channels.set_fg_rgb(0xFFFFFF); - channels.set_bg_default(); - ncd.putstr(channels, "\nbye!\n\n")?; - ncd.flush()?; - sleep![0, 600]; - ncd.clear()?; - Ok(()) -} diff --git a/rust/examples/direct-image-c.rs b/rust/examples/direct-image-c.rs deleted file mode 100644 index 43c896dec..000000000 --- a/rust/examples/direct-image-c.rs +++ /dev/null @@ -1,38 +0,0 @@ -//! Example 'direct-image' -//! -//! Explore image rendering in direct mode -//! -//! NOTE: This example uses the C style with functions. - -use core::ptr::{null, null_mut}; -use libnotcurses_sys::*; - -fn main() { - unsafe { - let ncd = ncdirect_init(null(), null_mut(), 0); - - render_image(&mut *ncd, NCBLIT_1x1); - render_image(&mut *ncd, NCBLIT_2x1); - render_image(&mut *ncd, NCBLIT_BRAILLE); - - ncdirect_stop(ncd); - } -} - -fn render_image(ncd: &mut NcDirect, blit: NcBlitter) { - unsafe { - if ncdirect_render_image( - ncd, - cstring!["image-16x16.png"], - NCALIGN_CENTER, - blit, - NCSCALE_NONE, - ) != 0 - { - panic!( - "ERROR: ncdirect_render_image(). Make sure you \ - are running this example from the examples folder" - ); - } - } -} diff --git a/rust/examples/direct-image-rust.rs b/rust/examples/direct-image-rust.rs deleted file mode 100644 index 8a92f67ef..000000000 --- a/rust/examples/direct-image-rust.rs +++ /dev/null @@ -1,28 +0,0 @@ -//! Example 'direct-image' -//! -//! Explore image rendering in direct mode -//! -//! NOTE: This example uses the Rust style with methods. - -use libnotcurses_sys::*; - -fn main() -> NcResult<()> { - let mut dm = NcDirect::new()?; - - render_image(&mut dm, NCBLIT_1x1)?; - render_image(&mut dm, NCBLIT_2x1)?; - render_image(&mut dm, NCBLIT_BRAILLE)?; - - Ok(()) -} - -fn render_image(dm: &mut NcDirect, blit: NcBlitter) -> NcResult<()> { - if let Err(nc_error) = dm.render_image("image-16x16.png", NCALIGN_CENTER, blit, NCSCALE_NONE) { - return Err(NcError::with_msg( - nc_error.int, - "ERROR: dmirect_render_image(). Make sure you \ - are running this example from the examples folder", - )); - } - Ok(()) -} diff --git a/rust/examples/full-capabilities.rs b/rust/examples/full-capabilities.rs deleted file mode 100644 index e0dff7be5..000000000 --- a/rust/examples/full-capabilities.rs +++ /dev/null @@ -1,43 +0,0 @@ -use libnotcurses_sys::*; - -fn main() -> NcResult<()> { - let nc = Nc::without_altscreen()?; - - let (t_rows, t_cols) = nc.term_dim_yx(); - println!("Terminal rows={0}, cols={1}", t_rows, t_cols); - - println!( - "Can display UTF-8: {0} -Can display braille characters: {1} -Can display sextant characters: {2} -Can display quadrant characters: {3} -Can display half block characters: {4} -Can open images: {5} -Can open videos: {6} -Supports Pixels: {7:?} -Supports True Color: {8} -Supports fading: {9} -Supports changing the palette: {10} -Palette size: {11:?} -", - nc.canutf8(), - nc.canbraille(), - nc.cansextant(), - nc.canquadrant(), - nc.canhalfblock(), - nc.canopen_images(), - nc.canopen_videos(), - nc.check_pixel_support(), - nc.cantruecolor(), - nc.canfade(), - nc.canchangecolor(), - nc.palette_size(), - ); - - let pixelgeom = nc.stdplane().pixelgeom(); - println!("{:#?}", pixelgeom); - - nc.render()?; - nc.stop()?; - Ok(()) -} diff --git a/rust/examples/full-input.rs b/rust/examples/full-input.rs deleted file mode 100644 index a44ae9942..000000000 --- a/rust/examples/full-input.rs +++ /dev/null @@ -1,37 +0,0 @@ -//! Input -//! -//! https://github.com/dankamongmen/notcurses/blob/master/USAGE.md#input -//! - -use libnotcurses_sys::*; - -fn main() -> NcResult<()> { - let mut nc = Nc::with_flags( - NCOPTION_SUPPRESS_BANNERS | NCOPTION_NO_WINCH_SIGHANDLER | NCOPTION_NO_QUIT_SIGHANDLERS, - )?; - - println!("Exit with F1\n"); - - let mut input = NcInput::new_empty(); - - loop { - let key = notcurses_getc_nblock(&mut nc, &mut input); - - if key as i32 != -1 { - println!("'{0}' ({1:x})\n{2:?}", key, key as u32, input); - } - - nrs![&mut nc, 0, 10]; - - match key { - NCKEY_F01 => break, - _ => (), - } - } - - println!("\nExiting..."); - - nrs![&mut nc, 1]; - nc.stop()?; - Ok(()) -} diff --git a/rust/examples/full-planes.rs b/rust/examples/full-planes.rs deleted file mode 100644 index 2d9bb6aff..000000000 --- a/rust/examples/full-planes.rs +++ /dev/null @@ -1,64 +0,0 @@ -use libnotcurses_sys::*; - -fn main() -> NcResult<()> { - let mut nc = Nc::new()?; - - // get the terminal size in character rows & columns - let (t_rows, t_cols) = nc.term_dim_yx(); - - // the standard plane has the same size - let mut stdplane = nc.stdplane(); - assert_eq![(t_rows, t_cols), stdplane.dim_yx()]; - - // set the standard plane's base cell's foreground and background colors - let channels = NcChannels::from_rgb(0x88aa00, 0x222288); - stdplane.set_base("x", 0, channels)?; - nrs![&mut nc, 0, 500]; - - // add a green plane to the stdplane's pile - let plane_green = NcPlane::new_bound(&mut stdplane, 0, 0, 16, 30)?; - plane_green.set_base("·", 0, NcChannels::from_rgb(0x224411, 0x229922))?; - nrs![&mut nc, 0, 800]; - - // add a smaller red plane, a bit displaced to the bottom right - let plane_red = NcPlane::new_bound(&mut stdplane, 8, 12, 10, 20)?; - plane_red.set_base("~", 0, NcChannels::from_rgb(0xaadd2b, 0x882222))?; - nrs![&mut nc, 0, 800]; - - // write something - plane_green.putstr("PLANE 11111")?; - plane_red.putstr("PLANE 22222")?; - nrs![&mut nc, 0, 800]; - - // move the green plane down - for _ in 0..16 { - plane_green.move_rel(1, 1)?; - nrs![&mut nc, 0, 30]; - } - // and up - for _ in 0..20 { - plane_green.move_rel(-1, -1)?; - nrs![&mut nc, 0, 35]; - } - - // move the red plane right - for _ in 0..26 { - plane_red.move_rel(0, 1)?; - nrs![&mut nc, 0, 40]; - } - sleep![1]; - - // resize the red plane - plane_red.resize_simple(14, 24)?; - nrs![&mut nc, 0, 300]; - plane_red.move_rel(-2, -2)?; - nrs![&mut nc, 0, 300]; - plane_red.resize_simple(8, 16)?; - - // TODO… - - nrs![&mut nc, 3]; - - nc.stop()?; - Ok(()) -} diff --git a/rust/examples/image-16x16.png b/rust/examples/image-16x16.png deleted file mode 100644 index d1ff75f51..000000000 Binary files a/rust/examples/image-16x16.png and /dev/null differ diff --git a/rust/examples/issue-1832.rs b/rust/examples/issue-1832.rs deleted file mode 100644 index 3d1edd3a9..000000000 --- a/rust/examples/issue-1832.rs +++ /dev/null @@ -1,48 +0,0 @@ -//! https://github.com/dankamongmen/notcurses/issues/1832 - -use libnotcurses_sys::*; - -const W: u32 = 32; -const H: u32 = 32; - -fn main() -> NcResult<()> { - let mut nc = Nc::new()?; - - // create a white rectangle visual for the background - let buffer1 = vec![255; H as usize * W as usize * 3]; - let mut bg_plane = NcPlane::new(&mut nc, 0, 0, H, W)?; - let v = NcVisual::from_rgb_packed(buffer1.as_slice(), H, W * 3, W, 255)?; - let vo = NcVisualOptions::with_plane( - &mut bg_plane, - NCSCALE_NONE, - 0, - 0, - 0, - 0, - 0, - 0, - NCBLIT_PIXEL, - 0, - 0, - ); - - // create a blue plane for the foreground - let fg_plane = NcPlane::new_bound(&mut bg_plane, 1, 1, 2, 16)?; - fg_plane.set_base(" ", 0, NcChannels::from_rgb(0x88aa00, 0x222288))?; - - let mut counter = 0; - for _ in 0..3 { - let _ = fg_plane.putstr_yx(0, 0, &format!["counter: {}", &counter]); - counter += 1; - - v.render(nc, &vo)?; - bg_plane.render()?; - bg_plane.rasterize()?; - sleep![1]; - } - - v.destroy(); - bg_plane.destroy()?; - nc.stop()?; - Ok(()) -} diff --git a/rust/examples/pixel-cell.rs b/rust/examples/pixel-cell.rs deleted file mode 100644 index 2bcb1c4b4..000000000 --- a/rust/examples/pixel-cell.rs +++ /dev/null @@ -1,107 +0,0 @@ -//! pixel-cell example -//! -//! Shows how to get the size of a cell in pixels -//! -//! It works on the following terminals: -//! - kitty -//! - xterm (invoked with `xterm -ti vt340`) -//! - alacritty (WIP: https://github.com/ayosec/alacritty/tree/graphics) - -use rand::{distributions::Uniform, Rng}; - -use libnotcurses_sys::*; - -fn main() -> NcResult<()> { - let mut nc = Nc::new()?; - - if nc.check_pixel_support() == NCPIXEL_NONE { - nc.stop()?; - return Err(NcError::new_msg("Current terminal doesn't support pixels.")); - } - - let mut stdplane = nc.stdplane(); - let pg = stdplane.pixelgeom(); - - // print visual delimiters around our pixelized cell - println!("0▗│▖\n│─ ─\n2▝│▘"); - println!("a cell is {}x{} pixels", pg.cell_y, pg.cell_x); - println!("\ninterpolated not-interpolated not-interpolated interpolated"); - println!(" SCALE SCALE RESIZE RESIZE"); - - // fill the buffer with random color pixels - let mut rng = rand::thread_rng(); - let range = Uniform::from(50..=180); - let mut buffer = Vec::::with_capacity((pg.cell_y * pg.cell_x * 4) as usize); - #[allow(unused_parens)] - for _byte in (0..={ pg.cell_y * pg.cell_x }) { - buffer.push(rng.sample(&range)); - buffer.push(rng.sample(&range)); - buffer.push(rng.sample(&range)); - buffer.push(255); - } - - // show the newly created ncvisual delimited with the box drawing characters - let v1 = NcVisual::from_rgba(buffer.as_slice(), pg.cell_y, pg.cell_x * 4, pg.cell_x)?; - let voptions = - NcVisualOptions::without_plane(1, 2, 0, 0, pg.cell_y, pg.cell_x, NCBLIT_PIXEL, 0, 0); - v1.render(&mut nc, &voptions)?; - nrs![&mut nc, 1]; - - // show the ncvisual, scaled with interpolated values - let mut vplane2 = NcPlane::new_bound(&mut stdplane, 7, 4, 5, 4)?; - let voptions2 = NcVisualOptions::with_plane( - &mut vplane2, - NCSCALE_SCALE, - 0, - 0, - 0, - 0, - pg.cell_y, - pg.cell_x, - NCBLIT_PIXEL, - 0, - 0, - ); - v1.render(&mut nc, &voptions2)?; - nrs![&mut nc, 0, 250]; - - // show the ncvisual, scaled without using interpolation - let mut vplane3 = NcPlane::new_bound(&mut stdplane, 7, 19, 5, 4)?; - let voptions3 = NcVisualOptions::with_plane( - &mut vplane3, - NCSCALE_SCALE, - 0, - 0, - 0, - 0, - pg.cell_y, - pg.cell_x, - NCBLIT_PIXEL, - NCVISUAL_OPTION_NOINTERPOLATE, - 0, - ); - v1.render(&mut nc, &voptions3)?; - nrs![&mut nc, 0, 250]; - - // resize the ncvisual (doesn't use interpolation) - let voptions4 = - NcVisualOptions::without_plane(7, 39, 0, 0, pg.cell_y, pg.cell_x, NCBLIT_PIXEL, 0, 0); - v1.resize_noninterpolative(pg.cell_y * 4, pg.cell_x * 4)?; - v1.render(&mut nc, &voptions4)?; - nrs![&mut nc, 0, 250]; - - // resize the ncvisual (uses interpolation) - let v5 = NcVisual::from_rgba(buffer.as_slice(), pg.cell_y, pg.cell_x * 4, pg.cell_x)?; - let voptions5 = - NcVisualOptions::without_plane(7, 56, 0, 0, pg.cell_y, pg.cell_x, NCBLIT_PIXEL, 0, 0); - v5.resize(pg.cell_y * 4, pg.cell_x * 4)?; - v5.render(&mut nc, &voptions5)?; - nrs![&mut nc, 0, 250]; - - sleep![2]; - - v1.destroy(); - v5.destroy(); - nc.stop()?; - Ok(()) -} diff --git a/rust/examples/poc-cjkscroll.rs b/rust/examples/poc-cjkscroll.rs deleted file mode 100644 index b89ee2f8d..000000000 --- a/rust/examples/poc-cjkscroll.rs +++ /dev/null @@ -1,25 +0,0 @@ -//! based on the proof of concept at ../../src/poc/cjkscroll.c - -use libnotcurses_sys::*; - -fn main() -> NcResult<()> { - let mut nc = Nc::new()?; - - let plane = nc.stdplane(); - plane.set_scrolling(true); - - let mut wc = '\u{4e00}'; // 一 - - loop { - plane.putchar(wc)?; - wc = core::char::from_u32(wc as u32 + 1).expect("invalid char"); - - // 龣 - if wc == '\u{9fa5}' { - wc = '\u{4e00}'; - } - nrs![&mut nc, 0, 0, 30]; - } - - // nc.stop()?; -} diff --git a/rust/examples/poc-direct.rs b/rust/examples/poc-direct.rs deleted file mode 100644 index 2d1a51f49..000000000 --- a/rust/examples/poc-direct.rs +++ /dev/null @@ -1,62 +0,0 @@ -//! based on the proof of concept at ../../src/poc/direct.c - -use core::convert::TryInto; -use libnotcurses_sys::*; - -fn main() -> NcResult<()> { - let dm = NcDirect::new()?; - - let dimy = dm.dim_y() as i32; - let dimx = dm.dim_x() as i32; - for _ in 0..dimy { - for _ in 0..dimx { - printf!("X"); - } - } - dm.flush()?; - - dm.set_fg_rgb(0xff8080)?; - printf!(" erp erp \n"); - dm.set_fg_rgb(0x80ff80)?; - printf!(" erp erp \n"); - dm.set_fg_rgb(0xff8080)?; - printf!(" erp erp \n"); - dm.cursor_right(dimx / 2)?; - dm.cursor_up(dimy / 2)?; - printf!(" erperperp! \n"); - - let (mut y, x); - - if let Ok((_y, _x)) = dm.cursor_yx() { - y = _y; - x = _x; - printf!("\n\tRead cursor position: y: %d x: %d\n", y, x); - - y += 2; - while y > 3 { - let up = if y >= 3 { 3 } else { y }; - dm.cursor_up(up.try_into().unwrap_or(0))?; - dm.flush()?; - y -= up; - - let newy; - if let Ok((_y, _)) = dm.cursor_yx() { - newy = _y; - } else { - break; - } - - if newy != y { - eprintln!("Expected {}, got {}", y, newy); - break; - } - printf!("\n\tRead cursor position: y: %d x: %d\n", newy, x); - y += 2; - } - } else { - return Err(NcError::with_msg(-10, "Couldn't read cursor position.")); - } - - dm.stop()?; - Ok(()) -} diff --git a/rust/examples/poc-kittyzapper.rs b/rust/examples/poc-kittyzapper.rs deleted file mode 100644 index c899189b3..000000000 --- a/rust/examples/poc-kittyzapper.rs +++ /dev/null @@ -1,24 +0,0 @@ -//! based on the proof of concept at ../../src/poc/kittyzapper.c - -use libnotcurses_sys::*; - -fn main() -> NcResult<()> { - let dm = NcDirect::new()?; - - dm.set_fg_rgb8(100, 100, 100)?; - dm.set_bg_rgb8(0xff, 0xff, 0xff)?; - printf!("a"); - dm.set_bg_rgb8(0, 0, 0)?; - printf!("b"); - printf!(" "); - printf!(" "); - dm.set_bg_rgb8(0, 0, 1)?; - printf!("c"); - printf!(" "); - printf!(" "); - dm.set_bg_rgb8(0xff, 0xff, 0xff)?; - printf!("d"); - printf!("\n"); - - Ok(()) -} diff --git a/rust/examples/poc-menu.rs b/rust/examples/poc-menu.rs deleted file mode 100644 index d5fc55880..000000000 --- a/rust/examples/poc-menu.rs +++ /dev/null @@ -1,137 +0,0 @@ -//! based on the proof of concept at ../../src/poc/menu.c - -// FIXME: has bugs, doesn't work well -// probably related to the arrays or the strings... - -use libnotcurses_sys::*; -use widgets::*; - -fn main() -> NcResult<()> { - let mut nc = Nc::new()?; - nc.mouse_enable()?; - - let mut demo_items = [ - NcMenuItem::new("Restart", NcInput::with_ctrl('r')), - NcMenuItem::new("Disabled", NcInput::with_ctrl('d')), - ]; - let mut file_items = [ - NcMenuItem::new("New", NcInput::with_ctrl('n')), - NcMenuItem::new("Open", NcInput::with_ctrl('o')), - NcMenuItem::new("Close", NcInput::with_ctrl('c')), - NcMenuItem::new_empty(), - NcMenuItem::new("Quit", NcInput::with_ctrl('q')), - ]; - - let mut help_items = [NcMenuItem::new("About", NcInput::with_ctrl('a'))]; - - let mut sections = [ - NcMenuSection::new("Schwarzgerät", &mut demo_items, NcInput::with_alt('ä')), - NcMenuSection::new("File", &mut file_items, NcInput::with_alt('f')), - NcMenuSection::new_separator(), - // DEBUG: remove alt modifier for now. - NcMenuSection::new("Help", &mut help_items, NcInput::new('h')), - ]; - - let mut mopts = NcMenuOptions::new(&mut sections); - mopts.header_channels_mut().set_fg_rgb(0x00ff00); - mopts.header_channels_mut().set_bg_rgb(0x440000); - mopts.section_channels_mut().set_fg_rgb(0xb0d700); - mopts.section_channels_mut().set_bg_rgb(0x002000); - - let stdplane = nc.stdplane(); - let (dim_y, _dim_x) = stdplane.dim_yx(); - - let menu_top = NcMenu::new(stdplane, mopts)?; - menu_top.item_set_status("Schwarzgerät", "Disabled", false)?; - menu_top.item_set_status("Schwarzgerät", "Restart", false)?; - - stdplane.set_base("x", 0, NcChannels::from_rgb(0x88aa00, 0x000088))?; - - nc.render()?; - - stdplane.set_fg_rgb(0x00dddd); - stdplane.putstr_aligned( - dim_y - 1, - NCALIGN_RIGHT, - " -=+ menu poc. press q to exit +=-", - )?; - - run_menu(&mut nc, menu_top)?; - - stdplane.erase(); // is this needed? - - // BUG FIXME: this doesn't show over the menu (at row 0) - stdplane.putstr_aligned(0, NCALIGN_RIGHT, " -=+ menu poc. press q to exit +=-")?; - stdplane.putstr_aligned(1, NCALIGN_CENTER, " -=+ menu poc. press q to exit +=-")?; - stdplane.putstr_aligned(2, NCALIGN_LEFT, " -=+ menu poc. press q to exit +=-")?; - - mopts.flags |= NCMENU_OPTION_BOTTOM; - let menu_bottom = NcMenu::new(stdplane, mopts)?; - - run_menu(&mut nc, menu_bottom)?; - - Ok(()) -} - -fn run_menu(nc: &mut Nc, menu: &mut NcMenu) -> NcResult<()> { - // yellow rectangle - let planeopts = NcPlaneOptions::new_aligned(10, NCALIGN_CENTER, 3, 40); - let stdplane = nc.stdplane(); - let selplane = NcPlane::with_options_bound(stdplane, planeopts)?; - selplane.set_fg_rgb(0); - selplane.set_bg_rgb(0xdddddd); - let mut channels = 0; - channels.set_fg_rgb(0x000088); - channels.set_bg_rgb(0x88aa00); - selplane.set_base(" ", 0, channels)?; - - let mut ni = NcInput::new_empty(); - let mut keypress: char; - nc.render()?; - - loop { - stdplane.erase(); - selplane.erase(); - - keypress = nc.getc_blocking(Some(&mut ni))?; - - // DEBUG - stdplane.putstr_yx(2, 0, &format!["{:?}", ni])?; - nc.render()?; - - // BUG FIXME: always returns false: - if !menu.offer_input(ni) { - match keypress { - 'q' => { - menu.destroy()?; - selplane.destroy()?; - nc.stop()?; - return Ok(()); - } - NCKEY_ENTER => { - if let Some(selection) = menu.selected(Some(&mut ni)) { - match selection.as_ref() { - "Quit" => { - menu.destroy()?; - selplane.destroy()?; - nc.stop()?; - return Ok(()); - } - _ => (), - } - } - } - _ => (), - } - } - - let mut selni = NcInput::new_empty(); - if let Some(selitem) = menu.selected(Some(&mut selni)) { - selplane.putstr_aligned(1, NCALIGN_CENTER, &selitem)?; - } else { - // DEBUG - selplane.putstr_aligned(1, NCALIGN_CENTER, "nothing opened")?; - } - nc.render()?; - } -} diff --git a/rust/src/bindings.rs b/rust/src/bindings.rs deleted file mode 100644 index da87d6a8f..000000000 --- a/rust/src/bindings.rs +++ /dev/null @@ -1,850 +0,0 @@ -//! A selection of the [ffi] bindings intended to be used directly. -//! -//! The full list of bindings is under the [ffi] submodule. -//! -//! The current module publicly re-exports bindgen generated structs, functions, -//! and constants, for their direct usage. - -// BUG ISSUES: -// https://github.com/rust-lang/rust-bindgen/issues/1470 -#[allow(clippy::all)] -// https://github.com/rust-lang/rust-bindgen/issues/1651 -#[allow(unknown_lints, deref_nullptr)] -pub mod ffi { - //! Rust FFI bindings, automatically generated with bindgen. - //! - //! Almost all of the notcurses API functions are reexported to the public - //! API, while structs, enums and constants are type aliased or wrapped up. - //! - include!(concat!(env!("OUT_DIR"), "/bindings.rs")); -} - -// Miscellaneous --------------------------------------------------------------- - -#[rustfmt::skip] -#[doc(inline)] -pub use ffi::{ - // functions - ncstrwidth, -}; - -// blitset --------------------------------------------------------------------- -// -// already wrapped: -// -// // structs -// blitset, - -// cell ------------------------------------------------------------------------ -// -// already wrapped: -// -// // structs -// cell, -// -// // constants -// NCALPHA_BLEND, -// NCALPHA_HIGHCONTRAST, -// NCALPHA_OPAQUE, -// NCALPHA_TRANSPARENT, -// NC_BGDEFAULT_MASK, -// NC_BG_ALPHA_MASK, -// NC_BG_PALETTE, -// NC_BG_RGB_MASK, -// NC_FGDEFAULT_MASK, -// NC_FG_ALPHA_MASK, -// NC_FG_PALETTE, -// NC_FG_RGB_MASK, - -#[doc(inline)] -pub use ffi::{ - // functions - nccell_duplicate, - nccell_extended_gcluster, - nccell_load, - nccell_release, - nccells_double_box, - nccells_rounded_box, -}; - -// channel --------------------------------------------------------------------- -// -// already wrapped: -// -// // constants -// CHANNEL_ALPHA_MASK, - -// ncalign --------------------------------------------------------------------- -// -// already wrapped: -// -// // type definitions -// ncalign_e, -// -// // constants -// ncalign_e_NCALIGN_CENTER, -// ncalign_e_NCALIGN_LEFT, -// ncalign_e_NCALIGN_RIGHT, -// ncalign_e_NCALIGN_UNALIGNED, - -// ncblitter ------------------------------------------------------------------- -// -// already wrapped: -// -// // type definitions -// ncblitter_e, -// -// // constants -// ncblitter_e_NCBLIT_1x1, -// ncblitter_e_NCBLIT_2x1, -// ncblitter_e_NCBLIT_2x2, -// ncblitter_e_NCBLIT_3x2, -// ncblitter_e_NCBLIT_4x1, -// ncblitter_e_NCBLIT_8x1, -// ncblitter_e_NCBLIT_BRAILLE, -// ncblitter_e_NCBLIT_DEFAULT, -// ncblitter_e_NCBLIT_PIXEL, - -#[doc(inline)] -pub use ffi::{ - ncblit_bgrx, - ncblit_rgb_loose, - ncblit_rgb_packed, - // functions - ncblit_rgba, -}; - -// ncbox ----------------------------------------------------------------------- - -// // constants -// NCBOXCORNER_MASK, -// NCBOXCORNER_SHIFT, -// NCBOXGRAD_BOTTOM, -// NCBOXGRAD_LEFT, -// NCBOXGRAD_RIGHT, -// NCBOXGRAD_TOP, -// NCBOXMASK_BOTTOM, -// NCBOXMASK_LEFT, -// NCBOXMASK_RIGHT, -// NCBOXMASK_TOP, - -// nccapabilit* ---------------------------------------------------------------- -// -// already wrapped: -// -// // structs -// nccapabilities, -// -// // functions -// nccapability_canchangecolor, - -// ncdirect -------------------------------------------------------------------- -// -// already wrapped: -// -// // structs -// ncdirect, -// -// // functions -// ncdirect_canbraille, -// ncdirect_canopen_videos -// ncdirect_canchangecolor, -// ncdirect_canfade, -// ncdirect_canhalfblock, -// ncdirect_canquadrant, -// ncdirect_cantruecolor, -// ncdirect_capabilities, -// ncdirect_hline_interp, -// ncdirect_vline_interp, -// -// // constants -// NCDIRECT_OPTION_INHIBIT_CBREAK, -// NCDIRECT_OPTION_INHIBIT_SETLOCALE, -// NCDIRECT_OPTION_NO_QUIT_SIGHANDLERS, -// NCDIRECT_OPTION_VERBOSE -// NCDIRECT_OPTION_VERY_VERBOSE - -#[doc(inline)] -pub use ffi::{ - // functions - ncdirect_box, - ncdirect_canget_cursor, - ncdirect_canopen_images, - ncdirect_canutf8, - ncdirect_check_pixel_support, - ncdirect_clear, - ncdirect_core_init, - ncdirect_cursor_disable, - ncdirect_cursor_down, - ncdirect_cursor_enable, - ncdirect_cursor_left, - ncdirect_cursor_move_yx, - ncdirect_cursor_pop, - ncdirect_cursor_push, - ncdirect_cursor_right, - ncdirect_cursor_up, - ncdirect_cursor_yx, - ncdirect_detected_terminal, - ncdirect_dim_x, - ncdirect_dim_y, - ncdirect_double_box, - ncdirect_flush, - ncdirect_get, - ncdirect_init, - ncdirect_inputready_fd, - ncdirect_off_styles, - ncdirect_on_styles, - ncdirect_palette_size, - //W ncdirect_printf_aligned, - ncdirect_putstr, - ncdirect_raster_frame, - ncdirect_readline, - ncdirect_render_frame, - ncdirect_render_image, - ncdirect_rounded_box, - ncdirect_set_bg_default, - ncdirect_set_bg_palindex, - ncdirect_set_bg_rgb, - ncdirect_set_fg_default, - ncdirect_set_fg_palindex, - ncdirect_set_fg_rgb, - ncdirect_set_styles, - ncdirect_stop, - ncdirect_stream, - ncdirect_styles, - ncdirect_supported_styles, -}; - -// ncdirectf -------------------------------------------------------------------- -// -// already wrapped: -// -// // type alias -// ncdirectf, -// - -#[doc(inline)] -pub use ffi::{ - ncdirectf_free, - // functions - ncdirectf_from_file, - ncdirectf_geom, - ncdirectf_render, -}; - -// ncfadectx ------------------------------------------------------------------- -// -// already wrapped: -// -// // structs -// ncfadectx, - -#[doc(inline)] -pub use ffi::{ - // functions - ncfadectx_free, - ncfadectx_iterations, - ncfadectx_setup, -}; - -// ncinput --------------------------------------------------------------------- -// -// already wrapped: -// -// // structs -// ncinput, - -// ncloglevel ------------------------------------------------------------------ -// -// already wrapped: -// -// // type definitions -// ncloglevel_e, -// -// // constants -// ncloglevel_e_NCLOGLEVEL_DEBUG, -// ncloglevel_e_NCLOGLEVEL_ERROR, -// ncloglevel_e_NCLOGLEVEL_FATAL, -// ncloglevel_e_NCLOGLEVEL_INFO, -// ncloglevel_e_NCLOGLEVEL_PANIC, -// ncloglevel_e_NCLOGLEVEL_SILENT, -// ncloglevel_e_NCLOGLEVEL_TRACE, -// ncloglevel_e_NCLOGLEVEL_VERBOSE, -// ncloglevel_e_NCLOGLEVEL_WARNING, - -// ncfdplane ------------------------------------------------------------------- -// -// already wrapped: -// -// // structs -// ncfdplane, -// ncfdplane_options, - -#[doc(inline)] -pub use ffi::{ - // functions - ncfdplane_create, - ncfdplane_destroy, - ncfdplane_plane, -}; - -// ncmenu ---------------------------------------------------------------------- -// -// already wrapped: -// -// // structs -// ncmenu, -// ncmenu_item, -// ncmenu_options, -// ncmenu_section, -// -// // constants -// NCMENU_OPTION_BOTTOM, -// NCMENU_OPTION_HIDING, - -#[doc(inline)] -pub use ffi::{ - // functions - ncmenu_create, - ncmenu_destroy, - ncmenu_item_set_status, - ncmenu_mouse_selected, - ncmenu_nextitem, - ncmenu_nextsection, - ncmenu_offer_input, - ncmenu_plane, - ncmenu_previtem, - ncmenu_prevsection, - ncmenu_rollup, - ncmenu_selected, - ncmenu_unroll, -}; - -// ncmetric -------------------------------------------------------------------- -// -// already wrapped: -// -// // functions -// ncmetric -// -// // constants -// PREFIXCOLUMNS, -// PREFIXSTRLEN, -// BPREFIXCOLUMNS, -// BPREFIXSTRLEN, -// IPREFIXCOLUMNS, -// IPREFIXSTRLEN, - -// ncmultiselector ------------------------------------------------------------- -// -// already wrapped: -// -// // structs -// ncmultiselector, -// ncmselector_item, -// ncmultiselector_options, - -#[doc(inline)] -pub use ffi::{ - // functions - ncmultiselector_create, - ncmultiselector_destroy, - ncmultiselector_offer_input, - ncmultiselector_plane, - ncmultiselector_selected, -}; - -// ncpile ---------------------------------------------------------------------- - -#[doc(inline)] -pub use ffi::{ - // functions - ncpile_bottom, - ncpile_create, - ncpile_rasterize, - ncpile_render, - ncpile_top, -}; - -// ncplane --------------------------------------------------------------------- -// -// already wrapped: -// -// // structs -// ncplane, -// ncplane_options, -// -// // functions -// ncplane_channels, -// ncplane_gradient, -// ncplane_set_bchannel, -// ncplane_set_fchannel, -// ncplane_set_channels, -// -// // constants -// NCPLANE_OPTION_HORALIGNED, -// NCPLANE_OPTION_MARGINALIZED, -// NCPLANE_OPTION_VERALIGNED, -// -// // type alias -// ncdirectv, - -#[doc(inline)] -pub use ffi::{ - // functions - ncplane_above, - ncplane_abs_x, - ncplane_abs_y, - ncplane_abs_yx, - ncplane_as_rgba, - ncplane_at_cursor, - ncplane_at_cursor_cell, - ncplane_at_yx, - ncplane_at_yx_cell, - ncplane_base, - ncplane_below, - ncplane_box, - ncplane_center_abs, - ncplane_contents, - ncplane_create, - ncplane_cursor_move_yx, - ncplane_cursor_yx, - ncplane_destroy, - ncplane_dim_yx, - ncplane_dup, - ncplane_erase, - ncplane_erase_region, - ncplane_fadein, - ncplane_fadein_iteration, - ncplane_fadeout, - ncplane_fadeout_iteration, - ncplane_format, - ncplane_greyscale, - ncplane_highgradient, - ncplane_highgradient_sized, - ncplane_hline_interp, - ncplane_home, - ncplane_mergedown, - ncplane_mergedown_simple, - ncplane_move_above, - ncplane_move_below, - ncplane_move_bottom, - ncplane_move_top, - ncplane_move_yx, - ncplane_notcurses, - ncplane_notcurses_const, - ncplane_off_styles, - ncplane_on_styles, - ncplane_parent, - ncplane_parent_const, - ncplane_pixelgeom, - ncplane_polyfill_yx, - ncplane_pulse, - ncplane_putc_yx, - ncplane_putchar_stained, - ncplane_putegc_stained, - ncplane_putegc_yx, - ncplane_putnstr_aligned, - ncplane_putnstr_yx, - ncplane_putstr_aligned, - ncplane_putstr_stained, - ncplane_putstr_yx, - ncplane_puttext, - ncplane_putwegc_stained, - ncplane_putwstr_stained, - ncplane_qrcode, - ncplane_reparent, - ncplane_reparent_family, - ncplane_resize, - ncplane_resize_marginalized, - ncplane_resize_maximize, - ncplane_resize_realign, - ncplane_resizecb, - ncplane_rotate_ccw, - ncplane_rotate_cw, - ncplane_scrolling_p, - ncplane_set_base, - ncplane_set_base_cell, - ncplane_set_bg_alpha, - ncplane_set_bg_default, - ncplane_set_bg_palindex, - ncplane_set_bg_rgb, - ncplane_set_bg_rgb8, - ncplane_set_bg_rgb8_clipped, - ncplane_set_fg_alpha, - ncplane_set_fg_default, - ncplane_set_fg_palindex, - ncplane_set_fg_rgb, - ncplane_set_fg_rgb8, - ncplane_set_fg_rgb8_clipped, - ncplane_set_resizecb, - ncplane_set_scrolling, - ncplane_set_styles, - ncplane_set_userptr, - ncplane_stain, - ncplane_styles, - ncplane_styles_off, - ncplane_styles_on, - ncplane_styles_set, - ncplane_translate, - ncplane_translate_abs, - ncplane_userptr, - ncplane_vline_interp, - ncplane_vprintf_aligned, - ncplane_vprintf_stained, - ncplane_vprintf_yx, - ncplane_x, - ncplane_y, - ncplane_yx, -}; - -// ncplot ---------------------------------------------------------------------- -// -// already wrapped: -// -// // structs -// ncdplot, // f64 -// ncuplot, // u64 -// ncplot_options, -// -// // constants -// NCPLOT_OPTION_DETECTMAXONLY, -// NCPLOT_OPTION_EXPONENTIALD, -// NCPLOT_OPTION_LABELTICKSD, -// NCPLOT_OPTION_NODEGRADE, -// NCPLOT_OPTION_VERTICALI, - -#[doc(inline)] -pub use ffi::{ - // functions - ncdplot_add_sample, - ncdplot_create, - ncdplot_destroy, - ncdplot_plane, - ncdplot_sample, - ncdplot_set_sample, - - ncuplot_add_sample, - ncuplot_create, - ncuplot_destroy, - ncuplot_plane, - ncuplot_sample, - ncuplot_set_sample, -}; - -// ncreader -------------------------------------------------------------------- -// -// already wrapped: -// -// // structs -// ncreader, -// ncreader_options, -// -// // constants -// NCREADER_OPTION_CURSOR, -// NCREADER_OPTION_HORSCROLL, -// NCREADER_OPTION_NOCMDKEYS, -// NCREADER_OPTION_VERSCROLL, - -#[doc(inline)] -pub use ffi::{ - // functions - ncreader_clear, - ncreader_contents, - ncreader_create, - ncreader_destroy, - ncreader_move_down, - ncreader_move_left, - ncreader_move_right, - ncreader_move_up, - ncreader_offer_input, - ncreader_plane, - ncreader_write_egc, -}; - -// ncprogbar ------------------------------------------------------------------- -// -// already wrapped: -// -// // structs -// ncprogbar, -// ncprogbar_options, -// -// // constants -// NCPROGBAR_OPTION_RETROGRADE, - -#[doc(inline)] -pub use ffi::{ - // functions - ncprogbar_create, - ncprogbar_destroy, - ncprogbar_plane, - ncprogbar_progress, - ncprogbar_set_progress, -}; - -// ncreel ---------------------------------------------------------------------- -// -// already wrapped: -// -// // structs -// ncreel, -// ncreel_options, -// -// // constants -// NCREEL_OPTION_CIRCULAR, -// NCREEL_OPTION_INFINITESCROLL, - -#[doc(inline)] -pub use ffi::{ - // functions - ncreel_add, - ncreel_create, - ncreel_del, - ncreel_destroy, - ncreel_focused, - ncreel_next, - ncreel_offer_input, - ncreel_plane, - ncreel_prev, - ncreel_redraw, - ncreel_tabletcount, -}; - -// ncscale --------------------------------------------------------------------- -// -// already wrapped: -// -// // type definitions -// ncscale_e, -// -// // constants -// ncscale_e_NCSCALE_NONE, -// ncscale_e_NCSCALE_SCALE, -// ncscale_e_NCSCALE_STRETCH, -// ncscale_e_NCSCALE_NONE_HIRES, -// ncscale_e_NCSCALE_SCALE_HIRES, - -// ncselector ------------------------------------------------------------------ -// -// already wrapped: -// -// // structs -// ncselector, -// ncselector_item, -// ncselector_options, - -#[doc(inline)] -pub use ffi::{ - // functions - ncselector_additem, - ncselector_create, - ncselector_delitem, - ncselector_destroy, - ncselector_nextitem, - ncselector_offer_input, - ncselector_plane, - ncselector_previtem, - ncselector_selected, -}; - -// ncstats --------------------------------------------------------------------- -// -// already wrapped: -// -// // structs -// ncstats, - -// ncstyle --------------------------------------------------------------------- -// -// already wrapped: -// -// // constants -// NCSTYLE_MASK, -// NCSTYLE_ITALIC, -// NCSTYLE_UNDERLINE, -// NCSTYLE_UNDERCURL, -// NCSTYLE_BOLD, -// NCSTYLE_STRUCK, -// NCSTYLE_NONE, - -// nctablet -------------------------------------------------------------------- -// -// already wrapped: -// -// // structs -// nctablet, - -#[doc(inline)] -pub use ffi::{ - // functions - nctablet_plane, - nctablet_userptr, -}; - -// nctree ---------------------------------------------------------------------- -// -// // structs -// nctree, -// nctree_item, -// nctree_options, -// -#[doc(inline)] -pub use ffi::{ - // functions - nctree_create, - nctree_destroy, - nctree_focused, - nctree_goto, - nctree_next, - nctree_offer_input, - nctree_plane, - nctree_prev, - nctree_redraw, -}; - -// ncvgeom --------------------------------------------------------------------- -// -// already wrapped: -// -// // structs -// ncvgeom - -// ncvisual -------------------------------------------------------------------- -// -// already wrapped: -// -// // structs -// ncvisual, -// ncvisual_options, -// -// // constants -// NCVISUAL_OPTION_ADDALPHA, -// NCVISUAL_OPTION_BLEND, -// NCVISUAL_OPTION_CHILDPLANE -// NCVISUAL_OPTION_HORALIGNED -// NCVISUAL_OPTION_NODEGRADE, -// NCVISUAL_OPTION_NOINTERPOLATE -// NCVISUAL_OPTION_VERALIGNED, - -#[doc(inline)] -pub use ffi::{ - // functions - ncvisual_at_yx, - ncvisual_blitter_geom, - ncvisual_decode, - ncvisual_decode_loop, - ncvisual_destroy, - ncvisual_from_bgra, - ncvisual_from_file, - ncvisual_from_plane, - ncvisual_from_rgb_loose, - ncvisual_from_rgb_packed, - ncvisual_from_rgba, - ncvisual_media_defblitter, - ncvisual_polyfill_yx, - ncvisual_render, - ncvisual_resize, - ncvisual_resize_noninterpolative, - ncvisual_rotate, - ncvisual_set_yx, - ncvisual_simple_streamer, - ncvisual_stream, - ncvisual_subtitle, -}; - -// notcurses ------------------------------------------------------------------- -// -// already wrapped: -// -// // structs -// notcurses, -// notcurses_options, -// -// // constants -// NCOPTION_INHIBIT_SETLOCALE, -// NCOPTION_NO_ALTERNATE_SCREEN, -// NCOPTION_NO_CLEAR_BITMAPS -// NCOPTION_NO_FONT_CHANGES, -// NCOPTION_NO_QUIT_SIGHANDLERS, -// NCOPTION_NO_WINCH_SIGHANDLER, -// NCOPTION_PRESERVE_CURSOR, -// NCOPTION_SUPPRESS_BANNERS, - -#[doc(inline)] -pub use ffi::{ - // functions - notcurses_at_yx, - notcurses_bottom, - notcurses_canbraille, - notcurses_canchangecolor, - notcurses_canfade, - notcurses_canhalfblock, - notcurses_canopen_images, - notcurses_canopen_videos, - notcurses_canquadrant, - notcurses_cansextant, - notcurses_cantruecolor, - notcurses_canutf8, - notcurses_check_pixel_support, - notcurses_core_init, - notcurses_cursor_disable, - notcurses_cursor_enable, - notcurses_cursor_yx, - notcurses_debug, - notcurses_detected_terminal, - notcurses_drop_planes, - notcurses_get, - notcurses_init, - notcurses_inputready_fd, - notcurses_lex_blitter, - notcurses_lex_margins, - notcurses_lex_scalemode, - notcurses_linesigs_disable, - notcurses_linesigs_enable, - notcurses_mouse_disable, - notcurses_mouse_enable, - notcurses_palette_size, - notcurses_refresh, - notcurses_render, - notcurses_render_to_buffer, - notcurses_render_to_file, - notcurses_stats, - notcurses_stats_alloc, - notcurses_stats_reset, - notcurses_stdplane, - notcurses_stdplane_const, - notcurses_stop, - notcurses_str_blitter, - notcurses_str_scalemode, - notcurses_supported_styles, - notcurses_top, - notcurses_ucs32_to_utf8, - notcurses_version, - notcurses_version_components, -}; - -// palette --------------------------------------------------------------------- -// -// already wrapped: -// -// // structs -// ncpalette, - -#[doc(inline)] -pub use ffi::{ - // functions - ncpalette_free, - ncpalette_new, - ncpalette_use, - - // constants - NCPALETTESIZE, -}; - -// fade callback --------------------------------------------------------------- -// -// already wrapped: -// -// // types -// fadecb, diff --git a/rust/src/box.rs b/rust/src/box.rs deleted file mode 100644 index fa36f56b6..000000000 --- a/rust/src/box.rs +++ /dev/null @@ -1,75 +0,0 @@ -//! `NcBoxMask` - -/// Controls the drawing of borders, gradients and corners. -/// -/// NcBoxMax is defined in the least significant byte, where bits [3, 0] are -/// are a border mask, and bits [7, 4] are a gradient mask. -/// -/// The drawing of the corners is defined in the second byte, -/// see [`NCBOXCORNER_MASK`]. -/// -/// ## Diagram -/// -/// ```txt -/// NCBOXMASK_TOP 0x0001 0b00000001 -/// NCBOXMASK_RIGHT 0x0002 0b00000010 -/// NCBOXMASK_BOTTOM 0x0004 0b00000100 -/// NCBOXMASK_LEFT 0x0008 0b00001000 -/// -/// NCBOXGRAD_TOP 0x0010 0b00010000 -/// NCBOXGRAD_RIGHT 0x0020 0b00100000 -/// NCBOXGRAD_BOTTOM 0x0040 0b01000000 -/// NCBOXGRAD_LEFT 0x0080 0b10000000 -/// -/// NCBOXCORNER_MASK 0x0300 0b00000111_00000000 -/// -/// NCBOXCORNER_SHIFT 8 -/// ``` -/// -/// ## Bit masks -/// -/// - [NCBOXMASK_TOP] -/// - [NCBOXMASK_RIGHT] -/// - [NCBOXMASK_BOTTOM] -/// - [NCBOXMASK_LEFT] -/// -/// - [NCBOXGRAD_TOP] -/// - [NCBOXGRAD_RIGHT] -/// - [NCBOXGRAD_BOTTOM] -/// - [NCBOXGRAD_LEFT] -/// -/// - [NCBOXCORNER_MASK] -/// - [NCBOXCORNER_SHIFT] -/// -pub type NcBoxMask = u32; - -/// [NcBoxMask] top gradient mask. -pub const NCBOXGRAD_TOP: NcBoxMask = crate::bindings::ffi::NCBOXGRAD_TOP; -/// [NcBoxMask] right gradient mask. -pub const NCBOXGRAD_RIGHT: NcBoxMask = crate::bindings::ffi::NCBOXGRAD_RIGHT; -/// [NcBoxMask] bottom gradient mask. -pub const NCBOXGRAD_BOTTOM: NcBoxMask = crate::bindings::ffi::NCBOXGRAD_BOTTOM; -/// [NcBoxMask] left gradient mask. -pub const NCBOXGRAD_LEFT: NcBoxMask = crate::bindings::ffi::NCBOXGRAD_LEFT; - -/// [NcBoxMask] top border mask. -pub const NCBOXMASK_TOP: NcBoxMask = crate::bindings::ffi::NCBOXMASK_TOP; -/// [NcBoxMask] right border mask. -pub const NCBOXMASK_RIGHT: NcBoxMask = crate::bindings::ffi::NCBOXMASK_RIGHT; -/// [NcBoxMask] bottom border mask. -pub const NCBOXMASK_BOTTOM: NcBoxMask = crate::bindings::ffi::NCBOXMASK_BOTTOM; -/// [NcBoxMask] left border mask. -pub const NCBOXMASK_LEFT: NcBoxMask = crate::bindings::ffi::NCBOXMASK_LEFT; - -/// [NcBoxMask] corner mask to control the drawing of boxes corners. -/// -/// By default, vertexes are drawn whether their connecting edges are drawn -/// or not. The value of the bits control this, and are interpreted as the -/// number of connecting edges necessary to draw a given corner. -/// -/// At 0 (the default), corners are always drawn. At 3, corners are never drawn -/// (since at most 2 edges can touch a box's corner). -pub const NCBOXCORNER_MASK: NcBoxMask = crate::bindings::ffi::NCBOXCORNER_MASK; - -/// The number of bits [NCBOXCORNER_MASK] is shifted in [NcBoxMask]. -pub const NCBOXCORNER_SHIFT: NcBoxMask = crate::bindings::ffi::NCBOXCORNER_SHIFT; diff --git a/rust/src/capabilities.rs b/rust/src/capabilities.rs deleted file mode 100644 index 42b107fb0..000000000 --- a/rust/src/capabilities.rs +++ /dev/null @@ -1,26 +0,0 @@ -//! `NcCapabilities` - -use crate::NcPalette; - -use core::mem::size_of; - -/// Capabilities, derived from terminfo, environment variables, and queries. -pub type NcCapabilities = crate::bindings::ffi::nccapabilities; - -/// Can we set the "hardware" palette? -/// -/// Requires the "ccc" terminfo capability, and that the number of colors -/// supported is at least the size of our `NcPalette` structure. -#[inline] -pub fn nccapability_canchangecolor(caps: &NcCapabilities) -> bool { - if !caps.can_change_colors { - return false; - } - // CHECK this does the same as: - // if(caps.colors < sizeof(p->chans) / sizeof(*p->chans)){ - // - if (caps.colors as usize) < size_of::() / size_of::() { - return false; - } - true -} diff --git a/rust/src/cells/methods.rs b/rust/src/cells/methods.rs deleted file mode 100644 index e18c6f6fc..000000000 --- a/rust/src/cells/methods.rs +++ /dev/null @@ -1,471 +0,0 @@ -//! `NcCell` methods and associated functions. - -use crate::{ - cstring, error, nccell_load, NcAlphaBits, NcCell, NcChannels, NcComponent, NcEgcBackstop, - NcPaletteIndex, NcPlane, NcResult, NcRgb, NcStyle, NCRESULT_ERR, -}; - -#[allow(unused_imports)] // for the doc comments -use crate::NcChannel; - -/// # NcCell constructors -impl NcCell { - /// New `NcCell`, expects a 7-bit [`char`]. - #[inline] - #[allow(clippy::unnecessary_cast)] - pub const fn from_char7b(ch: char) -> Self { - NcCell { - gcluster: (ch as u32).to_le(), - gcluster_backstop: 0 as NcEgcBackstop, - width: 0_u8, - stylemask: 0 as NcStyle, - channels: 0 as NcChannels, - } - } - - /// New `NcCell`, expects an [`NcPlane`] and a [`char`]. - #[inline] - pub fn from_char(ch: char, plane: &mut NcPlane) -> Self { - let mut cell = Self::new(); - let result = unsafe { nccell_load(plane, &mut cell, cstring![ch.to_string()]) }; - // TEMP solution for: - // https://github.com/dankamongmen/notcurses/pull/1937/checks?check_run_id=3093152924#step:11:339 - #[cfg(not(target_os = "macos"))] - debug_assert_ne![NCRESULT_ERR, result]; - cell - } - - /// New `NcCell`, expects an [`NcPlane`] and a &[`str`]. - #[inline] - pub fn from_str(plane: &mut NcPlane, string: &str) -> Self { - let mut cell = Self::new(); - let result = unsafe { nccell_load(plane, &mut cell, cstring![string]) }; - debug_assert_ne![NCRESULT_ERR, result]; - cell - } - - /// New empty `NcCell`. - #[inline] - pub const fn new() -> Self { - Self::from_char7b(0 as char) - } - - /// Breaks the UTF-8 string in `egc` down, setting up this `NcCell`, - /// and returns the number of bytes copied out of `egc`. - /// - /// The styling of the cell is left untouched, but any resources are released. - /// *C style function: [nccell_load()][crate::nccell_load].* - pub fn load(plane: &mut NcPlane, cell: &mut NcCell, egc: &str) -> NcResult { - let bytes = unsafe { crate::nccell_load(plane, cell, cstring![egc]) }; - error![ - bytes, - &format!["NcCell.load(NcPlane, NcCell, {:?})", egc], - bytes as u32 - ] - } - - /// Same as [load][NcCell#method.load], plus blasts the styling with - /// `style` and `channels`. - /// - /// - Breaks the UTF-8 string in `gcluster` down, setting up this NcCell. - /// - Returns the number of bytes copied out of `gcluster`. - /// - Any resources are released. - /// - Blasts the styling with `style` and `channels`. - /// - /// *C style function: [nccell_prime()][crate::nccell_prime].* - pub fn prime( - plane: &mut NcPlane, - cell: &mut NcCell, - gcluster: &str, - style: NcStyle, - channels: NcChannels, - ) -> NcResult { - let bytes = crate::nccell_prime(plane, cell, gcluster, style, channels); - error![bytes, "", bytes as u32] - } - - /// Duplicate this `NcCell` into another one. - /// - /// Both must be or will be bound to `common_plane`. - /// - /// *C style function: [nccell_duplicate()][crate::nccell_duplicate].* - pub fn duplicate(&self, target: &mut NcCell, common_plane: &mut NcPlane) -> NcResult<()> { - error![unsafe { crate::nccell_duplicate(common_plane, target, self) }] - } - - /// Initializes (zeroes out) this `NcCell`. - /// - /// *C style function: [nccell_init()][crate::nccell_init].* - #[inline] - pub fn init(&mut self) { - crate::nccell_init(self); - } - - /// Releases resources held by the current cell in the [NcPlane] `plane`. - /// - /// *C style function: [nccell_release()][crate::nccell_release].* - pub fn release(&mut self, plane: &mut NcPlane) { - unsafe { - crate::nccell_release(plane, self); - } - } -} - -// ----------------------------------------------------------------------------- -/// ## NcCell methods: bg|fg `NcChannel`s manipulation. -impl NcCell { - /// Returns the [`NcChannels`] of this `NcCell`. - /// - /// *(No equivalent C style function)* - pub fn channels(&mut self, plane: &mut NcPlane) -> NcChannels { - let (mut _styles, mut channels) = (0, 0); - let _char = crate::nccell_extract(plane, self, &mut _styles, &mut channels); - channels - } - - /// Extracts the background [`NcAlphaBits`] (shifted to LSBs). - /// - /// *C style function: [nccell_bg_alpha()][crate::nccell_bg_alpha].* - pub fn bg_alpha(&self) -> NcAlphaBits { - crate::nccell_bg_alpha(self) - } - - /// Is the background [`NcChannel`] using the "default background color"? - /// - /// *C style function: [nccell_bg_default_p()][crate::nccell_bg_default_p].* - pub fn bg_default_p(&self) -> bool { - crate::nccell_bg_default_p(self) - } - - /// Gets the [`NcPaletteIndex`] of the background [`NcChannel`]. - /// - /// *C style function: [nccell_bg_palindex()][crate::nccell_bg_palindex].* - pub fn bg_palindex(&self) -> NcPaletteIndex { - crate::nccell_bg_palindex(self) - } - - /// Is the background [`NcChannel`] using an [`NcPaletteIndex`] indexed - /// [`NcPalette`][crate::NcPalette] color? - /// - /// *C style function: [nccell_bg_palindex_p()][crate::nccell_bg_palindex_p].* - pub fn bg_palindex_p(&self) -> bool { - crate::nccell_bg_palindex_p(self) - } - - /// Gets the background [`NcRgb`] (shifted to LSBs). - /// - /// *C style function: [nccell_bg_rgb()][crate::nccell_bg_rgb].* - pub fn bg_rgb(&self) -> NcRgb { - crate::nccell_bg_rgb(self) - } - - /// Gets the background RGB [`NcComponent`]s. - /// - /// *C style function: [nccell_bg_rgb8()][crate::nccell_bg_rgb8].* - pub fn bg_rgb8(&self) -> (NcComponent, NcComponent, NcComponent) { - let (mut r, mut g, mut b) = (0, 0, 0); - crate::nccell_bg_rgb8(self, &mut r, &mut g, &mut b); - (r, g, b) - } - - /// Extracts the foreground [`NcAlphaBits`] (shifted to LSBs). - /// - /// *C style function: [nccell_fg_alpha()][crate::nccell_fg_alpha].* - pub fn fg_alpha(&self) -> NcAlphaBits { - crate::nccell_fg_alpha(self) - } - - /// Is the foreground [`NcChannel`] using the "default foreground color"? - /// - /// *C style function: [nccell_fg_default_p()][crate::nccell_fg_default_p].* - pub fn fg_default_p(&self) -> bool { - crate::nccell_fg_default_p(self) - } - - /// Gets the [`NcPaletteIndex`] of the foreground [`NcChannel`]. - /// - /// *C style function: [nccell_fg_palindex()][crate::nccell_fg_palindex].* - pub fn fg_palindex(&self) -> NcPaletteIndex { - crate::nccell_fg_palindex(self) - } - - /// Is the foreground [`NcChannel`] using an [`NcPaletteIndex`] indexed - /// [`NcPalette`][crate::NcPalette] color? - /// - /// *C style function: [nccell_fg_palindex_p()][crate::nccell_fg_palindex_p].* - pub fn fg_palindex_p(&self) -> bool { - crate::nccell_fg_palindex_p(self) - } - - /// Gets the foreground [`NcRgb`] (shifted to LSBs). - /// - /// *C style function: [nccell_fg_rgb()][crate::nccell_fg_rgb].* - pub fn fg_rgb(&self) -> NcRgb { - crate::nccell_fg_rgb(self) - } - - /// Gets the foreground RGB [`NcComponent`]s. - /// - /// *C style function: [nccell_fg_rgb8()][crate::nccell_fg_rgb8].* - pub fn fg_rgb8(&self) -> (NcComponent, NcComponent, NcComponent) { - let (mut r, mut g, mut b) = (0, 0, 0); - crate::nccell_fg_rgb8(self, &mut r, &mut g, &mut b); - (r, g, b) - } - - /// Sets the background [`NcAlphaBits`]. - /// - /// *C style function: [nccell_set_bg_alpha()][crate::nccell_set_bg_alpha].* - pub fn set_bg_alpha(&mut self, alpha: NcAlphaBits) { - crate::nccell_set_bg_alpha(self, alpha); - } - - /// Indicates to use the "default color" for the background [`NcChannel`]. - /// - /// *C style function: [nccell_set_bg_default()][crate::nccell_set_bg_default].* - pub fn set_bg_default(&mut self) { - crate::nccell_set_bg_default(self); - } - - /// Sets the background [`NcPaletteIndex`]. - /// - /// Also sets [NCALPHA_BG_PALETTE][crate::NCALPHA_BG_PALETTE] and - /// [NCALPHA_OPAQUE][crate::NCALPHA_OPAQUE], and clears out - /// [NCALPHA_BGDEFAULT_MASK][crate::NCALPHA_BGDEFAULT_MASK]. - /// - /// *C style function: [nccell_set_bg_palindex()][crate::nccell_set_bg_palindex].* - pub fn set_bg_palindex(&mut self, index: NcPaletteIndex) { - crate::nccell_set_bg_palindex(self, index); - } - - /// Sets the background [`NcRgb`] and marks it as not using the default color. - /// - /// *C style function: [nccell_set_bg_rgb()][crate::nccell_set_bg_rgb].* - pub fn set_bg_rgb(&mut self, rgb: NcRgb) { - crate::nccell_set_bg_rgb(self, rgb); - } - - /// Sets the background RGB [`NcComponent`]s, and marks it as not using - /// the "default color". - /// - /// *C style function: [nccell_set_bg_rgb8()][crate::nccell_set_bg_rgb8].* - pub fn set_bg_rgb8(&mut self, red: NcComponent, green: NcComponent, blue: NcComponent) { - crate::nccell_set_bg_rgb8(self, red, green, blue); - } - - /// Sets the foreground [`NcAlphaBits`]. - /// - /// *C style function: [nccell_set_fg_alpha()][crate::nccell_set_fg_alpha].* - pub fn set_fg_alpha(&mut self, alpha: NcAlphaBits) { - crate::nccell_set_fg_alpha(self, alpha); - } - - /// Indicates to use the "default color" for the foreground [`NcChannel`]. - /// - /// *C style function: [nccell_set_fg_default()][crate::nccell_set_fg_default].* - pub fn set_fg_default(&mut self) { - crate::nccell_set_fg_default(self); - } - - /// Sets the foreground [`NcPaletteIndex`]. - /// - /// Also sets [NCALPHA_FG_PALETTE][crate::NCALPHA_FG_PALETTE] and - /// [NCALPHA_OPAQUE][crate::NCALPHA_OPAQUE], and clears out - /// [NCALPHA_BGDEFAULT_MASK][crate::NCALPHA_BGDEFAULT_MASK]. - /// - /// *C style function: [nccell_set_fg_palindex()][crate::nccell_set_fg_palindex].* - pub fn set_fg_palindex(&mut self, index: NcPaletteIndex) { - crate::nccell_set_fg_palindex(self, index); - } - - /// Sets the foreground [`NcRgb`] and marks it as not using the default color. - /// - /// *C style function: [nccell_set_fg_rgb()][crate::nccell_set_fg_rgb].* - pub fn set_fg_rgb(&mut self, rgb: NcRgb) { - crate::nccell_set_fg_rgb(self, rgb); - } - - /// Sets the foreground RGB [`NcComponent`]s, and marks it as not using - /// the "default color". - /// - /// *C style function: [nccell_set_fg_rgb8()][crate::nccell_set_fg_rgb8].* - pub fn set_fg_rgb8(&mut self, red: NcComponent, green: NcComponent, blue: NcComponent) { - crate::nccell_set_fg_rgb8(self, red, green, blue); - } -} - -/// # `NcCell` methods: other components -impl NcCell { - /// Returns true if the two cells have distinct `EGC`s, attributes, - /// or [`NcChannel`]s. - /// - /// The actual egcpool index needn't be the same--indeed, the planes - /// needn't even be the same. Only the expanded `EGC` must be bit-equal. - /// - /// *C style function: [nccellcmp()][crate::nccellcmp].* - pub fn compare(plane1: &NcPlane, cell1: &NcCell, plane2: &NcPlane, cell2: &NcCell) -> bool { - crate::nccellcmp(plane1, cell1, plane2, cell2) - } - - /// Saves the [`NcStyle`] and the [`NcChannels`], and returns the `EGC`. - /// (These are the three elements of an `NcCell`). - /// - /// *C style function: [nccell_fg_alpha()][crate::nccell_fg_alpha].* - pub fn extract( - &mut self, - plane: &mut NcPlane, - styles: &mut NcStyle, - channels: &mut NcChannels, - ) -> String { - crate::nccell_extract(plane, self, styles, channels) - } - - /// Returns the `EGC` of the `NcCell`. - /// - /// See also: [extended_gcluster][NcCell#method.extended_gcluster] method. - /// - /// *(No equivalent C style function)* - pub fn egc(&mut self, plane: &mut NcPlane) -> String { - let (mut _styles, mut _channels) = (0, 0); - crate::nccell_extract(plane, self, &mut _styles, &mut _channels) - } - - /// Returns the [`NcStyle`] bits. - /// - /// *C style function: [nccell_styles()][crate::nccell_styles].* - pub fn styles(&mut self) -> NcStyle { - crate::nccell_styles(self) - } - - /// Removes the specified [`NcStyle`] bits. - /// - /// *C style function: [nccell_off_styles()][crate::nccell_off_styles].* - pub fn styles_off(&mut self, stylebits: NcStyle) { - crate::nccell_off_styles(self, stylebits) - } - - /// Adds the specified [`NcStyle`] bits. - /// - /// *C style function: [nccell_on_styles()][crate::nccell_on_styles].* - pub fn styles_on(&mut self, stylebits: NcStyle) { - crate::nccell_on_styles(self, stylebits) - } - - /// Sets just the specified [`NcStyle`] bits. - /// - /// *C style function: [nccell_set_styles()][crate::nccell_set_styles].* - pub fn styles_set(&mut self, stylebits: NcStyle) { - crate::nccell_set_styles(self, stylebits) - } -} - -/// # `NcCell` methods: text -impl NcCell { - // /// Returns a pointer to the `EGC` of this NcCell in the [NcPlane] `plane`. - // /// - // /// This pointer can be invalidated by any further operation on the referred - // /// plane, so… watch out! - // /// - // /// *C style function: [nccell_extended_gcluster()][crate::nccell_wide_left_p].* - // pub fn extended_gcluster(&self, plane: &NcPlane) -> u32 { - // let egcpointer = unsafe { crate::nccell_extended_gcluster(plane, self) }; - // egcpointer - // } - - /// Copies the UTF8-encoded `EGC` out of this NcCell, - /// whether simple or complex. - /// - /// The result is not tied to the [NcPlane], - /// and persists across erases and destruction. - /// - /// *C style function: [nccell_strdup()][crate::nccell_strdup].* - pub fn strdup(&self, plane: &NcPlane) -> String { - crate::nccell_strdup(plane, self) - } - - /// Does this NcCell contain a wide codepoint? - /// - /// *C style function: [nccell_double_wide_p()][crate::nccell_double_wide_p].* - pub fn double_wide_p(&self) -> bool { - crate::nccell_double_wide_p(self) - } - - /// Is this the left half of a wide character? - /// - /// *C style function: [nccell_wide_left_p()][crate::nccell_wide_left_p].* - pub fn wide_left_p(&self) -> bool { - crate::nccell_wide_right_p(self) - } - - /// Is this the right side of a wide character? - /// - /// *C style function: [nccell_wide_right_p()][crate::nccell_wide_right_p].* - pub fn wide_right_p(&self) -> bool { - crate::nccell_wide_right_p(self) - } -} - -/// # `NcCell` methods: boxes -impl NcCell { - /// Loads up six cells with the `EGC`s necessary to draw a box. - /// - /// On error, any [`NcCell`]s this function might have loaded before the error - /// are [release][NcCell#method.release]d. - /// There must be at least six `EGC`s in `gcluster`. - /// - /// *C style function: [nccells_load_box()][crate::nccells_load_box].* - pub fn load_box( - plane: &mut NcPlane, - style: NcStyle, - channels: NcChannels, - ul: &mut NcCell, - ur: &mut NcCell, - ll: &mut NcCell, - lr: &mut NcCell, - hl: &mut NcCell, - vl: &mut NcCell, - gcluster: &str, - ) -> NcResult<()> { - error![crate::nccells_load_box( - plane, style, channels, ul, ur, ll, lr, hl, vl, gcluster - )] - } - - /// NcCell.[load_box()][NcCell#method.box] with the double box-drawing characters. - /// - /// *C style function: [nccells_double_box()][crate::nccells_double_box].* - pub fn double_box( - plane: &mut NcPlane, - style: NcStyle, - channels: NcChannels, - ul: &mut NcCell, - ur: &mut NcCell, - ll: &mut NcCell, - lr: &mut NcCell, - hl: &mut NcCell, - vl: &mut NcCell, - ) -> NcResult<()> { - error![unsafe { - crate::nccells_double_box(plane, style as u32, channels, ul, ur, ll, lr, hl, vl) - }] - } - - /// NcCell.[load_box()][NcCell#method.box] with the rounded box-drawing characters. - /// - /// *C style function: [nccells_rounded_box()][crate::nccells_double_box].* - pub fn rounded_box( - plane: &mut NcPlane, - style: NcStyle, - channels: NcChannels, - ul: &mut NcCell, - ur: &mut NcCell, - ll: &mut NcCell, - lr: &mut NcCell, - hl: &mut NcCell, - vl: &mut NcCell, - ) -> NcResult<()> { - error![unsafe { - crate::nccells_rounded_box(plane, style as u32, channels, ul, ur, ll, lr, hl, vl) - }] - } -} diff --git a/rust/src/cells/mod.rs b/rust/src/cells/mod.rs deleted file mode 100644 index ff4f889fa..000000000 --- a/rust/src/cells/mod.rs +++ /dev/null @@ -1,362 +0,0 @@ -//! `NcCell` - -// functions already exported by bindgen : 7 -// ----------------------------------------- -// (W) wrap: 4 -// (#) test: 0 -// ------------------------------------------ -//… nccell_extended_gcluster -//… nccell_load -//W nccells_double_box -//W nccells_rounded_box -//W nccell_duplicate -//W nccell_release -// -// functions manually reimplemented: 46 -// ------------------------------------------ -// (X) wont: 2 -// (+) done: 38 -// (W) wrap: 40 -// (#) test: 26 -// ------------------------------------------ -//W# nccell_bg_alpha -//W# nccell_bg_default_p -//W# nccell_bg_palindex -//W# nccell_bg_palindex_p -//W# nccell_bg_rgb -//W# nccell_bg_rgb8 -// + nccell_cols -//W+ nccell_double_wide_p -//W+ nccell_extract -//W# nccell_fchannel -//W# nccell_fg_alpha -//W# nccell_fg_default_p -//W# nccell_fg_palindex -//W# nccell_fg_palindex_p -//W# nccell_fg_rgb -//W# nccell_fg_rgb8 -//W+ nccell_init -//…… nccell_load_char -// nccell_load_egc32 -//W+ nccell_off_styles -//W+ nccell_on_styles -//W+ nccell_prime -//W# nccell_set_bchannel -//W# nccell_set_bg_alpha -//W# nccell_set_bg_default -//W# nccell_set_bg_palindex -//W# nccell_set_bg_rgb -//W# nccell_set_bg_rgb8 -// X nccell_set_bg_rgb8_clipped // unneeded -//W# nccell_set_fchannel -//W# nccell_set_fg_alpha -//W# nccell_set_fg_default -//W# nccell_set_fg_palindex -//W# nccell_set_fg_rgb -//W# nccell_set_fg_rgb8 -// X nccell_set_fg_rgb8_clipped // unneeded -//W+ nccell_set_styles -//W+ nccell_strdup -//W+ nccell_styles -//W+ nccell_wide_left_p -//W+ nccell_wide_right_p -//W+ nccellcmp -// nccells_ascii_box -// nccells_heavy_box -// nccells_light_box -//W+ nccells_load_box - -#[cfg(test)] -mod test; - -mod methods; -mod reimplemented; -pub use reimplemented::*; - -#[allow(unused_imports)] // TEMP -use crate::{NcChannel, NcPlane}; - -// NcCell -/// A coordinate on an [`NcPlane`][crate::NcPlane] storing 128 bits of data. -/// -/// # Methods & Associated Functions -/// -/// - [Constructors & Destructors](#nccell-constructors-and-destructors) -/// -/// - [bg|fg `NcChannel`s manipulation](#nccell-methods-bgfg-ncchannels-manipulation) -/// - [Other components](#nccell-methods-other-components) -/// - [Text](#nccell-methods-text) -/// -/// # Description -/// -/// An `NcCell` corresponds to a single character cell on some `NcPlane`, -/// which can be occupied by a single `EGC` grapheme cluster (some root -/// spacing glyph, along with possible combining characters, which might span -/// multiple columns). -/// -/// An NcCell is bounded to an `NcPlane`, but the cell doesn't store anything -/// about the plane. -/// -/// At any `NcCell`, we can have a theoretically arbitrarily long UTF-8 string, -/// a foreground color, a background color, and an [`NcStyle`] attribute set. -/// -/// Valid grapheme cluster contents include: -/// -/// - A NUL terminator, -/// - A single [control character](https://en.wikipedia.org/wiki/Control_character), -/// followed by a NUL terminator, -/// - At most one [spacing -/// character](https://en.wikipedia.org/wiki/Graphic_character#Spacing_character), -/// followed by zero or more nonspacing characters, followed by a NUL terminator. -/// -/// ## Diagram -/// -/// ```txt -/// NcCell: 128 bits structure comprised of the following 5 elements: -/// -/// GCLUSTER|GCLUSTER|GCLUSTER|GCLUSTER 1. `EGC` -/// 00000000║WWWWWWWW║11111111|11111111 2. NcEgcBackstop + 3. width + 4. NcStyle -/// ~~AA~~~~|RRRRRRRR|GGGGGGGG|BBBBBBBB 5. NcChannels -/// ~~AA~~~~|RRRRRRRR|GGGGGGGG|BBBBBBBB " -/// -/// 1. (32b) Extended Grapheme Cluster, presented either as: -/// -/// 1.1. An EGC of up to 4 bytes: -/// UUUUUUUU|UUUUUUUU|UUUUUUUU|UUUUUUUU -/// -/// 1.2. A `0x01` in the first byte, plus 3 bytes with a 24b address to an egcpool: -/// 00000001|IIIIIIII|IIIIIIII|IIIIIIII -/// -/// 2. (8b) Backstop (zero) -/// 00000000 -/// -/// 3. (8b) column width -/// WWWWWWWW -/// -/// 4. (16b) NcStyle -/// 11111111 11111111 -/// -/// 5. (64b) NcChannels -/// ~~AA~~~~|RRRRRRRR|GGGGGGGG|BBBBBBBB║~~AA~~~~|RRRRRRRR|GGGGGGGG|BBBBBBBB -/// ``` -/// -/// `type in C: cell (struct)` -/// -/// # More NcCell Information -/// -/// ## Size -/// -/// Multi-column characters can only have a single style/color throughout. -/// [`wcwidth()`](https://www.man7.org/linux/man-pages/man3/wcwidth.3.html) -/// is not reliable. It's just quoting whether or not the `EGC` -/// contains a "Wide Asian" double-width character. -/// This is set for some things, like most emoji, and not set for -/// other things, like cuneiform. -/// -/// Each cell occupies 16 static bytes (128 bits). The surface is thus ~1.6MB -/// for a (pretty large) 500x200 terminal. At 80x43, it's less than 64KB. -/// Dynamic requirements (the egcpool) can add up to 16MB to an ncplane, but -/// such large pools are unlikely in common use. -/// -/// ## Alpha Compositing -/// -/// We implement some small alpha compositing. Foreground and background both -/// have two bits of inverted alpha. The actual grapheme written to a cell is -/// the topmost non-zero grapheme. -/// -/// - If its alpha is 00 ([`NCALPHA_OPAQUE`][crate::NCALPHA_OPAQUE]) -/// its foreground color is used unchanged. -/// -/// - If its alpha is 10 ([`NCALPHA_TRANSPARENT`][crate::NCALPHA_TRANSPARENT]) -/// its foreground color is derived -/// entirely from cells underneath it. -/// -/// - If its alpha is 01 ([`NCALPHA_BLEND`][crate::NCALPHA_BLEND]) -/// the result will be a composite. -/// -/// Likewise for the background. If the bottom of a coordinate's zbuffer is -/// reached with a cumulative alpha of zero, the default is used. In this way, -/// a terminal configured with transparent background can be supported through -/// multiple occluding ncplanes. -/// -/// A foreground alpha of 11 -/// ([`NCALPHA_HIGHCONTRAST`][crate::NCALPHA_HIGHCONTRAST]) -/// requests high-contrast text (relative to the computed background). -/// A background alpha of 11 is currently forbidden. -/// -/// ## Precedence -/// -/// - Default color takes precedence over palette or RGB, and cannot be used with -/// transparency. -/// - Indexed palette takes precedence over RGB. It cannot meaningfully set -/// transparency, but it can be mixed into a cascading color. -/// - RGB is used if neither default terminal colors nor palette indexing are in -/// play, and fully supports all transparency options. -/// -/// ## Column width *(WIP)* -/// -/// See [USAGE.md](https://github.com/dankamongmen/notcurses/blob/master/USAGE.md) -/// -/// We store the column width in this field. for a multicolumn EGC of N -/// columns, there will be N nccells, and each has a width of N...for now. -/// eventually, such an EGC will set more than one subsequent cell to -/// WIDE_RIGHT, and this won't be necessary. it can then be used as a -/// bytecount. see #1203. FIXME iff width >= 2, the cell is part of a -/// multicolumn glyph. whether a cell is the left or right side of the glyph -/// can be determined by checking whether ->gcluster is zero. -/// -pub type NcCell = crate::bindings::ffi::nccell; - -// RETHINK: -// -// NcEgc -// -// /// Extended Grapheme Cluster. A unicode string of length 1. -// /// -// /// This 32 bit char, together with the associated plane's associated egcpool, -// /// completely define this cell's `NcEgc`. Unless the `NcEgc` requires more than -// /// four bytes to encode as UTF-8, it will be inlined here: -// /// -// /// ## Diagram 1 -// /// -// /// ```txt -// /// UUUUUUUU UUUUUUUU UUUUUUUU UUUUUUUU -// /// extended grapheme cluster <= 4bytes -// /// ``` -// /// -// /// `type in C: uint32_t` -// /// -// /// If more than four bytes are required, it will be spilled into the egcpool. -// /// In either case, there's a NUL-terminated string available without copying, -// /// because (1) the egcpool is all NUL-terminated sequences and (2) the fifth -// /// byte of this struct (the GClusterBackStop field, see below) is -// /// guaranteed to be zero, as are any unused bytes in gcluster. -// /// -// /// A spilled `NcEgc` is indicated by the value `0x01iiiiii`. This cannot alias a -// /// true supra-ASCII NcEgc, because UTF-8 only encodes bytes <= 0x80 when they -// /// are single-byte ASCII-derived values. The `iiiiii` is interpreted as a 24-bit -// /// index into the egcpool (which may thus be up to 16MB): -// /// -// /// ## Diagram 2 -// /// -// /// ```txt -// /// 00000001 iiiiiiii iiiiiiii iiiiiiii -// /// sign 24bit index to egcpool -// /// ``` -// /// `type in C: uint32_t` -// /// -// /// The cost of this scheme is that the character 0x01 (`SOH`) cannot be encoded -// /// in a cell, and therefore it must not be allowed through the API. -// /// -// /// ----- -// /// Note that even if the `NcEgc` is <= 4 bytes and inlined, is still interpreted as -// /// a NUL-terminated char * (technically, &cell->gcluster is treated as a char*). -// /// If it is more than 4 bytes, cell->gcluster has a first byte of 0x01, -// /// and the remaining 24 bits are an index into the plane's egcpool, -// /// which is carved into NUL-terminated chunks of arbitrary length. -// /// -// /// ## Links -// /// -// /// - [Grapheme Cluster -// /// Boundaries](https://unicode.org/reports/tr29/#Grapheme_Cluster_Boundaries) -// /// -// /// -// FIXME: should be an utf-8 string len 1 of type &str. -// pub type NcEgc = String; -// pub type NcEgc<'a> = &'a str; - -// NcEgcBackStop -/// An `u8` always at zero, part of the [`NcCell`] struct -/// -/// ## Diagram -/// -/// ```txt -/// 00000000 -/// ``` -/// -/// `type in C: uint_8t` -/// -pub type NcEgcBackstop = u8; - -// NcStyle -/// -/// An `u16` of `NCSTYLE_*` boolean styling attribute flags -/// -/// ## Attributes -/// -/// - [`NCSTYLE_MASK`] -/// - [`NCSTYLE_ITALIC`] -/// - [`NCSTYLE_UNDERLINE`] -/// - [`NCSTYLE_UNDERCURL`] -/// - [`NCSTYLE_STRUCK`] -/// - [`NCSTYLE_BOLD`] -/// - [`NCSTYLE_NONE`] -/// -/// ## Diagram -/// -/// ```txt -/// 11111111 11111111 -/// ``` -/// -/// `type in C: uint16_t` -/// -pub type NcStyle = u16; - -/// -pub const NCSTYLE_MASK: u16 = crate::bindings::ffi::NCSTYLE_MASK as u16; - -/// -pub const NCSTYLE_ITALIC: u16 = crate::bindings::ffi::NCSTYLE_ITALIC as u16; - -/// -pub const NCSTYLE_UNDERLINE: u16 = crate::bindings::ffi::NCSTYLE_UNDERLINE as u16; - -/// -pub const NCSTYLE_UNDERCURL: u16 = crate::bindings::ffi::NCSTYLE_UNDERCURL as u16; - -/// -pub const NCSTYLE_STRUCK: u16 = crate::bindings::ffi::NCSTYLE_STRUCK as u16; - -/// -pub const NCSTYLE_BOLD: u16 = crate::bindings::ffi::NCSTYLE_BOLD as u16; - -/// -pub const NCSTYLE_NONE: u16 = crate::bindings::ffi::NCSTYLE_NONE as u16; - -/// Enables the [`NcStyle`] methods. -pub trait NcStyleMethods { - fn add(&mut self, other_style: NcStyle); - fn has(&self, other: NcStyle) -> bool; - fn to_vec(&self) -> Vec; -} - -impl NcStyleMethods for NcStyle { - /// Returns a `Vec` with all the styles contained in the current style. - fn to_vec(&self) -> Vec { - let mut v = vec![]; - let styles = [ - NCSTYLE_ITALIC, - NCSTYLE_UNDERLINE, - NCSTYLE_UNDERCURL, - NCSTYLE_STRUCK, - NCSTYLE_BOLD, - NCSTYLE_NONE, - ]; - for s in &styles { - if self.has(*s) { - v.push(*s) - } - } - v - } - - /// Returns true if the current style has included the `other_style`. - fn has(&self, other_style: NcStyle) -> bool { - (self & other_style) == other_style - } - - /// Adds the `other_style` to the current style. - fn add(&mut self, other_style: NcStyle) { - *self |= other_style - } -} diff --git a/rust/src/cells/reimplemented.rs b/rust/src/cells/reimplemented.rs deleted file mode 100644 index 343c80fcf..000000000 --- a/rust/src/cells/reimplemented.rs +++ /dev/null @@ -1,532 +0,0 @@ -//! `cell*_*` reimplemented functions. - -use libc::strcmp; - -use crate::{ - cstring, nccell_release, rstring, NcAlphaBits, NcCell, NcChannel, NcChannels, NcComponent, - NcIntResult, NcPaletteIndex, NcPlane, NcRgb, NcStyle, NCALPHA_BGDEFAULT_MASK, - NCALPHA_BG_PALETTE, NCALPHA_FGDEFAULT_MASK, NCALPHA_FG_PALETTE, NCALPHA_OPAQUE, NCRESULT_ERR, - NCRESULT_OK, NCSTYLE_MASK, -}; - -// Alpha ----------------------------------------------------------------------- - -/// Extracts the foreground [`NcAlphaBits`] from an [`NcCell`] (shifted to LSBs). -/// -/// *Method: NcCell.[fg_alpha()][NcCell#method.fg_alpha].* -#[inline] -pub fn nccell_fg_alpha(cell: &NcCell) -> NcAlphaBits { - crate::ncchannels_fg_alpha(cell.channels) -} - -/// Extracts the background [`NcAlphaBits`] from an [`NcCell`] (shifted to LSBs). -/// -/// *Method: NcCell.[bg_alpha()][NcCell#method.bg_alpha].* -#[inline] -pub fn nccell_bg_alpha(cell: &NcCell) -> NcAlphaBits { - crate::ncchannels_bg_alpha(cell.channels) -} - -/// Sets the foreground [`NcAlphaBits`] of an [`NcCell`]. -/// -/// *Method: NcCell.[set_fg_alpha()][NcCell#method.set_fg_alpha].* -#[inline] -pub fn nccell_set_fg_alpha(cell: &mut NcCell, alpha: NcAlphaBits) { - crate::ncchannels_set_fg_alpha(&mut cell.channels, alpha); -} - -/// Sets the background [`NcAlphaBits`] of an [`NcCell`]. -/// -/// *Method: NcCell.[set_bg_alpha()][NcCell#method.set_bg_alpha].* -#[inline] -pub fn nccell_set_bg_alpha(cell: &mut NcCell, alpha: NcAlphaBits) { - crate::ncchannels_set_bg_alpha(&mut cell.channels, alpha); -} - -// NcComponent --------------------------------------------------------------------- - -/// Gets the foreground [`NcComponent`]s of an [`NcCell`], -/// and returns the [`NcChannel`] (which can have some extra bits set). -/// -/// *Method: NcCell.[fg_rgb8()][NcCell#method.fg_rgb8].* -#[inline] -pub fn nccell_fg_rgb8( - cell: &NcCell, - red: &mut NcComponent, - green: &mut NcComponent, - blue: &mut NcComponent, -) -> NcChannel { - crate::ncchannels_fg_rgb8(cell.channels, red, green, blue) -} - -/// Gets the background [`NcComponent`]s of an [`NcCell`], -/// and returns the [`NcChannel`] (which can have some extra bits set). -/// -/// *Method: NcCell.[bg_rgb8()][NcCell#method.bg_rgb8].* -#[inline] -pub fn nccell_bg_rgb8( - cell: &NcCell, - red: &mut NcComponent, - green: &mut NcComponent, - blue: &mut NcComponent, -) -> NcChannel { - crate::ncchannels_bg_rgb8(cell.channels, red, green, blue) -} - -/// Sets the foreground [`NcComponent`]s of the [`NcCell`], -/// and marks it as not using the "default color". -/// -/// *Method: NcCell.[set_fg_rgb8()][NcCell#method.set_fg_rgb8].* -#[inline] -pub fn nccell_set_fg_rgb8( - cell: &mut NcCell, - red: NcComponent, - green: NcComponent, - blue: NcComponent, -) { - crate::ncchannels_set_fg_rgb8(&mut cell.channels, red, green, blue); -} - -/// Sets the background [`NcComponent`]s of the [`NcCell`], -/// and marks it as not using the "default color". -/// -/// *Method: NcCell.[set_bg_rgb8()][NcCell#method.set_bg_rgb8].* -#[inline] -pub fn nccell_set_bg_rgb8( - cell: &mut NcCell, - red: NcComponent, - green: NcComponent, - blue: NcComponent, -) { - crate::ncchannels_set_bg_rgb8(&mut cell.channels, red, green, blue); -} - -// NcRgb ----------------------------------------------------------------------- - -/// Gets the foreground [`NcRgb`] from an [`NcCell`] (shifted to LSBs). -/// -/// *Method: NcCell.[fg_rgb()][NcCell#method.fg_rgb].* -#[inline] -pub fn nccell_fg_rgb(cell: &NcCell) -> NcRgb { - crate::ncchannels_fg_rgb(cell.channels) -} - -/// Gets the background [`NcRgb`] from an [`NcCell`] (shifted to LSBs). -/// -/// *Method: NcCell.[bg_rgb()][NcCell#method.bg_rgb].* -#[inline] -pub fn nccell_bg_rgb(cell: &NcCell) -> NcRgb { - crate::ncchannels_bg_rgb(cell.channels) -} - -/// Sets the foreground [`NcRgb`] of an [`NcCell`], -/// and marks it as not using the default color. -/// -/// *Method: NcCell.[set_fg_rgb()][NcCell#method.set_fg_rgb].* -#[inline] -pub fn nccell_set_fg_rgb(cell: &mut NcCell, rgb: NcRgb) { - crate::ncchannels_set_fg_rgb(&mut cell.channels, rgb); -} - -/// Sets the background [`NcRgb`] of an [`NcCell`], -/// and marks it as not using the default color. -/// -/// *Method: NcCell.[set_bg_rgb()][NcCell#method.set_bg_rgb].* -#[inline] -pub fn nccell_set_bg_rgb(cell: &mut NcCell, rgb: NcRgb) { - crate::ncchannels_set_bg_rgb(&mut cell.channels, rgb); -} - -// Default --------------------------------------------------------------------- - -/// Indicates to use the "default color" for the foreground [`NcChannel`] -/// of an [`NcCell`]. -/// -/// *Method: NcCell.[set_fg_default()][NcCell#method.set_fg_default].* -#[inline] -pub fn nccell_set_fg_default(cell: &mut NcCell) { - crate::ncchannels_set_fg_default(&mut cell.channels); -} - -/// Indicates to use the "default color" for the background [`NcChannel`] -/// of an [`NcCell`]. -/// -/// *Method: NcCell.[set_bg_default()][NcCell#method.set_bg_default].* -#[inline] -pub fn nccell_set_bg_default(cell: &mut NcCell) { - crate::ncchannels_set_bg_default(&mut cell.channels); -} - -/// Is the foreground [`NcChannel`] of this [`NcCell`] using the -/// "default foreground color"? -/// -/// *Method: NcCell.[fg_default_p()][NcCell#method.fg_default_p].* -#[inline] -pub fn nccell_fg_default_p(cell: &NcCell) -> bool { - crate::ncchannels_fg_default_p(cell.channels) -} - -/// Is the background [`NcChannel`] of this [`NcCell`] using the -/// "default background color"? -/// -/// The "default background color" must generally be used to take advantage of -/// terminal-effected transparency. -/// -/// *Method: NcCell.[bg_default_p()][NcCell#method.bg_default_p].* -#[inline] -pub fn nccell_bg_default_p(cell: &NcCell) -> bool { - crate::ncchannels_bg_default_p(cell.channels) -} - -// Palette --------------------------------------------------------------------- - -/// Is the foreground [`NcChannel`] of this [`NcCell`] using an -/// [`NcPaletteIndex`] indexed [`NcPalette`][crate::NcPalette] color? -/// -/// *Method: NcCell.[fg_palindex_p()][NcCell#method.fg_palindex_p].* -#[inline] -pub fn nccell_fg_palindex_p(cell: &NcCell) -> bool { - crate::ncchannels_fg_palindex_p(cell.channels) -} - -/// Is the background [`NcChannel`] of this [`NcCell`] using an -/// [`NcPaletteIndex`] indexed [`NcPalette`][crate::NcPalette] color? -/// -/// *Method: NcCell.[bg_palindex_p()][NcCell#method.bg_palindex_p].* -#[inline] -pub fn nccell_bg_palindex_p(cell: &NcCell) -> bool { - crate::ncchannels_bg_palindex_p(cell.channels) -} - -/// Gets the [`NcPaletteIndex`] of the foreground [`NcChannel`] of the [`NcCell`]. -/// -/// *Method: NcCell.[fg_palindex()][NcCell#method.fg_palindex].* -#[inline] -#[allow(clippy::unnecessary_cast)] -pub const fn nccell_fg_palindex(cell: &NcCell) -> NcPaletteIndex { - ((cell.channels & 0xff00000000 as NcChannels) >> 32) as NcPaletteIndex -} - -/// Gets the [`NcPaletteIndex`] of the background [`NcChannel`] of the [`NcCell`]. -/// -/// *Method: NcCell.[bg_palindex()][NcCell#method.bg_palindex].* -#[inline] -#[allow(clippy::unnecessary_cast)] -pub const fn nccell_bg_palindex(cell: &NcCell) -> NcPaletteIndex { - (cell.channels & 0xff) as NcPaletteIndex -} - -/// Sets an [`NcCell`]'s foreground [`NcPaletteIndex`]. -/// -/// Also sets [NCALPHA_FG_PALETTE] and [NCALPHA_OPAQUE], -/// and clears out [NCALPHA_FGDEFAULT_MASK]. -/// -/// *Method: NcCell.[set_fg_palindex()][NcCell#method.set_fg_palindex].* -// -// NOTE: unlike the original C function, this one can't fail -#[inline] -#[allow(clippy::unnecessary_cast)] -pub fn nccell_set_fg_palindex(cell: &mut NcCell, index: NcPaletteIndex) { - cell.channels |= NCALPHA_FGDEFAULT_MASK; - cell.channels |= NCALPHA_FG_PALETTE; - nccell_set_fg_alpha(cell, NCALPHA_OPAQUE); - cell.channels &= 0xff000000ffffffff as NcChannels; - cell.channels |= (index as NcChannels) << 32; -} - -/// Sets an [`NcCell`]'s background [`NcPaletteIndex`]. -/// -/// Also sets [`NCALPHA_BG_PALETTE`] and [`NCALPHA_OPAQUE`], -/// and clears out [`NCALPHA_BGDEFAULT_MASK`]. -/// -/// *Method: NcCell.[set_bg_palindex()][NcCell#method.set_bg_palindex].* -// -// NOTE: unlike the original C function, this one can't fail -#[inline] -pub fn nccell_set_bg_palindex(cell: &mut NcCell, index: NcPaletteIndex) { - cell.channels |= NCALPHA_BGDEFAULT_MASK as NcChannels; - cell.channels |= NCALPHA_BG_PALETTE as NcChannels; - nccell_set_bg_alpha(cell, NCALPHA_OPAQUE); - cell.channels &= 0xffffffffff000000; - cell.channels |= index as NcChannels; -} - -// Styles ---------------------------------------------------------------------- - -/// Extracts the [`NcStyle`] bits from an [`NcCell`]. -/// -/// *Method: NcCell.[cell_styles()][NcCell#method.cell_styles].* -#[inline] -pub const fn nccell_styles(cell: &NcCell) -> NcStyle { - cell.stylemask -} - -/// Adds the specified [`NcStyle`] bits to an [`NcCell`]'s existing spec., -/// whether they're actively supported or not. -/// -/// *Method: NcCell.[styles_on()][NcCell#method.styles_on].* -#[inline] -pub fn nccell_on_styles(cell: &mut NcCell, stylebits: NcStyle) { - cell.stylemask |= stylebits & NCSTYLE_MASK as u16; -} - -/// Removes the specified [`NcStyle`] bits from an [`NcCell`]'s existing spec. -/// -/// *Method: NcCell.[styles_off()][NcCell#method.styles_off].* -#[inline] -pub fn nccell_off_styles(cell: &mut NcCell, stylebits: NcStyle) { - cell.stylemask &= !(stylebits & NCSTYLE_MASK as u16); -} - -/// Sets *just* the specified [`NcStyle`] bits for an [`NcCell`], -/// whether they're actively supported or not. -/// -/// *Method: NcCell.[styles_set()][NcCell#method.styles_set].* -#[inline] -pub fn nccell_set_styles(cell: &mut NcCell, stylebits: NcStyle) { - cell.stylemask = stylebits & NCSTYLE_MASK as u16; -} - -// Chars ----------------------------------------------------------------------- - -/// Returns the number of columns occupied by 'c'. see ncstrwidth() for an -/// equivalent for multiple EGCs. -#[inline] -pub const fn nccell_cols(cell: &NcCell) -> u8 { - if cell.width != 0 { - cell.width - } else { - 1 - } -} - -#[deprecated] -pub fn nccell_width(plane: &NcPlane, cell: &NcCell) -> NcIntResult { - unsafe { crate::ffi::nccell_width(plane, cell) } -} - -/// Does the [`NcCell`] contain an East Asian Wide codepoint? -/// -/// *Method: NcCell.[double_wide_p()][NcCell#method.double_wide_p].* -#[inline] -pub const fn nccell_double_wide_p(cell: &NcCell) -> bool { - cell.width > 0 -} - -/// Is this the right half of a wide character? -/// -/// *Method: NcCell.[wide_right_p()][NcCell#method.wide_right_p].* -#[inline] -pub const fn nccell_wide_right_p(cell: &NcCell) -> bool { - nccell_double_wide_p(cell) && cell.gcluster == 0 -} - -/// Is this the left half of a wide character? -/// -/// *Method: NcCell.[wide_left_p()][NcCell#method.wide_left_p].* -#[inline] -pub const fn nccell_wide_left_p(cell: &NcCell) -> bool { - nccell_double_wide_p(cell) && cell.gcluster != 0 -} - -// /// Loads a 7-bit `EGC` character into the [`NcCell`]. -// /// -// /// *Method: NcCell.[load_char()][NcCell#method.load_char].* -// // -// // TODO:CHECK is this necessary at all? -// #[inline] -// pub fn nccell_load_char(plane: &mut NcPlane, cell: &mut NcCell, ch: char) /* -> i32 */ -// { -// let _ = unsafe { crate::nccell_load(plane, cell, ch) }; -// } -// nccell_load_char(struct ncplane* n, nccell* c, char ch){ -// char gcluster[2]; -// gcluster[0] = ch; -// gcluster[1] = '\0'; -// let _ = nccell_load(n, c, gcluster); -// } - -// /// Loads a UTF-8 grapheme cluster of up to 4 bytes into the cell `c`. -// /// -// /// *Method: NcCell.[load_egc32()][NcCell#method.load_egc32].* -// // -// // TODO -// #[inline] -// pub fn nccell_load_egc32(plane: &mut NcPlane, cell: &mut NcCell, egc: &str) -> NcIntResult { -// char gcluster[sizeof(egc) + 1]; -// egc = egc.to_le(); -// memcpy(gcluster, &egc, sizeof(egc)); -// gcluster[4] = '\0'; -// return nccell_load(n, c, gcluster); -// } -// // Load a UTF-8 encoded EGC of up to 4 bytes into the nccell 'c'. Returns the -// // number of bytes used, or -1 on error. -// static inline int -// nccell_load_egc32(struct ncplane* n, nccell* c, uint32_t egc){ -// char gcluster[sizeof(egc) + 1]; -// egc = htole(egc); -// memcpy(gcluster, &egc, sizeof(egc)); -// gcluster[4] = '\0'; -// return nccell_load(n, c, gcluster); -// } - -/// Copies the UTF8-encoded `EGC` out of the [`NcCell`], whether simple or complex. -/// -/// The result is not tied to the [NcPlane], -/// and persists across erases and destruction. -/// -/// *Method: NcCell.[strdup()][NcCell#method.strdup].* -#[inline] -pub fn nccell_strdup(plane: &NcPlane, cell: &NcCell) -> String { - rstring![libc::strdup(crate::nccell_extended_gcluster(plane, cell))].into() -} - -// Misc. ----------------------------------------------------------------------- - -/// Saves the [`NcStyle`] and the [`NcChannels`], -/// and returns the `EGC`, of an [`NcCell`]. -/// -/// *Method: NcCell.[extract()][NcCell#method.extract].* -#[inline] -pub fn nccell_extract( - plane: &NcPlane, - cell: &NcCell, - stylemask: &mut NcStyle, - channels: &mut NcChannels, -) -> String { - if *stylemask != 0 { - *stylemask = cell.stylemask; - } - if *channels != 0 { - *channels = cell.channels; - } - nccell_strdup(plane, cell) -} - -/// Returns true if the two cells are distinct `EGC`s, attributes, or channels. -/// -/// The actual egcpool index needn't be the same--indeed, the planes needn't even -/// be the same. Only the expanded EGC must be equal. The EGC must be bit-equal; -/// -/// *Method: NcCell.[compare()][NcCell#method.compare].* -// -// NOTE: FIXME: it would probably be better to test whether they're Unicode-equal -#[inline] -pub fn nccellcmp(plane1: &NcPlane, cell1: &NcCell, plane2: &NcPlane, cell2: &NcCell) -> bool { - if cell1.stylemask != cell2.stylemask { - return true; - } - if cell1.channels != cell2.channels { - return true; - } - unsafe { - strcmp( - crate::nccell_extended_gcluster(plane1, cell1), - crate::nccell_extended_gcluster(plane2, cell2), - ) != 0 - } -} - -/// Initializes (zeroes out) an [`NcCell`]. -/// -/// *Method: NcCell.[init()][NcCell#method.init].* -#[inline] -pub fn nccell_init(cell: &mut NcCell) { - *cell = unsafe { core::mem::zeroed() } -} - -/// Same as [`nccell_load`][crate::nccell_load], plus blasts the styling with -/// `style` and `channels`. -/// -/// - Breaks the UTF-8 string in `gcluster` down, setting up the cell `cell`. -/// - Returns the number of bytes copied out of `gcluster`, or -1 on failure. -/// - The styling of the cell is left untouched, but any resources are released. -/// - Blasts the styling with `style` and `channels`. -/// -/// *Method: NcCell.[prime()][NcCell#method.prime].* -pub fn nccell_prime( - plane: &mut NcPlane, - cell: &mut NcCell, - gcluster: &str, - style: NcStyle, - channels: NcChannels, -) -> NcIntResult { - cell.stylemask = style; - cell.channels = channels; - unsafe { crate::nccell_load(plane, cell, cstring![gcluster]) } -} - -/// Loads up six cells with the `EGC`s necessary to draw a box. -/// -/// Returns [`NCRESULT_OK`] on success or [`NCRESULT_ERR`] on error. -/// -/// On error, any [`NcCell`]s this function might have loaded before the error -/// are [nccell_release]d. There must be at least six `EGC`s in `gcluster`. -/// -/// *Method: NcCell.[load_box()][NcCell#method.load_box].* -pub fn nccells_load_box( - plane: &mut NcPlane, - style: NcStyle, - channels: NcChannels, - ul: &mut NcCell, - ur: &mut NcCell, - ll: &mut NcCell, - lr: &mut NcCell, - hl: &mut NcCell, - vl: &mut NcCell, - gcluster: &str, -) -> NcIntResult { - assert![gcluster.len() >= 6]; // DEBUG - - // TODO: CHECK: mutable copy for pointer arithmetics: - let mut gclu = cstring![gcluster]; - - let mut ulen: NcIntResult; - - ulen = nccell_prime(plane, ul, gcluster, style, channels); - - if ulen > 0 { - gclu = unsafe { gclu.offset(ulen as isize) }; - ulen = nccell_prime(plane, ur, gcluster, style, channels); - - if ulen > 0 { - gclu = unsafe { gclu.offset(ulen as isize) }; - ulen = nccell_prime(plane, ll, gcluster, style, channels); - - if ulen > 0 { - gclu = unsafe { gclu.offset(ulen as isize) }; - ulen = nccell_prime(plane, lr, gcluster, style, channels); - - if ulen > 0 { - gclu = unsafe { gclu.offset(ulen as isize) }; - ulen = nccell_prime(plane, hl, gcluster, style, channels); - - if ulen > 0 { - let _gclu = unsafe { gclu.offset(ulen as isize) }; - ulen = nccell_prime(plane, vl, gcluster, style, channels); - - if ulen > 0 { - return NCRESULT_OK; - } - unsafe { - nccell_release(plane, hl); - } - } - unsafe { - nccell_release(plane, lr); - } - } - unsafe { - nccell_release(plane, ll); - } - } - unsafe { - nccell_release(plane, ur); - } - } - unsafe { - nccell_release(plane, ul); - } - } - NCRESULT_ERR -} diff --git a/rust/src/cells/test/methods.rs b/rust/src/cells/test/methods.rs deleted file mode 100644 index 8c49b7823..000000000 --- a/rust/src/cells/test/methods.rs +++ /dev/null @@ -1,18 +0,0 @@ -//! Test `NcCell` methods and associated functions. - -use crate::{Nc, NcCell, NcPlane}; - -use serial_test::serial; - -#[test] -#[serial] -fn constructors() -> crate::NcResult<()> { - let _c1 = NcCell::new(); - let _c2 = NcCell::from_char7b('C'); - - let nc = Nc::new()?; - let plane = NcPlane::new(nc, 0, 0, 10, 10)?; - let _c3 = NcCell::from_char('௵', plane); - nc.stop()?; - Ok(()) -} diff --git a/rust/src/cells/test/mod.rs b/rust/src/cells/test/mod.rs deleted file mode 100644 index b9c681d66..000000000 --- a/rust/src/cells/test/mod.rs +++ /dev/null @@ -1,7 +0,0 @@ -//! `NcCell` tests - -#[cfg(test)] -mod methods; - -#[cfg(test)] -mod reimplemented; diff --git a/rust/src/cells/test/reimplemented.rs b/rust/src/cells/test/reimplemented.rs deleted file mode 100644 index b5f5d961a..000000000 --- a/rust/src/cells/test/reimplemented.rs +++ /dev/null @@ -1,103 +0,0 @@ -//! Test `cell*_*` reimplemented functions - -use serial_test::serial; - -use crate::NcCell; - -#[test] -#[serial] -fn rgb() { - // rgb - - let mut c1 = NcCell::new(); - assert_eq![0, crate::nccell_fg_rgb(&c1)]; - assert_eq![0, crate::nccell_bg_rgb(&c1)]; - - crate::nccell_set_fg_rgb(&mut c1, 0x99112233); - assert_eq![0x112233, crate::nccell_fg_rgb(&c1)]; - crate::nccell_set_bg_rgb(&mut c1, 0x99445566); - assert_eq![0x445566, crate::nccell_bg_rgb(&c1)]; - - // rgb8 - - let mut c2 = NcCell::new(); - let (mut r, mut g, mut b) = (0, 0, 0); - - crate::nccell_set_fg_rgb8(&mut c2, 0x11, 0x22, 0x33); - let fchannel = crate::nccell_fg_rgb8(&c2, &mut r, &mut g, &mut b); - assert_eq!((0x11, 0x22, 0x33), (r, g, b)); - assert_eq![0x112233, fchannel & !crate::NCALPHA_BGDEFAULT_MASK]; - - crate::nccell_set_bg_rgb8(&mut c2, 0x44, 0x55, 0x66); - let bchannel = crate::nccell_bg_rgb8(&c2, &mut r, &mut g, &mut b); - assert_eq!((0x44, 0x55, 0x66), (r, g, b)); - assert_eq![0x445566, bchannel & !crate::NCALPHA_BGDEFAULT_MASK]; -} - -#[test] -#[serial] -fn alpha() { - let mut c1 = NcCell::new(); - assert_eq![0, crate::nccell_fg_alpha(&c1)]; - assert_eq![0, crate::nccell_bg_alpha(&c1)]; - - crate::nccell_set_fg_alpha(&mut c1, crate::NCALPHA_TRANSPARENT); - assert_eq![crate::NCALPHA_TRANSPARENT, crate::nccell_fg_alpha(&c1)]; - - crate::nccell_set_bg_alpha(&mut c1, crate::NCALPHA_BLEND); - assert_eq![crate::NCALPHA_BLEND, crate::nccell_bg_alpha(&c1)]; -} - -#[test] -#[serial] -fn default() { - let mut c1 = NcCell::new(); - assert_eq![true, crate::nccell_fg_default_p(&c1)]; - assert_eq![true, crate::nccell_bg_default_p(&c1)]; - - // rgb - crate::nccell_set_fg_rgb(&mut c1, 0x112233); - crate::nccell_set_bg_rgb(&mut c1, 0x445566); - assert_eq![false, crate::nccell_fg_default_p(&c1)]; - assert_eq![false, crate::nccell_bg_default_p(&c1)]; - - // reset - crate::nccell_set_fg_default(&mut c1); - crate::nccell_set_bg_default(&mut c1); - assert_eq![true, crate::nccell_fg_default_p(&c1)]; - assert_eq![true, crate::nccell_bg_default_p(&c1)]; - - // rgb8 - crate::nccell_set_fg_rgb8(&mut c1, 0x11, 0x22, 0x33); - crate::nccell_set_bg_rgb8(&mut c1, 0x44, 0x55, 0x66); - assert_eq![false, crate::nccell_fg_default_p(&c1)]; - assert_eq![false, crate::nccell_bg_default_p(&c1)]; - - // reset - crate::nccell_set_fg_default(&mut c1); - crate::nccell_set_bg_default(&mut c1); - - // palette - crate::nccell_set_fg_palindex(&mut c1, 5); - crate::nccell_set_bg_palindex(&mut c1, 6); - assert_eq![false, crate::nccell_fg_default_p(&c1)]; - assert_eq![false, crate::nccell_bg_default_p(&c1)]; -} - -#[test] -#[serial] -fn palette() { - let mut c1 = NcCell::new(); - assert_eq![false, crate::nccell_fg_palindex_p(&c1)]; - assert_eq![false, crate::nccell_bg_palindex_p(&c1)]; - assert_eq![0, crate::nccell_fg_palindex(&c1)]; - assert_eq![0, crate::nccell_bg_palindex(&c1)]; - - crate::nccell_set_fg_palindex(&mut c1, 5); - crate::nccell_set_bg_palindex(&mut c1, 6); - assert_eq![true, crate::nccell_fg_palindex_p(&c1)]; - assert_eq![true, crate::nccell_bg_palindex_p(&c1)]; - - assert_eq![5, crate::nccell_fg_palindex(&c1)]; - assert_eq![6, crate::nccell_bg_palindex(&c1)]; -} diff --git a/rust/src/channel/methods.rs b/rust/src/channel/methods.rs deleted file mode 100644 index bf81e32da..000000000 --- a/rust/src/channel/methods.rs +++ /dev/null @@ -1,776 +0,0 @@ -//! `NcChannel*` methods and associated functions. -#![allow(clippy::unnecessary_cast)] - -use crate::{NcAlphaBits, NcChannel, NcChannels, NcComponent, NcPaletteIndex, NcRgb}; - -/// Enables the [`NcChannel`] methods. -pub trait NcChannelMethods { - // constructors - fn new() -> Self; - fn default() -> Self; - fn from_rgb(rgb: NcRgb) -> Self; - fn from_rgb_alpha(rgb: NcRgb, alpha: NcAlphaBits) -> Self; - fn from_rgb8(r: NcComponent, g: NcComponent, b: NcComponent) -> Self; - fn from_rgb8_alpha(r: NcComponent, g: NcComponent, b: NcComponent, alpha: NcAlphaBits) -> Self; - - // methods - fn fcombine(&self, bchannel: NcChannel) -> NcChannels; - fn bcombine(&self, fchannel: NcChannel) -> NcChannels; - - fn alpha(&self) -> NcAlphaBits; - fn set_alpha(&mut self, alpha: NcAlphaBits) -> Self; - - fn rgb(&self) -> NcRgb; - fn set(&mut self, rgb: NcRgb) -> Self; - - fn rgb8(&self) -> (NcComponent, NcComponent, NcComponent); - fn set_rgb8(&mut self, r: NcComponent, g: NcComponent, b: NcComponent) -> Self; - fn r(&self) -> NcComponent; - fn g(&self) -> NcComponent; - fn b(&self) -> NcComponent; - fn set_r(&mut self, r: NcComponent) -> Self; - fn set_g(&mut self, g: NcComponent) -> Self; - fn set_b(&mut self, b: NcComponent) -> Self; - - fn default_p(&self) -> bool; - fn set_default(&mut self) -> Self; - fn set_not_default(&mut self) -> Self; - - fn palindex_p(&self) -> bool; -} - -/// Enables the [`NcChannels`] methods. -pub trait NcChannelsMethods { - // constructors - fn new() -> Self; - fn with_default() -> Self; - fn from_rgb(fg_rgb: NcRgb, bg_rgb: NcRgb) -> Self; - fn from_rgb_both(rgb: NcRgb) -> Self; - fn from_rgb_alpha( - fg_rgb: NcRgb, - fg_alpha: NcAlphaBits, - bg_rgb: NcRgb, - bg_alpha: NcAlphaBits, - ) -> Self; - fn from_rgb_alpha_both(rgb: NcRgb, alpha: NcAlphaBits) -> Self; - fn from_rgb8( - fg_r: NcComponent, - fg_g: NcComponent, - fg_b: NcComponent, - bg_r: NcComponent, - bg_g: NcComponent, - bg_b: NcComponent, - ) -> Self; - fn from_rgb8_both(r: NcComponent, g: NcComponent, b: NcComponent) -> Self; - fn from_rgb8_alpha( - fg_r: NcComponent, - fg_g: NcComponent, - fg_b: NcComponent, - fg_alpha: NcAlphaBits, - bg_r: NcComponent, - bg_g: NcComponent, - bg_b: NcComponent, - bg_alpha: NcAlphaBits, - ) -> Self; - fn from_rgb8_alpha_both( - r: NcComponent, - g: NcComponent, - b: NcComponent, - alpha: NcAlphaBits, - ) -> Self; - - // methods - fn combine(fchannel: NcChannel, bchannel: NcChannel) -> Self; - - fn fchannel(&self) -> NcChannel; - fn bchannel(&self) -> NcChannel; - fn set_fchannel(&mut self, fchannel: NcChannel) -> Self; - fn set_bchannel(&mut self, bchannel: NcChannel) -> Self; - - fn fg_alpha(&self) -> NcAlphaBits; - fn bg_alpha(&self) -> NcAlphaBits; - fn set_fg_alpha(&mut self, alpha: NcAlphaBits); - fn set_bg_alpha(&mut self, alpha: NcAlphaBits); - - fn fg_rgb(&self) -> NcRgb; - fn bg_rgb(&self) -> NcRgb; - fn set_fg_rgb(&mut self, alpha: NcAlphaBits) -> Self; - fn set_bg_rgb(&mut self, alpha: NcAlphaBits) -> Self; - - fn fg_rgb8(&self) -> (NcComponent, NcComponent, NcComponent); - fn bg_rgb8(&self) -> (NcComponent, NcComponent, NcComponent); - fn set_fg_rgb8(&mut self, r: NcComponent, g: NcComponent, b: NcComponent) -> Self; - fn set_bg_rgb8(&mut self, r: NcComponent, g: NcComponent, b: NcComponent) -> Self; - fn fg_r(&self) -> NcComponent; - fn fg_g(&self) -> NcComponent; - fn fg_b(&self) -> NcComponent; - fn bg_r(&self) -> NcComponent; - fn bg_g(&self) -> NcComponent; - fn bg_b(&self) -> NcComponent; - fn fg_set_r(&mut self, r: NcComponent) -> Self; - fn fg_set_g(&mut self, g: NcComponent) -> Self; - fn fg_set_b(&mut self, b: NcComponent) -> Self; - fn bg_set_r(&mut self, r: NcComponent) -> Self; - fn bg_set_g(&mut self, g: NcComponent) -> Self; - fn bg_set_b(&mut self, b: NcComponent) -> Self; - - fn fg_default_p(&self) -> bool; - fn bg_default_p(&self) -> bool; - fn set_fg_default(&mut self) -> Self; - fn set_fg_not_default(&mut self) -> Self; - fn set_bg_default(&mut self) -> Self; - fn set_bg_not_default(&mut self) -> Self; - fn set_default(&mut self) -> Self; - fn set_not_default(&mut self) -> Self; - - fn fg_palindex_p(&self) -> bool; - fn bg_palindex_p(&self) -> bool; - fn set_fg_palindex(&mut self, index: NcPaletteIndex) -> Self; - fn set_bg_palindex(&mut self, index: NcPaletteIndex) -> Self; -} - -// NcChannel ------------------------------------------------------------------- - -/// # NcChannel Methods -impl NcChannelMethods for NcChannel { - // Constructors - - /// New `NcChannel`, set to black and NOT using the "default color". - fn new() -> Self { - 0 as NcChannel | crate::NCALPHA_BGDEFAULT_MASK - } - - /// New `NcChannel`, set to black and using the "default color". - fn default() -> Self { - 0 as NcChannel - } - - /// New `NcChannel`, expects [`NcRgb`]. - fn from_rgb(rgb: NcRgb) -> Self { - Self::new().set(rgb) - } - - /// New `NcChannel`, expects [`NcRgb`] & [`NcAlphaBits`]. - fn from_rgb_alpha(rgb: NcRgb, alpha: NcAlphaBits) -> Self { - Self::new().set(rgb).set_alpha(alpha) - } - - /// New `NcChannel`, expects three RGB [`NcComponent`] components. - fn from_rgb8(r: NcComponent, g: NcComponent, b: NcComponent) -> Self { - Self::new().set_rgb8(r, g, b) - } - - /// New `NcChannel`, expects three RGB [`NcComponent`] components & [`NcAlphaBits`]. - fn from_rgb8_alpha(r: NcComponent, g: NcComponent, b: NcComponent, alpha: NcAlphaBits) -> Self { - Self::new().set_rgb8(r, g, b).set_alpha(alpha) - } - - // Combine - - /// Combines this [`NcChannel`] as foreground, with another as background - /// into an [`NcChannels`]. - /// - /// *C style function: [channels_combine()][crate::ncchannels_combine].* - // - // Not in the C API - fn fcombine(&self, bchannel: NcChannel) -> NcChannels { - crate::ncchannels_combine(*self, bchannel) - } - - /// Combines this [`NcChannel`] as background, with another as foreground - /// into an [`NcChannels`]. - /// - /// *C style function: [channels_combine()][crate::ncchannels_combine].* - // - // Not in the C API - fn bcombine(&self, fchannel: NcChannel) -> NcChannels { - crate::ncchannels_combine(fchannel, *self) - } - - // Alpha - - /// Gets the [`NcAlphaBits`]. - /// - /// *C style function: [channel_alpha()][crate::ncchannel_alpha].* - fn alpha(&self) -> NcAlphaBits { - crate::ncchannel_alpha(*self) - } - - /// Sets the [`NcAlphaBits`]. - /// - /// *C style function: [channel_set_alpha()][crate::ncchannel_set_alpha].* - fn set_alpha(&mut self, alpha: NcAlphaBits) -> Self { - crate::ncchannel_set_alpha(self, alpha); - *self - } - - // NcRgb - - /// Gets the [`NcRgb`]. - /// - /// *C style function: [channel_rgb()][crate::ncchannel_rgb].* - // - // Not in the C API - fn rgb(&self) -> NcRgb { - crate::ncchannel_rgb(*self) - } - - /// Sets the [`NcRgb`], and marks the NcChannel as NOT using the - /// "default color", retaining the other bits unchanged. - /// - /// *C style function: [channel_set()][crate::ncchannel_set].* - fn set(&mut self, rgb: NcRgb) -> Self { - crate::ncchannel_set(self, rgb); - *self - } - - // NcComponent - - /// Gets the three [`NcComponent`]s. - /// - /// *C style function: [channel_rgb8()][crate::ncchannel_rgb8].* - fn rgb8(&self) -> (NcComponent, NcComponent, NcComponent) { - let (mut r, mut g, mut b) = (0, 0, 0); - crate::ncchannel_rgb8(*self, &mut r, &mut g, &mut b); - (r, g, b) - } - - /// Sets the three [`NcComponent`]s, and - /// marks the NcChannel as NOT using the "default color". - /// - /// *C style function: [channel_set_rgb8()][crate::ncchannel_set_rgb8].* - fn set_rgb8(&mut self, r: NcComponent, g: NcComponent, b: NcComponent) -> Self { - crate::ncchannel_set_rgb8(self, r, g, b); - *self - } - - /// Gets the red [`NcComponent`]. - /// - /// *C style function: [channel_r()][crate::ncchannel_r].* - fn r(&self) -> NcComponent { - crate::ncchannel_r(*self) - } - - /// Gets the green [`NcComponent`]. - /// - /// *C style function: [channel_g()][crate::ncchannel_g].* - fn g(&self) -> NcComponent { - crate::ncchannel_g(*self) - } - - /// Gets the blue [`NcComponent`]. - /// - /// *C style function: [channel_b()][crate::ncchannel_b].* - fn b(&self) -> NcComponent { - crate::ncchannel_b(*self) - } - - /// Sets the red [`NcComponent`], and returns the new `NcChannel`. - /// - /// *C style function: [channel_set_r()][crate::ncchannel_set_r].* - // - // Not in the C API - fn set_r(&mut self, r: NcComponent) -> Self { - crate::ncchannel_set_r(self, r) - } - - /// Sets the green [`NcComponent`], and returns the new `NcChannel`. - /// - /// *C style function: [channel_set_g()][crate::ncchannel_set_g].* - // - // Not in the C API - fn set_g(&mut self, g: NcComponent) -> Self { - crate::ncchannel_set_g(self, g) - } - - /// Sets the blue [`NcComponent`], and returns the new `NcChannel`. - /// - /// *C style function: [channel_set_b()][crate::ncchannel_set_b].* - // - // Not in the C API - fn set_b(&mut self, b: NcComponent) -> Self { - crate::ncchannel_set_b(self, b) - } - - // default color - - /// Is this `NcChannel` using the "default color" rather than RGB/palette-indexed? - /// - /// *C style function: [channel_default_p()][crate::ncchannel_default_p].* - fn default_p(&self) -> bool { - crate::ncchannel_default_p(*self) - } - - /// Marks this `NcChannel` as using its "default color", - /// which also marks it opaque. - /// - /// *C style function: [channel_set_default()][crate::ncchannel_set_default].* - fn set_default(&mut self) -> Self { - crate::ncchannel_set_default(self) - } - - /// Marks this `NcChannel` as *not* using its "default color". - /// - /// The following methods also marks the channel as NOT using the "default color": - /// - [new()][NcChannel#method.new] - /// - [set()][NcChannel#method.set] - /// - [set_rgb8()][NcChannel#method.set_rgb8] - /// - /// *C style function: [channel_set_not_default()][crate::ncchannel_set_not_default].* - // - // Not in the C API - fn set_not_default(&mut self) -> Self { - crate::ncchannel_set_not_default(self) - } - - // NcPaletteIndex - - /// Is this NcChannel using palette-indexed color rather than RGB? - /// - /// *C style function: [channel_set_default()][crate::ncchannel_set_default].* - fn palindex_p(&self) -> bool { - crate::ncchannel_palindex_p(*self) - } -} - -// NcChannels --------------------------------------------------------------- - -/// # NcChannels Methods -impl NcChannelsMethods for NcChannels { - // Constructors - - /// New `NcChannels`, set to black and NOT using the "default color". - fn new() -> Self { - Self::combine( - 0 as NcChannel | crate::NCALPHA_BGDEFAULT_MASK, - 0 as NcChannel | crate::NCALPHA_BGDEFAULT_MASK, - ) - } - - /// New `NcChannels`, set to black and using the "default color". - fn with_default() -> Self { - Self::combine(0 as NcChannel, 0 as NcChannel) - } - - /// New `NcChannels`, expects two separate [`NcRgb`]s for the foreground - /// and background channels. - fn from_rgb(fg_rgb: NcRgb, bg_rgb: NcRgb) -> Self { - Self::combine(NcChannel::from_rgb(fg_rgb), NcChannel::from_rgb(bg_rgb)) - } - - /// New `NcChannels`, expects a single [`NcRgb`] for both foreground - /// and background channels. - fn from_rgb_both(rgb: NcRgb) -> Self { - let channel = NcChannel::new().set(rgb); - Self::combine(channel, channel) - } - - /// New `NcChannels`, expects two separate [`NcRgb`] & [`NcAlphaBits`] for the - /// foreground and background channels. - fn from_rgb_alpha( - fg_rgb: NcRgb, - fg_alpha: NcAlphaBits, - bg_rgb: NcRgb, - bg_alpha: NcAlphaBits, - ) -> Self { - Self::combine( - NcChannel::from_rgb(fg_rgb).set_alpha(fg_alpha), - NcChannel::from_rgb(bg_rgb).set_alpha(bg_alpha), - ) - } - - /// New `NcChannels`, expects [`NcRgb`] & [`NcAlphaBits`] for both - /// channels. - fn from_rgb_alpha_both(rgb: NcRgb, alpha: NcAlphaBits) -> Self { - let channel = NcChannel::new().set(rgb).set_alpha(alpha); - Self::combine(channel, channel) - } - - /// New `NcChannels`, expects three RGB [`NcComponent`] components - /// for each channel. - fn from_rgb8( - fg_r: NcComponent, - fg_g: NcComponent, - fg_b: NcComponent, - bg_r: NcComponent, - bg_g: NcComponent, - bg_b: NcComponent, - ) -> Self { - Self::combine( - NcChannel::from_rgb8(fg_r, fg_g, fg_b), - NcChannel::from_rgb8(bg_r, bg_g, bg_b), - ) - } - - /// New `NcChannels`, expects three RGB [`NcComponent`] components for - /// both the foreground and background channels. - fn from_rgb8_both(r: NcComponent, g: NcComponent, b: NcComponent) -> Self { - let channel = NcChannel::new().set_rgb8(r, g, b); - Self::combine(channel, channel) - } - - /// New `NcChannels`, expects three RGB [`NcComponent`]s and - /// [`NcAlphaBits`], for both the foreground and background channels. - fn from_rgb8_alpha( - fg_r: NcComponent, - fg_g: NcComponent, - fg_b: NcComponent, - fg_alpha: NcAlphaBits, - bg_r: NcComponent, - bg_g: NcComponent, - bg_b: NcComponent, - bg_alpha: NcAlphaBits, - ) -> Self { - Self::combine( - NcChannel::from_rgb8_alpha(fg_r, fg_g, fg_b, fg_alpha), - NcChannel::from_rgb8_alpha(bg_r, bg_g, bg_b, bg_alpha), - ) - } - - /// New `NcChannel`, expects three RGB [`NcComponent`]s. - fn from_rgb8_alpha_both( - r: NcComponent, - g: NcComponent, - b: NcComponent, - alpha: NcAlphaBits, - ) -> Self { - let channel = NcChannel::new().set_rgb8(r, g, b).set_alpha(alpha); - Self::combine(channel, channel) - } - - // Combine - - /// Combines two [`NcChannel`]s into an [`NcChannels`]. - /// - /// *C style function: [channels_combine()][crate::ncchannels_combine].* - fn combine(fchannel: NcChannel, bchannel: NcChannel) -> Self { - crate::ncchannels_combine(fchannel, bchannel) - } - - // NcChannel - - /// Extracts the foreground [`NcChannel`]. - /// - /// *C style function: [channels_fchannel()][crate::ncchannels_fchannel].* - fn fchannel(&self) -> NcChannel { - crate::ncchannels_fchannel(*self) - } - - /// Extracts the background [`NcChannel`]. - /// - /// *C style function: [channels_bchannel()][crate::ncchannels_bchannel].* - fn bchannel(&self) -> NcChannel { - crate::ncchannels_bchannel(*self) - } - - /// Sets the foreground [`NcChannel`]. - /// - /// *C style function: [channels_set_fchannel()][crate::ncchannels_set_fchannel].* - fn set_fchannel(&mut self, fchannel: NcChannel) -> Self { - crate::ncchannels_set_fchannel(self, fchannel) - } - - /// Sets the background [`NcChannel`]. - /// - /// *C style function: [channels_set_bchannel()][crate::ncchannels_set_bchannel].* - fn set_bchannel(&mut self, bchannel: NcChannel) -> Self { - crate::ncchannels_set_bchannel(self, bchannel) - } - - // Alpha - - /// Gets the foreground [`NcAlphaBits`]. - /// - /// *C style function: [channels_fg_alpha()][crate::ncchannels_fg_alpha].* - fn fg_alpha(&self) -> NcAlphaBits { - crate::ncchannels_fg_alpha(*self) - } - - /// Gets the background [`NcAlphaBits`]. - /// - /// *C style function: [channels_bg_alpha()][crate::ncchannels_bg_alpha].* - fn bg_alpha(&self) -> NcAlphaBits { - crate::ncchannels_bg_alpha(*self) - } - - /// Sets the foreground [`NcAlphaBits`]. - /// - /// *C style function: [channels_set_fg_alpha()][crate::ncchannels_set_fg_alpha].* - fn set_fg_alpha(&mut self, alpha: NcAlphaBits) { - crate::ncchannels_set_fg_alpha(self, alpha) - } - - /// Sets the background [`NcAlphaBits`]. - /// - /// *C style function: [channels_set_bg_alpha()][crate::ncchannels_set_bg_alpha].* - fn set_bg_alpha(&mut self, alpha: NcAlphaBits) { - crate::ncchannels_set_bg_alpha(self, alpha) - } - - // NcRgb - - /// Gets the foreground [`NcRgb`]. - /// - /// *C style function: [channels_fg_rgb()][crate::ncchannels_fg_rgb].* - fn fg_rgb(&self) -> NcRgb { - crate::ncchannels_fg_rgb(*self) - } - - /// Gets the background [`NcRgb`]. - /// - /// *C style function: [channels_bg_rgb()][crate::ncchannels_bg_rgb].* - fn bg_rgb(&self) -> NcRgb { - crate::ncchannels_bg_rgb(*self) - } - - /// Sets the foreground [`NcRgb`]. - /// - /// *C style function: [channels_set_fg_rgb()][crate::ncchannels_set_fg_rgb].* - fn set_fg_rgb(&mut self, rgb: NcRgb) -> Self { - crate::ncchannels_set_fg_rgb(self, rgb); - *self - } - - /// Sets the background [`NcRgb`]. - /// - /// *C style function: [channels_set_bg_rgb()][crate::ncchannels_set_bg_rgb].* - fn set_bg_rgb(&mut self, rgb: NcRgb) -> Self { - crate::ncchannels_set_bg_rgb(self, rgb); - *self - } - - // NcComponent - - /// Gets the three foreground RGB [`NcComponent`]s (r, g, b). - /// - /// *C style function: [channels_fg_rgb8()][crate::ncchannels_fg_rgb8].* - fn fg_rgb8(&self) -> (NcComponent, NcComponent, NcComponent) { - let (mut r, mut g, mut b) = (0, 0, 0); - crate::ncchannels_fg_rgb8(*self, &mut r, &mut g, &mut b); - (r, g, b) - } - - /// Gets the three background RGB [`NcComponent`]s (r, g, b). - /// - /// *C style function: [channels_bg_rgb8()][crate::ncchannels_bg_rgb8].* - fn bg_rgb8(&self) -> (NcComponent, NcComponent, NcComponent) { - let (mut r, mut g, mut b) = (0, 0, 0); - crate::ncchannels_bg_rgb8(*self, &mut r, &mut g, &mut b); - (r, g, b) - } - - /// Sets the three foreground RGB [`NcComponent`]s (r, g, b), and - /// marks the foreground [`NcChannel`] as not using the "default color". - /// - /// *C style function: [channels_set_fg_rgb8()][crate::ncchannels_set_fg_rgb8].* - fn set_fg_rgb8(&mut self, r: NcComponent, g: NcComponent, b: NcComponent) -> Self { - crate::ncchannels_set_fg_rgb8(self, r, g, b) - } - - /// Sets the three background RGB [`NcComponent`]s (r, g, b), and - /// marks the background [`NcChannel`] as not using the "default color". - /// - /// *C style function: [channels_set_bg_rgb8()][crate::ncchannels_set_bg_rgb8].* - fn set_bg_rgb8(&mut self, r: NcComponent, g: NcComponent, b: NcComponent) -> Self { - crate::ncchannels_set_bg_rgb8(self, r, g, b) - } - - /// Gets the foreground red [`NcComponent`]. - /// - /// *(No equivalent C style function)* - fn fg_r(&self) -> NcComponent { - crate::ncchannel_r(crate::ncchannels_fchannel(*self)) - } - - /// Gets the foreground green [`NcComponent`]. - /// - /// *(No equivalent C style function)* - fn fg_g(&self) -> NcComponent { - crate::ncchannel_g(crate::ncchannels_fchannel(*self)) - } - - /// Gets the foreground blue [`NcComponent`]. - /// - /// *(No equivalent C style function)* - fn fg_b(&self) -> NcComponent { - crate::ncchannel_b(crate::ncchannels_fchannel(*self)) - } - - /// Gets the background red [`NcComponent`]. - /// - /// *(No equivalent C style function)* - fn bg_r(&self) -> NcComponent { - crate::ncchannel_r(crate::ncchannels_bchannel(*self)) - } - - /// Gets the background green [`NcComponent`]. - /// - /// *(No equivalent C style function)* - fn bg_g(&self) -> NcComponent { - crate::ncchannel_g(crate::ncchannels_bchannel(*self)) - } - - /// Gets the background blue [`NcComponent`]. - /// - /// *(No equivalent C style function)* - fn bg_b(&self) -> NcComponent { - crate::ncchannel_b(crate::ncchannels_bchannel(*self)) - } - - /// Sets the foreground red [`NcComponent`], and returns the new `NcChannels`. - /// - /// *(No equivalent C style function)* - fn fg_set_r(&mut self, r: NcComponent) -> Self { - let (_, g, b) = self.bg_rgb8(); - crate::ncchannels_set_fg_rgb8(self, r, g, b) - } - - /// Sets the foreground green [`NcComponent`], and returns the new `NcChannels`. - /// - /// *(No equivalent C style function)* - fn fg_set_g(&mut self, g: NcComponent) -> Self { - let (r, _, b) = self.bg_rgb8(); - crate::ncchannels_set_fg_rgb8(self, r, g, b) - } - - /// Sets the foreground blue [`NcComponent`], and returns the new `NcChannels`. - /// - /// *(No equivalent C style function)* - fn fg_set_b(&mut self, b: NcComponent) -> Self { - let (r, g, _) = self.bg_rgb8(); - crate::ncchannels_set_fg_rgb8(self, r, g, b) - } - - /// Sets the background red [`NcComponent`], and returns the new `NcChannels`. - /// - /// *(No equivalent C style function)* - fn bg_set_r(&mut self, r: NcComponent) -> Self { - let (_, g, b) = self.bg_rgb8(); - crate::ncchannels_set_bg_rgb8(self, r, g, b) - } - - /// Sets the background green [`NcComponent`], and returns the new `NcChannels`. - /// - /// *(No equivalent C style function)* - fn bg_set_g(&mut self, g: NcComponent) -> Self { - let (r, _, b) = self.bg_rgb8(); - crate::ncchannels_set_bg_rgb8(self, r, g, b) - } - - /// Sets the background blue [`NcComponent`], and returns the new `NcChannels`. - /// - /// *(No equivalent C style function)* - fn bg_set_b(&mut self, b: NcComponent) -> Self { - let (r, g, _) = self.bg_rgb8(); - crate::ncchannels_set_bg_rgb8(self, r, g, b) - } - - // default color - - /// Is the background using the "default background color"? - /// - /// *C style function: [channels_fg_default_p()][crate::ncchannels_fg_default_p].* - fn fg_default_p(&self) -> bool { - crate::ncchannels_fg_default_p(*self) - } - - /// Is the background using the "default background color"? - /// - /// The "default background color" must generally be used to take advantage - /// of terminal-effected transparency. - /// - /// *C style function: [channels_bg_default_p()][crate::ncchannels_bg_default_p].* - fn bg_default_p(&self) -> bool { - crate::ncchannels_bg_default_p(*self) - } - - /// Marks the foreground as using its "default color", and - /// returns the new [`NcChannels`]. - /// - /// *C style function: [channels_set_fg_default()][crate::ncchannels_set_fg_default].* - fn set_fg_default(&mut self) -> Self { - crate::ncchannels_set_fg_default(self) - } - - /// Marks the background as using its "default color", and - /// returns the new [`NcChannels`]. - /// - /// *C style function: [channels_set_bg_default()][crate::ncchannels_set_bg_default].* - fn set_bg_default(&mut self) -> Self { - crate::ncchannels_set_bg_default(self) - } - - /// Marks the foreground as NOT using its "default color", and - /// returns the new [`NcChannels`]. - /// - /// *C style function: [channels_set_fg_default()][crate::ncchannels_set_fg_default].* - // - // Not in the C API - fn set_fg_not_default(&mut self) -> Self { - crate::ncchannels_set_fg_not_default(self) - } - - /// Marks the background as NOT using its "default color", and - /// returns the new [`NcChannels`]. - /// - /// *C style function: [channels_set_bg_not_default()][crate::ncchannels_set_bg_not_default].* - // - // Not in the C API - fn set_bg_not_default(&mut self) -> Self { - crate::ncchannels_set_bg_not_default(self) - } - - /// Marks both the foreground and background as using its "default color", and - /// returns the new [`NcChannels`]. - /// - // - // Not in the C API - fn set_default(&mut self) -> Self { - crate::ncchannels_set_fg_default(&mut crate::ncchannels_set_bg_default(self)) - } - - /// Marks both the foreground and background as NOT using its "default color", - /// and returns the new [`NcChannels`]. - /// - // - // Not in the C API - fn set_not_default(&mut self) -> Self { - crate::ncchannels_set_fg_not_default(&mut crate::ncchannels_set_bg_not_default(self)) - } - - // NcPaletteIndex - - /// Is the foreground of using an [indexed][NcPaletteIndex] - /// [NcPalette][crate::NcPalette] color? - /// - /// *C style function: [channels_fg_palindex_p()][crate::ncchannels_fg_palindex_p].* - fn fg_palindex_p(&self) -> bool { - crate::ncchannels_fg_palindex_p(*self) - } - - /// Is the background of using an [indexed][NcPaletteIndex] - /// [NcPalette][crate::NcPalette] color? - /// - /// *C style function: [channels_bg_palindex_p()][crate::ncchannels_bg_palindex_p].* - fn bg_palindex_p(&self) -> bool { - crate::ncchannels_bg_palindex_p(*self) - } - - /// Sets the foreground of an [`NcChannels`] as using an - /// [indexed][NcPaletteIndex] [NcPalette][crate::NcPalette] color. - /// - /// *C style function: [channels_set_fg_palindex()][crate::ncchannels_set_fg_palindex].* - fn set_fg_palindex(&mut self, index: NcPaletteIndex) -> Self { - crate::ncchannels_set_fg_palindex(self, index); - *self - } - - /// Sets the background of an [`NcChannels`] as using an - /// [indexed][NcPaletteIndex] [NcPalette][crate::NcPalette] color. - /// - /// *C style function: [channels_set_bg_palindex()][crate::ncchannels_set_bg_palindex].* - fn set_bg_palindex(&mut self, index: NcPaletteIndex) -> Self { - crate::ncchannels_set_bg_palindex(self, index); - *self - } -} diff --git a/rust/src/channel/mod.rs b/rust/src/channel/mod.rs deleted file mode 100644 index ec1716b5e..000000000 --- a/rust/src/channel/mod.rs +++ /dev/null @@ -1,314 +0,0 @@ -//! `NcChannel*` - -// ----------------------------------------------------------------------------- -// - The channel components are u8 instead of u32. -// Because of type enforcing, some runtime checks are now unnecessary. -// -// - None of the functions can't fail now. The original checks for dirty bits -// have been substitued by mask cleaning (bitwise and) -// -// - These functions were deemed unnecessary to implement: -// - `channel_set_rgb_clipped()` -// - `channels_set_fg_rgb8_clipped()` -// - `channels_set_bg_rgb8_clipped()` -// ----------------------------------------------------------------------------- -// -// functions manually reimplemented: 44 -// ------------------------------------------ -// (X) wont: 3 -// (+) done: 36 / 0 -// (#) test: 21 -// (W) wrap: 41 -// ------------------------------------------ -//W# channel_alpha -//W# channel_b -//W# channel_default_p -//W# channel_g -//W# channel_palindex_p -//W# channel_r -//W# channel_rgb8 -//W# channel_set -//W# channel_set_alpha -//W# channel_set_default -//W# channel_set_not_default // not in the original C API -//W# channel_set_rgb8 -// X channel_set_rgb_clipped // not needed -//W# channels_bchannel -//W+ channels_bg_alpha -//W+ channels_bg_default_p -//W# channels_bg_palindex_p -//W+ channels_bg_rgb -//W+ channels_bg_rgb8 -//W# channels_combine -//W# channels_fchannel -//W+ channels_fg_alpha -//W+ channels_fg_default_p -//W# channels_fg_palindex_p -//W+ channels_fg_rgb -//W+ channels_fg_rgb8 -//W# channels_set_bchannel -//W+ channels_set_bg_alpha -//W+ channels_set_bg_default -//W channels_set_bg_not_default // not in the original C API -//W# channels_set_bg_palindex -//W+ channels_set_bg_rgb -//W+ channels_set_bg_rgb8 -// X channels_set_bg_rgb8_clipped // not needed -//W channels_set_default // not in the original C API -//W# channels_set_fchannel -//W+ channels_set_fg_alpha -//W+ channels_set_fg_default -//W channels_set_fg_not_default // not in the original C API -//W# channels_set_fg_palindex -//W+ channels_set_fg_rgb -//W+ channels_set_fg_rgb8 -// X channels_set_fg_rgb8_clipped // not needed -//W channels_set_not_default // not in the original C API - -#[allow(unused_imports)] // for the doc comments -use crate::{NcCell, NcRgba}; - -#[cfg(test)] -mod test; - -mod methods; -mod reimplemented; -pub use methods::{NcChannelMethods, NcChannelsMethods}; -pub use reimplemented::*; - -// NcChannel -// -/// 32 bits of context-dependent info -/// containing RGB + 2 bits of alpha + extra -/// -/// It is: -/// - a 24-bit [`NcRgb`] value -/// - plus 8 bits divided in: -/// - 2 bits of [`NcAlphaBits`] -/// - 6 bits of context-dependent info -/// -/// The context details are documented in [`NcChannels`] -/// -/// ## Diagram -/// -/// ```txt -/// ~~AA~~~~ RRRRRRRR GGGGGGGG BBBBBBBB -/// ``` -/// `type in C: channel (uint32_t)` -/// -/// See also: [NcRgb] and [NcRgba] types. -pub type NcChannel = u32; - -/// Extract these bits to get a channel's alpha value -pub const NCCHANNEL_ALPHA_MASK: u32 = crate::bindings::ffi::NC_BG_ALPHA_MASK; - -// NcAlphaBits -// -/// 2 bits of alpha (surrounded by context dependent bits). -/// It is part of an [`NcChannel`]. -/// -/// ## Diagram -/// -/// ```txt -/// ~~AA~~~~ -------- -------- -------- -/// ``` -/// `type in C: no data type` -/// -pub type NcAlphaBits = u32; - -/// [`NcAlphaBits`] bits indicating -/// [`NcCell`]'s foreground or background color will be a composite between -/// its color and the `NcCell`s' corresponding colors underneath it -pub const NCALPHA_BLEND: u32 = crate::bindings::ffi::NCALPHA_BLEND; - -/// [`NcAlphaBits`] bits indicating -/// [`NcCell`]'s foreground color will be high-contrast (relative to the -/// computed background). Background cannot be highcontrast -pub const NCALPHA_HIGHCONTRAST: u32 = crate::bindings::ffi::NCALPHA_HIGHCONTRAST; - -/// [`NcAlphaBits`] bits indicating -/// [`NcCell`]'s foreground or background color is used unchanged -pub const NCALPHA_OPAQUE: u32 = crate::bindings::ffi::NCALPHA_OPAQUE; - -/// [`NcAlphaBits`] bits indicating -/// [`NcCell`]'s foreground or background color is derived entirely from the -/// `NcCell`s underneath it -pub const NCALPHA_TRANSPARENT: u32 = crate::bindings::ffi::NCALPHA_TRANSPARENT; - -/// If this bit is set, we are *not* using the default background color -/// -/// See the detailed diagram at [`NcChannels`][crate::NcChannels] -/// -/// Note: This can also be used against a single [`NcChannel`] -pub const NCALPHA_BGDEFAULT_MASK: u32 = crate::bindings::ffi::NC_BGDEFAULT_MASK; - -/// Extract these bits to get the background alpha mask -/// ([`NcAlphaBits`]) -/// -/// See the detailed diagram at [`NcChannels`][crate::NcChannels] -/// -/// Note: This can also be used against a single [`NcChannel`] -pub const NCALPHA_BG_ALPHA_MASK: u32 = crate::bindings::ffi::NC_BG_ALPHA_MASK; - -/// If this bit *and* [`NCALPHA_BGDEFAULT_MASK`] are set, we're using a -/// palette-indexed background color -/// -/// See the detailed diagram at [`NcChannels`][crate::NcChannels] -/// -/// Note: This can also be used against a single [`NcChannel`] -pub const NCALPHA_BG_PALETTE: u32 = crate::bindings::ffi::NC_BG_PALETTE; - -/// Extract these bits to get the background [`NcRgb`][crate::NcRgb] value -/// -/// See the detailed diagram at [`NcChannels`][crate::NcChannels] -/// -/// Note: This can also be used against a single [`NcChannel`] -pub const NCALPHA_BG_RGB_MASK: u32 = crate::bindings::ffi::NC_BG_RGB_MASK; - -/// If this bit is set, we are *not* using the default foreground color -/// -/// See the detailed diagram at [`NcChannels`][crate::NcChannels] -/// -/// Note: When working with a single [`NcChannel`] use [`NCALPHA_BGDEFAULT_MASK`]; -pub const NCALPHA_FGDEFAULT_MASK: u64 = crate::bindings::ffi::NC_FGDEFAULT_MASK; - -/// Extract these bits to get the foreground alpha mask -/// ([`NcAlphaBits`]) -/// -/// See the detailed diagram at [`NcChannels`][crate::NcChannels] -/// -/// Note: When working with a single [`NcChannel`] use [`NCALPHA_BG_ALPHA_MASK`]; -pub const NCALPHA_FG_ALPHA_MASK: u64 = crate::bindings::ffi::NC_FG_ALPHA_MASK; - -/// If this bit *and* [`NCALPHA_FGDEFAULT_MASK`] are set, we're using a -/// palette-indexed background color -/// -/// See the detailed diagram at [`NcChannels`][crate::NcChannels] -/// -/// Note: When working with a single [`NcChannel`] use [`NCALPHA_BG_PALETTE`]; -pub const NCALPHA_FG_PALETTE: u64 = crate::bindings::ffi::NC_FG_PALETTE; - -/// Extract these bits to get the foreground [`NcRgb`][crate::NcRgb] value -/// -/// See the detailed diagram at [`NcChannels`][crate::NcChannels] -/// -/// Note: When working with a single [`NcChannel`] use [`NCALPHA_BG_RGB_MASK`]; -pub const NCALPHA_FG_RGB_MASK: u64 = crate::bindings::ffi::NC_FG_RGB_MASK; - -// NcChannels -// -/// 64 bits containing a foreground and background [`NcChannel`] -/// -/// At render time, both 24-bit [`NcRgb`] values are quantized down to terminal -/// capabilities, if necessary. There's a clear path to 10-bit support should -/// we one day need it. -/// -/// ## Default Color -/// -/// The "default color" is best explained by -/// [color(3NCURSES)](https://manpages.debian.org/stretch/ncurses-doc/color.3ncurses.en.html) and -/// [default_colors(3NCURSES)](https://manpages.debian.org/stretch/ncurses-doc/default_colors.3ncurses.en.html). -/// Ours is the same concept. -/// -/// **Until the "not default color" bit is set, any color you load will be ignored.** -/// -/// ## Diagram -/// -/// ```txt -/// ~~AA~~~~|RRRRRRRR|GGGGGGGG|BBBBBBBB║~~AA~~~~|RRRRRRRR|GGGGGGGG|BBBBBBBB -/// ↑↑↑↑↑↑↑↑↑↑↑↑ foreground ↑↑↑↑↑↑↑↑↑↑↑║↑↑↑↑↑↑↑↑↑↑↑↑ background ↑↑↑↑↑↑↑↑↑↑↑ -/// ``` -/// -/// Detailed info (specially on the context-dependent bits on each -/// [`NcChannel`]'s 4th byte): -/// -/// ```txt -/// ~foreground channel~ -/// NCALPHA_WIDEASIAN_MASK: part of a wide glyph ↓bits view↓ ↓hex mask↓ -/// 1·······|········|········|········║········|········|········|········ = 8·······|········ -/// -/// NCALPHA_FGDEFAULT_MASK: foreground is NOT "default color" -/// ·1······|········|········|········║········|········|········|········ = 4·······|········ -/// -/// NCALPHA_FG_ALPHA_MASK: foreground alpha (2bits) -/// ··11····|········|········|········║········|········|········|········ = 3·······|········ -/// -/// NCALPHA_FG_PALETTE: foreground uses palette index -/// ····1···|········|········|········║········|········|········|········ = ·8······|········ -/// -/// NCALPHA_NOBACKGROUND_MASK: glyph is entirely foreground -/// ·····1··|········|········|········║········|········|········|········ = ·4······|········ -/// -/// reserved, must be 0 -/// ······00|········|········|········║········|········|········|········ = ·3······|········ -/// -/// NCALPHA_FG_RGB_MASK: foreground in 3x8 RGB (rrggbb) -/// ········|11111111|11111111|11111111║········|········|········|········ = ··FFFFFF|········ -/// ``` - -/// ```txt -/// ~background channel~ -/// reserved, must be 0 ↓bits view↓ ↓hex mask↓ -/// ········|········|········|········║0·······|········|········|········ = ········|8······· -/// -/// NCALPHA_BGDEFAULT_MASK: background is NOT "default color" -/// ········|········|········|········║·1······|········|········|········ = ········|4······· -/// -/// NCALPHA_BG_ALPHA_MASK: background alpha (2 bits) -/// ········|········|········|········║··11····|········|········|········ = ········|3······· -/// -/// NCALPHA_BG_PALETTE: background uses palette index -/// ········|········|········|········║····1···|········|········|········ = ········|·8······ -/// -/// reserved, must be 0 -/// ········|········|········|········║·····000|········|········|········ = ········|·7······ -/// -/// NCALPHA_BG_RGB_MASK: background in 3x8 RGB (rrggbb) -/// ········|········|········|········║········|11111111|11111111|11111111 = ········|··FFFFFF -/// ``` -/// `type in C: channels (uint64_t)` -/// -/// ## `NcCell` Mask Flags -/// -/// - [`NCALPHA_BGDEFAULT_MASK`][crate::NCALPHA_BGDEFAULT_MASK] -/// - [`NCALPHA_BG_ALPHA_MASK`][crate::NCALPHA_BG_ALPHA_MASK] -/// - [`NCALPHA_BG_PALETTE`][crate::NCALPHA_BG_PALETTE] -/// - [`NCALPHA_BG_RGB_MASK`][crate::NCALPHA_BG_RGB_MASK] -/// - [`NCALPHA_FGDEFAULT_MASK`][crate::NCALPHA_FGDEFAULT_MASK] -/// - [`NCALPHA_FG_ALPHA_MASK`][crate::NCALPHA_FG_ALPHA_MASK] -/// - [`NCALPHA_FG_PALETTE`][crate::NCALPHA_FG_PALETTE] -/// - [`NCALPHA_FG_RGB_MASK`][crate::NCALPHA_FG_RGB_MASK] -/// -pub type NcChannels = u64; - -#[deprecated = "use NcChannels instead"] -#[doc(hidden)] -pub type NcChannelPair = NcChannels; - -// NcRgb -// -/// 24 bits broken into 3x 8bpp channels. -/// -/// Unlike with [`NcChannel`], operations involving `NcRgb` ignores the last 4th byte -/// -/// ## Diagram -/// -/// ```txt -/// -------- RRRRRRRR GGGGGGGG BBBBBBBB -/// ``` -/// `type in C: no data type` -/// -/// See also: [NcRgba] and [NcChannel] types. -pub type NcRgb = u32; - -// NcComponent -// -/// 8 bits representing an R/G/B color component or an alpha channel component. -/// -/// ## Diagram -/// -/// ```txt -/// CCCCCCCC (1 Byte) -/// ``` -/// `type in C: no data type` -pub type NcComponent = u8; diff --git a/rust/src/channel/reimplemented.rs b/rust/src/channel/reimplemented.rs deleted file mode 100644 index 72e889d49..000000000 --- a/rust/src/channel/reimplemented.rs +++ /dev/null @@ -1,510 +0,0 @@ -//! `channel*_*` reimplemented functions. - -use crate::{ - NcAlphaBits, NcChannel, NcChannels, NcComponent, NcPaletteIndex, NcRgb, NCALPHA_BGDEFAULT_MASK, - NCALPHA_BG_PALETTE, NCALPHA_BG_RGB_MASK, NCALPHA_FGDEFAULT_MASK, NCALPHA_FG_PALETTE, - NCALPHA_HIGHCONTRAST, NCALPHA_OPAQUE, NCCHANNEL_ALPHA_MASK, -}; - -// Alpha ----------------------------------------------------------------------- - -/// Gets the [`NcAlphaBits`] from an [`NcChannel`]. -/// -/// *Method: NcChannel.[alpha()][NcChannel#method.alpha]* -#[inline] -pub const fn ncchannel_alpha(channel: NcChannel) -> NcAlphaBits { - channel & NCCHANNEL_ALPHA_MASK -} - -/// Sets the [`NcAlphaBits`] of an [`NcChannel`]. -/// -/// *Method: NcChannel.[set_alpha()][NcChannel#method.set_alpha]* -#[inline] -pub fn ncchannel_set_alpha(channel: &mut NcChannel, alpha: NcAlphaBits) { - let alpha_clean = alpha & NCCHANNEL_ALPHA_MASK; - *channel = alpha_clean | (*channel & !NCCHANNEL_ALPHA_MASK); - - if alpha != NCALPHA_OPAQUE { - // indicate that we are *not* using the default background color - *channel |= NCALPHA_BGDEFAULT_MASK; - } -} - -/// Gets the foreground [`NcAlphaBits`] from an [`NcChannels`], shifted to LSBs. -/// -/// *Method: NcChannels.[fg_alpha()][NcChannels#method.fg_alpha]* -#[inline] -pub const fn ncchannels_fg_alpha(channels: NcChannels) -> NcAlphaBits { - ncchannel_alpha(ncchannels_fchannel(channels)) -} - -/// Gets the background [`NcAlphaBits`] from an [`NcChannels`], shifted to LSBs. -/// -/// *Method: NcChannels.[bg_alpha()][NcChannels#method.bg_alpha]* -#[inline] -pub const fn ncchannels_bg_alpha(channels: NcChannels) -> NcAlphaBits { - ncchannel_alpha(ncchannels_bchannel(channels)) -} - -/// Sets the [`NcAlphaBits`] of the foreground [`NcChannel`] of an [`NcChannels`]. -/// -/// *Method: NcChannels.[set_fg_alpha()][NcChannels#method.set_fg_alpha]* -#[inline] -pub fn ncchannels_set_fg_alpha(channels: &mut NcChannels, alpha: NcAlphaBits) { - let mut channel = ncchannels_fchannel(*channels); - ncchannel_set_alpha(&mut channel, alpha); - *channels = (channel as NcChannels) << 32 | *channels & 0xffffffff_u64; -} - -/// Sets the [`NcAlphaBits`] of the background [`NcChannel`] of an [`NcChannels`]. -/// -/// *Method: NcChannels.[set_bg_alpha()][NcChannels#method.set_bg_alpha]* -#[inline] -pub fn ncchannels_set_bg_alpha(channels: &mut NcChannels, alpha: NcAlphaBits) { - let mut alpha_clean = alpha; - if alpha == NCALPHA_HIGHCONTRAST { - // forbidden for background alpha, so makes it opaque - alpha_clean = NCALPHA_OPAQUE; - } - let mut channel = ncchannels_bchannel(*channels); - ncchannel_set_alpha(&mut channel, alpha_clean); - ncchannels_set_bchannel(channels, channel); -} - -// Channels -------------------------------------------------------------------- - -/// Extracts the background [`NcChannel`] from a [`NcChannels`]. -/// -/// *Method: NcChannels.[bchannel()][NcChannels#method.bchannel]* -#[inline] -pub const fn ncchannels_bchannel(channels: NcChannels) -> NcChannel { - (channels & 0xffffffff_u64) as NcChannel -} - -/// Extracts the foreground [`NcChannel`] from an [`NcChannels`]. -/// -/// *Method: NcChannels.[fchannel()][NcChannels#method.fchannel]* -#[inline] -pub const fn ncchannels_fchannel(channels: NcChannels) -> NcChannel { - ncchannels_bchannel(channels >> 32) -} - -/// Sets the background [`NcChannel`] of an [`NcChannels`]. -/// -/// *Method: NcChannels.[set_bchannel()][NcChannels#method.set_bchannel]* -#[inline] -pub fn ncchannels_set_bchannel(channels: &mut NcChannels, bchannel: NcChannel) -> NcChannels { - *channels = (*channels & 0xffffffff00000000_u64) | bchannel as u64; - *channels -} - -/// Sets the foreground [`NcChannel`] of an [`NcChannels`]. -/// -/// *Method: NcChannels.[set_fchannel()][NcChannels#method.set_fchannel]* -#[inline] -pub fn ncchannels_set_fchannel(channels: &mut NcChannels, fchannel: NcChannel) -> NcChannels { - *channels = (*channels & 0xffffffff_u64) | (fchannel as u64) << 32; - *channels -} - -/// Combines two [`NcChannel`]s into an [`NcChannels`]. -/// -/// *Method: NcChannels.[combine()][NcChannels#method.combine]* -#[inline] -pub fn ncchannels_combine(fchannel: NcChannel, bchannel: NcChannel) -> NcChannels { - let mut channels: NcChannels = 0; - ncchannels_set_fchannel(&mut channels, fchannel); - ncchannels_set_bchannel(&mut channels, bchannel); - channels -} - -// NcComponent --------------------------------------------------------------------- - -/// Gets the red [`NcComponent`] from an [`NcChannel`]. -/// -/// *Method: NcChannel.[r()][NcChannel#method.r]* -#[inline] -pub const fn ncchannel_r(channel: NcChannel) -> NcComponent { - ((channel & 0xff0000) >> 16) as NcComponent -} - -/// Gets the green [`NcComponent`] from an [`NcChannel`]. -/// -/// *Method: NcChannel.[g()][NcChannel#method.g]* -#[inline] -pub const fn ncchannel_g(channel: NcChannel) -> NcComponent { - ((channel & 0x00ff00) >> 8) as NcComponent -} - -/// Gets the blue [`NcComponent`] from an [`NcChannel`]. -/// -/// *Method: NcChannel.[b()][NcChannel#method.b]* -#[inline] -pub const fn ncchannel_b(channel: NcChannel) -> NcComponent { - (channel & 0x0000ff) as NcComponent -} - -/// Sets the red [`NcComponent`] of an [`NcChannel`], and returns it. -/// -/// *Method: NcChannel.[set_r()][NcChannel#method.set_r]* -// -// Not in the C API. -#[inline] -pub fn ncchannel_set_r(channel: &mut NcChannel, r: NcComponent) -> NcChannel { - *channel = (r as NcChannel) << 16 | (*channel & 0xff00) | (*channel & 0xff); - *channel -} - -/// Sets the green [`NcComponent`] of an [`NcChannel`], and returns it. -/// -/// *Method: NcChannel.[set_g()][NcChannel#method.set_g]* -// -// Not in the C API. -#[inline] -pub fn ncchannel_set_g(channel: &mut NcChannel, g: NcComponent) -> NcChannel { - *channel = (*channel & 0xff0000) | (g as NcChannel) << 8 | (*channel & 0xff); - *channel -} - -/// Sets the blue [`NcComponent`] of an [`NcChannel`], and returns it. -/// -/// *Method: NcChannel.[set_b()][NcChannel#method.set_b]* -// -// Not in the C API. -#[inline] -pub fn ncchannel_set_b(channel: &mut NcChannel, b: NcComponent) -> NcChannel { - *channel = (*channel & 0xff0000) | (*channel & 0xff00) | (b as NcChannel); - *channel -} - -/// Gets the three RGB [`NcComponent`]s from an [`NcChannel`], and returns it. -/// -/// *Method: NcChannel.[rgb8()][NcChannel#method.rgb8]* -#[inline] -pub fn ncchannel_rgb8( - channel: NcChannel, - r: &mut NcComponent, - g: &mut NcComponent, - b: &mut NcComponent, -) -> NcChannel { - *r = ncchannel_r(channel); - *g = ncchannel_g(channel); - *b = ncchannel_b(channel); - channel -} - -/// Sets the three RGB [`NcComponent`]s an [`NcChannel`], and marks it as NOT using the -/// "default color", retaining the other bits unchanged. -/// -/// *Method: NcChannel.[set_rgb8()][NcChannel#method.set_rgb8]* -#[inline] -pub fn ncchannel_set_rgb8(channel: &mut NcChannel, r: NcComponent, g: NcComponent, b: NcComponent) { - let rgb: NcRgb = (r as NcChannel) << 16 | (g as NcChannel) << 8 | (b as NcChannel); - *channel = (*channel & !NCALPHA_BG_RGB_MASK) | NCALPHA_BGDEFAULT_MASK | rgb; -} - -/// Gets the three foreground RGB [`NcComponent`]s from an [`NcChannels`], and -/// returns the foreground [`NcChannel`] (which can have some extra bits set). -/// -/// *Method: NcChannels.[fg_rgb8()][NcChannels#method.fg_rgb8]* -#[inline] -pub fn ncchannels_fg_rgb8( - channels: NcChannels, - r: &mut NcComponent, - g: &mut NcComponent, - b: &mut NcComponent, -) -> NcChannel { - ncchannel_rgb8(ncchannels_fchannel(channels), r, g, b) -} - -/// Gets the three background RGB [`NcComponent`]s from an [`NcChannels`], and -/// returns the background [`NcChannel`] (which can have some extra bits set). -/// -/// *Method: NcChannels.[bg_rgb8()][NcChannels#method.bg_rgb8]* -#[inline] -pub fn ncchannels_bg_rgb8( - channels: NcChannels, - r: &mut NcComponent, - g: &mut NcComponent, - b: &mut NcComponent, -) -> NcChannel { - ncchannel_rgb8(ncchannels_bchannel(channels), r, g, b) -} - -/// Sets the three foreground RGB [`NcComponent`]s of an [`NcChannels`], and -/// marks it as NOT using the "default color", retaining the other bits unchanged. -/// -/// Unlike the original C API, it also returns the new NcChannels. -/// -/// *Method: NcChannels.[set_fg_rgb8()][NcChannels#method.set_fg_rgb8]* -#[inline] -pub fn ncchannels_set_fg_rgb8( - channels: &mut NcChannels, - r: NcComponent, - g: NcComponent, - b: NcComponent, -) -> NcChannels { - let mut channel = ncchannels_fchannel(*channels); - ncchannel_set_rgb8(&mut channel, r, g, b); - *channels = (channel as u64) << 32 | *channels & 0xffffffff_u64; - *channels -} - -/// Sets the three background RGB [`NcComponent`]s of an [`NcChannels`], and -/// marks it as NOT using the "default color", retaining the other bits unchanged. -/// -/// Unlike the original C API, it also returns the new NcChannels. -/// -/// *Method: NcChannels.[set_bg_rgb8()][NcChannels#method.set_bg_rgb8]* -#[inline] -pub fn ncchannels_set_bg_rgb8( - channels: &mut NcChannels, - r: NcComponent, - g: NcComponent, - b: NcComponent, -) -> NcChannels { - let mut channel = ncchannels_bchannel(*channels); - ncchannel_set_rgb8(&mut channel, r, g, b); - ncchannels_set_bchannel(channels, channel); - *channels -} - -// NcRgb ----------------------------------------------------------------------- - -/// Gets the foreground [`NcRgb`] from an [`NcChannels`], shifted to LSBs. -/// -/// *Method: NcChannels.[fg_rgb()][NcChannels#method.fg_rgb]* -#[inline] -pub fn ncchannels_fg_rgb(channels: NcChannels) -> NcRgb { - ncchannels_fchannel(channels) & NCALPHA_BG_RGB_MASK -} - -/// Gets the background [`NcRgb`] from an [`NcChannels`], shifted to LSBs. -/// -/// *Method: NcChannels.[bg_rgb()][NcChannels#method.bg_rgb]* -#[inline] -pub fn ncchannels_bg_rgb(channels: NcChannels) -> NcRgb { - ncchannels_bchannel(channels) & NCALPHA_BG_RGB_MASK -} - -/// Gets the [`NcRgb`] of an [`NcChannel`]. -/// -/// This function basically removes the 4th byte of the NcChannel. -/// -/// *Method: NcChannel.[rgb()][NcChannel#method.rgb]* -// -// Not in the C API -#[inline] -pub const fn ncchannel_rgb(channel: NcChannel) -> NcRgb { - channel & NCALPHA_BG_RGB_MASK -} - -/// Sets the [`NcRgb`] of an [`NcChannel`], and marks it as NOT using the -/// "default color", retaining the other bits unchanged. -/// -/// *Method: NcChannel.[set()][NcChannel#method.set]* -#[inline] -pub fn ncchannel_set(channel: &mut NcChannel, rgb: NcRgb) { - *channel = (*channel & !NCALPHA_BG_RGB_MASK) | NCALPHA_BGDEFAULT_MASK | (rgb & 0x00ffffff); -} - -/// Sets the foreground [`NcRgb`] of an [`NcChannels`], and marks it as NOT using -/// the "default color", retaining the other bits unchanged. -/// -/// *Method: NcChannels.[set_fg_rgb()][NcChannels#method.set_fg_rgb]* -#[inline] -pub fn ncchannels_set_fg_rgb(channels: &mut NcChannels, rgb: NcRgb) { - let mut channel = ncchannels_fchannel(*channels); - ncchannel_set(&mut channel, rgb); - *channels = (channel as u64) << 32 | *channels & 0xffffffff_u64; -} - -/// Sets the foreground [`NcRgb`] of an [`NcChannels`], and marks it as NOT using -/// the "default color", retaining the other bits unchanged. -/// -/// *Method: NcChannels.[set_bg_rgb()][NcChannels#method.set_bg_rgb]* -#[inline] -pub fn ncchannels_set_bg_rgb(channels: &mut NcChannels, rgb: NcRgb) { - let mut channel = ncchannels_bchannel(*channels); - ncchannel_set(&mut channel, rgb); - ncchannels_set_bchannel(channels, channel); -} - -// Default --------------------------------------------------------------------- - -/// Is this [`NcChannel`] using the "default color" rather than RGB/palette-indexed? -/// -/// *Method: NcChannel.[default_p()][NcChannel#method.default_p]* -#[inline] -pub const fn ncchannel_default_p(channel: NcChannel) -> bool { - (channel & NCALPHA_BGDEFAULT_MASK) == 0 -} - -/// Marks an [`NcChannel`] as using its "default color", which also marks it opaque. -/// -/// *Method: NcChannel.[set_default()][NcChannel#method.set_default]* -#[inline] -pub fn ncchannel_set_default(channel: &mut NcChannel) -> NcChannel { - *channel &= !(NCALPHA_BGDEFAULT_MASK | NCALPHA_HIGHCONTRAST); - *channel -} - -/// Marks an [`NcChannel`] as NOT using its "default color", -/// retaining the other bits unchanged. -/// -/// *Method: NcChannel.[set_not_default()][NcChannel#method.set_not_default]* -// -// Not in the C API -#[inline] -pub fn ncchannel_set_not_default(channel: &mut NcChannel) -> NcChannel { - *channel |= NCALPHA_BGDEFAULT_MASK; - *channel -} - -/// Is the foreground of an [`NcChannels`] using the "default foreground color"? -/// -/// *Method: NcChannels.[fg_default_p()][NcChannels#method.fg_default_p]* -#[inline] -pub fn ncchannels_fg_default_p(channels: NcChannels) -> bool { - ncchannel_default_p(ncchannels_fchannel(channels)) -} - -/// Is the background using the "default background color"? -/// -/// The "default background color" must generally be used to take advantage of -/// terminal-effected transparency. -/// -/// *Method: NcChannels.[bg_default_p()][NcChannels#method.bg_default_p]* -#[inline] -pub fn ncchannels_bg_default_p(channels: NcChannels) -> bool { - ncchannel_default_p(ncchannels_bchannel(channels)) -} - -/// Marks the foreground of an [`NcChannels`] as using its "default color", -/// which also marks it opaque, and returns the new [`NcChannels`]. -/// -/// *Method: NcChannels.[set_fg_default()][NcChannels#method.set_fg_default]* -#[inline] -pub fn ncchannels_set_fg_default(channels: &mut NcChannels) -> NcChannels { - let mut channel = ncchannels_fchannel(*channels); - ncchannel_set_default(&mut channel); - *channels = (channel as u64) << 32 | *channels & 0xffffffff_u64; - *channels -} - -/// Marks the foreground of an [`NcChannels`] as NOT using its "default color", -/// retaining the other bits unchanged, and returns the new [`NcChannels`]. -/// -/// *Method: NcChannels.[set_fg_not_default()][NcChannels#method.set_fg_not_default]* -// -// Not in the C API -#[inline] -pub fn ncchannels_set_fg_not_default(channels: &mut NcChannels) -> NcChannels { - let mut channel = ncchannels_fchannel(*channels); - ncchannel_set_not_default(&mut channel); - *channels = (channel as u64) << 32 | *channels & 0xffffffff_u64; - *channels -} - -/// Marks the background of an [`NcChannels`] as using its "default color", -/// which also marks it opaque, and returns the new [`NcChannels`]. -/// -/// *Method: NcChannels.[set_bg_default()][NcChannels#method.set_bg_default]* -#[inline] -pub fn ncchannels_set_bg_default(channels: &mut NcChannels) -> NcChannels { - let mut channel = ncchannels_bchannel(*channels); - ncchannel_set_default(&mut channel); - ncchannels_set_bchannel(channels, channel); - *channels -} - -/// Marks the background of an [`NcChannels`] as NOT using its "default color", -/// retaining the other bits unchanged, and returns the new [`NcChannels`]. -/// -/// *Method: NcChannels.[set_bg_not_default()][NcChannels#method.set_bg_not_default]* -// -// Not in the C API -#[inline] -pub fn ncchannels_set_bg_not_default(channels: &mut NcChannels) -> NcChannels { - let mut channel = ncchannels_bchannel(*channels); - ncchannel_set_not_default(&mut channel); - ncchannels_set_bchannel(channels, channel); - *channels -} - -/// Marks both the foreground and background of an [`NcChannels`] as using their -/// "default color", which also marks them opaque, and returns the new [`NcChannels`]. -/// -/// *Method: NcChannels.[set_default()][NcChannels#method.set_default]* -// -// Not in the C API -#[inline] -pub fn ncchannels_set_default(channels: &mut NcChannels) -> NcChannels { - ncchannels_set_bg_default(&mut ncchannels_set_fg_default(channels)) -} - -/// Marks both the foreground and background of an [`NcChannels`] as NOT using their -/// "default color", retaining the other bits unchanged, and returns the new [`NcChannels`]. -/// -/// *Method: NcChannels.[set_not_default()][NcChannels#method.set_not_default]* -// -// Not in the C API -#[inline] -pub fn ncchannels_set_not_default(channels: &mut NcChannels) -> NcChannels { - ncchannels_set_bg_not_default(&mut ncchannels_set_fg_not_default(channels)) -} - -// Palette --------------------------------------------------------------------- - -/// Is this [`NcChannel`] using palette-indexed color rather than RGB? -/// -/// *Method: NcChannel.[palindex_p()][NcChannel#method.palindex_p]* -#[inline] -pub fn ncchannel_palindex_p(channel: NcChannel) -> bool { - !(ncchannel_default_p(channel) && (channel & NCALPHA_BG_PALETTE) == 0) -} - -/// Is the foreground of an [`NcChannels`] using an [indexed][`NcPaletteIndex`] -/// [`NcPalette`][crate::NcPalette] color? -/// -/// *Method: NcChannels.[fg_palindex_p()][NcChannels#method.fg_palindex_p]* -#[inline] -pub fn ncchannels_fg_palindex_p(channels: NcChannels) -> bool { - ncchannel_palindex_p(ncchannels_fchannel(channels)) -} - -/// Is the background of an [`NcChannels`] using an [indexed][`NcPaletteIndex`] -/// [`NcPalette`][crate::NcPalette] color? -/// -/// *Method: NcChannels.[bg_palindex_p()][NcChannels#method.bg_palindex_p]* -#[inline] -pub fn ncchannels_bg_palindex_p(channels: NcChannels) -> bool { - ncchannel_palindex_p(ncchannels_bchannel(channels)) -} - -/// Sets the foreground of an [`NcChannels`] as using an -/// [indexed][`NcPaletteIndex`] [`NcPalette`][crate::NcPalette] color. -/// -/// *Method: NcChannels.[set_fg_palindex()][NcChannels#method.set_fg_palindex]* -#[inline] -#[allow(clippy::unnecessary_cast)] -pub fn ncchannels_set_fg_palindex(channels: &mut NcChannels, index: NcPaletteIndex) { - *channels |= NCALPHA_FGDEFAULT_MASK; - *channels |= NCALPHA_FG_PALETTE as NcChannels; - ncchannels_set_fg_alpha(channels, NCALPHA_OPAQUE); - *channels &= 0xff000000ffffffff as NcChannels; - *channels |= (index as NcChannels) << 32; -} - -/// Sets the background of an [`NcChannels`] as using an -/// [indexed][`NcPaletteIndex`] [`NcPalette`][crate::NcPalette] color. -/// -/// *Method: NcChannels.[set_bg_palindex()][NcChannels#method.set_bg_palindex]* -#[inline] -pub fn ncchannels_set_bg_palindex(channels: &mut NcChannels, index: NcPaletteIndex) { - *channels |= NCALPHA_BGDEFAULT_MASK as NcChannels; - *channels |= NCALPHA_BG_PALETTE as NcChannels; - ncchannels_set_bg_alpha(channels, NCALPHA_OPAQUE); - *channels &= 0xffffffffff000000; - *channels |= index as NcChannels; -} diff --git a/rust/src/channel/test/methods.rs b/rust/src/channel/test/methods.rs deleted file mode 100644 index 595a4fbe8..000000000 --- a/rust/src/channel/test/methods.rs +++ /dev/null @@ -1,10 +0,0 @@ -//! Test `NcChannel*` methods and associated functions. - -// use crate::{NcChannel, NcChannels}; -// -// use serial_test::serial; -// -// #[test] -// #[serial] -// fn () { -// } diff --git a/rust/src/channel/test/mod.rs b/rust/src/channel/test/mod.rs deleted file mode 100644 index 99466243e..000000000 --- a/rust/src/channel/test/mod.rs +++ /dev/null @@ -1,7 +0,0 @@ -//! `NcChannel*` tests. - -#[cfg(test)] -mod methods; - -#[cfg(test)] -mod reimplemented; diff --git a/rust/src/channel/test/reimplemented.rs b/rust/src/channel/test/reimplemented.rs deleted file mode 100644 index fd3ca380d..000000000 --- a/rust/src/channel/test/reimplemented.rs +++ /dev/null @@ -1,226 +0,0 @@ -//! Test `channel*_*` reimplemented functions. - -use serial_test::serial; - -use crate::{ - NcChannel, NcChannels, NCALPHA_BLEND, NCALPHA_HIGHCONTRAST, NCALPHA_OPAQUE, NCALPHA_TRANSPARENT, -}; - -// NcChannel tests ------------------------------------------------------------- - -/// retrieves the red NcComponent component -#[test] -#[serial] -fn channel_r() { - let c: NcChannel = 0x112233; - assert_eq!(crate::ncchannel_r(c), 0x11); -} - -/// retrieves the green NcComponent component -#[test] -#[serial] -fn channel_g() { - let c: NcChannel = 0x112233; - assert_eq!(crate::ncchannel_g(c), 0x22); -} - -/// retrieves the blue NcComponent component -#[test] -#[serial] -fn channel_b() { - let c: NcChannel = 0x112233; - assert_eq!(crate::ncchannel_b(c), 0x33); -} - -/// writes out the three RGB NcComponent components -#[test] -#[serial] -fn channel_rgb8() { - let c: NcChannel = 0x112233; - let mut r = 0; - let mut g = 0; - let mut b = 0; - crate::ncchannel_rgb8(c, &mut r, &mut g, &mut b); - assert_eq!(r, 0x11); - assert_eq!(g, 0x22); - assert_eq!(b, 0x33); -} - -/// sets the three RGB NcComponent components -#[test] -#[serial] -fn channel_set_rgb8() { - let mut c = 0x000000; - // by default it uses the default color - assert_eq!(true, crate::ncchannel_default_p(c)); - - crate::ncchannel_set_rgb8(&mut c, 0x11, 0x22, 0x33); - - assert_eq!(crate::ncchannel_r(c), 0x11); - assert_eq!(crate::ncchannel_g(c), 0x22); - assert_eq!(crate::ncchannel_b(c), 0x33); - - // now it shoud be marked as NOT using the default color - assert_eq!(false, crate::ncchannel_default_p(c)); -} - -/// sets the NcRGB color components -#[test] -#[serial] -fn channel_set() { - let mut c = 0x000000; - // by default it uses the default color - assert_eq!(true, crate::ncchannel_default_p(c)); - - crate::ncchannel_set(&mut c, 0x112233); - println!("\n {:08x}", c); // DEBUG - - assert_eq!(crate::ncchannel_r(c), 0x11); - assert_eq!(crate::ncchannel_g(c), 0x22); - assert_eq!(crate::ncchannel_b(c), 0x33); - - // now it shoud be marked as NOT using the default color - assert_eq!(false, crate::ncchannel_default_p(c)); -} - -/// gets the alpha component -#[test] -#[serial] -fn channel_alpha() { - let c: NcChannel = 0x112233; - assert_ne!(crate::ncchannel_alpha(c), NCALPHA_TRANSPARENT); - - let c: NcChannel = 0x112233 | NCALPHA_TRANSPARENT; - assert_eq!(crate::ncchannel_alpha(c), NCALPHA_TRANSPARENT); -} - -/// sets the alpha component -#[test] -#[serial] -fn channel_set_alpha() { - let mut c: NcChannel = 0x112233; - crate::ncchannel_set_alpha(&mut c, NCALPHA_HIGHCONTRAST); - assert_eq!(NCALPHA_HIGHCONTRAST, crate::ncchannel_alpha(c)); - - crate::ncchannel_set_alpha(&mut c, NCALPHA_TRANSPARENT); - assert_eq!(NCALPHA_TRANSPARENT, crate::ncchannel_alpha(c)); - - crate::ncchannel_set_alpha(&mut c, NCALPHA_BLEND); - assert_eq!(NCALPHA_BLEND, crate::ncchannel_alpha(c)); - - crate::ncchannel_set_alpha(&mut c, NCALPHA_OPAQUE); - assert_eq!(NCALPHA_OPAQUE, crate::ncchannel_alpha(c)); - // TODO: CHECK for NCALPHA_BGDEFAULT_MASK -} - -/// sets the channel as using the default color -#[test] -#[serial] -fn channel_set_default() { - let channel = 0x_00_112233; - // By default a channel uses the default color, if the proper bit isn't set - assert_eq!(true, crate::ncchannel_default_p(channel)); - - // If we change it from being opaque... - let mut channel_transp = channel | NCALPHA_TRANSPARENT; - assert_eq!(0x_20_112233, channel_transp); // the transparent bit is now set - - crate::ncchannel_set_not_default(&mut channel_transp); - // both the "not default" & transparent bits are now set - assert_eq!(0x_60_112233, channel_transp); - - // and calling set_default() should make it both default & opaque again - assert_eq!( - 0x_00_112233, - crate::ncchannel_set_default(&mut channel_transp) - ); -} - -/// sets the channel as *not* using the default color -// -// more functions that marks as NOT using the default color: -// - channel_set() -// - channel_set_rgb8() -#[test] -#[serial] -fn channel_set_not_default() { - let mut channel = 0x_00_112233; - // By default a channel uses the default color, if the proper bit isn't set - assert_eq!(true, crate::ncchannel_default_p(channel)); - - // marking it as NOT using the default color - crate::ncchannel_set_not_default(&mut channel); - assert_eq!(0x_40_112233, channel); // check the "not default" bit is set - assert_eq!(false, crate::ncchannel_default_p(channel)); -} - -/// checks whether the channel is using the default color -#[test] -#[serial] -fn channel_default_p() { - let mut c: NcChannel = 0x112233; - assert_eq!(true, crate::ncchannel_default_p(c)); - - let _ = crate::ncchannel_set_alpha(&mut c, NCALPHA_OPAQUE); - assert_eq!(true, crate::ncchannel_default_p(c)); - - crate::ncchannel_set(&mut c, 0x112233); - assert_eq!(false, crate::ncchannel_default_p(c)); -} - -// NcChannels tests --------------------------------------------------------- - -/// -#[test] -#[serial] -#[allow(non_snake_case)] -fn channels_set_fchannel__channels_fchannel() { - let fc: NcChannel = 0x112233; - let mut cp: NcChannels = 0; - crate::ncchannels_set_fchannel(&mut cp, fc); - assert_eq!(crate::ncchannels_fchannel(cp), fc); -} - -/// -#[test] -#[serial] -#[allow(non_snake_case)] -fn channels_set_bchannel__channels_bchannel() { - let bc: NcChannel = 0x112233; - let mut cp: NcChannels = 0; - crate::ncchannels_set_bchannel(&mut cp, bc); - assert_eq!(crate::ncchannels_bchannel(cp), bc); -} - -/// -#[test] -#[serial] -fn channels_combine() { - let bc: NcChannel = 0x112233; - let fc: NcChannel = 0x445566; - let mut cp1: NcChannels = 0; - let mut _cp2: NcChannels = 0; - crate::ncchannels_set_bchannel(&mut cp1, bc); - crate::ncchannels_set_fchannel(&mut cp1, fc); - _cp2 = crate::ncchannels_combine(fc, bc); - assert_eq!(cp1, _cp2); -} - -/// -#[test] -#[serial] -fn channels_palette() { - let bc: NcChannel = 0x112233; - let fc: NcChannel = 0x445566; - assert_eq!(false, crate::ncchannel_palindex_p(bc)); - assert_eq!(false, crate::ncchannel_palindex_p(fc)); - - let mut channels = crate::ncchannels_combine(fc, bc); - assert_eq!(false, crate::ncchannels_fg_palindex_p(channels)); - assert_eq!(false, crate::ncchannels_bg_palindex_p(channels)); - - crate::ncchannels_set_fg_palindex(&mut channels, 5); - crate::ncchannels_set_bg_palindex(&mut channels, 6); - assert_eq!(true, crate::ncchannels_fg_palindex_p(channels)); - assert_eq!(true, crate::ncchannels_bg_palindex_p(channels)); -} diff --git a/rust/src/dimension.rs b/rust/src/dimension.rs deleted file mode 100644 index 61f4622c3..000000000 --- a/rust/src/dimension.rs +++ /dev/null @@ -1,7 +0,0 @@ -//! `NcDim`, `NcOffset` - -/// Represents a dimension in rows or columns. Can't be negative. -pub type NcDim = u32; - -/// Represents an offset in rows or columns. Can be negative. -pub type NcOffset = i32; diff --git a/rust/src/direct/methods.rs b/rust/src/direct/methods.rs deleted file mode 100644 index 5a77a45fd..000000000 --- a/rust/src/direct/methods.rs +++ /dev/null @@ -1,767 +0,0 @@ -//! `NcDirect` methods and associated functions. - -use core::ptr::{null, null_mut}; - -use crate::{ - cstring, error, error_ref_mut, rstring, NcAlign, NcBlitter, NcCapabilities, NcChannels, - NcComponent, NcDim, NcDirect, NcDirectFlags, NcError, NcInput, NcOffset, NcPaletteIndex, - NcPlane, NcResult, NcRgb, NcScale, NcStyle, NcTime, NCRESULT_ERR, -}; - -/// # `NcDirect` constructors and destructors -impl NcDirect { - /// New NcDirect with the default options. - /// - /// Initializes a direct-mode notcurses context on the tty. - /// - /// Direct mode supports a limited subset of notcurses routines, - /// and neither supports nor requires - /// [notcurses_render()][crate::notcurses_render]. This can be used to add - /// color and styling to text in the standard output paradigm. - /// - /// *C style function: [ncdirect_init()][crate::ncdirect_init].* - pub fn new<'a>() -> NcResult<&'a mut NcDirect> { - Self::with_flags(0) - } - - /// New NcDirect with optional flags. - /// - /// `flags` is a bitmask over: - /// - [NCDIRECT_OPTION_INHIBIT_CBREAK][crate::NCDIRECT_OPTION_INHIBIT_CBREAK] - /// - [NCDIRECT_OPTION_INHIBIT_SETLOCALE][crate::NCDIRECT_OPTION_INHIBIT_SETLOCALE] - /// - [NCDIRECT_OPTION_NO_QUIT_SIGHANDLERS][crate::NCDIRECT_OPTION_NO_QUIT_SIGHANDLERS] - /// - [NCDIRECT_OPTION_VERBOSE][crate::NCDIRECT_OPTION_VERBOSE] - /// - [NCDIRECT_OPTION_VERY_VERBOSE][crate::NCDIRECT_OPTION_VERY_VERBOSE] - /// - /// *C style function: [ncdirect_init()][crate::ncdirect_init].* - pub fn with_flags<'a>(flags: NcDirectFlags) -> NcResult<&'a mut NcDirect> { - let res = unsafe { crate::ncdirect_init(null(), null_mut(), flags) }; - error_ref_mut![res, "Initializing NcDirect"] - } - - /// Releases this NcDirect and any associated resources. - /// - /// *C style function: [ncdirect_stop()][crate::ncdirect_stop].* - pub fn stop(&mut self) -> NcResult<()> { - error![unsafe { crate::ncdirect_stop(self) }, "NcDirect.stop()"] - } -} - -/// ## NcDirect methods: clear, flush, render -impl NcDirect { - /// Clears the screen. - /// - /// *C style function: [ncdirect_clear()][crate::ncdirect_clear].* - pub fn clear(&mut self) -> NcResult<()> { - error![unsafe { crate::ncdirect_clear(self) }, "NcDirect.clear()"] - } - - /// Forces a flush. - /// - /// *C style function: [ncdirect_flush()][crate::ncdirect_flush].* - pub fn flush(&self) -> NcResult<()> { - error![unsafe { crate::ncdirect_flush(self) }, "NcDirect.clear()"] - } - - /// Takes the result of [`render_frame`][NcDirect#method.render_frame] - /// and writes it to the output. - /// - /// *C style function: [ncdirect_raster_frame()][crate::ncdirect_raster_frame].* - pub fn raster_frame(&mut self, frame: &mut NcPlane, align: NcAlign) -> NcResult<()> { - error![ - unsafe { crate::ncdirect_raster_frame(self, frame, align) }, - "NcDirect.raster_frame()" - ] - } - - /// Renders an image using the specified blitter and scaling, - /// but doesn't write the result. - /// - /// The image may be arbitrarily many rows -- the output will scroll -- - /// but will only occupy the column of the cursor, and those to the right. - /// - /// To actually write (and free) this, invoke ncdirect_raster_frame(). - /// - /// `max_y' and 'max_x` (cell geometry, *not* pixel), if greater than 0, - /// are used for scaling; the terminal's geometry is otherwise used. - /// - /// *C style function: [ncdirect_render_frame()][crate::ncdirect_render_frame].* - pub fn render_frame<'a>( - &mut self, - filename: &str, - blitter: NcBlitter, - scale: NcScale, - max_y: NcDim, - max_x: NcDim, - ) -> NcResult<&'a mut NcPlane> { - let res = unsafe { - crate::ncdirect_render_frame( - self, - cstring![filename], - blitter, - scale, - max_y as i32, - max_x as i32, - ) - }; - error_ref_mut![ - res, - &format!( - "NcDirect.render_frame({:?}, {:?}, {:?})", - filename, blitter, scale - ) - ] - } - - /// Displays an image using the specified blitter and scaling. - /// - /// The image may be arbitrarily many rows -- the output will scroll -- but - /// will only occupy the column of the cursor, and those to the right. - /// - /// The render/raster process can be split by using - /// [render_frame()][#method.render_frame] and - /// [raster_frame()][#method.raster_frame]. - /// - /// *C style function: [ncdirect_render_image()][crate::ncdirect_render_image].* - pub fn render_image( - &mut self, - filename: &str, - align: NcAlign, - blitter: NcBlitter, - scale: NcScale, - ) -> NcResult<()> { - error![ - unsafe { - crate::ncdirect_render_image(self, cstring![filename], align, blitter, scale) - }, - &format!( - "NcDirect.render_image({:?}, {:?}, {:?}, {:?})", - filename, align, blitter, scale - ) - ] - } -} - -/// ## NcDirect methods: `NcPaletteIndex`, `NcRgb`, `NcStyle` & default color -impl NcDirect { - /// Sets the foreground [NcPaletteIndex]. - /// - /// *C style function: [ncdirect_set_fg_palindex()][crate::ncdirect_set_fg_palindex].* - pub fn set_fg_palindex(&mut self, index: NcPaletteIndex) -> NcResult<()> { - error![ - unsafe { crate::ncdirect_set_fg_palindex(self, index as i32) }, - &format!("NcDirect.set_fg_palindex({})", index) - ] - } - - /// Sets the background [NcPaletteIndex]. - /// - /// *C style function: [ncdirect_set_bg_palindex()][crate::ncdirect_set_bg_palindex].* - pub fn set_bg_palindex(&mut self, index: NcPaletteIndex) -> NcResult<()> { - error![ - unsafe { crate::ncdirect_set_bg_palindex(self, index as i32) }, - &format!("NcDirect.set_fg_palindex({})", index) - ] - } - - /// Returns the number of simultaneous colors claimed to be supported, - /// if there is color support. - /// - /// Note that several terminal emulators advertise more colors than they - /// actually support, downsampling internally. - /// - /// *C style function: [ncdirect_palette_size()][crate::ncdirect_palette_size].* - pub fn palette_size(&self) -> NcResult { - let res = unsafe { crate::ncdirect_palette_size(self) }; - if res == 1 { - return Err(NcError::with_msg( - 1, - "No color support ← NcDirect.palette_size()", - )); - } - Ok(res) - } - - /// Sets the foreground [NcRgb]. - /// - /// *C style function: [ncdirect_set_fg_rgb()][crate::ncdirect_set_fg_rgb].* - pub fn set_fg_rgb(&mut self, rgb: NcRgb) -> NcResult<()> { - error![ - unsafe { crate::ncdirect_set_fg_rgb(self, rgb) }, - &format!("NcDirect.set_fg_rgb({})", rgb) - ] - } - - /// Sets the background [NcRgb]. - /// - /// *C style function: [ncdirect_set_bg_rgb()][crate::ncdirect_set_bg_rgb].* - pub fn set_bg_rgb(&mut self, rgb: NcRgb) -> NcResult<()> { - error![ - unsafe { crate::ncdirect_set_bg_rgb(self, rgb) }, - &format!("NcDirect.set_bg_rgb({})", rgb) - ] - } - - /// Sets the foreground [NcComponent] components. - /// - /// *C style function: [ncdirect_set_fg_rgb8()][crate::ncdirect_set_fg_rgb8].* - pub fn set_fg_rgb8( - &mut self, - red: NcComponent, - green: NcComponent, - blue: NcComponent, - ) -> NcResult<()> { - error![ - crate::ncdirect_set_fg_rgb8(self, red, green, blue), - &format!("NcDirect.set_fg_rgb8({}, {}, {})", red, green, blue) - ] - } - - /// Sets the background [NcComponent] components. - /// - /// *C style function: [ncdirect_set_bg_rgb()][crate::ncdirect_set_bg_rgb].* - pub fn set_bg_rgb8( - &mut self, - red: NcComponent, - green: NcComponent, - blue: NcComponent, - ) -> NcResult<()> { - error![ - crate::ncdirect_set_bg_rgb8(self, red, green, blue), - &format!("NcDirect.set_bg_rgb8({}, {}, {})", red, green, blue) - ] - } - - /// Removes the specified styles. - /// - /// *C style function: [ncdirect_off_styles()][crate::ncdirect_off_styles].* - pub fn styles_off(&mut self, stylebits: NcStyle) -> NcResult<()> { - error![ - unsafe { crate::ncdirect_off_styles(self, stylebits.into()) }, - &format!("NcDirect.styles_off({:0X})", stylebits) - ] - } - - /// Adds the specified styles. - /// - /// *C style function: [ncdirect_on_styles()][crate::ncdirect_on_styles].* - pub fn styles_on(&mut self, stylebits: NcStyle) -> NcResult<()> { - error![ - unsafe { crate::ncdirect_on_styles(self, stylebits.into()) }, - &format!("NcDirect.styles_on({:0X})", stylebits) - ] - } - - /// Sets just the specified styles. - /// - /// *C style function: [ncdirect_set_styles()][crate::ncdirect_set_styles].* - pub fn styles_set(&mut self, stylebits: NcStyle) -> NcResult<()> { - error![ - unsafe { crate::ncdirect_set_styles(self, stylebits.into()) }, - &format!("NcDirect.styles_set({:0X})", stylebits) - ] - } - - /// Indicates to use the "default color" for the foreground. - /// - /// *C style function: [ncdirect_set_fg_default()][crate::ncdirect_set_fg_default].* - pub fn set_fg_default(&mut self) -> NcResult<()> { - error![ - unsafe { crate::ncdirect_set_fg_default(self) }, - "NcDirect.set_fg_default()" - ] - } - - /// Indicates to use the "default color" for the background. - /// - /// *C style function: [ncdirect_set_bg_default()][crate::ncdirect_set_bg_default].* - pub fn set_bg_default(&mut self) -> NcResult<()> { - error![ - unsafe { crate::ncdirect_set_bg_default(self) }, - "NcDirect.set_bg_default()" - ] - } -} - -/// ## NcDirect methods: capabilities, cursor, dimensions -impl NcDirect { - /// Is there support for acquiring the cursor's current position? - /// - /// Requires the u7 terminfo capability, and that we are connected to an - /// actual terminal. - pub fn canget_cursor(&self) -> bool { - unsafe { crate::ncdirect_canget_cursor(self) } - } - - /// Can we reliably use Unicode braille? - /// - /// *C style function: [ncdirect_canbraille()][crate::ncdirect_canbraille].* - pub fn canbraille(&self) -> bool { - crate::ncdirect_canbraille(self) - } - - /// Can we set the "hardware" palette? - /// - /// Requires the "ccc" terminfo capability. - /// - /// *C style function: [ncdirect_canchangecolor()][crate::ncdirect_canchangecolor].* - pub fn canchangecolor(&self) -> bool { - crate::ncdirect_canchangecolor(self) - } - - /// Can we fade? - /// - /// Requires either the "rgb" or "ccc" terminfo capability. - /// - /// *C style function: [ncdirect_canfade()][crate::ncdirect_canfade].* - pub fn canfade(&self) -> bool { - crate::ncdirect_canfade(self) - } - - /// Can we reliably use Unicode halfblocks? - /// - /// *C style function: [ncdirect_canhalfblock()][crate::ncdirect_canhalfblock].* - pub fn canhalfblock(&self) -> bool { - crate::ncdirect_canhalfblock(self) - } - - /// Can we load images? - /// - /// Requires being built against FFmpeg/OIIO. - /// - /// *C style function: [ncdirect_canopen_images()][crate::ncdirect_canopen_images].* - pub fn canopen_images(&self) -> bool { - unsafe { crate::ncdirect_canopen_images(self) } - } - - /// Can we load videos? - /// - /// Requires being built against FFmpeg/OIIO. - /// - /// *C style function: [ncdirect_canopen_videos()][crate::ncdirect_canopen_videos].* - pub fn canopen_videos(&self) -> bool { - crate::ncdirect_canopen_videos(self) - } - - /// Can we reliably use Unicode quadrants? - /// - /// *C style function: [ncdirect_canquadrant()][crate::ncdirect_canquadrant].* - pub fn canquadrant(&self) -> bool { - crate::ncdirect_canquadrant(self) - } - - /// Can we reliably use Unicode sextants? - /// - /// *C style function: [ncdirect_cansextant()][crate::ncdirect_cansextant].* - pub fn cansextant(&self) -> bool { - crate::ncdirect_cansextant(self) - } - - /// Can we directly specify RGB values per cell, or only use palettes? - /// - /// *C style function: [ncdirect_cantruecolor()][crate::ncdirect_cantruecolor].* - pub fn cantruecolor(&self) -> bool { - crate::ncdirect_cantruecolor(self) - } - - /// Is our encoding UTF-8? - /// - /// Requires LANG being set to a UTF8 locale. - /// - /// *C style function: [ncdirect_canutf8()][crate::ncdirect_canutf8].* - pub fn canutf8(&self) -> bool { - unsafe { crate::ncdirect_canutf8(self) } - } - - /// Returns the [`NcCapabilities`]. - /// - /// *C style function: [ncdirect_capabilities()][crate::ncdirect_capabilities].* - pub fn capabilities(&self) -> NcCapabilities { - crate::ncdirect_capabilities(self) - } - - /// Checks for pixel support. - /// - /// Returns `false` for no support, or `true` if pixel output is supported. - /// - /// This function must successfully return before NCBLIT_PIXEL is available. - /// - /// Must not be called concurrently with either input or rasterization. - /// - /// *C style function: [ncdirect_check_pixel_support()][crate::ncdirect_check-pixel_support].* - #[allow(clippy::wildcard_in_or_patterns)] - pub fn check_pixel_support(&self) -> NcResult { - let res = unsafe { crate::ncdirect_check_pixel_support(self) }; - match res { - 0 => Ok(false), - 1 => Ok(true), - NCRESULT_ERR | _ => Err(NcError::with_msg(res, "NcDirect.check_pixel_support()")), - } - } - - /// Disables the terminal's cursor, if supported. - /// - /// *C style function: [ncdirect_cursor_disable()][crate::ncdirect_cursor_disable].* - pub fn cursor_disable(&mut self) -> NcResult<()> { - error![ - unsafe { crate::ncdirect_cursor_disable(self) }, - "NcDirect.cursor_disable()" - ] - } - - /// Enables the terminal's cursor, if supported. - /// - /// *C style function: [ncdirect_cursor_enable()][crate::ncdirect_cursor_enable].* - pub fn cursor_enable(&mut self) -> NcResult<()> { - error![ - unsafe { crate::ncdirect_cursor_enable(self) }, - "NcDirect.cursor_enable()" - ] - } - - /// Moves the cursor down any number of rows. - /// - /// *C style function: [ncdirect_cursor_down()][crate::ncdirect_cursor_down].* - pub fn cursor_down(&mut self, rows: NcOffset) -> NcResult<()> { - error![ - unsafe { crate::ncdirect_cursor_down(self, rows as i32) }, - &format!("NcDirect.cursor_down({})", rows) - ] - } - - /// Moves the cursor left any number of columns. - /// - /// *C style function: [ncdirect_cursor_left()][crate::ncdirect_cursor_left].* - pub fn cursor_left(&mut self, cols: NcOffset) -> NcResult<()> { - error![ - unsafe { crate::ncdirect_cursor_left(self, cols as i32) }, - &format!("NcDirect.cursor_left({})", cols) - ] - } - - /// Moves the cursor right any number of columns. - /// - /// *C style function: [ncdirect_cursor_right()][crate::ncdirect_cursor_right].* - pub fn cursor_right(&mut self, cols: NcOffset) -> NcResult<()> { - error![ - unsafe { crate::ncdirect_cursor_right(self, cols as i32) }, - &format!("NcDirect.cursor_right({})", cols) - ] - } - - /// Moves the cursor up any number of rows. - /// - /// *C style function: [ncdirect_cursor_up()][crate::ncdirect_cursor_up].* - pub fn cursor_up(&mut self, rows: NcOffset) -> NcResult<()> { - error![ - unsafe { crate::ncdirect_cursor_up(self, rows as i32) }, - &format!("NcDirect.cursor_up({})", rows) - ] - } - - /// Sets the cursor to the specified row `y`, column `x`. - /// - /// *C style function: [ncdirect_cursor_move_yx()][crate::ncdirect_cursor_move_yx].* - pub fn cursor_set_yx(&mut self, y: NcDim, x: NcDim) -> NcResult<()> { - error![unsafe { crate::ncdirect_cursor_move_yx(self, y as i32, x as i32) }] - } - - /// Sets the cursor to the specified row `y`. - /// - /// *(No equivalent C style function)* - pub fn cursor_set_y(&mut self, y: NcDim) -> NcResult<()> { - error![unsafe { crate::ncdirect_cursor_move_yx(self, y as i32, -1) }] - } - - /// Sets the cursor to the specified column `x`. - /// - /// *(No equivalent C style function)* - pub fn cursor_set_x(&mut self, x: NcDim) -> NcResult<()> { - error![unsafe { crate::ncdirect_cursor_move_yx(self, -1, x as i32) }] - } - - /// Gets the cursor (y, x) position, when supported. - /// - /// This requires writing to the terminal, and then reading from it. - /// If the terminal doesn't reply, or doesn't reply in a way we understand, - /// the results might be detrimental. - /// - /// *C style function: [ncdirect_cursor_yx()][crate::ncdirect_cursor_yx].* - pub fn cursor_yx(&mut self) -> NcResult<(NcDim, NcDim)> { - let (mut y, mut x) = (0, 0); - error![ - unsafe { crate::ncdirect_cursor_yx(self, &mut y, &mut x) }, - "", - (y as NcDim, x as NcDim) - ] - } - - /// Pushes the cursor location to the terminal's stack. - /// - /// The depth of this stack, and indeed its existence, is terminal-dependent. - /// - /// *C style function: [ncdirect_cursor_push()][crate::ncdirect_cursor_push].* - pub fn cursor_push(&mut self) -> NcResult<()> { - error![unsafe { crate::ncdirect_cursor_push(self) }] - } - - /// Pops the cursor location from the terminal's stack. - /// - /// The depth of this stack, and indeed its existence, is terminal-dependent. - /// - /// *C style function: [ncdirect_cursor_pop()][crate::ncdirect_cursor_pop].* - pub fn cursor_pop(&mut self) -> NcResult<()> { - error![unsafe { crate::ncdirect_cursor_pop(self) }] - } - - /// Gets the current number of rows. - /// - /// *C style function: [ncdirect_dim_y()][crate::ncdirect_dim_y].* - pub fn dim_y(&mut self) -> NcDim { - unsafe { crate::ncdirect_dim_y(self) as NcDim } - } - - /// Gets the current number of columns. - /// - /// *C style function: [ncdirect_dim_x()][crate::ncdirect_dim_x].* - pub fn dim_x(&mut self) -> NcDim { - unsafe { crate::ncdirect_dim_x(self) as NcDim } - } - - /// Gets the current number of rows and columns. - /// - /// *C style function: [ncdirect_dim_y()][crate::ncdirect_dim_y].* - pub fn dim_yx(&mut self) -> (NcDim, NcDim) { - let y = unsafe { crate::ncdirect_dim_y(self) as NcDim }; - let x = unsafe { crate::ncdirect_dim_x(self) as NcDim }; - (y, x) - } - - /// Returns the name of the detected terminal. - /// - /// *C style function: [ncdirect_detected_terminal()][crate::ncdirect_detected_terminal].* - pub fn detected_terminal(&self) -> String { - rstring![crate::ncdirect_detected_terminal(self)].to_string() - } -} - -/// ## NcDirect methods: I/O -impl NcDirect { - /// Returns a [char] representing a single unicode point. - /// - /// If an event is processed, the return value is the `id` field from that - /// event. - /// - /// Provide a None `time` to block at length, a `time` of 0 for non-blocking - /// operation, and otherwise a timespec to bound blocking. - /// - /// *C style function: [ncdirect_getc()][crate::ncdirect_getc].* - // - // CHECK returns 0 on a timeout. - pub fn getc(&mut self, time: Option, input: Option<&mut NcInput>) -> NcResult { - let ntime; - if let Some(time) = time { - ntime = &time as *const _; - } else { - ntime = null(); - } - let ninput; - if let Some(input) = input { - ninput = input as *mut _; - } else { - ninput = null_mut(); - } - let c = unsafe { core::char::from_u32_unchecked(crate::ncdirect_get(self, ntime, ninput)) }; - if c as u32 as i32 == NCRESULT_ERR { - return Err(NcError::new()); - } - Ok(c) - } - - /// - /// *C style function: [ncdirect_getc_nblock()][crate::ncdirect_getc_nblock].* - pub fn getc_nblock(&mut self, input: &mut NcInput) -> char { - crate::ncdirect_getc_nblock(self, input) - } - - /// - /// *C style function: [ncdirect_getc_blocking()][crate::ncdirect_getc_blocking].* - pub fn getc_blocking(&mut self, input: &mut NcInput) -> char { - crate::ncdirect_getc_blocking(self, input) - } - - /// Get a file descriptor suitable for input event poll()ing. - /// - /// When this descriptor becomes available, you can call - /// [getc_nblock()][NcDirect#method.getc_nblock], and input ought be ready. - /// - /// This file descriptor is not necessarily the file descriptor associated - /// with stdin (but it might be!). - /// - /// *C style function: [ncdirect_inputready_fd()][crate::ncdirect_inputready_fd].* - pub fn inputready_fd(&mut self) -> NcResult<()> { - error![unsafe { crate::ncdirect_inputready_fd(self) }] - } - - /// Outputs the `string` according to the `channels`, and - /// returns the total number of characters written on success. - /// - /// Note that it does not explicitly flush output buffers, so it will not - /// necessarily be immediately visible. - /// - /// It will fail if the NcDirect context and the foreground channel - /// are both marked as using the default color. - /// - /// *C style function: [ncdirect_putstr()][crate::ncdirect_putstr].* - pub fn putstr(&mut self, channels: NcChannels, string: &str) -> NcResult<()> { - error![ - unsafe { crate::ncdirect_putstr(self, channels, cstring![string]) }, - &format!("NcDirect.putstr({:0X}, {:?})", channels, string) - ] - } - - /// Reads a (heap-allocated) line of text using the Readline library. - /// - /// Initializes Readline the first time it's called. - /// - /// For input to be echoed to the terminal, it is necessary that the flag - /// [NCDIRECT_OPTION_INHIBIT_CBREAK][crate::NCDIRECT_OPTION_INHIBIT_CBREAK] - /// be provided to the constructor. - /// - /// *C style function: [ncdirect_readline()][crate::ncdirect_readline].* - pub fn readline(&mut self, prompt: &str) -> NcResult<&str> { - let res = unsafe { crate::ncdirect_readline(self, cstring![prompt]) }; - if !res.is_null() { - return Ok(rstring![res]); - } else { - Err(NcError::with_msg( - NCRESULT_ERR, - &format!["NcDirect.readline({})", prompt], - )) - } - } - - /// Draws a box with its upper-left corner at the current cursor position, - /// having dimensions `ylen` * `xlen`. - /// - /// See NcPlane.[box()][NcPlane#method.box] for more information. - /// - /// The minimum box size is 2x2, and it cannot be drawn off-screen. - /// - /// `wchars` is an array of 6 characters: UL, UR, LL, LR, HL, VL. - /// - /// *C style function: [ncdirect_box()][crate::ncdirect_box].* - // TODO: CHECK, specially wchars. - pub fn r#box( - &mut self, - ul: NcChannels, - ur: NcChannels, - ll: NcChannels, - lr: NcChannels, - wchars: &[char; 6], - y_len: NcDim, - x_len: NcDim, - ctlword: u32, - ) -> NcResult<()> { - error![ - unsafe { - let wchars = core::mem::transmute(wchars); - crate::ncdirect_box( - self, - ul, - ur, - ll, - lr, - wchars, - y_len as i32, - x_len as i32, - ctlword, - ) - }, - &format!( - "NcDirect.box({:0X}, {:0X}, {:0X}, {:0X}, {:?}, {}, {}, {})", - ul, ur, ll, lr, wchars, y_len, x_len, ctlword - ) - ] - } - - /// NcDirect.[box()][NcDirect#method.box] with the double box-drawing characters. - /// - /// *C style function: [ncdirect_double_box()][crate::ncdirect_double_box].* - pub fn double_box( - &mut self, - ul: NcChannels, - ur: NcChannels, - ll: NcChannels, - lr: NcChannels, - y_len: NcDim, - x_len: NcDim, - ctlword: u32, - ) -> NcResult<()> { - error![unsafe { - crate::ncdirect_double_box(self, ul, ur, ll, lr, y_len as i32, x_len as i32, ctlword) - }] - } - - /// NcDirect.[box()][NcDirect#method.box] with the rounded box-drawing characters. - /// - /// *C style function: [ncdirect_rounded_box()][crate::ncdirect_rounded_box].* - pub fn rounded_box( - &mut self, - ul: NcChannels, - ur: NcChannels, - ll: NcChannels, - lr: NcChannels, - y_len: NcDim, - x_len: NcDim, - ctlword: u32, - ) -> NcResult<()> { - error![unsafe { - crate::ncdirect_rounded_box(self, ul, ur, ll, lr, y_len as i32, x_len as i32, ctlword) - }] - } - - /// Draws horizontal lines using the specified [NcChannels]s, interpolating - /// between them as we go. - /// - /// All lines start at the current cursor position. - /// - /// The string at `egc` may not use more than one column. - /// - /// For a horizontal line, `len` cannot exceed the screen width minus the - /// cursor's offset. - /// - /// *C style function: [ncdirect_hline_interp()][crate::ncdirect_hline_interp].* - #[inline] - pub fn hline_interp( - &mut self, - egc: &str, - len: NcDim, - h1: NcChannels, - h2: NcChannels, - ) -> NcResult<()> { - error![crate::ncdirect_hline_interp(self, egc, len, h1, h2)] - } - - /// Draws horizontal lines using the specified [NcChannels]s, interpolating - /// between them as we go. - /// - /// All lines start at the current cursor position. - /// - /// The string at `egc` may not use more than one column. - /// - /// For a vertical line, `len` may be as long as you'd like; the screen - /// will scroll as necessary. - /// - /// *C style function: [ncdirect_vline_interp()][crate::ncdirect_vline_interp].* - #[inline] - pub fn vline_interp( - &mut self, - egc: &str, - len: NcDim, - h1: NcChannels, - h2: NcChannels, - ) -> NcResult<()> { - error![crate::ncdirect_vline_interp(self, egc, len, h1, h2)] - } -} diff --git a/rust/src/direct/mod.rs b/rust/src/direct/mod.rs deleted file mode 100644 index 68d9c328e..000000000 --- a/rust/src/direct/mod.rs +++ /dev/null @@ -1,125 +0,0 @@ -//! `NcDirect` - -// total: 62 -// --------------------------------------------------- -// (X) 1 : wont do -// (~) 3 : TODO / WIP -// -// (f) 46 : unsafe ffi function exported by bindgen -// (w) 1 : safely wrapped ffi function -// (r) 11 : static function manually reimplemented -// -// (m) 55 : method implemented -// -// (t) 0 : unit test done for the function -// (T) 0 : unit test done also for the method -// --------------------------------------------------- -// fm ncdirect_bg_default -// fm ncdirect_bg_palindex -// fm ncdirect_bg_rgb -// fm ncdirect_box -// rm ncdirect_canbraille -// rm ncdirect_canchangecolor -// fm ncdirect_canget_cursor -// rm ncdirect_canfade -// rm ncdirect_canhalfblock -// fm ncdirect_canopen_images -// rm ncdirect_canopen_videos -// rm ncdirect_canquadrant -// rm ncdirect_cantruecolor -// fm ncdirect_canutf8 -// wm ncdirect_capabilities -// fm ncdirect_check_pixel_support -// fm ncdirect_clear -//~f ncdirect_core_init -// fm ncdirect_cursor_disable -// fm ncdirect_cursor_down -// fm ncdirect_cursor_enable -// fm ncdirect_cursor_left -// fm ncdirect_cursor_move_yx -// fm ncdirect_cursor_pop -// fm ncdirect_cursor_push -// fm ncdirect_cursor_right -// fm ncdirect_cursor_up -// fm ncdirect_cursor_yx -// fm ncdirect_detected_terminal -// fm ncdirect_dim_x -// fm ncdirect_dim_y -// fm ncdirect_double_box -// fm ncdirect_fg_default -// fm ncdirect_fg_palindex -// fm ncdirect_fg_rgb -// fm ncdirect_flush -// fm ncdirect_getc -//~r ncdirect_heavy_box, -// fm ncdirect_hline_interp -// fm ncdirect_init -// fm ncdirect_inputready_fd -//~r ncdirect_light_box, -// fm ncplane_on_styles -// fm ncplane_off_styles -// fm ncdirect_palette_size -//X ncdirect_printf_aligned -// fm ncdirect_putstr -// fm ncdirect_raster_frame -// fm ncdirect_readline -// fm ncdirect_render_frame -// fm ncdirect_render_image -// fm ncdirect_rounded_box -// fm ncplane_set_styles -// fm ncdirect_stop -// f ncdirect_stream -// f ncdirect_styles -// f ncdirect_supported_styles -// fm ncdirect_vline_interp -// rm ncdirect_bg_rgb8 -// rm ncdirect_fg_rgb8 -// rm ncdirect_getc_nblock -// rm ncdirect_getc_nblocking - -#[cfg(test)] -mod test; - -mod methods; -mod reimplemented; - -pub use reimplemented::*; - -/// Minimal notcurses instance for styling text. -pub type NcDirect = crate::bindings::ffi::ncdirect; - -/// Flags (options) for [`NcDirect`] -pub type NcDirectFlags = u64; - -/// Flag that avoids placing the terminal into cbreak mode -/// (disabling echo and line buffering) -/// -pub const NCDIRECT_OPTION_INHIBIT_CBREAK: NcDirectFlags = - crate::bindings::ffi::NCDIRECT_OPTION_INHIBIT_CBREAK as NcDirectFlags; - -/// Flag that avoids calling setlocale(LC_ALL, NULL) -/// -/// If the result is either "C" or "POSIX", it will print a -/// diagnostic to stderr, and then call setlocale(LC_ALL, ""). -/// -/// This will attempt to set the locale based off the LANG -/// environment variable. Your program should call setlocale(3) -/// itself, usually as one of the first lines. -/// -pub const NCDIRECT_OPTION_INHIBIT_SETLOCALE: NcDirectFlags = - crate::bindings::ffi::NCDIRECT_OPTION_INHIBIT_SETLOCALE as NcDirectFlags; - -/// Flag that inhibits registration of the SIGINT, SIGSEGV, SIGABRT & SIGQUIT -/// signal handlers. -pub const NCDIRECT_OPTION_NO_QUIT_SIGHANDLERS: NcDirectFlags = - crate::bindings::ffi::NCDIRECT_OPTION_NO_QUIT_SIGHANDLERS as NcDirectFlags; - -/// Flag that enables showing detailed information. -pub const NCDIRECT_OPTION_VERBOSE: NcDirectFlags = - crate::bindings::ffi::NCDIRECT_OPTION_VERBOSE as NcDirectFlags; - -/// Flag that enables showing all diagnostics (equivalent to -/// [`NCLOGLEVEL_TRACE`][crate::NCLOGLEVEL_TRACE]). -/// Implies [`NCDIRECT_OPTION_VERBOSE`]. -pub const NCDIRECT_OPTION_VERY_VERBOSE: NcDirectFlags = - crate::bindings::ffi::NCDIRECT_OPTION_VERY_VERBOSE as NcDirectFlags; diff --git a/rust/src/direct/reimplemented.rs b/rust/src/direct/reimplemented.rs deleted file mode 100644 index d8a80b6e8..000000000 --- a/rust/src/direct/reimplemented.rs +++ /dev/null @@ -1,169 +0,0 @@ -//! `ncdirect_*` reimplemented functions. - -use core::ptr::null; - -use crate::{ - cstring, NcCapabilities, NcChannels, NcComponent, NcDim, NcDirect, NcInput, NcIntResult, NcRgb, - NcTime, -}; - -/// Can we directly specify RGB values per cell, or only use palettes? -#[inline] -pub fn ncdirect_cantruecolor(ncd: &NcDirect) -> bool { - ncdirect_capabilities(ncd).rgb -} - -/// Can we set the "hardware" palette? Requires the "ccc" terminfo capability. -#[inline] -pub fn ncdirect_canchangecolor(ncd: &NcDirect) -> bool { - crate::nccapability_canchangecolor(&ncdirect_capabilities(ncd)) -} - -/// Can we fade? Fading requires either the "rgb" or "ccc" terminfo capability. -#[inline] -pub fn ncdirect_canfade(ncd: &NcDirect) -> bool { - ncdirect_canchangecolor(ncd) || ncdirect_cantruecolor(ncd) -} - -/// Can we load videos? This requires being built against FFmpeg. -#[inline] -pub fn ncdirect_canopen_videos(_ncd: &NcDirect) -> bool { - unsafe { crate::notcurses_canopen_videos(null()) } -} - -/// Can we reliably use Unicode halfblocks? -#[inline] -pub fn ncdirect_canhalfblock(ncd: &NcDirect) -> bool { - unsafe { crate::ncdirect_canutf8(ncd) } -} - -/// Can we reliably use Unicode quadrants? -#[inline] -pub fn ncdirect_canquadrant(ncd: &NcDirect) -> bool { - (unsafe { crate::ncdirect_canutf8(ncd) }) && ncdirect_capabilities(ncd).quadrants -} - -/// Can we reliably use Unicode 13 sextants? -#[inline] -pub fn ncdirect_cansextant(ncd: &NcDirect) -> bool { - (unsafe { crate::ncdirect_canutf8(ncd) }) && ncdirect_capabilities(ncd).sextants -} - -/// Can we reliably use Unicode Braille? -#[inline] -pub fn ncdirect_canbraille(_ncd: &NcDirect) -> bool { - unsafe { crate::notcurses_canbraille(null()) } -} - -/// Returns the detected [`NcCapabilities`]. -#[inline] -pub fn ncdirect_capabilities(ncd: &NcDirect) -> NcCapabilities { - unsafe { *crate::bindings::ffi::ncdirect_capabilities(ncd) } -} - -/// 'input' may be NULL if the caller is uninterested in event details. -/// Blocks until an event is processed or a signal is received. -/// -/// *Method: NcDirect.[getc_blocking()][NcDirect#method.getc_blocking].* -// TODO: use from_u32 & return Option. -#[inline] -pub fn ncdirect_getc_blocking(ncd: &mut NcDirect, input: &mut NcInput) -> char { - unsafe { core::char::from_u32_unchecked(crate::ncdirect_get(ncd, null(), input)) } -} - -/// -/// If no event is ready, returns 0. -/// -/// *Method: NcDirect.[getc_nblock()][NcDirect#method.getc_nblock].* -// -// `input` may be NULL if the caller is uninterested in event details. -#[inline] -pub fn ncdirect_getc_nblock(ncd: &mut NcDirect, input: &mut NcInput) -> char { - unsafe { - let ts = NcTime::new(); - core::char::from_u32_unchecked(crate::ncdirect_get(ncd, &ts, input)) - } -} - -/// Sets the foreground [NcComponent] components. -/// -/// *Method: NcDirect.[set_fg_rgb8()][NcDirect#method.set_fg_rgb8].* -#[inline] -pub fn ncdirect_set_fg_rgb8( - ncd: &mut NcDirect, - red: NcComponent, - green: NcComponent, - blue: NcComponent, -) -> NcIntResult { - let rgb = (red as NcRgb) << 16 | (green as NcRgb) << 8 | blue as NcRgb; - unsafe { crate::ncdirect_set_fg_rgb(ncd, rgb) } -} - -/// Sets the background [NcComponent] components. -/// -/// *Method: NcDirect.[set_bg_rgb8()][NcDirect#method.set_bg_rgb8].* -#[inline] -pub fn ncdirect_set_bg_rgb8( - ncd: &mut NcDirect, - red: NcComponent, - green: NcComponent, - blue: NcComponent, -) -> NcIntResult { - let rgb = (red as NcRgb) << 16 | (green as NcRgb) << 8 | blue as NcRgb; - unsafe { crate::ncdirect_set_bg_rgb(ncd, rgb) } -} - -/// Draws horizontal lines using the specified [NcChannels]s, interpolating -/// between them as we go. -/// -/// The string at `egc` may not use more than one column. -/// -/// All lines start at the current cursor position. -/// -/// For a horizontal line, `len` cannot exceed the screen width minus the -/// cursor's offset. -// TODO:MAYBE saturate the `len` value -/// -/// *Method: NcDirect.[hline_interp()][NcDirect#method.hline_interp].* -#[inline] -pub fn ncdirect_hline_interp( - ncd: &mut NcDirect, - egc: &str, - len: NcDim, - h1: NcChannels, - h2: NcChannels, -) -> NcIntResult { - #[cfg(any(target_arch = "armv7l", target_arch = "i686"))] - let egc_ptr = cstring![egc] as *const i8; - #[cfg(not(any(target_arch = "armv7l", target_arch = "i686")))] - let egc_ptr = cstring![egc]; - - unsafe { crate::bindings::ffi::ncdirect_hline_interp(ncd, egc_ptr, len as i32, h1, h2) } -} - -/// Draws horizontal lines using the specified [NcChannels]s, interpolating -/// between them as we go. -/// -/// The string at `egc` may not use more than one column. -/// -/// All lines start at the current cursor position. -/// -/// For a vertical line, `len` may be as long as you'd like; the screen -/// will scroll as necessary. -/// -/// *Method: NcDirect.[vline_interp()][NcDirect#method.vline_interp].* -#[inline] -pub fn ncdirect_vline_interp( - ncd: &mut NcDirect, - egc: &str, - len: NcDim, - h1: NcChannels, - h2: NcChannels, -) -> NcIntResult { - #[cfg(any(target_arch = "armv7l", target_arch = "i686"))] - let egc_ptr = cstring![egc] as *const i8; - #[cfg(not(any(target_arch = "armv7l", target_arch = "i686")))] - let egc_ptr = cstring![egc]; - - unsafe { crate::bindings::ffi::ncdirect_vline_interp(ncd, egc_ptr, len as i32, h1, h2) } -} diff --git a/rust/src/direct/test/mod.rs b/rust/src/direct/test/mod.rs deleted file mode 100644 index 8b1378917..000000000 --- a/rust/src/direct/test/mod.rs +++ /dev/null @@ -1 +0,0 @@ - diff --git a/rust/src/error.rs b/rust/src/error.rs deleted file mode 100644 index 3b2dbb907..000000000 --- a/rust/src/error.rs +++ /dev/null @@ -1,80 +0,0 @@ -//! Error handling with `Error`, `NcResult` & `NcIntResult` for error handling - -use std::{self, error, fmt}; - -/// The [`i32`] value used to return errors by the underlying C API. -/// -/// A value < 0 means error, (usually -1). -/// -/// # Defined constants: -/// -/// - [`NCRESULT_OK`] -/// - [`NCRESULT_ERR`] -/// - [`NCRESULT_MAX`] -pub type NcIntResult = i32; - -/// OK value, for the functions that return [`NcIntResult`]. -pub const NCRESULT_OK: i32 = 0; - -/// ERROR value, for the functions that return an [`NcIntResult`]. -pub const NCRESULT_ERR: i32 = -1; - -/// MAX value, for the functions that return [`NcIntResult`]. -pub const NCRESULT_MAX: i32 = i32::MAX; - -/// The error type for the Rust methods API. -#[derive(Debug, Clone, Default)] -pub struct NcError { - /// [NcIntResult]. - pub int: i32, - pub msg: String, -} - -impl fmt::Display for NcError { - fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { - write!(f, "NcError {}: {}", self.int, self.msg) - } -} - -impl error::Error for NcError { - fn description(&self) -> &str { - &self.msg - } -} - -impl NcError { - /// New NcError with default [NCRESULT_ERR] error number, and without message. - pub fn new() -> Self { - Self { - int: NCRESULT_ERR, - ..Default::default() - } - } - - /// New NcError with custom error number, and without message. - pub fn new_err(int: NcIntResult) -> Self { - Self { - int, - ..Default::default() - } - } - - /// New NcError with default [NCRESULT_ERR] error number and a custom message. - pub fn new_msg(msg: &str) -> Self { - Self { - int: NCRESULT_ERR, - msg: msg.to_string(), - } - } - - /// New NcError with both a custom error number and a custom message. - pub fn with_msg(int: NcIntResult, msg: &str) -> Self { - Self { - int, - msg: msg.to_string(), - } - } -} - -/// The result type for the Rust methods API. -pub type NcResult = Result; diff --git a/rust/src/fade.rs b/rust/src/fade.rs deleted file mode 100644 index 1f76c045b..000000000 --- a/rust/src/fade.rs +++ /dev/null @@ -1,49 +0,0 @@ -//! `NcFadeCb` & `NcFadeCtx` - -// functions already exported by bindgen : 3 -// ------------------------------------------- -// (#) test: 0 -// (W) wrap: 3 / 0 -// ------------------------------------------- -//W ncfadectx_free -//W ncfadectx_iterations -//W ncfadectx_setup - -use std::ffi::c_void; - -use crate::{Nc, NcIntResult, NcPlane, NcTime}; - -/// Called for each fade iteration on the NcPlane. -/// -/// If anything but 0 is returned, the fading operation ceases immediately, -/// and that value is propagated out. -/// -/// The recommended absolute display time target is passed in 'tspec'. -pub type NcFadeCb = - Option NcIntResult>; - -/// Context for a palette fade operation -pub type NcFadeCtx = crate::bindings::ffi::ncfadectx; - -impl NcFadeCtx { - /// NcFadeCtx constructor. - /// - /// Rather than the simple ncplane_fade{in/out}(), - /// ncfadectx_setup() can be paired with a loop over - /// ncplane_fade{in/out}_iteration() + ncfadectx_free(). - pub fn setup(plane: &mut NcPlane) -> &mut NcFadeCtx { - unsafe { &mut *crate::ncfadectx_setup(plane) } - } - - /// Releases the resources associated. - pub fn free(&mut self) { - unsafe { - crate::ncfadectx_free(self); - } - } - - /// Returns the number of iterations through which will fade. - pub fn iterations(&self) -> u32 { - unsafe { crate::ncfadectx_iterations(self) as u32 } - } -} diff --git a/rust/src/fd/methods.rs b/rust/src/fd/methods.rs deleted file mode 100644 index c89e674ba..000000000 --- a/rust/src/fd/methods.rs +++ /dev/null @@ -1,366 +0,0 @@ -//! `NcVisual*` methods and associated functions. - -use core::ptr::null_mut; -use libc::c_void; - -use crate::{ - // cstring, error, error_ref_mut, rstring, NcBlitter, NcDim, NcError, NcIntResult, NcPixel, - // NcPlane, NcResult, NcRgba, NcScale, NcTime, NcVisual, NcVisualOptions, Notcurses, NCBLIT_PIXEL, - // NCRESULT_ERR, -}; - -/// # NcVisualOptions Constructors -impl NcSubprocOptions { - - /// - pub fn new( - curry: *mut c_void, - restart_period: u64, - // flags: u64, - ) -> Self { - Self { - curry:, - // restart this many seconds after an exit (watch) - restart_period, - // bitfield over NCOPTION_SUBPROC_* (none yet) - flags: 0, - } - } -} - -/// # NcSubproc Constructors & Destructors -impl NcSubproc { - /// Opens a visual at `file`, extracts the codec and parameters and - /// decodes the first image to memory. - /// - /// *C style function: [ncvisual_from_file()][crate::ncvisual_from_file].* - pub fn new<'a>(file: &str) -> NcResult<&'a mut NcVisual> { - error_ref_mut![ - unsafe { crate::ncvisual_from_file(cstring![file]) }, - &format!("NcVisual::from_file()") - ] - } - - /// Promotes an NcPlane to an NcVisual. - /// - /// The plane may contain only spaces, half blocks, and full blocks. - /// This will be checked, and any other glyph will result in an error. - /// - /// This function exists so that planes can be subjected to NcVisual transformations. - /// If possible, it's better to create the ncvisual from memory using - /// [from_rgba][NcVisual#method.from_rgba]. - /// - /// *C style function: [ncvisual_from_plane()][crate::ncvisual_from_plane].* - pub fn from_plane<'a>( - plane: &NcPlane, - blitter: NcBlitter, - beg_y: NcDim, - beg_x: NcDim, - len_y: NcDim, - len_x: NcDim, - ) -> NcResult<&'a mut NcVisual> { - error_ref_mut![ - unsafe { - crate::ncvisual_from_plane( - plane, - blitter, - beg_y as i32, - beg_x as i32, - len_y as i32, - len_x as i32, - ) - }, - &format!("NcVisual::from_file()") - ] - } - - /// Prepares an NcVisual, and its underlying NcPlane, based off RGBA content - /// in memory at `rgba`. - /// - /// `rgba` is laid out as `rows` lines, each of which is `rowstride` bytes in length. - /// Each line has `cols` 32-bit 8bpc RGBA pixels followed by possible padding - /// (there will be rowstride - cols * 4 bytes of padding). - /// - /// The total size of `rgba` is thus (rows * rowstride) bytes, of which - /// (rows * cols * 4) bytes are actual non-padding data. - /// - /// *C style function: [ncvisual_from_rgba()][crate::ncvisual_from_rgba].* - pub fn from_rgba<'a>( - rgba: &[u8], - rows: NcDim, - rowstride: NcDim, - cols: NcDim, - ) -> NcResult<&'a mut NcVisual> { - error_ref_mut![ - unsafe { - crate::ncvisual_from_rgba( - rgba.as_ptr() as *const c_void, - rows as i32, - rowstride as i32, - cols as i32, - ) - }, - &format!("NcVisual::from_rgba()") - ] - } - - /// Destroys this NcVisual. - /// - /// Rendered elements will not be disrupted, but the visual can be neither - /// decoded nor rendered any further. - /// - /// *C style function: [ncvisual_destroy()][crate::ncvisual_destroy].* - pub fn destroy(&mut self) { - unsafe { crate::ncvisual_destroy(self) } - } -} - -/// # NcVisual Methods -impl NcVisual { - /// Gets the specified pixel from this NcVisual. - /// - /// *C style function: [ncvisual_at_yx()][crate::ncvisual_at_yx].* - pub fn at_yx(&self, y: NcDim, x: NcDim) -> NcResult { - let mut pixel = 0; - let res = unsafe { crate::ncvisual_at_yx(self, y as i32, x as i32, &mut pixel) }; - error![res, "NcVisual.at_yx()", pixel] - } - - /// Extracts the next frame from the NcVisual. - /// - /// Returns 0 for normal frames, and 1 to indicate EOF. - /// - /// *C style function: [ncvisual_decode()][crate::ncvisual_decode].* - pub fn decode(&mut self) -> NcResult { - let res = unsafe { crate::ncvisual_decode(self) }; - if res == NCRESULT_ERR { - return Err(NcError::with_msg(res, "NcVisual.decode()")); - } else { - Ok(res) - } - } - - /// Extracts the next frame from the NcVisual, ala [decode][NcVisual#method.decode], - /// but if we have reached the end, rewinds to the first frame. - /// - /// *A subsequent [NcVisual.render]() will render the first frame, - /// as if the ncvisual had been closed and reopened.* - /// - /// Returns 0 for normal frames and 1 to indicate EOF. - /// - /// *C style function: [ncvisual_decode_loop()][crate::ncvisual_decode_loop].* - pub fn decode_loop(&mut self) -> NcResult { - let res = unsafe { crate::ncvisual_decode_loop(self) }; - if res == NCRESULT_ERR { - return Err(NcError::with_msg(res, "NcVisual.decode_loop()")); - } else { - Ok(res) - } - } - - /// Inflates each pixel in the image to 'scale'x'scale' pixels. - /// - /// The original color is retained. - pub fn inflate(&mut self, scale: u32) -> NcResult { - let res = unsafe { crate::ncvisual_inflate(self, scale as i32) }; - error![res, &format!["NcVisual.inflate({})", scale], res] - } - - /// Gets the size and ratio of NcVisual pixels to output cells along the - /// `y→to_y` and `x→to_x` axes. - /// - /// Returns a tuple with (y, x, to_y, to_x) - /// - /// An NcVisual of `y` by `x` pixels will require - /// (`y` * `to_y`) by (`x` * `to_x`) cells for full output. - /// - /// Errors on invalid blitter in `options`. Scaling is taken into consideration. - /// - /// *C style function: [ncvisual_blitter_geom()][crate::ncvisual_blitter_geom].* - pub fn geom( - &self, - nc: &Notcurses, - options: &NcVisualOptions, - ) -> NcResult<(NcDim, NcDim, NcDim, NcDim)> { - let mut y = 0; - let mut x = 0; - let mut to_y = 0; - let mut to_x = 0; - - let res = unsafe { - crate::ncvisual_blitter_geom( - nc, - self, - options, - &mut y, - &mut x, - &mut to_y, - &mut to_x, - null_mut(), - ) - }; - error![ - res, - "NcVisual.geom()", - (y as NcDim, x as NcDim, to_y as NcDim, to_x as NcDim) - ]; - } - - /// Gets the default media (not plot) blitter for this environment when using - /// the specified scaling method. - /// - /// Currently, this means: - /// - if lacking UTF-8, NCBLIT_1x1. - /// - otherwise, if not NCSCALE_STRETCH, NCBLIT_2x1. - /// - otherwise, if sextants are not known to be good, NCBLIT_2x2. - /// - otherwise NCBLIT_3x2 NCBLIT_2x2 and NCBLIT_3x2 both distort the original - /// aspect ratio, thus NCBLIT_2x1 is used outside of NCSCALE_STRETCH. - /// - /// *C style function: [ncvisual_media_defblitter()][crate::ncvisual_media_defblitter].* - pub fn media_defblitter(nc: &Notcurses, scale: NcScale) -> NcBlitter { - unsafe { crate::ncvisual_media_defblitter(nc, scale) } - } - - /// Polyfills at the specified location using `rgba`. - /// - /// *C style function: [ncvisual_polyfill_yx()][crate::ncvisual_polyfill_yx].* - pub fn polyfill_yx(&mut self, y: NcDim, x: NcDim, rgba: NcRgba) -> NcResult<()> { - error![ - unsafe { crate::ncvisual_polyfill_yx(self, y as i32, x as i32, rgba) }, - &format!["NcVisual.polyfill_yx({}, {}, {})", y, x, rgba] - ] - } - - /// Renders the decoded frame to the specified [NcPlane]. - /// - /// See [`NcVisualOptions`]. - /// - /// *C style function: [ncvisual_render()][crate::ncvisual_render].* - pub fn render( - &mut self, - nc: &mut Notcurses, - options: &NcVisualOptions, - ) -> NcResult<&mut NcPlane> { - error_ref_mut![ - unsafe { crate::ncvisual_render(nc, self, options) }, - "NcVisual.render()" - ] - } - - /// Resizes the visual to `rows` X `columns` pixels. - /// - /// This is a lossy transformation, unless the size is unchanged. - /// - /// *C style function: [ncvisual_resize()][crate::ncvisual_resize].* - pub fn resize(&mut self, rows: NcDim, cols: NcDim) -> NcResult<()> { - error![ - unsafe { crate::ncvisual_resize(self, rows as i32, cols as i32) }, - &format!["NcVisual.resize({}, {})", rows, cols] - ] - } - - /// Rotates the visual `rads` radians. - /// - /// Only M_PI/2 and -M_PI/2 are supported at the moment, - /// but this will change. (FIXME) - /// - /// *C style function: [ncvisual_rotate()][crate::ncvisual_rotate].* - pub fn rotate(&mut self, rads: f64) -> NcResult<()> { - error![ - unsafe { crate::ncvisual_rotate(self, rads) }, - &format!["NcVisual.rotate({})", rads] - ] - } - - /// Sets the specified pixel. - /// - /// *C style function: [ncvisual_set_yx()][crate::ncvisual_set_yx].* - pub fn set_yx(&mut self, y: NcDim, x: NcDim, pixel: NcPixel) -> NcResult<()> { - error![ - unsafe { crate::ncvisual_set_yx(self, y as i32, x as i32, pixel) }, - &format!["NcVisual.set_yx({}, {}, {})", y, x, pixel] - ] - } - - /// Displays frames. - /// - /// *Provide as an argument to ncvisual_stream().* - /// - /// If you'd like subtitles to be decoded, provide an ncplane as the curry. - /// If the curry is NULL, subtitles will not be displayed. - /// - /// *C style function: [ncvisual_simple_streamer()][crate::ncvisual_simple_streamer].* - pub fn simple_streamer( - &mut self, - options: &mut NcVisualOptions, - time: &NcTime, - curry: Option<&mut NcPlane>, - ) -> NcResult<()> { - if let Some(plane) = curry { - error![ - unsafe { - crate::ncvisual_simple_streamer( - self, - options, - time, - plane as *mut _ as *mut libc::c_void, - ) - }, - &format![ - "NcVisual.simple_streamer({:?}, {:?}, ncplane)", - options, time - ] - ] - } else { - error![ - unsafe { crate::ncvisual_simple_streamer(self, options, time, null_mut()) }, - &format!["NcVisual.simple_streamer({:?}, {:?}, null)", options, time] - ] - } - } - - // // TODO - // - // /// Streams the entirety of the media, according to its own timing. - // /// - // /// Blocking, obviously. - // /// - // /// If `streamer` is provided it will be called for each frame, and its return - // /// value handled as outlined for streamcb. - // /// If streamer() returns non-zero, the stream is aborted, and that value is - // /// returned. By convention, return a positive number to indicate intentional - // /// abort from within streamer(). - // /// - // /// `timescale` allows the frame duration time to be scaled. - // /// For a visual naturally running at 30FPS, a 'timescale' of 0.1 will result - // /// in 300 FPS, and a `timescale` of 10 will result in 3 FPS. - // /// It is an error to supply `timescale` less than or equal to 0. - // /// - // /// *C style function: [ncvisual_streamer()][crate::ncvisual_streamer].* - // // - // // TODO: add streamcb - // // INFO: QUESTION: is curry also optional like in simple_streamer? - // // - // pub fn simple_streamer( - // &mut self, - // nc: &mut Notcurses, - // timescale: f32, - // //streamer: Option - // options: &NcVisualOptions, - // curry: Option<&mut NcPlane>, - // ) -> NcResult<()> { - // } - - /// If a subtitle ought be displayed at this time, returns a heap-allocated - /// copy of the UTF8 text. - /// - /// *C style function: [ncvisual_subtitle()][crate::ncvisual_subtitle].* - pub fn subtitle(&self) -> NcResult<&str> { - let res = unsafe { crate::ncvisual_subtitle(self) }; - if res != null_mut() { - return Ok(rstring![res]); - } else { - Err(NcError::with_msg(NCRESULT_ERR, "NcVisual.subtitle()")) - } - } -} diff --git a/rust/src/file.rs b/rust/src/file.rs deleted file mode 100644 index dfd61de26..000000000 --- a/rust/src/file.rs +++ /dev/null @@ -1,335 +0,0 @@ -//! Wrapper for `libc::FILE`, both as used by notcurses and the libc crate -//! -//! The interface is largely based on the implementation of the -//! [cfile-rs crate](https://github.com/jkarns275/cfile) by Joshua Karns - -use core::ptr::{null_mut, NonNull}; - -use std::io::{Error, ErrorKind, Read, Seek, SeekFrom}; - -use libc::{ - c_long, c_void, fclose, /* feof, */ fread, fseek, ftell, SEEK_CUR, SEEK_END, SEEK_SET, -}; - -/// See [NcFile]. Notcurses functions expects this type of `*FILE` (a struct) -#[allow(clippy::upper_case_acronyms)] -pub type FILE_NC = crate::ffi::FILE; - -/// See [NcFile]. The [`libc`](https://docs.rs/libc/) crate expects this type -/// of `*FILE` (an opaque enum) -#[allow(clippy::upper_case_acronyms)] -pub type FILE_LIBC = libc::FILE; - -// TODO: the following static strings aren't made public - -/// Intended to be passed into the CFile::open method. -/// It will open the file in a way that will allow reading and writing, -/// including overwriting old data. -/// It will not create the file if it does not exist. -pub static RANDOM_ACCESS_MODE: &str = "rb+"; - -/// Intended to be passed into the CFile::open method. -/// It will open the file in a way that will allow reading and writing, -/// including overwriting old data -pub static UPDATE: &str = "rb+"; - -/// Intended to be passed into the CFile::open method. -/// It will only allow reading. -pub static READ_ONLY: &str = "r"; - -/// Intended to be passed into the CFile::open method. -/// It will only allow writing. -pub static WRITE_ONLY: &str = "w"; - -/// Intended to be passed into the CFile::open method. -/// It will only allow data to be appended to the end of the file. -pub static APPEND_ONLY: &str = "a"; - -/// Intended to be passed into the CFile::open method. -/// It will allow data to be appended to the end of the file, and data to be -/// read from the file. It will create the file if it doesn't exist. -pub static APPEND_READ: &str = "a+"; - -/// Intended to be passed into the CFile::open method. -/// It will open the file in a way that will allow reading and writing, -/// including overwriting old data. It will create the file if it doesn't exist -pub static TRUNCATE_RANDOM_ACCESS_MODE: &str = "wb+"; - -/// A utility function to pull the current value of errno and put it into an -/// Error::Errno -fn get_error() -> Result { - Err(Error::last_os_error()) -} - -/// A wrapper struct around -/// [`libc::FILE`](https://docs.rs/libc/0.2.80/libc/enum.FILE.html) -/// -/// The notcurses `FILE` type [`FILE_NC`] a struct imported through bindgen, -/// while the equivalent [`libc`](https://docs.rs/libc) crate FILE -/// ([`FILE_LIBC`]) is an opaque enum. -/// -/// Several methods are provided to cast back and forth between both types, -/// in order to allow both rust libc operations and notcurses file operations -/// over the same underlying `*FILE`. -#[derive(Debug)] -pub struct NcFile { - file_ptr: NonNull, -} - -impl NcFile { - // constructors -- - - /// `NcFile` constructor from a file produced by notcurses - pub fn from_nc(file: *mut FILE_NC) -> Self { - NcFile { - file_ptr: unsafe { NonNull::new_unchecked(NcFile::nc2libc(file)) }, - } - } - - /// `NcFile` constructor from a file produced by the libc crate - #[allow(clippy::missing_safety_doc)] - pub unsafe fn from_libc(file: *mut FILE_LIBC) -> Self { - NcFile { - file_ptr: NonNull::new_unchecked(file), - } - } - - // methods -- - - /// Returns the file pointer in the format expected by the [`libc`] crate - #[inline] - pub fn as_libc_ptr(&self) -> *mut FILE_LIBC { - self.file_ptr.as_ptr() - } - - /// Returns the file pointer in the format expected by notcurses - #[inline] - pub fn as_nc_ptr(&self) -> *mut FILE_NC { - Self::libc2nc(self.file_ptr.as_ptr()) - } - - /// Returns the current position in the file. - /// - /// On error `Error::Errno(errno)` is returned. - pub fn current_pos(&self) -> Result { - unsafe { - let pos = ftell(self.as_libc_ptr()); - if pos != -1 { - Ok(pos as u64) - } else { - get_error() - } - } - } - - /// Reads the file from start to end. Convenience method - /// - #[inline] - pub fn read_all(&mut self, buf: &mut Vec) -> Result { - let _ = self.seek(SeekFrom::Start(0)); - self.read_to_end(buf) - } - - // private methods -- - - /// Converts a file pointer from the struct notcurses uses to the - /// opaque enum type libc expects - #[inline] - fn nc2libc(file: *mut FILE_NC) -> *mut FILE_LIBC { - file as *mut _ as *mut FILE_LIBC - } - - /// Converts a file pointer from the libc opaque enum format to the struct - /// expected by notcurses - #[inline] - fn libc2nc(file: *mut FILE_LIBC) -> *mut FILE_NC { - file as *mut _ as *mut FILE_NC - } - - /// A utility function to expand a vector without increasing its capacity - /// more than it needs to be expanded. - fn expand_buffer(buff: &mut Vec, by: usize) { - if buff.capacity() < buff.len() + by { - buff.reserve(by); - } - for _ in 0..by { - buff.push(0u8); - } - } -} - -impl Read for NcFile { - /// Reads exactly the number of bytes required to fill buf. - /// - /// If the end of the file is reached before buf is filled, - /// `Err(EndOfFile(bytes_read))` will be returned. The data that was read - /// before that will still have been placed into buf. - /// - /// Upon some other error, `Err(Errno(errno))` will be returned. - fn read(&mut self, buf: &mut [u8]) -> Result { - unsafe { - let result = fread( - buf.as_ptr() as *mut c_void, - 1, - buf.len(), - self.as_libc_ptr(), - ); - if result != buf.len() { - match get_error::() { - Err(err) => { - if err.kind() == ErrorKind::UnexpectedEof { - Ok(result) - } else { - Err(err) - } - } - Ok(_) => panic!("This is impossible"), - } - } else { - Ok(result) - } - } - } - - /// Reads the entire file starting from the current_position - /// expanding buf as needed. - /// - /// On a successful read, this function will return `Ok(bytes_read)`. - /// - /// If an error occurs during reading, some varient of error will be returned. - fn read_to_end(&mut self, buf: &mut Vec) -> Result { - let pos = self.current_pos(); - let _ = self.seek(SeekFrom::End(0)); - let end = self.current_pos(); - match pos { - Ok(cur_pos) => match end { - Ok(end_pos) => { - if end_pos == cur_pos { - return Ok(0); - } - let to_read = (end_pos - cur_pos) as usize; - if buf.len() < to_read { - let to_reserve = to_read - buf.len(); - Self::expand_buffer(buf, to_reserve); - } - let _ = self.seek(SeekFrom::Start(cur_pos as u64)); - match self.read_exact(buf) { - Ok(()) => Ok(to_read), - Err(e) => Err(e), - } - } - Err(e) => Err(e), - }, - Err(e) => Err(e), - } - } - - /// Reads the entire file from the beginning and stores it in a string - /// - /// On a successful read, this function will return `Ok(bytes_read)`. - /// - /// If an error occurs during reading, some varient of error will be returned. - fn read_to_string(&mut self, strbuf: &mut String) -> Result { - let mut bytes_read = 0_usize; - let mut buffer = vec![0u8]; - let result = self.read_all(&mut buffer); - - if let Ok(bytes) = result { - bytes_read = bytes; - } - if let Err(e) = result { - return Err(e); - } - - let result = std::str::from_utf8(&buffer); - - if let Ok(strslice) = result { - *strbuf = strslice.to_string(); - Ok(bytes_read) - } else { - get_error() - } - } - - /// Reads exactly the number of bytes required to fill buf. - /// - /// If the end of the file is reached before buf is filled, - /// `Err(EndOfFile(bytes_read))` will be returned. The data that was read - /// before that will still have been placed into buf. - /// - /// Upon some other error, `Err(Errno(errno))` will be returned. - fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error> { - unsafe { - let result = fread( - buf.as_ptr() as *mut c_void, - 1, - buf.len(), - self.as_libc_ptr(), - ); - if result == buf.len() { - Ok(()) - } else { - // Check if we hit the end of the file - // FIXME - // if feof(self.as_libc_ptr()) != 0 { - // get_error() - // } else { - // get_error() - // } - get_error() - } - } - } -} - -impl Seek for NcFile { - /// Changes the current position in the file using the [`SeekFrom`] enum. - /// - /// To set relative to the beginning of the file (i.e. index is 0 + offset): - /// ```ignore - /// SeekFrom::Start(offset) - /// ``` - /// To set relative to the end of the file (i.e. index is file_lenth - 1 - offset): - /// ```ignore - /// SeekFrom::End(offset) - /// ``` - /// To set relative to the current position: - /// ```ignore - /// SeekFrom::End(offset) - /// ``` - /// - /// On error `Error::Errno(errno)` is returned. - fn seek(&mut self, pos: SeekFrom) -> Result { - unsafe { - let result = match pos { - SeekFrom::Start(from) => fseek(self.as_libc_ptr(), from as c_long, SEEK_SET), - SeekFrom::End(from) => fseek(self.as_libc_ptr(), from as c_long, SEEK_END), - SeekFrom::Current(delta) => fseek(self.as_libc_ptr(), delta as c_long, SEEK_CUR), - }; - if result == 0 { - self.current_pos() - } else { - get_error() - } - } - } -} - -impl Drop for NcFile { - /// Ensures the file stream is closed before abandoning the data. - fn drop(&mut self) { - let _ = unsafe { - if !(self.as_libc_ptr()).is_null() { - let res = fclose(self.as_libc_ptr()); - if res == 0 { - self.file_ptr = NonNull::new_unchecked(null_mut::()); - Ok(()) - } else { - get_error() - } - } else { - Ok(()) - } - }; - } -} diff --git a/rust/src/input/key.rs b/rust/src/input/key.rs deleted file mode 100644 index abfc18f6a..000000000 --- a/rust/src/input/key.rs +++ /dev/null @@ -1,25 +0,0 @@ -// functions manually reimplemented: 2 -// ------------------------------------------ -// (+) done: 2 / 0 -// (#) test: 0 / 2 -// ------------------------------------------ -// + nckey_mouse_p -// + nckey_supppuab_p - -use crate::{NCKEY_BUTTON1, NCKEY_RELEASE}; - -/// Is this [char] a Supplementary Private Use Area-B codepoint? -/// -/// Links: -/// - https://en.wikipedia.org/wiki/Private_Use_Areas -/// - https://codepoints.net/supplementary_private_use_area-b -#[inline] -pub fn nckey_supppuab_p(w: char) -> bool { - w as u32 >= 0x100000_u32 && w as u32 <= 0x10fffd_u32 -} - -/// Is the event a synthesized mouse event? -#[inline] -pub const fn nckey_mouse_p(r: char) -> bool { - r >= NCKEY_BUTTON1 && r <= NCKEY_RELEASE -} diff --git a/rust/src/input/keycodes.rs b/rust/src/input/keycodes.rs deleted file mode 100644 index 57c8a8ad3..000000000 --- a/rust/src/input/keycodes.rs +++ /dev/null @@ -1,137 +0,0 @@ -//! Special composed key definitions. These values are added to 0x100000. -#![allow(clippy::transmute_int_to_char)] - -use std::mem::transmute; - -// NOTE: Waiting for: https://github.com/rust-lang/rust/issues/53605 -// const fn suppuabize(w: u32) -> char { -const fn suppuabize(w: u32) -> u32 { - // unsafe { transmute(w + 0x100000) } - w + 0x100000 -} - -pub const NCKEY_INVALID: char = unsafe { transmute(suppuabize(0)) }; -///generated interally in response to SIGWINCH -pub const NCKEY_RESIZE: char = unsafe { transmute(suppuabize(1)) }; -pub const NCKEY_UP: char = unsafe { transmute(suppuabize(2)) }; -pub const NCKEY_RIGHT: char = unsafe { transmute(suppuabize(3)) }; -pub const NCKEY_DOWN: char = unsafe { transmute(suppuabize(4)) }; -pub const NCKEY_LEFT: char = unsafe { transmute(suppuabize(5)) }; -pub const NCKEY_INS: char = unsafe { transmute(suppuabize(6)) }; -pub const NCKEY_DEL: char = unsafe { transmute(suppuabize(7)) }; -/// backspace (sometimes) -pub const NCKEY_BACKSPACE: char = unsafe { transmute(suppuabize(8)) }; -pub const NCKEY_PGDOWN: char = unsafe { transmute(suppuabize(9)) }; -pub const NCKEY_PGUP: char = unsafe { transmute(suppuabize(10)) }; -pub const NCKEY_HOME: char = unsafe { transmute(suppuabize(11)) }; -pub const NCKEY_END: char = unsafe { transmute(suppuabize(12)) }; -pub const NCKEY_F00: char = unsafe { transmute(suppuabize(20)) }; -pub const NCKEY_F01: char = unsafe { transmute(suppuabize(21)) }; -pub const NCKEY_F02: char = unsafe { transmute(suppuabize(22)) }; -pub const NCKEY_F03: char = unsafe { transmute(suppuabize(23)) }; -pub const NCKEY_F04: char = unsafe { transmute(suppuabize(24)) }; -pub const NCKEY_F05: char = unsafe { transmute(suppuabize(25)) }; -pub const NCKEY_F06: char = unsafe { transmute(suppuabize(26)) }; -pub const NCKEY_F07: char = unsafe { transmute(suppuabize(27)) }; -pub const NCKEY_F08: char = unsafe { transmute(suppuabize(28)) }; -pub const NCKEY_F09: char = unsafe { transmute(suppuabize(29)) }; -pub const NCKEY_F10: char = unsafe { transmute(suppuabize(30)) }; -pub const NCKEY_F11: char = unsafe { transmute(suppuabize(31)) }; -pub const NCKEY_F12: char = unsafe { transmute(suppuabize(32)) }; -pub const NCKEY_F13: char = unsafe { transmute(suppuabize(33)) }; -pub const NCKEY_F14: char = unsafe { transmute(suppuabize(34)) }; -pub const NCKEY_F15: char = unsafe { transmute(suppuabize(35)) }; -pub const NCKEY_F16: char = unsafe { transmute(suppuabize(36)) }; -pub const NCKEY_F17: char = unsafe { transmute(suppuabize(37)) }; -pub const NCKEY_F18: char = unsafe { transmute(suppuabize(38)) }; -pub const NCKEY_F19: char = unsafe { transmute(suppuabize(39)) }; -pub const NCKEY_F20: char = unsafe { transmute(suppuabize(40)) }; -pub const NCKEY_F21: char = unsafe { transmute(suppuabize(41)) }; -pub const NCKEY_F22: char = unsafe { transmute(suppuabize(42)) }; -pub const NCKEY_F23: char = unsafe { transmute(suppuabize(43)) }; -pub const NCKEY_F24: char = unsafe { transmute(suppuabize(44)) }; -pub const NCKEY_F25: char = unsafe { transmute(suppuabize(45)) }; -pub const NCKEY_F26: char = unsafe { transmute(suppuabize(46)) }; -pub const NCKEY_F27: char = unsafe { transmute(suppuabize(47)) }; -pub const NCKEY_F28: char = unsafe { transmute(suppuabize(48)) }; -pub const NCKEY_F29: char = unsafe { transmute(suppuabize(49)) }; -pub const NCKEY_F30: char = unsafe { transmute(suppuabize(50)) }; -pub const NCKEY_F31: char = unsafe { transmute(suppuabize(51)) }; -pub const NCKEY_F32: char = unsafe { transmute(suppuabize(52)) }; -pub const NCKEY_F33: char = unsafe { transmute(suppuabize(53)) }; -pub const NCKEY_F34: char = unsafe { transmute(suppuabize(54)) }; -pub const NCKEY_F35: char = unsafe { transmute(suppuabize(55)) }; -pub const NCKEY_F36: char = unsafe { transmute(suppuabize(56)) }; -pub const NCKEY_F37: char = unsafe { transmute(suppuabize(57)) }; -pub const NCKEY_F38: char = unsafe { transmute(suppuabize(58)) }; -pub const NCKEY_F39: char = unsafe { transmute(suppuabize(59)) }; -pub const NCKEY_F40: char = unsafe { transmute(suppuabize(60)) }; -pub const NCKEY_F41: char = unsafe { transmute(suppuabize(61)) }; -pub const NCKEY_F42: char = unsafe { transmute(suppuabize(62)) }; -pub const NCKEY_F43: char = unsafe { transmute(suppuabize(63)) }; -pub const NCKEY_F44: char = unsafe { transmute(suppuabize(64)) }; -pub const NCKEY_F45: char = unsafe { transmute(suppuabize(65)) }; -pub const NCKEY_F46: char = unsafe { transmute(suppuabize(66)) }; -pub const NCKEY_F47: char = unsafe { transmute(suppuabize(67)) }; -pub const NCKEY_F48: char = unsafe { transmute(suppuabize(68)) }; -pub const NCKEY_F49: char = unsafe { transmute(suppuabize(69)) }; -pub const NCKEY_F50: char = unsafe { transmute(suppuabize(70)) }; -pub const NCKEY_F51: char = unsafe { transmute(suppuabize(71)) }; -pub const NCKEY_F52: char = unsafe { transmute(suppuabize(72)) }; -pub const NCKEY_F53: char = unsafe { transmute(suppuabize(73)) }; -pub const NCKEY_F54: char = unsafe { transmute(suppuabize(74)) }; -pub const NCKEY_F55: char = unsafe { transmute(suppuabize(75)) }; -pub const NCKEY_F56: char = unsafe { transmute(suppuabize(76)) }; -pub const NCKEY_F57: char = unsafe { transmute(suppuabize(77)) }; -pub const NCKEY_F58: char = unsafe { transmute(suppuabize(78)) }; -pub const NCKEY_F59: char = unsafe { transmute(suppuabize(79)) }; -pub const NCKEY_F60: char = unsafe { transmute(suppuabize(80)) }; - -// ... leave room for up to 100 function keys, egads - -pub const NCKEY_ENTER: char = unsafe { transmute(suppuabize(121)) }; -/// "clear-screen or erase" -pub const NCKEY_CLS: char = unsafe { transmute(suppuabize(122)) }; -/// down + left on keypad -pub const NCKEY_DLEFT: char = unsafe { transmute(suppuabize(123)) }; -pub const NCKEY_DRIGHT: char = unsafe { transmute(suppuabize(124)) }; -/// up + left on keypad -pub const NCKEY_ULEFT: char = unsafe { transmute(suppuabize(125)) }; -pub const NCKEY_URIGHT: char = unsafe { transmute(suppuabize(126)) }; -/// the most truly neutral of keypresses -pub const NCKEY_CENTER: char = unsafe { transmute(suppuabize(127)) }; -pub const NCKEY_BEGIN: char = unsafe { transmute(suppuabize(128)) }; -pub const NCKEY_CANCEL: char = unsafe { transmute(suppuabize(129)) }; -pub const NCKEY_CLOSE: char = unsafe { transmute(suppuabize(130)) }; -pub const NCKEY_COMMAND: char = unsafe { transmute(suppuabize(131)) }; -pub const NCKEY_COPY: char = unsafe { transmute(suppuabize(132)) }; -pub const NCKEY_EXIT: char = unsafe { transmute(suppuabize(133)) }; -pub const NCKEY_PRINT: char = unsafe { transmute(suppuabize(134)) }; -pub const NCKEY_REFRESH: char = unsafe { transmute(suppuabize(135)) }; - -// Mouse events. We try to encode some details into the char32_t (i.e. which -// button was pressed);, but some is embedded in the ncinput event. The release -// event is generic across buttons; callers must maintain state, if they care. -pub const NCKEY_BUTTON1: char = unsafe { transmute(suppuabize(201)) }; -pub const NCKEY_BUTTON2: char = unsafe { transmute(suppuabize(202)) }; -pub const NCKEY_BUTTON3: char = unsafe { transmute(suppuabize(203)) }; -/// scrollwheel up -pub const NCKEY_BUTTON4: char = unsafe { transmute(suppuabize(204)) }; -/// scrollwheel down -pub const NCKEY_BUTTON5: char = unsafe { transmute(suppuabize(205)) }; -pub const NCKEY_BUTTON6: char = unsafe { transmute(suppuabize(206)) }; -pub const NCKEY_BUTTON7: char = unsafe { transmute(suppuabize(207)) }; -pub const NCKEY_BUTTON8: char = unsafe { transmute(suppuabize(208)) }; -pub const NCKEY_BUTTON9: char = unsafe { transmute(suppuabize(209)) }; -pub const NCKEY_BUTTON10: char = unsafe { transmute(suppuabize(210)) }; -pub const NCKEY_BUTTON11: char = unsafe { transmute(suppuabize(211)) }; -pub const NCKEY_RELEASE: char = unsafe { transmute(suppuabize(212)) }; - -// Synonyms (so far as we're concerned) -pub const NCKEY_SCROLL_UP: char = NCKEY_BUTTON4; -pub const NCKEY_SCROLL_DOWN: char = NCKEY_BUTTON5; -pub const NCKEY_RETURN: char = NCKEY_ENTER; - -// Aliases, from the 128 characters common to ASCII+UTF8 -pub const NCKEY_ESC: char = unsafe { transmute(0x1b) }; -pub const NCKEY_SPACE: char = unsafe { transmute(0x20) }; diff --git a/rust/src/input/mod.rs b/rust/src/input/mod.rs deleted file mode 100644 index 1769e8191..000000000 --- a/rust/src/input/mod.rs +++ /dev/null @@ -1,139 +0,0 @@ -//! `NcInput` & `NcKey` - -// functions manually reimplemented: 4 -// ------------------------------------------ -// (+) done: 4 -// (#) test: 0 -// ------------------------------------------ -// + ncinput_equal_p -// + ncinput_nomod_p -// + nckey_mouse_p -// + nckey_supppuab_p - -use crate::NcDim; - -mod keycodes; -pub use keycodes::*; - -/// Reads and decodes input events. -/// -/// Reads from stdin and decodes the input to stdout, including synthesized -/// events and mouse events. Notcurses provides input from keyboards and mice. -/// Single Unicode codepoints are received from the keyboard, directly encoded -/// as `u32`. -/// -/// The input system must deal with numerous keyboard signals which do not map -/// to Unicode code points. This includes the keypad arrows and function keys. -/// These "synthesized" codepoints are enumerated in , and mapped into the -/// Supplementary Private Use Area-B (U+100000..U+10FFFD). -/// Mouse button events are similarly mapped into the SPUA-B. -/// -/// All events carry a ncinput structure with them. -/// For mouse events, the x and y coordinates are reported within this struct. -/// For all events, modifiers (e.g. "Alt") are carried as bools in this struct. -pub type NcInput = crate::bindings::ffi::ncinput; - -/// New NcInput. -impl NcInput { - /// New empty NcInput. - pub const fn new_empty() -> NcInput { - NcInput { - id: 0, - y: 0, - x: 0, - alt: false, - shift: false, - ctrl: false, - seqnum: 0, - } - } - - /// New NcInput. - pub const fn new(id: char) -> NcInput { - Self::with_all_args(id, None, None, false, false, false, 0) - } - - /// New NcInput with alt key. - pub const fn with_alt(id: char) -> NcInput { - Self::with_all_args(id, None, None, true, false, false, 0) - } - - /// New NcInput with shift key. - pub const fn with_shift(id: char) -> NcInput { - Self::with_all_args(id, None, None, false, true, false, 0) - } - - /// New NcInput with ctrl key. - pub const fn with_ctrl(id: char) -> NcInput { - Self::with_all_args(id, None, None, false, false, true, 0) - } - - /// New NcInput, expecting all the arguments. - pub const fn with_all_args( - id: char, - x: Option, - y: Option, - alt: bool, - shift: bool, - ctrl: bool, - seqnum: u64, - ) -> NcInput { - let (ix, iy); - if let Some(x) = x { - ix = x as i32 - } else { - ix = -1 - }; - if let Some(y) = y { - iy = y as i32 - } else { - iy = -1 - }; - - NcInput { - id: id as u32, - y: ix, - x: iy, - alt, - shift, - ctrl, - seqnum, - } - } -} - -/// Compares two ncinput structs for data equality by doing a field-by-field -/// comparison for equality (excepting seqnum). -/// -/// Returns true if the two are data-equivalent. -pub const fn ncinput_equal_p(n1: NcInput, n2: NcInput) -> bool { - if n1.id != n2.id { - return false; - } - if n1.y != n2.y || n1.x != n2.x { - return false; - } - // do not check seqnum - true -} - -/// Are all the modifiers off (alt, control, shift)? -pub const fn ncinput_nomod_p(input: &NcInput) -> bool { - !input.alt && !input.ctrl && !input.shift -} - -/// Is this [char] a Supplementary Private Use Area-B codepoint? -/// -/// Links: -/// - -/// - -#[inline] -pub const fn nckey_supppuab_p(w: char) -> bool { - w as u32 >= 0x100000_u32 && w as u32 <= 0x10fffd_u32 -} - -/// Is the event a synthesized mouse event? -#[inline] -pub const fn nckey_mouse_p(r: char) -> bool { - r >= NCKEY_BUTTON1 && r <= NCKEY_RELEASE -} diff --git a/rust/src/lib.rs b/rust/src/lib.rs deleted file mode 100644 index 30522b859..000000000 --- a/rust/src/lib.rs +++ /dev/null @@ -1,162 +0,0 @@ -//! `libnotcurses-sys` is a low-level Rust wrapper for the [notcurses -//! C library](https://www.github.com/dankamongmen/notcurses/) -//! -//! *This is a work in progress.* -//! -//! This library is built with several layers of zero-overhead abstractions -//! over the C functions and pointers accessed through FFI. -//! -//! # How to use this library -//! -//! There are basically two ways: The [**Rust way**](#1-the-rust-way), -//! and the [**C way**](#2-the-c-way). (Or a mix of both). -//! -//! ## 1. The Rust way -//! -//! Where you use the safely wrapped types, with its methods and constructors, -//! and painless error handling, like this: -//! -//! ### Example -//! -//! ```rust -//! use libnotcurses_sys::*; -//! -//! # #[cfg(not(miri))] -//! fn main() -> NcResult<()> { -//! let mut nc = Nc::with_flags(NCOPTION_NO_ALTERNATE_SCREEN)?; -//! let plane = nc.stdplane(); -//! plane.putstr("hello world")?; -//! nc.render()?; -//! nc.stop()?; -//! Ok(()) -//! } -//! # #[cfg(miri)] -//! # fn main() {} -//! ``` -//! -//! Although you still have to manually call the `stop()` method for [`Nc`] and -//! [`NcDirect`] objects, and the `destroy()` method for the rest of types that -//! allocate, (like [`NcPlane`], [`NcVisual`]…) at the end of their scope, since -//! the Drop trait is not implemented for any wrapping type in libnotcurses-sys. -//! -//! But they do implement methods and use [`NcResult`] as the return type, -//! for handling errors in the way we are used to in Rust. -//! -//! For the types that don't allocate, most are based on primitives like `i32`, -//! `u32`, `u64`… without a name in the C library. In Rust they are type aliased -//! (e.g.: [`NcChannel`], [`NcChannels`], [`NcRgb`], [`NcComponent`]…), to -//! leverage type checking, and they implement methods through [traits](#traits) -//! (e.g. [`NcChannelMethods`] must be in scope to use the `NcChannel` methods. -//! -//! -//! ## 2. The C way -//! -//! You can always use the C API functions directly if you prefer, -//! in a very similar way as the C library is used. -//! -//! It requires the use of unsafe, since most functions are wrapped directly -//! by `bindgen` marked as such. -//! -//! Error handling is done this way by checking the returned [`NcIntResult`], -//! or in case of receiving a pointer, by comparing it -//! to [null_mut()][core::ptr::null_mut]. -//! -//! ### Example -//! -//! ```rust -//! use core::ptr::{null, null_mut}; -//! use std::process::exit; -//! -//! use libnotcurses_sys::*; -//! -//! # #[cfg(not(miri))] -//! fn main() { -//! let options = ffi::notcurses_options { -//! termtype: null(), -//! renderfp: null_mut(), -//! loglevel: 0, -//! margin_t: 0, -//! margin_r: 0, -//! margin_b: 0, -//! margin_l: 0, -//! flags: NCOPTION_NO_ALTERNATE_SCREEN, -//! }; -//! unsafe { -//! let nc = notcurses_init(&options, null_mut()); -//! if nc.is_null() { -//! exit(1); -//! } -//! let plane = notcurses_stdplane(nc); -//! let cols = ncplane_putstr(&mut *plane, "hello world"); -//! if cols < NCRESULT_OK { -//! notcurses_stop(nc); -//! exit(cols.abs()); -//! } -//! if notcurses_stop(nc) < NCRESULT_OK { -//! exit(2); -//! } -//! } -//! } -//! # #[cfg(miri)] -//! # fn main() {} -//! ``` -//! -//! ### The `notcurses` C API docs -//! -//! - [API reference (man pages)](https://notcurses.com/) -//! - [Wiki Page](https://nick-black.com/dankwiki/index.php/Notcurses) -//! - [The Book Guide (pdf)](https://nick-black.com/htp-notcurses.pdf) -//! - [USAGE.md](https://github.com/dankamongmen/notcurses/blob/master/USAGE.md) -//! - [HACKING.md](https://github.com/dankamongmen/notcurses/blob/master/doc/HACKING.md) -//! - [Doxygen Documentation](https://nick-black.com/notcurses/html/index.html) -//! - [FOSDEM 2021 presentation](https://fosdem.org/2021/schedule/event/notcurses/) -//! -#![allow(non_upper_case_globals, non_camel_case_types, non_snake_case)] -#![allow(clippy::too_many_arguments, clippy::needless_doctest_main)] - -mod bindings; -#[doc(inline)] -pub use bindings::*; - -mod r#box; -mod capabilities; -mod cells; -mod channel; -mod dimension; -mod direct; -mod error; -mod fade; -mod file; -mod input; -mod macros; -mod metric; -mod notcurses; -mod palette; -mod pixel; -mod plane; -mod resizecb; -mod stats; -mod time; -mod visual; -pub mod widgets; - -pub use crate::input::*; -pub use capabilities::*; -pub use cells::*; -pub use channel::*; -pub use dimension::*; -pub use direct::*; -pub use error::*; -pub use fade::*; -pub use file::*; -pub use macros::*; -pub use metric::*; -pub use notcurses::*; -pub use palette::*; -pub use pixel::*; -pub use plane::*; -pub use r#box::*; -pub use resizecb::*; -pub use stats::*; -pub use time::*; -pub use visual::*; diff --git a/rust/src/macros.rs b/rust/src/macros.rs deleted file mode 100644 index 847ee2e23..000000000 --- a/rust/src/macros.rs +++ /dev/null @@ -1,276 +0,0 @@ -//! Macros -//! -// -// NOTE: Use full paths everywhere. Don't assume anything will be in scope. - -#[allow(unused_imports)] -// enjoy briefer doc comments -use crate::{Nc, NcDirect, NcError, NcPlane, NcResult, NCRESULT_ERR, NCRESULT_OK}; - -// Sleep, Render & Flush Macros ------------------------------------------------ - -/// Sleeps for `$s` seconds + `$ms` milliseconds -/// + `$us` microseconds + `$ns` nanoseconds -#[macro_export] -macro_rules! sleep { - ($s:expr) => { - std::thread::sleep(std::time::Duration::from_secs($s)); - }; - - ($s:expr, $ms:expr) => { - std::thread::sleep(std::time::Duration::from_millis($s * 1000 + $ms)); - }; - ($s:expr, $ms:expr, $us:expr) => { - std::thread::sleep(std::time::Duration::from_micros( - $s * 1_000_000 + $ms * 1_000 + $us, - )); - }; - ($s:expr, $ms:expr, $us:expr, $ns:expr) => { - std::thread::sleep(std::time::Duration::from_nanos( - $s * 1_000_000_000 + $ms * 1_000_000 + $us * 1_000 + $ns, - )); - }; -} - -/// notcurses render sleep: -/// [`Nc::render`][Nc#method.render]\(`$nc`\)? + [`sleep!`]`[$sleep_args]`. -/// -/// Renders the `$nc` [`Nc`] object's standard plane pile and then, -/// if there's no error, calls the sleep macro with the rest of the arguments. -/// -/// Returns [NcResult]. -#[macro_export] -macro_rules! nrs { - ($nc:expr, $( $sleep_args:expr),+ ) => { - crate::Nc::render($nc)?; - sleep![$( $sleep_args ),+]; - }; - ($nc:expr, $( $sleep_args:expr),+ ,) => { - rsleep![$nc, $( $sleep_args ),* ] - }; -} - -/// plane render sleep: -/// [`NcPlane::render`][NcPlane#method.render]\(`$p`\)? + -/// [`NcPlane::rasterize`][NcPlane#method.rasterize]\(`$p`\)? + -/// [`sleep!`]`[$sleep_args]`. -/// -/// Renders and rasterizes the `$p` [NcPlane] pile and then, if there are -/// no errors, calls the sleep macro with the rest of the arguments. -/// -/// Returns [NcResult]. -#[macro_export] -macro_rules! prs { - ($p:expr, $( $sleep_args:expr),+ ) => { - crate::NcPlane::render($p)?; - crate::NcPlane::rasterize($p)?; - sleep![$( $sleep_args ),+]; - }; - ($nc:expr, $( $sleep_args:expr),+ ,) => { - rsleep![$nc, $( $sleep_args ),* ] - }; -} - -/// [`NcDirect::flush`][NcDirect#method.flush]\(`$ncd`\)? + [`sleep!`]`[$sleep_args]`. -/// -/// Flushes the `$ncd` [NcDirect] object and, if there's no error, -/// calls the sleep macro with the rest of the arguments. -/// -/// Returns [NcResult]. -#[macro_export] -#[deprecated] -#[doc(hidden)] -macro_rules! fsleep { - ($ncd:expr, $( $sleep_args:expr),+ ) => { - // Rust style, with methods & NcResult - crate::NcDirect::flush($ncd)?; - sleep![$( $sleep_args ),+]; - }; - ($ncd:expr, $( $sleep_args:expr),+ ,) => { - rsleep![$ncd, $( $sleep_args ),* ] - }; -} - -#[deprecated] -#[doc(hidden)] -#[allow(unused_macros)] -macro_rules! prsleep { - ($p:expr, $( $sleep_args:expr),+ ) => { - prs![$p, $( $sleep_args ),+]; - }; -} - -#[deprecated] -#[doc(hidden)] -#[allow(unused_macros)] -macro_rules! psleep { - ($p:expr, $( $sleep_args:expr),+ ) => { - prs![$p, $( $sleep_args ),+]; - }; -} - -#[deprecated] -#[doc(hidden)] -#[allow(unused_macros)] -macro_rules! rsleep { - ($nc:expr, $( $sleep_args:expr),+ ) => { - nrs![$nc, $( $sleep_args ),+]; - }; -} - -// String & Print Macros ------------------------------------------------------- - -/// Converts an `&str` into `*const c_char`. -#[macro_export] -#[doc(hidden)] -macro_rules! cstring { - ($s:expr) => { - std::ffi::CString::new($s).unwrap().as_ptr() - }; -} - -/// Converts an `&str` into `*mut c_char`. -#[macro_export] -#[doc(hidden)] -macro_rules! cstring_mut { - ($s:expr) => { - std::ffi::CString::new($s).unwrap().into_raw() - }; -} - -/// Converts a `*const c_char` into an `&str`. -#[macro_export] -#[doc(hidden)] -macro_rules! rstring { - ($s:expr) => { - unsafe { std::ffi::CStr::from_ptr($s).to_str().unwrap() } - // possible alternative: - // unsafe { std::ffi::CStr::from_ptr($s).to_string_lossy() } - }; -} - -/// Wrapper around [libc::printf]. -#[macro_export] -#[doc(hidden)] -macro_rules! printf { - ($s:expr) => { - unsafe { libc::printf(cstring![$s]) } - }; - ($s:expr $(, $opt:expr)*) => { - unsafe { libc::printf(cstring![$s], $($opt),*) } - }; -} - -// Error Wrappers Macros ------------------------------------------------------- - -/// Returns an `Ok($ok)`, -/// or an `Err(`[`NcError`]`)` if `$res` < [`NCRESULT_OK`]. -/// -/// In other words: -/// Returns Ok(`$ok`) if `$res` >= [NCRESULT_OK], otherwise returns -/// Err([NcError]::[new][NcError#method.new](`$res`, `$msg`)). -/// -/// `$ok` & `$msg` are optional. By default they will be the unit -/// type `()`, and an empty `&str` `""`, respectively. -#[macro_export] -#[doc(hidden)] -macro_rules! error { - ($res:expr, $msg:expr, $ok:expr) => {{ - let res = $res; - if res >= crate::NCRESULT_OK { - return Ok($ok); - } else { - return Err(crate::NcError::with_msg(res, $msg)); - } - }}; - ($res:expr, $msg:expr) => { - error![$res, $msg, ()] - }; - ($res:expr) => { - error![$res, "", ()] - }; -} - -/// Returns an `Ok(&T)` from a `*const T` pointer, -/// or an `Err(`[`NcError`]`)` if the pointer is null. -/// -/// In other words: -/// Returns Ok(&*`$ptr`) if `!$ptr.is_null()`, otherwise returns -/// Err([NcError]]::[new][NcError#method.new]([NCRESULT_ERR], `$msg`)). -/// -/// `$msg` is optional. By default it will be an empty `&str` `""`. -#[macro_export] -#[doc(hidden)] -macro_rules! error_ref { - ($ptr:expr, $msg:expr, $ok:expr) => {{ - let ptr = $ptr; // avoid calling a function multiple times - if ptr.is_null() { - return Err(crate::NcError::with_msg(crate::NCRESULT_ERR, $msg)); - } else { - #[allow(unused_unsafe)] - return Ok(unsafe { $ok }); - } - }}; - ($ptr:expr, $msg:expr) => {{ - let ptr = $ptr; - error_ref![$ptr, $msg, unsafe { &*ptr }]; - }}; - ($ptr:expr) => {{ - let ptr = $ptr; - error_ref![$ptr, "", unsafe { &*ptr }]; - }}; -} - -/// Returns an `Ok(&mut T)` from a `*mut T` pointer, -/// or an `Err(`[`NcError`]`)` if the pointer is null. -/// -/// In other words: -/// Returns Ok(&mut *`$ptr`) if `!$ptr._is_null()`, otherwise returns -/// Err([NcError]]::[new][NcError#method.new]([NCRESULT_ERR], `$msg`)). -/// -/// `$msg` is optional. By default it will be an empty `&str` `""`. -#[macro_export] -#[doc(hidden)] -macro_rules! error_ref_mut { - ($ptr:expr, $msg:expr, $ok:expr) => {{ - let ptr = $ptr; // avoid calling a function multiple times - if ptr.is_null() { - return Err(crate::NcError::with_msg(crate::NCRESULT_ERR, $msg)); - } else { - #[allow(unused_unsafe)] - return Ok(unsafe { $ok }); - } - }}; - ($ptr:expr, $msg:expr) => {{ - let ptr = $ptr; - error_ref_mut![ptr, $msg, unsafe { &mut *ptr }]; - }}; - ($ptr:expr) => {{ - let ptr = $ptr; - error_ref_mut![ptr, "", unsafe { &mut *ptr }]; - }}; -} - -/// Returns an `Ok(String)` from a `*const` pointer to a C string, -/// or an `Err(`[`NcError`]`)` if the pointer is null. -/// -/// In other words: -/// Returns Ok((&*`$str`).to_string()) if `!$str.is_null()`, otherwise returns -/// Err([NcError]]::[new][NcError#method.new]([NCRESULT_ERR], `$msg`)). -/// -/// `$msg` is optional. By default it will be an empty `&str` `""`. -#[macro_export] -#[doc(hidden)] -macro_rules! error_str { - ($str:expr, $msg:expr) => { - if !$str.is_null() { - #[allow(unused_unsafe)] - return Ok(unsafe { (&*$str).to_string() }); - } else { - return Err(crate::NcError::with_msg(crate::NCRESULT_ERR, $msg)); - } - }; - ($str:expr) => { - error_str![$str, ""]; - }; -} diff --git a/rust/src/metric.rs b/rust/src/metric.rs deleted file mode 100644 index c9bd82eea..000000000 --- a/rust/src/metric.rs +++ /dev/null @@ -1,66 +0,0 @@ -//! `NcMetric` - -use crate::{cstring_mut, rstring}; - -// TODO: clarify, update and visibilize doc-comments - -/// Takes an arbitrarily large number, and prints it into a fixed-size buffer by -/// adding the necessary SI suffix. -/// -/// Usually, pass a `|[IB]PREFIXSTRLEN+1|-sized` buffer to generate up to -/// `|[IB]PREFIXCOLUMNS|` columns' worth of EGCs. The characteristic can occupy -/// up through `|mult-1|` characters (3 for 1000, 4 for 1024). -/// The mantissa can occupy either zero or two characters. -/// -/// Floating-point is never used, because an IEEE758 double can only losslessly -/// represent integers through 2^53-1. -/// -/// 2^64-1 is 18446744073709551615, 18.45E(xa). KMGTPEZY thus suffice to handle -/// an 89-bit uintmax_t. Beyond Z(etta) and Y(otta) lie lands unspecified by SI. -/// 2^-63 is 0.000000000000000000108, 1.08a(tto). val: value to print decimal: -/// scaling. '1' if none has taken place. buf: buffer in which string will be -/// generated omitdec: inhibit printing of all-0 decimal portions mult: base of -/// suffix system (almost always 1000 or 1024) uprefix: character to print -/// following suffix ('i' for kibibytes basically). only printed if suffix is -/// actually printed (input >= mult). -/// -/// You are encouraged to consult notcurses_metric(3). -/// -pub fn ncmetric(val: u64, decimal: u64, buf: &str, omitdec: i32, mult: u64, uprefix: i32) -> &str { - let buf = cstring_mut![buf]; - rstring![crate::ffi::ncmetric( - val, decimal, buf, omitdec, mult, uprefix - )] -} - -// The number of columns is one fewer, as the STRLEN expressions must leave -// an extra byte open in case 'µ' (U+00B5, 0xC2 0xB5) shows up. - -// This is the true number of columns; -// -// to set up a printf()-style maximum field width, -// you should use [IB]PREFIXFMT (see below). -pub const NCMETRIC_PREFIXCOLUMNS: u32 = crate::bindings::ffi::PREFIXCOLUMNS; - -// The maximum number of columns used by a mult == 1000 (standard) -// ncmetric() call. -pub const NCMETRIC_BPREFIXCOLUMNS: u32 = crate::bindings::ffi::BPREFIXCOLUMNS; - -// IPREFIXCOLUMNS is the maximum number of columns used by a mult == 1024 -// (digital information) ncmetric(). -pub const NCMETRIC_IPREFIXCOLUMNS: u32 = crate::bindings::ffi::IPREFIXCOLUMNS; - -// -// Does not include a '\0' (xxx.xxU) -pub const NCMETRIC_PREFIXSTRLEN: u32 = crate::bindings::ffi::PREFIXSTRLEN; - -// The maximum number of columns used by a mult == 1024 call making use of -// the 'i' suffix. -// Does not include a '\0' (xxxx.xxUi), i == prefix -pub const NCMETRIC_BPREFIXSTRLEN: u32 = crate::bindings::ffi::BPREFIXSTRLEN; - -// Does not include a '\0' (xxxx.xxU) -pub const NCMETRIC_IPREFIXSTRLEN: u32 = crate::bindings::ffi::IPREFIXSTRLEN; - -// TODO:? -// WCHAR_MAX_UTF8BYTES diff --git a/rust/src/notcurses/helpers.rs b/rust/src/notcurses/helpers.rs deleted file mode 100644 index d7ba86734..000000000 --- a/rust/src/notcurses/helpers.rs +++ /dev/null @@ -1,10 +0,0 @@ -use crate::{notcurses_init, Nc, NcOptions, NCOPTION_SUPPRESS_BANNERS}; - -/// Helper function for initializing Nc on C style tests. -#[allow(dead_code)] -pub(crate) unsafe fn notcurses_init_test<'a>() -> &'a mut Nc { - &mut *notcurses_init( - &NcOptions::with_flags(NCOPTION_SUPPRESS_BANNERS), - core::ptr::null_mut(), - ) -} diff --git a/rust/src/notcurses/methods.rs b/rust/src/notcurses/methods.rs deleted file mode 100644 index 15137c595..000000000 --- a/rust/src/notcurses/methods.rs +++ /dev/null @@ -1,740 +0,0 @@ -//! `Nc*` methods and associated functions. - -use core::ptr::{null, null_mut}; - -use crate::{ - cstring, error, error_ref_mut, notcurses_init, rstring, Nc, NcAlign, NcBlitter, NcChannels, - NcDim, NcError, NcFile, NcInput, NcLogLevel, NcOptions, NcPixelImpl, NcPlane, NcResult, - NcScale, NcStats, NcStyle, NcStyleMethods, NcTime, NCOPTION_NO_ALTERNATE_SCREEN, - NCOPTION_SUPPRESS_BANNERS, NCRESULT_ERR, NCSTYLE_BOLD, NCSTYLE_ITALIC, NCSTYLE_NONE, - NCSTYLE_STRUCK, NCSTYLE_UNDERCURL, NCSTYLE_UNDERLINE, -}; - -/// # `NcOptions` Constructors -impl NcOptions { - /// New NcOptions. - pub const fn new() -> Self { - Self::with_all_options(0, 0, 0, 0, 0, 0) - } - - /// New NcOptions, with margins. - pub const fn with_margins(top: NcDim, right: NcDim, bottom: NcDim, left: NcDim) -> Self { - Self::with_all_options(0, top, right, bottom, left, 0) - } - - /// New NcOptions, with flags. - pub const fn with_flags(flags: u64) -> Self { - Self::with_all_options(0, 0, 0, 0, 0, flags) - } - - /// New NcOptions, with all the options. - /// - /// ## Arguments - /// - /// - loglevel - /// - /// Progressively higher log levels result in more logging to stderr. By - /// default, nothing is printed to stderr once fullscreen service begins. - /// - /// - margin_t, margin_r, margin_b, margin_l - /// - /// Desirable margins (top, right, bottom, left). - /// - /// If all are 0 (default), we will render to the entirety of the screen. - /// If the screen is too small, we do what we can. - /// Absolute coordinates are relative to the rendering area - /// ((0, 0) is always the origin of the rendering area). - /// - /// - flags - /// - /// General flags; This is expressed as a bitfield so that future options - /// can be added without reshaping the struct. - /// Undefined bits must be set to 0. - /// - /// - [`NCOPTION_INHIBIT_SETLOCALE`][crate::NCOPTION_INHIBIT_SETLOCALE] - /// - [`NCOPTION_NO_ALTERNATE_SCREEN`] - /// - [`NCOPTION_NO_FONT_CHANGES`][crate::NCOPTION_NO_FONT_CHANGES] - /// - [`NCOPTION_NO_QUIT_SIGHANDLERS`][crate::NCOPTION_NO_QUIT_SIGHANDLERS] - /// - [`NCOPTION_NO_WINCH_SIGHANDLER`][crate::NCOPTION_NO_WINCH_SIGHANDLER] - /// - [`NCOPTION_SUPPRESS_BANNERS`] - /// - pub const fn with_all_options( - loglevel: NcLogLevel, - margin_t: NcDim, - margin_r: NcDim, - margin_b: NcDim, - margin_l: NcDim, - flags: u64, - ) -> Self { - Self { - termtype: null(), - loglevel, - renderfp: null_mut(), - margin_t: margin_t as i32, - margin_r: margin_r as i32, - margin_b: margin_b as i32, - margin_l: margin_l as i32, - flags, - } - } -} - -/// # `Nc` Constructors -impl Nc { - /// New notcurses context (without banners). - pub fn new<'a>() -> NcResult<&'a mut Nc> { - Self::with_flags(NCOPTION_SUPPRESS_BANNERS) - } - - /// New notcurses context, with banners. - /// - /// This is the default in the C library. - pub fn with_banners<'a>() -> NcResult<&'a mut Nc> { - Self::with_flags(0) - } - - /// New notcurses context, without an alternate screen (nor banners). - pub fn without_altscreen<'a>() -> NcResult<&'a mut Nc> { - Self::with_flags(NCOPTION_NO_ALTERNATE_SCREEN | NCOPTION_SUPPRESS_BANNERS) - } - - /// New notcurses context, expects `NCOPTION_*` flags. - pub fn with_flags<'a>(flags: u64) -> NcResult<&'a mut Nc> { - Self::with_options(NcOptions::with_flags(flags)) - } - - /// New notcurses context, expects [NcOptions]. - pub fn with_options<'a>(options: NcOptions) -> NcResult<&'a mut Nc> { - let res = unsafe { notcurses_init(&options, null_mut()) }; - error_ref_mut![res, "Notcurses.with_options()"] - } - - /// New notcurses context, expects [NcLogLevel] and flags. - pub fn with_debug<'a>(loglevel: NcLogLevel, flags: u64) -> NcResult<&'a mut Nc> { - Self::with_options(NcOptions::with_all_options(loglevel, 0, 0, 0, 0, flags)) - } -} - -/// # `Nc` methods -impl Nc { - /// Returns the offset into `availcols` at which `cols` ought be output given - /// the requirements of `align`. - /// - /// Returns `-`[`NCRESULT_MAX`][crate::NCRESULT_MAX] if - /// [NCALIGN_UNALIGNED][crate::NCALIGN_UNALIGNED] or invalid [NcAlign]. - /// - /// *C style function: [notcurses_align()][crate::notcurses_align].* - // - // TODO: handle error rightfully. - pub fn align(availcols: NcDim, align: NcAlign, cols: NcDim) -> NcResult<()> { - error![crate::notcurses_align(availcols, align, cols)] - } - - /// Retrieves the current contents of the specified [NcCell][crate::NcCell] - /// as last rendered, returning the `EGC` (or None on error) and writing - /// out the [`NcStyle`] and the [`NcChannels`]. - /// - // possible BUG? CHECK: - /// This `EGC` must be freed by the caller. - /// - /// *C style function: [notcurses_at_yx()][crate::notcurses_at_yx].* - pub fn at_yx( - &mut self, - y: NcDim, - x: NcDim, - stylemask: &mut NcStyle, - channels: &mut NcChannels, - ) -> Option { - let egc = unsafe { crate::notcurses_at_yx(self, x as i32, y as i32, stylemask, channels) }; - if egc.is_null() { - return None; - } - Some(rstring![egc].into()) - } - - /// Returns the bottommost [`NcPlane`] on the standard pile, - /// of which there is always at least one. - /// - /// *C style function: [notcurses_bottom()][crate::notcurses_bottom].* - pub fn bottom(&mut self) -> &mut NcPlane { - unsafe { &mut *crate::notcurses_bottom(self) } - } - - /// Returns true if we can reliably use Unicode Braille. - /// - /// See also [NCBLIT_BRAILLE][crate::NCBLIT_BRAILLE]. - /// - /// *C style function: [notcurses_canbraille()][crate::notcurses_canbraille].* - pub fn canbraille(&self) -> bool { - unsafe { crate::notcurses_canbraille(self) } - } - - /// Returns true if it's possible to set the "hardware" palette. - /// - /// Requires the "ccc" terminfo capability. - /// - /// *C style function: [notcurses_canchangecolor()][crate::notcurses_canchangecolor].* - pub fn canchangecolor(&self) -> bool { - unsafe { crate::notcurses_canchangecolor(self) } - } - - /// Returns true if fading is possible. - /// - /// Fading requires either the "rgb" or "ccc" terminfo capability. - /// - /// *C style function: [notcurses_canfade()][crate::notcurses_canfade].* - pub fn canfade(&self) -> bool { - unsafe { crate::notcurses_canfade(self) } - } - - /// Returns true if we can reliably use Unicode half blocks. - /// - /// See also [NCBLIT_2x1][crate::NCBLIT_2x1]. - /// - /// *C style function: [notcurses_canhalfblock()][crate::notcurses_canhalfblock].* - pub fn canhalfblock(&self) -> bool { - unsafe { crate::notcurses_canhalfblock(self) } - } - - /// Returns true if loading images is possible. - /// - /// This requires being built against FFmpeg/OIIO. - /// - /// *C style function: [notcurses_canopen_images()][crate::notcurses_canopen_images].* - pub fn canopen_images(&self) -> bool { - unsafe { crate::notcurses_canopen_images(self) } - } - - /// Returns true if loading videos is possible. - /// - /// This requires being built against FFmpeg. - /// - /// *C style function: [notcurses_canopen_videos()][crate::notcurses_canopen_videos].* - pub fn canopen_videos(&self) -> bool { - unsafe { crate::notcurses_canopen_videos(self) } - } - - /// Returns true if we can reliably use Unicode quadrant blocks. - /// - /// See also [NCBLIT_2x2][crate::NCBLIT_2x2]. - /// - /// *C style function: [notcurses_canquadrant()][crate::notcurses_canquadrant].* - pub fn canquadrant(&self) -> bool { - unsafe { crate::notcurses_canquadrant(self) } - } - - /// Returns true if we can reliably use Unicode 13 sextants. - /// - /// See also [NCBLIT_3x2][crate::NCBLIT_3x2]. - /// - /// *C style function: [notcurses_cansextant()][crate::notcurses_cansextant].* - pub fn cansextant(&self) -> bool { - unsafe { crate::notcurses_cansextant(self) } - } - - /// Returns true if it's possible to directly specify RGB values per cell, - /// or false if it's only possible to use palettes. - /// - /// *C style function: [notcurses_cantruecolor()][crate::notcurses_cantruecolor].* - pub fn cantruecolor(&self) -> bool { - unsafe { crate::notcurses_cantruecolor(self) } - } - - /// Returns true if the encoding is UTF-8. - /// - /// Requires `LANG` being set to a UTF-8 locale. - /// - /// *C style function: [notcurses_canutf8()][crate::notcurses_canutf8].* - pub fn canutf8(&self) -> bool { - unsafe { crate::notcurses_canutf8(self) } - } - - /// Checks for pixel support. - /// - /// Returns [`NcPixelImpl`] with a non-zero constant corresponding to some - /// pixel-blitting mechanism if bitmap support (via any mechanism) has been - /// detected, or else 0 (NCPIXEL_NONE). - /// - /// *C style function: [notcurses_check_pixel_support()][crate::notcurses_check-pixel_support].* - #[allow(clippy::wildcard_in_or_patterns)] - pub fn check_pixel_support(&self) -> NcPixelImpl { - unsafe { crate::notcurses_check_pixel_support(self) } - } - - /// Disables the terminal's cursor, if supported. - /// - /// Immediate effect (no need for a call to notcurses_render()). - /// - /// *C style function: [notcurses_cursor_disable()][crate::notcurses_cursor_disable].* - pub fn cursor_disable(&mut self) -> NcResult<()> { - error![unsafe { crate::notcurses_cursor_disable(self) }] - } - - /// Enables the terminal's cursor, if supported, placing it at `y`, `x`. - /// - /// Immediate effect (no need for a call to notcurses_render()). - /// It is an error if `y`, `x` lies outside the standard plane. - /// - /// *C style function: [notcurses_cursor_enable()][crate::notcurses_cursor_enable].* - pub fn cursor_enable(&mut self, y: NcDim, x: NcDim) -> NcResult<()> { - error![unsafe { crate::notcurses_cursor_enable(self, y as i32, x as i32) }] - } - - /// Dumps notcurses state to the supplied `debugfp`. - /// - /// Output is freeform, and subject to change. It includes geometry of all - /// planes, from all piles. - /// - /// *C style function: [notcurses_debug()][crate::notcurses_debug].* - pub fn debug(&mut self, debugfp: &mut NcFile) { - unsafe { - crate::notcurses_debug(self, debugfp.as_nc_ptr()); - } - } - - /// Returns the name of the detected terminal. - /// - /// *C style function: [notcurses_detected_terminal()][crate::notcurses_detected_terminal].* - pub fn detected_terminal(&self) -> String { - rstring![crate::notcurses_detected_terminal(self)].to_string() - } - - /// Destroys all [`NcPlane`]s other than the stdplane. - /// - /// *C style function: [notcurses_drop_planes()][crate::notcurses_drop_planes].* - pub fn drop_planes(&mut self) { - unsafe { - crate::notcurses_drop_planes(self); - } - } - - /// Returns a [char] representing a single unicode point. - /// - /// If an event is processed, the return value is the `id` field from that - /// event. - /// - /// Provide a None `time` to block at length, a `time` of 0 for non-blocking - /// operation, and otherwise a timespec to bound blocking. - /// - /// *C style function: [notcurses_getc()][crate::notcurses_getc].* - pub fn getc(&mut self, time: Option, input: Option<&mut NcInput>) -> NcResult { - let ntime; - if let Some(time) = time { - ntime = &time as *const _; - } else { - ntime = null(); - } - - let ninput; - if let Some(input) = input { - ninput = input as *mut _; - } else { - ninput = null_mut(); - } - let c = - unsafe { core::char::from_u32_unchecked(crate::notcurses_get(self, ntime, ninput)) }; - if c as u32 as i32 == NCRESULT_ERR { - return Err(NcError::new()); - } - Ok(c) - } - - /// If no event is ready, returns 0. - /// - /// *C style function: [notcurses_getc_nblock()][crate::notcurses_getc_nblock].* - pub fn getc_nblock(&mut self, input: &mut NcInput) -> char { - crate::notcurses_getc_nblock(self, input) - } - - /// Blocks until a codepoint or special key is read, - /// or until interrupted by a signal. - /// - /// In the case of a valid read, a 32-bit Unicode codepoint is returned. - /// - /// Optionally writes the event details in `input`. - /// - /// *C style function: [notcurses_getc_blocking()][crate::notcurses_getc_blocking].* - pub fn getc_blocking(&mut self, input: Option<&mut NcInput>) -> NcResult { - let input_txt; - if cfg!(debug_assertions) { - input_txt = format!("{:?}", input); - } else { - input_txt = String::from(""); - } - - let res = crate::notcurses_getc_blocking(self, input); - - // An invalid read is indicated with -1 - if res as u32 as i32 != -1 { - Ok(res) - } else { - error![-1, &format!("Nc.getc_blocking({:?})", input_txt), res] - } - } - - /// Gets a file descriptor suitable for input event poll()ing. - /// - /// When this descriptor becomes available, you can call - /// [getc_nblock()][Nc#method.getc_nblock], and input ought be ready. - /// - /// This file descriptor is not necessarily the file descriptor associated - /// with stdin (but it might be!). - /// - /// *C style function: [notcurses_inputready_fd()][crate::notcurses_inputready_fd].* - pub fn inputready_fd(&mut self) -> NcResult<()> { - error![unsafe { crate::notcurses_inputready_fd(self) }] - } - - /// Returns an [`NcBlitter`] from a string representation. - /// - /// *C style function: [notcurses_lex_blitter()][crate::notcurses_lex_blitter].* - pub fn lex_blitter(blitter_str: &str) -> NcResult { - let mut blitter = 0; - error![ - unsafe { crate::notcurses_lex_blitter(cstring![blitter_str], &mut blitter) }, - "Invalid blitter name", blitter - ] - } - - /// Lexes a margin argument according to the standard notcurses definition. - /// - /// There can be either a single number, which will define all margins equally, - /// or there can be four numbers separated by commas. - /// - /// *C style function: [notcurses_lex_margins()][crate::notcurses_lex_margins].* - pub fn lex_margins(margins_str: &str, options: &mut NcOptions) -> NcResult<()> { - error![unsafe { crate::notcurses_lex_margins(cstring![margins_str], options) }] - } - - /// Returns an [`NcScale`] from a string representation. - /// - /// *C style function: [notcurses_lex_scalemode()][crate::notcurses_lex_scalemode].* - pub fn lex_scalemode(scalemode_str: &str) -> NcResult { - let mut scalemode = 0; - error![ - unsafe { crate::notcurses_lex_scalemode(cstring![scalemode_str], &mut scalemode) }, - "", scalemode - ] - } - - /// Returns an [`NcStyle`] from a string representation. - /// - /// It is case-insensitive, and supports multiple styles separated by - /// spaces. - /// - /// The supported styles are: `italic`, `underline`, `undercurl`, - /// `struck`, `bold`, and `none`. - /// - /// If a style is are not recognized returns an error. - /// - /// *(No equivalent C style function)* - pub fn lex_styles(styles_str: &str) -> NcResult { - let mut style = NCSTYLE_NONE; - let mut errstr = String::new(); - - for s in styles_str.split(' ') { - match s.to_lowercase().as_str() { - "italic" => style.add(NCSTYLE_ITALIC), - "underline" => style.add(NCSTYLE_UNDERLINE), - "undercurl" => style.add(NCSTYLE_UNDERCURL), - "struck" => style.add(NCSTYLE_STRUCK), - "bold" => style.add(NCSTYLE_BOLD), - "none" => (), - _ => { - errstr.push_str(s); - errstr.push(' '); - } - } - } - if errstr.is_empty() { - Ok(style) - } else { - let _ = errstr.pop(); - Err(NcError::new_msg(&format![ - "the following styles are not recognized: '{}'", - errstr - ])) - } - } - - /// Disables signals originating from the terminal's line discipline, i.e. - /// SIGINT (^C), SIGQUIT (^), and SIGTSTP (^Z). They are enabled by default. - /// - /// *C style function: [notcurses_linesigs_disable()][crate::notcurses_linesigs_disable].* - pub fn linesigs_disable(&mut self) -> NcResult<()> { - error![unsafe { crate::notcurses_linesigs_disable(self) }] - } - - /// Restores signals originating from the terminal's line discipline, i.e. - /// SIGINT (^C), SIGQUIT (^), and SIGTSTP (^Z), if disabled. - /// - /// *C style function: [notcurses_linesigs_enable()][crate::notcurses_linesigs_enable].* - pub fn linesigs_enable(&mut self) -> NcResult<()> { - error![unsafe { crate::notcurses_linesigs_enable(self) }] - } - - /// Disables mouse events. - /// - /// Any events in the input queue can still be delivered. - /// - /// *C style function: [notcurses_mouse_disable()][crate::notcurses_mouse_disable].* - pub fn mouse_disable(&mut self) -> NcResult<()> { - error![unsafe { crate::notcurses_mouse_disable(self) }] - } - - /// Enable the mouse in "button-event tracking" mode with focus detection - /// and UTF8-style extended coordinates. - /// - /// On success, mouse events will be published to [getc()][Nc#method.getc]. - /// - /// *C style function: [notcurses_mouse_enable()][crate::notcurses_mouse_enable].* - pub fn mouse_enable(&mut self) -> NcResult<()> { - error![ - unsafe { crate::notcurses_mouse_enable(self) }, - "Nc.mouse_enable()" - ] - } - - /// Returns the number of simultaneous colors claimed to be supported, - /// if there is color support. - /// - /// Note that several terminal emulators advertise more colors than they - /// actually support, downsampling internally. - /// - /// *C style function: [notcurses_palette_size()][crate::notcurses_palette_size].* - pub fn palette_size(&self) -> NcResult { - let res = unsafe { crate::notcurses_palette_size(self) }; - if res == 1 { - return Err(NcError::with_msg(1, "No color support ← Nc.palette_size()")); - } - Ok(res) - } - - /// Refreshes the physical screen to match what was last rendered (i.e., - /// without reflecting any changes since the last call to - /// [`render`][crate::Nc#method.render]). - /// - /// Returns the current screen geometry (`y`, `x`). - /// - /// This is primarily useful if the screen is externally corrupted, or if an - /// [NCKEY_RESIZE][crate::NCKEY_RESIZE] event has been read and you're not - /// yet ready to render. - /// - /// *C style function: [notcurses_refresh()][crate::notcurses_refresh].* - // - pub fn refresh(&mut self) -> NcResult<(NcDim, NcDim)> { - let (mut y, mut x) = (0, 0); - error![ - unsafe { crate::notcurses_refresh(self, &mut y, &mut x) }, - "", - (y as NcDim, x as NcDim) - ] - } - - /// Renders and rasterizes the standard pile in one shot. Blocking call. - /// - /// *C style function: [notcurses_render()][crate::notcurses_render].* - pub fn render(&mut self) -> NcResult<()> { - error![unsafe { crate::notcurses_render(self) }, "Nc.render()"] - } - - /// Performs the rendering and rasterization portion of - /// [`render`][Nc#method.render] but do not write the resulting buffer - /// out to the terminal. - /// - /// Using this function, the user can control the writeout process, - /// and render a second frame while writing another. - /// - // possible BUG? CHECK: - /// The returned buffer must be freed by the caller. - /// - /// *C style function: [notcurses_render_to_buffer()][crate::notcurses_render_to_buffer].* - // - // CHECK that this works. - pub fn render_to_buffer(&mut self, buffer: &mut Vec) -> NcResult<()> { - #[allow(unused_mut)] // CHECK whether it actually works without the mut - let mut len = buffer.len() as u32; - - // https://github.com/dankamongmen/notcurses/issues/1339 - #[cfg(any(target_arch = "x86_64", target_arch = "i686", target_arch = "x86"))] - let mut buf = buffer.as_mut_ptr() as *mut i8; - #[cfg(not(any(target_arch = "x86_64", target_arch = "i686", target_arch = "x86")))] - let mut buf = buffer.as_mut_ptr() as *mut u8; - - error![unsafe { crate::notcurses_render_to_buffer(self, &mut buf, &mut len.into()) }] - } - - /// Writes the last rendered frame, in its entirety, to 'fp'. - /// - /// If [`render`][Nc#method.render] has not yet been called, - /// nothing will be written. - /// - /// *C style function: [notcurses_render_to_file()][crate::notcurses_render_to_file].* - pub fn render_to_file(&mut self, fp: &mut NcFile) -> NcResult<()> { - error![unsafe { crate::notcurses_render_to_file(self, fp.as_nc_ptr()) }] - } - - /// Acquires an atomic snapshot of the notcurses object's stats. - /// - /// *C style function: [notcurses_stats()][crate::notcurses_stats].* - pub fn stats(&mut self, stats: &mut NcStats) { - unsafe { - crate::notcurses_stats(self, stats); - } - } - - /// Allocates an [`NcStats`] object. - /// - /// Use this rather than allocating your own, since future versions of - /// notcurses might enlarge this structure. - /// - /// *C style function: [notcurses_stats_alloc()][crate::notcurses_stats_alloc].* - pub fn stats_alloc(&mut self) -> &mut NcStats { - unsafe { &mut *crate::notcurses_stats_alloc(self) } - } - - /// Resets all cumulative stats (immediate ones, such as fbbytes, are not reset). - /// - /// *C style function: [notcurses_stats_reset()][crate::notcurses_stats_reset].* - pub fn stats_reset(&mut self, stats: &mut NcStats) { - unsafe { - crate::notcurses_stats_reset(self, stats); - } - } - - // TODO: decide what to do with these two: - // - // /// [notcurses_stdplane()][crate::notcurses_stdplane], plus free bonus - // /// dimensions written to non-NULL y/x! - // /// - // /// *C style function: [notcurses_stddim_yx()][crate::notcurses_stddim_yx].* - // #[inline] - // pub fn stddim_yx<'a>( - // &'a mut self, - // y: &mut NcDim, - // x: &mut NcDim, - // ) -> NcResult<&'a mut NcPlane> { - // crate::notcurses_stddim_yx(self, y, x) - // } - - // /// [stdplane_const()][Notcurses#method.stdplane_const], plus free - // /// bonus dimensions written to non-NULL y/x! - // /// - // /// *C style function: [notcurses_stddim_yx()][crate::notcurses_stddim_yx].* - // #[inline] - // pub fn stddim_yx_const<'a>( - // &'a self, - // y: &mut NcDim, - // x: &mut NcDim, - // ) -> NcResult<&'a NcPlane> { - // crate::notcurses_stddim_yx_const(self, y, x) - // } - - /// Returns a mutable reference to the standard [`NcPlane`] for this terminal. - /// - /// The standard plane always exists, and its origin is always at the - /// uppermost, leftmost cell. - /// - /// *C style function: [notcurses_stdplane()][crate::notcurses_stdplane].* - pub fn stdplane<'a>(&mut self) -> &'a mut NcPlane { - unsafe { &mut *crate::notcurses_stdplane(self) } - } - - /// Returns a reference to the standard [`NcPlane`] for this terminal. - /// - /// The standard plane always exists, and its origin is always at the - /// uppermost, leftmost cell. - /// - /// *C style function: [notcurses_stdplane_const()][crate::notcurses_stdplane_const].* - pub fn stdplane_const<'a>(&self) -> &'a NcPlane { - unsafe { &*crate::notcurses_stdplane_const(self) } - } - - /// Destroys the notcurses context. - /// - /// *C style function: [notcurses_stop()][crate::notcurses_stop].* - pub fn stop(&mut self) -> NcResult<()> { - error![unsafe { crate::notcurses_stop(self) }] - } - - /// Gets the name of an [`NcBlitter`] blitter. - /// - /// *C style function: [notcurses_str_blitter()][crate::notcurses_str_blitter].* - pub fn str_blitter(blitter: NcBlitter) -> String { - rstring![crate::notcurses_str_blitter(blitter)].to_string() - } - - /// Gets the name of an [`NcScale`] scaling mode. - /// - /// *C style function: [notcurses_str_scalemode()][crate::notcurses_str_scalemode].* - pub fn str_scalemode(scalemode: NcScale) -> String { - rstring![crate::notcurses_str_scalemode(scalemode)].to_string() - } - - /// Gets the lowercase name (or names) of the styles included in an [`NcStyle`]. - /// - /// *(No equivalent C style function)* - pub fn str_styles(style: NcStyle) -> String { - let mut string = String::new(); - for s in style.to_vec() { - string.push_str(match s { - NCSTYLE_ITALIC => "italic", - NCSTYLE_UNDERLINE => "underline", - NCSTYLE_UNDERCURL => "undercurl", - NCSTYLE_STRUCK => "struck", - NCSTYLE_BOLD => "bold", - #[allow(unreachable_patterns)] // FIXME - NCSTYLE_NONE => "none", - _ => "none", - }); - string.push(' '); - } - let _ = string.pop(); - string - } - - /// Returns an [`NcStyle`] with the supported curses-style attributes. - /// - /// The attribute is only indicated as supported if the terminal can support - /// it together with color. - /// - /// For more information, see the "ncv" capability in terminfo(5). - /// - /// *C style function: [notcurses_supported_styles()][crate::notcurses_supported_styles].* - pub fn supported_styles(&self) -> NcStyle { - unsafe { crate::notcurses_supported_styles(self) as NcStyle } - } - - /// Returns our current idea of the terminal dimensions in rows and cols. - /// - /// *C style function: [notcurses_term_dim_yx()][crate::notcurses_term_dim_yx].* - pub fn term_dim_yx(&self) -> (NcDim, NcDim) { - crate::notcurses_term_dim_yx(self) - } - - /// Returns the topmost [`NcPlane`], of which there is always at least one. - /// - /// *C style function: [notcurses_top()][crate::notcurses_top].* - pub fn top(&mut self) -> &mut NcPlane { - unsafe { &mut *crate::notcurses_top(self) } - } - - /// Returns a human-readable string describing the running notcurses version. - /// - /// *C style function: [notcurses_version()][crate::notcurses_version].* - pub fn version() -> String { - rstring![crate::notcurses_version()].to_string() - } - - /// Returns the running notcurses version components - /// (major, minor, patch, tweak). - /// - /// *C style function: [notcurses_version_components()][crate::notcurses_version_components].* - pub fn version_components() -> (u32, u32, u32, u32) { - let (mut major, mut minor, mut patch, mut tweak) = (0, 0, 0, 0); - unsafe { - crate::notcurses_version_components(&mut major, &mut minor, &mut patch, &mut tweak); - } - (major as u32, minor as u32, patch as u32, tweak as u32) - } -} diff --git a/rust/src/notcurses/mod.rs b/rust/src/notcurses/mod.rs deleted file mode 100644 index 04f587391..000000000 --- a/rust/src/notcurses/mod.rs +++ /dev/null @@ -1,247 +0,0 @@ -//! `Nc` - -// total: 53 -// --------------------------------------------------- -// (X) 1 : wont do -// (…) 4 : TODO / WIP -// -// (f) 45 : unsafe ffi function exported by bindgen -// (w) 0 : safely wrapped ffi function -// (r) 6 : static function manually reimplemented -// -// (m) 38 : method implemented -// -// (t) 13 : unit test done for the function -// (T) 0 : unit test done also for the method -// --------------------------------------------------- -// fm notcurses_at_yx -// fm notcurses_bottom -// fm notcurses_canbraille -// fmt notcurses_canchangecolor -// fmt notcurses_canfade -// fmt notcurses_canopen_images -// fmt notcurses_canopen_videos -// fmt notcurses_cansextant -// fmt notcurses_cantruecolor -// fmt notcurses_canutf8 -// fm notcurses_check_pixel_support -//~f notcurses_core_init -// fm notcurses_cursor_disable -// fm notcurses_cursor_enable -// f notcurses_cursor_yx -// fmt notcurses_debug -//~f notcurses_detected_terminal -// fmt notcurses_drop_planes -// fm notcurses_getc -// fmt notcurses_init -// fm notcurses_inputready_fd -// fm notcurses_lex_blitter -// fm notcurses_lex_margins -// fm notcurses_lex_scalemode -// fm notcurses_linesigs_disable -// fm notcurses_linesigs_enable -// fm notcurses_mouse_disable -// fm notcurses_mouse_enable -// fm notcurses_palette_size -// fm notcurses_refresh -// fm notcurses_render -// fm notcurses_render_to_buffer -// fm notcurses_render_to_file -// fm notcurses_stats -// fm notcurses_stats_alloc -// fm notcurses_stats_reset -// fm notcurses_stdplane -// fm notcurses_stdplane_const -// fmt notcurses_stop -// fm notcurses_str_blitter -// fm notcurses_str_scalemode -// fm notcurses_supported_styles -// fm notcurses_top -//X notcurses_ucs32_to_utf8 (not needed in rust) -// fmt notcurses_version -// fm notcurses_version_components -// rmt notcurses_align -// rm notcurses_getc_blocking -// rm notcurses_getc_nblock -//~r notcurses_stddim_yx // multiple mutable references errors -//~r notcurses_stddim_yx_const // -// rm notcurses_term_dim_yx - -#[cfg(test)] -mod test; - -mod helpers; -mod methods; -mod reimplemented; - -#[allow(unused_imports)] -pub(crate) use helpers::*; -pub use reimplemented::*; - -/// The full **notcurses** context. -/// -/// It's built atop the terminfo abstraction layer to provide reasonably -/// portable vivid character displays. -pub type Nc = crate::bindings::ffi::notcurses; - -#[deprecated] -#[doc(hidden)] -pub type Notcurses = Nc; - -/// Options struct for [`Notcurses`] -pub type NcOptions = crate::bindings::ffi::notcurses_options; - -#[deprecated] -#[doc(hidden)] -pub type NotcursesOptions = NcOptions; - -/// Do not call setlocale() -/// -/// notcurses_init() will call setlocale() to inspect the current locale. If -/// that locale is "C" or "POSIX", it will call setlocale(LC_ALL, "") to set -/// the locale according to the LANG environment variable. Ideally, this will -/// result in UTF8 being enabled, even if the client app didn't call -/// setlocale() itself. Unless you're certain that you're invoking setlocale() -/// prior to notcurses_init(), you should not set this bit. Even if you are -/// invoking setlocale(), this behavior shouldn't be an issue unless you're -/// doing something weird (setting a locale not based on LANG). -pub const NCOPTION_INHIBIT_SETLOCALE: u64 = crate::bindings::ffi::NCOPTION_INHIBIT_SETLOCALE as u64; - -/// Do not enter alternate mode. -/// -/// If smcup/rmcup capabilities are indicated, notcurses defaults to making use -/// of the "alternate screen". This flag inhibits use of smcup/rmcup. -pub const NCOPTION_NO_ALTERNATE_SCREEN: u64 = - crate::bindings::ffi::NCOPTION_NO_ALTERNATE_SCREEN as u64; - -/// Do not try to clear any preexisting bitmaps. -/// -/// Note that they might still get cleared even if this is set, and they might -/// not get cleared even if this is not set. -pub const NCOPTION_NO_CLEAR_BITMAPS: u64 = crate::bindings::ffi::NCOPTION_NO_CLEAR_BITMAPS as u64; - -/// Do not modify the font. -/// -/// Notcurses might attempt to change the font slightly, to support certain -/// glyphs (especially on the Linux console). If this is set, no such -/// modifications will be made. Note that font changes will not affect anything -/// but the virtual console/terminal in which notcurses is running. -pub const NCOPTION_NO_FONT_CHANGES: u64 = crate::bindings::ffi::NCOPTION_NO_FONT_CHANGES as u64; - -/// Do not handle SIG{ING, SEGV, ABRT, QUIT}. -/// -/// A signal handler will usually be installed for SIGINT, SIGQUIT, SIGSEGV, -/// SIGTERM, and SIGABRT, cleaning up the terminal on such exceptions. -/// With this flag, the handler will not be installed. -pub const NCOPTION_NO_QUIT_SIGHANDLERS: u64 = - crate::bindings::ffi::NCOPTION_NO_QUIT_SIGHANDLERS as u64; - -/// Do not handle SIGWINCH. -/// -/// A signal handler will usually be installed for SIGWINCH, resulting in -/// NCKEY_RESIZE events being generated on input. -/// With this flag, the handler will not be installed. -pub const NCOPTION_NO_WINCH_SIGHANDLER: u64 = - crate::bindings::ffi::NCOPTION_NO_WINCH_SIGHANDLER as u64; - -/// Initialize the standard plane's virtual cursor to match the physical cursor -/// at context creation time. -/// -/// Together with [`NCOPTION_NO_ALTERNATE_SCREEN`] and a scrolling standard plane, -/// this facilitates easy scrolling-style programs in rendered mode. -pub const NCOPTION_PRESERVE_CURSOR: u64 = crate::bindings::ffi::NCOPTION_PRESERVE_CURSOR as u64; - -/// Do not print banners. -/// -/// Notcurses typically prints version info in notcurses_init() and performance -/// info in notcurses_stop(). This inhibits that output. -pub const NCOPTION_SUPPRESS_BANNERS: u64 = crate::bindings::ffi::NCOPTION_SUPPRESS_BANNERS as u64; - -// NcLogLevel ------------------------------------------------------------------ - -/// Log level for [`NcOptions`] -/// -/// These log levels consciously map cleanly to those of libav; notcurses itself -/// does not use this full granularity. The log level does not affect the opening -/// and closing banners, which can be disabled via the `NcOptions` -/// `NCOPTION_SUPPRESS_BANNERS`. -/// Note that if stderr is connected to the same terminal on which we're -/// rendering, any kind of logging will disrupt the output. -pub type NcLogLevel = crate::bindings::ffi::ncloglevel_e; - -/// this is honestly a bit much -pub const NCLOGLEVEL_DEBUG: NcLogLevel = crate::bindings::ffi::ncloglevel_e_NCLOGLEVEL_DEBUG; - -/// we can't keep doin' this, but we can do other things -pub const NCLOGLEVEL_ERROR: NcLogLevel = crate::bindings::ffi::ncloglevel_e_NCLOGLEVEL_ERROR; - -/// we're hanging around, but we've had a horrible fault -pub const NCLOGLEVEL_FATAL: NcLogLevel = crate::bindings::ffi::ncloglevel_e_NCLOGLEVEL_FATAL; - -/// "detailed information -pub const NCLOGLEVEL_INFO: NcLogLevel = crate::bindings::ffi::ncloglevel_e_NCLOGLEVEL_INFO; - -/// print diagnostics immediately related to crashing -pub const NCLOGLEVEL_PANIC: NcLogLevel = crate::bindings::ffi::ncloglevel_e_NCLOGLEVEL_PANIC; - -/// default. print nothing once fullscreen service begins -pub const NCLOGLEVEL_SILENT: NcLogLevel = crate::bindings::ffi::ncloglevel_e_NCLOGLEVEL_SILENT; - -/// there's probably a better way to do what you want -pub const NCLOGLEVEL_TRACE: NcLogLevel = crate::bindings::ffi::ncloglevel_e_NCLOGLEVEL_TRACE; - -/// "detailed information -pub const NCLOGLEVEL_VERBOSE: NcLogLevel = crate::bindings::ffi::ncloglevel_e_NCLOGLEVEL_VERBOSE; - -/// you probably don't want what's happening to happen -pub const NCLOGLEVEL_WARNING: NcLogLevel = crate::bindings::ffi::ncloglevel_e_NCLOGLEVEL_WARNING; - -// NcAlign --------------------------------------------------------------------- - -/// Alignment within a plane or terminal. -/// Left/right-justified, or centered. -/// -/// ## Defined constants -/// -/// - [NCALIGN_UNALIGNED] -/// - [NCALIGN_LEFT] -/// - [NCALIGN_CENTER] -/// - [NCALIGN_RIGHT] -pub type NcAlign = crate::bindings::ffi::ncalign_e; - -/// Left alignment within an [`NcPlane`][crate::NcPlane] or terminal. -pub const NCALIGN_LEFT: NcAlign = crate::bindings::ffi::ncalign_e_NCALIGN_LEFT; - -/// Right alignment within an [`NcPlane`][crate::NcPlane] or terminal. -pub const NCALIGN_RIGHT: NcAlign = crate::bindings::ffi::ncalign_e_NCALIGN_RIGHT; - -/// Center alignment within an [`NcPlane`][crate::NcPlane] or terminal. -pub const NCALIGN_CENTER: NcAlign = crate::bindings::ffi::ncalign_e_NCALIGN_CENTER; - -/// Do not align an [`NcPlane`][crate::NcPlane] or terminal. -pub const NCALIGN_UNALIGNED: NcAlign = crate::bindings::ffi::ncalign_e_NCALIGN_UNALIGNED; - -// NcPixelImpl ----------------------------------------------------------------- - -/// Pixel blitting implementations. (Informative only). -/// -/// Returned by [`check_pixel_support`][Notcurses#method.check_pixel_support]. -pub type NcPixelImpl = crate::bindings::ffi::ncpixelimpl_e; - -/// No pixel support. -pub const NCPIXEL_NONE: NcPixelImpl = crate::bindings::ffi::ncpixelimpl_e_NCPIXEL_NONE; -/// Sixel -pub const NCPIXEL_SIXEL: NcPixelImpl = crate::bindings::ffi::ncpixelimpl_e_NCPIXEL_SIXEL; -/// Linux framebuffer. -pub const NCPIXEL_LINUXFB: NcPixelImpl = crate::bindings::ffi::ncpixelimpl_e_NCPIXEL_LINUXFB; -/// iTerm2 -pub const NCPIXEL_ITERM2: NcPixelImpl = crate::bindings::ffi::ncpixelimpl_e_NCPIXEL_ITERM2; -/// Kitty prior to C=1 and animation. -pub const NCPIXEL_KITTY_STATIC: NcPixelImpl = - crate::bindings::ffi::ncpixelimpl_e_NCPIXEL_KITTY_STATIC; -/// Kitty with animation but not reflexive composition. -pub const NCPIXEL_KITTY_ANIMATED: NcPixelImpl = - crate::bindings::ffi::ncpixelimpl_e_NCPIXEL_KITTY_ANIMATED; -/// Kitty with reflexive composition. -pub const NCPIXEL_KITTY_SELFREF: NcPixelImpl = - crate::bindings::ffi::ncpixelimpl_e_NCPIXEL_KITTY_SELFREF; diff --git a/rust/src/notcurses/reimplemented.rs b/rust/src/notcurses/reimplemented.rs deleted file mode 100644 index 875e698bd..000000000 --- a/rust/src/notcurses/reimplemented.rs +++ /dev/null @@ -1,119 +0,0 @@ -//! `notcurses_*` reimplemented functions. - -use core::ptr::{null, null_mut}; - -use crate::{ - Nc, NcAlign, NcDim, NcError, NcInput, NcOffset, NcPlane, NcResult, NcTime, NCALIGN_CENTER, - NCALIGN_LEFT, NCALIGN_RIGHT, NCRESULT_MAX, -}; - -/// Returns the offset into `availcols` at which `cols` ought be output given -/// the requirements of `align`. -/// -/// Returns `-`[`NCRESULT_MAX`] if [NCALIGN_UNALIGNED][crate::NCALIGN_UNALIGNED] -/// or invalid [NcAlign]. -/// -/// *Method: Nc.[align()][Nc#method.align].* -#[inline] -pub fn notcurses_align(availcols: NcDim, align: NcAlign, cols: NcDim) -> NcOffset { - if align == NCALIGN_LEFT { - return 0; - } - if cols > availcols { - return 0; - } - if align == NCALIGN_CENTER { - return ((availcols - cols) / 2) as NcOffset; - } - if align == NCALIGN_RIGHT { - return (availcols - cols) as NcOffset; - } - -NCRESULT_MAX // NCALIGN_UNALIGNED -} - -/// -/// If no event is ready, returns 0. -/// -/// *Method: Nc.[getc_nblock()][Nc#method.getc_nblock].* -// -// TODO: use from_u32 & return Option. -#[inline] -pub fn notcurses_getc_nblock(nc: &mut Nc, input: &mut NcInput) -> char { - unsafe { - let ts = NcTime { - tv_sec: 0, - tv_nsec: 0, - }; - core::char::from_u32_unchecked(crate::notcurses_get(nc, &ts, input)) - } -} - -/// Blocks until an event is processed or a signal is received. -/// -/// Optionally writes the event details in `input`. -/// -/// In case of an invalid read (including on EOF) *-1 as char* is returned. -/// -/// *Method: Nc.[getc_blocking()][Nc#method.getc_blocking].* -#[inline] -pub fn notcurses_getc_blocking(nc: &mut Nc, input: Option<&mut NcInput>) -> char { - let input_ptr; - if let Some(i) = input { - input_ptr = i as *mut _; - } else { - input_ptr = null_mut(); - } - unsafe { core::char::from_u32_unchecked(crate::notcurses_get(nc, null(), input_ptr)) } -} - -/// [notcurses_stdplane()][crate::notcurses_stdplane], plus free bonus -/// dimensions written to non-NULL y/x! -/// -/// *Method: Nc.[getc_stddim_yx()][Nc#method.stddim_yx].* -#[inline] -pub fn notcurses_stddim_yx<'a>( - nc: &'a mut Nc, - y: &mut NcDim, - x: &mut NcDim, -) -> NcResult<&'a mut NcPlane> { - unsafe { - let sp = crate::notcurses_stdplane(nc); - if !sp.is_null() { - crate::ncplane_dim_yx(sp, &mut (*y as i32), &mut (*x as i32)); - return Ok(&mut *sp); - } - } - Err(NcError::new()) -} - -/// [notcurses_stdplane_const()][crate::notcurses_stdplane_const], plus free -/// bonus dimensions written to non-NULL y/x! -/// -/// *Method: Nc.[getc_stddim_yx_const()][Nc#method.stddim_yx_const].* -#[inline] -pub fn notcurses_stddim_yx_const<'a>( - nc: &'a Nc, - y: &mut NcDim, - x: &mut NcDim, -) -> NcResult<&'a NcPlane> { - unsafe { - let sp = crate::notcurses_stdplane_const(nc); - if !sp.is_null() { - crate::ncplane_dim_yx(sp, &mut (*y as i32), &mut (*x as i32)); - return Ok(&*sp); - } - } - Err(NcError::new()) -} - -/// Returns our current idea of the terminal dimensions in rows and cols. -/// -/// *Method: Nc.[getc_term_yx()][Nc#method.term_yx].* -#[inline] -pub fn notcurses_term_dim_yx(nc: &Nc) -> (NcDim, NcDim) { - let (mut y, mut x) = (0, 0); - unsafe { - crate::ncplane_dim_yx(crate::notcurses_stdplane_const(nc), &mut y, &mut x); - } - (y as NcDim, x as NcDim) -} diff --git a/rust/src/notcurses/test/methods.rs b/rust/src/notcurses/test/methods.rs deleted file mode 100644 index 6ee077ed3..000000000 --- a/rust/src/notcurses/test/methods.rs +++ /dev/null @@ -1,4 +0,0 @@ -//! Test `Notcurses` methods and associated functions. - -// use crate::Notcurses; -// use serial_test::serial; diff --git a/rust/src/notcurses/test/mod.rs b/rust/src/notcurses/test/mod.rs deleted file mode 100644 index 759dc3d48..000000000 --- a/rust/src/notcurses/test/mod.rs +++ /dev/null @@ -1,7 +0,0 @@ -//! `Notcurses` tests. - -#[cfg(test)] -mod methods; - -#[cfg(test)] -mod reimplemented; diff --git a/rust/src/notcurses/test/reimplemented.rs b/rust/src/notcurses/test/reimplemented.rs deleted file mode 100644 index 6941d1b22..000000000 --- a/rust/src/notcurses/test/reimplemented.rs +++ /dev/null @@ -1,191 +0,0 @@ -//! Test `notcurses_*` reimplemented functions. - -use serial_test::serial; -use std::io::Read; - -use crate::{notcurses_init_test, notcurses_stop, NCRESULT_MAX}; - -use crate::NcFile; - -#[test] -#[serial] -fn notcurses_align() { - unsafe { - let nc = notcurses_init_test(); - assert_eq![0, crate::notcurses_align(30, crate::NCALIGN_LEFT, 20)]; - assert_eq![5, crate::notcurses_align(30, crate::NCALIGN_CENTER, 20)]; - assert_eq![10, crate::notcurses_align(30, crate::NCALIGN_RIGHT, 20)]; - assert_eq![ - -NCRESULT_MAX, - crate::notcurses_align(30, crate::NCALIGN_UNALIGNED, 20) - ]; - notcurses_stop(nc); - } -} - -#[test] -#[serial] -fn notcurses_canchangecolor() { - unsafe { - let nc = notcurses_init_test(); - let res = crate::notcurses_canchangecolor(nc); - notcurses_stop(nc); - print!("[{}] ", res); - } -} - -#[test] -#[serial] -fn notcurses_canfade() { - unsafe { - let nc = notcurses_init_test(); - let res = crate::notcurses_canfade(nc); - notcurses_stop(nc); - print!("[{}] ", res); - } -} - -#[test] -#[serial] -fn notcurses_canopen_images() { - unsafe { - let nc = notcurses_init_test(); - let res = crate::notcurses_canopen_images(nc); - notcurses_stop(nc); - print!("[{}] ", res); - } -} - -#[test] -#[serial] -fn notcurses_canopen_videos() { - unsafe { - let nc = notcurses_init_test(); - let res = crate::notcurses_canopen_videos(nc); - notcurses_stop(nc); - print!("[{}] ", res); - } -} - -#[test] -#[serial] -fn notcurses_cansextant() { - unsafe { - let nc = notcurses_init_test(); - let res = crate::notcurses_cansextant(nc); - notcurses_stop(nc); - print!("[{}] ", res); - } -} - -#[test] -#[serial] -fn notcurses_cantruecolor() { - unsafe { - let nc = notcurses_init_test(); - let res = crate::notcurses_cantruecolor(nc); - notcurses_stop(nc); - print!("[{}] ", res); - } -} - -#[test] -#[serial] -fn notcurses_canutf8() { - unsafe { - let nc = notcurses_init_test(); - let res = crate::notcurses_canutf8(nc); - notcurses_stop(nc); - print!("[{}] ", res); - } -} - -#[test] -#[serial] -fn notcurses_drop_planes() { - unsafe { - let nc = notcurses_init_test(); - let stdplane = crate::notcurses_stdplane(nc); - let plane1 = crate::ncplane_new_bound_test(&mut *stdplane, 0, 0, 10, 10); - let _plane2 = crate::ncplane_new_bound_test(plane1, 0, 0, 10, 10); - - crate::notcurses_drop_planes(nc); - // TODO: CHECK that planes are really dropped. - - notcurses_stop(nc); - } -} - -#[test] -#[serial] -fn notcurses_initialization() { - unsafe { - let nc = notcurses_init_test(); - assert![nc as *mut _ != core::ptr::null_mut()]; - notcurses_stop(nc); - } -} - -#[test] -#[serial] -#[ignore] -// FIXME: always return null -fn notcurses_at_yx() { - unsafe { - let nc = notcurses_init_test(); - let mut sm = 0; - let mut ch = 0; - let res = crate::notcurses_at_yx(nc, 0, 0, &mut sm, &mut ch); - notcurses_stop(nc); - assert![!res.is_null()]; - - //print!("[{}] ", res); - } -} - -#[test] -#[serial] -#[cfg_attr(target_os = "macos", ignore)] // FIXME -#[ignore] // FIXME https://github.com/dankamongmen/notcurses/issues/2111 -fn notcurses_debug() { - unsafe { - let nc = notcurses_init_test(); - - #[cfg(any( - target_arch = "s390x", - target_arch = "powerpc64le", - target_arch = "armv7hl", - target_arch = "aarch64" - ))] - let mut _p: *mut u8 = &mut 0; - #[cfg(not(any( - target_arch = "s390x", - target_arch = "powerpc64le", - target_arch = "armv7hl", - target_arch = "aarch64" - )))] - let mut _p: *mut i8 = &mut 0; - - let mut _size: *mut usize = &mut 0; - let mut file = NcFile::from_libc(libc::open_memstream(&mut _p, _size)); - crate::notcurses_debug(nc, file.as_nc_ptr()); - notcurses_stop(nc); - - let mut string1 = String::new(); - let _result = file.read_to_string(&mut string1); - - let string2 = - " -------------------------- notcurses debug state -----------------------------"; - - assert_eq![&string1[0..string2.len()], &string2[..]]; - } -} - -#[test] -#[serial] -// TODO test version_components -fn notcurses_version() { - let c_str = unsafe { crate::notcurses_version() }; - assert!(!c_str.is_null()); - print!("v{} ", crate::rstring![c_str]); -} diff --git a/rust/src/palette/methods.rs b/rust/src/palette/methods.rs deleted file mode 100644 index 7d2e678ab..000000000 --- a/rust/src/palette/methods.rs +++ /dev/null @@ -1,54 +0,0 @@ -//! `NcPalette` methods and associated functions. - -use crate::{error, Nc, NcChannel, NcComponent, NcPalette, NcPaletteIndex, NcResult, NcRgb}; - -impl NcPalette { - /// New `NcPalette`. - /// - /// *C style function: [ncpalette_new()][crate::ncpalette_new].* - pub fn new<'a>(nc: &mut Nc) -> &'a mut Self { - unsafe { &mut *crate::ncpalette_new(nc) } - } - - /// Frees this `NcPalette`. - /// - /// *C style function: [ncpalette_free()][crate::ncpalette_free].* - pub fn free(&mut self) { - unsafe { - crate::ncpalette_free(self); - } - } - - /// Attempts to configure the terminal with this NcPalette. - /// - /// *C style function: [ncpalette_use()][crate::ncpalette_use].* - pub fn r#use(&self, nc: &mut Nc) -> NcResult<()> { - error![unsafe { crate::ncpalette_use(nc, self) }] - } - - /// Returns the [`NcComponent`]s from the [`NcChannel`] in this `NcPalette`. - /// - /// *C style function: [ncpalette_get_rgb()][crate::ncpalette_get_rgb8].* - pub fn get_rgb8(&self, index: NcPaletteIndex) -> (NcComponent, NcComponent, NcComponent) { - let (mut r, mut g, mut b) = (0, 0, 0); - crate::ncchannel_rgb8(self.chans[index as usize], &mut r, &mut g, &mut b); - (r, g, b) - } - - /// Extracts the [`NcComponent`]s from an [`NcChannel`] entry inside - /// this NcPalette, and returns the NcChannel. - /// - /// *C style function: [ncpalette_get_rgb()][crate::ncpalette_get_rgb8].* - pub fn get_rgb(&self, index: NcPaletteIndex) -> NcChannel { - let (mut r, mut g, mut b) = (0, 0, 0); - crate::ncchannel_rgb8(self.chans[index as usize], &mut r, &mut g, &mut b) - } - - /// Sets the [`NcRgb`] value of the [`NcChannel`][crate::NcChannel] entry - /// inside this NcPalette. - /// - /// *C style function: [ncpalette_set()][crate::ncpalette_set].* - pub fn set(&mut self, index: NcPaletteIndex, rgb: NcRgb) { - crate::ncchannel_set(&mut self.chans[index as usize], rgb); - } -} diff --git a/rust/src/palette/mod.rs b/rust/src/palette/mod.rs deleted file mode 100644 index 904683f50..000000000 --- a/rust/src/palette/mod.rs +++ /dev/null @@ -1,49 +0,0 @@ -//! `NcPalette*` - -// ----------------------------------------------------------------------------- -// Now none of these functions can't fail and therefore don't return errors. -// ----------------------------------------------------------------------------- -// -// functions already exported by bindgen : 3 -// ----------------------------------------- -// (#) test: 0 -// (W) wrap: 3 / 0 -// ----------------------------------------- -//W ncpalette_free -//W ncpalette_new -//W ncpalette_use -// -// functions manually reimplemented: 5 -// ----------------------------------------- -// (+) done: 3 / 0 -// (#) test: 0 -// (W) wrap: 3 / 0 -// ----------------------------------------- -//W+ ncpalette_get_rgb -// ncpalette_get_rgb8 -//W+ ncpalette_set -//W+ ncpalette_set_rgb -// ncpalette_set_rgb8 - -mod methods; -mod reimplemented; -pub use methods::*; -pub use reimplemented::*; - -/// NcPalette structure consisting of an array of 256 -/// [`NcChannel`][crate::NcChannel]s. -/// -/// See also [NcPaletteIndex]. -/// -/// Some terminals only support 256 colors, but allow the full -/// palette to be specified with arbitrary RGB colors. In all cases, it's more -/// performant to use indexed colors, since it's much less data to write to the -/// terminal. If you can limit yourself to 256 colors, that's probably best. -/// -/// `type in C: ncncpalette (struct)` -/// -pub type NcPalette = crate::bindings::ffi::ncpalette; - -/// 8-bit value used for indexing into a [`NcPalette`] -/// -pub type NcPaletteIndex = u8; diff --git a/rust/src/palette/reimplemented.rs b/rust/src/palette/reimplemented.rs deleted file mode 100644 index e2bdfb135..000000000 --- a/rust/src/palette/reimplemented.rs +++ /dev/null @@ -1,42 +0,0 @@ -//! `ncpalette_*` reimplemented functions. - -use crate::{NcChannel, NcComponent, NcPalette, NcPaletteIndex, NcRgb}; - -/// Extracts the RGB [`NcComponent`]s from an [`NcChannel`] entry inside -/// an [`NcPalette`], and returns the `NcChannel`. -/// -/// *Method: NcPalette.[get_rgb()][NcPalette#method.get_rgb].* -/// *Method: NcPalette.[get_rgb8()][NcPalette#method.get_rgb8].* -#[inline] -pub fn ncpalette_get_rgb8( - palette: &NcPalette, - index: NcPaletteIndex, - red: &mut NcComponent, - green: &mut NcComponent, - blue: &mut NcComponent, -) -> NcChannel { - crate::ncchannel_rgb8(palette.chans[index as usize], red, green, blue) -} - -/// Sets the [`NcRgb`] value of the [`NcChannel`] entry inside an [`NcPalette`]. -/// -/// *Method: NcPalette.[set()][NcPalette#method.set].* -#[inline] -pub fn ncpalette_set(palette: &mut NcPalette, index: NcPaletteIndex, rgb: NcRgb) { - crate::ncchannel_set(&mut palette.chans[index as usize], rgb); -} - -/// Sets the RGB [`NcComponent`]s of the [`NcChannel`] entry inside an -/// [`NcPalette`]. -/// -/// *Method: NcPalette.[set_rgb()][NcPalette#method.set_rgb].* -#[inline] -pub fn ncpalette_set_rgb8( - palette: &mut NcPalette, - index: NcPaletteIndex, - red: NcComponent, - green: NcComponent, - blue: NcComponent, -) { - crate::ncchannel_set_rgb8(&mut palette.chans[index as usize], red, green, blue) -} diff --git a/rust/src/pixel.rs b/rust/src/pixel.rs deleted file mode 100644 index 430090b6b..000000000 --- a/rust/src/pixel.rs +++ /dev/null @@ -1,192 +0,0 @@ -//! The ncpixel API facilitates direct management of the pixels within an -//! ncvisual (ncvisuals keep a backing store of 32-bit RGBA pixels, and render -//! them down to terminal graphics in ncvisual_render()). -// -// - NOTE: The pixel color & alpha [`NcComponent`]s are u8 instead of u32. -// Because of type enforcing, some runtime checks are now unnecessary. -// -// - NOTE: None of the functions can't fail anymore and don't have to return an error. -// -// functions manually reimplemented: 10 -// ------------------------------------------ -// (+) done: 10 / 0 -// (#) test: 0 -// (W) wrap: 10 -// ------------------------------------------ -//W+ ncpixel -//W+ ncpixel_a -//W+ ncpixel_b -//W+ ncpixel_g -//W+ ncpixel_r -//W+ ncpixel_set_a -//W+ ncpixel_set_b -//W+ ncpixel_set_g -//W+ ncpixel_set_r -//W+ ncpixel_set_rgb8 - -use crate::NcComponent; - -// NcPixel (RGBA) -/// An ABGR pixel. -/// -/// ## Diagram -/// -/// ```txt -/// AAAAAAAA GGGGGGGG BBBBBBBB RRRRRRRR -/// ``` -/// -/// `type in C: ncpixel (uint32_t)` -/// -/// NcPixel has 8 bits of alpha, more or less linear, contributing -/// directly to the usual alpha blending equation. -/// -/// We map the 8 bits of alpha to 2 bits of alpha via a [level -/// function](https://nick-black.com/dankwiki/index.php?title=Notcurses#Transparency.2FContrasting) -/// -/// The ncpixel API facilitates direct management of the pixels within an -/// ncvisual (ncvisuals keep a backing store of 32-bit RGBA pixels, and render -/// them down to terminal graphics in ncvisual_render()). -/// -/// Per libav, we "store as BGRA on little-endian, and ARGB on big-endian". -/// This is an RGBA *byte-order* scheme. libav emits bytes, not words. Those -/// bytes are R-G-B-A. When read as words, on little endian this will be ABGR, -/// and on big-endian this will be RGBA. force everything to LE ABGR. -/// -pub type NcPixel = u32; - -/// Constructs a libav-compatible ABGR pixel from RGB [`NcComponent`]s. -#[inline] -#[allow(clippy::unnecessary_cast)] -pub const fn ncpixel(red: NcComponent, green: NcComponent, blue: NcComponent) -> NcPixel { - 0xff000000 as NcPixel | red as NcPixel | (blue as NcPixel) << 8 | (green as NcPixel) << 16 -} - -/// Extracts the 8-bit alpha [`NcComponent`] from an ABGR pixel. -#[inline] -pub const fn ncpixel_a(pixel: NcPixel) -> NcComponent { - ((pixel.to_le() & 0xff000000) >> 24) as NcComponent -} - -/// Extracts the 8 bit blue [`NcComponent`] from an ABGR pixel. -#[inline] -pub const fn ncpixel_b(pixel: NcPixel) -> NcComponent { - ((pixel.to_le() & 0x00ff0000) >> 16) as NcComponent -} - -/// Extracts the 8 bit green [`NcComponent`] from an ABGR pixel. -#[inline] -pub const fn ncpixel_g(pixel: NcPixel) -> NcComponent { - ((pixel.to_le() & 0x0000ff00) >> 8) as NcComponent -} - -/// Extracts the 8 bit red [`NcComponent`] from an ABGR pixel. -#[inline] -pub const fn ncpixel_r(pixel: NcPixel) -> NcComponent { - (pixel.to_le() & 0x000000ff) as NcComponent -} - -/// Sets the 8-bit alpha [`NcComponent`] of an ABGR pixel. -#[inline] -pub fn ncpixel_set_a(pixel: &mut NcPixel, alpha: NcComponent) { - *pixel = (((*pixel).to_le() & 0x00ffffff) | ((alpha as NcPixel) << 24)).to_le(); -} - -/// Sets the 8-bit blue [`NcComponent`] of an ABGR pixel. -#[inline] -pub fn ncpixel_set_b(pixel: &mut NcPixel, blue: NcComponent) { - *pixel = (((*pixel).to_le() & 0xffff00ff) | ((blue as NcPixel) << 8)).to_le(); -} - -/// Sets the 8-bit green [`NcComponent`] of an ABGR pixel. -#[inline] -pub fn ncpixel_set_g(pixel: &mut NcPixel, green: NcComponent) { - *pixel = (((*pixel).to_le() & 0xff00ffff) | ((green as NcPixel) << 16)).to_le(); -} - -/// Sets the 8-bit red [`NcComponent`] of an ABGR pixel. -#[inline] -pub fn ncpixel_set_r(pixel: &mut NcPixel, red: NcComponent) { - *pixel = (((*pixel).to_le() & 0xffffff00) | red as NcPixel).to_le(); -} - -/// Sets the RGB [`NcComponent`]s of an ABGR pixel. -#[inline] -pub fn ncpixel_set_rgb8( - pixel: &mut NcPixel, - red: NcComponent, - green: NcComponent, - blue: NcComponent, -) { - ncpixel_set_r(pixel, red); - ncpixel_set_g(pixel, green); - ncpixel_set_b(pixel, blue); -} - -/// Enables the [NcPixel] methods. -// -// NOTE: waiting for: https://github.com/rust-lang/rust/issues/56546 -// to move doc comments to the trait and appear unhidden at the implementation. -pub trait NcPixelMethods { - fn new(r: NcComponent, g: NcComponent, b: NcComponent) -> Self; - fn a(self) -> NcComponent; - fn b(self) -> NcComponent; - fn g(self) -> NcComponent; - fn r(self) -> NcComponent; - fn set_a(&mut self, green: NcComponent); - fn set_b(&mut self, blue: NcComponent); - fn set_g(&mut self, green: NcComponent); - fn set_r(&mut self, red: NcComponent); - fn set_rgb8(&mut self, red: NcComponent, green: NcComponent, blue: NcComponent); -} - -impl NcPixelMethods for NcPixel { - /// Constructs a libav-compatible ABGR pixel from RGB [`NcComponent`]s. - fn new(red: NcComponent, green: NcComponent, blue: NcComponent) -> Self { - ncpixel(red, green, blue) - } - - /// Extracts the 8-bit alpha [`NcComponent`] from an ABGR pixel. - fn a(self) -> NcComponent { - ncpixel_a(self) - } - - /// Extracts the 8 bit blue [`NcComponent`] from an ABGR pixel. - fn b(self) -> NcComponent { - ncpixel_b(self) - } - - /// Extracts the 8 bit green [`NcComponent`] from an ABGR pixel. - fn g(self) -> NcComponent { - ncpixel_g(self) - } - - /// Extracts the 8 bit red [`NcComponent`] from an ABGR pixel. - fn r(self) -> NcComponent { - ncpixel_r(self) - } - - /// Sets the 8-bit alpha [`NcComponent`] of an ABGR pixel. - fn set_a(&mut self, alpha: NcComponent) { - ncpixel_set_a(self, alpha) - } - - /// Sets the 8-bit green [`NcComponent`] of an ABGR pixel. - fn set_g(&mut self, green: NcComponent) { - ncpixel_set_b(self, green) - } - - /// Sets the 8-bit blue [`NcComponent`] of an ABGR pixel. - fn set_b(&mut self, blue: NcComponent) { - ncpixel_set_b(self, blue) - } - - /// Sets the 8-bit red [`NcComponent`] of an ABGR pixel. - fn set_r(&mut self, red: NcComponent) { - ncpixel_set_r(self, red) - } - - /// Sets the RGB [`NcComponent`]s of an ABGR pixel. - fn set_rgb8(&mut self, red: NcComponent, green: NcComponent, blue: NcComponent) { - ncpixel_set_rgb8(self, red, green, blue); - } -} diff --git a/rust/src/plane/helpers.rs b/rust/src/plane/helpers.rs deleted file mode 100644 index 56936b6f5..000000000 --- a/rust/src/plane/helpers.rs +++ /dev/null @@ -1,25 +0,0 @@ -use crate::{Nc, NcDim, NcOffset, NcPlane, NcPlaneOptions}; - -/// Helper function for a new NcPlane on C style tests. -#[allow(dead_code)] -pub(crate) unsafe fn ncplane_new_test<'a>( - nc: &mut Nc, - y: NcOffset, - x: NcOffset, - rows: NcDim, - cols: NcDim, -) -> &'a mut NcPlane { - &mut *crate::ncpile_create(nc, &NcPlaneOptions::new(y, x, rows, cols)) -} - -/// Helper function for a new bound NcPlane on C style tests. -#[allow(dead_code)] -pub(crate) unsafe fn ncplane_new_bound_test<'a>( - plane: &mut NcPlane, - y: NcOffset, - x: NcOffset, - rows: NcDim, - cols: NcDim, -) -> &'a mut NcPlane { - &mut *crate::ncplane_create(plane, &NcPlaneOptions::new(y, x, rows, cols)) -} diff --git a/rust/src/plane/methods.rs b/rust/src/plane/methods.rs deleted file mode 100644 index e3a6915e0..000000000 --- a/rust/src/plane/methods.rs +++ /dev/null @@ -1,2049 +0,0 @@ -//! `NcPlane*` methods and associated functions. -use core::{ - ptr::{null, null_mut}, - slice::from_raw_parts_mut, -}; - -use crate::{ - cstring, error, error_ref, error_ref_mut, rstring, Nc, NcAlign, NcAlphaBits, NcBlitter, - NcBoxMask, NcCell, NcChannel, NcChannels, NcComponent, NcDim, NcError, NcFadeCb, NcOffset, - NcPaletteIndex, NcPixelGeometry, NcPlane, NcPlaneOptions, NcResizeCb, NcResult, NcRgb, NcStyle, - NcTime, NCRESULT_ERR, -}; - -/// # NcPlaneOptions Constructors -impl NcPlaneOptions { - /// New NcPlaneOptions using the horizontal x. - pub fn new(y: NcOffset, x: NcOffset, rows: NcDim, cols: NcDim) -> Self { - Self::with_flags(y, x, rows, cols, None, 0, 0, 0) - } - - /// New NcPlaneOptions with horizontal alignment. - pub fn new_aligned(y: NcOffset, align: NcAlign, rows: NcDim, cols: NcDim) -> Self { - Self::with_flags_aligned(y, align, rows, cols, None, crate::NCPLANE_OPTION_HORALIGNED) - } - - /// New NcPlaneOptions, with flags. - pub fn with_flags( - y: NcOffset, - x: NcOffset, - rows: NcDim, - cols: NcDim, - resizecb: Option, - flags: u64, - margin_b: NcOffset, - margin_r: NcOffset, - ) -> Self { - NcPlaneOptions { - y: y as i32, - x: x as i32, - rows: rows as i32, - cols: cols as i32, - userptr: null_mut(), - name: null(), - resizecb: crate::ncresizecb_to_c(resizecb), - flags, - margin_b: margin_b as i32, - margin_r: margin_r as i32, - } - } - - /// New NcPlaneOptions, with flags and horizontal alignment. - /// - /// Note: Already includes the - /// [NCPLANE_OPTION_HORALIGNED][crate::NCPLANE_OPTION_HORALIGNED] flag. - pub fn with_flags_aligned( - y: NcOffset, - align: NcAlign, - rows: NcDim, - cols: NcDim, - resizecb: Option, - flags: u64, - ) -> Self { - let flags = crate::NCPLANE_OPTION_HORALIGNED | flags; - NcPlaneOptions { - y: y as i32, - x: align as i32, - rows: rows as i32, - cols: cols as i32, - userptr: null_mut(), - name: null(), - resizecb: crate::ncresizecb_to_c(resizecb), - flags, - margin_b: 0, - margin_r: 0, - } - } -} - -/// # NcPlane constructors & destructors -impl NcPlane { - /// New `NcPlane`. - /// - /// The returned plane will be the top, bottom, and root of this new pile. - /// - /// *C style function: [ncpile_create()][crate::ncpile_create].* - pub fn new<'a>( - nc: &mut Nc, - y: NcOffset, - x: NcOffset, - rows: NcDim, - cols: NcDim, - ) -> NcResult<&'a mut NcPlane> { - Self::with_options(nc, NcPlaneOptions::new(y, x, rows, cols)) - } - - /// New `NcPlane`, expects an [NcPlaneOptions] struct. - /// - /// The returned plane will be the top, bottom, and root of this new pile. - /// - /// *C style function: [ncpile_create()][crate::ncpile_create].* - pub fn with_options<'a>(nc: &mut Nc, options: NcPlaneOptions) -> NcResult<&'a mut NcPlane> { - error_ref_mut![ - unsafe { crate::ncpile_create(nc, &options) }, - &format!["NcPlane::with_options(Nc, {:?})", &options] - ] - } - - /// New `NcPlane`, bound to another NcPlane. - /// - /// *C style function: [ncplane_create()][crate::ncplane_create].* - pub fn new_bound<'a>( - bound_to: &mut NcPlane, - y: NcOffset, - x: NcOffset, - rows: NcDim, - cols: NcDim, - ) -> NcResult<&'a mut NcPlane> { - Self::with_options_bound(bound_to, NcPlaneOptions::new(y, x, rows, cols)) - } - - /// New `NcPlane`, bound to another plane, expects an [NcPlaneOptions] struct. - /// - /// *C style function: [ncplane_create()][crate::ncplane_create].* - pub fn with_options_bound<'a>( - bound_to: &mut NcPlane, - options: NcPlaneOptions, - ) -> NcResult<&'a mut NcPlane> { - error_ref_mut![ - unsafe { crate::ncplane_create(bound_to, &options) }, - &format!("NcPlane::with_options_bound(NcPlane, {:?})", &options) - ] - } - - /// New `NcPlane`, with the same dimensions of the terminal. - /// - /// The returned plane will be the top, bottom, and root of this new pile. - /// - /// *(No equivalent C style function)* - pub fn with_termsize<'a>(nc: &mut Nc) -> NcResult<&'a mut NcPlane> { - let (trows, tcols) = crate::notcurses_term_dim_yx(nc); - assert![(trows > 0) & (tcols > 0)]; - Self::with_options( - nc, - NcPlaneOptions::new(0, 0, trows as NcDim, tcols as NcDim), - ) - } - - /// Destroys this `NcPlane`. - /// - /// None of its contents will be visible after the next render call. - /// It is an error to attempt to destroy the standard plane. - /// - /// *C style function: [ncplane_destroy()][crate::ncplane_destroy].* - pub fn destroy(&mut self) -> NcResult<()> { - error![unsafe { crate::ncplane_destroy(self) }, "NcPlane.destroy()"] - } -} - -// ----------------------------------------------------------------------------- -/// ## NcPlane methods: `NcAlphaBits` -impl NcPlane { - /// Gets the foreground [`NcAlphaBits`] from this `NcPlane`, shifted to LSBs. - /// - /// *C style function: [ncplane_fg_alpha()][crate::ncplane_fg_alpha].* - #[inline] - pub fn fg_alpha(&self) -> NcAlphaBits { - crate::ncchannels_fg_alpha(crate::ncplane_channels(self)) - } - - /// Gets the background [`NcAlphaBits`] for this `NcPlane`, shifted to LSBs. - /// - /// *C style function: [ncplane_bg_alpha()][crate::ncplane_bg_alpha].* - #[inline] - pub fn bg_alpha(&self) -> NcAlphaBits { - crate::ncchannels_bg_alpha(crate::ncplane_channels(self)) - } - - /// Sets the foreground [`NcAlphaBits`] from this `NcPlane`. - /// - /// *C style function: [ncplane_set_fg_alpha()][crate::ncplane_set_fg_alpha].* - pub fn set_fg_alpha(&mut self, alpha: NcAlphaBits) -> NcResult<()> { - error![ - unsafe { crate::ncplane_set_fg_alpha(self, alpha as i32) }, - &format!("NcPlane.set_fg_alpha({:0X})", alpha) - ] - } - - /// Sets the background [`NcAlphaBits`] for this `NcPlane`. - /// - /// *C style function: [ncplane_set_bg_alpha()][crate::ncplane_set_bg_alpha].* - pub fn set_bg_alpha(&mut self, alpha: NcAlphaBits) -> NcResult<()> { - error![ - unsafe { crate::ncplane_set_bg_alpha(self, alpha as i32) }, - &format!("NcPlane.set_bg_alpha({:0X})", alpha) - ] - } -} - -// ----------------------------------------------------------------------------- -/// ## NcPlane methods: `NcChannel` -impl NcPlane { - /// Gets the current [`NcChannels`] from this `NcPlane`. - /// - /// *C style function: [ncplane_channels()][crate::ncplane_channels].* - pub fn channels(&self) -> NcChannels { - crate::ncplane_channels(self) - } - - /// Sets the current [`NcChannels`] for this `NcPlane`. - /// - /// *C style function: [ncplane_set_channels()][crate::ncplane_set_channels].* - pub fn set_channels(&mut self, channels: NcChannels) { - crate::ncplane_set_channels(self, channels); - } - - /// Gets the foreground [`NcChannel`] from an [NcPlane]. - /// - /// *C style function: [ncplane_fchannel()][crate::ncplane_fchannel].* - #[inline] - pub fn fchannel(&self) -> NcChannel { - crate::ncchannels_fchannel(crate::ncplane_channels(self)) - } - - /// Gets the background [`NcChannel`] from an [NcPlane]. - /// - /// *C style function: [ncplane_bchannel()][crate::ncplane_bchannel].* - #[inline] - pub fn bchannel(&self) -> NcChannel { - crate::ncchannels_bchannel(crate::ncplane_channels(self)) - } - - /// Sets the current foreground [`NcChannel`] for this `NcPlane`. - /// Returns the updated [`NcChannels`]. - /// - /// *C style function: [ncplane_set_fchannel()][crate::ncplane_set_fchannel].* - pub fn set_fchannel(&mut self, channel: NcChannel) -> NcChannels { - crate::ncplane_set_fchannel(self, channel) - } - - /// Sets the current background [`NcChannel`] for this `NcPlane`. - /// Returns the updated [`NcChannels`]. - /// - /// *C style function: [ncplane_set_bchannel()][crate::ncplane_set_bchannel].* - pub fn set_bchannel(&mut self, channel: NcChannel) -> NcChannels { - crate::ncplane_set_bchannel(self, channel) - } - - /// Sets the given [`NcChannels`]s throughout the specified region, - /// keeping content and attributes unchanged. - /// - /// Returns the number of cells set. - /// - /// *C style function: [ncplane_stain()][crate::ncplane_stain].* - pub fn stain( - &mut self, - y_stop: NcDim, - x_stop: NcDim, - ul: NcChannels, - ur: NcChannels, - ll: NcChannels, - lr: NcChannels, - ) -> NcResult { - let res = - unsafe { crate::ncplane_stain(self, y_stop as i32, x_stop as i32, ul, ur, ll, lr) }; - error![ - res, - &format!( - "NcPlane.stain({}, {}, {:0X}, {:0X}, {:0X}, {:0X})", - y_stop, x_stop, ul, ur, ll, lr - ), - res as u32 - ] - } -} - -// ----------------------------------------------------------------------------- -/// ## NcPlane methods: `NcComponent`, `NcRgb` & default color -impl NcPlane { - /// Gets the foreground RGB [`NcComponent`]s from this `NcPlane`. - /// - /// *C style function: [ncplane_fg_rgb8()][crate::ncplane_fg_rgb8].* - #[inline] - pub fn fg_rgb8(&self) -> (NcComponent, NcComponent, NcComponent) { - let (mut r, mut g, mut b) = (0, 0, 0); - let _ = crate::ncchannels_fg_rgb8(crate::ncplane_channels(self), &mut r, &mut g, &mut b); - (r, g, b) - } - - /// Gets the background RGB [`NcComponent`]s from this `NcPlane`. - /// - /// *C style function: [ncplane_bg_rgb8()][crate::ncplane_bg_rgb8].* - #[inline] - pub fn bg_rgb8(&self) -> (NcComponent, NcComponent, NcComponent) { - let (mut r, mut g, mut b) = (0, 0, 0); - let _ = crate::ncchannels_bg_rgb8(crate::ncplane_channels(self), &mut r, &mut g, &mut b); - (r, g, b) - } - - /// Sets the foreground RGB [`NcComponent`]s for this `NcPlane`. - /// - /// If the terminal does not support directly-specified 3x8b cells - /// (24-bit "TrueColor", indicated by the "RGB" terminfo capability), - /// the provided values will be interpreted in some lossy fashion. - /// - /// "HP-like" terminals require setting foreground and background at the same - /// time using "color pairs"; notcurses will manage color pairs transparently. - /// - /// *C style function: [ncplane_set_fg_rgb8()][crate::ncplane_set_fg_rgb8].* - pub fn set_fg_rgb8(&mut self, red: NcComponent, green: NcComponent, blue: NcComponent) { - unsafe { - // Can't fail because of type enforcing. - let _ = crate::ncplane_set_fg_rgb8(self, red as u32, green as u32, blue as u32); - } - } - - /// Sets the background RGB [`NcComponent`]s for this `NcPlane`. - /// - /// If the terminal does not support directly-specified 3x8b cells - /// (24-bit "TrueColor", indicated by the "RGB" terminfo capability), - /// the provided values will be interpreted in some lossy fashion. - /// - /// "HP-like" terminals require setting foreground and background at the same - /// time using "color pairs"; notcurses will manage color pairs transparently. - /// - /// *C style function: [ncplane_set_bg_rgb8()][crate::ncplane_set_bg_rgb8].* - pub fn set_bg_rgb8(&mut self, red: NcComponent, green: NcComponent, blue: NcComponent) { - unsafe { - // Can't fail because of type enforcing. - let _ = crate::ncplane_set_bg_rgb8(self, red as u32, green as u32, blue as u32); - } - } - - /// Gets the foreground [`NcRgb`] from this `NcPlane`, shifted to LSBs. - /// - /// *C style function: [ncplane_fg_rgb()][crate::ncplane_fg_rgb].* - #[inline] - pub fn fg_rgb(&self) -> NcRgb { - crate::ncchannels_fg_rgb(crate::ncplane_channels(self)) - } - - /// Gets the background [`NcRgb`] from this `NcPlane`, shifted to LSBs. - /// - /// *C style function: [ncplane_bg_rgb()][crate::ncplane_bg_rgb].* - #[inline] - pub fn bg_rgb(&self) -> NcRgb { - crate::ncchannels_bg_rgb(crate::ncplane_channels(self)) - } - - /// Sets the foreground [`NcRgb`] for this `NcPlane`. - /// - /// *C style function: [ncplane_set_fg_rgb()][crate::ncplane_set_fg_rgb].* - #[inline] - pub fn set_fg_rgb(&mut self, rgb: NcRgb) { - unsafe { - crate::ncplane_set_fg_rgb(self, rgb); - } - } - - /// Sets the background [`NcRgb`] for this `NcPlane`. - /// - /// *C style function: [ncplane_set_bg_rgb()][crate::ncplane_set_bg_rgb].* - #[inline] - pub fn set_bg_rgb(&mut self, rgb: NcRgb) { - unsafe { - crate::ncplane_set_bg_rgb(self, rgb); - } - } - - /// Is this `NcPlane`'s foreground using the "default foreground color"? - /// - /// *C style function: [ncplane_fg_default_p()][crate::ncplane_fg_default_p].* - #[inline] - pub fn fg_default(&self) -> bool { - crate::ncchannels_fg_default_p(crate::ncplane_channels(self)) - } - - /// Is this `NcPlane`'s background using the "default background color"? - /// - /// *C style function: [ncplane_bg_default_p()][crate::ncplane_bg_default_p].* - #[inline] - pub fn bg_default(&self) -> bool { - crate::ncchannels_bg_default_p(crate::ncplane_channels(self)) - } - - /// Uses the default color for the foreground. - /// - /// *C style function: [ncplane_set_fg_default()][crate::ncplane_set_fg_default].* - #[inline] - pub fn set_fg_default(&mut self) { - unsafe { - crate::ncplane_set_fg_default(self); - } - } - - /// Uses the default color for the background. - /// - /// *C style function: [ncplane_set_bg_default()][crate::ncplane_set_bg_default].* - #[inline] - pub fn set_bg_default(&mut self) { - unsafe { - crate::ncplane_set_bg_default(self); - } - } - - /// Marks the foreground as NOT using the default color. - /// - /// Returns the new [`NcChannels`]. - /// - /// *C style function: [ncplane_set_fg_not_default()][crate::ncplane_set_fg_not_default].* - // - // Not in the C API - #[inline] - pub fn set_fg_not_default(&mut self) -> NcChannels { - crate::ncplane_set_fg_not_default(self) - } - - /// Marks the background as NOT using the default color. - /// - /// Returns the new [`NcChannels`]. - /// - /// *C style function: [ncplane_set_bg_not_default()][crate::ncplane_set_bg_not_default].* - // - // Not in the C API - #[inline] - pub fn set_bg_not_default(&mut self) -> NcChannels { - crate::ncplane_set_bg_not_default(self) - } - - /// Marks both the foreground and background as using the default color. - /// - /// Returns the new [`NcChannels`]. - /// - /// *C style function: [ncplane_set_default()][crate::ncplane_set_default].* - // - // Not in the C API - #[inline] - pub fn set_default(&mut self) -> NcChannels { - crate::ncplane_set_default(self) - } - - /// Marks both the foreground and background as NOT using the default color. - /// - /// Returns the new [`NcChannels`]. - /// - /// *C style function: [ncplane_set_not_default()][crate::ncplane_set_not_default].* - // - // Not in the C API - #[inline] - pub fn set_not_default(&mut self) -> NcChannels { - crate::ncplane_set_not_default(self) - } -} - -// ----------------------------------------------------------------------------- -/// ## NcPlane methods: `NcStyle` & `PaletteIndex` -impl NcPlane { - /// Sets the given style throughout the specified region, keeping content - /// and channels unchanged. - /// - /// Returns the number of cells set. - /// - /// *C style function: [ncplane_format()][crate::ncplane_format].* - pub fn format(&mut self, y_stop: NcDim, x_stop: NcDim, stylemask: NcStyle) -> NcResult { - let res = - unsafe { crate::ncplane_format(self, y_stop as i32, x_stop as i32, stylemask as u32) }; - error![ - res, - &format!("NcPlane.format({}, {}, {:0X})", y_stop, x_stop, stylemask), - res as u32 - ] - } - - /// Returns the current styling for this `NcPlane`. - /// - /// *C style function: [ncplane_styles()][crate::ncplane_styles].* - pub fn styles(&self) -> NcStyle { - unsafe { crate::ncplane_styles(self) } - } - - /// Removes the specified styles from this `NcPlane`'s existing spec. - /// - /// *C style function: [ncplane_off_styles()][crate::ncplane_off_styles].* - pub fn off_styles(&mut self, stylemask: NcStyle) { - unsafe { - crate::ncplane_off_styles(self, stylemask as u32); - } - } - - /// Adds the specified styles to this `NcPlane`'s existing spec. - /// - /// *C style function: [ncplane_on_styles()][crate::ncplane_on_styles].* - pub fn on_styles(&mut self, stylemask: NcStyle) { - unsafe { - crate::ncplane_on_styles(self, stylemask as u32); - } - } - - /// Sets just the specified styles for this `NcPlane`. - /// - /// *C style function: [ncplane_set_styles()][crate::ncplane_set_styles].* - pub fn set_styles(&mut self, stylemask: NcStyle) { - unsafe { - crate::ncplane_set_styles(self, stylemask as u32); - } - } - - /// Sets this `NcPlane`'s foreground [NcPaletteIndex]. - /// - /// Also sets the foreground palette index bit, sets it foreground-opaque, - /// and clears the foreground default color bit. - /// - /// *C style function: [ncplane_set_fg_palindex()][crate::ncplane_set_fg_palindex].* - pub fn set_fg_palindex(&mut self, palindex: NcPaletteIndex) { - unsafe { - crate::ncplane_set_fg_palindex(self, palindex as i32); - } - } - - /// Sets this `NcPlane`'s background [NcPaletteIndex]. - /// - /// Also sets the background palette index bit, sets it background-opaque, - /// and clears the background default color bit. - /// - /// *C style function: [ncplane_set_bg_palindex()][crate::ncplane_set_bg_palindex].* - pub fn set_bg_palindex(&mut self, palindex: NcPaletteIndex) { - unsafe { - crate::ncplane_set_bg_palindex(self, palindex as i32); - } - } -} - -// ----------------------------------------------------------------------------- -/// ## NcPlane methods: `NcCell` & strings -impl NcPlane { - /// Retrieves the current contents of the [`NcCell`] under the cursor, - /// returning the `EGC` and writing out the [`NcStyle`] and the [`NcChannels`]. - /// - /// This `EGC` must be freed by the caller. - /// - /// *C style function: [ncplane_at_cursor()][crate::ncplane_at_cursor].* - pub fn at_cursor( - &mut self, - stylemask: &mut NcStyle, - channels: &mut NcChannels, - ) -> NcResult { - let egc = unsafe { crate::ncplane_at_cursor(self, stylemask, channels) }; - if egc.is_null() { - return Err(NcError::with_msg( - NCRESULT_ERR, - &format!("NcPlane.at_cursor({:0X}, {:0X})", stylemask, channels), - )); - } - Ok(rstring![egc].into()) - } - - /// Retrieves the current contents of the [`NcCell`] under the cursor - /// into `cell`. Returns the number of bytes in the `EGC`. - /// - /// This NcCell is invalidated if the associated NcPlane is destroyed. - /// - /// *C style function: [ncplane_at_cursor_cell()][crate::ncplane_at_cursor_cell].* - #[inline] - pub fn at_cursor_cell(&mut self, cell: &mut NcCell) -> NcResult { - let bytes = unsafe { crate::ncplane_at_cursor_cell(self, cell) }; - error![ - bytes, - &format!("NcPlane.at_cursor_cell({:?})", cell), - bytes as u32 - ] - } - - /// Retrieves the current contents of the specified [`NcCell`], returning the - /// `EGC` and writing out the [`NcStyle`] and the [`NcChannels`]. - /// - /// This `EGC` must be freed by the caller. - /// - /// *C style function: [ncplane_at_yx()][crate::ncplane_at_yx].* - pub fn at_yx( - &mut self, - y: NcDim, - x: NcDim, - stylemask: &mut NcStyle, - channels: &mut NcChannels, - ) -> NcResult { - let egc = unsafe { crate::ncplane_at_yx(self, y as i32, x as i32, stylemask, channels) }; - if egc.is_null() { - return Err(NcError::with_msg( - NCRESULT_ERR, - &format!( - "NcPlane.at_yx({}, {}, {:0X}, {:0X})", - y, x, stylemask, channels - ), - )); - } - Ok(rstring![egc].into()) - } - - /// Retrieves the current contents of the specified [`NcCell`] into `cell`. - /// Returns the number of bytes in the `EGC`. - /// - /// This NcCell is invalidated if the associated plane is destroyed. - /// - /// *C style function: [ncplane_at_yx_cell()][crate::ncplane_at_yx_cell].* - #[inline] - pub fn at_yx_cell(&mut self, y: NcDim, x: NcDim, cell: &mut NcCell) -> NcResult { - let bytes = unsafe { crate::ncplane_at_yx_cell(self, y as i32, x as i32, cell) }; - error![ - bytes, - &format!("NcPlane.at_yx_cell({}, {}, {:?})", y, x, cell), - bytes as u32 - ] - } - - /// Extracts this `NcPlane`'s base [`NcCell`]. - /// - /// The reference is invalidated if this `NcPlane` is destroyed. - /// - /// *C style function: [ncplane_base()][crate::ncplane_base].* - pub fn base(&mut self) -> NcResult { - let mut cell = NcCell::new(); - let res = unsafe { crate::ncplane_base(self, &mut cell) }; - error![res, "NcPlane.base()", cell] - } - - /// Sets this `NcPlane`'s base [`NcCell`] from its components. - /// - /// Returns the number of bytes copied out of `egc` if succesful. - /// - /// It will be used for purposes of rendering anywhere that the `NcPlane`'s - /// gcluster is 0. - /// - /// Note that erasing the `NcPlane` does not reset the base cell. - /// - /// *C style function: [ncplane_set_base()][crate::ncplane_set_base].* - // call stack: - // - ncplane_set_base calls nccell_prime: - // return nccell_prime(ncp, &ncp->basecell, egc, stylemask, channels); - // - nccell_prime calls notcurses.c/nccell_load: - // return nccell_load(n, c, gcluster); - // - cell-load calls internal.h/pool load: - // return pool_load(&n->pool, c, gcluster); - pub fn set_base( - &mut self, - egc: &str, - stylemask: NcStyle, - channels: NcChannels, - ) -> NcResult { - let res = - unsafe { crate::ncplane_set_base(self, cstring![egc], stylemask as u32, channels) }; - error![ - res, - &format!( - "NcPlane.set_base({:?}, {:0X}, {:0X})", - egc, stylemask, channels - ), - res as u32 - ] - } - - /// Sets this `NcPlane`'s base [`NcCell`]. - /// - /// It will be used for purposes of rendering anywhere that the `NcPlane`'s - /// gcluster is 0. - /// - /// Note that erasing the `NcPlane` does not reset the base cell. - /// - /// *C style function: [ncplane_set_base_cell()][crate::ncplane_set_base_cell].* - pub fn set_base_cell(&mut self, cell: &NcCell) -> NcResult<()> { - error![ - unsafe { crate::ncplane_set_base_cell(self, cell) }, - &format!("NcPlane.base({:?})", cell) - ] - } - - /// Creates a flat string from the `EGC`'s of the selected region of the - /// `NcPlane`. - /// - /// Starts at the plane's `beg_y` * `beg_x` coordinates (which must lie on - /// the plane), continuing for `len_y` x `len_x` cells. - /// - /// If either `through_y` or `through_x` are true, then `len_y` or `len_x`, - /// will be respectively ignored, and will go through the boundary of the plane. - /// - /// *C style function: [ncplane_contents()][crate::ncplane_contents].* - pub fn contents( - &mut self, - beg_y: NcDim, - beg_x: NcDim, - len_y: NcDim, - len_x: NcDim, - through_y: bool, - through_x: bool, - ) -> String { - let (mut len_y, mut len_x) = (len_y as i32, len_x as i32); - if through_y { - len_y = -1; - } - if through_x { - len_x = -1; - } - rstring![crate::ncplane_contents( - self, - beg_y as i32, - beg_x as i32, - len_y, - len_x - )] - .to_string() - } - - /// Erases every [`NcCell`] in this `NcPlane`, resetting all attributes to - /// normal, all colors to the default color, and all cells to undrawn. - /// - /// All cells associated with this `NcPlane` are invalidated, and must not - /// be used after the call, excluding the base cell. The cursor is homed. - /// - /// *C style function: [ncplane_erase()][crate::ncplane_erase].* - pub fn erase(&mut self) { - unsafe { - crate::ncplane_erase(self); - } - } - - /// Replaces the `NcCell` at the **specified** coordinates with the provided - /// `NcCell`, advancing the cursor by its width (but not past the end of - /// the plane). - /// - /// The new `NcCell` must already be associated with the `NcPlane`. - /// - /// Returns the number of columns the cursor was advanced. - /// - /// *C style function: [ncplane_putc_yx()][crate::ncplane_putc_yx].* - pub fn putc_yx(&mut self, y: NcDim, x: NcDim, cell: &NcCell) -> NcResult { - let res = unsafe { crate::ncplane_putc_yx(self, y as i32, x as i32, cell) }; - error![ - res, - &format!("NcPlane.putc_yx({}, {}, {:?})", y, x, cell), - res as NcDim - ] - } - - /// Replaces the [`NcCell`] at the **current** coordinates with the provided - /// `NcCell`, advancing the cursor by its width (but not past the end of - /// the plane). - /// - /// The new `NcCell` must already be associated with the `NcPlane`. - /// - /// Returns the number of columns the cursor was advanced. - /// - /// *C style function: [ncplane_putc()][crate::ncplane_putc].* - pub fn putc(&mut self, cell: &NcCell) -> NcResult { - let res = crate::ncplane_putc(self, cell); - error![res, &format!("NcPlane.putc({:?})", cell), res as NcDim] - } - - /// Calls [`putchar_yx`][NcPlane#method.putchar_yx] at the current cursor - /// location. - /// - /// Returns the number of columns the cursor was advanced. - /// - /// *C style function: [ncplane_putchar()][crate::ncplane_putchar].* - pub fn putchar(&mut self, ch: char) -> NcResult { - let res = crate::ncplane_putchar(self, ch); - error![res, &format!("NcPlane.putchar({:?})", ch), res as NcDim] - } - - // TODO: call put_egc - // /// Replaces the `EGC` to the current location, but retain - // /// the styling. The current styling of the plane will not be changed. - // pub fn putchar_stained(&mut self, y: NcDim, x: NcDim, ch: char) -> - // NcResult { - // error![crate::ncplane_putchar_stained(self, ch)] - // } - - /// Replaces the [NcCell] at the `y`,`x` coordinates with the provided - /// 7-bit `char`, but retain the styling. - /// The current styling of the plane will not be changed. - /// - /// On success, returns the number of columns the cursor was advanced. - /// - /// *C style function: [ncplane_putchar_yx()][crate::ncplane_putchar_yx].* - pub fn putchar_yx(&mut self, y: NcDim, x: NcDim, ch: char) -> NcResult { - let res = crate::ncplane_putchar_yx(self, y, x, ch); - error![ - res, - &format!("NcPlane.putchar_yx({}, {}, {:?})", y, x, ch), - res as NcDim - ] - } - - /// Writes a string to the current location, using the current style. - /// - /// Advances the cursor by some positive number of columns (though not - /// beyond the end of the plane), and this number is returned on success. - /// - /// On error, a non-positive number is returned, indicating - /// the number of columns which were written before the error. - /// - /// *C style function: [ncplane_putstr()][crate::ncplane_putstr].* - #[inline] - pub fn putstr(&mut self, string: &str) -> NcResult { - let res = crate::ncplane_putstr(self, string); - error![res, &format!("NcPlane.putstr({:?})", string), res as NcDim] - } - - /// Same as [`putstr`][NcPlane#method.putstr], but it also tries to move the - /// cursor to the beginning of the next row. - /// - /// Advances the cursor by some positive number of columns (though not - /// beyond the end of the plane); this number will be returned on success, - /// after calling [`putln`][NcPlane#method.putln]. - /// - /// On error, a non-positive number is returned, indicating the number of - /// columns which were written before the error. - /// - /// *(No equivalent C style function)* - pub fn putstrln(&mut self, string: &str) -> NcResult { - let cols = self.putstr(string)?; - self.putln()?; - Ok(cols) - } - - /// Moves the cursor to the beginning of the next row. - /// - /// *(No equivalent C style function)* - pub fn putln(&mut self) -> NcResult<()> { - let (y, _x) = self.cursor_yx(); - self.cursor_move_yx(y + 1, 0)?; - Ok(()) - } - - /// Same as [`putstr_yx()`][NcPlane#method.putstr_yx] - /// but [`NcAlign`]ed on x. - /// - /// *C style function: [ncplane_putstr_aligned()][crate::ncplane_putstr_aligned].* - pub fn putstr_aligned(&mut self, y: NcDim, align: NcAlign, string: &str) -> NcResult { - let res = unsafe { crate::ncplane_putstr_aligned(self, y as i32, align, cstring![string]) }; - error![ - res, - &format!("NcPlane.putstr_aligned({}, {}, {:?})", y, align, string), - res as NcDim - ] - } - - /// Writes a string to the current location, but retains the styling. - /// - /// The current styling of the plane will not be changed. - /// - /// Advances the cursor by some positive number of columns (though not - /// beyond the end of the plane); this number is returned on success. - /// - /// On error, a non-positive number is returned, indicating the number of - /// columns which were written before the error. - /// - /// *C style function: [ncplane_putstr_stained()][crate::ncplane_putstr_stained].* - pub fn putstr_stained(&mut self, string: &str) -> NcResult { - let res = unsafe { crate::ncplane_putstr_stained(self, cstring![string]) }; - error![ - res, - &format!("NcPlane.putstr_stained({:?})", string), - res as NcDim - ] - } - - /// Writes a string to the provided location, using the current style. - /// - /// They will be interpreted as a series of columns. - /// - /// Advances the cursor by some positive number of columns (though not - /// beyond the end of the plane); this number is returned on success. - /// - /// On error, a non-positive number is returned, indicating the number of - /// columns which were written before the error. - /// - /// *C style function: [ncplane_putstr_yx()][crate::ncplane_putstr_yx].* - pub fn putstr_yx(&mut self, y: NcDim, x: NcDim, string: &str) -> NcResult { - let res = unsafe { crate::ncplane_putstr_yx(self, y as i32, x as i32, cstring![string]) }; - error![ - res, - &format!("NcPlane.putstr_yx({}, {}, {:?})", y, x, string), - res as NcDim - ] - } -} - -// ----------------------------------------------------------------------------- -/// ## NcPlane methods: `NcPlane` & `Nc` -impl NcPlane { - /// Gets the origin of this plane relative to its pile. - /// - /// *C style function: [ncplane_abs_yx()][crate::ncplane_abs_yx].* - pub fn abs_yx(&self) -> (NcDim, NcDim) { - let mut y = 0; - let mut x = 0; - unsafe { - crate::ncplane_abs_yx(self, &mut y, &mut x); - } - (y as NcDim, x as NcDim) - } - - /// Gets the origin of this plane relative to its pile, in the y axis. - /// - /// *C style function: [ncplane_abs_y()][crate::ncplane_abs_y].* - pub fn abs_y(&self) -> NcDim { - unsafe { crate::ncplane_abs_y(self) as NcDim } - } - - /// Gets the origin of this plane relative to its pile, in the x axis. - /// - /// *C style function: [ncplane_abs_x()][crate::ncplane_abs_x].* - pub fn abs_x(&self) -> NcDim { - unsafe { crate::ncplane_abs_x(self) as NcDim } - } - - /// Duplicates this `NcPlane`. - /// - /// The new NcPlane will have the same geometry, the same rendering state, - /// and all the same duplicated content. - /// - /// The new plane will be immediately above the old one on the z axis, - /// and will be bound to the same parent. Bound planes are not duplicated; - /// the new plane is bound to the current parent, but has no bound planes. - /// - /// *C style function: [ncplane_dup()][crate::ncplane_dup].* - // - // TODO: deal with the opaque field that is stored in NcPlaneOptions.userptr - pub fn dup(&mut self) -> &mut NcPlane { - unsafe { &mut *crate::ncplane_dup(self, null_mut()) } - } - - /// Returns the topmost `NcPlane` of the current pile. - /// - /// *C style function: [ncpile_top()][crate::ncpile_top].* - pub fn top(&mut self) -> &mut NcPlane { - unsafe { &mut *crate::ncpile_top(self) } - } - - /// Returns the bottommost `NcPlane` of the current pile. - /// - /// *C style function: [ncpile_bottom()][crate::ncpile_bottom].* - pub fn bottom<'a>(&mut self) -> &'a mut NcPlane { - unsafe { &mut *crate::ncpile_bottom(self) } - } - - /// Relocates this `NcPlane` at the top of the z-buffer. - /// - /// *C style function: [ncplane_move_top()][crate::ncplane_move_top].* - pub fn move_top(&mut self) { - unsafe { - crate::ncplane_move_top(self); - } - } - - /// Relocates this `NcPlane` at the bottom of the z-buffer. - /// - /// *C style function: [ncplane_move_bottom()][crate::ncplane_move_bottom].* - pub fn move_bottom(&mut self) { - unsafe { - crate::ncplane_move_bottom(self); - } - } - - /// Moves this `NcPlane` relative to the standard plane, or the plane to - /// which it is bound. - /// - /// It is an error to attempt to move the standard plane. - /// - /// *C style function: [ncplane_move_yx()][crate::ncplane_move_yx].* - pub fn move_yx(&mut self, y: NcOffset, x: NcOffset) -> NcResult<()> { - error![ - unsafe { crate::ncplane_move_yx(self, y, x) }, - &format!("NcPlane.move_yx({}, {})", y, x) - ] - } - - /// Moves this `NcPlane` relative to its current location. - /// - /// Negative values move up and left, respectively. - /// Pass 0 to hold an axis constant. - /// - /// It is an error to attempt to move the standard plane. - /// - /// *C style function: [ncplane_moverel()][crate::ncplane_moverel].* - pub fn move_rel(&mut self, rows: NcOffset, cols: NcOffset) -> NcResult<()> { - error![ - crate::ncplane_moverel(self, rows, cols), - &format!("NcPlane.move_rel({}, {})", rows, cols) - ] - } - - /// Returns the `NcPlane` above this one, or None if already at the top. - /// - /// *C style function: [ncplane_above()][crate::ncplane_above].* - pub fn above(&mut self) -> NcResult<&mut NcPlane> { - error_ref_mut![unsafe { crate::ncplane_above(self) }, "NcPlane.above()"] - } - - /// Returns the `NcPlane` below this one, or None if already at the bottom. - /// - /// *C style function: [ncplane_below()][crate::ncplane_below].* - pub fn below(&mut self) -> NcResult<&mut NcPlane> { - error_ref_mut![unsafe { crate::ncplane_below(self) }, "NcPlane.below()"] - } - - /// Relocates this `NcPlane` above the `above` NcPlane, in the z-buffer. - /// - /// Returns [NCRESULT_ERR] if the current plane is - /// already in the desired location. Both planes must not be the same. - /// - /// *C style function: [ncplane_move_above()][crate::ncplane_move_above].* - pub fn move_above(&mut self, above: &mut NcPlane) -> NcResult<()> { - error![ - unsafe { crate::ncplane_move_above(self, above) }, - "NcPlane.move_above(NcPlane)" - ] - } - - /// Relocates this `NcPlane` below the `below` NcPlane, in the z-buffer. - /// - /// Returns [NCRESULT_ERR] if the current plane is - /// already in the desired location. Both planes must not be the same. - /// - /// *C style function: [ncplane_move_below()][crate::ncplane_move_below].* - pub fn move_below(&mut self, below: &mut NcPlane) -> NcResult<()> { - error![ - unsafe { crate::ncplane_move_below(self, below) }, - "NcPlane.move_below(NcPlane)" - ] - } - /// Merge the `NcPlane` `source` down onto the current `NcPlane` (`self`). - /// - /// This is most rigorously defined as "write to `self` the frame that would - /// be rendered were the entire stack made up only of the specified subregion - /// of `source` and, below it, the subregion of `self` having the specified - /// origin. - /// - /// Merging is independent of the position of both planes on the z-axis. - /// - /// It is an error to define a subregion of zero area, or that is not - /// entirely contained within `source`. It is an error to define a target - /// origin such that the projected subregion is not entirely contained - /// within `self`. - /// - /// Behavior is undefined if both planes are equivalent. `self` is modified, - /// but `source` remains unchanged. - /// - /// neither `source` nor `self` may have sprixels. - /// - /// *C style function: [ncplane_mergedown()][crate::ncplane_mergedown].* - pub fn mergedown( - &mut self, - source: &mut NcPlane, - source_y: NcDim, - source_x: NcDim, - len_y: NcDim, - len_x: NcDim, - target_y: NcDim, - target_x: NcDim, - ) -> NcResult<()> { - error![ - unsafe { - crate::ncplane_mergedown( - source, - self, - source_y as i32, - source_x as i32, - len_y as i32, - len_x as i32, - target_y as i32, - target_x as i32, - ) - }, - &format!( - "NcPlane.mergedown(NcPlane, {}, {}, {}, {}, {}, {})", - source_y, source_x, len_y, len_x, target_y, target_x - ) - ] - } - - /// Merges `source` down onto this `NcPlane`. - /// - /// If `source` does not intersect, this plane will not be changed, - /// but it is not an error. - /// - /// See [`mergedown`][NcPlane#method.mergedown] - /// for more information. - /// - /// *C style function: [ncplane_mergedown_simple()][crate::ncplane_mergedown_simple].* - // - // TODO: maybe create a reversed method, and/or an associated function, - // for `mergedown` too. - pub fn mergedown_simple(&mut self, source: &mut NcPlane) -> NcResult<()> { - error![ - unsafe { crate::ncplane_mergedown_simple(source, self) }, - "NcPlane.mergedown_simple(NcPlane)" - ] - } - - /// Gets the parent to which this `NcPlane` is bound, if any. - /// - /// *C style function: [ncplane_parent()][crate::ncplane_parent].* - // - // TODO: CHECK: what happens when it's bound to itself. - pub fn parent(&mut self) -> NcResult<&mut NcPlane> { - error_ref_mut![unsafe { crate::ncplane_parent(self) }, "NcPlane.parent()"] - } - - /// Gets the parent to which this `NcPlane` is bound, if any. - /// - /// *C style function: [ncplane_parent_const()][crate::ncplane_parent_const].* - // - // CHECK: what happens when it's bound to itself. - pub fn parent_const(&self) -> NcResult<&NcPlane> { - error_ref![ - unsafe { crate::ncplane_parent_const(self) }, - "NcPlane.parent_const()" - ] - } - - /// Unbounds this `NcPlane` from its parent, makes it a bound child of - /// 'newparent', and returns itself. - /// - /// Any planes bound to this `NcPlane` are reparented to the previous parent. - /// - /// If this `NcPlane` is equal to `newparent`, then becomes the root of a new - /// pile, unless it is already the root of a pile, in which case this is a - /// no-op. - /// - /// The standard plane cannot be reparented. - /// - /// *C style function: [ncplane_reparent()][crate::ncplane_reparent].* - pub fn reparent<'a>(&mut self, newparent: &'a mut NcPlane) -> NcResult<&'a mut NcPlane> { - error_ref_mut![ - unsafe { crate::ncplane_reparent(self, newparent) }, - "NcPlane.reparent(NcPlane)" - ] - } - - /// Like [`reparent`][NcPlane#method.reparent], except any bound - /// planes comes along with this `NcPlane` to its new destination. - /// - /// Their z-order is maintained. - /// - /// *C style function: [ncplane_reparent_family()][crate::ncplane_reparent_family].* - // - // TODO:CHECK: If 'newparent' is an ancestor, NULL is returned & no changes're made. - pub fn reparent_family<'a>(&mut self, newparent: &'a mut NcPlane) -> NcResult<&'a mut NcPlane> { - error_ref_mut![ - unsafe { crate::ncplane_reparent_family(self, newparent) }, - "NcPlane.reparent_family(NcPlane)" - ] - } - - /// Makes the physical screen match the last rendered frame from the pile of - /// which this `NcPlane` is a part. - /// - /// This is a blocking call. Don't call this before the pile has been - /// rendered (doing so will likely result in a blank screen). - /// - /// *C style function: [ncpile_rasterize()][crate::ncpile_rasterize].* - pub fn rasterize(&mut self) -> NcResult<()> { - error![ - unsafe { crate::ncpile_rasterize(self) }, - "NcPlane.rasterize()" - ] - } - - /// Renders the pile of which this `NcPlane` is a part. - /// Rendering this pile again will blow away the render. - /// To actually write out the render, call ncpile_rasterize(). - /// - /// *C style function: [ncpile_render()][crate::ncpile_render].* - pub fn render(&mut self) -> NcResult<()> { - error![unsafe { crate::ncpile_render(self) }, "NcPlane.render()"] - } - - /// Gets a mutable reference to the [`Nc`] context of this `NcPlane`. - /// - /// *C style function: [ncplane_notcurses()][crate::ncplane_notcurses].* - pub fn notcurses<'a>(&self) -> NcResult<&'a mut Nc> { - error_ref_mut![ - unsafe { crate::ncplane_notcurses(self) }, - "NcPlane.notcurses()" - ] - } - - /// Gets an immutable reference to the [`Nc`] context of this `NcPlane`. - /// - /// *C style function: [ncplane_notcurses_const()][crate::ncplane_notcurses_const].* - pub fn notcurses_const<'a>(&self) -> NcResult<&'a Nc> { - error_ref![ - unsafe { crate::ncplane_notcurses_const(self) }, - "NcPlane.notcurses()" - ] - } -} - -// ----------------------------------------------------------------------------- -/// ## NcPlane methods: cursor -impl NcPlane { - /// Moves the cursor to 0, 0. - /// - /// *C style function: [ncplane_home()][crate::ncplane_home].* - pub fn cursor_home(&mut self) { - unsafe { - crate::ncplane_home(self); - } - } - - #[doc(hidden)] - #[deprecated] - pub fn home(&mut self) { - self.cursor_home() - } - - /// Returns the current position of the cursor within this `NcPlane`. - /// - /// *C style function: [ncplane_cursor_yx()][crate::ncplane_cursor_yx].* - // - // NOTE: y and/or x may be NULL. - // check for null and return NcResult - pub fn cursor_yx(&self) -> (NcDim, NcDim) { - let (mut y, mut x) = (0, 0); - unsafe { crate::ncplane_cursor_yx(self, &mut y, &mut x) }; - (y as NcDim, x as NcDim) - } - - /// Returns the current row of the cursor within this `NcPlane`. - /// - /// *(No equivalent C style function)* - pub fn cursor_y(&self) -> NcDim { - self.cursor_yx().0 - } - - /// Returns the current column of the cursor within this `NcPlane`. - /// - /// *(No equivalent C style function)* - pub fn cursor_x(&self) -> NcDim { - self.cursor_yx().1 - } - - /// Moves the cursor to the specified position within this `NcPlane`. - /// - /// The cursor doesn't need to be visible. - /// - /// Parameters exceeding the plane's dimensions will result in an error, - /// and the cursor position will remain unchanged. - /// - /// *C style function: [ncplane_cursor_move_yx()][crate::ncplane_cursor_move_yx].* - pub fn cursor_move_yx(&mut self, y: NcDim, x: NcDim) -> NcResult<()> { - error![ - unsafe { crate::ncplane_cursor_move_yx(self, y as i32, x as i32) }, - &format!("NcPlane.move_yx({}, {})", y, x) - ] - } - - /// Moves the cursor to the specified row within this `NcPlane`. - /// - /// *(No equivalent C style function)* - pub fn cursor_move_y(&mut self, y: NcDim) -> NcResult<()> { - let x = self.cursor_x(); - error![ - unsafe { crate::ncplane_cursor_move_yx(self, y as i32, x as i32) }, - &format!("NcPlane.move_y({})", y) - ] - } - - /// Moves the cursor to the specified column within this `NcPlane`. - /// - /// *(No equivalent C style function)* - pub fn cursor_move_x(&mut self, x: NcDim) -> NcResult<()> { - let y = self.cursor_y(); - error![ - unsafe { crate::ncplane_cursor_move_yx(self, y as i32, x as i32) }, - &format!("NcPlane.move_x({})", x) - ] - } - - /// Moves the cursor the number of rows specified (forward or backwards). - /// - /// It will error if the target row exceeds the plane dimensions. - /// - /// *(No equivalent C style function)* - pub fn cursor_move_rows(&mut self, rows: NcOffset) -> NcResult<()> { - let (y, x) = self.cursor_yx(); - self.cursor_move_yx((y as NcOffset + rows) as NcDim, x) - } - - /// Moves the cursor the number of columns specified (forward or backwards). - /// - /// It will error if the target column exceeds the plane dimensions. - /// - /// *(No equivalent C style function)* - pub fn cursor_move_cols(&mut self, cols: NcOffset) -> NcResult<()> { - let (y, x) = self.cursor_yx(); - self.cursor_move_yx(y, (x as NcOffset + cols) as NcDim) - } - - /// Moves the cursor relatively, the number of rows and columns specified - /// (forward or backwards). - /// - /// It will error if the target row or column exceeds the plane dimensions. - /// - /// *(No equivalent C style function)* - pub fn cursor_move_rel(&mut self, rows: NcOffset, cols: NcOffset) -> NcResult<()> { - self.cursor_move_rows(rows)?; - self.cursor_move_cols(cols)?; - Ok(()) - } -} - -// ----------------------------------------------------------------------------- -/// ## NcPlane methods: size, position & alignment -impl NcPlane { - /// Returns the column at which `cols` columns ought start in order to be - /// aligned according to `align` within this `NcPlane`. - /// - /// Returns `-`[NCRESULT_MAX][crate::NCRESULT_MAX] if - /// [NCALIGN_UNALIGNED][crate::NCALIGN_UNALIGNED] or invalid [NcAlign]. - /// - /// *C style function: [ncplane_halign()][crate::ncplane_halign].* - #[inline] - pub fn halign(&mut self, align: NcAlign, cols: NcDim) -> NcResult<()> { - error![ - crate::ncplane_halign(self, align, cols), - &format!("NcPlane.halign({:?}, {})", align, cols) - ] - } - - /// Returns the row at which `rows` rows ought start in order to be - /// aligned according to `align` within this `NcPlane`. - /// - /// Returns `-`[NCRESULT_MAX][crate::NCRESULT_MAX] if - /// [NCALIGN_UNALIGNED][crate::NCALIGN_UNALIGNED] or invalid [NcAlign]. - /// - /// *C style function: [ncplane_valign()][crate::ncplane_valign].* - #[inline] - pub fn valign(&mut self, align: NcAlign, cols: NcDim) -> NcResult<()> { - error![ - crate::ncplane_valign(self, align, cols), - &format!("NcPlane.valign({:?}, {})", align, cols) - ] - } - - /// - /// - /// *C style function: [ncplane_center_abs()][crate::ncplane_center_abs].* - // - // TODO: doc. - pub fn center_abs(&self, y: &mut NcDim, x: &mut NcDim) { - unsafe { - crate::ncplane_center_abs(self, &mut (*y as i32), &mut (*x as i32)); - } - } - - /// Returns the dimensions of this `NcPlane`. - /// - /// *C style function: [ncplane_dim_yx()][crate::ncplane_dim_yx].* - pub fn dim_yx(&self) -> (NcDim, NcDim) { - let (mut y, mut x) = (0, 0); - unsafe { crate::ncplane_dim_yx(self, &mut y, &mut x) }; - (y as NcDim, x as NcDim) - } - - /// Return the rows of this `NcPlane`. - /// - /// *C style function: [ncplane_dim_y()][crate::ncplane_dim_y].* - #[inline] - pub fn dim_y(&self) -> NcDim { - self.dim_yx().0 - } - - /// Return the columns of this `NcPlane`. - /// - /// *C style function: [ncplane_dim_x()][crate::ncplane_dim_x].* - #[inline] - pub fn dim_x(&self) -> NcDim { - self.dim_yx().1 - } - - /// Return the rows of this `NcPlane`. - /// - /// Alias of [dim_y][NcPlane#method.dim_y] - /// - /// *C style function: [ncplane_dim_y()][crate::ncplane_dim_y].* - #[inline] - pub fn rows(&self) -> NcDim { - self.dim_yx().0 - } - - /// Return the cols of this `NcPlane`. - /// - /// Alias of [dim_x][NcPlane#method.dim_x] - /// - /// *C style function: [ncplane_dim_x()][crate::ncplane_dim_x].* - #[inline] - pub fn cols(&self) -> NcDim { - self.dim_yx().1 - } - - /// Resizes this `NcPlane`. - /// - /// The four parameters `keep_y`, `keep_x`, `keep_len_y`, and `keep_len_x` - /// defines a subset of this `NcPlane` to keep unchanged. This may be a section - /// of size 0. - /// - /// `keep_x` and `keep_y` are relative to this `NcPlane`. They must specify a - /// coordinate within the ncplane's totality. If either of `keep_len_y` or - /// `keep_len_x` is non-zero, both must be non-zero. - /// - /// `y_off` and `x_off` are relative to `keep_y` and `keep_x`, and place the - /// upper-left corner of the resized NcPlane. - /// - /// `y_len` and `x_len` are the dimensions of this `NcPlane` after resizing. - /// `y_len` must be greater than or equal to `keep_len_y`, - /// and `x_len` must be greater than or equal to `keeplenx`. - /// - /// It is an error to attempt to resize the standard plane. - /// - /// *C style function: [ncplane_resize()][crate::ncplane_resize].* - pub fn resize( - &mut self, - keep_y: NcDim, - keep_x: NcDim, - keep_len_y: NcDim, - keep_len_x: NcDim, - y_off: NcOffset, - x_off: NcOffset, - y_len: NcDim, - x_len: NcDim, - ) -> NcResult<()> { - error![ - unsafe { - crate::ncplane_resize( - self, - keep_y as i32, - keep_x as i32, - keep_len_y as i32, - keep_len_x as i32, - y_off as i32, - x_off as i32, - y_len as i32, - x_len as i32, - ) - }, - &format!( - "NcPlane.resize({}, {}, {}, {}, {}, {}, {}, {})", - keep_y, keep_x, keep_len_y, keep_len_x, y_off, x_off, y_len, x_len - ) - ] - } - - /// Suitable for use as a 'resizecb' with planes created with - /// [`NCPLANE_OPTION_MARGINALIZED`][crate::NCPLANE_OPTION_MARGINALIZED]. - /// - /// This will resize this plane against its parent, attempting to enforce - /// the supplied margins. - /// - /// *C style function: [ncplane_resize_marginalized()][crate::ncplane_resize_marginalized].* - pub fn resize_marginalized(&mut self) -> NcResult<()> { - error![ - unsafe { crate::ncplane_resize_marginalized(self) }, - "NcPlane.resize_marginalized()" - ] - } - - /// Suitable for use as a 'resizecb', this will resize the plane - /// to the visual region's size. It is used for the standard plane. - /// - /// *C style function: [ncplane_resize_maximize()][crate::ncplane_resize_maximize].* - pub fn resize_maximize(&mut self) -> NcResult<()> { - error![ - unsafe { crate::ncplane_resize_maximize(self) }, - "NcPlane.resize_maximize()" - ] - } - - /// Creates an RGBA flat array from the selected region of the plane. - /// - /// Starts at the plane's `beg_y`x`beg_x` coordinate (which must lie on the - /// plane), continuing for `len_y`x`len_x` cells. - /// - /// Use `None` for either or both of `len_y` and `len_x` in order to - /// go through the boundary of the plane in that axis. - /// - /// Only glyphs from the specified blitset may be present. - /// - /// *C style function: [ncplane_rgba()][crate::ncplane_as_rgba].* - pub fn as_rgba( - &mut self, - blitter: NcBlitter, - beg_y: NcDim, - beg_x: NcDim, - len_y: Option, - len_x: Option, - ) -> NcResult<&mut [u32]> { - // converts length arguments to expected format - let len_y2: i32; - let len_x2: i32; - if let Some(y) = len_y { - len_y2 = y as i32; - } else { - len_y2 = -1; - } - if let Some(x) = len_x { - len_x2 = x as i32; - } else { - len_x2 = -1; - } - - // pixel geometry - let mut pxdimy = 0; - let mut pxdimx = 0; - - let res_array = unsafe { - crate::ncplane_as_rgba( - self, - blitter, - beg_y as i32, - beg_x as i32, - len_y2, - len_x2, - &mut pxdimy, - &mut pxdimx, - ) - }; - - error_ref_mut![ - res_array, - &format![ - "NcPlane.rgba({}, {}, {}, {:?}, {:?})", - blitter, beg_y, beg_x, len_y, len_x - ], - from_raw_parts_mut(res_array, (pxdimy * pxdimx) as usize) - ] - } - - /// Returns an [NcPixelGeometry] structure filled with pixel geometry for - /// the display region, each cell, and the maximum displayable bitmap. - /// - /// This function calls - /// [notcurses_check_pixel_support][crate::notcurses_check_pixel_support], - /// possibly leading to an interrogation of the terminal. - /// - /// *C style function: [ncplane_pixelgeom()][crate::ncplane_pixelgeom].* - pub fn pixelgeom(&self) -> NcPixelGeometry { - let mut pxy = 0; - let mut pxx = 0; - let mut celldimy = 0; - let mut celldimx = 0; - let mut maxbmapy = 0; - let mut maxbmapx = 0; - unsafe { - crate::ncplane_pixelgeom( - self, - &mut pxy, - &mut pxx, - &mut celldimy, - &mut celldimx, - &mut maxbmapy, - &mut maxbmapx, - ); - } - NcPixelGeometry { - term_y: pxy as NcDim, - term_x: pxx as NcDim, - cell_y: celldimy as NcDim, - cell_x: celldimx as NcDim, - max_bitmap_y: maxbmapy as NcDim, - max_bitmap_x: maxbmapx as NcDim, - } - } - - /// Realigns this `NcPlane` against its parent, using the alignment specified - /// at creation time. - /// - /// Suitable for use as an [NcResizeCb]. - /// - /// *C style function: [ncplane_resize_realign()][crate::ncplane_resize_realign].* - // - // TODO: suitable for use as an NcResizeCb? - pub fn resize_realign(&mut self) -> NcResult<()> { - error![unsafe { crate::ncplane_resize_realign(self) }] - } - - /// Resizes this `NcPlane`, retaining what data we can (everything, unless we're - /// shrinking in some dimension). Keeps the origin where it is. - /// - /// *C style function: [ncplane_resize_simple()][crate::ncplane_resize_simple].* - #[inline] - pub fn resize_simple(&mut self, y_len: NcDim, x_len: NcDim) -> NcResult<()> { - error![crate::ncplane_resize_simple( - self, - y_len as u32, - x_len as u32 - )] - } - - /// Returns this `NcPlane`'s current resize callback. - /// - /// *C style function: [ncplane_resizecb()][crate::ncplane_resizecb].* - pub fn resizecb(&self) -> Option { - unsafe { crate::ncresizecb_to_rust(crate::ncplane_resizecb(self)) } - } - - /// Replaces this `NcPlane`'s existing resize callback (which may be [None]). - /// - /// The standard plane's resizecb may not be changed. - /// - /// *C style function: [ncplane_set_resizecb()][crate::ncplane_set_resizecb].* - pub fn set_resizecb(&mut self, resizecb: Option) { - unsafe { crate::ncplane_set_resizecb(self, crate::ncresizecb_to_c(resizecb)) } - } - - /// Rotate the plane π/2 radians clockwise. - /// - /// This cannot be performed on arbitrary planes, because glyphs cannot be - /// arbitrarily rotated. - /// - /// The glyphs which can be rotated are limited: line-drawing characters, - /// spaces, half blocks, and full blocks. - /// - /// The plane must have an even number of columns. - /// - /// Use the ncvisual rotation for a more flexible approach. - /// - /// *C style function: [ncplane_rotate_cw()][crate::ncplane_rotate_cw].* - pub fn rotate_cw(&mut self) -> NcResult<()> { - error![unsafe { crate::ncplane_rotate_cw(self) }] - } - - /// Rotate the plane π/2 radians counter-clockwise. - /// - /// See [`rotate_cw`][NcPlane#method.rotate_cw] - /// for more information. - /// - /// *C style function: [ncplane_rotate_ccw()][crate::ncplane_rotate_ccw].* - pub fn rotate_ccw(&mut self) -> NcResult<()> { - error![unsafe { crate::ncplane_rotate_ccw(self) }] - } - - /// Maps the provided coordinates relative to the origin of this `NcPlane`, - /// to the same absolute coordinates relative to the origin of `target`. - /// - /// *C style function: [ncplane_translate()][crate::ncplane_translate].* - // - // TODO: API change, return the coordinates as a tuple instead of being &mut - pub fn translate(&self, target: &NcPlane, y: &mut NcDim, x: &mut NcDim) { - unsafe { crate::ncplane_translate(self, target, &mut (*y as i32), &mut (*x as i32)) } - } - - /// Returns true if the provided absolute `y`/`x` coordinates are within - /// this `NcPlane`, or false otherwise. - /// - /// Either way, translates the absolute coordinates relative to this `NcPlane`. - /// - /// *C style function: [ncplane_translate_abs()][crate::ncplane_translate_abs].* - // - // TODO: API change, return a tuple (y,x,bool) - pub fn translate_abs(&self, y: &mut NcDim, x: &mut NcDim) -> bool { - unsafe { crate::ncplane_translate_abs(self, &mut (*y as i32), &mut (*x as i32)) } - } - - /// Gets the `y`, `x` origin of this `NcPlane` relative to the standard plane, - /// or the `NcPlane` to which it is bound. - /// - /// *C style function: [ncplane_yx()][crate::ncplane_yx].* - // - // CHECK: negative offsets - pub fn yx(&self) -> (NcOffset, NcOffset) { - let (mut y, mut x) = (0, 0); - unsafe { crate::ncplane_yx(self, &mut y, &mut x) }; - (y as NcOffset, x as NcOffset) - } - - /// Gets the `x` origin of this `NcPlane` relative to the standard plane, - /// or the `NcPlane` to which it is bound. - /// - /// *C style function: [ncplane_x()][crate::ncplane_x].* - pub fn x(&self) -> NcOffset { - unsafe { crate::ncplane_x(self) as NcOffset } - } - - /// Gets the `y` origin of this `NcPlane` relative to the standard plane, - /// or the `NcPlane` to which it is bound. - /// - /// *C style function: [ncplane_y()][crate::ncplane_y].* - pub fn y(&self) -> NcOffset { - unsafe { crate::ncplane_y(self) as NcOffset } - } - - /// Returns `true` if this `NcPlane` has scrolling enabled, or `false` otherwise. - pub fn scrolling_p(&self) -> bool { - unsafe { crate::ncplane_scrolling_p(self) } - } - - /// Sets the scrolling behaviour of the plane, and - /// returns true if scrolling was previously enabled, of false, if disabled. - /// - /// All planes are created with scrolling disabled. Attempting to print past - /// the end of a line will stop at the plane boundary, and indicate an error. - /// - /// On a plane 10 columns wide and two rows high, printing "0123456789" - /// at the origin should succeed, but printing "01234567890" will by default - /// fail at the eleventh character. In either case, the cursor will be left - /// at location 0x10; it must be moved before further printing can take place. I - /// - /// *C style function: [ncplane_set_scrolling()][crate::ncplane_set_scrolling].* - pub fn set_scrolling(&mut self, scroll: bool) -> bool { - unsafe { crate::ncplane_set_scrolling(self, scroll) } - } -} - -// ----------------------------------------------------------------------------- -/// ## NcPlane methods: boxes & perimeters -impl NcPlane { - /// Draws a box with its upper-left corner at the current cursor position, - /// and its lower-right corner at `y_stop` * `x_stop`. - /// - /// The 6 cells provided are used to draw the upper-left, ur, ll, and lr corners, - /// then the horizontal and vertical lines. - /// - /// See [NcBoxMask] for information about the border and gradient masks, - /// and the drawing of corners. - /// - /// If the gradient bit is not set, the styling from the hline/vlline cells - /// is used for the horizontal and vertical lines, respectively. - /// - /// If the gradient bit is set, the color is linearly interpolated between - /// the two relevant corner cells. - /// - /// *C style function: [ncplane_box()][crate::ncplane_box].* - pub fn r#box( - &mut self, - ul: &NcCell, - ur: &NcCell, - ll: &NcCell, - lr: &NcCell, - hline: &NcCell, - vline: &NcCell, - y_stop: NcDim, - x_stop: NcDim, - boxmask: NcBoxMask, - ) -> NcResult<()> { - error![unsafe { - crate::ncplane_box( - self, - ul, - ur, - ll, - lr, - hline, - vline, - y_stop as i32, - x_stop as i32, - boxmask, - ) - }] - } - - /// Draws a box with its upper-left corner at the current cursor position, - /// having dimensions `y_len` * `x_len`. - /// The minimum box size is 2x2, and it cannot be drawn off-screen. - /// - /// See the [`box`][NcPlane#method.box] method for more information. - /// - /// *C style function: [ncplane_box_sized()][crate::ncplane_box_sized].* - #[inline] - pub fn box_sized( - &mut self, - ul: &NcCell, - ur: &NcCell, - ll: &NcCell, - lr: &NcCell, - hline: &NcCell, - vline: &NcCell, - y_len: NcDim, - x_len: NcDim, - boxmask: NcBoxMask, - ) -> NcResult<()> { - error![crate::ncplane_box_sized( - self, ul, ur, ll, lr, hline, vline, y_len, x_len, boxmask - )] - } - - /// NcPlane.[box()][NcPlane#method.box] with the double box-drawing characters. - /// - /// *C style function: [ncplane_double_box()][crate::ncplane_double_box].* - #[inline] - pub fn double_box( - &mut self, - stylemask: NcStyle, - channels: NcChannels, - y_stop: NcDim, - x_stop: NcDim, - boxmask: NcBoxMask, - ) -> NcResult<()> { - error![crate::ncplane_double_box( - self, stylemask, channels, y_stop, x_stop, boxmask - )] - } - - /// - /// - /// *C style function: [ncplane_double_box_sized()][crate::ncplane_double_box_sized].* - #[inline] - pub fn double_box_sized( - &mut self, - stylemask: NcStyle, - channels: NcChannels, - y_len: NcDim, - x_len: NcDim, - boxmask: NcBoxMask, - ) -> NcResult<()> { - error![crate::ncplane_double_box( - self, stylemask, channels, y_len, x_len, boxmask - )] - } - - /// Draws the perimeter around this `NcPlane`. - /// - /// *C style function: [ncplane_perimeter()][crate::ncplane_perimeter].* - #[inline] - pub fn perimeter( - &mut self, - ul: &NcCell, - ur: &NcCell, - ll: &NcCell, - lr: &NcCell, - hline: &NcCell, - vline: &NcCell, - boxmask: NcBoxMask, - ) -> NcResult<()> { - error![crate::ncplane_perimeter( - self, ul, ur, ll, lr, hline, vline, boxmask - )] - } - - /// NcPlane.[perimeter()][NcPlane#method.perimeter] with the double box-drawing characters. - - /// - /// *C style function: [ncplane_perimeter_double()][crate::ncplane_perimeter_double].* - #[inline] - pub fn perimeter_double( - &mut self, - stylemask: NcStyle, - channels: NcChannels, - boxmask: NcBoxMask, - ) -> NcResult<()> { - error![crate::ncplane_perimeter_double( - self, stylemask, channels, boxmask - )] - } - - /// NcPlane.[perimeter()][NcPlane#method.perimeter] with the rounded box-drawing characters. - /// - /// - /// *C style function: [ncplane_perimeter_rounded()][crate::ncplane_perimeter_rounded].* - #[inline] - pub fn perimeter_rounded( - &mut self, - stylemask: NcStyle, - channels: NcChannels, - boxmask: NcBoxMask, - ) -> NcResult<()> { - error![crate::ncplane_perimeter_rounded( - self, stylemask, channels, boxmask - )] - } -} - -// ----------------------------------------------------------------------------- -/// ## NcPlane methods: fading, gradients & greyscale -impl NcPlane { - /// Fades this `NcPlane` in, over the specified time, calling 'fader' at - /// each iteration. - /// - /// Usage: - /// 1. Load this `NcPlane` with the target cells without rendering. - /// 2. call this function. - /// - /// When it's done, the `NcPlane` will have reached the target levels, - /// starting from zeroes. - /// - /// *C style function: [ncplane_fadein()][crate::ncplane_fadein].* - pub fn fadein(&mut self, time: &NcTime, fader: NcFadeCb) -> NcResult<()> { - error![unsafe { crate::ncplane_fadein(self, time, fader, null_mut()) }] - } - - /// Fades in through 'iter' iterations, - /// where 'iter' < 'ncfadectx_iterations(nctx)'. - /// - /// *C style function: [ncplane_fadein_iteration()][crate::ncplane_fadein_iteration].* - pub fn fadein_iteration(&mut self, time: &NcTime, fader: NcFadeCb) -> NcResult<()> { - error![unsafe { crate::ncplane_fadein(self, time, fader, null_mut()) }] - } - - /// Fades this `NcPlane` out, over the specified time, calling 'fader' at - /// each iteration. - /// - /// Requires a terminal which supports truecolor, or at least palette - /// modification (if the terminal uses a palette, our ability to fade planes - /// is limited, and affected by the complexity of the rest of the screen). - /// - /// *C style function: [ncplane_fadeout()][crate::ncplane_fadeout].* - pub fn fadeout(&mut self, time: &NcTime, fader: NcFadeCb) -> NcResult<()> { - error![unsafe { crate::ncplane_fadeout(self, time, fader, null_mut()) }] - } - - /// Fades out through 'iter' iterations, - /// where 'iter' < 'ncfadectx_iterations(nctx)'. - /// - /// *C style function: [ncplane_fadeout_iteration()][crate::ncplane_fadeout_iteration].* - pub fn fadeout_iteration(&mut self, time: &NcTime, fader: NcFadeCb) -> NcResult<()> { - error![unsafe { crate::ncplane_fadeout(self, time, fader, null_mut()) }] - } - - /// Pulses this `NcPlane` in and out until the callback returns non-zero, - /// relying on the callback 'fader' to initiate rendering. - /// - /// `time` defines the half-period (i.e. the transition from black to full - /// brightness, or back again). - /// - /// Proper use involves preparing (but not rendering) the `NcPlane`, - /// then calling this method, which will fade in from black to the - /// specified colors. - /// - /// *C style function: [ncplane_pulse()][crate::ncplane_pulse].* - pub fn pulse(&mut self, time: &NcTime, fader: NcFadeCb) -> NcResult<()> { - error![unsafe { crate::ncplane_pulse(self, time, fader, null_mut()) }] - } - - /// Draws a gradient with its upper-left corner at the current cursor - /// position, stopping at `y_stop` * `xstop`. - /// - /// Returns the number of cells filled on success, - /// or [NCRESULT_ERR] on error. - /// - /// The glyph composed of `egc` and `stylemask` is used for all cells. - /// The channels specified by `ul`, `ur`, `ll`, and `lr` are composed into - /// foreground and background gradients. - /// - /// To do a vertical gradient, `ul` ought equal `ur` and `ll` ought equal - /// `lr`. To do a horizontal gradient, `ul` ought equal `ll` and `ur` ought - /// equal `ul`. - /// - /// To color everything the same, all four channels should be equivalent. - /// The resulting alpha values are equal to incoming alpha values. - /// - /// Palette-indexed color is not supported. - /// - /// Preconditions for gradient operations (error otherwise): - /// - /// all: only RGB colors, unless all four channels match as default - /// all: all alpha values must be the same - /// 1x1: all four colors must be the same - /// 1xN: both top and both bottom colors must be the same (vertical gradient) - /// Nx1: both left and both right colors must be the same (horizontal gradient) - /// - /// *C style function: [ncplane_gradient()][crate::ncplane_gradient].* - pub fn gradient( - &mut self, - egc: &str, - stylemask: NcStyle, - ul: NcChannels, - ur: NcChannels, - ll: NcChannels, - lr: NcChannels, - y_stop: NcDim, - x_stop: NcDim, - ) -> NcResult { - let res = crate::ncplane_gradient(self, egc, stylemask, ul, ur, ll, lr, y_stop, x_stop); - error![res, "", res as NcDim] - } - - /// Draw a gradient with its upper-left corner at the current cursor position, - /// having dimensions `y_len` * `x_len`. - /// - /// See [gradient][NcPlane#method.gradient] for more information. - /// - /// *C style function: [ncplane_gradient_sized()][crate::ncplane_gradient_sized].* - #[inline] - pub fn gradient_sized( - &mut self, - egc: &str, - stylemask: NcStyle, - ul: NcChannels, - ur: NcChannels, - ll: NcChannels, - lr: NcChannels, - y_len: NcDim, - x_len: NcDim, - ) -> NcResult { - let res = crate::ncplane_gradient_sized(self, egc, stylemask, ul, ur, ll, lr, y_len, x_len); - error![res, "", res as NcDim] - } - - /// Draws a high-resolution gradient using upper blocks and synced backgrounds. - /// - /// Returns the number of cells filled on success, - /// or [NCRESULT_ERR] on error. - /// - /// This doubles the number of vertical gradations, but restricts you to - /// half blocks (appearing to be full blocks). - /// - /// *C style function: [ncplane_highgradient()][crate::ncplane_highgradient].* - pub fn highgradient( - &mut self, - ul: NcChannel, - ur: NcChannel, - ll: NcChannel, - lr: NcChannel, - y_stop: NcDim, - x_stop: NcDim, - ) -> NcResult { - let res = unsafe { - crate::ncplane_highgradient(self, ul, ur, ll, lr, y_stop as i32, x_stop as i32) - }; - error![res, "", res as NcDim] - } - - /// [`gradient_sized`][NcPlane#method.gradient_sized] - /// meets [`highgradient`][NcPlane#method.highgradient]. - /// - /// *C style function: [ncplane_highgradient_sized()][crate::ncplane_highgradient_sized].* - pub fn highgradient_sized( - &mut self, - ul: NcChannel, - ur: NcChannel, - ll: NcChannel, - lr: NcChannel, - y_stop: NcDim, - x_stop: NcDim, - ) -> NcResult { - let res = unsafe { - crate::ncplane_highgradient_sized(self, ul, ur, ll, lr, y_stop as i32, x_stop as i32) - }; - error![res, "", res as NcDim] - } - - /// Converts this `NcPlane`'s content to greyscale. - /// - /// *C style function: [ncplane_greyscale()][crate::ncplane_greyscale].* - pub fn greyscale(&mut self) { - unsafe { - crate::ncplane_greyscale(self); - } - } -} diff --git a/rust/src/plane/mod.rs b/rust/src/plane/mod.rs deleted file mode 100644 index 2cc36acb9..000000000 --- a/rust/src/plane/mod.rs +++ /dev/null @@ -1,298 +0,0 @@ -//! `NcPlane` - -// functions already exported by bindgen : 117 -// ------------------------------------------- -// (X) wont: 10 -// (D) depr: 4 -// (#) test: 13 -// (W) wrap: 83 -// ------------------------------------------- -//W ncpile_bottom -//W# ncpile_create -//W ncpile_rasterize -//W ncpile_render -//W ncpile_top -//W ncplane_above -//W ncplane_abs_x -//W ncplane_abs_y -//W ncplane_abs_yx -//W ncplane_at_cursor -//W ncplane_at_cursor_cell -//W ncplane_at_yx -//W ncplane_at_yx_cell -//W ncplane_base -//W ncplane_below -//W ncplane_box -//W ncplane_center_abs -//W# ncplane_channels -//W ncplane_contents -//W ncplane_create -//W# ncplane_cursor_move_yx -//W# ncplane_cursor_yx -//W ncplane_destroy -//W# ncplane_dim_yx -//W ncplane_dup -//W# ncplane_erase -// ncplane_erase_region -//W ncplane_fadein -//W ncplane_fadein_iteration -//W ncplane_fadeout -//W ncplane_fadeout_iteration -//W ncplane_format -//W ncplane_gradient -//W ncplane_greyscale -// ncplane_halign -//W ncplane_highgradient -//W ncplane_highgradient_sized -// ncplane_hline_interp -//W# ncplane_home -//W ncplane_mergedown -//W ncplane_mergedown_simple -//W ncplane_move_above -//W ncplane_move_below -//W ncplane_move_bottom -//W ncplane_move_top -//W ncplane_move_yx -//W# ncplane_notcurses -//W# ncplane_notcurses_const -//W ncplane_off_styles -//W ncplane_on_styles -//W ncplane_parent -//W ncplane_parent_const -//W ncplane_pixelgeom -// ncplane_polyfill_yx -//W ncplane_pulse -// ncplane_putchar_stained -// ncplane_putc_yx -// X ncplane_putegc_stained // unneeded -// X ncplane_putegc_yx // unneeded -// ncplane_putnstr_aligned -// ncplane_putnstr_yx -//W ncplane_putstr_aligned -//W ncplane_putstr_stained -//W ncplane_putstr_yx -// ncplane_puttext -// X ncplane_putwegc_stained // unneeded -// X ncplane_putwstr_stained // unneeded -// ncplane_qrcode -//W ncplane_reparent -//W ncplane_reparent_family -//W# ncplane_resize -//W ncplane_resizecb -//W ncplane_resize_marginalize -//W ncplane_resize_maximize -//W ncplane_resize_realign -//W ncplane_rgba -//W ncplane_rotate_ccw -//W ncplane_rotate_cw -//W ncplane_scrolling_p -//W ncplane_set_base -//W ncplane_set_base_cell -//W# ncplane_set_bchannel -//W ncplane_set_bg_alpha -//W ncplane_set_bg_default -//W ncplane_set_bg_palindex -//W ncplane_set_bg_rgb -//W ncplane_set_bg_rgb8 -// X ncplane_set_bg_rgb8_clipped // unneeded -//W# ncplane_set_channels -//W# ncplane_set_fchannel -//W ncplane_set_fg_alpha -//W ncplane_set_fg_default -//W ncplane_set_fg_palindex -//W ncplane_set_fg_rgb -//W ncplane_set_fg_rgb8 -// X ncplane_set_fg_rgb8_clipped // unneeded -//W ncplane_set_resizecb -//W ncplane_set_scrolling -//W ncplane_set_styles -// ncplane_set_userptr -//W ncplane_stain -//W ncplane_styles -//W ncplane_translate -//W ncplane_translate_abs -// ncplane_userptr -// ncplane_valign -// ncplane_vline_interp -// X ncplane_vprintf_aligned -// X ncplane_vprintf_stained -// X ncplane_vprintf_yx -//W ncplane_x -//W ncplane_y -//W ncplane_yx -// -// functions manually reimplemented: 40 -// ------------------------------------------ -// (X) wont: 9 -// (+) done: 33 / 0 -// (W) wrap: 25 -// (#) test: 5 -// ------------------------------------------ -//W+ ncplane_bchannel -//W+ ncplane_bg_alpha -//W# ncplane_bg_default_p -//W+ ncplane_bg_rgb -//W+ ncplane_bg_rgb8 -//W+ ncplane_box_sized -//W# ncplane_dim_x -//W# ncplane_dim_y -//W+ ncplane_double_box -//W+ ncplane_double_box_sized -//W+ ncplane_fchannel -//W+ ncplane_fg_alpha -//W# ncplane_fg_default_p -//W+ ncplane_fg_rgb -//W+ ncplane_fg_rgb8 -//W+ ncplane_gradient_sized -//W+ ncplane_halign -// + ncplane_hline -//W ncplane_moverel -//W+ ncplane_perimeter -//W+ ncplane_perimeter_double -//W+ ncplane_perimeter_rounded -// + ncplane_putc -// + ncplane_putchar -// + ncplane_putchar_yx -// X ncplane_putegc // unneeded -// + ncplane_putnstr -//W+ ncplane_putstr -// X ncplane_putwc // unneeded -// X ncplane_putwc_stained // unneeded -// X ncplane_putwc_yx // unneeded -// X ncplane_putwegc // unneeded -// X ncplane_putwegc_yx // unneeded -// X ncplane_putwstr // unneeded -// X ncplane_putwstr_aligned // unneeded -// X ncplane_putwstr_yx // unneeded -//W# ncplane_resize_simple -// + ncplane_rounded_box -// + ncplane_rounded_box_sized -//W+ ncplane_halign -// + ncplane_vline -// X ncplane_vprintf - -#[cfg(test)] -mod test; - -mod helpers; -mod methods; -mod reimplemented; - -#[allow(unused_imports)] -pub(crate) use helpers::*; -pub use reimplemented::*; - -// NcPlane -/// Fundamental drawing surface. -/// -/// Unites a: -/// - CellMatrix -/// - EgcPool -/// -/// `type in C: ncplane (struct)` -/// -/// -/// # About planes and piles -/// -/// A given notcurses context is made up of one or more piles. -/// -/// A pile is made up of [`NcPlane`]s, totally ordered on a z-axis. -/// -/// You can't manage the piles directly, but only the `NcPlanes`. -/// -/// A pile is destroyed when all its planes are destroyed or moved to other -/// piles. -/// -/// A pile has a top and bottom plane (this might be a single `NcPlane`), -/// and one or more root planes (`NcPlane`s which are bound to themselves). -/// -/// Multiple threads can concurrently operate on distinct piles, rendering or -/// mutating it, while another thread concurrently renders or mutates another. -/// -/// Each `NcPlane` is part of one and only one pile. By default, an `NcPlane` is -/// part of the same pile that contains the `NcPlane` to which it is bound. -/// -/// When an `NcPlane` is created without being bound to another `NcPlane`, then -/// it becomes the root plane, top, and bottom of a new pile. As a root plane, -/// it is bound to itself. -/// -/// A new pile can also be created by reparenting an `NcPlane` to itself, -/// though if the plane is already a root plane, this is a no-op. -/// -/// When an `NcPlane` is moved to a different pile (whether new or preexisting), -/// any `NcPlane`s which were bound to it are rebound to its previous parent. -/// If the `NcPlane` was a root plane of some pile, any bound planes become root -/// planes. The new `NcPlane` is placed immediately atop its new parent on its -/// new pile's z-axis. -/// -/// When [`NcPlane::reparent_family`][NcPlane#method.reparent_family] is used, -/// all `NcPlanes` bound to the reparented `NcPlane` are moved along with it. -/// Their relative z-order is maintained. -// -/// Rendering reduces a pile of `NcPlane`s to a single `NcPlane`, proceeding -/// from the top to the bottom along a pile's z-axis. The result is a matrix of -/// [`NcCell`][crate::NcCell]s. Rasterizing takes this matrix, together with the -/// current state of the visual area, and produces a stream of optimized control -/// sequences and `EGC`s for the terminal. By writing this stream to the -/// terminal, the physical display is synced to some pile's `NcPlane`s. -/// -/// [`NcPlane.render`][crate::NcPlane#method.render] performs the first of these -/// tasks for the pile of which the plane is a part. The output is maintained -/// internally; calling `render` again on the same pile will replace this state -/// with a fresh render. Multiple piles can be concurrently rendered. -/// [`NcPlane.rasterize`][crate::NcPlane#method.rasterize] performs -/// rasterization, and writes the result to the terminal. It is a blocking call, -/// and only one rasterization operation may proceed at a time. -/// -/// It is necessary to call `NcPlane.rasterize` to generate any visible output; -/// the various *output calls* only draw to the virtual `NcPlane`s. Most of the -/// notcurses `statistics` are updated as a result of a render, and screen -/// geometry is refreshed (similarly to -/// [`Notcurses.refresh`][crate::Notcurses#method.refresh]) following the render. -/// -/// # Methods & Associated Functions -/// -/// - [Constructors & Destructors](#ncplane-constructors--destructors) -/// -/// Methods: -/// - [`NcAlphaBits`](#ncplane-methods-ncalphabits) -/// - [`NcChannel` & `NcChannels`](#ncplane-methods-ncchannel) -/// - [`NcComponent`, `NcRgb` & default color](#ncplane-methods-nccomponent-ncrgb--default-color) -/// - [`NcStyle` & `NcPaletteIndex`](#ncplane-methods-ncstylemask--paletteindex) -/// - [`NcCell` & strings](#ncplane-methods-nccell--strings) -/// - [cursor](#ncplane-methods-cursor) -/// - [`NcPlane` & `Notcurses`](#ncplane-methods-ncplane--notcurses) -/// - [boxes & perimeters](#ncplane-methods-boxes--perimeters) -/// - [Size, position & alignment](#ncplane-methods-size-position--alignment) -/// - [fading, gradients & greyscale](#ncplane-methods-fading-gradients--greyscale) -/// -pub type NcPlane = crate::bindings::ffi::ncplane; - -/// Options struct for [`NcPlane`] -pub type NcPlaneOptions = crate::bindings::ffi::ncplane_options; - -/// Horizontal alignment relative to the parent plane. Use NcAlign for 'x'. -pub const NCPLANE_OPTION_HORALIGNED: u64 = crate::bindings::ffi::NCPLANE_OPTION_HORALIGNED as u64; - -/// Vertical alignment relative to the parent plane. Use NcAlign for 'y'. -pub const NCPLANE_OPTION_VERALIGNED: u64 = crate::bindings::ffi::NCPLANE_OPTION_VERALIGNED as u64; - -/// Maximize relative to the parent plane, modulo the provided margins. -/// -/// The margins are best-effort; the plane will always be at least 1 column by -/// 1 row. If the margins can be effected, the plane will be sized to all -/// remaining space. 'y' and 'x' are overloaded as the top and left margins -/// when this flag is used. 'rows' and 'cols' must be 0 when this flag is -/// used. This flag is exclusive with both of the alignment flags. -pub const NCPLANE_OPTION_MARGINALIZED: u64 = - crate::bindings::ffi::NCPLANE_OPTION_MARGINALIZED as u64; - -/// I/O wrapper to dump file descriptor to [`NcPlane`] -/// -/// `type in C: ncfdplane (struct)` -pub type NcFdPlane = crate::bindings::ffi::ncfdplane; - -/// Options struct for [`NcFdPlane`] -/// -/// `type in C: ncplane_options (struct)` -pub type NcFdPlaneOptions = crate::bindings::ffi::ncfdplane_options; diff --git a/rust/src/plane/reimplemented.rs b/rust/src/plane/reimplemented.rs deleted file mode 100644 index 476a07b2a..000000000 --- a/rust/src/plane/reimplemented.rs +++ /dev/null @@ -1,854 +0,0 @@ -//! `ncplane_*` reimplemented functions. - -use core::ptr::null_mut; - -use crate::{ - cstring, nccell_release, NcAlign, NcAlphaBits, NcBoxMask, NcCell, NcChannel, NcChannels, - NcComponent, NcDim, NcIntResult, NcOffset, NcPlane, NcRgb, NcStyle, NCRESULT_ERR, NCRESULT_OK, -}; - -// Alpha ----------------------------------------------------------------------- - -/// Gets the foreground [NcAlphaBits] from the [NcPlane], shifted to LSBs. -/// -/// *Method: NcPlane.[fg_alpha()][NcPlane#method.fg_alpha].* -#[inline] -pub fn ncplane_fg_alpha(plane: &NcPlane) -> NcAlphaBits { - crate::ncchannels_fg_alpha(ncplane_channels(plane)) -} - -/// Gets the background [NcAlphaBits] from the [NcPlane], shifted to LSBs. -/// -/// *Method: NcPlane.[bg_alpha()][NcPlane#method.bg_alpha].* -#[inline] -pub fn ncplane_bg_alpha(plane: &NcPlane) -> NcAlphaBits { - crate::ncchannels_bg_alpha(ncplane_channels(plane)) -} - -// NcChannel ------------------------------------------------------------------- - -/// Gets the foreground [NcChannel] from an [NcPlane]. -/// -/// *Method: NcPlane.[fchannel()][NcPlane#method.fchannel].* -#[inline] -pub fn ncplane_fchannel(plane: &NcPlane) -> NcChannel { - crate::ncchannels_fchannel(ncplane_channels(plane)) -} - -/// Gets the background [NcChannel] from an [NcPlane]. -/// -/// *Method: NcPlane.[bchannel()][NcPlane#method.bchannel].* -#[inline] -pub fn ncplane_bchannel(plane: &NcPlane) -> NcChannel { - crate::ncchannels_bchannel(ncplane_channels(plane)) -} - -/// Sets the foreground [NcChannel] on an [NcPlane], -/// and returns the new [NcChannels]. -/// -/// *Method: NcPlane.[set_fchannel()][NcPlane#method.set_fchannel].* -#[inline] -pub fn ncplane_set_fchannel(plane: &mut NcPlane, channel: NcChannel) -> NcChannels { - unsafe { crate::ffi::ncplane_set_fchannel(plane, channel) } -} - -/// Sets the background [NcChannel] on an [NcPlane], -/// and returns the new [NcChannels]. -/// -/// *Method: NcPlane.[set_bchannel()][NcPlane#method.set_bchannel].* -#[inline] -pub fn ncplane_set_bchannel(plane: &mut NcPlane, channel: NcChannel) -> NcChannels { - unsafe { crate::ffi::ncplane_set_bchannel(plane, channel) } -} - -/// Gets the [NcChannels] of an [NcPlane]. -/// -/// *Method: NcPlane.[channels()][NcPlane#method.channels].* -#[inline] -pub fn ncplane_channels(plane: &NcPlane) -> NcChannels { - unsafe { crate::ffi::ncplane_channels(plane) } -} - -/// Sets the [NcChannels] of an [NcPlane]. -/// -/// *Method: NcPlane.[set_channels()][NcPlane#method.set_channels].* -#[inline] -pub fn ncplane_set_channels(plane: &mut NcPlane, channels: NcChannels) { - unsafe { crate::ffi::ncplane_set_channels(plane, channels) }; -} - -// NcComponent --------------------------------------------------------------------- - -/// Gets the foreground RGB [NcComponent]s from an [NcPlane]. -/// and returns the background [NcChannel]. -/// -/// *Method: NcPlane.[fg_rgb8()][NcPlane#method.fg_rgb8].* -#[inline] -pub fn ncplane_fg_rgb8( - plane: &NcPlane, - red: &mut NcComponent, - green: &mut NcComponent, - blue: &mut NcComponent, -) -> NcChannel { - crate::ncchannels_fg_rgb8(ncplane_channels(plane), red, green, blue) -} - -/// Gets the background RGB [NcComponent]s from an [NcPlane], -/// and returns the background [NcChannel]. -/// -/// *Method: NcPlane.[bg_rgb8()][NcPlane#method.bg_rgb8].* -#[inline] -pub fn ncplane_bg_rgb8( - plane: &NcPlane, - red: &mut NcComponent, - green: &mut NcComponent, - blue: &mut NcComponent, -) -> NcChannel { - crate::ncchannels_bg_rgb8(ncplane_channels(plane), red, green, blue) -} - -// NcRgb ----------------------------------------------------------------------- - -/// Gets the foreground [NcRgb] from an [NcPlane], shifted to LSBs. -/// -/// *Method: NcPlane.[fg_rgb()][NcPlane#method.fg_rgb].* -#[inline] -pub fn ncplane_fg_rgb(plane: &NcPlane) -> NcRgb { - crate::ncchannels_fg_rgb(ncplane_channels(plane)) -} - -/// Gets the background [NcRgb] from an [NcPlane], shifted to LSBs. -/// -/// *Method: NcPlane.[bg_rgb()][NcPlane#method.bg_rgb].* -#[inline] -pub fn ncplane_bg_rgb(plane: &NcPlane) -> NcRgb { - crate::ncchannels_bg_rgb(ncplane_channels(plane)) -} - -// Default --------------------------------------------------------------------- - -/// Is the plane's foreground using the "default foreground color"? -/// -/// *Method: NcPlane.[fg_default_p()][NcPlane#method.fg_default_p].* -#[inline] -pub fn ncplane_fg_default_p(plane: &NcPlane) -> bool { - crate::ncchannels_fg_default_p(ncplane_channels(plane)) -} - -/// Is the plane's background using the "default background color"? -/// -/// *Method: NcPlane.[bg_default_p()][NcPlane#method.bg_default_p].* -#[inline] -pub fn ncplane_bg_default_p(plane: &NcPlane) -> bool { - crate::ncchannels_bg_default_p(ncplane_channels(plane)) -} - -/// Marks both the foreground and background as using the "default color", -/// and returns the new [NcChannels]. -/// -/// *Method: NcPlane.[set_default()][NcPlane#method.set_default].* -// -// Not in the C API. -#[inline] -pub fn ncplane_set_default(plane: &mut NcPlane) -> NcChannels { - let channels = crate::ncchannels_set_default(&mut ncplane_channels(plane)); - ncplane_set_channels(plane, channels); - channels -} - -/// Marks both the foreground and background as NOT using the "default color", -/// and returns the new [NcChannels]. -/// -/// *Method: NcPlane.[set_not_default()][NcPlane#method.set_not_default].* -// -// Not in the C API. -#[inline] -pub fn ncplane_set_not_default(plane: &mut NcPlane) -> NcChannels { - let channels = crate::ncchannels_set_not_default(&mut ncplane_channels(plane)); - crate::ncplane_set_channels(plane, channels); - channels -} - -/// Marks the foreground as NOT using the "default color", -/// and returns the new [NcChannels]. -/// -/// *Method: NcPlane.[set_fg_not_default()][NcPlane#method.set_fg_not_default].* -// -// Not in the C API. -#[inline] -pub fn ncplane_set_fg_not_default(plane: &NcPlane) -> NcChannels { - crate::ncchannels_set_fg_not_default(&mut ncplane_channels(plane)) -} - -/// Marks the background as NOT using the "default color", -/// and returns the new [NcChannels]. -/// -/// *Method: NcPlane.[set_bg_not_default()][NcPlane#method.set_bg_not_default].* -// -// Not in the C API. -#[inline] -pub fn ncplane_set_bg_not_default(plane: &NcPlane) -> NcChannels { - crate::ncchannels_set_bg_not_default(&mut ncplane_channels(plane)) -} - -// put & print ----------------------------------------------------------------- - -/// Calls [ncplane_putc_yx()][crate::ncplane_putc_yx] for the current cursor location. -/// -/// *Method: NcPlane.[putc()][NcPlane#method.putc].* -#[inline] -pub fn ncplane_putc(plane: &mut NcPlane, cell: &NcCell) -> NcIntResult { - unsafe { crate::ncplane_putc_yx(plane, -1, -1, cell) } -} - -/// Calls ncplane_putchar_yx() at the current cursor location. -/// -/// *Method: NcPlane.[putchar()][NcPlane#method.putchar].* -#[inline] -pub fn ncplane_putchar(plane: &mut NcPlane, ch: char) -> NcIntResult { - unsafe { - let cell = NcCell::from_char(ch, plane); - crate::ncplane_putc_yx(plane, -1, -1, &cell) - } -} - -/// Replaces the [NcCell] at the specified coordinates with the provided char. -/// Advances the cursor by 1. -/// -/// *Method: NcPlane.[putchar_yx()][NcPlane#method.putchar_yx].* -#[inline] -pub fn ncplane_putchar_yx(plane: &mut NcPlane, y: NcDim, x: NcDim, ch: char) -> NcIntResult { - unsafe { - let cell = NcCell::from_char(ch, plane); - crate::ncplane_putc_yx(plane, y as i32, x as i32, &cell) - } -} - -/// Writes a series of `EGC`s to the current location, using the current style. -/// -/// Advances the cursor by some positive number of columns -/// (though not beyond the end of the plane), -/// and this number is returned on success. -/// -/// On error, a non-positive number is returned, indicating -/// the number of columns which were written before the error. -/// -/// *Method: NcPlane.[putstr()][NcPlane#method.putstr].* -#[inline] -pub fn ncplane_putstr(plane: &mut NcPlane, string: &str) -> NcIntResult { - unsafe { crate::ncplane_putstr_yx(plane, -1, -1, cstring![string]) } -} - -/// -/// -/// *Method: NcPlane.[putnstr()][NcPlane#method.putnstr].* -#[inline] -pub fn ncplane_putnstr(plane: &mut NcPlane, size: u32, gclustarr: &[u8]) -> NcIntResult { - unsafe { crate::ncplane_putnstr_yx(plane, -1, -1, size.into(), cstring![gclustarr]) } -} - -// movement, size & alignment -------------------------------------------------- - -/// Moves this `NcPlane` relative to its current location. -/// -/// Negative values move up and left, respectively. -/// Pass 0 to hold an axis constant. -/// -/// It is an error to attempt to move the standard plane. -/// -/// *C style function: [ncplane_moverel()][crate::ncplane_moverel].* -pub fn ncplane_moverel(plane: &mut NcPlane, rows: NcOffset, cols: NcOffset) -> NcIntResult { - let (mut orig_y, mut orig_x) = (0, 0); - unsafe { - crate::ncplane_dim_yx(plane, &mut orig_y, &mut orig_x); - crate::ncplane_move_yx(plane, orig_y + rows, orig_x + cols) - } -} - -/// Gets the columns of the [NcPlane]. -/// -/// *Method: NcPlane.[dim_x()][NcPlane#method.dim_x].* -#[inline] -pub fn ncplane_dim_x(plane: &NcPlane) -> NcDim { - unsafe { - let mut x = 0; - crate::ncplane_dim_yx(plane, null_mut(), &mut x); - x as NcDim - } -} - -/// Gets the rows of the [NcPlane]. -/// -/// *Method: NcPlane.[dim_y()][NcPlane#method.dim_y].* -#[inline] -#[inline] -pub fn ncplane_dim_y(plane: &NcPlane) -> NcDim { - unsafe { - let mut y = 0; - crate::ncplane_dim_yx(plane, &mut y, null_mut()); - y as NcDim - } -} - -/// Resizes the plane, retaining what data we can (everything, unless we're -/// shrinking in some dimension). Keep the origin where it is. -/// -/// *Method: NcPlane.[resize_simple()][NcPlane#method.resize_simple].* -#[inline] -pub fn ncplane_resize_simple(plane: &mut NcPlane, y_len: NcDim, x_len: NcDim) -> NcIntResult { - let (mut old_y, mut old_x) = (0, 0); - unsafe { - crate::ncplane_dim_yx(plane, &mut old_y, &mut old_x); - } - let keep_len_y = { - if old_y > y_len as i32 { - y_len as i32 - } else { - old_y - } - }; - let keep_len_x = { - if old_x > x_len as i32 { - x_len as i32 - } else { - old_x - } - }; - unsafe { - crate::ncplane_resize( - plane, - 0, - 0, - keep_len_y, - keep_len_x, - 0, - 0, - y_len as i32, - x_len as i32, - ) - } -} - -/// Returns the column at which `cols` columns ought start in order to be aligned -/// according to `align` within this NcPlane. -/// -/// Returns `-`[`NCRESULT_MAX`][crate::NCRESULT_MAX] if -/// [NCALIGN_UNALIGNED][crate::NCALIGN_UNALIGNED] or invalid [NcAlign]. -/// -/// *Method: NcPlane.[halign()][NcPlane#method.halign].* -#[inline] -pub fn ncplane_halign(plane: &NcPlane, align: NcAlign, cols: NcDim) -> NcIntResult { - crate::notcurses_align(ncplane_dim_x(plane), align, cols) -} - -/// Returns the row at which `rows` rows ought start in order to be aligned -/// according to `align` within this NcPlane. -/// -/// Returns `-`[`NCRESULT_MAX`][crate::NCRESULT_MAX] if -/// [NCALIGN_UNALIGNED][crate::NCALIGN_UNALIGNED] or invalid [NcAlign]. -/// -/// *Method: NcPlane.[valign()][NcPlane#method.valign].* -#[inline] -pub fn ncplane_valign(plane: &NcPlane, align: NcAlign, rows: NcDim) -> NcIntResult { - crate::notcurses_align(ncplane_dim_y(plane), align, rows) -} - -// line ------------------------------------------------------------------------ - -/// Draws horizontal lines using the specified NcCell, starting at the current -/// cursor position. -/// -/// The cursor will end at the cell following the last cell output, -/// just as if ncplane_putc() was called at that spot. -/// -/// Returns the number of cells drawn on success. On error, returns the negative -/// number of cells drawn. -/// -/// *Method: NcPlane.[hline()][NcPlane#method.hline].* -#[inline] -pub fn ncplane_hline(plane: &mut NcPlane, cell: &NcCell, len: NcDim) -> NcIntResult { - unsafe { crate::ncplane_hline_interp(plane, cell, len as i32, cell.channels, cell.channels) } -} - -/// Draws vertical lines using the specified NcCell, starting at the current -/// cursor position. -/// -/// The cursor will end at the cell following the last cell output, -/// just as if ncplane_putc() was called at that spot. -/// -/// Returns the number of cells drawn on success. On error, returns the negative -/// number of cells drawn. -/// -/// *Method: NcPlane.[vline()][NcPlane#method.vline].* -#[inline] -pub fn ncplane_vline(plane: &mut NcPlane, cell: &NcCell, len: NcDim) -> NcIntResult { - unsafe { crate::ncplane_vline_interp(plane, cell, len as i32, cell.channels, cell.channels) } -} - -// perimeter ------------------------------------------------------------------- - -/// -/// -/// *Method: NcPlane.[perimeter()][NcPlane#method.perimeter].* -#[inline] -pub fn ncplane_perimeter( - plane: &mut NcPlane, - ul: &NcCell, - ur: &NcCell, - ll: &NcCell, - lr: &NcCell, - hline: &NcCell, - vline: &NcCell, - boxmask: NcBoxMask, -) -> NcIntResult { - unsafe { - crate::ncplane_cursor_move_yx(plane, 0, 0); - let (mut dimy, mut dimx) = (0, 0); - crate::ncplane_dim_yx(plane, &mut dimy, &mut dimx); - ncplane_box_sized( - plane, - ul, - ur, - ll, - lr, - hline, - vline, - dimy as NcDim, - dimx as NcDim, - boxmask, - ) - } -} - -/// -/// -/// *Method: NcPlane.[perimeter_double()][NcPlane#method.perimeter_double].* -#[inline] -pub fn ncplane_perimeter_double( - plane: &mut NcPlane, - stylemask: NcStyle, - channels: NcChannels, - boxmask: NcBoxMask, -) -> NcIntResult { - if unsafe { crate::ncplane_cursor_move_yx(plane, 0, 0) } != NCRESULT_OK { - return NCRESULT_ERR; - } - let (mut dimy, mut dimx) = (0, 0); - unsafe { - crate::ncplane_dim_yx(plane, &mut dimy, &mut dimx); - } - let mut ul = NcCell::new(); - let mut ur = NcCell::new(); - let mut ll = NcCell::new(); - let mut lr = NcCell::new(); - let mut hl = NcCell::new(); - let mut vl = NcCell::new(); - if unsafe { - crate::nccells_double_box( - plane, - stylemask as u32, - channels, - &mut ul, - &mut ur, - &mut ll, - &mut lr, - &mut hl, - &mut vl, - ) - } != NCRESULT_OK - { - return NCRESULT_ERR; - } - let ret = ncplane_box_sized( - plane, - &ul, - &ur, - &ll, - &lr, - &hl, - &vl, - dimy as NcDim, - dimx as NcDim, - boxmask, - ); - unsafe { - nccell_release(plane, &mut ul); - nccell_release(plane, &mut ur); - nccell_release(plane, &mut ll); - nccell_release(plane, &mut lr); - nccell_release(plane, &mut hl); - nccell_release(plane, &mut vl); - } - ret -} - -/// -/// -/// *Method: NcPlane.[perimeter_rounded()][NcPlane#method.perimeter_rounded].* -#[inline] -pub fn ncplane_perimeter_rounded( - plane: &mut NcPlane, - stylemask: NcStyle, - channels: NcChannels, - boxmask: NcBoxMask, -) -> NcIntResult { - if unsafe { crate::ncplane_cursor_move_yx(plane, 0, 0) } != NCRESULT_OK { - return NCRESULT_ERR; - } - let (mut dimy, mut dimx) = (0, 0); - unsafe { - crate::ncplane_dim_yx(plane, &mut dimy, &mut dimx); - } - let mut ul = NcCell::new(); - let mut ur = NcCell::new(); - let mut ll = NcCell::new(); - let mut lr = NcCell::new(); - let mut hl = NcCell::new(); - let mut vl = NcCell::new(); - if unsafe { - crate::nccells_rounded_box( - plane, - stylemask as u32, - channels, - &mut ul, - &mut ur, - &mut ll, - &mut lr, - &mut hl, - &mut vl, - ) - } != NCRESULT_OK - { - return NCRESULT_ERR; - } - let ret = ncplane_box_sized( - plane, - &ul, - &ur, - &ll, - &lr, - &hl, - &vl, - dimy as NcDim, - dimx as NcDim, - boxmask, - ); - unsafe { - nccell_release(plane, &mut ul); - nccell_release(plane, &mut ur); - nccell_release(plane, &mut ll); - nccell_release(plane, &mut lr); - nccell_release(plane, &mut hl); - nccell_release(plane, &mut vl); - } - ret -} - -// box ------------------------------------------------------------------------- - -/// Draws a box with its upper-left corner at the current cursor position, -/// having dimensions `y_len` * `x_len`. -/// -/// The minimum box size is 2x2, and it cannot be drawn off-screen. -/// -/// See [ncplane_box()](crate::ncplane_box) for more information. -/// -/// *Method: NcPlane.[box_sized()][NcPlane#method.box_sized].* -#[inline] -pub fn ncplane_box_sized( - plane: &mut NcPlane, - ul: &NcCell, - ur: &NcCell, - ll: &NcCell, - lr: &NcCell, - hline: &NcCell, - vline: &NcCell, - y_len: NcDim, - x_len: NcDim, - boxmask: NcBoxMask, -) -> NcIntResult { - let (mut y, mut x) = (0, 0); - unsafe { - crate::ncplane_cursor_yx(plane, &mut y, &mut x); - crate::ncplane_box( - plane, - ul, - ur, - ll, - lr, - hline, - vline, - y + y_len as i32 - 1, - x + x_len as i32 - 1, - boxmask, - ) - } -} - -/// -/// -/// *Method: NcPlane.[double_box()][NcPlane#method.double_box].* -#[inline] -pub fn ncplane_double_box( - plane: &mut NcPlane, - stylemask: NcStyle, - channels: NcChannels, - y_stop: NcDim, - x_stop: NcDim, - boxmask: NcBoxMask, -) -> NcIntResult { - #[allow(unused_assignments)] - let mut ret = NCRESULT_OK; - - let mut ul = NcCell::new(); - let mut ur = NcCell::new(); - let mut ll = NcCell::new(); - let mut lr = NcCell::new(); - let mut hl = NcCell::new(); - let mut vl = NcCell::new(); - - unsafe { - ret = crate::nccells_double_box( - plane, - stylemask as u32, - channels, - &mut ul, - &mut ur, - &mut ll, - &mut lr, - &mut hl, - &mut vl, - ); - if ret == NCRESULT_OK { - ret = crate::ncplane_box( - plane, - &ul, - &ur, - &ll, - &lr, - &hl, - &vl, - y_stop as i32, - x_stop as i32, - boxmask, - ); - } - - nccell_release(plane, &mut ul); - nccell_release(plane, &mut ur); - nccell_release(plane, &mut ll); - nccell_release(plane, &mut lr); - nccell_release(plane, &mut hl); - nccell_release(plane, &mut vl); - } - ret -} - -/// -/// -/// *Method: NcPlane.[double_box_sized()][NcPlane#method.double_box_sized].* -#[inline] -pub fn ncplane_double_box_sized( - plane: &mut NcPlane, - stylemask: NcStyle, - channels: NcChannels, - y_len: NcDim, - x_len: NcDim, - boxmask: NcBoxMask, -) -> NcIntResult { - let (mut y, mut x) = (0, 0); - unsafe { - crate::ncplane_cursor_yx(plane, &mut y, &mut x); - } - crate::ncplane_double_box( - plane, - stylemask, - channels, - y as NcDim + y_len - 1, - x as NcDim + x_len - 1, - boxmask, - ) -} - -/// -/// -/// *Method: NcPlane.[rounded_box()][NcPlane#method.rounded_box].* -#[inline] -pub fn ncplane_rounded_box( - plane: &mut NcPlane, - stylemask: NcStyle, - channels: NcChannels, - y_stop: NcDim, - x_stop: NcDim, - boxmask: NcBoxMask, -) -> NcIntResult { - #[allow(unused_assignments)] - let mut ret = NCRESULT_OK; - - let mut ul = NcCell::new(); - let mut ur = NcCell::new(); - let mut ll = NcCell::new(); - let mut lr = NcCell::new(); - let mut hl = NcCell::new(); - let mut vl = NcCell::new(); - - unsafe { - ret = crate::nccells_rounded_box( - plane, - stylemask as u32, - channels, - &mut ul, - &mut ur, - &mut ll, - &mut lr, - &mut hl, - &mut vl, - ); - if ret == NCRESULT_OK { - ret = crate::ncplane_box( - plane, - &ul, - &ur, - &ll, - &lr, - &hl, - &vl, - y_stop as i32, - x_stop as i32, - boxmask, - ); - } - nccell_release(plane, &mut ul); - nccell_release(plane, &mut ur); - nccell_release(plane, &mut ll); - nccell_release(plane, &mut lr); - nccell_release(plane, &mut hl); - nccell_release(plane, &mut vl); - } - ret -} - -/// -/// -/// *Method: NcPlane.[rounded_box_sized()][NcPlane#method.rounded_box_sized].* -#[inline] -pub fn ncplane_rounded_box_sized( - plane: &mut NcPlane, - stylemask: NcStyle, - channels: NcChannels, - y_len: NcDim, - x_len: NcDim, - boxmask: NcBoxMask, -) -> NcIntResult { - let (mut y, mut x) = (0, 0); - unsafe { - crate::ncplane_cursor_yx(plane, &mut y, &mut x); - } - ncplane_rounded_box( - plane, - stylemask, - channels, - y as NcDim + y_len - 1, - x as NcDim + x_len - 1, - boxmask, - ) -} - -// gradient -------------------------------------------------------------------- - -/// Draws a gradient with its upper-left corner at the current cursor position, -/// stopping at `ystop`×`xstop`. -/// -/// The glyph composed of `egc` and `stylemask` is used for all cells. The -/// `NcChannels` specified by `ul`, `ur`, `ll`, and `lr` are composed into -/// foreground and background gradients. -/// -/// - To do a vertical gradient, `ul` ought equal `ur` and `ll` ought equal `lr`. -/// - To do a horizontal gradient, `ul` ought equal `ll` and `ur` ought equal `ul`. -/// - To color everything the same, all four channels should be equivalent. The -/// resulting alpha values are equal to incoming alpha values. Returns the number -/// of cells filled on success, or -1 on failure. -/// -/// Palette-indexed color is not supported. -/// -/// Preconditions for gradient operations (error otherwise): -/// - all: only RGB colors, unless all four channels match as default -/// - all: all alpha values must be the same -/// - 1x1: all four colors must be the same -/// - 1xN: both top and both bottom colors must be the same (vertical gradient) -/// - Nx1: both left and both right colors must be the same (horizontal gradient) -/// -/// *Method: NcPlane.[gradient()][NcPlane#method.gradient].* -#[inline] -pub fn ncplane_gradient( - plane: &mut NcPlane, - egc: &str, - stylemask: NcStyle, - ul: NcChannels, - ur: NcChannels, - ll: NcChannels, - lr: NcChannels, - y_len: NcDim, - x_len: NcDim, -) -> NcIntResult { - if y_len < 1 || x_len < 1 { - return NCRESULT_ERR; - } - - #[cfg(any(target_arch = "armv7l", target_arch = "i686"))] - let egc_ptr = cstring![egc] as *const i8; - #[cfg(not(any(target_arch = "armv7l", target_arch = "i686")))] - let egc_ptr = cstring![egc]; - - unsafe { - crate::bindings::ffi::ncplane_gradient( - plane, - egc_ptr, - stylemask as u32, - ul, - ur, - ll, - lr, - y_len as i32, - x_len as i32, - ) - } -} - -/// Draw a gradient with its upper-left corner at the current cursor position, -/// having dimensions `y_len` * `x_len`. -/// -/// See [ncplane_gradient][crate::ncplane_gradient] for more information. -/// -/// *Method: NcPlane.[gradient_sized()][NcPlane#method.gradient_sized].* -#[inline] -pub fn ncplane_gradient_sized( - plane: &mut NcPlane, - egc: &str, - stylemask: NcStyle, - ul: NcChannels, - ur: NcChannels, - ll: NcChannels, - lr: NcChannels, - y_len: NcDim, - x_len: NcDim, -) -> NcIntResult { - if y_len < 1 || x_len < 1 { - return NCRESULT_ERR; - } - let (mut y, mut x) = (0, 0); - unsafe { - crate::ncplane_cursor_yx(plane, &mut y, &mut x); - ncplane_gradient( - plane, - egc, - stylemask, - ul, - ur, - ll, - lr, - y as u32 + y_len - 1, - x as u32 + x_len - 1, - ) - } -} diff --git a/rust/src/plane/test/methods.rs b/rust/src/plane/test/methods.rs deleted file mode 100644 index d2311dac6..000000000 --- a/rust/src/plane/test/methods.rs +++ /dev/null @@ -1,4 +0,0 @@ -//! Test `NcPlane` methods and associated functions. - -// use crate::NcPlane; -// use serial_test::serial; diff --git a/rust/src/plane/test/mod.rs b/rust/src/plane/test/mod.rs deleted file mode 100644 index 2f66f6c89..000000000 --- a/rust/src/plane/test/mod.rs +++ /dev/null @@ -1,7 +0,0 @@ -//! `NcPlane` tests. - -#[cfg(test)] -mod methods; - -#[cfg(test)] -mod reimplemented; diff --git a/rust/src/plane/test/reimplemented.rs b/rust/src/plane/test/reimplemented.rs deleted file mode 100644 index aa41e0478..000000000 --- a/rust/src/plane/test/reimplemented.rs +++ /dev/null @@ -1,240 +0,0 @@ -//! Test `ncplane_*` reimplemented functions. - -use crate::{ncplane_new_test, notcurses_init_test, notcurses_stop, NCRESULT_OK}; -use serial_test::serial; - -#[test] -#[serial] -fn ncplane_notcurses() { - unsafe { - let nc = notcurses_init_test(); - let plane = ncplane_new_test(nc, 0, 0, 20, 20); - - let nc2 = crate::ncplane_notcurses(plane); - assert_eq![nc as *mut _, nc2]; - - let nc3 = crate::ncplane_notcurses_const(plane); - assert_eq![nc as *const _, nc3]; - - notcurses_stop(nc); - } -} - -#[test] -#[serial] -fn ncplane_cursor() { - unsafe { - let nc = notcurses_init_test(); - let plane = ncplane_new_test(nc, 0, 0, 20, 20); - - let (mut y, mut x) = (0, 0); - crate::ncplane_cursor_yx(plane, &mut y, &mut x); - assert_eq![x, 0]; - assert_eq![y, 0]; - - let res = crate::ncplane_cursor_move_yx(plane, 10, 15); - assert_eq![res, 0]; - crate::ncplane_cursor_yx(plane, &mut y, &mut x); - assert_eq![x, 15]; - assert_eq![y, 10]; - - crate::ncplane_home(plane); - crate::ncplane_cursor_yx(plane, &mut y, &mut x); - assert_eq![x, 0]; - assert_eq![y, 0]; - - let _res = crate::ncplane_cursor_move_yx(plane, 10, 15); - crate::ncplane_erase(plane); // has to move the cursor to 0,0 - crate::ncplane_cursor_yx(plane, &mut y, &mut x); - assert_eq![x, 0]; - assert_eq![y, 0]; - - notcurses_stop(nc); - } -} - -#[test] -#[serial] -fn ncplane_channels() { - unsafe { - let nc = notcurses_init_test(); - let plane = ncplane_new_test(nc, 0, 0, 20, 20); - - let channels = crate::ncplane_channels(plane); - assert_eq![channels, 0]; - - crate::ncplane_set_channels(plane, 0x1122334455667788); - assert_eq![0x1122334455667788, crate::ncplane_channels(plane)]; - - notcurses_stop(nc); - } -} - -#[test] -#[serial] -fn ncplane_fchannel() { - unsafe { - let nc = notcurses_init_test(); - let plane = ncplane_new_test(nc, 0, 0, 20, 20); - - crate::ncplane_set_channels(plane, 0x1122334455667788); - let channels = crate::ncplane_channels(plane); - assert_eq![0x11223344, crate::ncchannels_fchannel(channels)]; - - let channels = crate::ncplane_set_fchannel(plane, 0x10203040); - assert_eq![0x10203040, crate::ncchannels_fchannel(channels)]; - assert_eq![0x1020304055667788, channels]; - - notcurses_stop(nc); - } -} - -#[test] -#[serial] -fn ncplane_bchannel() { - unsafe { - let nc = notcurses_init_test(); - let plane = ncplane_new_test(nc, 0, 0, 20, 20); - - crate::ncplane_set_channels(plane, 0x1122334455667788); - let channels = crate::ncplane_channels(plane); - assert_eq![0x55667788, crate::ncchannels_bchannel(channels)]; - - // BUG? ncplane_set_bchannel and ncplane_set_fchannel don't get - // applied unless they are assigned to a variable. Weird. - - let channels = crate::ncplane_set_bchannel(plane, 0x50607080); - assert_eq![0x50607080, crate::ncchannels_bchannel(channels)]; - assert_eq![0x1122334450607080, channels]; - - notcurses_stop(nc); - } -} - -#[test] -#[serial] -fn ncplane_rgb() { - unsafe { - let nc = notcurses_init_test(); - let plane = ncplane_new_test(nc, 0, 0, 20, 20); - - crate::ncplane_set_fg_rgb(plane, 0x112233); - assert_eq![0x112233, crate::ncplane_fg_rgb(plane)]; - - notcurses_stop(nc); - } -} - -#[test] -#[serial] -fn ncplane_default() { - unsafe { - let nc = notcurses_init_test(); - let plane = ncplane_new_test(nc, 0, 0, 20, 20); - assert_eq![true, crate::ncplane_bg_default_p(plane)]; - assert_eq![true, crate::ncplane_fg_default_p(plane)]; - - crate::ncplane_set_bg_rgb8(plane, 11, 22, 33); - crate::ncplane_set_fg_rgb8(plane, 44, 55, 66); - assert_eq![false, crate::ncplane_bg_default_p(plane)]; - assert_eq![false, crate::ncplane_fg_default_p(plane)]; - - crate::ncplane_set_bg_default(plane); - crate::ncplane_set_fg_default(plane); - assert_eq![true, crate::ncplane_bg_default_p(plane)]; - assert_eq![true, crate::ncplane_fg_default_p(plane)]; - - notcurses_stop(nc); - } -} - -#[test] -#[serial] -fn ncplane_dimensions() { - unsafe { - let nc = notcurses_init_test(); - let plane = ncplane_new_test(nc, 0, 0, 10, 20); - - let (mut y, mut x) = (0, 0); - crate::ncplane_dim_yx(plane, &mut y, &mut x); - assert_eq!((10, 20), (y, x)); - - assert_eq!(10, crate::ncplane_dim_y(plane)); - assert_eq!(20, crate::ncplane_dim_x(plane)); - - notcurses_stop(nc); - } -} - -#[test] -#[serial] -fn ncplane_resize() { - unsafe { - let nc = notcurses_init_test(); - let plane = ncplane_new_test(nc, 0, 0, 20, 20); - - let res = crate::ncplane_resize_simple(plane, 40, 40); - assert_eq![NCRESULT_OK, res]; - - let (mut y, mut x) = (0, 0); - crate::ncplane_dim_yx(plane, &mut y, &mut x); - assert_eq!((40, 40), (y, x)); - - // TODO: test further plane subset keeping unchanged features - let res = crate::ncplane_resize(plane, 0, 0, 0, 0, 0, 0, 60, 70); - assert_eq![NCRESULT_OK, res]; - - assert_eq!(60, crate::ncplane_dim_y(plane)); - assert_eq!(70, crate::ncplane_dim_x(plane)); - - notcurses_stop(nc); - } -} - -// TODO: resizecb - -#[test] -#[serial] -// TODO: CHECK: zeroes out every cell of the plane, dumps the egcpool, -// The base cell is preserved. -fn ncplane_erase() { - unsafe { - let nc = notcurses_init_test(); - let plane = ncplane_new_test(nc, 0, 0, 20, 20); - - crate::ncplane_set_bg_rgb(plane, 0x112233); - crate::ncplane_set_fg_rgb(plane, 0x445566); - assert_eq![false, crate::ncplane_bg_default_p(plane)]; - assert_eq![false, crate::ncplane_fg_default_p(plane)]; - - // FIXME? DEBUG - crate::ncplane_erase(plane); - // assert_eq![true, crate::ncplane_bg_default_p(plane)]; - // assert_eq![true, crate::ncplane_fg_default_p(plane)]; - //print!(" C: {:#0x} ", crate::ncplane_channels(plane)); - - notcurses_stop(nc); - } -} - -// #[test] -// #[serial] -// fn ncplane_at_cursor() { -// unsafe { -// let nc = notcurses_init_test(); -// let plane = ncplane_new_test(nc, 0, 0, 20, 20); -// -// notcurses_stop(nc); -// } -// } -// -// #[test] -// #[serial] -// fn ncplane_at_cursor_cell() { -// unsafe { -// let nc = notcurses_init_test(); -// let plane = ncplane_new_test(nc, 0, 0, 20, 20); -// -// notcurses_stop(nc); -// } -// } diff --git a/rust/src/resizecb.rs b/rust/src/resizecb.rs deleted file mode 100644 index 8cffc1f15..000000000 --- a/rust/src/resizecb.rs +++ /dev/null @@ -1,58 +0,0 @@ -//! `NcResizeCb` - -use crate::{NcIntResult, NcPlane}; - -/// A callback function called when an [NcPlane] is resized. -/// -/// See also [ncresizecb_to_rust] & [ncresizecb_to_c]. -/// -pub type NcResizeCb = fn(&mut NcPlane) -> NcIntResult; - -/// The unsafe version of [NcResizeCb] expected by the notcurses C API. -pub type NcResizeCbUnsafe = unsafe extern "C" fn(*mut NcPlane) -> NcIntResult; - -/// Converts [NcResizeCbUnsafe] to [NcResizeCb]. -pub fn ncresizecb_to_rust(resizecb: Option) -> Option { - resizecb.map(|cb| unsafe { core::mem::transmute(cb) }) -} - -/// Converts [NcResizeCb] to [NcResizeCbUnsafe]. -/// -// waiting for https://github.com/rust-lang/rust/issues/53605 -// to make this function const, and then NcPlaneOptions constructors. -pub fn ncresizecb_to_c(resizecb: Option) -> Option { - resizecb.map(|cb| unsafe { core::mem::transmute(cb) }) -} - -/// Enables the [NcResizeCb] methods. -pub trait NcResizeCbMethods { - fn to_rust(&self) -> Option; - fn to_c(&self) -> Option; -} - -impl NcResizeCbMethods for NcResizeCb { - /// Returns [NcResizeCbUnsafe]. - /// - /// *C style function: [ncresizecb_to_c()][ncresizecb_to_c].* - fn to_c(&self) -> Option { - ncresizecb_to_c(Some(*self)) - } - /// no-op. - fn to_rust(&self) -> Option { - Some(*self) - } -} - -impl NcResizeCbMethods for NcResizeCbUnsafe { - /// no-op. - fn to_c(&self) -> Option { - Some(*self) - } - - /// Returns [NcResizeCb]. - /// - /// *C style function: [ncresizecb_to_rust()][ncresizecb_to_rust].* - fn to_rust(&self) -> Option { - ncresizecb_to_rust(Some(*self)) - } -} diff --git a/rust/src/stats.rs b/rust/src/stats.rs deleted file mode 100644 index 0ddc8b086..000000000 --- a/rust/src/stats.rs +++ /dev/null @@ -1,24 +0,0 @@ -//! `NcStats` - -use crate::Nc; - -/// notcurses runtime statistics -pub type NcStats = crate::bindings::ffi::ncstats; - -/// # `NcStats` Methods. -impl NcStats { - /// Allocates an NcStats object. - pub fn new(nc: &mut Nc) -> &mut Self { - unsafe { &mut *crate::notcurses_stats_alloc(nc) } - } - - /// Acquires an atomic snapshot of the notcurses object's stats. - pub fn stats(&mut self, nc: &mut Nc) { - unsafe { crate::notcurses_stats(nc, self) } - } - - /// Resets all cumulative stats (immediate ones are not reset). - pub fn reset(&mut self, nc: &mut Nc) { - unsafe { crate::notcurses_stats_reset(nc, self) } - } -} diff --git a/rust/src/time.rs b/rust/src/time.rs deleted file mode 100644 index e8d781eea..000000000 --- a/rust/src/time.rs +++ /dev/null @@ -1,15 +0,0 @@ -//! `NcTime` - -/// -// Expected by [`notcurses_getc`] & [`notcurses_getc_nblock`], that can't use -// libc::timespec -pub type NcTime = crate::bindings::ffi::timespec; - -impl NcTime { - pub fn new() -> Self { - Self { - tv_sec: 0, - tv_nsec: 0, - } - } -} diff --git a/rust/src/visual/methods.rs b/rust/src/visual/methods.rs deleted file mode 100644 index 000450fac..000000000 --- a/rust/src/visual/methods.rs +++ /dev/null @@ -1,618 +0,0 @@ -//! `NcVisual*` methods and associated functions. - -use core::ptr::null_mut; -use libc::c_void; - -use crate::{ - cstring, error, error_ref_mut, rstring, Nc, NcBlitter, NcComponent, NcDim, NcDirect, NcDirectF, - NcError, NcIntResult, NcPixel, NcPlane, NcResult, NcRgba, NcScale, NcTime, NcVGeom, NcVisual, - NcVisualOptions, NCBLIT_PIXEL, NCRESULT_ERR, -}; - -/// # NcVisualOptions Constructors -impl NcVisualOptions { - // /// New NcVisualOptions - // pub fn new() -> Self { - // Self::with_flags() - // } - // - // pub fn new_aligned() -> Self { - // Self::with_flags_aligned() - // } - - // TODO: - // - horizontally aligned - // - copy from NcPlaneOptions (with_flags_aligned & with_flags,) - // y is an ncalign_e if NCVISUAL_OPTION_VERALIGNED is provided. - // x is an ncalign_e value if NCVISUAL_OPTION_HORALIGNED is provided. - - /// Specify an existing plane. - /// - /// If [`NCVISUAL_OPTION_CHILDPLANE`][crate::NCVISUAL_OPTION_CHILDPLANE] is - /// used in `flags` then the `plane` is interpreted as the parent [`NcPlane`] - /// of the new plane created for this [`NcVisual`]. - pub fn with_plane( - plane: &mut NcPlane, - scale: NcScale, - y: NcDim, - x: NcDim, - begy: NcDim, - begx: NcDim, - leny: NcDim, - lenx: NcDim, - blitter: NcBlitter, - flags: u32, - transcolor: NcRgba, - ) -> Self { - Self { - // provided plane - n: plane, - // the source is stretched/scaled relative to the provided ncplane - scaling: scale, - y: y as i32, - x: x as i32, - // origin of rendered section - begy: begy as i32, - begx: begx as i32, - // size of rendered section - leny: leny as i32, - lenx: lenx as i32, - // glyph set to use - blitter, - // bitmask over NCVISUAL_OPTION_* - flags: flags as u64, - transcolor, - } - } - - pub fn without_plane( - y: NcDim, - x: NcDim, - begy: NcDim, - begx: NcDim, - leny: NcDim, - lenx: NcDim, - blitter: NcBlitter, - flags: u32, - transcolor: u32, - ) -> Self { - Self { - n: null_mut(), - scaling: crate::NCSCALE_NONE, - // where the created ncplane will be placed relative to the standard plane's origin - y: y as i32, - x: x as i32, - // origin of rendered section - begy: begy as i32, - begx: begx as i32, - // size of rendered section - leny: leny as i32, - lenx: lenx as i32, - // glyph set to use - blitter, - // bitmask over NCVISUAL_OPTION_* - flags: flags as u64, - // This color will be treated as transparent with flag [NCVISUAL_OPTION_ADDALPHA]. - transcolor, - } - } - - pub fn fullsize_pixel_without_plane(y: NcDim, x: NcDim, leny: NcDim, lenx: NcDim) -> Self { - Self::without_plane(y, x, 0, 0, leny, lenx, NCBLIT_PIXEL, 0, 0) - } -} - -/// # NcVisual Constructors & destructors -impl NcVisual { - /// Like [from_rgba][NcVisual#method.from_rgba], but 'bgra' is arranged as BGRA. - /// - /// *C style function: [ncvisual_from_bgra()][crate::ncvisual_from_bgra].* - pub fn from_bgra<'a>( - bgra: &[u8], - rows: NcDim, - rowstride: NcDim, - cols: NcDim, - ) -> NcResult<&'a mut NcVisual> { - error_ref_mut![ - unsafe { - crate::ncvisual_from_bgra( - bgra.as_ptr() as *const c_void, - rows as i32, - rowstride as i32, - cols as i32, - ) - }, - &format![ - "NcVisual::from_bgra(bgra, {}, {}, {})", - rows, rowstride, cols - ] - ] - } - - /// Opens a visual at `file`, extracts the codec and parameters and - /// decodes the first image to memory. - /// - /// *C style function: [ncvisual_from_file()][crate::ncvisual_from_file].* - pub fn from_file<'a>(file: &str) -> NcResult<&'a mut NcVisual> { - error_ref_mut![ - unsafe { crate::ncvisual_from_file(cstring![file]) }, - &format!("NcVisual::from_file({})", file) - ] - } - - /// Promotes an NcPlane to an NcVisual. - /// - /// The plane may contain only spaces, half blocks, and full blocks. - /// This will be checked, and any other glyph will result in an error. - /// - /// This function exists so that planes can be subjected to NcVisual transformations. - /// If possible, it's better to create the ncvisual from memory using - /// [from_rgba][NcVisual#method.from_rgba]. - /// - /// *C style function: [ncvisual_from_plane()][crate::ncvisual_from_plane].* - pub fn from_plane<'a>( - plane: &NcPlane, - blitter: NcBlitter, - beg_y: NcDim, - beg_x: NcDim, - len_y: NcDim, - len_x: NcDim, - ) -> NcResult<&'a mut NcVisual> { - error_ref_mut![ - unsafe { - crate::ncvisual_from_plane( - plane, - blitter, - beg_y as i32, - beg_x as i32, - len_y as i32, - len_x as i32, - ) - }, - &format!( - "NcVisual::from_file(plane, {}, {}, {}, {}, {})", - blitter, beg_y, beg_x, len_y, len_x - ) - ] - } - - /// Like [`from_rgba`][NcVisual#method.from_rgba], but the pixels are - /// 4-byte RGBX. Alpha is filled in throughout using 'alpha'. - /// - /// `rowstride` must be a multiple of 4. - /// - /// *C style function: [ncvisual_from_rgb_loose()][crate::ncvisual_from_rgb_loose].* - pub fn from_rgb_loose<'a>( - rgb: &[u8], - rows: NcDim, - rowstride: NcDim, - cols: NcDim, - alpha: NcComponent, - ) -> NcResult<&'a mut NcVisual> { - error_ref_mut![ - unsafe { - crate::ncvisual_from_rgb_loose( - rgb.as_ptr() as *const c_void, - rows as i32, - rowstride as i32, - cols as i32, - alpha as i32, - ) - }, - &format!( - "NcVisual::from_rgb_loose(rgba, {}, {}, {}, {})", - rows, rowstride, cols, alpha - ) - ] - } - - /// Like [`from_rgba`][NcVisual#method.from_rgba], but the pixels are - /// 3-byte RGB. Alpha is filled in throughout using 'alpha'. - /// - /// *C style function: [ncvisual_from_rgb_packed()][crate::ncvisual_from_rgb_packed].* - pub fn from_rgb_packed<'a>( - rgb: &[u8], - rows: NcDim, - rowstride: NcDim, - cols: NcDim, - alpha: NcComponent, - ) -> NcResult<&'a mut NcVisual> { - error_ref_mut![ - unsafe { - crate::ncvisual_from_rgb_packed( - rgb.as_ptr() as *const c_void, - rows as i32, - rowstride as i32, - cols as i32, - alpha as i32, - ) - }, - &format!( - "NcVisual::from_rgb_packed(rgba, {}, {}, {}, {})", - rows, rowstride, cols, alpha - ) - ] - } - - /// Prepares an NcVisual, and its underlying NcPlane, based off RGBA content - /// in memory at `rgba`. - /// - /// `rgba` is laid out as `rows` lines, each of which is `rowstride` bytes in length. - /// Each line has `cols` 32-bit 8bpc RGBA pixels followed by possible padding - /// (there will be rowstride - cols * 4 bytes of padding). - /// - /// The total size of `rgba` is thus (rows * rowstride) bytes, of which - /// (rows * cols * 4) bytes are actual non-padding data. - /// - /// *C style function: [ncvisual_from_rgba()][crate::ncvisual_from_rgba].* - pub fn from_rgba<'a>( - rgba: &[u8], - rows: NcDim, - rowstride: NcDim, - cols: NcDim, - ) -> NcResult<&'a mut NcVisual> { - error_ref_mut![ - unsafe { - crate::ncvisual_from_rgba( - rgba.as_ptr() as *const c_void, - rows as i32, - rowstride as i32, - cols as i32, - ) - }, - &format!( - "NcVisual::from_rgba(rgba, {}, {}, {})", - rows, rowstride, cols - ) - ] - } - - /// Destroys this NcVisual. - /// - /// Rendered elements will not be disrupted, but the visual can be neither - /// decoded nor rendered any further. - /// - /// *C style function: [ncvisual_destroy()][crate::ncvisual_destroy].* - pub fn destroy(&mut self) { - unsafe { crate::ncvisual_destroy(self) } - } -} - -/// # NcVisual Methods -impl NcVisual { - /// Gets the specified pixel from this NcVisual. - /// - /// *C style function: [ncvisual_at_yx()][crate::ncvisual_at_yx].* - pub fn at_yx(&self, y: NcDim, x: NcDim) -> NcResult { - let mut pixel = 0; - let res = unsafe { crate::ncvisual_at_yx(self, y as i32, x as i32, &mut pixel) }; - error![res, "NcVisual.at_yx()", pixel] - } - - /// Extracts the next frame from the NcVisual. - /// - /// Returns 0 for normal frames, and 1 to indicate EOF. - /// - /// *C style function: [ncvisual_decode()][crate::ncvisual_decode].* - pub fn decode(&mut self) -> NcResult { - let res = unsafe { crate::ncvisual_decode(self) }; - if res == NCRESULT_ERR { - Err(NcError::with_msg(res, "NcVisual.decode()")) - } else { - Ok(res) - } - } - - /// Extracts the next frame from the NcVisual, ala [decode][NcVisual#method.decode], - /// but if we have reached the end, rewinds to the first frame. - /// - /// *A subsequent [NcVisual.render]() will render the first frame, - /// as if the ncvisual had been closed and reopened.* - /// - /// Returns 0 for normal frames and 1 to indicate EOF. - /// - /// *C style function: [ncvisual_decode_loop()][crate::ncvisual_decode_loop].* - pub fn decode_loop(&mut self) -> NcResult { - let res = unsafe { crate::ncvisual_decode_loop(self) }; - if res == NCRESULT_ERR { - Err(NcError::with_msg(res, "NcVisual.decode_loop()")) - } else { - Ok(res) - } - } - - /// Gets the size and ratio of NcVisual pixels to output cells along the - /// `y→to_y` and `x→to_x` axes. - /// - /// Returns a tuple with (y, x, to_y, to_x) - /// - /// An NcVisual of `y` by `x` pixels will require - /// (`y` * `to_y`) by (`x` * `to_x`) cells for full output. - /// - /// Errors on invalid blitter in `options`. Scaling is taken into consideration. - /// - /// *C style function: [ncvisual_blitter_geom()][crate::ncvisual_blitter_geom].* - pub fn geom( - &self, - nc: &Nc, - options: &NcVisualOptions, - ) -> NcResult<(NcDim, NcDim, NcDim, NcDim)> { - let mut y = 0; - let mut x = 0; - let mut to_y = 0; - let mut to_x = 0; - - let res = unsafe { - crate::ncvisual_blitter_geom( - nc, - self, - options, - &mut y, - &mut x, - &mut to_y, - &mut to_x, - null_mut(), - ) - }; - error![ - res, - "NcVisual.geom()", - (y as NcDim, x as NcDim, to_y as NcDim, to_x as NcDim) - ]; - } - - /// Gets the default media (not plot) blitter for this environment when using - /// the specified scaling method. - /// - /// Currently, this means: - /// - if lacking UTF-8, NCBLIT_1x1. - /// - otherwise, if not NCSCALE_STRETCH, NCBLIT_2x1. - /// - otherwise, if sextants are not known to be good, NCBLIT_2x2. - /// - otherwise NCBLIT_3x2 NCBLIT_2x2 and NCBLIT_3x2 both distort the original - /// aspect ratio, thus NCBLIT_2x1 is used outside of NCSCALE_STRETCH. - /// - /// *C style function: [ncvisual_media_defblitter()][crate::ncvisual_media_defblitter].* - pub fn media_defblitter(nc: &Nc, scale: NcScale) -> NcBlitter { - unsafe { crate::ncvisual_media_defblitter(nc, scale) } - } - - /// Polyfills at the specified location using `rgba`. - /// - /// *C style function: [ncvisual_polyfill_yx()][crate::ncvisual_polyfill_yx].* - pub fn polyfill_yx(&mut self, y: NcDim, x: NcDim, rgba: NcRgba) -> NcResult<()> { - error![ - unsafe { crate::ncvisual_polyfill_yx(self, y as i32, x as i32, rgba) }, - &format!["NcVisual.polyfill_yx({}, {}, {})", y, x, rgba] - ] - } - - /// Renders the decoded frame to the specified [`NcPlane`]. - /// - /// See [`NcVisualOptions`]. - /// - /// *C style function: [ncvisual_render()][crate::ncvisual_render].* - pub fn render(&mut self, nc: &mut Nc, options: &NcVisualOptions) -> NcResult<&mut NcPlane> { - error_ref_mut![ - unsafe { crate::ncvisual_render(nc, self, options) }, - "NcVisual.render(Nc, &NcVisualOptions)" - ] - } - - /// Resizes the visual to `cols` X `rows` pixels. - /// - /// This is a lossy transformation, unless the size is unchanged. - /// - /// *C style function: [ncvisual_resize()][crate::ncvisual_resize].* - pub fn resize(&mut self, rows: NcDim, cols: NcDim) -> NcResult<()> { - error![ - unsafe { crate::ncvisual_resize(self, rows as i32, cols as i32) }, - &format!["NcVisual.resize({}, {})", rows, cols] - ] - } - - /// Resizes the visual to in the image to `rows` X `cols` pixels, without - /// interpolating the color values. - /// - /// The original color is retained. - /// - /// *C style function: - /// [ncvisual_resize_noninterpolative()][crate::ncvisual_resize_noninterpolative].* - pub fn resize_noninterpolative(&mut self, rows: NcDim, cols: NcDim) -> NcResult<()> { - error![ - unsafe { crate::ncvisual_resize_noninterpolative(self, rows as i32, cols as i32) }, - &format!["NcVisual.resize_noninterpolative({}, {})", cols, rows] - ] - } - - /// Rotates the visual `rads` radians. - /// - /// Only M_PI/2 and -M_PI/2 are supported at the moment, - /// but this will change. (FIXME) - /// - /// *C style function: [ncvisual_rotate()][crate::ncvisual_rotate].* - pub fn rotate(&mut self, rads: f64) -> NcResult<()> { - error![ - unsafe { crate::ncvisual_rotate(self, rads) }, - &format!["NcVisual.rotate({})", rads] - ] - } - - /// Sets the specified pixel. - /// - /// *C style function: [ncvisual_set_yx()][crate::ncvisual_set_yx].* - pub fn set_yx(&mut self, y: NcDim, x: NcDim, pixel: NcPixel) -> NcResult<()> { - error![ - unsafe { crate::ncvisual_set_yx(self, y as i32, x as i32, pixel) }, - &format!["NcVisual.set_yx({}, {}, {})", y, x, pixel] - ] - } - - /// Displays frames. - /// - /// *Provide as an argument to ncvisual_stream().* - /// - /// If you'd like subtitles to be decoded, provide an ncplane as the curry. - /// If the curry is NULL, subtitles will not be displayed. - /// - /// *C style function: [ncvisual_simple_streamer()][crate::ncvisual_simple_streamer].* - pub fn simple_streamer( - &mut self, - options: &mut NcVisualOptions, - time: &NcTime, - curry: Option<&mut NcPlane>, - ) -> NcResult<()> { - if let Some(plane) = curry { - error![ - unsafe { - crate::ncvisual_simple_streamer( - self, - options, - time, - plane as *mut _ as *mut libc::c_void, - ) - }, - &format![ - "NcVisual.simple_streamer({:?}, {:?}, ncplane)", - options, time - ] - ] - } else { - error![ - unsafe { crate::ncvisual_simple_streamer(self, options, time, null_mut()) }, - &format!["NcVisual.simple_streamer({:?}, {:?}, null)", options, time] - ] - } - } - - // // TODO - // - // /// Streams the entirety of the media, according to its own timing. - // /// - // /// Blocking, obviously. - // /// - // /// If `streamer` is provided it will be called for each frame, and its return - // /// value handled as outlined for streamcb. - // /// If streamer() returns non-zero, the stream is aborted, and that value is - // /// returned. By convention, return a positive number to indicate intentional - // /// abort from within streamer(). - // /// - // /// `timescale` allows the frame duration time to be scaled. - // /// For a visual naturally running at 30FPS, a 'timescale' of 0.1 will result - // /// in 300 FPS, and a `timescale` of 10 will result in 3 FPS. - // /// It is an error to supply `timescale` less than or equal to 0. - // /// - // /// *C style function: [ncvisual_streamer()][crate::ncvisual_streamer].* - // // - // // TODO: add streamcb - // // INFO: QUESTION: is curry also optional like in simple_streamer? - // // - // pub fn simple_streamer( - // &mut self, - // nc: &mut Nc, - // timescale: f32, - // //streamer: Option - // options: &NcVisualOptions, - // curry: Option<&mut NcPlane>, - // ) -> NcResult<()> { - // } - - /// If a subtitle ought be displayed at this time, returns a heap-allocated - /// copy of the UTF8 text. - /// - /// *C style function: [ncvisual_subtitle()][crate::ncvisual_subtitle].* - pub fn subtitle(&self) -> NcResult<&str> { - let res = unsafe { crate::ncvisual_subtitle(self) }; - if !res.is_null() { - Ok(rstring![res]) - } else { - Err(NcError::with_msg(NCRESULT_ERR, "NcVisual.subtitle()")) - } - } -} - -/// # NcDirectF Constructors & destructors -impl NcDirectF { - /// Loads media from disk, but do not yet renders it (presumably because you - /// want to get its geometry via [ncdirectf_geom()][0], or to use the same - /// file with [ncdirectf_render()][1] multiple times). - /// - /// You must destroy the result with [ncdirectf_free()][2]; - /// - /// [0]: crate::NcDirectF#method.ncdirectf_geom - /// [1]: crate::NcDirectF#method.ncdirectf_render - /// [2]: crate::NcDirectF#method.ncdirectf_free - /// - /// *C style function: [ncdirectf_from_file()][crate::ncdirectf_from_file].* - pub fn ncdirectf_from_file<'a>(ncd: &mut NcDirect, file: &str) -> NcResult<&'a mut NcDirectF> { - error_ref_mut![ - unsafe { crate::ncdirectf_from_file(ncd, cstring![file]) }, - &format!("NcDirectF::ncdirectf_from_file(ncd, {})", file) - ] - } - - /// Frees a [`NcDirectF`] returned from [ncdirectf_from_file()][0]. - /// - /// [0]: crate::NcDirectF#method.ncdirectf_from_file - /// - /// *C style function: [ncdirectf_free()][crate::ncdirectf_free].* - pub fn ncdirectf_free(&mut self) { - unsafe { crate::ncdirectf_free(self) }; - } -} - -/// # NcDirectF Methods -impl NcDirectF { - /// Same as [`NcDirect.render_frame()`][0], except `frame` must already have - /// been loaded. - /// - /// A loaded frame may be rendered in different ways before it is destroyed. - /// - /// [0]: NcDirect#method.render_frame - /// - /// *C style function: [ncvisual_render()][crate::ncvisual_render].* - pub fn ncdirectf_render( - &mut self, - ncd: &mut NcDirect, - options: &NcVisualOptions, - ) -> NcResult<&mut NcPlane> { - error_ref_mut![ - unsafe { crate::ncdirectf_render(ncd, self, options) }, - "NcVisual.render()" - ] - } - /// Having loaded the `frame`, get the geometry of a potential render. - /// - /// *C style function: [ncdirectf_geom()][crate::ncdirectf_geom].* - pub fn ncdirectf_geom( - &mut self, - ncd: &mut NcDirect, - options: &NcVisualOptions, - ) -> NcResult { - let mut geom = NcVGeom::new(); - - let res = unsafe { crate::ncdirectf_geom(ncd, self, options, &mut geom) }; - error![res, "NcDirectF.ncdirectf_geom()", geom]; - } -} - -/// # NcVGeom Constructors -impl NcVGeom { - /// Returns a new `NcVGeom` with zeroed fields. - pub fn new() -> Self { - Self { - pixy: 0, - pixx: 0, - cdimy: 0, - cdimx: 0, - rpixy: 0, - rpixx: 0, - rcelly: 0, - rcellx: 0, - scaley: 0, - scalex: 0, - maxpixely: 0, - maxpixelx: 0, - blitter: 0, - } - } -} diff --git a/rust/src/visual/mod.rs b/rust/src/visual/mod.rs deleted file mode 100644 index b184c1916..000000000 --- a/rust/src/visual/mod.rs +++ /dev/null @@ -1,251 +0,0 @@ -// functions already exported by bindgen : 26 -// ----------------------------------------- -// (W) wrap: 22 -// (#) test: 0 -// ----------------------------------------- -//W ncdirectf_free -//W ncdirectf_from_file -// ncdirectf_geom -// ncdirectf_render -//W ncvisual_at_yx -//W ncvisual_decode -//W ncvisual_decode_loop -//W ncvisual_destroy -//W ncvisual_from_bgra -//W ncvisual_from_file -//W ncvisual_from_plane -//W ncvisual_from_rgba -//W ncvisual_from_rgb_packed -//W ncvisual_from_rgb_loose -//W ncvisual_inflate -//W ncvisual_blitter_geom -//W ncvisual_media_defblitter -//W ncvisual_polyfill_yx -// ncvisual_plane_create -//W ncvisual_render -//W ncvisual_resize -//W ncvisual_rotate -//W ncvisual_set_yx -//W ncvisual_simple_streamer -//~ ncvisual_stream -//W ncvisual_subtitle - -#[allow(unused_imports)] // for the doc comments -use crate::{NcChannel, NcDim, NcRgb}; - -mod methods; - -/// Indicates how to scale an [`NcVisual`] during rendering. -/// -/// - [`NCSCALE_NONE`] will apply no scaling. -/// - [`NCSCALE_SCALE`] scales a visual to the plane's size, -/// maintaining aspect ratio. -/// - [`NCSCALE_STRETCH`] stretches and scales the image in an -/// attempt to fill the entirety of the plane. -/// - [`NCSCALE_NONE_HIRES`] like `NCSCALE_NONE` admitting high-res blitters. -/// - [`NCSCALE_SCALE_HIRES`] like `NCSCALE_SCALE` admitting high-res blitters. -/// -/// The `NCSCALE_*` preferences are applied only for the context of -/// [`NcVisual.render`][NcVisual#method.render]. You can think of it as a pipeline: -/// -/// ```txt -/// NcVisual::fromfile() → frame → NcVisual.render() → scaling → output frame → blit -/// ``` -/// -/// where you still have the original frame. Whereas -/// [`NcVisual.resize`][NcVisual#method.resize] and -/// [`NcVisual.resize_noninterpolative`][NcVisual#method.resize_noninterpolative] -/// are changing that original frame. -/// -pub type NcScale = crate::bindings::ffi::ncscale_e; - -/// Maintains original size. -pub const NCSCALE_NONE: NcScale = crate::bindings::ffi::ncscale_e_NCSCALE_NONE; - -/// Maintains aspect ratio. -pub const NCSCALE_SCALE: NcScale = crate::bindings::ffi::ncscale_e_NCSCALE_SCALE; - -/// Throws away aspect ratio. -pub const NCSCALE_STRETCH: NcScale = crate::bindings::ffi::ncscale_e_NCSCALE_STRETCH; - -/// Maintains original size, admitting high-resolution blitters -/// that don't preserve aspect ratio. -pub const NCSCALE_NONE_HIRES: NcScale = crate::bindings::ffi::ncscale_e_NCSCALE_NONE_HIRES; - -/// Maintains aspect ratio, admitting high-resolution blitters -/// that don't preserve aspect ratio. -pub const NCSCALE_SCALE_HIRES: NcScale = crate::bindings::ffi::ncscale_e_NCSCALE_SCALE_HIRES; - -/// A visual bit of multimedia. -/// -/// It can be constructed from a rgba or bgra buffer. -/// -/// The [NcVisualOptions] structure is used only by the following methods: -/// - [.geom][NcVisual#method.geom] -/// - [.render][NcVisual#method.render] -/// - [.simple_streamer][NcVisual#method.simple_streamer] -pub type NcVisual = crate::bindings::ffi::ncvisual; - -/// A type alias of [`NcVisual`] (NcDirect ***F**rame*) intended to be used -/// with its `ncdirectf_*` methods, in [`NcDirect`][crate::NcDirect] mode. -pub type NcDirectF = NcVisual; - -/// Describes all geometries of an [`NcVisual`] ncvisual–both those which are inherent, and -/// those in a given rendering regime. -/// -/// *FIXME this ought be used in the rendered mode API as well; -/// it’s currently only used by direct mode.* -/// *(See [ncvgeom][1] more more information)* -/// -/// This is the return type of the [NcDirectF.ncdirectf_geom()][0] method. -/// -/// [0]: NcDirectF#method.ncdirectf_geom -/// [1]: crate::bindings::ffi::ncvgeom -pub type NcVGeom = crate::bindings::ffi::ncvgeom; - -/// Options struct for [`NcVisual`] -/// -/// If a plane is not provided, one will be created, having the exact size -/// necessary to display the visual (this might be smaller or larger than -/// the rendering area). if NCVISUAL_OPTION_CHILDPLANE is provided, this -/// will be interpreted as the parent. -/// -/// A subregion of the visual can be rendered using `begx`, `begy`, `lenx`, and `leny`. -pub type NcVisualOptions = crate::bindings::ffi::ncvisual_options; - -// NcRgba -// -/// 32 bits broken into 3x 8bpp RGB channels + 8ppp alpha. -/// -/// Unlike with [`NcChannel`], operations involving `NcRgb` ignores the last 4th byte -/// -/// ## Diagram -/// -/// ```txt -/// AAAAAAAA RRRRRRRR GGGGGGGG BBBBBBBB -/// ``` -/// `type in C: no data type` -/// -/// See also: [NcRgb] and [NcChannel] types. -pub type NcRgba = u32; - -// // NcBgra -// // -// /// 32 bits broken into 3x 8bpp BGR channels + 8ppp alpha. -// /// -// /// ## Diagram -// /// -// /// ```txt -// /// AAAAAAAA BBBBBBBB GGGGGGGG RRRRRRRR -// /// ``` -// /// -// /// `type in C: no data type` -// /// -// /// See also: [NcRgba], [NcRgb] and [NcChannel] types. -// pub type NcBgra = u32; - -/// Treats as transparent the color specified in the `transcolor` field. -pub const NCVISUAL_OPTION_ADDALPHA: u32 = crate::bindings::ffi::NCVISUAL_OPTION_ADDALPHA; - -/// Uses [`NCALPHA_BLEND`][crate::NCALPHA_BLEND] with visual. -pub const NCVISUAL_OPTION_BLEND: u32 = crate::bindings::ffi::NCVISUAL_OPTION_BLEND; - -/// allows you to indicate that the n field of ncvisual_options refers not to -/// the plane onto which you'd like to blit, but the parent of a new plane. -/// -/// A plane will be created using the other parameters in the ncvisual_options, -/// as a child of this parent. This means things like, say, vertically centering -/// a sprixel relative to the standard plane can be done in one step. -pub const NCVISUAL_OPTION_CHILDPLANE: u32 = crate::bindings::ffi::NCVISUAL_OPTION_CHILDPLANE; - -/// Fails rather than gracefully degrade. See [NcBlitter]. -pub const NCVISUAL_OPTION_NODEGRADE: u32 = crate::bindings::ffi::NCVISUAL_OPTION_NODEGRADE; - -/// Y is an alignment, not absolute. -pub const NCVISUAL_OPTION_VERALIGNED: u32 = crate::bindings::ffi::NCVISUAL_OPTION_VERALIGNED; - -/// X is an alignment, not absolute. -pub const NCVISUAL_OPTION_HORALIGNED: u32 = crate::bindings::ffi::NCVISUAL_OPTION_HORALIGNED; - -/// Uses non-interpolative scaling. -pub const NCVISUAL_OPTION_NOINTERPOLATE: u32 = crate::bindings::ffi::NCVISUAL_OPTION_NOINTERPOLATE; - -/// The blitter mode to use for rasterizing an [`NcVisual`]. -/// -/// We never blit full blocks, but instead spaces (more efficient) with the -/// background set to the desired foreground. -/// -/// ## Modes -/// -/// - [`NCBLIT_1x1`] -/// - [`NCBLIT_2x1`] -/// - [`NCBLIT_2x2`] -/// - [`NCBLIT_3x2`] -/// - [`NCBLIT_4x1`] -/// - [`NCBLIT_8x1`] -/// - [`NCBLIT_BRAILLE`] -/// - [`NCBLIT_DEFAULT`] -/// - [`NCBLIT_PIXEL`] -/// -/// There is a mechanism of graceful degradation, that works as follows: -/// - without braille support, NCBLIT_BRAILLE decays to NCBLIT_3x2 -/// - without bitmap support, NCBLIT_PIXEL decays to NCBLIT_3x2 -/// - without sextant support, NCBLIT_3x2 decays to NCBLIT_2x2 -/// - without quadrant support, NCBLIT_2x2 decays to NCBLIT_2x1 -/// - the only viable blitters in ASCII are NCBLIT_1x1 and NCBLIT_PIXEL -/// -/// If you don't want this behaviour you have to use [NCVISUAL_OPTION_NODEGRADE] -/// -pub type NcBlitter = crate::bindings::ffi::ncblitter_e; - -/// [`NcBlitter`] mode using: space, compatible with ASCII -pub const NCBLIT_1x1: NcBlitter = crate::bindings::ffi::ncblitter_e_NCBLIT_1x1; - -/// [`NcBlitter`] mode using: halves + 1x1 (space) -/// ▄▀ -pub const NCBLIT_2x1: NcBlitter = crate::bindings::ffi::ncblitter_e_NCBLIT_2x1; - -/// [`NcBlitter`] mode using: quadrants + 2x1 -/// ▗▐ ▖▀▟▌▙ -pub const NCBLIT_2x2: NcBlitter = crate::bindings::ffi::ncblitter_e_NCBLIT_2x2; - -/// [`NcBlitter`] mode using: sextants -/// 🬀🬁🬂🬃🬄🬅🬆🬇🬈🬉🬊🬋🬌🬍🬎🬏🬐🬑🬒🬓🬔🬕🬖🬗🬘🬙🬚🬛🬜🬝🬞🬟🬠🬡🬢🬣🬤🬥🬦🬧🬨🬩🬪🬫🬬🬭🬮🬯🬰🬱🬲🬳🬴🬵🬶🬷🬸🬹🬺🬻 -pub const NCBLIT_3x2: NcBlitter = crate::bindings::ffi::ncblitter_e_NCBLIT_3x2; - -/// [`NcBlitter`] mode using: four vertical levels -/// █▆▄▂ -pub const NCBLIT_4x1: NcBlitter = crate::bindings::ffi::ncblitter_e_NCBLIT_4x1; - -/// [`NcBlitter`] mode using: eight vertical levels -/// █▇▆▅▄▃▂▁ -pub const NCBLIT_8x1: NcBlitter = crate::bindings::ffi::ncblitter_e_NCBLIT_8x1; - -/// [`NcBlitter`] mode using: 4 rows, 2 cols (braille) -/// ⡀⡄⡆⡇⢀⣀⣄⣆⣇⢠⣠⣤⣦⣧⢰⣰⣴⣶⣷⢸⣸⣼⣾⣿ -pub const NCBLIT_BRAILLE: NcBlitter = crate::bindings::ffi::ncblitter_e_NCBLIT_BRAILLE; - -/// [`NcBlitter`] mode where the blitter is automatically chosen -pub const NCBLIT_DEFAULT: NcBlitter = crate::bindings::ffi::ncblitter_e_NCBLIT_DEFAULT; - -/// Sixel/Pixel mode -/// -/// NCBLIT_PIXEL -/// -/// See [Sixel in Wikipedia](https://en.wikipedia.org/wiki/Sixel). -pub const NCBLIT_PIXEL: NcBlitter = crate::bindings::ffi::ncblitter_e_NCBLIT_PIXEL; - -/// Contains the pixel geometry information as returned by the -/// NcPlane.[pixelgeom()][crate::NcPlane#method.pixelgeom] method. -/// -/// If bitmaps are not supported, the fields `max_bitmap_*` will be 0. -#[derive(Clone, Debug)] -pub struct NcPixelGeometry { - /// Geometry of the display region - pub term_y: NcDim, - pub term_x: NcDim, - pub cell_y: NcDim, - pub cell_x: NcDim, - pub max_bitmap_y: NcDim, - pub max_bitmap_x: NcDim, -} diff --git a/rust/src/widgets/menu/methods/menu.rs b/rust/src/widgets/menu/methods/menu.rs deleted file mode 100644 index 52807b3c9..000000000 --- a/rust/src/widgets/menu/methods/menu.rs +++ /dev/null @@ -1,179 +0,0 @@ -use core::ptr::null_mut; - -use crate::{ - cstring, error, error_ref_mut, error_str, ncmenu_create, - widgets::{NcMenu, NcMenuOptions}, - NcInput, NcPlane, NcResult, -}; - -#[allow(unused_imports)] -use crate::widgets::{NcMenuItem, NcMenuSection}; - -/// # `NcMenu` constructors & destructors -impl NcMenu { - /// Creates an [`NcMenu`] with the specified options. - /// - /// Menus are currently bound to an overall [`Notcurses`][crate::Notcurses] - /// object (as opposed to a particular plane), and are implemented as - /// [`NcPlane`]s kept atop other NcPlanes. - /// - /// *C style function: [ncmenu_create()][crate::ncmenu_create].* - pub fn new<'a>(plane: &mut NcPlane, options: NcMenuOptions) -> NcResult<&'a mut Self> { - error_ref_mut![unsafe { ncmenu_create(plane, &options) }, "Creating NcMenu"] - } - - /// Destroys an `NcMenu` created with [`new`][NcMenu#method.new]. - /// - /// *C style function: [ncmenu_destroy()][crate::ncmenu_destroy].* - pub fn destroy(&mut self) -> NcResult<()> { - error![unsafe { crate::ncmenu_destroy(self) }] - } -} - -/// # `NcMenu` methods -impl NcMenu { - /// Disables or enables an [`NcMenuItem`]. - /// - /// *C style function: [ncmenu_item_set_status()][crate::ncmenu_item_set_status].* - pub fn item_set_status(&mut self, section: &str, item: &str, enabled: bool) -> NcResult<()> { - error![ - unsafe { - crate::ncmenu_item_set_status(self, cstring![section], cstring![item], enabled) - }, - &format!( - ".item_set_status({:?}, {:?}, {:?}, {})", - self, section, item, enabled - ) - ] - } - - /// Returns the [`NcMenuItem`] description - /// corresponding to the mouse `click`. - /// - /// The NcMenuItem must be on an actively unrolled section, and the click - /// must be in the area of a valid item. - /// - /// If `ninput` is provided, and the selected item has a shortcut, - /// it will be filled in with that shortcut. - /// - /// *C style function: [ncmenu_mouse_selected()][crate::ncmenu_mouse_selected].* - pub fn mouse_selected( - &self, - click: NcInput, - shortcut: Option<&mut NcInput>, - ) -> NcResult { - let ninput; - if let Some(i) = shortcut { - ninput = i as *mut _; - } else { - ninput = null_mut(); - } - error_str![ - unsafe { crate::ncmenu_mouse_selected(self, &click, ninput) }, - "Getting NcMenuItem description" - ] - } - - /// Moves to the next item within the currently unrolled section. - /// - /// If no section is unrolled, the first section will be unrolled. - /// - /// *C style function: [ncmenu_nextitem()][crate::ncmenu_nextitem].* - pub fn nextitem(&mut self) -> NcResult<()> { - error![unsafe { crate::ncmenu_nextitem(self) }] - } - - /// Unrolls the next section (relative to current unrolled). - /// - /// If no section is unrolled, the first section will be unrolled. - /// - /// *C style function: [ncmenu_nextsection()][crate::ncmenu_nextsection].* - pub fn nextsection(&mut self) -> NcResult<()> { - error![unsafe { crate::ncmenu_nextsection(self) }] - } - - /// Offers the `input` to this `NcMenu`. - /// - /// If it's relevant, this function returns true, - /// and the input ought not be processed further. - /// If it's irrelevant to the menu, false is returned. - /// - /// Relevant inputs include: - /// - mouse movement over a hidden menu - /// - a mouse click on a menu section (the section is unrolled) - /// - a mouse click outside of an unrolled menu (the menu is rolled up) - /// - left or right on an unrolled menu (navigates among sections) - /// - up or down on an unrolled menu (navigates among items) - /// - escape on an unrolled menu (the menu is rolled up) - /// - /// *C style function: [ncmenu_offer_input()][crate::ncmenu_offer_input].* - pub fn offer_input(&mut self, input: NcInput) -> bool { - unsafe { crate::ncmenu_offer_input(self, &input) } - } - - /// Returns the [`NcPlane`] backing this `NcMenu`. - /// - /// *C style function: [ncmenu_plane()][crate::ncmenu_plane].* - pub fn plane(&mut self) -> NcResult<&NcPlane> { - error_ref_mut![ - unsafe { crate::ncmenu_plane(self) }, - "Getting the backing NcPlane" - ] - } - - /// Moves to the previous item within the currently unrolled section. - /// - /// If no section is unrolled, the first section will be unrolled. - /// - /// *C style function: [ncmenu_previtem()][crate::ncmenu_previtem].* - pub fn previtem(&mut self) -> NcResult<()> { - error![unsafe { crate::ncmenu_previtem(self) }] - } - - /// Unrolls the previous section (relative to current unrolled). - /// - /// If no section is unrolled, the first section will be unrolled. - /// - /// *C style function: [ncmenu_prevsection()][crate::ncmenu_prevsection].* - pub fn prevsection(&mut self) -> NcResult<()> { - error![unsafe { crate::ncmenu_prevsection(self) }] - } - - /// Rolls up any unrolled [`NcMenuSection`] - /// and hides this `NcMenu` if using hiding. - /// - /// *C style function: [ncmenu_rollup()][crate::ncmenu_rollup].* - pub fn rollup(&mut self) -> NcResult<()> { - error![unsafe { crate::ncmenu_rollup(self) }] - } - - /// Returns the selected item description, if there's an unrolled section. - /// - /// If `shortcut` is provided, and the selected item has a shortcut, - /// it will be filled in with that shortcut--this can allow faster matching. - /// - /// *C style function: [ncmenu_selected()][crate::ncmenu_selected].* - pub fn selected(&mut self, shortcut: Option<&mut NcInput>) -> Option { - let ninput; - if let Some(i) = shortcut { - ninput = i as *mut _; - } else { - ninput = null_mut(); - } - let res = unsafe { crate::ncmenu_selected(self, ninput) }; - if !res.is_null() { - Some(unsafe { (&*res).to_string() }) - } else { - None - } - } - - /// Unrolls the specified [`NcMenuSection`], - /// making the menu visible if it was invisible - /// and rolling up any `NcMenuSection` that is already unrolled. - /// - /// *C style function: [ncmenu_unroll()][crate::ncmenu_unroll].* - pub fn unroll(&mut self, sectionindex: u32) -> NcResult<()> { - error![unsafe { crate::ncmenu_unroll(self, sectionindex as i32) }] - } -} diff --git a/rust/src/widgets/menu/methods/mod.rs b/rust/src/widgets/menu/methods/mod.rs deleted file mode 100644 index 5779fbf80..000000000 --- a/rust/src/widgets/menu/methods/mod.rs +++ /dev/null @@ -1,69 +0,0 @@ -//! `NcMenu*` methods and associated functions. - -use super::{NcMenuItem, NcMenuSection}; -use crate::{cstring_mut, NcInput}; -use core::ptr::null_mut; - -#[allow(unused_imports)] -use crate::widgets::NcMenu; - -mod menu; -mod options; - -pub use menu::*; -pub use options::*; - -/// # `NcMenuItem` Constructors -impl NcMenuItem { - /// New NcMenuItem for [`NcMenu`]. - pub fn new(desc: &str, shortcut: NcInput) -> Self { - Self { - // utf-8 menu item, NULL for horizontal separator - desc: cstring_mut![desc], - - // ´NcInput´ shortcut, all should be distinct - shortcut, - } - } - - /// New empty NcMenuItem for [`NcMenu`]. - pub fn new_empty() -> Self { - Self { - desc: null_mut(), - shortcut: NcInput::new_empty(), - } - } -} - -/// # `NcMenuSection` Constructors -/// -// Must contain at least 1 NcMenuItem. -impl NcMenuSection { - /// New NcMenuSection for [`NcMenu`]. - pub fn new(name: &str, items: &mut [NcMenuItem], shortcut: NcInput) -> Self { - Self { - // utf-8 name string - name: cstring_mut![name], - - // array of itemcount `NcMenuItem`s - items: items.as_mut_ptr(), - - // - itemcount: items.len() as i32, - - // shortcut, will be underlined if present in name - shortcut, - } - } - - /// New NcMenuSection separator for [`NcMenu`]. - /// - pub fn new_separator() -> Self { - Self { - name: null_mut(), - items: null_mut(), - itemcount: 0, - shortcut: NcInput::new_empty(), - } - } -} diff --git a/rust/src/widgets/menu/methods/options.rs b/rust/src/widgets/menu/methods/options.rs deleted file mode 100644 index 3275c102c..000000000 --- a/rust/src/widgets/menu/methods/options.rs +++ /dev/null @@ -1,76 +0,0 @@ -use crate::{ - widgets::{NcMenuOptions, NcMenuSection}, - NcChannels, -}; - -#[allow(unused_imports)] -use crate::widgets::NcMenu; - -/// # `NcMenuOptions` constructors -impl NcMenuOptions { - /// New NcMenuOptions for [`NcMenu`]. - /// - /// `sections` must contain at least 1 [`NcMenuSection`]. - pub fn new(sections: &mut [NcMenuSection]) -> Self { - Self::with_all_args(sections, 0, 0, 0) - } - - /// New NcMenuOptions for [`NcMenu`], with all args. - /// - /// `sections` must contain at least 1 [`NcMenuSection`]. - pub fn with_all_args( - sections: &mut [NcMenuSection], - style_header: NcChannels, - style_sections: NcChannels, - flags: u64, - ) -> Self { - assert![!sections.is_empty()]; - Self { - // array of 'sectioncount' `MenuSection`s - sections: sections.as_mut_ptr(), - - // - sectioncount: sections.len() as i32, - - // styling for header - headerchannels: style_header, - - // styling for sections - sectionchannels: style_sections, - - // flag word of NCMENU_OPTION_* - flags, - } - } -} - -/// # `NcMenuOptions` methods -impl NcMenuOptions { - /// Returns the styling for the header. - /// - /// *(No equivalent C style function)* - pub const fn header_channels(&self) -> NcChannels { - self.headerchannels - } - - /// Returns a mutable reference of the styling for the sections. - /// - /// *(No equivalent C style function)* - pub fn header_channels_mut(&mut self) -> &mut NcChannels { - &mut self.headerchannels - } - - /// Returns the styling for the sections. - /// - /// *(No equivalent C style function)* - pub const fn section_channels(&self) -> NcChannels { - self.sectionchannels - } - - /// Returns a mutable reference of the styling for the sections. - /// - /// *(No equivalent C style function)* - pub fn section_channels_mut(&mut self) -> &mut NcChannels { - &mut self.sectionchannels - } -} diff --git a/rust/src/widgets/menu/mod.rs b/rust/src/widgets/menu/mod.rs deleted file mode 100644 index 1623b80cf..000000000 --- a/rust/src/widgets/menu/mod.rs +++ /dev/null @@ -1,58 +0,0 @@ -//! `NcMenu` widget - -// functions already exported by bindgen : 13 -// ------------------------------------------ -// (#) test: 0 -// (W) wrap: 13 -// ------------------------------------------ -//W ncmenu_create -//W ncmenu_destroy -//W ncmenu_item_set_status -//W ncmenu_mouse_selected -//W ncmenu_nextitem -//W ncmenu_nextsection -//W ncmenu_offer_input -//W ncmenu_plane -//W ncmenu_previtem -//W ncmenu_prevsection -//W ncmenu_rollup -//W ncmenu_selected -//W ncmenu_unroll - -mod methods; - -/// menus on the top or bottom rows -/// -/// A [Notcurses][crate::Notcurses] instance supports menu bars on the top or -/// bottom row of the true screen. -/// -/// An NcMenu is composed of [NcMenuSection]s, which are in turn composed of -/// [NcMenuItem]s. -/// -/// Either no sections are visible, and the menu is rolled up, or exactly one -/// section is unrolled. -/// -/// - [rollup()][NcMenu#method.rollup] -/// places an `NcMenu` in the rolled up state. -/// - [unroll()][NcMenu#method.unroll] -/// rolls up any unrolled section and unrolls the specified one. -/// - [destroy()][NcMenu#method.destroy] -/// removes a menu bar, and frees all associated resources. -/// -/// `type in C: ncmenu (struct)` -pub type NcMenu = crate::bindings::ffi::ncmenu; - -/// Options struct for [`NcMenu`]. -pub type NcMenuOptions = crate::bindings::ffi::ncmenu_options; - -/// Item for [`NcMenu`]. -pub type NcMenuItem = crate::bindings::ffi::ncmenu_item; - -/// Section for [`NcMenu`]. -pub type NcMenuSection = crate::bindings::ffi::ncmenu_section; - -/// [NcMenuOptions] flag: Bottom row (as opposed to top row). -pub const NCMENU_OPTION_BOTTOM: u64 = crate::bindings::ffi::NCMENU_OPTION_BOTTOM as u64; - -/// [NcMenuOptions] flag: Hide the menu when not unrolled -pub const NCMENU_OPTION_HIDING: u64 = crate::bindings::ffi::NCMENU_OPTION_HIDING as u64; diff --git a/rust/src/widgets/mod.rs b/rust/src/widgets/mod.rs deleted file mode 100644 index 2f9c907ac..000000000 --- a/rust/src/widgets/mod.rs +++ /dev/null @@ -1,19 +0,0 @@ -//! All the notcurses widgets. - -mod menu; -mod multiselector; -mod plot; -mod progbar; -mod reader; -mod reel; -mod selector; -mod tree; - -pub use menu::*; -pub use multiselector::*; -pub use plot::*; -pub use progbar::*; -pub use reader::*; -pub use reel::*; -pub use selector::*; -pub use tree::*; diff --git a/rust/src/widgets/multiselector/mod.rs b/rust/src/widgets/multiselector/mod.rs deleted file mode 100644 index beffbbed0..000000000 --- a/rust/src/widgets/multiselector/mod.rs +++ /dev/null @@ -1,10 +0,0 @@ -//! `NcMultiSelector` widget. - -/// high-level widget for selecting items from a set -pub type NcMultiSelector = crate::bindings::ffi::ncmultiselector; - -/// an item for [`NcMultiSelector`] -pub type NcMultiSelectorItem = crate::bindings::ffi::ncmselector_item; - -/// Options structure for [`NcMultiSelector`] -pub type NcMultiSelectorOptions = crate::bindings::ffi::ncmultiselector_options; diff --git a/rust/src/widgets/plot/mod.rs b/rust/src/widgets/plot/mod.rs deleted file mode 100644 index 97ffd78ad..000000000 --- a/rust/src/widgets/plot/mod.rs +++ /dev/null @@ -1,27 +0,0 @@ -//! `NcPlot[F|U]64` widget. - -/// A histogram, bound to an [`NcPlane`][crate::NcPlane] -/// (uses non-negative `f64`s) -pub type NcPlotF64 = crate::bindings::ffi::ncdplot; - -/// A histogram, bound to an [`NcPlane`][crate::NcPlane] (uses `u64`s) -pub type NcPlotU64 = crate::bindings::ffi::ncuplot; - -/// Options struct for -/// [`NcPlotF64`] or [`NcPlotU64`] -pub type NcPlotOptions = crate::bindings::ffi::ncplot_options; - -/// Use domain detection only for max -pub const NCPLOT_OPTION_DETECTMAXONLY: u32 = crate::bindings::ffi::NCPLOT_OPTION_DETECTMAXONLY; - -/// Exponential dependent axis -pub const NCPLOT_OPTION_EXPONENTIALD: u32 = crate::bindings::ffi::NCPLOT_OPTION_EXPONENTIALD; - -/// Show labels for dependent axis -pub const NCPLOT_OPTION_LABELTICKSD: u32 = crate::bindings::ffi::NCPLOT_OPTION_LABELTICKSD; - -/// Use domain detection only for max -pub const NCPLOT_OPTION_NODEGRADE: u32 = crate::bindings::ffi::NCPLOT_OPTION_NODEGRADE; - -/// Independent axis is vertical -pub const NCPLOT_OPTION_VERTICALI: u32 = crate::bindings::ffi::NCPLOT_OPTION_VERTICALI; diff --git a/rust/src/widgets/progbar/methods.rs b/rust/src/widgets/progbar/methods.rs deleted file mode 100644 index 45302ca62..000000000 --- a/rust/src/widgets/progbar/methods.rs +++ /dev/null @@ -1,68 +0,0 @@ -//! `NcProgBar` & `NcProgBarOptions` methods and associated functions. - -use super::{NcProgBar, NcProgBarOptions}; -use crate::{error, NcPlane, NcResult}; - -/// # `NcProgBarOptions` Methods -impl NcProgBarOptions { - /// New NcProgBarOptions for [NcProgBar]. - pub fn new() -> Self { - Self { - ulchannel: 0, - urchannel: 0, - blchannel: 0, - brchannel: 0, - flags: 0, - } - } -} - -/// # `NcProgBar` Methods -impl NcProgBar { - /// New NcProgBar. - /// - /// Takes ownership of the `plane`, which will be destroyed by - /// [destroy][NcProgBar#method.destroy](). The progress bar is initially at 0%. - pub fn new<'a>(plane: &mut NcPlane) -> &'a mut Self { - Self::with_options(plane, &NcProgBarOptions::new()) - } - - /// New NcProgBar. Expects an [NcProgBarOptions] struct. - /// - /// *C style function: [ncprogbar_create()][crate::ncprogbar_create].* - pub fn with_options<'a>(plane: &mut NcPlane, options: &NcProgBarOptions) -> &'a mut Self { - unsafe { &mut *crate::ncprogbar_create(plane, options) } - } - - /// Destroy the progress bar and its underlying ncplane. - /// - /// *C style function: [ncprogbar_destroy()][crate::ncprogbar_destroy].* - pub fn destroy(&mut self) { - unsafe { - crate::ncprogbar_destroy(self); - } - } - - /// Return a reference to the ncprogbar's underlying ncplane. - /// - /// *C style function: [ncprogbar_plane()][crate::ncprogbar_plane].* - pub fn plane(&mut self) -> &mut NcPlane { - unsafe { &mut *crate::ncprogbar_plane(self) } - } - - /// Get the progress bar's completion, an [f64] on [0, 1]. - /// - /// *C style function: [ncprogbar_progress()][crate::ncprogbar_progress].* - pub fn progress(&self) -> f64 { - unsafe { crate::ncprogbar_progress(self) } - } - - /// Sets the progress bar's completion, an 0 <= [f64] <= 1. - /// - /// Returns [NCRESULT_ERR][crate::NCRESULT_ERR] if progress is < 0 || > 1. - /// - /// *C style function: [ncprogbar_set_progress()][crate::ncprogbar_set_progress].* - pub fn set_progress(&mut self, progress: f64) -> NcResult<()> { - error![unsafe { crate::ncprogbar_set_progress(self, progress) }] - } -} diff --git a/rust/src/widgets/progbar/mod.rs b/rust/src/widgets/progbar/mod.rs deleted file mode 100644 index ca6cae2e8..000000000 --- a/rust/src/widgets/progbar/mod.rs +++ /dev/null @@ -1,43 +0,0 @@ -//! `NcProgbar` widget. - -// functions already exported by bindgen : 5 -// ----------------------------------------- -// (#) test: 0 -// (W) wrap: 5 / 0 -// ----------------------------------------- -//W ncprogbar_create, -//W ncprogbar_destroy, -//W ncprogbar_plane, -//W ncprogbar_progress, -//W ncprogbar_set_progress, - -mod methods; - -/// Progress bars. They proceed linearly in any of four directions. -/// -/// The entirety of the plane will be used -- any border should be provided by -/// the caller on another plane. -/// -/// The plane will not be erased; text preloaded into the plane will be consumed -/// by the progress indicator. -/// -/// The bar is redrawn for each provided progress report (a double between 0 -/// and 1), and can regress with lower values. -/// -/// The procession will take place along the longer dimension at the time of each -/// redraw, with the horizontal length scaled by 2 for purposes of comparison. -/// I.e. for a plane of 20 rows and 50 columns, the progress will be to the -/// right (50 > 40), or left with [NCPROGBAR_OPTION_RETROGRADE]. -/// -/// `type in C: ncprogbar (struct)` -/// -pub type NcProgBar = crate::bindings::ffi::ncprogbar; - -/// Options struct for [`NcProgBar`] -/// -/// `type in C: ncprogbar_options (struct)` -/// -pub type NcProgBarOptions = crate::bindings::ffi::ncprogbar_options; - -/// proceed left/down -pub const NCPROGBAR_OPTION_RETROGRADE: u32 = crate::bindings::ffi::NCPROGBAR_OPTION_RETROGRADE; diff --git a/rust/src/widgets/reader/methods.rs b/rust/src/widgets/reader/methods.rs deleted file mode 100644 index 56931b88e..000000000 --- a/rust/src/widgets/reader/methods.rs +++ /dev/null @@ -1,35 +0,0 @@ -//! `NcReader*` methods and associated functions. - -use super::{NcReader, NcReaderOptions}; -use crate::{error_ref_mut, ncreader_create, NcPlane, NcResult}; - -/// # `NcReaderOptions` Constructors -impl NcReaderOptions { - /// `NcReaderOptions` simple constructor - pub const fn new() -> Self { - Self { - // channels used for input - tchannels: 0, - // attributes used for input - tattrword: 0, - // bitfield of NCREADER_OPTION_* - flags: 0, - } - } -} - -/// # `NcReader` Constructors -impl NcReader { - /// `NcReader` simple constructor - pub fn new<'a>(plane: &mut NcPlane) -> NcResult<&'a mut Self> { - Self::with_options(plane, NcReaderOptions::new()) - } - - /// `NcReader` constructor with options - pub fn with_options<'a>( - plane: &mut NcPlane, - options: NcReaderOptions, - ) -> NcResult<&'a mut Self> { - error_ref_mut![unsafe { ncreader_create(plane, &options) }] - } -} diff --git a/rust/src/widgets/reader/mod.rs b/rust/src/widgets/reader/mod.rs deleted file mode 100644 index c155a4bd4..000000000 --- a/rust/src/widgets/reader/mod.rs +++ /dev/null @@ -1,48 +0,0 @@ -//! `NcReader` widget. - -// functions already exported by bindgen : 11 -// ------------------------------------------ -// ncreader_clear -// ncreader_contents -// ncreader_create -// ncreader_destroy -// ncreader_move_down -// ncreader_move_left -// ncreader_move_right -// ncreader_move_up -// ncreader_offer_input -// ncreader_plane -// ncreader_write_egc - -mod methods; - -/// Provides a freeform input in a (possibly multiline) region -/// -/// Supports optional readline keybindings (opt out using -/// NCREADER_OPTION_NOCMDKEYS flag) -/// -/// Takes ownership of its [`NcPlane`][crate::NcPlane], destroying it on any -/// error (`ncreader_destroy`() otherwise destroys the ncplane). -/// -/// `type in C: ncreader (struct)` -/// -pub type NcReader = crate::bindings::ffi::ncreader; - -/// Options struct for [`NcReader`] -/// -/// `type in C: ncreader_options (struct)` -/// -pub type NcReaderOptions = crate::bindings::ffi::ncreader_options; - -/// Make the terminal cursor visible across the lifetime of the ncreader, and -/// have the ncreader manage the cursor's placement. -pub const NCREADER_OPTION_CURSOR: u32 = crate::bindings::ffi::NCREADER_OPTION_CURSOR; - -/// Enable horizontal scrolling. Virtual lines can then grow arbitrarily long. -pub const NCREADER_OPTION_HORSCROLL: u32 = crate::bindings::ffi::NCREADER_OPTION_HORSCROLL; - -/// Disable all editing shortcuts. By default, emacs-style keys are available. -pub const NCREADER_OPTION_NOCMDKEYS: u32 = crate::bindings::ffi::NCREADER_OPTION_NOCMDKEYS; - -/// Enable vertical scrolling. You can then use arbitrarily many virtual lines. -pub const NCREADER_OPTION_VERSCROLL: u32 = crate::bindings::ffi::NCREADER_OPTION_VERSCROLL; diff --git a/rust/src/widgets/reel/mod.rs b/rust/src/widgets/reel/mod.rs deleted file mode 100644 index a8c886a26..000000000 --- a/rust/src/widgets/reel/mod.rs +++ /dev/null @@ -1,32 +0,0 @@ -//! `NcReel` widget. - -/// A wheel with [`NcTablet`]s on the outside. -/// -/// An `NcReel` is projected onto the 2d rendering area, showing some portion of -/// the `NcReel`, and zero or more `NcTablet`s. -/// -/// An `NcReel` is a [`Notcurses`][crate::Notcurses] region devoted to -/// displaying zero or more line-oriented, contained [`NcTablet`]s -/// between which the user may navigate. -/// -/// If at least one `NcTablet`s exists, there is a "focused tablet". -/// As much of the focused tablet as is possible is always displayed. -/// -/// If there is space left over, other tablets are included in the display. -/// Tablets can come and go at any time, and can grow or shrink at any time. -pub type NcReel = crate::bindings::ffi::ncreel; - -/// Options struct for [`NcReel`] -pub type NcReelOptions = crate::bindings::ffi::ncreel_options; - -/// Visual tablet for [`NcReel`] -pub type NcTablet = crate::bindings::ffi::nctablet; - -/// is navigation circular (does moving down from the last tablet move to the -/// first, and vice versa)? only meaningful when infinitescroll is true. if -/// infinitescroll is false, this must be false. -pub const NCREEL_OPTION_CIRCULAR: u32 = crate::bindings::ffi::NCREEL_OPTION_CIRCULAR; -/// is scrolling infinite (can one move down or up forever, or is an end -/// reached?). if true, 'circular' specifies how to handle the special case of -/// an incompletely-filled reel. -pub const NCREEL_OPTION_INFINITESCROLL: u32 = crate::bindings::ffi::NCREEL_OPTION_INFINITESCROLL; diff --git a/rust/src/widgets/selector/mod.rs b/rust/src/widgets/selector/mod.rs deleted file mode 100644 index 896e83a09..000000000 --- a/rust/src/widgets/selector/mod.rs +++ /dev/null @@ -1,10 +0,0 @@ -//! `NcSelector` widget. - -/// high-level widget for selecting one item from a set -pub type NcSelector = crate::bindings::ffi::ncselector; - -/// an item for [`NcSelector`] -pub type NcSelectorItem = crate::bindings::ffi::ncselector_item; - -/// Options structur for [`NcSelector`] -pub type NcSelectorOptions = crate::bindings::ffi::ncselector_options; diff --git a/rust/src/widgets/tree/methods/mod.rs b/rust/src/widgets/tree/methods/mod.rs deleted file mode 100644 index efdef326f..000000000 --- a/rust/src/widgets/tree/methods/mod.rs +++ /dev/null @@ -1,32 +0,0 @@ -//! `NcTree*` methods and associated functions. - -mod options; -mod tree; - -pub use options::*; -pub use tree::*; - -use core::ptr::null_mut; -use std::ffi::{c_void, CString}; - -use super::NcTreeItem; - -/// # `NcTreeItem` constructor -impl NcTreeItem { - /// Creates an [NcTreeItem]. - pub fn new(curry: &str, subs: Option<&mut [NcTreeItem]>, subcount: usize) -> Self { - if let Some(subs) = subs { - Self { - curry: CString::new(curry).unwrap().into_raw() as *mut _ as *mut c_void, - subs: subs.as_mut_ptr(), - subcount: subcount as u32, - } - } else { - Self { - curry: CString::new(curry).unwrap().into_raw() as *mut _ as *mut c_void, - subs: null_mut(), - subcount: subcount as u32, - } - } - } -} diff --git a/rust/src/widgets/tree/methods/options.rs b/rust/src/widgets/tree/methods/options.rs deleted file mode 100644 index ed13106ce..000000000 --- a/rust/src/widgets/tree/methods/options.rs +++ /dev/null @@ -1,42 +0,0 @@ -use crate::{ - widgets::{NcTreeItem, NcTreeItemCbUnsafe, NcTreeOptions}, - NcDim, -}; - -#[allow(unused_imports)] -use crate::widgets::NcTree; - -/// # `NcTreeOptions` constructors -impl NcTreeOptions { - /// New NcTreeOptions for [`NcTree`]. - pub fn new(items: &[NcTreeItem], indentcols: NcDim) -> Self { - Self::with_all_args(items, items.len(), None, indentcols, 0) - } - - /// New NcTreeOptions for [`NcTree`], with all args. - pub fn with_all_args( - // top-level nctree_item array - items: &[NcTreeItem], - - // size of |items| - count: usize, - - // item callback function - // TODO: use NcTreeItemCb and convert to NcTreeItemCbUnsafe - nctreecb: Option, - - // columns to indent per level of hierarchy - indentcols: NcDim, - - // bitfield of `NCTREE_OPTION_*` (there's none for now) - flags: u64, - ) -> Self { - Self { - items: items as *const _ as *const NcTreeItem, - count: count as u32, - nctreecb, - indentcols: indentcols as i32, - flags, - } - } -} diff --git a/rust/src/widgets/tree/methods/tree.rs b/rust/src/widgets/tree/methods/tree.rs deleted file mode 100644 index b175be514..000000000 --- a/rust/src/widgets/tree/methods/tree.rs +++ /dev/null @@ -1,122 +0,0 @@ -use crate::{ - error, error_ref_mut, nctree_create, - widgets::{NcTree, NcTreeItem, NcTreeOptions}, - NcError, NcInput, NcPlane, NcResult, NCRESULT_ERR, -}; - -/// # `NcTree` constructors & destructors -impl NcTree { - /// Creates an [NcTree] with the specified options. - /// - /// *C style function: [nctree_create()][crate::nctree_create].* - pub fn new<'a>(plane: &mut NcPlane, options: NcTreeOptions) -> NcResult<&'a mut Self> { - error_ref_mut![unsafe { nctree_create(plane, &options) }, "Creating NcTree"] - } - - /// Destroys an NcTree created with [new()][NcTree#method.new]. - /// - /// *C style function: [nctree_destroy()][crate::nctree_destroy].* - pub fn destroy(&mut self) { - unsafe { crate::nctree_destroy(self) }; - } -} - -/// # `NcTree` methods -impl NcTree { - // NOTE: not implemented yet in C API - // - // /// Goes to the item specified by the array |spec|, terminated by UINT_MAX. - // /// - // /// If the spec is invalid, returns an error and the depth of the first - // /// invalid spec is written to *|failspec|. - // /// - // /// Otherwise, the true depth is written to *|failspec|, - // /// and the curry is returned (|failspec| is necessary because the - // /// curry could itself be NULL). - // /// - // /// *C style function: [nctree_goto()][crate::nctree_goto].* - // pub fn goto(&mut self, spec: ... , failspec: ...) -> NcResult<&mut NcTreeItem> { - // let res = unsafe { crate::nctree_goto(self) }; - // if !res.is_null() { - // Ok(unsafe { &mut *(res as *mut NcTreeItem) }) - // } else { - // Err(NcError::with_msg(NCRESULT_ERR, "NcTree.goto()")) - // } - // } - - /// Returns the focused item, if any items are present. - /// - /// This is not a copy; be careful to use it only for the duration of a - /// critical section. - /// - /// *C style function: [nctree_focused()][crate::nctree_focused].* - pub fn focused(&mut self) -> NcResult<&mut NcTreeItem> { - let res = unsafe { crate::nctree_focused(self) }; - if !res.is_null() { - Ok(unsafe { &mut *(res as *mut NcTreeItem) }) - } else { - Err(NcError::with_msg(NCRESULT_ERR, "NcTree.focused()")) - } - } - - /// Changes the focus to the next item, and returns it. - /// - /// *C style function: [nctree_next()][crate::nctree_next].* - #[allow(clippy::should_implement_trait)] - pub fn next(&mut self) -> NcResult<&mut NcTreeItem> { - let res = unsafe { crate::nctree_next(self) }; - if !res.is_null() { - Ok(unsafe { &mut *(res as *mut NcTreeItem) }) - } else { - Err(NcError::with_msg(NCRESULT_ERR, "NcTree.next()")) - } - } - - /// Changes the focus to the previous item, and returns it. - /// - /// *C style function: [nctree_prev()][crate::nctree_prev].* - pub fn prev(&mut self) -> NcResult<&mut NcTreeItem> { - let res = unsafe { crate::nctree_prev(self) }; - if !res.is_null() { - Ok(unsafe { &mut *(res as *mut NcTreeItem) }) - } else { - Err(NcError::with_msg(NCRESULT_ERR, "NcTree.prev()")) - } - } - - /// Offers the `input` to this NcTree. - /// - /// If it's relevant, this function returns true, - /// and the input ought not be processed further. - /// If it's irrelevant to the tree, false is returned. - /// - /// Relevant inputs include: - /// - /// - a mouse click on an item (focuses item) - /// - a mouse scrollwheel event (srolls tree) - /// - up, down, pgup, or pgdown (navigates among items) - /// - /// *C style function: [nctree_offer_input()][crate::nctree_offer_input].* - pub fn offer_input(&mut self, input: NcInput) -> bool { - unsafe { crate::nctree_offer_input(self, &input) } - } - - /// Returns the [NcPlane] backing this NcTree. - /// - /// *C style function: [nctree_plane()][crate::nctree_plane].* - pub fn plane(&mut self) -> NcResult<&NcPlane> { - error_ref_mut![unsafe { crate::nctree_plane(self) }, "NcTree.plane()"] - } - - /// Redraws the NcTree in its entirety. - /// - /// The tree will be cleared, and items will be laid out, using the focused - /// item as a fulcrum. - /// - /// Item-drawing callbacks will be invoked for each visible item. - /// - /// *C style function: [nctree_redraw()][crate::nctree_redraw].* - pub fn redraw(&mut self) -> NcResult<()> { - error![unsafe { crate::nctree_redraw(self) }, "NcTree.redraw()"] - } -} diff --git a/rust/src/widgets/tree/mod.rs b/rust/src/widgets/tree/mod.rs deleted file mode 100644 index ab507c582..000000000 --- a/rust/src/widgets/tree/mod.rs +++ /dev/null @@ -1,89 +0,0 @@ -//! `NcTree` widget - -// functions already exported by bindgen : 13 -// ------------------------------------------ -// (#) test: 0 -// (W) wrap: 13 -// ------------------------------------------ -//W nctree_create, -//W nctree_destroy, -//W nctree_focused, -//~ nctree_goto, -//W nctree_next, -//W nctree_offer_input, -//W nctree_plane, -//W nctree_prev, -//W nctree_redraw, - -use cty::c_int; -use std::ffi::c_void; - -use crate::NcPlane; - -mod methods; - -/// High-level hierarchical line-based data. -/// -/// `NcTree`s organize static hierarchical items, and allow them to be browsed. -/// -/// An NcTree cannot be empty, count must be non-zero. -/// -/// - Each item can have arbitrary subitems. -/// - Items can be collapsed and expanded. -/// - The display supports scrolling and searching. -/// - Items cannot be added or removed, however; they must be provided in their -/// entirety at creation time. -/// -/// NOTE: `NcTree` shares many properties with `NcReel`. Unlike the latter, -/// `NcTree`s support arbitrary hierarchical levels, but they do not allow -/// elements to come and go across the lifetime of the widget. -/// -/// `type in C: nctree (struct)` -pub type NcTree = crate::bindings::ffi::nctree; - -/// Item for [`NcTree`]. -/// -/// each item has a curry, and zero or more subitems. -pub type NcTreeItem = crate::bindings::ffi::nctree_item; - -/// Options struct for [`NcTree`]. -pub type NcTreeOptions = crate::bindings::ffi::nctree_options; - -// e.g.: -// -// ```c -// int treecb(struct ncplane* n, void* curry, int pos){ -// ncplane_printf_yx(n, 0, 0, "item: %s pos: %d", -// static_cast(curry), pos); -// return 0; -// } -// ``` - -/// An [NcTreeItem] callback function (unsafe). -pub type NcTreeItemCbUnsafe = unsafe extern "C" fn(*mut NcPlane, *mut c_void, c_int) -> c_int; - -/// An [NcTreeItem] callback function. -pub type NcTreeItemCb = fn(&mut NcPlane, &str, i32); - -// WIP TODO: create callback type and conversion functions -// -// /// Converts [NcTreeItemCbUnsafe] to [NcTreeItemCb]. -// pub fn nctreeitemcb_to_rust(resizecb: Option) -> Option { -// if let Some(cb) = resizecb { -// return Some(unsafe { core::mem::transmute(cb) }); -// } else { -// None -// } -// } -// -// /// Converts [NcTreeItemCb] to [NcTreeItemCbUnsafe]. -// /// -// // waiting for https://github.com/rust-lang/rust/issues/53605 -// // to make this function const, and then NcPlaneOptions constructors. -// pub fn nctreeitemcb_to_c(resizecb: Option) -> Option { -// if let Some(cb) = resizecb { -// return Some(unsafe { core::mem::transmute(cb) }); -// } else { -// None -// } -// } diff --git a/tools/blame-nick.sh b/tools/blame-nick.sh deleted file mode 100755 index 588d7d80e..000000000 --- a/tools/blame-nick.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash -# -# handy script that shows the last changes made by Nick in the rust bindings - -RUST_DIR="$(git rev-parse --show-toplevel)/rust" - -# …in /src & /examples -for file in $(find "$RUST_DIR/src/" "$RUST_DIR/examples" -name '*.rs'); do - git blame -fn $file 2>&1 | grep "(nick black" | grep -v "no such path"; -done - diff --git a/tools/function-summary/PENDING-changes.md b/tools/function-summary/PENDING-changes.md deleted file mode 100644 index c3cd450f0..000000000 --- a/tools/function-summary/PENDING-changes.md +++ /dev/null @@ -1,41 +0,0 @@ -PENDING changes - -## from changes-20210321-20210406.txt -- all tabbed & tab widget functions - -## from changes-20210406-20210410.txt -missing methods: -- [ ] ncdirect_stream - -## from changes-20120518-20210603.txt - -missing methods: -- [ ] nccell_width -- [ ] ncdirect_styles (method) -- [ ] ncdirect_supported_styles (method) -- [ ] ncplane_erase_region -- [ ] notcurses_cursor_yx - -## from changes-20210603-20210704.txt … - -missing imports & methods: -- [ ] ncpile_render_to_buffer -- [ ] ncpile_render_to_file -- [ ] nccells_ascii_box -- [ ] nccells_heavy_box -- [ ] nccells_light_box - -## from changes-20210731-20210826.txt -- [ ] notcurses_hostname -- [ ] notcurses_accountname -- [ ] notcurses_enter_alternate_screen -- [ ] notcurses_leave_alternate_screen -- [ ] notcurses_get -- [ ] ncdirect_get -- [ ] ncvisual_subtitle_plane -- [ ] ncvisual_from_palidx -- [ ] ncplane_scrollup -- [ ] ncplane_scrollup_child -- [ ] ncplane_cursor_move_rel -- [ ] ncplane_boundlist /// Gets the head of the list of planes bound to 'n'. - diff --git a/tools/function-summary/compare-outputs.sh b/tools/function-summary/compare-outputs.sh deleted file mode 100755 index 0927eb907..000000000 --- a/tools/function-summary/compare-outputs.sh +++ /dev/null @@ -1,65 +0,0 @@ -#/usr/bin/env bash -# -# compares the changes betwee two output folders - -PATH1=$1 -PATH2=$2 - -if [[ -z $PATH1 ]]; then - echo "It's necessary to provide two paths to compare. 0 paths provided" - exit 1 -fi - -if [[ ! -d $PATH1 ]]; then - echo "The first path doesn't exist." - exit 1 -fi - -if [[ -z $PATH2 ]]; then - echo "It's necessary to provide two paths to compare. Only 1 path provided." - exit 1 -fi - -if [[ ! -d $PATH2 ]]; then - echo "The second path doesn't exist." - exit 1 -fi - - -# this line is to activate diff syntax highlighting -echo -e "0d0\n" - -echo -e "Differences between files:\n==========================" -#DIFFLIST=$(diff -qr "$PATH1" "$PATH2" | grep ^Files | cut -d' ' -f 2,4) -DIFFLIST=$(diff -qr "$PATH1" "$PATH2" | grep ^Files | cut -d' ' -f 2,4 | grep -v STATS) -echo "$DIFFLIST" - -echo -e "\nbroken down:\n============" - -OLDIFS=$IFS -IFS=$'\n' -for d in $DIFFLIST; do - d1=$(echo $d | cut -d' ' -f1) - d2=$(echo $d | cut -d' ' -f2) - - echo -e "\ndiff $d1 $d2:" - diff $d1 $d2 -done - - -echo -e "\nOnly in one path:\n=================" -UNIQUELIST=$(diff -qr "$PATH1" "$PATH2" | grep ^Only) -echo "$UNIQUELIST" - -echo -e "\ndisplay contents:\n=================" - -for u in $UNIQUELIST; do - u1=$(echo $u | cut -d' ' -f3| tr ':' '/' ) - u2=$(echo $u | cut -d' ' -f4) - path="${u1}${u2}" - echo -e "\ncat $path:\n-------------------" - cat $path -done - - -IFS=$OLDIFS diff --git a/tools/function-summary/function-summary.sh b/tools/function-summary/function-summary.sh deleted file mode 100755 index e0597d92a..000000000 --- a/tools/function-summary/function-summary.sh +++ /dev/null @@ -1,156 +0,0 @@ -#/usr/bin/env bash -# -# This script generates lists of functions generated by bindgen, on one side, -# and static inline functions in notcurses.h on the other, grouped by prefix. -# It also generates some statistics. -# -# It would be nice if this script could check for changes in the body of -# filtered functions, by asking git... between the date of today and a custom -# past date you want to check out (modified file in the bindings). -# -# I should probably re-do this in Rust, and put it as an advanced example… - - -# TODO:enhancement: support multiple paths -PATH_SOURCE_FILE="../../include/notcurses/notcurses.h" - -# this is the path to the latest bindgen generated rust sources -# TODO: retrieve it automatically, from the target folder, the most recently created/updated) - -if [[ -z $1 ]]; then - echo "Error: first argument must be the bindgen generated file." - exit 1 -fi -if [[ ! -f $1 ]]; then - echo "Error: file '$1' doesn't exist." - exit 2 -fi - -if [[ ! $(head -1 "$1" | grep "automatically generated by rust-bindgen") ]]; then - echo "Error: file '$1' is not a valid bindgen generated file." - exit 3 -fi - -PATH_BINDGEN_LATEST="$1" -CMD=$2 - - -# these are the main function prefixes used in notcurses (before the first `_`) for STATS_FILE -# NOTE: updated manually -PREFIX_LIST="cell channel ncblit ncdirect ncdplot ncfadectx ncfdplane nckey ncmenu ncmetric ncmultiselector ncpile ncpixel ncplane ncprogbar ncreader ncreel ncselector ncsubproc nctab nctree ncuplot ncvisual notcurses palette" - - -OUTPUT_DIR="out-$(date +%Y%m%d)" -OUTPUT_DIR_BG="$OUTPUT_DIR/bindgen" # (bindgen generated) -OUTPUT_DIR_SI="$OUTPUT_DIR/static" # (static inline) -STATS_FILE="$OUTPUT_DIR/STATS" - -TERM="static inline" - -GREP="/bin/grep" -CUT="/usr/bin/cut" -SED="/bin/sed" -WC="/usr/bin/wc" -UNIQ="/usr/bin/uniq" -REV="/usr/bin/rev" -SORT="/usr/bin/sort" - -# show the list of functions that are static inline -listfn() { - "$GREP" "$TERM" "$PATH_SOURCE_FILE" -A 1 | $GREP -v -- "--" | $SED /^static.*/d | $CUT -d '(' -f1 -} -listfn_bindgen() { - "$GREP" "pub fn" "$PATH_BINDGEN_LATEST" | $CUT -d'(' -f1 | $REV | $CUT -d' ' -f1 | $REV -} - -# show the number of different prefixes there are -listprefixes() { - listfn | $CUT -d'_' -f1 | $SORT | $UNIQ -} -listprefixes_bindgen() { - listfn_bindgen | $CUT -d'_' -f1 | $GREP -v '^$' | $SORT | $UNIQ -} - - -generate() { - - mkdir -p "$OUTPUT_DIR_BG" - mkdir -p "$OUTPUT_DIR_SI" - - echo "GENERAL" | tee $STATS_FILE - echo "-------"| tee -a $STATS_FILE - echo -n "bindgen generated functions (bg): " | tee -a $STATS_FILE - listfn_bindgen | $WC -l | tee -a $STATS_FILE - echo -n "static inline functions (si): " | tee -a $STATS_FILE - listfn | $WC -l | tee -a $STATS_FILE - echo | tee -a $STATS_FILE - - - echo "grouped by the following prefixes:" | tee -a $STATS_FILE - echo $PREFIX_LIST | tee -a $STATS_FILE - echo "--------------------------" | tee -a $STATS_FILE - echo -e " (bg, si)\n" | tee -a $STATS_FILE - - for prefix in $PREFIX_LIST; do - printf "%.12s" "$prefix: " | tee -a $STATS_FILE - echo -en "(" | tee -a $STATS_FILE - listfn_bindgen | $GREP "^$prefix" | $UNIQ -u | $WC -l | tr -d '\n' | tee -a $STATS_FILE - echo -en ", " | tee -a $STATS_FILE - listfn | $GREP "^$prefix" | $UNIQ -u | $WC -l | tr -d '\n' | tee -a $STATS_FILE - echo ")" | tee -a $STATS_FILE - - # create the files - listfn_bindgen | $GREP "^$prefix" | $UNIQ -u | $SORT > "$OUTPUT_DIR_BG/$prefix" | tee -a $STATS_FILE - listfn | $GREP "^$prefix" | $UNIQ -u | $SORT > "$OUTPUT_DIR_SI/$prefix" | tee -a $STATS_FILE - - filterout="$filterout^$prefix|" - done - - # DEBUG: show filtered out - filterout="${filterout::-1}" - #echo -e "$filterout" # DEBUG - - # show/save the rest not prefixed - echo -en "\nrest of the functions (bg/si):" | tee -a $STATS_FILE - echo -en "(" | tee -a $STATS_FILE - listfn | $GREP -vE "$filterout" | $WC -l | tr -d '\n' | tee -a $STATS_FILE - echo -en ", " | tee -a $STATS_FILE - listfn_bindgen | $GREP -vE "$filterout" | $WC -l | tr -d '\n' | tee -a $STATS_FILE - echo ")" | tee -a $STATS_FILE - - listfn_bindgen | $GREP -vE "$filterout" | $UNIQ -u | $SORT > "$OUTPUT_DIR_BG/_NON_FILTERED" | tee -a $STATS_FILE - listfn | $GREP -vE "$filterout" | $UNIQ -u | $SORT > "$OUTPUT_DIR_SI/_NON_FILTERED" | tee -a $STATS_FILE - - echo -e "\n» results generated in folder \"$OUTPUT_DIR\"" - -} #/generate - -main() { - - if [[ $CMD == "p" ]]; then - listprefixes - elif [[ $CMD == "f" ]]; then - listfn - elif [[ $CMD == "pbind" ]]; then - listprefixes_bindgen - elif [[ $CMD == "fbind" ]]; then - listfn_bindgen - elif [[ $CMD == "generate" ]]; then - generate - else - echo -e "I need an argument:" - echo -e "\tp list static inline uniq fn prefixes" - echo -e "\tf list static inline functions" - echo - echo -e "\tpbind list bindgen generated uniq fn prefixes" - echo -e "\tfbind list bindgen generated functions" - echo - echo -e "\tgenerate" - echo -e " create an output subfolder with today's date and save in there" - echo -e " a series of textfiles named by prefix, with the list of functions:" - echo -e " 1) generated by bindgen, and 2) static inline ones in notcurses.h" - echo - fi -} - -main $CMD diff --git a/tools/function-summary/history/bindgen_20201227.rs b/tools/function-summary/history/bindgen_20201227.rs deleted file mode 100644 index 8450f2703..000000000 --- a/tools/function-summary/history/bindgen_20201227.rs +++ /dev/null @@ -1,9034 +0,0 @@ -/* automatically generated by rust-bindgen 0.56.0 */ - -#[repr(C)] -#[derive(Default)] -pub struct __IncompleteArrayField(::core::marker::PhantomData, [T; 0]); -impl __IncompleteArrayField { - #[inline] - pub const fn new() -> Self { - __IncompleteArrayField(::core::marker::PhantomData, []) - } - #[inline] - pub fn as_ptr(&self) -> *const T { - self as *const _ as *const T - } - #[inline] - pub fn as_mut_ptr(&mut self) -> *mut T { - self as *mut _ as *mut T - } - #[inline] - pub unsafe fn as_slice(&self, len: usize) -> &[T] { - ::core::slice::from_raw_parts(self.as_ptr(), len) - } - #[inline] - pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] { - ::core::slice::from_raw_parts_mut(self.as_mut_ptr(), len) - } -} -impl ::core::fmt::Debug for __IncompleteArrayField { - fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - fmt.write_str("__IncompleteArrayField") - } -} -pub const _TIME_H: u32 = 1; -pub const _FEATURES_H: u32 = 1; -pub const __GLIBC_USE_ISOC2X: u32 = 0; -pub const __USE_ISOC11: u32 = 1; -pub const __USE_ISOC99: u32 = 1; -pub const __USE_ISOC95: u32 = 1; -pub const _POSIX_SOURCE: u32 = 1; -pub const _POSIX_C_SOURCE: u32 = 2; -pub const __USE_POSIX_IMPLICITLY: u32 = 1; -pub const __USE_POSIX: u32 = 1; -pub const __USE_POSIX2: u32 = 1; -pub const __USE_XOPEN: u32 = 1; -pub const __USE_FORTIFY_LEVEL: u32 = 0; -pub const __GLIBC_USE_DEPRECATED_GETS: u32 = 0; -pub const __GLIBC_USE_DEPRECATED_SCANF: u32 = 0; -pub const _STDC_PREDEF_H: u32 = 1; -pub const __STDC_IEC_559__: u32 = 1; -pub const __STDC_IEC_559_COMPLEX__: u32 = 1; -pub const __STDC_ISO_10646__: u32 = 201706; -pub const __GNU_LIBRARY__: u32 = 6; -pub const __GLIBC__: u32 = 2; -pub const __GLIBC_MINOR__: u32 = 31; -pub const _SYS_CDEFS_H: u32 = 1; -pub const __glibc_c99_flexarr_available: u32 = 1; -pub const __WORDSIZE: u32 = 64; -pub const __WORDSIZE_TIME64_COMPAT32: u32 = 1; -pub const __SYSCALL_WORDSIZE: u32 = 64; -pub const __LONG_DOUBLE_USES_FLOAT128: u32 = 0; -pub const __HAVE_GENERIC_SELECTION: u32 = 1; -pub const _BITS_TIME_H: u32 = 1; -pub const _BITS_TYPES_H: u32 = 1; -pub const __TIMESIZE: u32 = 64; -pub const _BITS_TYPESIZES_H: u32 = 1; -pub const __OFF_T_MATCHES_OFF64_T: u32 = 1; -pub const __INO_T_MATCHES_INO64_T: u32 = 1; -pub const __RLIM_T_MATCHES_RLIM64_T: u32 = 1; -pub const __STATFS_MATCHES_STATFS64: u32 = 1; -pub const __FD_SETSIZE: u32 = 1024; -pub const _BITS_TIME64_H: u32 = 1; -pub const __clock_t_defined: u32 = 1; -pub const __time_t_defined: u32 = 1; -pub const __struct_tm_defined: u32 = 1; -pub const _STRUCT_TIMESPEC: u32 = 1; -pub const _BITS_ENDIAN_H: u32 = 1; -pub const __LITTLE_ENDIAN: u32 = 1234; -pub const __BIG_ENDIAN: u32 = 4321; -pub const __PDP_ENDIAN: u32 = 3412; -pub const _BITS_ENDIANNESS_H: u32 = 1; -pub const __BYTE_ORDER: u32 = 1234; -pub const __FLOAT_WORD_ORDER: u32 = 1234; -pub const TIME_UTC: u32 = 1; -pub const _UCHAR_H: u32 = 1; -pub const __mbstate_t_defined: u32 = 1; -pub const ____mbstate_t_defined: u32 = 1; -pub const _CTYPE_H: u32 = 1; -pub const _WCHAR_H: u32 = 1; -pub const __GLIBC_USE_LIB_EXT2: u32 = 0; -pub const __GLIBC_USE_IEC_60559_BFP_EXT: u32 = 0; -pub const __GLIBC_USE_IEC_60559_BFP_EXT_C2X: u32 = 0; -pub const __GLIBC_USE_IEC_60559_FUNCS_EXT: u32 = 0; -pub const __GLIBC_USE_IEC_60559_FUNCS_EXT_C2X: u32 = 0; -pub const __GLIBC_USE_IEC_60559_TYPES_EXT: u32 = 0; -pub const __HAVE_FLOAT128: u32 = 0; -pub const __HAVE_DISTINCT_FLOAT128: u32 = 0; -pub const __HAVE_FLOAT64X: u32 = 1; -pub const __HAVE_FLOAT64X_LONG_DOUBLE: u32 = 1; -pub const __HAVE_FLOAT16: u32 = 0; -pub const __HAVE_FLOAT32: u32 = 1; -pub const __HAVE_FLOAT64: u32 = 1; -pub const __HAVE_FLOAT32X: u32 = 1; -pub const __HAVE_FLOAT128X: u32 = 0; -pub const __HAVE_DISTINCT_FLOAT16: u32 = 0; -pub const __HAVE_DISTINCT_FLOAT32: u32 = 0; -pub const __HAVE_DISTINCT_FLOAT64: u32 = 0; -pub const __HAVE_DISTINCT_FLOAT32X: u32 = 0; -pub const __HAVE_DISTINCT_FLOAT64X: u32 = 0; -pub const __HAVE_DISTINCT_FLOAT128X: u32 = 0; -pub const __HAVE_FLOATN_NOT_TYPEDEF: u32 = 0; -pub const __GNUC_VA_LIST: u32 = 1; -pub const _BITS_WCHAR_H: u32 = 1; -pub const __wint_t_defined: u32 = 1; -pub const _WINT_T: u32 = 1; -pub const ____FILE_defined: u32 = 1; -pub const WEOF: u32 = 4294967295; -pub const _BITS_WCTYPE_WCHAR_H: u32 = 1; -pub const _STDIO_H: u32 = 1; -pub const _____fpos_t_defined: u32 = 1; -pub const _____fpos64_t_defined: u32 = 1; -pub const __FILE_defined: u32 = 1; -pub const __struct_FILE_defined: u32 = 1; -pub const _IO_EOF_SEEN: u32 = 16; -pub const _IO_ERR_SEEN: u32 = 32; -pub const _IO_USER_LOCK: u32 = 32768; -pub const _IOFBF: u32 = 0; -pub const _IOLBF: u32 = 1; -pub const _IONBF: u32 = 2; -pub const BUFSIZ: u32 = 8192; -pub const EOF: i32 = -1; -pub const SEEK_SET: u32 = 0; -pub const SEEK_CUR: u32 = 1; -pub const SEEK_END: u32 = 2; -pub const P_tmpdir: &'static [u8; 5usize] = b"/tmp\0"; -pub const _BITS_STDIO_LIM_H: u32 = 1; -pub const L_tmpnam: u32 = 20; -pub const TMP_MAX: u32 = 238328; -pub const FILENAME_MAX: u32 = 4096; -pub const L_ctermid: u32 = 9; -pub const L_cuserid: u32 = 9; -pub const FOPEN_MAX: u32 = 16; -pub const _GETOPT_POSIX_H: u32 = 1; -pub const _GETOPT_CORE_H: u32 = 1; -pub const _STDINT_H: u32 = 1; -pub const _BITS_STDINT_INTN_H: u32 = 1; -pub const _BITS_STDINT_UINTN_H: u32 = 1; -pub const INT8_MIN: i32 = -128; -pub const INT16_MIN: i32 = -32768; -pub const INT32_MIN: i32 = -2147483648; -pub const INT8_MAX: u32 = 127; -pub const INT16_MAX: u32 = 32767; -pub const INT32_MAX: u32 = 2147483647; -pub const UINT8_MAX: u32 = 255; -pub const UINT16_MAX: u32 = 65535; -pub const UINT32_MAX: u32 = 4294967295; -pub const INT_LEAST8_MIN: i32 = -128; -pub const INT_LEAST16_MIN: i32 = -32768; -pub const INT_LEAST32_MIN: i32 = -2147483648; -pub const INT_LEAST8_MAX: u32 = 127; -pub const INT_LEAST16_MAX: u32 = 32767; -pub const INT_LEAST32_MAX: u32 = 2147483647; -pub const UINT_LEAST8_MAX: u32 = 255; -pub const UINT_LEAST16_MAX: u32 = 65535; -pub const UINT_LEAST32_MAX: u32 = 4294967295; -pub const INT_FAST8_MIN: i32 = -128; -pub const INT_FAST16_MIN: i64 = -9223372036854775808; -pub const INT_FAST32_MIN: i64 = -9223372036854775808; -pub const INT_FAST8_MAX: u32 = 127; -pub const INT_FAST16_MAX: u64 = 9223372036854775807; -pub const INT_FAST32_MAX: u64 = 9223372036854775807; -pub const UINT_FAST8_MAX: u32 = 255; -pub const UINT_FAST16_MAX: i32 = -1; -pub const UINT_FAST32_MAX: i32 = -1; -pub const INTPTR_MIN: i64 = -9223372036854775808; -pub const INTPTR_MAX: u64 = 9223372036854775807; -pub const UINTPTR_MAX: i32 = -1; -pub const PTRDIFF_MIN: i64 = -9223372036854775808; -pub const PTRDIFF_MAX: u64 = 9223372036854775807; -pub const SIG_ATOMIC_MIN: i32 = -2147483648; -pub const SIG_ATOMIC_MAX: u32 = 2147483647; -pub const SIZE_MAX: i32 = -1; -pub const WINT_MIN: u32 = 0; -pub const WINT_MAX: u32 = 4294967295; -pub const _STDLIB_H: u32 = 1; -pub const WNOHANG: u32 = 1; -pub const WUNTRACED: u32 = 2; -pub const __WNOTHREAD: u32 = 536870912; -pub const __WALL: u32 = 1073741824; -pub const __WCLONE: u32 = 2147483648; -pub const __W_CONTINUED: u32 = 65535; -pub const __WCOREFLAG: u32 = 128; -pub const __ldiv_t_defined: u32 = 1; -pub const __lldiv_t_defined: u32 = 1; -pub const RAND_MAX: u32 = 2147483647; -pub const EXIT_FAILURE: u32 = 1; -pub const EXIT_SUCCESS: u32 = 0; -pub const _STRING_H: u32 = 1; -pub const _BITS_SIGNUM_H: u32 = 1; -pub const _BITS_SIGNUM_GENERIC_H: u32 = 1; -pub const SIGINT: u32 = 2; -pub const SIGILL: u32 = 4; -pub const SIGABRT: u32 = 6; -pub const SIGFPE: u32 = 8; -pub const SIGSEGV: u32 = 11; -pub const SIGTERM: u32 = 15; -pub const SIGHUP: u32 = 1; -pub const SIGQUIT: u32 = 3; -pub const SIGTRAP: u32 = 5; -pub const SIGKILL: u32 = 9; -pub const SIGBUS: u32 = 10; -pub const SIGSYS: u32 = 12; -pub const SIGPIPE: u32 = 13; -pub const SIGALRM: u32 = 14; -pub const SIGURG: u32 = 16; -pub const SIGSTOP: u32 = 17; -pub const SIGTSTP: u32 = 18; -pub const SIGCONT: u32 = 19; -pub const SIGCHLD: u32 = 20; -pub const SIGTTIN: u32 = 21; -pub const SIGTTOU: u32 = 22; -pub const SIGPOLL: u32 = 23; -pub const SIGXCPU: u32 = 24; -pub const SIGXFSZ: u32 = 25; -pub const SIGVTALRM: u32 = 26; -pub const SIGPROF: u32 = 27; -pub const SIGUSR1: u32 = 30; -pub const SIGUSR2: u32 = 31; -pub const SIGWINCH: u32 = 28; -pub const SIGIO: u32 = 23; -pub const SIGIOT: u32 = 6; -pub const SIGCLD: u32 = 20; -pub const __SIGRTMIN: u32 = 32; -pub const __SIGRTMAX: u32 = 32; -pub const _NSIG: u32 = 33; -pub const SIGSTKFLT: u32 = 16; -pub const SIGPWR: u32 = 30; -pub const __sig_atomic_t_defined: u32 = 1; -pub const __sigset_t_defined: u32 = 1; -pub const _BITS_SIGACTION_H: u32 = 1; -pub const SA_NOCLDSTOP: u32 = 1; -pub const SA_NOCLDWAIT: u32 = 2; -pub const SA_SIGINFO: u32 = 4; -pub const SIG_BLOCK: u32 = 0; -pub const SIG_UNBLOCK: u32 = 1; -pub const SIG_SETMASK: u32 = 2; -pub const _LIBC_LIMITS_H_: u32 = 1; -pub const MB_LEN_MAX: u32 = 16; -pub const _BITS_POSIX1_LIM_H: u32 = 1; -pub const _POSIX_AIO_LISTIO_MAX: u32 = 2; -pub const _POSIX_AIO_MAX: u32 = 1; -pub const _POSIX_ARG_MAX: u32 = 4096; -pub const _POSIX_CHILD_MAX: u32 = 6; -pub const _POSIX_DELAYTIMER_MAX: u32 = 32; -pub const _POSIX_HOST_NAME_MAX: u32 = 255; -pub const _POSIX_LINK_MAX: u32 = 8; -pub const _POSIX_LOGIN_NAME_MAX: u32 = 9; -pub const _POSIX_MAX_CANON: u32 = 255; -pub const _POSIX_MAX_INPUT: u32 = 255; -pub const _POSIX_MQ_OPEN_MAX: u32 = 8; -pub const _POSIX_MQ_PRIO_MAX: u32 = 32; -pub const _POSIX_NAME_MAX: u32 = 14; -pub const _POSIX_NGROUPS_MAX: u32 = 0; -pub const _POSIX_OPEN_MAX: u32 = 16; -pub const _POSIX_FD_SETSIZE: u32 = 16; -pub const _POSIX_PATH_MAX: u32 = 256; -pub const _POSIX_PIPE_BUF: u32 = 512; -pub const _POSIX_RE_DUP_MAX: u32 = 255; -pub const _POSIX_RTSIG_MAX: u32 = 8; -pub const _POSIX_SEM_NSEMS_MAX: u32 = 256; -pub const _POSIX_SEM_VALUE_MAX: u32 = 32767; -pub const _POSIX_SIGQUEUE_MAX: u32 = 32; -pub const _POSIX_SSIZE_MAX: u32 = 32767; -pub const _POSIX_STREAM_MAX: u32 = 8; -pub const _POSIX_SYMLINK_MAX: u32 = 255; -pub const _POSIX_SYMLOOP_MAX: u32 = 8; -pub const _POSIX_TIMER_MAX: u32 = 32; -pub const _POSIX_TTY_NAME_MAX: u32 = 9; -pub const _POSIX_TZNAME_MAX: u32 = 3; -pub const _POSIX_QLIMIT: u32 = 1; -pub const _POSIX_HIWAT: u32 = 512; -pub const _POSIX_UIO_MAXIOV: u32 = 16; -pub const _POSIX_CLOCKRES_MIN: u32 = 20000000; -pub const NR_OPEN: u32 = 1024; -pub const NGROUPS_MAX: u32 = 65536; -pub const ARG_MAX: u32 = 131072; -pub const LINK_MAX: u32 = 127; -pub const MAX_CANON: u32 = 255; -pub const MAX_INPUT: u32 = 255; -pub const NAME_MAX: u32 = 255; -pub const PATH_MAX: u32 = 4096; -pub const PIPE_BUF: u32 = 4096; -pub const XATTR_NAME_MAX: u32 = 255; -pub const XATTR_SIZE_MAX: u32 = 65536; -pub const XATTR_LIST_MAX: u32 = 65536; -pub const RTSIG_MAX: u32 = 32; -pub const _POSIX_THREAD_KEYS_MAX: u32 = 128; -pub const PTHREAD_KEYS_MAX: u32 = 1024; -pub const _POSIX_THREAD_DESTRUCTOR_ITERATIONS: u32 = 4; -pub const PTHREAD_DESTRUCTOR_ITERATIONS: u32 = 4; -pub const _POSIX_THREAD_THREADS_MAX: u32 = 64; -pub const AIO_PRIO_DELTA_MAX: u32 = 20; -pub const PTHREAD_STACK_MIN: u32 = 16384; -pub const DELAYTIMER_MAX: u32 = 2147483647; -pub const TTY_NAME_MAX: u32 = 32; -pub const LOGIN_NAME_MAX: u32 = 256; -pub const HOST_NAME_MAX: u32 = 64; -pub const MQ_PRIO_MAX: u32 = 32768; -pub const SEM_VALUE_MAX: u32 = 2147483647; -pub const _BITS_POSIX2_LIM_H: u32 = 1; -pub const _POSIX2_BC_BASE_MAX: u32 = 99; -pub const _POSIX2_BC_DIM_MAX: u32 = 2048; -pub const _POSIX2_BC_SCALE_MAX: u32 = 99; -pub const _POSIX2_BC_STRING_MAX: u32 = 1000; -pub const _POSIX2_COLL_WEIGHTS_MAX: u32 = 2; -pub const _POSIX2_EXPR_NEST_MAX: u32 = 32; -pub const _POSIX2_LINE_MAX: u32 = 2048; -pub const _POSIX2_RE_DUP_MAX: u32 = 255; -pub const _POSIX2_CHARCLASS_NAME_MAX: u32 = 14; -pub const BC_BASE_MAX: u32 = 99; -pub const BC_DIM_MAX: u32 = 2048; -pub const BC_SCALE_MAX: u32 = 99; -pub const BC_STRING_MAX: u32 = 1000; -pub const COLL_WEIGHTS_MAX: u32 = 255; -pub const EXPR_NEST_MAX: u32 = 32; -pub const LINE_MAX: u32 = 2048; -pub const CHARCLASS_NAME_MAX: u32 = 2048; -pub const RE_DUP_MAX: u32 = 32767; -pub const _XOPEN_LIM_H: u32 = 1; -pub const _XOPEN_IOV_MAX: u32 = 16; -pub const _BITS_UIO_LIM_H: u32 = 1; -pub const __IOV_MAX: u32 = 1024; -pub const IOV_MAX: u32 = 1024; -pub const NL_ARGMAX: u32 = 4096; -pub const NL_LANGMAX: u32 = 2048; -pub const NZERO: u32 = 20; -pub const WORD_BIT: u32 = 32; -pub const LONG_BIT: u32 = 64; -pub const true_: u32 = 1; -pub const false_: u32 = 0; -pub const __bool_true_false_are_defined: u32 = 1; -pub const _BYTESWAP_H: u32 = 1; -pub const _BITS_BYTESWAP_H: u32 = 1; -pub const _NETINET_IN_H: u32 = 1; -pub const _SYS_SOCKET_H: u32 = 1; -pub const __iovec_defined: u32 = 1; -pub const _SYS_TYPES_H: u32 = 1; -pub const __clockid_t_defined: u32 = 1; -pub const __timer_t_defined: u32 = 1; -pub const __BIT_TYPES_DEFINED__: u32 = 1; -pub const PF_UNSPEC: u32 = 0; -pub const PF_LOCAL: u32 = 1; -pub const PF_UNIX: u32 = 1; -pub const PF_FILE: u32 = 1; -pub const PF_INET: u32 = 2; -pub const PF_AX25: u32 = 3; -pub const PF_IPX: u32 = 4; -pub const PF_APPLETALK: u32 = 5; -pub const PF_NETROM: u32 = 6; -pub const PF_BRIDGE: u32 = 7; -pub const PF_ATMPVC: u32 = 8; -pub const PF_X25: u32 = 9; -pub const PF_INET6: u32 = 10; -pub const PF_ROSE: u32 = 11; -pub const PF_DECnet: u32 = 12; -pub const PF_NETBEUI: u32 = 13; -pub const PF_SECURITY: u32 = 14; -pub const PF_KEY: u32 = 15; -pub const PF_NETLINK: u32 = 16; -pub const PF_ROUTE: u32 = 16; -pub const PF_PACKET: u32 = 17; -pub const PF_ASH: u32 = 18; -pub const PF_ECONET: u32 = 19; -pub const PF_ATMSVC: u32 = 20; -pub const PF_RDS: u32 = 21; -pub const PF_SNA: u32 = 22; -pub const PF_IRDA: u32 = 23; -pub const PF_PPPOX: u32 = 24; -pub const PF_WANPIPE: u32 = 25; -pub const PF_LLC: u32 = 26; -pub const PF_IB: u32 = 27; -pub const PF_MPLS: u32 = 28; -pub const PF_CAN: u32 = 29; -pub const PF_TIPC: u32 = 30; -pub const PF_BLUETOOTH: u32 = 31; -pub const PF_IUCV: u32 = 32; -pub const PF_RXRPC: u32 = 33; -pub const PF_ISDN: u32 = 34; -pub const PF_PHONET: u32 = 35; -pub const PF_IEEE802154: u32 = 36; -pub const PF_CAIF: u32 = 37; -pub const PF_ALG: u32 = 38; -pub const PF_NFC: u32 = 39; -pub const PF_VSOCK: u32 = 40; -pub const PF_KCM: u32 = 41; -pub const PF_QIPCRTR: u32 = 42; -pub const PF_SMC: u32 = 43; -pub const PF_XDP: u32 = 44; -pub const PF_MAX: u32 = 45; -pub const AF_UNSPEC: u32 = 0; -pub const AF_LOCAL: u32 = 1; -pub const AF_UNIX: u32 = 1; -pub const AF_FILE: u32 = 1; -pub const AF_INET: u32 = 2; -pub const AF_AX25: u32 = 3; -pub const AF_IPX: u32 = 4; -pub const AF_APPLETALK: u32 = 5; -pub const AF_NETROM: u32 = 6; -pub const AF_BRIDGE: u32 = 7; -pub const AF_ATMPVC: u32 = 8; -pub const AF_X25: u32 = 9; -pub const AF_INET6: u32 = 10; -pub const AF_ROSE: u32 = 11; -pub const AF_DECnet: u32 = 12; -pub const AF_NETBEUI: u32 = 13; -pub const AF_SECURITY: u32 = 14; -pub const AF_KEY: u32 = 15; -pub const AF_NETLINK: u32 = 16; -pub const AF_ROUTE: u32 = 16; -pub const AF_PACKET: u32 = 17; -pub const AF_ASH: u32 = 18; -pub const AF_ECONET: u32 = 19; -pub const AF_ATMSVC: u32 = 20; -pub const AF_RDS: u32 = 21; -pub const AF_SNA: u32 = 22; -pub const AF_IRDA: u32 = 23; -pub const AF_PPPOX: u32 = 24; -pub const AF_WANPIPE: u32 = 25; -pub const AF_LLC: u32 = 26; -pub const AF_IB: u32 = 27; -pub const AF_MPLS: u32 = 28; -pub const AF_CAN: u32 = 29; -pub const AF_TIPC: u32 = 30; -pub const AF_BLUETOOTH: u32 = 31; -pub const AF_IUCV: u32 = 32; -pub const AF_RXRPC: u32 = 33; -pub const AF_ISDN: u32 = 34; -pub const AF_PHONET: u32 = 35; -pub const AF_IEEE802154: u32 = 36; -pub const AF_CAIF: u32 = 37; -pub const AF_ALG: u32 = 38; -pub const AF_NFC: u32 = 39; -pub const AF_VSOCK: u32 = 40; -pub const AF_KCM: u32 = 41; -pub const AF_QIPCRTR: u32 = 42; -pub const AF_SMC: u32 = 43; -pub const AF_XDP: u32 = 44; -pub const AF_MAX: u32 = 45; -pub const SOL_RAW: u32 = 255; -pub const SOL_DECNET: u32 = 261; -pub const SOL_X25: u32 = 262; -pub const SOL_PACKET: u32 = 263; -pub const SOL_ATM: u32 = 264; -pub const SOL_AAL: u32 = 265; -pub const SOL_IRDA: u32 = 266; -pub const SOL_NETBEUI: u32 = 267; -pub const SOL_LLC: u32 = 268; -pub const SOL_DCCP: u32 = 269; -pub const SOL_NETLINK: u32 = 270; -pub const SOL_TIPC: u32 = 271; -pub const SOL_RXRPC: u32 = 272; -pub const SOL_PPPOL2TP: u32 = 273; -pub const SOL_BLUETOOTH: u32 = 274; -pub const SOL_PNPIPE: u32 = 275; -pub const SOL_RDS: u32 = 276; -pub const SOL_IUCV: u32 = 277; -pub const SOL_CAIF: u32 = 278; -pub const SOL_ALG: u32 = 279; -pub const SOL_NFC: u32 = 280; -pub const SOL_KCM: u32 = 281; -pub const SOL_TLS: u32 = 282; -pub const SOL_XDP: u32 = 283; -pub const SOMAXCONN: u32 = 4096; -pub const _BITS_SOCKADDR_H: u32 = 1; -pub const _SS_SIZE: u32 = 128; -pub const SO_DEBUG: u32 = 1; -pub const SOL_SOCKET: u32 = 1; -pub const SO_ACCEPTCONN: u32 = 30; -pub const SO_BROADCAST: u32 = 6; -pub const SO_DONTROUTE: u32 = 5; -pub const SO_ERROR: u32 = 4; -pub const SO_KEEPALIVE: u32 = 9; -pub const SO_LINGER: u32 = 13; -pub const SO_OOBINLINE: u32 = 10; -pub const SO_RCVBUF: u32 = 8; -pub const SO_RCVLOWAT: u32 = 18; -pub const SO_RCVTIMEO: u32 = 20; -pub const SO_REUSEADDR: u32 = 2; -pub const SO_SNDBUF: u32 = 7; -pub const SO_SNDLOWAT: u32 = 19; -pub const SO_SNDTIMEO: u32 = 21; -pub const SO_TYPE: u32 = 3; -pub const __USE_KERNEL_IPV6_DEFS: u32 = 0; -pub const IP_OPTIONS: u32 = 4; -pub const IP_HDRINCL: u32 = 3; -pub const IP_TOS: u32 = 1; -pub const IP_TTL: u32 = 2; -pub const IP_RECVOPTS: u32 = 6; -pub const IP_RETOPTS: u32 = 7; -pub const IP_MULTICAST_IF: u32 = 32; -pub const IP_MULTICAST_TTL: u32 = 33; -pub const IP_MULTICAST_LOOP: u32 = 34; -pub const IP_ADD_MEMBERSHIP: u32 = 35; -pub const IP_DROP_MEMBERSHIP: u32 = 36; -pub const IP_UNBLOCK_SOURCE: u32 = 37; -pub const IP_BLOCK_SOURCE: u32 = 38; -pub const IP_ADD_SOURCE_MEMBERSHIP: u32 = 39; -pub const IP_DROP_SOURCE_MEMBERSHIP: u32 = 40; -pub const IP_MSFILTER: u32 = 41; -pub const IP_ROUTER_ALERT: u32 = 5; -pub const IP_PKTINFO: u32 = 8; -pub const IP_PKTOPTIONS: u32 = 9; -pub const IP_PMTUDISC: u32 = 10; -pub const IP_MTU_DISCOVER: u32 = 10; -pub const IP_RECVERR: u32 = 11; -pub const IP_RECVTTL: u32 = 12; -pub const IP_RECVTOS: u32 = 13; -pub const IP_MTU: u32 = 14; -pub const IP_FREEBIND: u32 = 15; -pub const IP_IPSEC_POLICY: u32 = 16; -pub const IP_XFRM_POLICY: u32 = 17; -pub const IP_PASSSEC: u32 = 18; -pub const IP_TRANSPARENT: u32 = 19; -pub const IP_MULTICAST_ALL: u32 = 49; -pub const IP_ORIGDSTADDR: u32 = 20; -pub const IP_RECVORIGDSTADDR: u32 = 20; -pub const IP_MINTTL: u32 = 21; -pub const IP_NODEFRAG: u32 = 22; -pub const IP_CHECKSUM: u32 = 23; -pub const IP_BIND_ADDRESS_NO_PORT: u32 = 24; -pub const IP_RECVFRAGSIZE: u32 = 25; -pub const IP_PMTUDISC_DONT: u32 = 0; -pub const IP_PMTUDISC_WANT: u32 = 1; -pub const IP_PMTUDISC_DO: u32 = 2; -pub const IP_PMTUDISC_PROBE: u32 = 3; -pub const IP_PMTUDISC_INTERFACE: u32 = 4; -pub const IP_PMTUDISC_OMIT: u32 = 5; -pub const IP_UNICAST_IF: u32 = 50; -pub const SOL_IP: u32 = 0; -pub const IP_DEFAULT_MULTICAST_TTL: u32 = 1; -pub const IP_DEFAULT_MULTICAST_LOOP: u32 = 1; -pub const IP_MAX_MEMBERSHIPS: u32 = 20; -pub const IPV6_ADDRFORM: u32 = 1; -pub const IPV6_2292PKTINFO: u32 = 2; -pub const IPV6_2292HOPOPTS: u32 = 3; -pub const IPV6_2292DSTOPTS: u32 = 4; -pub const IPV6_2292RTHDR: u32 = 5; -pub const IPV6_2292PKTOPTIONS: u32 = 6; -pub const IPV6_CHECKSUM: u32 = 7; -pub const IPV6_2292HOPLIMIT: u32 = 8; -pub const IPV6_NEXTHOP: u32 = 9; -pub const IPV6_AUTHHDR: u32 = 10; -pub const IPV6_UNICAST_HOPS: u32 = 16; -pub const IPV6_MULTICAST_IF: u32 = 17; -pub const IPV6_MULTICAST_HOPS: u32 = 18; -pub const IPV6_MULTICAST_LOOP: u32 = 19; -pub const IPV6_JOIN_GROUP: u32 = 20; -pub const IPV6_LEAVE_GROUP: u32 = 21; -pub const IPV6_ROUTER_ALERT: u32 = 22; -pub const IPV6_MTU_DISCOVER: u32 = 23; -pub const IPV6_MTU: u32 = 24; -pub const IPV6_RECVERR: u32 = 25; -pub const IPV6_V6ONLY: u32 = 26; -pub const IPV6_JOIN_ANYCAST: u32 = 27; -pub const IPV6_LEAVE_ANYCAST: u32 = 28; -pub const IPV6_MULTICAST_ALL: u32 = 29; -pub const IPV6_ROUTER_ALERT_ISOLATE: u32 = 30; -pub const IPV6_IPSEC_POLICY: u32 = 34; -pub const IPV6_XFRM_POLICY: u32 = 35; -pub const IPV6_HDRINCL: u32 = 36; -pub const IPV6_RECVPKTINFO: u32 = 49; -pub const IPV6_PKTINFO: u32 = 50; -pub const IPV6_RECVHOPLIMIT: u32 = 51; -pub const IPV6_HOPLIMIT: u32 = 52; -pub const IPV6_RECVHOPOPTS: u32 = 53; -pub const IPV6_HOPOPTS: u32 = 54; -pub const IPV6_RTHDRDSTOPTS: u32 = 55; -pub const IPV6_RECVRTHDR: u32 = 56; -pub const IPV6_RTHDR: u32 = 57; -pub const IPV6_RECVDSTOPTS: u32 = 58; -pub const IPV6_DSTOPTS: u32 = 59; -pub const IPV6_RECVPATHMTU: u32 = 60; -pub const IPV6_PATHMTU: u32 = 61; -pub const IPV6_DONTFRAG: u32 = 62; -pub const IPV6_RECVTCLASS: u32 = 66; -pub const IPV6_TCLASS: u32 = 67; -pub const IPV6_AUTOFLOWLABEL: u32 = 70; -pub const IPV6_ADDR_PREFERENCES: u32 = 72; -pub const IPV6_MINHOPCOUNT: u32 = 73; -pub const IPV6_ORIGDSTADDR: u32 = 74; -pub const IPV6_RECVORIGDSTADDR: u32 = 74; -pub const IPV6_TRANSPARENT: u32 = 75; -pub const IPV6_UNICAST_IF: u32 = 76; -pub const IPV6_RECVFRAGSIZE: u32 = 77; -pub const IPV6_FREEBIND: u32 = 78; -pub const IPV6_ADD_MEMBERSHIP: u32 = 20; -pub const IPV6_DROP_MEMBERSHIP: u32 = 21; -pub const IPV6_RXHOPOPTS: u32 = 54; -pub const IPV6_RXDSTOPTS: u32 = 59; -pub const IPV6_PMTUDISC_DONT: u32 = 0; -pub const IPV6_PMTUDISC_WANT: u32 = 1; -pub const IPV6_PMTUDISC_DO: u32 = 2; -pub const IPV6_PMTUDISC_PROBE: u32 = 3; -pub const IPV6_PMTUDISC_INTERFACE: u32 = 4; -pub const IPV6_PMTUDISC_OMIT: u32 = 5; -pub const SOL_IPV6: u32 = 41; -pub const SOL_ICMPV6: u32 = 58; -pub const IPV6_RTHDR_LOOSE: u32 = 0; -pub const IPV6_RTHDR_STRICT: u32 = 1; -pub const IPV6_RTHDR_TYPE_0: u32 = 0; -pub const IN_CLASSA_NET: u32 = 4278190080; -pub const IN_CLASSA_NSHIFT: u32 = 24; -pub const IN_CLASSA_HOST: u32 = 16777215; -pub const IN_CLASSA_MAX: u32 = 128; -pub const IN_CLASSB_NET: u32 = 4294901760; -pub const IN_CLASSB_NSHIFT: u32 = 16; -pub const IN_CLASSB_HOST: u32 = 65535; -pub const IN_CLASSB_MAX: u32 = 65536; -pub const IN_CLASSC_NET: u32 = 4294967040; -pub const IN_CLASSC_NSHIFT: u32 = 8; -pub const IN_CLASSC_HOST: u32 = 255; -pub const IN_LOOPBACKNET: u32 = 127; -pub const INET_ADDRSTRLEN: u32 = 16; -pub const INET6_ADDRSTRLEN: u32 = 46; -pub const _ENDIAN_H: u32 = 1; -pub const _BITS_UINTN_IDENTITY_H: u32 = 1; -pub const NCKEY_ESC: u32 = 27; -pub const NCKEY_SPACE: u32 = 32; -pub const CHANNEL_ALPHA_MASK: u32 = 805306368; -pub const CELL_ALPHA_HIGHCONTRAST: u32 = 805306368; -pub const CELL_ALPHA_TRANSPARENT: u32 = 536870912; -pub const CELL_ALPHA_BLEND: u32 = 268435456; -pub const CELL_ALPHA_OPAQUE: u32 = 0; -pub const CELL_WIDEASIAN_MASK: i64 = -9223372036854775808; -pub const CELL_NOBACKGROUND_MASK: u64 = 288230376151711744; -pub const CELL_BGDEFAULT_MASK: u32 = 1073741824; -pub const CELL_FGDEFAULT_MASK: u64 = 4611686018427387904; -pub const CELL_BG_RGB_MASK: u32 = 16777215; -pub const CELL_FG_RGB_MASK: u64 = 72057589742960640; -pub const CELL_BG_PALETTE: u32 = 134217728; -pub const NCPALETTESIZE: u32 = 256; -pub const CELL_FG_PALETTE: u64 = 576460752303423488; -pub const CELL_BG_ALPHA_MASK: u32 = 805306368; -pub const CELL_FG_ALPHA_MASK: u64 = 3458764513820540928; -pub const NCSTYLE_MASK: u32 = 1023; -pub const NCSTYLE_STANDOUT: u32 = 128; -pub const NCSTYLE_UNDERLINE: u32 = 64; -pub const NCSTYLE_REVERSE: u32 = 32; -pub const NCSTYLE_BLINK: u32 = 16; -pub const NCSTYLE_DIM: u32 = 8; -pub const NCSTYLE_BOLD: u32 = 4; -pub const NCSTYLE_INVIS: u32 = 2; -pub const NCSTYLE_PROTECT: u32 = 1; -pub const NCSTYLE_ITALIC: u32 = 256; -pub const NCSTYLE_STRUCK: u32 = 512; -pub const NCSTYLE_NONE: u32 = 0; -pub const NCOPTION_INHIBIT_SETLOCALE: u32 = 1; -pub const NCOPTION_VERIFY_SIXEL: u32 = 2; -pub const NCOPTION_NO_WINCH_SIGHANDLER: u32 = 4; -pub const NCOPTION_NO_QUIT_SIGHANDLERS: u32 = 8; -pub const NCOPTION_SUPPRESS_BANNERS: u32 = 32; -pub const NCOPTION_NO_ALTERNATE_SCREEN: u32 = 64; -pub const NCOPTION_NO_FONT_CHANGES: u32 = 128; -pub const NCPLANE_OPTION_HORALIGNED: u32 = 1; -pub const WCHAR_MAX_UTF8BYTES: u32 = 6; -pub const NCBOXMASK_TOP: u32 = 1; -pub const NCBOXMASK_RIGHT: u32 = 2; -pub const NCBOXMASK_BOTTOM: u32 = 4; -pub const NCBOXMASK_LEFT: u32 = 8; -pub const NCBOXGRAD_TOP: u32 = 16; -pub const NCBOXGRAD_RIGHT: u32 = 32; -pub const NCBOXGRAD_BOTTOM: u32 = 64; -pub const NCBOXGRAD_LEFT: u32 = 128; -pub const NCBOXCORNER_MASK: u32 = 768; -pub const NCBOXCORNER_SHIFT: u32 = 8; -pub const NCVISUAL_OPTION_NODEGRADE: u32 = 1; -pub const NCVISUAL_OPTION_BLEND: u32 = 2; -pub const NCREEL_OPTION_INFINITESCROLL: u32 = 1; -pub const NCREEL_OPTION_CIRCULAR: u32 = 2; -pub const PREFIXCOLUMNS: u32 = 7; -pub const IPREFIXCOLUMNS: u32 = 8; -pub const BPREFIXCOLUMNS: u32 = 9; -pub const PREFIXSTRLEN: u32 = 8; -pub const IPREFIXSTRLEN: u32 = 9; -pub const BPREFIXSTRLEN: u32 = 10; -pub const NCMENU_OPTION_BOTTOM: u32 = 1; -pub const NCMENU_OPTION_HIDING: u32 = 2; -pub const NCPROGBAR_OPTION_RETROGRADE: u32 = 1; -pub const NCPLOT_OPTION_LABELTICKSD: u32 = 1; -pub const NCPLOT_OPTION_EXPONENTIALD: u32 = 2; -pub const NCPLOT_OPTION_VERTICALI: u32 = 4; -pub const NCPLOT_OPTION_NODEGRADE: u32 = 8; -pub const NCPLOT_OPTION_DETECTMAXONLY: u32 = 16; -pub const NCPLOT_OPTION_PRINTSAMPLE: u32 = 32; -pub const NCREADER_OPTION_HORSCROLL: u32 = 1; -pub const NCREADER_OPTION_VERSCROLL: u32 = 2; -pub const NCREADER_OPTION_NOCMDKEYS: u32 = 4; -pub const NCREADER_OPTION_CURSOR: u32 = 8; -pub const NCDIRECT_OPTION_INHIBIT_SETLOCALE: u32 = 1; -pub const NCDIRECT_OPTION_INHIBIT_CBREAK: u32 = 2; -pub type size_t = cty::c_ulong; -#[doc = " Convenience types."] -pub type __u_char = cty::c_uchar; -pub type __u_short = cty::c_ushort; -pub type __u_int = cty::c_uint; -pub type __u_long = cty::c_ulong; -#[doc = " Fixed-size types, underlying types depend on word size and compiler."] -pub type __int8_t = cty::c_schar; -pub type __uint8_t = cty::c_uchar; -pub type __int16_t = cty::c_short; -pub type __uint16_t = cty::c_ushort; -pub type __int32_t = cty::c_int; -pub type __uint32_t = cty::c_uint; -pub type __int64_t = cty::c_long; -pub type __uint64_t = cty::c_ulong; -#[doc = " Smallest types with at least a given width."] -pub type __int_least8_t = __int8_t; -pub type __uint_least8_t = __uint8_t; -pub type __int_least16_t = __int16_t; -pub type __uint_least16_t = __uint16_t; -pub type __int_least32_t = __int32_t; -pub type __uint_least32_t = __uint32_t; -pub type __int_least64_t = __int64_t; -pub type __uint_least64_t = __uint64_t; -pub type __quad_t = cty::c_long; -pub type __u_quad_t = cty::c_ulong; -pub type __intmax_t = cty::c_long; -pub type __uintmax_t = cty::c_ulong; -pub type __dev_t = cty::c_ulong; -pub type __uid_t = cty::c_uint; -pub type __gid_t = cty::c_uint; -pub type __ino_t = cty::c_ulong; -pub type __ino64_t = cty::c_ulong; -pub type __mode_t = cty::c_uint; -pub type __nlink_t = cty::c_ulong; -pub type __off_t = cty::c_long; -pub type __off64_t = cty::c_long; -pub type __pid_t = cty::c_int; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct __fsid_t { - pub __val: [cty::c_int; 2usize], -} -#[test] -fn bindgen_test_layout___fsid_t() { - assert_eq!( - ::core::mem::size_of::<__fsid_t>(), - 8usize, - concat!("Size of: ", stringify!(__fsid_t)) - ); - assert_eq!( - ::core::mem::align_of::<__fsid_t>(), - 4usize, - concat!("Alignment of ", stringify!(__fsid_t)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<__fsid_t>())).__val as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__fsid_t), - "::", - stringify!(__val) - ) - ); -} -pub type __clock_t = cty::c_long; -pub type __rlim_t = cty::c_ulong; -pub type __rlim64_t = cty::c_ulong; -pub type __id_t = cty::c_uint; -pub type __time_t = cty::c_long; -pub type __useconds_t = cty::c_uint; -pub type __suseconds_t = cty::c_long; -pub type __daddr_t = cty::c_int; -pub type __key_t = cty::c_int; -pub type __clockid_t = cty::c_int; -pub type __timer_t = *mut cty::c_void; -pub type __blksize_t = cty::c_long; -pub type __blkcnt_t = cty::c_long; -pub type __blkcnt64_t = cty::c_long; -pub type __fsblkcnt_t = cty::c_ulong; -pub type __fsblkcnt64_t = cty::c_ulong; -pub type __fsfilcnt_t = cty::c_ulong; -pub type __fsfilcnt64_t = cty::c_ulong; -pub type __fsword_t = cty::c_long; -pub type __ssize_t = cty::c_long; -pub type __syscall_slong_t = cty::c_long; -pub type __syscall_ulong_t = cty::c_ulong; -#[doc = " These few don't really vary by system, they always correspond"] -#[doc = "to one of the other defined types."] -pub type __loff_t = __off64_t; -pub type __caddr_t = *mut cty::c_char; -pub type __intptr_t = cty::c_long; -pub type __socklen_t = cty::c_uint; -#[doc = " C99: An integer type that can be accessed as an atomic entity,"] -#[doc = "even in the presence of asynchronous interrupts."] -#[doc = "It is not currently necessary for this to be machine-specific."] -pub type __sig_atomic_t = cty::c_int; -extern "C" { - #[doc = " Even though CLOCKS_PER_SEC has such a strange value CLK_TCK"] - #[doc = "presents the real value for clock ticks per second for the system."] - pub fn __sysconf(arg1: cty::c_int) -> cty::c_long; -} -#[doc = " Returned by `clock'."] -pub type clock_t = __clock_t; -#[doc = " Returned by `time'."] -pub type time_t = __time_t; -#[doc = " ISO C `broken-down time' structure."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct tm { - #[doc = " Seconds.\t[0-60] (1 leap second)"] - pub tm_sec: cty::c_int, - #[doc = " Minutes.\t[0-59]"] - pub tm_min: cty::c_int, - #[doc = " Hours.\t[0-23]"] - pub tm_hour: cty::c_int, - #[doc = " Day.\t\t[1-31]"] - pub tm_mday: cty::c_int, - #[doc = " Month.\t[0-11]"] - pub tm_mon: cty::c_int, - #[doc = " Year\t- 1900."] - pub tm_year: cty::c_int, - #[doc = " Day of week.\t[0-6]"] - pub tm_wday: cty::c_int, - #[doc = " Days in year.[0-365]"] - pub tm_yday: cty::c_int, - #[doc = " DST.\t\t[-1/0/1]"] - pub tm_isdst: cty::c_int, - #[doc = " Seconds east of UTC."] - pub __tm_gmtoff: cty::c_long, - #[doc = " Timezone abbreviation."] - pub __tm_zone: *const cty::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) - ) - ); -} -#[doc = " POSIX.1b structure for a time value. This is like a `struct timeval' but"] -#[doc = "has nanoseconds instead of microseconds."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct timespec { - #[doc = " Seconds."] - pub tv_sec: __time_t, - #[doc = " Nanoseconds."] - pub tv_nsec: __syscall_slong_t, -} -#[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) - ) - ); -} -extern "C" { - #[doc = " Time used by the program so far (user time + system time)."] - #[doc = "The result / CLOCKS_PER_SEC is program time in seconds."] - pub fn clock() -> clock_t; -} -extern "C" { - #[doc = " Return the current time and put it in *TIMER if TIMER is not NULL."] - pub fn time(__timer: *mut time_t) -> time_t; -} -extern "C" { - #[doc = " Return the difference between TIME1 and TIME0."] - pub fn difftime(__time1: time_t, __time0: time_t) -> f64; -} -extern "C" { - #[doc = " Return the `time_t' representation of TP and normalize TP."] - pub fn mktime(__tp: *mut tm) -> time_t; -} -extern "C" { - #[doc = " Format TP into S according to FORMAT."] - #[doc = "Write no more than MAXSIZE characters and return the number"] - #[doc = "of characters written, or 0 if it would exceed MAXSIZE."] - pub fn strftime( - __s: *mut cty::c_char, - __maxsize: size_t, - __format: *const cty::c_char, - __tp: *const tm, - ) -> size_t; -} -extern "C" { - #[doc = " Parse S according to FORMAT and store binary time information in TP."] - #[doc = "The return value is a pointer to the first unparsed character in S."] - pub fn strptime( - __s: *const cty::c_char, - __fmt: *const cty::c_char, - __tp: *mut tm, - ) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Return the `struct tm' representation of *TIMER"] - #[doc = "in Universal Coordinated Time (aka Greenwich Mean Time)."] - pub fn gmtime(__timer: *const time_t) -> *mut tm; -} -extern "C" { - #[doc = " Return the `struct tm' representation"] - #[doc = "of *TIMER in the local timezone."] - pub fn localtime(__timer: *const time_t) -> *mut tm; -} -extern "C" { - #[doc = " Return the `struct tm' representation of *TIMER in UTC,"] - #[doc = "using *TP to store the result."] - pub fn gmtime_r(__timer: *const time_t, __tp: *mut tm) -> *mut tm; -} -extern "C" { - #[doc = " Return the `struct tm' representation of *TIMER in local time,"] - #[doc = "using *TP to store the result."] - pub fn localtime_r(__timer: *const time_t, __tp: *mut tm) -> *mut tm; -} -extern "C" { - #[doc = " Return a string of the form \"Day Mon dd hh:mm:ss yyyy\\n\""] - #[doc = "that is the representation of TP in this format."] - pub fn asctime(__tp: *const tm) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Equivalent to `asctime (localtime (timer))'."] - pub fn ctime(__timer: *const time_t) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Return in BUF a string of the form \"Day Mon dd hh:mm:ss yyyy\\n\""] - #[doc = "that is the representation of TP in this format."] - pub fn asctime_r(__tp: *const tm, __buf: *mut cty::c_char) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Equivalent to `asctime_r (localtime_r (timer, *TMP*), buf)'."] - pub fn ctime_r(__timer: *const time_t, __buf: *mut cty::c_char) -> *mut cty::c_char; -} -extern "C" { - pub static mut __tzname: [*mut cty::c_char; 2usize]; -} -extern "C" { - pub static mut __daylight: cty::c_int; -} -extern "C" { - pub static mut __timezone: cty::c_long; -} -extern "C" { - pub static mut tzname: [*mut cty::c_char; 2usize]; -} -extern "C" { - #[doc = " Set time conversion information from the TZ environment variable."] - #[doc = "If TZ is not defined, a locale-dependent default is used."] - pub fn tzset(); -} -extern "C" { - pub static mut daylight: cty::c_int; -} -extern "C" { - pub static mut timezone: cty::c_long; -} -extern "C" { - #[doc = " Set TS to calendar time based in time base BASE."] - pub fn timespec_get(__ts: *mut timespec, __base: cty::c_int) -> cty::c_int; -} -#[doc = " Conversion state information."] -#[repr(C)] -#[derive(Copy, Clone)] -pub struct __mbstate_t { - pub __count: cty::c_int, - #[doc = " Value so far."] - pub __value: __mbstate_t__bindgen_ty_1, -} -#[repr(C)] -#[derive(Copy, Clone)] -pub union __mbstate_t__bindgen_ty_1 { - pub __wch: cty::c_uint, - pub __wchb: [cty::c_char; 4usize], - _bindgen_union_align: u32, -} -#[test] -fn bindgen_test_layout___mbstate_t__bindgen_ty_1() { - assert_eq!( - ::core::mem::size_of::<__mbstate_t__bindgen_ty_1>(), - 4usize, - concat!("Size of: ", stringify!(__mbstate_t__bindgen_ty_1)) - ); - assert_eq!( - ::core::mem::align_of::<__mbstate_t__bindgen_ty_1>(), - 4usize, - concat!("Alignment of ", stringify!(__mbstate_t__bindgen_ty_1)) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::<__mbstate_t__bindgen_ty_1>())).__wch as *const _ as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__mbstate_t__bindgen_ty_1), - "::", - stringify!(__wch) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::<__mbstate_t__bindgen_ty_1>())).__wchb as *const _ as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__mbstate_t__bindgen_ty_1), - "::", - stringify!(__wchb) - ) - ); -} -#[test] -fn bindgen_test_layout___mbstate_t() { - assert_eq!( - ::core::mem::size_of::<__mbstate_t>(), - 8usize, - concat!("Size of: ", stringify!(__mbstate_t)) - ); - assert_eq!( - ::core::mem::align_of::<__mbstate_t>(), - 4usize, - concat!("Alignment of ", stringify!(__mbstate_t)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<__mbstate_t>())).__count as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__mbstate_t), - "::", - stringify!(__count) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<__mbstate_t>())).__value as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(__mbstate_t), - "::", - stringify!(__value) - ) - ); -} -pub type mbstate_t = __mbstate_t; -#[doc = " Define the 16-bit and 32-bit character types."] -pub type char16_t = __uint_least16_t; -pub type char32_t = __uint_least32_t; -extern "C" { - #[doc = " Write char16_t representation of multibyte character pointed"] - #[doc = "to by S to PC16."] - pub fn mbrtoc16( - __pc16: *mut char16_t, - __s: *const cty::c_char, - __n: size_t, - __p: *mut mbstate_t, - ) -> size_t; -} -extern "C" { - #[doc = " Write multibyte representation of char16_t C16 to S."] - pub fn c16rtomb(__s: *mut cty::c_char, __c16: char16_t, __ps: *mut mbstate_t) -> size_t; -} -extern "C" { - #[doc = " Write char32_t representation of multibyte character pointed"] - #[doc = "to by S to PC32."] - pub fn mbrtoc32( - __pc32: *mut char32_t, - __s: *const cty::c_char, - __n: size_t, - __p: *mut mbstate_t, - ) -> size_t; -} -extern "C" { - #[doc = " Write multibyte representation of char32_t C32 to S."] - pub fn c32rtomb(__s: *mut cty::c_char, __c32: char32_t, __ps: *mut mbstate_t) -> size_t; -} -#[doc = " UPPERCASE."] -pub const _ISupper: cty::c_uint = 256; -#[doc = " lowercase."] -pub const _ISlower: cty::c_uint = 512; -#[doc = " Alphabetic."] -pub const _ISalpha: cty::c_uint = 1024; -#[doc = " Numeric."] -pub const _ISdigit: cty::c_uint = 2048; -#[doc = " Hexadecimal numeric."] -pub const _ISxdigit: cty::c_uint = 4096; -#[doc = " Whitespace."] -pub const _ISspace: cty::c_uint = 8192; -#[doc = " Printing."] -pub const _ISprint: cty::c_uint = 16384; -#[doc = " Graphical."] -pub const _ISgraph: cty::c_uint = 32768; -#[doc = " Blank (usually SPC and TAB)."] -pub const _ISblank: cty::c_uint = 1; -#[doc = " Control character."] -pub const _IScntrl: cty::c_uint = 2; -#[doc = " Punctuation."] -pub const _ISpunct: cty::c_uint = 4; -#[doc = " Alphanumeric."] -pub const _ISalnum: cty::c_uint = 8; -pub type _bindgen_ty_1 = cty::c_uint; -extern "C" { - #[doc = " These are defined in ctype-info.c."] - #[doc = "The declarations here must match those in localeinfo.h."] - #[doc = ""] - #[doc = "In the thread-specific locale model (see `uselocale' in )"] - #[doc = "we cannot use global variables for these as was done in the past."] - #[doc = "Instead, the following accessor functions return the address of"] - #[doc = "each variable, which is local to the current thread if multithreaded."] - #[doc = ""] - #[doc = "These point into arrays of 384, so they can be indexed by any `unsigned"] - #[doc = "char' value [0,255]; by EOF (-1); or by any `signed char' value"] - #[doc = "[-128,-1). ISO C requires that the ctype functions work for `unsigned"] - #[doc = "char' values and for EOF; we also support negative `signed char' values"] - #[doc = "for broken old programs. The case conversion arrays are of `int's"] - #[doc = "rather than `unsigned char's because tolower (EOF) must be EOF, which"] - #[doc = "doesn't fit into an `unsigned char'. But today more important is that"] - #[doc = "the arrays are also used for multi-byte character sets."] - pub fn __ctype_b_loc() -> *mut *const cty::c_ushort; -} -extern "C" { - pub fn __ctype_tolower_loc() -> *mut *const __int32_t; -} -extern "C" { - pub fn __ctype_toupper_loc() -> *mut *const __int32_t; -} -extern "C" { - pub fn isalnum(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn isalpha(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn iscntrl(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn isdigit(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn islower(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn isgraph(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn isprint(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn ispunct(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn isspace(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn isupper(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn isxdigit(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Return the lowercase version of C."] - pub fn tolower(__c: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Return the uppercase version of C."] - pub fn toupper(__c: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn isblank(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Return nonzero iff C is in the ASCII set"] - #[doc = "(i.e., is no more than 7 bits wide)."] - pub fn isascii(__c: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Return the part of C that is in the ASCII set"] - #[doc = "(i.e., the low-order 7 bits of C)."] - pub fn toascii(__c: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn _toupper(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn _tolower(arg1: cty::c_int) -> cty::c_int; -} -pub type _Float32 = f32; -pub type _Float64 = f64; -pub type _Float32x = f64; -pub type _Float64x = u128; -pub type wchar_t = cty::c_int; -pub type va_list = __builtin_va_list; -pub type __gnuc_va_list = __builtin_va_list; -pub type wint_t = cty::c_uint; -pub type __FILE = _IO_FILE; -#[doc = " Scalar type that can hold values which represent locale-specific"] -#[doc = "character classifications."] -pub type wctype_t = cty::c_ulong; -#[doc = " UPPERCASE."] -pub const __ISwupper: cty::c_int = 0; -#[doc = " lowercase."] -pub const __ISwlower: cty::c_int = 1; -#[doc = " Alphabetic."] -pub const __ISwalpha: cty::c_int = 2; -#[doc = " Numeric."] -pub const __ISwdigit: cty::c_int = 3; -#[doc = " Hexadecimal numeric."] -pub const __ISwxdigit: cty::c_int = 4; -#[doc = " Whitespace."] -pub const __ISwspace: cty::c_int = 5; -#[doc = " Printing."] -pub const __ISwprint: cty::c_int = 6; -#[doc = " Graphical."] -pub const __ISwgraph: cty::c_int = 7; -#[doc = " Blank (usually SPC and TAB)."] -pub const __ISwblank: cty::c_int = 8; -#[doc = " Control character."] -pub const __ISwcntrl: cty::c_int = 9; -#[doc = " Punctuation."] -pub const __ISwpunct: cty::c_int = 10; -#[doc = " Alphanumeric."] -pub const __ISwalnum: cty::c_int = 11; -#[doc = " UPPERCASE."] -pub const _ISwupper: cty::c_int = 16777216; -#[doc = " lowercase."] -pub const _ISwlower: cty::c_int = 33554432; -#[doc = " Alphabetic."] -pub const _ISwalpha: cty::c_int = 67108864; -#[doc = " Numeric."] -pub const _ISwdigit: cty::c_int = 134217728; -#[doc = " Hexadecimal numeric."] -pub const _ISwxdigit: cty::c_int = 268435456; -#[doc = " Whitespace."] -pub const _ISwspace: cty::c_int = 536870912; -#[doc = " Printing."] -pub const _ISwprint: cty::c_int = 1073741824; -#[doc = " Graphical."] -pub const _ISwgraph: cty::c_int = -2147483648; -#[doc = " Blank (usually SPC and TAB)."] -pub const _ISwblank: cty::c_int = 65536; -#[doc = " Control character."] -pub const _ISwcntrl: cty::c_int = 131072; -#[doc = " Punctuation."] -pub const _ISwpunct: cty::c_int = 262144; -#[doc = " Alphanumeric."] -pub const _ISwalnum: cty::c_int = 524288; -pub type _bindgen_ty_2 = cty::c_int; -extern "C" { - #[doc = " Test for any wide character for which `iswalpha' or `iswdigit' is"] - #[doc = "true."] - pub fn iswalnum(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any wide character for which `iswupper' or 'iswlower' is"] - #[doc = "true, or any wide character that is one of a locale-specific set of"] - #[doc = "wide-characters for which none of `iswcntrl', `iswdigit',"] - #[doc = "`iswpunct', or `iswspace' is true."] - pub fn iswalpha(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any control wide character."] - pub fn iswcntrl(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any wide character that corresponds to a decimal-digit"] - #[doc = "character."] - pub fn iswdigit(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any wide character for which `iswprint' is true and"] - #[doc = "`iswspace' is false."] - pub fn iswgraph(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any wide character that corresponds to a lowercase letter"] - #[doc = "or is one of a locale-specific set of wide characters for which"] - #[doc = "none of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true."] - pub fn iswlower(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any printing wide character."] - pub fn iswprint(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any printing wide character that is one of a"] - #[doc = "locale-specific et of wide characters for which neither `iswspace'"] - #[doc = "nor `iswalnum' is true."] - pub fn iswpunct(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any wide character that corresponds to a locale-specific"] - #[doc = "set of wide characters for which none of `iswalnum', `iswgraph', or"] - #[doc = "`iswpunct' is true."] - pub fn iswspace(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any wide character that corresponds to an uppercase letter"] - #[doc = "or is one of a locale-specific set of wide character for which none"] - #[doc = "of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true."] - pub fn iswupper(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any wide character that corresponds to a hexadecimal-digit"] - #[doc = "character equivalent to that performed be the functions described"] - #[doc = "in the previous subclause."] - pub fn iswxdigit(__wc: wint_t) -> cty::c_int; -} -extern "C" { - pub fn iswblank(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Construct value that describes a class of wide characters identified"] - #[doc = "by the string argument PROPERTY."] - pub fn wctype(__property: *const cty::c_char) -> wctype_t; -} -extern "C" { - #[doc = " Determine whether the wide-character WC has the property described by"] - #[doc = "DESC."] - pub fn iswctype(__wc: wint_t, __desc: wctype_t) -> cty::c_int; -} -extern "C" { - #[doc = " Converts an uppercase letter to the corresponding lowercase letter."] - pub fn towlower(__wc: wint_t) -> wint_t; -} -extern "C" { - #[doc = " Converts an lowercase letter to the corresponding uppercase letter."] - pub fn towupper(__wc: wint_t) -> wint_t; -} -extern "C" { - #[doc = " Copy SRC to DEST."] - pub fn wcscpy(__dest: *mut wchar_t, __src: *const wchar_t) -> *mut wchar_t; -} -extern "C" { - #[doc = " Copy no more than N wide-characters of SRC to DEST."] - pub fn wcsncpy(__dest: *mut wchar_t, __src: *const wchar_t, __n: size_t) -> *mut wchar_t; -} -extern "C" { - #[doc = " Append SRC onto DEST."] - pub fn wcscat(__dest: *mut wchar_t, __src: *const wchar_t) -> *mut wchar_t; -} -extern "C" { - #[doc = " Append no more than N wide-characters of SRC onto DEST."] - pub fn wcsncat(__dest: *mut wchar_t, __src: *const wchar_t, __n: size_t) -> *mut wchar_t; -} -extern "C" { - #[doc = " Compare S1 and S2."] - pub fn wcscmp(__s1: *const cty::c_int, __s2: *const cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Compare N wide-characters of S1 and S2."] - pub fn wcsncmp( - __s1: *const cty::c_int, - __s2: *const cty::c_int, - __n: cty::c_ulong, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Compare S1 and S2, both interpreted as appropriate to the"] - #[doc = "LC_COLLATE category of the current locale."] - pub fn wcscoll(__s1: *const wchar_t, __s2: *const wchar_t) -> cty::c_int; -} -extern "C" { - #[doc = " Transform S2 into array pointed to by S1 such that if wcscmp is"] - #[doc = "applied to two transformed strings the result is the as applying"] - #[doc = "`wcscoll' to the original strings."] - pub fn wcsxfrm(__s1: *mut wchar_t, __s2: *const wchar_t, __n: size_t) -> size_t; -} -extern "C" { - pub fn wcschr(__wcs: *const cty::c_int, __wc: cty::c_int) -> *mut cty::c_int; -} -extern "C" { - pub fn wcsrchr(__wcs: *const wchar_t, __wc: wchar_t) -> *mut wchar_t; -} -extern "C" { - #[doc = " Return the length of the initial segmet of WCS which"] - #[doc = "consists entirely of wide characters not in REJECT."] - pub fn wcscspn(__wcs: *const wchar_t, __reject: *const wchar_t) -> size_t; -} -extern "C" { - #[doc = " Return the length of the initial segmet of WCS which"] - #[doc = "consists entirely of wide characters in ACCEPT."] - pub fn wcsspn(__wcs: *const wchar_t, __accept: *const wchar_t) -> size_t; -} -extern "C" { - pub fn wcspbrk(__wcs: *const wchar_t, __accept: *const wchar_t) -> *mut wchar_t; -} -extern "C" { - pub fn wcsstr(__haystack: *const wchar_t, __needle: *const wchar_t) -> *mut wchar_t; -} -extern "C" { - #[doc = " Divide WCS into tokens separated by characters in DELIM."] - pub fn wcstok( - __s: *mut wchar_t, - __delim: *const wchar_t, - __ptr: *mut *mut wchar_t, - ) -> *mut wchar_t; -} -extern "C" { - #[doc = " Return the number of wide characters in S."] - pub fn wcslen(__s: *const cty::c_int) -> cty::c_ulong; -} -extern "C" { - pub fn wcswcs(__haystack: *const wchar_t, __needle: *const wchar_t) -> *mut wchar_t; -} -extern "C" { - pub fn wmemchr(__s: *const cty::c_int, __c: cty::c_int, __n: cty::c_ulong) -> *mut cty::c_int; -} -extern "C" { - #[doc = " Compare N wide characters of S1 and S2."] - pub fn wmemcmp( - __s1: *const cty::c_int, - __s2: *const cty::c_int, - __n: cty::c_ulong, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Copy N wide characters of SRC to DEST."] - pub fn wmemcpy( - __s1: *mut cty::c_int, - __s2: *const cty::c_int, - __n: cty::c_ulong, - ) -> *mut cty::c_int; -} -extern "C" { - #[doc = " Copy N wide characters of SRC to DEST, guaranteeing"] - #[doc = "correct behavior for overlapping strings."] - pub fn wmemmove( - __s1: *mut cty::c_int, - __s2: *const cty::c_int, - __n: cty::c_ulong, - ) -> *mut cty::c_int; -} -extern "C" { - #[doc = " Set N wide characters of S to C."] - pub fn wmemset(__s: *mut wchar_t, __c: wchar_t, __n: size_t) -> *mut wchar_t; -} -extern "C" { - #[doc = " Determine whether C constitutes a valid (one-byte) multibyte"] - #[doc = "character."] - pub fn btowc(__c: cty::c_int) -> wint_t; -} -extern "C" { - #[doc = " Determine whether C corresponds to a member of the extended"] - #[doc = "character set whose multibyte representation is a single byte."] - pub fn wctob(__c: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Determine whether PS points to an object representing the initial"] - #[doc = "state."] - pub fn mbsinit(__ps: *const mbstate_t) -> cty::c_int; -} -extern "C" { - #[doc = " Write wide character representation of multibyte character pointed"] - #[doc = "to by S to PWC."] - pub fn mbrtowc( - __pwc: *mut wchar_t, - __s: *const cty::c_char, - __n: size_t, - __p: *mut mbstate_t, - ) -> size_t; -} -extern "C" { - #[doc = " Write multibyte representation of wide character WC to S."] - pub fn wcrtomb(__s: *mut cty::c_char, __wc: wchar_t, __ps: *mut mbstate_t) -> size_t; -} -extern "C" { - #[doc = " Return number of bytes in multibyte character pointed to by S."] - pub fn __mbrlen(__s: *const cty::c_char, __n: size_t, __ps: *mut mbstate_t) -> size_t; -} -extern "C" { - pub fn mbrlen(__s: *const cty::c_char, __n: size_t, __ps: *mut mbstate_t) -> size_t; -} -extern "C" { - #[doc = " Write wide character representation of multibyte character string"] - #[doc = "SRC to DST."] - pub fn mbsrtowcs( - __dst: *mut wchar_t, - __src: *mut *const cty::c_char, - __len: size_t, - __ps: *mut mbstate_t, - ) -> size_t; -} -extern "C" { - #[doc = " Write multibyte character representation of wide character string"] - #[doc = "SRC to DST."] - pub fn wcsrtombs( - __dst: *mut cty::c_char, - __src: *mut *const wchar_t, - __len: size_t, - __ps: *mut mbstate_t, - ) -> size_t; -} -extern "C" { - #[doc = " Determine number of column positions required for C."] - pub fn wcwidth(__c: wchar_t) -> cty::c_int; -} -extern "C" { - #[doc = " Determine number of column positions required for first N wide"] - #[doc = "characters (or fewer if S ends before this) in S."] - pub fn wcswidth(__s: *const wchar_t, __n: size_t) -> cty::c_int; -} -extern "C" { - #[doc = " Convert initial portion of the wide string NPTR to `double'"] - #[doc = "representation."] - pub fn wcstod(__nptr: *const wchar_t, __endptr: *mut *mut wchar_t) -> f64; -} -extern "C" { - #[doc = " Likewise for `float' and `long double' sizes of floating-point numbers."] - pub fn wcstof(__nptr: *const wchar_t, __endptr: *mut *mut wchar_t) -> f32; -} -extern "C" { - #[doc = " Convert initial portion of wide string NPTR to `long int'"] - #[doc = "representation."] - pub fn wcstol( - __nptr: *const wchar_t, - __endptr: *mut *mut wchar_t, - __base: cty::c_int, - ) -> cty::c_long; -} -extern "C" { - #[doc = " Convert initial portion of wide string NPTR to `unsigned long int'"] - #[doc = "representation."] - pub fn wcstoul( - __nptr: *const wchar_t, - __endptr: *mut *mut wchar_t, - __base: cty::c_int, - ) -> cty::c_ulong; -} -extern "C" { - #[doc = " Convert initial portion of wide string NPTR to `long long int'"] - #[doc = "representation."] - pub fn wcstoll( - __nptr: *const wchar_t, - __endptr: *mut *mut wchar_t, - __base: cty::c_int, - ) -> cty::c_longlong; -} -extern "C" { - #[doc = " Convert initial portion of wide string NPTR to `unsigned long long int'"] - #[doc = "representation."] - pub fn wcstoull( - __nptr: *const wchar_t, - __endptr: *mut *mut wchar_t, - __base: cty::c_int, - ) -> cty::c_ulonglong; -} -extern "C" { - #[doc = " Select orientation for stream."] - pub fn fwide(__fp: *mut __FILE, __mode: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fwprintf(__stream: *mut __FILE, __format: *const wchar_t, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to stdout."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn wprintf(__format: *const wchar_t, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output of at most N characters to S."] - pub fn swprintf(__s: *mut wchar_t, __n: size_t, __format: *const wchar_t, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to S from argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn vfwprintf( - __s: *mut __FILE, - __format: *const wchar_t, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to stdout from argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn vwprintf(__format: *const wchar_t, __arg: *mut __va_list_tag) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output of at most N character to S from argument"] - #[doc = "list ARG."] - pub fn vswprintf( - __s: *mut wchar_t, - __n: size_t, - __format: *const wchar_t, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fwscanf(__stream: *mut __FILE, __format: *const wchar_t, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from stdin."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn wscanf(__format: *const wchar_t, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S."] - pub fn swscanf(__s: *const wchar_t, __format: *const wchar_t, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - #[link_name = "\u{1}__isoc99_fwscanf"] - pub fn fwscanf1(__stream: *mut __FILE, __format: *const wchar_t, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from stdin."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - #[link_name = "\u{1}__isoc99_wscanf"] - pub fn wscanf1(__format: *const wchar_t, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S."] - #[link_name = "\u{1}__isoc99_swscanf"] - pub fn swscanf1(__s: *const wchar_t, __format: *const wchar_t, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S into argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn vfwscanf( - __s: *mut __FILE, - __format: *const wchar_t, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from stdin into argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn vwscanf(__format: *const wchar_t, __arg: *mut __va_list_tag) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S into argument list ARG."] - pub fn vswscanf( - __s: *const wchar_t, - __format: *const wchar_t, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Read a character from STREAM."] - #[doc = ""] - #[doc = "These functions are possible cancellation points and therefore not"] - #[doc = "marked with __THROW."] - pub fn fgetwc(__stream: *mut __FILE) -> wint_t; -} -extern "C" { - pub fn getwc(__stream: *mut __FILE) -> wint_t; -} -extern "C" { - #[doc = " Read a character from stdin."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn getwchar() -> wint_t; -} -extern "C" { - #[doc = " Write a character to STREAM."] - #[doc = ""] - #[doc = "These functions are possible cancellation points and therefore not"] - #[doc = "marked with __THROW."] - pub fn fputwc(__wc: wchar_t, __stream: *mut __FILE) -> wint_t; -} -extern "C" { - pub fn putwc(__wc: wchar_t, __stream: *mut __FILE) -> wint_t; -} -extern "C" { - #[doc = " Write a character to stdout."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn putwchar(__wc: wchar_t) -> wint_t; -} -extern "C" { - #[doc = " Get a newline-terminated wide character string of finite length"] - #[doc = "from STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fgetws(__ws: *mut wchar_t, __n: cty::c_int, __stream: *mut __FILE) -> *mut wchar_t; -} -extern "C" { - #[doc = " Write a string to STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fputws(__ws: *const wchar_t, __stream: *mut __FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Push a character back onto the input buffer of STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn ungetwc(__wc: wint_t, __stream: *mut __FILE) -> wint_t; -} -extern "C" { - #[doc = " Format TP into S according to FORMAT."] - #[doc = "Write no more than MAXSIZE wide characters and return the number"] - #[doc = "of wide characters written, or 0 if it would exceed MAXSIZE."] - pub fn wcsftime( - __s: *mut wchar_t, - __maxsize: size_t, - __format: *const wchar_t, - __tp: *const tm, - ) -> size_t; -} -#[doc = " The tag name of this struct is _G_fpos_t to preserve historic"] -#[doc = "C++ mangled names for functions taking fpos_t arguments."] -#[doc = "That name should not be used in new code."] -#[repr(C)] -#[derive(Copy, Clone)] -pub struct _G_fpos_t { - pub __pos: __off_t, - pub __state: __mbstate_t, -} -#[test] -fn bindgen_test_layout__G_fpos_t() { - assert_eq!( - ::core::mem::size_of::<_G_fpos_t>(), - 16usize, - concat!("Size of: ", stringify!(_G_fpos_t)) - ); - assert_eq!( - ::core::mem::align_of::<_G_fpos_t>(), - 8usize, - concat!("Alignment of ", stringify!(_G_fpos_t)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_G_fpos_t>())).__pos as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(_G_fpos_t), - "::", - stringify!(__pos) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_G_fpos_t>())).__state as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(_G_fpos_t), - "::", - stringify!(__state) - ) - ); -} -#[doc = " The tag name of this struct is _G_fpos_t to preserve historic"] -#[doc = "C++ mangled names for functions taking fpos_t arguments."] -#[doc = "That name should not be used in new code."] -pub type __fpos_t = _G_fpos_t; -#[doc = " The tag name of this struct is _G_fpos64_t to preserve historic"] -#[doc = "C++ mangled names for functions taking fpos_t and/or fpos64_t"] -#[doc = "arguments. That name should not be used in new code."] -#[repr(C)] -#[derive(Copy, Clone)] -pub struct _G_fpos64_t { - pub __pos: __off64_t, - pub __state: __mbstate_t, -} -#[test] -fn bindgen_test_layout__G_fpos64_t() { - assert_eq!( - ::core::mem::size_of::<_G_fpos64_t>(), - 16usize, - concat!("Size of: ", stringify!(_G_fpos64_t)) - ); - assert_eq!( - ::core::mem::align_of::<_G_fpos64_t>(), - 8usize, - concat!("Alignment of ", stringify!(_G_fpos64_t)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_G_fpos64_t>())).__pos as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(_G_fpos64_t), - "::", - stringify!(__pos) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_G_fpos64_t>())).__state as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(_G_fpos64_t), - "::", - stringify!(__state) - ) - ); -} -#[doc = " The tag name of this struct is _G_fpos64_t to preserve historic"] -#[doc = "C++ mangled names for functions taking fpos_t and/or fpos64_t"] -#[doc = "arguments. That name should not be used in new code."] -pub type __fpos64_t = _G_fpos64_t; -#[doc = " The opaque type of streams. This is the definition used elsewhere."] -pub type FILE = _IO_FILE; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct _IO_marker { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct _IO_codecvt { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct _IO_wide_data { - _unused: [u8; 0], -} -pub type _IO_lock_t = cty::c_void; -#[doc = " The tag name of this struct is _IO_FILE to preserve historic"] -#[doc = "C++ mangled names for functions taking FILE* arguments."] -#[doc = "That name should not be used in new code."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct _IO_FILE { - #[doc = " High-order word is _IO_MAGIC; rest is flags."] - pub _flags: cty::c_int, - #[doc = " Current read pointer"] - pub _IO_read_ptr: *mut cty::c_char, - #[doc = " End of get area."] - pub _IO_read_end: *mut cty::c_char, - #[doc = " Start of putback+get area."] - pub _IO_read_base: *mut cty::c_char, - #[doc = " Start of put area."] - pub _IO_write_base: *mut cty::c_char, - #[doc = " Current put pointer."] - pub _IO_write_ptr: *mut cty::c_char, - #[doc = " End of put area."] - pub _IO_write_end: *mut cty::c_char, - #[doc = " Start of reserve area."] - pub _IO_buf_base: *mut cty::c_char, - #[doc = " End of reserve area."] - pub _IO_buf_end: *mut cty::c_char, - #[doc = " Pointer to start of non-current get area."] - pub _IO_save_base: *mut cty::c_char, - #[doc = " Pointer to first valid character of backup area"] - pub _IO_backup_base: *mut cty::c_char, - #[doc = " Pointer to end of non-current get area."] - pub _IO_save_end: *mut cty::c_char, - pub _markers: *mut _IO_marker, - pub _chain: *mut _IO_FILE, - pub _fileno: cty::c_int, - pub _flags2: cty::c_int, - #[doc = " This used to be _offset but it's too small."] - pub _old_offset: __off_t, - #[doc = " 1+column number of pbase(); 0 is unknown."] - pub _cur_column: cty::c_ushort, - pub _vtable_offset: cty::c_schar, - pub _shortbuf: [cty::c_char; 1usize], - pub _lock: *mut _IO_lock_t, - pub _offset: __off64_t, - #[doc = " Wide character stream stuff."] - pub _codecvt: *mut _IO_codecvt, - pub _wide_data: *mut _IO_wide_data, - pub _freeres_list: *mut _IO_FILE, - pub _freeres_buf: *mut cty::c_void, - pub __pad5: size_t, - pub _mode: cty::c_int, - #[doc = " Make sure we don't get into trouble again."] - pub _unused2: [cty::c_char; 20usize], -} -#[test] -fn bindgen_test_layout__IO_FILE() { - assert_eq!( - ::core::mem::size_of::<_IO_FILE>(), - 216usize, - concat!("Size of: ", stringify!(_IO_FILE)) - ); - assert_eq!( - ::core::mem::align_of::<_IO_FILE>(), - 8usize, - concat!("Alignment of ", stringify!(_IO_FILE)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._flags as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_flags) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_read_ptr as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_read_ptr) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_read_end as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_read_end) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_read_base as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_read_base) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_write_base as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_write_base) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_write_ptr as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_write_ptr) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_write_end as *const _ as usize }, - 48usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_write_end) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_buf_base as *const _ as usize }, - 56usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_buf_base) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_buf_end as *const _ as usize }, - 64usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_buf_end) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_save_base as *const _ as usize }, - 72usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_save_base) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_backup_base as *const _ as usize }, - 80usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_backup_base) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_save_end as *const _ as usize }, - 88usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_save_end) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._markers as *const _ as usize }, - 96usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_markers) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._chain as *const _ as usize }, - 104usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_chain) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._fileno as *const _ as usize }, - 112usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_fileno) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._flags2 as *const _ as usize }, - 116usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_flags2) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._old_offset as *const _ as usize }, - 120usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_old_offset) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._cur_column as *const _ as usize }, - 128usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_cur_column) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._vtable_offset as *const _ as usize }, - 130usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_vtable_offset) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._shortbuf as *const _ as usize }, - 131usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_shortbuf) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._lock as *const _ as usize }, - 136usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_lock) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._offset as *const _ as usize }, - 144usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_offset) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._codecvt as *const _ as usize }, - 152usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_codecvt) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._wide_data as *const _ as usize }, - 160usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_wide_data) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._freeres_list as *const _ as usize }, - 168usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_freeres_list) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._freeres_buf as *const _ as usize }, - 176usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_freeres_buf) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>())).__pad5 as *const _ as usize }, - 184usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(__pad5) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._mode as *const _ as usize }, - 192usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_mode) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._unused2 as *const _ as usize }, - 196usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_unused2) - ) - ); -} -pub type fpos_t = __fpos_t; -extern "C" { - pub static mut stdin: *mut FILE; -} -extern "C" { - pub static mut stdout: *mut FILE; -} -extern "C" { - pub static mut stderr: *mut FILE; -} -extern "C" { - #[doc = " Remove file FILENAME."] - pub fn remove(__filename: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Rename file OLD to NEW."] - pub fn rename(__old: *const cty::c_char, __new: *const cty::c_char) -> cty::c_int; -} -extern "C" { - pub fn tmpfile() -> *mut FILE; -} -extern "C" { - #[doc = " Generate a temporary filename."] - pub fn tmpnam(__s: *mut cty::c_char) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Generate a unique temporary filename using up to five characters of PFX"] - #[doc = "if it is not NULL. The directory to put this file in is searched for"] - #[doc = "as follows: First the environment variable \"TMPDIR\" is checked."] - #[doc = "If it contains the name of a writable directory, that directory is used."] - #[doc = "If not and if DIR is not NULL, that value is checked. If that fails,"] - #[doc = "P_tmpdir is tried and finally \"/tmp\". The storage for the filename"] - #[doc = "is allocated by `malloc'."] - pub fn tempnam(__dir: *const cty::c_char, __pfx: *const cty::c_char) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Close STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fclose(__stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Flush STREAM, or all streams if STREAM is NULL."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fflush(__stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Open a file and create a new stream for it."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fopen(__filename: *const cty::c_char, __modes: *const cty::c_char) -> *mut FILE; -} -extern "C" { - #[doc = " Open a file, replacing an existing stream with it."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn freopen( - __filename: *const cty::c_char, - __modes: *const cty::c_char, - __stream: *mut FILE, - ) -> *mut FILE; -} -extern "C" { - #[doc = " Create a new stream that refers to an existing system file descriptor."] - pub fn fdopen(__fd: cty::c_int, __modes: *const cty::c_char) -> *mut FILE; -} -extern "C" { - #[doc = " If BUF is NULL, make STREAM unbuffered."] - #[doc = "Else make it use buffer BUF, of size BUFSIZ."] - pub fn setbuf(__stream: *mut FILE, __buf: *mut cty::c_char); -} -extern "C" { - #[doc = " Make STREAM use buffering mode MODE."] - #[doc = "If BUF is not NULL, use N bytes of it for buffering;"] - #[doc = "else allocate an internal buffer N bytes long."] - pub fn setvbuf( - __stream: *mut FILE, - __buf: *mut cty::c_char, - __modes: cty::c_int, - __n: size_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fprintf(__stream: *mut FILE, __format: *const cty::c_char, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to stdout."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn printf(__format: *const cty::c_char, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to S."] - pub fn sprintf(__s: *mut cty::c_char, __format: *const cty::c_char, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to S from argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn vfprintf( - __s: *mut FILE, - __format: *const cty::c_char, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to stdout from argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn vprintf(__format: *const cty::c_char, __arg: *mut __va_list_tag) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to S from argument list ARG."] - pub fn vsprintf( - __s: *mut cty::c_char, - __format: *const cty::c_char, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Maximum chars of output to write in MAXLEN."] - pub fn snprintf( - __s: *mut cty::c_char, - __maxlen: cty::c_ulong, - __format: *const cty::c_char, - ... - ) -> cty::c_int; -} -extern "C" { - pub fn vsnprintf( - __s: *mut cty::c_char, - __maxlen: cty::c_ulong, - __format: *const cty::c_char, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fscanf(__stream: *mut FILE, __format: *const cty::c_char, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from stdin."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn scanf(__format: *const cty::c_char, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S."] - pub fn sscanf(__s: *const cty::c_char, __format: *const cty::c_char, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - #[link_name = "\u{1}__isoc99_fscanf"] - pub fn fscanf1(__stream: *mut FILE, __format: *const cty::c_char, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from stdin."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - #[link_name = "\u{1}__isoc99_scanf"] - pub fn scanf1(__format: *const cty::c_char, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S."] - #[link_name = "\u{1}__isoc99_sscanf"] - pub fn sscanf1(__s: *const cty::c_char, __format: *const cty::c_char, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S into argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn vfscanf( - __s: *mut FILE, - __format: *const cty::c_char, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from stdin into argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn vscanf(__format: *const cty::c_char, __arg: *mut __va_list_tag) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S into argument list ARG."] - pub fn vsscanf( - __s: *const cty::c_char, - __format: *const cty::c_char, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S into argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - #[link_name = "\u{1}__isoc99_vfscanf"] - pub fn vfscanf1( - __s: *mut FILE, - __format: *const cty::c_char, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from stdin into argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - #[link_name = "\u{1}__isoc99_vscanf"] - pub fn vscanf1(__format: *const cty::c_char, __arg: *mut __va_list_tag) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S into argument list ARG."] - #[link_name = "\u{1}__isoc99_vsscanf"] - pub fn vsscanf1( - __s: *const cty::c_char, - __format: *const cty::c_char, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Read a character from STREAM."] - #[doc = ""] - #[doc = "These functions are possible cancellation points and therefore not"] - #[doc = "marked with __THROW."] - pub fn fgetc(__stream: *mut FILE) -> cty::c_int; -} -extern "C" { - pub fn getc(__stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Read a character from stdin."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn getchar() -> cty::c_int; -} -extern "C" { - #[doc = " Write a character to STREAM."] - #[doc = ""] - #[doc = "These functions are possible cancellation points and therefore not"] - #[doc = "marked with __THROW."] - #[doc = ""] - #[doc = "These functions is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fputc(__c: cty::c_int, __stream: *mut FILE) -> cty::c_int; -} -extern "C" { - pub fn putc(__c: cty::c_int, __stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Write a character to stdout."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn putchar(__c: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Get a word (int) from STREAM."] - pub fn getw(__stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Write a word (int) to STREAM."] - pub fn putw(__w: cty::c_int, __stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Get a newline-terminated string of finite length from STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fgets(__s: *mut cty::c_char, __n: cty::c_int, __stream: *mut FILE) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Write a string to STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fputs(__s: *const cty::c_char, __stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Write a string, followed by a newline, to stdout."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn puts(__s: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Push a character back onto the input buffer of STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn ungetc(__c: cty::c_int, __stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Read chunks of generic data from STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fread( - __ptr: *mut cty::c_void, - __size: cty::c_ulong, - __n: cty::c_ulong, - __stream: *mut FILE, - ) -> cty::c_ulong; -} -extern "C" { - #[doc = " Write chunks of generic data to STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fwrite( - __ptr: *const cty::c_void, - __size: cty::c_ulong, - __n: cty::c_ulong, - __s: *mut FILE, - ) -> cty::c_ulong; -} -extern "C" { - #[doc = " Seek to a certain position on STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fseek(__stream: *mut FILE, __off: cty::c_long, __whence: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Return the current position of STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn ftell(__stream: *mut FILE) -> cty::c_long; -} -extern "C" { - #[doc = " Rewind to the beginning of STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn rewind(__stream: *mut FILE); -} -extern "C" { - #[doc = " Get STREAM's position."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fgetpos(__stream: *mut FILE, __pos: *mut fpos_t) -> cty::c_int; -} -extern "C" { - #[doc = " Set STREAM's position."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fsetpos(__stream: *mut FILE, __pos: *const fpos_t) -> cty::c_int; -} -extern "C" { - #[doc = " Clear the error and EOF indicators for STREAM."] - pub fn clearerr(__stream: *mut FILE); -} -extern "C" { - #[doc = " Return the EOF indicator for STREAM."] - pub fn feof(__stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Return the error indicator for STREAM."] - pub fn ferror(__stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Print a message describing the meaning of the value of errno."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn perror(__s: *const cty::c_char); -} -extern "C" { - #[doc = " Return the system file descriptor for STREAM."] - pub fn fileno(__stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Create a new stream connected to a pipe running the given command."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn popen(__command: *const cty::c_char, __modes: *const cty::c_char) -> *mut FILE; -} -extern "C" { - #[doc = " Close a stream opened by popen and return the status of its child."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn pclose(__stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Return the name of the controlling terminal."] - pub fn ctermid(__s: *mut cty::c_char) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Return the name of the current user."] - pub fn cuserid(__s: *mut cty::c_char) -> *mut cty::c_char; -} -extern "C" { - pub static mut optarg: *mut cty::c_char; -} -extern "C" { - pub static mut optind: cty::c_int; -} -extern "C" { - pub static mut opterr: cty::c_int; -} -extern "C" { - pub static mut optopt: cty::c_int; -} -extern "C" { - #[doc = " Get definitions and prototypes for functions to process the"] - #[doc = "arguments in ARGV (ARGC of them, minus the program name) for"] - #[doc = "options given in OPTS."] - #[doc = ""] - #[doc = "Return the option character from OPTS just read. Return -1 when"] - #[doc = "there are no more options. For unrecognized options, or options"] - #[doc = "missing arguments, 'optopt' is set to the option letter, and '?' is"] - #[doc = "returned."] - #[doc = ""] - #[doc = "The OPTS string is a list of characters which are recognized option"] - #[doc = "letters, optionally followed by colons, specifying that that letter"] - #[doc = "takes an argument, to be placed in 'optarg'."] - #[doc = ""] - #[doc = "If a letter in OPTS is followed by two colons, its argument is"] - #[doc = "optional. This behavior is specific to the GNU 'getopt'."] - #[doc = ""] - #[doc = "The argument '--' causes premature termination of argument"] - #[doc = "scanning, explicitly telling 'getopt' that there are no more"] - #[doc = "options."] - #[doc = ""] - #[doc = "If OPTS begins with '-', then non-option arguments are treated as"] - #[doc = "arguments to the option '\\1'. This behavior is specific to the GNU"] - #[doc = "'getopt'. If OPTS begins with '+', or POSIXLY_CORRECT is set in"] - #[doc = "the environment, then do not permute arguments."] - #[doc = ""] - #[doc = "For standards compliance, the 'argv' argument has the type"] - #[doc = "char *const *, but this is inaccurate; if argument permutation is"] - #[doc = "enabled, the argv array (not the strings it points to) must be"] - #[doc = "writable."] - pub fn getopt( - ___argc: cty::c_int, - ___argv: *const *mut cty::c_char, - __shortopts: *const cty::c_char, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Slow-path routines used by the optimized inline functions in"] - #[doc = "bits/stdio.h."] - pub fn __uflow(arg1: *mut FILE) -> cty::c_int; -} -extern "C" { - pub fn __overflow(arg1: *mut FILE, arg2: cty::c_int) -> cty::c_int; -} -#[doc = " Signed."] -pub type int_least8_t = __int_least8_t; -pub type int_least16_t = __int_least16_t; -pub type int_least32_t = __int_least32_t; -pub type int_least64_t = __int_least64_t; -#[doc = " Unsigned."] -pub type uint_least8_t = __uint_least8_t; -pub type uint_least16_t = __uint_least16_t; -pub type uint_least32_t = __uint_least32_t; -pub type uint_least64_t = __uint_least64_t; -#[doc = " Signed."] -pub type int_fast8_t = cty::c_schar; -pub type int_fast16_t = cty::c_long; -pub type int_fast32_t = cty::c_long; -pub type int_fast64_t = cty::c_long; -#[doc = " Unsigned."] -pub type uint_fast8_t = cty::c_uchar; -pub type uint_fast16_t = cty::c_ulong; -pub type uint_fast32_t = cty::c_ulong; -pub type uint_fast64_t = cty::c_ulong; -#[doc = " Largest integral types."] -pub type intmax_t = __intmax_t; -pub type uintmax_t = __uintmax_t; -#[doc = " Returned by `div'."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct div_t { - #[doc = " Quotient."] - pub quot: cty::c_int, - #[doc = " Remainder."] - pub rem: cty::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) - ) - ); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ldiv_t { - #[doc = " Quotient."] - pub quot: cty::c_long, - #[doc = " Remainder."] - pub rem: cty::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) - ) - ); -} -#[doc = " Returned by `lldiv'."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct lldiv_t { - #[doc = " Quotient."] - pub quot: cty::c_longlong, - #[doc = " Remainder."] - pub rem: cty::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) - ) - ); -} -extern "C" { - pub fn __ctype_get_mb_cur_max() -> size_t; -} -extern "C" { - #[doc = " Convert a string to a floating-point number."] - pub fn atof(__nptr: *const cty::c_char) -> f64; -} -extern "C" { - #[doc = " Convert a string to an integer."] - pub fn atoi(__nptr: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Convert a string to a long integer."] - pub fn atol(__nptr: *const cty::c_char) -> cty::c_long; -} -extern "C" { - #[doc = " Convert a string to a long long integer."] - pub fn atoll(__nptr: *const cty::c_char) -> cty::c_longlong; -} -extern "C" { - #[doc = " Convert a string to a floating-point number."] - pub fn strtod(__nptr: *const cty::c_char, __endptr: *mut *mut cty::c_char) -> f64; -} -extern "C" { - #[doc = " Likewise for `float' and `long double' sizes of floating-point numbers."] - pub fn strtof(__nptr: *const cty::c_char, __endptr: *mut *mut cty::c_char) -> f32; -} -extern "C" { - #[doc = " Convert a string to a long integer."] - pub fn strtol( - __nptr: *const cty::c_char, - __endptr: *mut *mut cty::c_char, - __base: cty::c_int, - ) -> cty::c_long; -} -extern "C" { - #[doc = " Convert a string to an unsigned long integer."] - pub fn strtoul( - __nptr: *const cty::c_char, - __endptr: *mut *mut cty::c_char, - __base: cty::c_int, - ) -> cty::c_ulong; -} -extern "C" { - #[doc = " Convert a string to a quadword integer."] - pub fn strtoll( - __nptr: *const cty::c_char, - __endptr: *mut *mut cty::c_char, - __base: cty::c_int, - ) -> cty::c_longlong; -} -extern "C" { - #[doc = " Convert a string to an unsigned quadword integer."] - pub fn strtoull( - __nptr: *const cty::c_char, - __endptr: *mut *mut cty::c_char, - __base: cty::c_int, - ) -> cty::c_ulonglong; -} -extern "C" { - #[doc = " Return a random integer between 0 and RAND_MAX inclusive."] - pub fn rand() -> cty::c_int; -} -extern "C" { - #[doc = " Seed the random number generator with the given number."] - pub fn srand(__seed: cty::c_uint); -} -extern "C" { - #[doc = " Return non-negative, double-precision floating-point value in [0.0,1.0)."] - pub fn drand48() -> f64; -} -extern "C" { - pub fn erand48(__xsubi: *mut cty::c_ushort) -> f64; -} -extern "C" { - #[doc = " Return non-negative, long integer in [0,2^31)."] - pub fn lrand48() -> cty::c_long; -} -extern "C" { - pub fn nrand48(__xsubi: *mut cty::c_ushort) -> cty::c_long; -} -extern "C" { - #[doc = " Return signed, long integers in [-2^31,2^31)."] - pub fn mrand48() -> cty::c_long; -} -extern "C" { - pub fn jrand48(__xsubi: *mut cty::c_ushort) -> cty::c_long; -} -extern "C" { - #[doc = " Seed random number generator."] - pub fn srand48(__seedval: cty::c_long); -} -extern "C" { - pub fn seed48(__seed16v: *mut cty::c_ushort) -> *mut cty::c_ushort; -} -extern "C" { - pub fn lcong48(__param: *mut cty::c_ushort); -} -extern "C" { - #[doc = " Allocate SIZE bytes of memory."] - pub fn malloc(__size: cty::c_ulong) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Allocate NMEMB elements of SIZE bytes each, all initialized to 0."] - pub fn calloc(__nmemb: cty::c_ulong, __size: cty::c_ulong) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Re-allocate the previously allocated block"] - #[doc = "in PTR, making the new block SIZE bytes long. */"] - #[doc = "the same pointer that was passed to it, aliasing needs to be allowed"] - #[doc = "between objects pointed by the old and new pointers."] - pub fn realloc(__ptr: *mut cty::c_void, __size: cty::c_ulong) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Free a block allocated by `malloc', `realloc' or `calloc'."] - pub fn free(__ptr: *mut cty::c_void); -} -extern "C" { - #[doc = " ISO C variant of aligned allocation."] - pub fn aligned_alloc(__alignment: size_t, __size: size_t) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Abort execution and generate a core-dump."] - pub fn abort(); -} -extern "C" { - #[doc = " Register a function to be called when `exit' is called."] - pub fn atexit(__func: ::core::option::Option) -> cty::c_int; -} -extern "C" { - pub fn at_quick_exit(__func: ::core::option::Option) -> cty::c_int; -} -extern "C" { - #[doc = " Call all functions registered with `atexit' and `on_exit',"] - #[doc = "in the reverse of the order in which they were registered,"] - #[doc = "perform stdio cleanup, and terminate program execution with STATUS."] - pub fn exit(__status: cty::c_int); -} -extern "C" { - #[doc = " Call all functions registered with `at_quick_exit' in the reverse"] - #[doc = "of the order in which they were registered and terminate program"] - #[doc = "execution with STATUS."] - pub fn quick_exit(__status: cty::c_int); -} -extern "C" { - #[doc = " Terminate the program with STATUS without calling any of the"] - #[doc = "functions registered with `atexit' or `on_exit'."] - pub fn _Exit(__status: cty::c_int); -} -extern "C" { - #[doc = " Return the value of envariable NAME, or NULL if it doesn't exist."] - pub fn getenv(__name: *const cty::c_char) -> *mut cty::c_char; -} -extern "C" { - #[doc = " The SVID says this is in , but this seems a better place.\t*/"] - #[doc = "If there is no `=', remove NAME from the environment."] - pub fn putenv(__string: *mut cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Execute the given line as a shell command."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn system(__command: *const cty::c_char) -> cty::c_int; -} -pub type __compar_fn_t = ::core::option::Option< - unsafe extern "C" fn(arg1: *const cty::c_void, arg2: *const cty::c_void) -> cty::c_int, ->; -extern "C" { - #[doc = " Do a binary search for KEY in BASE, which consists of NMEMB elements"] - #[doc = "of SIZE bytes each, using COMPAR to perform the comparisons."] - pub fn bsearch( - __key: *const cty::c_void, - __base: *const cty::c_void, - __nmemb: size_t, - __size: size_t, - __compar: __compar_fn_t, - ) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Sort NMEMB elements of BASE, of SIZE bytes each,"] - #[doc = "using COMPAR to perform the comparisons."] - pub fn qsort( - __base: *mut cty::c_void, - __nmemb: size_t, - __size: size_t, - __compar: __compar_fn_t, - ); -} -extern "C" { - #[doc = " Return the absolute value of X."] - pub fn abs(__x: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn labs(__x: cty::c_long) -> cty::c_long; -} -extern "C" { - pub fn llabs(__x: cty::c_longlong) -> cty::c_longlong; -} -extern "C" { - #[doc = " Return the `div_t', `ldiv_t' or `lldiv_t' representation"] - #[doc = "of the value of NUMER over DENOM. */"] - pub fn div(__numer: cty::c_int, __denom: cty::c_int) -> div_t; -} -extern "C" { - pub fn ldiv(__numer: cty::c_long, __denom: cty::c_long) -> ldiv_t; -} -extern "C" { - pub fn lldiv(__numer: cty::c_longlong, __denom: cty::c_longlong) -> lldiv_t; -} -extern "C" { - #[doc = " Return the length of the multibyte character"] - #[doc = "in S, which is no longer than N."] - pub fn mblen(__s: *const cty::c_char, __n: size_t) -> cty::c_int; -} -extern "C" { - #[doc = " Return the length of the given multibyte character,"] - #[doc = "putting its `wchar_t' representation in *PWC."] - pub fn mbtowc(__pwc: *mut wchar_t, __s: *const cty::c_char, __n: size_t) -> cty::c_int; -} -extern "C" { - #[doc = " Put the multibyte character represented"] - #[doc = "by WCHAR in S, returning its length."] - pub fn wctomb(__s: *mut cty::c_char, __wchar: wchar_t) -> cty::c_int; -} -extern "C" { - #[doc = " Convert a multibyte string to a wide char string."] - pub fn mbstowcs(__pwcs: *mut wchar_t, __s: *const cty::c_char, __n: size_t) -> size_t; -} -extern "C" { - #[doc = " Convert a wide char string to multibyte string."] - pub fn wcstombs(__s: *mut cty::c_char, __pwcs: *const wchar_t, __n: size_t) -> size_t; -} -extern "C" { - #[doc = " Copy N bytes of SRC to DEST."] - pub fn memcpy( - __dest: *mut cty::c_void, - __src: *const cty::c_void, - __n: cty::c_ulong, - ) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Copy N bytes of SRC to DEST, guaranteeing"] - #[doc = "correct behavior for overlapping strings."] - pub fn memmove( - __dest: *mut cty::c_void, - __src: *const cty::c_void, - __n: cty::c_ulong, - ) -> *mut cty::c_void; -} -extern "C" { - pub fn memccpy( - __dest: *mut cty::c_void, - __src: *const cty::c_void, - __c: cty::c_int, - __n: cty::c_ulong, - ) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Set N bytes of S to C."] - pub fn memset(__s: *mut cty::c_void, __c: cty::c_int, __n: cty::c_ulong) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Compare N bytes of S1 and S2."] - pub fn memcmp( - __s1: *const cty::c_void, - __s2: *const cty::c_void, - __n: cty::c_ulong, - ) -> cty::c_int; -} -extern "C" { - pub fn memchr(__s: *const cty::c_void, __c: cty::c_int, __n: cty::c_ulong) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Copy SRC to DEST."] - pub fn strcpy(__dest: *mut cty::c_char, __src: *const cty::c_char) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Copy no more than N characters of SRC to DEST."] - pub fn strncpy( - __dest: *mut cty::c_char, - __src: *const cty::c_char, - __n: cty::c_ulong, - ) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Append SRC onto DEST."] - pub fn strcat(__dest: *mut cty::c_char, __src: *const cty::c_char) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Append no more than N characters from SRC onto DEST."] - pub fn strncat( - __dest: *mut cty::c_char, - __src: *const cty::c_char, - __n: cty::c_ulong, - ) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Compare S1 and S2."] - pub fn strcmp(__s1: *const cty::c_char, __s2: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Compare N characters of S1 and S2."] - pub fn strncmp( - __s1: *const cty::c_char, - __s2: *const cty::c_char, - __n: cty::c_ulong, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Compare the collated forms of S1 and S2."] - pub fn strcoll(__s1: *const cty::c_char, __s2: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Put a transformation of SRC into no more than N bytes of DEST."] - pub fn strxfrm( - __dest: *mut cty::c_char, - __src: *const cty::c_char, - __n: cty::c_ulong, - ) -> cty::c_ulong; -} -extern "C" { - pub fn strchr(__s: *const cty::c_char, __c: cty::c_int) -> *mut cty::c_char; -} -extern "C" { - pub fn strrchr(__s: *const cty::c_char, __c: cty::c_int) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Return the length of the initial segment of S which"] - #[doc = "consists entirely of characters not in REJECT."] - pub fn strcspn(__s: *const cty::c_char, __reject: *const cty::c_char) -> cty::c_ulong; -} -extern "C" { - #[doc = " Return the length of the initial segment of S which"] - #[doc = "consists entirely of characters in ACCEPT."] - pub fn strspn(__s: *const cty::c_char, __accept: *const cty::c_char) -> cty::c_ulong; -} -extern "C" { - pub fn strpbrk(__s: *const cty::c_char, __accept: *const cty::c_char) -> *mut cty::c_char; -} -extern "C" { - pub fn strstr(__haystack: *const cty::c_char, __needle: *const cty::c_char) - -> *mut cty::c_char; -} -extern "C" { - #[doc = " Divide S into tokens separated by characters in DELIM."] - pub fn strtok(__s: *mut cty::c_char, __delim: *const cty::c_char) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Divide S into tokens separated by characters in DELIM. Information"] - #[doc = "passed between calls are stored in SAVE_PTR."] - pub fn __strtok_r( - __s: *mut cty::c_char, - __delim: *const cty::c_char, - __save_ptr: *mut *mut cty::c_char, - ) -> *mut cty::c_char; -} -extern "C" { - pub fn strtok_r( - __s: *mut cty::c_char, - __delim: *const cty::c_char, - __save_ptr: *mut *mut cty::c_char, - ) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Return the length of S."] - pub fn strlen(__s: *const cty::c_char) -> cty::c_ulong; -} -extern "C" { - #[doc = " Return a string describing the meaning of the `errno' code in ERRNUM."] - pub fn strerror(__errnum: cty::c_int) -> *mut cty::c_char; -} -#[doc = " An integral type that can be modified atomically, without the"] -#[doc = "possibility of a signal arriving in the middle of the operation."] -pub type sig_atomic_t = __sig_atomic_t; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct __sigset_t { - pub __val: [cty::c_ulong; 16usize], -} -#[test] -fn bindgen_test_layout___sigset_t() { - assert_eq!( - ::core::mem::size_of::<__sigset_t>(), - 128usize, - concat!("Size of: ", stringify!(__sigset_t)) - ); - assert_eq!( - ::core::mem::align_of::<__sigset_t>(), - 8usize, - concat!("Alignment of ", stringify!(__sigset_t)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<__sigset_t>())).__val as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__sigset_t), - "::", - stringify!(__val) - ) - ); -} -#[doc = " A set of signals to be blocked, unblocked, or waited for."] -pub type sigset_t = __sigset_t; -pub type pid_t = __pid_t; -pub type uid_t = __uid_t; -#[doc = " Type of a signal handler."] -pub type __sighandler_t = ::core::option::Option; -extern "C" { - #[doc = " The X/Open definition of `signal' specifies the SVID semantic. Use"] - #[doc = "the additional function `sysv_signal' when X/Open compatibility is"] - #[doc = "requested."] - pub fn __sysv_signal(__sig: cty::c_int, __handler: __sighandler_t) -> __sighandler_t; -} -extern "C" { - pub fn kill(__pid: __pid_t, __sig: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Raise signal SIG, i.e., send SIG to yourself."] - pub fn raise(__sig: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Clear all signals from SET."] - pub fn sigemptyset(__set: *mut sigset_t) -> cty::c_int; -} -extern "C" { - #[doc = " Set all signals in SET."] - pub fn sigfillset(__set: *mut sigset_t) -> cty::c_int; -} -extern "C" { - #[doc = " Add SIGNO to SET."] - pub fn sigaddset(__set: *mut sigset_t, __signo: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Remove SIGNO from SET."] - pub fn sigdelset(__set: *mut sigset_t, __signo: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Return 1 if SIGNO is in SET, 0 if not."] - pub fn sigismember(__set: *const sigset_t, __signo: cty::c_int) -> cty::c_int; -} -#[doc = " Structure describing the action to be taken when a signal arrives."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct sigaction { - pub sa_handler: __sighandler_t, - #[doc = " Additional set of signals to be blocked."] - pub sa_mask: __sigset_t, - #[doc = " Special flags."] - pub sa_flags: cty::c_int, - #[doc = " Restore handler."] - pub sa_restorer: ::core::option::Option, -} -#[test] -fn bindgen_test_layout_sigaction() { - assert_eq!( - ::core::mem::size_of::(), - 152usize, - concat!("Size of: ", stringify!(sigaction)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(sigaction)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sa_handler as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(sigaction), - "::", - stringify!(sa_handler) - ) - ); - 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 }, - 136usize, - concat!( - "Offset of field: ", - stringify!(sigaction), - "::", - stringify!(sa_flags) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sa_restorer as *const _ as usize }, - 144usize, - concat!( - "Offset of field: ", - stringify!(sigaction), - "::", - stringify!(sa_restorer) - ) - ); -} -extern "C" { - #[doc = " Get and/or change the set of blocked signals."] - pub fn sigprocmask( - __how: cty::c_int, - __set: *const sigset_t, - __oset: *mut sigset_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Change the set of blocked signals to SET,"] - #[doc = "wait until a signal arrives, and restore the set of blocked signals."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn sigsuspend(__set: *const sigset_t) -> cty::c_int; -} -extern "C" { - #[doc = " Get and/or set the action for signal SIG."] - pub fn sigaction( - __sig: cty::c_int, - __act: *const sigaction, - __oact: *mut sigaction, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Put in SET all signals that are blocked and waiting to be delivered."] - pub fn sigpending(__set: *mut sigset_t) -> cty::c_int; -} -extern "C" { - #[doc = " Return number of available real-time signal with highest priority."] - pub fn __libc_current_sigrtmin() -> cty::c_int; -} -extern "C" { - #[doc = " Return number of available real-time signal with lowest priority."] - pub fn __libc_current_sigrtmax() -> cty::c_int; -} -#[doc = " Structure for scatter/gather I/O."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct iovec { - #[doc = " Pointer to data."] - pub iov_base: *mut cty::c_void, - #[doc = " Length of data."] - pub iov_len: size_t, -} -#[test] -fn bindgen_test_layout_iovec() { - assert_eq!( - ::core::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(iovec)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(iovec)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).iov_base as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(iovec), - "::", - stringify!(iov_base) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).iov_len as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(iovec), - "::", - stringify!(iov_len) - ) - ); -} -pub type ino_t = __ino_t; -pub type dev_t = __dev_t; -pub type gid_t = __gid_t; -pub type mode_t = __mode_t; -pub type nlink_t = __nlink_t; -pub type off_t = __off_t; -pub type id_t = __id_t; -pub type ssize_t = __ssize_t; -pub type key_t = __key_t; -#[doc = " Clock ID used in clock and timer functions."] -pub type clockid_t = __clockid_t; -#[doc = " Timer ID returned by `timer_create'."] -pub type timer_t = __timer_t; -pub type useconds_t = __useconds_t; -pub type suseconds_t = __suseconds_t; -#[doc = " These were defined by ISO C without the first `_'."] -pub type u_int8_t = __uint8_t; -pub type u_int16_t = __uint16_t; -pub type u_int32_t = __uint32_t; -pub type u_int64_t = __uint64_t; -pub type register_t = cty::c_long; -pub type blkcnt_t = __blkcnt_t; -pub type fsblkcnt_t = __fsblkcnt_t; -pub type fsfilcnt_t = __fsfilcnt_t; -pub type socklen_t = __socklen_t; -#[doc = " Sequenced, reliable, connection-based"] -#[doc = "byte streams."] -pub const __socket_type_SOCK_STREAM: __socket_type = 1; -#[doc = " Connectionless, unreliable datagrams"] -#[doc = "of fixed maximum length."] -pub const __socket_type_SOCK_DGRAM: __socket_type = 2; -#[doc = " Raw protocol interface."] -pub const __socket_type_SOCK_RAW: __socket_type = 3; -#[doc = " Reliably-delivered messages."] -pub const __socket_type_SOCK_RDM: __socket_type = 4; -#[doc = " Sequenced, reliable, connection-based,"] -#[doc = "datagrams of fixed maximum length."] -pub const __socket_type_SOCK_SEQPACKET: __socket_type = 5; -#[doc = " Datagram Congestion Control Protocol."] -pub const __socket_type_SOCK_DCCP: __socket_type = 6; -#[doc = " Linux specific way of getting packets"] -#[doc = "at the dev level. For writing rarp and"] -#[doc = "other similar things on the user level."] -pub const __socket_type_SOCK_PACKET: __socket_type = 10; -#[doc = " Atomically set close-on-exec flag for the"] -#[doc = "new descriptor(s)."] -pub const __socket_type_SOCK_CLOEXEC: __socket_type = 524288; -#[doc = " Atomically mark descriptor(s) as"] -#[doc = "non-blocking."] -pub const __socket_type_SOCK_NONBLOCK: __socket_type = 2048; -#[doc = " Types of sockets."] -pub type __socket_type = cty::c_uint; -#[doc = " POSIX.1g specifies this type name for the `sa_family' member."] -pub type sa_family_t = cty::c_ushort; -#[doc = " Structure describing a generic socket address."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct sockaddr { - pub sa_family: sa_family_t, - #[doc = " Address data."] - pub sa_data: [cty::c_char; 14usize], -} -#[test] -fn bindgen_test_layout_sockaddr() { - assert_eq!( - ::core::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(sockaddr)) - ); - assert_eq!( - ::core::mem::align_of::(), - 2usize, - concat!("Alignment of ", stringify!(sockaddr)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sa_family as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(sockaddr), - "::", - stringify!(sa_family) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sa_data as *const _ as usize }, - 2usize, - concat!( - "Offset of field: ", - stringify!(sockaddr), - "::", - stringify!(sa_data) - ) - ); -} -#[repr(C)] -#[derive(Copy, Clone)] -pub struct sockaddr_storage { - pub ss_family: sa_family_t, - pub __ss_padding: [cty::c_char; 118usize], - #[doc = " Force desired alignment."] - pub __ss_align: cty::c_ulong, -} -#[test] -fn bindgen_test_layout_sockaddr_storage() { - assert_eq!( - ::core::mem::size_of::(), - 128usize, - concat!("Size of: ", stringify!(sockaddr_storage)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(sockaddr_storage)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).ss_family as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_storage), - "::", - stringify!(ss_family) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).__ss_padding as *const _ as usize }, - 2usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_storage), - "::", - stringify!(__ss_padding) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).__ss_align as *const _ as usize }, - 120usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_storage), - "::", - stringify!(__ss_align) - ) - ); -} -#[doc = " Process out-of-band data."] -pub const MSG_OOB: cty::c_uint = 1; -#[doc = " Peek at incoming messages."] -pub const MSG_PEEK: cty::c_uint = 2; -#[doc = " Don't use local routing."] -pub const MSG_DONTROUTE: cty::c_uint = 4; -#[doc = " Control data lost before delivery."] -pub const MSG_CTRUNC: cty::c_uint = 8; -#[doc = " Supply or ask second address."] -pub const MSG_PROXY: cty::c_uint = 16; -pub const MSG_TRUNC: cty::c_uint = 32; -#[doc = " Nonblocking IO."] -pub const MSG_DONTWAIT: cty::c_uint = 64; -#[doc = " End of record."] -pub const MSG_EOR: cty::c_uint = 128; -#[doc = " Wait for a full request."] -pub const MSG_WAITALL: cty::c_uint = 256; -pub const MSG_FIN: cty::c_uint = 512; -pub const MSG_SYN: cty::c_uint = 1024; -#[doc = " Confirm path validity."] -pub const MSG_CONFIRM: cty::c_uint = 2048; -pub const MSG_RST: cty::c_uint = 4096; -#[doc = " Fetch message from error queue."] -pub const MSG_ERRQUEUE: cty::c_uint = 8192; -#[doc = " Do not generate SIGPIPE."] -pub const MSG_NOSIGNAL: cty::c_uint = 16384; -#[doc = " Sender will send more."] -pub const MSG_MORE: cty::c_uint = 32768; -#[doc = " Wait for at least one packet to return."] -pub const MSG_WAITFORONE: cty::c_uint = 65536; -#[doc = " sendmmsg: more messages coming."] -pub const MSG_BATCH: cty::c_uint = 262144; -#[doc = " Use user data in kernel path."] -pub const MSG_ZEROCOPY: cty::c_uint = 67108864; -#[doc = " Send data in TCP SYN."] -pub const MSG_FASTOPEN: cty::c_uint = 536870912; -#[doc = " Set close_on_exit for file"] -#[doc = "descriptor received through"] -#[doc = "SCM_RIGHTS."] -pub const MSG_CMSG_CLOEXEC: cty::c_uint = 1073741824; -#[doc = " Bits in the FLAGS argument to `send', `recv', et al."] -pub type _bindgen_ty_3 = cty::c_uint; -#[doc = " Structure describing messages sent by"] -#[doc = "`sendmsg' and received by `recvmsg'."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct msghdr { - #[doc = " Address to send to/receive from."] - pub msg_name: *mut cty::c_void, - #[doc = " Length of address data."] - pub msg_namelen: socklen_t, - #[doc = " Vector of data to send/receive into."] - pub msg_iov: *mut iovec, - #[doc = " Number of elements in the vector."] - pub msg_iovlen: size_t, - #[doc = " Ancillary data (eg BSD filedesc passing)."] - pub msg_control: *mut cty::c_void, - #[doc = " Ancillary data buffer length."] - #[doc = " The type should be socklen_t but the"] - #[doc = "definition of the kernel is incompatible"] - #[doc = "with this."] - pub msg_controllen: size_t, - #[doc = " Flags on received message."] - pub msg_flags: cty::c_int, -} -#[test] -fn bindgen_test_layout_msghdr() { - assert_eq!( - ::core::mem::size_of::(), - 56usize, - concat!("Size of: ", stringify!(msghdr)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(msghdr)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).msg_name as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(msghdr), - "::", - stringify!(msg_name) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).msg_namelen as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(msghdr), - "::", - stringify!(msg_namelen) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).msg_iov as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(msghdr), - "::", - stringify!(msg_iov) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).msg_iovlen as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(msghdr), - "::", - stringify!(msg_iovlen) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).msg_control as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(msghdr), - "::", - stringify!(msg_control) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).msg_controllen as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(msghdr), - "::", - stringify!(msg_controllen) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).msg_flags as *const _ as usize }, - 48usize, - concat!( - "Offset of field: ", - stringify!(msghdr), - "::", - stringify!(msg_flags) - ) - ); -} -#[doc = " Structure used for storage of ancillary data object information."] -#[repr(C)] -#[derive(Debug)] -pub struct cmsghdr { - #[doc = " Length of data in cmsg_data plus length"] - #[doc = "of cmsghdr structure."] - #[doc = " The type should be socklen_t but the"] - #[doc = "definition of the kernel is incompatible"] - #[doc = "with this."] - pub cmsg_len: size_t, - #[doc = " Originating protocol."] - pub cmsg_level: cty::c_int, - #[doc = " Protocol specific type."] - pub cmsg_type: cty::c_int, - #[doc = " Ancillary data."] - pub __cmsg_data: __IncompleteArrayField, -} -#[test] -fn bindgen_test_layout_cmsghdr() { - assert_eq!( - ::core::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(cmsghdr)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(cmsghdr)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).cmsg_len as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(cmsghdr), - "::", - stringify!(cmsg_len) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).cmsg_level as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(cmsghdr), - "::", - stringify!(cmsg_level) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).cmsg_type as *const _ as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(cmsghdr), - "::", - stringify!(cmsg_type) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).__cmsg_data as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(cmsghdr), - "::", - stringify!(__cmsg_data) - ) - ); -} -extern "C" { - pub fn __cmsg_nxthdr(__mhdr: *mut msghdr, __cmsg: *mut cmsghdr) -> *mut cmsghdr; -} -#[doc = " Transfer file descriptors."] -pub const SCM_RIGHTS: cty::c_uint = 1; -#[doc = " Socket level message types. This must match the definitions in"] -#[doc = "."] -pub type _bindgen_ty_4 = cty::c_uint; -#[doc = " Structure used to manipulate the SO_LINGER option."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct linger { - #[doc = " Nonzero to linger on close."] - pub l_onoff: cty::c_int, - #[doc = " Time to linger."] - pub l_linger: cty::c_int, -} -#[test] -fn bindgen_test_layout_linger() { - assert_eq!( - ::core::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(linger)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(linger)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).l_onoff as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(linger), - "::", - stringify!(l_onoff) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).l_linger as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(linger), - "::", - stringify!(l_linger) - ) - ); -} -#[doc = " No more receptions."] -pub const SHUT_RD: cty::c_uint = 0; -#[doc = " No more transmissions."] -pub const SHUT_WR: cty::c_uint = 1; -#[doc = " No more receptions or transmissions."] -pub const SHUT_RDWR: cty::c_uint = 2; -#[doc = " The following constants should be used for the second parameter of"] -#[doc = "`shutdown'."] -pub type _bindgen_ty_5 = cty::c_uint; -extern "C" { - #[doc = " Create a new socket of type TYPE in domain DOMAIN, using"] - #[doc = "protocol PROTOCOL. If PROTOCOL is zero, one is chosen automatically."] - #[doc = "Returns a file descriptor for the new socket, or -1 for errors."] - pub fn socket(__domain: cty::c_int, __type: cty::c_int, __protocol: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Create two new sockets, of type TYPE in domain DOMAIN and using"] - #[doc = "protocol PROTOCOL, which are connected to each other, and put file"] - #[doc = "descriptors for them in FDS[0] and FDS[1]. If PROTOCOL is zero,"] - #[doc = "one will be chosen automatically. Returns 0 on success, -1 for errors."] - pub fn socketpair( - __domain: cty::c_int, - __type: cty::c_int, - __protocol: cty::c_int, - __fds: *mut cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Give the socket FD the local address ADDR (which is LEN bytes long)."] - pub fn bind(__fd: cty::c_int, __addr: *const sockaddr, __len: socklen_t) -> cty::c_int; -} -extern "C" { - #[doc = " Put the local address of FD into *ADDR and its length in *LEN."] - pub fn getsockname( - __fd: cty::c_int, - __addr: *mut sockaddr, - __len: *mut socklen_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Open a connection on socket FD to peer at ADDR (which LEN bytes long)."] - #[doc = "For connectionless socket types, just set the default address to send to"] - #[doc = "and the only address from which to accept transmissions."] - #[doc = "Return 0 on success, -1 for errors."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn connect(__fd: cty::c_int, __addr: *const sockaddr, __len: socklen_t) -> cty::c_int; -} -extern "C" { - #[doc = " Put the address of the peer connected to socket FD into *ADDR"] - #[doc = "(which is *LEN bytes long), and its actual length into *LEN."] - pub fn getpeername( - __fd: cty::c_int, - __addr: *mut sockaddr, - __len: *mut socklen_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Send N bytes of BUF to socket FD. Returns the number sent or -1."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn send( - __fd: cty::c_int, - __buf: *const cty::c_void, - __n: size_t, - __flags: cty::c_int, - ) -> ssize_t; -} -extern "C" { - #[doc = " Read N bytes into BUF from socket FD."] - #[doc = "Returns the number read or -1 for errors."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn recv( - __fd: cty::c_int, - __buf: *mut cty::c_void, - __n: size_t, - __flags: cty::c_int, - ) -> ssize_t; -} -extern "C" { - #[doc = " Send N bytes of BUF on socket FD to peer at address ADDR (which is"] - #[doc = "ADDR_LEN bytes long). Returns the number sent, or -1 for errors."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn sendto( - __fd: cty::c_int, - __buf: *const cty::c_void, - __n: size_t, - __flags: cty::c_int, - __addr: *const sockaddr, - __addr_len: socklen_t, - ) -> ssize_t; -} -extern "C" { - #[doc = " Read N bytes into BUF through socket FD."] - #[doc = "If ADDR is not NULL, fill in *ADDR_LEN bytes of it with tha address of"] - #[doc = "the sender, and store the actual size of the address in *ADDR_LEN."] - #[doc = "Returns the number of bytes read or -1 for errors."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn recvfrom( - __fd: cty::c_int, - __buf: *mut cty::c_void, - __n: size_t, - __flags: cty::c_int, - __addr: *mut sockaddr, - __addr_len: *mut socklen_t, - ) -> ssize_t; -} -extern "C" { - #[doc = " Send a message described MESSAGE on socket FD."] - #[doc = "Returns the number of bytes sent, or -1 for errors."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn sendmsg(__fd: cty::c_int, __message: *const msghdr, __flags: cty::c_int) -> ssize_t; -} -extern "C" { - #[doc = " Receive a message as described by MESSAGE from socket FD."] - #[doc = "Returns the number of bytes read or -1 for errors."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn recvmsg(__fd: cty::c_int, __message: *mut msghdr, __flags: cty::c_int) -> ssize_t; -} -extern "C" { - #[doc = " Put the current value for socket FD's option OPTNAME at protocol level LEVEL"] - #[doc = "into OPTVAL (which is *OPTLEN bytes long), and set *OPTLEN to the value's"] - #[doc = "actual length. Returns 0 on success, -1 for errors."] - pub fn getsockopt( - __fd: cty::c_int, - __level: cty::c_int, - __optname: cty::c_int, - __optval: *mut cty::c_void, - __optlen: *mut socklen_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Set socket FD's option OPTNAME at protocol level LEVEL"] - #[doc = "to *OPTVAL (which is OPTLEN bytes long)."] - #[doc = "Returns 0 on success, -1 for errors."] - pub fn setsockopt( - __fd: cty::c_int, - __level: cty::c_int, - __optname: cty::c_int, - __optval: *const cty::c_void, - __optlen: socklen_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Prepare to accept connections on socket FD."] - #[doc = "N connection requests will be queued before further requests are refused."] - #[doc = "Returns 0 on success, -1 for errors."] - pub fn listen(__fd: cty::c_int, __n: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Await a connection on socket FD."] - #[doc = "When a connection arrives, open a new socket to communicate with it,"] - #[doc = "set *ADDR (which is *ADDR_LEN bytes long) to the address of the connecting"] - #[doc = "peer and *ADDR_LEN to the address's actual length, and return the"] - #[doc = "new socket's descriptor, or -1 for errors."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn accept( - __fd: cty::c_int, - __addr: *mut sockaddr, - __addr_len: *mut socklen_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Shut down all or part of the connection open on socket FD."] - #[doc = "HOW determines what to shut down:"] - #[doc = "SHUT_RD = No more receptions;"] - #[doc = "SHUT_WR = No more transmissions;"] - #[doc = "SHUT_RDWR = No more receptions or transmissions."] - #[doc = "Returns 0 on success, -1 for errors."] - pub fn shutdown(__fd: cty::c_int, __how: cty::c_int) -> cty::c_int; -} -#[doc = " Internet address."] -pub type in_addr_t = u32; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct in_addr { - pub s_addr: in_addr_t, -} -#[test] -fn bindgen_test_layout_in_addr() { - assert_eq!( - ::core::mem::size_of::(), - 4usize, - concat!("Size of: ", stringify!(in_addr)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(in_addr)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).s_addr as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(in_addr), - "::", - stringify!(s_addr) - ) - ); -} -#[doc = " Dummy protocol for TCP."] -pub const IPPROTO_IP: cty::c_uint = 0; -#[doc = " Internet Control Message Protocol."] -pub const IPPROTO_ICMP: cty::c_uint = 1; -#[doc = " Internet Group Management Protocol."] -pub const IPPROTO_IGMP: cty::c_uint = 2; -#[doc = " IPIP tunnels (older KA9Q tunnels use 94)."] -pub const IPPROTO_IPIP: cty::c_uint = 4; -#[doc = " Transmission Control Protocol."] -pub const IPPROTO_TCP: cty::c_uint = 6; -#[doc = " Exterior Gateway Protocol."] -pub const IPPROTO_EGP: cty::c_uint = 8; -#[doc = " PUP protocol."] -pub const IPPROTO_PUP: cty::c_uint = 12; -#[doc = " User Datagram Protocol."] -pub const IPPROTO_UDP: cty::c_uint = 17; -#[doc = " XNS IDP protocol."] -pub const IPPROTO_IDP: cty::c_uint = 22; -#[doc = " SO Transport Protocol Class 4."] -pub const IPPROTO_TP: cty::c_uint = 29; -#[doc = " Datagram Congestion Control Protocol."] -pub const IPPROTO_DCCP: cty::c_uint = 33; -#[doc = " IPv6 header."] -pub const IPPROTO_IPV6: cty::c_uint = 41; -#[doc = " Reservation Protocol."] -pub const IPPROTO_RSVP: cty::c_uint = 46; -#[doc = " General Routing Encapsulation."] -pub const IPPROTO_GRE: cty::c_uint = 47; -#[doc = " encapsulating security payload."] -pub const IPPROTO_ESP: cty::c_uint = 50; -#[doc = " authentication header."] -pub const IPPROTO_AH: cty::c_uint = 51; -#[doc = " Multicast Transport Protocol."] -pub const IPPROTO_MTP: cty::c_uint = 92; -#[doc = " IP option pseudo header for BEET."] -pub const IPPROTO_BEETPH: cty::c_uint = 94; -#[doc = " Encapsulation Header."] -pub const IPPROTO_ENCAP: cty::c_uint = 98; -#[doc = " Protocol Independent Multicast."] -pub const IPPROTO_PIM: cty::c_uint = 103; -#[doc = " Compression Header Protocol."] -pub const IPPROTO_COMP: cty::c_uint = 108; -#[doc = " Stream Control Transmission Protocol."] -pub const IPPROTO_SCTP: cty::c_uint = 132; -#[doc = " UDP-Lite protocol."] -pub const IPPROTO_UDPLITE: cty::c_uint = 136; -#[doc = " MPLS in IP."] -pub const IPPROTO_MPLS: cty::c_uint = 137; -#[doc = " Raw IP packets."] -pub const IPPROTO_RAW: cty::c_uint = 255; -pub const IPPROTO_MAX: cty::c_uint = 256; -#[doc = " Standard well-defined IP protocols."] -pub type _bindgen_ty_6 = cty::c_uint; -#[doc = " IPv6 Hop-by-Hop options."] -pub const IPPROTO_HOPOPTS: cty::c_uint = 0; -#[doc = " IPv6 routing header."] -pub const IPPROTO_ROUTING: cty::c_uint = 43; -#[doc = " IPv6 fragmentation header."] -pub const IPPROTO_FRAGMENT: cty::c_uint = 44; -#[doc = " ICMPv6."] -pub const IPPROTO_ICMPV6: cty::c_uint = 58; -#[doc = " IPv6 no next header."] -pub const IPPROTO_NONE: cty::c_uint = 59; -#[doc = " IPv6 destination options."] -pub const IPPROTO_DSTOPTS: cty::c_uint = 60; -#[doc = " IPv6 mobility header."] -pub const IPPROTO_MH: cty::c_uint = 135; -pub type _bindgen_ty_7 = cty::c_uint; -#[doc = " Type to represent a port."] -pub type in_port_t = u16; -#[doc = " Echo service."] -pub const IPPORT_ECHO: cty::c_uint = 7; -#[doc = " Discard transmissions service."] -pub const IPPORT_DISCARD: cty::c_uint = 9; -#[doc = " System status service."] -pub const IPPORT_SYSTAT: cty::c_uint = 11; -#[doc = " Time of day service."] -pub const IPPORT_DAYTIME: cty::c_uint = 13; -#[doc = " Network status service."] -pub const IPPORT_NETSTAT: cty::c_uint = 15; -#[doc = " File Transfer Protocol."] -pub const IPPORT_FTP: cty::c_uint = 21; -#[doc = " Telnet protocol."] -pub const IPPORT_TELNET: cty::c_uint = 23; -#[doc = " Simple Mail Transfer Protocol."] -pub const IPPORT_SMTP: cty::c_uint = 25; -#[doc = " Timeserver service."] -pub const IPPORT_TIMESERVER: cty::c_uint = 37; -#[doc = " Domain Name Service."] -pub const IPPORT_NAMESERVER: cty::c_uint = 42; -#[doc = " Internet Whois service."] -pub const IPPORT_WHOIS: cty::c_uint = 43; -pub const IPPORT_MTP: cty::c_uint = 57; -#[doc = " Trivial File Transfer Protocol."] -pub const IPPORT_TFTP: cty::c_uint = 69; -pub const IPPORT_RJE: cty::c_uint = 77; -#[doc = " Finger service."] -pub const IPPORT_FINGER: cty::c_uint = 79; -pub const IPPORT_TTYLINK: cty::c_uint = 87; -#[doc = " SUPDUP protocol."] -pub const IPPORT_SUPDUP: cty::c_uint = 95; -#[doc = " execd service."] -pub const IPPORT_EXECSERVER: cty::c_uint = 512; -#[doc = " rlogind service."] -pub const IPPORT_LOGINSERVER: cty::c_uint = 513; -pub const IPPORT_CMDSERVER: cty::c_uint = 514; -pub const IPPORT_EFSSERVER: cty::c_uint = 520; -#[doc = " UDP ports."] -pub const IPPORT_BIFFUDP: cty::c_uint = 512; -#[doc = " UDP ports."] -pub const IPPORT_WHOSERVER: cty::c_uint = 513; -#[doc = " UDP ports."] -pub const IPPORT_ROUTESERVER: cty::c_uint = 520; -#[doc = " Ports less than this value are reserved for privileged processes."] -pub const IPPORT_RESERVED: cty::c_uint = 1024; -#[doc = " Ports greater this value are reserved for (non-privileged) servers."] -pub const IPPORT_USERRESERVED: cty::c_uint = 5000; -#[doc = " Standard well-known ports."] -pub type _bindgen_ty_8 = cty::c_uint; -#[doc = " IPv6 address"] -#[repr(C)] -#[derive(Copy, Clone)] -pub struct in6_addr { - pub __in6_u: in6_addr__bindgen_ty_1, -} -#[repr(C)] -#[derive(Copy, Clone)] -pub union in6_addr__bindgen_ty_1 { - pub __u6_addr8: [u8; 16usize], - pub __u6_addr16: [u16; 8usize], - pub __u6_addr32: [u32; 4usize], - _bindgen_union_align: [u32; 4usize], -} -#[test] -fn bindgen_test_layout_in6_addr__bindgen_ty_1() { - assert_eq!( - ::core::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(in6_addr__bindgen_ty_1)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(in6_addr__bindgen_ty_1)) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).__u6_addr8 as *const _ as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(in6_addr__bindgen_ty_1), - "::", - stringify!(__u6_addr8) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).__u6_addr16 as *const _ as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(in6_addr__bindgen_ty_1), - "::", - stringify!(__u6_addr16) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).__u6_addr32 as *const _ as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(in6_addr__bindgen_ty_1), - "::", - stringify!(__u6_addr32) - ) - ); -} -#[test] -fn bindgen_test_layout_in6_addr() { - assert_eq!( - ::core::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(in6_addr)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(in6_addr)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).__in6_u as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(in6_addr), - "::", - stringify!(__in6_u) - ) - ); -} -extern "C" { - pub static in6addr_any: in6_addr; -} -extern "C" { - pub static in6addr_loopback: in6_addr; -} -#[doc = " Structure describing an Internet socket address."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct sockaddr_in { - pub sin_family: sa_family_t, - #[doc = " Port number."] - pub sin_port: in_port_t, - #[doc = " Internet address."] - pub sin_addr: in_addr, - #[doc = " Pad to size of `struct sockaddr'."] - pub sin_zero: [cty::c_uchar; 8usize], -} -#[test] -fn bindgen_test_layout_sockaddr_in() { - assert_eq!( - ::core::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(sockaddr_in)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(sockaddr_in)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin_family as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in), - "::", - stringify!(sin_family) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin_port as *const _ as usize }, - 2usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in), - "::", - stringify!(sin_port) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin_addr as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in), - "::", - stringify!(sin_addr) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin_zero as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in), - "::", - stringify!(sin_zero) - ) - ); -} -#[doc = " Ditto, for IPv6."] -#[repr(C)] -#[derive(Copy, Clone)] -pub struct sockaddr_in6 { - pub sin6_family: sa_family_t, - #[doc = " Transport layer port #"] - pub sin6_port: in_port_t, - #[doc = " IPv6 flow information"] - pub sin6_flowinfo: u32, - #[doc = " IPv6 address"] - pub sin6_addr: in6_addr, - #[doc = " IPv6 scope-id"] - pub sin6_scope_id: u32, -} -#[test] -fn bindgen_test_layout_sockaddr_in6() { - assert_eq!( - ::core::mem::size_of::(), - 28usize, - concat!("Size of: ", stringify!(sockaddr_in6)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(sockaddr_in6)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin6_family as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in6), - "::", - stringify!(sin6_family) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin6_port as *const _ as usize }, - 2usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in6), - "::", - stringify!(sin6_port) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin6_flowinfo as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in6), - "::", - stringify!(sin6_flowinfo) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin6_addr as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in6), - "::", - stringify!(sin6_addr) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin6_scope_id as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in6), - "::", - stringify!(sin6_scope_id) - ) - ); -} -#[doc = " Likewise, for IPv6."] -#[repr(C)] -#[derive(Copy, Clone)] -pub struct ipv6_mreq { - #[doc = " IPv6 multicast address of group"] - pub ipv6mr_multiaddr: in6_addr, - #[doc = " local interface"] - pub ipv6mr_interface: cty::c_uint, -} -#[test] -fn bindgen_test_layout_ipv6_mreq() { - assert_eq!( - ::core::mem::size_of::(), - 20usize, - concat!("Size of: ", stringify!(ipv6_mreq)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(ipv6_mreq)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).ipv6mr_multiaddr as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ipv6_mreq), - "::", - stringify!(ipv6mr_multiaddr) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).ipv6mr_interface as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ipv6_mreq), - "::", - stringify!(ipv6mr_interface) - ) - ); -} -extern "C" { - #[doc = " Functions to convert between host and network byte order."] - #[doc = ""] - #[doc = "Please note that these functions normally take `unsigned long int' or"] - #[doc = "`unsigned short int' values as arguments and also return them. But"] - #[doc = "this was a short-sighted decision since on different systems the types"] - #[doc = "may have different representations but the values are always the same."] - pub fn ntohl(__netlong: u32) -> u32; -} -extern "C" { - pub fn ntohs(__netshort: u16) -> u16; -} -extern "C" { - pub fn htonl(__hostlong: u32) -> u32; -} -extern "C" { - pub fn htons(__hostshort: u16) -> u16; -} -extern "C" { - #[doc = " Get a human-readable string describing the running Notcurses version."] - pub fn notcurses_version() -> *const cty::c_char; -} -extern "C" { - #[doc = " Cannot be inline, as we want to get the versions of the actual Notcurses"] - #[doc = " library we loaded, not what we compile against."] - pub fn notcurses_version_components( - major: *mut cty::c_int, - minor: *mut cty::c_int, - patch: *mut cty::c_int, - tweak: *mut cty::c_int, - ); -} -#[repr(C)] -#[derive(Debug)] -pub struct notcurses { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncplane { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncvisual { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncuplot { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncdplot { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncprogbar { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncfdplane { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncsubproc { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncselector { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncmultiselector { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncreader { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncfadectx { - _unused: [u8; 0], -} -#[doc = " let the ncvisual pick"] -pub const ncblitter_e_NCBLIT_DEFAULT: ncblitter_e = 0; -#[doc = " space, compatible with ASCII"] -pub const ncblitter_e_NCBLIT_1x1: ncblitter_e = 1; -#[doc = " halves + 1x1 (space) ▄▀"] -pub const ncblitter_e_NCBLIT_2x1: ncblitter_e = 2; -#[doc = " quadrants + 2x1 ▗▐ ▖▀▟▌▙"] -pub const ncblitter_e_NCBLIT_2x2: ncblitter_e = 3; -#[doc = " sextants (*NOT* 2x2) 🬀🬁🬂🬃🬄🬅🬆🬇🬈🬉🬊🬋🬌🬍🬎🬏🬐🬑🬒🬓🬔🬕🬖🬗🬘🬙🬚🬛🬜🬝🬞🬟🬠🬡🬢🬣🬤🬥🬦🬧🬨🬩🬪🬫🬬🬭🬮🬯🬰🬱🬲🬳🬴🬵🬶🬷🬸🬹🬺🬻"] -pub const ncblitter_e_NCBLIT_3x2: ncblitter_e = 4; -#[doc = " four vertical levels █▆▄▂"] -pub const ncblitter_e_NCBLIT_4x1: ncblitter_e = 5; -#[doc = " 4 rows, 2 cols (braille) ⡀⡄⡆⡇⢀⣀⣄⣆⣇⢠⣠⣤⣦⣧⢰⣰⣴⣶⣷⢸⣸⣼⣾⣿"] -pub const ncblitter_e_NCBLIT_BRAILLE: ncblitter_e = 6; -#[doc = " eight vertical levels █▇▆▅▄▃▂▁"] -pub const ncblitter_e_NCBLIT_8x1: ncblitter_e = 7; -#[doc = " not yet implemented"] -pub const ncblitter_e_NCBLIT_SIXEL: ncblitter_e = 8; -#[doc = " we never blit full blocks, but instead spaces (more efficient) with the"] -#[doc = " background set to the desired foreground."] -pub type ncblitter_e = cty::c_uint; -pub const ncalign_e_NCALIGN_UNALIGNED: ncalign_e = 0; -pub const ncalign_e_NCALIGN_LEFT: ncalign_e = 1; -pub const ncalign_e_NCALIGN_CENTER: ncalign_e = 2; -pub const ncalign_e_NCALIGN_RIGHT: ncalign_e = 3; -#[doc = " Alignment within a plane or terminal. Left/right-justified, or centered."] -pub type ncalign_e = cty::c_uint; -pub const ncscale_e_NCSCALE_NONE: ncscale_e = 0; -pub const ncscale_e_NCSCALE_SCALE: ncscale_e = 1; -pub const ncscale_e_NCSCALE_STRETCH: ncscale_e = 2; -pub const ncscale_e_NCSCALE_NONE_HIRES: ncscale_e = 3; -pub const ncscale_e_NCSCALE_SCALE_HIRES: ncscale_e = 4; -#[doc = " How to scale an ncvisual during rendering. NCSCALE_NONE will apply no"] -#[doc = " scaling. NCSCALE_SCALE scales a visual to the plane's size, maintaining"] -#[doc = " aspect ratio. NCSCALE_STRETCH stretches and scales the image in an"] -#[doc = " attempt to fill the entirety of the plane. NCSCALE_NONE_HIRES and"] -#[doc = " NCSCALE_SCALE_HIRES behave like their counterparts, but admit blitters"] -#[doc = " which don't preserve aspect ratio."] -pub type ncscale_e = cty::c_uint; -extern "C" { - #[doc = " Returns the number of columns occupied by a multibyte (UTF-8) string, or"] - #[doc = " -1 if a non-printable/illegal character is encountered."] - pub fn ncstrwidth(mbs: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " input functions like notcurses_getc() return ucs32-encoded char32_t. convert"] - #[doc = " a series of char32_t to utf8. result must be at least 4 bytes per input"] - #[doc = " char32_t (6 bytes per char32_t will future-proof against Unicode expansion)."] - #[doc = " the number of bytes used is returned, or -1 if passed illegal ucs32, or too"] - #[doc = " small of a buffer."] - pub fn notcurses_ucs32_to_utf8( - ucs32: *const char32_t, - ucs32count: cty::c_uint, - resultbuf: *mut cty::c_uchar, - buflen: size_t, - ) -> cty::c_int; -} -#[doc = " An nccell corresponds to a single character cell on some plane, which can be"] -#[doc = " occupied by a single grapheme cluster (some root spacing glyph, along with"] -#[doc = " possible combining characters, which might span multiple columns). At any"] -#[doc = " cell, we can have a theoretically arbitrarily long UTF-8 string, a foreground"] -#[doc = " color, a background color, and an attribute set. Valid grapheme cluster"] -#[doc = " contents include:"] -#[doc = ""] -#[doc = " * A NUL terminator,"] -#[doc = " * A single control character, followed by a NUL terminator,"] -#[doc = " * At most one spacing character, followed by zero or more nonspacing"] -#[doc = " characters, followed by a NUL terminator."] -#[doc = ""] -#[doc = " Multi-column characters can only have a single style/color throughout."] -#[doc = " Existence is suffering, and thus wcwidth() is not reliable. It's just"] -#[doc = " quoting whether or not the EGC contains a \"Wide Asian\" double-width"] -#[doc = " character. This is set for some things, like most emoji, and not set for"] -#[doc = " other things, like cuneiform. True display width is a *function of the"] -#[doc = " font and terminal*. Among the longest Unicode codepoints is"] -#[doc = ""] -#[doc = " U+FDFD ARABIC LIGATURE BISMILLAH AR-RAHMAN AR-RAHEEM ﷽"] -#[doc = ""] -#[doc = " wcwidth() rather optimistically claims this most exalted glyph to occupy"] -#[doc = " a single column. BiDi text is too complicated for me to even get into here."] -#[doc = " Be assured there are no easy answers; ours is indeed a disturbing Universe."] -#[doc = ""] -#[doc = " Each nccell occupies 16 static bytes (128 bits). The surface is thus ~1.6MB"] -#[doc = " for a (pretty large) 500x200 terminal. At 80x43, it's less than 64KB."] -#[doc = " Dynamic requirements (the egcpool) can add up to 16MB to an ncplane, but"] -#[doc = " such large pools are unlikely in common use."] -#[doc = ""] -#[doc = " We implement some small alpha compositing. Foreground and background both"] -#[doc = " have two bits of inverted alpha. The actual grapheme written to a cell is"] -#[doc = " the topmost non-zero grapheme. If its alpha is 00, its foreground color is"] -#[doc = " used unchanged. If its alpha is 10, its foreground color is derived entirely"] -#[doc = " from cells underneath it. Otherwise, the result will be a composite."] -#[doc = " Likewise for the background. If the bottom of a coordinate's zbuffer is"] -#[doc = " reached with a cumulative alpha of zero, the default is used. In this way,"] -#[doc = " a terminal configured with transparent background can be supported through"] -#[doc = " multiple occluding ncplanes. A foreground alpha of 11 requests high-contrast"] -#[doc = " text (relative to the computed background). A background alpha of 11 is"] -#[doc = " currently forbidden."] -#[doc = ""] -#[doc = " Default color takes precedence over palette or RGB, and cannot be used with"] -#[doc = " transparency. Indexed palette takes precedence over RGB. It cannot"] -#[doc = " meaningfully set transparency, but it can be mixed into a cascading color."] -#[doc = " RGB is used if neither default terminal colors nor palette indexing are in"] -#[doc = " play, and fully supports all transparency options."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct nccell { - #[doc = " 4B → 4B little endian EGC"] - pub gcluster: u32, - #[doc = " 1B → 5B (8 bits of zero)"] - pub gcluster_backstop: u8, - #[doc = " 1B → 6B (8 bits of EGC width, bias-1)"] - pub width: u8, - #[doc = " 2B → 8B (16 bits of NCSTYLE_* attributes)"] - pub stylemask: u16, - #[doc = " + 8B == 16B"] - pub channels: u64, -} -#[test] -fn bindgen_test_layout_nccell() { - assert_eq!( - ::core::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(nccell)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(nccell)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).gcluster as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(nccell), - "::", - stringify!(gcluster) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).gcluster_backstop as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(nccell), - "::", - stringify!(gcluster_backstop) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).width as *const _ as usize }, - 5usize, - concat!( - "Offset of field: ", - stringify!(nccell), - "::", - stringify!(width) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).stylemask as *const _ as usize }, - 6usize, - concat!( - "Offset of field: ", - stringify!(nccell), - "::", - stringify!(stylemask) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).channels as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(nccell), - "::", - stringify!(channels) - ) - ); -} -pub type cell = nccell; -extern "C" { - #[doc = " Breaks the UTF-8 string in 'gcluster' down, setting up the nccell 'c'."] - #[doc = " Returns the number of bytes copied out of 'gcluster', or -1 on failure. The"] - #[doc = " styling of the cell is left untouched, but any resources are released."] - pub fn cell_load(n: *mut ncplane, c: *mut nccell, gcluster: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Duplicate 'c' into 'targ'; both must be/will be bound to 'n'. Returns -1 on"] - #[doc = " failure, and 0 on success."] - pub fn cell_duplicate(n: *mut ncplane, targ: *mut nccell, c: *const nccell) -> cty::c_int; -} -extern "C" { - #[doc = " Release resources held by the nccell 'c'."] - pub fn cell_release(n: *mut ncplane, c: *mut nccell); -} -extern "C" { - #[doc = " return a pointer to the NUL-terminated EGC referenced by 'c'. this pointer"] - #[doc = " can be invalidated by any further operation on the plane 'n', so...watch out!"] - pub fn cell_extended_gcluster(n: *const ncplane, c: *const nccell) -> *const cty::c_char; -} -#[doc = " default. print nothing once fullscreen service begins"] -pub const ncloglevel_e_NCLOGLEVEL_SILENT: ncloglevel_e = 0; -#[doc = " print diagnostics immediately related to crashing"] -pub const ncloglevel_e_NCLOGLEVEL_PANIC: ncloglevel_e = 1; -#[doc = " we're hanging around, but we've had a horrible fault"] -pub const ncloglevel_e_NCLOGLEVEL_FATAL: ncloglevel_e = 2; -#[doc = " we can't keep doin' this, but we can do other things"] -pub const ncloglevel_e_NCLOGLEVEL_ERROR: ncloglevel_e = 3; -#[doc = " you probably don't want what's happening to happen"] -pub const ncloglevel_e_NCLOGLEVEL_WARNING: ncloglevel_e = 4; -#[doc = " \"standard information\""] -pub const ncloglevel_e_NCLOGLEVEL_INFO: ncloglevel_e = 5; -#[doc = " \"detailed information\""] -pub const ncloglevel_e_NCLOGLEVEL_VERBOSE: ncloglevel_e = 6; -#[doc = " this is honestly a bit much"] -pub const ncloglevel_e_NCLOGLEVEL_DEBUG: ncloglevel_e = 7; -#[doc = " there's probably a better way to do what you want"] -pub const ncloglevel_e_NCLOGLEVEL_TRACE: ncloglevel_e = 8; -#[doc = " These log levels consciously map cleanly to those of libav; Notcurses itself"] -#[doc = " does not use this full granularity. The log level does not affect the opening"] -#[doc = " and closing banners, which can be disabled via the notcurses_option struct's"] -#[doc = " 'suppress_banner'. Note that if stderr is connected to the same terminal on"] -#[doc = " which we're rendering, any kind of logging will disrupt the output."] -pub type ncloglevel_e = cty::c_uint; -#[doc = " Configuration for notcurses_init()."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct notcurses_options { - #[doc = " The name of the terminfo database entry describing this terminal. If NULL,"] - #[doc = " the environment variable TERM is used. Failure to open the terminal"] - #[doc = " definition will result in failure to initialize notcurses."] - pub termtype: *const cty::c_char, - #[doc = " If non-NULL, notcurses_render() will write each rendered frame to this"] - #[doc = " FILE* in addition to outfp. This is used primarily for debugging."] - pub renderfp: *mut FILE, - #[doc = " Progressively higher log levels result in more logging to stderr. By"] - #[doc = " default, nothing is printed to stderr once fullscreen service begins."] - pub loglevel: ncloglevel_e, - #[doc = " Desirable margins. If all are 0 (default), we will render to the entirety"] - #[doc = " of the screen. If the screen is too small, we do what we can--this is"] - #[doc = " strictly best-effort. Absolute coordinates are relative to the rendering"] - #[doc = " area ((0, 0) is always the origin of the rendering area)."] - pub margin_t: cty::c_int, - #[doc = " Desirable margins. If all are 0 (default), we will render to the entirety"] - #[doc = " of the screen. If the screen is too small, we do what we can--this is"] - #[doc = " strictly best-effort. Absolute coordinates are relative to the rendering"] - #[doc = " area ((0, 0) is always the origin of the rendering area)."] - pub margin_r: cty::c_int, - #[doc = " Desirable margins. If all are 0 (default), we will render to the entirety"] - #[doc = " of the screen. If the screen is too small, we do what we can--this is"] - #[doc = " strictly best-effort. Absolute coordinates are relative to the rendering"] - #[doc = " area ((0, 0) is always the origin of the rendering area)."] - pub margin_b: cty::c_int, - #[doc = " Desirable margins. If all are 0 (default), we will render to the entirety"] - #[doc = " of the screen. If the screen is too small, we do what we can--this is"] - #[doc = " strictly best-effort. Absolute coordinates are relative to the rendering"] - #[doc = " area ((0, 0) is always the origin of the rendering area)."] - pub margin_l: cty::c_int, - #[doc = " General flags; see NCOPTION_*. This is expressed as a bitfield so that"] - #[doc = " future options can be added without reshaping the struct. Undefined bits"] - #[doc = " must be set to 0."] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_notcurses_options() { - assert_eq!( - ::core::mem::size_of::(), - 48usize, - concat!("Size of: ", stringify!(notcurses_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(notcurses_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).termtype as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(notcurses_options), - "::", - stringify!(termtype) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).renderfp as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(notcurses_options), - "::", - stringify!(renderfp) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).loglevel as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(notcurses_options), - "::", - stringify!(loglevel) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).margin_t as *const _ as usize }, - 20usize, - concat!( - "Offset of field: ", - stringify!(notcurses_options), - "::", - stringify!(margin_t) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).margin_r as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(notcurses_options), - "::", - stringify!(margin_r) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).margin_b as *const _ as usize }, - 28usize, - concat!( - "Offset of field: ", - stringify!(notcurses_options), - "::", - stringify!(margin_b) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).margin_l as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(notcurses_options), - "::", - stringify!(margin_l) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(notcurses_options), - "::", - stringify!(flags) - ) - ); -} -extern "C" { - #[doc = " Lex a margin argument according to the standard Notcurses definition. There"] - #[doc = " can be either a single number, which will define all margins equally, or"] - #[doc = " there can be four numbers separated by commas."] - pub fn notcurses_lex_margins( - op: *const cty::c_char, - opts: *mut notcurses_options, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Lex a blitter."] - pub fn notcurses_lex_blitter(op: *const cty::c_char, blitter: *mut ncblitter_e) -> cty::c_int; -} -extern "C" { - #[doc = " Get the name of a blitter."] - pub fn notcurses_str_blitter(blitter: ncblitter_e) -> *const cty::c_char; -} -extern "C" { - #[doc = " Lex a visual scaling mode (one of \"none\", \"stretch\", or \"scale\")."] - pub fn notcurses_lex_scalemode(op: *const cty::c_char, scalemode: *mut ncscale_e) - -> cty::c_int; -} -extern "C" { - #[doc = " Get the name of a scaling mode."] - pub fn notcurses_str_scalemode(scalemode: ncscale_e) -> *const cty::c_char; -} -extern "C" { - #[doc = " Initialize a Notcurses context on the connected terminal at 'fp'. 'fp' must"] - #[doc = " be a tty. You'll usually want stdout. NULL can be supplied for 'fp', in"] - #[doc = " which case /dev/tty will be opened. Returns NULL on error, including any"] - #[doc = " failure initializing terminfo."] - pub fn notcurses_init(opts: *const notcurses_options, fp: *mut FILE) -> *mut notcurses; -} -extern "C" { - #[doc = " Destroy a Notcurses context."] - pub fn notcurses_stop(nc: *mut notcurses) -> cty::c_int; -} -extern "C" { - #[doc = " Return the topmost plane of the pile containing 'n'."] - pub fn ncpile_top(n: *mut ncplane) -> *mut ncplane; -} -extern "C" { - #[doc = " Return the bottommost plane of the pile containing 'n'."] - pub fn ncpile_bottom(n: *mut ncplane) -> *mut ncplane; -} -extern "C" { - #[doc = " Renders the pile of which 'n' is a part. Rendering this pile again will blow"] - #[doc = " away the render. To actually write out the render, call ncpile_rasterize()."] - pub fn ncpile_render(n: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Make the physical screen match the last rendered frame from the pile of"] - #[doc = " which 'n' is a part. This is a blocking call. Don't call this before the"] - #[doc = " pile has been rendered (doing so will likely result in a blank screen)."] - pub fn ncpile_rasterize(n: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Renders and rasterizes the standard pile in one shot. Blocking call."] - pub fn notcurses_render(nc: *mut notcurses) -> cty::c_int; -} -extern "C" { - #[doc = " Perform the rendering and rasterization portion of notcurses_render(), but"] - #[doc = " do not write the resulting buffer out to the terminal. Using this function,"] - #[doc = " the user can control the writeout process, and render a second frame while"] - #[doc = " writing another. The returned buffer must be freed by the caller."] - pub fn notcurses_render_to_buffer( - nc: *mut notcurses, - buf: *mut *mut cty::c_char, - buflen: *mut size_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Write the last rendered frame, in its entirety, to 'fp'. If"] - #[doc = " notcurses_render() has not yet been called, nothing will be written."] - pub fn notcurses_render_to_file(nc: *mut notcurses, fp: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Return the topmost ncplane, of which there is always at least one."] - pub fn notcurses_top(n: *mut notcurses) -> *mut ncplane; -} -extern "C" { - #[doc = " Return the bottommost ncplane, of which there is always at least one."] - pub fn notcurses_bottom(n: *mut notcurses) -> *mut ncplane; -} -extern "C" { - #[doc = " Destroy all ncplanes other than the stdplane."] - pub fn notcurses_drop_planes(nc: *mut notcurses); -} -#[doc = " An input event. Cell coordinates are currently defined only for mouse events."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncinput { - #[doc = " identifier. Unicode codepoint or synthesized NCKEY event"] - pub id: char32_t, - #[doc = " y cell coordinate of event, -1 for undefined"] - pub y: cty::c_int, - #[doc = " x cell coordinate of event, -1 for undefined"] - pub x: cty::c_int, - #[doc = " was alt held?"] - pub alt: bool, - #[doc = " was shift held?"] - pub shift: bool, - #[doc = " was ctrl held?"] - pub ctrl: bool, - #[doc = " input event number"] - pub seqnum: u64, -} -#[test] -fn bindgen_test_layout_ncinput() { - assert_eq!( - ::core::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(ncinput)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncinput)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).id as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncinput), - "::", - stringify!(id) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).y as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(ncinput), - "::", - stringify!(y) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).x as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncinput), - "::", - stringify!(x) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).alt as *const _ as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(ncinput), - "::", - stringify!(alt) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).shift as *const _ as usize }, - 13usize, - concat!( - "Offset of field: ", - stringify!(ncinput), - "::", - stringify!(shift) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).ctrl as *const _ as usize }, - 14usize, - concat!( - "Offset of field: ", - stringify!(ncinput), - "::", - stringify!(ctrl) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).seqnum as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncinput), - "::", - stringify!(seqnum) - ) - ); -} -extern "C" { - #[doc = " See ppoll(2) for more detail. Provide a NULL 'ts' to block at length, a 'ts'"] - #[doc = " of 0 for non-blocking operation, and otherwise a timespec to bound blocking."] - #[doc = " Signals in sigmask (less several we handle internally) will be atomically"] - #[doc = " masked and unmasked per ppoll(2). It should generally contain all signals."] - #[doc = " Returns a single Unicode code point, or (char32_t)-1 on error. 'sigmask' may"] - #[doc = " be NULL. Returns 0 on a timeout. If an event is processed, the return value"] - #[doc = " is the 'id' field from that event. 'ni' may be NULL."] - pub fn notcurses_getc( - n: *mut notcurses, - ts: *const timespec, - sigmask: *mut sigset_t, - ni: *mut ncinput, - ) -> char32_t; -} -extern "C" { - #[doc = " Get a file descriptor suitable for input event poll()ing. When this"] - #[doc = " descriptor becomes available, you can call notcurses_getc_nblock(),"] - #[doc = " and input ought be ready. This file descriptor is *not* necessarily"] - #[doc = " the file descriptor associated with stdin (but it might be!)."] - pub fn notcurses_inputready_fd(n: *mut notcurses) -> cty::c_int; -} -extern "C" { - #[doc = " Enable the mouse in \"button-event tracking\" mode with focus detection and"] - #[doc = " UTF8-style extended coordinates. On failure, -1 is returned. On success, 0"] - #[doc = " is returned, and mouse events will be published to notcurses_getc()."] - pub fn notcurses_mouse_enable(n: *mut notcurses) -> cty::c_int; -} -extern "C" { - #[doc = " Disable mouse events. Any events in the input queue can still be delivered."] - pub fn notcurses_mouse_disable(n: *mut notcurses) -> cty::c_int; -} -extern "C" { - #[doc = " Disable signals originating from the terminal's line discipline, i.e."] - #[doc = " SIGINT (^C), SIGQUIT (^\\), and SIGTSTP (^Z). They are enabled by default."] - pub fn notcurses_linesigs_disable(n: *mut notcurses) -> cty::c_int; -} -extern "C" { - #[doc = " Restore signals originating from the terminal's line discipline, i.e."] - #[doc = " SIGINT (^C), SIGQUIT (^\\), and SIGTSTP (^Z), if disabled."] - pub fn notcurses_linesigs_enable(n: *mut notcurses) -> cty::c_int; -} -extern "C" { - #[doc = " Refresh the physical screen to match what was last rendered (i.e., without"] - #[doc = " reflecting any changes since the last call to notcurses_render()). This is"] - #[doc = " primarily useful if the screen is externally corrupted, or if an"] - #[doc = " NCKEY_RESIZE event has been read and you're not yet ready to render."] - pub fn notcurses_refresh( - n: *mut notcurses, - y: *mut cty::c_int, - x: *mut cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Extract the Notcurses context to which this plane is attached."] - pub fn ncplane_notcurses(n: *mut ncplane) -> *mut notcurses; -} -extern "C" { - pub fn ncplane_notcurses_const(n: *const ncplane) -> *const notcurses; -} -extern "C" { - #[doc = " Return the dimensions of this ncplane."] - pub fn ncplane_dim_yx(n: *const ncplane, y: *mut cty::c_int, x: *mut cty::c_int); -} -extern "C" { - #[doc = " Get a reference to the standard plane (one matching our current idea of the"] - #[doc = " terminal size) for this terminal. The standard plane always exists, and its"] - #[doc = " origin is always at the uppermost, leftmost cell of the terminal."] - pub fn notcurses_stdplane(nc: *mut notcurses) -> *mut ncplane; -} -extern "C" { - pub fn notcurses_stdplane_const(nc: *const notcurses) -> *const ncplane; -} -extern "C" { - #[doc = " Retrieve the contents of the specified cell as last rendered. Returns the EGC"] - #[doc = " or NULL on error. This EGC must be free()d by the caller. The stylemask and"] - #[doc = " channels are written to 'stylemask' and 'channels', respectively."] - pub fn notcurses_at_yx( - nc: *mut notcurses, - yoff: cty::c_int, - xoff: cty::c_int, - stylemask: *mut u16, - channels: *mut u64, - ) -> *mut cty::c_char; -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncplane_options { - #[doc = " vertical placement relative to parent plane"] - pub y: cty::c_int, - #[doc = " horizontal placement relative to parent plane"] - pub x: cty::c_int, - #[doc = " number of rows, must be positive"] - pub rows: cty::c_int, - #[doc = " number of columns, must be positive"] - pub cols: cty::c_int, - #[doc = " user curry, may be NULL"] - pub userptr: *mut cty::c_void, - #[doc = " name (used only for debugging), may be NULL"] - pub name: *const cty::c_char, - #[doc = " callback when parent is resized"] - pub resizecb: ::core::option::Option cty::c_int>, - #[doc = " closure over NCPLANE_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncplane_options() { - assert_eq!( - ::core::mem::size_of::(), - 48usize, - concat!("Size of: ", stringify!(ncplane_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncplane_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).y as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(y) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).x as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(x) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).rows as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(rows) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).cols as *const _ as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(cols) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).userptr as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(userptr) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).name as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(name) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).resizecb as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(resizecb) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(flags) - ) - ); -} -extern "C" { - #[doc = " Create a new ncplane bound to plane 'n', at the offset 'y'x'x' (relative to"] - #[doc = " the origin of 'n') and the specified size. The number of 'rows' and 'cols'"] - #[doc = " must both be positive. This plane is initially at the top of the z-buffer,"] - #[doc = " as if ncplane_move_top() had been called on it. The void* 'userptr' can be"] - #[doc = " retrieved (and reset) later. A 'name' can be set, used in debugging."] - pub fn ncplane_create(n: *mut ncplane, nopts: *const ncplane_options) -> *mut ncplane; -} -extern "C" { - #[doc = " Same as ncplane_create(), but creates a new pile. The returned plane will"] - #[doc = " be the top, bottom, and root of this new pile."] - pub fn ncpile_create(nc: *mut notcurses, nopts: *const ncplane_options) -> *mut ncplane; -} -extern "C" { - #[doc = " This function will be removed in 3.0 in favor of ncplane_create()."] - #[doc = " It persists in 2.0 only for backwards compatibility."] - pub fn ncplane_new( - n: *mut ncplane, - rows: cty::c_int, - cols: cty::c_int, - y: cty::c_int, - x: cty::c_int, - opaque: *mut cty::c_void, - name: *const cty::c_char, - ) -> *mut ncplane; -} -extern "C" { - #[doc = " Suitable for use as a 'resizecb', this will resize the plane to the visual"] - #[doc = " region's size. It is used for the standard plane."] - pub fn ncplane_resize_maximize(n: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Suitable for use as a 'resizecb'. This will realign the plane 'n' against"] - #[doc = " its parent, using the alignment specified at ncplane_create()-time."] - pub fn ncplane_resize_realign(n: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Replace the ncplane's existing resizecb with 'resizecb' (which may be NULL)."] - #[doc = " The standard plane's resizecb may not be changed."] - pub fn ncplane_set_resizecb( - n: *mut ncplane, - resizecb: ::core::option::Option cty::c_int>, - ); -} -extern "C" { - #[doc = " Returns the ncplane's current resize callback."] - pub fn ncplane_resizecb( - n: *const ncplane, - ) -> ::core::option::Option cty::c_int>; -} -extern "C" { - #[doc = " Plane 'n' will be unbound from its parent plane, and will be made a bound"] - #[doc = " child of 'newparent'. It is an error if 'n' or 'newparent' are NULL. If"] - #[doc = " 'newparent' is equal to 'n', 'n' becomes the root of a new pile, unless 'n'"] - #[doc = " is already the root of a pile, in which case this is a no-op. Returns 'n'."] - #[doc = " The standard plane cannot be reparented. Any planes bound to 'n' are"] - #[doc = " reparented to the previous parent of 'n'."] - pub fn ncplane_reparent(n: *mut ncplane, newparent: *mut ncplane) -> *mut ncplane; -} -extern "C" { - #[doc = " The same as ncplane_reparent(), except any planes bound to 'n' come along"] - #[doc = " with it to its new destination. Their z-order is maintained. If 'newparent'"] - #[doc = " is an ancestor of 'n', NULL is returned, and no changes are made."] - pub fn ncplane_reparent_family(n: *mut ncplane, newparent: *mut ncplane) -> *mut ncplane; -} -extern "C" { - #[doc = " Duplicate an existing ncplane. The new plane will have the same geometry,"] - #[doc = " will duplicate all content, and will start with the same rendering state."] - #[doc = " The new plane will be immediately above the old one on the z axis, and will"] - #[doc = " be bound to the same parent. Bound planes are *not* duplicated; the new"] - #[doc = " plane is bound to the parent of 'n', but has no bound planes."] - pub fn ncplane_dup(n: *const ncplane, opaque: *mut cty::c_void) -> *mut ncplane; -} -extern "C" { - #[doc = " provided a coordinate relative to the origin of 'src', map it to the same"] - #[doc = " absolute coordinate relative to thte origin of 'dst'. either or both of 'y'"] - #[doc = " and 'x' may be NULL. if 'dst' is NULL, it is taken to be the standard plane."] - pub fn ncplane_translate( - src: *const ncplane, - dst: *const ncplane, - y: *mut cty::c_int, - x: *mut cty::c_int, - ); -} -extern "C" { - #[doc = " Fed absolute 'y'/'x' coordinates, determine whether that coordinate is"] - #[doc = " within the ncplane 'n'. If not, return false. If so, return true. Either"] - #[doc = " way, translate the absolute coordinates relative to 'n'. If the point is not"] - #[doc = " within 'n', these coordinates will not be within the dimensions of the plane."] - pub fn ncplane_translate_abs(n: *const ncplane, y: *mut cty::c_int, x: *mut cty::c_int) - -> bool; -} -extern "C" { - #[doc = " All planes are created with scrolling disabled. Scrolling can be dynamically"] - #[doc = " controlled with ncplane_set_scrolling(). Returns true if scrolling was"] - #[doc = " previously enabled, or false if it was disabled."] - pub fn ncplane_set_scrolling(n: *mut ncplane, scrollp: bool) -> bool; -} -extern "C" { - #[doc = " Returns a 16-bit bitmask of supported curses-style attributes"] - #[doc = " (NCSTYLE_UNDERLINE, NCSTYLE_BOLD, etc.) The attribute is only"] - #[doc = " indicated as supported if the terminal can support it together with color."] - #[doc = " For more information, see the \"ncv\" capability in terminfo(5)."] - pub fn notcurses_supported_styles(nc: *const notcurses) -> cty::c_uint; -} -extern "C" { - #[doc = " Returns the number of simultaneous colors claimed to be supported, or 1 if"] - #[doc = " there is no color support. Note that several terminal emulators advertise"] - #[doc = " more colors than they actually support, downsampling internally."] - pub fn notcurses_palette_size(nc: *const notcurses) -> cty::c_uint; -} -extern "C" { - #[doc = " Can we directly specify RGB values per cell, or only use palettes?"] - pub fn notcurses_cantruecolor(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " Can we fade? Fading requires either the \"rgb\" or \"ccc\" terminfo capability."] - pub fn notcurses_canfade(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " Can we set the \"hardware\" palette? Requires the \"ccc\" terminfo capability."] - pub fn notcurses_canchangecolor(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " Can we load images? This requires being built against FFmpeg/OIIO."] - pub fn notcurses_canopen_images(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " Can we load videos? This requires being built against FFmpeg."] - pub fn notcurses_canopen_videos(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " Is our encoding UTF-8? Requires LANG being set to a UTF8 locale."] - pub fn notcurses_canutf8(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " Can we reliably use Unicode 13 sextants?"] - pub fn notcurses_cansextant(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " Can we blit to Sixel?"] - pub fn notcurses_cansixel(nc: *const notcurses) -> bool; -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncstats { - #[doc = " number of successful notcurses_render() runs"] - pub renders: u64, - #[doc = " number of aborted renders, should be 0"] - pub failed_renders: u64, - #[doc = " bytes emitted to ttyfp"] - pub render_bytes: u64, - #[doc = " max bytes emitted for a frame"] - pub render_max_bytes: i64, - #[doc = " min bytes emitted for a frame"] - pub render_min_bytes: i64, - #[doc = " nanoseconds spent in render+raster"] - pub render_ns: u64, - #[doc = " max ns spent in render+raster for a frame"] - pub render_max_ns: i64, - #[doc = " min ns spent in render+raster for a frame"] - pub render_min_ns: i64, - #[doc = " nanoseconds spent writing frames to terminal"] - pub writeout_ns: u64, - #[doc = " max ns spent writing out a frame"] - pub writeout_max_ns: i64, - #[doc = " min ns spent writing out a frame"] - pub writeout_min_ns: i64, - #[doc = " cells we elided entirely thanks to damage maps"] - pub cellelisions: u64, - #[doc = " total number of cells emitted to terminal"] - pub cellemissions: u64, - #[doc = " RGB fg elision count"] - pub fgelisions: u64, - #[doc = " RGB fg emissions"] - pub fgemissions: u64, - #[doc = " RGB bg elision count"] - pub bgelisions: u64, - #[doc = " RGB bg emissions"] - pub bgemissions: u64, - #[doc = " default color was emitted"] - pub defaultelisions: u64, - #[doc = " default color was elided"] - pub defaultemissions: u64, - #[doc = " refresh requests (non-optimized redraw)"] - pub refreshes: u64, - #[doc = " total bytes devoted to all active framebuffers"] - pub fbbytes: u64, - #[doc = " number of planes currently in existence"] - pub planes: cty::c_uint, -} -#[test] -fn bindgen_test_layout_ncstats() { - assert_eq!( - ::core::mem::size_of::(), - 176usize, - concat!("Size of: ", stringify!(ncstats)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncstats)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).renders as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(renders) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).failed_renders as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(failed_renders) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).render_bytes as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(render_bytes) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).render_max_bytes as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(render_max_bytes) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).render_min_bytes as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(render_min_bytes) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).render_ns as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(render_ns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).render_max_ns as *const _ as usize }, - 48usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(render_max_ns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).render_min_ns as *const _ as usize }, - 56usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(render_min_ns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).writeout_ns as *const _ as usize }, - 64usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(writeout_ns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).writeout_max_ns as *const _ as usize }, - 72usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(writeout_max_ns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).writeout_min_ns as *const _ as usize }, - 80usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(writeout_min_ns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).cellelisions as *const _ as usize }, - 88usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(cellelisions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).cellemissions as *const _ as usize }, - 96usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(cellemissions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).fgelisions as *const _ as usize }, - 104usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(fgelisions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).fgemissions as *const _ as usize }, - 112usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(fgemissions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).bgelisions as *const _ as usize }, - 120usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(bgelisions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).bgemissions as *const _ as usize }, - 128usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(bgemissions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).defaultelisions as *const _ as usize }, - 136usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(defaultelisions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).defaultemissions as *const _ as usize }, - 144usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(defaultemissions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).refreshes as *const _ as usize }, - 152usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(refreshes) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).fbbytes as *const _ as usize }, - 160usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(fbbytes) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).planes as *const _ as usize }, - 168usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(planes) - ) - ); -} -extern "C" { - #[doc = " Allocate an ncstats object. Use this rather than allocating your own, since"] - #[doc = " future versions of Notcurses might enlarge this structure."] - pub fn notcurses_stats_alloc(nc: *const notcurses) -> *mut ncstats; -} -extern "C" { - #[doc = " Acquire an atomic snapshot of the Notcurses object's stats."] - pub fn notcurses_stats(nc: *const notcurses, stats: *mut ncstats); -} -extern "C" { - #[doc = " Reset all cumulative stats (immediate ones, such as fbbytes, are not reset)."] - pub fn notcurses_stats_reset(nc: *mut notcurses, stats: *mut ncstats); -} -extern "C" { - #[doc = " Resize the specified ncplane. The four parameters 'keepy', 'keepx',"] - #[doc = " 'keepleny', and 'keeplenx' define a subset of the ncplane to keep,"] - #[doc = " unchanged. This may be a section of size 0, though none of these four"] - #[doc = " parameters may be negative. 'keepx' and 'keepy' are relative to the ncplane."] - #[doc = " They must specify a coordinate within the ncplane's totality. 'yoff' and"] - #[doc = " 'xoff' are relative to 'keepy' and 'keepx', and place the upper-left corner"] - #[doc = " of the resized ncplane. Finally, 'ylen' and 'xlen' are the dimensions of the"] - #[doc = " ncplane after resizing. 'ylen' must be greater than or equal to 'keepleny',"] - #[doc = " and 'xlen' must be greater than or equal to 'keeplenx'. It is an error to"] - #[doc = " attempt to resize the standard plane. If either of 'keepleny' or 'keeplenx'"] - #[doc = " is non-zero, both must be non-zero."] - #[doc = ""] - #[doc = " Essentially, the kept material does not move. It serves to anchor the"] - #[doc = " resized plane. If there is no kept material, the plane can move freely."] - pub fn ncplane_resize( - n: *mut ncplane, - keepy: cty::c_int, - keepx: cty::c_int, - keepleny: cty::c_int, - keeplenx: cty::c_int, - yoff: cty::c_int, - xoff: cty::c_int, - ylen: cty::c_int, - xlen: cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Destroy the specified ncplane. None of its contents will be visible after"] - #[doc = " the next call to notcurses_render(). It is an error to attempt to destroy"] - #[doc = " the standard plane."] - pub fn ncplane_destroy(n: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Set the ncplane's base nccell to this nccell. It will be used for purposes"] - #[doc = " of rendering anywhere that the ncplane's gcluster is 0. Erasing the ncplane"] - #[doc = " does not reset the base cell; this function must be called with a zero 'c'."] - pub fn ncplane_set_base_cell(n: *mut ncplane, c: *const nccell) -> cty::c_int; -} -extern "C" { - #[doc = " Set the ncplane's base nccell to this cell. It will be used for purposes of"] - #[doc = " rendering anywhere that the ncplane's gcluster is 0. Erasing the ncplane"] - #[doc = " does not reset the base cell; this function must be called with an empty"] - #[doc = " 'egc'. 'egc' must be a single extended grapheme cluster."] - pub fn ncplane_set_base( - n: *mut ncplane, - egc: *const cty::c_char, - stylemask: u32, - channels: u64, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Extract the ncplane's base nccell into 'c'. The reference is invalidated if"] - #[doc = " 'ncp' is destroyed."] - pub fn ncplane_base(n: *mut ncplane, c: *mut nccell) -> cty::c_int; -} -extern "C" { - #[doc = " Move this plane relative to the standard plane, or the plane to which it is"] - #[doc = " bound (if it is bound to a plane). It is an error to attempt to move the"] - #[doc = " standard plane."] - pub fn ncplane_move_yx(n: *mut ncplane, y: cty::c_int, x: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Get the origin of this plane relative to the standard plane, or the plane to"] - #[doc = " which it is bound (if it is bound to a plane)."] - pub fn ncplane_yx(n: *const ncplane, y: *mut cty::c_int, x: *mut cty::c_int); -} -extern "C" { - pub fn ncplane_y(n: *const ncplane) -> cty::c_int; -} -extern "C" { - pub fn ncplane_x(n: *const ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Get the plane to which the plane 'n' is bound, if any."] - pub fn ncplane_parent(n: *mut ncplane) -> *mut ncplane; -} -extern "C" { - pub fn ncplane_parent_const(n: *const ncplane) -> *const ncplane; -} -extern "C" { - #[doc = " Splice ncplane 'n' out of the z-buffer, and reinsert it at the top or bottom."] - pub fn ncplane_move_top(n: *mut ncplane); -} -extern "C" { - pub fn ncplane_move_bottom(n: *mut ncplane); -} -extern "C" { - #[doc = " Splice ncplane 'n' out of the z-buffer, and reinsert it above 'above'."] - #[doc = " Returns non-zero if 'n' is already in the desired location. 'n' and"] - #[doc = " 'above' must not be the same plane."] - pub fn ncplane_move_above(n: *mut ncplane, above: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Splice ncplane 'n' out of the z-buffer, and reinsert it below 'below'."] - #[doc = " Returns non-zero if 'n' is already in the desired location. 'n' and"] - #[doc = " 'below' must not be the same plane."] - pub fn ncplane_move_below(n: *mut ncplane, below: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Return the plane below this one, or NULL if this is at the bottom."] - pub fn ncplane_below(n: *mut ncplane) -> *mut ncplane; -} -extern "C" { - pub fn ncplane_above(n: *mut ncplane) -> *mut ncplane; -} -extern "C" { - #[doc = " Rotate the plane π/2 radians clockwise or counterclockwise. This cannot"] - #[doc = " be performed on arbitrary planes, because glyphs cannot be arbitrarily"] - #[doc = " rotated. The glyphs which can be rotated are limited: line-drawing"] - #[doc = " characters, spaces, half blocks, and full blocks. The plane must have"] - #[doc = " an even number of columns. Use the ncvisual rotation for a more"] - #[doc = " flexible approach."] - pub fn ncplane_rotate_cw(n: *mut ncplane) -> cty::c_int; -} -extern "C" { - pub fn ncplane_rotate_ccw(n: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Retrieve the current contents of the cell under the cursor. The EGC is"] - #[doc = " returned, or NULL on error. This EGC must be free()d by the caller. The"] - #[doc = " stylemask and channels are written to 'stylemask' and 'channels', respectively."] - pub fn ncplane_at_cursor( - n: *mut ncplane, - stylemask: *mut u16, - channels: *mut u64, - ) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Retrieve the current contents of the cell under the cursor into 'c'. This"] - #[doc = " cell is invalidated if the associated plane is destroyed. Returns the number"] - #[doc = " of bytes in the EGC, or -1 on error."] - pub fn ncplane_at_cursor_cell(n: *mut ncplane, c: *mut nccell) -> cty::c_int; -} -extern "C" { - #[doc = " Retrieve the current contents of the specified cell. The EGC is returned, or"] - #[doc = " NULL on error. This EGC must be free()d by the caller. The stylemask and"] - #[doc = " channels are written to 'stylemask' and 'channels', respectively."] - pub fn ncplane_at_yx( - n: *const ncplane, - y: cty::c_int, - x: cty::c_int, - stylemask: *mut u16, - channels: *mut u64, - ) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Retrieve the current contents of the specified cell into 'c'. This cell is"] - #[doc = " invalidated if the associated plane is destroyed. Returns the number of"] - #[doc = " bytes in the EGC, or -1 on error."] - pub fn ncplane_at_yx_cell( - n: *mut ncplane, - y: cty::c_int, - x: cty::c_int, - c: *mut nccell, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Create a flat string from the EGCs of the selected region of the ncplane"] - #[doc = " 'n'. Start at the plane's 'begy'x'begx' coordinate (which must lie on the"] - #[doc = " plane), continuing for 'leny'x'lenx' cells. Either or both of 'leny' and"] - #[doc = " 'lenx' can be specified as -1 to go through the boundary of the plane."] - pub fn ncplane_contents( - n: *const ncplane, - begy: cty::c_int, - begx: cty::c_int, - leny: cty::c_int, - lenx: cty::c_int, - ) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Manipulate the opaque user pointer associated with this plane."] - #[doc = " ncplane_set_userptr() returns the previous userptr after replacing"] - #[doc = " it with 'opaque'. the others simply return the userptr."] - pub fn ncplane_set_userptr(n: *mut ncplane, opaque: *mut cty::c_void) -> *mut cty::c_void; -} -extern "C" { - pub fn ncplane_userptr(n: *mut ncplane) -> *mut cty::c_void; -} -extern "C" { - pub fn ncplane_center_abs(n: *const ncplane, y: *mut cty::c_int, x: *mut cty::c_int); -} -extern "C" { - #[doc = " Move the cursor to the specified position (the cursor needn't be visible)."] - #[doc = " Returns -1 on error, including negative parameters, or ones exceeding the"] - #[doc = " plane's dimensions."] - pub fn ncplane_cursor_move_yx(n: *mut ncplane, y: cty::c_int, x: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Move the cursor to 0, 0. Can't fail."] - pub fn ncplane_home(n: *mut ncplane); -} -extern "C" { - #[doc = " Get the current position of the cursor within n. y and/or x may be NULL."] - pub fn ncplane_cursor_yx(n: *const ncplane, y: *mut cty::c_int, x: *mut cty::c_int); -} -extern "C" { - #[doc = " Get the current channels or attribute word for ncplane 'n'."] - pub fn ncplane_channels(n: *const ncplane) -> u64; -} -extern "C" { - #[doc = " Return the current styling for this ncplane."] - pub fn ncplane_styles(n: *const ncplane) -> u16; -} -extern "C" { - #[doc = " Replace the cell at the specified coordinates with the provided cell 'c',"] - #[doc = " and advance the cursor by the width of the cell (but not past the end of the"] - #[doc = " plane). On success, returns the number of columns the cursor was advanced."] - #[doc = " 'c' must already be associated with 'n'. On failure, -1 is returned."] - pub fn ncplane_putc_yx( - n: *mut ncplane, - y: cty::c_int, - x: cty::c_int, - c: *const nccell, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Replace the EGC underneath us, but retain the styling. The current styling"] - #[doc = " of the plane will not be changed."] - pub fn ncplane_putchar_stained(n: *mut ncplane, c: cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Replace the cell at the specified coordinates with the provided EGC, and"] - #[doc = " advance the cursor by the width of the cluster (but not past the end of the"] - #[doc = " plane). On success, returns the number of columns the cursor was advanced."] - #[doc = " On failure, -1 is returned. The number of bytes converted from gclust is"] - #[doc = " written to 'sbytes' if non-NULL."] - pub fn ncplane_putegc_yx( - n: *mut ncplane, - y: cty::c_int, - x: cty::c_int, - gclust: *const cty::c_char, - sbytes: *mut cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Replace the EGC underneath us, but retain the styling. The current styling"] - #[doc = " of the plane will not be changed."] - pub fn ncplane_putegc_stained( - n: *mut ncplane, - gclust: *const cty::c_char, - sbytes: *mut cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Replace the EGC underneath us, but retain the styling. The current styling"] - #[doc = " of the plane will not be changed."] - pub fn ncplane_putwegc_stained( - n: *mut ncplane, - gclust: *const wchar_t, - sbytes: *mut cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Write a series of EGCs to the current location, using the current style."] - #[doc = " They will be interpreted as a series of columns (according to the definition"] - #[doc = " of ncplane_putc()). Advances the cursor by some positive number of columns"] - #[doc = " (though not beyond the end of the plane); this number is returned on success."] - #[doc = " On error, a non-positive number is returned, indicating the number of columns"] - #[doc = " which were written before the error."] - pub fn ncplane_putstr_yx( - n: *mut ncplane, - y: cty::c_int, - x: cty::c_int, - gclusters: *const cty::c_char, - ) -> cty::c_int; -} -extern "C" { - pub fn ncplane_putstr_aligned( - n: *mut ncplane, - y: cty::c_int, - align: ncalign_e, - s: *const cty::c_char, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Replace a string's worth of glyphs at the current cursor location, but"] - #[doc = " retain the styling. The current styling of the plane will not be changed."] - pub fn ncplane_putstr_stained(n: *mut ncplane, s: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Write a series of EGCs to the current location, using the current style."] - #[doc = " They will be interpreted as a series of columns (according to the definition"] - #[doc = " of ncplane_putc()). Advances the cursor by some positive number of columns"] - #[doc = " (though not beyond the end of the plane); this number is returned on success."] - #[doc = " On error, a non-positive number is returned, indicating the number of columns"] - #[doc = " which were written before the error. No more than 's' bytes will be written."] - pub fn ncplane_putnstr_yx( - n: *mut ncplane, - y: cty::c_int, - x: cty::c_int, - s: size_t, - gclusters: *const cty::c_char, - ) -> cty::c_int; -} -extern "C" { - pub fn ncplane_putnstr_aligned( - n: *mut ncplane, - y: cty::c_int, - align: ncalign_e, - s: size_t, - gclustarr: *const cty::c_char, - ) -> cty::c_int; -} -extern "C" { - pub fn ncplane_putwstr_stained(n: *mut ncplane, gclustarr: *const wchar_t) -> cty::c_int; -} -extern "C" { - #[doc = " The ncplane equivalents of printf(3) and vprintf(3)."] - pub fn ncplane_vprintf_aligned( - n: *mut ncplane, - y: cty::c_int, - align: ncalign_e, - format: *const cty::c_char, - ap: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - pub fn ncplane_vprintf_yx( - n: *mut ncplane, - y: cty::c_int, - x: cty::c_int, - format: *const cty::c_char, - ap: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - pub fn ncplane_vprintf_stained( - n: *mut ncplane, - format: *const cty::c_char, - ap: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Write the specified text to the plane, breaking lines sensibly, beginning at"] - #[doc = " the specified line. Returns the number of columns written. When breaking a"] - #[doc = " line, the line will be cleared to the end of the plane (the last line will"] - #[doc = " *not* be so cleared). The number of bytes written from the input is written"] - #[doc = " to '*bytes' if it is not NULL. Cleared columns are included in the return"] - #[doc = " value, but *not* included in the number of bytes written. Leaves the cursor"] - #[doc = " at the end of output. A partial write will be accomplished as far as it can;"] - #[doc = " determine whether the write completed by inspecting '*bytes'. Can output to"] - #[doc = " multiple rows even in the absence of scrolling, but not more rows than are"] - #[doc = " available. With scrolling enabled, arbitrary amounts of data can be emitted."] - #[doc = " All provided whitespace is preserved -- ncplane_puttext() followed by an"] - #[doc = " appropriate ncplane_contents() will read back the original output."] - #[doc = ""] - #[doc = " If 'y' is -1, the first row of output is taken relative to the current"] - #[doc = " cursor: it will be left-, right-, or center-aligned in whatever remains"] - #[doc = " of the row. On subsequent rows -- or if 'y' is not -1 -- the entire row can"] - #[doc = " be used, and alignment works normally."] - #[doc = ""] - #[doc = " A newline at any point will move the cursor to the next row."] - pub fn ncplane_puttext( - n: *mut ncplane, - y: cty::c_int, - align: ncalign_e, - text: *const cty::c_char, - bytes: *mut size_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Draw horizontal or vertical lines using the specified cell, starting at the"] - #[doc = " current cursor position. The cursor will end at the cell following the last"] - #[doc = " cell output (even, perhaps counter-intuitively, when drawing vertical"] - #[doc = " lines), just as if ncplane_putc() was called at that spot. Return the"] - #[doc = " number of cells drawn on success. On error, return the negative number of"] - #[doc = " cells drawn."] - pub fn ncplane_hline_interp( - n: *mut ncplane, - c: *const nccell, - len: cty::c_int, - c1: u64, - c2: u64, - ) -> cty::c_int; -} -extern "C" { - pub fn ncplane_vline_interp( - n: *mut ncplane, - c: *const nccell, - len: cty::c_int, - c1: u64, - c2: u64, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Draw a box with its upper-left corner at the current cursor position, and its"] - #[doc = " lower-right corner at 'ystop'x'xstop'. The 6 cells provided are used to draw the"] - #[doc = " upper-left, ur, ll, and lr corners, then the horizontal and vertical lines."] - #[doc = " 'ctlword' is defined in the least significant byte, where bits [7, 4] are a"] - #[doc = " gradient mask, and [3, 0] are a border mask:"] - #[doc = " * 7, 3: top"] - #[doc = " * 6, 2: right"] - #[doc = " * 5, 1: bottom"] - #[doc = " * 4, 0: left"] - #[doc = " If the gradient bit is not set, the styling from the hl/vl cells is used for"] - #[doc = " the horizontal and vertical lines, respectively. If the gradient bit is set,"] - #[doc = " the color is linearly interpolated between the two relevant corner cells."] - #[doc = ""] - #[doc = " By default, vertexes are drawn whether their connecting edges are drawn or"] - #[doc = " not. The value of the bits corresponding to NCBOXCORNER_MASK control this,"] - #[doc = " and are interpreted as the number of connecting edges necessary to draw a"] - #[doc = " given corner. At 0 (the default), corners are always drawn. At 3, corners"] - #[doc = " are never drawn (since at most 2 edges can touch a box's corner)."] - pub fn ncplane_box( - n: *mut ncplane, - ul: *const nccell, - ur: *const nccell, - ll: *const nccell, - lr: *const nccell, - hline: *const nccell, - vline: *const nccell, - ystop: cty::c_int, - xstop: cty::c_int, - ctlword: cty::c_uint, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Starting at the specified coordinate, if its glyph is different from that of"] - #[doc = " 'c', 'c' is copied into it, and the original glyph is considered the fill"] - #[doc = " target. We do the same to all cardinally-connected cells having this same"] - #[doc = " fill target. Returns the number of cells polyfilled. An invalid initial y, x"] - #[doc = " is an error. Returns the number of cells filled, or -1 on error."] - pub fn ncplane_polyfill_yx( - n: *mut ncplane, - y: cty::c_int, - x: cty::c_int, - c: *const nccell, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Draw a gradient with its upper-left corner at the current cursor position,"] - #[doc = " stopping at 'ystop'x'xstop'. The glyph composed of 'egc' and 'stylemask' is"] - #[doc = " used for all cells. The channels specified by 'ul', 'ur', 'll', and 'lr'"] - #[doc = " are composed into foreground and background gradients. To do a vertical"] - #[doc = " gradient, 'ul' ought equal 'ur' and 'll' ought equal 'lr'. To do a"] - #[doc = " horizontal gradient, 'ul' ought equal 'll' and 'ur' ought equal 'ul'. To"] - #[doc = " color everything the same, all four channels should be equivalent. The"] - #[doc = " resulting alpha values are equal to incoming alpha values. Returns the"] - #[doc = " number of cells filled on success, or -1 on failure."] - #[doc = ""] - #[doc = " Palette-indexed color is not supported."] - #[doc = ""] - #[doc = " Preconditions for gradient operations (error otherwise):"] - #[doc = ""] - #[doc = " all: only RGB colors, unless all four channels match as default"] - #[doc = " all: all alpha values must be the same"] - #[doc = " 1x1: all four colors must be the same"] - #[doc = " 1xN: both top and both bottom colors must be the same (vertical gradient)"] - #[doc = " Nx1: both left and both right colors must be the same (horizontal gradient)"] - pub fn ncplane_gradient( - n: *mut ncplane, - egc: *const cty::c_char, - stylemask: u32, - ul: u64, - ur: u64, - ll: u64, - lr: u64, - ystop: cty::c_int, - xstop: cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Do a high-resolution gradient using upper blocks and synced backgrounds."] - #[doc = " This doubles the number of vertical gradations, but restricts you to"] - #[doc = " half blocks (appearing to be full blocks). Returns the number of cells"] - #[doc = " filled on success, or -1 on error."] - pub fn ncplane_highgradient( - n: *mut ncplane, - ul: u32, - ur: u32, - ll: u32, - lr: u32, - ystop: cty::c_int, - xstop: cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " ncplane_gradent_sized() meets ncplane_highgradient()."] - pub fn ncplane_highgradient_sized( - n: *mut ncplane, - ul: u32, - ur: u32, - ll: u32, - lr: u32, - ylen: cty::c_int, - xlen: cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Set the given style throughout the specified region, keeping content and"] - #[doc = " channels unchanged. Returns the number of cells set, or -1 on failure."] - pub fn ncplane_format( - n: *mut ncplane, - ystop: cty::c_int, - xstop: cty::c_int, - stylemask: u32, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Set the given channels throughout the specified region, keeping content and"] - #[doc = " attributes unchanged. Returns the number of cells set, or -1 on failure."] - pub fn ncplane_stain( - n: *mut ncplane, - ystop: cty::c_int, - xstop: cty::c_int, - ul: u64, - ur: u64, - ll: u64, - lr: u64, - ) -> cty::c_int; -} -extern "C" { - #[doc = " If 'src' does not intersect with 'dst', 'dst' will not be changed, but it is"] - #[doc = " not an error. If 'dst' is NULL, the operation will target the standard plane."] - pub fn ncplane_mergedown_simple(src: *const ncplane, dst: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Merge the ncplane 'src' down onto the ncplane 'dst'. This is most rigorously"] - #[doc = " defined as \"write to 'dst' the frame that would be rendered were the entire"] - #[doc = " stack made up only of the specified subregion of 'src' and, below it, the"] - #[doc = " subregion of 'dst' having the specified origin. Merging is independent of"] - #[doc = " the position of 'src' viz 'dst' on the z-axis. It is an error to define a"] - #[doc = " subregion of zero area, or that is not entirely contained within 'src'. It"] - #[doc = " is an error to define a target origin such that the projected subregion is"] - #[doc = " not entirely contained within 'dst'. Behavior is undefined if 'src' and"] - #[doc = " 'dst' are equivalent. 'dst' is modified, but 'src' remains unchanged."] - pub fn ncplane_mergedown( - src: *const ncplane, - dst: *mut ncplane, - begsrcy: cty::c_int, - begsrcx: cty::c_int, - leny: cty::c_int, - lenx: cty::c_int, - dsty: cty::c_int, - dstx: cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Erase every cell in the ncplane (each cell is initialized to the null glyph"] - #[doc = " and the default channels/styles). All cells associated with this ncplane are"] - #[doc = " invalidated, and must not be used after the call, *excluding* the base cell."] - #[doc = " The cursor is homed. The plane's active attributes are unaffected."] - pub fn ncplane_erase(n: *mut ncplane); -} -extern "C" { - pub fn ncplane_set_channels(n: *mut ncplane, channels: u64); -} -extern "C" { - #[doc = " Set the specified style bits for the ncplane 'n', whether they're actively"] - #[doc = " supported or not."] - pub fn ncplane_set_styles(n: *mut ncplane, stylebits: cty::c_uint); -} -extern "C" { - #[doc = " Add the specified styles to the ncplane's existing spec."] - pub fn ncplane_on_styles(n: *mut ncplane, stylebits: cty::c_uint); -} -extern "C" { - #[doc = " Remove the specified styles from the ncplane's existing spec."] - pub fn ncplane_off_styles(n: *mut ncplane, stylebits: cty::c_uint); -} -extern "C" { - #[doc = " Deprecated forms of above."] - pub fn ncplane_styles_set(n: *mut ncplane, stylebits: cty::c_uint); -} -extern "C" { - pub fn ncplane_styles_on(n: *mut ncplane, stylebits: cty::c_uint); -} -extern "C" { - pub fn ncplane_styles_off(n: *mut ncplane, stylebits: cty::c_uint); -} -extern "C" { - #[doc = " Set an entire 32-bit channel of the plane"] - pub fn ncplane_set_fchannel(n: *mut ncplane, channel: u32) -> u64; -} -extern "C" { - pub fn ncplane_set_bchannel(n: *mut ncplane, channel: u32) -> u64; -} -extern "C" { - #[doc = " Set the current fore/background color using RGB specifications. If the"] - #[doc = " terminal does not support directly-specified 3x8b cells (24-bit \"TrueColor\","] - #[doc = " indicated by the \"RGB\" terminfo capability), the provided values will be"] - #[doc = " interpreted in some lossy fashion. None of r, g, or b may exceed 255."] - #[doc = " \"HP-like\" terminals require setting foreground and background at the same"] - #[doc = " time using \"color pairs\"; Notcurses will manage color pairs transparently."] - pub fn ncplane_set_fg_rgb8( - n: *mut ncplane, - r: cty::c_int, - g: cty::c_int, - b: cty::c_int, - ) -> cty::c_int; -} -extern "C" { - pub fn ncplane_set_bg_rgb8( - n: *mut ncplane, - r: cty::c_int, - g: cty::c_int, - b: cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Same, but clipped to [0..255]."] - pub fn ncplane_set_bg_rgb8_clipped( - n: *mut ncplane, - r: cty::c_int, - g: cty::c_int, - b: cty::c_int, - ); -} -extern "C" { - pub fn ncplane_set_fg_rgb8_clipped( - n: *mut ncplane, - r: cty::c_int, - g: cty::c_int, - b: cty::c_int, - ); -} -extern "C" { - #[doc = " Same, but with rgb assembled into a channel (i.e. lower 24 bits)."] - pub fn ncplane_set_fg_rgb(n: *mut ncplane, channel: u32) -> cty::c_int; -} -extern "C" { - pub fn ncplane_set_bg_rgb(n: *mut ncplane, channel: u32) -> cty::c_int; -} -extern "C" { - #[doc = " Use the default color for the foreground/background."] - pub fn ncplane_set_fg_default(n: *mut ncplane); -} -extern "C" { - pub fn ncplane_set_bg_default(n: *mut ncplane); -} -extern "C" { - #[doc = " Set the ncplane's foreground palette index, set the foreground palette index"] - #[doc = " bit, set it foreground-opaque, and clear the foreground default color bit."] - pub fn ncplane_set_fg_palindex(n: *mut ncplane, idx: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn ncplane_set_bg_palindex(n: *mut ncplane, idx: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Set the alpha parameters for ncplane 'n'."] - pub fn ncplane_set_fg_alpha(n: *mut ncplane, alpha: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn ncplane_set_bg_alpha(n: *mut ncplane, alpha: cty::c_int) -> cty::c_int; -} -#[doc = " Called for each fade iteration on 'ncp'. If anything but 0 is returned,"] -#[doc = " the fading operation ceases immediately, and that value is propagated out."] -#[doc = " The recommended absolute display time target is passed in 'tspec'."] -pub type fadecb = ::core::option::Option< - unsafe extern "C" fn( - nc: *mut notcurses, - n: *mut ncplane, - arg1: *const timespec, - curry: *mut cty::c_void, - ) -> cty::c_int, ->; -extern "C" { - #[doc = " Fade the ncplane out over the provided time, calling 'fader' at each"] - #[doc = " iteration. Requires a terminal which supports truecolor, or at least palette"] - #[doc = " modification (if the terminal uses a palette, our ability to fade planes is"] - #[doc = " limited, and affected by the complexity of the rest of the screen)."] - pub fn ncplane_fadeout( - n: *mut ncplane, - ts: *const timespec, - fader: fadecb, - curry: *mut cty::c_void, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Fade the ncplane in over the specified time. Load the ncplane with the"] - #[doc = " target cells without rendering, then call this function. When it's done, the"] - #[doc = " ncplane will have reached the target levels, starting from zeroes."] - pub fn ncplane_fadein( - n: *mut ncplane, - ts: *const timespec, - fader: fadecb, - curry: *mut cty::c_void, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Rather than the simple ncplane_fade{in/out}(), ncfadectx_setup() can be"] - #[doc = " paired with a loop over ncplane_fade{in/out}_iteration() + ncfadectx_free()."] - pub fn ncfadectx_setup(n: *mut ncplane) -> *mut ncfadectx; -} -extern "C" { - #[doc = " Return the number of iterations through which 'nctx' will fade."] - pub fn ncfadectx_iterations(nctx: *const ncfadectx) -> cty::c_int; -} -extern "C" { - #[doc = " Fade out through 'iter' iterations, where"] - #[doc = " 'iter' < 'ncfadectx_iterations(nctx)'."] - pub fn ncplane_fadeout_iteration( - n: *mut ncplane, - nctx: *mut ncfadectx, - iter: cty::c_int, - fader: fadecb, - curry: *mut cty::c_void, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Fade in through 'iter' iterations, where"] - #[doc = " 'iter' < 'ncfadectx_iterations(nctx)'."] - pub fn ncplane_fadein_iteration( - n: *mut ncplane, - nctx: *mut ncfadectx, - iter: cty::c_int, - fader: fadecb, - curry: *mut cty::c_void, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Pulse the plane in and out until the callback returns non-zero, relying on"] - #[doc = " the callback 'fader' to initiate rendering. 'ts' defines the half-period"] - #[doc = " (i.e. the transition from black to full brightness, or back again). Proper"] - #[doc = " use involves preparing (but not rendering) an ncplane, then calling"] - #[doc = " ncplane_pulse(), which will fade in from black to the specified colors."] - pub fn ncplane_pulse( - n: *mut ncplane, - ts: *const timespec, - fader: fadecb, - curry: *mut cty::c_void, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Release the resources associated with 'nctx'."] - pub fn ncfadectx_free(nctx: *mut ncfadectx); -} -extern "C" { - pub fn cells_rounded_box( - n: *mut ncplane, - styles: u32, - channels: u64, - ul: *mut nccell, - ur: *mut nccell, - ll: *mut nccell, - lr: *mut nccell, - hl: *mut nccell, - vl: *mut nccell, - ) -> cty::c_int; -} -extern "C" { - pub fn cells_double_box( - n: *mut ncplane, - styles: u32, - channels: u64, - ul: *mut nccell, - ur: *mut nccell, - ll: *mut nccell, - lr: *mut nccell, - hl: *mut nccell, - vl: *mut nccell, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Open a visual at 'file', extract a codec and parameters, decode the first"] - #[doc = " image to memory."] - pub fn ncvisual_from_file(file: *const cty::c_char) -> *mut ncvisual; -} -extern "C" { - #[doc = " Prepare an ncvisual, and its underlying plane, based off RGBA content in"] - #[doc = " memory at 'rgba'. 'rgba' must be a flat array of 32-bit 8bpc RGBA pixels."] - #[doc = " These must be arranged in 'rowstride' lines, where the first 'cols' * 4b"] - #[doc = " are actual data. There must be 'rows' lines. The total size of 'rgba'"] - #[doc = " must thus be at least (rows * rowstride) bytes, of which (rows * cols * 4)"] - #[doc = " bytes are actual data. Resulting planes are ceil('rows' / 2) x 'cols'."] - pub fn ncvisual_from_rgba( - rgba: *const cty::c_void, - rows: cty::c_int, - rowstride: cty::c_int, - cols: cty::c_int, - ) -> *mut ncvisual; -} -extern "C" { - #[doc = " ncvisual_from_rgba(), but 'bgra' is arranged as BGRA."] - pub fn ncvisual_from_bgra( - rgba: *const cty::c_void, - rows: cty::c_int, - rowstride: cty::c_int, - cols: cty::c_int, - ) -> *mut ncvisual; -} -extern "C" { - #[doc = " Promote an ncplane 'n' to an ncvisual. The plane may contain only spaces,"] - #[doc = " half blocks, and full blocks. The latter will be checked, and any other"] - #[doc = " glyph will result in a NULL being returned. This function exists so that"] - #[doc = " planes can be subjected to ncvisual transformations. If possible, it's"] - #[doc = " better to create the ncvisual from memory using ncvisual_from_rgba()."] - pub fn ncvisual_from_plane( - n: *const ncplane, - blit: ncblitter_e, - begy: cty::c_int, - begx: cty::c_int, - leny: cty::c_int, - lenx: cty::c_int, - ) -> *mut ncvisual; -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncvisual_options { - #[doc = " if no ncplane is provided, one will be created using the exact size"] - #[doc = " necessary to render the source with perfect fidelity (this might be"] - #[doc = " smaller or larger than the rendering area)."] - pub n: *mut ncplane, - #[doc = " the scaling is ignored if no ncplane is provided (it ought be NCSCALE_NONE"] - #[doc = " in this case). otherwise, the source is stretched/scaled relative to the"] - #[doc = " provided ncplane."] - pub scaling: ncscale_e, - #[doc = " if an ncplane is provided, y and x specify where the visual will be"] - #[doc = " rendered on that plane. otherwise, they specify where the created ncplane"] - #[doc = " will be placed relative to the standard plane's origin."] - pub y: cty::c_int, - #[doc = " if an ncplane is provided, y and x specify where the visual will be"] - #[doc = " rendered on that plane. otherwise, they specify where the created ncplane"] - #[doc = " will be placed relative to the standard plane's origin."] - pub x: cty::c_int, - #[doc = " origin of rendered section"] - pub begy: cty::c_int, - #[doc = " origin of rendered section"] - pub begx: cty::c_int, - #[doc = " size of rendered section"] - pub leny: cty::c_int, - #[doc = " size of rendered section"] - pub lenx: cty::c_int, - #[doc = " glyph set to use (maps input to output cells)"] - pub blitter: ncblitter_e, - #[doc = " bitmask over NCVISUAL_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncvisual_options() { - assert_eq!( - ::core::mem::size_of::(), - 48usize, - concat!("Size of: ", stringify!(ncvisual_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncvisual_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).n as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(n) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).scaling as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(scaling) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).y as *const _ as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(y) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).x as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(x) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).begy as *const _ as usize }, - 20usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(begy) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).begx as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(begx) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).leny as *const _ as usize }, - 28usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(leny) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).lenx as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(lenx) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).blitter as *const _ as usize }, - 36usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(blitter) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(flags) - ) - ); -} -extern "C" { - #[doc = " Create an RGBA flat array from the selected region of the ncplane 'nc'."] - #[doc = " Start at the plane's 'begy'x'begx' coordinate (which must lie on the"] - #[doc = " plane), continuing for 'leny'x'lenx' cells. Either or both of 'leny' and"] - #[doc = " 'lenx' can be specified as -1 to go through the boundary of the plane."] - #[doc = " Only glyphs from the specified blitset may be present."] - pub fn ncplane_rgba( - n: *const ncplane, - blit: ncblitter_e, - begy: cty::c_int, - begx: cty::c_int, - leny: cty::c_int, - lenx: cty::c_int, - ) -> *mut u32; -} -extern "C" { - #[doc = " Get the size and ratio of ncvisual pixels to output cells along the y"] - #[doc = " ('toy') and x ('tox') axes. A ncvisual of '*y'X'*x' pixels will require"] - #[doc = " ('*y' * '*toy')X('x' * 'tox') cells for full output. Returns non-zero"] - #[doc = " for an invalid 'vopts->blitter'. Scaling is taken into consideration."] - pub fn ncvisual_geom( - nc: *const notcurses, - n: *const ncvisual, - vopts: *const ncvisual_options, - y: *mut cty::c_int, - x: *mut cty::c_int, - toy: *mut cty::c_int, - tox: *mut cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Destroy an ncvisual. Rendered elements will not be disrupted, but the visual"] - #[doc = " can be neither decoded nor rendered any further."] - pub fn ncvisual_destroy(ncv: *mut ncvisual); -} -extern "C" { - #[doc = " extract the next frame from an ncvisual. returns 1 on end of file, 0 on"] - #[doc = " success, and -1 on failure."] - pub fn ncvisual_decode(nc: *mut ncvisual) -> cty::c_int; -} -extern "C" { - #[doc = " decode the next frame ala ncvisual_decode(), but if we have reached the end,"] - #[doc = " rewind to the first frame of the ncvisual. a subsequent 'ncvisual_render()'"] - #[doc = " will render the first frame, as if the ncvisual had been closed and reopened."] - #[doc = " the return values remain the same as those of ncvisual_decode()."] - pub fn ncvisual_decode_loop(nc: *mut ncvisual) -> cty::c_int; -} -extern "C" { - #[doc = " Rotate the visual 'rads' radians. Only M_PI/2 and -M_PI/2 are"] - #[doc = " supported at the moment, but this will change FIXME."] - pub fn ncvisual_rotate(n: *mut ncvisual, rads: f64) -> cty::c_int; -} -extern "C" { - #[doc = " Resize the visual so that it is 'rows' X 'columns'. This is a lossy"] - #[doc = " transformation, unless the size is unchanged."] - pub fn ncvisual_resize(n: *mut ncvisual, rows: cty::c_int, cols: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Polyfill at the specified location within the ncvisual 'n', using 'rgba'."] - pub fn ncvisual_polyfill_yx( - n: *mut ncvisual, - y: cty::c_int, - x: cty::c_int, - rgba: u32, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Get the specified pixel from the specified ncvisual."] - pub fn ncvisual_at_yx( - n: *const ncvisual, - y: cty::c_int, - x: cty::c_int, - pixel: *mut u32, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Set the specified pixel in the specified ncvisual."] - pub fn ncvisual_set_yx( - n: *const ncvisual, - y: cty::c_int, - x: cty::c_int, - pixel: u32, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Render the decoded frame to the specified ncplane (if one is not provided,"] - #[doc = " one will be created, having the exact size necessary to display the visual."] - #[doc = " In this case, 'style' must be NCSTYLE_NONE). A subregion of the visual can"] - #[doc = " be rendered using 'begx', 'begy', 'lenx', and 'leny'. Negative values for"] - #[doc = " 'begy' or 'begx' are an error. It is an error to specify any region beyond"] - #[doc = " the boundaries of the frame. Returns the plane to which we drew (if ncv->n"] - #[doc = " is NULL, a new plane will be created)."] - pub fn ncvisual_render( - nc: *mut notcurses, - ncv: *mut ncvisual, - vopts: *const ncvisual_options, - ) -> *mut ncplane; -} -extern "C" { - #[doc = " If a subtitle ought be displayed at this time, return a heap-allocated copy"] - #[doc = " of the UTF8 text."] - pub fn ncvisual_subtitle(ncv: *const ncvisual) -> *mut cty::c_char; -} -#[doc = " Called for each frame rendered from 'ncv'. If anything but 0 is returned,"] -#[doc = " the streaming operation ceases immediately, and that value is propagated out."] -#[doc = " The recommended absolute display time target is passed in 'tspec'."] -pub type streamcb = ::core::option::Option< - unsafe extern "C" fn( - arg1: *mut ncvisual, - arg2: *mut ncvisual_options, - arg3: *const timespec, - arg4: *mut cty::c_void, - ) -> cty::c_int, ->; -extern "C" { - #[doc = " Shut up and display my frames! Provide as an argument to ncvisual_stream()."] - #[doc = " If you'd like subtitles to be decoded, provide an ncplane as the curry. If the"] - #[doc = " curry is NULL, subtitles will not be displayed."] - pub fn ncvisual_simple_streamer( - ncv: *mut ncvisual, - vopts: *mut ncvisual_options, - tspec: *const timespec, - curry: *mut cty::c_void, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Stream the entirety of the media, according to its own timing. Blocking,"] - #[doc = " obviously. streamer may be NULL; it is otherwise called for each frame, and"] - #[doc = " its return value handled as outlined for streamcb. If streamer() returns"] - #[doc = " non-zero, the stream is aborted, and that value is returned. By convention,"] - #[doc = " return a positive number to indicate intentional abort from within"] - #[doc = " streamer(). 'timescale' allows the frame duration time to be scaled. For a"] - #[doc = " visual naturally running at 30FPS, a 'timescale' of 0.1 will result in"] - #[doc = " 300FPS, and a 'timescale' of 10 will result in 3FPS. It is an error to"] - #[doc = " supply 'timescale' less than or equal to 0."] - pub fn ncvisual_stream( - nc: *mut notcurses, - ncv: *mut ncvisual, - timescale: f32, - streamer: streamcb, - vopts: *const ncvisual_options, - curry: *mut cty::c_void, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Blit a flat array 'data' of RGBA 32-bit values to the ncplane 'vopts->n',"] - #[doc = " which mustn't be NULL. the blit begins at 'vopts->y' and 'vopts->x' relative"] - #[doc = " to the specified plane. Each source row ought occupy 'linesize' bytes (this"] - #[doc = " might be greater than 'vopts->lenx' * 4 due to padding or partial blits). A"] - #[doc = " subregion of the input can be specified with the 'begy'x'begx' and"] - #[doc = " 'leny'x'lenx' fields from 'vopts'. Returns the number of pixels blitted, or"] - #[doc = " -1 on error."] - pub fn ncblit_rgba( - data: *const cty::c_void, - linesize: cty::c_int, - vopts: *const ncvisual_options, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Same as ncblit_rgba(), but for BGRx."] - pub fn ncblit_bgrx( - data: *const cty::c_void, - linesize: cty::c_int, - vopts: *const ncvisual_options, - ) -> cty::c_int; -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncreel_options { - #[doc = " bitfield; 1s will not be drawn (see bordermaskbits)"] - pub bordermask: cty::c_uint, - #[doc = " attributes used for ncreel border"] - pub borderchan: u64, - #[doc = " bitfield; same as bordermask but for tablet borders"] - pub tabletmask: cty::c_uint, - #[doc = " tablet border styling channel"] - pub tabletchan: u64, - #[doc = " focused tablet border styling channel"] - pub focusedchan: u64, - #[doc = " bitfield over NCREEL_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncreel_options() { - assert_eq!( - ::core::mem::size_of::(), - 48usize, - concat!("Size of: ", stringify!(ncreel_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncreel_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).bordermask as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncreel_options), - "::", - stringify!(bordermask) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).borderchan as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncreel_options), - "::", - stringify!(borderchan) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).tabletmask as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncreel_options), - "::", - stringify!(tabletmask) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).tabletchan as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncreel_options), - "::", - stringify!(tabletchan) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).focusedchan as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncreel_options), - "::", - stringify!(focusedchan) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(ncreel_options), - "::", - stringify!(flags) - ) - ); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct nctablet { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncreel { - _unused: [u8; 0], -} -extern "C" { - #[doc = " Take over the ncplane 'nc' and use it to draw a reel according to 'popts'."] - #[doc = " The plane will be destroyed by ncreel_destroy(); this transfers ownership."] - pub fn ncreel_create(n: *mut ncplane, popts: *const ncreel_options) -> *mut ncreel; -} -extern "C" { - #[doc = " Returns the ncplane on which this ncreel lives."] - pub fn ncreel_plane(pr: *mut ncreel) -> *mut ncplane; -} -#[doc = " Tablet draw callback, provided a tablet (from which the ncplane and userptr"] -#[doc = " may be extracted), and a bool indicating whether output ought be drawn from"] -#[doc = " the top (true) or bottom (false). Returns non-negative count of output lines,"] -#[doc = " which must be less than or equal to ncplane_dim_y(nctablet_plane(t))."] -pub type tabletcb = - ::core::option::Option cty::c_int>; -extern "C" { - #[doc = " Add a new nctablet to the provided ncreel 'nr', having the callback object"] - #[doc = " 'opaque'. Neither, either, or both of 'after' and 'before' may be specified."] - #[doc = " If neither is specified, the new tablet can be added anywhere on the reel."] - #[doc = " If one or the other is specified, the tablet will be added before or after"] - #[doc = " the specified tablet. If both are specified, the tablet will be added to the"] - #[doc = " resulting location, assuming it is valid (after->next == before->prev); if"] - #[doc = " it is not valid, or there is any other error, NULL will be returned."] - pub fn ncreel_add( - nr: *mut ncreel, - after: *mut nctablet, - before: *mut nctablet, - cb: tabletcb, - opaque: *mut cty::c_void, - ) -> *mut nctablet; -} -extern "C" { - #[doc = " Return the number of nctablets in the ncreel 'nr'."] - pub fn ncreel_tabletcount(nr: *const ncreel) -> cty::c_int; -} -extern "C" { - #[doc = " Delete the tablet specified by t from the ncreel 'nr'. Returns -1 if the"] - #[doc = " tablet cannot be found."] - pub fn ncreel_del(nr: *mut ncreel, t: *mut nctablet) -> cty::c_int; -} -extern "C" { - #[doc = " Redraw the ncreel 'nr' in its entirety. The reel will be cleared, and"] - #[doc = " tablets will be lain out, using the focused tablet as a fulcrum. Tablet"] - #[doc = " drawing callbacks will be invoked for each visible tablet."] - pub fn ncreel_redraw(nr: *mut ncreel) -> cty::c_int; -} -extern "C" { - #[doc = " Offer input 'ni' to the ncreel 'nr'. If it's relevant, this function returns"] - #[doc = " true, and the input ought not be processed further. If it's irrelevant to"] - #[doc = " the reel, false is returned. Relevant inputs include:"] - #[doc = " * a mouse click on a tablet (focuses tablet)"] - #[doc = " * a mouse scrollwheel event (rolls reel)"] - #[doc = " * up, down, pgup, or pgdown (navigates among items)"] - pub fn ncreel_offer_input(nr: *mut ncreel, ni: *const ncinput) -> bool; -} -extern "C" { - #[doc = " Return the focused tablet, if any tablets are present. This is not a copy;"] - #[doc = " be careful to use it only for the duration of a critical section."] - pub fn ncreel_focused(nr: *mut ncreel) -> *mut nctablet; -} -extern "C" { - #[doc = " Change focus to the next tablet, if one exists"] - pub fn ncreel_next(nr: *mut ncreel) -> *mut nctablet; -} -extern "C" { - #[doc = " Change focus to the previous tablet, if one exists"] - pub fn ncreel_prev(nr: *mut ncreel) -> *mut nctablet; -} -extern "C" { - #[doc = " Destroy an ncreel allocated with ncreel_create()."] - pub fn ncreel_destroy(nr: *mut ncreel); -} -extern "C" { - #[doc = " Returns a pointer to a user pointer associated with this nctablet."] - pub fn nctablet_userptr(t: *mut nctablet) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Access the ncplane associated with nctablet 't', if one exists."] - pub fn nctablet_plane(t: *mut nctablet) -> *mut ncplane; -} -extern "C" { - #[doc = " Deprecated form of nctablet_plane()."] - pub fn nctablet_ncplane(t: *mut nctablet) -> *mut ncplane; -} -extern "C" { - #[doc = " Takes an arbitrarily large number, and prints it into a fixed-size buffer by"] - #[doc = " adding the necessary SI suffix. Usually, pass a |[IB]PREFIXSTRLEN+1|-sized"] - #[doc = " buffer to generate up to |[IB]PREFIXCOLUMNS| columns' worth of EGCs. The"] - #[doc = " characteristic can occupy up through |mult-1| characters (3 for 1000, 4 for"] - #[doc = " 1024). The mantissa can occupy either zero or two characters."] - #[doc = ""] - #[doc = " Floating-point is never used, because an IEEE758 double can only losslessly"] - #[doc = " represent integers through 2^53-1."] - #[doc = ""] - #[doc = " 2^64-1 is 18446744073709551615, 18.45E(xa). KMGTPEZY thus suffice to handle"] - #[doc = " an 89-bit uintmax_t. Beyond Z(etta) and Y(otta) lie lands unspecified by SI."] - #[doc = " 2^-63 is 0.000000000000000000108, 1.08a(tto)."] - #[doc = " val: value to print"] - #[doc = " decimal: scaling. '1' if none has taken place."] - #[doc = " buf: buffer in which string will be generated"] - #[doc = " omitdec: inhibit printing of all-0 decimal portions"] - #[doc = " mult: base of suffix system (almost always 1000 or 1024)"] - #[doc = " uprefix: character to print following suffix ('i' for kibibytes basically)."] - #[doc = " only printed if suffix is actually printed (input >= mult)."] - #[doc = ""] - #[doc = " You are encouraged to consult notcurses_metric(3)."] - pub fn ncmetric( - val: uintmax_t, - decimal: uintmax_t, - buf: *mut cty::c_char, - omitdec: cty::c_int, - mult: uintmax_t, - uprefix: cty::c_int, - ) -> *const cty::c_char; -} -extern "C" { - #[doc = " Enable or disable the terminal's cursor, if supported, placing it at"] - #[doc = " 'y', 'x'. Immediate effect (no need for a call to notcurses_render())."] - #[doc = " It is an error if 'y', 'x' lies outside the standard plane."] - pub fn notcurses_cursor_enable(nc: *mut notcurses, y: cty::c_int, x: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn notcurses_cursor_disable(nc: *mut notcurses) -> cty::c_int; -} -#[doc = " Palette API. Some terminals only support 256 colors, but allow the full"] -#[doc = " palette to be specified with arbitrary RGB colors. In all cases, it's more"] -#[doc = " performant to use indexed colors, since it's much less data to write to the"] -#[doc = " terminal. If you can limit yourself to 256 colors, that's probably best."] -#[repr(C)] -#[derive(Copy, Clone)] -pub struct palette256 { - #[doc = " RGB values as regular ol' channels"] - pub chans: [u32; 256usize], -} -#[test] -fn bindgen_test_layout_palette256() { - assert_eq!( - ::core::mem::size_of::(), - 1024usize, - concat!("Size of: ", stringify!(palette256)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(palette256)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).chans as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(palette256), - "::", - stringify!(chans) - ) - ); -} -extern "C" { - #[doc = " Create a new palette store. It will be initialized with notcurses' best"] - #[doc = " knowledge of the currently configured palette. The palette upon startup"] - #[doc = " cannot be reliably detected, sadly."] - pub fn palette256_new(nc: *mut notcurses) -> *mut palette256; -} -extern "C" { - #[doc = " Attempt to configure the terminal with the provided palette 'p'. Does not"] - #[doc = " transfer ownership of 'p'; palette256_free() can (ought) still be called."] - pub fn palette256_use(nc: *mut notcurses, p: *const palette256) -> cty::c_int; -} -extern "C" { - #[doc = " Free the palette store 'p'."] - pub fn palette256_free(p: *mut palette256); -} -extern "C" { - #[doc = " Convert the plane's content to greyscale."] - pub fn ncplane_greyscale(n: *mut ncplane); -} -#[doc = " selection widget -- an ncplane with a title header and a body section. the"] -#[doc = " body section supports infinite scrolling up and down."] -#[doc = ""] -#[doc = " At all times, exactly one item is selected."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncselector_item { - pub option: *mut cty::c_char, - pub desc: *mut cty::c_char, - #[doc = " filled in by library"] - pub opcolumns: size_t, - #[doc = " filled in by library"] - pub desccolumns: size_t, -} -#[test] -fn bindgen_test_layout_ncselector_item() { - assert_eq!( - ::core::mem::size_of::(), - 32usize, - concat!("Size of: ", stringify!(ncselector_item)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncselector_item)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).option as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncselector_item), - "::", - stringify!(option) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).desc as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncselector_item), - "::", - stringify!(desc) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).opcolumns as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncselector_item), - "::", - stringify!(opcolumns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).desccolumns as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncselector_item), - "::", - stringify!(desccolumns) - ) - ); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncselector_options { - #[doc = " title may be NULL, inhibiting riser, saving two rows."] - pub title: *mut cty::c_char, - #[doc = " secondary may be NULL"] - pub secondary: *mut cty::c_char, - #[doc = " footer may be NULL"] - pub footer: *mut cty::c_char, - #[doc = " initial items and descriptions"] - pub items: *mut ncselector_item, - #[doc = " default item (selected at start), must be < itemcount unless itemcount is"] - #[doc = " 0, in which case 'defidx' must also be 0"] - pub defidx: cty::c_uint, - #[doc = " maximum number of options to display at once, 0 to use all available space"] - pub maxdisplay: cty::c_uint, - #[doc = " option channels"] - pub opchannels: u64, - #[doc = " description channels"] - pub descchannels: u64, - #[doc = " title channels"] - pub titlechannels: u64, - #[doc = " secondary and footer channels"] - pub footchannels: u64, - #[doc = " border channels"] - pub boxchannels: u64, - #[doc = " bitfield of NCSELECTOR_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncselector_options() { - assert_eq!( - ::core::mem::size_of::(), - 88usize, - concat!("Size of: ", stringify!(ncselector_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncselector_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).title as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(title) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).secondary as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(secondary) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).footer as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(footer) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).items as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(items) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).defidx as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(defidx) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).maxdisplay as *const _ as usize }, - 36usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(maxdisplay) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).opchannels as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(opchannels) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).descchannels as *const _ as usize - }, - 48usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(descchannels) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).titlechannels as *const _ as usize - }, - 56usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(titlechannels) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).footchannels as *const _ as usize - }, - 64usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(footchannels) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).boxchannels as *const _ as usize }, - 72usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(boxchannels) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 80usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(flags) - ) - ); -} -extern "C" { - pub fn ncselector_create(n: *mut ncplane, opts: *const ncselector_options) -> *mut ncselector; -} -extern "C" { - #[doc = " Dynamically add or delete items. It is usually sufficient to supply a static"] - #[doc = " list of items via ncselector_options->items."] - pub fn ncselector_additem(n: *mut ncselector, item: *const ncselector_item) -> cty::c_int; -} -extern "C" { - pub fn ncselector_delitem(n: *mut ncselector, item: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Return reference to the selected option, or NULL if there are no items."] - pub fn ncselector_selected(n: *const ncselector) -> *const cty::c_char; -} -extern "C" { - #[doc = " Return a reference to the ncselector's underlying ncplane."] - pub fn ncselector_plane(n: *mut ncselector) -> *mut ncplane; -} -extern "C" { - #[doc = " Move up or down in the list. A reference to the newly-selected item is"] - #[doc = " returned, or NULL if there are no items in the list."] - pub fn ncselector_previtem(n: *mut ncselector) -> *const cty::c_char; -} -extern "C" { - pub fn ncselector_nextitem(n: *mut ncselector) -> *const cty::c_char; -} -extern "C" { - #[doc = " Offer the input to the ncselector. If it's relevant, this function returns"] - #[doc = " true, and the input ought not be processed further. If it's irrelevant to"] - #[doc = " the selector, false is returned. Relevant inputs include:"] - #[doc = " * a mouse click on an item"] - #[doc = " * a mouse scrollwheel event"] - #[doc = " * a mouse click on the scrolling arrows"] - #[doc = " * up, down, pgup, or pgdown on an unrolled menu (navigates among items)"] - pub fn ncselector_offer_input(n: *mut ncselector, nc: *const ncinput) -> bool; -} -extern "C" { - #[doc = " Destroy the ncselector. If 'item' is not NULL, the last selected option will"] - #[doc = " be strdup()ed and assigned to '*item' (and must be free()d by the caller)."] - pub fn ncselector_destroy(n: *mut ncselector, item: *mut *mut cty::c_char); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncmselector_item { - pub option: *mut cty::c_char, - pub desc: *mut cty::c_char, - pub selected: bool, -} -#[test] -fn bindgen_test_layout_ncmselector_item() { - assert_eq!( - ::core::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(ncmselector_item)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncmselector_item)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).option as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncmselector_item), - "::", - stringify!(option) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).desc as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncmselector_item), - "::", - stringify!(desc) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).selected as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncmselector_item), - "::", - stringify!(selected) - ) - ); -} -#[doc = " multiselection widget -- a selector supporting multiple selections."] -#[doc = ""] -#[doc = " Unlike the selector widget, zero to all of the items can be selected, but"] -#[doc = " also the widget does not support adding or removing items at runtime."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncmultiselector_options { - #[doc = " title may be NULL, inhibiting riser, saving two rows."] - pub title: *mut cty::c_char, - #[doc = " secondary may be NULL"] - pub secondary: *mut cty::c_char, - #[doc = " footer may be NULL"] - pub footer: *mut cty::c_char, - #[doc = " initial items, descriptions, and statuses"] - pub items: *mut ncmselector_item, - #[doc = " maximum number of options to display at once, 0 to use all available space"] - pub maxdisplay: cty::c_uint, - #[doc = " option channels"] - pub opchannels: u64, - #[doc = " description channels"] - pub descchannels: u64, - #[doc = " title channels"] - pub titlechannels: u64, - #[doc = " secondary and footer channels"] - pub footchannels: u64, - #[doc = " border channels"] - pub boxchannels: u64, - #[doc = " bitfield of NCMULTISELECTOR_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncmultiselector_options() { - assert_eq!( - ::core::mem::size_of::(), - 88usize, - concat!("Size of: ", stringify!(ncmultiselector_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncmultiselector_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).title as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(title) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).secondary as *const _ as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(secondary) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).footer as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(footer) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).items as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(items) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).maxdisplay as *const _ as usize - }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(maxdisplay) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).opchannels as *const _ as usize - }, - 40usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(opchannels) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).descchannels as *const _ as usize - }, - 48usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(descchannels) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).titlechannels as *const _ as usize - }, - 56usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(titlechannels) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).footchannels as *const _ as usize - }, - 64usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(footchannels) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).boxchannels as *const _ as usize - }, - 72usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(boxchannels) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 80usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(flags) - ) - ); -} -extern "C" { - pub fn ncmultiselector_create( - n: *mut ncplane, - opts: *const ncmultiselector_options, - ) -> *mut ncmultiselector; -} -extern "C" { - #[doc = " Return selected vector. An array of bools must be provided, along with its"] - #[doc = " length. If that length doesn't match the itemcount, it is an error."] - pub fn ncmultiselector_selected( - n: *mut ncmultiselector, - selected: *mut bool, - count: cty::c_uint, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Return a reference to the ncmultiselector's underlying ncplane."] - pub fn ncmultiselector_plane(n: *mut ncmultiselector) -> *mut ncplane; -} -extern "C" { - #[doc = " Offer the input to the ncmultiselector. If it's relevant, this function"] - #[doc = " returns true, and the input ought not be processed further. If it's"] - #[doc = " irrelevant to the multiselector, false is returned. Relevant inputs include:"] - #[doc = " * a mouse click on an item"] - #[doc = " * a mouse scrollwheel event"] - #[doc = " * a mouse click on the scrolling arrows"] - #[doc = " * up, down, pgup, or pgdown on an unrolled menu (navigates among items)"] - pub fn ncmultiselector_offer_input(n: *mut ncmultiselector, nc: *const ncinput) -> bool; -} -extern "C" { - #[doc = " Destroy the ncmultiselector."] - pub fn ncmultiselector_destroy(n: *mut ncmultiselector); -} -#[doc = " Menus. Horizontal menu bars are supported, on the top and/or bottom rows."] -#[doc = " If the menu bar is longer than the screen, it will be only partially"] -#[doc = " visible. Menus may be either visible or invisible by default. In the event of"] -#[doc = " a screen resize, menus will be automatically moved/resized. Elements can be"] -#[doc = " dynamically enabled or disabled at all levels (menu, section, and item),"] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncmenu_item { - #[doc = " utf-8 menu item, NULL for horizontal separator"] - pub desc: *mut cty::c_char, - #[doc = " shortcut, all should be distinct"] - pub shortcut: ncinput, -} -#[test] -fn bindgen_test_layout_ncmenu_item() { - assert_eq!( - ::core::mem::size_of::(), - 32usize, - concat!("Size of: ", stringify!(ncmenu_item)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncmenu_item)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).desc as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_item), - "::", - stringify!(desc) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).shortcut as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_item), - "::", - stringify!(shortcut) - ) - ); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncmenu_section { - #[doc = " utf-8 c string"] - pub name: *mut cty::c_char, - pub itemcount: cty::c_int, - pub items: *mut ncmenu_item, - #[doc = " shortcut, will be underlined if present in name"] - pub shortcut: ncinput, -} -#[test] -fn bindgen_test_layout_ncmenu_section() { - assert_eq!( - ::core::mem::size_of::(), - 48usize, - concat!("Size of: ", stringify!(ncmenu_section)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncmenu_section)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).name as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_section), - "::", - stringify!(name) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).itemcount as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_section), - "::", - stringify!(itemcount) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).items as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_section), - "::", - stringify!(items) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).shortcut as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_section), - "::", - stringify!(shortcut) - ) - ); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncmenu_options { - #[doc = " array of 'sectioncount' menu_sections"] - pub sections: *mut ncmenu_section, - #[doc = " must be positive"] - pub sectioncount: cty::c_int, - #[doc = " styling for header"] - pub headerchannels: u64, - #[doc = " styling for sections"] - pub sectionchannels: u64, - #[doc = " flag word of NCMENU_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncmenu_options() { - assert_eq!( - ::core::mem::size_of::(), - 40usize, - concat!("Size of: ", stringify!(ncmenu_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncmenu_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sections as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_options), - "::", - stringify!(sections) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sectioncount as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_options), - "::", - stringify!(sectioncount) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).headerchannels as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_options), - "::", - stringify!(headerchannels) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sectionchannels as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_options), - "::", - stringify!(sectionchannels) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_options), - "::", - stringify!(flags) - ) - ); -} -#[repr(C)] -#[derive(Debug)] -pub struct ncmenu { - _unused: [u8; 0], -} -extern "C" { - #[doc = " Create a menu with the specified options. Menus are currently bound to an"] - #[doc = " overall Notcurses object (as opposed to a particular plane), and are"] - #[doc = " implemented as ncplanes kept atop other ncplanes."] - pub fn ncmenu_create(n: *mut ncplane, opts: *const ncmenu_options) -> *mut ncmenu; -} -extern "C" { - #[doc = " Unroll the specified menu section, making the menu visible if it was"] - #[doc = " invisible, and rolling up any menu section that is already unrolled."] - pub fn ncmenu_unroll(n: *mut ncmenu, sectionidx: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Roll up any unrolled menu section, and hide the menu if using hiding."] - pub fn ncmenu_rollup(n: *mut ncmenu) -> cty::c_int; -} -extern "C" { - #[doc = " Unroll the previous/next section (relative to current unrolled). If no"] - #[doc = " section is unrolled, the first section will be unrolled."] - pub fn ncmenu_nextsection(n: *mut ncmenu) -> cty::c_int; -} -extern "C" { - pub fn ncmenu_prevsection(n: *mut ncmenu) -> cty::c_int; -} -extern "C" { - #[doc = " Move to the previous/next item within the currently unrolled section. If no"] - #[doc = " section is unrolled, the first section will be unrolled."] - pub fn ncmenu_nextitem(n: *mut ncmenu) -> cty::c_int; -} -extern "C" { - pub fn ncmenu_previtem(n: *mut ncmenu) -> cty::c_int; -} -extern "C" { - #[doc = " Disable or enable a menu item. Returns 0 if the item was found."] - pub fn ncmenu_item_set_status( - n: *mut ncmenu, - section: *const cty::c_char, - item: *const cty::c_char, - enabled: bool, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Return the selected item description, or NULL if no section is unrolled. If"] - #[doc = " 'ni' is not NULL, and the selected item has a shortcut, 'ni' will be filled"] - #[doc = " in with that shortcut--this can allow faster matching."] - pub fn ncmenu_selected(n: *const ncmenu, ni: *mut ncinput) -> *const cty::c_char; -} -extern "C" { - #[doc = " Return the item description corresponding to the mouse click 'click'. The"] - #[doc = " item must be on an actively unrolled section, and the click must be in the"] - #[doc = " area of a valid item. If 'ni' is not NULL, and the selected item has a"] - #[doc = " shortcut, 'ni' will be filled in with the shortcut."] - pub fn ncmenu_mouse_selected( - n: *const ncmenu, - click: *const ncinput, - ni: *mut ncinput, - ) -> *const cty::c_char; -} -extern "C" { - #[doc = " Return the ncplane backing this ncmenu."] - pub fn ncmenu_plane(n: *mut ncmenu) -> *mut ncplane; -} -extern "C" { - #[doc = " Offer the input to the ncmenu. If it's relevant, this function returns true,"] - #[doc = " and the input ought not be processed further. If it's irrelevant to the"] - #[doc = " menu, false is returned. Relevant inputs include:"] - #[doc = " * mouse movement over a hidden menu"] - #[doc = " * a mouse click on a menu section (the section is unrolled)"] - #[doc = " * a mouse click outside of an unrolled menu (the menu is rolled up)"] - #[doc = " * left or right on an unrolled menu (navigates among sections)"] - #[doc = " * up or down on an unrolled menu (navigates among items)"] - #[doc = " * escape on an unrolled menu (the menu is rolled up)"] - pub fn ncmenu_offer_input(n: *mut ncmenu, nc: *const ncinput) -> bool; -} -extern "C" { - #[doc = " Destroy a menu created with ncmenu_create()."] - pub fn ncmenu_destroy(n: *mut ncmenu) -> cty::c_int; -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncprogbar_options { - #[doc = " upper-left channel. in the context of a progress bar,"] - pub ulchannel: u32, - #[doc = " \"up\" is the direction we are progressing towards, and"] - pub urchannel: u32, - #[doc = " \"bottom\" is the direction of origin. for monochromatic"] - pub blchannel: u32, - #[doc = " bar, all four channels ought be the same."] - pub brchannel: u32, - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncprogbar_options() { - assert_eq!( - ::core::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(ncprogbar_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncprogbar_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).ulchannel as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncprogbar_options), - "::", - stringify!(ulchannel) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).urchannel as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(ncprogbar_options), - "::", - stringify!(urchannel) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).blchannel as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncprogbar_options), - "::", - stringify!(blchannel) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).brchannel as *const _ as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(ncprogbar_options), - "::", - stringify!(brchannel) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncprogbar_options), - "::", - stringify!(flags) - ) - ); -} -extern "C" { - #[doc = " Takes ownership of the ncplane 'n', which will be destroyed by"] - #[doc = " ncprogbar_destroy(). The progress bar is initially at 0%."] - pub fn ncprogbar_create(n: *mut ncplane, opts: *const ncprogbar_options) -> *mut ncprogbar; -} -extern "C" { - #[doc = " Return a reference to the ncprogbar's underlying ncplane."] - pub fn ncprogbar_plane(n: *mut ncprogbar) -> *mut ncplane; -} -extern "C" { - #[doc = " Set the progress bar's completion, a double 0 <= 'p' <= 1."] - pub fn ncprogbar_set_progress(n: *mut ncprogbar, p: f64) -> cty::c_int; -} -extern "C" { - #[doc = " Get the progress bar's completion, a double on [0, 1]."] - pub fn ncprogbar_progress(n: *const ncprogbar) -> f64; -} -extern "C" { - #[doc = " Destroy the progress bar and its underlying ncplane."] - pub fn ncprogbar_destroy(n: *mut ncprogbar); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncplot_options { - #[doc = " channels for the maximum and minimum levels. linear or exponential"] - #[doc = " interpolation will be applied across the domain between these two."] - pub maxchannels: u64, - pub minchannels: u64, - #[doc = " styling used for the legend, if NCPLOT_OPTION_LABELTICKSD is set"] - pub legendstyle: u16, - #[doc = " number of \"pixels\" per row x column"] - pub gridtype: ncblitter_e, - #[doc = " independent variable can either be a contiguous range, or a finite set"] - #[doc = " of keys. for a time range, say the previous hour sampled with second"] - #[doc = " resolution, the independent variable would be the range [0..3600): 3600."] - #[doc = " if rangex is 0, it is dynamically set to the number of columns."] - pub rangex: cty::c_int, - #[doc = " optional, printed by the labels"] - pub title: *const cty::c_char, - #[doc = " bitfield over NCPLOT_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncplot_options() { - assert_eq!( - ::core::mem::size_of::(), - 48usize, - concat!("Size of: ", stringify!(ncplot_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncplot_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).maxchannels as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncplot_options), - "::", - stringify!(maxchannels) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).minchannels as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncplot_options), - "::", - stringify!(minchannels) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).legendstyle as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncplot_options), - "::", - stringify!(legendstyle) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).gridtype as *const _ as usize }, - 20usize, - concat!( - "Offset of field: ", - stringify!(ncplot_options), - "::", - stringify!(gridtype) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).rangex as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncplot_options), - "::", - stringify!(rangex) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).title as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncplot_options), - "::", - stringify!(title) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(ncplot_options), - "::", - stringify!(flags) - ) - ); -} -extern "C" { - #[doc = " Use the provided plane 'n' for plotting according to the options 'opts'. The"] - #[doc = " plot will make free use of the entirety of the plane. For domain"] - #[doc = " autodiscovery, set miny == maxy == 0. ncuplot holds uint64_ts, while"] - #[doc = " ncdplot holds doubles."] - pub fn ncuplot_create( - n: *mut ncplane, - opts: *const ncplot_options, - miny: u64, - maxy: u64, - ) -> *mut ncuplot; -} -extern "C" { - pub fn ncdplot_create( - n: *mut ncplane, - opts: *const ncplot_options, - miny: f64, - maxy: f64, - ) -> *mut ncdplot; -} -extern "C" { - #[doc = " Return a reference to the ncplot's underlying ncplane."] - pub fn ncuplot_plane(n: *mut ncuplot) -> *mut ncplane; -} -extern "C" { - pub fn ncdplot_plane(n: *mut ncdplot) -> *mut ncplane; -} -extern "C" { - #[doc = " Add to or set the value corresponding to this x. If x is beyond the current"] - #[doc = " x window, the x window is advanced to include x, and values passing beyond"] - #[doc = " the window are lost. The first call will place the initial window. The plot"] - #[doc = " will be redrawn, but notcurses_render() is not called."] - pub fn ncuplot_add_sample(n: *mut ncuplot, x: u64, y: u64) -> cty::c_int; -} -extern "C" { - pub fn ncdplot_add_sample(n: *mut ncdplot, x: u64, y: f64) -> cty::c_int; -} -extern "C" { - pub fn ncuplot_set_sample(n: *mut ncuplot, x: u64, y: u64) -> cty::c_int; -} -extern "C" { - pub fn ncdplot_set_sample(n: *mut ncdplot, x: u64, y: f64) -> cty::c_int; -} -extern "C" { - pub fn ncuplot_sample(n: *const ncuplot, x: u64, y: *mut u64) -> cty::c_int; -} -extern "C" { - pub fn ncdplot_sample(n: *const ncdplot, x: u64, y: *mut f64) -> cty::c_int; -} -extern "C" { - pub fn ncuplot_destroy(n: *mut ncuplot); -} -extern "C" { - pub fn ncdplot_destroy(n: *mut ncdplot); -} -pub type ncfdplane_callback = ::core::option::Option< - unsafe extern "C" fn( - n: *mut ncfdplane, - buf: *const cty::c_void, - s: size_t, - curry: *mut cty::c_void, - ) -> cty::c_int, ->; -pub type ncfdplane_done_cb = ::core::option::Option< - unsafe extern "C" fn( - n: *mut ncfdplane, - fderrno: cty::c_int, - curry: *mut cty::c_void, - ) -> cty::c_int, ->; -#[doc = " read from an fd until EOF (or beyond, if follow is set), invoking the user's"] -#[doc = " callback each time. runs in its own context. on EOF or error, the finalizer"] -#[doc = " callback will be invoked, and the user ought destroy the ncfdplane. the"] -#[doc = " data is *not* guaranteed to be nul-terminated, and may contain arbitrary"] -#[doc = " zeroes."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncfdplane_options { - #[doc = " parameter provided to callbacks"] - pub curry: *mut cty::c_void, - #[doc = " keep reading after hitting end? (think tail -f)"] - pub follow: bool, - #[doc = " bitfield over NCOPTION_FDPLANE_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncfdplane_options() { - assert_eq!( - ::core::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(ncfdplane_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncfdplane_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).curry as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncfdplane_options), - "::", - stringify!(curry) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).follow as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncfdplane_options), - "::", - stringify!(follow) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncfdplane_options), - "::", - stringify!(flags) - ) - ); -} -extern "C" { - #[doc = " Create an ncfdplane around the fd 'fd'. Consider this function to take"] - #[doc = " ownership of the file descriptor, which will be closed in ncfdplane_destroy()."] - pub fn ncfdplane_create( - n: *mut ncplane, - opts: *const ncfdplane_options, - fd: cty::c_int, - cbfxn: ncfdplane_callback, - donecbfxn: ncfdplane_done_cb, - ) -> *mut ncfdplane; -} -extern "C" { - pub fn ncfdplane_plane(n: *mut ncfdplane) -> *mut ncplane; -} -extern "C" { - pub fn ncfdplane_destroy(n: *mut ncfdplane) -> cty::c_int; -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncsubproc_options { - pub curry: *mut cty::c_void, - #[doc = " restart this many seconds after an exit (watch)"] - pub restart_period: u64, - #[doc = " bitfield over NCOPTION_SUBPROC_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncsubproc_options() { - assert_eq!( - ::core::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(ncsubproc_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncsubproc_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).curry as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncsubproc_options), - "::", - stringify!(curry) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).restart_period as *const _ as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncsubproc_options), - "::", - stringify!(restart_period) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncsubproc_options), - "::", - stringify!(flags) - ) - ); -} -extern "C" { - #[doc = " see exec(2). p-types use $PATH. e-type passes environment vars."] - pub fn ncsubproc_createv( - n: *mut ncplane, - opts: *const ncsubproc_options, - bin: *const cty::c_char, - arg: *const *mut cty::c_char, - cbfxn: ncfdplane_callback, - donecbfxn: ncfdplane_done_cb, - ) -> *mut ncsubproc; -} -extern "C" { - pub fn ncsubproc_createvp( - n: *mut ncplane, - opts: *const ncsubproc_options, - bin: *const cty::c_char, - arg: *const *mut cty::c_char, - cbfxn: ncfdplane_callback, - donecbfxn: ncfdplane_done_cb, - ) -> *mut ncsubproc; -} -extern "C" { - pub fn ncsubproc_createvpe( - n: *mut ncplane, - opts: *const ncsubproc_options, - bin: *const cty::c_char, - arg: *const *mut cty::c_char, - env: *const *mut cty::c_char, - cbfxn: ncfdplane_callback, - donecbfxn: ncfdplane_done_cb, - ) -> *mut ncsubproc; -} -extern "C" { - pub fn ncsubproc_plane(n: *mut ncsubproc) -> *mut ncplane; -} -extern "C" { - pub fn ncsubproc_destroy(n: *mut ncsubproc) -> cty::c_int; -} -extern "C" { - #[doc = " Draw a QR code at the current position on the plane. If there is insufficient"] - #[doc = " room to draw the code here, or there is any other error, non-zero will be"] - #[doc = " returned. Otherwise, the QR code \"version\" (size) is returned. The QR code"] - #[doc = " is (version * 4 + 17) columns wide, and ⌈version * 4 + 17⌉ rows tall (the"] - #[doc = " properly-scaled values are written back to '*ymax' and '*xmax')."] - pub fn ncplane_qrcode( - n: *mut ncplane, - blitter: ncblitter_e, - ymax: *mut cty::c_int, - xmax: *mut cty::c_int, - data: *const cty::c_void, - len: size_t, - ) -> cty::c_int; -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncreader_options { - #[doc = " channels used for input"] - pub tchannels: u64, - #[doc = " attributes used for input"] - pub tattrword: u32, - #[doc = " bitfield of NCREADER_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncreader_options() { - assert_eq!( - ::core::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(ncreader_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncreader_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).tchannels as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncreader_options), - "::", - stringify!(tchannels) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).tattrword as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncreader_options), - "::", - stringify!(tattrword) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncreader_options), - "::", - stringify!(flags) - ) - ); -} -extern "C" { - #[doc = " ncreaders provide freeform input in a (possibly multiline) region, supporting"] - #[doc = " optional readline keybindings. takes ownership of 'n', destroying it on any"] - #[doc = " error (ncreader_destroy() otherwise destroys the ncplane)."] - pub fn ncreader_create(n: *mut ncplane, opts: *const ncreader_options) -> *mut ncreader; -} -extern "C" { - #[doc = " empty the ncreader of any user input, and home the cursor."] - pub fn ncreader_clear(n: *mut ncreader) -> cty::c_int; -} -extern "C" { - pub fn ncreader_plane(n: *mut ncreader) -> *mut ncplane; -} -extern "C" { - #[doc = " Offer the input to the ncreader. If it's relevant, this function returns"] - #[doc = " true, and the input ought not be processed further. Almost all inputs"] - #[doc = " are relevant to an ncreader, save synthesized ones."] - pub fn ncreader_offer_input(n: *mut ncreader, ni: *const ncinput) -> bool; -} -extern "C" { - #[doc = " Atttempt to move in the specified direction. Returns 0 if a move was"] - #[doc = " successfully executed, -1 otherwise. Scrolling is taken into account."] - pub fn ncreader_move_left(n: *mut ncreader) -> cty::c_int; -} -extern "C" { - pub fn ncreader_move_right(n: *mut ncreader) -> cty::c_int; -} -extern "C" { - pub fn ncreader_move_up(n: *mut ncreader) -> cty::c_int; -} -extern "C" { - pub fn ncreader_move_down(n: *mut ncreader) -> cty::c_int; -} -extern "C" { - #[doc = " Destructively write the provided EGC to the current cursor location. Move"] - #[doc = " the cursor as necessary, scrolling if applicable."] - pub fn ncreader_write_egc(n: *mut ncreader, egc: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " return a heap-allocated copy of the current (UTF-8) contents."] - pub fn ncreader_contents(n: *const ncreader) -> *mut cty::c_char; -} -extern "C" { - #[doc = " destroy the reader and its bound plane. if 'contents' is not NULL, the"] - #[doc = " UTF-8 input will be heap-duplicated and written to 'contents'."] - pub fn ncreader_destroy(n: *mut ncreader, contents: *mut *mut cty::c_char); -} -extern "C" { - #[doc = " Dump selected Notcurses state to the supplied 'debugfp'. Output is freeform,"] - #[doc = " and subject to change. It includes geometry of all planes, from all piles."] - pub fn notcurses_debug(nc: *mut notcurses, debugfp: *mut FILE); -} -#[doc = " a system for rendering RGBA pixels as text glyphs"] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct blitset { - pub geom: ncblitter_e, - pub width: cty::c_int, - pub height: cty::c_int, - #[doc = " the EGCs which form the various levels of a given plotset. if the geometry"] - #[doc = " is wide, things are arranged with the rightmost side increasing most"] - #[doc = " quickly, i.e. it can be indexed as height arrays of 1 + height glyphs. i.e."] - #[doc = " the first five braille EGCs are all 0 on the left, [0..4] on the right."] - pub egcs: *const wchar_t, - pub blit: ::core::option::Option< - unsafe extern "C" fn( - n: *mut ncplane, - placey: cty::c_int, - placex: cty::c_int, - linesize: cty::c_int, - data: *const cty::c_void, - begy: cty::c_int, - begx: cty::c_int, - leny: cty::c_int, - lenx: cty::c_int, - blendcolors: bool, - ) -> cty::c_int, - >, - pub name: *const cty::c_char, - pub fill: bool, -} -#[test] -fn bindgen_test_layout_blitset() { - assert_eq!( - ::core::mem::size_of::(), - 48usize, - concat!("Size of: ", stringify!(blitset)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(blitset)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).geom as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(blitset), - "::", - stringify!(geom) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).width as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(blitset), - "::", - stringify!(width) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).height as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(blitset), - "::", - stringify!(height) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).egcs as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(blitset), - "::", - stringify!(egcs) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).blit as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(blitset), - "::", - stringify!(blit) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).name as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(blitset), - "::", - stringify!(name) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).fill as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(blitset), - "::", - stringify!(fill) - ) - ); -} -extern "C" { - pub static mut notcurses_blitters: [blitset; 0usize]; -} -extern "C" { - #[doc = " Get the default *media* (not plot) blitter for this environment when using"] - #[doc = " the specified scaling method. Currently, this means:"] - #[doc = " - if lacking UTF-8, NCBLIT_1x1"] - #[doc = " - otherwise, if not NCSCALE_STRETCH, NCBLIT_2x1"] - #[doc = " - otherwise, if sextants are not known to be good, NCBLIT_2x2"] - #[doc = " - otherwise NCBLIT_3x2"] - #[doc = " NCBLIT_2x2 and NCBLIT_3x2 both distort the original aspect ratio, thus"] - #[doc = " NCBLIT_2x1 is used outside of NCSCALE_STRETCH."] - pub fn ncvisual_media_defblitter(nc: *const notcurses, scale: ncscale_e) -> ncblitter_e; -} -pub type ncdirectv = ncplane; -#[repr(C)] -#[derive(Debug)] -pub struct ncdirect { - _unused: [u8; 0], -} -extern "C" { - #[doc = " Initialize a direct-mode Notcurses context on the connected terminal at 'fp'."] - #[doc = " 'fp' must be a tty. You'll usually want stdout. Direct mode supports a"] - #[doc = " limited subset of Notcurses routines which directly affect 'fp', and neither"] - #[doc = " supports nor requires notcurses_render(). This can be used to add color and"] - #[doc = " styling to text in the standard output paradigm. 'flags' is a bitmask over"] - #[doc = " NCDIRECT_OPTION_*."] - #[doc = " Returns NULL on error, including any failure initializing terminfo."] - pub fn ncdirect_init(termtype: *const cty::c_char, fp: *mut FILE, flags: u64) -> *mut ncdirect; -} -extern "C" { - #[doc = " Direct mode. This API can be used to colorize and stylize output generated"] - #[doc = " outside of notcurses, without ever calling notcurses_render(). These should"] - #[doc = " not be intermixed with standard Notcurses rendering."] - pub fn ncdirect_fg_rgb(nc: *mut ncdirect, rgb: cty::c_uint) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_bg_rgb(nc: *mut ncdirect, rgb: cty::c_uint) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_fg_palindex(nc: *mut ncdirect, pidx: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_bg_palindex(nc: *mut ncdirect, pidx: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Returns the number of simultaneous colors claimed to be supported, or 1 if"] - #[doc = " there is no color support. Note that several terminal emulators advertise"] - #[doc = " more colors than they actually support, downsampling internally."] - pub fn ncdirect_palette_size(nc: *const ncdirect) -> cty::c_uint; -} -extern "C" { - #[doc = " Output the string |utf8| according to the channels |channels|. Note that"] - #[doc = " ncdirect_putstr() does not explicitly flush output buffers, so it will not"] - #[doc = " necessarily be immediately visible."] - pub fn ncdirect_putstr( - nc: *mut ncdirect, - channels: u64, - utf8: *const cty::c_char, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Formatted printing (plus alignment relative to the terminal). Returns the"] - #[doc = " number of columns printed on success."] - pub fn ncdirect_printf_aligned( - n: *mut ncdirect, - y: cty::c_int, - align: ncalign_e, - fmt: *const cty::c_char, - ... - ) -> cty::c_int; -} -extern "C" { - #[doc = " Force a flush. Returns 0 on success, -1 on failure."] - pub fn ncdirect_flush(nc: *const ncdirect) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_fg_default(nc: *mut ncdirect) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_bg_default(nc: *mut ncdirect) -> cty::c_int; -} -extern "C" { - #[doc = " Get the current number of columns/rows."] - pub fn ncdirect_dim_x(nc: *const ncdirect) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_dim_y(nc: *const ncdirect) -> cty::c_int; -} -extern "C" { - #[doc = " ncplane_styles_*() analogues"] - pub fn ncdirect_styles_set(n: *mut ncdirect, stylebits: cty::c_uint) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_styles_on(n: *mut ncdirect, stylebits: cty::c_uint) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_styles_off(n: *mut ncdirect, stylebits: cty::c_uint) -> cty::c_int; -} -extern "C" { - #[doc = " Move the cursor in direct mode. -1 to retain current location on that axis."] - pub fn ncdirect_cursor_move_yx(n: *mut ncdirect, y: cty::c_int, x: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_cursor_enable(nc: *mut ncdirect) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_cursor_disable(nc: *mut ncdirect) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_cursor_up(nc: *mut ncdirect, num: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_cursor_left(nc: *mut ncdirect, num: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_cursor_right(nc: *mut ncdirect, num: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_cursor_down(nc: *mut ncdirect, num: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Get the cursor position, when supported. This requires writing to the"] - #[doc = " terminal, and then reading from it. If the terminal doesn't reply, or"] - #[doc = " doesn't reply in a way we understand, the results might be deleterious."] - pub fn ncdirect_cursor_yx( - n: *mut ncdirect, - y: *mut cty::c_int, - x: *mut cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Push or pop the cursor location to the terminal's stack. The depth of this"] - #[doc = " stack, and indeed its existence, is terminal-dependent."] - pub fn ncdirect_cursor_push(n: *mut ncdirect) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_cursor_pop(n: *mut ncdirect) -> cty::c_int; -} -extern "C" { - #[doc = " Display an image using the specified blitter and scaling. The image may"] - #[doc = " be arbitrarily many rows -- the output will scroll -- but will only occupy"] - #[doc = " the column of the cursor, and those to the right. The render/raster process"] - #[doc = " can be split by using ncdirect_render_frame() and ncdirect_raster_frame()."] - pub fn ncdirect_render_image( - n: *mut ncdirect, - filename: *const cty::c_char, - align: ncalign_e, - blitter: ncblitter_e, - scale: ncscale_e, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Clear the screen."] - pub fn ncdirect_clear(nc: *mut ncdirect) -> cty::c_int; -} -extern "C" { - #[doc = " Can we load images? This requires being built against FFmpeg/OIIO."] - pub fn ncdirect_canopen_images(n: *const ncdirect) -> bool; -} -extern "C" { - #[doc = " Is our encoding UTF-8? Requires LANG being set to a UTF8 locale."] - pub fn ncdirect_canutf8(n: *const ncdirect) -> bool; -} -extern "C" { - #[doc = " Draw horizontal/vertical lines using the specified channels, interpolating"] - #[doc = " between them as we go. The EGC may not use more than one column. For a"] - #[doc = " horizontal line, |len| cannot exceed the screen width minus the cursor's"] - #[doc = " offset. For a vertical line, it may be as long as you'd like; the screen"] - #[doc = " will scroll as necessary. All lines start at the current cursor position."] - pub fn ncdirect_hline_interp( - n: *mut ncdirect, - egc: *const cty::c_char, - len: cty::c_int, - h1: u64, - h2: u64, - ) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_vline_interp( - n: *mut ncdirect, - egc: *const cty::c_char, - len: cty::c_int, - h1: u64, - h2: u64, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Draw a box with its upper-left corner at the current cursor position, having"] - #[doc = " dimensions |ylen|x|xlen|. See ncplane_box() for more information. The"] - #[doc = " minimum box size is 2x2, and it cannot be drawn off-screen. |wchars| is an"] - #[doc = " array of 6 wide characters: UL, UR, LL, LR, HL, VL."] - pub fn ncdirect_box( - n: *mut ncdirect, - ul: u64, - ur: u64, - ll: u64, - lr: u64, - wchars: *const wchar_t, - ylen: cty::c_int, - xlen: cty::c_int, - ctlword: cty::c_uint, - ) -> cty::c_int; -} -extern "C" { - #[doc = " ncdirect_box() with the rounded box-drawing characters"] - pub fn ncdirect_rounded_box( - n: *mut ncdirect, - ul: u64, - ur: u64, - ll: u64, - lr: u64, - ylen: cty::c_int, - xlen: cty::c_int, - ctlword: cty::c_uint, - ) -> cty::c_int; -} -extern "C" { - #[doc = " ncdirect_box() with the double box-drawing characters"] - pub fn ncdirect_double_box( - n: *mut ncdirect, - ul: u64, - ur: u64, - ll: u64, - lr: u64, - ylen: cty::c_int, - xlen: cty::c_int, - ctlword: cty::c_uint, - ) -> cty::c_int; -} -extern "C" { - #[doc = " See ppoll(2) for more detail. Provide a NULL 'ts' to block at length, a 'ts'"] - #[doc = " of 0 for non-blocking operation, and otherwise a timespec to bound blocking."] - #[doc = " Signals in sigmask (less several we handle internally) will be atomically"] - #[doc = " masked and unmasked per ppoll(2). '*sigmask' should generally contain all"] - #[doc = " signals. Returns a single Unicode code point, or (char32_t)-1 on error."] - #[doc = " 'sigmask' may be NULL. Returns 0 on a timeout. If an event is processed, the"] - #[doc = " return value is the 'id' field from that event. 'ni' may be NULL."] - pub fn ncdirect_getc( - n: *mut ncdirect, - ts: *const timespec, - sigmask: *mut sigset_t, - ni: *mut ncinput, - ) -> char32_t; -} -extern "C" { - #[doc = " Get a file descriptor suitable for input event poll()ing. When this"] - #[doc = " descriptor becomes available, you can call ncdirect_getc_nblock(),"] - #[doc = " and input ought be ready. This file descriptor is *not* necessarily"] - #[doc = " the file descriptor associated with stdin (but it might be!)."] - pub fn ncdirect_inputready_fd(n: *mut ncdirect) -> cty::c_int; -} -extern "C" { - #[doc = " Release 'nc' and any associated resources. 0 on success, non-0 on failure."] - pub fn ncdirect_stop(nc: *mut ncdirect) -> cty::c_int; -} -extern "C" { - #[doc = " Render an image using the specified blitter and scaling, but do not write"] - #[doc = " the result. The image may be arbitrarily many rows -- the output will scroll"] - #[doc = " -- but will only occupy the column of the cursor, and those to the right."] - #[doc = " To actually write (and free) this, invoke ncdirect_raster_frame()."] - pub fn ncdirect_render_frame( - n: *mut ncdirect, - filename: *const cty::c_char, - blitter: ncblitter_e, - scale: ncscale_e, - ) -> *mut ncdirectv; -} -extern "C" { - #[doc = " Takes the result of ncdirect_render_frame() and writes it to the output. The"] - #[doc = " 'align', 'blitter', and 'scale' arguments must be the same as those passed"] - #[doc = " to ncdirect_render_frame()."] - pub fn ncdirect_raster_frame( - n: *mut ncdirect, - faken: *mut ncdirectv, - align: ncalign_e, - blitter: ncblitter_e, - scale: ncscale_e, - ) -> cty::c_int; -} -pub type __builtin_va_list = [__va_list_tag; 1usize]; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct __va_list_tag { - pub gp_offset: cty::c_uint, - pub fp_offset: cty::c_uint, - pub overflow_arg_area: *mut cty::c_void, - pub reg_save_area: *mut cty::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) - ) - ); -} diff --git a/tools/function-summary/history/bindgen_20210321.rs b/tools/function-summary/history/bindgen_20210321.rs deleted file mode 100644 index f429f3355..000000000 --- a/tools/function-summary/history/bindgen_20210321.rs +++ /dev/null @@ -1,9232 +0,0 @@ -/* automatically generated by rust-bindgen 0.56.0 */ - -#[repr(C)] -#[derive(Default)] -pub struct __IncompleteArrayField(::core::marker::PhantomData, [T; 0]); -impl __IncompleteArrayField { - #[inline] - pub const fn new() -> Self { - __IncompleteArrayField(::core::marker::PhantomData, []) - } - #[inline] - pub fn as_ptr(&self) -> *const T { - self as *const _ as *const T - } - #[inline] - pub fn as_mut_ptr(&mut self) -> *mut T { - self as *mut _ as *mut T - } - #[inline] - pub unsafe fn as_slice(&self, len: usize) -> &[T] { - ::core::slice::from_raw_parts(self.as_ptr(), len) - } - #[inline] - pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] { - ::core::slice::from_raw_parts_mut(self.as_mut_ptr(), len) - } -} -impl ::core::fmt::Debug for __IncompleteArrayField { - fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - fmt.write_str("__IncompleteArrayField") - } -} -pub const _TIME_H: u32 = 1; -pub const _FEATURES_H: u32 = 1; -pub const __GLIBC_USE_ISOC2X: u32 = 0; -pub const __USE_ISOC11: u32 = 1; -pub const __USE_ISOC99: u32 = 1; -pub const __USE_ISOC95: u32 = 1; -pub const _POSIX_SOURCE: u32 = 1; -pub const _POSIX_C_SOURCE: u32 = 2; -pub const __USE_POSIX_IMPLICITLY: u32 = 1; -pub const __USE_POSIX: u32 = 1; -pub const __USE_POSIX2: u32 = 1; -pub const __USE_XOPEN: u32 = 1; -pub const __USE_FORTIFY_LEVEL: u32 = 0; -pub const __GLIBC_USE_DEPRECATED_GETS: u32 = 0; -pub const __GLIBC_USE_DEPRECATED_SCANF: u32 = 0; -pub const _STDC_PREDEF_H: u32 = 1; -pub const __STDC_IEC_559__: u32 = 1; -pub const __STDC_IEC_559_COMPLEX__: u32 = 1; -pub const __STDC_ISO_10646__: u32 = 201706; -pub const __GNU_LIBRARY__: u32 = 6; -pub const __GLIBC__: u32 = 2; -pub const __GLIBC_MINOR__: u32 = 31; -pub const _SYS_CDEFS_H: u32 = 1; -pub const __glibc_c99_flexarr_available: u32 = 1; -pub const __WORDSIZE: u32 = 64; -pub const __WORDSIZE_TIME64_COMPAT32: u32 = 1; -pub const __SYSCALL_WORDSIZE: u32 = 64; -pub const __LONG_DOUBLE_USES_FLOAT128: u32 = 0; -pub const __HAVE_GENERIC_SELECTION: u32 = 1; -pub const _BITS_TIME_H: u32 = 1; -pub const _BITS_TYPES_H: u32 = 1; -pub const __TIMESIZE: u32 = 64; -pub const _BITS_TYPESIZES_H: u32 = 1; -pub const __OFF_T_MATCHES_OFF64_T: u32 = 1; -pub const __INO_T_MATCHES_INO64_T: u32 = 1; -pub const __RLIM_T_MATCHES_RLIM64_T: u32 = 1; -pub const __STATFS_MATCHES_STATFS64: u32 = 1; -pub const __FD_SETSIZE: u32 = 1024; -pub const _BITS_TIME64_H: u32 = 1; -pub const __clock_t_defined: u32 = 1; -pub const __time_t_defined: u32 = 1; -pub const __struct_tm_defined: u32 = 1; -pub const _STRUCT_TIMESPEC: u32 = 1; -pub const _BITS_ENDIAN_H: u32 = 1; -pub const __LITTLE_ENDIAN: u32 = 1234; -pub const __BIG_ENDIAN: u32 = 4321; -pub const __PDP_ENDIAN: u32 = 3412; -pub const _BITS_ENDIANNESS_H: u32 = 1; -pub const __BYTE_ORDER: u32 = 1234; -pub const __FLOAT_WORD_ORDER: u32 = 1234; -pub const TIME_UTC: u32 = 1; -pub const _UCHAR_H: u32 = 1; -pub const __mbstate_t_defined: u32 = 1; -pub const ____mbstate_t_defined: u32 = 1; -pub const _CTYPE_H: u32 = 1; -pub const _WCHAR_H: u32 = 1; -pub const __GLIBC_USE_LIB_EXT2: u32 = 0; -pub const __GLIBC_USE_IEC_60559_BFP_EXT: u32 = 0; -pub const __GLIBC_USE_IEC_60559_BFP_EXT_C2X: u32 = 0; -pub const __GLIBC_USE_IEC_60559_FUNCS_EXT: u32 = 0; -pub const __GLIBC_USE_IEC_60559_FUNCS_EXT_C2X: u32 = 0; -pub const __GLIBC_USE_IEC_60559_TYPES_EXT: u32 = 0; -pub const __HAVE_FLOAT128: u32 = 0; -pub const __HAVE_DISTINCT_FLOAT128: u32 = 0; -pub const __HAVE_FLOAT64X: u32 = 1; -pub const __HAVE_FLOAT64X_LONG_DOUBLE: u32 = 1; -pub const __HAVE_FLOAT16: u32 = 0; -pub const __HAVE_FLOAT32: u32 = 1; -pub const __HAVE_FLOAT64: u32 = 1; -pub const __HAVE_FLOAT32X: u32 = 1; -pub const __HAVE_FLOAT128X: u32 = 0; -pub const __HAVE_DISTINCT_FLOAT16: u32 = 0; -pub const __HAVE_DISTINCT_FLOAT32: u32 = 0; -pub const __HAVE_DISTINCT_FLOAT64: u32 = 0; -pub const __HAVE_DISTINCT_FLOAT32X: u32 = 0; -pub const __HAVE_DISTINCT_FLOAT64X: u32 = 0; -pub const __HAVE_DISTINCT_FLOAT128X: u32 = 0; -pub const __HAVE_FLOATN_NOT_TYPEDEF: u32 = 0; -pub const __GNUC_VA_LIST: u32 = 1; -pub const _BITS_WCHAR_H: u32 = 1; -pub const __wint_t_defined: u32 = 1; -pub const _WINT_T: u32 = 1; -pub const ____FILE_defined: u32 = 1; -pub const WEOF: u32 = 4294967295; -pub const _BITS_WCTYPE_WCHAR_H: u32 = 1; -pub const _STDIO_H: u32 = 1; -pub const _____fpos_t_defined: u32 = 1; -pub const _____fpos64_t_defined: u32 = 1; -pub const __FILE_defined: u32 = 1; -pub const __struct_FILE_defined: u32 = 1; -pub const _IO_EOF_SEEN: u32 = 16; -pub const _IO_ERR_SEEN: u32 = 32; -pub const _IO_USER_LOCK: u32 = 32768; -pub const _IOFBF: u32 = 0; -pub const _IOLBF: u32 = 1; -pub const _IONBF: u32 = 2; -pub const BUFSIZ: u32 = 8192; -pub const EOF: i32 = -1; -pub const SEEK_SET: u32 = 0; -pub const SEEK_CUR: u32 = 1; -pub const SEEK_END: u32 = 2; -pub const P_tmpdir: &'static [u8; 5usize] = b"/tmp\0"; -pub const _BITS_STDIO_LIM_H: u32 = 1; -pub const L_tmpnam: u32 = 20; -pub const TMP_MAX: u32 = 238328; -pub const FILENAME_MAX: u32 = 4096; -pub const L_ctermid: u32 = 9; -pub const L_cuserid: u32 = 9; -pub const FOPEN_MAX: u32 = 16; -pub const _GETOPT_POSIX_H: u32 = 1; -pub const _GETOPT_CORE_H: u32 = 1; -pub const _STDINT_H: u32 = 1; -pub const _BITS_STDINT_INTN_H: u32 = 1; -pub const _BITS_STDINT_UINTN_H: u32 = 1; -pub const INT8_MIN: i32 = -128; -pub const INT16_MIN: i32 = -32768; -pub const INT32_MIN: i32 = -2147483648; -pub const INT8_MAX: u32 = 127; -pub const INT16_MAX: u32 = 32767; -pub const INT32_MAX: u32 = 2147483647; -pub const UINT8_MAX: u32 = 255; -pub const UINT16_MAX: u32 = 65535; -pub const UINT32_MAX: u32 = 4294967295; -pub const INT_LEAST8_MIN: i32 = -128; -pub const INT_LEAST16_MIN: i32 = -32768; -pub const INT_LEAST32_MIN: i32 = -2147483648; -pub const INT_LEAST8_MAX: u32 = 127; -pub const INT_LEAST16_MAX: u32 = 32767; -pub const INT_LEAST32_MAX: u32 = 2147483647; -pub const UINT_LEAST8_MAX: u32 = 255; -pub const UINT_LEAST16_MAX: u32 = 65535; -pub const UINT_LEAST32_MAX: u32 = 4294967295; -pub const INT_FAST8_MIN: i32 = -128; -pub const INT_FAST16_MIN: i64 = -9223372036854775808; -pub const INT_FAST32_MIN: i64 = -9223372036854775808; -pub const INT_FAST8_MAX: u32 = 127; -pub const INT_FAST16_MAX: u64 = 9223372036854775807; -pub const INT_FAST32_MAX: u64 = 9223372036854775807; -pub const UINT_FAST8_MAX: u32 = 255; -pub const UINT_FAST16_MAX: i32 = -1; -pub const UINT_FAST32_MAX: i32 = -1; -pub const INTPTR_MIN: i64 = -9223372036854775808; -pub const INTPTR_MAX: u64 = 9223372036854775807; -pub const UINTPTR_MAX: i32 = -1; -pub const PTRDIFF_MIN: i64 = -9223372036854775808; -pub const PTRDIFF_MAX: u64 = 9223372036854775807; -pub const SIG_ATOMIC_MIN: i32 = -2147483648; -pub const SIG_ATOMIC_MAX: u32 = 2147483647; -pub const SIZE_MAX: i32 = -1; -pub const WINT_MIN: u32 = 0; -pub const WINT_MAX: u32 = 4294967295; -pub const _STDLIB_H: u32 = 1; -pub const WNOHANG: u32 = 1; -pub const WUNTRACED: u32 = 2; -pub const __WNOTHREAD: u32 = 536870912; -pub const __WALL: u32 = 1073741824; -pub const __WCLONE: u32 = 2147483648; -pub const __W_CONTINUED: u32 = 65535; -pub const __WCOREFLAG: u32 = 128; -pub const __ldiv_t_defined: u32 = 1; -pub const __lldiv_t_defined: u32 = 1; -pub const RAND_MAX: u32 = 2147483647; -pub const EXIT_FAILURE: u32 = 1; -pub const EXIT_SUCCESS: u32 = 0; -pub const _STRING_H: u32 = 1; -pub const _BITS_SIGNUM_H: u32 = 1; -pub const _BITS_SIGNUM_GENERIC_H: u32 = 1; -pub const SIGINT: u32 = 2; -pub const SIGILL: u32 = 4; -pub const SIGABRT: u32 = 6; -pub const SIGFPE: u32 = 8; -pub const SIGSEGV: u32 = 11; -pub const SIGTERM: u32 = 15; -pub const SIGHUP: u32 = 1; -pub const SIGQUIT: u32 = 3; -pub const SIGTRAP: u32 = 5; -pub const SIGKILL: u32 = 9; -pub const SIGBUS: u32 = 10; -pub const SIGSYS: u32 = 12; -pub const SIGPIPE: u32 = 13; -pub const SIGALRM: u32 = 14; -pub const SIGURG: u32 = 16; -pub const SIGSTOP: u32 = 17; -pub const SIGTSTP: u32 = 18; -pub const SIGCONT: u32 = 19; -pub const SIGCHLD: u32 = 20; -pub const SIGTTIN: u32 = 21; -pub const SIGTTOU: u32 = 22; -pub const SIGPOLL: u32 = 23; -pub const SIGXCPU: u32 = 24; -pub const SIGXFSZ: u32 = 25; -pub const SIGVTALRM: u32 = 26; -pub const SIGPROF: u32 = 27; -pub const SIGUSR1: u32 = 30; -pub const SIGUSR2: u32 = 31; -pub const SIGWINCH: u32 = 28; -pub const SIGIO: u32 = 23; -pub const SIGIOT: u32 = 6; -pub const SIGCLD: u32 = 20; -pub const __SIGRTMIN: u32 = 32; -pub const __SIGRTMAX: u32 = 32; -pub const _NSIG: u32 = 33; -pub const SIGSTKFLT: u32 = 16; -pub const SIGPWR: u32 = 30; -pub const __sig_atomic_t_defined: u32 = 1; -pub const __sigset_t_defined: u32 = 1; -pub const _BITS_SIGACTION_H: u32 = 1; -pub const SA_NOCLDSTOP: u32 = 1; -pub const SA_NOCLDWAIT: u32 = 2; -pub const SA_SIGINFO: u32 = 4; -pub const SIG_BLOCK: u32 = 0; -pub const SIG_UNBLOCK: u32 = 1; -pub const SIG_SETMASK: u32 = 2; -pub const _LIBC_LIMITS_H_: u32 = 1; -pub const MB_LEN_MAX: u32 = 16; -pub const _BITS_POSIX1_LIM_H: u32 = 1; -pub const _POSIX_AIO_LISTIO_MAX: u32 = 2; -pub const _POSIX_AIO_MAX: u32 = 1; -pub const _POSIX_ARG_MAX: u32 = 4096; -pub const _POSIX_CHILD_MAX: u32 = 6; -pub const _POSIX_DELAYTIMER_MAX: u32 = 32; -pub const _POSIX_HOST_NAME_MAX: u32 = 255; -pub const _POSIX_LINK_MAX: u32 = 8; -pub const _POSIX_LOGIN_NAME_MAX: u32 = 9; -pub const _POSIX_MAX_CANON: u32 = 255; -pub const _POSIX_MAX_INPUT: u32 = 255; -pub const _POSIX_MQ_OPEN_MAX: u32 = 8; -pub const _POSIX_MQ_PRIO_MAX: u32 = 32; -pub const _POSIX_NAME_MAX: u32 = 14; -pub const _POSIX_NGROUPS_MAX: u32 = 0; -pub const _POSIX_OPEN_MAX: u32 = 16; -pub const _POSIX_FD_SETSIZE: u32 = 16; -pub const _POSIX_PATH_MAX: u32 = 256; -pub const _POSIX_PIPE_BUF: u32 = 512; -pub const _POSIX_RE_DUP_MAX: u32 = 255; -pub const _POSIX_RTSIG_MAX: u32 = 8; -pub const _POSIX_SEM_NSEMS_MAX: u32 = 256; -pub const _POSIX_SEM_VALUE_MAX: u32 = 32767; -pub const _POSIX_SIGQUEUE_MAX: u32 = 32; -pub const _POSIX_SSIZE_MAX: u32 = 32767; -pub const _POSIX_STREAM_MAX: u32 = 8; -pub const _POSIX_SYMLINK_MAX: u32 = 255; -pub const _POSIX_SYMLOOP_MAX: u32 = 8; -pub const _POSIX_TIMER_MAX: u32 = 32; -pub const _POSIX_TTY_NAME_MAX: u32 = 9; -pub const _POSIX_TZNAME_MAX: u32 = 3; -pub const _POSIX_QLIMIT: u32 = 1; -pub const _POSIX_HIWAT: u32 = 512; -pub const _POSIX_UIO_MAXIOV: u32 = 16; -pub const _POSIX_CLOCKRES_MIN: u32 = 20000000; -pub const NR_OPEN: u32 = 1024; -pub const NGROUPS_MAX: u32 = 65536; -pub const ARG_MAX: u32 = 131072; -pub const LINK_MAX: u32 = 127; -pub const MAX_CANON: u32 = 255; -pub const MAX_INPUT: u32 = 255; -pub const NAME_MAX: u32 = 255; -pub const PATH_MAX: u32 = 4096; -pub const PIPE_BUF: u32 = 4096; -pub const XATTR_NAME_MAX: u32 = 255; -pub const XATTR_SIZE_MAX: u32 = 65536; -pub const XATTR_LIST_MAX: u32 = 65536; -pub const RTSIG_MAX: u32 = 32; -pub const _POSIX_THREAD_KEYS_MAX: u32 = 128; -pub const PTHREAD_KEYS_MAX: u32 = 1024; -pub const _POSIX_THREAD_DESTRUCTOR_ITERATIONS: u32 = 4; -pub const PTHREAD_DESTRUCTOR_ITERATIONS: u32 = 4; -pub const _POSIX_THREAD_THREADS_MAX: u32 = 64; -pub const AIO_PRIO_DELTA_MAX: u32 = 20; -pub const PTHREAD_STACK_MIN: u32 = 16384; -pub const DELAYTIMER_MAX: u32 = 2147483647; -pub const TTY_NAME_MAX: u32 = 32; -pub const LOGIN_NAME_MAX: u32 = 256; -pub const HOST_NAME_MAX: u32 = 64; -pub const MQ_PRIO_MAX: u32 = 32768; -pub const SEM_VALUE_MAX: u32 = 2147483647; -pub const _BITS_POSIX2_LIM_H: u32 = 1; -pub const _POSIX2_BC_BASE_MAX: u32 = 99; -pub const _POSIX2_BC_DIM_MAX: u32 = 2048; -pub const _POSIX2_BC_SCALE_MAX: u32 = 99; -pub const _POSIX2_BC_STRING_MAX: u32 = 1000; -pub const _POSIX2_COLL_WEIGHTS_MAX: u32 = 2; -pub const _POSIX2_EXPR_NEST_MAX: u32 = 32; -pub const _POSIX2_LINE_MAX: u32 = 2048; -pub const _POSIX2_RE_DUP_MAX: u32 = 255; -pub const _POSIX2_CHARCLASS_NAME_MAX: u32 = 14; -pub const BC_BASE_MAX: u32 = 99; -pub const BC_DIM_MAX: u32 = 2048; -pub const BC_SCALE_MAX: u32 = 99; -pub const BC_STRING_MAX: u32 = 1000; -pub const COLL_WEIGHTS_MAX: u32 = 255; -pub const EXPR_NEST_MAX: u32 = 32; -pub const LINE_MAX: u32 = 2048; -pub const CHARCLASS_NAME_MAX: u32 = 2048; -pub const RE_DUP_MAX: u32 = 32767; -pub const _XOPEN_LIM_H: u32 = 1; -pub const _XOPEN_IOV_MAX: u32 = 16; -pub const _BITS_UIO_LIM_H: u32 = 1; -pub const __IOV_MAX: u32 = 1024; -pub const IOV_MAX: u32 = 1024; -pub const NL_ARGMAX: u32 = 4096; -pub const NL_LANGMAX: u32 = 2048; -pub const NZERO: u32 = 20; -pub const WORD_BIT: u32 = 32; -pub const LONG_BIT: u32 = 64; -pub const true_: u32 = 1; -pub const false_: u32 = 0; -pub const __bool_true_false_are_defined: u32 = 1; -pub const _BYTESWAP_H: u32 = 1; -pub const _BITS_BYTESWAP_H: u32 = 1; -pub const _NETINET_IN_H: u32 = 1; -pub const _SYS_SOCKET_H: u32 = 1; -pub const __iovec_defined: u32 = 1; -pub const _SYS_TYPES_H: u32 = 1; -pub const __clockid_t_defined: u32 = 1; -pub const __timer_t_defined: u32 = 1; -pub const __BIT_TYPES_DEFINED__: u32 = 1; -pub const PF_UNSPEC: u32 = 0; -pub const PF_LOCAL: u32 = 1; -pub const PF_UNIX: u32 = 1; -pub const PF_FILE: u32 = 1; -pub const PF_INET: u32 = 2; -pub const PF_AX25: u32 = 3; -pub const PF_IPX: u32 = 4; -pub const PF_APPLETALK: u32 = 5; -pub const PF_NETROM: u32 = 6; -pub const PF_BRIDGE: u32 = 7; -pub const PF_ATMPVC: u32 = 8; -pub const PF_X25: u32 = 9; -pub const PF_INET6: u32 = 10; -pub const PF_ROSE: u32 = 11; -pub const PF_DECnet: u32 = 12; -pub const PF_NETBEUI: u32 = 13; -pub const PF_SECURITY: u32 = 14; -pub const PF_KEY: u32 = 15; -pub const PF_NETLINK: u32 = 16; -pub const PF_ROUTE: u32 = 16; -pub const PF_PACKET: u32 = 17; -pub const PF_ASH: u32 = 18; -pub const PF_ECONET: u32 = 19; -pub const PF_ATMSVC: u32 = 20; -pub const PF_RDS: u32 = 21; -pub const PF_SNA: u32 = 22; -pub const PF_IRDA: u32 = 23; -pub const PF_PPPOX: u32 = 24; -pub const PF_WANPIPE: u32 = 25; -pub const PF_LLC: u32 = 26; -pub const PF_IB: u32 = 27; -pub const PF_MPLS: u32 = 28; -pub const PF_CAN: u32 = 29; -pub const PF_TIPC: u32 = 30; -pub const PF_BLUETOOTH: u32 = 31; -pub const PF_IUCV: u32 = 32; -pub const PF_RXRPC: u32 = 33; -pub const PF_ISDN: u32 = 34; -pub const PF_PHONET: u32 = 35; -pub const PF_IEEE802154: u32 = 36; -pub const PF_CAIF: u32 = 37; -pub const PF_ALG: u32 = 38; -pub const PF_NFC: u32 = 39; -pub const PF_VSOCK: u32 = 40; -pub const PF_KCM: u32 = 41; -pub const PF_QIPCRTR: u32 = 42; -pub const PF_SMC: u32 = 43; -pub const PF_XDP: u32 = 44; -pub const PF_MAX: u32 = 45; -pub const AF_UNSPEC: u32 = 0; -pub const AF_LOCAL: u32 = 1; -pub const AF_UNIX: u32 = 1; -pub const AF_FILE: u32 = 1; -pub const AF_INET: u32 = 2; -pub const AF_AX25: u32 = 3; -pub const AF_IPX: u32 = 4; -pub const AF_APPLETALK: u32 = 5; -pub const AF_NETROM: u32 = 6; -pub const AF_BRIDGE: u32 = 7; -pub const AF_ATMPVC: u32 = 8; -pub const AF_X25: u32 = 9; -pub const AF_INET6: u32 = 10; -pub const AF_ROSE: u32 = 11; -pub const AF_DECnet: u32 = 12; -pub const AF_NETBEUI: u32 = 13; -pub const AF_SECURITY: u32 = 14; -pub const AF_KEY: u32 = 15; -pub const AF_NETLINK: u32 = 16; -pub const AF_ROUTE: u32 = 16; -pub const AF_PACKET: u32 = 17; -pub const AF_ASH: u32 = 18; -pub const AF_ECONET: u32 = 19; -pub const AF_ATMSVC: u32 = 20; -pub const AF_RDS: u32 = 21; -pub const AF_SNA: u32 = 22; -pub const AF_IRDA: u32 = 23; -pub const AF_PPPOX: u32 = 24; -pub const AF_WANPIPE: u32 = 25; -pub const AF_LLC: u32 = 26; -pub const AF_IB: u32 = 27; -pub const AF_MPLS: u32 = 28; -pub const AF_CAN: u32 = 29; -pub const AF_TIPC: u32 = 30; -pub const AF_BLUETOOTH: u32 = 31; -pub const AF_IUCV: u32 = 32; -pub const AF_RXRPC: u32 = 33; -pub const AF_ISDN: u32 = 34; -pub const AF_PHONET: u32 = 35; -pub const AF_IEEE802154: u32 = 36; -pub const AF_CAIF: u32 = 37; -pub const AF_ALG: u32 = 38; -pub const AF_NFC: u32 = 39; -pub const AF_VSOCK: u32 = 40; -pub const AF_KCM: u32 = 41; -pub const AF_QIPCRTR: u32 = 42; -pub const AF_SMC: u32 = 43; -pub const AF_XDP: u32 = 44; -pub const AF_MAX: u32 = 45; -pub const SOL_RAW: u32 = 255; -pub const SOL_DECNET: u32 = 261; -pub const SOL_X25: u32 = 262; -pub const SOL_PACKET: u32 = 263; -pub const SOL_ATM: u32 = 264; -pub const SOL_AAL: u32 = 265; -pub const SOL_IRDA: u32 = 266; -pub const SOL_NETBEUI: u32 = 267; -pub const SOL_LLC: u32 = 268; -pub const SOL_DCCP: u32 = 269; -pub const SOL_NETLINK: u32 = 270; -pub const SOL_TIPC: u32 = 271; -pub const SOL_RXRPC: u32 = 272; -pub const SOL_PPPOL2TP: u32 = 273; -pub const SOL_BLUETOOTH: u32 = 274; -pub const SOL_PNPIPE: u32 = 275; -pub const SOL_RDS: u32 = 276; -pub const SOL_IUCV: u32 = 277; -pub const SOL_CAIF: u32 = 278; -pub const SOL_ALG: u32 = 279; -pub const SOL_NFC: u32 = 280; -pub const SOL_KCM: u32 = 281; -pub const SOL_TLS: u32 = 282; -pub const SOL_XDP: u32 = 283; -pub const SOMAXCONN: u32 = 4096; -pub const _BITS_SOCKADDR_H: u32 = 1; -pub const _SS_SIZE: u32 = 128; -pub const SO_DEBUG: u32 = 1; -pub const SOL_SOCKET: u32 = 1; -pub const SO_ACCEPTCONN: u32 = 30; -pub const SO_BROADCAST: u32 = 6; -pub const SO_DONTROUTE: u32 = 5; -pub const SO_ERROR: u32 = 4; -pub const SO_KEEPALIVE: u32 = 9; -pub const SO_LINGER: u32 = 13; -pub const SO_OOBINLINE: u32 = 10; -pub const SO_RCVBUF: u32 = 8; -pub const SO_RCVLOWAT: u32 = 18; -pub const SO_RCVTIMEO: u32 = 20; -pub const SO_REUSEADDR: u32 = 2; -pub const SO_SNDBUF: u32 = 7; -pub const SO_SNDLOWAT: u32 = 19; -pub const SO_SNDTIMEO: u32 = 21; -pub const SO_TYPE: u32 = 3; -pub const __USE_KERNEL_IPV6_DEFS: u32 = 0; -pub const IP_OPTIONS: u32 = 4; -pub const IP_HDRINCL: u32 = 3; -pub const IP_TOS: u32 = 1; -pub const IP_TTL: u32 = 2; -pub const IP_RECVOPTS: u32 = 6; -pub const IP_RETOPTS: u32 = 7; -pub const IP_MULTICAST_IF: u32 = 32; -pub const IP_MULTICAST_TTL: u32 = 33; -pub const IP_MULTICAST_LOOP: u32 = 34; -pub const IP_ADD_MEMBERSHIP: u32 = 35; -pub const IP_DROP_MEMBERSHIP: u32 = 36; -pub const IP_UNBLOCK_SOURCE: u32 = 37; -pub const IP_BLOCK_SOURCE: u32 = 38; -pub const IP_ADD_SOURCE_MEMBERSHIP: u32 = 39; -pub const IP_DROP_SOURCE_MEMBERSHIP: u32 = 40; -pub const IP_MSFILTER: u32 = 41; -pub const IP_ROUTER_ALERT: u32 = 5; -pub const IP_PKTINFO: u32 = 8; -pub const IP_PKTOPTIONS: u32 = 9; -pub const IP_PMTUDISC: u32 = 10; -pub const IP_MTU_DISCOVER: u32 = 10; -pub const IP_RECVERR: u32 = 11; -pub const IP_RECVTTL: u32 = 12; -pub const IP_RECVTOS: u32 = 13; -pub const IP_MTU: u32 = 14; -pub const IP_FREEBIND: u32 = 15; -pub const IP_IPSEC_POLICY: u32 = 16; -pub const IP_XFRM_POLICY: u32 = 17; -pub const IP_PASSSEC: u32 = 18; -pub const IP_TRANSPARENT: u32 = 19; -pub const IP_MULTICAST_ALL: u32 = 49; -pub const IP_ORIGDSTADDR: u32 = 20; -pub const IP_RECVORIGDSTADDR: u32 = 20; -pub const IP_MINTTL: u32 = 21; -pub const IP_NODEFRAG: u32 = 22; -pub const IP_CHECKSUM: u32 = 23; -pub const IP_BIND_ADDRESS_NO_PORT: u32 = 24; -pub const IP_RECVFRAGSIZE: u32 = 25; -pub const IP_PMTUDISC_DONT: u32 = 0; -pub const IP_PMTUDISC_WANT: u32 = 1; -pub const IP_PMTUDISC_DO: u32 = 2; -pub const IP_PMTUDISC_PROBE: u32 = 3; -pub const IP_PMTUDISC_INTERFACE: u32 = 4; -pub const IP_PMTUDISC_OMIT: u32 = 5; -pub const IP_UNICAST_IF: u32 = 50; -pub const SOL_IP: u32 = 0; -pub const IP_DEFAULT_MULTICAST_TTL: u32 = 1; -pub const IP_DEFAULT_MULTICAST_LOOP: u32 = 1; -pub const IP_MAX_MEMBERSHIPS: u32 = 20; -pub const IPV6_ADDRFORM: u32 = 1; -pub const IPV6_2292PKTINFO: u32 = 2; -pub const IPV6_2292HOPOPTS: u32 = 3; -pub const IPV6_2292DSTOPTS: u32 = 4; -pub const IPV6_2292RTHDR: u32 = 5; -pub const IPV6_2292PKTOPTIONS: u32 = 6; -pub const IPV6_CHECKSUM: u32 = 7; -pub const IPV6_2292HOPLIMIT: u32 = 8; -pub const IPV6_NEXTHOP: u32 = 9; -pub const IPV6_AUTHHDR: u32 = 10; -pub const IPV6_UNICAST_HOPS: u32 = 16; -pub const IPV6_MULTICAST_IF: u32 = 17; -pub const IPV6_MULTICAST_HOPS: u32 = 18; -pub const IPV6_MULTICAST_LOOP: u32 = 19; -pub const IPV6_JOIN_GROUP: u32 = 20; -pub const IPV6_LEAVE_GROUP: u32 = 21; -pub const IPV6_ROUTER_ALERT: u32 = 22; -pub const IPV6_MTU_DISCOVER: u32 = 23; -pub const IPV6_MTU: u32 = 24; -pub const IPV6_RECVERR: u32 = 25; -pub const IPV6_V6ONLY: u32 = 26; -pub const IPV6_JOIN_ANYCAST: u32 = 27; -pub const IPV6_LEAVE_ANYCAST: u32 = 28; -pub const IPV6_MULTICAST_ALL: u32 = 29; -pub const IPV6_ROUTER_ALERT_ISOLATE: u32 = 30; -pub const IPV6_IPSEC_POLICY: u32 = 34; -pub const IPV6_XFRM_POLICY: u32 = 35; -pub const IPV6_HDRINCL: u32 = 36; -pub const IPV6_RECVPKTINFO: u32 = 49; -pub const IPV6_PKTINFO: u32 = 50; -pub const IPV6_RECVHOPLIMIT: u32 = 51; -pub const IPV6_HOPLIMIT: u32 = 52; -pub const IPV6_RECVHOPOPTS: u32 = 53; -pub const IPV6_HOPOPTS: u32 = 54; -pub const IPV6_RTHDRDSTOPTS: u32 = 55; -pub const IPV6_RECVRTHDR: u32 = 56; -pub const IPV6_RTHDR: u32 = 57; -pub const IPV6_RECVDSTOPTS: u32 = 58; -pub const IPV6_DSTOPTS: u32 = 59; -pub const IPV6_RECVPATHMTU: u32 = 60; -pub const IPV6_PATHMTU: u32 = 61; -pub const IPV6_DONTFRAG: u32 = 62; -pub const IPV6_RECVTCLASS: u32 = 66; -pub const IPV6_TCLASS: u32 = 67; -pub const IPV6_AUTOFLOWLABEL: u32 = 70; -pub const IPV6_ADDR_PREFERENCES: u32 = 72; -pub const IPV6_MINHOPCOUNT: u32 = 73; -pub const IPV6_ORIGDSTADDR: u32 = 74; -pub const IPV6_RECVORIGDSTADDR: u32 = 74; -pub const IPV6_TRANSPARENT: u32 = 75; -pub const IPV6_UNICAST_IF: u32 = 76; -pub const IPV6_RECVFRAGSIZE: u32 = 77; -pub const IPV6_FREEBIND: u32 = 78; -pub const IPV6_ADD_MEMBERSHIP: u32 = 20; -pub const IPV6_DROP_MEMBERSHIP: u32 = 21; -pub const IPV6_RXHOPOPTS: u32 = 54; -pub const IPV6_RXDSTOPTS: u32 = 59; -pub const IPV6_PMTUDISC_DONT: u32 = 0; -pub const IPV6_PMTUDISC_WANT: u32 = 1; -pub const IPV6_PMTUDISC_DO: u32 = 2; -pub const IPV6_PMTUDISC_PROBE: u32 = 3; -pub const IPV6_PMTUDISC_INTERFACE: u32 = 4; -pub const IPV6_PMTUDISC_OMIT: u32 = 5; -pub const SOL_IPV6: u32 = 41; -pub const SOL_ICMPV6: u32 = 58; -pub const IPV6_RTHDR_LOOSE: u32 = 0; -pub const IPV6_RTHDR_STRICT: u32 = 1; -pub const IPV6_RTHDR_TYPE_0: u32 = 0; -pub const IN_CLASSA_NET: u32 = 4278190080; -pub const IN_CLASSA_NSHIFT: u32 = 24; -pub const IN_CLASSA_HOST: u32 = 16777215; -pub const IN_CLASSA_MAX: u32 = 128; -pub const IN_CLASSB_NET: u32 = 4294901760; -pub const IN_CLASSB_NSHIFT: u32 = 16; -pub const IN_CLASSB_HOST: u32 = 65535; -pub const IN_CLASSB_MAX: u32 = 65536; -pub const IN_CLASSC_NET: u32 = 4294967040; -pub const IN_CLASSC_NSHIFT: u32 = 8; -pub const IN_CLASSC_HOST: u32 = 255; -pub const IN_LOOPBACKNET: u32 = 127; -pub const INET_ADDRSTRLEN: u32 = 16; -pub const INET6_ADDRSTRLEN: u32 = 46; -pub const _ENDIAN_H: u32 = 1; -pub const _BITS_UINTN_IDENTITY_H: u32 = 1; -pub const NCKEY_ESC: u32 = 27; -pub const NCKEY_SPACE: u32 = 32; -pub const CELL_ALPHA_HIGHCONTRAST: u32 = 805306368; -pub const CELL_ALPHA_TRANSPARENT: u32 = 536870912; -pub const CELL_ALPHA_BLEND: u32 = 268435456; -pub const CELL_ALPHA_OPAQUE: u32 = 0; -pub const CELL_BGDEFAULT_MASK: u32 = 1073741824; -pub const CELL_FGDEFAULT_MASK: u64 = 4611686018427387904; -pub const CELL_BG_RGB_MASK: u32 = 16777215; -pub const CELL_FG_RGB_MASK: u64 = 72057589742960640; -pub const CELL_BG_PALETTE: u32 = 134217728; -pub const NCPALETTESIZE: u32 = 256; -pub const CELL_FG_PALETTE: u64 = 576460752303423488; -pub const CELL_BG_ALPHA_MASK: u32 = 805306368; -pub const CELL_FG_ALPHA_MASK: u64 = 3458764513820540928; -pub const NCSTYLE_MASK: u32 = 1023; -pub const NCSTYLE_STANDOUT: u32 = 128; -pub const NCSTYLE_UNDERLINE: u32 = 64; -pub const NCSTYLE_REVERSE: u32 = 32; -pub const NCSTYLE_BLINK: u32 = 16; -pub const NCSTYLE_DIM: u32 = 8; -pub const NCSTYLE_BOLD: u32 = 4; -pub const NCSTYLE_INVIS: u32 = 2; -pub const NCSTYLE_PROTECT: u32 = 1; -pub const NCSTYLE_ITALIC: u32 = 256; -pub const NCSTYLE_STRUCK: u32 = 512; -pub const NCSTYLE_NONE: u32 = 0; -pub const NCOPTION_INHIBIT_SETLOCALE: u32 = 1; -pub const NCOPTION_NO_WINCH_SIGHANDLER: u32 = 4; -pub const NCOPTION_NO_QUIT_SIGHANDLERS: u32 = 8; -pub const NCOPTION_SUPPRESS_BANNERS: u32 = 32; -pub const NCOPTION_NO_ALTERNATE_SCREEN: u32 = 64; -pub const NCOPTION_NO_FONT_CHANGES: u32 = 128; -pub const NCPLANE_OPTION_HORALIGNED: u32 = 1; -pub const WCHAR_MAX_UTF8BYTES: u32 = 6; -pub const NCBOXMASK_TOP: u32 = 1; -pub const NCBOXMASK_RIGHT: u32 = 2; -pub const NCBOXMASK_BOTTOM: u32 = 4; -pub const NCBOXMASK_LEFT: u32 = 8; -pub const NCBOXGRAD_TOP: u32 = 16; -pub const NCBOXGRAD_RIGHT: u32 = 32; -pub const NCBOXGRAD_BOTTOM: u32 = 64; -pub const NCBOXGRAD_LEFT: u32 = 128; -pub const NCBOXCORNER_MASK: u32 = 768; -pub const NCBOXCORNER_SHIFT: u32 = 8; -pub const NCVISUAL_OPTION_NODEGRADE: u32 = 1; -pub const NCVISUAL_OPTION_BLEND: u32 = 2; -pub const NCREEL_OPTION_INFINITESCROLL: u32 = 1; -pub const NCREEL_OPTION_CIRCULAR: u32 = 2; -pub const PREFIXCOLUMNS: u32 = 7; -pub const IPREFIXCOLUMNS: u32 = 8; -pub const BPREFIXCOLUMNS: u32 = 9; -pub const PREFIXSTRLEN: u32 = 8; -pub const IPREFIXSTRLEN: u32 = 9; -pub const BPREFIXSTRLEN: u32 = 10; -pub const NCMENU_OPTION_BOTTOM: u32 = 1; -pub const NCMENU_OPTION_HIDING: u32 = 2; -pub const NCPROGBAR_OPTION_RETROGRADE: u32 = 1; -pub const NCPLOT_OPTION_LABELTICKSD: u32 = 1; -pub const NCPLOT_OPTION_EXPONENTIALD: u32 = 2; -pub const NCPLOT_OPTION_VERTICALI: u32 = 4; -pub const NCPLOT_OPTION_NODEGRADE: u32 = 8; -pub const NCPLOT_OPTION_DETECTMAXONLY: u32 = 16; -pub const NCPLOT_OPTION_PRINTSAMPLE: u32 = 32; -pub const NCREADER_OPTION_HORSCROLL: u32 = 1; -pub const NCREADER_OPTION_VERSCROLL: u32 = 2; -pub const NCREADER_OPTION_NOCMDKEYS: u32 = 4; -pub const NCREADER_OPTION_CURSOR: u32 = 8; -pub const NCDIRECT_OPTION_INHIBIT_SETLOCALE: u32 = 1; -pub const NCDIRECT_OPTION_INHIBIT_CBREAK: u32 = 2; -pub const NCDIRECT_OPTION_NO_QUIT_SIGHANDLERS: u32 = 8; -pub type size_t = cty::c_ulong; -#[doc = " Convenience types."] -pub type __u_char = cty::c_uchar; -pub type __u_short = cty::c_ushort; -pub type __u_int = cty::c_uint; -pub type __u_long = cty::c_ulong; -#[doc = " Fixed-size types, underlying types depend on word size and compiler."] -pub type __int8_t = cty::c_schar; -pub type __uint8_t = cty::c_uchar; -pub type __int16_t = cty::c_short; -pub type __uint16_t = cty::c_ushort; -pub type __int32_t = cty::c_int; -pub type __uint32_t = cty::c_uint; -pub type __int64_t = cty::c_long; -pub type __uint64_t = cty::c_ulong; -#[doc = " Smallest types with at least a given width."] -pub type __int_least8_t = __int8_t; -pub type __uint_least8_t = __uint8_t; -pub type __int_least16_t = __int16_t; -pub type __uint_least16_t = __uint16_t; -pub type __int_least32_t = __int32_t; -pub type __uint_least32_t = __uint32_t; -pub type __int_least64_t = __int64_t; -pub type __uint_least64_t = __uint64_t; -pub type __quad_t = cty::c_long; -pub type __u_quad_t = cty::c_ulong; -pub type __intmax_t = cty::c_long; -pub type __uintmax_t = cty::c_ulong; -pub type __dev_t = cty::c_ulong; -pub type __uid_t = cty::c_uint; -pub type __gid_t = cty::c_uint; -pub type __ino_t = cty::c_ulong; -pub type __ino64_t = cty::c_ulong; -pub type __mode_t = cty::c_uint; -pub type __nlink_t = cty::c_ulong; -pub type __off_t = cty::c_long; -pub type __off64_t = cty::c_long; -pub type __pid_t = cty::c_int; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct __fsid_t { - pub __val: [cty::c_int; 2usize], -} -#[test] -fn bindgen_test_layout___fsid_t() { - assert_eq!( - ::core::mem::size_of::<__fsid_t>(), - 8usize, - concat!("Size of: ", stringify!(__fsid_t)) - ); - assert_eq!( - ::core::mem::align_of::<__fsid_t>(), - 4usize, - concat!("Alignment of ", stringify!(__fsid_t)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<__fsid_t>())).__val as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__fsid_t), - "::", - stringify!(__val) - ) - ); -} -pub type __clock_t = cty::c_long; -pub type __rlim_t = cty::c_ulong; -pub type __rlim64_t = cty::c_ulong; -pub type __id_t = cty::c_uint; -pub type __time_t = cty::c_long; -pub type __useconds_t = cty::c_uint; -pub type __suseconds_t = cty::c_long; -pub type __daddr_t = cty::c_int; -pub type __key_t = cty::c_int; -pub type __clockid_t = cty::c_int; -pub type __timer_t = *mut cty::c_void; -pub type __blksize_t = cty::c_long; -pub type __blkcnt_t = cty::c_long; -pub type __blkcnt64_t = cty::c_long; -pub type __fsblkcnt_t = cty::c_ulong; -pub type __fsblkcnt64_t = cty::c_ulong; -pub type __fsfilcnt_t = cty::c_ulong; -pub type __fsfilcnt64_t = cty::c_ulong; -pub type __fsword_t = cty::c_long; -pub type __ssize_t = cty::c_long; -pub type __syscall_slong_t = cty::c_long; -pub type __syscall_ulong_t = cty::c_ulong; -#[doc = " These few don't really vary by system, they always correspond"] -#[doc = "to one of the other defined types."] -pub type __loff_t = __off64_t; -pub type __caddr_t = *mut cty::c_char; -pub type __intptr_t = cty::c_long; -pub type __socklen_t = cty::c_uint; -#[doc = " C99: An integer type that can be accessed as an atomic entity,"] -#[doc = "even in the presence of asynchronous interrupts."] -#[doc = "It is not currently necessary for this to be machine-specific."] -pub type __sig_atomic_t = cty::c_int; -extern "C" { - #[doc = " Even though CLOCKS_PER_SEC has such a strange value CLK_TCK"] - #[doc = "presents the real value for clock ticks per second for the system."] - pub fn __sysconf(arg1: cty::c_int) -> cty::c_long; -} -#[doc = " Returned by `clock'."] -pub type clock_t = __clock_t; -#[doc = " Returned by `time'."] -pub type time_t = __time_t; -#[doc = " ISO C `broken-down time' structure."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct tm { - #[doc = " Seconds.\t[0-60] (1 leap second)"] - pub tm_sec: cty::c_int, - #[doc = " Minutes.\t[0-59]"] - pub tm_min: cty::c_int, - #[doc = " Hours.\t[0-23]"] - pub tm_hour: cty::c_int, - #[doc = " Day.\t\t[1-31]"] - pub tm_mday: cty::c_int, - #[doc = " Month.\t[0-11]"] - pub tm_mon: cty::c_int, - #[doc = " Year\t- 1900."] - pub tm_year: cty::c_int, - #[doc = " Day of week.\t[0-6]"] - pub tm_wday: cty::c_int, - #[doc = " Days in year.[0-365]"] - pub tm_yday: cty::c_int, - #[doc = " DST.\t\t[-1/0/1]"] - pub tm_isdst: cty::c_int, - #[doc = " Seconds east of UTC."] - pub __tm_gmtoff: cty::c_long, - #[doc = " Timezone abbreviation."] - pub __tm_zone: *const cty::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) - ) - ); -} -#[doc = " POSIX.1b structure for a time value. This is like a `struct timeval' but"] -#[doc = "has nanoseconds instead of microseconds."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct timespec { - #[doc = " Seconds."] - pub tv_sec: __time_t, - #[doc = " Nanoseconds."] - pub tv_nsec: __syscall_slong_t, -} -#[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) - ) - ); -} -extern "C" { - #[doc = " Time used by the program so far (user time + system time)."] - #[doc = "The result / CLOCKS_PER_SEC is program time in seconds."] - pub fn clock() -> clock_t; -} -extern "C" { - #[doc = " Return the current time and put it in *TIMER if TIMER is not NULL."] - pub fn time(__timer: *mut time_t) -> time_t; -} -extern "C" { - #[doc = " Return the difference between TIME1 and TIME0."] - pub fn difftime(__time1: time_t, __time0: time_t) -> f64; -} -extern "C" { - #[doc = " Return the `time_t' representation of TP and normalize TP."] - pub fn mktime(__tp: *mut tm) -> time_t; -} -extern "C" { - #[doc = " Format TP into S according to FORMAT."] - #[doc = "Write no more than MAXSIZE characters and return the number"] - #[doc = "of characters written, or 0 if it would exceed MAXSIZE."] - pub fn strftime( - __s: *mut cty::c_char, - __maxsize: size_t, - __format: *const cty::c_char, - __tp: *const tm, - ) -> size_t; -} -extern "C" { - #[doc = " Parse S according to FORMAT and store binary time information in TP."] - #[doc = "The return value is a pointer to the first unparsed character in S."] - pub fn strptime( - __s: *const cty::c_char, - __fmt: *const cty::c_char, - __tp: *mut tm, - ) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Return the `struct tm' representation of *TIMER"] - #[doc = "in Universal Coordinated Time (aka Greenwich Mean Time)."] - pub fn gmtime(__timer: *const time_t) -> *mut tm; -} -extern "C" { - #[doc = " Return the `struct tm' representation"] - #[doc = "of *TIMER in the local timezone."] - pub fn localtime(__timer: *const time_t) -> *mut tm; -} -extern "C" { - #[doc = " Return the `struct tm' representation of *TIMER in UTC,"] - #[doc = "using *TP to store the result."] - pub fn gmtime_r(__timer: *const time_t, __tp: *mut tm) -> *mut tm; -} -extern "C" { - #[doc = " Return the `struct tm' representation of *TIMER in local time,"] - #[doc = "using *TP to store the result."] - pub fn localtime_r(__timer: *const time_t, __tp: *mut tm) -> *mut tm; -} -extern "C" { - #[doc = " Return a string of the form \"Day Mon dd hh:mm:ss yyyy\\n\""] - #[doc = "that is the representation of TP in this format."] - pub fn asctime(__tp: *const tm) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Equivalent to `asctime (localtime (timer))'."] - pub fn ctime(__timer: *const time_t) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Return in BUF a string of the form \"Day Mon dd hh:mm:ss yyyy\\n\""] - #[doc = "that is the representation of TP in this format."] - pub fn asctime_r(__tp: *const tm, __buf: *mut cty::c_char) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Equivalent to `asctime_r (localtime_r (timer, *TMP*), buf)'."] - pub fn ctime_r(__timer: *const time_t, __buf: *mut cty::c_char) -> *mut cty::c_char; -} -extern "C" { - pub static mut __tzname: [*mut cty::c_char; 2usize]; -} -extern "C" { - pub static mut __daylight: cty::c_int; -} -extern "C" { - pub static mut __timezone: cty::c_long; -} -extern "C" { - pub static mut tzname: [*mut cty::c_char; 2usize]; -} -extern "C" { - #[doc = " Set time conversion information from the TZ environment variable."] - #[doc = "If TZ is not defined, a locale-dependent default is used."] - pub fn tzset(); -} -extern "C" { - pub static mut daylight: cty::c_int; -} -extern "C" { - pub static mut timezone: cty::c_long; -} -extern "C" { - #[doc = " Set TS to calendar time based in time base BASE."] - pub fn timespec_get(__ts: *mut timespec, __base: cty::c_int) -> cty::c_int; -} -#[doc = " Conversion state information."] -#[repr(C)] -#[derive(Copy, Clone)] -pub struct __mbstate_t { - pub __count: cty::c_int, - #[doc = " Value so far."] - pub __value: __mbstate_t__bindgen_ty_1, -} -#[repr(C)] -#[derive(Copy, Clone)] -pub union __mbstate_t__bindgen_ty_1 { - pub __wch: cty::c_uint, - pub __wchb: [cty::c_char; 4usize], - _bindgen_union_align: u32, -} -#[test] -fn bindgen_test_layout___mbstate_t__bindgen_ty_1() { - assert_eq!( - ::core::mem::size_of::<__mbstate_t__bindgen_ty_1>(), - 4usize, - concat!("Size of: ", stringify!(__mbstate_t__bindgen_ty_1)) - ); - assert_eq!( - ::core::mem::align_of::<__mbstate_t__bindgen_ty_1>(), - 4usize, - concat!("Alignment of ", stringify!(__mbstate_t__bindgen_ty_1)) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::<__mbstate_t__bindgen_ty_1>())).__wch as *const _ as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__mbstate_t__bindgen_ty_1), - "::", - stringify!(__wch) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::<__mbstate_t__bindgen_ty_1>())).__wchb as *const _ as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__mbstate_t__bindgen_ty_1), - "::", - stringify!(__wchb) - ) - ); -} -#[test] -fn bindgen_test_layout___mbstate_t() { - assert_eq!( - ::core::mem::size_of::<__mbstate_t>(), - 8usize, - concat!("Size of: ", stringify!(__mbstate_t)) - ); - assert_eq!( - ::core::mem::align_of::<__mbstate_t>(), - 4usize, - concat!("Alignment of ", stringify!(__mbstate_t)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<__mbstate_t>())).__count as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__mbstate_t), - "::", - stringify!(__count) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<__mbstate_t>())).__value as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(__mbstate_t), - "::", - stringify!(__value) - ) - ); -} -pub type mbstate_t = __mbstate_t; -#[doc = " Define the 16-bit and 32-bit character types."] -pub type char16_t = __uint_least16_t; -pub type char32_t = __uint_least32_t; -extern "C" { - #[doc = " Write char16_t representation of multibyte character pointed"] - #[doc = "to by S to PC16."] - pub fn mbrtoc16( - __pc16: *mut char16_t, - __s: *const cty::c_char, - __n: size_t, - __p: *mut mbstate_t, - ) -> size_t; -} -extern "C" { - #[doc = " Write multibyte representation of char16_t C16 to S."] - pub fn c16rtomb(__s: *mut cty::c_char, __c16: char16_t, __ps: *mut mbstate_t) -> size_t; -} -extern "C" { - #[doc = " Write char32_t representation of multibyte character pointed"] - #[doc = "to by S to PC32."] - pub fn mbrtoc32( - __pc32: *mut char32_t, - __s: *const cty::c_char, - __n: size_t, - __p: *mut mbstate_t, - ) -> size_t; -} -extern "C" { - #[doc = " Write multibyte representation of char32_t C32 to S."] - pub fn c32rtomb(__s: *mut cty::c_char, __c32: char32_t, __ps: *mut mbstate_t) -> size_t; -} -#[doc = " UPPERCASE."] -pub const _ISupper: cty::c_uint = 256; -#[doc = " lowercase."] -pub const _ISlower: cty::c_uint = 512; -#[doc = " Alphabetic."] -pub const _ISalpha: cty::c_uint = 1024; -#[doc = " Numeric."] -pub const _ISdigit: cty::c_uint = 2048; -#[doc = " Hexadecimal numeric."] -pub const _ISxdigit: cty::c_uint = 4096; -#[doc = " Whitespace."] -pub const _ISspace: cty::c_uint = 8192; -#[doc = " Printing."] -pub const _ISprint: cty::c_uint = 16384; -#[doc = " Graphical."] -pub const _ISgraph: cty::c_uint = 32768; -#[doc = " Blank (usually SPC and TAB)."] -pub const _ISblank: cty::c_uint = 1; -#[doc = " Control character."] -pub const _IScntrl: cty::c_uint = 2; -#[doc = " Punctuation."] -pub const _ISpunct: cty::c_uint = 4; -#[doc = " Alphanumeric."] -pub const _ISalnum: cty::c_uint = 8; -pub type _bindgen_ty_1 = cty::c_uint; -extern "C" { - #[doc = " These are defined in ctype-info.c."] - #[doc = "The declarations here must match those in localeinfo.h."] - #[doc = ""] - #[doc = "In the thread-specific locale model (see `uselocale' in )"] - #[doc = "we cannot use global variables for these as was done in the past."] - #[doc = "Instead, the following accessor functions return the address of"] - #[doc = "each variable, which is local to the current thread if multithreaded."] - #[doc = ""] - #[doc = "These point into arrays of 384, so they can be indexed by any `unsigned"] - #[doc = "char' value [0,255]; by EOF (-1); or by any `signed char' value"] - #[doc = "[-128,-1). ISO C requires that the ctype functions work for `unsigned"] - #[doc = "char' values and for EOF; we also support negative `signed char' values"] - #[doc = "for broken old programs. The case conversion arrays are of `int's"] - #[doc = "rather than `unsigned char's because tolower (EOF) must be EOF, which"] - #[doc = "doesn't fit into an `unsigned char'. But today more important is that"] - #[doc = "the arrays are also used for multi-byte character sets."] - pub fn __ctype_b_loc() -> *mut *const cty::c_ushort; -} -extern "C" { - pub fn __ctype_tolower_loc() -> *mut *const __int32_t; -} -extern "C" { - pub fn __ctype_toupper_loc() -> *mut *const __int32_t; -} -extern "C" { - pub fn isalnum(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn isalpha(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn iscntrl(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn isdigit(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn islower(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn isgraph(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn isprint(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn ispunct(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn isspace(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn isupper(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn isxdigit(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Return the lowercase version of C."] - pub fn tolower(__c: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Return the uppercase version of C."] - pub fn toupper(__c: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn isblank(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Return nonzero iff C is in the ASCII set"] - #[doc = "(i.e., is no more than 7 bits wide)."] - pub fn isascii(__c: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Return the part of C that is in the ASCII set"] - #[doc = "(i.e., the low-order 7 bits of C)."] - pub fn toascii(__c: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn _toupper(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn _tolower(arg1: cty::c_int) -> cty::c_int; -} -pub type _Float32 = f32; -pub type _Float64 = f64; -pub type _Float32x = f64; -pub type _Float64x = u128; -pub type wchar_t = cty::c_int; -pub type va_list = __builtin_va_list; -pub type __gnuc_va_list = __builtin_va_list; -pub type wint_t = cty::c_uint; -pub type __FILE = _IO_FILE; -#[doc = " Scalar type that can hold values which represent locale-specific"] -#[doc = "character classifications."] -pub type wctype_t = cty::c_ulong; -#[doc = " UPPERCASE."] -pub const __ISwupper: cty::c_int = 0; -#[doc = " lowercase."] -pub const __ISwlower: cty::c_int = 1; -#[doc = " Alphabetic."] -pub const __ISwalpha: cty::c_int = 2; -#[doc = " Numeric."] -pub const __ISwdigit: cty::c_int = 3; -#[doc = " Hexadecimal numeric."] -pub const __ISwxdigit: cty::c_int = 4; -#[doc = " Whitespace."] -pub const __ISwspace: cty::c_int = 5; -#[doc = " Printing."] -pub const __ISwprint: cty::c_int = 6; -#[doc = " Graphical."] -pub const __ISwgraph: cty::c_int = 7; -#[doc = " Blank (usually SPC and TAB)."] -pub const __ISwblank: cty::c_int = 8; -#[doc = " Control character."] -pub const __ISwcntrl: cty::c_int = 9; -#[doc = " Punctuation."] -pub const __ISwpunct: cty::c_int = 10; -#[doc = " Alphanumeric."] -pub const __ISwalnum: cty::c_int = 11; -#[doc = " UPPERCASE."] -pub const _ISwupper: cty::c_int = 16777216; -#[doc = " lowercase."] -pub const _ISwlower: cty::c_int = 33554432; -#[doc = " Alphabetic."] -pub const _ISwalpha: cty::c_int = 67108864; -#[doc = " Numeric."] -pub const _ISwdigit: cty::c_int = 134217728; -#[doc = " Hexadecimal numeric."] -pub const _ISwxdigit: cty::c_int = 268435456; -#[doc = " Whitespace."] -pub const _ISwspace: cty::c_int = 536870912; -#[doc = " Printing."] -pub const _ISwprint: cty::c_int = 1073741824; -#[doc = " Graphical."] -pub const _ISwgraph: cty::c_int = -2147483648; -#[doc = " Blank (usually SPC and TAB)."] -pub const _ISwblank: cty::c_int = 65536; -#[doc = " Control character."] -pub const _ISwcntrl: cty::c_int = 131072; -#[doc = " Punctuation."] -pub const _ISwpunct: cty::c_int = 262144; -#[doc = " Alphanumeric."] -pub const _ISwalnum: cty::c_int = 524288; -pub type _bindgen_ty_2 = cty::c_int; -extern "C" { - #[doc = " Test for any wide character for which `iswalpha' or `iswdigit' is"] - #[doc = "true."] - pub fn iswalnum(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any wide character for which `iswupper' or 'iswlower' is"] - #[doc = "true, or any wide character that is one of a locale-specific set of"] - #[doc = "wide-characters for which none of `iswcntrl', `iswdigit',"] - #[doc = "`iswpunct', or `iswspace' is true."] - pub fn iswalpha(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any control wide character."] - pub fn iswcntrl(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any wide character that corresponds to a decimal-digit"] - #[doc = "character."] - pub fn iswdigit(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any wide character for which `iswprint' is true and"] - #[doc = "`iswspace' is false."] - pub fn iswgraph(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any wide character that corresponds to a lowercase letter"] - #[doc = "or is one of a locale-specific set of wide characters for which"] - #[doc = "none of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true."] - pub fn iswlower(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any printing wide character."] - pub fn iswprint(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any printing wide character that is one of a"] - #[doc = "locale-specific et of wide characters for which neither `iswspace'"] - #[doc = "nor `iswalnum' is true."] - pub fn iswpunct(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any wide character that corresponds to a locale-specific"] - #[doc = "set of wide characters for which none of `iswalnum', `iswgraph', or"] - #[doc = "`iswpunct' is true."] - pub fn iswspace(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any wide character that corresponds to an uppercase letter"] - #[doc = "or is one of a locale-specific set of wide character for which none"] - #[doc = "of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true."] - pub fn iswupper(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any wide character that corresponds to a hexadecimal-digit"] - #[doc = "character equivalent to that performed be the functions described"] - #[doc = "in the previous subclause."] - pub fn iswxdigit(__wc: wint_t) -> cty::c_int; -} -extern "C" { - pub fn iswblank(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Construct value that describes a class of wide characters identified"] - #[doc = "by the string argument PROPERTY."] - pub fn wctype(__property: *const cty::c_char) -> wctype_t; -} -extern "C" { - #[doc = " Determine whether the wide-character WC has the property described by"] - #[doc = "DESC."] - pub fn iswctype(__wc: wint_t, __desc: wctype_t) -> cty::c_int; -} -extern "C" { - #[doc = " Converts an uppercase letter to the corresponding lowercase letter."] - pub fn towlower(__wc: wint_t) -> wint_t; -} -extern "C" { - #[doc = " Converts an lowercase letter to the corresponding uppercase letter."] - pub fn towupper(__wc: wint_t) -> wint_t; -} -extern "C" { - #[doc = " Copy SRC to DEST."] - pub fn wcscpy(__dest: *mut wchar_t, __src: *const wchar_t) -> *mut wchar_t; -} -extern "C" { - #[doc = " Copy no more than N wide-characters of SRC to DEST."] - pub fn wcsncpy(__dest: *mut wchar_t, __src: *const wchar_t, __n: size_t) -> *mut wchar_t; -} -extern "C" { - #[doc = " Append SRC onto DEST."] - pub fn wcscat(__dest: *mut wchar_t, __src: *const wchar_t) -> *mut wchar_t; -} -extern "C" { - #[doc = " Append no more than N wide-characters of SRC onto DEST."] - pub fn wcsncat(__dest: *mut wchar_t, __src: *const wchar_t, __n: size_t) -> *mut wchar_t; -} -extern "C" { - #[doc = " Compare S1 and S2."] - pub fn wcscmp(__s1: *const cty::c_int, __s2: *const cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Compare N wide-characters of S1 and S2."] - pub fn wcsncmp( - __s1: *const cty::c_int, - __s2: *const cty::c_int, - __n: cty::c_ulong, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Compare S1 and S2, both interpreted as appropriate to the"] - #[doc = "LC_COLLATE category of the current locale."] - pub fn wcscoll(__s1: *const wchar_t, __s2: *const wchar_t) -> cty::c_int; -} -extern "C" { - #[doc = " Transform S2 into array pointed to by S1 such that if wcscmp is"] - #[doc = "applied to two transformed strings the result is the as applying"] - #[doc = "`wcscoll' to the original strings."] - pub fn wcsxfrm(__s1: *mut wchar_t, __s2: *const wchar_t, __n: size_t) -> size_t; -} -extern "C" { - pub fn wcschr(__wcs: *const cty::c_int, __wc: cty::c_int) -> *mut cty::c_int; -} -extern "C" { - pub fn wcsrchr(__wcs: *const wchar_t, __wc: wchar_t) -> *mut wchar_t; -} -extern "C" { - #[doc = " Return the length of the initial segmet of WCS which"] - #[doc = "consists entirely of wide characters not in REJECT."] - pub fn wcscspn(__wcs: *const wchar_t, __reject: *const wchar_t) -> size_t; -} -extern "C" { - #[doc = " Return the length of the initial segmet of WCS which"] - #[doc = "consists entirely of wide characters in ACCEPT."] - pub fn wcsspn(__wcs: *const wchar_t, __accept: *const wchar_t) -> size_t; -} -extern "C" { - pub fn wcspbrk(__wcs: *const wchar_t, __accept: *const wchar_t) -> *mut wchar_t; -} -extern "C" { - pub fn wcsstr(__haystack: *const wchar_t, __needle: *const wchar_t) -> *mut wchar_t; -} -extern "C" { - #[doc = " Divide WCS into tokens separated by characters in DELIM."] - pub fn wcstok( - __s: *mut wchar_t, - __delim: *const wchar_t, - __ptr: *mut *mut wchar_t, - ) -> *mut wchar_t; -} -extern "C" { - #[doc = " Return the number of wide characters in S."] - pub fn wcslen(__s: *const cty::c_int) -> cty::c_ulong; -} -extern "C" { - pub fn wcswcs(__haystack: *const wchar_t, __needle: *const wchar_t) -> *mut wchar_t; -} -extern "C" { - pub fn wmemchr(__s: *const cty::c_int, __c: cty::c_int, __n: cty::c_ulong) -> *mut cty::c_int; -} -extern "C" { - #[doc = " Compare N wide characters of S1 and S2."] - pub fn wmemcmp( - __s1: *const cty::c_int, - __s2: *const cty::c_int, - __n: cty::c_ulong, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Copy N wide characters of SRC to DEST."] - pub fn wmemcpy( - __s1: *mut cty::c_int, - __s2: *const cty::c_int, - __n: cty::c_ulong, - ) -> *mut cty::c_int; -} -extern "C" { - #[doc = " Copy N wide characters of SRC to DEST, guaranteeing"] - #[doc = "correct behavior for overlapping strings."] - pub fn wmemmove( - __s1: *mut cty::c_int, - __s2: *const cty::c_int, - __n: cty::c_ulong, - ) -> *mut cty::c_int; -} -extern "C" { - #[doc = " Set N wide characters of S to C."] - pub fn wmemset(__s: *mut wchar_t, __c: wchar_t, __n: size_t) -> *mut wchar_t; -} -extern "C" { - #[doc = " Determine whether C constitutes a valid (one-byte) multibyte"] - #[doc = "character."] - pub fn btowc(__c: cty::c_int) -> wint_t; -} -extern "C" { - #[doc = " Determine whether C corresponds to a member of the extended"] - #[doc = "character set whose multibyte representation is a single byte."] - pub fn wctob(__c: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Determine whether PS points to an object representing the initial"] - #[doc = "state."] - pub fn mbsinit(__ps: *const mbstate_t) -> cty::c_int; -} -extern "C" { - #[doc = " Write wide character representation of multibyte character pointed"] - #[doc = "to by S to PWC."] - pub fn mbrtowc( - __pwc: *mut wchar_t, - __s: *const cty::c_char, - __n: size_t, - __p: *mut mbstate_t, - ) -> size_t; -} -extern "C" { - #[doc = " Write multibyte representation of wide character WC to S."] - pub fn wcrtomb(__s: *mut cty::c_char, __wc: wchar_t, __ps: *mut mbstate_t) -> size_t; -} -extern "C" { - #[doc = " Return number of bytes in multibyte character pointed to by S."] - pub fn __mbrlen(__s: *const cty::c_char, __n: size_t, __ps: *mut mbstate_t) -> size_t; -} -extern "C" { - pub fn mbrlen(__s: *const cty::c_char, __n: size_t, __ps: *mut mbstate_t) -> size_t; -} -extern "C" { - #[doc = " Write wide character representation of multibyte character string"] - #[doc = "SRC to DST."] - pub fn mbsrtowcs( - __dst: *mut wchar_t, - __src: *mut *const cty::c_char, - __len: size_t, - __ps: *mut mbstate_t, - ) -> size_t; -} -extern "C" { - #[doc = " Write multibyte character representation of wide character string"] - #[doc = "SRC to DST."] - pub fn wcsrtombs( - __dst: *mut cty::c_char, - __src: *mut *const wchar_t, - __len: size_t, - __ps: *mut mbstate_t, - ) -> size_t; -} -extern "C" { - #[doc = " Determine number of column positions required for C."] - pub fn wcwidth(__c: wchar_t) -> cty::c_int; -} -extern "C" { - #[doc = " Determine number of column positions required for first N wide"] - #[doc = "characters (or fewer if S ends before this) in S."] - pub fn wcswidth(__s: *const wchar_t, __n: size_t) -> cty::c_int; -} -extern "C" { - #[doc = " Convert initial portion of the wide string NPTR to `double'"] - #[doc = "representation."] - pub fn wcstod(__nptr: *const wchar_t, __endptr: *mut *mut wchar_t) -> f64; -} -extern "C" { - #[doc = " Likewise for `float' and `long double' sizes of floating-point numbers."] - pub fn wcstof(__nptr: *const wchar_t, __endptr: *mut *mut wchar_t) -> f32; -} -extern "C" { - #[doc = " Convert initial portion of wide string NPTR to `long int'"] - #[doc = "representation."] - pub fn wcstol( - __nptr: *const wchar_t, - __endptr: *mut *mut wchar_t, - __base: cty::c_int, - ) -> cty::c_long; -} -extern "C" { - #[doc = " Convert initial portion of wide string NPTR to `unsigned long int'"] - #[doc = "representation."] - pub fn wcstoul( - __nptr: *const wchar_t, - __endptr: *mut *mut wchar_t, - __base: cty::c_int, - ) -> cty::c_ulong; -} -extern "C" { - #[doc = " Convert initial portion of wide string NPTR to `long long int'"] - #[doc = "representation."] - pub fn wcstoll( - __nptr: *const wchar_t, - __endptr: *mut *mut wchar_t, - __base: cty::c_int, - ) -> cty::c_longlong; -} -extern "C" { - #[doc = " Convert initial portion of wide string NPTR to `unsigned long long int'"] - #[doc = "representation."] - pub fn wcstoull( - __nptr: *const wchar_t, - __endptr: *mut *mut wchar_t, - __base: cty::c_int, - ) -> cty::c_ulonglong; -} -extern "C" { - #[doc = " Select orientation for stream."] - pub fn fwide(__fp: *mut __FILE, __mode: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fwprintf(__stream: *mut __FILE, __format: *const wchar_t, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to stdout."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn wprintf(__format: *const wchar_t, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output of at most N characters to S."] - pub fn swprintf(__s: *mut wchar_t, __n: size_t, __format: *const wchar_t, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to S from argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn vfwprintf( - __s: *mut __FILE, - __format: *const wchar_t, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to stdout from argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn vwprintf(__format: *const wchar_t, __arg: *mut __va_list_tag) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output of at most N character to S from argument"] - #[doc = "list ARG."] - pub fn vswprintf( - __s: *mut wchar_t, - __n: size_t, - __format: *const wchar_t, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fwscanf(__stream: *mut __FILE, __format: *const wchar_t, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from stdin."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn wscanf(__format: *const wchar_t, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S."] - pub fn swscanf(__s: *const wchar_t, __format: *const wchar_t, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - #[link_name = "\u{1}__isoc99_fwscanf"] - pub fn fwscanf1(__stream: *mut __FILE, __format: *const wchar_t, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from stdin."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - #[link_name = "\u{1}__isoc99_wscanf"] - pub fn wscanf1(__format: *const wchar_t, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S."] - #[link_name = "\u{1}__isoc99_swscanf"] - pub fn swscanf1(__s: *const wchar_t, __format: *const wchar_t, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S into argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn vfwscanf( - __s: *mut __FILE, - __format: *const wchar_t, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from stdin into argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn vwscanf(__format: *const wchar_t, __arg: *mut __va_list_tag) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S into argument list ARG."] - pub fn vswscanf( - __s: *const wchar_t, - __format: *const wchar_t, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Read a character from STREAM."] - #[doc = ""] - #[doc = "These functions are possible cancellation points and therefore not"] - #[doc = "marked with __THROW."] - pub fn fgetwc(__stream: *mut __FILE) -> wint_t; -} -extern "C" { - pub fn getwc(__stream: *mut __FILE) -> wint_t; -} -extern "C" { - #[doc = " Read a character from stdin."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn getwchar() -> wint_t; -} -extern "C" { - #[doc = " Write a character to STREAM."] - #[doc = ""] - #[doc = "These functions are possible cancellation points and therefore not"] - #[doc = "marked with __THROW."] - pub fn fputwc(__wc: wchar_t, __stream: *mut __FILE) -> wint_t; -} -extern "C" { - pub fn putwc(__wc: wchar_t, __stream: *mut __FILE) -> wint_t; -} -extern "C" { - #[doc = " Write a character to stdout."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn putwchar(__wc: wchar_t) -> wint_t; -} -extern "C" { - #[doc = " Get a newline-terminated wide character string of finite length"] - #[doc = "from STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fgetws(__ws: *mut wchar_t, __n: cty::c_int, __stream: *mut __FILE) -> *mut wchar_t; -} -extern "C" { - #[doc = " Write a string to STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fputws(__ws: *const wchar_t, __stream: *mut __FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Push a character back onto the input buffer of STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn ungetwc(__wc: wint_t, __stream: *mut __FILE) -> wint_t; -} -extern "C" { - #[doc = " Format TP into S according to FORMAT."] - #[doc = "Write no more than MAXSIZE wide characters and return the number"] - #[doc = "of wide characters written, or 0 if it would exceed MAXSIZE."] - pub fn wcsftime( - __s: *mut wchar_t, - __maxsize: size_t, - __format: *const wchar_t, - __tp: *const tm, - ) -> size_t; -} -#[doc = " The tag name of this struct is _G_fpos_t to preserve historic"] -#[doc = "C++ mangled names for functions taking fpos_t arguments."] -#[doc = "That name should not be used in new code."] -#[repr(C)] -#[derive(Copy, Clone)] -pub struct _G_fpos_t { - pub __pos: __off_t, - pub __state: __mbstate_t, -} -#[test] -fn bindgen_test_layout__G_fpos_t() { - assert_eq!( - ::core::mem::size_of::<_G_fpos_t>(), - 16usize, - concat!("Size of: ", stringify!(_G_fpos_t)) - ); - assert_eq!( - ::core::mem::align_of::<_G_fpos_t>(), - 8usize, - concat!("Alignment of ", stringify!(_G_fpos_t)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_G_fpos_t>())).__pos as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(_G_fpos_t), - "::", - stringify!(__pos) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_G_fpos_t>())).__state as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(_G_fpos_t), - "::", - stringify!(__state) - ) - ); -} -#[doc = " The tag name of this struct is _G_fpos_t to preserve historic"] -#[doc = "C++ mangled names for functions taking fpos_t arguments."] -#[doc = "That name should not be used in new code."] -pub type __fpos_t = _G_fpos_t; -#[doc = " The tag name of this struct is _G_fpos64_t to preserve historic"] -#[doc = "C++ mangled names for functions taking fpos_t and/or fpos64_t"] -#[doc = "arguments. That name should not be used in new code."] -#[repr(C)] -#[derive(Copy, Clone)] -pub struct _G_fpos64_t { - pub __pos: __off64_t, - pub __state: __mbstate_t, -} -#[test] -fn bindgen_test_layout__G_fpos64_t() { - assert_eq!( - ::core::mem::size_of::<_G_fpos64_t>(), - 16usize, - concat!("Size of: ", stringify!(_G_fpos64_t)) - ); - assert_eq!( - ::core::mem::align_of::<_G_fpos64_t>(), - 8usize, - concat!("Alignment of ", stringify!(_G_fpos64_t)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_G_fpos64_t>())).__pos as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(_G_fpos64_t), - "::", - stringify!(__pos) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_G_fpos64_t>())).__state as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(_G_fpos64_t), - "::", - stringify!(__state) - ) - ); -} -#[doc = " The tag name of this struct is _G_fpos64_t to preserve historic"] -#[doc = "C++ mangled names for functions taking fpos_t and/or fpos64_t"] -#[doc = "arguments. That name should not be used in new code."] -pub type __fpos64_t = _G_fpos64_t; -#[doc = " The opaque type of streams. This is the definition used elsewhere."] -pub type FILE = _IO_FILE; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct _IO_marker { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct _IO_codecvt { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct _IO_wide_data { - _unused: [u8; 0], -} -pub type _IO_lock_t = cty::c_void; -#[doc = " The tag name of this struct is _IO_FILE to preserve historic"] -#[doc = "C++ mangled names for functions taking FILE* arguments."] -#[doc = "That name should not be used in new code."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct _IO_FILE { - #[doc = " High-order word is _IO_MAGIC; rest is flags."] - pub _flags: cty::c_int, - #[doc = " Current read pointer"] - pub _IO_read_ptr: *mut cty::c_char, - #[doc = " End of get area."] - pub _IO_read_end: *mut cty::c_char, - #[doc = " Start of putback+get area."] - pub _IO_read_base: *mut cty::c_char, - #[doc = " Start of put area."] - pub _IO_write_base: *mut cty::c_char, - #[doc = " Current put pointer."] - pub _IO_write_ptr: *mut cty::c_char, - #[doc = " End of put area."] - pub _IO_write_end: *mut cty::c_char, - #[doc = " Start of reserve area."] - pub _IO_buf_base: *mut cty::c_char, - #[doc = " End of reserve area."] - pub _IO_buf_end: *mut cty::c_char, - #[doc = " Pointer to start of non-current get area."] - pub _IO_save_base: *mut cty::c_char, - #[doc = " Pointer to first valid character of backup area"] - pub _IO_backup_base: *mut cty::c_char, - #[doc = " Pointer to end of non-current get area."] - pub _IO_save_end: *mut cty::c_char, - pub _markers: *mut _IO_marker, - pub _chain: *mut _IO_FILE, - pub _fileno: cty::c_int, - pub _flags2: cty::c_int, - #[doc = " This used to be _offset but it's too small."] - pub _old_offset: __off_t, - #[doc = " 1+column number of pbase(); 0 is unknown."] - pub _cur_column: cty::c_ushort, - pub _vtable_offset: cty::c_schar, - pub _shortbuf: [cty::c_char; 1usize], - pub _lock: *mut _IO_lock_t, - pub _offset: __off64_t, - #[doc = " Wide character stream stuff."] - pub _codecvt: *mut _IO_codecvt, - pub _wide_data: *mut _IO_wide_data, - pub _freeres_list: *mut _IO_FILE, - pub _freeres_buf: *mut cty::c_void, - pub __pad5: size_t, - pub _mode: cty::c_int, - #[doc = " Make sure we don't get into trouble again."] - pub _unused2: [cty::c_char; 20usize], -} -#[test] -fn bindgen_test_layout__IO_FILE() { - assert_eq!( - ::core::mem::size_of::<_IO_FILE>(), - 216usize, - concat!("Size of: ", stringify!(_IO_FILE)) - ); - assert_eq!( - ::core::mem::align_of::<_IO_FILE>(), - 8usize, - concat!("Alignment of ", stringify!(_IO_FILE)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._flags as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_flags) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_read_ptr as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_read_ptr) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_read_end as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_read_end) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_read_base as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_read_base) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_write_base as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_write_base) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_write_ptr as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_write_ptr) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_write_end as *const _ as usize }, - 48usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_write_end) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_buf_base as *const _ as usize }, - 56usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_buf_base) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_buf_end as *const _ as usize }, - 64usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_buf_end) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_save_base as *const _ as usize }, - 72usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_save_base) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_backup_base as *const _ as usize }, - 80usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_backup_base) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_save_end as *const _ as usize }, - 88usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_save_end) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._markers as *const _ as usize }, - 96usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_markers) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._chain as *const _ as usize }, - 104usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_chain) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._fileno as *const _ as usize }, - 112usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_fileno) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._flags2 as *const _ as usize }, - 116usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_flags2) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._old_offset as *const _ as usize }, - 120usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_old_offset) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._cur_column as *const _ as usize }, - 128usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_cur_column) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._vtable_offset as *const _ as usize }, - 130usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_vtable_offset) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._shortbuf as *const _ as usize }, - 131usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_shortbuf) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._lock as *const _ as usize }, - 136usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_lock) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._offset as *const _ as usize }, - 144usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_offset) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._codecvt as *const _ as usize }, - 152usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_codecvt) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._wide_data as *const _ as usize }, - 160usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_wide_data) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._freeres_list as *const _ as usize }, - 168usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_freeres_list) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._freeres_buf as *const _ as usize }, - 176usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_freeres_buf) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>())).__pad5 as *const _ as usize }, - 184usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(__pad5) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._mode as *const _ as usize }, - 192usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_mode) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._unused2 as *const _ as usize }, - 196usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_unused2) - ) - ); -} -pub type fpos_t = __fpos_t; -extern "C" { - pub static mut stdin: *mut FILE; -} -extern "C" { - pub static mut stdout: *mut FILE; -} -extern "C" { - pub static mut stderr: *mut FILE; -} -extern "C" { - #[doc = " Remove file FILENAME."] - pub fn remove(__filename: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Rename file OLD to NEW."] - pub fn rename(__old: *const cty::c_char, __new: *const cty::c_char) -> cty::c_int; -} -extern "C" { - pub fn tmpfile() -> *mut FILE; -} -extern "C" { - #[doc = " Generate a temporary filename."] - pub fn tmpnam(__s: *mut cty::c_char) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Generate a unique temporary filename using up to five characters of PFX"] - #[doc = "if it is not NULL. The directory to put this file in is searched for"] - #[doc = "as follows: First the environment variable \"TMPDIR\" is checked."] - #[doc = "If it contains the name of a writable directory, that directory is used."] - #[doc = "If not and if DIR is not NULL, that value is checked. If that fails,"] - #[doc = "P_tmpdir is tried and finally \"/tmp\". The storage for the filename"] - #[doc = "is allocated by `malloc'."] - pub fn tempnam(__dir: *const cty::c_char, __pfx: *const cty::c_char) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Close STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fclose(__stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Flush STREAM, or all streams if STREAM is NULL."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fflush(__stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Open a file and create a new stream for it."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fopen(__filename: *const cty::c_char, __modes: *const cty::c_char) -> *mut FILE; -} -extern "C" { - #[doc = " Open a file, replacing an existing stream with it."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn freopen( - __filename: *const cty::c_char, - __modes: *const cty::c_char, - __stream: *mut FILE, - ) -> *mut FILE; -} -extern "C" { - #[doc = " Create a new stream that refers to an existing system file descriptor."] - pub fn fdopen(__fd: cty::c_int, __modes: *const cty::c_char) -> *mut FILE; -} -extern "C" { - #[doc = " If BUF is NULL, make STREAM unbuffered."] - #[doc = "Else make it use buffer BUF, of size BUFSIZ."] - pub fn setbuf(__stream: *mut FILE, __buf: *mut cty::c_char); -} -extern "C" { - #[doc = " Make STREAM use buffering mode MODE."] - #[doc = "If BUF is not NULL, use N bytes of it for buffering;"] - #[doc = "else allocate an internal buffer N bytes long."] - pub fn setvbuf( - __stream: *mut FILE, - __buf: *mut cty::c_char, - __modes: cty::c_int, - __n: size_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fprintf(__stream: *mut FILE, __format: *const cty::c_char, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to stdout."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn printf(__format: *const cty::c_char, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to S."] - pub fn sprintf(__s: *mut cty::c_char, __format: *const cty::c_char, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to S from argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn vfprintf( - __s: *mut FILE, - __format: *const cty::c_char, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to stdout from argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn vprintf(__format: *const cty::c_char, __arg: *mut __va_list_tag) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to S from argument list ARG."] - pub fn vsprintf( - __s: *mut cty::c_char, - __format: *const cty::c_char, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Maximum chars of output to write in MAXLEN."] - pub fn snprintf( - __s: *mut cty::c_char, - __maxlen: cty::c_ulong, - __format: *const cty::c_char, - ... - ) -> cty::c_int; -} -extern "C" { - pub fn vsnprintf( - __s: *mut cty::c_char, - __maxlen: cty::c_ulong, - __format: *const cty::c_char, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fscanf(__stream: *mut FILE, __format: *const cty::c_char, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from stdin."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn scanf(__format: *const cty::c_char, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S."] - pub fn sscanf(__s: *const cty::c_char, __format: *const cty::c_char, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - #[link_name = "\u{1}__isoc99_fscanf"] - pub fn fscanf1(__stream: *mut FILE, __format: *const cty::c_char, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from stdin."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - #[link_name = "\u{1}__isoc99_scanf"] - pub fn scanf1(__format: *const cty::c_char, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S."] - #[link_name = "\u{1}__isoc99_sscanf"] - pub fn sscanf1(__s: *const cty::c_char, __format: *const cty::c_char, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S into argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn vfscanf( - __s: *mut FILE, - __format: *const cty::c_char, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from stdin into argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn vscanf(__format: *const cty::c_char, __arg: *mut __va_list_tag) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S into argument list ARG."] - pub fn vsscanf( - __s: *const cty::c_char, - __format: *const cty::c_char, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S into argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - #[link_name = "\u{1}__isoc99_vfscanf"] - pub fn vfscanf1( - __s: *mut FILE, - __format: *const cty::c_char, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from stdin into argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - #[link_name = "\u{1}__isoc99_vscanf"] - pub fn vscanf1(__format: *const cty::c_char, __arg: *mut __va_list_tag) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S into argument list ARG."] - #[link_name = "\u{1}__isoc99_vsscanf"] - pub fn vsscanf1( - __s: *const cty::c_char, - __format: *const cty::c_char, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Read a character from STREAM."] - #[doc = ""] - #[doc = "These functions are possible cancellation points and therefore not"] - #[doc = "marked with __THROW."] - pub fn fgetc(__stream: *mut FILE) -> cty::c_int; -} -extern "C" { - pub fn getc(__stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Read a character from stdin."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn getchar() -> cty::c_int; -} -extern "C" { - #[doc = " Write a character to STREAM."] - #[doc = ""] - #[doc = "These functions are possible cancellation points and therefore not"] - #[doc = "marked with __THROW."] - #[doc = ""] - #[doc = "These functions is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fputc(__c: cty::c_int, __stream: *mut FILE) -> cty::c_int; -} -extern "C" { - pub fn putc(__c: cty::c_int, __stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Write a character to stdout."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn putchar(__c: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Get a word (int) from STREAM."] - pub fn getw(__stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Write a word (int) to STREAM."] - pub fn putw(__w: cty::c_int, __stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Get a newline-terminated string of finite length from STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fgets(__s: *mut cty::c_char, __n: cty::c_int, __stream: *mut FILE) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Write a string to STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fputs(__s: *const cty::c_char, __stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Write a string, followed by a newline, to stdout."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn puts(__s: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Push a character back onto the input buffer of STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn ungetc(__c: cty::c_int, __stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Read chunks of generic data from STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fread( - __ptr: *mut cty::c_void, - __size: cty::c_ulong, - __n: cty::c_ulong, - __stream: *mut FILE, - ) -> cty::c_ulong; -} -extern "C" { - #[doc = " Write chunks of generic data to STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fwrite( - __ptr: *const cty::c_void, - __size: cty::c_ulong, - __n: cty::c_ulong, - __s: *mut FILE, - ) -> cty::c_ulong; -} -extern "C" { - #[doc = " Seek to a certain position on STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fseek(__stream: *mut FILE, __off: cty::c_long, __whence: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Return the current position of STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn ftell(__stream: *mut FILE) -> cty::c_long; -} -extern "C" { - #[doc = " Rewind to the beginning of STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn rewind(__stream: *mut FILE); -} -extern "C" { - #[doc = " Get STREAM's position."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fgetpos(__stream: *mut FILE, __pos: *mut fpos_t) -> cty::c_int; -} -extern "C" { - #[doc = " Set STREAM's position."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fsetpos(__stream: *mut FILE, __pos: *const fpos_t) -> cty::c_int; -} -extern "C" { - #[doc = " Clear the error and EOF indicators for STREAM."] - pub fn clearerr(__stream: *mut FILE); -} -extern "C" { - #[doc = " Return the EOF indicator for STREAM."] - pub fn feof(__stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Return the error indicator for STREAM."] - pub fn ferror(__stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Print a message describing the meaning of the value of errno."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn perror(__s: *const cty::c_char); -} -extern "C" { - #[doc = " Return the system file descriptor for STREAM."] - pub fn fileno(__stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Create a new stream connected to a pipe running the given command."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn popen(__command: *const cty::c_char, __modes: *const cty::c_char) -> *mut FILE; -} -extern "C" { - #[doc = " Close a stream opened by popen and return the status of its child."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn pclose(__stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Return the name of the controlling terminal."] - pub fn ctermid(__s: *mut cty::c_char) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Return the name of the current user."] - pub fn cuserid(__s: *mut cty::c_char) -> *mut cty::c_char; -} -extern "C" { - pub static mut optarg: *mut cty::c_char; -} -extern "C" { - pub static mut optind: cty::c_int; -} -extern "C" { - pub static mut opterr: cty::c_int; -} -extern "C" { - pub static mut optopt: cty::c_int; -} -extern "C" { - #[doc = " Get definitions and prototypes for functions to process the"] - #[doc = "arguments in ARGV (ARGC of them, minus the program name) for"] - #[doc = "options given in OPTS."] - #[doc = ""] - #[doc = "Return the option character from OPTS just read. Return -1 when"] - #[doc = "there are no more options. For unrecognized options, or options"] - #[doc = "missing arguments, 'optopt' is set to the option letter, and '?' is"] - #[doc = "returned."] - #[doc = ""] - #[doc = "The OPTS string is a list of characters which are recognized option"] - #[doc = "letters, optionally followed by colons, specifying that that letter"] - #[doc = "takes an argument, to be placed in 'optarg'."] - #[doc = ""] - #[doc = "If a letter in OPTS is followed by two colons, its argument is"] - #[doc = "optional. This behavior is specific to the GNU 'getopt'."] - #[doc = ""] - #[doc = "The argument '--' causes premature termination of argument"] - #[doc = "scanning, explicitly telling 'getopt' that there are no more"] - #[doc = "options."] - #[doc = ""] - #[doc = "If OPTS begins with '-', then non-option arguments are treated as"] - #[doc = "arguments to the option '\\1'. This behavior is specific to the GNU"] - #[doc = "'getopt'. If OPTS begins with '+', or POSIXLY_CORRECT is set in"] - #[doc = "the environment, then do not permute arguments."] - #[doc = ""] - #[doc = "For standards compliance, the 'argv' argument has the type"] - #[doc = "char *const *, but this is inaccurate; if argument permutation is"] - #[doc = "enabled, the argv array (not the strings it points to) must be"] - #[doc = "writable."] - pub fn getopt( - ___argc: cty::c_int, - ___argv: *const *mut cty::c_char, - __shortopts: *const cty::c_char, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Slow-path routines used by the optimized inline functions in"] - #[doc = "bits/stdio.h."] - pub fn __uflow(arg1: *mut FILE) -> cty::c_int; -} -extern "C" { - pub fn __overflow(arg1: *mut FILE, arg2: cty::c_int) -> cty::c_int; -} -#[doc = " Signed."] -pub type int_least8_t = __int_least8_t; -pub type int_least16_t = __int_least16_t; -pub type int_least32_t = __int_least32_t; -pub type int_least64_t = __int_least64_t; -#[doc = " Unsigned."] -pub type uint_least8_t = __uint_least8_t; -pub type uint_least16_t = __uint_least16_t; -pub type uint_least32_t = __uint_least32_t; -pub type uint_least64_t = __uint_least64_t; -#[doc = " Signed."] -pub type int_fast8_t = cty::c_schar; -pub type int_fast16_t = cty::c_long; -pub type int_fast32_t = cty::c_long; -pub type int_fast64_t = cty::c_long; -#[doc = " Unsigned."] -pub type uint_fast8_t = cty::c_uchar; -pub type uint_fast16_t = cty::c_ulong; -pub type uint_fast32_t = cty::c_ulong; -pub type uint_fast64_t = cty::c_ulong; -#[doc = " Largest integral types."] -pub type intmax_t = __intmax_t; -pub type uintmax_t = __uintmax_t; -#[doc = " Returned by `div'."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct div_t { - #[doc = " Quotient."] - pub quot: cty::c_int, - #[doc = " Remainder."] - pub rem: cty::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) - ) - ); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ldiv_t { - #[doc = " Quotient."] - pub quot: cty::c_long, - #[doc = " Remainder."] - pub rem: cty::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) - ) - ); -} -#[doc = " Returned by `lldiv'."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct lldiv_t { - #[doc = " Quotient."] - pub quot: cty::c_longlong, - #[doc = " Remainder."] - pub rem: cty::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) - ) - ); -} -extern "C" { - pub fn __ctype_get_mb_cur_max() -> size_t; -} -extern "C" { - #[doc = " Convert a string to a floating-point number."] - pub fn atof(__nptr: *const cty::c_char) -> f64; -} -extern "C" { - #[doc = " Convert a string to an integer."] - pub fn atoi(__nptr: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Convert a string to a long integer."] - pub fn atol(__nptr: *const cty::c_char) -> cty::c_long; -} -extern "C" { - #[doc = " Convert a string to a long long integer."] - pub fn atoll(__nptr: *const cty::c_char) -> cty::c_longlong; -} -extern "C" { - #[doc = " Convert a string to a floating-point number."] - pub fn strtod(__nptr: *const cty::c_char, __endptr: *mut *mut cty::c_char) -> f64; -} -extern "C" { - #[doc = " Likewise for `float' and `long double' sizes of floating-point numbers."] - pub fn strtof(__nptr: *const cty::c_char, __endptr: *mut *mut cty::c_char) -> f32; -} -extern "C" { - #[doc = " Convert a string to a long integer."] - pub fn strtol( - __nptr: *const cty::c_char, - __endptr: *mut *mut cty::c_char, - __base: cty::c_int, - ) -> cty::c_long; -} -extern "C" { - #[doc = " Convert a string to an unsigned long integer."] - pub fn strtoul( - __nptr: *const cty::c_char, - __endptr: *mut *mut cty::c_char, - __base: cty::c_int, - ) -> cty::c_ulong; -} -extern "C" { - #[doc = " Convert a string to a quadword integer."] - pub fn strtoll( - __nptr: *const cty::c_char, - __endptr: *mut *mut cty::c_char, - __base: cty::c_int, - ) -> cty::c_longlong; -} -extern "C" { - #[doc = " Convert a string to an unsigned quadword integer."] - pub fn strtoull( - __nptr: *const cty::c_char, - __endptr: *mut *mut cty::c_char, - __base: cty::c_int, - ) -> cty::c_ulonglong; -} -extern "C" { - #[doc = " Return a random integer between 0 and RAND_MAX inclusive."] - pub fn rand() -> cty::c_int; -} -extern "C" { - #[doc = " Seed the random number generator with the given number."] - pub fn srand(__seed: cty::c_uint); -} -extern "C" { - #[doc = " Return non-negative, double-precision floating-point value in [0.0,1.0)."] - pub fn drand48() -> f64; -} -extern "C" { - pub fn erand48(__xsubi: *mut cty::c_ushort) -> f64; -} -extern "C" { - #[doc = " Return non-negative, long integer in [0,2^31)."] - pub fn lrand48() -> cty::c_long; -} -extern "C" { - pub fn nrand48(__xsubi: *mut cty::c_ushort) -> cty::c_long; -} -extern "C" { - #[doc = " Return signed, long integers in [-2^31,2^31)."] - pub fn mrand48() -> cty::c_long; -} -extern "C" { - pub fn jrand48(__xsubi: *mut cty::c_ushort) -> cty::c_long; -} -extern "C" { - #[doc = " Seed random number generator."] - pub fn srand48(__seedval: cty::c_long); -} -extern "C" { - pub fn seed48(__seed16v: *mut cty::c_ushort) -> *mut cty::c_ushort; -} -extern "C" { - pub fn lcong48(__param: *mut cty::c_ushort); -} -extern "C" { - #[doc = " Allocate SIZE bytes of memory."] - pub fn malloc(__size: cty::c_ulong) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Allocate NMEMB elements of SIZE bytes each, all initialized to 0."] - pub fn calloc(__nmemb: cty::c_ulong, __size: cty::c_ulong) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Re-allocate the previously allocated block"] - #[doc = "in PTR, making the new block SIZE bytes long. */"] - #[doc = "the same pointer that was passed to it, aliasing needs to be allowed"] - #[doc = "between objects pointed by the old and new pointers."] - pub fn realloc(__ptr: *mut cty::c_void, __size: cty::c_ulong) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Free a block allocated by `malloc', `realloc' or `calloc'."] - pub fn free(__ptr: *mut cty::c_void); -} -extern "C" { - #[doc = " ISO C variant of aligned allocation."] - pub fn aligned_alloc(__alignment: size_t, __size: size_t) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Abort execution and generate a core-dump."] - pub fn abort(); -} -extern "C" { - #[doc = " Register a function to be called when `exit' is called."] - pub fn atexit(__func: ::core::option::Option) -> cty::c_int; -} -extern "C" { - pub fn at_quick_exit(__func: ::core::option::Option) -> cty::c_int; -} -extern "C" { - #[doc = " Call all functions registered with `atexit' and `on_exit',"] - #[doc = "in the reverse of the order in which they were registered,"] - #[doc = "perform stdio cleanup, and terminate program execution with STATUS."] - pub fn exit(__status: cty::c_int); -} -extern "C" { - #[doc = " Call all functions registered with `at_quick_exit' in the reverse"] - #[doc = "of the order in which they were registered and terminate program"] - #[doc = "execution with STATUS."] - pub fn quick_exit(__status: cty::c_int); -} -extern "C" { - #[doc = " Terminate the program with STATUS without calling any of the"] - #[doc = "functions registered with `atexit' or `on_exit'."] - pub fn _Exit(__status: cty::c_int); -} -extern "C" { - #[doc = " Return the value of envariable NAME, or NULL if it doesn't exist."] - pub fn getenv(__name: *const cty::c_char) -> *mut cty::c_char; -} -extern "C" { - #[doc = " The SVID says this is in , but this seems a better place.\t*/"] - #[doc = "If there is no `=', remove NAME from the environment."] - pub fn putenv(__string: *mut cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Execute the given line as a shell command."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn system(__command: *const cty::c_char) -> cty::c_int; -} -pub type __compar_fn_t = ::core::option::Option< - unsafe extern "C" fn(arg1: *const cty::c_void, arg2: *const cty::c_void) -> cty::c_int, ->; -extern "C" { - #[doc = " Do a binary search for KEY in BASE, which consists of NMEMB elements"] - #[doc = "of SIZE bytes each, using COMPAR to perform the comparisons."] - pub fn bsearch( - __key: *const cty::c_void, - __base: *const cty::c_void, - __nmemb: size_t, - __size: size_t, - __compar: __compar_fn_t, - ) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Sort NMEMB elements of BASE, of SIZE bytes each,"] - #[doc = "using COMPAR to perform the comparisons."] - pub fn qsort( - __base: *mut cty::c_void, - __nmemb: size_t, - __size: size_t, - __compar: __compar_fn_t, - ); -} -extern "C" { - #[doc = " Return the absolute value of X."] - pub fn abs(__x: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn labs(__x: cty::c_long) -> cty::c_long; -} -extern "C" { - pub fn llabs(__x: cty::c_longlong) -> cty::c_longlong; -} -extern "C" { - #[doc = " Return the `div_t', `ldiv_t' or `lldiv_t' representation"] - #[doc = "of the value of NUMER over DENOM. */"] - pub fn div(__numer: cty::c_int, __denom: cty::c_int) -> div_t; -} -extern "C" { - pub fn ldiv(__numer: cty::c_long, __denom: cty::c_long) -> ldiv_t; -} -extern "C" { - pub fn lldiv(__numer: cty::c_longlong, __denom: cty::c_longlong) -> lldiv_t; -} -extern "C" { - #[doc = " Return the length of the multibyte character"] - #[doc = "in S, which is no longer than N."] - pub fn mblen(__s: *const cty::c_char, __n: size_t) -> cty::c_int; -} -extern "C" { - #[doc = " Return the length of the given multibyte character,"] - #[doc = "putting its `wchar_t' representation in *PWC."] - pub fn mbtowc(__pwc: *mut wchar_t, __s: *const cty::c_char, __n: size_t) -> cty::c_int; -} -extern "C" { - #[doc = " Put the multibyte character represented"] - #[doc = "by WCHAR in S, returning its length."] - pub fn wctomb(__s: *mut cty::c_char, __wchar: wchar_t) -> cty::c_int; -} -extern "C" { - #[doc = " Convert a multibyte string to a wide char string."] - pub fn mbstowcs(__pwcs: *mut wchar_t, __s: *const cty::c_char, __n: size_t) -> size_t; -} -extern "C" { - #[doc = " Convert a wide char string to multibyte string."] - pub fn wcstombs(__s: *mut cty::c_char, __pwcs: *const wchar_t, __n: size_t) -> size_t; -} -extern "C" { - #[doc = " Copy N bytes of SRC to DEST."] - pub fn memcpy( - __dest: *mut cty::c_void, - __src: *const cty::c_void, - __n: cty::c_ulong, - ) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Copy N bytes of SRC to DEST, guaranteeing"] - #[doc = "correct behavior for overlapping strings."] - pub fn memmove( - __dest: *mut cty::c_void, - __src: *const cty::c_void, - __n: cty::c_ulong, - ) -> *mut cty::c_void; -} -extern "C" { - pub fn memccpy( - __dest: *mut cty::c_void, - __src: *const cty::c_void, - __c: cty::c_int, - __n: cty::c_ulong, - ) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Set N bytes of S to C."] - pub fn memset(__s: *mut cty::c_void, __c: cty::c_int, __n: cty::c_ulong) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Compare N bytes of S1 and S2."] - pub fn memcmp( - __s1: *const cty::c_void, - __s2: *const cty::c_void, - __n: cty::c_ulong, - ) -> cty::c_int; -} -extern "C" { - pub fn memchr(__s: *const cty::c_void, __c: cty::c_int, __n: cty::c_ulong) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Copy SRC to DEST."] - pub fn strcpy(__dest: *mut cty::c_char, __src: *const cty::c_char) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Copy no more than N characters of SRC to DEST."] - pub fn strncpy( - __dest: *mut cty::c_char, - __src: *const cty::c_char, - __n: cty::c_ulong, - ) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Append SRC onto DEST."] - pub fn strcat(__dest: *mut cty::c_char, __src: *const cty::c_char) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Append no more than N characters from SRC onto DEST."] - pub fn strncat( - __dest: *mut cty::c_char, - __src: *const cty::c_char, - __n: cty::c_ulong, - ) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Compare S1 and S2."] - pub fn strcmp(__s1: *const cty::c_char, __s2: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Compare N characters of S1 and S2."] - pub fn strncmp( - __s1: *const cty::c_char, - __s2: *const cty::c_char, - __n: cty::c_ulong, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Compare the collated forms of S1 and S2."] - pub fn strcoll(__s1: *const cty::c_char, __s2: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Put a transformation of SRC into no more than N bytes of DEST."] - pub fn strxfrm( - __dest: *mut cty::c_char, - __src: *const cty::c_char, - __n: cty::c_ulong, - ) -> cty::c_ulong; -} -extern "C" { - pub fn strchr(__s: *const cty::c_char, __c: cty::c_int) -> *mut cty::c_char; -} -extern "C" { - pub fn strrchr(__s: *const cty::c_char, __c: cty::c_int) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Return the length of the initial segment of S which"] - #[doc = "consists entirely of characters not in REJECT."] - pub fn strcspn(__s: *const cty::c_char, __reject: *const cty::c_char) -> cty::c_ulong; -} -extern "C" { - #[doc = " Return the length of the initial segment of S which"] - #[doc = "consists entirely of characters in ACCEPT."] - pub fn strspn(__s: *const cty::c_char, __accept: *const cty::c_char) -> cty::c_ulong; -} -extern "C" { - pub fn strpbrk(__s: *const cty::c_char, __accept: *const cty::c_char) -> *mut cty::c_char; -} -extern "C" { - pub fn strstr(__haystack: *const cty::c_char, __needle: *const cty::c_char) - -> *mut cty::c_char; -} -extern "C" { - #[doc = " Divide S into tokens separated by characters in DELIM."] - pub fn strtok(__s: *mut cty::c_char, __delim: *const cty::c_char) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Divide S into tokens separated by characters in DELIM. Information"] - #[doc = "passed between calls are stored in SAVE_PTR."] - pub fn __strtok_r( - __s: *mut cty::c_char, - __delim: *const cty::c_char, - __save_ptr: *mut *mut cty::c_char, - ) -> *mut cty::c_char; -} -extern "C" { - pub fn strtok_r( - __s: *mut cty::c_char, - __delim: *const cty::c_char, - __save_ptr: *mut *mut cty::c_char, - ) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Return the length of S."] - pub fn strlen(__s: *const cty::c_char) -> cty::c_ulong; -} -extern "C" { - #[doc = " Return a string describing the meaning of the `errno' code in ERRNUM."] - pub fn strerror(__errnum: cty::c_int) -> *mut cty::c_char; -} -#[doc = " An integral type that can be modified atomically, without the"] -#[doc = "possibility of a signal arriving in the middle of the operation."] -pub type sig_atomic_t = __sig_atomic_t; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct __sigset_t { - pub __val: [cty::c_ulong; 16usize], -} -#[test] -fn bindgen_test_layout___sigset_t() { - assert_eq!( - ::core::mem::size_of::<__sigset_t>(), - 128usize, - concat!("Size of: ", stringify!(__sigset_t)) - ); - assert_eq!( - ::core::mem::align_of::<__sigset_t>(), - 8usize, - concat!("Alignment of ", stringify!(__sigset_t)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<__sigset_t>())).__val as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__sigset_t), - "::", - stringify!(__val) - ) - ); -} -#[doc = " A set of signals to be blocked, unblocked, or waited for."] -pub type sigset_t = __sigset_t; -pub type pid_t = __pid_t; -pub type uid_t = __uid_t; -#[doc = " Type of a signal handler."] -pub type __sighandler_t = ::core::option::Option; -extern "C" { - #[doc = " The X/Open definition of `signal' specifies the SVID semantic. Use"] - #[doc = "the additional function `sysv_signal' when X/Open compatibility is"] - #[doc = "requested."] - pub fn __sysv_signal(__sig: cty::c_int, __handler: __sighandler_t) -> __sighandler_t; -} -extern "C" { - pub fn kill(__pid: __pid_t, __sig: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Raise signal SIG, i.e., send SIG to yourself."] - pub fn raise(__sig: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Clear all signals from SET."] - pub fn sigemptyset(__set: *mut sigset_t) -> cty::c_int; -} -extern "C" { - #[doc = " Set all signals in SET."] - pub fn sigfillset(__set: *mut sigset_t) -> cty::c_int; -} -extern "C" { - #[doc = " Add SIGNO to SET."] - pub fn sigaddset(__set: *mut sigset_t, __signo: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Remove SIGNO from SET."] - pub fn sigdelset(__set: *mut sigset_t, __signo: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Return 1 if SIGNO is in SET, 0 if not."] - pub fn sigismember(__set: *const sigset_t, __signo: cty::c_int) -> cty::c_int; -} -#[doc = " Structure describing the action to be taken when a signal arrives."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct sigaction { - pub sa_handler: __sighandler_t, - #[doc = " Additional set of signals to be blocked."] - pub sa_mask: __sigset_t, - #[doc = " Special flags."] - pub sa_flags: cty::c_int, - #[doc = " Restore handler."] - pub sa_restorer: ::core::option::Option, -} -#[test] -fn bindgen_test_layout_sigaction() { - assert_eq!( - ::core::mem::size_of::(), - 152usize, - concat!("Size of: ", stringify!(sigaction)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(sigaction)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sa_handler as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(sigaction), - "::", - stringify!(sa_handler) - ) - ); - 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 }, - 136usize, - concat!( - "Offset of field: ", - stringify!(sigaction), - "::", - stringify!(sa_flags) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sa_restorer as *const _ as usize }, - 144usize, - concat!( - "Offset of field: ", - stringify!(sigaction), - "::", - stringify!(sa_restorer) - ) - ); -} -extern "C" { - #[doc = " Get and/or change the set of blocked signals."] - pub fn sigprocmask( - __how: cty::c_int, - __set: *const sigset_t, - __oset: *mut sigset_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Change the set of blocked signals to SET,"] - #[doc = "wait until a signal arrives, and restore the set of blocked signals."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn sigsuspend(__set: *const sigset_t) -> cty::c_int; -} -extern "C" { - #[doc = " Get and/or set the action for signal SIG."] - pub fn sigaction( - __sig: cty::c_int, - __act: *const sigaction, - __oact: *mut sigaction, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Put in SET all signals that are blocked and waiting to be delivered."] - pub fn sigpending(__set: *mut sigset_t) -> cty::c_int; -} -extern "C" { - #[doc = " Return number of available real-time signal with highest priority."] - pub fn __libc_current_sigrtmin() -> cty::c_int; -} -extern "C" { - #[doc = " Return number of available real-time signal with lowest priority."] - pub fn __libc_current_sigrtmax() -> cty::c_int; -} -#[doc = " Structure for scatter/gather I/O."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct iovec { - #[doc = " Pointer to data."] - pub iov_base: *mut cty::c_void, - #[doc = " Length of data."] - pub iov_len: size_t, -} -#[test] -fn bindgen_test_layout_iovec() { - assert_eq!( - ::core::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(iovec)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(iovec)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).iov_base as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(iovec), - "::", - stringify!(iov_base) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).iov_len as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(iovec), - "::", - stringify!(iov_len) - ) - ); -} -pub type ino_t = __ino_t; -pub type dev_t = __dev_t; -pub type gid_t = __gid_t; -pub type mode_t = __mode_t; -pub type nlink_t = __nlink_t; -pub type off_t = __off_t; -pub type id_t = __id_t; -pub type ssize_t = __ssize_t; -pub type key_t = __key_t; -#[doc = " Clock ID used in clock and timer functions."] -pub type clockid_t = __clockid_t; -#[doc = " Timer ID returned by `timer_create'."] -pub type timer_t = __timer_t; -pub type useconds_t = __useconds_t; -pub type suseconds_t = __suseconds_t; -#[doc = " These were defined by ISO C without the first `_'."] -pub type u_int8_t = __uint8_t; -pub type u_int16_t = __uint16_t; -pub type u_int32_t = __uint32_t; -pub type u_int64_t = __uint64_t; -pub type register_t = cty::c_long; -pub type blkcnt_t = __blkcnt_t; -pub type fsblkcnt_t = __fsblkcnt_t; -pub type fsfilcnt_t = __fsfilcnt_t; -pub type socklen_t = __socklen_t; -#[doc = " Sequenced, reliable, connection-based"] -#[doc = "byte streams."] -pub const __socket_type_SOCK_STREAM: __socket_type = 1; -#[doc = " Connectionless, unreliable datagrams"] -#[doc = "of fixed maximum length."] -pub const __socket_type_SOCK_DGRAM: __socket_type = 2; -#[doc = " Raw protocol interface."] -pub const __socket_type_SOCK_RAW: __socket_type = 3; -#[doc = " Reliably-delivered messages."] -pub const __socket_type_SOCK_RDM: __socket_type = 4; -#[doc = " Sequenced, reliable, connection-based,"] -#[doc = "datagrams of fixed maximum length."] -pub const __socket_type_SOCK_SEQPACKET: __socket_type = 5; -#[doc = " Datagram Congestion Control Protocol."] -pub const __socket_type_SOCK_DCCP: __socket_type = 6; -#[doc = " Linux specific way of getting packets"] -#[doc = "at the dev level. For writing rarp and"] -#[doc = "other similar things on the user level."] -pub const __socket_type_SOCK_PACKET: __socket_type = 10; -#[doc = " Atomically set close-on-exec flag for the"] -#[doc = "new descriptor(s)."] -pub const __socket_type_SOCK_CLOEXEC: __socket_type = 524288; -#[doc = " Atomically mark descriptor(s) as"] -#[doc = "non-blocking."] -pub const __socket_type_SOCK_NONBLOCK: __socket_type = 2048; -#[doc = " Types of sockets."] -pub type __socket_type = cty::c_uint; -#[doc = " POSIX.1g specifies this type name for the `sa_family' member."] -pub type sa_family_t = cty::c_ushort; -#[doc = " Structure describing a generic socket address."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct sockaddr { - pub sa_family: sa_family_t, - #[doc = " Address data."] - pub sa_data: [cty::c_char; 14usize], -} -#[test] -fn bindgen_test_layout_sockaddr() { - assert_eq!( - ::core::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(sockaddr)) - ); - assert_eq!( - ::core::mem::align_of::(), - 2usize, - concat!("Alignment of ", stringify!(sockaddr)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sa_family as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(sockaddr), - "::", - stringify!(sa_family) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sa_data as *const _ as usize }, - 2usize, - concat!( - "Offset of field: ", - stringify!(sockaddr), - "::", - stringify!(sa_data) - ) - ); -} -#[repr(C)] -#[derive(Copy, Clone)] -pub struct sockaddr_storage { - pub ss_family: sa_family_t, - pub __ss_padding: [cty::c_char; 118usize], - #[doc = " Force desired alignment."] - pub __ss_align: cty::c_ulong, -} -#[test] -fn bindgen_test_layout_sockaddr_storage() { - assert_eq!( - ::core::mem::size_of::(), - 128usize, - concat!("Size of: ", stringify!(sockaddr_storage)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(sockaddr_storage)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).ss_family as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_storage), - "::", - stringify!(ss_family) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).__ss_padding as *const _ as usize }, - 2usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_storage), - "::", - stringify!(__ss_padding) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).__ss_align as *const _ as usize }, - 120usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_storage), - "::", - stringify!(__ss_align) - ) - ); -} -#[doc = " Process out-of-band data."] -pub const MSG_OOB: cty::c_uint = 1; -#[doc = " Peek at incoming messages."] -pub const MSG_PEEK: cty::c_uint = 2; -#[doc = " Don't use local routing."] -pub const MSG_DONTROUTE: cty::c_uint = 4; -#[doc = " Control data lost before delivery."] -pub const MSG_CTRUNC: cty::c_uint = 8; -#[doc = " Supply or ask second address."] -pub const MSG_PROXY: cty::c_uint = 16; -pub const MSG_TRUNC: cty::c_uint = 32; -#[doc = " Nonblocking IO."] -pub const MSG_DONTWAIT: cty::c_uint = 64; -#[doc = " End of record."] -pub const MSG_EOR: cty::c_uint = 128; -#[doc = " Wait for a full request."] -pub const MSG_WAITALL: cty::c_uint = 256; -pub const MSG_FIN: cty::c_uint = 512; -pub const MSG_SYN: cty::c_uint = 1024; -#[doc = " Confirm path validity."] -pub const MSG_CONFIRM: cty::c_uint = 2048; -pub const MSG_RST: cty::c_uint = 4096; -#[doc = " Fetch message from error queue."] -pub const MSG_ERRQUEUE: cty::c_uint = 8192; -#[doc = " Do not generate SIGPIPE."] -pub const MSG_NOSIGNAL: cty::c_uint = 16384; -#[doc = " Sender will send more."] -pub const MSG_MORE: cty::c_uint = 32768; -#[doc = " Wait for at least one packet to return."] -pub const MSG_WAITFORONE: cty::c_uint = 65536; -#[doc = " sendmmsg: more messages coming."] -pub const MSG_BATCH: cty::c_uint = 262144; -#[doc = " Use user data in kernel path."] -pub const MSG_ZEROCOPY: cty::c_uint = 67108864; -#[doc = " Send data in TCP SYN."] -pub const MSG_FASTOPEN: cty::c_uint = 536870912; -#[doc = " Set close_on_exit for file"] -#[doc = "descriptor received through"] -#[doc = "SCM_RIGHTS."] -pub const MSG_CMSG_CLOEXEC: cty::c_uint = 1073741824; -#[doc = " Bits in the FLAGS argument to `send', `recv', et al."] -pub type _bindgen_ty_3 = cty::c_uint; -#[doc = " Structure describing messages sent by"] -#[doc = "`sendmsg' and received by `recvmsg'."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct msghdr { - #[doc = " Address to send to/receive from."] - pub msg_name: *mut cty::c_void, - #[doc = " Length of address data."] - pub msg_namelen: socklen_t, - #[doc = " Vector of data to send/receive into."] - pub msg_iov: *mut iovec, - #[doc = " Number of elements in the vector."] - pub msg_iovlen: size_t, - #[doc = " Ancillary data (eg BSD filedesc passing)."] - pub msg_control: *mut cty::c_void, - #[doc = " Ancillary data buffer length."] - #[doc = " The type should be socklen_t but the"] - #[doc = "definition of the kernel is incompatible"] - #[doc = "with this."] - pub msg_controllen: size_t, - #[doc = " Flags on received message."] - pub msg_flags: cty::c_int, -} -#[test] -fn bindgen_test_layout_msghdr() { - assert_eq!( - ::core::mem::size_of::(), - 56usize, - concat!("Size of: ", stringify!(msghdr)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(msghdr)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).msg_name as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(msghdr), - "::", - stringify!(msg_name) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).msg_namelen as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(msghdr), - "::", - stringify!(msg_namelen) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).msg_iov as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(msghdr), - "::", - stringify!(msg_iov) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).msg_iovlen as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(msghdr), - "::", - stringify!(msg_iovlen) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).msg_control as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(msghdr), - "::", - stringify!(msg_control) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).msg_controllen as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(msghdr), - "::", - stringify!(msg_controllen) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).msg_flags as *const _ as usize }, - 48usize, - concat!( - "Offset of field: ", - stringify!(msghdr), - "::", - stringify!(msg_flags) - ) - ); -} -#[doc = " Structure used for storage of ancillary data object information."] -#[repr(C)] -#[derive(Debug)] -pub struct cmsghdr { - #[doc = " Length of data in cmsg_data plus length"] - #[doc = "of cmsghdr structure."] - #[doc = " The type should be socklen_t but the"] - #[doc = "definition of the kernel is incompatible"] - #[doc = "with this."] - pub cmsg_len: size_t, - #[doc = " Originating protocol."] - pub cmsg_level: cty::c_int, - #[doc = " Protocol specific type."] - pub cmsg_type: cty::c_int, - #[doc = " Ancillary data."] - pub __cmsg_data: __IncompleteArrayField, -} -#[test] -fn bindgen_test_layout_cmsghdr() { - assert_eq!( - ::core::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(cmsghdr)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(cmsghdr)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).cmsg_len as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(cmsghdr), - "::", - stringify!(cmsg_len) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).cmsg_level as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(cmsghdr), - "::", - stringify!(cmsg_level) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).cmsg_type as *const _ as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(cmsghdr), - "::", - stringify!(cmsg_type) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).__cmsg_data as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(cmsghdr), - "::", - stringify!(__cmsg_data) - ) - ); -} -extern "C" { - pub fn __cmsg_nxthdr(__mhdr: *mut msghdr, __cmsg: *mut cmsghdr) -> *mut cmsghdr; -} -#[doc = " Transfer file descriptors."] -pub const SCM_RIGHTS: cty::c_uint = 1; -#[doc = " Socket level message types. This must match the definitions in"] -#[doc = "."] -pub type _bindgen_ty_4 = cty::c_uint; -#[doc = " Structure used to manipulate the SO_LINGER option."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct linger { - #[doc = " Nonzero to linger on close."] - pub l_onoff: cty::c_int, - #[doc = " Time to linger."] - pub l_linger: cty::c_int, -} -#[test] -fn bindgen_test_layout_linger() { - assert_eq!( - ::core::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(linger)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(linger)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).l_onoff as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(linger), - "::", - stringify!(l_onoff) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).l_linger as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(linger), - "::", - stringify!(l_linger) - ) - ); -} -#[doc = " No more receptions."] -pub const SHUT_RD: cty::c_uint = 0; -#[doc = " No more transmissions."] -pub const SHUT_WR: cty::c_uint = 1; -#[doc = " No more receptions or transmissions."] -pub const SHUT_RDWR: cty::c_uint = 2; -#[doc = " The following constants should be used for the second parameter of"] -#[doc = "`shutdown'."] -pub type _bindgen_ty_5 = cty::c_uint; -extern "C" { - #[doc = " Create a new socket of type TYPE in domain DOMAIN, using"] - #[doc = "protocol PROTOCOL. If PROTOCOL is zero, one is chosen automatically."] - #[doc = "Returns a file descriptor for the new socket, or -1 for errors."] - pub fn socket(__domain: cty::c_int, __type: cty::c_int, __protocol: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Create two new sockets, of type TYPE in domain DOMAIN and using"] - #[doc = "protocol PROTOCOL, which are connected to each other, and put file"] - #[doc = "descriptors for them in FDS[0] and FDS[1]. If PROTOCOL is zero,"] - #[doc = "one will be chosen automatically. Returns 0 on success, -1 for errors."] - pub fn socketpair( - __domain: cty::c_int, - __type: cty::c_int, - __protocol: cty::c_int, - __fds: *mut cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Give the socket FD the local address ADDR (which is LEN bytes long)."] - pub fn bind(__fd: cty::c_int, __addr: *const sockaddr, __len: socklen_t) -> cty::c_int; -} -extern "C" { - #[doc = " Put the local address of FD into *ADDR and its length in *LEN."] - pub fn getsockname( - __fd: cty::c_int, - __addr: *mut sockaddr, - __len: *mut socklen_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Open a connection on socket FD to peer at ADDR (which LEN bytes long)."] - #[doc = "For connectionless socket types, just set the default address to send to"] - #[doc = "and the only address from which to accept transmissions."] - #[doc = "Return 0 on success, -1 for errors."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn connect(__fd: cty::c_int, __addr: *const sockaddr, __len: socklen_t) -> cty::c_int; -} -extern "C" { - #[doc = " Put the address of the peer connected to socket FD into *ADDR"] - #[doc = "(which is *LEN bytes long), and its actual length into *LEN."] - pub fn getpeername( - __fd: cty::c_int, - __addr: *mut sockaddr, - __len: *mut socklen_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Send N bytes of BUF to socket FD. Returns the number sent or -1."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn send( - __fd: cty::c_int, - __buf: *const cty::c_void, - __n: size_t, - __flags: cty::c_int, - ) -> ssize_t; -} -extern "C" { - #[doc = " Read N bytes into BUF from socket FD."] - #[doc = "Returns the number read or -1 for errors."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn recv( - __fd: cty::c_int, - __buf: *mut cty::c_void, - __n: size_t, - __flags: cty::c_int, - ) -> ssize_t; -} -extern "C" { - #[doc = " Send N bytes of BUF on socket FD to peer at address ADDR (which is"] - #[doc = "ADDR_LEN bytes long). Returns the number sent, or -1 for errors."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn sendto( - __fd: cty::c_int, - __buf: *const cty::c_void, - __n: size_t, - __flags: cty::c_int, - __addr: *const sockaddr, - __addr_len: socklen_t, - ) -> ssize_t; -} -extern "C" { - #[doc = " Read N bytes into BUF through socket FD."] - #[doc = "If ADDR is not NULL, fill in *ADDR_LEN bytes of it with tha address of"] - #[doc = "the sender, and store the actual size of the address in *ADDR_LEN."] - #[doc = "Returns the number of bytes read or -1 for errors."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn recvfrom( - __fd: cty::c_int, - __buf: *mut cty::c_void, - __n: size_t, - __flags: cty::c_int, - __addr: *mut sockaddr, - __addr_len: *mut socklen_t, - ) -> ssize_t; -} -extern "C" { - #[doc = " Send a message described MESSAGE on socket FD."] - #[doc = "Returns the number of bytes sent, or -1 for errors."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn sendmsg(__fd: cty::c_int, __message: *const msghdr, __flags: cty::c_int) -> ssize_t; -} -extern "C" { - #[doc = " Receive a message as described by MESSAGE from socket FD."] - #[doc = "Returns the number of bytes read or -1 for errors."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn recvmsg(__fd: cty::c_int, __message: *mut msghdr, __flags: cty::c_int) -> ssize_t; -} -extern "C" { - #[doc = " Put the current value for socket FD's option OPTNAME at protocol level LEVEL"] - #[doc = "into OPTVAL (which is *OPTLEN bytes long), and set *OPTLEN to the value's"] - #[doc = "actual length. Returns 0 on success, -1 for errors."] - pub fn getsockopt( - __fd: cty::c_int, - __level: cty::c_int, - __optname: cty::c_int, - __optval: *mut cty::c_void, - __optlen: *mut socklen_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Set socket FD's option OPTNAME at protocol level LEVEL"] - #[doc = "to *OPTVAL (which is OPTLEN bytes long)."] - #[doc = "Returns 0 on success, -1 for errors."] - pub fn setsockopt( - __fd: cty::c_int, - __level: cty::c_int, - __optname: cty::c_int, - __optval: *const cty::c_void, - __optlen: socklen_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Prepare to accept connections on socket FD."] - #[doc = "N connection requests will be queued before further requests are refused."] - #[doc = "Returns 0 on success, -1 for errors."] - pub fn listen(__fd: cty::c_int, __n: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Await a connection on socket FD."] - #[doc = "When a connection arrives, open a new socket to communicate with it,"] - #[doc = "set *ADDR (which is *ADDR_LEN bytes long) to the address of the connecting"] - #[doc = "peer and *ADDR_LEN to the address's actual length, and return the"] - #[doc = "new socket's descriptor, or -1 for errors."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn accept( - __fd: cty::c_int, - __addr: *mut sockaddr, - __addr_len: *mut socklen_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Shut down all or part of the connection open on socket FD."] - #[doc = "HOW determines what to shut down:"] - #[doc = "SHUT_RD = No more receptions;"] - #[doc = "SHUT_WR = No more transmissions;"] - #[doc = "SHUT_RDWR = No more receptions or transmissions."] - #[doc = "Returns 0 on success, -1 for errors."] - pub fn shutdown(__fd: cty::c_int, __how: cty::c_int) -> cty::c_int; -} -#[doc = " Internet address."] -pub type in_addr_t = u32; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct in_addr { - pub s_addr: in_addr_t, -} -#[test] -fn bindgen_test_layout_in_addr() { - assert_eq!( - ::core::mem::size_of::(), - 4usize, - concat!("Size of: ", stringify!(in_addr)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(in_addr)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).s_addr as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(in_addr), - "::", - stringify!(s_addr) - ) - ); -} -#[doc = " Dummy protocol for TCP."] -pub const IPPROTO_IP: cty::c_uint = 0; -#[doc = " Internet Control Message Protocol."] -pub const IPPROTO_ICMP: cty::c_uint = 1; -#[doc = " Internet Group Management Protocol."] -pub const IPPROTO_IGMP: cty::c_uint = 2; -#[doc = " IPIP tunnels (older KA9Q tunnels use 94)."] -pub const IPPROTO_IPIP: cty::c_uint = 4; -#[doc = " Transmission Control Protocol."] -pub const IPPROTO_TCP: cty::c_uint = 6; -#[doc = " Exterior Gateway Protocol."] -pub const IPPROTO_EGP: cty::c_uint = 8; -#[doc = " PUP protocol."] -pub const IPPROTO_PUP: cty::c_uint = 12; -#[doc = " User Datagram Protocol."] -pub const IPPROTO_UDP: cty::c_uint = 17; -#[doc = " XNS IDP protocol."] -pub const IPPROTO_IDP: cty::c_uint = 22; -#[doc = " SO Transport Protocol Class 4."] -pub const IPPROTO_TP: cty::c_uint = 29; -#[doc = " Datagram Congestion Control Protocol."] -pub const IPPROTO_DCCP: cty::c_uint = 33; -#[doc = " IPv6 header."] -pub const IPPROTO_IPV6: cty::c_uint = 41; -#[doc = " Reservation Protocol."] -pub const IPPROTO_RSVP: cty::c_uint = 46; -#[doc = " General Routing Encapsulation."] -pub const IPPROTO_GRE: cty::c_uint = 47; -#[doc = " encapsulating security payload."] -pub const IPPROTO_ESP: cty::c_uint = 50; -#[doc = " authentication header."] -pub const IPPROTO_AH: cty::c_uint = 51; -#[doc = " Multicast Transport Protocol."] -pub const IPPROTO_MTP: cty::c_uint = 92; -#[doc = " IP option pseudo header for BEET."] -pub const IPPROTO_BEETPH: cty::c_uint = 94; -#[doc = " Encapsulation Header."] -pub const IPPROTO_ENCAP: cty::c_uint = 98; -#[doc = " Protocol Independent Multicast."] -pub const IPPROTO_PIM: cty::c_uint = 103; -#[doc = " Compression Header Protocol."] -pub const IPPROTO_COMP: cty::c_uint = 108; -#[doc = " Stream Control Transmission Protocol."] -pub const IPPROTO_SCTP: cty::c_uint = 132; -#[doc = " UDP-Lite protocol."] -pub const IPPROTO_UDPLITE: cty::c_uint = 136; -#[doc = " MPLS in IP."] -pub const IPPROTO_MPLS: cty::c_uint = 137; -#[doc = " Raw IP packets."] -pub const IPPROTO_RAW: cty::c_uint = 255; -pub const IPPROTO_MAX: cty::c_uint = 256; -#[doc = " Standard well-defined IP protocols."] -pub type _bindgen_ty_6 = cty::c_uint; -#[doc = " IPv6 Hop-by-Hop options."] -pub const IPPROTO_HOPOPTS: cty::c_uint = 0; -#[doc = " IPv6 routing header."] -pub const IPPROTO_ROUTING: cty::c_uint = 43; -#[doc = " IPv6 fragmentation header."] -pub const IPPROTO_FRAGMENT: cty::c_uint = 44; -#[doc = " ICMPv6."] -pub const IPPROTO_ICMPV6: cty::c_uint = 58; -#[doc = " IPv6 no next header."] -pub const IPPROTO_NONE: cty::c_uint = 59; -#[doc = " IPv6 destination options."] -pub const IPPROTO_DSTOPTS: cty::c_uint = 60; -#[doc = " IPv6 mobility header."] -pub const IPPROTO_MH: cty::c_uint = 135; -pub type _bindgen_ty_7 = cty::c_uint; -#[doc = " Type to represent a port."] -pub type in_port_t = u16; -#[doc = " Echo service."] -pub const IPPORT_ECHO: cty::c_uint = 7; -#[doc = " Discard transmissions service."] -pub const IPPORT_DISCARD: cty::c_uint = 9; -#[doc = " System status service."] -pub const IPPORT_SYSTAT: cty::c_uint = 11; -#[doc = " Time of day service."] -pub const IPPORT_DAYTIME: cty::c_uint = 13; -#[doc = " Network status service."] -pub const IPPORT_NETSTAT: cty::c_uint = 15; -#[doc = " File Transfer Protocol."] -pub const IPPORT_FTP: cty::c_uint = 21; -#[doc = " Telnet protocol."] -pub const IPPORT_TELNET: cty::c_uint = 23; -#[doc = " Simple Mail Transfer Protocol."] -pub const IPPORT_SMTP: cty::c_uint = 25; -#[doc = " Timeserver service."] -pub const IPPORT_TIMESERVER: cty::c_uint = 37; -#[doc = " Domain Name Service."] -pub const IPPORT_NAMESERVER: cty::c_uint = 42; -#[doc = " Internet Whois service."] -pub const IPPORT_WHOIS: cty::c_uint = 43; -pub const IPPORT_MTP: cty::c_uint = 57; -#[doc = " Trivial File Transfer Protocol."] -pub const IPPORT_TFTP: cty::c_uint = 69; -pub const IPPORT_RJE: cty::c_uint = 77; -#[doc = " Finger service."] -pub const IPPORT_FINGER: cty::c_uint = 79; -pub const IPPORT_TTYLINK: cty::c_uint = 87; -#[doc = " SUPDUP protocol."] -pub const IPPORT_SUPDUP: cty::c_uint = 95; -#[doc = " execd service."] -pub const IPPORT_EXECSERVER: cty::c_uint = 512; -#[doc = " rlogind service."] -pub const IPPORT_LOGINSERVER: cty::c_uint = 513; -pub const IPPORT_CMDSERVER: cty::c_uint = 514; -pub const IPPORT_EFSSERVER: cty::c_uint = 520; -#[doc = " UDP ports."] -pub const IPPORT_BIFFUDP: cty::c_uint = 512; -#[doc = " UDP ports."] -pub const IPPORT_WHOSERVER: cty::c_uint = 513; -#[doc = " UDP ports."] -pub const IPPORT_ROUTESERVER: cty::c_uint = 520; -#[doc = " Ports less than this value are reserved for privileged processes."] -pub const IPPORT_RESERVED: cty::c_uint = 1024; -#[doc = " Ports greater this value are reserved for (non-privileged) servers."] -pub const IPPORT_USERRESERVED: cty::c_uint = 5000; -#[doc = " Standard well-known ports."] -pub type _bindgen_ty_8 = cty::c_uint; -#[doc = " IPv6 address"] -#[repr(C)] -#[derive(Copy, Clone)] -pub struct in6_addr { - pub __in6_u: in6_addr__bindgen_ty_1, -} -#[repr(C)] -#[derive(Copy, Clone)] -pub union in6_addr__bindgen_ty_1 { - pub __u6_addr8: [u8; 16usize], - pub __u6_addr16: [u16; 8usize], - pub __u6_addr32: [u32; 4usize], - _bindgen_union_align: [u32; 4usize], -} -#[test] -fn bindgen_test_layout_in6_addr__bindgen_ty_1() { - assert_eq!( - ::core::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(in6_addr__bindgen_ty_1)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(in6_addr__bindgen_ty_1)) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).__u6_addr8 as *const _ as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(in6_addr__bindgen_ty_1), - "::", - stringify!(__u6_addr8) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).__u6_addr16 as *const _ as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(in6_addr__bindgen_ty_1), - "::", - stringify!(__u6_addr16) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).__u6_addr32 as *const _ as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(in6_addr__bindgen_ty_1), - "::", - stringify!(__u6_addr32) - ) - ); -} -#[test] -fn bindgen_test_layout_in6_addr() { - assert_eq!( - ::core::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(in6_addr)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(in6_addr)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).__in6_u as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(in6_addr), - "::", - stringify!(__in6_u) - ) - ); -} -extern "C" { - pub static in6addr_any: in6_addr; -} -extern "C" { - pub static in6addr_loopback: in6_addr; -} -#[doc = " Structure describing an Internet socket address."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct sockaddr_in { - pub sin_family: sa_family_t, - #[doc = " Port number."] - pub sin_port: in_port_t, - #[doc = " Internet address."] - pub sin_addr: in_addr, - #[doc = " Pad to size of `struct sockaddr'."] - pub sin_zero: [cty::c_uchar; 8usize], -} -#[test] -fn bindgen_test_layout_sockaddr_in() { - assert_eq!( - ::core::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(sockaddr_in)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(sockaddr_in)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin_family as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in), - "::", - stringify!(sin_family) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin_port as *const _ as usize }, - 2usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in), - "::", - stringify!(sin_port) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin_addr as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in), - "::", - stringify!(sin_addr) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin_zero as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in), - "::", - stringify!(sin_zero) - ) - ); -} -#[doc = " Ditto, for IPv6."] -#[repr(C)] -#[derive(Copy, Clone)] -pub struct sockaddr_in6 { - pub sin6_family: sa_family_t, - #[doc = " Transport layer port #"] - pub sin6_port: in_port_t, - #[doc = " IPv6 flow information"] - pub sin6_flowinfo: u32, - #[doc = " IPv6 address"] - pub sin6_addr: in6_addr, - #[doc = " IPv6 scope-id"] - pub sin6_scope_id: u32, -} -#[test] -fn bindgen_test_layout_sockaddr_in6() { - assert_eq!( - ::core::mem::size_of::(), - 28usize, - concat!("Size of: ", stringify!(sockaddr_in6)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(sockaddr_in6)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin6_family as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in6), - "::", - stringify!(sin6_family) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin6_port as *const _ as usize }, - 2usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in6), - "::", - stringify!(sin6_port) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin6_flowinfo as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in6), - "::", - stringify!(sin6_flowinfo) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin6_addr as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in6), - "::", - stringify!(sin6_addr) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin6_scope_id as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in6), - "::", - stringify!(sin6_scope_id) - ) - ); -} -#[doc = " Likewise, for IPv6."] -#[repr(C)] -#[derive(Copy, Clone)] -pub struct ipv6_mreq { - #[doc = " IPv6 multicast address of group"] - pub ipv6mr_multiaddr: in6_addr, - #[doc = " local interface"] - pub ipv6mr_interface: cty::c_uint, -} -#[test] -fn bindgen_test_layout_ipv6_mreq() { - assert_eq!( - ::core::mem::size_of::(), - 20usize, - concat!("Size of: ", stringify!(ipv6_mreq)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(ipv6_mreq)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).ipv6mr_multiaddr as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ipv6_mreq), - "::", - stringify!(ipv6mr_multiaddr) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).ipv6mr_interface as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ipv6_mreq), - "::", - stringify!(ipv6mr_interface) - ) - ); -} -extern "C" { - #[doc = " Functions to convert between host and network byte order."] - #[doc = ""] - #[doc = "Please note that these functions normally take `unsigned long int' or"] - #[doc = "`unsigned short int' values as arguments and also return them. But"] - #[doc = "this was a short-sighted decision since on different systems the types"] - #[doc = "may have different representations but the values are always the same."] - pub fn ntohl(__netlong: u32) -> u32; -} -extern "C" { - pub fn ntohs(__netshort: u16) -> u16; -} -extern "C" { - pub fn htonl(__hostlong: u32) -> u32; -} -extern "C" { - pub fn htons(__hostshort: u16) -> u16; -} -extern "C" { - #[doc = " Get a human-readable string describing the running Notcurses version."] - pub fn notcurses_version() -> *const cty::c_char; -} -extern "C" { - #[doc = " Cannot be inline, as we want to get the versions of the actual Notcurses"] - #[doc = " library we loaded, not what we compile against."] - pub fn notcurses_version_components( - major: *mut cty::c_int, - minor: *mut cty::c_int, - patch: *mut cty::c_int, - tweak: *mut cty::c_int, - ); -} -#[repr(C)] -#[derive(Debug)] -pub struct notcurses { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncplane { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncvisual { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncuplot { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncdplot { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncprogbar { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncfdplane { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncsubproc { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncselector { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncmultiselector { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncreader { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncfadectx { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct nctablet { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncreel { - _unused: [u8; 0], -} -#[doc = " let the ncvisual pick"] -pub const ncblitter_e_NCBLIT_DEFAULT: ncblitter_e = 0; -#[doc = " space, compatible with ASCII"] -pub const ncblitter_e_NCBLIT_1x1: ncblitter_e = 1; -#[doc = " halves + 1x1 (space) ▄▀"] -pub const ncblitter_e_NCBLIT_2x1: ncblitter_e = 2; -#[doc = " quadrants + 2x1 ▗▐ ▖▀▟▌▙"] -pub const ncblitter_e_NCBLIT_2x2: ncblitter_e = 3; -#[doc = " sextants (*NOT* 2x2) 🬀🬁🬂🬃🬄🬅🬆🬇🬈🬉🬊🬋🬌🬍🬎🬏🬐🬑🬒🬓🬔🬕🬖🬗🬘🬙🬚🬛🬜🬝🬞"] -pub const ncblitter_e_NCBLIT_3x2: ncblitter_e = 4; -#[doc = " 4 rows, 2 cols (braille) ⡀⡄⡆⡇⢀⣀⣄⣆⣇⢠⣠⣤⣦⣧⢰⣰⣴⣶⣷⢸⣸⣼⣾⣿"] -pub const ncblitter_e_NCBLIT_BRAILLE: ncblitter_e = 5; -#[doc = " pixel graphics"] -pub const ncblitter_e_NCBLIT_PIXEL: ncblitter_e = 6; -#[doc = " four vertical levels █▆▄▂"] -pub const ncblitter_e_NCBLIT_4x1: ncblitter_e = 7; -#[doc = " eight vertical levels █▇▆▅▄▃▂▁"] -pub const ncblitter_e_NCBLIT_8x1: ncblitter_e = 8; -#[doc = " we never blit full blocks, but instead spaces (more efficient) with the"] -#[doc = " background set to the desired foreground."] -pub type ncblitter_e = cty::c_uint; -pub const ncalign_e_NCALIGN_UNALIGNED: ncalign_e = 0; -pub const ncalign_e_NCALIGN_LEFT: ncalign_e = 1; -pub const ncalign_e_NCALIGN_CENTER: ncalign_e = 2; -pub const ncalign_e_NCALIGN_RIGHT: ncalign_e = 3; -#[doc = " Alignment within a plane or terminal. Left/right-justified, or centered."] -pub type ncalign_e = cty::c_uint; -pub const ncscale_e_NCSCALE_NONE: ncscale_e = 0; -pub const ncscale_e_NCSCALE_SCALE: ncscale_e = 1; -pub const ncscale_e_NCSCALE_STRETCH: ncscale_e = 2; -pub const ncscale_e_NCSCALE_NONE_HIRES: ncscale_e = 3; -pub const ncscale_e_NCSCALE_SCALE_HIRES: ncscale_e = 4; -#[doc = " How to scale an ncvisual during rendering. NCSCALE_NONE will apply no"] -#[doc = " scaling. NCSCALE_SCALE scales a visual to the plane's size, maintaining"] -#[doc = " aspect ratio. NCSCALE_STRETCH stretches and scales the image in an"] -#[doc = " attempt to fill the entirety of the plane. NCSCALE_NONE_HIRES and"] -#[doc = " NCSCALE_SCALE_HIRES behave like their counterparts, but admit blitters"] -#[doc = " which don't preserve aspect ratio."] -pub type ncscale_e = cty::c_uint; -extern "C" { - #[doc = " Returns the number of columns occupied by a multibyte (UTF-8) string, or"] - #[doc = " -1 if a non-printable/illegal character is encountered."] - pub fn ncstrwidth(mbs: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " input functions like notcurses_getc() return ucs32-encoded char32_t. convert"] - #[doc = " a series of char32_t to utf8. result must be at least 4 bytes per input"] - #[doc = " char32_t (6 bytes per char32_t will future-proof against Unicode expansion)."] - #[doc = " the number of bytes used is returned, or -1 if passed illegal ucs32, or too"] - #[doc = " small of a buffer."] - pub fn notcurses_ucs32_to_utf8( - ucs32: *const char32_t, - ucs32count: cty::c_uint, - resultbuf: *mut cty::c_uchar, - buflen: size_t, - ) -> cty::c_int; -} -#[doc = " An nccell corresponds to a single character cell on some plane, which can be"] -#[doc = " occupied by a single grapheme cluster (some root spacing glyph, along with"] -#[doc = " possible combining characters, which might span multiple columns). At any"] -#[doc = " cell, we can have a theoretically arbitrarily long UTF-8 string, a foreground"] -#[doc = " color, a background color, and an attribute set. Valid grapheme cluster"] -#[doc = " contents include:"] -#[doc = ""] -#[doc = " * A NUL terminator,"] -#[doc = " * A single control character, followed by a NUL terminator,"] -#[doc = " * At most one spacing character, followed by zero or more nonspacing"] -#[doc = " characters, followed by a NUL terminator."] -#[doc = ""] -#[doc = " Multi-column characters can only have a single style/color throughout."] -#[doc = " Existence is suffering, and thus wcwidth() is not reliable. It's just"] -#[doc = " quoting whether or not the EGC contains a \"Wide Asian\" double-width"] -#[doc = " character. This is set for some things, like most emoji, and not set for"] -#[doc = " other things, like cuneiform. True display width is a *function of the"] -#[doc = " font and terminal*. Among the longest Unicode codepoints is"] -#[doc = ""] -#[doc = " U+FDFD ARABIC LIGATURE BISMILLAH AR-RAHMAN AR-RAHEEM ﷽"] -#[doc = ""] -#[doc = " wcwidth() rather optimistically claims this most exalted glyph to occupy"] -#[doc = " a single column. BiDi text is too complicated for me to even get into here."] -#[doc = " Be assured there are no easy answers; ours is indeed a disturbing Universe."] -#[doc = ""] -#[doc = " Each nccell occupies 16 static bytes (128 bits). The surface is thus ~1.6MB"] -#[doc = " for a (pretty large) 500x200 terminal. At 80x43, it's less than 64KB."] -#[doc = " Dynamic requirements (the egcpool) can add up to 16MB to an ncplane, but"] -#[doc = " such large pools are unlikely in common use."] -#[doc = ""] -#[doc = " We implement some small alpha compositing. Foreground and background both"] -#[doc = " have two bits of inverted alpha. The actual grapheme written to a cell is"] -#[doc = " the topmost non-zero grapheme. If its alpha is 00, its foreground color is"] -#[doc = " used unchanged. If its alpha is 10, its foreground color is derived entirely"] -#[doc = " from cells underneath it. Otherwise, the result will be a composite."] -#[doc = " Likewise for the background. If the bottom of a coordinate's zbuffer is"] -#[doc = " reached with a cumulative alpha of zero, the default is used. In this way,"] -#[doc = " a terminal configured with transparent background can be supported through"] -#[doc = " multiple occluding ncplanes. A foreground alpha of 11 requests high-contrast"] -#[doc = " text (relative to the computed background). A background alpha of 11 is"] -#[doc = " currently forbidden."] -#[doc = ""] -#[doc = " Default color takes precedence over palette or RGB, and cannot be used with"] -#[doc = " transparency. Indexed palette takes precedence over RGB. It cannot"] -#[doc = " meaningfully set transparency, but it can be mixed into a cascading color."] -#[doc = " RGB is used if neither default terminal colors nor palette indexing are in"] -#[doc = " play, and fully supports all transparency options."] -#[doc = ""] -#[doc = " This structure is exposed only so that most functions can be inlined. Do not"] -#[doc = " directly modify or access the fields of this structure; use the API."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct nccell { - #[doc = " 4B → 4B little endian EGC"] - pub gcluster: u32, - #[doc = " 1B → 5B (8 bits of zero)"] - pub gcluster_backstop: u8, - #[doc = " 1B → 6B (8 bits of EGC column width)"] - pub width: u8, - #[doc = " 2B → 8B (16 bits of NCSTYLE_* attributes)"] - pub stylemask: u16, - #[doc = " + 8B == 16B"] - pub channels: u64, -} -#[test] -fn bindgen_test_layout_nccell() { - assert_eq!( - ::core::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(nccell)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(nccell)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).gcluster as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(nccell), - "::", - stringify!(gcluster) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).gcluster_backstop as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(nccell), - "::", - stringify!(gcluster_backstop) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).width as *const _ as usize }, - 5usize, - concat!( - "Offset of field: ", - stringify!(nccell), - "::", - stringify!(width) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).stylemask as *const _ as usize }, - 6usize, - concat!( - "Offset of field: ", - stringify!(nccell), - "::", - stringify!(stylemask) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).channels as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(nccell), - "::", - stringify!(channels) - ) - ); -} -pub type cell = nccell; -extern "C" { - #[doc = " Breaks the UTF-8 string in 'gcluster' down, setting up the nccell 'c'."] - #[doc = " Returns the number of bytes copied out of 'gcluster', or -1 on failure. The"] - #[doc = " styling of the cell is left untouched, but any resources are released."] - pub fn cell_load(n: *mut ncplane, c: *mut nccell, gcluster: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Duplicate 'c' into 'targ'; both must be/will be bound to 'n'. Returns -1 on"] - #[doc = " failure, and 0 on success."] - pub fn cell_duplicate(n: *mut ncplane, targ: *mut nccell, c: *const nccell) -> cty::c_int; -} -extern "C" { - #[doc = " Release resources held by the nccell 'c'."] - pub fn cell_release(n: *mut ncplane, c: *mut nccell); -} -extern "C" { - #[doc = " return a pointer to the NUL-terminated EGC referenced by 'c'. this pointer"] - #[doc = " can be invalidated by any further operation on the plane 'n', so...watch out!"] - #[doc = " must not be called on a pixel graphic."] - pub fn cell_extended_gcluster(n: *const ncplane, c: *const nccell) -> *const cty::c_char; -} -#[doc = " default. print nothing once fullscreen service begins"] -pub const ncloglevel_e_NCLOGLEVEL_SILENT: ncloglevel_e = 0; -#[doc = " print diagnostics immediately related to crashing"] -pub const ncloglevel_e_NCLOGLEVEL_PANIC: ncloglevel_e = 1; -#[doc = " we're hanging around, but we've had a horrible fault"] -pub const ncloglevel_e_NCLOGLEVEL_FATAL: ncloglevel_e = 2; -#[doc = " we can't keep doing this, but we can do other things"] -pub const ncloglevel_e_NCLOGLEVEL_ERROR: ncloglevel_e = 3; -#[doc = " you probably don't want what's happening to happen"] -pub const ncloglevel_e_NCLOGLEVEL_WARNING: ncloglevel_e = 4; -#[doc = " \"standard information\""] -pub const ncloglevel_e_NCLOGLEVEL_INFO: ncloglevel_e = 5; -#[doc = " \"detailed information\""] -pub const ncloglevel_e_NCLOGLEVEL_VERBOSE: ncloglevel_e = 6; -#[doc = " this is honestly a bit much"] -pub const ncloglevel_e_NCLOGLEVEL_DEBUG: ncloglevel_e = 7; -#[doc = " there's probably a better way to do what you want"] -pub const ncloglevel_e_NCLOGLEVEL_TRACE: ncloglevel_e = 8; -#[doc = " These log levels consciously map cleanly to those of libav; Notcurses itself"] -#[doc = " does not use this full granularity. The log level does not affect the opening"] -#[doc = " and closing banners, which can be disabled via the notcurses_option struct's"] -#[doc = " 'suppress_banner'. Note that if stderr is connected to the same terminal on"] -#[doc = " which we're rendering, any kind of logging will disrupt the output."] -pub type ncloglevel_e = cty::c_uint; -#[doc = " Configuration for notcurses_init()."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct notcurses_options { - #[doc = " The name of the terminfo database entry describing this terminal. If NULL,"] - #[doc = " the environment variable TERM is used. Failure to open the terminal"] - #[doc = " definition will result in failure to initialize notcurses."] - pub termtype: *const cty::c_char, - #[doc = " If non-NULL, notcurses_render() will write each rendered frame to this"] - #[doc = " FILE* in addition to outfp. This is used primarily for debugging."] - pub renderfp: *mut FILE, - #[doc = " Progressively higher log levels result in more logging to stderr. By"] - #[doc = " default, nothing is printed to stderr once fullscreen service begins."] - pub loglevel: ncloglevel_e, - #[doc = " Desirable margins. If all are 0 (default), we will render to the entirety"] - #[doc = " of the screen. If the screen is too small, we do what we can--this is"] - #[doc = " strictly best-effort. Absolute coordinates are relative to the rendering"] - #[doc = " area ((0, 0) is always the origin of the rendering area)."] - pub margin_t: cty::c_int, - #[doc = " Desirable margins. If all are 0 (default), we will render to the entirety"] - #[doc = " of the screen. If the screen is too small, we do what we can--this is"] - #[doc = " strictly best-effort. Absolute coordinates are relative to the rendering"] - #[doc = " area ((0, 0) is always the origin of the rendering area)."] - pub margin_r: cty::c_int, - #[doc = " Desirable margins. If all are 0 (default), we will render to the entirety"] - #[doc = " of the screen. If the screen is too small, we do what we can--this is"] - #[doc = " strictly best-effort. Absolute coordinates are relative to the rendering"] - #[doc = " area ((0, 0) is always the origin of the rendering area)."] - pub margin_b: cty::c_int, - #[doc = " Desirable margins. If all are 0 (default), we will render to the entirety"] - #[doc = " of the screen. If the screen is too small, we do what we can--this is"] - #[doc = " strictly best-effort. Absolute coordinates are relative to the rendering"] - #[doc = " area ((0, 0) is always the origin of the rendering area)."] - pub margin_l: cty::c_int, - #[doc = " General flags; see NCOPTION_*. This is expressed as a bitfield so that"] - #[doc = " future options can be added without reshaping the struct. Undefined bits"] - #[doc = " must be set to 0."] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_notcurses_options() { - assert_eq!( - ::core::mem::size_of::(), - 48usize, - concat!("Size of: ", stringify!(notcurses_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(notcurses_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).termtype as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(notcurses_options), - "::", - stringify!(termtype) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).renderfp as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(notcurses_options), - "::", - stringify!(renderfp) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).loglevel as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(notcurses_options), - "::", - stringify!(loglevel) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).margin_t as *const _ as usize }, - 20usize, - concat!( - "Offset of field: ", - stringify!(notcurses_options), - "::", - stringify!(margin_t) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).margin_r as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(notcurses_options), - "::", - stringify!(margin_r) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).margin_b as *const _ as usize }, - 28usize, - concat!( - "Offset of field: ", - stringify!(notcurses_options), - "::", - stringify!(margin_b) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).margin_l as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(notcurses_options), - "::", - stringify!(margin_l) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(notcurses_options), - "::", - stringify!(flags) - ) - ); -} -extern "C" { - #[doc = " Lex a margin argument according to the standard Notcurses definition. There"] - #[doc = " can be either a single number, which will define all margins equally, or"] - #[doc = " there can be four numbers separated by commas."] - pub fn notcurses_lex_margins( - op: *const cty::c_char, - opts: *mut notcurses_options, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Lex a blitter."] - pub fn notcurses_lex_blitter(op: *const cty::c_char, blitter: *mut ncblitter_e) -> cty::c_int; -} -extern "C" { - #[doc = " Get the name of a blitter."] - pub fn notcurses_str_blitter(blitter: ncblitter_e) -> *const cty::c_char; -} -extern "C" { - #[doc = " Lex a scaling mode (one of \"none\", \"stretch\", \"scale\", \"hires\", or \"scalehi\")."] - pub fn notcurses_lex_scalemode(op: *const cty::c_char, scalemode: *mut ncscale_e) - -> cty::c_int; -} -extern "C" { - #[doc = " Get the name of a scaling mode."] - pub fn notcurses_str_scalemode(scalemode: ncscale_e) -> *const cty::c_char; -} -extern "C" { - #[doc = " Initialize a Notcurses context on the connected terminal at 'fp'. 'fp' must"] - #[doc = " be a tty. You'll usually want stdout. NULL can be supplied for 'fp', in"] - #[doc = " which case /dev/tty will be opened. Returns NULL on error, including any"] - #[doc = " failure initializing terminfo."] - pub fn notcurses_init(opts: *const notcurses_options, fp: *mut FILE) -> *mut notcurses; -} -extern "C" { - #[doc = " The same as notcurses_init(), but without any multimedia functionality,"] - #[doc = " allowing for a svelter binary. Link with notcurses-core if this is used."] - pub fn notcurses_core_init(opts: *const notcurses_options, fp: *mut FILE) -> *mut notcurses; -} -extern "C" { - #[doc = " Destroy a Notcurses context."] - pub fn notcurses_stop(nc: *mut notcurses) -> cty::c_int; -} -extern "C" { - #[doc = " Return the topmost plane of the pile containing 'n'."] - pub fn ncpile_top(n: *mut ncplane) -> *mut ncplane; -} -extern "C" { - #[doc = " Return the bottommost plane of the pile containing 'n'."] - pub fn ncpile_bottom(n: *mut ncplane) -> *mut ncplane; -} -extern "C" { - #[doc = " Renders the pile of which 'n' is a part. Rendering this pile again will blow"] - #[doc = " away the render. To actually write out the render, call ncpile_rasterize()."] - pub fn ncpile_render(n: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Make the physical screen match the last rendered frame from the pile of"] - #[doc = " which 'n' is a part. This is a blocking call. Don't call this before the"] - #[doc = " pile has been rendered (doing so will likely result in a blank screen)."] - pub fn ncpile_rasterize(n: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Renders and rasterizes the standard pile in one shot. Blocking call."] - pub fn notcurses_render(nc: *mut notcurses) -> cty::c_int; -} -extern "C" { - #[doc = " Perform the rendering and rasterization portion of notcurses_render(), but"] - #[doc = " do not write the resulting buffer out to the terminal. Using this function,"] - #[doc = " the user can control the writeout process, and render a second frame while"] - #[doc = " writing another. The returned buffer must be freed by the caller."] - pub fn notcurses_render_to_buffer( - nc: *mut notcurses, - buf: *mut *mut cty::c_char, - buflen: *mut size_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Write the last rendered frame, in its entirety, to 'fp'. If"] - #[doc = " notcurses_render() has not yet been called, nothing will be written."] - pub fn notcurses_render_to_file(nc: *mut notcurses, fp: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Return the topmost ncplane of the standard pile."] - pub fn notcurses_top(n: *mut notcurses) -> *mut ncplane; -} -extern "C" { - #[doc = " Return the bottommost ncplane of the standard pile."] - pub fn notcurses_bottom(n: *mut notcurses) -> *mut ncplane; -} -extern "C" { - #[doc = " Destroy all ncplanes other than the stdplane."] - pub fn notcurses_drop_planes(nc: *mut notcurses); -} -#[doc = " An input event. Cell coordinates are currently defined only for mouse events."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncinput { - #[doc = " identifier. Unicode codepoint or synthesized NCKEY event"] - pub id: char32_t, - #[doc = " y cell coordinate of event, -1 for undefined"] - pub y: cty::c_int, - #[doc = " x cell coordinate of event, -1 for undefined"] - pub x: cty::c_int, - #[doc = " was alt held?"] - pub alt: bool, - #[doc = " was shift held?"] - pub shift: bool, - #[doc = " was ctrl held?"] - pub ctrl: bool, - #[doc = " input event number"] - pub seqnum: u64, -} -#[test] -fn bindgen_test_layout_ncinput() { - assert_eq!( - ::core::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(ncinput)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncinput)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).id as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncinput), - "::", - stringify!(id) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).y as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(ncinput), - "::", - stringify!(y) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).x as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncinput), - "::", - stringify!(x) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).alt as *const _ as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(ncinput), - "::", - stringify!(alt) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).shift as *const _ as usize }, - 13usize, - concat!( - "Offset of field: ", - stringify!(ncinput), - "::", - stringify!(shift) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).ctrl as *const _ as usize }, - 14usize, - concat!( - "Offset of field: ", - stringify!(ncinput), - "::", - stringify!(ctrl) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).seqnum as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncinput), - "::", - stringify!(seqnum) - ) - ); -} -extern "C" { - #[doc = " See ppoll(2) for more detail. Provide a NULL 'ts' to block at length, a 'ts'"] - #[doc = " of 0 for non-blocking operation, and otherwise a timespec to bound blocking."] - #[doc = " Signals in sigmask (less several we handle internally) will be atomically"] - #[doc = " masked and unmasked per ppoll(2). It should generally contain all signals."] - #[doc = " Returns a single Unicode code point, or (char32_t)-1 on error. 'sigmask' may"] - #[doc = " be NULL. Returns 0 on a timeout. If an event is processed, the return value"] - #[doc = " is the 'id' field from that event. 'ni' may be NULL."] - pub fn notcurses_getc( - n: *mut notcurses, - ts: *const timespec, - sigmask: *mut sigset_t, - ni: *mut ncinput, - ) -> char32_t; -} -extern "C" { - #[doc = " Get a file descriptor suitable for input event poll()ing. When this"] - #[doc = " descriptor becomes available, you can call notcurses_getc_nblock(),"] - #[doc = " and input ought be ready. This file descriptor is *not* necessarily"] - #[doc = " the file descriptor associated with stdin (but it might be!)."] - pub fn notcurses_inputready_fd(n: *mut notcurses) -> cty::c_int; -} -extern "C" { - #[doc = " Enable the mouse in \"button-event tracking\" mode with focus detection and"] - #[doc = " UTF8-style extended coordinates. On failure, -1 is returned. On success, 0"] - #[doc = " is returned, and mouse events will be published to notcurses_getc()."] - pub fn notcurses_mouse_enable(n: *mut notcurses) -> cty::c_int; -} -extern "C" { - #[doc = " Disable mouse events. Any events in the input queue can still be delivered."] - pub fn notcurses_mouse_disable(n: *mut notcurses) -> cty::c_int; -} -extern "C" { - #[doc = " Disable signals originating from the terminal's line discipline, i.e."] - #[doc = " SIGINT (^C), SIGQUIT (^\\), and SIGTSTP (^Z). They are enabled by default."] - pub fn notcurses_linesigs_disable(n: *mut notcurses) -> cty::c_int; -} -extern "C" { - #[doc = " Restore signals originating from the terminal's line discipline, i.e."] - #[doc = " SIGINT (^C), SIGQUIT (^\\), and SIGTSTP (^Z), if disabled."] - pub fn notcurses_linesigs_enable(n: *mut notcurses) -> cty::c_int; -} -extern "C" { - #[doc = " Refresh the physical screen to match what was last rendered (i.e., without"] - #[doc = " reflecting any changes since the last call to notcurses_render()). This is"] - #[doc = " primarily useful if the screen is externally corrupted, or if an"] - #[doc = " NCKEY_RESIZE event has been read and you're not yet ready to render."] - pub fn notcurses_refresh( - n: *mut notcurses, - y: *mut cty::c_int, - x: *mut cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Extract the Notcurses context to which this plane is attached."] - pub fn ncplane_notcurses(n: *mut ncplane) -> *mut notcurses; -} -extern "C" { - pub fn ncplane_notcurses_const(n: *const ncplane) -> *const notcurses; -} -extern "C" { - #[doc = " Return the dimensions of this ncplane."] - pub fn ncplane_dim_yx(n: *const ncplane, y: *mut cty::c_int, x: *mut cty::c_int); -} -extern "C" { - #[doc = " Get a reference to the standard plane (one matching our current idea of the"] - #[doc = " terminal size) for this terminal. The standard plane always exists, and its"] - #[doc = " origin is always at the uppermost, leftmost cell of the terminal."] - pub fn notcurses_stdplane(nc: *mut notcurses) -> *mut ncplane; -} -extern "C" { - pub fn notcurses_stdplane_const(nc: *const notcurses) -> *const ncplane; -} -extern "C" { - #[doc = " Retrieve the contents of the specified cell as last rendered. Returns the EGC"] - #[doc = " or NULL on error. This EGC must be free()d by the caller. The stylemask and"] - #[doc = " channels are written to 'stylemask' and 'channels', respectively."] - pub fn notcurses_at_yx( - nc: *mut notcurses, - yoff: cty::c_int, - xoff: cty::c_int, - stylemask: *mut u16, - channels: *mut u64, - ) -> *mut cty::c_char; -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncplane_options { - #[doc = " vertical placement relative to parent plane"] - pub y: cty::c_int, - #[doc = " horizontal placement relative to parent plane"] - pub x: cty::c_int, - #[doc = " number of rows, must be positive"] - pub rows: cty::c_int, - #[doc = " number of columns, must be positive"] - pub cols: cty::c_int, - #[doc = " user curry, may be NULL"] - pub userptr: *mut cty::c_void, - #[doc = " name (used only for debugging), may be NULL"] - pub name: *const cty::c_char, - #[doc = " callback when parent is resized"] - pub resizecb: ::core::option::Option cty::c_int>, - #[doc = " closure over NCPLANE_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncplane_options() { - assert_eq!( - ::core::mem::size_of::(), - 48usize, - concat!("Size of: ", stringify!(ncplane_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncplane_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).y as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(y) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).x as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(x) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).rows as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(rows) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).cols as *const _ as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(cols) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).userptr as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(userptr) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).name as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(name) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).resizecb as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(resizecb) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(flags) - ) - ); -} -extern "C" { - #[doc = " Create a new ncplane bound to plane 'n', at the offset 'y'x'x' (relative to"] - #[doc = " the origin of 'n') and the specified size. The number of 'rows' and 'cols'"] - #[doc = " must both be positive. This plane is initially at the top of the z-buffer,"] - #[doc = " as if ncplane_move_top() had been called on it. The void* 'userptr' can be"] - #[doc = " retrieved (and reset) later. A 'name' can be set, used in debugging."] - pub fn ncplane_create(n: *mut ncplane, nopts: *const ncplane_options) -> *mut ncplane; -} -extern "C" { - #[doc = " Same as ncplane_create(), but creates a new pile. The returned plane will"] - #[doc = " be the top, bottom, and root of this new pile."] - pub fn ncpile_create(nc: *mut notcurses, nopts: *const ncplane_options) -> *mut ncplane; -} -extern "C" { - #[doc = " This function will be removed in ABI3 in favor of ncplane_create()."] - #[doc = " It persists in ABI2 only for backwards compatibility."] - pub fn ncplane_new( - n: *mut ncplane, - rows: cty::c_int, - cols: cty::c_int, - y: cty::c_int, - x: cty::c_int, - opaque: *mut cty::c_void, - name: *const cty::c_char, - ) -> *mut ncplane; -} -extern "C" { - #[doc = " Suitable for use as a 'resizecb', this will resize the plane to the visual"] - #[doc = " region's size. It is used for the standard plane."] - pub fn ncplane_resize_maximize(n: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Suitable for use as a 'resizecb'. This will realign the plane 'n' against"] - #[doc = " its parent, using the alignment specified at ncplane_create()-time."] - pub fn ncplane_resize_realign(n: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Replace the ncplane's existing resizecb with 'resizecb' (which may be NULL)."] - #[doc = " The standard plane's resizecb may not be changed."] - pub fn ncplane_set_resizecb( - n: *mut ncplane, - resizecb: ::core::option::Option cty::c_int>, - ); -} -extern "C" { - #[doc = " Returns the ncplane's current resize callback."] - pub fn ncplane_resizecb( - n: *const ncplane, - ) -> ::core::option::Option cty::c_int>; -} -extern "C" { - #[doc = " Plane 'n' will be unbound from its parent plane, and will be made a bound"] - #[doc = " child of 'newparent'. It is an error if 'n' or 'newparent' are NULL. If"] - #[doc = " 'newparent' is equal to 'n', 'n' becomes the root of a new pile, unless 'n'"] - #[doc = " is already the root of a pile, in which case this is a no-op. Returns 'n'."] - #[doc = " The standard plane cannot be reparented. Any planes bound to 'n' are"] - #[doc = " reparented to the previous parent of 'n'."] - pub fn ncplane_reparent(n: *mut ncplane, newparent: *mut ncplane) -> *mut ncplane; -} -extern "C" { - #[doc = " The same as ncplane_reparent(), except any planes bound to 'n' come along"] - #[doc = " with it to its new destination. Their z-order is maintained. If 'newparent'"] - #[doc = " is an ancestor of 'n', NULL is returned, and no changes are made."] - pub fn ncplane_reparent_family(n: *mut ncplane, newparent: *mut ncplane) -> *mut ncplane; -} -extern "C" { - #[doc = " Duplicate an existing ncplane. The new plane will have the same geometry,"] - #[doc = " will duplicate all content, and will start with the same rendering state."] - #[doc = " The new plane will be immediately above the old one on the z axis, and will"] - #[doc = " be bound to the same parent. Bound planes are *not* duplicated; the new"] - #[doc = " plane is bound to the parent of 'n', but has no bound planes."] - pub fn ncplane_dup(n: *const ncplane, opaque: *mut cty::c_void) -> *mut ncplane; -} -extern "C" { - #[doc = " provided a coordinate relative to the origin of 'src', map it to the same"] - #[doc = " absolute coordinate relative to the origin of 'dst'. either or both of 'y'"] - #[doc = " and 'x' may be NULL. if 'dst' is NULL, it is taken to be the standard plane."] - pub fn ncplane_translate( - src: *const ncplane, - dst: *const ncplane, - y: *mut cty::c_int, - x: *mut cty::c_int, - ); -} -extern "C" { - #[doc = " Fed absolute 'y'/'x' coordinates, determine whether that coordinate is"] - #[doc = " within the ncplane 'n'. If not, return false. If so, return true. Either"] - #[doc = " way, translate the absolute coordinates relative to 'n'. If the point is not"] - #[doc = " within 'n', these coordinates will not be within the dimensions of the plane."] - pub fn ncplane_translate_abs(n: *const ncplane, y: *mut cty::c_int, x: *mut cty::c_int) - -> bool; -} -extern "C" { - #[doc = " All planes are created with scrolling disabled. Scrolling can be dynamically"] - #[doc = " controlled with ncplane_set_scrolling(). Returns true if scrolling was"] - #[doc = " previously enabled, or false if it was disabled."] - pub fn ncplane_set_scrolling(n: *mut ncplane, scrollp: bool) -> bool; -} -extern "C" { - #[doc = " Returns a 16-bit bitmask of supported curses-style attributes"] - #[doc = " (NCSTYLE_UNDERLINE, NCSTYLE_BOLD, etc.) The attribute is only"] - #[doc = " indicated as supported if the terminal can support it together with color."] - #[doc = " For more information, see the \"ncv\" capability in terminfo(5)."] - pub fn notcurses_supported_styles(nc: *const notcurses) -> cty::c_uint; -} -extern "C" { - #[doc = " Returns the number of simultaneous colors claimed to be supported, or 1 if"] - #[doc = " there is no color support. Note that several terminal emulators advertise"] - #[doc = " more colors than they actually support, downsampling internally."] - pub fn notcurses_palette_size(nc: *const notcurses) -> cty::c_uint; -} -extern "C" { - #[doc = " Can we directly specify RGB values per cell, or only use palettes?"] - pub fn notcurses_cantruecolor(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " Can we fade? Fading requires either the \"rgb\" or \"ccc\" terminfo capability."] - pub fn notcurses_canfade(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " Can we set the \"hardware\" palette? Requires the \"ccc\" terminfo capability."] - pub fn notcurses_canchangecolor(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " Can we load images? This requires being built against FFmpeg/OIIO."] - pub fn notcurses_canopen_images(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " Can we load videos? This requires being built against FFmpeg."] - pub fn notcurses_canopen_videos(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " Is our encoding UTF-8? Requires LANG being set to a UTF8 locale."] - pub fn notcurses_canutf8(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " Can we reliably use Unicode 13 sextants?"] - pub fn notcurses_cansextant(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " Can we reliably use Unicode Braille?"] - pub fn notcurses_canbraille(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " Can we blit to pixel graphics?"] - pub fn notcurses_canpixel(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " This function must successfully return before NCBLIT_PIXEL is available."] - #[doc = " Returns -1 on error, 0 for no support, or 1 if pixel output is supported."] - #[doc = " Must not be called concurrently with either input or rasterization."] - pub fn notcurses_check_pixel_support(nc: *mut notcurses) -> cty::c_int; -} -#[doc = " whenever a new field is added here, ensure we add the proper rule to"] -#[doc = " notcurses_stats_reset(), so that values are preserved in the stash stats."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncstats { - #[doc = " successful ncpile_render() runs"] - pub renders: u64, - #[doc = " successful ncpile_rasterize() runs"] - pub writeouts: u64, - #[doc = " aborted renders, should be 0"] - pub failed_renders: u64, - #[doc = " aborted writes"] - pub failed_writeouts: u64, - #[doc = " bytes emitted to ttyfp"] - pub render_bytes: u64, - #[doc = " max bytes emitted for a frame"] - pub render_max_bytes: i64, - #[doc = " min bytes emitted for a frame"] - pub render_min_bytes: i64, - #[doc = " nanoseconds spent rendering"] - pub render_ns: u64, - #[doc = " max ns spent in render for a frame"] - pub render_max_ns: i64, - #[doc = " min ns spent in render for a frame"] - pub render_min_ns: i64, - #[doc = " nanoseconds spent writing frames to terminal"] - pub writeout_ns: u64, - #[doc = " max ns spent writing out a frame"] - pub writeout_max_ns: i64, - #[doc = " min ns spent writing out a frame"] - pub writeout_min_ns: i64, - #[doc = " cells we elided entirely thanks to damage maps"] - pub cellelisions: u64, - #[doc = " total number of cells emitted to terminal"] - pub cellemissions: u64, - #[doc = " RGB fg elision count"] - pub fgelisions: u64, - #[doc = " RGB fg emissions"] - pub fgemissions: u64, - #[doc = " RGB bg elision count"] - pub bgelisions: u64, - #[doc = " RGB bg emissions"] - pub bgemissions: u64, - #[doc = " default color was emitted"] - pub defaultelisions: u64, - #[doc = " default color was elided"] - pub defaultemissions: u64, - #[doc = " refresh requests (non-optimized redraw)"] - pub refreshes: u64, - #[doc = " total bytes devoted to all active framebuffers"] - pub fbbytes: u64, - #[doc = " number of planes currently in existence"] - pub planes: cty::c_uint, - #[doc = " nanoseconds spent rasterizing"] - pub raster_ns: u64, - #[doc = " max ns spent in raster for a frame"] - pub raster_max_ns: i64, - #[doc = " min ns spent in raster for a frame"] - pub raster_min_ns: i64, -} -#[test] -fn bindgen_test_layout_ncstats() { - assert_eq!( - ::core::mem::size_of::(), - 216usize, - concat!("Size of: ", stringify!(ncstats)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncstats)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).renders as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(renders) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).writeouts as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(writeouts) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).failed_renders as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(failed_renders) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).failed_writeouts as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(failed_writeouts) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).render_bytes as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(render_bytes) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).render_max_bytes as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(render_max_bytes) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).render_min_bytes as *const _ as usize }, - 48usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(render_min_bytes) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).render_ns as *const _ as usize }, - 56usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(render_ns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).render_max_ns as *const _ as usize }, - 64usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(render_max_ns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).render_min_ns as *const _ as usize }, - 72usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(render_min_ns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).writeout_ns as *const _ as usize }, - 80usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(writeout_ns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).writeout_max_ns as *const _ as usize }, - 88usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(writeout_max_ns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).writeout_min_ns as *const _ as usize }, - 96usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(writeout_min_ns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).cellelisions as *const _ as usize }, - 104usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(cellelisions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).cellemissions as *const _ as usize }, - 112usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(cellemissions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).fgelisions as *const _ as usize }, - 120usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(fgelisions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).fgemissions as *const _ as usize }, - 128usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(fgemissions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).bgelisions as *const _ as usize }, - 136usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(bgelisions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).bgemissions as *const _ as usize }, - 144usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(bgemissions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).defaultelisions as *const _ as usize }, - 152usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(defaultelisions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).defaultemissions as *const _ as usize }, - 160usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(defaultemissions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).refreshes as *const _ as usize }, - 168usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(refreshes) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).fbbytes as *const _ as usize }, - 176usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(fbbytes) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).planes as *const _ as usize }, - 184usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(planes) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).raster_ns as *const _ as usize }, - 192usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(raster_ns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).raster_max_ns as *const _ as usize }, - 200usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(raster_max_ns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).raster_min_ns as *const _ as usize }, - 208usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(raster_min_ns) - ) - ); -} -extern "C" { - #[doc = " Allocate an ncstats object. Use this rather than allocating your own, since"] - #[doc = " future versions of Notcurses might enlarge this structure."] - pub fn notcurses_stats_alloc(nc: *const notcurses) -> *mut ncstats; -} -extern "C" { - #[doc = " Acquire an atomic snapshot of the Notcurses object's stats."] - pub fn notcurses_stats(nc: *mut notcurses, stats: *mut ncstats); -} -extern "C" { - #[doc = " Reset all cumulative stats (immediate ones, such as fbbytes, are not reset),"] - #[doc = " first copying them into |*stats| (if |stats| is not NULL)."] - pub fn notcurses_stats_reset(nc: *mut notcurses, stats: *mut ncstats); -} -extern "C" { - #[doc = " Resize the specified ncplane. The four parameters 'keepy', 'keepx',"] - #[doc = " 'keepleny', and 'keeplenx' define a subset of the ncplane to keep,"] - #[doc = " unchanged. This may be a section of size 0, though none of these four"] - #[doc = " parameters may be negative. 'keepx' and 'keepy' are relative to the ncplane."] - #[doc = " They must specify a coordinate within the ncplane's totality. 'yoff' and"] - #[doc = " 'xoff' are relative to 'keepy' and 'keepx', and place the upper-left corner"] - #[doc = " of the resized ncplane. Finally, 'ylen' and 'xlen' are the dimensions of the"] - #[doc = " ncplane after resizing. 'ylen' must be greater than or equal to 'keepleny',"] - #[doc = " and 'xlen' must be greater than or equal to 'keeplenx'. It is an error to"] - #[doc = " attempt to resize the standard plane. If either of 'keepleny' or 'keeplenx'"] - #[doc = " is non-zero, both must be non-zero."] - #[doc = ""] - #[doc = " Essentially, the kept material does not move. It serves to anchor the"] - #[doc = " resized plane. If there is no kept material, the plane can move freely."] - pub fn ncplane_resize( - n: *mut ncplane, - keepy: cty::c_int, - keepx: cty::c_int, - keepleny: cty::c_int, - keeplenx: cty::c_int, - yoff: cty::c_int, - xoff: cty::c_int, - ylen: cty::c_int, - xlen: cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Destroy the specified ncplane. None of its contents will be visible after"] - #[doc = " the next call to notcurses_render(). It is an error to attempt to destroy"] - #[doc = " the standard plane."] - pub fn ncplane_destroy(n: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Set the ncplane's base nccell to 'c'. The base cell is used for purposes of"] - #[doc = " rendering anywhere that the ncplane's gcluster is 0. Note that the base cell"] - #[doc = " is not affected by ncplane_erase(). 'c' must not be a secondary cell from a"] - #[doc = " multicolumn EGC."] - pub fn ncplane_set_base_cell(n: *mut ncplane, c: *const nccell) -> cty::c_int; -} -extern "C" { - #[doc = " Set the ncplane's base nccell. It will be used for purposes of rendering"] - #[doc = " anywhere that the ncplane's gcluster is 0. Note that the base cell is not"] - #[doc = " affected by ncplane_erase(). 'egc' must be an extended grapheme cluster."] - pub fn ncplane_set_base( - n: *mut ncplane, - egc: *const cty::c_char, - stylemask: u32, - channels: u64, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Extract the ncplane's base nccell into 'c'. The reference is invalidated if"] - #[doc = " 'ncp' is destroyed."] - pub fn ncplane_base(n: *mut ncplane, c: *mut nccell) -> cty::c_int; -} -extern "C" { - #[doc = " Move this plane relative to the standard plane, or the plane to which it is"] - #[doc = " bound (if it is bound to a plane). It is an error to attempt to move the"] - #[doc = " standard plane."] - pub fn ncplane_move_yx(n: *mut ncplane, y: cty::c_int, x: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Get the origin of plane 'n' relative to its bound plane, or pile (if 'n' is"] - #[doc = " a root plane). To get absolute coordinates, use ncplane_abs_yx()."] - pub fn ncplane_yx(n: *const ncplane, y: *mut cty::c_int, x: *mut cty::c_int); -} -extern "C" { - pub fn ncplane_y(n: *const ncplane) -> cty::c_int; -} -extern "C" { - pub fn ncplane_x(n: *const ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Get the origin of plane 'n' relative to its pile. Either or both of 'x' and"] - #[doc = " 'y' may be NULL."] - pub fn ncplane_abs_yx(n: *const ncplane, y: *mut cty::c_int, x: *mut cty::c_int); -} -extern "C" { - pub fn ncplane_abs_y(n: *const ncplane) -> cty::c_int; -} -extern "C" { - pub fn ncplane_abs_x(n: *const ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Get the plane to which the plane 'n' is bound, if any."] - pub fn ncplane_parent(n: *mut ncplane) -> *mut ncplane; -} -extern "C" { - pub fn ncplane_parent_const(n: *const ncplane) -> *const ncplane; -} -extern "C" { - #[doc = " Splice ncplane 'n' out of the z-buffer, and reinsert it at the top or bottom."] - pub fn ncplane_move_top(n: *mut ncplane); -} -extern "C" { - pub fn ncplane_move_bottom(n: *mut ncplane); -} -extern "C" { - #[doc = " Splice ncplane 'n' out of the z-buffer, and reinsert it above 'above'."] - #[doc = " Returns non-zero if 'n' is already in the desired location. 'n' and"] - #[doc = " 'above' must not be the same plane."] - pub fn ncplane_move_above(n: *mut ncplane, above: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Splice ncplane 'n' out of the z-buffer, and reinsert it below 'below'."] - #[doc = " Returns non-zero if 'n' is already in the desired location. 'n' and"] - #[doc = " 'below' must not be the same plane."] - pub fn ncplane_move_below(n: *mut ncplane, below: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Return the plane below this one, or NULL if this is at the bottom."] - pub fn ncplane_below(n: *mut ncplane) -> *mut ncplane; -} -extern "C" { - pub fn ncplane_above(n: *mut ncplane) -> *mut ncplane; -} -extern "C" { - #[doc = " Rotate the plane π/2 radians clockwise or counterclockwise. This cannot"] - #[doc = " be performed on arbitrary planes, because glyphs cannot be arbitrarily"] - #[doc = " rotated. The glyphs which can be rotated are limited: line-drawing"] - #[doc = " characters, spaces, half blocks, and full blocks. The plane must have"] - #[doc = " an even number of columns. Use the ncvisual rotation for a more"] - #[doc = " flexible approach."] - pub fn ncplane_rotate_cw(n: *mut ncplane) -> cty::c_int; -} -extern "C" { - pub fn ncplane_rotate_ccw(n: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Retrieve the current contents of the cell under the cursor. The EGC is"] - #[doc = " returned, or NULL on error. This EGC must be free()d by the caller. The"] - #[doc = " stylemask and channels are written to 'stylemask' and 'channels', respectively."] - pub fn ncplane_at_cursor( - n: *mut ncplane, - stylemask: *mut u16, - channels: *mut u64, - ) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Retrieve the current contents of the cell under the cursor into 'c'. This"] - #[doc = " cell is invalidated if the associated plane is destroyed. Returns the number"] - #[doc = " of bytes in the EGC, or -1 on error."] - pub fn ncplane_at_cursor_cell(n: *mut ncplane, c: *mut nccell) -> cty::c_int; -} -extern "C" { - #[doc = " Retrieve the current contents of the specified cell. The EGC is returned, or"] - #[doc = " NULL on error. This EGC must be free()d by the caller. The stylemask and"] - #[doc = " channels are written to 'stylemask' and 'channels', respectively."] - pub fn ncplane_at_yx( - n: *const ncplane, - y: cty::c_int, - x: cty::c_int, - stylemask: *mut u16, - channels: *mut u64, - ) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Retrieve the current contents of the specified cell into 'c'. This cell is"] - #[doc = " invalidated if the associated plane is destroyed. Returns the number of"] - #[doc = " bytes in the EGC, or -1 on error."] - pub fn ncplane_at_yx_cell( - n: *mut ncplane, - y: cty::c_int, - x: cty::c_int, - c: *mut nccell, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Create a flat string from the EGCs of the selected region of the ncplane"] - #[doc = " 'n'. Start at the plane's 'begy'x'begx' coordinate (which must lie on the"] - #[doc = " plane), continuing for 'leny'x'lenx' cells. Either or both of 'leny' and"] - #[doc = " 'lenx' can be specified as -1 to go through the boundary of the plane."] - pub fn ncplane_contents( - n: *const ncplane, - begy: cty::c_int, - begx: cty::c_int, - leny: cty::c_int, - lenx: cty::c_int, - ) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Manipulate the opaque user pointer associated with this plane."] - #[doc = " ncplane_set_userptr() returns the previous userptr after replacing"] - #[doc = " it with 'opaque'. the others simply return the userptr."] - pub fn ncplane_set_userptr(n: *mut ncplane, opaque: *mut cty::c_void) -> *mut cty::c_void; -} -extern "C" { - pub fn ncplane_userptr(n: *mut ncplane) -> *mut cty::c_void; -} -extern "C" { - pub fn ncplane_center_abs(n: *const ncplane, y: *mut cty::c_int, x: *mut cty::c_int); -} -extern "C" { - #[doc = " Move the cursor to the specified position (the cursor needn't be visible)."] - #[doc = " Returns -1 on error, including negative parameters, or ones exceeding the"] - #[doc = " plane's dimensions."] - pub fn ncplane_cursor_move_yx(n: *mut ncplane, y: cty::c_int, x: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Move the cursor to 0, 0. Can't fail."] - pub fn ncplane_home(n: *mut ncplane); -} -extern "C" { - #[doc = " Get the current position of the cursor within n. y and/or x may be NULL."] - pub fn ncplane_cursor_yx(n: *const ncplane, y: *mut cty::c_int, x: *mut cty::c_int); -} -extern "C" { - #[doc = " Get the current channels or attribute word for ncplane 'n'."] - pub fn ncplane_channels(n: *const ncplane) -> u64; -} -extern "C" { - #[doc = " Return the current styling for this ncplane."] - pub fn ncplane_styles(n: *const ncplane) -> u16; -} -extern "C" { - #[doc = " Replace the cell at the specified coordinates with the provided cell 'c',"] - #[doc = " and advance the cursor by the width of the cell (but not past the end of the"] - #[doc = " plane). On success, returns the number of columns the cursor was advanced."] - #[doc = " 'c' must already be associated with 'n'. On failure, -1 is returned."] - pub fn ncplane_putc_yx( - n: *mut ncplane, - y: cty::c_int, - x: cty::c_int, - c: *const nccell, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Replace the EGC underneath us, but retain the styling. The current styling"] - #[doc = " of the plane will not be changed."] - pub fn ncplane_putchar_stained(n: *mut ncplane, c: cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Replace the cell at the specified coordinates with the provided EGC, and"] - #[doc = " advance the cursor by the width of the cluster (but not past the end of the"] - #[doc = " plane). On success, returns the number of columns the cursor was advanced."] - #[doc = " On failure, -1 is returned. The number of bytes converted from gclust is"] - #[doc = " written to 'sbytes' if non-NULL."] - pub fn ncplane_putegc_yx( - n: *mut ncplane, - y: cty::c_int, - x: cty::c_int, - gclust: *const cty::c_char, - sbytes: *mut cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Replace the EGC underneath us, but retain the styling. The current styling"] - #[doc = " of the plane will not be changed."] - pub fn ncplane_putegc_stained( - n: *mut ncplane, - gclust: *const cty::c_char, - sbytes: *mut cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Replace the EGC underneath us, but retain the styling. The current styling"] - #[doc = " of the plane will not be changed."] - pub fn ncplane_putwegc_stained( - n: *mut ncplane, - gclust: *const wchar_t, - sbytes: *mut cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Write a series of EGCs to the current location, using the current style."] - #[doc = " They will be interpreted as a series of columns (according to the definition"] - #[doc = " of ncplane_putc()). Advances the cursor by some positive number of columns"] - #[doc = " (though not beyond the end of the plane); this number is returned on success."] - #[doc = " On error, a non-positive number is returned, indicating the number of columns"] - #[doc = " which were written before the error."] - pub fn ncplane_putstr_yx( - n: *mut ncplane, - y: cty::c_int, - x: cty::c_int, - gclusters: *const cty::c_char, - ) -> cty::c_int; -} -extern "C" { - pub fn ncplane_putstr_aligned( - n: *mut ncplane, - y: cty::c_int, - align: ncalign_e, - s: *const cty::c_char, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Replace a string's worth of glyphs at the current cursor location, but"] - #[doc = " retain the styling. The current styling of the plane will not be changed."] - pub fn ncplane_putstr_stained(n: *mut ncplane, s: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Write a series of EGCs to the current location, using the current style."] - #[doc = " They will be interpreted as a series of columns (according to the definition"] - #[doc = " of ncplane_putc()). Advances the cursor by some positive number of columns"] - #[doc = " (though not beyond the end of the plane); this number is returned on success."] - #[doc = " On error, a non-positive number is returned, indicating the number of columns"] - #[doc = " which were written before the error. No more than 's' bytes will be written."] - pub fn ncplane_putnstr_yx( - n: *mut ncplane, - y: cty::c_int, - x: cty::c_int, - s: size_t, - gclusters: *const cty::c_char, - ) -> cty::c_int; -} -extern "C" { - pub fn ncplane_putnstr_aligned( - n: *mut ncplane, - y: cty::c_int, - align: ncalign_e, - s: size_t, - gclustarr: *const cty::c_char, - ) -> cty::c_int; -} -extern "C" { - pub fn ncplane_putwstr_stained(n: *mut ncplane, gclustarr: *const wchar_t) -> cty::c_int; -} -extern "C" { - #[doc = " The ncplane equivalents of printf(3) and vprintf(3)."] - pub fn ncplane_vprintf_aligned( - n: *mut ncplane, - y: cty::c_int, - align: ncalign_e, - format: *const cty::c_char, - ap: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - pub fn ncplane_vprintf_yx( - n: *mut ncplane, - y: cty::c_int, - x: cty::c_int, - format: *const cty::c_char, - ap: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - pub fn ncplane_vprintf_stained( - n: *mut ncplane, - format: *const cty::c_char, - ap: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Write the specified text to the plane, breaking lines sensibly, beginning at"] - #[doc = " the specified line. Returns the number of columns written. When breaking a"] - #[doc = " line, the line will be cleared to the end of the plane (the last line will"] - #[doc = " *not* be so cleared). The number of bytes written from the input is written"] - #[doc = " to '*bytes' if it is not NULL. Cleared columns are included in the return"] - #[doc = " value, but *not* included in the number of bytes written. Leaves the cursor"] - #[doc = " at the end of output. A partial write will be accomplished as far as it can;"] - #[doc = " determine whether the write completed by inspecting '*bytes'. Can output to"] - #[doc = " multiple rows even in the absence of scrolling, but not more rows than are"] - #[doc = " available. With scrolling enabled, arbitrary amounts of data can be emitted."] - #[doc = " All provided whitespace is preserved -- ncplane_puttext() followed by an"] - #[doc = " appropriate ncplane_contents() will read back the original output."] - #[doc = ""] - #[doc = " If 'y' is -1, the first row of output is taken relative to the current"] - #[doc = " cursor: it will be left-, right-, or center-aligned in whatever remains"] - #[doc = " of the row. On subsequent rows -- or if 'y' is not -1 -- the entire row can"] - #[doc = " be used, and alignment works normally."] - #[doc = ""] - #[doc = " A newline at any point will move the cursor to the next row."] - pub fn ncplane_puttext( - n: *mut ncplane, - y: cty::c_int, - align: ncalign_e, - text: *const cty::c_char, - bytes: *mut size_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Draw horizontal or vertical lines using the specified cell, starting at the"] - #[doc = " current cursor position. The cursor will end at the cell following the last"] - #[doc = " cell output (even, perhaps counter-intuitively, when drawing vertical"] - #[doc = " lines), just as if ncplane_putc() was called at that spot. Return the"] - #[doc = " number of cells drawn on success. On error, return the negative number of"] - #[doc = " cells drawn."] - pub fn ncplane_hline_interp( - n: *mut ncplane, - c: *const nccell, - len: cty::c_int, - c1: u64, - c2: u64, - ) -> cty::c_int; -} -extern "C" { - pub fn ncplane_vline_interp( - n: *mut ncplane, - c: *const nccell, - len: cty::c_int, - c1: u64, - c2: u64, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Draw a box with its upper-left corner at the current cursor position, and its"] - #[doc = " lower-right corner at 'ystop'x'xstop'. The 6 cells provided are used to draw the"] - #[doc = " upper-left, ur, ll, and lr corners, then the horizontal and vertical lines."] - #[doc = " 'ctlword' is defined in the least significant byte, where bits [7, 4] are a"] - #[doc = " gradient mask, and [3, 0] are a border mask:"] - #[doc = " * 7, 3: top"] - #[doc = " * 6, 2: right"] - #[doc = " * 5, 1: bottom"] - #[doc = " * 4, 0: left"] - #[doc = " If the gradient bit is not set, the styling from the hl/vl cells is used for"] - #[doc = " the horizontal and vertical lines, respectively. If the gradient bit is set,"] - #[doc = " the color is linearly interpolated between the two relevant corner cells."] - #[doc = ""] - #[doc = " By default, vertexes are drawn whether their connecting edges are drawn or"] - #[doc = " not. The value of the bits corresponding to NCBOXCORNER_MASK control this,"] - #[doc = " and are interpreted as the number of connecting edges necessary to draw a"] - #[doc = " given corner. At 0 (the default), corners are always drawn. At 3, corners"] - #[doc = " are never drawn (since at most 2 edges can touch a box's corner)."] - pub fn ncplane_box( - n: *mut ncplane, - ul: *const nccell, - ur: *const nccell, - ll: *const nccell, - lr: *const nccell, - hline: *const nccell, - vline: *const nccell, - ystop: cty::c_int, - xstop: cty::c_int, - ctlword: cty::c_uint, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Starting at the specified coordinate, if its glyph is different from that of"] - #[doc = " 'c', 'c' is copied into it, and the original glyph is considered the fill"] - #[doc = " target. We do the same to all cardinally-connected cells having this same"] - #[doc = " fill target. Returns the number of cells polyfilled. An invalid initial y, x"] - #[doc = " is an error. Returns the number of cells filled, or -1 on error."] - pub fn ncplane_polyfill_yx( - n: *mut ncplane, - y: cty::c_int, - x: cty::c_int, - c: *const nccell, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Draw a gradient with its upper-left corner at the current cursor position,"] - #[doc = " stopping at 'ystop'x'xstop'. The glyph composed of 'egc' and 'stylemask' is"] - #[doc = " used for all cells. The channels specified by 'ul', 'ur', 'll', and 'lr'"] - #[doc = " are composed into foreground and background gradients. To do a vertical"] - #[doc = " gradient, 'ul' ought equal 'ur' and 'll' ought equal 'lr'. To do a"] - #[doc = " horizontal gradient, 'ul' ought equal 'll' and 'ur' ought equal 'ul'. To"] - #[doc = " color everything the same, all four channels should be equivalent. The"] - #[doc = " resulting alpha values are equal to incoming alpha values. Returns the"] - #[doc = " number of cells filled on success, or -1 on failure."] - #[doc = ""] - #[doc = " Palette-indexed color is not supported."] - #[doc = ""] - #[doc = " Preconditions for gradient operations (error otherwise):"] - #[doc = ""] - #[doc = " all: only RGB colors, unless all four channels match as default"] - #[doc = " all: all alpha values must be the same"] - #[doc = " 1x1: all four colors must be the same"] - #[doc = " 1xN: both top and both bottom colors must be the same (vertical gradient)"] - #[doc = " Nx1: both left and both right colors must be the same (horizontal gradient)"] - pub fn ncplane_gradient( - n: *mut ncplane, - egc: *const cty::c_char, - stylemask: u32, - ul: u64, - ur: u64, - ll: u64, - lr: u64, - ystop: cty::c_int, - xstop: cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Do a high-resolution gradient using upper blocks and synced backgrounds."] - #[doc = " This doubles the number of vertical gradations, but restricts you to"] - #[doc = " half blocks (appearing to be full blocks). Returns the number of cells"] - #[doc = " filled on success, or -1 on error."] - pub fn ncplane_highgradient( - n: *mut ncplane, - ul: u32, - ur: u32, - ll: u32, - lr: u32, - ystop: cty::c_int, - xstop: cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " ncplane_gradent_sized() meets ncplane_highgradient()."] - pub fn ncplane_highgradient_sized( - n: *mut ncplane, - ul: u32, - ur: u32, - ll: u32, - lr: u32, - ylen: cty::c_int, - xlen: cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Set the given style throughout the specified region, keeping content and"] - #[doc = " channels unchanged. Returns the number of cells set, or -1 on failure."] - pub fn ncplane_format( - n: *mut ncplane, - ystop: cty::c_int, - xstop: cty::c_int, - stylemask: u32, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Set the given channels throughout the specified region, keeping content and"] - #[doc = " attributes unchanged. Returns the number of cells set, or -1 on failure."] - pub fn ncplane_stain( - n: *mut ncplane, - ystop: cty::c_int, - xstop: cty::c_int, - ul: u64, - ur: u64, - ll: u64, - lr: u64, - ) -> cty::c_int; -} -extern "C" { - #[doc = " If 'src' does not intersect with 'dst', 'dst' will not be changed, but it is"] - #[doc = " not an error. If 'dst' is NULL, the operation will target the standard plane."] - pub fn ncplane_mergedown_simple(src: *const ncplane, dst: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Merge the ncplane 'src' down onto the ncplane 'dst'. This is most rigorously"] - #[doc = " defined as \"write to 'dst' the frame that would be rendered were the entire"] - #[doc = " stack made up only of the specified subregion of 'src' and, below it, the"] - #[doc = " subregion of 'dst' having the specified origin. Merging is independent of"] - #[doc = " the position of 'src' viz 'dst' on the z-axis. It is an error to define a"] - #[doc = " subregion of zero area, or that is not entirely contained within 'src'. It"] - #[doc = " is an error to define a target origin such that the projected subregion is"] - #[doc = " not entirely contained within 'dst'. Behavior is undefined if 'src' and"] - #[doc = " 'dst' are equivalent. 'dst' is modified, but 'src' remains unchanged."] - pub fn ncplane_mergedown( - src: *const ncplane, - dst: *mut ncplane, - begsrcy: cty::c_int, - begsrcx: cty::c_int, - leny: cty::c_int, - lenx: cty::c_int, - dsty: cty::c_int, - dstx: cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Erase every cell in the ncplane (each cell is initialized to the null glyph"] - #[doc = " and the default channels/styles). All cells associated with this ncplane are"] - #[doc = " invalidated, and must not be used after the call, *excluding* the base cell."] - #[doc = " The cursor is homed. The plane's active attributes are unaffected."] - pub fn ncplane_erase(n: *mut ncplane); -} -extern "C" { - pub fn ncplane_set_channels(n: *mut ncplane, channels: u64); -} -extern "C" { - #[doc = " Set the specified style bits for the ncplane 'n', whether they're actively"] - #[doc = " supported or not."] - pub fn ncplane_set_styles(n: *mut ncplane, stylebits: cty::c_uint); -} -extern "C" { - #[doc = " Add the specified styles to the ncplane's existing spec."] - pub fn ncplane_on_styles(n: *mut ncplane, stylebits: cty::c_uint); -} -extern "C" { - #[doc = " Remove the specified styles from the ncplane's existing spec."] - pub fn ncplane_off_styles(n: *mut ncplane, stylebits: cty::c_uint); -} -extern "C" { - #[doc = " Deprecated forms of above."] - pub fn ncplane_styles_set(n: *mut ncplane, stylebits: cty::c_uint); -} -extern "C" { - pub fn ncplane_styles_on(n: *mut ncplane, stylebits: cty::c_uint); -} -extern "C" { - pub fn ncplane_styles_off(n: *mut ncplane, stylebits: cty::c_uint); -} -extern "C" { - #[doc = " Set an entire 32-bit channel of the plane"] - pub fn ncplane_set_fchannel(n: *mut ncplane, channel: u32) -> u64; -} -extern "C" { - pub fn ncplane_set_bchannel(n: *mut ncplane, channel: u32) -> u64; -} -extern "C" { - #[doc = " Set the current fore/background color using RGB specifications. If the"] - #[doc = " terminal does not support directly-specified 3x8b cells (24-bit \"TrueColor\","] - #[doc = " indicated by the \"RGB\" terminfo capability), the provided values will be"] - #[doc = " interpreted in some lossy fashion. None of r, g, or b may exceed 255."] - #[doc = " \"HP-like\" terminals require setting foreground and background at the same"] - #[doc = " time using \"color pairs\"; Notcurses will manage color pairs transparently."] - pub fn ncplane_set_fg_rgb8( - n: *mut ncplane, - r: cty::c_int, - g: cty::c_int, - b: cty::c_int, - ) -> cty::c_int; -} -extern "C" { - pub fn ncplane_set_bg_rgb8( - n: *mut ncplane, - r: cty::c_int, - g: cty::c_int, - b: cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Same, but clipped to [0..255]."] - pub fn ncplane_set_bg_rgb8_clipped( - n: *mut ncplane, - r: cty::c_int, - g: cty::c_int, - b: cty::c_int, - ); -} -extern "C" { - pub fn ncplane_set_fg_rgb8_clipped( - n: *mut ncplane, - r: cty::c_int, - g: cty::c_int, - b: cty::c_int, - ); -} -extern "C" { - #[doc = " Same, but with rgb assembled into a channel (i.e. lower 24 bits)."] - pub fn ncplane_set_fg_rgb(n: *mut ncplane, channel: u32) -> cty::c_int; -} -extern "C" { - pub fn ncplane_set_bg_rgb(n: *mut ncplane, channel: u32) -> cty::c_int; -} -extern "C" { - #[doc = " Use the default color for the foreground/background."] - pub fn ncplane_set_fg_default(n: *mut ncplane); -} -extern "C" { - pub fn ncplane_set_bg_default(n: *mut ncplane); -} -extern "C" { - #[doc = " Set the ncplane's foreground palette index, set the foreground palette index"] - #[doc = " bit, set it foreground-opaque, and clear the foreground default color bit."] - pub fn ncplane_set_fg_palindex(n: *mut ncplane, idx: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn ncplane_set_bg_palindex(n: *mut ncplane, idx: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Set the alpha parameters for ncplane 'n'."] - pub fn ncplane_set_fg_alpha(n: *mut ncplane, alpha: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn ncplane_set_bg_alpha(n: *mut ncplane, alpha: cty::c_int) -> cty::c_int; -} -#[doc = " Called for each fade iteration on 'ncp'. If anything but 0 is returned,"] -#[doc = " the fading operation ceases immediately, and that value is propagated out."] -#[doc = " The recommended absolute display time target is passed in 'tspec'."] -pub type fadecb = ::core::option::Option< - unsafe extern "C" fn( - nc: *mut notcurses, - n: *mut ncplane, - arg1: *const timespec, - curry: *mut cty::c_void, - ) -> cty::c_int, ->; -extern "C" { - #[doc = " Fade the ncplane out over the provided time, calling 'fader' at each"] - #[doc = " iteration. Requires a terminal which supports truecolor, or at least palette"] - #[doc = " modification (if the terminal uses a palette, our ability to fade planes is"] - #[doc = " limited, and affected by the complexity of the rest of the screen)."] - pub fn ncplane_fadeout( - n: *mut ncplane, - ts: *const timespec, - fader: fadecb, - curry: *mut cty::c_void, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Fade the ncplane in over the specified time. Load the ncplane with the"] - #[doc = " target cells without rendering, then call this function. When it's done, the"] - #[doc = " ncplane will have reached the target levels, starting from zeroes."] - pub fn ncplane_fadein( - n: *mut ncplane, - ts: *const timespec, - fader: fadecb, - curry: *mut cty::c_void, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Rather than the simple ncplane_fade{in/out}(), ncfadectx_setup() can be"] - #[doc = " paired with a loop over ncplane_fade{in/out}_iteration() + ncfadectx_free()."] - pub fn ncfadectx_setup(n: *mut ncplane) -> *mut ncfadectx; -} -extern "C" { - #[doc = " Return the number of iterations through which 'nctx' will fade."] - pub fn ncfadectx_iterations(nctx: *const ncfadectx) -> cty::c_int; -} -extern "C" { - #[doc = " Fade out through 'iter' iterations, where"] - #[doc = " 'iter' < 'ncfadectx_iterations(nctx)'."] - pub fn ncplane_fadeout_iteration( - n: *mut ncplane, - nctx: *mut ncfadectx, - iter: cty::c_int, - fader: fadecb, - curry: *mut cty::c_void, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Fade in through 'iter' iterations, where"] - #[doc = " 'iter' < 'ncfadectx_iterations(nctx)'."] - pub fn ncplane_fadein_iteration( - n: *mut ncplane, - nctx: *mut ncfadectx, - iter: cty::c_int, - fader: fadecb, - curry: *mut cty::c_void, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Pulse the plane in and out until the callback returns non-zero, relying on"] - #[doc = " the callback 'fader' to initiate rendering. 'ts' defines the half-period"] - #[doc = " (i.e. the transition from black to full brightness, or back again). Proper"] - #[doc = " use involves preparing (but not rendering) an ncplane, then calling"] - #[doc = " ncplane_pulse(), which will fade in from black to the specified colors."] - pub fn ncplane_pulse( - n: *mut ncplane, - ts: *const timespec, - fader: fadecb, - curry: *mut cty::c_void, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Release the resources associated with 'nctx'."] - pub fn ncfadectx_free(nctx: *mut ncfadectx); -} -extern "C" { - pub fn cells_rounded_box( - n: *mut ncplane, - styles: u32, - channels: u64, - ul: *mut nccell, - ur: *mut nccell, - ll: *mut nccell, - lr: *mut nccell, - hl: *mut nccell, - vl: *mut nccell, - ) -> cty::c_int; -} -extern "C" { - pub fn cells_double_box( - n: *mut ncplane, - styles: u32, - channels: u64, - ul: *mut nccell, - ur: *mut nccell, - ll: *mut nccell, - lr: *mut nccell, - hl: *mut nccell, - vl: *mut nccell, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Open a visual at 'file', extract a codec and parameters, decode the first"] - #[doc = " image to memory."] - pub fn ncvisual_from_file(file: *const cty::c_char) -> *mut ncvisual; -} -extern "C" { - #[doc = " Prepare an ncvisual, and its underlying plane, based off RGBA content in"] - #[doc = " memory at 'rgba'. 'rgba' must be a flat array of 32-bit 8bpc RGBA pixels."] - #[doc = " These must be arranged in 'rowstride' lines, where the first 'cols' * 4b"] - #[doc = " are actual data. There must be 'rows' lines. The total size of 'rgba'"] - #[doc = " must thus be at least (rows * rowstride) bytes, of which (rows * cols * 4)"] - #[doc = " bytes are actual data. Resulting planes are ceil('rows' / 2) x 'cols'."] - pub fn ncvisual_from_rgba( - rgba: *const cty::c_void, - rows: cty::c_int, - rowstride: cty::c_int, - cols: cty::c_int, - ) -> *mut ncvisual; -} -extern "C" { - #[doc = " ncvisual_from_rgba(), but 'bgra' is arranged as BGRA."] - pub fn ncvisual_from_bgra( - rgba: *const cty::c_void, - rows: cty::c_int, - rowstride: cty::c_int, - cols: cty::c_int, - ) -> *mut ncvisual; -} -extern "C" { - #[doc = " Promote an ncplane 'n' to an ncvisual. The plane may contain only spaces,"] - #[doc = " half blocks, and full blocks. The latter will be checked, and any other"] - #[doc = " glyph will result in a NULL being returned. This function exists so that"] - #[doc = " planes can be subjected to ncvisual transformations. If possible, it's"] - #[doc = " better to create the ncvisual from memory using ncvisual_from_rgba()."] - pub fn ncvisual_from_plane( - n: *const ncplane, - blit: ncblitter_e, - begy: cty::c_int, - begx: cty::c_int, - leny: cty::c_int, - lenx: cty::c_int, - ) -> *mut ncvisual; -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncvisual_options { - #[doc = " if no ncplane is provided, one will be created using the exact size"] - #[doc = " necessary to render the source with perfect fidelity (this might be"] - #[doc = " smaller or larger than the rendering area)."] - pub n: *mut ncplane, - #[doc = " the scaling is ignored if no ncplane is provided (it ought be NCSCALE_NONE"] - #[doc = " in this case). otherwise, the source is stretched/scaled relative to the"] - #[doc = " provided ncplane."] - pub scaling: ncscale_e, - #[doc = " if an ncplane is provided, y and x specify where the visual will be"] - #[doc = " rendered on that plane. otherwise, they specify where the created ncplane"] - #[doc = " will be placed relative to the standard plane's origin."] - pub y: cty::c_int, - #[doc = " if an ncplane is provided, y and x specify where the visual will be"] - #[doc = " rendered on that plane. otherwise, they specify where the created ncplane"] - #[doc = " will be placed relative to the standard plane's origin."] - pub x: cty::c_int, - #[doc = " origin of rendered section"] - pub begy: cty::c_int, - #[doc = " origin of rendered section"] - pub begx: cty::c_int, - #[doc = " size of rendered section"] - pub leny: cty::c_int, - #[doc = " size of rendered section"] - pub lenx: cty::c_int, - #[doc = " glyph set to use (maps input to output cells)"] - pub blitter: ncblitter_e, - #[doc = " bitmask over NCVISUAL_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncvisual_options() { - assert_eq!( - ::core::mem::size_of::(), - 48usize, - concat!("Size of: ", stringify!(ncvisual_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncvisual_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).n as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(n) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).scaling as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(scaling) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).y as *const _ as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(y) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).x as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(x) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).begy as *const _ as usize }, - 20usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(begy) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).begx as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(begx) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).leny as *const _ as usize }, - 28usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(leny) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).lenx as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(lenx) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).blitter as *const _ as usize }, - 36usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(blitter) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(flags) - ) - ); -} -extern "C" { - #[doc = " Create an RGBA flat array from the selected region of the ncplane 'nc'."] - #[doc = " Start at the plane's 'begy'x'begx' coordinate (which must lie on the"] - #[doc = " plane), continuing for 'leny'x'lenx' cells. Either or both of 'leny' and"] - #[doc = " 'lenx' can be specified as -1 to go through the boundary of the plane."] - #[doc = " Only glyphs from the specified blitset may be present."] - pub fn ncplane_rgba( - n: *const ncplane, - blit: ncblitter_e, - begy: cty::c_int, - begx: cty::c_int, - leny: cty::c_int, - lenx: cty::c_int, - ) -> *mut u32; -} -extern "C" { - #[doc = " Get the size and ratio of ncvisual pixels to output cells along the y"] - #[doc = " ('toy') and x ('tox') axes. A ncvisual of '*y'X'*x' pixels will require"] - #[doc = " ('*y' * '*toy')X('x' * 'tox') cells for full output. Returns non-zero"] - #[doc = " for an invalid 'vopts->blitter'. Scaling is taken into consideration."] - pub fn ncvisual_geom( - nc: *const notcurses, - n: *const ncvisual, - vopts: *const ncvisual_options, - y: *mut cty::c_int, - x: *mut cty::c_int, - toy: *mut cty::c_int, - tox: *mut cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Destroy an ncvisual. Rendered elements will not be disrupted, but the visual"] - #[doc = " can be neither decoded nor rendered any further."] - pub fn ncvisual_destroy(ncv: *mut ncvisual); -} -extern "C" { - #[doc = " extract the next frame from an ncvisual. returns 1 on end of file, 0 on"] - #[doc = " success, and -1 on failure."] - pub fn ncvisual_decode(nc: *mut ncvisual) -> cty::c_int; -} -extern "C" { - #[doc = " decode the next frame ala ncvisual_decode(), but if we have reached the end,"] - #[doc = " rewind to the first frame of the ncvisual. a subsequent 'ncvisual_render()'"] - #[doc = " will render the first frame, as if the ncvisual had been closed and reopened."] - #[doc = " the return values remain the same as those of ncvisual_decode()."] - pub fn ncvisual_decode_loop(nc: *mut ncvisual) -> cty::c_int; -} -extern "C" { - #[doc = " Rotate the visual 'rads' radians. Only M_PI/2 and -M_PI/2 are"] - #[doc = " supported at the moment, but this will change FIXME."] - pub fn ncvisual_rotate(n: *mut ncvisual, rads: f64) -> cty::c_int; -} -extern "C" { - #[doc = " Resize the visual so that it is 'rows' X 'columns'. This is a lossy"] - #[doc = " transformation, unless the size is unchanged."] - pub fn ncvisual_resize(n: *mut ncvisual, rows: cty::c_int, cols: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Polyfill at the specified location within the ncvisual 'n', using 'rgba'."] - pub fn ncvisual_polyfill_yx( - n: *mut ncvisual, - y: cty::c_int, - x: cty::c_int, - rgba: u32, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Get the specified pixel from the specified ncvisual."] - pub fn ncvisual_at_yx( - n: *const ncvisual, - y: cty::c_int, - x: cty::c_int, - pixel: *mut u32, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Set the specified pixel in the specified ncvisual."] - pub fn ncvisual_set_yx( - n: *const ncvisual, - y: cty::c_int, - x: cty::c_int, - pixel: u32, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Render the decoded frame to the specified ncplane (if one is not provided,"] - #[doc = " one will be created, having the exact size necessary to display the visual."] - #[doc = " In this case, 'style' must be NCSTYLE_NONE). A subregion of the visual can"] - #[doc = " be rendered using 'begx', 'begy', 'lenx', and 'leny'. Negative values for"] - #[doc = " 'begy' or 'begx' are an error. It is an error to specify any region beyond"] - #[doc = " the boundaries of the frame. Returns the plane to which we drew (if ncv->n"] - #[doc = " is NULL, a new plane will be created)."] - pub fn ncvisual_render( - nc: *mut notcurses, - ncv: *mut ncvisual, - vopts: *const ncvisual_options, - ) -> *mut ncplane; -} -extern "C" { - #[doc = " If a subtitle ought be displayed at this time, return a heap-allocated copy"] - #[doc = " of the UTF8 text."] - pub fn ncvisual_subtitle(ncv: *const ncvisual) -> *mut cty::c_char; -} -#[doc = " Called for each frame rendered from 'ncv'. If anything but 0 is returned,"] -#[doc = " the streaming operation ceases immediately, and that value is propagated out."] -#[doc = " The recommended absolute display time target is passed in 'tspec'."] -pub type streamcb = ::core::option::Option< - unsafe extern "C" fn( - arg1: *mut ncvisual, - arg2: *mut ncvisual_options, - arg3: *const timespec, - arg4: *mut cty::c_void, - ) -> cty::c_int, ->; -extern "C" { - #[doc = " Shut up and display my frames! Provide as an argument to ncvisual_stream()."] - #[doc = " If you'd like subtitles to be decoded, provide an ncplane as the curry. If the"] - #[doc = " curry is NULL, subtitles will not be displayed."] - pub fn ncvisual_simple_streamer( - ncv: *mut ncvisual, - vopts: *mut ncvisual_options, - tspec: *const timespec, - curry: *mut cty::c_void, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Stream the entirety of the media, according to its own timing. Blocking,"] - #[doc = " obviously. streamer may be NULL; it is otherwise called for each frame, and"] - #[doc = " its return value handled as outlined for streamcb. If streamer() returns"] - #[doc = " non-zero, the stream is aborted, and that value is returned. By convention,"] - #[doc = " return a positive number to indicate intentional abort from within"] - #[doc = " streamer(). 'timescale' allows the frame duration time to be scaled. For a"] - #[doc = " visual naturally running at 30FPS, a 'timescale' of 0.1 will result in"] - #[doc = " 300FPS, and a 'timescale' of 10 will result in 3FPS. It is an error to"] - #[doc = " supply 'timescale' less than or equal to 0."] - pub fn ncvisual_stream( - nc: *mut notcurses, - ncv: *mut ncvisual, - timescale: f32, - streamer: streamcb, - vopts: *const ncvisual_options, - curry: *mut cty::c_void, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Blit a flat array 'data' of RGBA 32-bit values to the ncplane 'vopts->n',"] - #[doc = " which mustn't be NULL. the blit begins at 'vopts->y' and 'vopts->x' relative"] - #[doc = " to the specified plane. Each source row ought occupy 'linesize' bytes (this"] - #[doc = " might be greater than 'vopts->lenx' * 4 due to padding or partial blits). A"] - #[doc = " subregion of the input can be specified with the 'begy'x'begx' and"] - #[doc = " 'leny'x'lenx' fields from 'vopts'. Returns the number of pixels blitted, or"] - #[doc = " -1 on error."] - pub fn ncblit_rgba( - data: *const cty::c_void, - linesize: cty::c_int, - vopts: *const ncvisual_options, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Same as ncblit_rgba(), but for BGRx."] - pub fn ncblit_bgrx( - data: *const cty::c_void, - linesize: cty::c_int, - vopts: *const ncvisual_options, - ) -> cty::c_int; -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncreel_options { - #[doc = " bitfield; 1s will not be drawn (see bordermaskbits)"] - pub bordermask: cty::c_uint, - #[doc = " attributes used for ncreel border"] - pub borderchan: u64, - #[doc = " bitfield; same as bordermask but for tablet borders"] - pub tabletmask: cty::c_uint, - #[doc = " tablet border styling channel"] - pub tabletchan: u64, - #[doc = " focused tablet border styling channel"] - pub focusedchan: u64, - #[doc = " bitfield over NCREEL_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncreel_options() { - assert_eq!( - ::core::mem::size_of::(), - 48usize, - concat!("Size of: ", stringify!(ncreel_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncreel_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).bordermask as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncreel_options), - "::", - stringify!(bordermask) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).borderchan as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncreel_options), - "::", - stringify!(borderchan) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).tabletmask as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncreel_options), - "::", - stringify!(tabletmask) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).tabletchan as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncreel_options), - "::", - stringify!(tabletchan) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).focusedchan as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncreel_options), - "::", - stringify!(focusedchan) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(ncreel_options), - "::", - stringify!(flags) - ) - ); -} -extern "C" { - #[doc = " Take over the ncplane 'nc' and use it to draw a reel according to 'popts'."] - #[doc = " The plane will be destroyed by ncreel_destroy(); this transfers ownership."] - pub fn ncreel_create(n: *mut ncplane, popts: *const ncreel_options) -> *mut ncreel; -} -extern "C" { - #[doc = " Returns the ncplane on which this ncreel lives."] - pub fn ncreel_plane(nr: *mut ncreel) -> *mut ncplane; -} -#[doc = " Tablet draw callback, provided a tablet (from which the ncplane and userptr"] -#[doc = " may be extracted), and a bool indicating whether output ought be drawn from"] -#[doc = " the top (true) or bottom (false). Returns non-negative count of output lines,"] -#[doc = " which must be less than or equal to ncplane_dim_y(nctablet_plane(t))."] -pub type tabletcb = - ::core::option::Option cty::c_int>; -extern "C" { - #[doc = " Add a new nctablet to the provided ncreel 'nr', having the callback object"] - #[doc = " 'opaque'. Neither, either, or both of 'after' and 'before' may be specified."] - #[doc = " If neither is specified, the new tablet can be added anywhere on the reel."] - #[doc = " If one or the other is specified, the tablet will be added before or after"] - #[doc = " the specified tablet. If both are specified, the tablet will be added to the"] - #[doc = " resulting location, assuming it is valid (after->next == before->prev); if"] - #[doc = " it is not valid, or there is any other error, NULL will be returned."] - pub fn ncreel_add( - nr: *mut ncreel, - after: *mut nctablet, - before: *mut nctablet, - cb: tabletcb, - opaque: *mut cty::c_void, - ) -> *mut nctablet; -} -extern "C" { - #[doc = " Return the number of nctablets in the ncreel 'nr'."] - pub fn ncreel_tabletcount(nr: *const ncreel) -> cty::c_int; -} -extern "C" { - #[doc = " Delete the tablet specified by t from the ncreel 'nr'. Returns -1 if the"] - #[doc = " tablet cannot be found."] - pub fn ncreel_del(nr: *mut ncreel, t: *mut nctablet) -> cty::c_int; -} -extern "C" { - #[doc = " Redraw the ncreel 'nr' in its entirety. The reel will be cleared, and"] - #[doc = " tablets will be lain out, using the focused tablet as a fulcrum. Tablet"] - #[doc = " drawing callbacks will be invoked for each visible tablet."] - pub fn ncreel_redraw(nr: *mut ncreel) -> cty::c_int; -} -extern "C" { - #[doc = " Offer input 'ni' to the ncreel 'nr'. If it's relevant, this function returns"] - #[doc = " true, and the input ought not be processed further. If it's irrelevant to"] - #[doc = " the reel, false is returned. Relevant inputs include:"] - #[doc = " * a mouse click on a tablet (focuses tablet)"] - #[doc = " * a mouse scrollwheel event (rolls reel)"] - #[doc = " * up, down, pgup, or pgdown (navigates among items)"] - pub fn ncreel_offer_input(nr: *mut ncreel, ni: *const ncinput) -> bool; -} -extern "C" { - #[doc = " Return the focused tablet, if any tablets are present. This is not a copy;"] - #[doc = " be careful to use it only for the duration of a critical section."] - pub fn ncreel_focused(nr: *mut ncreel) -> *mut nctablet; -} -extern "C" { - #[doc = " Change focus to the next tablet, if one exists"] - pub fn ncreel_next(nr: *mut ncreel) -> *mut nctablet; -} -extern "C" { - #[doc = " Change focus to the previous tablet, if one exists"] - pub fn ncreel_prev(nr: *mut ncreel) -> *mut nctablet; -} -extern "C" { - #[doc = " Destroy an ncreel allocated with ncreel_create()."] - pub fn ncreel_destroy(nr: *mut ncreel); -} -extern "C" { - #[doc = " Returns a pointer to a user pointer associated with this nctablet."] - pub fn nctablet_userptr(t: *mut nctablet) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Access the ncplane associated with nctablet 't', if one exists."] - pub fn nctablet_plane(t: *mut nctablet) -> *mut ncplane; -} -extern "C" { - #[doc = " Deprecated form of nctablet_plane()."] - pub fn nctablet_ncplane(t: *mut nctablet) -> *mut ncplane; -} -extern "C" { - #[doc = " Takes an arbitrarily large number, and prints it into a fixed-size buffer by"] - #[doc = " adding the necessary SI suffix. Usually, pass a |[IB]PREFIXSTRLEN+1|-sized"] - #[doc = " buffer to generate up to |[IB]PREFIXCOLUMNS| columns' worth of EGCs. The"] - #[doc = " characteristic can occupy up through |mult-1| characters (3 for 1000, 4 for"] - #[doc = " 1024). The mantissa can occupy either zero or two characters."] - #[doc = ""] - #[doc = " Floating-point is never used, because an IEEE758 double can only losslessly"] - #[doc = " represent integers through 2^53-1."] - #[doc = ""] - #[doc = " 2^64-1 is 18446744073709551615, 18.45E(xa). KMGTPEZY thus suffice to handle"] - #[doc = " an 89-bit uintmax_t. Beyond Z(etta) and Y(otta) lie lands unspecified by SI."] - #[doc = " 2^-63 is 0.000000000000000000108, 1.08a(tto)."] - #[doc = " val: value to print"] - #[doc = " decimal: scaling. '1' if none has taken place."] - #[doc = " buf: buffer in which string will be generated"] - #[doc = " omitdec: inhibit printing of all-0 decimal portions"] - #[doc = " mult: base of suffix system (almost always 1000 or 1024)"] - #[doc = " uprefix: character to print following suffix ('i' for kibibytes basically)."] - #[doc = " only printed if suffix is actually printed (input >= mult)."] - #[doc = ""] - #[doc = " You are encouraged to consult notcurses_metric(3)."] - pub fn ncmetric( - val: uintmax_t, - decimal: uintmax_t, - buf: *mut cty::c_char, - omitdec: cty::c_int, - mult: uintmax_t, - uprefix: cty::c_int, - ) -> *const cty::c_char; -} -extern "C" { - #[doc = " Enable or disable the terminal's cursor, if supported, placing it at"] - #[doc = " 'y', 'x'. Immediate effect (no need for a call to notcurses_render())."] - #[doc = " It is an error if 'y', 'x' lies outside the standard plane."] - pub fn notcurses_cursor_enable(nc: *mut notcurses, y: cty::c_int, x: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn notcurses_cursor_disable(nc: *mut notcurses) -> cty::c_int; -} -#[doc = " Palette API. Some terminals only support 256 colors, but allow the full"] -#[doc = " palette to be specified with arbitrary RGB colors. In all cases, it's more"] -#[doc = " performant to use indexed colors, since it's much less data to write to the"] -#[doc = " terminal. If you can limit yourself to 256 colors, that's probably best."] -#[repr(C)] -#[derive(Copy, Clone)] -pub struct palette256 { - #[doc = " RGB values as regular ol' channels"] - pub chans: [u32; 256usize], -} -#[test] -fn bindgen_test_layout_palette256() { - assert_eq!( - ::core::mem::size_of::(), - 1024usize, - concat!("Size of: ", stringify!(palette256)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(palette256)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).chans as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(palette256), - "::", - stringify!(chans) - ) - ); -} -extern "C" { - #[doc = " Create a new palette store. It will be initialized with notcurses' best"] - #[doc = " knowledge of the currently configured palette. The palette upon startup"] - #[doc = " cannot be reliably detected, sadly."] - pub fn palette256_new(nc: *mut notcurses) -> *mut palette256; -} -extern "C" { - #[doc = " Attempt to configure the terminal with the provided palette 'p'. Does not"] - #[doc = " transfer ownership of 'p'; palette256_free() can (ought) still be called."] - pub fn palette256_use(nc: *mut notcurses, p: *const palette256) -> cty::c_int; -} -extern "C" { - #[doc = " Free the palette store 'p'."] - pub fn palette256_free(p: *mut palette256); -} -extern "C" { - #[doc = " Convert the plane's content to greyscale."] - pub fn ncplane_greyscale(n: *mut ncplane); -} -#[doc = " selection widget -- an ncplane with a title header and a body section. the"] -#[doc = " body section supports infinite scrolling up and down."] -#[doc = ""] -#[doc = " At all times, exactly one item is selected."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncselector_item { - pub option: *mut cty::c_char, - pub desc: *mut cty::c_char, - #[doc = " filled in by library"] - pub opcolumns: size_t, - #[doc = " filled in by library"] - pub desccolumns: size_t, -} -#[test] -fn bindgen_test_layout_ncselector_item() { - assert_eq!( - ::core::mem::size_of::(), - 32usize, - concat!("Size of: ", stringify!(ncselector_item)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncselector_item)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).option as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncselector_item), - "::", - stringify!(option) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).desc as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncselector_item), - "::", - stringify!(desc) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).opcolumns as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncselector_item), - "::", - stringify!(opcolumns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).desccolumns as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncselector_item), - "::", - stringify!(desccolumns) - ) - ); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncselector_options { - #[doc = " title may be NULL, inhibiting riser, saving two rows."] - pub title: *mut cty::c_char, - #[doc = " secondary may be NULL"] - pub secondary: *mut cty::c_char, - #[doc = " footer may be NULL"] - pub footer: *mut cty::c_char, - #[doc = " initial items and descriptions"] - pub items: *mut ncselector_item, - #[doc = " default item (selected at start), must be < itemcount unless itemcount is"] - #[doc = " 0, in which case 'defidx' must also be 0"] - pub defidx: cty::c_uint, - #[doc = " maximum number of options to display at once, 0 to use all available space"] - pub maxdisplay: cty::c_uint, - #[doc = " option channels"] - pub opchannels: u64, - #[doc = " description channels"] - pub descchannels: u64, - #[doc = " title channels"] - pub titlechannels: u64, - #[doc = " secondary and footer channels"] - pub footchannels: u64, - #[doc = " border channels"] - pub boxchannels: u64, - #[doc = " bitfield of NCSELECTOR_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncselector_options() { - assert_eq!( - ::core::mem::size_of::(), - 88usize, - concat!("Size of: ", stringify!(ncselector_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncselector_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).title as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(title) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).secondary as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(secondary) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).footer as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(footer) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).items as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(items) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).defidx as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(defidx) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).maxdisplay as *const _ as usize }, - 36usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(maxdisplay) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).opchannels as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(opchannels) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).descchannels as *const _ as usize - }, - 48usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(descchannels) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).titlechannels as *const _ as usize - }, - 56usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(titlechannels) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).footchannels as *const _ as usize - }, - 64usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(footchannels) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).boxchannels as *const _ as usize }, - 72usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(boxchannels) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 80usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(flags) - ) - ); -} -extern "C" { - pub fn ncselector_create(n: *mut ncplane, opts: *const ncselector_options) -> *mut ncselector; -} -extern "C" { - #[doc = " Dynamically add or delete items. It is usually sufficient to supply a static"] - #[doc = " list of items via ncselector_options->items."] - pub fn ncselector_additem(n: *mut ncselector, item: *const ncselector_item) -> cty::c_int; -} -extern "C" { - pub fn ncselector_delitem(n: *mut ncselector, item: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Return reference to the selected option, or NULL if there are no items."] - pub fn ncselector_selected(n: *const ncselector) -> *const cty::c_char; -} -extern "C" { - #[doc = " Return a reference to the ncselector's underlying ncplane."] - pub fn ncselector_plane(n: *mut ncselector) -> *mut ncplane; -} -extern "C" { - #[doc = " Move up or down in the list. A reference to the newly-selected item is"] - #[doc = " returned, or NULL if there are no items in the list."] - pub fn ncselector_previtem(n: *mut ncselector) -> *const cty::c_char; -} -extern "C" { - pub fn ncselector_nextitem(n: *mut ncselector) -> *const cty::c_char; -} -extern "C" { - #[doc = " Offer the input to the ncselector. If it's relevant, this function returns"] - #[doc = " true, and the input ought not be processed further. If it's irrelevant to"] - #[doc = " the selector, false is returned. Relevant inputs include:"] - #[doc = " * a mouse click on an item"] - #[doc = " * a mouse scrollwheel event"] - #[doc = " * a mouse click on the scrolling arrows"] - #[doc = " * up, down, pgup, or pgdown on an unrolled menu (navigates among items)"] - pub fn ncselector_offer_input(n: *mut ncselector, nc: *const ncinput) -> bool; -} -extern "C" { - #[doc = " Destroy the ncselector. If 'item' is not NULL, the last selected option will"] - #[doc = " be strdup()ed and assigned to '*item' (and must be free()d by the caller)."] - pub fn ncselector_destroy(n: *mut ncselector, item: *mut *mut cty::c_char); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncmselector_item { - pub option: *mut cty::c_char, - pub desc: *mut cty::c_char, - pub selected: bool, -} -#[test] -fn bindgen_test_layout_ncmselector_item() { - assert_eq!( - ::core::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(ncmselector_item)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncmselector_item)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).option as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncmselector_item), - "::", - stringify!(option) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).desc as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncmselector_item), - "::", - stringify!(desc) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).selected as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncmselector_item), - "::", - stringify!(selected) - ) - ); -} -#[doc = " multiselection widget -- a selector supporting multiple selections."] -#[doc = ""] -#[doc = " Unlike the selector widget, zero to all of the items can be selected, but"] -#[doc = " also the widget does not support adding or removing items at runtime."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncmultiselector_options { - #[doc = " title may be NULL, inhibiting riser, saving two rows."] - pub title: *mut cty::c_char, - #[doc = " secondary may be NULL"] - pub secondary: *mut cty::c_char, - #[doc = " footer may be NULL"] - pub footer: *mut cty::c_char, - #[doc = " initial items, descriptions, and statuses"] - pub items: *mut ncmselector_item, - #[doc = " maximum number of options to display at once, 0 to use all available space"] - pub maxdisplay: cty::c_uint, - #[doc = " option channels"] - pub opchannels: u64, - #[doc = " description channels"] - pub descchannels: u64, - #[doc = " title channels"] - pub titlechannels: u64, - #[doc = " secondary and footer channels"] - pub footchannels: u64, - #[doc = " border channels"] - pub boxchannels: u64, - #[doc = " bitfield of NCMULTISELECTOR_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncmultiselector_options() { - assert_eq!( - ::core::mem::size_of::(), - 88usize, - concat!("Size of: ", stringify!(ncmultiselector_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncmultiselector_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).title as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(title) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).secondary as *const _ as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(secondary) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).footer as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(footer) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).items as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(items) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).maxdisplay as *const _ as usize - }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(maxdisplay) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).opchannels as *const _ as usize - }, - 40usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(opchannels) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).descchannels as *const _ as usize - }, - 48usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(descchannels) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).titlechannels as *const _ as usize - }, - 56usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(titlechannels) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).footchannels as *const _ as usize - }, - 64usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(footchannels) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).boxchannels as *const _ as usize - }, - 72usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(boxchannels) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 80usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(flags) - ) - ); -} -extern "C" { - pub fn ncmultiselector_create( - n: *mut ncplane, - opts: *const ncmultiselector_options, - ) -> *mut ncmultiselector; -} -extern "C" { - #[doc = " Return selected vector. An array of bools must be provided, along with its"] - #[doc = " length. If that length doesn't match the itemcount, it is an error."] - pub fn ncmultiselector_selected( - n: *mut ncmultiselector, - selected: *mut bool, - count: cty::c_uint, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Return a reference to the ncmultiselector's underlying ncplane."] - pub fn ncmultiselector_plane(n: *mut ncmultiselector) -> *mut ncplane; -} -extern "C" { - #[doc = " Offer the input to the ncmultiselector. If it's relevant, this function"] - #[doc = " returns true, and the input ought not be processed further. If it's"] - #[doc = " irrelevant to the multiselector, false is returned. Relevant inputs include:"] - #[doc = " * a mouse click on an item"] - #[doc = " * a mouse scrollwheel event"] - #[doc = " * a mouse click on the scrolling arrows"] - #[doc = " * up, down, pgup, or pgdown on an unrolled menu (navigates among items)"] - pub fn ncmultiselector_offer_input(n: *mut ncmultiselector, nc: *const ncinput) -> bool; -} -extern "C" { - #[doc = " Destroy the ncmultiselector."] - pub fn ncmultiselector_destroy(n: *mut ncmultiselector); -} -#[doc = " each item has a curry, and zero or more subitems."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct nctree_item { - pub curry: *mut cty::c_void, - pub subs: *mut nctree_item, - pub subcount: cty::c_uint, -} -#[test] -fn bindgen_test_layout_nctree_item() { - assert_eq!( - ::core::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(nctree_item)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(nctree_item)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).curry as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(nctree_item), - "::", - stringify!(curry) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).subs as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(nctree_item), - "::", - stringify!(subs) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).subcount as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(nctree_item), - "::", - stringify!(subcount) - ) - ); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct nctree_options { - #[doc = " top-level nctree_item array"] - pub items: *const nctree_item, - #[doc = " size of |items|"] - pub count: cty::c_uint, - #[doc = " item callback function"] - pub nctreecb: ::core::option::Option< - unsafe extern "C" fn( - arg1: *mut ncplane, - arg2: *mut cty::c_void, - arg3: cty::c_int, - ) -> cty::c_int, - >, - #[doc = " columns to indent per level of hierarchy"] - pub indentcols: cty::c_int, - #[doc = " bitfield of NCTREE_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_nctree_options() { - assert_eq!( - ::core::mem::size_of::(), - 40usize, - concat!("Size of: ", stringify!(nctree_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(nctree_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).items as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(nctree_options), - "::", - stringify!(items) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).count as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(nctree_options), - "::", - stringify!(count) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).nctreecb as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(nctree_options), - "::", - stringify!(nctreecb) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).indentcols as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(nctree_options), - "::", - stringify!(indentcols) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(nctree_options), - "::", - stringify!(flags) - ) - ); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct nctree { - _unused: [u8; 0], -} -extern "C" { - #[doc = " |opts| may *not* be NULL, since it is necessary to define a callback"] - #[doc = " function."] - pub fn nctree_create(n: *mut ncplane, opts: *const nctree_options) -> *mut nctree; -} -extern "C" { - #[doc = " Returns the ncplane on which this nctree lives."] - pub fn nctree_plane(n: *mut nctree) -> *mut ncplane; -} -extern "C" { - #[doc = " Redraw the nctree 'n' in its entirety. The tree will be cleared, and items"] - #[doc = " will be lain out, using the focused item as a fulcrum. Item-drawing"] - #[doc = " callbacks will be invoked for each visible item."] - pub fn nctree_redraw(n: *mut nctree) -> cty::c_int; -} -extern "C" { - #[doc = " Offer input 'ni' to the nctree 'n'. If it's relevant, this function returns"] - #[doc = " true, and the input ought not be processed further. If it's irrelevant to"] - #[doc = " the tree, false is returned. Relevant inputs include:"] - #[doc = " * a mouse click on an item (focuses item)"] - #[doc = " * a mouse scrollwheel event (srolls tree)"] - #[doc = " * up, down, pgup, or pgdown (navigates among items)"] - pub fn nctree_offer_input(n: *mut nctree, ni: *const ncinput) -> bool; -} -extern "C" { - #[doc = " Return the focused item, if any items are present. This is not a copy;"] - #[doc = " be careful to use it only for the duration of a critical section."] - pub fn nctree_focused(n: *mut nctree) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Change focus to the next item."] - pub fn nctree_next(n: *mut nctree) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Change focus to the previous item."] - pub fn nctree_prev(n: *mut nctree) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Go to the item specified by the array |spec|, terminated by UINT_MAX. If"] - #[doc = " the spec is invalid, NULL is returned, and the depth of the first invalid"] - #[doc = " spec is written to *|failspec|. Otherwise, the true depth is written to"] - #[doc = " *|failspec|, and the curry is returned (|failspec| is necessary because the"] - #[doc = " curry could itself be NULL)."] - pub fn nctree_goto( - n: *mut nctree, - spec: *const cty::c_uint, - failspec: *mut cty::c_int, - ) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Destroy the nctree."] - pub fn nctree_destroy(n: *mut nctree); -} -#[doc = " Menus. Horizontal menu bars are supported, on the top and/or bottom rows."] -#[doc = " If the menu bar is longer than the screen, it will be only partially"] -#[doc = " visible. Menus may be either visible or invisible by default. In the event of"] -#[doc = " a screen resize, menus will be automatically moved/resized. Elements can be"] -#[doc = " dynamically enabled or disabled at all levels (menu, section, and item),"] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncmenu_item { - #[doc = " utf-8 menu item, NULL for horizontal separator"] - pub desc: *mut cty::c_char, - #[doc = " shortcut, all should be distinct"] - pub shortcut: ncinput, -} -#[test] -fn bindgen_test_layout_ncmenu_item() { - assert_eq!( - ::core::mem::size_of::(), - 32usize, - concat!("Size of: ", stringify!(ncmenu_item)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncmenu_item)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).desc as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_item), - "::", - stringify!(desc) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).shortcut as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_item), - "::", - stringify!(shortcut) - ) - ); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncmenu_section { - #[doc = " utf-8 c string"] - pub name: *mut cty::c_char, - pub itemcount: cty::c_int, - pub items: *mut ncmenu_item, - #[doc = " shortcut, will be underlined if present in name"] - pub shortcut: ncinput, -} -#[test] -fn bindgen_test_layout_ncmenu_section() { - assert_eq!( - ::core::mem::size_of::(), - 48usize, - concat!("Size of: ", stringify!(ncmenu_section)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncmenu_section)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).name as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_section), - "::", - stringify!(name) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).itemcount as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_section), - "::", - stringify!(itemcount) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).items as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_section), - "::", - stringify!(items) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).shortcut as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_section), - "::", - stringify!(shortcut) - ) - ); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncmenu_options { - #[doc = " array of 'sectioncount' menu_sections"] - pub sections: *mut ncmenu_section, - #[doc = " must be positive"] - pub sectioncount: cty::c_int, - #[doc = " styling for header"] - pub headerchannels: u64, - #[doc = " styling for sections"] - pub sectionchannels: u64, - #[doc = " flag word of NCMENU_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncmenu_options() { - assert_eq!( - ::core::mem::size_of::(), - 40usize, - concat!("Size of: ", stringify!(ncmenu_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncmenu_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sections as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_options), - "::", - stringify!(sections) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sectioncount as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_options), - "::", - stringify!(sectioncount) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).headerchannels as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_options), - "::", - stringify!(headerchannels) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sectionchannels as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_options), - "::", - stringify!(sectionchannels) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_options), - "::", - stringify!(flags) - ) - ); -} -#[repr(C)] -#[derive(Debug)] -pub struct ncmenu { - _unused: [u8; 0], -} -extern "C" { - #[doc = " Create a menu with the specified options. Menus are currently bound to an"] - #[doc = " overall Notcurses object (as opposed to a particular plane), and are"] - #[doc = " implemented as ncplanes kept atop other ncplanes."] - pub fn ncmenu_create(n: *mut ncplane, opts: *const ncmenu_options) -> *mut ncmenu; -} -extern "C" { - #[doc = " Unroll the specified menu section, making the menu visible if it was"] - #[doc = " invisible, and rolling up any menu section that is already unrolled."] - pub fn ncmenu_unroll(n: *mut ncmenu, sectionidx: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Roll up any unrolled menu section, and hide the menu if using hiding."] - pub fn ncmenu_rollup(n: *mut ncmenu) -> cty::c_int; -} -extern "C" { - #[doc = " Unroll the previous/next section (relative to current unrolled). If no"] - #[doc = " section is unrolled, the first section will be unrolled."] - pub fn ncmenu_nextsection(n: *mut ncmenu) -> cty::c_int; -} -extern "C" { - pub fn ncmenu_prevsection(n: *mut ncmenu) -> cty::c_int; -} -extern "C" { - #[doc = " Move to the previous/next item within the currently unrolled section. If no"] - #[doc = " section is unrolled, the first section will be unrolled."] - pub fn ncmenu_nextitem(n: *mut ncmenu) -> cty::c_int; -} -extern "C" { - pub fn ncmenu_previtem(n: *mut ncmenu) -> cty::c_int; -} -extern "C" { - #[doc = " Disable or enable a menu item. Returns 0 if the item was found."] - pub fn ncmenu_item_set_status( - n: *mut ncmenu, - section: *const cty::c_char, - item: *const cty::c_char, - enabled: bool, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Return the selected item description, or NULL if no section is unrolled. If"] - #[doc = " 'ni' is not NULL, and the selected item has a shortcut, 'ni' will be filled"] - #[doc = " in with that shortcut--this can allow faster matching."] - pub fn ncmenu_selected(n: *const ncmenu, ni: *mut ncinput) -> *const cty::c_char; -} -extern "C" { - #[doc = " Return the item description corresponding to the mouse click 'click'. The"] - #[doc = " item must be on an actively unrolled section, and the click must be in the"] - #[doc = " area of a valid item. If 'ni' is not NULL, and the selected item has a"] - #[doc = " shortcut, 'ni' will be filled in with the shortcut."] - pub fn ncmenu_mouse_selected( - n: *const ncmenu, - click: *const ncinput, - ni: *mut ncinput, - ) -> *const cty::c_char; -} -extern "C" { - #[doc = " Return the ncplane backing this ncmenu."] - pub fn ncmenu_plane(n: *mut ncmenu) -> *mut ncplane; -} -extern "C" { - #[doc = " Offer the input to the ncmenu. If it's relevant, this function returns true,"] - #[doc = " and the input ought not be processed further. If it's irrelevant to the"] - #[doc = " menu, false is returned. Relevant inputs include:"] - #[doc = " * mouse movement over a hidden menu"] - #[doc = " * a mouse click on a menu section (the section is unrolled)"] - #[doc = " * a mouse click outside of an unrolled menu (the menu is rolled up)"] - #[doc = " * left or right on an unrolled menu (navigates among sections)"] - #[doc = " * up or down on an unrolled menu (navigates among items)"] - #[doc = " * escape on an unrolled menu (the menu is rolled up)"] - pub fn ncmenu_offer_input(n: *mut ncmenu, nc: *const ncinput) -> bool; -} -extern "C" { - #[doc = " Destroy a menu created with ncmenu_create()."] - pub fn ncmenu_destroy(n: *mut ncmenu) -> cty::c_int; -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncprogbar_options { - #[doc = " upper-left channel. in the context of a progress bar,"] - pub ulchannel: u32, - #[doc = " \"up\" is the direction we are progressing towards, and"] - pub urchannel: u32, - #[doc = " \"bottom\" is the direction of origin. for monochromatic"] - pub blchannel: u32, - #[doc = " bar, all four channels ought be the same."] - pub brchannel: u32, - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncprogbar_options() { - assert_eq!( - ::core::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(ncprogbar_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncprogbar_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).ulchannel as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncprogbar_options), - "::", - stringify!(ulchannel) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).urchannel as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(ncprogbar_options), - "::", - stringify!(urchannel) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).blchannel as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncprogbar_options), - "::", - stringify!(blchannel) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).brchannel as *const _ as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(ncprogbar_options), - "::", - stringify!(brchannel) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncprogbar_options), - "::", - stringify!(flags) - ) - ); -} -extern "C" { - #[doc = " Takes ownership of the ncplane 'n', which will be destroyed by"] - #[doc = " ncprogbar_destroy(). The progress bar is initially at 0%."] - pub fn ncprogbar_create(n: *mut ncplane, opts: *const ncprogbar_options) -> *mut ncprogbar; -} -extern "C" { - #[doc = " Return a reference to the ncprogbar's underlying ncplane."] - pub fn ncprogbar_plane(n: *mut ncprogbar) -> *mut ncplane; -} -extern "C" { - #[doc = " Set the progress bar's completion, a double 0 <= 'p' <= 1."] - pub fn ncprogbar_set_progress(n: *mut ncprogbar, p: f64) -> cty::c_int; -} -extern "C" { - #[doc = " Get the progress bar's completion, a double on [0, 1]."] - pub fn ncprogbar_progress(n: *const ncprogbar) -> f64; -} -extern "C" { - #[doc = " Destroy the progress bar and its underlying ncplane."] - pub fn ncprogbar_destroy(n: *mut ncprogbar); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncplot_options { - #[doc = " channels for the maximum and minimum levels. linear or exponential"] - #[doc = " interpolation will be applied across the domain between these two."] - pub maxchannels: u64, - pub minchannels: u64, - #[doc = " styling used for the legend, if NCPLOT_OPTION_LABELTICKSD is set"] - pub legendstyle: u16, - #[doc = " number of \"pixels\" per row x column"] - pub gridtype: ncblitter_e, - #[doc = " independent variable can either be a contiguous range, or a finite set"] - #[doc = " of keys. for a time range, say the previous hour sampled with second"] - #[doc = " resolution, the independent variable would be the range [0..3600): 3600."] - #[doc = " if rangex is 0, it is dynamically set to the number of columns."] - pub rangex: cty::c_int, - #[doc = " optional, printed by the labels"] - pub title: *const cty::c_char, - #[doc = " bitfield over NCPLOT_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncplot_options() { - assert_eq!( - ::core::mem::size_of::(), - 48usize, - concat!("Size of: ", stringify!(ncplot_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncplot_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).maxchannels as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncplot_options), - "::", - stringify!(maxchannels) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).minchannels as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncplot_options), - "::", - stringify!(minchannels) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).legendstyle as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncplot_options), - "::", - stringify!(legendstyle) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).gridtype as *const _ as usize }, - 20usize, - concat!( - "Offset of field: ", - stringify!(ncplot_options), - "::", - stringify!(gridtype) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).rangex as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncplot_options), - "::", - stringify!(rangex) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).title as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncplot_options), - "::", - stringify!(title) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(ncplot_options), - "::", - stringify!(flags) - ) - ); -} -extern "C" { - #[doc = " Use the provided plane 'n' for plotting according to the options 'opts'. The"] - #[doc = " plot will make free use of the entirety of the plane. For domain"] - #[doc = " autodiscovery, set miny == maxy == 0. ncuplot holds uint64_ts, while"] - #[doc = " ncdplot holds doubles."] - pub fn ncuplot_create( - n: *mut ncplane, - opts: *const ncplot_options, - miny: u64, - maxy: u64, - ) -> *mut ncuplot; -} -extern "C" { - pub fn ncdplot_create( - n: *mut ncplane, - opts: *const ncplot_options, - miny: f64, - maxy: f64, - ) -> *mut ncdplot; -} -extern "C" { - #[doc = " Return a reference to the ncplot's underlying ncplane."] - pub fn ncuplot_plane(n: *mut ncuplot) -> *mut ncplane; -} -extern "C" { - pub fn ncdplot_plane(n: *mut ncdplot) -> *mut ncplane; -} -extern "C" { - #[doc = " Add to or set the value corresponding to this x. If x is beyond the current"] - #[doc = " x window, the x window is advanced to include x, and values passing beyond"] - #[doc = " the window are lost. The first call will place the initial window. The plot"] - #[doc = " will be redrawn, but notcurses_render() is not called."] - pub fn ncuplot_add_sample(n: *mut ncuplot, x: u64, y: u64) -> cty::c_int; -} -extern "C" { - pub fn ncdplot_add_sample(n: *mut ncdplot, x: u64, y: f64) -> cty::c_int; -} -extern "C" { - pub fn ncuplot_set_sample(n: *mut ncuplot, x: u64, y: u64) -> cty::c_int; -} -extern "C" { - pub fn ncdplot_set_sample(n: *mut ncdplot, x: u64, y: f64) -> cty::c_int; -} -extern "C" { - pub fn ncuplot_sample(n: *const ncuplot, x: u64, y: *mut u64) -> cty::c_int; -} -extern "C" { - pub fn ncdplot_sample(n: *const ncdplot, x: u64, y: *mut f64) -> cty::c_int; -} -extern "C" { - pub fn ncuplot_destroy(n: *mut ncuplot); -} -extern "C" { - pub fn ncdplot_destroy(n: *mut ncdplot); -} -pub type ncfdplane_callback = ::core::option::Option< - unsafe extern "C" fn( - n: *mut ncfdplane, - buf: *const cty::c_void, - s: size_t, - curry: *mut cty::c_void, - ) -> cty::c_int, ->; -pub type ncfdplane_done_cb = ::core::option::Option< - unsafe extern "C" fn( - n: *mut ncfdplane, - fderrno: cty::c_int, - curry: *mut cty::c_void, - ) -> cty::c_int, ->; -#[doc = " read from an fd until EOF (or beyond, if follow is set), invoking the user's"] -#[doc = " callback each time. runs in its own context. on EOF or error, the finalizer"] -#[doc = " callback will be invoked, and the user ought destroy the ncfdplane. the"] -#[doc = " data is *not* guaranteed to be nul-terminated, and may contain arbitrary"] -#[doc = " zeroes."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncfdplane_options { - #[doc = " parameter provided to callbacks"] - pub curry: *mut cty::c_void, - #[doc = " keep reading after hitting end? (think tail -f)"] - pub follow: bool, - #[doc = " bitfield over NCOPTION_FDPLANE_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncfdplane_options() { - assert_eq!( - ::core::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(ncfdplane_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncfdplane_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).curry as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncfdplane_options), - "::", - stringify!(curry) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).follow as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncfdplane_options), - "::", - stringify!(follow) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncfdplane_options), - "::", - stringify!(flags) - ) - ); -} -extern "C" { - #[doc = " Create an ncfdplane around the fd 'fd'. Consider this function to take"] - #[doc = " ownership of the file descriptor, which will be closed in ncfdplane_destroy()."] - pub fn ncfdplane_create( - n: *mut ncplane, - opts: *const ncfdplane_options, - fd: cty::c_int, - cbfxn: ncfdplane_callback, - donecbfxn: ncfdplane_done_cb, - ) -> *mut ncfdplane; -} -extern "C" { - pub fn ncfdplane_plane(n: *mut ncfdplane) -> *mut ncplane; -} -extern "C" { - pub fn ncfdplane_destroy(n: *mut ncfdplane) -> cty::c_int; -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncsubproc_options { - pub curry: *mut cty::c_void, - #[doc = " restart this many seconds after an exit (watch)"] - pub restart_period: u64, - #[doc = " bitfield over NCOPTION_SUBPROC_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncsubproc_options() { - assert_eq!( - ::core::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(ncsubproc_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncsubproc_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).curry as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncsubproc_options), - "::", - stringify!(curry) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).restart_period as *const _ as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncsubproc_options), - "::", - stringify!(restart_period) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncsubproc_options), - "::", - stringify!(flags) - ) - ); -} -extern "C" { - #[doc = " see exec(2). p-types use $PATH. e-type passes environment vars."] - pub fn ncsubproc_createv( - n: *mut ncplane, - opts: *const ncsubproc_options, - bin: *const cty::c_char, - arg: *const *mut cty::c_char, - cbfxn: ncfdplane_callback, - donecbfxn: ncfdplane_done_cb, - ) -> *mut ncsubproc; -} -extern "C" { - pub fn ncsubproc_createvp( - n: *mut ncplane, - opts: *const ncsubproc_options, - bin: *const cty::c_char, - arg: *const *mut cty::c_char, - cbfxn: ncfdplane_callback, - donecbfxn: ncfdplane_done_cb, - ) -> *mut ncsubproc; -} -extern "C" { - pub fn ncsubproc_createvpe( - n: *mut ncplane, - opts: *const ncsubproc_options, - bin: *const cty::c_char, - arg: *const *mut cty::c_char, - env: *const *mut cty::c_char, - cbfxn: ncfdplane_callback, - donecbfxn: ncfdplane_done_cb, - ) -> *mut ncsubproc; -} -extern "C" { - pub fn ncsubproc_plane(n: *mut ncsubproc) -> *mut ncplane; -} -extern "C" { - pub fn ncsubproc_destroy(n: *mut ncsubproc) -> cty::c_int; -} -extern "C" { - #[doc = " Draw a QR code at the current position on the plane. If there is insufficient"] - #[doc = " room to draw the code here, or there is any other error, non-zero will be"] - #[doc = " returned. Otherwise, the QR code \"version\" (size) is returned. The QR code"] - #[doc = " is (version * 4 + 17) columns wide, and ⌈version * 4 + 17⌉ rows tall (the"] - #[doc = " properly-scaled values are written back to '*ymax' and '*xmax')."] - pub fn ncplane_qrcode( - n: *mut ncplane, - ymax: *mut cty::c_int, - xmax: *mut cty::c_int, - data: *const cty::c_void, - len: size_t, - ) -> cty::c_int; -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncreader_options { - #[doc = " channels used for input"] - pub tchannels: u64, - #[doc = " attributes used for input"] - pub tattrword: u32, - #[doc = " bitfield of NCREADER_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncreader_options() { - assert_eq!( - ::core::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(ncreader_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncreader_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).tchannels as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncreader_options), - "::", - stringify!(tchannels) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).tattrword as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncreader_options), - "::", - stringify!(tattrword) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncreader_options), - "::", - stringify!(flags) - ) - ); -} -extern "C" { - #[doc = " ncreaders provide freeform input in a (possibly multiline) region, supporting"] - #[doc = " optional readline keybindings. takes ownership of 'n', destroying it on any"] - #[doc = " error (ncreader_destroy() otherwise destroys the ncplane)."] - pub fn ncreader_create(n: *mut ncplane, opts: *const ncreader_options) -> *mut ncreader; -} -extern "C" { - #[doc = " empty the ncreader of any user input, and home the cursor."] - pub fn ncreader_clear(n: *mut ncreader) -> cty::c_int; -} -extern "C" { - pub fn ncreader_plane(n: *mut ncreader) -> *mut ncplane; -} -extern "C" { - #[doc = " Offer the input to the ncreader. If it's relevant, this function returns"] - #[doc = " true, and the input ought not be processed further. Almost all inputs"] - #[doc = " are relevant to an ncreader, save synthesized ones."] - pub fn ncreader_offer_input(n: *mut ncreader, ni: *const ncinput) -> bool; -} -extern "C" { - #[doc = " Atttempt to move in the specified direction. Returns 0 if a move was"] - #[doc = " successfully executed, -1 otherwise. Scrolling is taken into account."] - pub fn ncreader_move_left(n: *mut ncreader) -> cty::c_int; -} -extern "C" { - pub fn ncreader_move_right(n: *mut ncreader) -> cty::c_int; -} -extern "C" { - pub fn ncreader_move_up(n: *mut ncreader) -> cty::c_int; -} -extern "C" { - pub fn ncreader_move_down(n: *mut ncreader) -> cty::c_int; -} -extern "C" { - #[doc = " Destructively write the provided EGC to the current cursor location. Move"] - #[doc = " the cursor as necessary, scrolling if applicable."] - pub fn ncreader_write_egc(n: *mut ncreader, egc: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " return a heap-allocated copy of the current (UTF-8) contents."] - pub fn ncreader_contents(n: *const ncreader) -> *mut cty::c_char; -} -extern "C" { - #[doc = " destroy the reader and its bound plane. if 'contents' is not NULL, the"] - #[doc = " UTF-8 input will be heap-duplicated and written to 'contents'."] - pub fn ncreader_destroy(n: *mut ncreader, contents: *mut *mut cty::c_char); -} -extern "C" { - #[doc = " Dump selected Notcurses state to the supplied 'debugfp'. Output is freeform,"] - #[doc = " and subject to change. It includes geometry of all planes, from all piles."] - pub fn notcurses_debug(nc: *mut notcurses, debugfp: *mut FILE); -} -extern "C" { - #[doc = " Get the default *media* (not plot) blitter for this environment when using"] - #[doc = " the specified scaling method. Currently, this means:"] - #[doc = " - if lacking UTF-8, NCBLIT_1x1"] - #[doc = " - otherwise, if not NCSCALE_STRETCH, NCBLIT_2x1"] - #[doc = " - otherwise, if sextants are not known to be good, NCBLIT_2x2"] - #[doc = " - otherwise NCBLIT_3x2"] - #[doc = " NCBLIT_2x2 and NCBLIT_3x2 both distort the original aspect ratio, thus"] - #[doc = " NCBLIT_2x1 is used outside of NCSCALE_STRETCH."] - pub fn ncvisual_media_defblitter(nc: *const notcurses, scale: ncscale_e) -> ncblitter_e; -} -pub type ncdirectv = ncplane; -#[repr(C)] -#[derive(Debug)] -pub struct ncdirect { - _unused: [u8; 0], -} -extern "C" { - #[doc = " Initialize a direct-mode Notcurses context on the connected terminal at 'fp'."] - #[doc = " 'fp' must be a tty. You'll usually want stdout. Direct mode supports a"] - #[doc = " limited subset of Notcurses routines which directly affect 'fp', and neither"] - #[doc = " supports nor requires notcurses_render(). This can be used to add color and"] - #[doc = " styling to text in the standard output paradigm. 'flags' is a bitmask over"] - #[doc = " NCDIRECT_OPTION_*."] - #[doc = " Returns NULL on error, including any failure initializing terminfo."] - pub fn ncdirect_init(termtype: *const cty::c_char, fp: *mut FILE, flags: u64) -> *mut ncdirect; -} -extern "C" { - #[doc = " The same as ncdirect_init(), but without any multimedia functionality,"] - #[doc = " allowing for a svelter binary. Link with notcurses-core if this is used."] - pub fn ncdirect_core_init( - termtype: *const cty::c_char, - fp: *mut FILE, - flags: u64, - ) -> *mut ncdirect; -} -extern "C" { - #[doc = " Read a (heap-allocated) line of text using the Readline library Initializes"] - #[doc = " Readline the first time it's called. For input to be echoed to the terminal,"] - #[doc = " it is necessary that NCDIRECT_OPTION_INHIBIT_CBREAK be provided to"] - #[doc = " ncdirect_init(). Returns NULL on error."] - pub fn ncdirect_readline(nc: *mut ncdirect, prompt: *const cty::c_char) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Direct mode. This API can be used to colorize and stylize output generated"] - #[doc = " outside of notcurses, without ever calling notcurses_render(). These should"] - #[doc = " not be intermixed with standard Notcurses rendering."] - pub fn ncdirect_set_fg_rgb(nc: *mut ncdirect, rgb: cty::c_uint) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_set_bg_rgb(nc: *mut ncdirect, rgb: cty::c_uint) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_set_fg_palindex(nc: *mut ncdirect, pidx: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_set_bg_palindex(nc: *mut ncdirect, pidx: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Returns the number of simultaneous colors claimed to be supported, or 1 if"] - #[doc = " there is no color support. Note that several terminal emulators advertise"] - #[doc = " more colors than they actually support, downsampling internally."] - pub fn ncdirect_palette_size(nc: *const ncdirect) -> cty::c_uint; -} -extern "C" { - #[doc = " Output the string |utf8| according to the channels |channels|. Note that"] - #[doc = " ncdirect_putstr() does not explicitly flush output buffers, so it will not"] - #[doc = " necessarily be immediately visible."] - pub fn ncdirect_putstr( - nc: *mut ncdirect, - channels: u64, - utf8: *const cty::c_char, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Formatted printing (plus alignment relative to the terminal). Returns the"] - #[doc = " number of columns printed on success."] - pub fn ncdirect_printf_aligned( - n: *mut ncdirect, - y: cty::c_int, - align: ncalign_e, - fmt: *const cty::c_char, - ... - ) -> cty::c_int; -} -extern "C" { - #[doc = " Force a flush. Returns 0 on success, -1 on failure."] - pub fn ncdirect_flush(nc: *const ncdirect) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_set_fg_default(nc: *mut ncdirect) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_set_bg_default(nc: *mut ncdirect) -> cty::c_int; -} -extern "C" { - #[doc = " Get the current number of columns/rows."] - pub fn ncdirect_dim_x(nc: *const ncdirect) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_dim_y(nc: *const ncdirect) -> cty::c_int; -} -extern "C" { - #[doc = " ncplane_styles_*() analogues"] - pub fn ncdirect_set_styles(n: *mut ncdirect, stylebits: cty::c_uint) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_on_styles(n: *mut ncdirect, stylebits: cty::c_uint) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_off_styles(n: *mut ncdirect, stylebits: cty::c_uint) -> cty::c_int; -} -extern "C" { - #[doc = " Deprecated forms of above."] - pub fn ncdirect_styles_set(n: *mut ncdirect, stylebits: cty::c_uint) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_styles_on(n: *mut ncdirect, stylebits: cty::c_uint) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_styles_off(n: *mut ncdirect, stylebits: cty::c_uint) -> cty::c_int; -} -extern "C" { - #[doc = " Move the cursor in direct mode. -1 to retain current location on that axis."] - pub fn ncdirect_cursor_move_yx(n: *mut ncdirect, y: cty::c_int, x: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_cursor_enable(nc: *mut ncdirect) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_cursor_disable(nc: *mut ncdirect) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_cursor_up(nc: *mut ncdirect, num: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_cursor_left(nc: *mut ncdirect, num: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_cursor_right(nc: *mut ncdirect, num: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_cursor_down(nc: *mut ncdirect, num: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Get the cursor position, when supported. This requires writing to the"] - #[doc = " terminal, and then reading from it. If the terminal doesn't reply, or"] - #[doc = " doesn't reply in a way we understand, the results might be deleterious."] - pub fn ncdirect_cursor_yx( - n: *mut ncdirect, - y: *mut cty::c_int, - x: *mut cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Push or pop the cursor location to the terminal's stack. The depth of this"] - #[doc = " stack, and indeed its existence, is terminal-dependent."] - pub fn ncdirect_cursor_push(n: *mut ncdirect) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_cursor_pop(n: *mut ncdirect) -> cty::c_int; -} -extern "C" { - #[doc = " Display an image using the specified blitter and scaling. The image may"] - #[doc = " be arbitrarily many rows -- the output will scroll -- but will only occupy"] - #[doc = " the column of the cursor, and those to the right. The render/raster process"] - #[doc = " can be split by using ncdirect_render_frame() and ncdirect_raster_frame()."] - pub fn ncdirect_render_image( - n: *mut ncdirect, - filename: *const cty::c_char, - align: ncalign_e, - blitter: ncblitter_e, - scale: ncscale_e, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Clear the screen."] - pub fn ncdirect_clear(nc: *mut ncdirect) -> cty::c_int; -} -extern "C" { - #[doc = " Can we load images? This requires being built against FFmpeg/OIIO."] - pub fn ncdirect_canopen_images(n: *const ncdirect) -> bool; -} -extern "C" { - #[doc = " Is our encoding UTF-8? Requires LANG being set to a UTF8 locale."] - pub fn ncdirect_canutf8(n: *const ncdirect) -> bool; -} -extern "C" { - #[doc = " This function must successfully return before NCBLIT_PIXEL is available."] - #[doc = " Returns -1 on error, 0 for no support, or 1 if pixel output is supported."] - #[doc = " Must not be called concurrently with either input or rasterization."] - pub fn ncdirect_check_pixel_support(n: *mut ncdirect) -> cty::c_int; -} -extern "C" { - #[doc = " Draw horizontal/vertical lines using the specified channels, interpolating"] - #[doc = " between them as we go. The EGC may not use more than one column. For a"] - #[doc = " horizontal line, |len| cannot exceed the screen width minus the cursor's"] - #[doc = " offset. For a vertical line, it may be as long as you'd like; the screen"] - #[doc = " will scroll as necessary. All lines start at the current cursor position."] - pub fn ncdirect_hline_interp( - n: *mut ncdirect, - egc: *const cty::c_char, - len: cty::c_int, - h1: u64, - h2: u64, - ) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_vline_interp( - n: *mut ncdirect, - egc: *const cty::c_char, - len: cty::c_int, - h1: u64, - h2: u64, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Draw a box with its upper-left corner at the current cursor position, having"] - #[doc = " dimensions |ylen|x|xlen|. See ncplane_box() for more information. The"] - #[doc = " minimum box size is 2x2, and it cannot be drawn off-screen. |wchars| is an"] - #[doc = " array of 6 wide characters: UL, UR, LL, LR, HL, VL."] - pub fn ncdirect_box( - n: *mut ncdirect, - ul: u64, - ur: u64, - ll: u64, - lr: u64, - wchars: *const wchar_t, - ylen: cty::c_int, - xlen: cty::c_int, - ctlword: cty::c_uint, - ) -> cty::c_int; -} -extern "C" { - #[doc = " ncdirect_box() with the rounded box-drawing characters"] - pub fn ncdirect_rounded_box( - n: *mut ncdirect, - ul: u64, - ur: u64, - ll: u64, - lr: u64, - ylen: cty::c_int, - xlen: cty::c_int, - ctlword: cty::c_uint, - ) -> cty::c_int; -} -extern "C" { - #[doc = " ncdirect_box() with the double box-drawing characters"] - pub fn ncdirect_double_box( - n: *mut ncdirect, - ul: u64, - ur: u64, - ll: u64, - lr: u64, - ylen: cty::c_int, - xlen: cty::c_int, - ctlword: cty::c_uint, - ) -> cty::c_int; -} -extern "C" { - #[doc = " See ppoll(2) for more detail. Provide a NULL 'ts' to block at length, a 'ts'"] - #[doc = " of 0 for non-blocking operation, and otherwise a timespec to bound blocking."] - #[doc = " Signals in sigmask (less several we handle internally) will be atomically"] - #[doc = " masked and unmasked per ppoll(2). '*sigmask' should generally contain all"] - #[doc = " signals. Returns a single Unicode code point, or (char32_t)-1 on error."] - #[doc = " 'sigmask' may be NULL. Returns 0 on a timeout. If an event is processed, the"] - #[doc = " return value is the 'id' field from that event. 'ni' may be NULL."] - pub fn ncdirect_getc( - n: *mut ncdirect, - ts: *const timespec, - sigmask: *mut sigset_t, - ni: *mut ncinput, - ) -> char32_t; -} -extern "C" { - #[doc = " Get a file descriptor suitable for input event poll()ing. When this"] - #[doc = " descriptor becomes available, you can call ncdirect_getc_nblock(),"] - #[doc = " and input ought be ready. This file descriptor is *not* necessarily"] - #[doc = " the file descriptor associated with stdin (but it might be!)."] - pub fn ncdirect_inputready_fd(n: *mut ncdirect) -> cty::c_int; -} -extern "C" { - #[doc = " Release 'nc' and any associated resources. 0 on success, non-0 on failure."] - pub fn ncdirect_stop(nc: *mut ncdirect) -> cty::c_int; -} -extern "C" { - #[doc = " Render an image using the specified blitter and scaling, but do not write"] - #[doc = " the result. The image may be arbitrarily many rows -- the output will scroll"] - #[doc = " -- but will only occupy the column of the cursor, and those to the right."] - #[doc = " To actually write (and free) this, invoke ncdirect_raster_frame(). 'maxx'"] - #[doc = " and 'maxy', if greater than 0, are used for scaling; the terminal's geometry"] - #[doc = " is otherwise used."] - pub fn ncdirect_render_frame( - n: *mut ncdirect, - filename: *const cty::c_char, - blitter: ncblitter_e, - scale: ncscale_e, - maxy: cty::c_int, - maxx: cty::c_int, - ) -> *mut ncdirectv; -} -extern "C" { - #[doc = " Takes the result of ncdirect_render_frame() and writes it to the output."] - pub fn ncdirect_raster_frame( - n: *mut ncdirect, - ncdv: *mut ncdirectv, - align: ncalign_e, - ) -> cty::c_int; -} -pub type __builtin_va_list = [__va_list_tag; 1usize]; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct __va_list_tag { - pub gp_offset: cty::c_uint, - pub fp_offset: cty::c_uint, - pub overflow_arg_area: *mut cty::c_void, - pub reg_save_area: *mut cty::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) - ) - ); -} diff --git a/tools/function-summary/history/bindgen_20210406.rs b/tools/function-summary/history/bindgen_20210406.rs deleted file mode 100644 index c01a9fd79..000000000 --- a/tools/function-summary/history/bindgen_20210406.rs +++ /dev/null @@ -1,9549 +0,0 @@ -/* automatically generated by rust-bindgen 0.58.0 */ - -#[repr(C)] -#[derive(Default)] -pub struct __IncompleteArrayField(::core::marker::PhantomData, [T; 0]); -impl __IncompleteArrayField { - #[inline] - pub const fn new() -> Self { - __IncompleteArrayField(::core::marker::PhantomData, []) - } - #[inline] - pub fn as_ptr(&self) -> *const T { - self as *const _ as *const T - } - #[inline] - pub fn as_mut_ptr(&mut self) -> *mut T { - self as *mut _ as *mut T - } - #[inline] - pub unsafe fn as_slice(&self, len: usize) -> &[T] { - ::core::slice::from_raw_parts(self.as_ptr(), len) - } - #[inline] - pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] { - ::core::slice::from_raw_parts_mut(self.as_mut_ptr(), len) - } -} -impl ::core::fmt::Debug for __IncompleteArrayField { - fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - fmt.write_str("__IncompleteArrayField") - } -} -pub const _TIME_H: u32 = 1; -pub const _FEATURES_H: u32 = 1; -pub const __GLIBC_USE_ISOC2X: u32 = 0; -pub const __USE_ISOC11: u32 = 1; -pub const __USE_ISOC99: u32 = 1; -pub const __USE_ISOC95: u32 = 1; -pub const _POSIX_SOURCE: u32 = 1; -pub const _POSIX_C_SOURCE: u32 = 2; -pub const __USE_POSIX_IMPLICITLY: u32 = 1; -pub const __USE_POSIX: u32 = 1; -pub const __USE_POSIX2: u32 = 1; -pub const __USE_XOPEN: u32 = 1; -pub const __USE_FORTIFY_LEVEL: u32 = 0; -pub const __GLIBC_USE_DEPRECATED_GETS: u32 = 0; -pub const __GLIBC_USE_DEPRECATED_SCANF: u32 = 0; -pub const _STDC_PREDEF_H: u32 = 1; -pub const __STDC_IEC_559__: u32 = 1; -pub const __STDC_IEC_559_COMPLEX__: u32 = 1; -pub const __STDC_ISO_10646__: u32 = 201706; -pub const __GNU_LIBRARY__: u32 = 6; -pub const __GLIBC__: u32 = 2; -pub const __GLIBC_MINOR__: u32 = 31; -pub const _SYS_CDEFS_H: u32 = 1; -pub const __glibc_c99_flexarr_available: u32 = 1; -pub const __WORDSIZE: u32 = 64; -pub const __WORDSIZE_TIME64_COMPAT32: u32 = 1; -pub const __SYSCALL_WORDSIZE: u32 = 64; -pub const __LONG_DOUBLE_USES_FLOAT128: u32 = 0; -pub const __HAVE_GENERIC_SELECTION: u32 = 1; -pub const _BITS_TIME_H: u32 = 1; -pub const _BITS_TYPES_H: u32 = 1; -pub const __TIMESIZE: u32 = 64; -pub const _BITS_TYPESIZES_H: u32 = 1; -pub const __OFF_T_MATCHES_OFF64_T: u32 = 1; -pub const __INO_T_MATCHES_INO64_T: u32 = 1; -pub const __RLIM_T_MATCHES_RLIM64_T: u32 = 1; -pub const __STATFS_MATCHES_STATFS64: u32 = 1; -pub const __FD_SETSIZE: u32 = 1024; -pub const _BITS_TIME64_H: u32 = 1; -pub const __clock_t_defined: u32 = 1; -pub const __time_t_defined: u32 = 1; -pub const __struct_tm_defined: u32 = 1; -pub const _STRUCT_TIMESPEC: u32 = 1; -pub const _BITS_ENDIAN_H: u32 = 1; -pub const __LITTLE_ENDIAN: u32 = 1234; -pub const __BIG_ENDIAN: u32 = 4321; -pub const __PDP_ENDIAN: u32 = 3412; -pub const _BITS_ENDIANNESS_H: u32 = 1; -pub const __BYTE_ORDER: u32 = 1234; -pub const __FLOAT_WORD_ORDER: u32 = 1234; -pub const TIME_UTC: u32 = 1; -pub const _UCHAR_H: u32 = 1; -pub const __mbstate_t_defined: u32 = 1; -pub const ____mbstate_t_defined: u32 = 1; -pub const _CTYPE_H: u32 = 1; -pub const _WCHAR_H: u32 = 1; -pub const __GLIBC_USE_LIB_EXT2: u32 = 0; -pub const __GLIBC_USE_IEC_60559_BFP_EXT: u32 = 0; -pub const __GLIBC_USE_IEC_60559_BFP_EXT_C2X: u32 = 0; -pub const __GLIBC_USE_IEC_60559_FUNCS_EXT: u32 = 0; -pub const __GLIBC_USE_IEC_60559_FUNCS_EXT_C2X: u32 = 0; -pub const __GLIBC_USE_IEC_60559_TYPES_EXT: u32 = 0; -pub const __HAVE_FLOAT128: u32 = 0; -pub const __HAVE_DISTINCT_FLOAT128: u32 = 0; -pub const __HAVE_FLOAT64X: u32 = 1; -pub const __HAVE_FLOAT64X_LONG_DOUBLE: u32 = 1; -pub const __HAVE_FLOAT16: u32 = 0; -pub const __HAVE_FLOAT32: u32 = 1; -pub const __HAVE_FLOAT64: u32 = 1; -pub const __HAVE_FLOAT32X: u32 = 1; -pub const __HAVE_FLOAT128X: u32 = 0; -pub const __HAVE_DISTINCT_FLOAT16: u32 = 0; -pub const __HAVE_DISTINCT_FLOAT32: u32 = 0; -pub const __HAVE_DISTINCT_FLOAT64: u32 = 0; -pub const __HAVE_DISTINCT_FLOAT32X: u32 = 0; -pub const __HAVE_DISTINCT_FLOAT64X: u32 = 0; -pub const __HAVE_DISTINCT_FLOAT128X: u32 = 0; -pub const __HAVE_FLOATN_NOT_TYPEDEF: u32 = 0; -pub const __GNUC_VA_LIST: u32 = 1; -pub const _BITS_WCHAR_H: u32 = 1; -pub const __wint_t_defined: u32 = 1; -pub const _WINT_T: u32 = 1; -pub const ____FILE_defined: u32 = 1; -pub const WEOF: u32 = 4294967295; -pub const _BITS_WCTYPE_WCHAR_H: u32 = 1; -pub const _STDIO_H: u32 = 1; -pub const _____fpos_t_defined: u32 = 1; -pub const _____fpos64_t_defined: u32 = 1; -pub const __FILE_defined: u32 = 1; -pub const __struct_FILE_defined: u32 = 1; -pub const _IO_EOF_SEEN: u32 = 16; -pub const _IO_ERR_SEEN: u32 = 32; -pub const _IO_USER_LOCK: u32 = 32768; -pub const _IOFBF: u32 = 0; -pub const _IOLBF: u32 = 1; -pub const _IONBF: u32 = 2; -pub const BUFSIZ: u32 = 8192; -pub const EOF: i32 = -1; -pub const SEEK_SET: u32 = 0; -pub const SEEK_CUR: u32 = 1; -pub const SEEK_END: u32 = 2; -pub const P_tmpdir: &'static [u8; 5usize] = b"/tmp\0"; -pub const _BITS_STDIO_LIM_H: u32 = 1; -pub const L_tmpnam: u32 = 20; -pub const TMP_MAX: u32 = 238328; -pub const FILENAME_MAX: u32 = 4096; -pub const L_ctermid: u32 = 9; -pub const L_cuserid: u32 = 9; -pub const FOPEN_MAX: u32 = 16; -pub const _GETOPT_POSIX_H: u32 = 1; -pub const _GETOPT_CORE_H: u32 = 1; -pub const _STDINT_H: u32 = 1; -pub const _BITS_STDINT_INTN_H: u32 = 1; -pub const _BITS_STDINT_UINTN_H: u32 = 1; -pub const INT8_MIN: i32 = -128; -pub const INT16_MIN: i32 = -32768; -pub const INT32_MIN: i32 = -2147483648; -pub const INT8_MAX: u32 = 127; -pub const INT16_MAX: u32 = 32767; -pub const INT32_MAX: u32 = 2147483647; -pub const UINT8_MAX: u32 = 255; -pub const UINT16_MAX: u32 = 65535; -pub const UINT32_MAX: u32 = 4294967295; -pub const INT_LEAST8_MIN: i32 = -128; -pub const INT_LEAST16_MIN: i32 = -32768; -pub const INT_LEAST32_MIN: i32 = -2147483648; -pub const INT_LEAST8_MAX: u32 = 127; -pub const INT_LEAST16_MAX: u32 = 32767; -pub const INT_LEAST32_MAX: u32 = 2147483647; -pub const UINT_LEAST8_MAX: u32 = 255; -pub const UINT_LEAST16_MAX: u32 = 65535; -pub const UINT_LEAST32_MAX: u32 = 4294967295; -pub const INT_FAST8_MIN: i32 = -128; -pub const INT_FAST16_MIN: i64 = -9223372036854775808; -pub const INT_FAST32_MIN: i64 = -9223372036854775808; -pub const INT_FAST8_MAX: u32 = 127; -pub const INT_FAST16_MAX: u64 = 9223372036854775807; -pub const INT_FAST32_MAX: u64 = 9223372036854775807; -pub const UINT_FAST8_MAX: u32 = 255; -pub const UINT_FAST16_MAX: i32 = -1; -pub const UINT_FAST32_MAX: i32 = -1; -pub const INTPTR_MIN: i64 = -9223372036854775808; -pub const INTPTR_MAX: u64 = 9223372036854775807; -pub const UINTPTR_MAX: i32 = -1; -pub const PTRDIFF_MIN: i64 = -9223372036854775808; -pub const PTRDIFF_MAX: u64 = 9223372036854775807; -pub const SIG_ATOMIC_MIN: i32 = -2147483648; -pub const SIG_ATOMIC_MAX: u32 = 2147483647; -pub const SIZE_MAX: i32 = -1; -pub const WINT_MIN: u32 = 0; -pub const WINT_MAX: u32 = 4294967295; -pub const _STDLIB_H: u32 = 1; -pub const WNOHANG: u32 = 1; -pub const WUNTRACED: u32 = 2; -pub const __WNOTHREAD: u32 = 536870912; -pub const __WALL: u32 = 1073741824; -pub const __WCLONE: u32 = 2147483648; -pub const __W_CONTINUED: u32 = 65535; -pub const __WCOREFLAG: u32 = 128; -pub const __ldiv_t_defined: u32 = 1; -pub const __lldiv_t_defined: u32 = 1; -pub const RAND_MAX: u32 = 2147483647; -pub const EXIT_FAILURE: u32 = 1; -pub const EXIT_SUCCESS: u32 = 0; -pub const _STRING_H: u32 = 1; -pub const _BITS_SIGNUM_H: u32 = 1; -pub const _BITS_SIGNUM_GENERIC_H: u32 = 1; -pub const SIGINT: u32 = 2; -pub const SIGILL: u32 = 4; -pub const SIGABRT: u32 = 6; -pub const SIGFPE: u32 = 8; -pub const SIGSEGV: u32 = 11; -pub const SIGTERM: u32 = 15; -pub const SIGHUP: u32 = 1; -pub const SIGQUIT: u32 = 3; -pub const SIGTRAP: u32 = 5; -pub const SIGKILL: u32 = 9; -pub const SIGBUS: u32 = 10; -pub const SIGSYS: u32 = 12; -pub const SIGPIPE: u32 = 13; -pub const SIGALRM: u32 = 14; -pub const SIGURG: u32 = 16; -pub const SIGSTOP: u32 = 17; -pub const SIGTSTP: u32 = 18; -pub const SIGCONT: u32 = 19; -pub const SIGCHLD: u32 = 20; -pub const SIGTTIN: u32 = 21; -pub const SIGTTOU: u32 = 22; -pub const SIGPOLL: u32 = 23; -pub const SIGXCPU: u32 = 24; -pub const SIGXFSZ: u32 = 25; -pub const SIGVTALRM: u32 = 26; -pub const SIGPROF: u32 = 27; -pub const SIGUSR1: u32 = 30; -pub const SIGUSR2: u32 = 31; -pub const SIGWINCH: u32 = 28; -pub const SIGIO: u32 = 23; -pub const SIGIOT: u32 = 6; -pub const SIGCLD: u32 = 20; -pub const __SIGRTMIN: u32 = 32; -pub const __SIGRTMAX: u32 = 32; -pub const _NSIG: u32 = 33; -pub const SIGSTKFLT: u32 = 16; -pub const SIGPWR: u32 = 30; -pub const __sig_atomic_t_defined: u32 = 1; -pub const __sigset_t_defined: u32 = 1; -pub const _BITS_SIGACTION_H: u32 = 1; -pub const SA_NOCLDSTOP: u32 = 1; -pub const SA_NOCLDWAIT: u32 = 2; -pub const SA_SIGINFO: u32 = 4; -pub const SIG_BLOCK: u32 = 0; -pub const SIG_UNBLOCK: u32 = 1; -pub const SIG_SETMASK: u32 = 2; -pub const _LIBC_LIMITS_H_: u32 = 1; -pub const MB_LEN_MAX: u32 = 16; -pub const _BITS_POSIX1_LIM_H: u32 = 1; -pub const _POSIX_AIO_LISTIO_MAX: u32 = 2; -pub const _POSIX_AIO_MAX: u32 = 1; -pub const _POSIX_ARG_MAX: u32 = 4096; -pub const _POSIX_CHILD_MAX: u32 = 6; -pub const _POSIX_DELAYTIMER_MAX: u32 = 32; -pub const _POSIX_HOST_NAME_MAX: u32 = 255; -pub const _POSIX_LINK_MAX: u32 = 8; -pub const _POSIX_LOGIN_NAME_MAX: u32 = 9; -pub const _POSIX_MAX_CANON: u32 = 255; -pub const _POSIX_MAX_INPUT: u32 = 255; -pub const _POSIX_MQ_OPEN_MAX: u32 = 8; -pub const _POSIX_MQ_PRIO_MAX: u32 = 32; -pub const _POSIX_NAME_MAX: u32 = 14; -pub const _POSIX_NGROUPS_MAX: u32 = 0; -pub const _POSIX_OPEN_MAX: u32 = 16; -pub const _POSIX_FD_SETSIZE: u32 = 16; -pub const _POSIX_PATH_MAX: u32 = 256; -pub const _POSIX_PIPE_BUF: u32 = 512; -pub const _POSIX_RE_DUP_MAX: u32 = 255; -pub const _POSIX_RTSIG_MAX: u32 = 8; -pub const _POSIX_SEM_NSEMS_MAX: u32 = 256; -pub const _POSIX_SEM_VALUE_MAX: u32 = 32767; -pub const _POSIX_SIGQUEUE_MAX: u32 = 32; -pub const _POSIX_SSIZE_MAX: u32 = 32767; -pub const _POSIX_STREAM_MAX: u32 = 8; -pub const _POSIX_SYMLINK_MAX: u32 = 255; -pub const _POSIX_SYMLOOP_MAX: u32 = 8; -pub const _POSIX_TIMER_MAX: u32 = 32; -pub const _POSIX_TTY_NAME_MAX: u32 = 9; -pub const _POSIX_TZNAME_MAX: u32 = 3; -pub const _POSIX_QLIMIT: u32 = 1; -pub const _POSIX_HIWAT: u32 = 512; -pub const _POSIX_UIO_MAXIOV: u32 = 16; -pub const _POSIX_CLOCKRES_MIN: u32 = 20000000; -pub const NR_OPEN: u32 = 1024; -pub const NGROUPS_MAX: u32 = 65536; -pub const ARG_MAX: u32 = 131072; -pub const LINK_MAX: u32 = 127; -pub const MAX_CANON: u32 = 255; -pub const MAX_INPUT: u32 = 255; -pub const NAME_MAX: u32 = 255; -pub const PATH_MAX: u32 = 4096; -pub const PIPE_BUF: u32 = 4096; -pub const XATTR_NAME_MAX: u32 = 255; -pub const XATTR_SIZE_MAX: u32 = 65536; -pub const XATTR_LIST_MAX: u32 = 65536; -pub const RTSIG_MAX: u32 = 32; -pub const _POSIX_THREAD_KEYS_MAX: u32 = 128; -pub const PTHREAD_KEYS_MAX: u32 = 1024; -pub const _POSIX_THREAD_DESTRUCTOR_ITERATIONS: u32 = 4; -pub const PTHREAD_DESTRUCTOR_ITERATIONS: u32 = 4; -pub const _POSIX_THREAD_THREADS_MAX: u32 = 64; -pub const AIO_PRIO_DELTA_MAX: u32 = 20; -pub const PTHREAD_STACK_MIN: u32 = 16384; -pub const DELAYTIMER_MAX: u32 = 2147483647; -pub const TTY_NAME_MAX: u32 = 32; -pub const LOGIN_NAME_MAX: u32 = 256; -pub const HOST_NAME_MAX: u32 = 64; -pub const MQ_PRIO_MAX: u32 = 32768; -pub const SEM_VALUE_MAX: u32 = 2147483647; -pub const _BITS_POSIX2_LIM_H: u32 = 1; -pub const _POSIX2_BC_BASE_MAX: u32 = 99; -pub const _POSIX2_BC_DIM_MAX: u32 = 2048; -pub const _POSIX2_BC_SCALE_MAX: u32 = 99; -pub const _POSIX2_BC_STRING_MAX: u32 = 1000; -pub const _POSIX2_COLL_WEIGHTS_MAX: u32 = 2; -pub const _POSIX2_EXPR_NEST_MAX: u32 = 32; -pub const _POSIX2_LINE_MAX: u32 = 2048; -pub const _POSIX2_RE_DUP_MAX: u32 = 255; -pub const _POSIX2_CHARCLASS_NAME_MAX: u32 = 14; -pub const BC_BASE_MAX: u32 = 99; -pub const BC_DIM_MAX: u32 = 2048; -pub const BC_SCALE_MAX: u32 = 99; -pub const BC_STRING_MAX: u32 = 1000; -pub const COLL_WEIGHTS_MAX: u32 = 255; -pub const EXPR_NEST_MAX: u32 = 32; -pub const LINE_MAX: u32 = 2048; -pub const CHARCLASS_NAME_MAX: u32 = 2048; -pub const RE_DUP_MAX: u32 = 32767; -pub const _XOPEN_LIM_H: u32 = 1; -pub const _XOPEN_IOV_MAX: u32 = 16; -pub const _BITS_UIO_LIM_H: u32 = 1; -pub const __IOV_MAX: u32 = 1024; -pub const IOV_MAX: u32 = 1024; -pub const NL_ARGMAX: u32 = 4096; -pub const NL_LANGMAX: u32 = 2048; -pub const NZERO: u32 = 20; -pub const WORD_BIT: u32 = 32; -pub const LONG_BIT: u32 = 64; -pub const true_: u32 = 1; -pub const false_: u32 = 0; -pub const __bool_true_false_are_defined: u32 = 1; -pub const _BYTESWAP_H: u32 = 1; -pub const _BITS_BYTESWAP_H: u32 = 1; -pub const _NETINET_IN_H: u32 = 1; -pub const _SYS_SOCKET_H: u32 = 1; -pub const __iovec_defined: u32 = 1; -pub const _SYS_TYPES_H: u32 = 1; -pub const __clockid_t_defined: u32 = 1; -pub const __timer_t_defined: u32 = 1; -pub const __BIT_TYPES_DEFINED__: u32 = 1; -pub const PF_UNSPEC: u32 = 0; -pub const PF_LOCAL: u32 = 1; -pub const PF_UNIX: u32 = 1; -pub const PF_FILE: u32 = 1; -pub const PF_INET: u32 = 2; -pub const PF_AX25: u32 = 3; -pub const PF_IPX: u32 = 4; -pub const PF_APPLETALK: u32 = 5; -pub const PF_NETROM: u32 = 6; -pub const PF_BRIDGE: u32 = 7; -pub const PF_ATMPVC: u32 = 8; -pub const PF_X25: u32 = 9; -pub const PF_INET6: u32 = 10; -pub const PF_ROSE: u32 = 11; -pub const PF_DECnet: u32 = 12; -pub const PF_NETBEUI: u32 = 13; -pub const PF_SECURITY: u32 = 14; -pub const PF_KEY: u32 = 15; -pub const PF_NETLINK: u32 = 16; -pub const PF_ROUTE: u32 = 16; -pub const PF_PACKET: u32 = 17; -pub const PF_ASH: u32 = 18; -pub const PF_ECONET: u32 = 19; -pub const PF_ATMSVC: u32 = 20; -pub const PF_RDS: u32 = 21; -pub const PF_SNA: u32 = 22; -pub const PF_IRDA: u32 = 23; -pub const PF_PPPOX: u32 = 24; -pub const PF_WANPIPE: u32 = 25; -pub const PF_LLC: u32 = 26; -pub const PF_IB: u32 = 27; -pub const PF_MPLS: u32 = 28; -pub const PF_CAN: u32 = 29; -pub const PF_TIPC: u32 = 30; -pub const PF_BLUETOOTH: u32 = 31; -pub const PF_IUCV: u32 = 32; -pub const PF_RXRPC: u32 = 33; -pub const PF_ISDN: u32 = 34; -pub const PF_PHONET: u32 = 35; -pub const PF_IEEE802154: u32 = 36; -pub const PF_CAIF: u32 = 37; -pub const PF_ALG: u32 = 38; -pub const PF_NFC: u32 = 39; -pub const PF_VSOCK: u32 = 40; -pub const PF_KCM: u32 = 41; -pub const PF_QIPCRTR: u32 = 42; -pub const PF_SMC: u32 = 43; -pub const PF_XDP: u32 = 44; -pub const PF_MAX: u32 = 45; -pub const AF_UNSPEC: u32 = 0; -pub const AF_LOCAL: u32 = 1; -pub const AF_UNIX: u32 = 1; -pub const AF_FILE: u32 = 1; -pub const AF_INET: u32 = 2; -pub const AF_AX25: u32 = 3; -pub const AF_IPX: u32 = 4; -pub const AF_APPLETALK: u32 = 5; -pub const AF_NETROM: u32 = 6; -pub const AF_BRIDGE: u32 = 7; -pub const AF_ATMPVC: u32 = 8; -pub const AF_X25: u32 = 9; -pub const AF_INET6: u32 = 10; -pub const AF_ROSE: u32 = 11; -pub const AF_DECnet: u32 = 12; -pub const AF_NETBEUI: u32 = 13; -pub const AF_SECURITY: u32 = 14; -pub const AF_KEY: u32 = 15; -pub const AF_NETLINK: u32 = 16; -pub const AF_ROUTE: u32 = 16; -pub const AF_PACKET: u32 = 17; -pub const AF_ASH: u32 = 18; -pub const AF_ECONET: u32 = 19; -pub const AF_ATMSVC: u32 = 20; -pub const AF_RDS: u32 = 21; -pub const AF_SNA: u32 = 22; -pub const AF_IRDA: u32 = 23; -pub const AF_PPPOX: u32 = 24; -pub const AF_WANPIPE: u32 = 25; -pub const AF_LLC: u32 = 26; -pub const AF_IB: u32 = 27; -pub const AF_MPLS: u32 = 28; -pub const AF_CAN: u32 = 29; -pub const AF_TIPC: u32 = 30; -pub const AF_BLUETOOTH: u32 = 31; -pub const AF_IUCV: u32 = 32; -pub const AF_RXRPC: u32 = 33; -pub const AF_ISDN: u32 = 34; -pub const AF_PHONET: u32 = 35; -pub const AF_IEEE802154: u32 = 36; -pub const AF_CAIF: u32 = 37; -pub const AF_ALG: u32 = 38; -pub const AF_NFC: u32 = 39; -pub const AF_VSOCK: u32 = 40; -pub const AF_KCM: u32 = 41; -pub const AF_QIPCRTR: u32 = 42; -pub const AF_SMC: u32 = 43; -pub const AF_XDP: u32 = 44; -pub const AF_MAX: u32 = 45; -pub const SOL_RAW: u32 = 255; -pub const SOL_DECNET: u32 = 261; -pub const SOL_X25: u32 = 262; -pub const SOL_PACKET: u32 = 263; -pub const SOL_ATM: u32 = 264; -pub const SOL_AAL: u32 = 265; -pub const SOL_IRDA: u32 = 266; -pub const SOL_NETBEUI: u32 = 267; -pub const SOL_LLC: u32 = 268; -pub const SOL_DCCP: u32 = 269; -pub const SOL_NETLINK: u32 = 270; -pub const SOL_TIPC: u32 = 271; -pub const SOL_RXRPC: u32 = 272; -pub const SOL_PPPOL2TP: u32 = 273; -pub const SOL_BLUETOOTH: u32 = 274; -pub const SOL_PNPIPE: u32 = 275; -pub const SOL_RDS: u32 = 276; -pub const SOL_IUCV: u32 = 277; -pub const SOL_CAIF: u32 = 278; -pub const SOL_ALG: u32 = 279; -pub const SOL_NFC: u32 = 280; -pub const SOL_KCM: u32 = 281; -pub const SOL_TLS: u32 = 282; -pub const SOL_XDP: u32 = 283; -pub const SOMAXCONN: u32 = 4096; -pub const _BITS_SOCKADDR_H: u32 = 1; -pub const _SS_SIZE: u32 = 128; -pub const SO_DEBUG: u32 = 1; -pub const SOL_SOCKET: u32 = 1; -pub const SO_ACCEPTCONN: u32 = 30; -pub const SO_BROADCAST: u32 = 6; -pub const SO_DONTROUTE: u32 = 5; -pub const SO_ERROR: u32 = 4; -pub const SO_KEEPALIVE: u32 = 9; -pub const SO_LINGER: u32 = 13; -pub const SO_OOBINLINE: u32 = 10; -pub const SO_RCVBUF: u32 = 8; -pub const SO_RCVLOWAT: u32 = 18; -pub const SO_RCVTIMEO: u32 = 20; -pub const SO_REUSEADDR: u32 = 2; -pub const SO_SNDBUF: u32 = 7; -pub const SO_SNDLOWAT: u32 = 19; -pub const SO_SNDTIMEO: u32 = 21; -pub const SO_TYPE: u32 = 3; -pub const __USE_KERNEL_IPV6_DEFS: u32 = 0; -pub const IP_OPTIONS: u32 = 4; -pub const IP_HDRINCL: u32 = 3; -pub const IP_TOS: u32 = 1; -pub const IP_TTL: u32 = 2; -pub const IP_RECVOPTS: u32 = 6; -pub const IP_RETOPTS: u32 = 7; -pub const IP_MULTICAST_IF: u32 = 32; -pub const IP_MULTICAST_TTL: u32 = 33; -pub const IP_MULTICAST_LOOP: u32 = 34; -pub const IP_ADD_MEMBERSHIP: u32 = 35; -pub const IP_DROP_MEMBERSHIP: u32 = 36; -pub const IP_UNBLOCK_SOURCE: u32 = 37; -pub const IP_BLOCK_SOURCE: u32 = 38; -pub const IP_ADD_SOURCE_MEMBERSHIP: u32 = 39; -pub const IP_DROP_SOURCE_MEMBERSHIP: u32 = 40; -pub const IP_MSFILTER: u32 = 41; -pub const IP_ROUTER_ALERT: u32 = 5; -pub const IP_PKTINFO: u32 = 8; -pub const IP_PKTOPTIONS: u32 = 9; -pub const IP_PMTUDISC: u32 = 10; -pub const IP_MTU_DISCOVER: u32 = 10; -pub const IP_RECVERR: u32 = 11; -pub const IP_RECVTTL: u32 = 12; -pub const IP_RECVTOS: u32 = 13; -pub const IP_MTU: u32 = 14; -pub const IP_FREEBIND: u32 = 15; -pub const IP_IPSEC_POLICY: u32 = 16; -pub const IP_XFRM_POLICY: u32 = 17; -pub const IP_PASSSEC: u32 = 18; -pub const IP_TRANSPARENT: u32 = 19; -pub const IP_MULTICAST_ALL: u32 = 49; -pub const IP_ORIGDSTADDR: u32 = 20; -pub const IP_RECVORIGDSTADDR: u32 = 20; -pub const IP_MINTTL: u32 = 21; -pub const IP_NODEFRAG: u32 = 22; -pub const IP_CHECKSUM: u32 = 23; -pub const IP_BIND_ADDRESS_NO_PORT: u32 = 24; -pub const IP_RECVFRAGSIZE: u32 = 25; -pub const IP_PMTUDISC_DONT: u32 = 0; -pub const IP_PMTUDISC_WANT: u32 = 1; -pub const IP_PMTUDISC_DO: u32 = 2; -pub const IP_PMTUDISC_PROBE: u32 = 3; -pub const IP_PMTUDISC_INTERFACE: u32 = 4; -pub const IP_PMTUDISC_OMIT: u32 = 5; -pub const IP_UNICAST_IF: u32 = 50; -pub const SOL_IP: u32 = 0; -pub const IP_DEFAULT_MULTICAST_TTL: u32 = 1; -pub const IP_DEFAULT_MULTICAST_LOOP: u32 = 1; -pub const IP_MAX_MEMBERSHIPS: u32 = 20; -pub const IPV6_ADDRFORM: u32 = 1; -pub const IPV6_2292PKTINFO: u32 = 2; -pub const IPV6_2292HOPOPTS: u32 = 3; -pub const IPV6_2292DSTOPTS: u32 = 4; -pub const IPV6_2292RTHDR: u32 = 5; -pub const IPV6_2292PKTOPTIONS: u32 = 6; -pub const IPV6_CHECKSUM: u32 = 7; -pub const IPV6_2292HOPLIMIT: u32 = 8; -pub const IPV6_NEXTHOP: u32 = 9; -pub const IPV6_AUTHHDR: u32 = 10; -pub const IPV6_UNICAST_HOPS: u32 = 16; -pub const IPV6_MULTICAST_IF: u32 = 17; -pub const IPV6_MULTICAST_HOPS: u32 = 18; -pub const IPV6_MULTICAST_LOOP: u32 = 19; -pub const IPV6_JOIN_GROUP: u32 = 20; -pub const IPV6_LEAVE_GROUP: u32 = 21; -pub const IPV6_ROUTER_ALERT: u32 = 22; -pub const IPV6_MTU_DISCOVER: u32 = 23; -pub const IPV6_MTU: u32 = 24; -pub const IPV6_RECVERR: u32 = 25; -pub const IPV6_V6ONLY: u32 = 26; -pub const IPV6_JOIN_ANYCAST: u32 = 27; -pub const IPV6_LEAVE_ANYCAST: u32 = 28; -pub const IPV6_MULTICAST_ALL: u32 = 29; -pub const IPV6_ROUTER_ALERT_ISOLATE: u32 = 30; -pub const IPV6_IPSEC_POLICY: u32 = 34; -pub const IPV6_XFRM_POLICY: u32 = 35; -pub const IPV6_HDRINCL: u32 = 36; -pub const IPV6_RECVPKTINFO: u32 = 49; -pub const IPV6_PKTINFO: u32 = 50; -pub const IPV6_RECVHOPLIMIT: u32 = 51; -pub const IPV6_HOPLIMIT: u32 = 52; -pub const IPV6_RECVHOPOPTS: u32 = 53; -pub const IPV6_HOPOPTS: u32 = 54; -pub const IPV6_RTHDRDSTOPTS: u32 = 55; -pub const IPV6_RECVRTHDR: u32 = 56; -pub const IPV6_RTHDR: u32 = 57; -pub const IPV6_RECVDSTOPTS: u32 = 58; -pub const IPV6_DSTOPTS: u32 = 59; -pub const IPV6_RECVPATHMTU: u32 = 60; -pub const IPV6_PATHMTU: u32 = 61; -pub const IPV6_DONTFRAG: u32 = 62; -pub const IPV6_RECVTCLASS: u32 = 66; -pub const IPV6_TCLASS: u32 = 67; -pub const IPV6_AUTOFLOWLABEL: u32 = 70; -pub const IPV6_ADDR_PREFERENCES: u32 = 72; -pub const IPV6_MINHOPCOUNT: u32 = 73; -pub const IPV6_ORIGDSTADDR: u32 = 74; -pub const IPV6_RECVORIGDSTADDR: u32 = 74; -pub const IPV6_TRANSPARENT: u32 = 75; -pub const IPV6_UNICAST_IF: u32 = 76; -pub const IPV6_RECVFRAGSIZE: u32 = 77; -pub const IPV6_FREEBIND: u32 = 78; -pub const IPV6_ADD_MEMBERSHIP: u32 = 20; -pub const IPV6_DROP_MEMBERSHIP: u32 = 21; -pub const IPV6_RXHOPOPTS: u32 = 54; -pub const IPV6_RXDSTOPTS: u32 = 59; -pub const IPV6_PMTUDISC_DONT: u32 = 0; -pub const IPV6_PMTUDISC_WANT: u32 = 1; -pub const IPV6_PMTUDISC_DO: u32 = 2; -pub const IPV6_PMTUDISC_PROBE: u32 = 3; -pub const IPV6_PMTUDISC_INTERFACE: u32 = 4; -pub const IPV6_PMTUDISC_OMIT: u32 = 5; -pub const SOL_IPV6: u32 = 41; -pub const SOL_ICMPV6: u32 = 58; -pub const IPV6_RTHDR_LOOSE: u32 = 0; -pub const IPV6_RTHDR_STRICT: u32 = 1; -pub const IPV6_RTHDR_TYPE_0: u32 = 0; -pub const IN_CLASSA_NET: u32 = 4278190080; -pub const IN_CLASSA_NSHIFT: u32 = 24; -pub const IN_CLASSA_HOST: u32 = 16777215; -pub const IN_CLASSA_MAX: u32 = 128; -pub const IN_CLASSB_NET: u32 = 4294901760; -pub const IN_CLASSB_NSHIFT: u32 = 16; -pub const IN_CLASSB_HOST: u32 = 65535; -pub const IN_CLASSB_MAX: u32 = 65536; -pub const IN_CLASSC_NET: u32 = 4294967040; -pub const IN_CLASSC_NSHIFT: u32 = 8; -pub const IN_CLASSC_HOST: u32 = 255; -pub const IN_LOOPBACKNET: u32 = 127; -pub const INET_ADDRSTRLEN: u32 = 16; -pub const INET6_ADDRSTRLEN: u32 = 46; -pub const _ENDIAN_H: u32 = 1; -pub const _BITS_UINTN_IDENTITY_H: u32 = 1; -pub const NCKEY_ESC: u32 = 27; -pub const NCKEY_SPACE: u32 = 32; -pub const CELL_ALPHA_HIGHCONTRAST: u32 = 805306368; -pub const CELL_ALPHA_TRANSPARENT: u32 = 536870912; -pub const CELL_ALPHA_BLEND: u32 = 268435456; -pub const CELL_ALPHA_OPAQUE: u32 = 0; -pub const CELL_BGDEFAULT_MASK: u32 = 1073741824; -pub const CELL_FGDEFAULT_MASK: u64 = 4611686018427387904; -pub const CELL_BG_RGB_MASK: u32 = 16777215; -pub const CELL_FG_RGB_MASK: u64 = 72057589742960640; -pub const CELL_BG_PALETTE: u32 = 134217728; -pub const NCPALETTESIZE: u32 = 256; -pub const CELL_FG_PALETTE: u64 = 576460752303423488; -pub const CELL_BG_ALPHA_MASK: u32 = 805306368; -pub const CELL_FG_ALPHA_MASK: u64 = 3458764513820540928; -pub const NCSTYLE_MASK: u32 = 1023; -pub const NCSTYLE_STANDOUT: u32 = 128; -pub const NCSTYLE_UNDERLINE: u32 = 64; -pub const NCSTYLE_REVERSE: u32 = 32; -pub const NCSTYLE_BLINK: u32 = 16; -pub const NCSTYLE_DIM: u32 = 8; -pub const NCSTYLE_BOLD: u32 = 4; -pub const NCSTYLE_INVIS: u32 = 2; -pub const NCSTYLE_PROTECT: u32 = 1; -pub const NCSTYLE_ITALIC: u32 = 256; -pub const NCSTYLE_STRUCK: u32 = 512; -pub const NCSTYLE_NONE: u32 = 0; -pub const NCOPTION_INHIBIT_SETLOCALE: u32 = 1; -pub const NCOPTION_NO_CLEAR_BITMAPS: u32 = 2; -pub const NCOPTION_NO_WINCH_SIGHANDLER: u32 = 4; -pub const NCOPTION_NO_QUIT_SIGHANDLERS: u32 = 8; -pub const NCOPTION_SUPPRESS_BANNERS: u32 = 32; -pub const NCOPTION_NO_ALTERNATE_SCREEN: u32 = 64; -pub const NCOPTION_NO_FONT_CHANGES: u32 = 128; -pub const NCPLANE_OPTION_HORALIGNED: u32 = 1; -pub const NCPLANE_OPTION_VERALIGNED: u32 = 2; -pub const NCPLANE_OPTION_MARGINALIZED: u32 = 4; -pub const WCHAR_MAX_UTF8BYTES: u32 = 6; -pub const NCBOXMASK_TOP: u32 = 1; -pub const NCBOXMASK_RIGHT: u32 = 2; -pub const NCBOXMASK_BOTTOM: u32 = 4; -pub const NCBOXMASK_LEFT: u32 = 8; -pub const NCBOXGRAD_TOP: u32 = 16; -pub const NCBOXGRAD_RIGHT: u32 = 32; -pub const NCBOXGRAD_BOTTOM: u32 = 64; -pub const NCBOXGRAD_LEFT: u32 = 128; -pub const NCBOXCORNER_MASK: u32 = 768; -pub const NCBOXCORNER_SHIFT: u32 = 8; -pub const NCVISUAL_OPTION_NODEGRADE: u32 = 1; -pub const NCVISUAL_OPTION_BLEND: u32 = 2; -pub const NCVISUAL_OPTION_HORALIGNED: u32 = 4; -pub const NCVISUAL_OPTION_VERALIGNED: u32 = 8; -pub const NCREEL_OPTION_INFINITESCROLL: u32 = 1; -pub const NCREEL_OPTION_CIRCULAR: u32 = 2; -pub const PREFIXCOLUMNS: u32 = 7; -pub const IPREFIXCOLUMNS: u32 = 8; -pub const BPREFIXCOLUMNS: u32 = 9; -pub const PREFIXSTRLEN: u32 = 8; -pub const IPREFIXSTRLEN: u32 = 9; -pub const BPREFIXSTRLEN: u32 = 10; -pub const NCMENU_OPTION_BOTTOM: u32 = 1; -pub const NCMENU_OPTION_HIDING: u32 = 2; -pub const NCPROGBAR_OPTION_RETROGRADE: u32 = 1; -pub const NCTABBED_OPTION_BOTTOM: u32 = 1; -pub const NCPLOT_OPTION_LABELTICKSD: u32 = 1; -pub const NCPLOT_OPTION_EXPONENTIALD: u32 = 2; -pub const NCPLOT_OPTION_VERTICALI: u32 = 4; -pub const NCPLOT_OPTION_NODEGRADE: u32 = 8; -pub const NCPLOT_OPTION_DETECTMAXONLY: u32 = 16; -pub const NCPLOT_OPTION_PRINTSAMPLE: u32 = 32; -pub const NCREADER_OPTION_HORSCROLL: u32 = 1; -pub const NCREADER_OPTION_VERSCROLL: u32 = 2; -pub const NCREADER_OPTION_NOCMDKEYS: u32 = 4; -pub const NCREADER_OPTION_CURSOR: u32 = 8; -pub const NCDIRECT_OPTION_INHIBIT_SETLOCALE: u32 = 1; -pub const NCDIRECT_OPTION_INHIBIT_CBREAK: u32 = 2; -pub const NCDIRECT_OPTION_NO_QUIT_SIGHANDLERS: u32 = 8; -pub type size_t = cty::c_ulong; -#[doc = " Convenience types."] -pub type __u_char = cty::c_uchar; -pub type __u_short = cty::c_ushort; -pub type __u_int = cty::c_uint; -pub type __u_long = cty::c_ulong; -#[doc = " Fixed-size types, underlying types depend on word size and compiler."] -pub type __int8_t = cty::c_schar; -pub type __uint8_t = cty::c_uchar; -pub type __int16_t = cty::c_short; -pub type __uint16_t = cty::c_ushort; -pub type __int32_t = cty::c_int; -pub type __uint32_t = cty::c_uint; -pub type __int64_t = cty::c_long; -pub type __uint64_t = cty::c_ulong; -#[doc = " Smallest types with at least a given width."] -pub type __int_least8_t = __int8_t; -pub type __uint_least8_t = __uint8_t; -pub type __int_least16_t = __int16_t; -pub type __uint_least16_t = __uint16_t; -pub type __int_least32_t = __int32_t; -pub type __uint_least32_t = __uint32_t; -pub type __int_least64_t = __int64_t; -pub type __uint_least64_t = __uint64_t; -pub type __quad_t = cty::c_long; -pub type __u_quad_t = cty::c_ulong; -pub type __intmax_t = cty::c_long; -pub type __uintmax_t = cty::c_ulong; -pub type __dev_t = cty::c_ulong; -pub type __uid_t = cty::c_uint; -pub type __gid_t = cty::c_uint; -pub type __ino_t = cty::c_ulong; -pub type __ino64_t = cty::c_ulong; -pub type __mode_t = cty::c_uint; -pub type __nlink_t = cty::c_ulong; -pub type __off_t = cty::c_long; -pub type __off64_t = cty::c_long; -pub type __pid_t = cty::c_int; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct __fsid_t { - pub __val: [cty::c_int; 2usize], -} -#[test] -fn bindgen_test_layout___fsid_t() { - assert_eq!( - ::core::mem::size_of::<__fsid_t>(), - 8usize, - concat!("Size of: ", stringify!(__fsid_t)) - ); - assert_eq!( - ::core::mem::align_of::<__fsid_t>(), - 4usize, - concat!("Alignment of ", stringify!(__fsid_t)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<__fsid_t>())).__val as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__fsid_t), - "::", - stringify!(__val) - ) - ); -} -pub type __clock_t = cty::c_long; -pub type __rlim_t = cty::c_ulong; -pub type __rlim64_t = cty::c_ulong; -pub type __id_t = cty::c_uint; -pub type __time_t = cty::c_long; -pub type __useconds_t = cty::c_uint; -pub type __suseconds_t = cty::c_long; -pub type __daddr_t = cty::c_int; -pub type __key_t = cty::c_int; -pub type __clockid_t = cty::c_int; -pub type __timer_t = *mut cty::c_void; -pub type __blksize_t = cty::c_long; -pub type __blkcnt_t = cty::c_long; -pub type __blkcnt64_t = cty::c_long; -pub type __fsblkcnt_t = cty::c_ulong; -pub type __fsblkcnt64_t = cty::c_ulong; -pub type __fsfilcnt_t = cty::c_ulong; -pub type __fsfilcnt64_t = cty::c_ulong; -pub type __fsword_t = cty::c_long; -pub type __ssize_t = cty::c_long; -pub type __syscall_slong_t = cty::c_long; -pub type __syscall_ulong_t = cty::c_ulong; -#[doc = " These few don't really vary by system, they always correspond"] -#[doc = "to one of the other defined types."] -pub type __loff_t = __off64_t; -pub type __caddr_t = *mut cty::c_char; -pub type __intptr_t = cty::c_long; -pub type __socklen_t = cty::c_uint; -#[doc = " C99: An integer type that can be accessed as an atomic entity,"] -#[doc = "even in the presence of asynchronous interrupts."] -#[doc = "It is not currently necessary for this to be machine-specific."] -pub type __sig_atomic_t = cty::c_int; -extern "C" { - #[doc = " Even though CLOCKS_PER_SEC has such a strange value CLK_TCK"] - #[doc = "presents the real value for clock ticks per second for the system."] - pub fn __sysconf(arg1: cty::c_int) -> cty::c_long; -} -#[doc = " Returned by `clock'."] -pub type clock_t = __clock_t; -#[doc = " Returned by `time'."] -pub type time_t = __time_t; -#[doc = " ISO C `broken-down time' structure."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct tm { - #[doc = " Seconds.\t[0-60] (1 leap second)"] - pub tm_sec: cty::c_int, - #[doc = " Minutes.\t[0-59]"] - pub tm_min: cty::c_int, - #[doc = " Hours.\t[0-23]"] - pub tm_hour: cty::c_int, - #[doc = " Day.\t\t[1-31]"] - pub tm_mday: cty::c_int, - #[doc = " Month.\t[0-11]"] - pub tm_mon: cty::c_int, - #[doc = " Year\t- 1900."] - pub tm_year: cty::c_int, - #[doc = " Day of week.\t[0-6]"] - pub tm_wday: cty::c_int, - #[doc = " Days in year.[0-365]"] - pub tm_yday: cty::c_int, - #[doc = " DST.\t\t[-1/0/1]"] - pub tm_isdst: cty::c_int, - #[doc = " Seconds east of UTC."] - pub __tm_gmtoff: cty::c_long, - #[doc = " Timezone abbreviation."] - pub __tm_zone: *const cty::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) - ) - ); -} -#[doc = " POSIX.1b structure for a time value. This is like a `struct timeval' but"] -#[doc = "has nanoseconds instead of microseconds."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct timespec { - #[doc = " Seconds."] - pub tv_sec: __time_t, - #[doc = " Nanoseconds."] - pub tv_nsec: __syscall_slong_t, -} -#[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) - ) - ); -} -extern "C" { - #[doc = " Time used by the program so far (user time + system time)."] - #[doc = "The result / CLOCKS_PER_SEC is program time in seconds."] - pub fn clock() -> clock_t; -} -extern "C" { - #[doc = " Return the current time and put it in *TIMER if TIMER is not NULL."] - pub fn time(__timer: *mut time_t) -> time_t; -} -extern "C" { - #[doc = " Return the difference between TIME1 and TIME0."] - pub fn difftime(__time1: time_t, __time0: time_t) -> f64; -} -extern "C" { - #[doc = " Return the `time_t' representation of TP and normalize TP."] - pub fn mktime(__tp: *mut tm) -> time_t; -} -extern "C" { - #[doc = " Format TP into S according to FORMAT."] - #[doc = "Write no more than MAXSIZE characters and return the number"] - #[doc = "of characters written, or 0 if it would exceed MAXSIZE."] - pub fn strftime( - __s: *mut cty::c_char, - __maxsize: size_t, - __format: *const cty::c_char, - __tp: *const tm, - ) -> size_t; -} -extern "C" { - #[doc = " Parse S according to FORMAT and store binary time information in TP."] - #[doc = "The return value is a pointer to the first unparsed character in S."] - pub fn strptime( - __s: *const cty::c_char, - __fmt: *const cty::c_char, - __tp: *mut tm, - ) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Return the `struct tm' representation of *TIMER"] - #[doc = "in Universal Coordinated Time (aka Greenwich Mean Time)."] - pub fn gmtime(__timer: *const time_t) -> *mut tm; -} -extern "C" { - #[doc = " Return the `struct tm' representation"] - #[doc = "of *TIMER in the local timezone."] - pub fn localtime(__timer: *const time_t) -> *mut tm; -} -extern "C" { - #[doc = " Return the `struct tm' representation of *TIMER in UTC,"] - #[doc = "using *TP to store the result."] - pub fn gmtime_r(__timer: *const time_t, __tp: *mut tm) -> *mut tm; -} -extern "C" { - #[doc = " Return the `struct tm' representation of *TIMER in local time,"] - #[doc = "using *TP to store the result."] - pub fn localtime_r(__timer: *const time_t, __tp: *mut tm) -> *mut tm; -} -extern "C" { - #[doc = " Return a string of the form \"Day Mon dd hh:mm:ss yyyy\\n\""] - #[doc = "that is the representation of TP in this format."] - pub fn asctime(__tp: *const tm) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Equivalent to `asctime (localtime (timer))'."] - pub fn ctime(__timer: *const time_t) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Return in BUF a string of the form \"Day Mon dd hh:mm:ss yyyy\\n\""] - #[doc = "that is the representation of TP in this format."] - pub fn asctime_r(__tp: *const tm, __buf: *mut cty::c_char) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Equivalent to `asctime_r (localtime_r (timer, *TMP*), buf)'."] - pub fn ctime_r(__timer: *const time_t, __buf: *mut cty::c_char) -> *mut cty::c_char; -} -extern "C" { - pub static mut __tzname: [*mut cty::c_char; 2usize]; -} -extern "C" { - pub static mut __daylight: cty::c_int; -} -extern "C" { - pub static mut __timezone: cty::c_long; -} -extern "C" { - pub static mut tzname: [*mut cty::c_char; 2usize]; -} -extern "C" { - #[doc = " Set time conversion information from the TZ environment variable."] - #[doc = "If TZ is not defined, a locale-dependent default is used."] - pub fn tzset(); -} -extern "C" { - pub static mut daylight: cty::c_int; -} -extern "C" { - pub static mut timezone: cty::c_long; -} -extern "C" { - #[doc = " Set TS to calendar time based in time base BASE."] - pub fn timespec_get(__ts: *mut timespec, __base: cty::c_int) -> cty::c_int; -} -#[doc = " Conversion state information."] -#[repr(C)] -#[derive(Copy, Clone)] -pub struct __mbstate_t { - pub __count: cty::c_int, - #[doc = " Value so far."] - pub __value: __mbstate_t__bindgen_ty_1, -} -#[repr(C)] -#[derive(Copy, Clone)] -pub union __mbstate_t__bindgen_ty_1 { - pub __wch: cty::c_uint, - pub __wchb: [cty::c_char; 4usize], -} -#[test] -fn bindgen_test_layout___mbstate_t__bindgen_ty_1() { - assert_eq!( - ::core::mem::size_of::<__mbstate_t__bindgen_ty_1>(), - 4usize, - concat!("Size of: ", stringify!(__mbstate_t__bindgen_ty_1)) - ); - assert_eq!( - ::core::mem::align_of::<__mbstate_t__bindgen_ty_1>(), - 4usize, - concat!("Alignment of ", stringify!(__mbstate_t__bindgen_ty_1)) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::<__mbstate_t__bindgen_ty_1>())).__wch as *const _ as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__mbstate_t__bindgen_ty_1), - "::", - stringify!(__wch) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::<__mbstate_t__bindgen_ty_1>())).__wchb as *const _ as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__mbstate_t__bindgen_ty_1), - "::", - stringify!(__wchb) - ) - ); -} -#[test] -fn bindgen_test_layout___mbstate_t() { - assert_eq!( - ::core::mem::size_of::<__mbstate_t>(), - 8usize, - concat!("Size of: ", stringify!(__mbstate_t)) - ); - assert_eq!( - ::core::mem::align_of::<__mbstate_t>(), - 4usize, - concat!("Alignment of ", stringify!(__mbstate_t)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<__mbstate_t>())).__count as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__mbstate_t), - "::", - stringify!(__count) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<__mbstate_t>())).__value as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(__mbstate_t), - "::", - stringify!(__value) - ) - ); -} -pub type mbstate_t = __mbstate_t; -#[doc = " Define the 16-bit and 32-bit character types."] -pub type char16_t = __uint_least16_t; -pub type char32_t = __uint_least32_t; -extern "C" { - #[doc = " Write char16_t representation of multibyte character pointed"] - #[doc = "to by S to PC16."] - pub fn mbrtoc16( - __pc16: *mut char16_t, - __s: *const cty::c_char, - __n: size_t, - __p: *mut mbstate_t, - ) -> size_t; -} -extern "C" { - #[doc = " Write multibyte representation of char16_t C16 to S."] - pub fn c16rtomb(__s: *mut cty::c_char, __c16: char16_t, __ps: *mut mbstate_t) -> size_t; -} -extern "C" { - #[doc = " Write char32_t representation of multibyte character pointed"] - #[doc = "to by S to PC32."] - pub fn mbrtoc32( - __pc32: *mut char32_t, - __s: *const cty::c_char, - __n: size_t, - __p: *mut mbstate_t, - ) -> size_t; -} -extern "C" { - #[doc = " Write multibyte representation of char32_t C32 to S."] - pub fn c32rtomb(__s: *mut cty::c_char, __c32: char32_t, __ps: *mut mbstate_t) -> size_t; -} -#[doc = " UPPERCASE."] -pub const _ISupper: cty::c_uint = 256; -#[doc = " lowercase."] -pub const _ISlower: cty::c_uint = 512; -#[doc = " Alphabetic."] -pub const _ISalpha: cty::c_uint = 1024; -#[doc = " Numeric."] -pub const _ISdigit: cty::c_uint = 2048; -#[doc = " Hexadecimal numeric."] -pub const _ISxdigit: cty::c_uint = 4096; -#[doc = " Whitespace."] -pub const _ISspace: cty::c_uint = 8192; -#[doc = " Printing."] -pub const _ISprint: cty::c_uint = 16384; -#[doc = " Graphical."] -pub const _ISgraph: cty::c_uint = 32768; -#[doc = " Blank (usually SPC and TAB)."] -pub const _ISblank: cty::c_uint = 1; -#[doc = " Control character."] -pub const _IScntrl: cty::c_uint = 2; -#[doc = " Punctuation."] -pub const _ISpunct: cty::c_uint = 4; -#[doc = " Alphanumeric."] -pub const _ISalnum: cty::c_uint = 8; -pub type _bindgen_ty_1 = cty::c_uint; -extern "C" { - #[doc = " These are defined in ctype-info.c."] - #[doc = "The declarations here must match those in localeinfo.h."] - #[doc = ""] - #[doc = "In the thread-specific locale model (see `uselocale' in )"] - #[doc = "we cannot use global variables for these as was done in the past."] - #[doc = "Instead, the following accessor functions return the address of"] - #[doc = "each variable, which is local to the current thread if multithreaded."] - #[doc = ""] - #[doc = "These point into arrays of 384, so they can be indexed by any `unsigned"] - #[doc = "char' value [0,255]; by EOF (-1); or by any `signed char' value"] - #[doc = "[-128,-1). ISO C requires that the ctype functions work for `unsigned"] - #[doc = "char' values and for EOF; we also support negative `signed char' values"] - #[doc = "for broken old programs. The case conversion arrays are of `int's"] - #[doc = "rather than `unsigned char's because tolower (EOF) must be EOF, which"] - #[doc = "doesn't fit into an `unsigned char'. But today more important is that"] - #[doc = "the arrays are also used for multi-byte character sets."] - pub fn __ctype_b_loc() -> *mut *const cty::c_ushort; -} -extern "C" { - pub fn __ctype_tolower_loc() -> *mut *const __int32_t; -} -extern "C" { - pub fn __ctype_toupper_loc() -> *mut *const __int32_t; -} -extern "C" { - pub fn isalnum(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn isalpha(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn iscntrl(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn isdigit(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn islower(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn isgraph(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn isprint(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn ispunct(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn isspace(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn isupper(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn isxdigit(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Return the lowercase version of C."] - pub fn tolower(__c: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Return the uppercase version of C."] - pub fn toupper(__c: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn isblank(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Return nonzero iff C is in the ASCII set"] - #[doc = "(i.e., is no more than 7 bits wide)."] - pub fn isascii(__c: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Return the part of C that is in the ASCII set"] - #[doc = "(i.e., the low-order 7 bits of C)."] - pub fn toascii(__c: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn _toupper(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn _tolower(arg1: cty::c_int) -> cty::c_int; -} -pub type _Float32 = f32; -pub type _Float64 = f64; -pub type _Float32x = f64; -pub type _Float64x = u128; -pub type wchar_t = cty::c_int; -pub type va_list = __builtin_va_list; -pub type __gnuc_va_list = __builtin_va_list; -pub type wint_t = cty::c_uint; -pub type __FILE = _IO_FILE; -#[doc = " Scalar type that can hold values which represent locale-specific"] -#[doc = "character classifications."] -pub type wctype_t = cty::c_ulong; -#[doc = " UPPERCASE."] -pub const __ISwupper: cty::c_int = 0; -#[doc = " lowercase."] -pub const __ISwlower: cty::c_int = 1; -#[doc = " Alphabetic."] -pub const __ISwalpha: cty::c_int = 2; -#[doc = " Numeric."] -pub const __ISwdigit: cty::c_int = 3; -#[doc = " Hexadecimal numeric."] -pub const __ISwxdigit: cty::c_int = 4; -#[doc = " Whitespace."] -pub const __ISwspace: cty::c_int = 5; -#[doc = " Printing."] -pub const __ISwprint: cty::c_int = 6; -#[doc = " Graphical."] -pub const __ISwgraph: cty::c_int = 7; -#[doc = " Blank (usually SPC and TAB)."] -pub const __ISwblank: cty::c_int = 8; -#[doc = " Control character."] -pub const __ISwcntrl: cty::c_int = 9; -#[doc = " Punctuation."] -pub const __ISwpunct: cty::c_int = 10; -#[doc = " Alphanumeric."] -pub const __ISwalnum: cty::c_int = 11; -#[doc = " UPPERCASE."] -pub const _ISwupper: cty::c_int = 16777216; -#[doc = " lowercase."] -pub const _ISwlower: cty::c_int = 33554432; -#[doc = " Alphabetic."] -pub const _ISwalpha: cty::c_int = 67108864; -#[doc = " Numeric."] -pub const _ISwdigit: cty::c_int = 134217728; -#[doc = " Hexadecimal numeric."] -pub const _ISwxdigit: cty::c_int = 268435456; -#[doc = " Whitespace."] -pub const _ISwspace: cty::c_int = 536870912; -#[doc = " Printing."] -pub const _ISwprint: cty::c_int = 1073741824; -#[doc = " Graphical."] -pub const _ISwgraph: cty::c_int = -2147483648; -#[doc = " Blank (usually SPC and TAB)."] -pub const _ISwblank: cty::c_int = 65536; -#[doc = " Control character."] -pub const _ISwcntrl: cty::c_int = 131072; -#[doc = " Punctuation."] -pub const _ISwpunct: cty::c_int = 262144; -#[doc = " Alphanumeric."] -pub const _ISwalnum: cty::c_int = 524288; -pub type _bindgen_ty_2 = cty::c_int; -extern "C" { - #[doc = " Test for any wide character for which `iswalpha' or `iswdigit' is"] - #[doc = "true."] - pub fn iswalnum(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any wide character for which `iswupper' or 'iswlower' is"] - #[doc = "true, or any wide character that is one of a locale-specific set of"] - #[doc = "wide-characters for which none of `iswcntrl', `iswdigit',"] - #[doc = "`iswpunct', or `iswspace' is true."] - pub fn iswalpha(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any control wide character."] - pub fn iswcntrl(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any wide character that corresponds to a decimal-digit"] - #[doc = "character."] - pub fn iswdigit(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any wide character for which `iswprint' is true and"] - #[doc = "`iswspace' is false."] - pub fn iswgraph(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any wide character that corresponds to a lowercase letter"] - #[doc = "or is one of a locale-specific set of wide characters for which"] - #[doc = "none of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true."] - pub fn iswlower(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any printing wide character."] - pub fn iswprint(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any printing wide character that is one of a"] - #[doc = "locale-specific et of wide characters for which neither `iswspace'"] - #[doc = "nor `iswalnum' is true."] - pub fn iswpunct(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any wide character that corresponds to a locale-specific"] - #[doc = "set of wide characters for which none of `iswalnum', `iswgraph', or"] - #[doc = "`iswpunct' is true."] - pub fn iswspace(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any wide character that corresponds to an uppercase letter"] - #[doc = "or is one of a locale-specific set of wide character for which none"] - #[doc = "of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true."] - pub fn iswupper(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any wide character that corresponds to a hexadecimal-digit"] - #[doc = "character equivalent to that performed be the functions described"] - #[doc = "in the previous subclause."] - pub fn iswxdigit(__wc: wint_t) -> cty::c_int; -} -extern "C" { - pub fn iswblank(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Construct value that describes a class of wide characters identified"] - #[doc = "by the string argument PROPERTY."] - pub fn wctype(__property: *const cty::c_char) -> wctype_t; -} -extern "C" { - #[doc = " Determine whether the wide-character WC has the property described by"] - #[doc = "DESC."] - pub fn iswctype(__wc: wint_t, __desc: wctype_t) -> cty::c_int; -} -extern "C" { - #[doc = " Converts an uppercase letter to the corresponding lowercase letter."] - pub fn towlower(__wc: wint_t) -> wint_t; -} -extern "C" { - #[doc = " Converts an lowercase letter to the corresponding uppercase letter."] - pub fn towupper(__wc: wint_t) -> wint_t; -} -extern "C" { - #[doc = " Copy SRC to DEST."] - pub fn wcscpy(__dest: *mut wchar_t, __src: *const wchar_t) -> *mut wchar_t; -} -extern "C" { - #[doc = " Copy no more than N wide-characters of SRC to DEST."] - pub fn wcsncpy(__dest: *mut wchar_t, __src: *const wchar_t, __n: size_t) -> *mut wchar_t; -} -extern "C" { - #[doc = " Append SRC onto DEST."] - pub fn wcscat(__dest: *mut wchar_t, __src: *const wchar_t) -> *mut wchar_t; -} -extern "C" { - #[doc = " Append no more than N wide-characters of SRC onto DEST."] - pub fn wcsncat(__dest: *mut wchar_t, __src: *const wchar_t, __n: size_t) -> *mut wchar_t; -} -extern "C" { - #[doc = " Compare S1 and S2."] - pub fn wcscmp(__s1: *const cty::c_int, __s2: *const cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Compare N wide-characters of S1 and S2."] - pub fn wcsncmp( - __s1: *const cty::c_int, - __s2: *const cty::c_int, - __n: cty::c_ulong, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Compare S1 and S2, both interpreted as appropriate to the"] - #[doc = "LC_COLLATE category of the current locale."] - pub fn wcscoll(__s1: *const wchar_t, __s2: *const wchar_t) -> cty::c_int; -} -extern "C" { - #[doc = " Transform S2 into array pointed to by S1 such that if wcscmp is"] - #[doc = "applied to two transformed strings the result is the as applying"] - #[doc = "`wcscoll' to the original strings."] - pub fn wcsxfrm(__s1: *mut wchar_t, __s2: *const wchar_t, __n: size_t) -> size_t; -} -extern "C" { - pub fn wcschr(__wcs: *const cty::c_int, __wc: cty::c_int) -> *mut cty::c_int; -} -extern "C" { - pub fn wcsrchr(__wcs: *const wchar_t, __wc: wchar_t) -> *mut wchar_t; -} -extern "C" { - #[doc = " Return the length of the initial segmet of WCS which"] - #[doc = "consists entirely of wide characters not in REJECT."] - pub fn wcscspn(__wcs: *const wchar_t, __reject: *const wchar_t) -> size_t; -} -extern "C" { - #[doc = " Return the length of the initial segmet of WCS which"] - #[doc = "consists entirely of wide characters in ACCEPT."] - pub fn wcsspn(__wcs: *const wchar_t, __accept: *const wchar_t) -> size_t; -} -extern "C" { - pub fn wcspbrk(__wcs: *const wchar_t, __accept: *const wchar_t) -> *mut wchar_t; -} -extern "C" { - pub fn wcsstr(__haystack: *const wchar_t, __needle: *const wchar_t) -> *mut wchar_t; -} -extern "C" { - #[doc = " Divide WCS into tokens separated by characters in DELIM."] - pub fn wcstok( - __s: *mut wchar_t, - __delim: *const wchar_t, - __ptr: *mut *mut wchar_t, - ) -> *mut wchar_t; -} -extern "C" { - #[doc = " Return the number of wide characters in S."] - pub fn wcslen(__s: *const cty::c_int) -> cty::c_ulong; -} -extern "C" { - pub fn wcswcs(__haystack: *const wchar_t, __needle: *const wchar_t) -> *mut wchar_t; -} -extern "C" { - pub fn wmemchr(__s: *const cty::c_int, __c: cty::c_int, __n: cty::c_ulong) -> *mut cty::c_int; -} -extern "C" { - #[doc = " Compare N wide characters of S1 and S2."] - pub fn wmemcmp( - __s1: *const cty::c_int, - __s2: *const cty::c_int, - __n: cty::c_ulong, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Copy N wide characters of SRC to DEST."] - pub fn wmemcpy( - __s1: *mut cty::c_int, - __s2: *const cty::c_int, - __n: cty::c_ulong, - ) -> *mut cty::c_int; -} -extern "C" { - #[doc = " Copy N wide characters of SRC to DEST, guaranteeing"] - #[doc = "correct behavior for overlapping strings."] - pub fn wmemmove( - __s1: *mut cty::c_int, - __s2: *const cty::c_int, - __n: cty::c_ulong, - ) -> *mut cty::c_int; -} -extern "C" { - #[doc = " Set N wide characters of S to C."] - pub fn wmemset(__s: *mut wchar_t, __c: wchar_t, __n: size_t) -> *mut wchar_t; -} -extern "C" { - #[doc = " Determine whether C constitutes a valid (one-byte) multibyte"] - #[doc = "character."] - pub fn btowc(__c: cty::c_int) -> wint_t; -} -extern "C" { - #[doc = " Determine whether C corresponds to a member of the extended"] - #[doc = "character set whose multibyte representation is a single byte."] - pub fn wctob(__c: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Determine whether PS points to an object representing the initial"] - #[doc = "state."] - pub fn mbsinit(__ps: *const mbstate_t) -> cty::c_int; -} -extern "C" { - #[doc = " Write wide character representation of multibyte character pointed"] - #[doc = "to by S to PWC."] - pub fn mbrtowc( - __pwc: *mut wchar_t, - __s: *const cty::c_char, - __n: size_t, - __p: *mut mbstate_t, - ) -> size_t; -} -extern "C" { - #[doc = " Write multibyte representation of wide character WC to S."] - pub fn wcrtomb(__s: *mut cty::c_char, __wc: wchar_t, __ps: *mut mbstate_t) -> size_t; -} -extern "C" { - #[doc = " Return number of bytes in multibyte character pointed to by S."] - pub fn __mbrlen(__s: *const cty::c_char, __n: size_t, __ps: *mut mbstate_t) -> size_t; -} -extern "C" { - pub fn mbrlen(__s: *const cty::c_char, __n: size_t, __ps: *mut mbstate_t) -> size_t; -} -extern "C" { - #[doc = " Write wide character representation of multibyte character string"] - #[doc = "SRC to DST."] - pub fn mbsrtowcs( - __dst: *mut wchar_t, - __src: *mut *const cty::c_char, - __len: size_t, - __ps: *mut mbstate_t, - ) -> size_t; -} -extern "C" { - #[doc = " Write multibyte character representation of wide character string"] - #[doc = "SRC to DST."] - pub fn wcsrtombs( - __dst: *mut cty::c_char, - __src: *mut *const wchar_t, - __len: size_t, - __ps: *mut mbstate_t, - ) -> size_t; -} -extern "C" { - #[doc = " Determine number of column positions required for C."] - pub fn wcwidth(__c: wchar_t) -> cty::c_int; -} -extern "C" { - #[doc = " Determine number of column positions required for first N wide"] - #[doc = "characters (or fewer if S ends before this) in S."] - pub fn wcswidth(__s: *const wchar_t, __n: size_t) -> cty::c_int; -} -extern "C" { - #[doc = " Convert initial portion of the wide string NPTR to `double'"] - #[doc = "representation."] - pub fn wcstod(__nptr: *const wchar_t, __endptr: *mut *mut wchar_t) -> f64; -} -extern "C" { - #[doc = " Likewise for `float' and `long double' sizes of floating-point numbers."] - pub fn wcstof(__nptr: *const wchar_t, __endptr: *mut *mut wchar_t) -> f32; -} -extern "C" { - #[doc = " Convert initial portion of wide string NPTR to `long int'"] - #[doc = "representation."] - pub fn wcstol( - __nptr: *const wchar_t, - __endptr: *mut *mut wchar_t, - __base: cty::c_int, - ) -> cty::c_long; -} -extern "C" { - #[doc = " Convert initial portion of wide string NPTR to `unsigned long int'"] - #[doc = "representation."] - pub fn wcstoul( - __nptr: *const wchar_t, - __endptr: *mut *mut wchar_t, - __base: cty::c_int, - ) -> cty::c_ulong; -} -extern "C" { - #[doc = " Convert initial portion of wide string NPTR to `long long int'"] - #[doc = "representation."] - pub fn wcstoll( - __nptr: *const wchar_t, - __endptr: *mut *mut wchar_t, - __base: cty::c_int, - ) -> cty::c_longlong; -} -extern "C" { - #[doc = " Convert initial portion of wide string NPTR to `unsigned long long int'"] - #[doc = "representation."] - pub fn wcstoull( - __nptr: *const wchar_t, - __endptr: *mut *mut wchar_t, - __base: cty::c_int, - ) -> cty::c_ulonglong; -} -extern "C" { - #[doc = " Select orientation for stream."] - pub fn fwide(__fp: *mut __FILE, __mode: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fwprintf(__stream: *mut __FILE, __format: *const wchar_t, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to stdout."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn wprintf(__format: *const wchar_t, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output of at most N characters to S."] - pub fn swprintf(__s: *mut wchar_t, __n: size_t, __format: *const wchar_t, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to S from argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn vfwprintf( - __s: *mut __FILE, - __format: *const wchar_t, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to stdout from argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn vwprintf(__format: *const wchar_t, __arg: *mut __va_list_tag) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output of at most N character to S from argument"] - #[doc = "list ARG."] - pub fn vswprintf( - __s: *mut wchar_t, - __n: size_t, - __format: *const wchar_t, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fwscanf(__stream: *mut __FILE, __format: *const wchar_t, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from stdin."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn wscanf(__format: *const wchar_t, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S."] - pub fn swscanf(__s: *const wchar_t, __format: *const wchar_t, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - #[link_name = "\u{1}__isoc99_fwscanf"] - pub fn fwscanf1(__stream: *mut __FILE, __format: *const wchar_t, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from stdin."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - #[link_name = "\u{1}__isoc99_wscanf"] - pub fn wscanf1(__format: *const wchar_t, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S."] - #[link_name = "\u{1}__isoc99_swscanf"] - pub fn swscanf1(__s: *const wchar_t, __format: *const wchar_t, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S into argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn vfwscanf( - __s: *mut __FILE, - __format: *const wchar_t, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from stdin into argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn vwscanf(__format: *const wchar_t, __arg: *mut __va_list_tag) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S into argument list ARG."] - pub fn vswscanf( - __s: *const wchar_t, - __format: *const wchar_t, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Read a character from STREAM."] - #[doc = ""] - #[doc = "These functions are possible cancellation points and therefore not"] - #[doc = "marked with __THROW."] - pub fn fgetwc(__stream: *mut __FILE) -> wint_t; -} -extern "C" { - pub fn getwc(__stream: *mut __FILE) -> wint_t; -} -extern "C" { - #[doc = " Read a character from stdin."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn getwchar() -> wint_t; -} -extern "C" { - #[doc = " Write a character to STREAM."] - #[doc = ""] - #[doc = "These functions are possible cancellation points and therefore not"] - #[doc = "marked with __THROW."] - pub fn fputwc(__wc: wchar_t, __stream: *mut __FILE) -> wint_t; -} -extern "C" { - pub fn putwc(__wc: wchar_t, __stream: *mut __FILE) -> wint_t; -} -extern "C" { - #[doc = " Write a character to stdout."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn putwchar(__wc: wchar_t) -> wint_t; -} -extern "C" { - #[doc = " Get a newline-terminated wide character string of finite length"] - #[doc = "from STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fgetws(__ws: *mut wchar_t, __n: cty::c_int, __stream: *mut __FILE) -> *mut wchar_t; -} -extern "C" { - #[doc = " Write a string to STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fputws(__ws: *const wchar_t, __stream: *mut __FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Push a character back onto the input buffer of STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn ungetwc(__wc: wint_t, __stream: *mut __FILE) -> wint_t; -} -extern "C" { - #[doc = " Format TP into S according to FORMAT."] - #[doc = "Write no more than MAXSIZE wide characters and return the number"] - #[doc = "of wide characters written, or 0 if it would exceed MAXSIZE."] - pub fn wcsftime( - __s: *mut wchar_t, - __maxsize: size_t, - __format: *const wchar_t, - __tp: *const tm, - ) -> size_t; -} -#[doc = " The tag name of this struct is _G_fpos_t to preserve historic"] -#[doc = "C++ mangled names for functions taking fpos_t arguments."] -#[doc = "That name should not be used in new code."] -#[repr(C)] -#[derive(Copy, Clone)] -pub struct _G_fpos_t { - pub __pos: __off_t, - pub __state: __mbstate_t, -} -#[test] -fn bindgen_test_layout__G_fpos_t() { - assert_eq!( - ::core::mem::size_of::<_G_fpos_t>(), - 16usize, - concat!("Size of: ", stringify!(_G_fpos_t)) - ); - assert_eq!( - ::core::mem::align_of::<_G_fpos_t>(), - 8usize, - concat!("Alignment of ", stringify!(_G_fpos_t)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_G_fpos_t>())).__pos as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(_G_fpos_t), - "::", - stringify!(__pos) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_G_fpos_t>())).__state as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(_G_fpos_t), - "::", - stringify!(__state) - ) - ); -} -#[doc = " The tag name of this struct is _G_fpos_t to preserve historic"] -#[doc = "C++ mangled names for functions taking fpos_t arguments."] -#[doc = "That name should not be used in new code."] -pub type __fpos_t = _G_fpos_t; -#[doc = " The tag name of this struct is _G_fpos64_t to preserve historic"] -#[doc = "C++ mangled names for functions taking fpos_t and/or fpos64_t"] -#[doc = "arguments. That name should not be used in new code."] -#[repr(C)] -#[derive(Copy, Clone)] -pub struct _G_fpos64_t { - pub __pos: __off64_t, - pub __state: __mbstate_t, -} -#[test] -fn bindgen_test_layout__G_fpos64_t() { - assert_eq!( - ::core::mem::size_of::<_G_fpos64_t>(), - 16usize, - concat!("Size of: ", stringify!(_G_fpos64_t)) - ); - assert_eq!( - ::core::mem::align_of::<_G_fpos64_t>(), - 8usize, - concat!("Alignment of ", stringify!(_G_fpos64_t)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_G_fpos64_t>())).__pos as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(_G_fpos64_t), - "::", - stringify!(__pos) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_G_fpos64_t>())).__state as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(_G_fpos64_t), - "::", - stringify!(__state) - ) - ); -} -#[doc = " The tag name of this struct is _G_fpos64_t to preserve historic"] -#[doc = "C++ mangled names for functions taking fpos_t and/or fpos64_t"] -#[doc = "arguments. That name should not be used in new code."] -pub type __fpos64_t = _G_fpos64_t; -#[doc = " The opaque type of streams. This is the definition used elsewhere."] -pub type FILE = _IO_FILE; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct _IO_marker { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct _IO_codecvt { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct _IO_wide_data { - _unused: [u8; 0], -} -pub type _IO_lock_t = cty::c_void; -#[doc = " The tag name of this struct is _IO_FILE to preserve historic"] -#[doc = "C++ mangled names for functions taking FILE* arguments."] -#[doc = "That name should not be used in new code."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct _IO_FILE { - #[doc = " High-order word is _IO_MAGIC; rest is flags."] - pub _flags: cty::c_int, - #[doc = " Current read pointer"] - pub _IO_read_ptr: *mut cty::c_char, - #[doc = " End of get area."] - pub _IO_read_end: *mut cty::c_char, - #[doc = " Start of putback+get area."] - pub _IO_read_base: *mut cty::c_char, - #[doc = " Start of put area."] - pub _IO_write_base: *mut cty::c_char, - #[doc = " Current put pointer."] - pub _IO_write_ptr: *mut cty::c_char, - #[doc = " End of put area."] - pub _IO_write_end: *mut cty::c_char, - #[doc = " Start of reserve area."] - pub _IO_buf_base: *mut cty::c_char, - #[doc = " End of reserve area."] - pub _IO_buf_end: *mut cty::c_char, - #[doc = " Pointer to start of non-current get area."] - pub _IO_save_base: *mut cty::c_char, - #[doc = " Pointer to first valid character of backup area"] - pub _IO_backup_base: *mut cty::c_char, - #[doc = " Pointer to end of non-current get area."] - pub _IO_save_end: *mut cty::c_char, - pub _markers: *mut _IO_marker, - pub _chain: *mut _IO_FILE, - pub _fileno: cty::c_int, - pub _flags2: cty::c_int, - #[doc = " This used to be _offset but it's too small."] - pub _old_offset: __off_t, - #[doc = " 1+column number of pbase(); 0 is unknown."] - pub _cur_column: cty::c_ushort, - pub _vtable_offset: cty::c_schar, - pub _shortbuf: [cty::c_char; 1usize], - pub _lock: *mut _IO_lock_t, - pub _offset: __off64_t, - #[doc = " Wide character stream stuff."] - pub _codecvt: *mut _IO_codecvt, - pub _wide_data: *mut _IO_wide_data, - pub _freeres_list: *mut _IO_FILE, - pub _freeres_buf: *mut cty::c_void, - pub __pad5: size_t, - pub _mode: cty::c_int, - #[doc = " Make sure we don't get into trouble again."] - pub _unused2: [cty::c_char; 20usize], -} -#[test] -fn bindgen_test_layout__IO_FILE() { - assert_eq!( - ::core::mem::size_of::<_IO_FILE>(), - 216usize, - concat!("Size of: ", stringify!(_IO_FILE)) - ); - assert_eq!( - ::core::mem::align_of::<_IO_FILE>(), - 8usize, - concat!("Alignment of ", stringify!(_IO_FILE)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._flags as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_flags) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_read_ptr as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_read_ptr) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_read_end as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_read_end) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_read_base as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_read_base) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_write_base as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_write_base) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_write_ptr as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_write_ptr) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_write_end as *const _ as usize }, - 48usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_write_end) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_buf_base as *const _ as usize }, - 56usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_buf_base) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_buf_end as *const _ as usize }, - 64usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_buf_end) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_save_base as *const _ as usize }, - 72usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_save_base) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_backup_base as *const _ as usize }, - 80usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_backup_base) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_save_end as *const _ as usize }, - 88usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_save_end) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._markers as *const _ as usize }, - 96usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_markers) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._chain as *const _ as usize }, - 104usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_chain) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._fileno as *const _ as usize }, - 112usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_fileno) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._flags2 as *const _ as usize }, - 116usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_flags2) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._old_offset as *const _ as usize }, - 120usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_old_offset) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._cur_column as *const _ as usize }, - 128usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_cur_column) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._vtable_offset as *const _ as usize }, - 130usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_vtable_offset) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._shortbuf as *const _ as usize }, - 131usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_shortbuf) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._lock as *const _ as usize }, - 136usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_lock) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._offset as *const _ as usize }, - 144usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_offset) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._codecvt as *const _ as usize }, - 152usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_codecvt) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._wide_data as *const _ as usize }, - 160usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_wide_data) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._freeres_list as *const _ as usize }, - 168usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_freeres_list) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._freeres_buf as *const _ as usize }, - 176usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_freeres_buf) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>())).__pad5 as *const _ as usize }, - 184usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(__pad5) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._mode as *const _ as usize }, - 192usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_mode) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._unused2 as *const _ as usize }, - 196usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_unused2) - ) - ); -} -pub type fpos_t = __fpos_t; -extern "C" { - pub static mut stdin: *mut FILE; -} -extern "C" { - pub static mut stdout: *mut FILE; -} -extern "C" { - pub static mut stderr: *mut FILE; -} -extern "C" { - #[doc = " Remove file FILENAME."] - pub fn remove(__filename: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Rename file OLD to NEW."] - pub fn rename(__old: *const cty::c_char, __new: *const cty::c_char) -> cty::c_int; -} -extern "C" { - pub fn tmpfile() -> *mut FILE; -} -extern "C" { - #[doc = " Generate a temporary filename."] - pub fn tmpnam(__s: *mut cty::c_char) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Generate a unique temporary filename using up to five characters of PFX"] - #[doc = "if it is not NULL. The directory to put this file in is searched for"] - #[doc = "as follows: First the environment variable \"TMPDIR\" is checked."] - #[doc = "If it contains the name of a writable directory, that directory is used."] - #[doc = "If not and if DIR is not NULL, that value is checked. If that fails,"] - #[doc = "P_tmpdir is tried and finally \"/tmp\". The storage for the filename"] - #[doc = "is allocated by `malloc'."] - pub fn tempnam(__dir: *const cty::c_char, __pfx: *const cty::c_char) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Close STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fclose(__stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Flush STREAM, or all streams if STREAM is NULL."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fflush(__stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Open a file and create a new stream for it."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fopen(__filename: *const cty::c_char, __modes: *const cty::c_char) -> *mut FILE; -} -extern "C" { - #[doc = " Open a file, replacing an existing stream with it."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn freopen( - __filename: *const cty::c_char, - __modes: *const cty::c_char, - __stream: *mut FILE, - ) -> *mut FILE; -} -extern "C" { - #[doc = " Create a new stream that refers to an existing system file descriptor."] - pub fn fdopen(__fd: cty::c_int, __modes: *const cty::c_char) -> *mut FILE; -} -extern "C" { - #[doc = " If BUF is NULL, make STREAM unbuffered."] - #[doc = "Else make it use buffer BUF, of size BUFSIZ."] - pub fn setbuf(__stream: *mut FILE, __buf: *mut cty::c_char); -} -extern "C" { - #[doc = " Make STREAM use buffering mode MODE."] - #[doc = "If BUF is not NULL, use N bytes of it for buffering;"] - #[doc = "else allocate an internal buffer N bytes long."] - pub fn setvbuf( - __stream: *mut FILE, - __buf: *mut cty::c_char, - __modes: cty::c_int, - __n: size_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fprintf(__stream: *mut FILE, __format: *const cty::c_char, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to stdout."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn printf(__format: *const cty::c_char, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to S."] - pub fn sprintf(__s: *mut cty::c_char, __format: *const cty::c_char, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to S from argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn vfprintf( - __s: *mut FILE, - __format: *const cty::c_char, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to stdout from argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn vprintf(__format: *const cty::c_char, __arg: *mut __va_list_tag) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to S from argument list ARG."] - pub fn vsprintf( - __s: *mut cty::c_char, - __format: *const cty::c_char, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Maximum chars of output to write in MAXLEN."] - pub fn snprintf( - __s: *mut cty::c_char, - __maxlen: cty::c_ulong, - __format: *const cty::c_char, - ... - ) -> cty::c_int; -} -extern "C" { - pub fn vsnprintf( - __s: *mut cty::c_char, - __maxlen: cty::c_ulong, - __format: *const cty::c_char, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fscanf(__stream: *mut FILE, __format: *const cty::c_char, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from stdin."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn scanf(__format: *const cty::c_char, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S."] - pub fn sscanf(__s: *const cty::c_char, __format: *const cty::c_char, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - #[link_name = "\u{1}__isoc99_fscanf"] - pub fn fscanf1(__stream: *mut FILE, __format: *const cty::c_char, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from stdin."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - #[link_name = "\u{1}__isoc99_scanf"] - pub fn scanf1(__format: *const cty::c_char, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S."] - #[link_name = "\u{1}__isoc99_sscanf"] - pub fn sscanf1(__s: *const cty::c_char, __format: *const cty::c_char, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S into argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn vfscanf( - __s: *mut FILE, - __format: *const cty::c_char, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from stdin into argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn vscanf(__format: *const cty::c_char, __arg: *mut __va_list_tag) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S into argument list ARG."] - pub fn vsscanf( - __s: *const cty::c_char, - __format: *const cty::c_char, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S into argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - #[link_name = "\u{1}__isoc99_vfscanf"] - pub fn vfscanf1( - __s: *mut FILE, - __format: *const cty::c_char, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from stdin into argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - #[link_name = "\u{1}__isoc99_vscanf"] - pub fn vscanf1(__format: *const cty::c_char, __arg: *mut __va_list_tag) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S into argument list ARG."] - #[link_name = "\u{1}__isoc99_vsscanf"] - pub fn vsscanf1( - __s: *const cty::c_char, - __format: *const cty::c_char, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Read a character from STREAM."] - #[doc = ""] - #[doc = "These functions are possible cancellation points and therefore not"] - #[doc = "marked with __THROW."] - pub fn fgetc(__stream: *mut FILE) -> cty::c_int; -} -extern "C" { - pub fn getc(__stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Read a character from stdin."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn getchar() -> cty::c_int; -} -extern "C" { - #[doc = " Write a character to STREAM."] - #[doc = ""] - #[doc = "These functions are possible cancellation points and therefore not"] - #[doc = "marked with __THROW."] - #[doc = ""] - #[doc = "These functions is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fputc(__c: cty::c_int, __stream: *mut FILE) -> cty::c_int; -} -extern "C" { - pub fn putc(__c: cty::c_int, __stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Write a character to stdout."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn putchar(__c: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Get a word (int) from STREAM."] - pub fn getw(__stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Write a word (int) to STREAM."] - pub fn putw(__w: cty::c_int, __stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Get a newline-terminated string of finite length from STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fgets(__s: *mut cty::c_char, __n: cty::c_int, __stream: *mut FILE) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Write a string to STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fputs(__s: *const cty::c_char, __stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Write a string, followed by a newline, to stdout."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn puts(__s: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Push a character back onto the input buffer of STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn ungetc(__c: cty::c_int, __stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Read chunks of generic data from STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fread( - __ptr: *mut cty::c_void, - __size: cty::c_ulong, - __n: cty::c_ulong, - __stream: *mut FILE, - ) -> cty::c_ulong; -} -extern "C" { - #[doc = " Write chunks of generic data to STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fwrite( - __ptr: *const cty::c_void, - __size: cty::c_ulong, - __n: cty::c_ulong, - __s: *mut FILE, - ) -> cty::c_ulong; -} -extern "C" { - #[doc = " Seek to a certain position on STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fseek(__stream: *mut FILE, __off: cty::c_long, __whence: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Return the current position of STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn ftell(__stream: *mut FILE) -> cty::c_long; -} -extern "C" { - #[doc = " Rewind to the beginning of STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn rewind(__stream: *mut FILE); -} -extern "C" { - #[doc = " Get STREAM's position."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fgetpos(__stream: *mut FILE, __pos: *mut fpos_t) -> cty::c_int; -} -extern "C" { - #[doc = " Set STREAM's position."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fsetpos(__stream: *mut FILE, __pos: *const fpos_t) -> cty::c_int; -} -extern "C" { - #[doc = " Clear the error and EOF indicators for STREAM."] - pub fn clearerr(__stream: *mut FILE); -} -extern "C" { - #[doc = " Return the EOF indicator for STREAM."] - pub fn feof(__stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Return the error indicator for STREAM."] - pub fn ferror(__stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Print a message describing the meaning of the value of errno."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn perror(__s: *const cty::c_char); -} -extern "C" { - #[doc = " Return the system file descriptor for STREAM."] - pub fn fileno(__stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Create a new stream connected to a pipe running the given command."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn popen(__command: *const cty::c_char, __modes: *const cty::c_char) -> *mut FILE; -} -extern "C" { - #[doc = " Close a stream opened by popen and return the status of its child."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn pclose(__stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Return the name of the controlling terminal."] - pub fn ctermid(__s: *mut cty::c_char) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Return the name of the current user."] - pub fn cuserid(__s: *mut cty::c_char) -> *mut cty::c_char; -} -extern "C" { - pub static mut optarg: *mut cty::c_char; -} -extern "C" { - pub static mut optind: cty::c_int; -} -extern "C" { - pub static mut opterr: cty::c_int; -} -extern "C" { - pub static mut optopt: cty::c_int; -} -extern "C" { - #[doc = " Get definitions and prototypes for functions to process the"] - #[doc = "arguments in ARGV (ARGC of them, minus the program name) for"] - #[doc = "options given in OPTS."] - #[doc = ""] - #[doc = "Return the option character from OPTS just read. Return -1 when"] - #[doc = "there are no more options. For unrecognized options, or options"] - #[doc = "missing arguments, 'optopt' is set to the option letter, and '?' is"] - #[doc = "returned."] - #[doc = ""] - #[doc = "The OPTS string is a list of characters which are recognized option"] - #[doc = "letters, optionally followed by colons, specifying that that letter"] - #[doc = "takes an argument, to be placed in 'optarg'."] - #[doc = ""] - #[doc = "If a letter in OPTS is followed by two colons, its argument is"] - #[doc = "optional. This behavior is specific to the GNU 'getopt'."] - #[doc = ""] - #[doc = "The argument '--' causes premature termination of argument"] - #[doc = "scanning, explicitly telling 'getopt' that there are no more"] - #[doc = "options."] - #[doc = ""] - #[doc = "If OPTS begins with '-', then non-option arguments are treated as"] - #[doc = "arguments to the option '\\1'. This behavior is specific to the GNU"] - #[doc = "'getopt'. If OPTS begins with '+', or POSIXLY_CORRECT is set in"] - #[doc = "the environment, then do not permute arguments."] - #[doc = ""] - #[doc = "For standards compliance, the 'argv' argument has the type"] - #[doc = "char *const *, but this is inaccurate; if argument permutation is"] - #[doc = "enabled, the argv array (not the strings it points to) must be"] - #[doc = "writable."] - pub fn getopt( - ___argc: cty::c_int, - ___argv: *const *mut cty::c_char, - __shortopts: *const cty::c_char, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Slow-path routines used by the optimized inline functions in"] - #[doc = "bits/stdio.h."] - pub fn __uflow(arg1: *mut FILE) -> cty::c_int; -} -extern "C" { - pub fn __overflow(arg1: *mut FILE, arg2: cty::c_int) -> cty::c_int; -} -#[doc = " Signed."] -pub type int_least8_t = __int_least8_t; -pub type int_least16_t = __int_least16_t; -pub type int_least32_t = __int_least32_t; -pub type int_least64_t = __int_least64_t; -#[doc = " Unsigned."] -pub type uint_least8_t = __uint_least8_t; -pub type uint_least16_t = __uint_least16_t; -pub type uint_least32_t = __uint_least32_t; -pub type uint_least64_t = __uint_least64_t; -#[doc = " Signed."] -pub type int_fast8_t = cty::c_schar; -pub type int_fast16_t = cty::c_long; -pub type int_fast32_t = cty::c_long; -pub type int_fast64_t = cty::c_long; -#[doc = " Unsigned."] -pub type uint_fast8_t = cty::c_uchar; -pub type uint_fast16_t = cty::c_ulong; -pub type uint_fast32_t = cty::c_ulong; -pub type uint_fast64_t = cty::c_ulong; -#[doc = " Largest integral types."] -pub type intmax_t = __intmax_t; -pub type uintmax_t = __uintmax_t; -#[doc = " Returned by `div'."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct div_t { - #[doc = " Quotient."] - pub quot: cty::c_int, - #[doc = " Remainder."] - pub rem: cty::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) - ) - ); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ldiv_t { - #[doc = " Quotient."] - pub quot: cty::c_long, - #[doc = " Remainder."] - pub rem: cty::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) - ) - ); -} -#[doc = " Returned by `lldiv'."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct lldiv_t { - #[doc = " Quotient."] - pub quot: cty::c_longlong, - #[doc = " Remainder."] - pub rem: cty::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) - ) - ); -} -extern "C" { - pub fn __ctype_get_mb_cur_max() -> size_t; -} -extern "C" { - #[doc = " Convert a string to a floating-point number."] - pub fn atof(__nptr: *const cty::c_char) -> f64; -} -extern "C" { - #[doc = " Convert a string to an integer."] - pub fn atoi(__nptr: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Convert a string to a long integer."] - pub fn atol(__nptr: *const cty::c_char) -> cty::c_long; -} -extern "C" { - #[doc = " Convert a string to a long long integer."] - pub fn atoll(__nptr: *const cty::c_char) -> cty::c_longlong; -} -extern "C" { - #[doc = " Convert a string to a floating-point number."] - pub fn strtod(__nptr: *const cty::c_char, __endptr: *mut *mut cty::c_char) -> f64; -} -extern "C" { - #[doc = " Likewise for `float' and `long double' sizes of floating-point numbers."] - pub fn strtof(__nptr: *const cty::c_char, __endptr: *mut *mut cty::c_char) -> f32; -} -extern "C" { - #[doc = " Convert a string to a long integer."] - pub fn strtol( - __nptr: *const cty::c_char, - __endptr: *mut *mut cty::c_char, - __base: cty::c_int, - ) -> cty::c_long; -} -extern "C" { - #[doc = " Convert a string to an unsigned long integer."] - pub fn strtoul( - __nptr: *const cty::c_char, - __endptr: *mut *mut cty::c_char, - __base: cty::c_int, - ) -> cty::c_ulong; -} -extern "C" { - #[doc = " Convert a string to a quadword integer."] - pub fn strtoll( - __nptr: *const cty::c_char, - __endptr: *mut *mut cty::c_char, - __base: cty::c_int, - ) -> cty::c_longlong; -} -extern "C" { - #[doc = " Convert a string to an unsigned quadword integer."] - pub fn strtoull( - __nptr: *const cty::c_char, - __endptr: *mut *mut cty::c_char, - __base: cty::c_int, - ) -> cty::c_ulonglong; -} -extern "C" { - #[doc = " Return a random integer between 0 and RAND_MAX inclusive."] - pub fn rand() -> cty::c_int; -} -extern "C" { - #[doc = " Seed the random number generator with the given number."] - pub fn srand(__seed: cty::c_uint); -} -extern "C" { - #[doc = " Return non-negative, double-precision floating-point value in [0.0,1.0)."] - pub fn drand48() -> f64; -} -extern "C" { - pub fn erand48(__xsubi: *mut cty::c_ushort) -> f64; -} -extern "C" { - #[doc = " Return non-negative, long integer in [0,2^31)."] - pub fn lrand48() -> cty::c_long; -} -extern "C" { - pub fn nrand48(__xsubi: *mut cty::c_ushort) -> cty::c_long; -} -extern "C" { - #[doc = " Return signed, long integers in [-2^31,2^31)."] - pub fn mrand48() -> cty::c_long; -} -extern "C" { - pub fn jrand48(__xsubi: *mut cty::c_ushort) -> cty::c_long; -} -extern "C" { - #[doc = " Seed random number generator."] - pub fn srand48(__seedval: cty::c_long); -} -extern "C" { - pub fn seed48(__seed16v: *mut cty::c_ushort) -> *mut cty::c_ushort; -} -extern "C" { - pub fn lcong48(__param: *mut cty::c_ushort); -} -extern "C" { - #[doc = " Allocate SIZE bytes of memory."] - pub fn malloc(__size: cty::c_ulong) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Allocate NMEMB elements of SIZE bytes each, all initialized to 0."] - pub fn calloc(__nmemb: cty::c_ulong, __size: cty::c_ulong) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Re-allocate the previously allocated block"] - #[doc = "in PTR, making the new block SIZE bytes long. */"] - #[doc = "the same pointer that was passed to it, aliasing needs to be allowed"] - #[doc = "between objects pointed by the old and new pointers."] - pub fn realloc(__ptr: *mut cty::c_void, __size: cty::c_ulong) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Free a block allocated by `malloc', `realloc' or `calloc'."] - pub fn free(__ptr: *mut cty::c_void); -} -extern "C" { - #[doc = " ISO C variant of aligned allocation."] - pub fn aligned_alloc(__alignment: size_t, __size: size_t) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Abort execution and generate a core-dump."] - pub fn abort(); -} -extern "C" { - #[doc = " Register a function to be called when `exit' is called."] - pub fn atexit(__func: ::core::option::Option) -> cty::c_int; -} -extern "C" { - pub fn at_quick_exit(__func: ::core::option::Option) -> cty::c_int; -} -extern "C" { - #[doc = " Call all functions registered with `atexit' and `on_exit',"] - #[doc = "in the reverse of the order in which they were registered,"] - #[doc = "perform stdio cleanup, and terminate program execution with STATUS."] - pub fn exit(__status: cty::c_int); -} -extern "C" { - #[doc = " Call all functions registered with `at_quick_exit' in the reverse"] - #[doc = "of the order in which they were registered and terminate program"] - #[doc = "execution with STATUS."] - pub fn quick_exit(__status: cty::c_int); -} -extern "C" { - #[doc = " Terminate the program with STATUS without calling any of the"] - #[doc = "functions registered with `atexit' or `on_exit'."] - pub fn _Exit(__status: cty::c_int); -} -extern "C" { - #[doc = " Return the value of envariable NAME, or NULL if it doesn't exist."] - pub fn getenv(__name: *const cty::c_char) -> *mut cty::c_char; -} -extern "C" { - #[doc = " The SVID says this is in , but this seems a better place.\t*/"] - #[doc = "If there is no `=', remove NAME from the environment."] - pub fn putenv(__string: *mut cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Execute the given line as a shell command."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn system(__command: *const cty::c_char) -> cty::c_int; -} -pub type __compar_fn_t = ::core::option::Option< - unsafe extern "C" fn(arg1: *const cty::c_void, arg2: *const cty::c_void) -> cty::c_int, ->; -extern "C" { - #[doc = " Do a binary search for KEY in BASE, which consists of NMEMB elements"] - #[doc = "of SIZE bytes each, using COMPAR to perform the comparisons."] - pub fn bsearch( - __key: *const cty::c_void, - __base: *const cty::c_void, - __nmemb: size_t, - __size: size_t, - __compar: __compar_fn_t, - ) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Sort NMEMB elements of BASE, of SIZE bytes each,"] - #[doc = "using COMPAR to perform the comparisons."] - pub fn qsort( - __base: *mut cty::c_void, - __nmemb: size_t, - __size: size_t, - __compar: __compar_fn_t, - ); -} -extern "C" { - #[doc = " Return the absolute value of X."] - pub fn abs(__x: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn labs(__x: cty::c_long) -> cty::c_long; -} -extern "C" { - pub fn llabs(__x: cty::c_longlong) -> cty::c_longlong; -} -extern "C" { - #[doc = " Return the `div_t', `ldiv_t' or `lldiv_t' representation"] - #[doc = "of the value of NUMER over DENOM. */"] - pub fn div(__numer: cty::c_int, __denom: cty::c_int) -> div_t; -} -extern "C" { - pub fn ldiv(__numer: cty::c_long, __denom: cty::c_long) -> ldiv_t; -} -extern "C" { - pub fn lldiv(__numer: cty::c_longlong, __denom: cty::c_longlong) -> lldiv_t; -} -extern "C" { - #[doc = " Return the length of the multibyte character"] - #[doc = "in S, which is no longer than N."] - pub fn mblen(__s: *const cty::c_char, __n: size_t) -> cty::c_int; -} -extern "C" { - #[doc = " Return the length of the given multibyte character,"] - #[doc = "putting its `wchar_t' representation in *PWC."] - pub fn mbtowc(__pwc: *mut wchar_t, __s: *const cty::c_char, __n: size_t) -> cty::c_int; -} -extern "C" { - #[doc = " Put the multibyte character represented"] - #[doc = "by WCHAR in S, returning its length."] - pub fn wctomb(__s: *mut cty::c_char, __wchar: wchar_t) -> cty::c_int; -} -extern "C" { - #[doc = " Convert a multibyte string to a wide char string."] - pub fn mbstowcs(__pwcs: *mut wchar_t, __s: *const cty::c_char, __n: size_t) -> size_t; -} -extern "C" { - #[doc = " Convert a wide char string to multibyte string."] - pub fn wcstombs(__s: *mut cty::c_char, __pwcs: *const wchar_t, __n: size_t) -> size_t; -} -extern "C" { - #[doc = " Copy N bytes of SRC to DEST."] - pub fn memcpy( - __dest: *mut cty::c_void, - __src: *const cty::c_void, - __n: cty::c_ulong, - ) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Copy N bytes of SRC to DEST, guaranteeing"] - #[doc = "correct behavior for overlapping strings."] - pub fn memmove( - __dest: *mut cty::c_void, - __src: *const cty::c_void, - __n: cty::c_ulong, - ) -> *mut cty::c_void; -} -extern "C" { - pub fn memccpy( - __dest: *mut cty::c_void, - __src: *const cty::c_void, - __c: cty::c_int, - __n: cty::c_ulong, - ) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Set N bytes of S to C."] - pub fn memset(__s: *mut cty::c_void, __c: cty::c_int, __n: cty::c_ulong) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Compare N bytes of S1 and S2."] - pub fn memcmp( - __s1: *const cty::c_void, - __s2: *const cty::c_void, - __n: cty::c_ulong, - ) -> cty::c_int; -} -extern "C" { - pub fn memchr(__s: *const cty::c_void, __c: cty::c_int, __n: cty::c_ulong) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Copy SRC to DEST."] - pub fn strcpy(__dest: *mut cty::c_char, __src: *const cty::c_char) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Copy no more than N characters of SRC to DEST."] - pub fn strncpy( - __dest: *mut cty::c_char, - __src: *const cty::c_char, - __n: cty::c_ulong, - ) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Append SRC onto DEST."] - pub fn strcat(__dest: *mut cty::c_char, __src: *const cty::c_char) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Append no more than N characters from SRC onto DEST."] - pub fn strncat( - __dest: *mut cty::c_char, - __src: *const cty::c_char, - __n: cty::c_ulong, - ) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Compare S1 and S2."] - pub fn strcmp(__s1: *const cty::c_char, __s2: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Compare N characters of S1 and S2."] - pub fn strncmp( - __s1: *const cty::c_char, - __s2: *const cty::c_char, - __n: cty::c_ulong, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Compare the collated forms of S1 and S2."] - pub fn strcoll(__s1: *const cty::c_char, __s2: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Put a transformation of SRC into no more than N bytes of DEST."] - pub fn strxfrm( - __dest: *mut cty::c_char, - __src: *const cty::c_char, - __n: cty::c_ulong, - ) -> cty::c_ulong; -} -extern "C" { - pub fn strchr(__s: *const cty::c_char, __c: cty::c_int) -> *mut cty::c_char; -} -extern "C" { - pub fn strrchr(__s: *const cty::c_char, __c: cty::c_int) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Return the length of the initial segment of S which"] - #[doc = "consists entirely of characters not in REJECT."] - pub fn strcspn(__s: *const cty::c_char, __reject: *const cty::c_char) -> cty::c_ulong; -} -extern "C" { - #[doc = " Return the length of the initial segment of S which"] - #[doc = "consists entirely of characters in ACCEPT."] - pub fn strspn(__s: *const cty::c_char, __accept: *const cty::c_char) -> cty::c_ulong; -} -extern "C" { - pub fn strpbrk(__s: *const cty::c_char, __accept: *const cty::c_char) -> *mut cty::c_char; -} -extern "C" { - pub fn strstr(__haystack: *const cty::c_char, __needle: *const cty::c_char) - -> *mut cty::c_char; -} -extern "C" { - #[doc = " Divide S into tokens separated by characters in DELIM."] - pub fn strtok(__s: *mut cty::c_char, __delim: *const cty::c_char) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Divide S into tokens separated by characters in DELIM. Information"] - #[doc = "passed between calls are stored in SAVE_PTR."] - pub fn __strtok_r( - __s: *mut cty::c_char, - __delim: *const cty::c_char, - __save_ptr: *mut *mut cty::c_char, - ) -> *mut cty::c_char; -} -extern "C" { - pub fn strtok_r( - __s: *mut cty::c_char, - __delim: *const cty::c_char, - __save_ptr: *mut *mut cty::c_char, - ) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Return the length of S."] - pub fn strlen(__s: *const cty::c_char) -> cty::c_ulong; -} -extern "C" { - #[doc = " Return a string describing the meaning of the `errno' code in ERRNUM."] - pub fn strerror(__errnum: cty::c_int) -> *mut cty::c_char; -} -#[doc = " An integral type that can be modified atomically, without the"] -#[doc = "possibility of a signal arriving in the middle of the operation."] -pub type sig_atomic_t = __sig_atomic_t; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct __sigset_t { - pub __val: [cty::c_ulong; 16usize], -} -#[test] -fn bindgen_test_layout___sigset_t() { - assert_eq!( - ::core::mem::size_of::<__sigset_t>(), - 128usize, - concat!("Size of: ", stringify!(__sigset_t)) - ); - assert_eq!( - ::core::mem::align_of::<__sigset_t>(), - 8usize, - concat!("Alignment of ", stringify!(__sigset_t)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<__sigset_t>())).__val as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__sigset_t), - "::", - stringify!(__val) - ) - ); -} -#[doc = " A set of signals to be blocked, unblocked, or waited for."] -pub type sigset_t = __sigset_t; -pub type pid_t = __pid_t; -pub type uid_t = __uid_t; -#[doc = " Type of a signal handler."] -pub type __sighandler_t = ::core::option::Option; -extern "C" { - #[doc = " The X/Open definition of `signal' specifies the SVID semantic. Use"] - #[doc = "the additional function `sysv_signal' when X/Open compatibility is"] - #[doc = "requested."] - pub fn __sysv_signal(__sig: cty::c_int, __handler: __sighandler_t) -> __sighandler_t; -} -extern "C" { - pub fn kill(__pid: __pid_t, __sig: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Raise signal SIG, i.e., send SIG to yourself."] - pub fn raise(__sig: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Clear all signals from SET."] - pub fn sigemptyset(__set: *mut sigset_t) -> cty::c_int; -} -extern "C" { - #[doc = " Set all signals in SET."] - pub fn sigfillset(__set: *mut sigset_t) -> cty::c_int; -} -extern "C" { - #[doc = " Add SIGNO to SET."] - pub fn sigaddset(__set: *mut sigset_t, __signo: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Remove SIGNO from SET."] - pub fn sigdelset(__set: *mut sigset_t, __signo: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Return 1 if SIGNO is in SET, 0 if not."] - pub fn sigismember(__set: *const sigset_t, __signo: cty::c_int) -> cty::c_int; -} -#[doc = " Structure describing the action to be taken when a signal arrives."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct sigaction { - pub sa_handler: __sighandler_t, - #[doc = " Additional set of signals to be blocked."] - pub sa_mask: __sigset_t, - #[doc = " Special flags."] - pub sa_flags: cty::c_int, - #[doc = " Restore handler."] - pub sa_restorer: ::core::option::Option, -} -#[test] -fn bindgen_test_layout_sigaction() { - assert_eq!( - ::core::mem::size_of::(), - 152usize, - concat!("Size of: ", stringify!(sigaction)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(sigaction)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sa_handler as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(sigaction), - "::", - stringify!(sa_handler) - ) - ); - 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 }, - 136usize, - concat!( - "Offset of field: ", - stringify!(sigaction), - "::", - stringify!(sa_flags) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sa_restorer as *const _ as usize }, - 144usize, - concat!( - "Offset of field: ", - stringify!(sigaction), - "::", - stringify!(sa_restorer) - ) - ); -} -extern "C" { - #[doc = " Get and/or change the set of blocked signals."] - pub fn sigprocmask( - __how: cty::c_int, - __set: *const sigset_t, - __oset: *mut sigset_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Change the set of blocked signals to SET,"] - #[doc = "wait until a signal arrives, and restore the set of blocked signals."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn sigsuspend(__set: *const sigset_t) -> cty::c_int; -} -extern "C" { - #[doc = " Get and/or set the action for signal SIG."] - pub fn sigaction( - __sig: cty::c_int, - __act: *const sigaction, - __oact: *mut sigaction, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Put in SET all signals that are blocked and waiting to be delivered."] - pub fn sigpending(__set: *mut sigset_t) -> cty::c_int; -} -extern "C" { - #[doc = " Return number of available real-time signal with highest priority."] - pub fn __libc_current_sigrtmin() -> cty::c_int; -} -extern "C" { - #[doc = " Return number of available real-time signal with lowest priority."] - pub fn __libc_current_sigrtmax() -> cty::c_int; -} -#[doc = " Structure for scatter/gather I/O."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct iovec { - #[doc = " Pointer to data."] - pub iov_base: *mut cty::c_void, - #[doc = " Length of data."] - pub iov_len: size_t, -} -#[test] -fn bindgen_test_layout_iovec() { - assert_eq!( - ::core::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(iovec)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(iovec)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).iov_base as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(iovec), - "::", - stringify!(iov_base) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).iov_len as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(iovec), - "::", - stringify!(iov_len) - ) - ); -} -pub type ino_t = __ino_t; -pub type dev_t = __dev_t; -pub type gid_t = __gid_t; -pub type mode_t = __mode_t; -pub type nlink_t = __nlink_t; -pub type off_t = __off_t; -pub type id_t = __id_t; -pub type ssize_t = __ssize_t; -pub type key_t = __key_t; -#[doc = " Clock ID used in clock and timer functions."] -pub type clockid_t = __clockid_t; -#[doc = " Timer ID returned by `timer_create'."] -pub type timer_t = __timer_t; -pub type useconds_t = __useconds_t; -pub type suseconds_t = __suseconds_t; -#[doc = " These were defined by ISO C without the first `_'."] -pub type u_int8_t = __uint8_t; -pub type u_int16_t = __uint16_t; -pub type u_int32_t = __uint32_t; -pub type u_int64_t = __uint64_t; -pub type register_t = cty::c_long; -pub type blkcnt_t = __blkcnt_t; -pub type fsblkcnt_t = __fsblkcnt_t; -pub type fsfilcnt_t = __fsfilcnt_t; -pub type socklen_t = __socklen_t; -#[doc = " Sequenced, reliable, connection-based"] -#[doc = "byte streams."] -pub const __socket_type_SOCK_STREAM: __socket_type = 1; -#[doc = " Connectionless, unreliable datagrams"] -#[doc = "of fixed maximum length."] -pub const __socket_type_SOCK_DGRAM: __socket_type = 2; -#[doc = " Raw protocol interface."] -pub const __socket_type_SOCK_RAW: __socket_type = 3; -#[doc = " Reliably-delivered messages."] -pub const __socket_type_SOCK_RDM: __socket_type = 4; -#[doc = " Sequenced, reliable, connection-based,"] -#[doc = "datagrams of fixed maximum length."] -pub const __socket_type_SOCK_SEQPACKET: __socket_type = 5; -#[doc = " Datagram Congestion Control Protocol."] -pub const __socket_type_SOCK_DCCP: __socket_type = 6; -#[doc = " Linux specific way of getting packets"] -#[doc = "at the dev level. For writing rarp and"] -#[doc = "other similar things on the user level."] -pub const __socket_type_SOCK_PACKET: __socket_type = 10; -#[doc = " Atomically set close-on-exec flag for the"] -#[doc = "new descriptor(s)."] -pub const __socket_type_SOCK_CLOEXEC: __socket_type = 524288; -#[doc = " Atomically mark descriptor(s) as"] -#[doc = "non-blocking."] -pub const __socket_type_SOCK_NONBLOCK: __socket_type = 2048; -#[doc = " Types of sockets."] -pub type __socket_type = cty::c_uint; -#[doc = " POSIX.1g specifies this type name for the `sa_family' member."] -pub type sa_family_t = cty::c_ushort; -#[doc = " Structure describing a generic socket address."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct sockaddr { - pub sa_family: sa_family_t, - #[doc = " Address data."] - pub sa_data: [cty::c_char; 14usize], -} -#[test] -fn bindgen_test_layout_sockaddr() { - assert_eq!( - ::core::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(sockaddr)) - ); - assert_eq!( - ::core::mem::align_of::(), - 2usize, - concat!("Alignment of ", stringify!(sockaddr)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sa_family as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(sockaddr), - "::", - stringify!(sa_family) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sa_data as *const _ as usize }, - 2usize, - concat!( - "Offset of field: ", - stringify!(sockaddr), - "::", - stringify!(sa_data) - ) - ); -} -#[repr(C)] -#[derive(Copy, Clone)] -pub struct sockaddr_storage { - pub ss_family: sa_family_t, - pub __ss_padding: [cty::c_char; 118usize], - #[doc = " Force desired alignment."] - pub __ss_align: cty::c_ulong, -} -#[test] -fn bindgen_test_layout_sockaddr_storage() { - assert_eq!( - ::core::mem::size_of::(), - 128usize, - concat!("Size of: ", stringify!(sockaddr_storage)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(sockaddr_storage)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).ss_family as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_storage), - "::", - stringify!(ss_family) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).__ss_padding as *const _ as usize }, - 2usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_storage), - "::", - stringify!(__ss_padding) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).__ss_align as *const _ as usize }, - 120usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_storage), - "::", - stringify!(__ss_align) - ) - ); -} -#[doc = " Process out-of-band data."] -pub const MSG_OOB: cty::c_uint = 1; -#[doc = " Peek at incoming messages."] -pub const MSG_PEEK: cty::c_uint = 2; -#[doc = " Don't use local routing."] -pub const MSG_DONTROUTE: cty::c_uint = 4; -#[doc = " Control data lost before delivery."] -pub const MSG_CTRUNC: cty::c_uint = 8; -#[doc = " Supply or ask second address."] -pub const MSG_PROXY: cty::c_uint = 16; -pub const MSG_TRUNC: cty::c_uint = 32; -#[doc = " Nonblocking IO."] -pub const MSG_DONTWAIT: cty::c_uint = 64; -#[doc = " End of record."] -pub const MSG_EOR: cty::c_uint = 128; -#[doc = " Wait for a full request."] -pub const MSG_WAITALL: cty::c_uint = 256; -pub const MSG_FIN: cty::c_uint = 512; -pub const MSG_SYN: cty::c_uint = 1024; -#[doc = " Confirm path validity."] -pub const MSG_CONFIRM: cty::c_uint = 2048; -pub const MSG_RST: cty::c_uint = 4096; -#[doc = " Fetch message from error queue."] -pub const MSG_ERRQUEUE: cty::c_uint = 8192; -#[doc = " Do not generate SIGPIPE."] -pub const MSG_NOSIGNAL: cty::c_uint = 16384; -#[doc = " Sender will send more."] -pub const MSG_MORE: cty::c_uint = 32768; -#[doc = " Wait for at least one packet to return."] -pub const MSG_WAITFORONE: cty::c_uint = 65536; -#[doc = " sendmmsg: more messages coming."] -pub const MSG_BATCH: cty::c_uint = 262144; -#[doc = " Use user data in kernel path."] -pub const MSG_ZEROCOPY: cty::c_uint = 67108864; -#[doc = " Send data in TCP SYN."] -pub const MSG_FASTOPEN: cty::c_uint = 536870912; -#[doc = " Set close_on_exit for file"] -#[doc = "descriptor received through"] -#[doc = "SCM_RIGHTS."] -pub const MSG_CMSG_CLOEXEC: cty::c_uint = 1073741824; -#[doc = " Bits in the FLAGS argument to `send', `recv', et al."] -pub type _bindgen_ty_3 = cty::c_uint; -#[doc = " Structure describing messages sent by"] -#[doc = "`sendmsg' and received by `recvmsg'."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct msghdr { - #[doc = " Address to send to/receive from."] - pub msg_name: *mut cty::c_void, - #[doc = " Length of address data."] - pub msg_namelen: socklen_t, - #[doc = " Vector of data to send/receive into."] - pub msg_iov: *mut iovec, - #[doc = " Number of elements in the vector."] - pub msg_iovlen: size_t, - #[doc = " Ancillary data (eg BSD filedesc passing)."] - pub msg_control: *mut cty::c_void, - #[doc = " Ancillary data buffer length."] - #[doc = " The type should be socklen_t but the"] - #[doc = "definition of the kernel is incompatible"] - #[doc = "with this."] - pub msg_controllen: size_t, - #[doc = " Flags on received message."] - pub msg_flags: cty::c_int, -} -#[test] -fn bindgen_test_layout_msghdr() { - assert_eq!( - ::core::mem::size_of::(), - 56usize, - concat!("Size of: ", stringify!(msghdr)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(msghdr)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).msg_name as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(msghdr), - "::", - stringify!(msg_name) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).msg_namelen as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(msghdr), - "::", - stringify!(msg_namelen) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).msg_iov as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(msghdr), - "::", - stringify!(msg_iov) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).msg_iovlen as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(msghdr), - "::", - stringify!(msg_iovlen) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).msg_control as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(msghdr), - "::", - stringify!(msg_control) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).msg_controllen as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(msghdr), - "::", - stringify!(msg_controllen) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).msg_flags as *const _ as usize }, - 48usize, - concat!( - "Offset of field: ", - stringify!(msghdr), - "::", - stringify!(msg_flags) - ) - ); -} -#[doc = " Structure used for storage of ancillary data object information."] -#[repr(C)] -#[derive(Debug)] -pub struct cmsghdr { - #[doc = " Length of data in cmsg_data plus length"] - #[doc = "of cmsghdr structure."] - #[doc = " The type should be socklen_t but the"] - #[doc = "definition of the kernel is incompatible"] - #[doc = "with this."] - pub cmsg_len: size_t, - #[doc = " Originating protocol."] - pub cmsg_level: cty::c_int, - #[doc = " Protocol specific type."] - pub cmsg_type: cty::c_int, - #[doc = " Ancillary data."] - pub __cmsg_data: __IncompleteArrayField, -} -#[test] -fn bindgen_test_layout_cmsghdr() { - assert_eq!( - ::core::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(cmsghdr)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(cmsghdr)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).cmsg_len as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(cmsghdr), - "::", - stringify!(cmsg_len) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).cmsg_level as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(cmsghdr), - "::", - stringify!(cmsg_level) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).cmsg_type as *const _ as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(cmsghdr), - "::", - stringify!(cmsg_type) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).__cmsg_data as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(cmsghdr), - "::", - stringify!(__cmsg_data) - ) - ); -} -extern "C" { - pub fn __cmsg_nxthdr(__mhdr: *mut msghdr, __cmsg: *mut cmsghdr) -> *mut cmsghdr; -} -#[doc = " Transfer file descriptors."] -pub const SCM_RIGHTS: cty::c_uint = 1; -#[doc = " Socket level message types. This must match the definitions in"] -#[doc = "."] -pub type _bindgen_ty_4 = cty::c_uint; -#[doc = " Structure used to manipulate the SO_LINGER option."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct linger { - #[doc = " Nonzero to linger on close."] - pub l_onoff: cty::c_int, - #[doc = " Time to linger."] - pub l_linger: cty::c_int, -} -#[test] -fn bindgen_test_layout_linger() { - assert_eq!( - ::core::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(linger)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(linger)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).l_onoff as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(linger), - "::", - stringify!(l_onoff) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).l_linger as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(linger), - "::", - stringify!(l_linger) - ) - ); -} -#[doc = " No more receptions."] -pub const SHUT_RD: cty::c_uint = 0; -#[doc = " No more transmissions."] -pub const SHUT_WR: cty::c_uint = 1; -#[doc = " No more receptions or transmissions."] -pub const SHUT_RDWR: cty::c_uint = 2; -#[doc = " The following constants should be used for the second parameter of"] -#[doc = "`shutdown'."] -pub type _bindgen_ty_5 = cty::c_uint; -extern "C" { - #[doc = " Create a new socket of type TYPE in domain DOMAIN, using"] - #[doc = "protocol PROTOCOL. If PROTOCOL is zero, one is chosen automatically."] - #[doc = "Returns a file descriptor for the new socket, or -1 for errors."] - pub fn socket(__domain: cty::c_int, __type: cty::c_int, __protocol: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Create two new sockets, of type TYPE in domain DOMAIN and using"] - #[doc = "protocol PROTOCOL, which are connected to each other, and put file"] - #[doc = "descriptors for them in FDS[0] and FDS[1]. If PROTOCOL is zero,"] - #[doc = "one will be chosen automatically. Returns 0 on success, -1 for errors."] - pub fn socketpair( - __domain: cty::c_int, - __type: cty::c_int, - __protocol: cty::c_int, - __fds: *mut cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Give the socket FD the local address ADDR (which is LEN bytes long)."] - pub fn bind(__fd: cty::c_int, __addr: *const sockaddr, __len: socklen_t) -> cty::c_int; -} -extern "C" { - #[doc = " Put the local address of FD into *ADDR and its length in *LEN."] - pub fn getsockname( - __fd: cty::c_int, - __addr: *mut sockaddr, - __len: *mut socklen_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Open a connection on socket FD to peer at ADDR (which LEN bytes long)."] - #[doc = "For connectionless socket types, just set the default address to send to"] - #[doc = "and the only address from which to accept transmissions."] - #[doc = "Return 0 on success, -1 for errors."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn connect(__fd: cty::c_int, __addr: *const sockaddr, __len: socklen_t) -> cty::c_int; -} -extern "C" { - #[doc = " Put the address of the peer connected to socket FD into *ADDR"] - #[doc = "(which is *LEN bytes long), and its actual length into *LEN."] - pub fn getpeername( - __fd: cty::c_int, - __addr: *mut sockaddr, - __len: *mut socklen_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Send N bytes of BUF to socket FD. Returns the number sent or -1."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn send( - __fd: cty::c_int, - __buf: *const cty::c_void, - __n: size_t, - __flags: cty::c_int, - ) -> ssize_t; -} -extern "C" { - #[doc = " Read N bytes into BUF from socket FD."] - #[doc = "Returns the number read or -1 for errors."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn recv( - __fd: cty::c_int, - __buf: *mut cty::c_void, - __n: size_t, - __flags: cty::c_int, - ) -> ssize_t; -} -extern "C" { - #[doc = " Send N bytes of BUF on socket FD to peer at address ADDR (which is"] - #[doc = "ADDR_LEN bytes long). Returns the number sent, or -1 for errors."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn sendto( - __fd: cty::c_int, - __buf: *const cty::c_void, - __n: size_t, - __flags: cty::c_int, - __addr: *const sockaddr, - __addr_len: socklen_t, - ) -> ssize_t; -} -extern "C" { - #[doc = " Read N bytes into BUF through socket FD."] - #[doc = "If ADDR is not NULL, fill in *ADDR_LEN bytes of it with tha address of"] - #[doc = "the sender, and store the actual size of the address in *ADDR_LEN."] - #[doc = "Returns the number of bytes read or -1 for errors."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn recvfrom( - __fd: cty::c_int, - __buf: *mut cty::c_void, - __n: size_t, - __flags: cty::c_int, - __addr: *mut sockaddr, - __addr_len: *mut socklen_t, - ) -> ssize_t; -} -extern "C" { - #[doc = " Send a message described MESSAGE on socket FD."] - #[doc = "Returns the number of bytes sent, or -1 for errors."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn sendmsg(__fd: cty::c_int, __message: *const msghdr, __flags: cty::c_int) -> ssize_t; -} -extern "C" { - #[doc = " Receive a message as described by MESSAGE from socket FD."] - #[doc = "Returns the number of bytes read or -1 for errors."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn recvmsg(__fd: cty::c_int, __message: *mut msghdr, __flags: cty::c_int) -> ssize_t; -} -extern "C" { - #[doc = " Put the current value for socket FD's option OPTNAME at protocol level LEVEL"] - #[doc = "into OPTVAL (which is *OPTLEN bytes long), and set *OPTLEN to the value's"] - #[doc = "actual length. Returns 0 on success, -1 for errors."] - pub fn getsockopt( - __fd: cty::c_int, - __level: cty::c_int, - __optname: cty::c_int, - __optval: *mut cty::c_void, - __optlen: *mut socklen_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Set socket FD's option OPTNAME at protocol level LEVEL"] - #[doc = "to *OPTVAL (which is OPTLEN bytes long)."] - #[doc = "Returns 0 on success, -1 for errors."] - pub fn setsockopt( - __fd: cty::c_int, - __level: cty::c_int, - __optname: cty::c_int, - __optval: *const cty::c_void, - __optlen: socklen_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Prepare to accept connections on socket FD."] - #[doc = "N connection requests will be queued before further requests are refused."] - #[doc = "Returns 0 on success, -1 for errors."] - pub fn listen(__fd: cty::c_int, __n: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Await a connection on socket FD."] - #[doc = "When a connection arrives, open a new socket to communicate with it,"] - #[doc = "set *ADDR (which is *ADDR_LEN bytes long) to the address of the connecting"] - #[doc = "peer and *ADDR_LEN to the address's actual length, and return the"] - #[doc = "new socket's descriptor, or -1 for errors."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn accept( - __fd: cty::c_int, - __addr: *mut sockaddr, - __addr_len: *mut socklen_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Shut down all or part of the connection open on socket FD."] - #[doc = "HOW determines what to shut down:"] - #[doc = "SHUT_RD = No more receptions;"] - #[doc = "SHUT_WR = No more transmissions;"] - #[doc = "SHUT_RDWR = No more receptions or transmissions."] - #[doc = "Returns 0 on success, -1 for errors."] - pub fn shutdown(__fd: cty::c_int, __how: cty::c_int) -> cty::c_int; -} -#[doc = " Internet address."] -pub type in_addr_t = u32; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct in_addr { - pub s_addr: in_addr_t, -} -#[test] -fn bindgen_test_layout_in_addr() { - assert_eq!( - ::core::mem::size_of::(), - 4usize, - concat!("Size of: ", stringify!(in_addr)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(in_addr)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).s_addr as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(in_addr), - "::", - stringify!(s_addr) - ) - ); -} -#[doc = " Dummy protocol for TCP."] -pub const IPPROTO_IP: cty::c_uint = 0; -#[doc = " Internet Control Message Protocol."] -pub const IPPROTO_ICMP: cty::c_uint = 1; -#[doc = " Internet Group Management Protocol."] -pub const IPPROTO_IGMP: cty::c_uint = 2; -#[doc = " IPIP tunnels (older KA9Q tunnels use 94)."] -pub const IPPROTO_IPIP: cty::c_uint = 4; -#[doc = " Transmission Control Protocol."] -pub const IPPROTO_TCP: cty::c_uint = 6; -#[doc = " Exterior Gateway Protocol."] -pub const IPPROTO_EGP: cty::c_uint = 8; -#[doc = " PUP protocol."] -pub const IPPROTO_PUP: cty::c_uint = 12; -#[doc = " User Datagram Protocol."] -pub const IPPROTO_UDP: cty::c_uint = 17; -#[doc = " XNS IDP protocol."] -pub const IPPROTO_IDP: cty::c_uint = 22; -#[doc = " SO Transport Protocol Class 4."] -pub const IPPROTO_TP: cty::c_uint = 29; -#[doc = " Datagram Congestion Control Protocol."] -pub const IPPROTO_DCCP: cty::c_uint = 33; -#[doc = " IPv6 header."] -pub const IPPROTO_IPV6: cty::c_uint = 41; -#[doc = " Reservation Protocol."] -pub const IPPROTO_RSVP: cty::c_uint = 46; -#[doc = " General Routing Encapsulation."] -pub const IPPROTO_GRE: cty::c_uint = 47; -#[doc = " encapsulating security payload."] -pub const IPPROTO_ESP: cty::c_uint = 50; -#[doc = " authentication header."] -pub const IPPROTO_AH: cty::c_uint = 51; -#[doc = " Multicast Transport Protocol."] -pub const IPPROTO_MTP: cty::c_uint = 92; -#[doc = " IP option pseudo header for BEET."] -pub const IPPROTO_BEETPH: cty::c_uint = 94; -#[doc = " Encapsulation Header."] -pub const IPPROTO_ENCAP: cty::c_uint = 98; -#[doc = " Protocol Independent Multicast."] -pub const IPPROTO_PIM: cty::c_uint = 103; -#[doc = " Compression Header Protocol."] -pub const IPPROTO_COMP: cty::c_uint = 108; -#[doc = " Stream Control Transmission Protocol."] -pub const IPPROTO_SCTP: cty::c_uint = 132; -#[doc = " UDP-Lite protocol."] -pub const IPPROTO_UDPLITE: cty::c_uint = 136; -#[doc = " MPLS in IP."] -pub const IPPROTO_MPLS: cty::c_uint = 137; -#[doc = " Raw IP packets."] -pub const IPPROTO_RAW: cty::c_uint = 255; -pub const IPPROTO_MAX: cty::c_uint = 256; -#[doc = " Standard well-defined IP protocols."] -pub type _bindgen_ty_6 = cty::c_uint; -#[doc = " IPv6 Hop-by-Hop options."] -pub const IPPROTO_HOPOPTS: cty::c_uint = 0; -#[doc = " IPv6 routing header."] -pub const IPPROTO_ROUTING: cty::c_uint = 43; -#[doc = " IPv6 fragmentation header."] -pub const IPPROTO_FRAGMENT: cty::c_uint = 44; -#[doc = " ICMPv6."] -pub const IPPROTO_ICMPV6: cty::c_uint = 58; -#[doc = " IPv6 no next header."] -pub const IPPROTO_NONE: cty::c_uint = 59; -#[doc = " IPv6 destination options."] -pub const IPPROTO_DSTOPTS: cty::c_uint = 60; -#[doc = " IPv6 mobility header."] -pub const IPPROTO_MH: cty::c_uint = 135; -pub type _bindgen_ty_7 = cty::c_uint; -#[doc = " Type to represent a port."] -pub type in_port_t = u16; -#[doc = " Echo service."] -pub const IPPORT_ECHO: cty::c_uint = 7; -#[doc = " Discard transmissions service."] -pub const IPPORT_DISCARD: cty::c_uint = 9; -#[doc = " System status service."] -pub const IPPORT_SYSTAT: cty::c_uint = 11; -#[doc = " Time of day service."] -pub const IPPORT_DAYTIME: cty::c_uint = 13; -#[doc = " Network status service."] -pub const IPPORT_NETSTAT: cty::c_uint = 15; -#[doc = " File Transfer Protocol."] -pub const IPPORT_FTP: cty::c_uint = 21; -#[doc = " Telnet protocol."] -pub const IPPORT_TELNET: cty::c_uint = 23; -#[doc = " Simple Mail Transfer Protocol."] -pub const IPPORT_SMTP: cty::c_uint = 25; -#[doc = " Timeserver service."] -pub const IPPORT_TIMESERVER: cty::c_uint = 37; -#[doc = " Domain Name Service."] -pub const IPPORT_NAMESERVER: cty::c_uint = 42; -#[doc = " Internet Whois service."] -pub const IPPORT_WHOIS: cty::c_uint = 43; -pub const IPPORT_MTP: cty::c_uint = 57; -#[doc = " Trivial File Transfer Protocol."] -pub const IPPORT_TFTP: cty::c_uint = 69; -pub const IPPORT_RJE: cty::c_uint = 77; -#[doc = " Finger service."] -pub const IPPORT_FINGER: cty::c_uint = 79; -pub const IPPORT_TTYLINK: cty::c_uint = 87; -#[doc = " SUPDUP protocol."] -pub const IPPORT_SUPDUP: cty::c_uint = 95; -#[doc = " execd service."] -pub const IPPORT_EXECSERVER: cty::c_uint = 512; -#[doc = " rlogind service."] -pub const IPPORT_LOGINSERVER: cty::c_uint = 513; -pub const IPPORT_CMDSERVER: cty::c_uint = 514; -pub const IPPORT_EFSSERVER: cty::c_uint = 520; -#[doc = " UDP ports."] -pub const IPPORT_BIFFUDP: cty::c_uint = 512; -#[doc = " UDP ports."] -pub const IPPORT_WHOSERVER: cty::c_uint = 513; -#[doc = " UDP ports."] -pub const IPPORT_ROUTESERVER: cty::c_uint = 520; -#[doc = " Ports less than this value are reserved for privileged processes."] -pub const IPPORT_RESERVED: cty::c_uint = 1024; -#[doc = " Ports greater this value are reserved for (non-privileged) servers."] -pub const IPPORT_USERRESERVED: cty::c_uint = 5000; -#[doc = " Standard well-known ports."] -pub type _bindgen_ty_8 = cty::c_uint; -#[doc = " IPv6 address"] -#[repr(C)] -#[derive(Copy, Clone)] -pub struct in6_addr { - pub __in6_u: in6_addr__bindgen_ty_1, -} -#[repr(C)] -#[derive(Copy, Clone)] -pub union in6_addr__bindgen_ty_1 { - pub __u6_addr8: [u8; 16usize], - pub __u6_addr16: [u16; 8usize], - pub __u6_addr32: [u32; 4usize], -} -#[test] -fn bindgen_test_layout_in6_addr__bindgen_ty_1() { - assert_eq!( - ::core::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(in6_addr__bindgen_ty_1)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(in6_addr__bindgen_ty_1)) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).__u6_addr8 as *const _ as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(in6_addr__bindgen_ty_1), - "::", - stringify!(__u6_addr8) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).__u6_addr16 as *const _ as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(in6_addr__bindgen_ty_1), - "::", - stringify!(__u6_addr16) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).__u6_addr32 as *const _ as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(in6_addr__bindgen_ty_1), - "::", - stringify!(__u6_addr32) - ) - ); -} -#[test] -fn bindgen_test_layout_in6_addr() { - assert_eq!( - ::core::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(in6_addr)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(in6_addr)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).__in6_u as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(in6_addr), - "::", - stringify!(__in6_u) - ) - ); -} -extern "C" { - pub static in6addr_any: in6_addr; -} -extern "C" { - pub static in6addr_loopback: in6_addr; -} -#[doc = " Structure describing an Internet socket address."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct sockaddr_in { - pub sin_family: sa_family_t, - #[doc = " Port number."] - pub sin_port: in_port_t, - #[doc = " Internet address."] - pub sin_addr: in_addr, - #[doc = " Pad to size of `struct sockaddr'."] - pub sin_zero: [cty::c_uchar; 8usize], -} -#[test] -fn bindgen_test_layout_sockaddr_in() { - assert_eq!( - ::core::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(sockaddr_in)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(sockaddr_in)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin_family as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in), - "::", - stringify!(sin_family) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin_port as *const _ as usize }, - 2usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in), - "::", - stringify!(sin_port) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin_addr as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in), - "::", - stringify!(sin_addr) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin_zero as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in), - "::", - stringify!(sin_zero) - ) - ); -} -#[doc = " Ditto, for IPv6."] -#[repr(C)] -#[derive(Copy, Clone)] -pub struct sockaddr_in6 { - pub sin6_family: sa_family_t, - #[doc = " Transport layer port #"] - pub sin6_port: in_port_t, - #[doc = " IPv6 flow information"] - pub sin6_flowinfo: u32, - #[doc = " IPv6 address"] - pub sin6_addr: in6_addr, - #[doc = " IPv6 scope-id"] - pub sin6_scope_id: u32, -} -#[test] -fn bindgen_test_layout_sockaddr_in6() { - assert_eq!( - ::core::mem::size_of::(), - 28usize, - concat!("Size of: ", stringify!(sockaddr_in6)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(sockaddr_in6)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin6_family as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in6), - "::", - stringify!(sin6_family) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin6_port as *const _ as usize }, - 2usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in6), - "::", - stringify!(sin6_port) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin6_flowinfo as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in6), - "::", - stringify!(sin6_flowinfo) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin6_addr as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in6), - "::", - stringify!(sin6_addr) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin6_scope_id as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in6), - "::", - stringify!(sin6_scope_id) - ) - ); -} -#[doc = " Likewise, for IPv6."] -#[repr(C)] -#[derive(Copy, Clone)] -pub struct ipv6_mreq { - #[doc = " IPv6 multicast address of group"] - pub ipv6mr_multiaddr: in6_addr, - #[doc = " local interface"] - pub ipv6mr_interface: cty::c_uint, -} -#[test] -fn bindgen_test_layout_ipv6_mreq() { - assert_eq!( - ::core::mem::size_of::(), - 20usize, - concat!("Size of: ", stringify!(ipv6_mreq)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(ipv6_mreq)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).ipv6mr_multiaddr as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ipv6_mreq), - "::", - stringify!(ipv6mr_multiaddr) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).ipv6mr_interface as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ipv6_mreq), - "::", - stringify!(ipv6mr_interface) - ) - ); -} -extern "C" { - #[doc = " Functions to convert between host and network byte order."] - #[doc = ""] - #[doc = "Please note that these functions normally take `unsigned long int' or"] - #[doc = "`unsigned short int' values as arguments and also return them. But"] - #[doc = "this was a short-sighted decision since on different systems the types"] - #[doc = "may have different representations but the values are always the same."] - pub fn ntohl(__netlong: u32) -> u32; -} -extern "C" { - pub fn ntohs(__netshort: u16) -> u16; -} -extern "C" { - pub fn htonl(__hostlong: u32) -> u32; -} -extern "C" { - pub fn htons(__hostshort: u16) -> u16; -} -extern "C" { - #[doc = " Get a human-readable string describing the running Notcurses version."] - pub fn notcurses_version() -> *const cty::c_char; -} -extern "C" { - #[doc = " Cannot be inline, as we want to get the versions of the actual Notcurses"] - #[doc = " library we loaded, not what we compile against."] - pub fn notcurses_version_components( - major: *mut cty::c_int, - minor: *mut cty::c_int, - patch: *mut cty::c_int, - tweak: *mut cty::c_int, - ); -} -#[repr(C)] -#[derive(Debug)] -pub struct notcurses { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncplane { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncvisual { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncuplot { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncdplot { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncprogbar { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncfdplane { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncsubproc { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncselector { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncmultiselector { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncreader { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncfadectx { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct nctablet { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncreel { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct nctab { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct nctabbed { - _unused: [u8; 0], -} -#[doc = " let the ncvisual pick"] -pub const ncblitter_e_NCBLIT_DEFAULT: ncblitter_e = 0; -#[doc = " space, compatible with ASCII"] -pub const ncblitter_e_NCBLIT_1x1: ncblitter_e = 1; -#[doc = " halves + 1x1 (space) ▄▀"] -pub const ncblitter_e_NCBLIT_2x1: ncblitter_e = 2; -#[doc = " quadrants + 2x1 ▗▐ ▖▀▟▌▙"] -pub const ncblitter_e_NCBLIT_2x2: ncblitter_e = 3; -#[doc = " sextants (*NOT* 2x2) 🬀🬁🬂🬃🬄🬅🬆🬇🬈🬉🬊🬋🬌🬍🬎🬏🬐🬑🬒🬓🬔🬕🬖🬗🬘🬙🬚🬛🬜🬝🬞"] -pub const ncblitter_e_NCBLIT_3x2: ncblitter_e = 4; -#[doc = " 4 rows, 2 cols (braille) ⡀⡄⡆⡇⢀⣀⣄⣆⣇⢠⣠⣤⣦⣧⢰⣰⣴⣶⣷⢸⣸⣼⣾⣿"] -pub const ncblitter_e_NCBLIT_BRAILLE: ncblitter_e = 5; -#[doc = " pixel graphics"] -pub const ncblitter_e_NCBLIT_PIXEL: ncblitter_e = 6; -#[doc = " four vertical levels █▆▄▂"] -pub const ncblitter_e_NCBLIT_4x1: ncblitter_e = 7; -#[doc = " eight vertical levels █▇▆▅▄▃▂▁"] -pub const ncblitter_e_NCBLIT_8x1: ncblitter_e = 8; -#[doc = " we never blit full blocks, but instead spaces (more efficient) with the"] -#[doc = " background set to the desired foreground."] -pub type ncblitter_e = cty::c_uint; -pub const ncalign_e_NCALIGN_UNALIGNED: ncalign_e = 0; -pub const ncalign_e_NCALIGN_LEFT: ncalign_e = 1; -pub const ncalign_e_NCALIGN_CENTER: ncalign_e = 2; -pub const ncalign_e_NCALIGN_RIGHT: ncalign_e = 3; -#[doc = " Alignment within a plane or terminal. Left/right-justified, or centered."] -pub type ncalign_e = cty::c_uint; -pub const ncscale_e_NCSCALE_NONE: ncscale_e = 0; -pub const ncscale_e_NCSCALE_SCALE: ncscale_e = 1; -pub const ncscale_e_NCSCALE_STRETCH: ncscale_e = 2; -pub const ncscale_e_NCSCALE_NONE_HIRES: ncscale_e = 3; -pub const ncscale_e_NCSCALE_SCALE_HIRES: ncscale_e = 4; -#[doc = " How to scale an ncvisual during rendering. NCSCALE_NONE will apply no"] -#[doc = " scaling. NCSCALE_SCALE scales a visual to the plane's size, maintaining"] -#[doc = " aspect ratio. NCSCALE_STRETCH stretches and scales the image in an"] -#[doc = " attempt to fill the entirety of the plane. NCSCALE_NONE_HIRES and"] -#[doc = " NCSCALE_SCALE_HIRES behave like their counterparts, but admit blitters"] -#[doc = " which don't preserve aspect ratio."] -pub type ncscale_e = cty::c_uint; -extern "C" { - #[doc = " Returns the number of columns occupied by a multibyte (UTF-8) string, or"] - #[doc = " -1 if a non-printable/illegal character is encountered."] - pub fn ncstrwidth(mbs: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " input functions like notcurses_getc() return ucs32-encoded char32_t. convert"] - #[doc = " a series of char32_t to utf8. result must be at least 4 bytes per input"] - #[doc = " char32_t (6 bytes per char32_t will future-proof against Unicode expansion)."] - #[doc = " the number of bytes used is returned, or -1 if passed illegal ucs32, or too"] - #[doc = " small of a buffer."] - pub fn notcurses_ucs32_to_utf8( - ucs32: *const char32_t, - ucs32count: cty::c_uint, - resultbuf: *mut cty::c_uchar, - buflen: size_t, - ) -> cty::c_int; -} -#[doc = " An nccell corresponds to a single character cell on some plane, which can be"] -#[doc = " occupied by a single grapheme cluster (some root spacing glyph, along with"] -#[doc = " possible combining characters, which might span multiple columns). At any"] -#[doc = " cell, we can have a theoretically arbitrarily long UTF-8 string, a foreground"] -#[doc = " color, a background color, and an attribute set. Valid grapheme cluster"] -#[doc = " contents include:"] -#[doc = ""] -#[doc = " * A NUL terminator,"] -#[doc = " * A single control character, followed by a NUL terminator,"] -#[doc = " * At most one spacing character, followed by zero or more nonspacing"] -#[doc = " characters, followed by a NUL terminator."] -#[doc = ""] -#[doc = " Multi-column characters can only have a single style/color throughout."] -#[doc = " Existence is suffering, and thus wcwidth() is not reliable. It's just"] -#[doc = " quoting whether or not the EGC contains a \"Wide Asian\" double-width"] -#[doc = " character. This is set for some things, like most emoji, and not set for"] -#[doc = " other things, like cuneiform. True display width is a *function of the"] -#[doc = " font and terminal*. Among the longest Unicode codepoints is"] -#[doc = ""] -#[doc = " U+FDFD ARABIC LIGATURE BISMILLAH AR-RAHMAN AR-RAHEEM ﷽"] -#[doc = ""] -#[doc = " wcwidth() rather optimistically claims this most exalted glyph to occupy"] -#[doc = " a single column. BiDi text is too complicated for me to even get into here."] -#[doc = " Be assured there are no easy answers; ours is indeed a disturbing Universe."] -#[doc = ""] -#[doc = " Each nccell occupies 16 static bytes (128 bits). The surface is thus ~1.6MB"] -#[doc = " for a (pretty large) 500x200 terminal. At 80x43, it's less than 64KB."] -#[doc = " Dynamic requirements (the egcpool) can add up to 16MB to an ncplane, but"] -#[doc = " such large pools are unlikely in common use."] -#[doc = ""] -#[doc = " We implement some small alpha compositing. Foreground and background both"] -#[doc = " have two bits of inverted alpha. The actual grapheme written to a cell is"] -#[doc = " the topmost non-zero grapheme. If its alpha is 00, its foreground color is"] -#[doc = " used unchanged. If its alpha is 10, its foreground color is derived entirely"] -#[doc = " from cells underneath it. Otherwise, the result will be a composite."] -#[doc = " Likewise for the background. If the bottom of a coordinate's zbuffer is"] -#[doc = " reached with a cumulative alpha of zero, the default is used. In this way,"] -#[doc = " a terminal configured with transparent background can be supported through"] -#[doc = " multiple occluding ncplanes. A foreground alpha of 11 requests high-contrast"] -#[doc = " text (relative to the computed background). A background alpha of 11 is"] -#[doc = " currently forbidden."] -#[doc = ""] -#[doc = " Default color takes precedence over palette or RGB, and cannot be used with"] -#[doc = " transparency. Indexed palette takes precedence over RGB. It cannot"] -#[doc = " meaningfully set transparency, but it can be mixed into a cascading color."] -#[doc = " RGB is used if neither default terminal colors nor palette indexing are in"] -#[doc = " play, and fully supports all transparency options."] -#[doc = ""] -#[doc = " This structure is exposed only so that most functions can be inlined. Do not"] -#[doc = " directly modify or access the fields of this structure; use the API."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct nccell { - #[doc = " 4B → 4B little endian EGC"] - pub gcluster: u32, - #[doc = " 1B → 5B (8 bits of zero)"] - pub gcluster_backstop: u8, - #[doc = " 1B → 6B (8 bits of EGC column width)"] - pub width: u8, - #[doc = " 2B → 8B (16 bits of NCSTYLE_* attributes)"] - pub stylemask: u16, - #[doc = " + 8B == 16B"] - pub channels: u64, -} -#[test] -fn bindgen_test_layout_nccell() { - assert_eq!( - ::core::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(nccell)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(nccell)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).gcluster as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(nccell), - "::", - stringify!(gcluster) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).gcluster_backstop as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(nccell), - "::", - stringify!(gcluster_backstop) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).width as *const _ as usize }, - 5usize, - concat!( - "Offset of field: ", - stringify!(nccell), - "::", - stringify!(width) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).stylemask as *const _ as usize }, - 6usize, - concat!( - "Offset of field: ", - stringify!(nccell), - "::", - stringify!(stylemask) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).channels as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(nccell), - "::", - stringify!(channels) - ) - ); -} -pub type cell = nccell; -extern "C" { - #[doc = " Breaks the UTF-8 string in 'gcluster' down, setting up the nccell 'c'."] - #[doc = " Returns the number of bytes copied out of 'gcluster', or -1 on failure. The"] - #[doc = " styling of the cell is left untouched, but any resources are released."] - pub fn cell_load(n: *mut ncplane, c: *mut nccell, gcluster: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Duplicate 'c' into 'targ'; both must be/will be bound to 'n'. Returns -1 on"] - #[doc = " failure, and 0 on success."] - pub fn cell_duplicate(n: *mut ncplane, targ: *mut nccell, c: *const nccell) -> cty::c_int; -} -extern "C" { - #[doc = " Release resources held by the nccell 'c'."] - pub fn cell_release(n: *mut ncplane, c: *mut nccell); -} -extern "C" { - #[doc = " return a pointer to the NUL-terminated EGC referenced by 'c'. this pointer"] - #[doc = " can be invalidated by any further operation on the plane 'n', so...watch out!"] - #[doc = " must not be called on a pixel graphic."] - pub fn cell_extended_gcluster(n: *const ncplane, c: *const nccell) -> *const cty::c_char; -} -#[doc = " default. print nothing once fullscreen service begins"] -pub const ncloglevel_e_NCLOGLEVEL_SILENT: ncloglevel_e = 0; -#[doc = " print diagnostics immediately related to crashing"] -pub const ncloglevel_e_NCLOGLEVEL_PANIC: ncloglevel_e = 1; -#[doc = " we're hanging around, but we've had a horrible fault"] -pub const ncloglevel_e_NCLOGLEVEL_FATAL: ncloglevel_e = 2; -#[doc = " we can't keep doing this, but we can do other things"] -pub const ncloglevel_e_NCLOGLEVEL_ERROR: ncloglevel_e = 3; -#[doc = " you probably don't want what's happening to happen"] -pub const ncloglevel_e_NCLOGLEVEL_WARNING: ncloglevel_e = 4; -#[doc = " \"standard information\""] -pub const ncloglevel_e_NCLOGLEVEL_INFO: ncloglevel_e = 5; -#[doc = " \"detailed information\""] -pub const ncloglevel_e_NCLOGLEVEL_VERBOSE: ncloglevel_e = 6; -#[doc = " this is honestly a bit much"] -pub const ncloglevel_e_NCLOGLEVEL_DEBUG: ncloglevel_e = 7; -#[doc = " there's probably a better way to do what you want"] -pub const ncloglevel_e_NCLOGLEVEL_TRACE: ncloglevel_e = 8; -#[doc = " These log levels consciously map cleanly to those of libav; Notcurses itself"] -#[doc = " does not use this full granularity. The log level does not affect the opening"] -#[doc = " and closing banners, which can be disabled via the notcurses_option struct's"] -#[doc = " 'suppress_banner'. Note that if stderr is connected to the same terminal on"] -#[doc = " which we're rendering, any kind of logging will disrupt the output."] -pub type ncloglevel_e = cty::c_uint; -#[doc = " Configuration for notcurses_init()."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct notcurses_options { - #[doc = " The name of the terminfo database entry describing this terminal. If NULL,"] - #[doc = " the environment variable TERM is used. Failure to open the terminal"] - #[doc = " definition will result in failure to initialize notcurses."] - pub termtype: *const cty::c_char, - #[doc = " If non-NULL, notcurses_render() will write each rendered frame to this"] - #[doc = " FILE* in addition to outfp. This is used primarily for debugging."] - pub renderfp: *mut FILE, - #[doc = " Progressively higher log levels result in more logging to stderr. By"] - #[doc = " default, nothing is printed to stderr once fullscreen service begins."] - pub loglevel: ncloglevel_e, - #[doc = " Desirable margins. If all are 0 (default), we will render to the entirety"] - #[doc = " of the screen. If the screen is too small, we do what we can--this is"] - #[doc = " strictly best-effort. Absolute coordinates are relative to the rendering"] - #[doc = " area ((0, 0) is always the origin of the rendering area)."] - pub margin_t: cty::c_int, - #[doc = " Desirable margins. If all are 0 (default), we will render to the entirety"] - #[doc = " of the screen. If the screen is too small, we do what we can--this is"] - #[doc = " strictly best-effort. Absolute coordinates are relative to the rendering"] - #[doc = " area ((0, 0) is always the origin of the rendering area)."] - pub margin_r: cty::c_int, - #[doc = " Desirable margins. If all are 0 (default), we will render to the entirety"] - #[doc = " of the screen. If the screen is too small, we do what we can--this is"] - #[doc = " strictly best-effort. Absolute coordinates are relative to the rendering"] - #[doc = " area ((0, 0) is always the origin of the rendering area)."] - pub margin_b: cty::c_int, - #[doc = " Desirable margins. If all are 0 (default), we will render to the entirety"] - #[doc = " of the screen. If the screen is too small, we do what we can--this is"] - #[doc = " strictly best-effort. Absolute coordinates are relative to the rendering"] - #[doc = " area ((0, 0) is always the origin of the rendering area)."] - pub margin_l: cty::c_int, - #[doc = " General flags; see NCOPTION_*. This is expressed as a bitfield so that"] - #[doc = " future options can be added without reshaping the struct. Undefined bits"] - #[doc = " must be set to 0."] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_notcurses_options() { - assert_eq!( - ::core::mem::size_of::(), - 48usize, - concat!("Size of: ", stringify!(notcurses_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(notcurses_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).termtype as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(notcurses_options), - "::", - stringify!(termtype) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).renderfp as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(notcurses_options), - "::", - stringify!(renderfp) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).loglevel as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(notcurses_options), - "::", - stringify!(loglevel) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).margin_t as *const _ as usize }, - 20usize, - concat!( - "Offset of field: ", - stringify!(notcurses_options), - "::", - stringify!(margin_t) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).margin_r as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(notcurses_options), - "::", - stringify!(margin_r) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).margin_b as *const _ as usize }, - 28usize, - concat!( - "Offset of field: ", - stringify!(notcurses_options), - "::", - stringify!(margin_b) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).margin_l as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(notcurses_options), - "::", - stringify!(margin_l) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(notcurses_options), - "::", - stringify!(flags) - ) - ); -} -extern "C" { - #[doc = " Lex a margin argument according to the standard Notcurses definition. There"] - #[doc = " can be either a single number, which will define all margins equally, or"] - #[doc = " there can be four numbers separated by commas."] - pub fn notcurses_lex_margins( - op: *const cty::c_char, - opts: *mut notcurses_options, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Lex a blitter."] - pub fn notcurses_lex_blitter(op: *const cty::c_char, blitter: *mut ncblitter_e) -> cty::c_int; -} -extern "C" { - #[doc = " Get the name of a blitter."] - pub fn notcurses_str_blitter(blitter: ncblitter_e) -> *const cty::c_char; -} -extern "C" { - #[doc = " Lex a scaling mode (one of \"none\", \"stretch\", \"scale\", \"hires\", or \"scalehi\")."] - pub fn notcurses_lex_scalemode(op: *const cty::c_char, scalemode: *mut ncscale_e) - -> cty::c_int; -} -extern "C" { - #[doc = " Get the name of a scaling mode."] - pub fn notcurses_str_scalemode(scalemode: ncscale_e) -> *const cty::c_char; -} -extern "C" { - #[doc = " Initialize a Notcurses context on the connected terminal at 'fp'. 'fp' must"] - #[doc = " be a tty. You'll usually want stdout. NULL can be supplied for 'fp', in"] - #[doc = " which case /dev/tty will be opened. Returns NULL on error, including any"] - #[doc = " failure initializing terminfo."] - pub fn notcurses_init(opts: *const notcurses_options, fp: *mut FILE) -> *mut notcurses; -} -extern "C" { - #[doc = " The same as notcurses_init(), but without any multimedia functionality,"] - #[doc = " allowing for a svelter binary. Link with notcurses-core if this is used."] - pub fn notcurses_core_init(opts: *const notcurses_options, fp: *mut FILE) -> *mut notcurses; -} -extern "C" { - #[doc = " Destroy a Notcurses context."] - pub fn notcurses_stop(nc: *mut notcurses) -> cty::c_int; -} -extern "C" { - #[doc = " Return the topmost plane of the pile containing 'n'."] - pub fn ncpile_top(n: *mut ncplane) -> *mut ncplane; -} -extern "C" { - #[doc = " Return the bottommost plane of the pile containing 'n'."] - pub fn ncpile_bottom(n: *mut ncplane) -> *mut ncplane; -} -extern "C" { - #[doc = " Renders the pile of which 'n' is a part. Rendering this pile again will blow"] - #[doc = " away the render. To actually write out the render, call ncpile_rasterize()."] - pub fn ncpile_render(n: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Make the physical screen match the last rendered frame from the pile of"] - #[doc = " which 'n' is a part. This is a blocking call. Don't call this before the"] - #[doc = " pile has been rendered (doing so will likely result in a blank screen)."] - pub fn ncpile_rasterize(n: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Renders and rasterizes the standard pile in one shot. Blocking call."] - pub fn notcurses_render(nc: *mut notcurses) -> cty::c_int; -} -extern "C" { - #[doc = " Perform the rendering and rasterization portion of notcurses_render(), but"] - #[doc = " do not write the resulting buffer out to the terminal. Using this function,"] - #[doc = " the user can control the writeout process, and render a second frame while"] - #[doc = " writing another. The returned buffer must be freed by the caller."] - pub fn notcurses_render_to_buffer( - nc: *mut notcurses, - buf: *mut *mut cty::c_char, - buflen: *mut size_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Write the last rendered frame, in its entirety, to 'fp'. If"] - #[doc = " notcurses_render() has not yet been called, nothing will be written."] - pub fn notcurses_render_to_file(nc: *mut notcurses, fp: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Return the topmost ncplane of the standard pile."] - pub fn notcurses_top(n: *mut notcurses) -> *mut ncplane; -} -extern "C" { - #[doc = " Return the bottommost ncplane of the standard pile."] - pub fn notcurses_bottom(n: *mut notcurses) -> *mut ncplane; -} -extern "C" { - #[doc = " Destroy all ncplanes other than the stdplane."] - pub fn notcurses_drop_planes(nc: *mut notcurses); -} -#[doc = " An input event. Cell coordinates are currently defined only for mouse events."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncinput { - #[doc = " identifier. Unicode codepoint or synthesized NCKEY event"] - pub id: char32_t, - #[doc = " y cell coordinate of event, -1 for undefined"] - pub y: cty::c_int, - #[doc = " x cell coordinate of event, -1 for undefined"] - pub x: cty::c_int, - #[doc = " was alt held?"] - pub alt: bool, - #[doc = " was shift held?"] - pub shift: bool, - #[doc = " was ctrl held?"] - pub ctrl: bool, - #[doc = " input event number"] - pub seqnum: u64, -} -#[test] -fn bindgen_test_layout_ncinput() { - assert_eq!( - ::core::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(ncinput)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncinput)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).id as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncinput), - "::", - stringify!(id) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).y as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(ncinput), - "::", - stringify!(y) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).x as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncinput), - "::", - stringify!(x) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).alt as *const _ as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(ncinput), - "::", - stringify!(alt) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).shift as *const _ as usize }, - 13usize, - concat!( - "Offset of field: ", - stringify!(ncinput), - "::", - stringify!(shift) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).ctrl as *const _ as usize }, - 14usize, - concat!( - "Offset of field: ", - stringify!(ncinput), - "::", - stringify!(ctrl) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).seqnum as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncinput), - "::", - stringify!(seqnum) - ) - ); -} -extern "C" { - #[doc = " See ppoll(2) for more detail. Provide a NULL 'ts' to block at length, a 'ts'"] - #[doc = " of 0 for non-blocking operation, and otherwise a timespec to bound blocking."] - #[doc = " Signals in sigmask (less several we handle internally) will be atomically"] - #[doc = " masked and unmasked per ppoll(2). It should generally contain all signals."] - #[doc = " Returns a single Unicode code point, or (char32_t)-1 on error. 'sigmask' may"] - #[doc = " be NULL. Returns 0 on a timeout. If an event is processed, the return value"] - #[doc = " is the 'id' field from that event. 'ni' may be NULL."] - pub fn notcurses_getc( - n: *mut notcurses, - ts: *const timespec, - sigmask: *mut sigset_t, - ni: *mut ncinput, - ) -> char32_t; -} -extern "C" { - #[doc = " Get a file descriptor suitable for input event poll()ing. When this"] - #[doc = " descriptor becomes available, you can call notcurses_getc_nblock(),"] - #[doc = " and input ought be ready. This file descriptor is *not* necessarily"] - #[doc = " the file descriptor associated with stdin (but it might be!)."] - pub fn notcurses_inputready_fd(n: *mut notcurses) -> cty::c_int; -} -extern "C" { - #[doc = " Enable the mouse in \"button-event tracking\" mode with focus detection and"] - #[doc = " UTF8-style extended coordinates. On failure, -1 is returned. On success, 0"] - #[doc = " is returned, and mouse events will be published to notcurses_getc()."] - pub fn notcurses_mouse_enable(n: *mut notcurses) -> cty::c_int; -} -extern "C" { - #[doc = " Disable mouse events. Any events in the input queue can still be delivered."] - pub fn notcurses_mouse_disable(n: *mut notcurses) -> cty::c_int; -} -extern "C" { - #[doc = " Disable signals originating from the terminal's line discipline, i.e."] - #[doc = " SIGINT (^C), SIGQUIT (^\\), and SIGTSTP (^Z). They are enabled by default."] - pub fn notcurses_linesigs_disable(n: *mut notcurses) -> cty::c_int; -} -extern "C" { - #[doc = " Restore signals originating from the terminal's line discipline, i.e."] - #[doc = " SIGINT (^C), SIGQUIT (^\\), and SIGTSTP (^Z), if disabled."] - pub fn notcurses_linesigs_enable(n: *mut notcurses) -> cty::c_int; -} -extern "C" { - #[doc = " Refresh the physical screen to match what was last rendered (i.e., without"] - #[doc = " reflecting any changes since the last call to notcurses_render()). This is"] - #[doc = " primarily useful if the screen is externally corrupted, or if an"] - #[doc = " NCKEY_RESIZE event has been read and you're not yet ready to render."] - pub fn notcurses_refresh( - n: *mut notcurses, - y: *mut cty::c_int, - x: *mut cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Extract the Notcurses context to which this plane is attached."] - pub fn ncplane_notcurses(n: *mut ncplane) -> *mut notcurses; -} -extern "C" { - pub fn ncplane_notcurses_const(n: *const ncplane) -> *const notcurses; -} -extern "C" { - #[doc = " Return the dimensions of this ncplane."] - pub fn ncplane_dim_yx(n: *const ncplane, y: *mut cty::c_int, x: *mut cty::c_int); -} -extern "C" { - #[doc = " Get a reference to the standard plane (one matching our current idea of the"] - #[doc = " terminal size) for this terminal. The standard plane always exists, and its"] - #[doc = " origin is always at the uppermost, leftmost cell of the terminal."] - pub fn notcurses_stdplane(nc: *mut notcurses) -> *mut ncplane; -} -extern "C" { - pub fn notcurses_stdplane_const(nc: *const notcurses) -> *const ncplane; -} -extern "C" { - #[doc = " Retrieve the contents of the specified cell as last rendered. Returns the EGC"] - #[doc = " or NULL on error. This EGC must be free()d by the caller. The stylemask and"] - #[doc = " channels are written to 'stylemask' and 'channels', respectively."] - pub fn notcurses_at_yx( - nc: *mut notcurses, - yoff: cty::c_int, - xoff: cty::c_int, - stylemask: *mut u16, - channels: *mut u64, - ) -> *mut cty::c_char; -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncplane_options { - #[doc = " vertical placement relative to parent plane"] - pub y: cty::c_int, - #[doc = " horizontal placement relative to parent plane"] - pub x: cty::c_int, - #[doc = " rows, must be positive (unless NCPLANE_OPTION_MARGINALIZED)"] - pub rows: cty::c_int, - #[doc = " columns, must be positive (unless NCPLANE_OPTION_MARGINALIZED)"] - pub cols: cty::c_int, - #[doc = " user curry, may be NULL"] - pub userptr: *mut cty::c_void, - #[doc = " name (used only for debugging), may be NULL"] - pub name: *const cty::c_char, - #[doc = " callback when parent is resized"] - pub resizecb: ::core::option::Option cty::c_int>, - #[doc = " closure over NCPLANE_OPTION_*"] - pub flags: u64, - #[doc = " margins (require NCPLANE_OPTION_MARGINALIZED)"] - pub margin_b: cty::c_int, - #[doc = " margins (require NCPLANE_OPTION_MARGINALIZED)"] - pub margin_r: cty::c_int, -} -#[test] -fn bindgen_test_layout_ncplane_options() { - assert_eq!( - ::core::mem::size_of::(), - 56usize, - concat!("Size of: ", stringify!(ncplane_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncplane_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).y as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(y) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).x as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(x) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).rows as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(rows) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).cols as *const _ as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(cols) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).userptr as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(userptr) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).name as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(name) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).resizecb as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(resizecb) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(flags) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).margin_b as *const _ as usize }, - 48usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(margin_b) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).margin_r as *const _ as usize }, - 52usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(margin_r) - ) - ); -} -extern "C" { - #[doc = " Create a new ncplane bound to plane 'n', at the offset 'y'x'x' (relative to"] - #[doc = " the origin of 'n') and the specified size. The number of 'rows' and 'cols'"] - #[doc = " must both be positive. This plane is initially at the top of the z-buffer,"] - #[doc = " as if ncplane_move_top() had been called on it. The void* 'userptr' can be"] - #[doc = " retrieved (and reset) later. A 'name' can be set, used in debugging."] - pub fn ncplane_create(n: *mut ncplane, nopts: *const ncplane_options) -> *mut ncplane; -} -extern "C" { - #[doc = " Same as ncplane_create(), but creates a new pile. The returned plane will"] - #[doc = " be the top, bottom, and root of this new pile."] - pub fn ncpile_create(nc: *mut notcurses, nopts: *const ncplane_options) -> *mut ncplane; -} -extern "C" { - #[doc = " This function will be removed in ABI3 in favor of ncplane_create()."] - #[doc = " It persists in ABI2 only for backwards compatibility."] - pub fn ncplane_new( - n: *mut ncplane, - rows: cty::c_int, - cols: cty::c_int, - y: cty::c_int, - x: cty::c_int, - opaque: *mut cty::c_void, - name: *const cty::c_char, - ) -> *mut ncplane; -} -extern "C" { - #[doc = " Suitable for use as a 'resizecb', this will resize the plane to the visual"] - #[doc = " region's size. It is used for the standard plane."] - pub fn ncplane_resize_maximize(n: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Suitable for use as a 'resizecb' with planes created with"] - #[doc = " NCPLANE_OPTION_MARGINALIZED. This will resize the plane 'n' against its"] - #[doc = " parent, attempting to enforce the supplied margins."] - pub fn ncplane_resize_marginalized(n: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Suitable for use as a 'resizecb'. This will realign the plane 'n' against"] - #[doc = " its parent, using the alignment specified at ncplane_create()-time."] - pub fn ncplane_resize_realign(n: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Replace the ncplane's existing resizecb with 'resizecb' (which may be NULL)."] - #[doc = " The standard plane's resizecb may not be changed."] - pub fn ncplane_set_resizecb( - n: *mut ncplane, - resizecb: ::core::option::Option cty::c_int>, - ); -} -extern "C" { - #[doc = " Returns the ncplane's current resize callback."] - pub fn ncplane_resizecb( - n: *const ncplane, - ) -> ::core::option::Option cty::c_int>; -} -extern "C" { - #[doc = " Plane 'n' will be unbound from its parent plane, and will be made a bound"] - #[doc = " child of 'newparent'. It is an error if 'n' or 'newparent' are NULL. If"] - #[doc = " 'newparent' is equal to 'n', 'n' becomes the root of a new pile, unless 'n'"] - #[doc = " is already the root of a pile, in which case this is a no-op. Returns 'n'."] - #[doc = " The standard plane cannot be reparented. Any planes bound to 'n' are"] - #[doc = " reparented to the previous parent of 'n'."] - pub fn ncplane_reparent(n: *mut ncplane, newparent: *mut ncplane) -> *mut ncplane; -} -extern "C" { - #[doc = " The same as ncplane_reparent(), except any planes bound to 'n' come along"] - #[doc = " with it to its new destination. Their z-order is maintained. If 'newparent'"] - #[doc = " is an ancestor of 'n', NULL is returned, and no changes are made."] - pub fn ncplane_reparent_family(n: *mut ncplane, newparent: *mut ncplane) -> *mut ncplane; -} -extern "C" { - #[doc = " Duplicate an existing ncplane. The new plane will have the same geometry,"] - #[doc = " will duplicate all content, and will start with the same rendering state."] - #[doc = " The new plane will be immediately above the old one on the z axis, and will"] - #[doc = " be bound to the same parent. Bound planes are *not* duplicated; the new"] - #[doc = " plane is bound to the parent of 'n', but has no bound planes."] - pub fn ncplane_dup(n: *const ncplane, opaque: *mut cty::c_void) -> *mut ncplane; -} -extern "C" { - #[doc = " provided a coordinate relative to the origin of 'src', map it to the same"] - #[doc = " absolute coordinate relative to the origin of 'dst'. either or both of 'y'"] - #[doc = " and 'x' may be NULL. if 'dst' is NULL, it is taken to be the standard plane."] - pub fn ncplane_translate( - src: *const ncplane, - dst: *const ncplane, - y: *mut cty::c_int, - x: *mut cty::c_int, - ); -} -extern "C" { - #[doc = " Fed absolute 'y'/'x' coordinates, determine whether that coordinate is"] - #[doc = " within the ncplane 'n'. If not, return false. If so, return true. Either"] - #[doc = " way, translate the absolute coordinates relative to 'n'. If the point is not"] - #[doc = " within 'n', these coordinates will not be within the dimensions of the plane."] - pub fn ncplane_translate_abs(n: *const ncplane, y: *mut cty::c_int, x: *mut cty::c_int) - -> bool; -} -extern "C" { - #[doc = " All planes are created with scrolling disabled. Scrolling can be dynamically"] - #[doc = " controlled with ncplane_set_scrolling(). Returns true if scrolling was"] - #[doc = " previously enabled, or false if it was disabled."] - pub fn ncplane_set_scrolling(n: *mut ncplane, scrollp: bool) -> bool; -} -extern "C" { - #[doc = " Returns a 16-bit bitmask of supported curses-style attributes"] - #[doc = " (NCSTYLE_UNDERLINE, NCSTYLE_BOLD, etc.) The attribute is only"] - #[doc = " indicated as supported if the terminal can support it together with color."] - #[doc = " For more information, see the \"ncv\" capability in terminfo(5)."] - pub fn notcurses_supported_styles(nc: *const notcurses) -> cty::c_uint; -} -extern "C" { - #[doc = " Returns the number of simultaneous colors claimed to be supported, or 1 if"] - #[doc = " there is no color support. Note that several terminal emulators advertise"] - #[doc = " more colors than they actually support, downsampling internally."] - pub fn notcurses_palette_size(nc: *const notcurses) -> cty::c_uint; -} -extern "C" { - #[doc = " Can we directly specify RGB values per cell, or only use palettes?"] - pub fn notcurses_cantruecolor(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " Can we fade? Fading requires either the \"rgb\" or \"ccc\" terminfo capability."] - pub fn notcurses_canfade(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " Can we set the \"hardware\" palette? Requires the \"ccc\" terminfo capability."] - pub fn notcurses_canchangecolor(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " Can we load images? This requires being built against FFmpeg/OIIO."] - pub fn notcurses_canopen_images(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " Can we load videos? This requires being built against FFmpeg."] - pub fn notcurses_canopen_videos(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " Is our encoding UTF-8? Requires LANG being set to a UTF8 locale."] - pub fn notcurses_canutf8(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " Can we reliably use Unicode 13 sextants?"] - pub fn notcurses_cansextant(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " Can we reliably use Unicode Braille?"] - pub fn notcurses_canbraille(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " This function must successfully return before NCBLIT_PIXEL is available."] - #[doc = " Returns -1 on error, 0 for no support, or 1 if pixel output is supported."] - #[doc = " Must not be called concurrently with either input or rasterization."] - pub fn notcurses_check_pixel_support(nc: *mut notcurses) -> cty::c_int; -} -#[doc = " whenever a new field is added here, ensure we add the proper rule to"] -#[doc = " notcurses_stats_reset(), so that values are preserved in the stash stats."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncstats { - #[doc = " successful ncpile_render() runs"] - pub renders: u64, - #[doc = " successful ncpile_rasterize() runs"] - pub writeouts: u64, - #[doc = " aborted renders, should be 0"] - pub failed_renders: u64, - #[doc = " aborted writes"] - pub failed_writeouts: u64, - #[doc = " bytes emitted to ttyfp"] - pub render_bytes: u64, - #[doc = " max bytes emitted for a frame"] - pub render_max_bytes: i64, - #[doc = " min bytes emitted for a frame"] - pub render_min_bytes: i64, - #[doc = " nanoseconds spent rendering"] - pub render_ns: u64, - #[doc = " max ns spent in render for a frame"] - pub render_max_ns: i64, - #[doc = " min ns spent in render for a frame"] - pub render_min_ns: i64, - #[doc = " nanoseconds spent writing frames to terminal"] - pub writeout_ns: u64, - #[doc = " max ns spent writing out a frame"] - pub writeout_max_ns: i64, - #[doc = " min ns spent writing out a frame"] - pub writeout_min_ns: i64, - #[doc = " cells we elided entirely thanks to damage maps"] - pub cellelisions: u64, - #[doc = " total number of cells emitted to terminal"] - pub cellemissions: u64, - #[doc = " RGB fg elision count"] - pub fgelisions: u64, - #[doc = " RGB fg emissions"] - pub fgemissions: u64, - #[doc = " RGB bg elision count"] - pub bgelisions: u64, - #[doc = " RGB bg emissions"] - pub bgemissions: u64, - #[doc = " default color was emitted"] - pub defaultelisions: u64, - #[doc = " default color was elided"] - pub defaultemissions: u64, - #[doc = " refresh requests (non-optimized redraw)"] - pub refreshes: u64, - #[doc = " total bytes devoted to all active framebuffers"] - pub fbbytes: u64, - #[doc = " number of planes currently in existence"] - pub planes: cty::c_uint, - #[doc = " nanoseconds spent rasterizing"] - pub raster_ns: u64, - #[doc = " max ns spent in raster for a frame"] - pub raster_max_ns: i64, - #[doc = " min ns spent in raster for a frame"] - pub raster_min_ns: i64, -} -#[test] -fn bindgen_test_layout_ncstats() { - assert_eq!( - ::core::mem::size_of::(), - 216usize, - concat!("Size of: ", stringify!(ncstats)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncstats)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).renders as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(renders) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).writeouts as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(writeouts) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).failed_renders as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(failed_renders) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).failed_writeouts as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(failed_writeouts) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).render_bytes as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(render_bytes) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).render_max_bytes as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(render_max_bytes) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).render_min_bytes as *const _ as usize }, - 48usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(render_min_bytes) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).render_ns as *const _ as usize }, - 56usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(render_ns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).render_max_ns as *const _ as usize }, - 64usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(render_max_ns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).render_min_ns as *const _ as usize }, - 72usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(render_min_ns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).writeout_ns as *const _ as usize }, - 80usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(writeout_ns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).writeout_max_ns as *const _ as usize }, - 88usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(writeout_max_ns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).writeout_min_ns as *const _ as usize }, - 96usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(writeout_min_ns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).cellelisions as *const _ as usize }, - 104usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(cellelisions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).cellemissions as *const _ as usize }, - 112usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(cellemissions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).fgelisions as *const _ as usize }, - 120usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(fgelisions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).fgemissions as *const _ as usize }, - 128usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(fgemissions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).bgelisions as *const _ as usize }, - 136usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(bgelisions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).bgemissions as *const _ as usize }, - 144usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(bgemissions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).defaultelisions as *const _ as usize }, - 152usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(defaultelisions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).defaultemissions as *const _ as usize }, - 160usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(defaultemissions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).refreshes as *const _ as usize }, - 168usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(refreshes) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).fbbytes as *const _ as usize }, - 176usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(fbbytes) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).planes as *const _ as usize }, - 184usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(planes) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).raster_ns as *const _ as usize }, - 192usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(raster_ns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).raster_max_ns as *const _ as usize }, - 200usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(raster_max_ns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).raster_min_ns as *const _ as usize }, - 208usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(raster_min_ns) - ) - ); -} -extern "C" { - #[doc = " Allocate an ncstats object. Use this rather than allocating your own, since"] - #[doc = " future versions of Notcurses might enlarge this structure."] - pub fn notcurses_stats_alloc(nc: *const notcurses) -> *mut ncstats; -} -extern "C" { - #[doc = " Acquire an atomic snapshot of the Notcurses object's stats."] - pub fn notcurses_stats(nc: *mut notcurses, stats: *mut ncstats); -} -extern "C" { - #[doc = " Reset all cumulative stats (immediate ones, such as fbbytes, are not reset),"] - #[doc = " first copying them into |*stats| (if |stats| is not NULL)."] - pub fn notcurses_stats_reset(nc: *mut notcurses, stats: *mut ncstats); -} -extern "C" { - #[doc = " Resize the specified ncplane. The four parameters 'keepy', 'keepx',"] - #[doc = " 'keepleny', and 'keeplenx' define a subset of the ncplane to keep,"] - #[doc = " unchanged. This may be a section of size 0, though none of these four"] - #[doc = " parameters may be negative. 'keepx' and 'keepy' are relative to the ncplane."] - #[doc = " They must specify a coordinate within the ncplane's totality. 'yoff' and"] - #[doc = " 'xoff' are relative to 'keepy' and 'keepx', and place the upper-left corner"] - #[doc = " of the resized ncplane. Finally, 'ylen' and 'xlen' are the dimensions of the"] - #[doc = " ncplane after resizing. 'ylen' must be greater than or equal to 'keepleny',"] - #[doc = " and 'xlen' must be greater than or equal to 'keeplenx'. It is an error to"] - #[doc = " attempt to resize the standard plane. If either of 'keepleny' or 'keeplenx'"] - #[doc = " is non-zero, both must be non-zero."] - #[doc = ""] - #[doc = " Essentially, the kept material does not move. It serves to anchor the"] - #[doc = " resized plane. If there is no kept material, the plane can move freely."] - pub fn ncplane_resize( - n: *mut ncplane, - keepy: cty::c_int, - keepx: cty::c_int, - keepleny: cty::c_int, - keeplenx: cty::c_int, - yoff: cty::c_int, - xoff: cty::c_int, - ylen: cty::c_int, - xlen: cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Destroy the specified ncplane. None of its contents will be visible after"] - #[doc = " the next call to notcurses_render(). It is an error to attempt to destroy"] - #[doc = " the standard plane."] - pub fn ncplane_destroy(n: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Set the ncplane's base nccell to 'c'. The base cell is used for purposes of"] - #[doc = " rendering anywhere that the ncplane's gcluster is 0. Note that the base cell"] - #[doc = " is not affected by ncplane_erase(). 'c' must not be a secondary cell from a"] - #[doc = " multicolumn EGC."] - pub fn ncplane_set_base_cell(n: *mut ncplane, c: *const nccell) -> cty::c_int; -} -extern "C" { - #[doc = " Set the ncplane's base nccell. It will be used for purposes of rendering"] - #[doc = " anywhere that the ncplane's gcluster is 0. Note that the base cell is not"] - #[doc = " affected by ncplane_erase(). 'egc' must be an extended grapheme cluster."] - pub fn ncplane_set_base( - n: *mut ncplane, - egc: *const cty::c_char, - stylemask: u32, - channels: u64, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Extract the ncplane's base nccell into 'c'. The reference is invalidated if"] - #[doc = " 'ncp' is destroyed."] - pub fn ncplane_base(n: *mut ncplane, c: *mut nccell) -> cty::c_int; -} -extern "C" { - #[doc = " Move this plane relative to the standard plane, or the plane to which it is"] - #[doc = " bound (if it is bound to a plane). It is an error to attempt to move the"] - #[doc = " standard plane."] - pub fn ncplane_move_yx(n: *mut ncplane, y: cty::c_int, x: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Get the origin of plane 'n' relative to its bound plane, or pile (if 'n' is"] - #[doc = " a root plane). To get absolute coordinates, use ncplane_abs_yx()."] - pub fn ncplane_yx(n: *const ncplane, y: *mut cty::c_int, x: *mut cty::c_int); -} -extern "C" { - pub fn ncplane_y(n: *const ncplane) -> cty::c_int; -} -extern "C" { - pub fn ncplane_x(n: *const ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Get the origin of plane 'n' relative to its pile. Either or both of 'x' and"] - #[doc = " 'y' may be NULL."] - pub fn ncplane_abs_yx(n: *const ncplane, y: *mut cty::c_int, x: *mut cty::c_int); -} -extern "C" { - pub fn ncplane_abs_y(n: *const ncplane) -> cty::c_int; -} -extern "C" { - pub fn ncplane_abs_x(n: *const ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Get the plane to which the plane 'n' is bound, if any."] - pub fn ncplane_parent(n: *mut ncplane) -> *mut ncplane; -} -extern "C" { - pub fn ncplane_parent_const(n: *const ncplane) -> *const ncplane; -} -extern "C" { - #[doc = " Splice ncplane 'n' out of the z-buffer, and reinsert it at the top or bottom."] - pub fn ncplane_move_top(n: *mut ncplane); -} -extern "C" { - pub fn ncplane_move_bottom(n: *mut ncplane); -} -extern "C" { - #[doc = " Splice ncplane 'n' out of the z-buffer, and reinsert it above 'above'."] - #[doc = " Returns non-zero if 'n' is already in the desired location. 'n' and"] - #[doc = " 'above' must not be the same plane."] - pub fn ncplane_move_above(n: *mut ncplane, above: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Splice ncplane 'n' out of the z-buffer, and reinsert it below 'below'."] - #[doc = " Returns non-zero if 'n' is already in the desired location. 'n' and"] - #[doc = " 'below' must not be the same plane."] - pub fn ncplane_move_below(n: *mut ncplane, below: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Return the plane below this one, or NULL if this is at the bottom."] - pub fn ncplane_below(n: *mut ncplane) -> *mut ncplane; -} -extern "C" { - pub fn ncplane_above(n: *mut ncplane) -> *mut ncplane; -} -extern "C" { - #[doc = " Rotate the plane π/2 radians clockwise or counterclockwise. This cannot"] - #[doc = " be performed on arbitrary planes, because glyphs cannot be arbitrarily"] - #[doc = " rotated. The glyphs which can be rotated are limited: line-drawing"] - #[doc = " characters, spaces, half blocks, and full blocks. The plane must have"] - #[doc = " an even number of columns. Use the ncvisual rotation for a more"] - #[doc = " flexible approach."] - pub fn ncplane_rotate_cw(n: *mut ncplane) -> cty::c_int; -} -extern "C" { - pub fn ncplane_rotate_ccw(n: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Retrieve the current contents of the cell under the cursor. The EGC is"] - #[doc = " returned, or NULL on error. This EGC must be free()d by the caller. The"] - #[doc = " stylemask and channels are written to 'stylemask' and 'channels', respectively."] - pub fn ncplane_at_cursor( - n: *mut ncplane, - stylemask: *mut u16, - channels: *mut u64, - ) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Retrieve the current contents of the cell under the cursor into 'c'. This"] - #[doc = " cell is invalidated if the associated plane is destroyed. Returns the number"] - #[doc = " of bytes in the EGC, or -1 on error."] - pub fn ncplane_at_cursor_cell(n: *mut ncplane, c: *mut nccell) -> cty::c_int; -} -extern "C" { - #[doc = " Retrieve the current contents of the specified cell. The EGC is returned, or"] - #[doc = " NULL on error. This EGC must be free()d by the caller. The stylemask and"] - #[doc = " channels are written to 'stylemask' and 'channels', respectively."] - pub fn ncplane_at_yx( - n: *const ncplane, - y: cty::c_int, - x: cty::c_int, - stylemask: *mut u16, - channels: *mut u64, - ) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Retrieve the current contents of the specified cell into 'c'. This cell is"] - #[doc = " invalidated if the associated plane is destroyed. Returns the number of"] - #[doc = " bytes in the EGC, or -1 on error."] - pub fn ncplane_at_yx_cell( - n: *mut ncplane, - y: cty::c_int, - x: cty::c_int, - c: *mut nccell, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Create a flat string from the EGCs of the selected region of the ncplane"] - #[doc = " 'n'. Start at the plane's 'begy'x'begx' coordinate (which must lie on the"] - #[doc = " plane), continuing for 'leny'x'lenx' cells. Either or both of 'leny' and"] - #[doc = " 'lenx' can be specified as -1 to go through the boundary of the plane."] - pub fn ncplane_contents( - n: *const ncplane, - begy: cty::c_int, - begx: cty::c_int, - leny: cty::c_int, - lenx: cty::c_int, - ) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Manipulate the opaque user pointer associated with this plane."] - #[doc = " ncplane_set_userptr() returns the previous userptr after replacing"] - #[doc = " it with 'opaque'. the others simply return the userptr."] - pub fn ncplane_set_userptr(n: *mut ncplane, opaque: *mut cty::c_void) -> *mut cty::c_void; -} -extern "C" { - pub fn ncplane_userptr(n: *mut ncplane) -> *mut cty::c_void; -} -extern "C" { - pub fn ncplane_center_abs(n: *const ncplane, y: *mut cty::c_int, x: *mut cty::c_int); -} -extern "C" { - #[doc = " Move the cursor to the specified position (the cursor needn't be visible)."] - #[doc = " Returns -1 on error, including negative parameters, or ones exceeding the"] - #[doc = " plane's dimensions."] - pub fn ncplane_cursor_move_yx(n: *mut ncplane, y: cty::c_int, x: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Move the cursor to 0, 0. Can't fail."] - pub fn ncplane_home(n: *mut ncplane); -} -extern "C" { - #[doc = " Get the current position of the cursor within n. y and/or x may be NULL."] - pub fn ncplane_cursor_yx(n: *const ncplane, y: *mut cty::c_int, x: *mut cty::c_int); -} -extern "C" { - #[doc = " Get the current channels or attribute word for ncplane 'n'."] - pub fn ncplane_channels(n: *const ncplane) -> u64; -} -extern "C" { - #[doc = " Return the current styling for this ncplane."] - pub fn ncplane_styles(n: *const ncplane) -> u16; -} -extern "C" { - #[doc = " Replace the cell at the specified coordinates with the provided cell 'c',"] - #[doc = " and advance the cursor by the width of the cell (but not past the end of the"] - #[doc = " plane). On success, returns the number of columns the cursor was advanced."] - #[doc = " 'c' must already be associated with 'n'. On failure, -1 is returned."] - pub fn ncplane_putc_yx( - n: *mut ncplane, - y: cty::c_int, - x: cty::c_int, - c: *const nccell, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Replace the EGC underneath us, but retain the styling. The current styling"] - #[doc = " of the plane will not be changed."] - pub fn ncplane_putchar_stained(n: *mut ncplane, c: cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Replace the cell at the specified coordinates with the provided EGC, and"] - #[doc = " advance the cursor by the width of the cluster (but not past the end of the"] - #[doc = " plane). On success, returns the number of columns the cursor was advanced."] - #[doc = " On failure, -1 is returned. The number of bytes converted from gclust is"] - #[doc = " written to 'sbytes' if non-NULL."] - pub fn ncplane_putegc_yx( - n: *mut ncplane, - y: cty::c_int, - x: cty::c_int, - gclust: *const cty::c_char, - sbytes: *mut cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Replace the EGC underneath us, but retain the styling. The current styling"] - #[doc = " of the plane will not be changed."] - pub fn ncplane_putegc_stained( - n: *mut ncplane, - gclust: *const cty::c_char, - sbytes: *mut cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Replace the EGC underneath us, but retain the styling. The current styling"] - #[doc = " of the plane will not be changed."] - pub fn ncplane_putwegc_stained( - n: *mut ncplane, - gclust: *const wchar_t, - sbytes: *mut cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Write a series of EGCs to the current location, using the current style."] - #[doc = " They will be interpreted as a series of columns (according to the definition"] - #[doc = " of ncplane_putc()). Advances the cursor by some positive number of columns"] - #[doc = " (though not beyond the end of the plane); this number is returned on success."] - #[doc = " On error, a non-positive number is returned, indicating the number of columns"] - #[doc = " which were written before the error."] - pub fn ncplane_putstr_yx( - n: *mut ncplane, - y: cty::c_int, - x: cty::c_int, - gclusters: *const cty::c_char, - ) -> cty::c_int; -} -extern "C" { - pub fn ncplane_putstr_aligned( - n: *mut ncplane, - y: cty::c_int, - align: ncalign_e, - s: *const cty::c_char, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Replace a string's worth of glyphs at the current cursor location, but"] - #[doc = " retain the styling. The current styling of the plane will not be changed."] - pub fn ncplane_putstr_stained(n: *mut ncplane, s: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Write a series of EGCs to the current location, using the current style."] - #[doc = " They will be interpreted as a series of columns (according to the definition"] - #[doc = " of ncplane_putc()). Advances the cursor by some positive number of columns"] - #[doc = " (though not beyond the end of the plane); this number is returned on success."] - #[doc = " On error, a non-positive number is returned, indicating the number of columns"] - #[doc = " which were written before the error. No more than 's' bytes will be written."] - pub fn ncplane_putnstr_yx( - n: *mut ncplane, - y: cty::c_int, - x: cty::c_int, - s: size_t, - gclusters: *const cty::c_char, - ) -> cty::c_int; -} -extern "C" { - pub fn ncplane_putnstr_aligned( - n: *mut ncplane, - y: cty::c_int, - align: ncalign_e, - s: size_t, - gclustarr: *const cty::c_char, - ) -> cty::c_int; -} -extern "C" { - pub fn ncplane_putwstr_stained(n: *mut ncplane, gclustarr: *const wchar_t) -> cty::c_int; -} -extern "C" { - #[doc = " The ncplane equivalents of printf(3) and vprintf(3)."] - pub fn ncplane_vprintf_aligned( - n: *mut ncplane, - y: cty::c_int, - align: ncalign_e, - format: *const cty::c_char, - ap: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - pub fn ncplane_vprintf_yx( - n: *mut ncplane, - y: cty::c_int, - x: cty::c_int, - format: *const cty::c_char, - ap: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - pub fn ncplane_vprintf_stained( - n: *mut ncplane, - format: *const cty::c_char, - ap: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Write the specified text to the plane, breaking lines sensibly, beginning at"] - #[doc = " the specified line. Returns the number of columns written. When breaking a"] - #[doc = " line, the line will be cleared to the end of the plane (the last line will"] - #[doc = " *not* be so cleared). The number of bytes written from the input is written"] - #[doc = " to '*bytes' if it is not NULL. Cleared columns are included in the return"] - #[doc = " value, but *not* included in the number of bytes written. Leaves the cursor"] - #[doc = " at the end of output. A partial write will be accomplished as far as it can;"] - #[doc = " determine whether the write completed by inspecting '*bytes'. Can output to"] - #[doc = " multiple rows even in the absence of scrolling, but not more rows than are"] - #[doc = " available. With scrolling enabled, arbitrary amounts of data can be emitted."] - #[doc = " All provided whitespace is preserved -- ncplane_puttext() followed by an"] - #[doc = " appropriate ncplane_contents() will read back the original output."] - #[doc = ""] - #[doc = " If 'y' is -1, the first row of output is taken relative to the current"] - #[doc = " cursor: it will be left-, right-, or center-aligned in whatever remains"] - #[doc = " of the row. On subsequent rows -- or if 'y' is not -1 -- the entire row can"] - #[doc = " be used, and alignment works normally."] - #[doc = ""] - #[doc = " A newline at any point will move the cursor to the next row."] - pub fn ncplane_puttext( - n: *mut ncplane, - y: cty::c_int, - align: ncalign_e, - text: *const cty::c_char, - bytes: *mut size_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Draw horizontal or vertical lines using the specified cell, starting at the"] - #[doc = " current cursor position. The cursor will end at the cell following the last"] - #[doc = " cell output (even, perhaps counter-intuitively, when drawing vertical"] - #[doc = " lines), just as if ncplane_putc() was called at that spot. Return the"] - #[doc = " number of cells drawn on success. On error, return the negative number of"] - #[doc = " cells drawn."] - pub fn ncplane_hline_interp( - n: *mut ncplane, - c: *const nccell, - len: cty::c_int, - c1: u64, - c2: u64, - ) -> cty::c_int; -} -extern "C" { - pub fn ncplane_vline_interp( - n: *mut ncplane, - c: *const nccell, - len: cty::c_int, - c1: u64, - c2: u64, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Draw a box with its upper-left corner at the current cursor position, and its"] - #[doc = " lower-right corner at 'ystop'x'xstop'. The 6 cells provided are used to draw the"] - #[doc = " upper-left, ur, ll, and lr corners, then the horizontal and vertical lines."] - #[doc = " 'ctlword' is defined in the least significant byte, where bits [7, 4] are a"] - #[doc = " gradient mask, and [3, 0] are a border mask:"] - #[doc = " * 7, 3: top"] - #[doc = " * 6, 2: right"] - #[doc = " * 5, 1: bottom"] - #[doc = " * 4, 0: left"] - #[doc = " If the gradient bit is not set, the styling from the hl/vl cells is used for"] - #[doc = " the horizontal and vertical lines, respectively. If the gradient bit is set,"] - #[doc = " the color is linearly interpolated between the two relevant corner cells."] - #[doc = ""] - #[doc = " By default, vertexes are drawn whether their connecting edges are drawn or"] - #[doc = " not. The value of the bits corresponding to NCBOXCORNER_MASK control this,"] - #[doc = " and are interpreted as the number of connecting edges necessary to draw a"] - #[doc = " given corner. At 0 (the default), corners are always drawn. At 3, corners"] - #[doc = " are never drawn (since at most 2 edges can touch a box's corner)."] - pub fn ncplane_box( - n: *mut ncplane, - ul: *const nccell, - ur: *const nccell, - ll: *const nccell, - lr: *const nccell, - hline: *const nccell, - vline: *const nccell, - ystop: cty::c_int, - xstop: cty::c_int, - ctlword: cty::c_uint, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Starting at the specified coordinate, if its glyph is different from that of"] - #[doc = " 'c', 'c' is copied into it, and the original glyph is considered the fill"] - #[doc = " target. We do the same to all cardinally-connected cells having this same"] - #[doc = " fill target. Returns the number of cells polyfilled. An invalid initial y, x"] - #[doc = " is an error. Returns the number of cells filled, or -1 on error."] - pub fn ncplane_polyfill_yx( - n: *mut ncplane, - y: cty::c_int, - x: cty::c_int, - c: *const nccell, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Draw a gradient with its upper-left corner at the current cursor position,"] - #[doc = " stopping at 'ystop'x'xstop'. The glyph composed of 'egc' and 'stylemask' is"] - #[doc = " used for all cells. The channels specified by 'ul', 'ur', 'll', and 'lr'"] - #[doc = " are composed into foreground and background gradients. To do a vertical"] - #[doc = " gradient, 'ul' ought equal 'ur' and 'll' ought equal 'lr'. To do a"] - #[doc = " horizontal gradient, 'ul' ought equal 'll' and 'ur' ought equal 'ul'. To"] - #[doc = " color everything the same, all four channels should be equivalent. The"] - #[doc = " resulting alpha values are equal to incoming alpha values. Returns the"] - #[doc = " number of cells filled on success, or -1 on failure."] - #[doc = ""] - #[doc = " Palette-indexed color is not supported."] - #[doc = ""] - #[doc = " Preconditions for gradient operations (error otherwise):"] - #[doc = ""] - #[doc = " all: only RGB colors, unless all four channels match as default"] - #[doc = " all: all alpha values must be the same"] - #[doc = " 1x1: all four colors must be the same"] - #[doc = " 1xN: both top and both bottom colors must be the same (vertical gradient)"] - #[doc = " Nx1: both left and both right colors must be the same (horizontal gradient)"] - pub fn ncplane_gradient( - n: *mut ncplane, - egc: *const cty::c_char, - stylemask: u32, - ul: u64, - ur: u64, - ll: u64, - lr: u64, - ystop: cty::c_int, - xstop: cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Do a high-resolution gradient using upper blocks and synced backgrounds."] - #[doc = " This doubles the number of vertical gradations, but restricts you to"] - #[doc = " half blocks (appearing to be full blocks). Returns the number of cells"] - #[doc = " filled on success, or -1 on error."] - pub fn ncplane_highgradient( - n: *mut ncplane, - ul: u32, - ur: u32, - ll: u32, - lr: u32, - ystop: cty::c_int, - xstop: cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " ncplane_gradent_sized() meets ncplane_highgradient()."] - pub fn ncplane_highgradient_sized( - n: *mut ncplane, - ul: u32, - ur: u32, - ll: u32, - lr: u32, - ylen: cty::c_int, - xlen: cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Set the given style throughout the specified region, keeping content and"] - #[doc = " channels unchanged. Returns the number of cells set, or -1 on failure."] - pub fn ncplane_format( - n: *mut ncplane, - ystop: cty::c_int, - xstop: cty::c_int, - stylemask: u32, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Set the given channels throughout the specified region, keeping content and"] - #[doc = " attributes unchanged. Returns the number of cells set, or -1 on failure."] - pub fn ncplane_stain( - n: *mut ncplane, - ystop: cty::c_int, - xstop: cty::c_int, - ul: u64, - ur: u64, - ll: u64, - lr: u64, - ) -> cty::c_int; -} -extern "C" { - #[doc = " If 'src' does not intersect with 'dst', 'dst' will not be changed, but it is"] - #[doc = " not an error. If 'dst' is NULL, the operation will target the standard plane."] - pub fn ncplane_mergedown_simple(src: *const ncplane, dst: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Merge the ncplane 'src' down onto the ncplane 'dst'. This is most rigorously"] - #[doc = " defined as \"write to 'dst' the frame that would be rendered were the entire"] - #[doc = " stack made up only of the specified subregion of 'src' and, below it, the"] - #[doc = " subregion of 'dst' having the specified origin. Merging is independent of"] - #[doc = " the position of 'src' viz 'dst' on the z-axis. It is an error to define a"] - #[doc = " subregion of zero area, or that is not entirely contained within 'src'. It"] - #[doc = " is an error to define a target origin such that the projected subregion is"] - #[doc = " not entirely contained within 'dst'. Behavior is undefined if 'src' and"] - #[doc = " 'dst' are equivalent. 'dst' is modified, but 'src' remains unchanged."] - pub fn ncplane_mergedown( - src: *const ncplane, - dst: *mut ncplane, - begsrcy: cty::c_int, - begsrcx: cty::c_int, - leny: cty::c_int, - lenx: cty::c_int, - dsty: cty::c_int, - dstx: cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Erase every cell in the ncplane (each cell is initialized to the null glyph"] - #[doc = " and the default channels/styles). All cells associated with this ncplane are"] - #[doc = " invalidated, and must not be used after the call, *excluding* the base cell."] - #[doc = " The cursor is homed. The plane's active attributes are unaffected."] - pub fn ncplane_erase(n: *mut ncplane); -} -extern "C" { - pub fn ncplane_set_channels(n: *mut ncplane, channels: u64); -} -extern "C" { - #[doc = " Set the specified style bits for the ncplane 'n', whether they're actively"] - #[doc = " supported or not."] - pub fn ncplane_set_styles(n: *mut ncplane, stylebits: cty::c_uint); -} -extern "C" { - #[doc = " Add the specified styles to the ncplane's existing spec."] - pub fn ncplane_on_styles(n: *mut ncplane, stylebits: cty::c_uint); -} -extern "C" { - #[doc = " Remove the specified styles from the ncplane's existing spec."] - pub fn ncplane_off_styles(n: *mut ncplane, stylebits: cty::c_uint); -} -extern "C" { - #[doc = " Deprecated forms of above."] - pub fn ncplane_styles_set(n: *mut ncplane, stylebits: cty::c_uint); -} -extern "C" { - pub fn ncplane_styles_on(n: *mut ncplane, stylebits: cty::c_uint); -} -extern "C" { - pub fn ncplane_styles_off(n: *mut ncplane, stylebits: cty::c_uint); -} -extern "C" { - #[doc = " Set an entire 32-bit channel of the plane"] - pub fn ncplane_set_fchannel(n: *mut ncplane, channel: u32) -> u64; -} -extern "C" { - pub fn ncplane_set_bchannel(n: *mut ncplane, channel: u32) -> u64; -} -extern "C" { - #[doc = " Set the current fore/background color using RGB specifications. If the"] - #[doc = " terminal does not support directly-specified 3x8b cells (24-bit \"TrueColor\","] - #[doc = " indicated by the \"RGB\" terminfo capability), the provided values will be"] - #[doc = " interpreted in some lossy fashion. None of r, g, or b may exceed 255."] - #[doc = " \"HP-like\" terminals require setting foreground and background at the same"] - #[doc = " time using \"color pairs\"; Notcurses will manage color pairs transparently."] - pub fn ncplane_set_fg_rgb8( - n: *mut ncplane, - r: cty::c_int, - g: cty::c_int, - b: cty::c_int, - ) -> cty::c_int; -} -extern "C" { - pub fn ncplane_set_bg_rgb8( - n: *mut ncplane, - r: cty::c_int, - g: cty::c_int, - b: cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Same, but clipped to [0..255]."] - pub fn ncplane_set_bg_rgb8_clipped( - n: *mut ncplane, - r: cty::c_int, - g: cty::c_int, - b: cty::c_int, - ); -} -extern "C" { - pub fn ncplane_set_fg_rgb8_clipped( - n: *mut ncplane, - r: cty::c_int, - g: cty::c_int, - b: cty::c_int, - ); -} -extern "C" { - #[doc = " Same, but with rgb assembled into a channel (i.e. lower 24 bits)."] - pub fn ncplane_set_fg_rgb(n: *mut ncplane, channel: u32) -> cty::c_int; -} -extern "C" { - pub fn ncplane_set_bg_rgb(n: *mut ncplane, channel: u32) -> cty::c_int; -} -extern "C" { - #[doc = " Use the default color for the foreground/background."] - pub fn ncplane_set_fg_default(n: *mut ncplane); -} -extern "C" { - pub fn ncplane_set_bg_default(n: *mut ncplane); -} -extern "C" { - #[doc = " Set the ncplane's foreground palette index, set the foreground palette index"] - #[doc = " bit, set it foreground-opaque, and clear the foreground default color bit."] - pub fn ncplane_set_fg_palindex(n: *mut ncplane, idx: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn ncplane_set_bg_palindex(n: *mut ncplane, idx: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Set the alpha parameters for ncplane 'n'."] - pub fn ncplane_set_fg_alpha(n: *mut ncplane, alpha: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn ncplane_set_bg_alpha(n: *mut ncplane, alpha: cty::c_int) -> cty::c_int; -} -#[doc = " Called for each fade iteration on 'ncp'. If anything but 0 is returned,"] -#[doc = " the fading operation ceases immediately, and that value is propagated out."] -#[doc = " The recommended absolute display time target is passed in 'tspec'."] -pub type fadecb = ::core::option::Option< - unsafe extern "C" fn( - nc: *mut notcurses, - n: *mut ncplane, - arg1: *const timespec, - curry: *mut cty::c_void, - ) -> cty::c_int, ->; -extern "C" { - #[doc = " Fade the ncplane out over the provided time, calling 'fader' at each"] - #[doc = " iteration. Requires a terminal which supports truecolor, or at least palette"] - #[doc = " modification (if the terminal uses a palette, our ability to fade planes is"] - #[doc = " limited, and affected by the complexity of the rest of the screen)."] - pub fn ncplane_fadeout( - n: *mut ncplane, - ts: *const timespec, - fader: fadecb, - curry: *mut cty::c_void, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Fade the ncplane in over the specified time. Load the ncplane with the"] - #[doc = " target cells without rendering, then call this function. When it's done, the"] - #[doc = " ncplane will have reached the target levels, starting from zeroes."] - pub fn ncplane_fadein( - n: *mut ncplane, - ts: *const timespec, - fader: fadecb, - curry: *mut cty::c_void, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Rather than the simple ncplane_fade{in/out}(), ncfadectx_setup() can be"] - #[doc = " paired with a loop over ncplane_fade{in/out}_iteration() + ncfadectx_free()."] - pub fn ncfadectx_setup(n: *mut ncplane) -> *mut ncfadectx; -} -extern "C" { - #[doc = " Return the number of iterations through which 'nctx' will fade."] - pub fn ncfadectx_iterations(nctx: *const ncfadectx) -> cty::c_int; -} -extern "C" { - #[doc = " Fade out through 'iter' iterations, where"] - #[doc = " 'iter' < 'ncfadectx_iterations(nctx)'."] - pub fn ncplane_fadeout_iteration( - n: *mut ncplane, - nctx: *mut ncfadectx, - iter: cty::c_int, - fader: fadecb, - curry: *mut cty::c_void, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Fade in through 'iter' iterations, where"] - #[doc = " 'iter' < 'ncfadectx_iterations(nctx)'."] - pub fn ncplane_fadein_iteration( - n: *mut ncplane, - nctx: *mut ncfadectx, - iter: cty::c_int, - fader: fadecb, - curry: *mut cty::c_void, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Pulse the plane in and out until the callback returns non-zero, relying on"] - #[doc = " the callback 'fader' to initiate rendering. 'ts' defines the half-period"] - #[doc = " (i.e. the transition from black to full brightness, or back again). Proper"] - #[doc = " use involves preparing (but not rendering) an ncplane, then calling"] - #[doc = " ncplane_pulse(), which will fade in from black to the specified colors."] - pub fn ncplane_pulse( - n: *mut ncplane, - ts: *const timespec, - fader: fadecb, - curry: *mut cty::c_void, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Release the resources associated with 'nctx'."] - pub fn ncfadectx_free(nctx: *mut ncfadectx); -} -extern "C" { - pub fn cells_rounded_box( - n: *mut ncplane, - styles: u32, - channels: u64, - ul: *mut nccell, - ur: *mut nccell, - ll: *mut nccell, - lr: *mut nccell, - hl: *mut nccell, - vl: *mut nccell, - ) -> cty::c_int; -} -extern "C" { - pub fn cells_double_box( - n: *mut ncplane, - styles: u32, - channels: u64, - ul: *mut nccell, - ur: *mut nccell, - ll: *mut nccell, - lr: *mut nccell, - hl: *mut nccell, - vl: *mut nccell, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Open a visual at 'file', extract a codec and parameters, decode the first"] - #[doc = " image to memory."] - pub fn ncvisual_from_file(file: *const cty::c_char) -> *mut ncvisual; -} -extern "C" { - #[doc = " Prepare an ncvisual, and its underlying plane, based off RGBA content in"] - #[doc = " memory at 'rgba'. 'rgba' must be a flat array of 32-bit 8bpc RGBA pixels."] - #[doc = " These must be arranged in 'rowstride' lines, where the first 'cols' * 4b"] - #[doc = " are actual data. There must be 'rows' lines. The total size of 'rgba'"] - #[doc = " must thus be at least (rows * rowstride) bytes, of which (rows * cols * 4)"] - #[doc = " bytes are actual data. Resulting planes are ceil('rows' / 2) x 'cols'."] - pub fn ncvisual_from_rgba( - rgba: *const cty::c_void, - rows: cty::c_int, - rowstride: cty::c_int, - cols: cty::c_int, - ) -> *mut ncvisual; -} -extern "C" { - #[doc = " ncvisual_from_rgba(), but 'bgra' is arranged as BGRA."] - pub fn ncvisual_from_bgra( - rgba: *const cty::c_void, - rows: cty::c_int, - rowstride: cty::c_int, - cols: cty::c_int, - ) -> *mut ncvisual; -} -extern "C" { - #[doc = " Promote an ncplane 'n' to an ncvisual. The plane may contain only spaces,"] - #[doc = " half blocks, and full blocks. The latter will be checked, and any other"] - #[doc = " glyph will result in a NULL being returned. This function exists so that"] - #[doc = " planes can be subjected to ncvisual transformations. If possible, it's"] - #[doc = " better to create the ncvisual from memory using ncvisual_from_rgba()."] - pub fn ncvisual_from_plane( - n: *const ncplane, - blit: ncblitter_e, - begy: cty::c_int, - begx: cty::c_int, - leny: cty::c_int, - lenx: cty::c_int, - ) -> *mut ncvisual; -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncvisual_options { - #[doc = " if no ncplane is provided, one will be created using the exact size"] - #[doc = " necessary to render the source with perfect fidelity (this might be"] - #[doc = " smaller or larger than the rendering area)."] - pub n: *mut ncplane, - #[doc = " the scaling is ignored if no ncplane is provided (it ought be NCSCALE_NONE"] - #[doc = " in this case). otherwise, the source is stretched/scaled relative to the"] - #[doc = " provided ncplane."] - pub scaling: ncscale_e, - #[doc = " if an ncplane is provided, y and x specify where the visual will be"] - #[doc = " rendered on that plane. otherwise, they specify where the created ncplane"] - #[doc = " will be placed relative to the standard plane's origin. x is an ncalign_e"] - #[doc = " value if NCVISUAL_OPTION_HORALIGNED is provided. y is an ncalign_e if"] - #[doc = " NCVISUAL_OPTION_VERALIGNED is provided."] - pub y: cty::c_int, - #[doc = " if an ncplane is provided, y and x specify where the visual will be"] - #[doc = " rendered on that plane. otherwise, they specify where the created ncplane"] - #[doc = " will be placed relative to the standard plane's origin. x is an ncalign_e"] - #[doc = " value if NCVISUAL_OPTION_HORALIGNED is provided. y is an ncalign_e if"] - #[doc = " NCVISUAL_OPTION_VERALIGNED is provided."] - pub x: cty::c_int, - #[doc = " origin of rendered section"] - pub begy: cty::c_int, - #[doc = " origin of rendered section"] - pub begx: cty::c_int, - #[doc = " size of rendered section"] - pub leny: cty::c_int, - #[doc = " size of rendered section"] - pub lenx: cty::c_int, - #[doc = " glyph set to use (maps input to output cells)"] - pub blitter: ncblitter_e, - #[doc = " bitmask over NCVISUAL_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncvisual_options() { - assert_eq!( - ::core::mem::size_of::(), - 48usize, - concat!("Size of: ", stringify!(ncvisual_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncvisual_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).n as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(n) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).scaling as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(scaling) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).y as *const _ as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(y) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).x as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(x) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).begy as *const _ as usize }, - 20usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(begy) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).begx as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(begx) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).leny as *const _ as usize }, - 28usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(leny) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).lenx as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(lenx) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).blitter as *const _ as usize }, - 36usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(blitter) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(flags) - ) - ); -} -extern "C" { - #[doc = " Create an RGBA flat array from the selected region of the ncplane 'nc'."] - #[doc = " Start at the plane's 'begy'x'begx' coordinate (which must lie on the"] - #[doc = " plane), continuing for 'leny'x'lenx' cells. Either or both of 'leny' and"] - #[doc = " 'lenx' can be specified as -1 to go through the boundary of the plane."] - #[doc = " Only glyphs from the specified blitset may be present."] - pub fn ncplane_rgba( - n: *const ncplane, - blit: ncblitter_e, - begy: cty::c_int, - begx: cty::c_int, - leny: cty::c_int, - lenx: cty::c_int, - ) -> *mut u32; -} -extern "C" { - #[doc = " Get the size and ratio of ncvisual pixels to output cells along the y"] - #[doc = " ('toy') and x ('tox') axes. A ncvisual of '*y'X'*x' pixels will require"] - #[doc = " ('*y' * '*toy')X('x' * 'tox') cells for full output. Returns non-zero"] - #[doc = " for an invalid 'vopts->blitter'. Scaling is taken into consideration."] - pub fn ncvisual_geom( - nc: *const notcurses, - n: *const ncvisual, - vopts: *const ncvisual_options, - y: *mut cty::c_int, - x: *mut cty::c_int, - toy: *mut cty::c_int, - tox: *mut cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Destroy an ncvisual. Rendered elements will not be disrupted, but the visual"] - #[doc = " can be neither decoded nor rendered any further."] - pub fn ncvisual_destroy(ncv: *mut ncvisual); -} -extern "C" { - #[doc = " extract the next frame from an ncvisual. returns 1 on end of file, 0 on"] - #[doc = " success, and -1 on failure."] - pub fn ncvisual_decode(nc: *mut ncvisual) -> cty::c_int; -} -extern "C" { - #[doc = " decode the next frame ala ncvisual_decode(), but if we have reached the end,"] - #[doc = " rewind to the first frame of the ncvisual. a subsequent 'ncvisual_render()'"] - #[doc = " will render the first frame, as if the ncvisual had been closed and reopened."] - #[doc = " the return values remain the same as those of ncvisual_decode()."] - pub fn ncvisual_decode_loop(nc: *mut ncvisual) -> cty::c_int; -} -extern "C" { - #[doc = " Rotate the visual 'rads' radians. Only M_PI/2 and -M_PI/2 are"] - #[doc = " supported at the moment, but this will change FIXME."] - pub fn ncvisual_rotate(n: *mut ncvisual, rads: f64) -> cty::c_int; -} -extern "C" { - #[doc = " Resize the visual so that it is 'rows' X 'columns'. This is a lossy"] - #[doc = " transformation, unless the size is unchanged."] - pub fn ncvisual_resize(n: *mut ncvisual, rows: cty::c_int, cols: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Polyfill at the specified location within the ncvisual 'n', using 'rgba'."] - pub fn ncvisual_polyfill_yx( - n: *mut ncvisual, - y: cty::c_int, - x: cty::c_int, - rgba: u32, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Get the specified pixel from the specified ncvisual."] - pub fn ncvisual_at_yx( - n: *const ncvisual, - y: cty::c_int, - x: cty::c_int, - pixel: *mut u32, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Set the specified pixel in the specified ncvisual."] - pub fn ncvisual_set_yx( - n: *const ncvisual, - y: cty::c_int, - x: cty::c_int, - pixel: u32, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Render the decoded frame to the specified ncplane (if one is not provided,"] - #[doc = " one will be created, having the exact size necessary to display the visual."] - #[doc = " In this case, 'style' must be NCSTYLE_NONE). A subregion of the visual can"] - #[doc = " be rendered using 'begx', 'begy', 'lenx', and 'leny'. Negative values for"] - #[doc = " 'begy' or 'begx' are an error. It is an error to specify any region beyond"] - #[doc = " the boundaries of the frame. Returns the plane to which we drew (if ncv->n"] - #[doc = " is NULL, a new plane will be created)."] - pub fn ncvisual_render( - nc: *mut notcurses, - ncv: *mut ncvisual, - vopts: *const ncvisual_options, - ) -> *mut ncplane; -} -extern "C" { - #[doc = " If a subtitle ought be displayed at this time, return a heap-allocated copy"] - #[doc = " of the UTF8 text."] - pub fn ncvisual_subtitle(ncv: *const ncvisual) -> *mut cty::c_char; -} -#[doc = " Called for each frame rendered from 'ncv'. If anything but 0 is returned,"] -#[doc = " the streaming operation ceases immediately, and that value is propagated out."] -#[doc = " The recommended absolute display time target is passed in 'tspec'."] -pub type streamcb = ::core::option::Option< - unsafe extern "C" fn( - arg1: *mut ncvisual, - arg2: *mut ncvisual_options, - arg3: *const timespec, - arg4: *mut cty::c_void, - ) -> cty::c_int, ->; -extern "C" { - #[doc = " Shut up and display my frames! Provide as an argument to ncvisual_stream()."] - #[doc = " If you'd like subtitles to be decoded, provide an ncplane as the curry. If the"] - #[doc = " curry is NULL, subtitles will not be displayed."] - pub fn ncvisual_simple_streamer( - ncv: *mut ncvisual, - vopts: *mut ncvisual_options, - tspec: *const timespec, - curry: *mut cty::c_void, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Stream the entirety of the media, according to its own timing. Blocking,"] - #[doc = " obviously. streamer may be NULL; it is otherwise called for each frame, and"] - #[doc = " its return value handled as outlined for streamcb. If streamer() returns"] - #[doc = " non-zero, the stream is aborted, and that value is returned. By convention,"] - #[doc = " return a positive number to indicate intentional abort from within"] - #[doc = " streamer(). 'timescale' allows the frame duration time to be scaled. For a"] - #[doc = " visual naturally running at 30FPS, a 'timescale' of 0.1 will result in"] - #[doc = " 300FPS, and a 'timescale' of 10 will result in 3FPS. It is an error to"] - #[doc = " supply 'timescale' less than or equal to 0."] - pub fn ncvisual_stream( - nc: *mut notcurses, - ncv: *mut ncvisual, - timescale: f32, - streamer: streamcb, - vopts: *const ncvisual_options, - curry: *mut cty::c_void, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Blit a flat array 'data' of RGBA 32-bit values to the ncplane 'vopts->n',"] - #[doc = " which mustn't be NULL. the blit begins at 'vopts->y' and 'vopts->x' relative"] - #[doc = " to the specified plane. Each source row ought occupy 'linesize' bytes (this"] - #[doc = " might be greater than 'vopts->lenx' * 4 due to padding or partial blits). A"] - #[doc = " subregion of the input can be specified with the 'begy'x'begx' and"] - #[doc = " 'leny'x'lenx' fields from 'vopts'. Returns the number of pixels blitted, or"] - #[doc = " -1 on error."] - pub fn ncblit_rgba( - data: *const cty::c_void, - linesize: cty::c_int, - vopts: *const ncvisual_options, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Same as ncblit_rgba(), but for BGRx."] - pub fn ncblit_bgrx( - data: *const cty::c_void, - linesize: cty::c_int, - vopts: *const ncvisual_options, - ) -> cty::c_int; -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncreel_options { - #[doc = " bitfield; 1s will not be drawn (see bordermaskbits)"] - pub bordermask: cty::c_uint, - #[doc = " attributes used for ncreel border"] - pub borderchan: u64, - #[doc = " bitfield; same as bordermask but for tablet borders"] - pub tabletmask: cty::c_uint, - #[doc = " tablet border styling channel"] - pub tabletchan: u64, - #[doc = " focused tablet border styling channel"] - pub focusedchan: u64, - #[doc = " bitfield over NCREEL_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncreel_options() { - assert_eq!( - ::core::mem::size_of::(), - 48usize, - concat!("Size of: ", stringify!(ncreel_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncreel_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).bordermask as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncreel_options), - "::", - stringify!(bordermask) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).borderchan as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncreel_options), - "::", - stringify!(borderchan) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).tabletmask as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncreel_options), - "::", - stringify!(tabletmask) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).tabletchan as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncreel_options), - "::", - stringify!(tabletchan) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).focusedchan as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncreel_options), - "::", - stringify!(focusedchan) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(ncreel_options), - "::", - stringify!(flags) - ) - ); -} -extern "C" { - #[doc = " Take over the ncplane 'nc' and use it to draw a reel according to 'popts'."] - #[doc = " The plane will be destroyed by ncreel_destroy(); this transfers ownership."] - pub fn ncreel_create(n: *mut ncplane, popts: *const ncreel_options) -> *mut ncreel; -} -extern "C" { - #[doc = " Returns the ncplane on which this ncreel lives."] - pub fn ncreel_plane(nr: *mut ncreel) -> *mut ncplane; -} -#[doc = " Tablet draw callback, provided a tablet (from which the ncplane and userptr"] -#[doc = " may be extracted), and a bool indicating whether output ought be drawn from"] -#[doc = " the top (true) or bottom (false). Returns non-negative count of output lines,"] -#[doc = " which must be less than or equal to ncplane_dim_y(nctablet_plane(t))."] -pub type tabletcb = - ::core::option::Option cty::c_int>; -extern "C" { - #[doc = " Add a new nctablet to the provided ncreel 'nr', having the callback object"] - #[doc = " 'opaque'. Neither, either, or both of 'after' and 'before' may be specified."] - #[doc = " If neither is specified, the new tablet can be added anywhere on the reel."] - #[doc = " If one or the other is specified, the tablet will be added before or after"] - #[doc = " the specified tablet. If both are specified, the tablet will be added to the"] - #[doc = " resulting location, assuming it is valid (after->next == before->prev); if"] - #[doc = " it is not valid, or there is any other error, NULL will be returned."] - pub fn ncreel_add( - nr: *mut ncreel, - after: *mut nctablet, - before: *mut nctablet, - cb: tabletcb, - opaque: *mut cty::c_void, - ) -> *mut nctablet; -} -extern "C" { - #[doc = " Return the number of nctablets in the ncreel 'nr'."] - pub fn ncreel_tabletcount(nr: *const ncreel) -> cty::c_int; -} -extern "C" { - #[doc = " Delete the tablet specified by t from the ncreel 'nr'. Returns -1 if the"] - #[doc = " tablet cannot be found."] - pub fn ncreel_del(nr: *mut ncreel, t: *mut nctablet) -> cty::c_int; -} -extern "C" { - #[doc = " Redraw the ncreel 'nr' in its entirety. The reel will be cleared, and"] - #[doc = " tablets will be lain out, using the focused tablet as a fulcrum. Tablet"] - #[doc = " drawing callbacks will be invoked for each visible tablet."] - pub fn ncreel_redraw(nr: *mut ncreel) -> cty::c_int; -} -extern "C" { - #[doc = " Offer input 'ni' to the ncreel 'nr'. If it's relevant, this function returns"] - #[doc = " true, and the input ought not be processed further. If it's irrelevant to"] - #[doc = " the reel, false is returned. Relevant inputs include:"] - #[doc = " * a mouse click on a tablet (focuses tablet)"] - #[doc = " * a mouse scrollwheel event (rolls reel)"] - #[doc = " * up, down, pgup, or pgdown (navigates among items)"] - pub fn ncreel_offer_input(nr: *mut ncreel, ni: *const ncinput) -> bool; -} -extern "C" { - #[doc = " Return the focused tablet, if any tablets are present. This is not a copy;"] - #[doc = " be careful to use it only for the duration of a critical section."] - pub fn ncreel_focused(nr: *mut ncreel) -> *mut nctablet; -} -extern "C" { - #[doc = " Change focus to the next tablet, if one exists"] - pub fn ncreel_next(nr: *mut ncreel) -> *mut nctablet; -} -extern "C" { - #[doc = " Change focus to the previous tablet, if one exists"] - pub fn ncreel_prev(nr: *mut ncreel) -> *mut nctablet; -} -extern "C" { - #[doc = " Destroy an ncreel allocated with ncreel_create()."] - pub fn ncreel_destroy(nr: *mut ncreel); -} -extern "C" { - #[doc = " Returns a pointer to a user pointer associated with this nctablet."] - pub fn nctablet_userptr(t: *mut nctablet) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Access the ncplane associated with nctablet 't', if one exists."] - pub fn nctablet_plane(t: *mut nctablet) -> *mut ncplane; -} -extern "C" { - #[doc = " Deprecated form of nctablet_plane()."] - pub fn nctablet_ncplane(t: *mut nctablet) -> *mut ncplane; -} -extern "C" { - #[doc = " Takes an arbitrarily large number, and prints it into a fixed-size buffer by"] - #[doc = " adding the necessary SI suffix. Usually, pass a |[IB]PREFIXSTRLEN+1|-sized"] - #[doc = " buffer to generate up to |[IB]PREFIXCOLUMNS| columns' worth of EGCs. The"] - #[doc = " characteristic can occupy up through |mult-1| characters (3 for 1000, 4 for"] - #[doc = " 1024). The mantissa can occupy either zero or two characters."] - #[doc = ""] - #[doc = " Floating-point is never used, because an IEEE758 double can only losslessly"] - #[doc = " represent integers through 2^53-1."] - #[doc = ""] - #[doc = " 2^64-1 is 18446744073709551615, 18.45E(xa). KMGTPEZY thus suffice to handle"] - #[doc = " an 89-bit uintmax_t. Beyond Z(etta) and Y(otta) lie lands unspecified by SI."] - #[doc = " 2^-63 is 0.000000000000000000108, 1.08a(tto)."] - #[doc = " val: value to print"] - #[doc = " decimal: scaling. '1' if none has taken place."] - #[doc = " buf: buffer in which string will be generated"] - #[doc = " omitdec: inhibit printing of all-0 decimal portions"] - #[doc = " mult: base of suffix system (almost always 1000 or 1024)"] - #[doc = " uprefix: character to print following suffix ('i' for kibibytes basically)."] - #[doc = " only printed if suffix is actually printed (input >= mult)."] - #[doc = ""] - #[doc = " You are encouraged to consult notcurses_metric(3)."] - pub fn ncmetric( - val: uintmax_t, - decimal: uintmax_t, - buf: *mut cty::c_char, - omitdec: cty::c_int, - mult: uintmax_t, - uprefix: cty::c_int, - ) -> *const cty::c_char; -} -extern "C" { - #[doc = " Enable or disable the terminal's cursor, if supported, placing it at"] - #[doc = " 'y', 'x'. Immediate effect (no need for a call to notcurses_render())."] - #[doc = " It is an error if 'y', 'x' lies outside the standard plane."] - pub fn notcurses_cursor_enable(nc: *mut notcurses, y: cty::c_int, x: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn notcurses_cursor_disable(nc: *mut notcurses) -> cty::c_int; -} -#[doc = " Palette API. Some terminals only support 256 colors, but allow the full"] -#[doc = " palette to be specified with arbitrary RGB colors. In all cases, it's more"] -#[doc = " performant to use indexed colors, since it's much less data to write to the"] -#[doc = " terminal. If you can limit yourself to 256 colors, that's probably best."] -#[repr(C)] -#[derive(Copy, Clone)] -pub struct palette256 { - #[doc = " RGB values as regular ol' channels"] - pub chans: [u32; 256usize], -} -#[test] -fn bindgen_test_layout_palette256() { - assert_eq!( - ::core::mem::size_of::(), - 1024usize, - concat!("Size of: ", stringify!(palette256)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(palette256)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).chans as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(palette256), - "::", - stringify!(chans) - ) - ); -} -extern "C" { - #[doc = " Create a new palette store. It will be initialized with notcurses' best"] - #[doc = " knowledge of the currently configured palette. The palette upon startup"] - #[doc = " cannot be reliably detected, sadly."] - pub fn palette256_new(nc: *mut notcurses) -> *mut palette256; -} -extern "C" { - #[doc = " Attempt to configure the terminal with the provided palette 'p'. Does not"] - #[doc = " transfer ownership of 'p'; palette256_free() can (ought) still be called."] - pub fn palette256_use(nc: *mut notcurses, p: *const palette256) -> cty::c_int; -} -extern "C" { - #[doc = " Free the palette store 'p'."] - pub fn palette256_free(p: *mut palette256); -} -extern "C" { - #[doc = " Convert the plane's content to greyscale."] - pub fn ncplane_greyscale(n: *mut ncplane); -} -#[doc = " selection widget -- an ncplane with a title header and a body section. the"] -#[doc = " body section supports infinite scrolling up and down."] -#[doc = ""] -#[doc = " At all times, exactly one item is selected."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncselector_item { - pub option: *mut cty::c_char, - pub desc: *mut cty::c_char, - #[doc = " filled in by library"] - pub opcolumns: size_t, - #[doc = " filled in by library"] - pub desccolumns: size_t, -} -#[test] -fn bindgen_test_layout_ncselector_item() { - assert_eq!( - ::core::mem::size_of::(), - 32usize, - concat!("Size of: ", stringify!(ncselector_item)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncselector_item)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).option as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncselector_item), - "::", - stringify!(option) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).desc as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncselector_item), - "::", - stringify!(desc) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).opcolumns as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncselector_item), - "::", - stringify!(opcolumns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).desccolumns as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncselector_item), - "::", - stringify!(desccolumns) - ) - ); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncselector_options { - #[doc = " title may be NULL, inhibiting riser, saving two rows."] - pub title: *mut cty::c_char, - #[doc = " secondary may be NULL"] - pub secondary: *mut cty::c_char, - #[doc = " footer may be NULL"] - pub footer: *mut cty::c_char, - #[doc = " initial items and descriptions"] - pub items: *mut ncselector_item, - #[doc = " default item (selected at start), must be < itemcount unless itemcount is"] - #[doc = " 0, in which case 'defidx' must also be 0"] - pub defidx: cty::c_uint, - #[doc = " maximum number of options to display at once, 0 to use all available space"] - pub maxdisplay: cty::c_uint, - #[doc = " option channels"] - pub opchannels: u64, - #[doc = " description channels"] - pub descchannels: u64, - #[doc = " title channels"] - pub titlechannels: u64, - #[doc = " secondary and footer channels"] - pub footchannels: u64, - #[doc = " border channels"] - pub boxchannels: u64, - #[doc = " bitfield of NCSELECTOR_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncselector_options() { - assert_eq!( - ::core::mem::size_of::(), - 88usize, - concat!("Size of: ", stringify!(ncselector_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncselector_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).title as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(title) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).secondary as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(secondary) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).footer as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(footer) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).items as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(items) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).defidx as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(defidx) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).maxdisplay as *const _ as usize }, - 36usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(maxdisplay) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).opchannels as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(opchannels) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).descchannels as *const _ as usize - }, - 48usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(descchannels) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).titlechannels as *const _ as usize - }, - 56usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(titlechannels) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).footchannels as *const _ as usize - }, - 64usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(footchannels) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).boxchannels as *const _ as usize }, - 72usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(boxchannels) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 80usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(flags) - ) - ); -} -extern "C" { - pub fn ncselector_create(n: *mut ncplane, opts: *const ncselector_options) -> *mut ncselector; -} -extern "C" { - #[doc = " Dynamically add or delete items. It is usually sufficient to supply a static"] - #[doc = " list of items via ncselector_options->items."] - pub fn ncselector_additem(n: *mut ncselector, item: *const ncselector_item) -> cty::c_int; -} -extern "C" { - pub fn ncselector_delitem(n: *mut ncselector, item: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Return reference to the selected option, or NULL if there are no items."] - pub fn ncselector_selected(n: *const ncselector) -> *const cty::c_char; -} -extern "C" { - #[doc = " Return a reference to the ncselector's underlying ncplane."] - pub fn ncselector_plane(n: *mut ncselector) -> *mut ncplane; -} -extern "C" { - #[doc = " Move up or down in the list. A reference to the newly-selected item is"] - #[doc = " returned, or NULL if there are no items in the list."] - pub fn ncselector_previtem(n: *mut ncselector) -> *const cty::c_char; -} -extern "C" { - pub fn ncselector_nextitem(n: *mut ncselector) -> *const cty::c_char; -} -extern "C" { - #[doc = " Offer the input to the ncselector. If it's relevant, this function returns"] - #[doc = " true, and the input ought not be processed further. If it's irrelevant to"] - #[doc = " the selector, false is returned. Relevant inputs include:"] - #[doc = " * a mouse click on an item"] - #[doc = " * a mouse scrollwheel event"] - #[doc = " * a mouse click on the scrolling arrows"] - #[doc = " * up, down, pgup, or pgdown on an unrolled menu (navigates among items)"] - pub fn ncselector_offer_input(n: *mut ncselector, nc: *const ncinput) -> bool; -} -extern "C" { - #[doc = " Destroy the ncselector. If 'item' is not NULL, the last selected option will"] - #[doc = " be strdup()ed and assigned to '*item' (and must be free()d by the caller)."] - pub fn ncselector_destroy(n: *mut ncselector, item: *mut *mut cty::c_char); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncmselector_item { - pub option: *mut cty::c_char, - pub desc: *mut cty::c_char, - pub selected: bool, -} -#[test] -fn bindgen_test_layout_ncmselector_item() { - assert_eq!( - ::core::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(ncmselector_item)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncmselector_item)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).option as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncmselector_item), - "::", - stringify!(option) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).desc as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncmselector_item), - "::", - stringify!(desc) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).selected as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncmselector_item), - "::", - stringify!(selected) - ) - ); -} -#[doc = " multiselection widget -- a selector supporting multiple selections."] -#[doc = ""] -#[doc = " Unlike the selector widget, zero to all of the items can be selected, but"] -#[doc = " also the widget does not support adding or removing items at runtime."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncmultiselector_options { - #[doc = " title may be NULL, inhibiting riser, saving two rows."] - pub title: *mut cty::c_char, - #[doc = " secondary may be NULL"] - pub secondary: *mut cty::c_char, - #[doc = " footer may be NULL"] - pub footer: *mut cty::c_char, - #[doc = " initial items, descriptions, and statuses"] - pub items: *mut ncmselector_item, - #[doc = " maximum number of options to display at once, 0 to use all available space"] - pub maxdisplay: cty::c_uint, - #[doc = " option channels"] - pub opchannels: u64, - #[doc = " description channels"] - pub descchannels: u64, - #[doc = " title channels"] - pub titlechannels: u64, - #[doc = " secondary and footer channels"] - pub footchannels: u64, - #[doc = " border channels"] - pub boxchannels: u64, - #[doc = " bitfield of NCMULTISELECTOR_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncmultiselector_options() { - assert_eq!( - ::core::mem::size_of::(), - 88usize, - concat!("Size of: ", stringify!(ncmultiselector_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncmultiselector_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).title as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(title) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).secondary as *const _ as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(secondary) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).footer as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(footer) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).items as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(items) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).maxdisplay as *const _ as usize - }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(maxdisplay) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).opchannels as *const _ as usize - }, - 40usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(opchannels) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).descchannels as *const _ as usize - }, - 48usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(descchannels) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).titlechannels as *const _ as usize - }, - 56usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(titlechannels) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).footchannels as *const _ as usize - }, - 64usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(footchannels) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).boxchannels as *const _ as usize - }, - 72usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(boxchannels) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 80usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(flags) - ) - ); -} -extern "C" { - pub fn ncmultiselector_create( - n: *mut ncplane, - opts: *const ncmultiselector_options, - ) -> *mut ncmultiselector; -} -extern "C" { - #[doc = " Return selected vector. An array of bools must be provided, along with its"] - #[doc = " length. If that length doesn't match the itemcount, it is an error."] - pub fn ncmultiselector_selected( - n: *mut ncmultiselector, - selected: *mut bool, - count: cty::c_uint, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Return a reference to the ncmultiselector's underlying ncplane."] - pub fn ncmultiselector_plane(n: *mut ncmultiselector) -> *mut ncplane; -} -extern "C" { - #[doc = " Offer the input to the ncmultiselector. If it's relevant, this function"] - #[doc = " returns true, and the input ought not be processed further. If it's"] - #[doc = " irrelevant to the multiselector, false is returned. Relevant inputs include:"] - #[doc = " * a mouse click on an item"] - #[doc = " * a mouse scrollwheel event"] - #[doc = " * a mouse click on the scrolling arrows"] - #[doc = " * up, down, pgup, or pgdown on an unrolled menu (navigates among items)"] - pub fn ncmultiselector_offer_input(n: *mut ncmultiselector, nc: *const ncinput) -> bool; -} -extern "C" { - #[doc = " Destroy the ncmultiselector."] - pub fn ncmultiselector_destroy(n: *mut ncmultiselector); -} -#[doc = " each item has a curry, and zero or more subitems."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct nctree_item { - pub curry: *mut cty::c_void, - pub subs: *mut nctree_item, - pub subcount: cty::c_uint, -} -#[test] -fn bindgen_test_layout_nctree_item() { - assert_eq!( - ::core::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(nctree_item)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(nctree_item)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).curry as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(nctree_item), - "::", - stringify!(curry) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).subs as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(nctree_item), - "::", - stringify!(subs) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).subcount as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(nctree_item), - "::", - stringify!(subcount) - ) - ); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct nctree_options { - #[doc = " top-level nctree_item array"] - pub items: *const nctree_item, - #[doc = " size of |items|"] - pub count: cty::c_uint, - #[doc = " item callback function"] - pub nctreecb: ::core::option::Option< - unsafe extern "C" fn( - arg1: *mut ncplane, - arg2: *mut cty::c_void, - arg3: cty::c_int, - ) -> cty::c_int, - >, - #[doc = " columns to indent per level of hierarchy"] - pub indentcols: cty::c_int, - #[doc = " bitfield of NCTREE_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_nctree_options() { - assert_eq!( - ::core::mem::size_of::(), - 40usize, - concat!("Size of: ", stringify!(nctree_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(nctree_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).items as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(nctree_options), - "::", - stringify!(items) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).count as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(nctree_options), - "::", - stringify!(count) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).nctreecb as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(nctree_options), - "::", - stringify!(nctreecb) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).indentcols as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(nctree_options), - "::", - stringify!(indentcols) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(nctree_options), - "::", - stringify!(flags) - ) - ); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct nctree { - _unused: [u8; 0], -} -extern "C" { - #[doc = " |opts| may *not* be NULL, since it is necessary to define a callback"] - #[doc = " function."] - pub fn nctree_create(n: *mut ncplane, opts: *const nctree_options) -> *mut nctree; -} -extern "C" { - #[doc = " Returns the ncplane on which this nctree lives."] - pub fn nctree_plane(n: *mut nctree) -> *mut ncplane; -} -extern "C" { - #[doc = " Redraw the nctree 'n' in its entirety. The tree will be cleared, and items"] - #[doc = " will be lain out, using the focused item as a fulcrum. Item-drawing"] - #[doc = " callbacks will be invoked for each visible item."] - pub fn nctree_redraw(n: *mut nctree) -> cty::c_int; -} -extern "C" { - #[doc = " Offer input 'ni' to the nctree 'n'. If it's relevant, this function returns"] - #[doc = " true, and the input ought not be processed further. If it's irrelevant to"] - #[doc = " the tree, false is returned. Relevant inputs include:"] - #[doc = " * a mouse click on an item (focuses item)"] - #[doc = " * a mouse scrollwheel event (srolls tree)"] - #[doc = " * up, down, pgup, or pgdown (navigates among items)"] - pub fn nctree_offer_input(n: *mut nctree, ni: *const ncinput) -> bool; -} -extern "C" { - #[doc = " Return the focused item, if any items are present. This is not a copy;"] - #[doc = " be careful to use it only for the duration of a critical section."] - pub fn nctree_focused(n: *mut nctree) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Change focus to the next item."] - pub fn nctree_next(n: *mut nctree) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Change focus to the previous item."] - pub fn nctree_prev(n: *mut nctree) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Go to the item specified by the array |spec|, terminated by UINT_MAX. If"] - #[doc = " the spec is invalid, NULL is returned, and the depth of the first invalid"] - #[doc = " spec is written to *|failspec|. Otherwise, the true depth is written to"] - #[doc = " *|failspec|, and the curry is returned (|failspec| is necessary because the"] - #[doc = " curry could itself be NULL)."] - pub fn nctree_goto( - n: *mut nctree, - spec: *const cty::c_uint, - failspec: *mut cty::c_int, - ) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Destroy the nctree."] - pub fn nctree_destroy(n: *mut nctree); -} -#[doc = " Menus. Horizontal menu bars are supported, on the top and/or bottom rows."] -#[doc = " If the menu bar is longer than the screen, it will be only partially"] -#[doc = " visible. Menus may be either visible or invisible by default. In the event of"] -#[doc = " a screen resize, menus will be automatically moved/resized. Elements can be"] -#[doc = " dynamically enabled or disabled at all levels (menu, section, and item),"] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncmenu_item { - #[doc = " utf-8 menu item, NULL for horizontal separator"] - pub desc: *mut cty::c_char, - #[doc = " shortcut, all should be distinct"] - pub shortcut: ncinput, -} -#[test] -fn bindgen_test_layout_ncmenu_item() { - assert_eq!( - ::core::mem::size_of::(), - 32usize, - concat!("Size of: ", stringify!(ncmenu_item)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncmenu_item)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).desc as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_item), - "::", - stringify!(desc) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).shortcut as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_item), - "::", - stringify!(shortcut) - ) - ); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncmenu_section { - #[doc = " utf-8 c string"] - pub name: *mut cty::c_char, - pub itemcount: cty::c_int, - pub items: *mut ncmenu_item, - #[doc = " shortcut, will be underlined if present in name"] - pub shortcut: ncinput, -} -#[test] -fn bindgen_test_layout_ncmenu_section() { - assert_eq!( - ::core::mem::size_of::(), - 48usize, - concat!("Size of: ", stringify!(ncmenu_section)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncmenu_section)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).name as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_section), - "::", - stringify!(name) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).itemcount as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_section), - "::", - stringify!(itemcount) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).items as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_section), - "::", - stringify!(items) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).shortcut as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_section), - "::", - stringify!(shortcut) - ) - ); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncmenu_options { - #[doc = " array of 'sectioncount' menu_sections"] - pub sections: *mut ncmenu_section, - #[doc = " must be positive"] - pub sectioncount: cty::c_int, - #[doc = " styling for header"] - pub headerchannels: u64, - #[doc = " styling for sections"] - pub sectionchannels: u64, - #[doc = " flag word of NCMENU_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncmenu_options() { - assert_eq!( - ::core::mem::size_of::(), - 40usize, - concat!("Size of: ", stringify!(ncmenu_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncmenu_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sections as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_options), - "::", - stringify!(sections) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sectioncount as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_options), - "::", - stringify!(sectioncount) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).headerchannels as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_options), - "::", - stringify!(headerchannels) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sectionchannels as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_options), - "::", - stringify!(sectionchannels) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_options), - "::", - stringify!(flags) - ) - ); -} -#[repr(C)] -#[derive(Debug)] -pub struct ncmenu { - _unused: [u8; 0], -} -extern "C" { - #[doc = " Create a menu with the specified options. Menus are currently bound to an"] - #[doc = " overall Notcurses object (as opposed to a particular plane), and are"] - #[doc = " implemented as ncplanes kept atop other ncplanes."] - pub fn ncmenu_create(n: *mut ncplane, opts: *const ncmenu_options) -> *mut ncmenu; -} -extern "C" { - #[doc = " Unroll the specified menu section, making the menu visible if it was"] - #[doc = " invisible, and rolling up any menu section that is already unrolled."] - pub fn ncmenu_unroll(n: *mut ncmenu, sectionidx: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Roll up any unrolled menu section, and hide the menu if using hiding."] - pub fn ncmenu_rollup(n: *mut ncmenu) -> cty::c_int; -} -extern "C" { - #[doc = " Unroll the previous/next section (relative to current unrolled). If no"] - #[doc = " section is unrolled, the first section will be unrolled."] - pub fn ncmenu_nextsection(n: *mut ncmenu) -> cty::c_int; -} -extern "C" { - pub fn ncmenu_prevsection(n: *mut ncmenu) -> cty::c_int; -} -extern "C" { - #[doc = " Move to the previous/next item within the currently unrolled section. If no"] - #[doc = " section is unrolled, the first section will be unrolled."] - pub fn ncmenu_nextitem(n: *mut ncmenu) -> cty::c_int; -} -extern "C" { - pub fn ncmenu_previtem(n: *mut ncmenu) -> cty::c_int; -} -extern "C" { - #[doc = " Disable or enable a menu item. Returns 0 if the item was found."] - pub fn ncmenu_item_set_status( - n: *mut ncmenu, - section: *const cty::c_char, - item: *const cty::c_char, - enabled: bool, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Return the selected item description, or NULL if no section is unrolled. If"] - #[doc = " 'ni' is not NULL, and the selected item has a shortcut, 'ni' will be filled"] - #[doc = " in with that shortcut--this can allow faster matching."] - pub fn ncmenu_selected(n: *const ncmenu, ni: *mut ncinput) -> *const cty::c_char; -} -extern "C" { - #[doc = " Return the item description corresponding to the mouse click 'click'. The"] - #[doc = " item must be on an actively unrolled section, and the click must be in the"] - #[doc = " area of a valid item. If 'ni' is not NULL, and the selected item has a"] - #[doc = " shortcut, 'ni' will be filled in with the shortcut."] - pub fn ncmenu_mouse_selected( - n: *const ncmenu, - click: *const ncinput, - ni: *mut ncinput, - ) -> *const cty::c_char; -} -extern "C" { - #[doc = " Return the ncplane backing this ncmenu."] - pub fn ncmenu_plane(n: *mut ncmenu) -> *mut ncplane; -} -extern "C" { - #[doc = " Offer the input to the ncmenu. If it's relevant, this function returns true,"] - #[doc = " and the input ought not be processed further. If it's irrelevant to the"] - #[doc = " menu, false is returned. Relevant inputs include:"] - #[doc = " * mouse movement over a hidden menu"] - #[doc = " * a mouse click on a menu section (the section is unrolled)"] - #[doc = " * a mouse click outside of an unrolled menu (the menu is rolled up)"] - #[doc = " * left or right on an unrolled menu (navigates among sections)"] - #[doc = " * up or down on an unrolled menu (navigates among items)"] - #[doc = " * escape on an unrolled menu (the menu is rolled up)"] - pub fn ncmenu_offer_input(n: *mut ncmenu, nc: *const ncinput) -> bool; -} -extern "C" { - #[doc = " Destroy a menu created with ncmenu_create()."] - pub fn ncmenu_destroy(n: *mut ncmenu) -> cty::c_int; -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncprogbar_options { - #[doc = " upper-left channel. in the context of a progress bar,"] - pub ulchannel: u32, - #[doc = " \"up\" is the direction we are progressing towards, and"] - pub urchannel: u32, - #[doc = " \"bottom\" is the direction of origin. for monochromatic"] - pub blchannel: u32, - #[doc = " bar, all four channels ought be the same."] - pub brchannel: u32, - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncprogbar_options() { - assert_eq!( - ::core::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(ncprogbar_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncprogbar_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).ulchannel as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncprogbar_options), - "::", - stringify!(ulchannel) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).urchannel as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(ncprogbar_options), - "::", - stringify!(urchannel) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).blchannel as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncprogbar_options), - "::", - stringify!(blchannel) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).brchannel as *const _ as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(ncprogbar_options), - "::", - stringify!(brchannel) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncprogbar_options), - "::", - stringify!(flags) - ) - ); -} -extern "C" { - #[doc = " Takes ownership of the ncplane 'n', which will be destroyed by"] - #[doc = " ncprogbar_destroy(). The progress bar is initially at 0%."] - pub fn ncprogbar_create(n: *mut ncplane, opts: *const ncprogbar_options) -> *mut ncprogbar; -} -extern "C" { - #[doc = " Return a reference to the ncprogbar's underlying ncplane."] - pub fn ncprogbar_plane(n: *mut ncprogbar) -> *mut ncplane; -} -extern "C" { - #[doc = " Set the progress bar's completion, a double 0 <= 'p' <= 1."] - pub fn ncprogbar_set_progress(n: *mut ncprogbar, p: f64) -> cty::c_int; -} -extern "C" { - #[doc = " Get the progress bar's completion, a double on [0, 1]."] - pub fn ncprogbar_progress(n: *const ncprogbar) -> f64; -} -extern "C" { - #[doc = " Destroy the progress bar and its underlying ncplane."] - pub fn ncprogbar_destroy(n: *mut ncprogbar); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct nctabbed_options { - #[doc = " channel for the selected tab header"] - pub selchan: u64, - #[doc = " channel for unselected tab headers"] - pub hdrchan: u64, - #[doc = " channel for the tab separator"] - pub sepchan: u64, - #[doc = " separator string (copied by nctabbed_create())"] - pub separator: *mut cty::c_char, - #[doc = " bitmask of NCTABBED_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_nctabbed_options() { - assert_eq!( - ::core::mem::size_of::(), - 40usize, - concat!("Size of: ", stringify!(nctabbed_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(nctabbed_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).selchan as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(nctabbed_options), - "::", - stringify!(selchan) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).hdrchan as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(nctabbed_options), - "::", - stringify!(hdrchan) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sepchan as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(nctabbed_options), - "::", - stringify!(sepchan) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).separator as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(nctabbed_options), - "::", - stringify!(separator) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(nctabbed_options), - "::", - stringify!(flags) - ) - ); -} -#[doc = " Tab content drawing callback. Takes the tab it was associated to, the ncplane"] -#[doc = " on which tab content is to be drawn, and the user pointer of the tab."] -#[doc = " It is called during nctabbed_redraw()."] -pub type tabcb = ::core::option::Option< - unsafe extern "C" fn(t: *mut nctab, ncp: *mut ncplane, curry: *mut cty::c_void), ->; -extern "C" { - #[doc = " Creates a new nctabbed widget, associated with the given ncplane 'n', and with"] - #[doc = " additional options given in 'opts'. When 'opts' is NULL, it acts as if it were"] - #[doc = " called with an all-zero opts. The widget takes ownership of 'n', and destroys"] - #[doc = " it when the widget is destroyed. Returns the newly created widget. Returns"] - #[doc = " NULL on failure, also destroying 'n'."] - pub fn nctabbed_create(n: *mut ncplane, opts: *const nctabbed_options) -> *mut nctabbed; -} -extern "C" { - #[doc = " Destroy an nctabbed widget. All memory belonging to 'nt' is deallocated,"] - #[doc = " including all tabs and their names. The plane associated with 'nt' is also"] - #[doc = " destroyed. Calling this with NULL does nothing."] - pub fn nctabbed_destroy(nt: *mut nctabbed); -} -extern "C" { - #[doc = " Redraw the widget. This calls the tab callback of the currently selected tab"] - #[doc = " to draw tab contents, and draws tab headers. The tab content plane is not"] - #[doc = " modified by this function, apart from resizing the plane is necessary."] - pub fn nctabbed_redraw(nt: *mut nctabbed); -} -extern "C" { - #[doc = " Make sure the tab header of the currently selected tab is at least partially"] - #[doc = " visible. (by rotating tabs until at least one column is displayed)"] - #[doc = " Does nothing if there are no tabs."] - pub fn nctabbed_ensure_selected_header_visible(nt: *mut nctabbed); -} -extern "C" { - #[doc = " Returns the currently selected tab, or NULL if there are no tabs."] - pub fn nctabbed_selected(nt: *mut nctabbed) -> *mut nctab; -} -extern "C" { - #[doc = " Returns the leftmost tab, or NULL if there are no tabs."] - pub fn nctabbed_leftmost(nt: *mut nctabbed) -> *mut nctab; -} -extern "C" { - #[doc = " Returns the number of tabs in the widget."] - pub fn nctabbed_tabcount(nt: *mut nctabbed) -> cty::c_int; -} -extern "C" { - #[doc = " Returns the plane associated to 'nt'."] - pub fn nctabbed_plane(nt: *mut nctabbed) -> *mut ncplane; -} -extern "C" { - #[doc = " Returns the tab content plane."] - pub fn nctabbed_content_plane(nt: *mut nctabbed) -> *mut ncplane; -} -extern "C" { - #[doc = " Returns the tab callback."] - pub fn nctab_cb(t: *mut nctab) -> tabcb; -} -extern "C" { - #[doc = " Returns the tab name. This is not a copy and it should not be stored."] - pub fn nctab_name(t: *mut nctab) -> *const cty::c_char; -} -extern "C" { - #[doc = " Returns the width (in columns) of the tab's name."] - pub fn nctab_name_width(t: *mut nctab) -> cty::c_int; -} -extern "C" { - #[doc = " Returns the tab's user pointer."] - pub fn nctab_userptr(t: *mut nctab) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Returns the tab to the right of 't'. This does not change which tab is selected."] - pub fn nctab_next(t: *mut nctab) -> *mut nctab; -} -extern "C" { - #[doc = " Returns the tab to the left of 't'. This does not change which tab is selected."] - pub fn nctab_prev(t: *mut nctab) -> *mut nctab; -} -extern "C" { - #[doc = " Add a new tab to 'nt' with the given tab callback, name, and user pointer."] - #[doc = " If both 'before' and 'after' are NULL, the tab is inserted after the selected"] - #[doc = " tab. Otherwise, it gets put after 'after' (if not NULL) and before 'before'"] - #[doc = " (if not NULL). If both 'after' and 'before' are given, they must be two"] - #[doc = " neighboring tabs (the tab list is circular, so the last tab is immediately"] - #[doc = " before the leftmost tab), otherwise the function returns NULL. If 'name' is"] - #[doc = " NULL or a string containing illegal characters, the function returns NULL."] - #[doc = " On all other failures the function also returns NULL. If it returns NULL,"] - #[doc = " none of the arguments are modified, and the widget state is not altered."] - pub fn nctabbed_add( - nt: *mut nctabbed, - after: *mut nctab, - before: *mut nctab, - tcb: tabcb, - name: *const cty::c_char, - opaque: *mut cty::c_void, - ) -> *mut nctab; -} -extern "C" { - #[doc = " Remove a tab 't' from 'nt'. Its neighboring tabs become neighbors to each"] - #[doc = " other. If 't' if the selected tab, the tab after 't' becomes selected."] - #[doc = " Likewise if 't' is the leftmost tab, the tab after 't' becomes leftmost."] - #[doc = " If 't' is the only tab, there will no more be a selected or leftmost tab,"] - #[doc = " until a new tab is added. Returns -1 if 't' is NULL, and 0 otherwise."] - pub fn nctabbed_del(nt: *mut nctabbed, t: *mut nctab) -> cty::c_int; -} -extern "C" { - #[doc = " Move 't' after 'after' (if not NULL) and before 'before' (if not NULL)."] - #[doc = " If both 'after' and 'before' are NULL, the function returns -1, otherwise"] - #[doc = " it returns 0."] - pub fn nctab_move( - nt: *mut nctabbed, - t: *mut nctab, - after: *mut nctab, - before: *mut nctab, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Move 't' to the right by one tab, looping around to become leftmost if needed."] - pub fn nctab_move_right(nt: *mut nctabbed, t: *mut nctab); -} -extern "C" { - #[doc = " Move 't' to the right by one tab, looping around to become the last tab if needed."] - pub fn nctab_move_left(nt: *mut nctabbed, t: *mut nctab); -} -extern "C" { - #[doc = " Rotate the tabs of 'nt' right by 'amt' tabs, or '-amt' tabs left if 'amt' is"] - #[doc = " negative. Tabs are rotated only by changing the leftmost tab; the selected tab"] - #[doc = " stays the same. If there are no tabs, nothing happens."] - pub fn nctabbed_rotate(nt: *mut nctabbed, amt: cty::c_int); -} -extern "C" { - #[doc = " Select the tab after the currently selected tab, and return the newly selected"] - #[doc = " tab. Returns NULL if there are no tabs."] - pub fn nctabbed_next(nt: *mut nctabbed) -> *mut nctab; -} -extern "C" { - #[doc = " Select the tab before the currently selected tab, and return the newly selected"] - #[doc = " tab. Returns NULL if there are no tabs."] - pub fn nctabbed_prev(nt: *mut nctabbed) -> *mut nctab; -} -extern "C" { - #[doc = " Change the selected tab to be 't'. Returns the previously selected tab."] - pub fn nctabbed_select(nt: *mut nctabbed, t: *mut nctab) -> *mut nctab; -} -extern "C" { - #[doc = " Write the channels for tab headers, the selected tab header, and the separator"] - #[doc = " to '*hdrchan', '*selchan', and '*sepchan' respectively."] - pub fn nctabbed_channels( - nt: *mut nctabbed, - hdrchan: *mut u64, - selchan: *mut u64, - sepchan: *mut u64, - ); -} -extern "C" { - #[doc = " Returns the tab separator. This is not a copy and it should not be stored."] - #[doc = " This can be NULL, if the separator was set to NULL in ncatbbed_create() or"] - #[doc = " nctabbed_set_separator()."] - pub fn nctabbed_separator(nt: *mut nctabbed) -> *const cty::c_char; -} -extern "C" { - #[doc = " Returns the tab separator width, or zero if there is no separator."] - pub fn nctabbed_separator_width(nt: *mut nctabbed) -> cty::c_int; -} -extern "C" { - #[doc = " Set the tab headers channel for 'nt'."] - pub fn nctabbed_set_hdrchan(nt: *mut nctabbed, chan: u64); -} -extern "C" { - #[doc = " Set the selected tab header channel for 'nt'."] - pub fn nctabbed_set_selchan(nt: *mut nctabbed, chan: u64); -} -extern "C" { - #[doc = " Set the tab separator channel for 'nt'."] - pub fn nctabbed_set_sepchan(nt: *mut nctabbed, chan: u64); -} -extern "C" { - #[doc = " Set the tab callback function for 't'. Returns the previous tab callback."] - pub fn nctab_set_cb(t: *mut nctab, newcb: tabcb) -> tabcb; -} -extern "C" { - #[doc = " Change the name of 't'. Returns -1 if 'newname' is NULL, and 0 otherwise."] - pub fn nctab_set_name(t: *mut nctab, newname: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Set the user pointer of 't'. Returns the previous user pointer."] - pub fn nctab_set_userptr(t: *mut nctab, newopaque: *mut cty::c_void) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Change the tab separator for 'nt'. Returns -1 if 'separator' is not NULL and"] - #[doc = " is not a valid string, and 0 otherwise."] - pub fn nctabbed_set_separator(nt: *mut nctabbed, separator: *const cty::c_char) -> cty::c_int; -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncplot_options { - #[doc = " channels for the maximum and minimum levels. linear or exponential"] - #[doc = " interpolation will be applied across the domain between these two."] - pub maxchannels: u64, - pub minchannels: u64, - #[doc = " styling used for the legend, if NCPLOT_OPTION_LABELTICKSD is set"] - pub legendstyle: u16, - #[doc = " number of \"pixels\" per row x column"] - pub gridtype: ncblitter_e, - #[doc = " independent variable can either be a contiguous range, or a finite set"] - #[doc = " of keys. for a time range, say the previous hour sampled with second"] - #[doc = " resolution, the independent variable would be the range [0..3600): 3600."] - #[doc = " if rangex is 0, it is dynamically set to the number of columns."] - pub rangex: cty::c_int, - #[doc = " optional, printed by the labels"] - pub title: *const cty::c_char, - #[doc = " bitfield over NCPLOT_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncplot_options() { - assert_eq!( - ::core::mem::size_of::(), - 48usize, - concat!("Size of: ", stringify!(ncplot_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncplot_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).maxchannels as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncplot_options), - "::", - stringify!(maxchannels) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).minchannels as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncplot_options), - "::", - stringify!(minchannels) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).legendstyle as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncplot_options), - "::", - stringify!(legendstyle) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).gridtype as *const _ as usize }, - 20usize, - concat!( - "Offset of field: ", - stringify!(ncplot_options), - "::", - stringify!(gridtype) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).rangex as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncplot_options), - "::", - stringify!(rangex) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).title as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncplot_options), - "::", - stringify!(title) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(ncplot_options), - "::", - stringify!(flags) - ) - ); -} -extern "C" { - #[doc = " Use the provided plane 'n' for plotting according to the options 'opts'. The"] - #[doc = " plot will make free use of the entirety of the plane. For domain"] - #[doc = " autodiscovery, set miny == maxy == 0. ncuplot holds uint64_ts, while"] - #[doc = " ncdplot holds doubles."] - pub fn ncuplot_create( - n: *mut ncplane, - opts: *const ncplot_options, - miny: u64, - maxy: u64, - ) -> *mut ncuplot; -} -extern "C" { - pub fn ncdplot_create( - n: *mut ncplane, - opts: *const ncplot_options, - miny: f64, - maxy: f64, - ) -> *mut ncdplot; -} -extern "C" { - #[doc = " Return a reference to the ncplot's underlying ncplane."] - pub fn ncuplot_plane(n: *mut ncuplot) -> *mut ncplane; -} -extern "C" { - pub fn ncdplot_plane(n: *mut ncdplot) -> *mut ncplane; -} -extern "C" { - #[doc = " Add to or set the value corresponding to this x. If x is beyond the current"] - #[doc = " x window, the x window is advanced to include x, and values passing beyond"] - #[doc = " the window are lost. The first call will place the initial window. The plot"] - #[doc = " will be redrawn, but notcurses_render() is not called."] - pub fn ncuplot_add_sample(n: *mut ncuplot, x: u64, y: u64) -> cty::c_int; -} -extern "C" { - pub fn ncdplot_add_sample(n: *mut ncdplot, x: u64, y: f64) -> cty::c_int; -} -extern "C" { - pub fn ncuplot_set_sample(n: *mut ncuplot, x: u64, y: u64) -> cty::c_int; -} -extern "C" { - pub fn ncdplot_set_sample(n: *mut ncdplot, x: u64, y: f64) -> cty::c_int; -} -extern "C" { - pub fn ncuplot_sample(n: *const ncuplot, x: u64, y: *mut u64) -> cty::c_int; -} -extern "C" { - pub fn ncdplot_sample(n: *const ncdplot, x: u64, y: *mut f64) -> cty::c_int; -} -extern "C" { - pub fn ncuplot_destroy(n: *mut ncuplot); -} -extern "C" { - pub fn ncdplot_destroy(n: *mut ncdplot); -} -pub type ncfdplane_callback = ::core::option::Option< - unsafe extern "C" fn( - n: *mut ncfdplane, - buf: *const cty::c_void, - s: size_t, - curry: *mut cty::c_void, - ) -> cty::c_int, ->; -pub type ncfdplane_done_cb = ::core::option::Option< - unsafe extern "C" fn( - n: *mut ncfdplane, - fderrno: cty::c_int, - curry: *mut cty::c_void, - ) -> cty::c_int, ->; -#[doc = " read from an fd until EOF (or beyond, if follow is set), invoking the user's"] -#[doc = " callback each time. runs in its own context. on EOF or error, the finalizer"] -#[doc = " callback will be invoked, and the user ought destroy the ncfdplane. the"] -#[doc = " data is *not* guaranteed to be nul-terminated, and may contain arbitrary"] -#[doc = " zeroes."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncfdplane_options { - #[doc = " parameter provided to callbacks"] - pub curry: *mut cty::c_void, - #[doc = " keep reading after hitting end? (think tail -f)"] - pub follow: bool, - #[doc = " bitfield over NCOPTION_FDPLANE_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncfdplane_options() { - assert_eq!( - ::core::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(ncfdplane_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncfdplane_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).curry as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncfdplane_options), - "::", - stringify!(curry) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).follow as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncfdplane_options), - "::", - stringify!(follow) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncfdplane_options), - "::", - stringify!(flags) - ) - ); -} -extern "C" { - #[doc = " Create an ncfdplane around the fd 'fd'. Consider this function to take"] - #[doc = " ownership of the file descriptor, which will be closed in ncfdplane_destroy()."] - pub fn ncfdplane_create( - n: *mut ncplane, - opts: *const ncfdplane_options, - fd: cty::c_int, - cbfxn: ncfdplane_callback, - donecbfxn: ncfdplane_done_cb, - ) -> *mut ncfdplane; -} -extern "C" { - pub fn ncfdplane_plane(n: *mut ncfdplane) -> *mut ncplane; -} -extern "C" { - pub fn ncfdplane_destroy(n: *mut ncfdplane) -> cty::c_int; -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncsubproc_options { - pub curry: *mut cty::c_void, - #[doc = " restart this many seconds after an exit (watch)"] - pub restart_period: u64, - #[doc = " bitfield over NCOPTION_SUBPROC_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncsubproc_options() { - assert_eq!( - ::core::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(ncsubproc_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncsubproc_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).curry as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncsubproc_options), - "::", - stringify!(curry) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).restart_period as *const _ as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncsubproc_options), - "::", - stringify!(restart_period) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncsubproc_options), - "::", - stringify!(flags) - ) - ); -} -extern "C" { - #[doc = " see exec(2). p-types use $PATH. e-type passes environment vars."] - pub fn ncsubproc_createv( - n: *mut ncplane, - opts: *const ncsubproc_options, - bin: *const cty::c_char, - arg: *const *mut cty::c_char, - cbfxn: ncfdplane_callback, - donecbfxn: ncfdplane_done_cb, - ) -> *mut ncsubproc; -} -extern "C" { - pub fn ncsubproc_createvp( - n: *mut ncplane, - opts: *const ncsubproc_options, - bin: *const cty::c_char, - arg: *const *mut cty::c_char, - cbfxn: ncfdplane_callback, - donecbfxn: ncfdplane_done_cb, - ) -> *mut ncsubproc; -} -extern "C" { - pub fn ncsubproc_createvpe( - n: *mut ncplane, - opts: *const ncsubproc_options, - bin: *const cty::c_char, - arg: *const *mut cty::c_char, - env: *const *mut cty::c_char, - cbfxn: ncfdplane_callback, - donecbfxn: ncfdplane_done_cb, - ) -> *mut ncsubproc; -} -extern "C" { - pub fn ncsubproc_plane(n: *mut ncsubproc) -> *mut ncplane; -} -extern "C" { - pub fn ncsubproc_destroy(n: *mut ncsubproc) -> cty::c_int; -} -extern "C" { - #[doc = " Draw a QR code at the current position on the plane. If there is insufficient"] - #[doc = " room to draw the code here, or there is any other error, non-zero will be"] - #[doc = " returned. Otherwise, the QR code \"version\" (size) is returned. The QR code"] - #[doc = " is (version * 4 + 17) columns wide, and ⌈version * 4 + 17⌉ rows tall (the"] - #[doc = " properly-scaled values are written back to '*ymax' and '*xmax')."] - pub fn ncplane_qrcode( - n: *mut ncplane, - ymax: *mut cty::c_int, - xmax: *mut cty::c_int, - data: *const cty::c_void, - len: size_t, - ) -> cty::c_int; -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncreader_options { - #[doc = " channels used for input"] - pub tchannels: u64, - #[doc = " attributes used for input"] - pub tattrword: u32, - #[doc = " bitfield of NCREADER_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncreader_options() { - assert_eq!( - ::core::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(ncreader_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncreader_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).tchannels as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncreader_options), - "::", - stringify!(tchannels) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).tattrword as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncreader_options), - "::", - stringify!(tattrword) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncreader_options), - "::", - stringify!(flags) - ) - ); -} -extern "C" { - #[doc = " ncreaders provide freeform input in a (possibly multiline) region, supporting"] - #[doc = " optional readline keybindings. takes ownership of 'n', destroying it on any"] - #[doc = " error (ncreader_destroy() otherwise destroys the ncplane)."] - pub fn ncreader_create(n: *mut ncplane, opts: *const ncreader_options) -> *mut ncreader; -} -extern "C" { - #[doc = " empty the ncreader of any user input, and home the cursor."] - pub fn ncreader_clear(n: *mut ncreader) -> cty::c_int; -} -extern "C" { - pub fn ncreader_plane(n: *mut ncreader) -> *mut ncplane; -} -extern "C" { - #[doc = " Offer the input to the ncreader. If it's relevant, this function returns"] - #[doc = " true, and the input ought not be processed further. Almost all inputs"] - #[doc = " are relevant to an ncreader, save synthesized ones."] - pub fn ncreader_offer_input(n: *mut ncreader, ni: *const ncinput) -> bool; -} -extern "C" { - #[doc = " Atttempt to move in the specified direction. Returns 0 if a move was"] - #[doc = " successfully executed, -1 otherwise. Scrolling is taken into account."] - pub fn ncreader_move_left(n: *mut ncreader) -> cty::c_int; -} -extern "C" { - pub fn ncreader_move_right(n: *mut ncreader) -> cty::c_int; -} -extern "C" { - pub fn ncreader_move_up(n: *mut ncreader) -> cty::c_int; -} -extern "C" { - pub fn ncreader_move_down(n: *mut ncreader) -> cty::c_int; -} -extern "C" { - #[doc = " Destructively write the provided EGC to the current cursor location. Move"] - #[doc = " the cursor as necessary, scrolling if applicable."] - pub fn ncreader_write_egc(n: *mut ncreader, egc: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " return a heap-allocated copy of the current (UTF-8) contents."] - pub fn ncreader_contents(n: *const ncreader) -> *mut cty::c_char; -} -extern "C" { - #[doc = " destroy the reader and its bound plane. if 'contents' is not NULL, the"] - #[doc = " UTF-8 input will be heap-duplicated and written to 'contents'."] - pub fn ncreader_destroy(n: *mut ncreader, contents: *mut *mut cty::c_char); -} -extern "C" { - #[doc = " Dump selected Notcurses state to the supplied 'debugfp'. Output is freeform,"] - #[doc = " and subject to change. It includes geometry of all planes, from all piles."] - pub fn notcurses_debug(nc: *const notcurses, debugfp: *mut FILE); -} -extern "C" { - #[doc = " Dump selected configuration capabilities to 'debugfp'. Output is freeform,"] - #[doc = " and subject to change."] - pub fn notcurses_debug_caps(nc: *const notcurses, debugfp: *mut FILE); -} -extern "C" { - #[doc = " Get the default *media* (not plot) blitter for this environment when using"] - #[doc = " the specified scaling method. Currently, this means:"] - #[doc = " - if lacking UTF-8, NCBLIT_1x1"] - #[doc = " - otherwise, if not NCSCALE_STRETCH, NCBLIT_2x1"] - #[doc = " - otherwise, if sextants are not known to be good, NCBLIT_2x2"] - #[doc = " - otherwise NCBLIT_3x2"] - #[doc = " NCBLIT_2x2 and NCBLIT_3x2 both distort the original aspect ratio, thus"] - #[doc = " NCBLIT_2x1 is used outside of NCSCALE_STRETCH."] - pub fn ncvisual_media_defblitter(nc: *const notcurses, scale: ncscale_e) -> ncblitter_e; -} -pub type ncdirectv = ncplane; -#[repr(C)] -#[derive(Debug)] -pub struct ncdirect { - _unused: [u8; 0], -} -extern "C" { - #[doc = " Initialize a direct-mode Notcurses context on the connected terminal at 'fp'."] - #[doc = " 'fp' must be a tty. You'll usually want stdout. Direct mode supports a"] - #[doc = " limited subset of Notcurses routines which directly affect 'fp', and neither"] - #[doc = " supports nor requires notcurses_render(). This can be used to add color and"] - #[doc = " styling to text in the standard output paradigm. 'flags' is a bitmask over"] - #[doc = " NCDIRECT_OPTION_*."] - #[doc = " Returns NULL on error, including any failure initializing terminfo."] - pub fn ncdirect_init(termtype: *const cty::c_char, fp: *mut FILE, flags: u64) -> *mut ncdirect; -} -extern "C" { - #[doc = " The same as ncdirect_init(), but without any multimedia functionality,"] - #[doc = " allowing for a svelter binary. Link with notcurses-core if this is used."] - pub fn ncdirect_core_init( - termtype: *const cty::c_char, - fp: *mut FILE, - flags: u64, - ) -> *mut ncdirect; -} -extern "C" { - #[doc = " Read a (heap-allocated) line of text using the Readline library Initializes"] - #[doc = " Readline the first time it's called. For input to be echoed to the terminal,"] - #[doc = " it is necessary that NCDIRECT_OPTION_INHIBIT_CBREAK be provided to"] - #[doc = " ncdirect_init(). Returns NULL on error."] - pub fn ncdirect_readline(nc: *mut ncdirect, prompt: *const cty::c_char) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Direct mode. This API can be used to colorize and stylize output generated"] - #[doc = " outside of notcurses, without ever calling notcurses_render(). These should"] - #[doc = " not be intermixed with standard Notcurses rendering."] - pub fn ncdirect_set_fg_rgb(nc: *mut ncdirect, rgb: cty::c_uint) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_set_bg_rgb(nc: *mut ncdirect, rgb: cty::c_uint) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_set_fg_palindex(nc: *mut ncdirect, pidx: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_set_bg_palindex(nc: *mut ncdirect, pidx: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Returns the number of simultaneous colors claimed to be supported, or 1 if"] - #[doc = " there is no color support. Note that several terminal emulators advertise"] - #[doc = " more colors than they actually support, downsampling internally."] - pub fn ncdirect_palette_size(nc: *const ncdirect) -> cty::c_uint; -} -extern "C" { - #[doc = " Output the string |utf8| according to the channels |channels|. Note that"] - #[doc = " ncdirect_putstr() does not explicitly flush output buffers, so it will not"] - #[doc = " necessarily be immediately visible."] - pub fn ncdirect_putstr( - nc: *mut ncdirect, - channels: u64, - utf8: *const cty::c_char, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Formatted printing (plus alignment relative to the terminal). Returns the"] - #[doc = " number of columns printed on success."] - pub fn ncdirect_printf_aligned( - n: *mut ncdirect, - y: cty::c_int, - align: ncalign_e, - fmt: *const cty::c_char, - ... - ) -> cty::c_int; -} -extern "C" { - #[doc = " Force a flush. Returns 0 on success, -1 on failure."] - pub fn ncdirect_flush(nc: *const ncdirect) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_set_fg_default(nc: *mut ncdirect) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_set_bg_default(nc: *mut ncdirect) -> cty::c_int; -} -extern "C" { - #[doc = " Get the current number of columns/rows."] - pub fn ncdirect_dim_x(nc: *const ncdirect) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_dim_y(nc: *const ncdirect) -> cty::c_int; -} -extern "C" { - #[doc = " ncplane_styles_*() analogues"] - pub fn ncdirect_set_styles(n: *mut ncdirect, stylebits: cty::c_uint) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_on_styles(n: *mut ncdirect, stylebits: cty::c_uint) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_off_styles(n: *mut ncdirect, stylebits: cty::c_uint) -> cty::c_int; -} -extern "C" { - #[doc = " Deprecated forms of above."] - pub fn ncdirect_styles_set(n: *mut ncdirect, stylebits: cty::c_uint) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_styles_on(n: *mut ncdirect, stylebits: cty::c_uint) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_styles_off(n: *mut ncdirect, stylebits: cty::c_uint) -> cty::c_int; -} -extern "C" { - #[doc = " Move the cursor in direct mode. -1 to retain current location on that axis."] - pub fn ncdirect_cursor_move_yx(n: *mut ncdirect, y: cty::c_int, x: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_cursor_enable(nc: *mut ncdirect) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_cursor_disable(nc: *mut ncdirect) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_cursor_up(nc: *mut ncdirect, num: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_cursor_left(nc: *mut ncdirect, num: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_cursor_right(nc: *mut ncdirect, num: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_cursor_down(nc: *mut ncdirect, num: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Get the cursor position, when supported. This requires writing to the"] - #[doc = " terminal, and then reading from it. If the terminal doesn't reply, or"] - #[doc = " doesn't reply in a way we understand, the results might be deleterious."] - pub fn ncdirect_cursor_yx( - n: *mut ncdirect, - y: *mut cty::c_int, - x: *mut cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Push or pop the cursor location to the terminal's stack. The depth of this"] - #[doc = " stack, and indeed its existence, is terminal-dependent."] - pub fn ncdirect_cursor_push(n: *mut ncdirect) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_cursor_pop(n: *mut ncdirect) -> cty::c_int; -} -extern "C" { - #[doc = " Display an image using the specified blitter and scaling. The image may"] - #[doc = " be arbitrarily many rows -- the output will scroll -- but will only occupy"] - #[doc = " the column of the cursor, and those to the right. The render/raster process"] - #[doc = " can be split by using ncdirect_render_frame() and ncdirect_raster_frame()."] - pub fn ncdirect_render_image( - n: *mut ncdirect, - filename: *const cty::c_char, - align: ncalign_e, - blitter: ncblitter_e, - scale: ncscale_e, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Clear the screen."] - pub fn ncdirect_clear(nc: *mut ncdirect) -> cty::c_int; -} -extern "C" { - #[doc = " Can we load images? This requires being built against FFmpeg/OIIO."] - pub fn ncdirect_canopen_images(n: *const ncdirect) -> bool; -} -extern "C" { - #[doc = " Is our encoding UTF-8? Requires LANG being set to a UTF8 locale."] - pub fn ncdirect_canutf8(n: *const ncdirect) -> bool; -} -extern "C" { - #[doc = " This function must successfully return before NCBLIT_PIXEL is available."] - #[doc = " Returns -1 on error, 0 for no support, or 1 if pixel output is supported."] - #[doc = " Must not be called concurrently with either input or rasterization."] - pub fn ncdirect_check_pixel_support(n: *mut ncdirect) -> cty::c_int; -} -extern "C" { - #[doc = " Draw horizontal/vertical lines using the specified channels, interpolating"] - #[doc = " between them as we go. The EGC may not use more than one column. For a"] - #[doc = " horizontal line, |len| cannot exceed the screen width minus the cursor's"] - #[doc = " offset. For a vertical line, it may be as long as you'd like; the screen"] - #[doc = " will scroll as necessary. All lines start at the current cursor position."] - pub fn ncdirect_hline_interp( - n: *mut ncdirect, - egc: *const cty::c_char, - len: cty::c_int, - h1: u64, - h2: u64, - ) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_vline_interp( - n: *mut ncdirect, - egc: *const cty::c_char, - len: cty::c_int, - h1: u64, - h2: u64, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Draw a box with its upper-left corner at the current cursor position, having"] - #[doc = " dimensions |ylen|x|xlen|. See ncplane_box() for more information. The"] - #[doc = " minimum box size is 2x2, and it cannot be drawn off-screen. |wchars| is an"] - #[doc = " array of 6 wide characters: UL, UR, LL, LR, HL, VL."] - pub fn ncdirect_box( - n: *mut ncdirect, - ul: u64, - ur: u64, - ll: u64, - lr: u64, - wchars: *const wchar_t, - ylen: cty::c_int, - xlen: cty::c_int, - ctlword: cty::c_uint, - ) -> cty::c_int; -} -extern "C" { - #[doc = " ncdirect_box() with the rounded box-drawing characters"] - pub fn ncdirect_rounded_box( - n: *mut ncdirect, - ul: u64, - ur: u64, - ll: u64, - lr: u64, - ylen: cty::c_int, - xlen: cty::c_int, - ctlword: cty::c_uint, - ) -> cty::c_int; -} -extern "C" { - #[doc = " ncdirect_box() with the double box-drawing characters"] - pub fn ncdirect_double_box( - n: *mut ncdirect, - ul: u64, - ur: u64, - ll: u64, - lr: u64, - ylen: cty::c_int, - xlen: cty::c_int, - ctlword: cty::c_uint, - ) -> cty::c_int; -} -extern "C" { - #[doc = " See ppoll(2) for more detail. Provide a NULL 'ts' to block at length, a 'ts'"] - #[doc = " of 0 for non-blocking operation, and otherwise a timespec to bound blocking."] - #[doc = " Signals in sigmask (less several we handle internally) will be atomically"] - #[doc = " masked and unmasked per ppoll(2). '*sigmask' should generally contain all"] - #[doc = " signals. Returns a single Unicode code point, or (char32_t)-1 on error."] - #[doc = " 'sigmask' may be NULL. Returns 0 on a timeout. If an event is processed, the"] - #[doc = " return value is the 'id' field from that event. 'ni' may be NULL."] - pub fn ncdirect_getc( - n: *mut ncdirect, - ts: *const timespec, - sigmask: *mut sigset_t, - ni: *mut ncinput, - ) -> char32_t; -} -extern "C" { - #[doc = " Get a file descriptor suitable for input event poll()ing. When this"] - #[doc = " descriptor becomes available, you can call ncdirect_getc_nblock(),"] - #[doc = " and input ought be ready. This file descriptor is *not* necessarily"] - #[doc = " the file descriptor associated with stdin (but it might be!)."] - pub fn ncdirect_inputready_fd(n: *mut ncdirect) -> cty::c_int; -} -extern "C" { - #[doc = " Release 'nc' and any associated resources. 0 on success, non-0 on failure."] - pub fn ncdirect_stop(nc: *mut ncdirect) -> cty::c_int; -} -extern "C" { - #[doc = " Render an image using the specified blitter and scaling, but do not write"] - #[doc = " the result. The image may be arbitrarily many rows -- the output will scroll"] - #[doc = " -- but will only occupy the column of the cursor, and those to the right."] - #[doc = " To actually write (and free) this, invoke ncdirect_raster_frame(). 'maxx'"] - #[doc = " and 'maxy', if greater than 0, are used for scaling; the terminal's geometry"] - #[doc = " is otherwise used."] - pub fn ncdirect_render_frame( - n: *mut ncdirect, - filename: *const cty::c_char, - blitter: ncblitter_e, - scale: ncscale_e, - maxy: cty::c_int, - maxx: cty::c_int, - ) -> *mut ncdirectv; -} -extern "C" { - #[doc = " Takes the result of ncdirect_render_frame() and writes it to the output."] - pub fn ncdirect_raster_frame( - n: *mut ncdirect, - ncdv: *mut ncdirectv, - align: ncalign_e, - ) -> cty::c_int; -} -pub type __builtin_va_list = [__va_list_tag; 1usize]; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct __va_list_tag { - pub gp_offset: cty::c_uint, - pub fp_offset: cty::c_uint, - pub overflow_arg_area: *mut cty::c_void, - pub reg_save_area: *mut cty::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) - ) - ); -} diff --git a/tools/function-summary/history/bindgen_20210410.rs b/tools/function-summary/history/bindgen_20210410.rs deleted file mode 100644 index de4fd4c33..000000000 --- a/tools/function-summary/history/bindgen_20210410.rs +++ /dev/null @@ -1,9734 +0,0 @@ -/* automatically generated by rust-bindgen 0.58.1 */ - -#[repr(C)] -#[derive(Default)] -pub struct __IncompleteArrayField(::core::marker::PhantomData, [T; 0]); -impl __IncompleteArrayField { - #[inline] - pub const fn new() -> Self { - __IncompleteArrayField(::core::marker::PhantomData, []) - } - #[inline] - pub fn as_ptr(&self) -> *const T { - self as *const _ as *const T - } - #[inline] - pub fn as_mut_ptr(&mut self) -> *mut T { - self as *mut _ as *mut T - } - #[inline] - pub unsafe fn as_slice(&self, len: usize) -> &[T] { - ::core::slice::from_raw_parts(self.as_ptr(), len) - } - #[inline] - pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] { - ::core::slice::from_raw_parts_mut(self.as_mut_ptr(), len) - } -} -impl ::core::fmt::Debug for __IncompleteArrayField { - fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - fmt.write_str("__IncompleteArrayField") - } -} -pub const _TIME_H: u32 = 1; -pub const _FEATURES_H: u32 = 1; -pub const __GLIBC_USE_ISOC2X: u32 = 0; -pub const __USE_ISOC11: u32 = 1; -pub const __USE_ISOC99: u32 = 1; -pub const __USE_ISOC95: u32 = 1; -pub const _POSIX_SOURCE: u32 = 1; -pub const _POSIX_C_SOURCE: u32 = 2; -pub const __USE_POSIX_IMPLICITLY: u32 = 1; -pub const __USE_POSIX: u32 = 1; -pub const __USE_POSIX2: u32 = 1; -pub const __USE_XOPEN: u32 = 1; -pub const __USE_FORTIFY_LEVEL: u32 = 0; -pub const __GLIBC_USE_DEPRECATED_GETS: u32 = 0; -pub const __GLIBC_USE_DEPRECATED_SCANF: u32 = 0; -pub const _STDC_PREDEF_H: u32 = 1; -pub const __STDC_IEC_559__: u32 = 1; -pub const __STDC_IEC_559_COMPLEX__: u32 = 1; -pub const __STDC_ISO_10646__: u32 = 201706; -pub const __GNU_LIBRARY__: u32 = 6; -pub const __GLIBC__: u32 = 2; -pub const __GLIBC_MINOR__: u32 = 31; -pub const _SYS_CDEFS_H: u32 = 1; -pub const __glibc_c99_flexarr_available: u32 = 1; -pub const __WORDSIZE: u32 = 64; -pub const __WORDSIZE_TIME64_COMPAT32: u32 = 1; -pub const __SYSCALL_WORDSIZE: u32 = 64; -pub const __LONG_DOUBLE_USES_FLOAT128: u32 = 0; -pub const __HAVE_GENERIC_SELECTION: u32 = 1; -pub const _BITS_TIME_H: u32 = 1; -pub const _BITS_TYPES_H: u32 = 1; -pub const __TIMESIZE: u32 = 64; -pub const _BITS_TYPESIZES_H: u32 = 1; -pub const __OFF_T_MATCHES_OFF64_T: u32 = 1; -pub const __INO_T_MATCHES_INO64_T: u32 = 1; -pub const __RLIM_T_MATCHES_RLIM64_T: u32 = 1; -pub const __STATFS_MATCHES_STATFS64: u32 = 1; -pub const __FD_SETSIZE: u32 = 1024; -pub const _BITS_TIME64_H: u32 = 1; -pub const __clock_t_defined: u32 = 1; -pub const __time_t_defined: u32 = 1; -pub const __struct_tm_defined: u32 = 1; -pub const _STRUCT_TIMESPEC: u32 = 1; -pub const _BITS_ENDIAN_H: u32 = 1; -pub const __LITTLE_ENDIAN: u32 = 1234; -pub const __BIG_ENDIAN: u32 = 4321; -pub const __PDP_ENDIAN: u32 = 3412; -pub const _BITS_ENDIANNESS_H: u32 = 1; -pub const __BYTE_ORDER: u32 = 1234; -pub const __FLOAT_WORD_ORDER: u32 = 1234; -pub const TIME_UTC: u32 = 1; -pub const _UCHAR_H: u32 = 1; -pub const __mbstate_t_defined: u32 = 1; -pub const ____mbstate_t_defined: u32 = 1; -pub const _CTYPE_H: u32 = 1; -pub const _WCHAR_H: u32 = 1; -pub const __GLIBC_USE_LIB_EXT2: u32 = 0; -pub const __GLIBC_USE_IEC_60559_BFP_EXT: u32 = 0; -pub const __GLIBC_USE_IEC_60559_BFP_EXT_C2X: u32 = 0; -pub const __GLIBC_USE_IEC_60559_FUNCS_EXT: u32 = 0; -pub const __GLIBC_USE_IEC_60559_FUNCS_EXT_C2X: u32 = 0; -pub const __GLIBC_USE_IEC_60559_TYPES_EXT: u32 = 0; -pub const __HAVE_FLOAT128: u32 = 0; -pub const __HAVE_DISTINCT_FLOAT128: u32 = 0; -pub const __HAVE_FLOAT64X: u32 = 1; -pub const __HAVE_FLOAT64X_LONG_DOUBLE: u32 = 1; -pub const __HAVE_FLOAT16: u32 = 0; -pub const __HAVE_FLOAT32: u32 = 1; -pub const __HAVE_FLOAT64: u32 = 1; -pub const __HAVE_FLOAT32X: u32 = 1; -pub const __HAVE_FLOAT128X: u32 = 0; -pub const __HAVE_DISTINCT_FLOAT16: u32 = 0; -pub const __HAVE_DISTINCT_FLOAT32: u32 = 0; -pub const __HAVE_DISTINCT_FLOAT64: u32 = 0; -pub const __HAVE_DISTINCT_FLOAT32X: u32 = 0; -pub const __HAVE_DISTINCT_FLOAT64X: u32 = 0; -pub const __HAVE_DISTINCT_FLOAT128X: u32 = 0; -pub const __HAVE_FLOATN_NOT_TYPEDEF: u32 = 0; -pub const __GNUC_VA_LIST: u32 = 1; -pub const _BITS_WCHAR_H: u32 = 1; -pub const __wint_t_defined: u32 = 1; -pub const _WINT_T: u32 = 1; -pub const ____FILE_defined: u32 = 1; -pub const WEOF: u32 = 4294967295; -pub const _BITS_WCTYPE_WCHAR_H: u32 = 1; -pub const _STDIO_H: u32 = 1; -pub const _____fpos_t_defined: u32 = 1; -pub const _____fpos64_t_defined: u32 = 1; -pub const __FILE_defined: u32 = 1; -pub const __struct_FILE_defined: u32 = 1; -pub const _IO_EOF_SEEN: u32 = 16; -pub const _IO_ERR_SEEN: u32 = 32; -pub const _IO_USER_LOCK: u32 = 32768; -pub const _IOFBF: u32 = 0; -pub const _IOLBF: u32 = 1; -pub const _IONBF: u32 = 2; -pub const BUFSIZ: u32 = 8192; -pub const EOF: i32 = -1; -pub const SEEK_SET: u32 = 0; -pub const SEEK_CUR: u32 = 1; -pub const SEEK_END: u32 = 2; -pub const P_tmpdir: &'static [u8; 5usize] = b"/tmp\0"; -pub const _BITS_STDIO_LIM_H: u32 = 1; -pub const L_tmpnam: u32 = 20; -pub const TMP_MAX: u32 = 238328; -pub const FILENAME_MAX: u32 = 4096; -pub const L_ctermid: u32 = 9; -pub const L_cuserid: u32 = 9; -pub const FOPEN_MAX: u32 = 16; -pub const _GETOPT_POSIX_H: u32 = 1; -pub const _GETOPT_CORE_H: u32 = 1; -pub const _STDINT_H: u32 = 1; -pub const _BITS_STDINT_INTN_H: u32 = 1; -pub const _BITS_STDINT_UINTN_H: u32 = 1; -pub const INT8_MIN: i32 = -128; -pub const INT16_MIN: i32 = -32768; -pub const INT32_MIN: i32 = -2147483648; -pub const INT8_MAX: u32 = 127; -pub const INT16_MAX: u32 = 32767; -pub const INT32_MAX: u32 = 2147483647; -pub const UINT8_MAX: u32 = 255; -pub const UINT16_MAX: u32 = 65535; -pub const UINT32_MAX: u32 = 4294967295; -pub const INT_LEAST8_MIN: i32 = -128; -pub const INT_LEAST16_MIN: i32 = -32768; -pub const INT_LEAST32_MIN: i32 = -2147483648; -pub const INT_LEAST8_MAX: u32 = 127; -pub const INT_LEAST16_MAX: u32 = 32767; -pub const INT_LEAST32_MAX: u32 = 2147483647; -pub const UINT_LEAST8_MAX: u32 = 255; -pub const UINT_LEAST16_MAX: u32 = 65535; -pub const UINT_LEAST32_MAX: u32 = 4294967295; -pub const INT_FAST8_MIN: i32 = -128; -pub const INT_FAST16_MIN: i64 = -9223372036854775808; -pub const INT_FAST32_MIN: i64 = -9223372036854775808; -pub const INT_FAST8_MAX: u32 = 127; -pub const INT_FAST16_MAX: u64 = 9223372036854775807; -pub const INT_FAST32_MAX: u64 = 9223372036854775807; -pub const UINT_FAST8_MAX: u32 = 255; -pub const UINT_FAST16_MAX: i32 = -1; -pub const UINT_FAST32_MAX: i32 = -1; -pub const INTPTR_MIN: i64 = -9223372036854775808; -pub const INTPTR_MAX: u64 = 9223372036854775807; -pub const UINTPTR_MAX: i32 = -1; -pub const PTRDIFF_MIN: i64 = -9223372036854775808; -pub const PTRDIFF_MAX: u64 = 9223372036854775807; -pub const SIG_ATOMIC_MIN: i32 = -2147483648; -pub const SIG_ATOMIC_MAX: u32 = 2147483647; -pub const SIZE_MAX: i32 = -1; -pub const WINT_MIN: u32 = 0; -pub const WINT_MAX: u32 = 4294967295; -pub const _STDLIB_H: u32 = 1; -pub const WNOHANG: u32 = 1; -pub const WUNTRACED: u32 = 2; -pub const __WNOTHREAD: u32 = 536870912; -pub const __WALL: u32 = 1073741824; -pub const __WCLONE: u32 = 2147483648; -pub const __W_CONTINUED: u32 = 65535; -pub const __WCOREFLAG: u32 = 128; -pub const __ldiv_t_defined: u32 = 1; -pub const __lldiv_t_defined: u32 = 1; -pub const RAND_MAX: u32 = 2147483647; -pub const EXIT_FAILURE: u32 = 1; -pub const EXIT_SUCCESS: u32 = 0; -pub const _STRING_H: u32 = 1; -pub const _BITS_SIGNUM_H: u32 = 1; -pub const _BITS_SIGNUM_GENERIC_H: u32 = 1; -pub const SIGINT: u32 = 2; -pub const SIGILL: u32 = 4; -pub const SIGABRT: u32 = 6; -pub const SIGFPE: u32 = 8; -pub const SIGSEGV: u32 = 11; -pub const SIGTERM: u32 = 15; -pub const SIGHUP: u32 = 1; -pub const SIGQUIT: u32 = 3; -pub const SIGTRAP: u32 = 5; -pub const SIGKILL: u32 = 9; -pub const SIGBUS: u32 = 10; -pub const SIGSYS: u32 = 12; -pub const SIGPIPE: u32 = 13; -pub const SIGALRM: u32 = 14; -pub const SIGURG: u32 = 16; -pub const SIGSTOP: u32 = 17; -pub const SIGTSTP: u32 = 18; -pub const SIGCONT: u32 = 19; -pub const SIGCHLD: u32 = 20; -pub const SIGTTIN: u32 = 21; -pub const SIGTTOU: u32 = 22; -pub const SIGPOLL: u32 = 23; -pub const SIGXCPU: u32 = 24; -pub const SIGXFSZ: u32 = 25; -pub const SIGVTALRM: u32 = 26; -pub const SIGPROF: u32 = 27; -pub const SIGUSR1: u32 = 30; -pub const SIGUSR2: u32 = 31; -pub const SIGWINCH: u32 = 28; -pub const SIGIO: u32 = 23; -pub const SIGIOT: u32 = 6; -pub const SIGCLD: u32 = 20; -pub const __SIGRTMIN: u32 = 32; -pub const __SIGRTMAX: u32 = 32; -pub const _NSIG: u32 = 33; -pub const SIGSTKFLT: u32 = 16; -pub const SIGPWR: u32 = 30; -pub const __sig_atomic_t_defined: u32 = 1; -pub const __sigset_t_defined: u32 = 1; -pub const _BITS_SIGACTION_H: u32 = 1; -pub const SA_NOCLDSTOP: u32 = 1; -pub const SA_NOCLDWAIT: u32 = 2; -pub const SA_SIGINFO: u32 = 4; -pub const SIG_BLOCK: u32 = 0; -pub const SIG_UNBLOCK: u32 = 1; -pub const SIG_SETMASK: u32 = 2; -pub const _LIBC_LIMITS_H_: u32 = 1; -pub const MB_LEN_MAX: u32 = 16; -pub const _BITS_POSIX1_LIM_H: u32 = 1; -pub const _POSIX_AIO_LISTIO_MAX: u32 = 2; -pub const _POSIX_AIO_MAX: u32 = 1; -pub const _POSIX_ARG_MAX: u32 = 4096; -pub const _POSIX_CHILD_MAX: u32 = 6; -pub const _POSIX_DELAYTIMER_MAX: u32 = 32; -pub const _POSIX_HOST_NAME_MAX: u32 = 255; -pub const _POSIX_LINK_MAX: u32 = 8; -pub const _POSIX_LOGIN_NAME_MAX: u32 = 9; -pub const _POSIX_MAX_CANON: u32 = 255; -pub const _POSIX_MAX_INPUT: u32 = 255; -pub const _POSIX_MQ_OPEN_MAX: u32 = 8; -pub const _POSIX_MQ_PRIO_MAX: u32 = 32; -pub const _POSIX_NAME_MAX: u32 = 14; -pub const _POSIX_NGROUPS_MAX: u32 = 0; -pub const _POSIX_OPEN_MAX: u32 = 16; -pub const _POSIX_FD_SETSIZE: u32 = 16; -pub const _POSIX_PATH_MAX: u32 = 256; -pub const _POSIX_PIPE_BUF: u32 = 512; -pub const _POSIX_RE_DUP_MAX: u32 = 255; -pub const _POSIX_RTSIG_MAX: u32 = 8; -pub const _POSIX_SEM_NSEMS_MAX: u32 = 256; -pub const _POSIX_SEM_VALUE_MAX: u32 = 32767; -pub const _POSIX_SIGQUEUE_MAX: u32 = 32; -pub const _POSIX_SSIZE_MAX: u32 = 32767; -pub const _POSIX_STREAM_MAX: u32 = 8; -pub const _POSIX_SYMLINK_MAX: u32 = 255; -pub const _POSIX_SYMLOOP_MAX: u32 = 8; -pub const _POSIX_TIMER_MAX: u32 = 32; -pub const _POSIX_TTY_NAME_MAX: u32 = 9; -pub const _POSIX_TZNAME_MAX: u32 = 3; -pub const _POSIX_QLIMIT: u32 = 1; -pub const _POSIX_HIWAT: u32 = 512; -pub const _POSIX_UIO_MAXIOV: u32 = 16; -pub const _POSIX_CLOCKRES_MIN: u32 = 20000000; -pub const NR_OPEN: u32 = 1024; -pub const NGROUPS_MAX: u32 = 65536; -pub const ARG_MAX: u32 = 131072; -pub const LINK_MAX: u32 = 127; -pub const MAX_CANON: u32 = 255; -pub const MAX_INPUT: u32 = 255; -pub const NAME_MAX: u32 = 255; -pub const PATH_MAX: u32 = 4096; -pub const PIPE_BUF: u32 = 4096; -pub const XATTR_NAME_MAX: u32 = 255; -pub const XATTR_SIZE_MAX: u32 = 65536; -pub const XATTR_LIST_MAX: u32 = 65536; -pub const RTSIG_MAX: u32 = 32; -pub const _POSIX_THREAD_KEYS_MAX: u32 = 128; -pub const PTHREAD_KEYS_MAX: u32 = 1024; -pub const _POSIX_THREAD_DESTRUCTOR_ITERATIONS: u32 = 4; -pub const PTHREAD_DESTRUCTOR_ITERATIONS: u32 = 4; -pub const _POSIX_THREAD_THREADS_MAX: u32 = 64; -pub const AIO_PRIO_DELTA_MAX: u32 = 20; -pub const PTHREAD_STACK_MIN: u32 = 16384; -pub const DELAYTIMER_MAX: u32 = 2147483647; -pub const TTY_NAME_MAX: u32 = 32; -pub const LOGIN_NAME_MAX: u32 = 256; -pub const HOST_NAME_MAX: u32 = 64; -pub const MQ_PRIO_MAX: u32 = 32768; -pub const SEM_VALUE_MAX: u32 = 2147483647; -pub const _BITS_POSIX2_LIM_H: u32 = 1; -pub const _POSIX2_BC_BASE_MAX: u32 = 99; -pub const _POSIX2_BC_DIM_MAX: u32 = 2048; -pub const _POSIX2_BC_SCALE_MAX: u32 = 99; -pub const _POSIX2_BC_STRING_MAX: u32 = 1000; -pub const _POSIX2_COLL_WEIGHTS_MAX: u32 = 2; -pub const _POSIX2_EXPR_NEST_MAX: u32 = 32; -pub const _POSIX2_LINE_MAX: u32 = 2048; -pub const _POSIX2_RE_DUP_MAX: u32 = 255; -pub const _POSIX2_CHARCLASS_NAME_MAX: u32 = 14; -pub const BC_BASE_MAX: u32 = 99; -pub const BC_DIM_MAX: u32 = 2048; -pub const BC_SCALE_MAX: u32 = 99; -pub const BC_STRING_MAX: u32 = 1000; -pub const COLL_WEIGHTS_MAX: u32 = 255; -pub const EXPR_NEST_MAX: u32 = 32; -pub const LINE_MAX: u32 = 2048; -pub const CHARCLASS_NAME_MAX: u32 = 2048; -pub const RE_DUP_MAX: u32 = 32767; -pub const _XOPEN_LIM_H: u32 = 1; -pub const _XOPEN_IOV_MAX: u32 = 16; -pub const _BITS_UIO_LIM_H: u32 = 1; -pub const __IOV_MAX: u32 = 1024; -pub const IOV_MAX: u32 = 1024; -pub const NL_ARGMAX: u32 = 4096; -pub const NL_LANGMAX: u32 = 2048; -pub const NZERO: u32 = 20; -pub const WORD_BIT: u32 = 32; -pub const LONG_BIT: u32 = 64; -pub const true_: u32 = 1; -pub const false_: u32 = 0; -pub const __bool_true_false_are_defined: u32 = 1; -pub const _BYTESWAP_H: u32 = 1; -pub const _BITS_BYTESWAP_H: u32 = 1; -pub const _NETINET_IN_H: u32 = 1; -pub const _SYS_SOCKET_H: u32 = 1; -pub const __iovec_defined: u32 = 1; -pub const _SYS_TYPES_H: u32 = 1; -pub const __clockid_t_defined: u32 = 1; -pub const __timer_t_defined: u32 = 1; -pub const __BIT_TYPES_DEFINED__: u32 = 1; -pub const PF_UNSPEC: u32 = 0; -pub const PF_LOCAL: u32 = 1; -pub const PF_UNIX: u32 = 1; -pub const PF_FILE: u32 = 1; -pub const PF_INET: u32 = 2; -pub const PF_AX25: u32 = 3; -pub const PF_IPX: u32 = 4; -pub const PF_APPLETALK: u32 = 5; -pub const PF_NETROM: u32 = 6; -pub const PF_BRIDGE: u32 = 7; -pub const PF_ATMPVC: u32 = 8; -pub const PF_X25: u32 = 9; -pub const PF_INET6: u32 = 10; -pub const PF_ROSE: u32 = 11; -pub const PF_DECnet: u32 = 12; -pub const PF_NETBEUI: u32 = 13; -pub const PF_SECURITY: u32 = 14; -pub const PF_KEY: u32 = 15; -pub const PF_NETLINK: u32 = 16; -pub const PF_ROUTE: u32 = 16; -pub const PF_PACKET: u32 = 17; -pub const PF_ASH: u32 = 18; -pub const PF_ECONET: u32 = 19; -pub const PF_ATMSVC: u32 = 20; -pub const PF_RDS: u32 = 21; -pub const PF_SNA: u32 = 22; -pub const PF_IRDA: u32 = 23; -pub const PF_PPPOX: u32 = 24; -pub const PF_WANPIPE: u32 = 25; -pub const PF_LLC: u32 = 26; -pub const PF_IB: u32 = 27; -pub const PF_MPLS: u32 = 28; -pub const PF_CAN: u32 = 29; -pub const PF_TIPC: u32 = 30; -pub const PF_BLUETOOTH: u32 = 31; -pub const PF_IUCV: u32 = 32; -pub const PF_RXRPC: u32 = 33; -pub const PF_ISDN: u32 = 34; -pub const PF_PHONET: u32 = 35; -pub const PF_IEEE802154: u32 = 36; -pub const PF_CAIF: u32 = 37; -pub const PF_ALG: u32 = 38; -pub const PF_NFC: u32 = 39; -pub const PF_VSOCK: u32 = 40; -pub const PF_KCM: u32 = 41; -pub const PF_QIPCRTR: u32 = 42; -pub const PF_SMC: u32 = 43; -pub const PF_XDP: u32 = 44; -pub const PF_MAX: u32 = 45; -pub const AF_UNSPEC: u32 = 0; -pub const AF_LOCAL: u32 = 1; -pub const AF_UNIX: u32 = 1; -pub const AF_FILE: u32 = 1; -pub const AF_INET: u32 = 2; -pub const AF_AX25: u32 = 3; -pub const AF_IPX: u32 = 4; -pub const AF_APPLETALK: u32 = 5; -pub const AF_NETROM: u32 = 6; -pub const AF_BRIDGE: u32 = 7; -pub const AF_ATMPVC: u32 = 8; -pub const AF_X25: u32 = 9; -pub const AF_INET6: u32 = 10; -pub const AF_ROSE: u32 = 11; -pub const AF_DECnet: u32 = 12; -pub const AF_NETBEUI: u32 = 13; -pub const AF_SECURITY: u32 = 14; -pub const AF_KEY: u32 = 15; -pub const AF_NETLINK: u32 = 16; -pub const AF_ROUTE: u32 = 16; -pub const AF_PACKET: u32 = 17; -pub const AF_ASH: u32 = 18; -pub const AF_ECONET: u32 = 19; -pub const AF_ATMSVC: u32 = 20; -pub const AF_RDS: u32 = 21; -pub const AF_SNA: u32 = 22; -pub const AF_IRDA: u32 = 23; -pub const AF_PPPOX: u32 = 24; -pub const AF_WANPIPE: u32 = 25; -pub const AF_LLC: u32 = 26; -pub const AF_IB: u32 = 27; -pub const AF_MPLS: u32 = 28; -pub const AF_CAN: u32 = 29; -pub const AF_TIPC: u32 = 30; -pub const AF_BLUETOOTH: u32 = 31; -pub const AF_IUCV: u32 = 32; -pub const AF_RXRPC: u32 = 33; -pub const AF_ISDN: u32 = 34; -pub const AF_PHONET: u32 = 35; -pub const AF_IEEE802154: u32 = 36; -pub const AF_CAIF: u32 = 37; -pub const AF_ALG: u32 = 38; -pub const AF_NFC: u32 = 39; -pub const AF_VSOCK: u32 = 40; -pub const AF_KCM: u32 = 41; -pub const AF_QIPCRTR: u32 = 42; -pub const AF_SMC: u32 = 43; -pub const AF_XDP: u32 = 44; -pub const AF_MAX: u32 = 45; -pub const SOL_RAW: u32 = 255; -pub const SOL_DECNET: u32 = 261; -pub const SOL_X25: u32 = 262; -pub const SOL_PACKET: u32 = 263; -pub const SOL_ATM: u32 = 264; -pub const SOL_AAL: u32 = 265; -pub const SOL_IRDA: u32 = 266; -pub const SOL_NETBEUI: u32 = 267; -pub const SOL_LLC: u32 = 268; -pub const SOL_DCCP: u32 = 269; -pub const SOL_NETLINK: u32 = 270; -pub const SOL_TIPC: u32 = 271; -pub const SOL_RXRPC: u32 = 272; -pub const SOL_PPPOL2TP: u32 = 273; -pub const SOL_BLUETOOTH: u32 = 274; -pub const SOL_PNPIPE: u32 = 275; -pub const SOL_RDS: u32 = 276; -pub const SOL_IUCV: u32 = 277; -pub const SOL_CAIF: u32 = 278; -pub const SOL_ALG: u32 = 279; -pub const SOL_NFC: u32 = 280; -pub const SOL_KCM: u32 = 281; -pub const SOL_TLS: u32 = 282; -pub const SOL_XDP: u32 = 283; -pub const SOMAXCONN: u32 = 4096; -pub const _BITS_SOCKADDR_H: u32 = 1; -pub const _SS_SIZE: u32 = 128; -pub const SO_DEBUG: u32 = 1; -pub const SOL_SOCKET: u32 = 1; -pub const SO_ACCEPTCONN: u32 = 30; -pub const SO_BROADCAST: u32 = 6; -pub const SO_DONTROUTE: u32 = 5; -pub const SO_ERROR: u32 = 4; -pub const SO_KEEPALIVE: u32 = 9; -pub const SO_LINGER: u32 = 13; -pub const SO_OOBINLINE: u32 = 10; -pub const SO_RCVBUF: u32 = 8; -pub const SO_RCVLOWAT: u32 = 18; -pub const SO_RCVTIMEO: u32 = 20; -pub const SO_REUSEADDR: u32 = 2; -pub const SO_SNDBUF: u32 = 7; -pub const SO_SNDLOWAT: u32 = 19; -pub const SO_SNDTIMEO: u32 = 21; -pub const SO_TYPE: u32 = 3; -pub const __USE_KERNEL_IPV6_DEFS: u32 = 0; -pub const IP_OPTIONS: u32 = 4; -pub const IP_HDRINCL: u32 = 3; -pub const IP_TOS: u32 = 1; -pub const IP_TTL: u32 = 2; -pub const IP_RECVOPTS: u32 = 6; -pub const IP_RETOPTS: u32 = 7; -pub const IP_MULTICAST_IF: u32 = 32; -pub const IP_MULTICAST_TTL: u32 = 33; -pub const IP_MULTICAST_LOOP: u32 = 34; -pub const IP_ADD_MEMBERSHIP: u32 = 35; -pub const IP_DROP_MEMBERSHIP: u32 = 36; -pub const IP_UNBLOCK_SOURCE: u32 = 37; -pub const IP_BLOCK_SOURCE: u32 = 38; -pub const IP_ADD_SOURCE_MEMBERSHIP: u32 = 39; -pub const IP_DROP_SOURCE_MEMBERSHIP: u32 = 40; -pub const IP_MSFILTER: u32 = 41; -pub const IP_ROUTER_ALERT: u32 = 5; -pub const IP_PKTINFO: u32 = 8; -pub const IP_PKTOPTIONS: u32 = 9; -pub const IP_PMTUDISC: u32 = 10; -pub const IP_MTU_DISCOVER: u32 = 10; -pub const IP_RECVERR: u32 = 11; -pub const IP_RECVTTL: u32 = 12; -pub const IP_RECVTOS: u32 = 13; -pub const IP_MTU: u32 = 14; -pub const IP_FREEBIND: u32 = 15; -pub const IP_IPSEC_POLICY: u32 = 16; -pub const IP_XFRM_POLICY: u32 = 17; -pub const IP_PASSSEC: u32 = 18; -pub const IP_TRANSPARENT: u32 = 19; -pub const IP_MULTICAST_ALL: u32 = 49; -pub const IP_ORIGDSTADDR: u32 = 20; -pub const IP_RECVORIGDSTADDR: u32 = 20; -pub const IP_MINTTL: u32 = 21; -pub const IP_NODEFRAG: u32 = 22; -pub const IP_CHECKSUM: u32 = 23; -pub const IP_BIND_ADDRESS_NO_PORT: u32 = 24; -pub const IP_RECVFRAGSIZE: u32 = 25; -pub const IP_PMTUDISC_DONT: u32 = 0; -pub const IP_PMTUDISC_WANT: u32 = 1; -pub const IP_PMTUDISC_DO: u32 = 2; -pub const IP_PMTUDISC_PROBE: u32 = 3; -pub const IP_PMTUDISC_INTERFACE: u32 = 4; -pub const IP_PMTUDISC_OMIT: u32 = 5; -pub const IP_UNICAST_IF: u32 = 50; -pub const SOL_IP: u32 = 0; -pub const IP_DEFAULT_MULTICAST_TTL: u32 = 1; -pub const IP_DEFAULT_MULTICAST_LOOP: u32 = 1; -pub const IP_MAX_MEMBERSHIPS: u32 = 20; -pub const IPV6_ADDRFORM: u32 = 1; -pub const IPV6_2292PKTINFO: u32 = 2; -pub const IPV6_2292HOPOPTS: u32 = 3; -pub const IPV6_2292DSTOPTS: u32 = 4; -pub const IPV6_2292RTHDR: u32 = 5; -pub const IPV6_2292PKTOPTIONS: u32 = 6; -pub const IPV6_CHECKSUM: u32 = 7; -pub const IPV6_2292HOPLIMIT: u32 = 8; -pub const IPV6_NEXTHOP: u32 = 9; -pub const IPV6_AUTHHDR: u32 = 10; -pub const IPV6_UNICAST_HOPS: u32 = 16; -pub const IPV6_MULTICAST_IF: u32 = 17; -pub const IPV6_MULTICAST_HOPS: u32 = 18; -pub const IPV6_MULTICAST_LOOP: u32 = 19; -pub const IPV6_JOIN_GROUP: u32 = 20; -pub const IPV6_LEAVE_GROUP: u32 = 21; -pub const IPV6_ROUTER_ALERT: u32 = 22; -pub const IPV6_MTU_DISCOVER: u32 = 23; -pub const IPV6_MTU: u32 = 24; -pub const IPV6_RECVERR: u32 = 25; -pub const IPV6_V6ONLY: u32 = 26; -pub const IPV6_JOIN_ANYCAST: u32 = 27; -pub const IPV6_LEAVE_ANYCAST: u32 = 28; -pub const IPV6_MULTICAST_ALL: u32 = 29; -pub const IPV6_ROUTER_ALERT_ISOLATE: u32 = 30; -pub const IPV6_IPSEC_POLICY: u32 = 34; -pub const IPV6_XFRM_POLICY: u32 = 35; -pub const IPV6_HDRINCL: u32 = 36; -pub const IPV6_RECVPKTINFO: u32 = 49; -pub const IPV6_PKTINFO: u32 = 50; -pub const IPV6_RECVHOPLIMIT: u32 = 51; -pub const IPV6_HOPLIMIT: u32 = 52; -pub const IPV6_RECVHOPOPTS: u32 = 53; -pub const IPV6_HOPOPTS: u32 = 54; -pub const IPV6_RTHDRDSTOPTS: u32 = 55; -pub const IPV6_RECVRTHDR: u32 = 56; -pub const IPV6_RTHDR: u32 = 57; -pub const IPV6_RECVDSTOPTS: u32 = 58; -pub const IPV6_DSTOPTS: u32 = 59; -pub const IPV6_RECVPATHMTU: u32 = 60; -pub const IPV6_PATHMTU: u32 = 61; -pub const IPV6_DONTFRAG: u32 = 62; -pub const IPV6_RECVTCLASS: u32 = 66; -pub const IPV6_TCLASS: u32 = 67; -pub const IPV6_AUTOFLOWLABEL: u32 = 70; -pub const IPV6_ADDR_PREFERENCES: u32 = 72; -pub const IPV6_MINHOPCOUNT: u32 = 73; -pub const IPV6_ORIGDSTADDR: u32 = 74; -pub const IPV6_RECVORIGDSTADDR: u32 = 74; -pub const IPV6_TRANSPARENT: u32 = 75; -pub const IPV6_UNICAST_IF: u32 = 76; -pub const IPV6_RECVFRAGSIZE: u32 = 77; -pub const IPV6_FREEBIND: u32 = 78; -pub const IPV6_ADD_MEMBERSHIP: u32 = 20; -pub const IPV6_DROP_MEMBERSHIP: u32 = 21; -pub const IPV6_RXHOPOPTS: u32 = 54; -pub const IPV6_RXDSTOPTS: u32 = 59; -pub const IPV6_PMTUDISC_DONT: u32 = 0; -pub const IPV6_PMTUDISC_WANT: u32 = 1; -pub const IPV6_PMTUDISC_DO: u32 = 2; -pub const IPV6_PMTUDISC_PROBE: u32 = 3; -pub const IPV6_PMTUDISC_INTERFACE: u32 = 4; -pub const IPV6_PMTUDISC_OMIT: u32 = 5; -pub const SOL_IPV6: u32 = 41; -pub const SOL_ICMPV6: u32 = 58; -pub const IPV6_RTHDR_LOOSE: u32 = 0; -pub const IPV6_RTHDR_STRICT: u32 = 1; -pub const IPV6_RTHDR_TYPE_0: u32 = 0; -pub const IN_CLASSA_NET: u32 = 4278190080; -pub const IN_CLASSA_NSHIFT: u32 = 24; -pub const IN_CLASSA_HOST: u32 = 16777215; -pub const IN_CLASSA_MAX: u32 = 128; -pub const IN_CLASSB_NET: u32 = 4294901760; -pub const IN_CLASSB_NSHIFT: u32 = 16; -pub const IN_CLASSB_HOST: u32 = 65535; -pub const IN_CLASSB_MAX: u32 = 65536; -pub const IN_CLASSC_NET: u32 = 4294967040; -pub const IN_CLASSC_NSHIFT: u32 = 8; -pub const IN_CLASSC_HOST: u32 = 255; -pub const IN_LOOPBACKNET: u32 = 127; -pub const INET_ADDRSTRLEN: u32 = 16; -pub const INET6_ADDRSTRLEN: u32 = 46; -pub const _ENDIAN_H: u32 = 1; -pub const _BITS_UINTN_IDENTITY_H: u32 = 1; -pub const NCKEY_ESC: u32 = 27; -pub const NCKEY_SPACE: u32 = 32; -pub const CELL_ALPHA_HIGHCONTRAST: u32 = 805306368; -pub const CELL_ALPHA_TRANSPARENT: u32 = 536870912; -pub const CELL_ALPHA_BLEND: u32 = 268435456; -pub const CELL_ALPHA_OPAQUE: u32 = 0; -pub const CELL_BGDEFAULT_MASK: u32 = 1073741824; -pub const CELL_FGDEFAULT_MASK: u64 = 4611686018427387904; -pub const CELL_BG_RGB_MASK: u32 = 16777215; -pub const CELL_FG_RGB_MASK: u64 = 72057589742960640; -pub const CELL_BG_PALETTE: u32 = 134217728; -pub const NCPALETTESIZE: u32 = 256; -pub const CELL_FG_PALETTE: u64 = 576460752303423488; -pub const CELL_BG_ALPHA_MASK: u32 = 805306368; -pub const CELL_FG_ALPHA_MASK: u64 = 3458764513820540928; -pub const NCSTYLE_MASK: u32 = 1023; -pub const NCSTYLE_STANDOUT: u32 = 128; -pub const NCSTYLE_UNDERLINE: u32 = 64; -pub const NCSTYLE_REVERSE: u32 = 32; -pub const NCSTYLE_BLINK: u32 = 16; -pub const NCSTYLE_DIM: u32 = 8; -pub const NCSTYLE_BOLD: u32 = 4; -pub const NCSTYLE_INVIS: u32 = 2; -pub const NCSTYLE_PROTECT: u32 = 1; -pub const NCSTYLE_ITALIC: u32 = 256; -pub const NCSTYLE_STRUCK: u32 = 512; -pub const NCSTYLE_NONE: u32 = 0; -pub const NCOPTION_INHIBIT_SETLOCALE: u32 = 1; -pub const NCOPTION_NO_CLEAR_BITMAPS: u32 = 2; -pub const NCOPTION_NO_WINCH_SIGHANDLER: u32 = 4; -pub const NCOPTION_NO_QUIT_SIGHANDLERS: u32 = 8; -pub const NCOPTION_SUPPRESS_BANNERS: u32 = 32; -pub const NCOPTION_NO_ALTERNATE_SCREEN: u32 = 64; -pub const NCOPTION_NO_FONT_CHANGES: u32 = 128; -pub const NCPLANE_OPTION_HORALIGNED: u32 = 1; -pub const NCPLANE_OPTION_VERALIGNED: u32 = 2; -pub const NCPLANE_OPTION_MARGINALIZED: u32 = 4; -pub const WCHAR_MAX_UTF8BYTES: u32 = 6; -pub const NCBOXMASK_TOP: u32 = 1; -pub const NCBOXMASK_RIGHT: u32 = 2; -pub const NCBOXMASK_BOTTOM: u32 = 4; -pub const NCBOXMASK_LEFT: u32 = 8; -pub const NCBOXGRAD_TOP: u32 = 16; -pub const NCBOXGRAD_RIGHT: u32 = 32; -pub const NCBOXGRAD_BOTTOM: u32 = 64; -pub const NCBOXGRAD_LEFT: u32 = 128; -pub const NCBOXCORNER_MASK: u32 = 768; -pub const NCBOXCORNER_SHIFT: u32 = 8; -pub const NCVISUAL_OPTION_NODEGRADE: u32 = 1; -pub const NCVISUAL_OPTION_BLEND: u32 = 2; -pub const NCVISUAL_OPTION_HORALIGNED: u32 = 4; -pub const NCVISUAL_OPTION_VERALIGNED: u32 = 8; -pub const NCREEL_OPTION_INFINITESCROLL: u32 = 1; -pub const NCREEL_OPTION_CIRCULAR: u32 = 2; -pub const PREFIXCOLUMNS: u32 = 7; -pub const IPREFIXCOLUMNS: u32 = 8; -pub const BPREFIXCOLUMNS: u32 = 9; -pub const PREFIXSTRLEN: u32 = 8; -pub const IPREFIXSTRLEN: u32 = 9; -pub const BPREFIXSTRLEN: u32 = 10; -pub const NCMENU_OPTION_BOTTOM: u32 = 1; -pub const NCMENU_OPTION_HIDING: u32 = 2; -pub const NCPROGBAR_OPTION_RETROGRADE: u32 = 1; -pub const NCTABBED_OPTION_BOTTOM: u32 = 1; -pub const NCPLOT_OPTION_LABELTICKSD: u32 = 1; -pub const NCPLOT_OPTION_EXPONENTIALD: u32 = 2; -pub const NCPLOT_OPTION_VERTICALI: u32 = 4; -pub const NCPLOT_OPTION_NODEGRADE: u32 = 8; -pub const NCPLOT_OPTION_DETECTMAXONLY: u32 = 16; -pub const NCPLOT_OPTION_PRINTSAMPLE: u32 = 32; -pub const NCREADER_OPTION_HORSCROLL: u32 = 1; -pub const NCREADER_OPTION_VERSCROLL: u32 = 2; -pub const NCREADER_OPTION_NOCMDKEYS: u32 = 4; -pub const NCREADER_OPTION_CURSOR: u32 = 8; -pub const NCDIRECT_OPTION_INHIBIT_SETLOCALE: u32 = 1; -pub const NCDIRECT_OPTION_INHIBIT_CBREAK: u32 = 2; -pub const NCDIRECT_OPTION_NO_QUIT_SIGHANDLERS: u32 = 8; -pub type size_t = cty::c_ulong; -#[doc = " Convenience types."] -pub type __u_char = cty::c_uchar; -pub type __u_short = cty::c_ushort; -pub type __u_int = cty::c_uint; -pub type __u_long = cty::c_ulong; -#[doc = " Fixed-size types, underlying types depend on word size and compiler."] -pub type __int8_t = cty::c_schar; -pub type __uint8_t = cty::c_uchar; -pub type __int16_t = cty::c_short; -pub type __uint16_t = cty::c_ushort; -pub type __int32_t = cty::c_int; -pub type __uint32_t = cty::c_uint; -pub type __int64_t = cty::c_long; -pub type __uint64_t = cty::c_ulong; -#[doc = " Smallest types with at least a given width."] -pub type __int_least8_t = __int8_t; -pub type __uint_least8_t = __uint8_t; -pub type __int_least16_t = __int16_t; -pub type __uint_least16_t = __uint16_t; -pub type __int_least32_t = __int32_t; -pub type __uint_least32_t = __uint32_t; -pub type __int_least64_t = __int64_t; -pub type __uint_least64_t = __uint64_t; -pub type __quad_t = cty::c_long; -pub type __u_quad_t = cty::c_ulong; -pub type __intmax_t = cty::c_long; -pub type __uintmax_t = cty::c_ulong; -pub type __dev_t = cty::c_ulong; -pub type __uid_t = cty::c_uint; -pub type __gid_t = cty::c_uint; -pub type __ino_t = cty::c_ulong; -pub type __ino64_t = cty::c_ulong; -pub type __mode_t = cty::c_uint; -pub type __nlink_t = cty::c_ulong; -pub type __off_t = cty::c_long; -pub type __off64_t = cty::c_long; -pub type __pid_t = cty::c_int; -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct __fsid_t { - pub __val: [cty::c_int; 2usize], -} -#[test] -fn bindgen_test_layout___fsid_t() { - assert_eq!( - ::core::mem::size_of::<__fsid_t>(), - 8usize, - concat!("Size of: ", stringify!(__fsid_t)) - ); - assert_eq!( - ::core::mem::align_of::<__fsid_t>(), - 4usize, - concat!("Alignment of ", stringify!(__fsid_t)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<__fsid_t>())).__val as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__fsid_t), - "::", - stringify!(__val) - ) - ); -} -pub type __clock_t = cty::c_long; -pub type __rlim_t = cty::c_ulong; -pub type __rlim64_t = cty::c_ulong; -pub type __id_t = cty::c_uint; -pub type __time_t = cty::c_long; -pub type __useconds_t = cty::c_uint; -pub type __suseconds_t = cty::c_long; -pub type __daddr_t = cty::c_int; -pub type __key_t = cty::c_int; -pub type __clockid_t = cty::c_int; -pub type __timer_t = *mut cty::c_void; -pub type __blksize_t = cty::c_long; -pub type __blkcnt_t = cty::c_long; -pub type __blkcnt64_t = cty::c_long; -pub type __fsblkcnt_t = cty::c_ulong; -pub type __fsblkcnt64_t = cty::c_ulong; -pub type __fsfilcnt_t = cty::c_ulong; -pub type __fsfilcnt64_t = cty::c_ulong; -pub type __fsword_t = cty::c_long; -pub type __ssize_t = cty::c_long; -pub type __syscall_slong_t = cty::c_long; -pub type __syscall_ulong_t = cty::c_ulong; -#[doc = " These few don't really vary by system, they always correspond"] -#[doc = "to one of the other defined types."] -pub type __loff_t = __off64_t; -pub type __caddr_t = *mut cty::c_char; -pub type __intptr_t = cty::c_long; -pub type __socklen_t = cty::c_uint; -#[doc = " C99: An integer type that can be accessed as an atomic entity,"] -#[doc = "even in the presence of asynchronous interrupts."] -#[doc = "It is not currently necessary for this to be machine-specific."] -pub type __sig_atomic_t = cty::c_int; -extern "C" { - #[doc = " Even though CLOCKS_PER_SEC has such a strange value CLK_TCK"] - #[doc = "presents the real value for clock ticks per second for the system."] - pub fn __sysconf(arg1: cty::c_int) -> cty::c_long; -} -#[doc = " Returned by `clock'."] -pub type clock_t = __clock_t; -#[doc = " Returned by `time'."] -pub type time_t = __time_t; -#[doc = " ISO C `broken-down time' structure."] -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct tm { - #[doc = " Seconds.\t[0-60] (1 leap second)"] - pub tm_sec: cty::c_int, - #[doc = " Minutes.\t[0-59]"] - pub tm_min: cty::c_int, - #[doc = " Hours.\t[0-23]"] - pub tm_hour: cty::c_int, - #[doc = " Day.\t\t[1-31]"] - pub tm_mday: cty::c_int, - #[doc = " Month.\t[0-11]"] - pub tm_mon: cty::c_int, - #[doc = " Year\t- 1900."] - pub tm_year: cty::c_int, - #[doc = " Day of week.\t[0-6]"] - pub tm_wday: cty::c_int, - #[doc = " Days in year.[0-365]"] - pub tm_yday: cty::c_int, - #[doc = " DST.\t\t[-1/0/1]"] - pub tm_isdst: cty::c_int, - #[doc = " Seconds east of UTC."] - pub __tm_gmtoff: cty::c_long, - #[doc = " Timezone abbreviation."] - pub __tm_zone: *const cty::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 Default for tm { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[doc = " POSIX.1b structure for a time value. This is like a `struct timeval' but"] -#[doc = "has nanoseconds instead of microseconds."] -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct timespec { - #[doc = " Seconds."] - pub tv_sec: __time_t, - #[doc = " Nanoseconds."] - pub tv_nsec: __syscall_slong_t, -} -#[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) - ) - ); -} -extern "C" { - #[doc = " Time used by the program so far (user time + system time)."] - #[doc = "The result / CLOCKS_PER_SEC is program time in seconds."] - pub fn clock() -> clock_t; -} -extern "C" { - #[doc = " Return the current time and put it in *TIMER if TIMER is not NULL."] - pub fn time(__timer: *mut time_t) -> time_t; -} -extern "C" { - #[doc = " Return the difference between TIME1 and TIME0."] - pub fn difftime(__time1: time_t, __time0: time_t) -> f64; -} -extern "C" { - #[doc = " Return the `time_t' representation of TP and normalize TP."] - pub fn mktime(__tp: *mut tm) -> time_t; -} -extern "C" { - #[doc = " Format TP into S according to FORMAT."] - #[doc = "Write no more than MAXSIZE characters and return the number"] - #[doc = "of characters written, or 0 if it would exceed MAXSIZE."] - pub fn strftime( - __s: *mut cty::c_char, - __maxsize: size_t, - __format: *const cty::c_char, - __tp: *const tm, - ) -> size_t; -} -extern "C" { - #[doc = " Parse S according to FORMAT and store binary time information in TP."] - #[doc = "The return value is a pointer to the first unparsed character in S."] - pub fn strptime( - __s: *const cty::c_char, - __fmt: *const cty::c_char, - __tp: *mut tm, - ) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Return the `struct tm' representation of *TIMER"] - #[doc = "in Universal Coordinated Time (aka Greenwich Mean Time)."] - pub fn gmtime(__timer: *const time_t) -> *mut tm; -} -extern "C" { - #[doc = " Return the `struct tm' representation"] - #[doc = "of *TIMER in the local timezone."] - pub fn localtime(__timer: *const time_t) -> *mut tm; -} -extern "C" { - #[doc = " Return the `struct tm' representation of *TIMER in UTC,"] - #[doc = "using *TP to store the result."] - pub fn gmtime_r(__timer: *const time_t, __tp: *mut tm) -> *mut tm; -} -extern "C" { - #[doc = " Return the `struct tm' representation of *TIMER in local time,"] - #[doc = "using *TP to store the result."] - pub fn localtime_r(__timer: *const time_t, __tp: *mut tm) -> *mut tm; -} -extern "C" { - #[doc = " Return a string of the form \"Day Mon dd hh:mm:ss yyyy\\n\""] - #[doc = "that is the representation of TP in this format."] - pub fn asctime(__tp: *const tm) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Equivalent to `asctime (localtime (timer))'."] - pub fn ctime(__timer: *const time_t) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Return in BUF a string of the form \"Day Mon dd hh:mm:ss yyyy\\n\""] - #[doc = "that is the representation of TP in this format."] - pub fn asctime_r(__tp: *const tm, __buf: *mut cty::c_char) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Equivalent to `asctime_r (localtime_r (timer, *TMP*), buf)'."] - pub fn ctime_r(__timer: *const time_t, __buf: *mut cty::c_char) -> *mut cty::c_char; -} -extern "C" { - pub static mut __tzname: [*mut cty::c_char; 2usize]; -} -extern "C" { - pub static mut __daylight: cty::c_int; -} -extern "C" { - pub static mut __timezone: cty::c_long; -} -extern "C" { - pub static mut tzname: [*mut cty::c_char; 2usize]; -} -extern "C" { - #[doc = " Set time conversion information from the TZ environment variable."] - #[doc = "If TZ is not defined, a locale-dependent default is used."] - pub fn tzset(); -} -extern "C" { - pub static mut daylight: cty::c_int; -} -extern "C" { - pub static mut timezone: cty::c_long; -} -extern "C" { - #[doc = " Set TS to calendar time based in time base BASE."] - pub fn timespec_get(__ts: *mut timespec, __base: cty::c_int) -> cty::c_int; -} -#[doc = " Conversion state information."] -#[repr(C)] -#[derive(Copy, Clone)] -pub struct __mbstate_t { - pub __count: cty::c_int, - #[doc = " Value so far."] - pub __value: __mbstate_t__bindgen_ty_1, -} -#[repr(C)] -#[derive(Copy, Clone)] -pub union __mbstate_t__bindgen_ty_1 { - pub __wch: cty::c_uint, - pub __wchb: [cty::c_char; 4usize], -} -#[test] -fn bindgen_test_layout___mbstate_t__bindgen_ty_1() { - assert_eq!( - ::core::mem::size_of::<__mbstate_t__bindgen_ty_1>(), - 4usize, - concat!("Size of: ", stringify!(__mbstate_t__bindgen_ty_1)) - ); - assert_eq!( - ::core::mem::align_of::<__mbstate_t__bindgen_ty_1>(), - 4usize, - concat!("Alignment of ", stringify!(__mbstate_t__bindgen_ty_1)) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::<__mbstate_t__bindgen_ty_1>())).__wch as *const _ as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__mbstate_t__bindgen_ty_1), - "::", - stringify!(__wch) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::<__mbstate_t__bindgen_ty_1>())).__wchb as *const _ as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__mbstate_t__bindgen_ty_1), - "::", - stringify!(__wchb) - ) - ); -} -impl Default for __mbstate_t__bindgen_ty_1 { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[test] -fn bindgen_test_layout___mbstate_t() { - assert_eq!( - ::core::mem::size_of::<__mbstate_t>(), - 8usize, - concat!("Size of: ", stringify!(__mbstate_t)) - ); - assert_eq!( - ::core::mem::align_of::<__mbstate_t>(), - 4usize, - concat!("Alignment of ", stringify!(__mbstate_t)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<__mbstate_t>())).__count as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__mbstate_t), - "::", - stringify!(__count) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<__mbstate_t>())).__value as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(__mbstate_t), - "::", - stringify!(__value) - ) - ); -} -impl Default for __mbstate_t { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -pub type mbstate_t = __mbstate_t; -#[doc = " Define the 16-bit and 32-bit character types."] -pub type char16_t = __uint_least16_t; -pub type char32_t = __uint_least32_t; -extern "C" { - #[doc = " Write char16_t representation of multibyte character pointed"] - #[doc = "to by S to PC16."] - pub fn mbrtoc16( - __pc16: *mut char16_t, - __s: *const cty::c_char, - __n: size_t, - __p: *mut mbstate_t, - ) -> size_t; -} -extern "C" { - #[doc = " Write multibyte representation of char16_t C16 to S."] - pub fn c16rtomb(__s: *mut cty::c_char, __c16: char16_t, __ps: *mut mbstate_t) -> size_t; -} -extern "C" { - #[doc = " Write char32_t representation of multibyte character pointed"] - #[doc = "to by S to PC32."] - pub fn mbrtoc32( - __pc32: *mut char32_t, - __s: *const cty::c_char, - __n: size_t, - __p: *mut mbstate_t, - ) -> size_t; -} -extern "C" { - #[doc = " Write multibyte representation of char32_t C32 to S."] - pub fn c32rtomb(__s: *mut cty::c_char, __c32: char32_t, __ps: *mut mbstate_t) -> size_t; -} -#[doc = " UPPERCASE."] -pub const _ISupper: cty::c_uint = 256; -#[doc = " lowercase."] -pub const _ISlower: cty::c_uint = 512; -#[doc = " Alphabetic."] -pub const _ISalpha: cty::c_uint = 1024; -#[doc = " Numeric."] -pub const _ISdigit: cty::c_uint = 2048; -#[doc = " Hexadecimal numeric."] -pub const _ISxdigit: cty::c_uint = 4096; -#[doc = " Whitespace."] -pub const _ISspace: cty::c_uint = 8192; -#[doc = " Printing."] -pub const _ISprint: cty::c_uint = 16384; -#[doc = " Graphical."] -pub const _ISgraph: cty::c_uint = 32768; -#[doc = " Blank (usually SPC and TAB)."] -pub const _ISblank: cty::c_uint = 1; -#[doc = " Control character."] -pub const _IScntrl: cty::c_uint = 2; -#[doc = " Punctuation."] -pub const _ISpunct: cty::c_uint = 4; -#[doc = " Alphanumeric."] -pub const _ISalnum: cty::c_uint = 8; -pub type _bindgen_ty_1 = cty::c_uint; -extern "C" { - #[doc = " These are defined in ctype-info.c."] - #[doc = "The declarations here must match those in localeinfo.h."] - #[doc = ""] - #[doc = "In the thread-specific locale model (see `uselocale' in )"] - #[doc = "we cannot use global variables for these as was done in the past."] - #[doc = "Instead, the following accessor functions return the address of"] - #[doc = "each variable, which is local to the current thread if multithreaded."] - #[doc = ""] - #[doc = "These point into arrays of 384, so they can be indexed by any `unsigned"] - #[doc = "char' value [0,255]; by EOF (-1); or by any `signed char' value"] - #[doc = "[-128,-1). ISO C requires that the ctype functions work for `unsigned"] - #[doc = "char' values and for EOF; we also support negative `signed char' values"] - #[doc = "for broken old programs. The case conversion arrays are of `int's"] - #[doc = "rather than `unsigned char's because tolower (EOF) must be EOF, which"] - #[doc = "doesn't fit into an `unsigned char'. But today more important is that"] - #[doc = "the arrays are also used for multi-byte character sets."] - pub fn __ctype_b_loc() -> *mut *const cty::c_ushort; -} -extern "C" { - pub fn __ctype_tolower_loc() -> *mut *const __int32_t; -} -extern "C" { - pub fn __ctype_toupper_loc() -> *mut *const __int32_t; -} -extern "C" { - pub fn isalnum(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn isalpha(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn iscntrl(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn isdigit(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn islower(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn isgraph(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn isprint(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn ispunct(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn isspace(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn isupper(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn isxdigit(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Return the lowercase version of C."] - pub fn tolower(__c: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Return the uppercase version of C."] - pub fn toupper(__c: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn isblank(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Return nonzero iff C is in the ASCII set"] - #[doc = "(i.e., is no more than 7 bits wide)."] - pub fn isascii(__c: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Return the part of C that is in the ASCII set"] - #[doc = "(i.e., the low-order 7 bits of C)."] - pub fn toascii(__c: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn _toupper(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn _tolower(arg1: cty::c_int) -> cty::c_int; -} -pub type _Float32 = f32; -pub type _Float64 = f64; -pub type _Float32x = f64; -pub type _Float64x = u128; -pub type wchar_t = cty::c_int; -pub type va_list = __builtin_va_list; -pub type __gnuc_va_list = __builtin_va_list; -pub type wint_t = cty::c_uint; -pub type __FILE = _IO_FILE; -#[doc = " Scalar type that can hold values which represent locale-specific"] -#[doc = "character classifications."] -pub type wctype_t = cty::c_ulong; -#[doc = " UPPERCASE."] -pub const __ISwupper: cty::c_int = 0; -#[doc = " lowercase."] -pub const __ISwlower: cty::c_int = 1; -#[doc = " Alphabetic."] -pub const __ISwalpha: cty::c_int = 2; -#[doc = " Numeric."] -pub const __ISwdigit: cty::c_int = 3; -#[doc = " Hexadecimal numeric."] -pub const __ISwxdigit: cty::c_int = 4; -#[doc = " Whitespace."] -pub const __ISwspace: cty::c_int = 5; -#[doc = " Printing."] -pub const __ISwprint: cty::c_int = 6; -#[doc = " Graphical."] -pub const __ISwgraph: cty::c_int = 7; -#[doc = " Blank (usually SPC and TAB)."] -pub const __ISwblank: cty::c_int = 8; -#[doc = " Control character."] -pub const __ISwcntrl: cty::c_int = 9; -#[doc = " Punctuation."] -pub const __ISwpunct: cty::c_int = 10; -#[doc = " Alphanumeric."] -pub const __ISwalnum: cty::c_int = 11; -#[doc = " UPPERCASE."] -pub const _ISwupper: cty::c_int = 16777216; -#[doc = " lowercase."] -pub const _ISwlower: cty::c_int = 33554432; -#[doc = " Alphabetic."] -pub const _ISwalpha: cty::c_int = 67108864; -#[doc = " Numeric."] -pub const _ISwdigit: cty::c_int = 134217728; -#[doc = " Hexadecimal numeric."] -pub const _ISwxdigit: cty::c_int = 268435456; -#[doc = " Whitespace."] -pub const _ISwspace: cty::c_int = 536870912; -#[doc = " Printing."] -pub const _ISwprint: cty::c_int = 1073741824; -#[doc = " Graphical."] -pub const _ISwgraph: cty::c_int = -2147483648; -#[doc = " Blank (usually SPC and TAB)."] -pub const _ISwblank: cty::c_int = 65536; -#[doc = " Control character."] -pub const _ISwcntrl: cty::c_int = 131072; -#[doc = " Punctuation."] -pub const _ISwpunct: cty::c_int = 262144; -#[doc = " Alphanumeric."] -pub const _ISwalnum: cty::c_int = 524288; -pub type _bindgen_ty_2 = cty::c_int; -extern "C" { - #[doc = " Test for any wide character for which `iswalpha' or `iswdigit' is"] - #[doc = "true."] - pub fn iswalnum(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any wide character for which `iswupper' or 'iswlower' is"] - #[doc = "true, or any wide character that is one of a locale-specific set of"] - #[doc = "wide-characters for which none of `iswcntrl', `iswdigit',"] - #[doc = "`iswpunct', or `iswspace' is true."] - pub fn iswalpha(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any control wide character."] - pub fn iswcntrl(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any wide character that corresponds to a decimal-digit"] - #[doc = "character."] - pub fn iswdigit(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any wide character for which `iswprint' is true and"] - #[doc = "`iswspace' is false."] - pub fn iswgraph(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any wide character that corresponds to a lowercase letter"] - #[doc = "or is one of a locale-specific set of wide characters for which"] - #[doc = "none of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true."] - pub fn iswlower(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any printing wide character."] - pub fn iswprint(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any printing wide character that is one of a"] - #[doc = "locale-specific et of wide characters for which neither `iswspace'"] - #[doc = "nor `iswalnum' is true."] - pub fn iswpunct(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any wide character that corresponds to a locale-specific"] - #[doc = "set of wide characters for which none of `iswalnum', `iswgraph', or"] - #[doc = "`iswpunct' is true."] - pub fn iswspace(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any wide character that corresponds to an uppercase letter"] - #[doc = "or is one of a locale-specific set of wide character for which none"] - #[doc = "of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true."] - pub fn iswupper(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any wide character that corresponds to a hexadecimal-digit"] - #[doc = "character equivalent to that performed be the functions described"] - #[doc = "in the previous subclause."] - pub fn iswxdigit(__wc: wint_t) -> cty::c_int; -} -extern "C" { - pub fn iswblank(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Construct value that describes a class of wide characters identified"] - #[doc = "by the string argument PROPERTY."] - pub fn wctype(__property: *const cty::c_char) -> wctype_t; -} -extern "C" { - #[doc = " Determine whether the wide-character WC has the property described by"] - #[doc = "DESC."] - pub fn iswctype(__wc: wint_t, __desc: wctype_t) -> cty::c_int; -} -extern "C" { - #[doc = " Converts an uppercase letter to the corresponding lowercase letter."] - pub fn towlower(__wc: wint_t) -> wint_t; -} -extern "C" { - #[doc = " Converts an lowercase letter to the corresponding uppercase letter."] - pub fn towupper(__wc: wint_t) -> wint_t; -} -extern "C" { - #[doc = " Copy SRC to DEST."] - pub fn wcscpy(__dest: *mut wchar_t, __src: *const wchar_t) -> *mut wchar_t; -} -extern "C" { - #[doc = " Copy no more than N wide-characters of SRC to DEST."] - pub fn wcsncpy(__dest: *mut wchar_t, __src: *const wchar_t, __n: size_t) -> *mut wchar_t; -} -extern "C" { - #[doc = " Append SRC onto DEST."] - pub fn wcscat(__dest: *mut wchar_t, __src: *const wchar_t) -> *mut wchar_t; -} -extern "C" { - #[doc = " Append no more than N wide-characters of SRC onto DEST."] - pub fn wcsncat(__dest: *mut wchar_t, __src: *const wchar_t, __n: size_t) -> *mut wchar_t; -} -extern "C" { - #[doc = " Compare S1 and S2."] - pub fn wcscmp(__s1: *const cty::c_int, __s2: *const cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Compare N wide-characters of S1 and S2."] - pub fn wcsncmp( - __s1: *const cty::c_int, - __s2: *const cty::c_int, - __n: cty::c_ulong, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Compare S1 and S2, both interpreted as appropriate to the"] - #[doc = "LC_COLLATE category of the current locale."] - pub fn wcscoll(__s1: *const wchar_t, __s2: *const wchar_t) -> cty::c_int; -} -extern "C" { - #[doc = " Transform S2 into array pointed to by S1 such that if wcscmp is"] - #[doc = "applied to two transformed strings the result is the as applying"] - #[doc = "`wcscoll' to the original strings."] - pub fn wcsxfrm(__s1: *mut wchar_t, __s2: *const wchar_t, __n: size_t) -> size_t; -} -extern "C" { - pub fn wcschr(__wcs: *const cty::c_int, __wc: cty::c_int) -> *mut cty::c_int; -} -extern "C" { - pub fn wcsrchr(__wcs: *const wchar_t, __wc: wchar_t) -> *mut wchar_t; -} -extern "C" { - #[doc = " Return the length of the initial segmet of WCS which"] - #[doc = "consists entirely of wide characters not in REJECT."] - pub fn wcscspn(__wcs: *const wchar_t, __reject: *const wchar_t) -> size_t; -} -extern "C" { - #[doc = " Return the length of the initial segmet of WCS which"] - #[doc = "consists entirely of wide characters in ACCEPT."] - pub fn wcsspn(__wcs: *const wchar_t, __accept: *const wchar_t) -> size_t; -} -extern "C" { - pub fn wcspbrk(__wcs: *const wchar_t, __accept: *const wchar_t) -> *mut wchar_t; -} -extern "C" { - pub fn wcsstr(__haystack: *const wchar_t, __needle: *const wchar_t) -> *mut wchar_t; -} -extern "C" { - #[doc = " Divide WCS into tokens separated by characters in DELIM."] - pub fn wcstok( - __s: *mut wchar_t, - __delim: *const wchar_t, - __ptr: *mut *mut wchar_t, - ) -> *mut wchar_t; -} -extern "C" { - #[doc = " Return the number of wide characters in S."] - pub fn wcslen(__s: *const cty::c_int) -> cty::c_ulong; -} -extern "C" { - pub fn wcswcs(__haystack: *const wchar_t, __needle: *const wchar_t) -> *mut wchar_t; -} -extern "C" { - pub fn wmemchr(__s: *const cty::c_int, __c: cty::c_int, __n: cty::c_ulong) -> *mut cty::c_int; -} -extern "C" { - #[doc = " Compare N wide characters of S1 and S2."] - pub fn wmemcmp( - __s1: *const cty::c_int, - __s2: *const cty::c_int, - __n: cty::c_ulong, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Copy N wide characters of SRC to DEST."] - pub fn wmemcpy( - __s1: *mut cty::c_int, - __s2: *const cty::c_int, - __n: cty::c_ulong, - ) -> *mut cty::c_int; -} -extern "C" { - #[doc = " Copy N wide characters of SRC to DEST, guaranteeing"] - #[doc = "correct behavior for overlapping strings."] - pub fn wmemmove( - __s1: *mut cty::c_int, - __s2: *const cty::c_int, - __n: cty::c_ulong, - ) -> *mut cty::c_int; -} -extern "C" { - #[doc = " Set N wide characters of S to C."] - pub fn wmemset(__s: *mut wchar_t, __c: wchar_t, __n: size_t) -> *mut wchar_t; -} -extern "C" { - #[doc = " Determine whether C constitutes a valid (one-byte) multibyte"] - #[doc = "character."] - pub fn btowc(__c: cty::c_int) -> wint_t; -} -extern "C" { - #[doc = " Determine whether C corresponds to a member of the extended"] - #[doc = "character set whose multibyte representation is a single byte."] - pub fn wctob(__c: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Determine whether PS points to an object representing the initial"] - #[doc = "state."] - pub fn mbsinit(__ps: *const mbstate_t) -> cty::c_int; -} -extern "C" { - #[doc = " Write wide character representation of multibyte character pointed"] - #[doc = "to by S to PWC."] - pub fn mbrtowc( - __pwc: *mut wchar_t, - __s: *const cty::c_char, - __n: size_t, - __p: *mut mbstate_t, - ) -> size_t; -} -extern "C" { - #[doc = " Write multibyte representation of wide character WC to S."] - pub fn wcrtomb(__s: *mut cty::c_char, __wc: wchar_t, __ps: *mut mbstate_t) -> size_t; -} -extern "C" { - #[doc = " Return number of bytes in multibyte character pointed to by S."] - pub fn __mbrlen(__s: *const cty::c_char, __n: size_t, __ps: *mut mbstate_t) -> size_t; -} -extern "C" { - pub fn mbrlen(__s: *const cty::c_char, __n: size_t, __ps: *mut mbstate_t) -> size_t; -} -extern "C" { - #[doc = " Write wide character representation of multibyte character string"] - #[doc = "SRC to DST."] - pub fn mbsrtowcs( - __dst: *mut wchar_t, - __src: *mut *const cty::c_char, - __len: size_t, - __ps: *mut mbstate_t, - ) -> size_t; -} -extern "C" { - #[doc = " Write multibyte character representation of wide character string"] - #[doc = "SRC to DST."] - pub fn wcsrtombs( - __dst: *mut cty::c_char, - __src: *mut *const wchar_t, - __len: size_t, - __ps: *mut mbstate_t, - ) -> size_t; -} -extern "C" { - #[doc = " Determine number of column positions required for C."] - pub fn wcwidth(__c: wchar_t) -> cty::c_int; -} -extern "C" { - #[doc = " Determine number of column positions required for first N wide"] - #[doc = "characters (or fewer if S ends before this) in S."] - pub fn wcswidth(__s: *const wchar_t, __n: size_t) -> cty::c_int; -} -extern "C" { - #[doc = " Convert initial portion of the wide string NPTR to `double'"] - #[doc = "representation."] - pub fn wcstod(__nptr: *const wchar_t, __endptr: *mut *mut wchar_t) -> f64; -} -extern "C" { - #[doc = " Likewise for `float' and `long double' sizes of floating-point numbers."] - pub fn wcstof(__nptr: *const wchar_t, __endptr: *mut *mut wchar_t) -> f32; -} -extern "C" { - #[doc = " Convert initial portion of wide string NPTR to `long int'"] - #[doc = "representation."] - pub fn wcstol( - __nptr: *const wchar_t, - __endptr: *mut *mut wchar_t, - __base: cty::c_int, - ) -> cty::c_long; -} -extern "C" { - #[doc = " Convert initial portion of wide string NPTR to `unsigned long int'"] - #[doc = "representation."] - pub fn wcstoul( - __nptr: *const wchar_t, - __endptr: *mut *mut wchar_t, - __base: cty::c_int, - ) -> cty::c_ulong; -} -extern "C" { - #[doc = " Convert initial portion of wide string NPTR to `long long int'"] - #[doc = "representation."] - pub fn wcstoll( - __nptr: *const wchar_t, - __endptr: *mut *mut wchar_t, - __base: cty::c_int, - ) -> cty::c_longlong; -} -extern "C" { - #[doc = " Convert initial portion of wide string NPTR to `unsigned long long int'"] - #[doc = "representation."] - pub fn wcstoull( - __nptr: *const wchar_t, - __endptr: *mut *mut wchar_t, - __base: cty::c_int, - ) -> cty::c_ulonglong; -} -extern "C" { - #[doc = " Select orientation for stream."] - pub fn fwide(__fp: *mut __FILE, __mode: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fwprintf(__stream: *mut __FILE, __format: *const wchar_t, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to stdout."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn wprintf(__format: *const wchar_t, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output of at most N characters to S."] - pub fn swprintf(__s: *mut wchar_t, __n: size_t, __format: *const wchar_t, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to S from argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn vfwprintf( - __s: *mut __FILE, - __format: *const wchar_t, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to stdout from argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn vwprintf(__format: *const wchar_t, __arg: *mut __va_list_tag) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output of at most N character to S from argument"] - #[doc = "list ARG."] - pub fn vswprintf( - __s: *mut wchar_t, - __n: size_t, - __format: *const wchar_t, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fwscanf(__stream: *mut __FILE, __format: *const wchar_t, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from stdin."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn wscanf(__format: *const wchar_t, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S."] - pub fn swscanf(__s: *const wchar_t, __format: *const wchar_t, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - #[link_name = "\u{1}__isoc99_fwscanf"] - pub fn fwscanf1(__stream: *mut __FILE, __format: *const wchar_t, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from stdin."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - #[link_name = "\u{1}__isoc99_wscanf"] - pub fn wscanf1(__format: *const wchar_t, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S."] - #[link_name = "\u{1}__isoc99_swscanf"] - pub fn swscanf1(__s: *const wchar_t, __format: *const wchar_t, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S into argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn vfwscanf( - __s: *mut __FILE, - __format: *const wchar_t, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from stdin into argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn vwscanf(__format: *const wchar_t, __arg: *mut __va_list_tag) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S into argument list ARG."] - pub fn vswscanf( - __s: *const wchar_t, - __format: *const wchar_t, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Read a character from STREAM."] - #[doc = ""] - #[doc = "These functions are possible cancellation points and therefore not"] - #[doc = "marked with __THROW."] - pub fn fgetwc(__stream: *mut __FILE) -> wint_t; -} -extern "C" { - pub fn getwc(__stream: *mut __FILE) -> wint_t; -} -extern "C" { - #[doc = " Read a character from stdin."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn getwchar() -> wint_t; -} -extern "C" { - #[doc = " Write a character to STREAM."] - #[doc = ""] - #[doc = "These functions are possible cancellation points and therefore not"] - #[doc = "marked with __THROW."] - pub fn fputwc(__wc: wchar_t, __stream: *mut __FILE) -> wint_t; -} -extern "C" { - pub fn putwc(__wc: wchar_t, __stream: *mut __FILE) -> wint_t; -} -extern "C" { - #[doc = " Write a character to stdout."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn putwchar(__wc: wchar_t) -> wint_t; -} -extern "C" { - #[doc = " Get a newline-terminated wide character string of finite length"] - #[doc = "from STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fgetws(__ws: *mut wchar_t, __n: cty::c_int, __stream: *mut __FILE) -> *mut wchar_t; -} -extern "C" { - #[doc = " Write a string to STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fputws(__ws: *const wchar_t, __stream: *mut __FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Push a character back onto the input buffer of STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn ungetwc(__wc: wint_t, __stream: *mut __FILE) -> wint_t; -} -extern "C" { - #[doc = " Format TP into S according to FORMAT."] - #[doc = "Write no more than MAXSIZE wide characters and return the number"] - #[doc = "of wide characters written, or 0 if it would exceed MAXSIZE."] - pub fn wcsftime( - __s: *mut wchar_t, - __maxsize: size_t, - __format: *const wchar_t, - __tp: *const tm, - ) -> size_t; -} -#[doc = " The tag name of this struct is _G_fpos_t to preserve historic"] -#[doc = "C++ mangled names for functions taking fpos_t arguments."] -#[doc = "That name should not be used in new code."] -#[repr(C)] -#[derive(Copy, Clone)] -pub struct _G_fpos_t { - pub __pos: __off_t, - pub __state: __mbstate_t, -} -#[test] -fn bindgen_test_layout__G_fpos_t() { - assert_eq!( - ::core::mem::size_of::<_G_fpos_t>(), - 16usize, - concat!("Size of: ", stringify!(_G_fpos_t)) - ); - assert_eq!( - ::core::mem::align_of::<_G_fpos_t>(), - 8usize, - concat!("Alignment of ", stringify!(_G_fpos_t)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_G_fpos_t>())).__pos as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(_G_fpos_t), - "::", - stringify!(__pos) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_G_fpos_t>())).__state as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(_G_fpos_t), - "::", - stringify!(__state) - ) - ); -} -impl Default for _G_fpos_t { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[doc = " The tag name of this struct is _G_fpos_t to preserve historic"] -#[doc = "C++ mangled names for functions taking fpos_t arguments."] -#[doc = "That name should not be used in new code."] -pub type __fpos_t = _G_fpos_t; -#[doc = " The tag name of this struct is _G_fpos64_t to preserve historic"] -#[doc = "C++ mangled names for functions taking fpos_t and/or fpos64_t"] -#[doc = "arguments. That name should not be used in new code."] -#[repr(C)] -#[derive(Copy, Clone)] -pub struct _G_fpos64_t { - pub __pos: __off64_t, - pub __state: __mbstate_t, -} -#[test] -fn bindgen_test_layout__G_fpos64_t() { - assert_eq!( - ::core::mem::size_of::<_G_fpos64_t>(), - 16usize, - concat!("Size of: ", stringify!(_G_fpos64_t)) - ); - assert_eq!( - ::core::mem::align_of::<_G_fpos64_t>(), - 8usize, - concat!("Alignment of ", stringify!(_G_fpos64_t)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_G_fpos64_t>())).__pos as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(_G_fpos64_t), - "::", - stringify!(__pos) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_G_fpos64_t>())).__state as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(_G_fpos64_t), - "::", - stringify!(__state) - ) - ); -} -impl Default for _G_fpos64_t { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[doc = " The tag name of this struct is _G_fpos64_t to preserve historic"] -#[doc = "C++ mangled names for functions taking fpos_t and/or fpos64_t"] -#[doc = "arguments. That name should not be used in new code."] -pub type __fpos64_t = _G_fpos64_t; -#[doc = " The opaque type of streams. This is the definition used elsewhere."] -pub type FILE = _IO_FILE; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct _IO_marker { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct _IO_codecvt { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct _IO_wide_data { - _unused: [u8; 0], -} -pub type _IO_lock_t = cty::c_void; -#[doc = " The tag name of this struct is _IO_FILE to preserve historic"] -#[doc = "C++ mangled names for functions taking FILE* arguments."] -#[doc = "That name should not be used in new code."] -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct _IO_FILE { - #[doc = " High-order word is _IO_MAGIC; rest is flags."] - pub _flags: cty::c_int, - #[doc = " Current read pointer"] - pub _IO_read_ptr: *mut cty::c_char, - #[doc = " End of get area."] - pub _IO_read_end: *mut cty::c_char, - #[doc = " Start of putback+get area."] - pub _IO_read_base: *mut cty::c_char, - #[doc = " Start of put area."] - pub _IO_write_base: *mut cty::c_char, - #[doc = " Current put pointer."] - pub _IO_write_ptr: *mut cty::c_char, - #[doc = " End of put area."] - pub _IO_write_end: *mut cty::c_char, - #[doc = " Start of reserve area."] - pub _IO_buf_base: *mut cty::c_char, - #[doc = " End of reserve area."] - pub _IO_buf_end: *mut cty::c_char, - #[doc = " Pointer to start of non-current get area."] - pub _IO_save_base: *mut cty::c_char, - #[doc = " Pointer to first valid character of backup area"] - pub _IO_backup_base: *mut cty::c_char, - #[doc = " Pointer to end of non-current get area."] - pub _IO_save_end: *mut cty::c_char, - pub _markers: *mut _IO_marker, - pub _chain: *mut _IO_FILE, - pub _fileno: cty::c_int, - pub _flags2: cty::c_int, - #[doc = " This used to be _offset but it's too small."] - pub _old_offset: __off_t, - #[doc = " 1+column number of pbase(); 0 is unknown."] - pub _cur_column: cty::c_ushort, - pub _vtable_offset: cty::c_schar, - pub _shortbuf: [cty::c_char; 1usize], - pub _lock: *mut _IO_lock_t, - pub _offset: __off64_t, - #[doc = " Wide character stream stuff."] - pub _codecvt: *mut _IO_codecvt, - pub _wide_data: *mut _IO_wide_data, - pub _freeres_list: *mut _IO_FILE, - pub _freeres_buf: *mut cty::c_void, - pub __pad5: size_t, - pub _mode: cty::c_int, - #[doc = " Make sure we don't get into trouble again."] - pub _unused2: [cty::c_char; 20usize], -} -#[test] -fn bindgen_test_layout__IO_FILE() { - assert_eq!( - ::core::mem::size_of::<_IO_FILE>(), - 216usize, - concat!("Size of: ", stringify!(_IO_FILE)) - ); - assert_eq!( - ::core::mem::align_of::<_IO_FILE>(), - 8usize, - concat!("Alignment of ", stringify!(_IO_FILE)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._flags as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_flags) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_read_ptr as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_read_ptr) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_read_end as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_read_end) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_read_base as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_read_base) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_write_base as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_write_base) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_write_ptr as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_write_ptr) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_write_end as *const _ as usize }, - 48usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_write_end) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_buf_base as *const _ as usize }, - 56usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_buf_base) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_buf_end as *const _ as usize }, - 64usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_buf_end) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_save_base as *const _ as usize }, - 72usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_save_base) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_backup_base as *const _ as usize }, - 80usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_backup_base) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_save_end as *const _ as usize }, - 88usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_save_end) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._markers as *const _ as usize }, - 96usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_markers) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._chain as *const _ as usize }, - 104usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_chain) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._fileno as *const _ as usize }, - 112usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_fileno) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._flags2 as *const _ as usize }, - 116usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_flags2) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._old_offset as *const _ as usize }, - 120usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_old_offset) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._cur_column as *const _ as usize }, - 128usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_cur_column) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._vtable_offset as *const _ as usize }, - 130usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_vtable_offset) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._shortbuf as *const _ as usize }, - 131usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_shortbuf) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._lock as *const _ as usize }, - 136usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_lock) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._offset as *const _ as usize }, - 144usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_offset) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._codecvt as *const _ as usize }, - 152usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_codecvt) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._wide_data as *const _ as usize }, - 160usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_wide_data) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._freeres_list as *const _ as usize }, - 168usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_freeres_list) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._freeres_buf as *const _ as usize }, - 176usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_freeres_buf) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>())).__pad5 as *const _ as usize }, - 184usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(__pad5) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._mode as *const _ as usize }, - 192usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_mode) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._unused2 as *const _ as usize }, - 196usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_unused2) - ) - ); -} -impl Default for _IO_FILE { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -pub type fpos_t = __fpos_t; -extern "C" { - pub static mut stdin: *mut FILE; -} -extern "C" { - pub static mut stdout: *mut FILE; -} -extern "C" { - pub static mut stderr: *mut FILE; -} -extern "C" { - #[doc = " Remove file FILENAME."] - pub fn remove(__filename: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Rename file OLD to NEW."] - pub fn rename(__old: *const cty::c_char, __new: *const cty::c_char) -> cty::c_int; -} -extern "C" { - pub fn tmpfile() -> *mut FILE; -} -extern "C" { - #[doc = " Generate a temporary filename."] - pub fn tmpnam(__s: *mut cty::c_char) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Generate a unique temporary filename using up to five characters of PFX"] - #[doc = "if it is not NULL. The directory to put this file in is searched for"] - #[doc = "as follows: First the environment variable \"TMPDIR\" is checked."] - #[doc = "If it contains the name of a writable directory, that directory is used."] - #[doc = "If not and if DIR is not NULL, that value is checked. If that fails,"] - #[doc = "P_tmpdir is tried and finally \"/tmp\". The storage for the filename"] - #[doc = "is allocated by `malloc'."] - pub fn tempnam(__dir: *const cty::c_char, __pfx: *const cty::c_char) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Close STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fclose(__stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Flush STREAM, or all streams if STREAM is NULL."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fflush(__stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Open a file and create a new stream for it."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fopen(__filename: *const cty::c_char, __modes: *const cty::c_char) -> *mut FILE; -} -extern "C" { - #[doc = " Open a file, replacing an existing stream with it."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn freopen( - __filename: *const cty::c_char, - __modes: *const cty::c_char, - __stream: *mut FILE, - ) -> *mut FILE; -} -extern "C" { - #[doc = " Create a new stream that refers to an existing system file descriptor."] - pub fn fdopen(__fd: cty::c_int, __modes: *const cty::c_char) -> *mut FILE; -} -extern "C" { - #[doc = " If BUF is NULL, make STREAM unbuffered."] - #[doc = "Else make it use buffer BUF, of size BUFSIZ."] - pub fn setbuf(__stream: *mut FILE, __buf: *mut cty::c_char); -} -extern "C" { - #[doc = " Make STREAM use buffering mode MODE."] - #[doc = "If BUF is not NULL, use N bytes of it for buffering;"] - #[doc = "else allocate an internal buffer N bytes long."] - pub fn setvbuf( - __stream: *mut FILE, - __buf: *mut cty::c_char, - __modes: cty::c_int, - __n: size_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fprintf(__stream: *mut FILE, __format: *const cty::c_char, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to stdout."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn printf(__format: *const cty::c_char, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to S."] - pub fn sprintf(__s: *mut cty::c_char, __format: *const cty::c_char, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to S from argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn vfprintf( - __s: *mut FILE, - __format: *const cty::c_char, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to stdout from argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn vprintf(__format: *const cty::c_char, __arg: *mut __va_list_tag) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to S from argument list ARG."] - pub fn vsprintf( - __s: *mut cty::c_char, - __format: *const cty::c_char, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Maximum chars of output to write in MAXLEN."] - pub fn snprintf( - __s: *mut cty::c_char, - __maxlen: cty::c_ulong, - __format: *const cty::c_char, - ... - ) -> cty::c_int; -} -extern "C" { - pub fn vsnprintf( - __s: *mut cty::c_char, - __maxlen: cty::c_ulong, - __format: *const cty::c_char, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fscanf(__stream: *mut FILE, __format: *const cty::c_char, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from stdin."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn scanf(__format: *const cty::c_char, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S."] - pub fn sscanf(__s: *const cty::c_char, __format: *const cty::c_char, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - #[link_name = "\u{1}__isoc99_fscanf"] - pub fn fscanf1(__stream: *mut FILE, __format: *const cty::c_char, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from stdin."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - #[link_name = "\u{1}__isoc99_scanf"] - pub fn scanf1(__format: *const cty::c_char, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S."] - #[link_name = "\u{1}__isoc99_sscanf"] - pub fn sscanf1(__s: *const cty::c_char, __format: *const cty::c_char, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S into argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn vfscanf( - __s: *mut FILE, - __format: *const cty::c_char, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from stdin into argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn vscanf(__format: *const cty::c_char, __arg: *mut __va_list_tag) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S into argument list ARG."] - pub fn vsscanf( - __s: *const cty::c_char, - __format: *const cty::c_char, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S into argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - #[link_name = "\u{1}__isoc99_vfscanf"] - pub fn vfscanf1( - __s: *mut FILE, - __format: *const cty::c_char, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from stdin into argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - #[link_name = "\u{1}__isoc99_vscanf"] - pub fn vscanf1(__format: *const cty::c_char, __arg: *mut __va_list_tag) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S into argument list ARG."] - #[link_name = "\u{1}__isoc99_vsscanf"] - pub fn vsscanf1( - __s: *const cty::c_char, - __format: *const cty::c_char, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Read a character from STREAM."] - #[doc = ""] - #[doc = "These functions are possible cancellation points and therefore not"] - #[doc = "marked with __THROW."] - pub fn fgetc(__stream: *mut FILE) -> cty::c_int; -} -extern "C" { - pub fn getc(__stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Read a character from stdin."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn getchar() -> cty::c_int; -} -extern "C" { - #[doc = " Write a character to STREAM."] - #[doc = ""] - #[doc = "These functions are possible cancellation points and therefore not"] - #[doc = "marked with __THROW."] - #[doc = ""] - #[doc = "These functions is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fputc(__c: cty::c_int, __stream: *mut FILE) -> cty::c_int; -} -extern "C" { - pub fn putc(__c: cty::c_int, __stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Write a character to stdout."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn putchar(__c: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Get a word (int) from STREAM."] - pub fn getw(__stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Write a word (int) to STREAM."] - pub fn putw(__w: cty::c_int, __stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Get a newline-terminated string of finite length from STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fgets(__s: *mut cty::c_char, __n: cty::c_int, __stream: *mut FILE) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Write a string to STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fputs(__s: *const cty::c_char, __stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Write a string, followed by a newline, to stdout."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn puts(__s: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Push a character back onto the input buffer of STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn ungetc(__c: cty::c_int, __stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Read chunks of generic data from STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fread( - __ptr: *mut cty::c_void, - __size: cty::c_ulong, - __n: cty::c_ulong, - __stream: *mut FILE, - ) -> cty::c_ulong; -} -extern "C" { - #[doc = " Write chunks of generic data to STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fwrite( - __ptr: *const cty::c_void, - __size: cty::c_ulong, - __n: cty::c_ulong, - __s: *mut FILE, - ) -> cty::c_ulong; -} -extern "C" { - #[doc = " Seek to a certain position on STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fseek(__stream: *mut FILE, __off: cty::c_long, __whence: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Return the current position of STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn ftell(__stream: *mut FILE) -> cty::c_long; -} -extern "C" { - #[doc = " Rewind to the beginning of STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn rewind(__stream: *mut FILE); -} -extern "C" { - #[doc = " Get STREAM's position."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fgetpos(__stream: *mut FILE, __pos: *mut fpos_t) -> cty::c_int; -} -extern "C" { - #[doc = " Set STREAM's position."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fsetpos(__stream: *mut FILE, __pos: *const fpos_t) -> cty::c_int; -} -extern "C" { - #[doc = " Clear the error and EOF indicators for STREAM."] - pub fn clearerr(__stream: *mut FILE); -} -extern "C" { - #[doc = " Return the EOF indicator for STREAM."] - pub fn feof(__stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Return the error indicator for STREAM."] - pub fn ferror(__stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Print a message describing the meaning of the value of errno."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn perror(__s: *const cty::c_char); -} -extern "C" { - #[doc = " Return the system file descriptor for STREAM."] - pub fn fileno(__stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Create a new stream connected to a pipe running the given command."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn popen(__command: *const cty::c_char, __modes: *const cty::c_char) -> *mut FILE; -} -extern "C" { - #[doc = " Close a stream opened by popen and return the status of its child."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn pclose(__stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Return the name of the controlling terminal."] - pub fn ctermid(__s: *mut cty::c_char) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Return the name of the current user."] - pub fn cuserid(__s: *mut cty::c_char) -> *mut cty::c_char; -} -extern "C" { - pub static mut optarg: *mut cty::c_char; -} -extern "C" { - pub static mut optind: cty::c_int; -} -extern "C" { - pub static mut opterr: cty::c_int; -} -extern "C" { - pub static mut optopt: cty::c_int; -} -extern "C" { - #[doc = " Get definitions and prototypes for functions to process the"] - #[doc = "arguments in ARGV (ARGC of them, minus the program name) for"] - #[doc = "options given in OPTS."] - #[doc = ""] - #[doc = "Return the option character from OPTS just read. Return -1 when"] - #[doc = "there are no more options. For unrecognized options, or options"] - #[doc = "missing arguments, 'optopt' is set to the option letter, and '?' is"] - #[doc = "returned."] - #[doc = ""] - #[doc = "The OPTS string is a list of characters which are recognized option"] - #[doc = "letters, optionally followed by colons, specifying that that letter"] - #[doc = "takes an argument, to be placed in 'optarg'."] - #[doc = ""] - #[doc = "If a letter in OPTS is followed by two colons, its argument is"] - #[doc = "optional. This behavior is specific to the GNU 'getopt'."] - #[doc = ""] - #[doc = "The argument '--' causes premature termination of argument"] - #[doc = "scanning, explicitly telling 'getopt' that there are no more"] - #[doc = "options."] - #[doc = ""] - #[doc = "If OPTS begins with '-', then non-option arguments are treated as"] - #[doc = "arguments to the option '\\1'. This behavior is specific to the GNU"] - #[doc = "'getopt'. If OPTS begins with '+', or POSIXLY_CORRECT is set in"] - #[doc = "the environment, then do not permute arguments."] - #[doc = ""] - #[doc = "For standards compliance, the 'argv' argument has the type"] - #[doc = "char *const *, but this is inaccurate; if argument permutation is"] - #[doc = "enabled, the argv array (not the strings it points to) must be"] - #[doc = "writable."] - pub fn getopt( - ___argc: cty::c_int, - ___argv: *const *mut cty::c_char, - __shortopts: *const cty::c_char, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Slow-path routines used by the optimized inline functions in"] - #[doc = "bits/stdio.h."] - pub fn __uflow(arg1: *mut FILE) -> cty::c_int; -} -extern "C" { - pub fn __overflow(arg1: *mut FILE, arg2: cty::c_int) -> cty::c_int; -} -#[doc = " Signed."] -pub type int_least8_t = __int_least8_t; -pub type int_least16_t = __int_least16_t; -pub type int_least32_t = __int_least32_t; -pub type int_least64_t = __int_least64_t; -#[doc = " Unsigned."] -pub type uint_least8_t = __uint_least8_t; -pub type uint_least16_t = __uint_least16_t; -pub type uint_least32_t = __uint_least32_t; -pub type uint_least64_t = __uint_least64_t; -#[doc = " Signed."] -pub type int_fast8_t = cty::c_schar; -pub type int_fast16_t = cty::c_long; -pub type int_fast32_t = cty::c_long; -pub type int_fast64_t = cty::c_long; -#[doc = " Unsigned."] -pub type uint_fast8_t = cty::c_uchar; -pub type uint_fast16_t = cty::c_ulong; -pub type uint_fast32_t = cty::c_ulong; -pub type uint_fast64_t = cty::c_ulong; -#[doc = " Largest integral types."] -pub type intmax_t = __intmax_t; -pub type uintmax_t = __uintmax_t; -#[doc = " Returned by `div'."] -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct div_t { - #[doc = " Quotient."] - pub quot: cty::c_int, - #[doc = " Remainder."] - pub rem: cty::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) - ) - ); -} -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ldiv_t { - #[doc = " Quotient."] - pub quot: cty::c_long, - #[doc = " Remainder."] - pub rem: cty::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) - ) - ); -} -#[doc = " Returned by `lldiv'."] -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct lldiv_t { - #[doc = " Quotient."] - pub quot: cty::c_longlong, - #[doc = " Remainder."] - pub rem: cty::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) - ) - ); -} -extern "C" { - pub fn __ctype_get_mb_cur_max() -> size_t; -} -extern "C" { - #[doc = " Convert a string to a floating-point number."] - pub fn atof(__nptr: *const cty::c_char) -> f64; -} -extern "C" { - #[doc = " Convert a string to an integer."] - pub fn atoi(__nptr: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Convert a string to a long integer."] - pub fn atol(__nptr: *const cty::c_char) -> cty::c_long; -} -extern "C" { - #[doc = " Convert a string to a long long integer."] - pub fn atoll(__nptr: *const cty::c_char) -> cty::c_longlong; -} -extern "C" { - #[doc = " Convert a string to a floating-point number."] - pub fn strtod(__nptr: *const cty::c_char, __endptr: *mut *mut cty::c_char) -> f64; -} -extern "C" { - #[doc = " Likewise for `float' and `long double' sizes of floating-point numbers."] - pub fn strtof(__nptr: *const cty::c_char, __endptr: *mut *mut cty::c_char) -> f32; -} -extern "C" { - #[doc = " Convert a string to a long integer."] - pub fn strtol( - __nptr: *const cty::c_char, - __endptr: *mut *mut cty::c_char, - __base: cty::c_int, - ) -> cty::c_long; -} -extern "C" { - #[doc = " Convert a string to an unsigned long integer."] - pub fn strtoul( - __nptr: *const cty::c_char, - __endptr: *mut *mut cty::c_char, - __base: cty::c_int, - ) -> cty::c_ulong; -} -extern "C" { - #[doc = " Convert a string to a quadword integer."] - pub fn strtoll( - __nptr: *const cty::c_char, - __endptr: *mut *mut cty::c_char, - __base: cty::c_int, - ) -> cty::c_longlong; -} -extern "C" { - #[doc = " Convert a string to an unsigned quadword integer."] - pub fn strtoull( - __nptr: *const cty::c_char, - __endptr: *mut *mut cty::c_char, - __base: cty::c_int, - ) -> cty::c_ulonglong; -} -extern "C" { - #[doc = " Return a random integer between 0 and RAND_MAX inclusive."] - pub fn rand() -> cty::c_int; -} -extern "C" { - #[doc = " Seed the random number generator with the given number."] - pub fn srand(__seed: cty::c_uint); -} -extern "C" { - #[doc = " Return non-negative, double-precision floating-point value in [0.0,1.0)."] - pub fn drand48() -> f64; -} -extern "C" { - pub fn erand48(__xsubi: *mut cty::c_ushort) -> f64; -} -extern "C" { - #[doc = " Return non-negative, long integer in [0,2^31)."] - pub fn lrand48() -> cty::c_long; -} -extern "C" { - pub fn nrand48(__xsubi: *mut cty::c_ushort) -> cty::c_long; -} -extern "C" { - #[doc = " Return signed, long integers in [-2^31,2^31)."] - pub fn mrand48() -> cty::c_long; -} -extern "C" { - pub fn jrand48(__xsubi: *mut cty::c_ushort) -> cty::c_long; -} -extern "C" { - #[doc = " Seed random number generator."] - pub fn srand48(__seedval: cty::c_long); -} -extern "C" { - pub fn seed48(__seed16v: *mut cty::c_ushort) -> *mut cty::c_ushort; -} -extern "C" { - pub fn lcong48(__param: *mut cty::c_ushort); -} -extern "C" { - #[doc = " Allocate SIZE bytes of memory."] - pub fn malloc(__size: cty::c_ulong) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Allocate NMEMB elements of SIZE bytes each, all initialized to 0."] - pub fn calloc(__nmemb: cty::c_ulong, __size: cty::c_ulong) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Re-allocate the previously allocated block"] - #[doc = "in PTR, making the new block SIZE bytes long. */"] - #[doc = "the same pointer that was passed to it, aliasing needs to be allowed"] - #[doc = "between objects pointed by the old and new pointers."] - pub fn realloc(__ptr: *mut cty::c_void, __size: cty::c_ulong) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Free a block allocated by `malloc', `realloc' or `calloc'."] - pub fn free(__ptr: *mut cty::c_void); -} -extern "C" { - #[doc = " ISO C variant of aligned allocation."] - pub fn aligned_alloc(__alignment: size_t, __size: size_t) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Abort execution and generate a core-dump."] - pub fn abort(); -} -extern "C" { - #[doc = " Register a function to be called when `exit' is called."] - pub fn atexit(__func: ::core::option::Option) -> cty::c_int; -} -extern "C" { - pub fn at_quick_exit(__func: ::core::option::Option) -> cty::c_int; -} -extern "C" { - #[doc = " Call all functions registered with `atexit' and `on_exit',"] - #[doc = "in the reverse of the order in which they were registered,"] - #[doc = "perform stdio cleanup, and terminate program execution with STATUS."] - pub fn exit(__status: cty::c_int); -} -extern "C" { - #[doc = " Call all functions registered with `at_quick_exit' in the reverse"] - #[doc = "of the order in which they were registered and terminate program"] - #[doc = "execution with STATUS."] - pub fn quick_exit(__status: cty::c_int); -} -extern "C" { - #[doc = " Terminate the program with STATUS without calling any of the"] - #[doc = "functions registered with `atexit' or `on_exit'."] - pub fn _Exit(__status: cty::c_int); -} -extern "C" { - #[doc = " Return the value of envariable NAME, or NULL if it doesn't exist."] - pub fn getenv(__name: *const cty::c_char) -> *mut cty::c_char; -} -extern "C" { - #[doc = " The SVID says this is in , but this seems a better place.\t*/"] - #[doc = "If there is no `=', remove NAME from the environment."] - pub fn putenv(__string: *mut cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Execute the given line as a shell command."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn system(__command: *const cty::c_char) -> cty::c_int; -} -pub type __compar_fn_t = ::core::option::Option< - unsafe extern "C" fn(arg1: *const cty::c_void, arg2: *const cty::c_void) -> cty::c_int, ->; -extern "C" { - #[doc = " Do a binary search for KEY in BASE, which consists of NMEMB elements"] - #[doc = "of SIZE bytes each, using COMPAR to perform the comparisons."] - pub fn bsearch( - __key: *const cty::c_void, - __base: *const cty::c_void, - __nmemb: size_t, - __size: size_t, - __compar: __compar_fn_t, - ) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Sort NMEMB elements of BASE, of SIZE bytes each,"] - #[doc = "using COMPAR to perform the comparisons."] - pub fn qsort( - __base: *mut cty::c_void, - __nmemb: size_t, - __size: size_t, - __compar: __compar_fn_t, - ); -} -extern "C" { - #[doc = " Return the absolute value of X."] - pub fn abs(__x: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn labs(__x: cty::c_long) -> cty::c_long; -} -extern "C" { - pub fn llabs(__x: cty::c_longlong) -> cty::c_longlong; -} -extern "C" { - #[doc = " Return the `div_t', `ldiv_t' or `lldiv_t' representation"] - #[doc = "of the value of NUMER over DENOM. */"] - pub fn div(__numer: cty::c_int, __denom: cty::c_int) -> div_t; -} -extern "C" { - pub fn ldiv(__numer: cty::c_long, __denom: cty::c_long) -> ldiv_t; -} -extern "C" { - pub fn lldiv(__numer: cty::c_longlong, __denom: cty::c_longlong) -> lldiv_t; -} -extern "C" { - #[doc = " Return the length of the multibyte character"] - #[doc = "in S, which is no longer than N."] - pub fn mblen(__s: *const cty::c_char, __n: size_t) -> cty::c_int; -} -extern "C" { - #[doc = " Return the length of the given multibyte character,"] - #[doc = "putting its `wchar_t' representation in *PWC."] - pub fn mbtowc(__pwc: *mut wchar_t, __s: *const cty::c_char, __n: size_t) -> cty::c_int; -} -extern "C" { - #[doc = " Put the multibyte character represented"] - #[doc = "by WCHAR in S, returning its length."] - pub fn wctomb(__s: *mut cty::c_char, __wchar: wchar_t) -> cty::c_int; -} -extern "C" { - #[doc = " Convert a multibyte string to a wide char string."] - pub fn mbstowcs(__pwcs: *mut wchar_t, __s: *const cty::c_char, __n: size_t) -> size_t; -} -extern "C" { - #[doc = " Convert a wide char string to multibyte string."] - pub fn wcstombs(__s: *mut cty::c_char, __pwcs: *const wchar_t, __n: size_t) -> size_t; -} -extern "C" { - #[doc = " Copy N bytes of SRC to DEST."] - pub fn memcpy( - __dest: *mut cty::c_void, - __src: *const cty::c_void, - __n: cty::c_ulong, - ) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Copy N bytes of SRC to DEST, guaranteeing"] - #[doc = "correct behavior for overlapping strings."] - pub fn memmove( - __dest: *mut cty::c_void, - __src: *const cty::c_void, - __n: cty::c_ulong, - ) -> *mut cty::c_void; -} -extern "C" { - pub fn memccpy( - __dest: *mut cty::c_void, - __src: *const cty::c_void, - __c: cty::c_int, - __n: cty::c_ulong, - ) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Set N bytes of S to C."] - pub fn memset(__s: *mut cty::c_void, __c: cty::c_int, __n: cty::c_ulong) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Compare N bytes of S1 and S2."] - pub fn memcmp( - __s1: *const cty::c_void, - __s2: *const cty::c_void, - __n: cty::c_ulong, - ) -> cty::c_int; -} -extern "C" { - pub fn memchr(__s: *const cty::c_void, __c: cty::c_int, __n: cty::c_ulong) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Copy SRC to DEST."] - pub fn strcpy(__dest: *mut cty::c_char, __src: *const cty::c_char) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Copy no more than N characters of SRC to DEST."] - pub fn strncpy( - __dest: *mut cty::c_char, - __src: *const cty::c_char, - __n: cty::c_ulong, - ) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Append SRC onto DEST."] - pub fn strcat(__dest: *mut cty::c_char, __src: *const cty::c_char) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Append no more than N characters from SRC onto DEST."] - pub fn strncat( - __dest: *mut cty::c_char, - __src: *const cty::c_char, - __n: cty::c_ulong, - ) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Compare S1 and S2."] - pub fn strcmp(__s1: *const cty::c_char, __s2: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Compare N characters of S1 and S2."] - pub fn strncmp( - __s1: *const cty::c_char, - __s2: *const cty::c_char, - __n: cty::c_ulong, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Compare the collated forms of S1 and S2."] - pub fn strcoll(__s1: *const cty::c_char, __s2: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Put a transformation of SRC into no more than N bytes of DEST."] - pub fn strxfrm( - __dest: *mut cty::c_char, - __src: *const cty::c_char, - __n: cty::c_ulong, - ) -> cty::c_ulong; -} -extern "C" { - pub fn strchr(__s: *const cty::c_char, __c: cty::c_int) -> *mut cty::c_char; -} -extern "C" { - pub fn strrchr(__s: *const cty::c_char, __c: cty::c_int) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Return the length of the initial segment of S which"] - #[doc = "consists entirely of characters not in REJECT."] - pub fn strcspn(__s: *const cty::c_char, __reject: *const cty::c_char) -> cty::c_ulong; -} -extern "C" { - #[doc = " Return the length of the initial segment of S which"] - #[doc = "consists entirely of characters in ACCEPT."] - pub fn strspn(__s: *const cty::c_char, __accept: *const cty::c_char) -> cty::c_ulong; -} -extern "C" { - pub fn strpbrk(__s: *const cty::c_char, __accept: *const cty::c_char) -> *mut cty::c_char; -} -extern "C" { - pub fn strstr(__haystack: *const cty::c_char, __needle: *const cty::c_char) - -> *mut cty::c_char; -} -extern "C" { - #[doc = " Divide S into tokens separated by characters in DELIM."] - pub fn strtok(__s: *mut cty::c_char, __delim: *const cty::c_char) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Divide S into tokens separated by characters in DELIM. Information"] - #[doc = "passed between calls are stored in SAVE_PTR."] - pub fn __strtok_r( - __s: *mut cty::c_char, - __delim: *const cty::c_char, - __save_ptr: *mut *mut cty::c_char, - ) -> *mut cty::c_char; -} -extern "C" { - pub fn strtok_r( - __s: *mut cty::c_char, - __delim: *const cty::c_char, - __save_ptr: *mut *mut cty::c_char, - ) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Return the length of S."] - pub fn strlen(__s: *const cty::c_char) -> cty::c_ulong; -} -extern "C" { - #[doc = " Return a string describing the meaning of the `errno' code in ERRNUM."] - pub fn strerror(__errnum: cty::c_int) -> *mut cty::c_char; -} -#[doc = " An integral type that can be modified atomically, without the"] -#[doc = "possibility of a signal arriving in the middle of the operation."] -pub type sig_atomic_t = __sig_atomic_t; -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct __sigset_t { - pub __val: [cty::c_ulong; 16usize], -} -#[test] -fn bindgen_test_layout___sigset_t() { - assert_eq!( - ::core::mem::size_of::<__sigset_t>(), - 128usize, - concat!("Size of: ", stringify!(__sigset_t)) - ); - assert_eq!( - ::core::mem::align_of::<__sigset_t>(), - 8usize, - concat!("Alignment of ", stringify!(__sigset_t)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<__sigset_t>())).__val as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__sigset_t), - "::", - stringify!(__val) - ) - ); -} -#[doc = " A set of signals to be blocked, unblocked, or waited for."] -pub type sigset_t = __sigset_t; -pub type pid_t = __pid_t; -pub type uid_t = __uid_t; -#[doc = " Type of a signal handler."] -pub type __sighandler_t = ::core::option::Option; -extern "C" { - #[doc = " The X/Open definition of `signal' specifies the SVID semantic. Use"] - #[doc = "the additional function `sysv_signal' when X/Open compatibility is"] - #[doc = "requested."] - pub fn __sysv_signal(__sig: cty::c_int, __handler: __sighandler_t) -> __sighandler_t; -} -extern "C" { - pub fn kill(__pid: __pid_t, __sig: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Raise signal SIG, i.e., send SIG to yourself."] - pub fn raise(__sig: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Clear all signals from SET."] - pub fn sigemptyset(__set: *mut sigset_t) -> cty::c_int; -} -extern "C" { - #[doc = " Set all signals in SET."] - pub fn sigfillset(__set: *mut sigset_t) -> cty::c_int; -} -extern "C" { - #[doc = " Add SIGNO to SET."] - pub fn sigaddset(__set: *mut sigset_t, __signo: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Remove SIGNO from SET."] - pub fn sigdelset(__set: *mut sigset_t, __signo: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Return 1 if SIGNO is in SET, 0 if not."] - pub fn sigismember(__set: *const sigset_t, __signo: cty::c_int) -> cty::c_int; -} -#[doc = " Structure describing the action to be taken when a signal arrives."] -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct sigaction { - pub sa_handler: __sighandler_t, - #[doc = " Additional set of signals to be blocked."] - pub sa_mask: __sigset_t, - #[doc = " Special flags."] - pub sa_flags: cty::c_int, - #[doc = " Restore handler."] - pub sa_restorer: ::core::option::Option, -} -#[test] -fn bindgen_test_layout_sigaction() { - assert_eq!( - ::core::mem::size_of::(), - 152usize, - concat!("Size of: ", stringify!(sigaction)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(sigaction)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sa_handler as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(sigaction), - "::", - stringify!(sa_handler) - ) - ); - 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 }, - 136usize, - concat!( - "Offset of field: ", - stringify!(sigaction), - "::", - stringify!(sa_flags) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sa_restorer as *const _ as usize }, - 144usize, - concat!( - "Offset of field: ", - stringify!(sigaction), - "::", - stringify!(sa_restorer) - ) - ); -} -extern "C" { - #[doc = " Get and/or change the set of blocked signals."] - pub fn sigprocmask( - __how: cty::c_int, - __set: *const sigset_t, - __oset: *mut sigset_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Change the set of blocked signals to SET,"] - #[doc = "wait until a signal arrives, and restore the set of blocked signals."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn sigsuspend(__set: *const sigset_t) -> cty::c_int; -} -extern "C" { - #[doc = " Get and/or set the action for signal SIG."] - pub fn sigaction( - __sig: cty::c_int, - __act: *const sigaction, - __oact: *mut sigaction, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Put in SET all signals that are blocked and waiting to be delivered."] - pub fn sigpending(__set: *mut sigset_t) -> cty::c_int; -} -extern "C" { - #[doc = " Return number of available real-time signal with highest priority."] - pub fn __libc_current_sigrtmin() -> cty::c_int; -} -extern "C" { - #[doc = " Return number of available real-time signal with lowest priority."] - pub fn __libc_current_sigrtmax() -> cty::c_int; -} -#[doc = " Structure for scatter/gather I/O."] -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct iovec { - #[doc = " Pointer to data."] - pub iov_base: *mut cty::c_void, - #[doc = " Length of data."] - pub iov_len: size_t, -} -#[test] -fn bindgen_test_layout_iovec() { - assert_eq!( - ::core::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(iovec)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(iovec)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).iov_base as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(iovec), - "::", - stringify!(iov_base) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).iov_len as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(iovec), - "::", - stringify!(iov_len) - ) - ); -} -impl Default for iovec { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -pub type ino_t = __ino_t; -pub type dev_t = __dev_t; -pub type gid_t = __gid_t; -pub type mode_t = __mode_t; -pub type nlink_t = __nlink_t; -pub type off_t = __off_t; -pub type id_t = __id_t; -pub type ssize_t = __ssize_t; -pub type key_t = __key_t; -#[doc = " Clock ID used in clock and timer functions."] -pub type clockid_t = __clockid_t; -#[doc = " Timer ID returned by `timer_create'."] -pub type timer_t = __timer_t; -pub type useconds_t = __useconds_t; -pub type suseconds_t = __suseconds_t; -#[doc = " These were defined by ISO C without the first `_'."] -pub type u_int8_t = __uint8_t; -pub type u_int16_t = __uint16_t; -pub type u_int32_t = __uint32_t; -pub type u_int64_t = __uint64_t; -pub type register_t = cty::c_long; -pub type blkcnt_t = __blkcnt_t; -pub type fsblkcnt_t = __fsblkcnt_t; -pub type fsfilcnt_t = __fsfilcnt_t; -pub type socklen_t = __socklen_t; -#[doc = " Sequenced, reliable, connection-based"] -#[doc = "byte streams."] -pub const __socket_type_SOCK_STREAM: __socket_type = 1; -#[doc = " Connectionless, unreliable datagrams"] -#[doc = "of fixed maximum length."] -pub const __socket_type_SOCK_DGRAM: __socket_type = 2; -#[doc = " Raw protocol interface."] -pub const __socket_type_SOCK_RAW: __socket_type = 3; -#[doc = " Reliably-delivered messages."] -pub const __socket_type_SOCK_RDM: __socket_type = 4; -#[doc = " Sequenced, reliable, connection-based,"] -#[doc = "datagrams of fixed maximum length."] -pub const __socket_type_SOCK_SEQPACKET: __socket_type = 5; -#[doc = " Datagram Congestion Control Protocol."] -pub const __socket_type_SOCK_DCCP: __socket_type = 6; -#[doc = " Linux specific way of getting packets"] -#[doc = "at the dev level. For writing rarp and"] -#[doc = "other similar things on the user level."] -pub const __socket_type_SOCK_PACKET: __socket_type = 10; -#[doc = " Atomically set close-on-exec flag for the"] -#[doc = "new descriptor(s)."] -pub const __socket_type_SOCK_CLOEXEC: __socket_type = 524288; -#[doc = " Atomically mark descriptor(s) as"] -#[doc = "non-blocking."] -pub const __socket_type_SOCK_NONBLOCK: __socket_type = 2048; -#[doc = " Types of sockets."] -pub type __socket_type = cty::c_uint; -#[doc = " POSIX.1g specifies this type name for the `sa_family' member."] -pub type sa_family_t = cty::c_ushort; -#[doc = " Structure describing a generic socket address."] -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct sockaddr { - pub sa_family: sa_family_t, - #[doc = " Address data."] - pub sa_data: [cty::c_char; 14usize], -} -#[test] -fn bindgen_test_layout_sockaddr() { - assert_eq!( - ::core::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(sockaddr)) - ); - assert_eq!( - ::core::mem::align_of::(), - 2usize, - concat!("Alignment of ", stringify!(sockaddr)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sa_family as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(sockaddr), - "::", - stringify!(sa_family) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sa_data as *const _ as usize }, - 2usize, - concat!( - "Offset of field: ", - stringify!(sockaddr), - "::", - stringify!(sa_data) - ) - ); -} -#[repr(C)] -#[derive(Copy, Clone)] -pub struct sockaddr_storage { - pub ss_family: sa_family_t, - pub __ss_padding: [cty::c_char; 118usize], - #[doc = " Force desired alignment."] - pub __ss_align: cty::c_ulong, -} -#[test] -fn bindgen_test_layout_sockaddr_storage() { - assert_eq!( - ::core::mem::size_of::(), - 128usize, - concat!("Size of: ", stringify!(sockaddr_storage)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(sockaddr_storage)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).ss_family as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_storage), - "::", - stringify!(ss_family) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).__ss_padding as *const _ as usize }, - 2usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_storage), - "::", - stringify!(__ss_padding) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).__ss_align as *const _ as usize }, - 120usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_storage), - "::", - stringify!(__ss_align) - ) - ); -} -impl Default for sockaddr_storage { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[doc = " Process out-of-band data."] -pub const MSG_OOB: cty::c_uint = 1; -#[doc = " Peek at incoming messages."] -pub const MSG_PEEK: cty::c_uint = 2; -#[doc = " Don't use local routing."] -pub const MSG_DONTROUTE: cty::c_uint = 4; -#[doc = " Control data lost before delivery."] -pub const MSG_CTRUNC: cty::c_uint = 8; -#[doc = " Supply or ask second address."] -pub const MSG_PROXY: cty::c_uint = 16; -pub const MSG_TRUNC: cty::c_uint = 32; -#[doc = " Nonblocking IO."] -pub const MSG_DONTWAIT: cty::c_uint = 64; -#[doc = " End of record."] -pub const MSG_EOR: cty::c_uint = 128; -#[doc = " Wait for a full request."] -pub const MSG_WAITALL: cty::c_uint = 256; -pub const MSG_FIN: cty::c_uint = 512; -pub const MSG_SYN: cty::c_uint = 1024; -#[doc = " Confirm path validity."] -pub const MSG_CONFIRM: cty::c_uint = 2048; -pub const MSG_RST: cty::c_uint = 4096; -#[doc = " Fetch message from error queue."] -pub const MSG_ERRQUEUE: cty::c_uint = 8192; -#[doc = " Do not generate SIGPIPE."] -pub const MSG_NOSIGNAL: cty::c_uint = 16384; -#[doc = " Sender will send more."] -pub const MSG_MORE: cty::c_uint = 32768; -#[doc = " Wait for at least one packet to return."] -pub const MSG_WAITFORONE: cty::c_uint = 65536; -#[doc = " sendmmsg: more messages coming."] -pub const MSG_BATCH: cty::c_uint = 262144; -#[doc = " Use user data in kernel path."] -pub const MSG_ZEROCOPY: cty::c_uint = 67108864; -#[doc = " Send data in TCP SYN."] -pub const MSG_FASTOPEN: cty::c_uint = 536870912; -#[doc = " Set close_on_exit for file"] -#[doc = "descriptor received through"] -#[doc = "SCM_RIGHTS."] -pub const MSG_CMSG_CLOEXEC: cty::c_uint = 1073741824; -#[doc = " Bits in the FLAGS argument to `send', `recv', et al."] -pub type _bindgen_ty_3 = cty::c_uint; -#[doc = " Structure describing messages sent by"] -#[doc = "`sendmsg' and received by `recvmsg'."] -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct msghdr { - #[doc = " Address to send to/receive from."] - pub msg_name: *mut cty::c_void, - #[doc = " Length of address data."] - pub msg_namelen: socklen_t, - #[doc = " Vector of data to send/receive into."] - pub msg_iov: *mut iovec, - #[doc = " Number of elements in the vector."] - pub msg_iovlen: size_t, - #[doc = " Ancillary data (eg BSD filedesc passing)."] - pub msg_control: *mut cty::c_void, - #[doc = " Ancillary data buffer length."] - #[doc = " The type should be socklen_t but the"] - #[doc = "definition of the kernel is incompatible"] - #[doc = "with this."] - pub msg_controllen: size_t, - #[doc = " Flags on received message."] - pub msg_flags: cty::c_int, -} -#[test] -fn bindgen_test_layout_msghdr() { - assert_eq!( - ::core::mem::size_of::(), - 56usize, - concat!("Size of: ", stringify!(msghdr)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(msghdr)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).msg_name as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(msghdr), - "::", - stringify!(msg_name) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).msg_namelen as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(msghdr), - "::", - stringify!(msg_namelen) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).msg_iov as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(msghdr), - "::", - stringify!(msg_iov) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).msg_iovlen as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(msghdr), - "::", - stringify!(msg_iovlen) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).msg_control as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(msghdr), - "::", - stringify!(msg_control) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).msg_controllen as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(msghdr), - "::", - stringify!(msg_controllen) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).msg_flags as *const _ as usize }, - 48usize, - concat!( - "Offset of field: ", - stringify!(msghdr), - "::", - stringify!(msg_flags) - ) - ); -} -impl Default for msghdr { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[doc = " Structure used for storage of ancillary data object information."] -#[repr(C)] -#[derive(Debug, Default)] -pub struct cmsghdr { - #[doc = " Length of data in cmsg_data plus length"] - #[doc = "of cmsghdr structure."] - #[doc = " The type should be socklen_t but the"] - #[doc = "definition of the kernel is incompatible"] - #[doc = "with this."] - pub cmsg_len: size_t, - #[doc = " Originating protocol."] - pub cmsg_level: cty::c_int, - #[doc = " Protocol specific type."] - pub cmsg_type: cty::c_int, - #[doc = " Ancillary data."] - pub __cmsg_data: __IncompleteArrayField, -} -#[test] -fn bindgen_test_layout_cmsghdr() { - assert_eq!( - ::core::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(cmsghdr)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(cmsghdr)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).cmsg_len as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(cmsghdr), - "::", - stringify!(cmsg_len) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).cmsg_level as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(cmsghdr), - "::", - stringify!(cmsg_level) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).cmsg_type as *const _ as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(cmsghdr), - "::", - stringify!(cmsg_type) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).__cmsg_data as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(cmsghdr), - "::", - stringify!(__cmsg_data) - ) - ); -} -extern "C" { - pub fn __cmsg_nxthdr(__mhdr: *mut msghdr, __cmsg: *mut cmsghdr) -> *mut cmsghdr; -} -#[doc = " Transfer file descriptors."] -pub const SCM_RIGHTS: cty::c_uint = 1; -#[doc = " Socket level message types. This must match the definitions in"] -#[doc = "."] -pub type _bindgen_ty_4 = cty::c_uint; -#[doc = " Structure used to manipulate the SO_LINGER option."] -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct linger { - #[doc = " Nonzero to linger on close."] - pub l_onoff: cty::c_int, - #[doc = " Time to linger."] - pub l_linger: cty::c_int, -} -#[test] -fn bindgen_test_layout_linger() { - assert_eq!( - ::core::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(linger)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(linger)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).l_onoff as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(linger), - "::", - stringify!(l_onoff) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).l_linger as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(linger), - "::", - stringify!(l_linger) - ) - ); -} -#[doc = " No more receptions."] -pub const SHUT_RD: cty::c_uint = 0; -#[doc = " No more transmissions."] -pub const SHUT_WR: cty::c_uint = 1; -#[doc = " No more receptions or transmissions."] -pub const SHUT_RDWR: cty::c_uint = 2; -#[doc = " The following constants should be used for the second parameter of"] -#[doc = "`shutdown'."] -pub type _bindgen_ty_5 = cty::c_uint; -extern "C" { - #[doc = " Create a new socket of type TYPE in domain DOMAIN, using"] - #[doc = "protocol PROTOCOL. If PROTOCOL is zero, one is chosen automatically."] - #[doc = "Returns a file descriptor for the new socket, or -1 for errors."] - pub fn socket(__domain: cty::c_int, __type: cty::c_int, __protocol: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Create two new sockets, of type TYPE in domain DOMAIN and using"] - #[doc = "protocol PROTOCOL, which are connected to each other, and put file"] - #[doc = "descriptors for them in FDS[0] and FDS[1]. If PROTOCOL is zero,"] - #[doc = "one will be chosen automatically. Returns 0 on success, -1 for errors."] - pub fn socketpair( - __domain: cty::c_int, - __type: cty::c_int, - __protocol: cty::c_int, - __fds: *mut cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Give the socket FD the local address ADDR (which is LEN bytes long)."] - pub fn bind(__fd: cty::c_int, __addr: *const sockaddr, __len: socklen_t) -> cty::c_int; -} -extern "C" { - #[doc = " Put the local address of FD into *ADDR and its length in *LEN."] - pub fn getsockname( - __fd: cty::c_int, - __addr: *mut sockaddr, - __len: *mut socklen_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Open a connection on socket FD to peer at ADDR (which LEN bytes long)."] - #[doc = "For connectionless socket types, just set the default address to send to"] - #[doc = "and the only address from which to accept transmissions."] - #[doc = "Return 0 on success, -1 for errors."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn connect(__fd: cty::c_int, __addr: *const sockaddr, __len: socklen_t) -> cty::c_int; -} -extern "C" { - #[doc = " Put the address of the peer connected to socket FD into *ADDR"] - #[doc = "(which is *LEN bytes long), and its actual length into *LEN."] - pub fn getpeername( - __fd: cty::c_int, - __addr: *mut sockaddr, - __len: *mut socklen_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Send N bytes of BUF to socket FD. Returns the number sent or -1."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn send( - __fd: cty::c_int, - __buf: *const cty::c_void, - __n: size_t, - __flags: cty::c_int, - ) -> ssize_t; -} -extern "C" { - #[doc = " Read N bytes into BUF from socket FD."] - #[doc = "Returns the number read or -1 for errors."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn recv( - __fd: cty::c_int, - __buf: *mut cty::c_void, - __n: size_t, - __flags: cty::c_int, - ) -> ssize_t; -} -extern "C" { - #[doc = " Send N bytes of BUF on socket FD to peer at address ADDR (which is"] - #[doc = "ADDR_LEN bytes long). Returns the number sent, or -1 for errors."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn sendto( - __fd: cty::c_int, - __buf: *const cty::c_void, - __n: size_t, - __flags: cty::c_int, - __addr: *const sockaddr, - __addr_len: socklen_t, - ) -> ssize_t; -} -extern "C" { - #[doc = " Read N bytes into BUF through socket FD."] - #[doc = "If ADDR is not NULL, fill in *ADDR_LEN bytes of it with tha address of"] - #[doc = "the sender, and store the actual size of the address in *ADDR_LEN."] - #[doc = "Returns the number of bytes read or -1 for errors."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn recvfrom( - __fd: cty::c_int, - __buf: *mut cty::c_void, - __n: size_t, - __flags: cty::c_int, - __addr: *mut sockaddr, - __addr_len: *mut socklen_t, - ) -> ssize_t; -} -extern "C" { - #[doc = " Send a message described MESSAGE on socket FD."] - #[doc = "Returns the number of bytes sent, or -1 for errors."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn sendmsg(__fd: cty::c_int, __message: *const msghdr, __flags: cty::c_int) -> ssize_t; -} -extern "C" { - #[doc = " Receive a message as described by MESSAGE from socket FD."] - #[doc = "Returns the number of bytes read or -1 for errors."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn recvmsg(__fd: cty::c_int, __message: *mut msghdr, __flags: cty::c_int) -> ssize_t; -} -extern "C" { - #[doc = " Put the current value for socket FD's option OPTNAME at protocol level LEVEL"] - #[doc = "into OPTVAL (which is *OPTLEN bytes long), and set *OPTLEN to the value's"] - #[doc = "actual length. Returns 0 on success, -1 for errors."] - pub fn getsockopt( - __fd: cty::c_int, - __level: cty::c_int, - __optname: cty::c_int, - __optval: *mut cty::c_void, - __optlen: *mut socklen_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Set socket FD's option OPTNAME at protocol level LEVEL"] - #[doc = "to *OPTVAL (which is OPTLEN bytes long)."] - #[doc = "Returns 0 on success, -1 for errors."] - pub fn setsockopt( - __fd: cty::c_int, - __level: cty::c_int, - __optname: cty::c_int, - __optval: *const cty::c_void, - __optlen: socklen_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Prepare to accept connections on socket FD."] - #[doc = "N connection requests will be queued before further requests are refused."] - #[doc = "Returns 0 on success, -1 for errors."] - pub fn listen(__fd: cty::c_int, __n: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Await a connection on socket FD."] - #[doc = "When a connection arrives, open a new socket to communicate with it,"] - #[doc = "set *ADDR (which is *ADDR_LEN bytes long) to the address of the connecting"] - #[doc = "peer and *ADDR_LEN to the address's actual length, and return the"] - #[doc = "new socket's descriptor, or -1 for errors."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn accept( - __fd: cty::c_int, - __addr: *mut sockaddr, - __addr_len: *mut socklen_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Shut down all or part of the connection open on socket FD."] - #[doc = "HOW determines what to shut down:"] - #[doc = "SHUT_RD = No more receptions;"] - #[doc = "SHUT_WR = No more transmissions;"] - #[doc = "SHUT_RDWR = No more receptions or transmissions."] - #[doc = "Returns 0 on success, -1 for errors."] - pub fn shutdown(__fd: cty::c_int, __how: cty::c_int) -> cty::c_int; -} -#[doc = " Internet address."] -pub type in_addr_t = u32; -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct in_addr { - pub s_addr: in_addr_t, -} -#[test] -fn bindgen_test_layout_in_addr() { - assert_eq!( - ::core::mem::size_of::(), - 4usize, - concat!("Size of: ", stringify!(in_addr)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(in_addr)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).s_addr as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(in_addr), - "::", - stringify!(s_addr) - ) - ); -} -#[doc = " Dummy protocol for TCP."] -pub const IPPROTO_IP: cty::c_uint = 0; -#[doc = " Internet Control Message Protocol."] -pub const IPPROTO_ICMP: cty::c_uint = 1; -#[doc = " Internet Group Management Protocol."] -pub const IPPROTO_IGMP: cty::c_uint = 2; -#[doc = " IPIP tunnels (older KA9Q tunnels use 94)."] -pub const IPPROTO_IPIP: cty::c_uint = 4; -#[doc = " Transmission Control Protocol."] -pub const IPPROTO_TCP: cty::c_uint = 6; -#[doc = " Exterior Gateway Protocol."] -pub const IPPROTO_EGP: cty::c_uint = 8; -#[doc = " PUP protocol."] -pub const IPPROTO_PUP: cty::c_uint = 12; -#[doc = " User Datagram Protocol."] -pub const IPPROTO_UDP: cty::c_uint = 17; -#[doc = " XNS IDP protocol."] -pub const IPPROTO_IDP: cty::c_uint = 22; -#[doc = " SO Transport Protocol Class 4."] -pub const IPPROTO_TP: cty::c_uint = 29; -#[doc = " Datagram Congestion Control Protocol."] -pub const IPPROTO_DCCP: cty::c_uint = 33; -#[doc = " IPv6 header."] -pub const IPPROTO_IPV6: cty::c_uint = 41; -#[doc = " Reservation Protocol."] -pub const IPPROTO_RSVP: cty::c_uint = 46; -#[doc = " General Routing Encapsulation."] -pub const IPPROTO_GRE: cty::c_uint = 47; -#[doc = " encapsulating security payload."] -pub const IPPROTO_ESP: cty::c_uint = 50; -#[doc = " authentication header."] -pub const IPPROTO_AH: cty::c_uint = 51; -#[doc = " Multicast Transport Protocol."] -pub const IPPROTO_MTP: cty::c_uint = 92; -#[doc = " IP option pseudo header for BEET."] -pub const IPPROTO_BEETPH: cty::c_uint = 94; -#[doc = " Encapsulation Header."] -pub const IPPROTO_ENCAP: cty::c_uint = 98; -#[doc = " Protocol Independent Multicast."] -pub const IPPROTO_PIM: cty::c_uint = 103; -#[doc = " Compression Header Protocol."] -pub const IPPROTO_COMP: cty::c_uint = 108; -#[doc = " Stream Control Transmission Protocol."] -pub const IPPROTO_SCTP: cty::c_uint = 132; -#[doc = " UDP-Lite protocol."] -pub const IPPROTO_UDPLITE: cty::c_uint = 136; -#[doc = " MPLS in IP."] -pub const IPPROTO_MPLS: cty::c_uint = 137; -#[doc = " Raw IP packets."] -pub const IPPROTO_RAW: cty::c_uint = 255; -pub const IPPROTO_MAX: cty::c_uint = 256; -#[doc = " Standard well-defined IP protocols."] -pub type _bindgen_ty_6 = cty::c_uint; -#[doc = " IPv6 Hop-by-Hop options."] -pub const IPPROTO_HOPOPTS: cty::c_uint = 0; -#[doc = " IPv6 routing header."] -pub const IPPROTO_ROUTING: cty::c_uint = 43; -#[doc = " IPv6 fragmentation header."] -pub const IPPROTO_FRAGMENT: cty::c_uint = 44; -#[doc = " ICMPv6."] -pub const IPPROTO_ICMPV6: cty::c_uint = 58; -#[doc = " IPv6 no next header."] -pub const IPPROTO_NONE: cty::c_uint = 59; -#[doc = " IPv6 destination options."] -pub const IPPROTO_DSTOPTS: cty::c_uint = 60; -#[doc = " IPv6 mobility header."] -pub const IPPROTO_MH: cty::c_uint = 135; -pub type _bindgen_ty_7 = cty::c_uint; -#[doc = " Type to represent a port."] -pub type in_port_t = u16; -#[doc = " Echo service."] -pub const IPPORT_ECHO: cty::c_uint = 7; -#[doc = " Discard transmissions service."] -pub const IPPORT_DISCARD: cty::c_uint = 9; -#[doc = " System status service."] -pub const IPPORT_SYSTAT: cty::c_uint = 11; -#[doc = " Time of day service."] -pub const IPPORT_DAYTIME: cty::c_uint = 13; -#[doc = " Network status service."] -pub const IPPORT_NETSTAT: cty::c_uint = 15; -#[doc = " File Transfer Protocol."] -pub const IPPORT_FTP: cty::c_uint = 21; -#[doc = " Telnet protocol."] -pub const IPPORT_TELNET: cty::c_uint = 23; -#[doc = " Simple Mail Transfer Protocol."] -pub const IPPORT_SMTP: cty::c_uint = 25; -#[doc = " Timeserver service."] -pub const IPPORT_TIMESERVER: cty::c_uint = 37; -#[doc = " Domain Name Service."] -pub const IPPORT_NAMESERVER: cty::c_uint = 42; -#[doc = " Internet Whois service."] -pub const IPPORT_WHOIS: cty::c_uint = 43; -pub const IPPORT_MTP: cty::c_uint = 57; -#[doc = " Trivial File Transfer Protocol."] -pub const IPPORT_TFTP: cty::c_uint = 69; -pub const IPPORT_RJE: cty::c_uint = 77; -#[doc = " Finger service."] -pub const IPPORT_FINGER: cty::c_uint = 79; -pub const IPPORT_TTYLINK: cty::c_uint = 87; -#[doc = " SUPDUP protocol."] -pub const IPPORT_SUPDUP: cty::c_uint = 95; -#[doc = " execd service."] -pub const IPPORT_EXECSERVER: cty::c_uint = 512; -#[doc = " rlogind service."] -pub const IPPORT_LOGINSERVER: cty::c_uint = 513; -pub const IPPORT_CMDSERVER: cty::c_uint = 514; -pub const IPPORT_EFSSERVER: cty::c_uint = 520; -#[doc = " UDP ports."] -pub const IPPORT_BIFFUDP: cty::c_uint = 512; -#[doc = " UDP ports."] -pub const IPPORT_WHOSERVER: cty::c_uint = 513; -#[doc = " UDP ports."] -pub const IPPORT_ROUTESERVER: cty::c_uint = 520; -#[doc = " Ports less than this value are reserved for privileged processes."] -pub const IPPORT_RESERVED: cty::c_uint = 1024; -#[doc = " Ports greater this value are reserved for (non-privileged) servers."] -pub const IPPORT_USERRESERVED: cty::c_uint = 5000; -#[doc = " Standard well-known ports."] -pub type _bindgen_ty_8 = cty::c_uint; -#[doc = " IPv6 address"] -#[repr(C)] -#[derive(Copy, Clone)] -pub struct in6_addr { - pub __in6_u: in6_addr__bindgen_ty_1, -} -#[repr(C)] -#[derive(Copy, Clone)] -pub union in6_addr__bindgen_ty_1 { - pub __u6_addr8: [u8; 16usize], - pub __u6_addr16: [u16; 8usize], - pub __u6_addr32: [u32; 4usize], -} -#[test] -fn bindgen_test_layout_in6_addr__bindgen_ty_1() { - assert_eq!( - ::core::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(in6_addr__bindgen_ty_1)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(in6_addr__bindgen_ty_1)) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).__u6_addr8 as *const _ as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(in6_addr__bindgen_ty_1), - "::", - stringify!(__u6_addr8) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).__u6_addr16 as *const _ as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(in6_addr__bindgen_ty_1), - "::", - stringify!(__u6_addr16) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).__u6_addr32 as *const _ as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(in6_addr__bindgen_ty_1), - "::", - stringify!(__u6_addr32) - ) - ); -} -impl Default for in6_addr__bindgen_ty_1 { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[test] -fn bindgen_test_layout_in6_addr() { - assert_eq!( - ::core::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(in6_addr)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(in6_addr)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).__in6_u as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(in6_addr), - "::", - stringify!(__in6_u) - ) - ); -} -impl Default for in6_addr { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -extern "C" { - pub static in6addr_any: in6_addr; -} -extern "C" { - pub static in6addr_loopback: in6_addr; -} -#[doc = " Structure describing an Internet socket address."] -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct sockaddr_in { - pub sin_family: sa_family_t, - #[doc = " Port number."] - pub sin_port: in_port_t, - #[doc = " Internet address."] - pub sin_addr: in_addr, - #[doc = " Pad to size of `struct sockaddr'."] - pub sin_zero: [cty::c_uchar; 8usize], -} -#[test] -fn bindgen_test_layout_sockaddr_in() { - assert_eq!( - ::core::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(sockaddr_in)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(sockaddr_in)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin_family as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in), - "::", - stringify!(sin_family) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin_port as *const _ as usize }, - 2usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in), - "::", - stringify!(sin_port) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin_addr as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in), - "::", - stringify!(sin_addr) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin_zero as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in), - "::", - stringify!(sin_zero) - ) - ); -} -#[doc = " Ditto, for IPv6."] -#[repr(C)] -#[derive(Copy, Clone)] -pub struct sockaddr_in6 { - pub sin6_family: sa_family_t, - #[doc = " Transport layer port #"] - pub sin6_port: in_port_t, - #[doc = " IPv6 flow information"] - pub sin6_flowinfo: u32, - #[doc = " IPv6 address"] - pub sin6_addr: in6_addr, - #[doc = " IPv6 scope-id"] - pub sin6_scope_id: u32, -} -#[test] -fn bindgen_test_layout_sockaddr_in6() { - assert_eq!( - ::core::mem::size_of::(), - 28usize, - concat!("Size of: ", stringify!(sockaddr_in6)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(sockaddr_in6)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin6_family as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in6), - "::", - stringify!(sin6_family) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin6_port as *const _ as usize }, - 2usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in6), - "::", - stringify!(sin6_port) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin6_flowinfo as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in6), - "::", - stringify!(sin6_flowinfo) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin6_addr as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in6), - "::", - stringify!(sin6_addr) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin6_scope_id as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in6), - "::", - stringify!(sin6_scope_id) - ) - ); -} -impl Default for sockaddr_in6 { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[doc = " Likewise, for IPv6."] -#[repr(C)] -#[derive(Copy, Clone)] -pub struct ipv6_mreq { - #[doc = " IPv6 multicast address of group"] - pub ipv6mr_multiaddr: in6_addr, - #[doc = " local interface"] - pub ipv6mr_interface: cty::c_uint, -} -#[test] -fn bindgen_test_layout_ipv6_mreq() { - assert_eq!( - ::core::mem::size_of::(), - 20usize, - concat!("Size of: ", stringify!(ipv6_mreq)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(ipv6_mreq)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).ipv6mr_multiaddr as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ipv6_mreq), - "::", - stringify!(ipv6mr_multiaddr) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).ipv6mr_interface as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ipv6_mreq), - "::", - stringify!(ipv6mr_interface) - ) - ); -} -impl Default for ipv6_mreq { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -extern "C" { - #[doc = " Functions to convert between host and network byte order."] - #[doc = ""] - #[doc = "Please note that these functions normally take `unsigned long int' or"] - #[doc = "`unsigned short int' values as arguments and also return them. But"] - #[doc = "this was a short-sighted decision since on different systems the types"] - #[doc = "may have different representations but the values are always the same."] - pub fn ntohl(__netlong: u32) -> u32; -} -extern "C" { - pub fn ntohs(__netshort: u16) -> u16; -} -extern "C" { - pub fn htonl(__hostlong: u32) -> u32; -} -extern "C" { - pub fn htons(__hostshort: u16) -> u16; -} -extern "C" { - #[doc = " Get a human-readable string describing the running Notcurses version."] - pub fn notcurses_version() -> *const cty::c_char; -} -extern "C" { - #[doc = " Cannot be inline, as we want to get the versions of the actual Notcurses"] - #[doc = " library we loaded, not what we compile against."] - pub fn notcurses_version_components( - major: *mut cty::c_int, - minor: *mut cty::c_int, - patch: *mut cty::c_int, - tweak: *mut cty::c_int, - ); -} -#[repr(C)] -#[derive(Debug)] -pub struct notcurses { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncplane { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncvisual { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncuplot { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncdplot { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncprogbar { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncfdplane { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncsubproc { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncselector { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncmultiselector { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncreader { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncfadectx { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct nctablet { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncreel { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct nctab { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct nctabbed { - _unused: [u8; 0], -} -#[doc = " let the ncvisual pick"] -pub const ncblitter_e_NCBLIT_DEFAULT: ncblitter_e = 0; -#[doc = " space, compatible with ASCII"] -pub const ncblitter_e_NCBLIT_1x1: ncblitter_e = 1; -#[doc = " halves + 1x1 (space) ▄▀"] -pub const ncblitter_e_NCBLIT_2x1: ncblitter_e = 2; -#[doc = " quadrants + 2x1 ▗▐ ▖▀▟▌▙"] -pub const ncblitter_e_NCBLIT_2x2: ncblitter_e = 3; -#[doc = " sextants (*NOT* 2x2) 🬀🬁🬂🬃🬄🬅🬆🬇🬈🬉🬊🬋🬌🬍🬎🬏🬐🬑🬒🬓🬔🬕🬖🬗🬘🬙🬚🬛🬜🬝🬞"] -pub const ncblitter_e_NCBLIT_3x2: ncblitter_e = 4; -#[doc = " 4 rows, 2 cols (braille) ⡀⡄⡆⡇⢀⣀⣄⣆⣇⢠⣠⣤⣦⣧⢰⣰⣴⣶⣷⢸⣸⣼⣾⣿"] -pub const ncblitter_e_NCBLIT_BRAILLE: ncblitter_e = 5; -#[doc = " pixel graphics"] -pub const ncblitter_e_NCBLIT_PIXEL: ncblitter_e = 6; -#[doc = " four vertical levels █▆▄▂"] -pub const ncblitter_e_NCBLIT_4x1: ncblitter_e = 7; -#[doc = " eight vertical levels █▇▆▅▄▃▂▁"] -pub const ncblitter_e_NCBLIT_8x1: ncblitter_e = 8; -#[doc = " we never blit full blocks, but instead spaces (more efficient) with the"] -#[doc = " background set to the desired foreground."] -pub type ncblitter_e = cty::c_uint; -pub const ncalign_e_NCALIGN_UNALIGNED: ncalign_e = 0; -pub const ncalign_e_NCALIGN_LEFT: ncalign_e = 1; -pub const ncalign_e_NCALIGN_CENTER: ncalign_e = 2; -pub const ncalign_e_NCALIGN_RIGHT: ncalign_e = 3; -#[doc = " Alignment within a plane or terminal. Left/right-justified, or centered."] -pub type ncalign_e = cty::c_uint; -pub const ncscale_e_NCSCALE_NONE: ncscale_e = 0; -pub const ncscale_e_NCSCALE_SCALE: ncscale_e = 1; -pub const ncscale_e_NCSCALE_STRETCH: ncscale_e = 2; -pub const ncscale_e_NCSCALE_NONE_HIRES: ncscale_e = 3; -pub const ncscale_e_NCSCALE_SCALE_HIRES: ncscale_e = 4; -#[doc = " How to scale an ncvisual during rendering. NCSCALE_NONE will apply no"] -#[doc = " scaling. NCSCALE_SCALE scales a visual to the plane's size, maintaining"] -#[doc = " aspect ratio. NCSCALE_STRETCH stretches and scales the image in an"] -#[doc = " attempt to fill the entirety of the plane. NCSCALE_NONE_HIRES and"] -#[doc = " NCSCALE_SCALE_HIRES behave like their counterparts, but admit blitters"] -#[doc = " which don't preserve aspect ratio."] -pub type ncscale_e = cty::c_uint; -extern "C" { - #[doc = " Returns the number of columns occupied by a multibyte (UTF-8) string, or"] - #[doc = " -1 if a non-printable/illegal character is encountered."] - pub fn ncstrwidth(mbs: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " input functions like notcurses_getc() return ucs32-encoded char32_t. convert"] - #[doc = " a series of char32_t to utf8. result must be at least 4 bytes per input"] - #[doc = " char32_t (6 bytes per char32_t will future-proof against Unicode expansion)."] - #[doc = " the number of bytes used is returned, or -1 if passed illegal ucs32, or too"] - #[doc = " small of a buffer."] - pub fn notcurses_ucs32_to_utf8( - ucs32: *const char32_t, - ucs32count: cty::c_uint, - resultbuf: *mut cty::c_uchar, - buflen: size_t, - ) -> cty::c_int; -} -#[doc = " An nccell corresponds to a single character cell on some plane, which can be"] -#[doc = " occupied by a single grapheme cluster (some root spacing glyph, along with"] -#[doc = " possible combining characters, which might span multiple columns). At any"] -#[doc = " cell, we can have a theoretically arbitrarily long UTF-8 string, a foreground"] -#[doc = " color, a background color, and an attribute set. Valid grapheme cluster"] -#[doc = " contents include:"] -#[doc = ""] -#[doc = " * A NUL terminator,"] -#[doc = " * A single control character, followed by a NUL terminator,"] -#[doc = " * At most one spacing character, followed by zero or more nonspacing"] -#[doc = " characters, followed by a NUL terminator."] -#[doc = ""] -#[doc = " Multi-column characters can only have a single style/color throughout."] -#[doc = " Existence is suffering, and thus wcwidth() is not reliable. It's just"] -#[doc = " quoting whether or not the EGC contains a \"Wide Asian\" double-width"] -#[doc = " character. This is set for some things, like most emoji, and not set for"] -#[doc = " other things, like cuneiform. True display width is a *function of the"] -#[doc = " font and terminal*. Among the longest Unicode codepoints is"] -#[doc = ""] -#[doc = " U+FDFD ARABIC LIGATURE BISMILLAH AR-RAHMAN AR-RAHEEM ﷽"] -#[doc = ""] -#[doc = " wcwidth() rather optimistically claims this most exalted glyph to occupy"] -#[doc = " a single column. BiDi text is too complicated for me to even get into here."] -#[doc = " Be assured there are no easy answers; ours is indeed a disturbing Universe."] -#[doc = ""] -#[doc = " Each nccell occupies 16 static bytes (128 bits). The surface is thus ~1.6MB"] -#[doc = " for a (pretty large) 500x200 terminal. At 80x43, it's less than 64KB."] -#[doc = " Dynamic requirements (the egcpool) can add up to 16MB to an ncplane, but"] -#[doc = " such large pools are unlikely in common use."] -#[doc = ""] -#[doc = " We implement some small alpha compositing. Foreground and background both"] -#[doc = " have two bits of inverted alpha. The actual grapheme written to a cell is"] -#[doc = " the topmost non-zero grapheme. If its alpha is 00, its foreground color is"] -#[doc = " used unchanged. If its alpha is 10, its foreground color is derived entirely"] -#[doc = " from cells underneath it. Otherwise, the result will be a composite."] -#[doc = " Likewise for the background. If the bottom of a coordinate's zbuffer is"] -#[doc = " reached with a cumulative alpha of zero, the default is used. In this way,"] -#[doc = " a terminal configured with transparent background can be supported through"] -#[doc = " multiple occluding ncplanes. A foreground alpha of 11 requests high-contrast"] -#[doc = " text (relative to the computed background). A background alpha of 11 is"] -#[doc = " currently forbidden."] -#[doc = ""] -#[doc = " Default color takes precedence over palette or RGB, and cannot be used with"] -#[doc = " transparency. Indexed palette takes precedence over RGB. It cannot"] -#[doc = " meaningfully set transparency, but it can be mixed into a cascading color."] -#[doc = " RGB is used if neither default terminal colors nor palette indexing are in"] -#[doc = " play, and fully supports all transparency options."] -#[doc = ""] -#[doc = " This structure is exposed only so that most functions can be inlined. Do not"] -#[doc = " directly modify or access the fields of this structure; use the API."] -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct nccell { - #[doc = " 4B → 4B little endian EGC"] - pub gcluster: u32, - #[doc = " 1B → 5B (8 bits of zero)"] - pub gcluster_backstop: u8, - #[doc = " 1B → 6B (8 bits of EGC column width)"] - pub width: u8, - #[doc = " 2B → 8B (16 bits of NCSTYLE_* attributes)"] - pub stylemask: u16, - #[doc = " + 8B == 16B"] - pub channels: u64, -} -#[test] -fn bindgen_test_layout_nccell() { - assert_eq!( - ::core::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(nccell)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(nccell)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).gcluster as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(nccell), - "::", - stringify!(gcluster) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).gcluster_backstop as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(nccell), - "::", - stringify!(gcluster_backstop) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).width as *const _ as usize }, - 5usize, - concat!( - "Offset of field: ", - stringify!(nccell), - "::", - stringify!(width) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).stylemask as *const _ as usize }, - 6usize, - concat!( - "Offset of field: ", - stringify!(nccell), - "::", - stringify!(stylemask) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).channels as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(nccell), - "::", - stringify!(channels) - ) - ); -} -pub type cell = nccell; -extern "C" { - #[doc = " Breaks the UTF-8 string in 'gcluster' down, setting up the nccell 'c'."] - #[doc = " Returns the number of bytes copied out of 'gcluster', or -1 on failure. The"] - #[doc = " styling of the cell is left untouched, but any resources are released."] - pub fn cell_load(n: *mut ncplane, c: *mut nccell, gcluster: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Duplicate 'c' into 'targ'; both must be/will be bound to 'n'. Returns -1 on"] - #[doc = " failure, and 0 on success."] - pub fn cell_duplicate(n: *mut ncplane, targ: *mut nccell, c: *const nccell) -> cty::c_int; -} -extern "C" { - #[doc = " Release resources held by the nccell 'c'."] - pub fn cell_release(n: *mut ncplane, c: *mut nccell); -} -extern "C" { - #[doc = " return a pointer to the NUL-terminated EGC referenced by 'c'. this pointer"] - #[doc = " can be invalidated by any further operation on the plane 'n', so...watch out!"] - #[doc = " must not be called on a pixel graphic."] - pub fn cell_extended_gcluster(n: *const ncplane, c: *const nccell) -> *const cty::c_char; -} -#[doc = " default. print nothing once fullscreen service begins"] -pub const ncloglevel_e_NCLOGLEVEL_SILENT: ncloglevel_e = 0; -#[doc = " print diagnostics immediately related to crashing"] -pub const ncloglevel_e_NCLOGLEVEL_PANIC: ncloglevel_e = 1; -#[doc = " we're hanging around, but we've had a horrible fault"] -pub const ncloglevel_e_NCLOGLEVEL_FATAL: ncloglevel_e = 2; -#[doc = " we can't keep doing this, but we can do other things"] -pub const ncloglevel_e_NCLOGLEVEL_ERROR: ncloglevel_e = 3; -#[doc = " you probably don't want what's happening to happen"] -pub const ncloglevel_e_NCLOGLEVEL_WARNING: ncloglevel_e = 4; -#[doc = " \"standard information\""] -pub const ncloglevel_e_NCLOGLEVEL_INFO: ncloglevel_e = 5; -#[doc = " \"detailed information\""] -pub const ncloglevel_e_NCLOGLEVEL_VERBOSE: ncloglevel_e = 6; -#[doc = " this is honestly a bit much"] -pub const ncloglevel_e_NCLOGLEVEL_DEBUG: ncloglevel_e = 7; -#[doc = " there's probably a better way to do what you want"] -pub const ncloglevel_e_NCLOGLEVEL_TRACE: ncloglevel_e = 8; -#[doc = " These log levels consciously map cleanly to those of libav; Notcurses itself"] -#[doc = " does not use this full granularity. The log level does not affect the opening"] -#[doc = " and closing banners, which can be disabled via the notcurses_option struct's"] -#[doc = " 'suppress_banner'. Note that if stderr is connected to the same terminal on"] -#[doc = " which we're rendering, any kind of logging will disrupt the output."] -pub type ncloglevel_e = cty::c_uint; -#[doc = " Configuration for notcurses_init()."] -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct notcurses_options { - #[doc = " The name of the terminfo database entry describing this terminal. If NULL,"] - #[doc = " the environment variable TERM is used. Failure to open the terminal"] - #[doc = " definition will result in failure to initialize notcurses."] - pub termtype: *const cty::c_char, - #[doc = " If non-NULL, notcurses_render() will write each rendered frame to this"] - #[doc = " FILE* in addition to outfp. This is used primarily for debugging."] - pub renderfp: *mut FILE, - #[doc = " Progressively higher log levels result in more logging to stderr. By"] - #[doc = " default, nothing is printed to stderr once fullscreen service begins."] - pub loglevel: ncloglevel_e, - #[doc = " Desirable margins. If all are 0 (default), we will render to the entirety"] - #[doc = " of the screen. If the screen is too small, we do what we can--this is"] - #[doc = " strictly best-effort. Absolute coordinates are relative to the rendering"] - #[doc = " area ((0, 0) is always the origin of the rendering area)."] - pub margin_t: cty::c_int, - #[doc = " Desirable margins. If all are 0 (default), we will render to the entirety"] - #[doc = " of the screen. If the screen is too small, we do what we can--this is"] - #[doc = " strictly best-effort. Absolute coordinates are relative to the rendering"] - #[doc = " area ((0, 0) is always the origin of the rendering area)."] - pub margin_r: cty::c_int, - #[doc = " Desirable margins. If all are 0 (default), we will render to the entirety"] - #[doc = " of the screen. If the screen is too small, we do what we can--this is"] - #[doc = " strictly best-effort. Absolute coordinates are relative to the rendering"] - #[doc = " area ((0, 0) is always the origin of the rendering area)."] - pub margin_b: cty::c_int, - #[doc = " Desirable margins. If all are 0 (default), we will render to the entirety"] - #[doc = " of the screen. If the screen is too small, we do what we can--this is"] - #[doc = " strictly best-effort. Absolute coordinates are relative to the rendering"] - #[doc = " area ((0, 0) is always the origin of the rendering area)."] - pub margin_l: cty::c_int, - #[doc = " General flags; see NCOPTION_*. This is expressed as a bitfield so that"] - #[doc = " future options can be added without reshaping the struct. Undefined bits"] - #[doc = " must be set to 0."] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_notcurses_options() { - assert_eq!( - ::core::mem::size_of::(), - 48usize, - concat!("Size of: ", stringify!(notcurses_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(notcurses_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).termtype as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(notcurses_options), - "::", - stringify!(termtype) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).renderfp as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(notcurses_options), - "::", - stringify!(renderfp) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).loglevel as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(notcurses_options), - "::", - stringify!(loglevel) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).margin_t as *const _ as usize }, - 20usize, - concat!( - "Offset of field: ", - stringify!(notcurses_options), - "::", - stringify!(margin_t) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).margin_r as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(notcurses_options), - "::", - stringify!(margin_r) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).margin_b as *const _ as usize }, - 28usize, - concat!( - "Offset of field: ", - stringify!(notcurses_options), - "::", - stringify!(margin_b) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).margin_l as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(notcurses_options), - "::", - stringify!(margin_l) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(notcurses_options), - "::", - stringify!(flags) - ) - ); -} -impl Default for notcurses_options { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -extern "C" { - #[doc = " Lex a margin argument according to the standard Notcurses definition. There"] - #[doc = " can be either a single number, which will define all margins equally, or"] - #[doc = " there can be four numbers separated by commas."] - pub fn notcurses_lex_margins( - op: *const cty::c_char, - opts: *mut notcurses_options, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Lex a blitter."] - pub fn notcurses_lex_blitter(op: *const cty::c_char, blitter: *mut ncblitter_e) -> cty::c_int; -} -extern "C" { - #[doc = " Get the name of a blitter."] - pub fn notcurses_str_blitter(blitter: ncblitter_e) -> *const cty::c_char; -} -extern "C" { - #[doc = " Lex a scaling mode (one of \"none\", \"stretch\", \"scale\", \"hires\", or \"scalehi\")."] - pub fn notcurses_lex_scalemode(op: *const cty::c_char, scalemode: *mut ncscale_e) - -> cty::c_int; -} -extern "C" { - #[doc = " Get the name of a scaling mode."] - pub fn notcurses_str_scalemode(scalemode: ncscale_e) -> *const cty::c_char; -} -extern "C" { - #[doc = " Initialize a Notcurses context on the connected terminal at 'fp'. 'fp' must"] - #[doc = " be a tty. You'll usually want stdout. NULL can be supplied for 'fp', in"] - #[doc = " which case /dev/tty will be opened. Returns NULL on error, including any"] - #[doc = " failure initializing terminfo."] - pub fn notcurses_init(opts: *const notcurses_options, fp: *mut FILE) -> *mut notcurses; -} -extern "C" { - #[doc = " The same as notcurses_init(), but without any multimedia functionality,"] - #[doc = " allowing for a svelter binary. Link with notcurses-core if this is used."] - pub fn notcurses_core_init(opts: *const notcurses_options, fp: *mut FILE) -> *mut notcurses; -} -extern "C" { - #[doc = " Destroy a Notcurses context."] - pub fn notcurses_stop(nc: *mut notcurses) -> cty::c_int; -} -extern "C" { - #[doc = " Return the topmost plane of the pile containing 'n'."] - pub fn ncpile_top(n: *mut ncplane) -> *mut ncplane; -} -extern "C" { - #[doc = " Return the bottommost plane of the pile containing 'n'."] - pub fn ncpile_bottom(n: *mut ncplane) -> *mut ncplane; -} -extern "C" { - #[doc = " Renders the pile of which 'n' is a part. Rendering this pile again will blow"] - #[doc = " away the render. To actually write out the render, call ncpile_rasterize()."] - pub fn ncpile_render(n: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Make the physical screen match the last rendered frame from the pile of"] - #[doc = " which 'n' is a part. This is a blocking call. Don't call this before the"] - #[doc = " pile has been rendered (doing so will likely result in a blank screen)."] - pub fn ncpile_rasterize(n: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Renders and rasterizes the standard pile in one shot. Blocking call."] - pub fn notcurses_render(nc: *mut notcurses) -> cty::c_int; -} -extern "C" { - #[doc = " Perform the rendering and rasterization portion of notcurses_render(), but"] - #[doc = " do not write the resulting buffer out to the terminal. Using this function,"] - #[doc = " the user can control the writeout process, and render a second frame while"] - #[doc = " writing another. The returned buffer must be freed by the caller."] - pub fn notcurses_render_to_buffer( - nc: *mut notcurses, - buf: *mut *mut cty::c_char, - buflen: *mut size_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Write the last rendered frame, in its entirety, to 'fp'. If"] - #[doc = " notcurses_render() has not yet been called, nothing will be written."] - pub fn notcurses_render_to_file(nc: *mut notcurses, fp: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Return the topmost ncplane of the standard pile."] - pub fn notcurses_top(n: *mut notcurses) -> *mut ncplane; -} -extern "C" { - #[doc = " Return the bottommost ncplane of the standard pile."] - pub fn notcurses_bottom(n: *mut notcurses) -> *mut ncplane; -} -extern "C" { - #[doc = " Destroy all ncplanes other than the stdplane."] - pub fn notcurses_drop_planes(nc: *mut notcurses); -} -#[doc = " An input event. Cell coordinates are currently defined only for mouse events."] -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncinput { - #[doc = " identifier. Unicode codepoint or synthesized NCKEY event"] - pub id: char32_t, - #[doc = " y cell coordinate of event, -1 for undefined"] - pub y: cty::c_int, - #[doc = " x cell coordinate of event, -1 for undefined"] - pub x: cty::c_int, - #[doc = " was alt held?"] - pub alt: bool, - #[doc = " was shift held?"] - pub shift: bool, - #[doc = " was ctrl held?"] - pub ctrl: bool, - #[doc = " input event number"] - pub seqnum: u64, -} -#[test] -fn bindgen_test_layout_ncinput() { - assert_eq!( - ::core::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(ncinput)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncinput)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).id as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncinput), - "::", - stringify!(id) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).y as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(ncinput), - "::", - stringify!(y) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).x as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncinput), - "::", - stringify!(x) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).alt as *const _ as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(ncinput), - "::", - stringify!(alt) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).shift as *const _ as usize }, - 13usize, - concat!( - "Offset of field: ", - stringify!(ncinput), - "::", - stringify!(shift) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).ctrl as *const _ as usize }, - 14usize, - concat!( - "Offset of field: ", - stringify!(ncinput), - "::", - stringify!(ctrl) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).seqnum as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncinput), - "::", - stringify!(seqnum) - ) - ); -} -extern "C" { - #[doc = " See ppoll(2) for more detail. Provide a NULL 'ts' to block at length, a 'ts'"] - #[doc = " of 0 for non-blocking operation, and otherwise a timespec to bound blocking."] - #[doc = " Signals in sigmask (less several we handle internally) will be atomically"] - #[doc = " masked and unmasked per ppoll(2). It should generally contain all signals."] - #[doc = " Returns a single Unicode code point, or (char32_t)-1 on error. 'sigmask' may"] - #[doc = " be NULL. Returns 0 on a timeout. If an event is processed, the return value"] - #[doc = " is the 'id' field from that event. 'ni' may be NULL."] - pub fn notcurses_getc( - n: *mut notcurses, - ts: *const timespec, - sigmask: *mut sigset_t, - ni: *mut ncinput, - ) -> char32_t; -} -extern "C" { - #[doc = " Get a file descriptor suitable for input event poll()ing. When this"] - #[doc = " descriptor becomes available, you can call notcurses_getc_nblock(),"] - #[doc = " and input ought be ready. This file descriptor is *not* necessarily"] - #[doc = " the file descriptor associated with stdin (but it might be!)."] - pub fn notcurses_inputready_fd(n: *mut notcurses) -> cty::c_int; -} -extern "C" { - #[doc = " Enable the mouse in \"button-event tracking\" mode with focus detection and"] - #[doc = " UTF8-style extended coordinates. On failure, -1 is returned. On success, 0"] - #[doc = " is returned, and mouse events will be published to notcurses_getc()."] - pub fn notcurses_mouse_enable(n: *mut notcurses) -> cty::c_int; -} -extern "C" { - #[doc = " Disable mouse events. Any events in the input queue can still be delivered."] - pub fn notcurses_mouse_disable(n: *mut notcurses) -> cty::c_int; -} -extern "C" { - #[doc = " Disable signals originating from the terminal's line discipline, i.e."] - #[doc = " SIGINT (^C), SIGQUIT (^\\), and SIGTSTP (^Z). They are enabled by default."] - pub fn notcurses_linesigs_disable(n: *mut notcurses) -> cty::c_int; -} -extern "C" { - #[doc = " Restore signals originating from the terminal's line discipline, i.e."] - #[doc = " SIGINT (^C), SIGQUIT (^\\), and SIGTSTP (^Z), if disabled."] - pub fn notcurses_linesigs_enable(n: *mut notcurses) -> cty::c_int; -} -extern "C" { - #[doc = " Refresh the physical screen to match what was last rendered (i.e., without"] - #[doc = " reflecting any changes since the last call to notcurses_render()). This is"] - #[doc = " primarily useful if the screen is externally corrupted, or if an"] - #[doc = " NCKEY_RESIZE event has been read and you're not yet ready to render."] - pub fn notcurses_refresh( - n: *mut notcurses, - y: *mut cty::c_int, - x: *mut cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Extract the Notcurses context to which this plane is attached."] - pub fn ncplane_notcurses(n: *mut ncplane) -> *mut notcurses; -} -extern "C" { - pub fn ncplane_notcurses_const(n: *const ncplane) -> *const notcurses; -} -extern "C" { - #[doc = " Return the dimensions of this ncplane."] - pub fn ncplane_dim_yx(n: *const ncplane, y: *mut cty::c_int, x: *mut cty::c_int); -} -extern "C" { - #[doc = " Get a reference to the standard plane (one matching our current idea of the"] - #[doc = " terminal size) for this terminal. The standard plane always exists, and its"] - #[doc = " origin is always at the uppermost, leftmost cell of the terminal."] - pub fn notcurses_stdplane(nc: *mut notcurses) -> *mut ncplane; -} -extern "C" { - pub fn notcurses_stdplane_const(nc: *const notcurses) -> *const ncplane; -} -extern "C" { - #[doc = " Retrieve pixel geometry for the display region ('pxy', 'pxx'), each cell"] - #[doc = " ('celldimy', 'celldimx'), and the maximum displayable bitmap ('maxbmapy',"] - #[doc = " 'maxbmapx'). Note that this will call notcurses_check_pixel_support(),"] - #[doc = " possibly leading to an interrogation of the terminal. If bitmaps are not"] - #[doc = " supported, 'maxbmapy' and 'maxbmapx' will be 0. Any of the geometry"] - #[doc = " arguments may be NULL."] - pub fn ncplane_pixelgeom( - n: *mut ncplane, - pxy: *mut cty::c_int, - pxx: *mut cty::c_int, - celldimy: *mut cty::c_int, - celldimx: *mut cty::c_int, - maxbmapy: *mut cty::c_int, - maxbmapx: *mut cty::c_int, - ); -} -extern "C" { - #[doc = " Retrieve the contents of the specified cell as last rendered. Returns the EGC"] - #[doc = " or NULL on error. This EGC must be free()d by the caller. The stylemask and"] - #[doc = " channels are written to 'stylemask' and 'channels', respectively."] - pub fn notcurses_at_yx( - nc: *mut notcurses, - yoff: cty::c_int, - xoff: cty::c_int, - stylemask: *mut u16, - channels: *mut u64, - ) -> *mut cty::c_char; -} -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncplane_options { - #[doc = " vertical placement relative to parent plane"] - pub y: cty::c_int, - #[doc = " horizontal placement relative to parent plane"] - pub x: cty::c_int, - #[doc = " rows, must be positive (unless NCPLANE_OPTION_MARGINALIZED)"] - pub rows: cty::c_int, - #[doc = " columns, must be positive (unless NCPLANE_OPTION_MARGINALIZED)"] - pub cols: cty::c_int, - #[doc = " user curry, may be NULL"] - pub userptr: *mut cty::c_void, - #[doc = " name (used only for debugging), may be NULL"] - pub name: *const cty::c_char, - #[doc = " callback when parent is resized"] - pub resizecb: ::core::option::Option cty::c_int>, - #[doc = " closure over NCPLANE_OPTION_*"] - pub flags: u64, - #[doc = " margins (require NCPLANE_OPTION_MARGINALIZED)"] - pub margin_b: cty::c_int, - #[doc = " margins (require NCPLANE_OPTION_MARGINALIZED)"] - pub margin_r: cty::c_int, -} -#[test] -fn bindgen_test_layout_ncplane_options() { - assert_eq!( - ::core::mem::size_of::(), - 56usize, - concat!("Size of: ", stringify!(ncplane_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncplane_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).y as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(y) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).x as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(x) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).rows as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(rows) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).cols as *const _ as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(cols) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).userptr as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(userptr) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).name as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(name) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).resizecb as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(resizecb) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(flags) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).margin_b as *const _ as usize }, - 48usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(margin_b) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).margin_r as *const _ as usize }, - 52usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(margin_r) - ) - ); -} -impl Default for ncplane_options { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -extern "C" { - #[doc = " Create a new ncplane bound to plane 'n', at the offset 'y'x'x' (relative to"] - #[doc = " the origin of 'n') and the specified size. The number of 'rows' and 'cols'"] - #[doc = " must both be positive. This plane is initially at the top of the z-buffer,"] - #[doc = " as if ncplane_move_top() had been called on it. The void* 'userptr' can be"] - #[doc = " retrieved (and reset) later. A 'name' can be set, used in debugging."] - pub fn ncplane_create(n: *mut ncplane, nopts: *const ncplane_options) -> *mut ncplane; -} -extern "C" { - #[doc = " Same as ncplane_create(), but creates a new pile. The returned plane will"] - #[doc = " be the top, bottom, and root of this new pile."] - pub fn ncpile_create(nc: *mut notcurses, nopts: *const ncplane_options) -> *mut ncplane; -} -extern "C" { - #[doc = " This function will be removed in ABI3 in favor of ncplane_create()."] - #[doc = " It persists in ABI2 only for backwards compatibility."] - pub fn ncplane_new( - n: *mut ncplane, - rows: cty::c_int, - cols: cty::c_int, - y: cty::c_int, - x: cty::c_int, - opaque: *mut cty::c_void, - name: *const cty::c_char, - ) -> *mut ncplane; -} -extern "C" { - #[doc = " Suitable for use as a 'resizecb', this will resize the plane to the visual"] - #[doc = " region's size. It is used for the standard plane."] - pub fn ncplane_resize_maximize(n: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Suitable for use as a 'resizecb' with planes created with"] - #[doc = " NCPLANE_OPTION_MARGINALIZED. This will resize the plane 'n' against its"] - #[doc = " parent, attempting to enforce the supplied margins."] - pub fn ncplane_resize_marginalized(n: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Suitable for use as a 'resizecb'. This will realign the plane 'n' against"] - #[doc = " its parent, using the alignment specified at ncplane_create()-time."] - pub fn ncplane_resize_realign(n: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Replace the ncplane's existing resizecb with 'resizecb' (which may be NULL)."] - #[doc = " The standard plane's resizecb may not be changed."] - pub fn ncplane_set_resizecb( - n: *mut ncplane, - resizecb: ::core::option::Option cty::c_int>, - ); -} -extern "C" { - #[doc = " Returns the ncplane's current resize callback."] - pub fn ncplane_resizecb( - n: *const ncplane, - ) -> ::core::option::Option cty::c_int>; -} -extern "C" { - #[doc = " Plane 'n' will be unbound from its parent plane, and will be made a bound"] - #[doc = " child of 'newparent'. It is an error if 'n' or 'newparent' are NULL. If"] - #[doc = " 'newparent' is equal to 'n', 'n' becomes the root of a new pile, unless 'n'"] - #[doc = " is already the root of a pile, in which case this is a no-op. Returns 'n'."] - #[doc = " The standard plane cannot be reparented. Any planes bound to 'n' are"] - #[doc = " reparented to the previous parent of 'n'."] - pub fn ncplane_reparent(n: *mut ncplane, newparent: *mut ncplane) -> *mut ncplane; -} -extern "C" { - #[doc = " The same as ncplane_reparent(), except any planes bound to 'n' come along"] - #[doc = " with it to its new destination. Their z-order is maintained. If 'newparent'"] - #[doc = " is an ancestor of 'n', NULL is returned, and no changes are made."] - pub fn ncplane_reparent_family(n: *mut ncplane, newparent: *mut ncplane) -> *mut ncplane; -} -extern "C" { - #[doc = " Duplicate an existing ncplane. The new plane will have the same geometry,"] - #[doc = " will duplicate all content, and will start with the same rendering state."] - #[doc = " The new plane will be immediately above the old one on the z axis, and will"] - #[doc = " be bound to the same parent. Bound planes are *not* duplicated; the new"] - #[doc = " plane is bound to the parent of 'n', but has no bound planes."] - pub fn ncplane_dup(n: *const ncplane, opaque: *mut cty::c_void) -> *mut ncplane; -} -extern "C" { - #[doc = " provided a coordinate relative to the origin of 'src', map it to the same"] - #[doc = " absolute coordinate relative to the origin of 'dst'. either or both of 'y'"] - #[doc = " and 'x' may be NULL. if 'dst' is NULL, it is taken to be the standard plane."] - pub fn ncplane_translate( - src: *const ncplane, - dst: *const ncplane, - y: *mut cty::c_int, - x: *mut cty::c_int, - ); -} -extern "C" { - #[doc = " Fed absolute 'y'/'x' coordinates, determine whether that coordinate is"] - #[doc = " within the ncplane 'n'. If not, return false. If so, return true. Either"] - #[doc = " way, translate the absolute coordinates relative to 'n'. If the point is not"] - #[doc = " within 'n', these coordinates will not be within the dimensions of the plane."] - pub fn ncplane_translate_abs(n: *const ncplane, y: *mut cty::c_int, x: *mut cty::c_int) - -> bool; -} -extern "C" { - #[doc = " All planes are created with scrolling disabled. Scrolling can be dynamically"] - #[doc = " controlled with ncplane_set_scrolling(). Returns true if scrolling was"] - #[doc = " previously enabled, or false if it was disabled."] - pub fn ncplane_set_scrolling(n: *mut ncplane, scrollp: bool) -> bool; -} -extern "C" { - #[doc = " Returns a 16-bit bitmask of supported curses-style attributes"] - #[doc = " (NCSTYLE_UNDERLINE, NCSTYLE_BOLD, etc.) The attribute is only"] - #[doc = " indicated as supported if the terminal can support it together with color."] - #[doc = " For more information, see the \"ncv\" capability in terminfo(5)."] - pub fn notcurses_supported_styles(nc: *const notcurses) -> cty::c_uint; -} -extern "C" { - #[doc = " Returns the number of simultaneous colors claimed to be supported, or 1 if"] - #[doc = " there is no color support. Note that several terminal emulators advertise"] - #[doc = " more colors than they actually support, downsampling internally."] - pub fn notcurses_palette_size(nc: *const notcurses) -> cty::c_uint; -} -extern "C" { - #[doc = " Can we directly specify RGB values per cell, or only use palettes?"] - pub fn notcurses_cantruecolor(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " Can we fade? Fading requires either the \"rgb\" or \"ccc\" terminfo capability."] - pub fn notcurses_canfade(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " Can we set the \"hardware\" palette? Requires the \"ccc\" terminfo capability."] - pub fn notcurses_canchangecolor(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " Can we load images? This requires being built against FFmpeg/OIIO."] - pub fn notcurses_canopen_images(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " Can we load videos? This requires being built against FFmpeg."] - pub fn notcurses_canopen_videos(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " Is our encoding UTF-8? Requires LANG being set to a UTF8 locale."] - pub fn notcurses_canutf8(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " Can we reliably use Unicode 13 sextants?"] - pub fn notcurses_cansextant(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " Can we reliably use Unicode Braille?"] - pub fn notcurses_canbraille(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " This function must successfully return before NCBLIT_PIXEL is available."] - #[doc = " Returns -1 on error, 0 for no support, or 1 if pixel output is supported."] - #[doc = " Must not be called concurrently with either input or rasterization."] - pub fn notcurses_check_pixel_support(nc: *mut notcurses) -> cty::c_int; -} -#[doc = " whenever a new field is added here, ensure we add the proper rule to"] -#[doc = " notcurses_stats_reset(), so that values are preserved in the stash stats."] -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncstats { - #[doc = " successful ncpile_render() runs"] - pub renders: u64, - #[doc = " successful ncpile_rasterize() runs"] - pub writeouts: u64, - #[doc = " aborted renders, should be 0"] - pub failed_renders: u64, - #[doc = " aborted writes"] - pub failed_writeouts: u64, - #[doc = " bytes emitted to ttyfp"] - pub render_bytes: u64, - #[doc = " max bytes emitted for a frame"] - pub render_max_bytes: i64, - #[doc = " min bytes emitted for a frame"] - pub render_min_bytes: i64, - #[doc = " nanoseconds spent rendering"] - pub render_ns: u64, - #[doc = " max ns spent in render for a frame"] - pub render_max_ns: i64, - #[doc = " min ns spent in render for a frame"] - pub render_min_ns: i64, - #[doc = " nanoseconds spent writing frames to terminal"] - pub writeout_ns: u64, - #[doc = " max ns spent writing out a frame"] - pub writeout_max_ns: i64, - #[doc = " min ns spent writing out a frame"] - pub writeout_min_ns: i64, - #[doc = " cells we elided entirely thanks to damage maps"] - pub cellelisions: u64, - #[doc = " total number of cells emitted to terminal"] - pub cellemissions: u64, - #[doc = " RGB fg elision count"] - pub fgelisions: u64, - #[doc = " RGB fg emissions"] - pub fgemissions: u64, - #[doc = " RGB bg elision count"] - pub bgelisions: u64, - #[doc = " RGB bg emissions"] - pub bgemissions: u64, - #[doc = " default color was emitted"] - pub defaultelisions: u64, - #[doc = " default color was elided"] - pub defaultemissions: u64, - #[doc = " refresh requests (non-optimized redraw)"] - pub refreshes: u64, - #[doc = " total bytes devoted to all active framebuffers"] - pub fbbytes: u64, - #[doc = " number of planes currently in existence"] - pub planes: cty::c_uint, - #[doc = " nanoseconds spent rasterizing"] - pub raster_ns: u64, - #[doc = " max ns spent in raster for a frame"] - pub raster_max_ns: i64, - #[doc = " min ns spent in raster for a frame"] - pub raster_min_ns: i64, -} -#[test] -fn bindgen_test_layout_ncstats() { - assert_eq!( - ::core::mem::size_of::(), - 216usize, - concat!("Size of: ", stringify!(ncstats)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncstats)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).renders as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(renders) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).writeouts as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(writeouts) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).failed_renders as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(failed_renders) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).failed_writeouts as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(failed_writeouts) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).render_bytes as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(render_bytes) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).render_max_bytes as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(render_max_bytes) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).render_min_bytes as *const _ as usize }, - 48usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(render_min_bytes) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).render_ns as *const _ as usize }, - 56usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(render_ns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).render_max_ns as *const _ as usize }, - 64usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(render_max_ns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).render_min_ns as *const _ as usize }, - 72usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(render_min_ns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).writeout_ns as *const _ as usize }, - 80usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(writeout_ns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).writeout_max_ns as *const _ as usize }, - 88usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(writeout_max_ns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).writeout_min_ns as *const _ as usize }, - 96usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(writeout_min_ns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).cellelisions as *const _ as usize }, - 104usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(cellelisions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).cellemissions as *const _ as usize }, - 112usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(cellemissions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).fgelisions as *const _ as usize }, - 120usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(fgelisions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).fgemissions as *const _ as usize }, - 128usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(fgemissions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).bgelisions as *const _ as usize }, - 136usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(bgelisions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).bgemissions as *const _ as usize }, - 144usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(bgemissions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).defaultelisions as *const _ as usize }, - 152usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(defaultelisions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).defaultemissions as *const _ as usize }, - 160usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(defaultemissions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).refreshes as *const _ as usize }, - 168usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(refreshes) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).fbbytes as *const _ as usize }, - 176usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(fbbytes) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).planes as *const _ as usize }, - 184usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(planes) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).raster_ns as *const _ as usize }, - 192usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(raster_ns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).raster_max_ns as *const _ as usize }, - 200usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(raster_max_ns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).raster_min_ns as *const _ as usize }, - 208usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(raster_min_ns) - ) - ); -} -extern "C" { - #[doc = " Allocate an ncstats object. Use this rather than allocating your own, since"] - #[doc = " future versions of Notcurses might enlarge this structure."] - pub fn notcurses_stats_alloc(nc: *const notcurses) -> *mut ncstats; -} -extern "C" { - #[doc = " Acquire an atomic snapshot of the Notcurses object's stats."] - pub fn notcurses_stats(nc: *mut notcurses, stats: *mut ncstats); -} -extern "C" { - #[doc = " Reset all cumulative stats (immediate ones, such as fbbytes, are not reset),"] - #[doc = " first copying them into |*stats| (if |stats| is not NULL)."] - pub fn notcurses_stats_reset(nc: *mut notcurses, stats: *mut ncstats); -} -extern "C" { - #[doc = " Resize the specified ncplane. The four parameters 'keepy', 'keepx',"] - #[doc = " 'keepleny', and 'keeplenx' define a subset of the ncplane to keep,"] - #[doc = " unchanged. This may be a section of size 0, though none of these four"] - #[doc = " parameters may be negative. 'keepx' and 'keepy' are relative to the ncplane."] - #[doc = " They must specify a coordinate within the ncplane's totality. 'yoff' and"] - #[doc = " 'xoff' are relative to 'keepy' and 'keepx', and place the upper-left corner"] - #[doc = " of the resized ncplane. Finally, 'ylen' and 'xlen' are the dimensions of the"] - #[doc = " ncplane after resizing. 'ylen' must be greater than or equal to 'keepleny',"] - #[doc = " and 'xlen' must be greater than or equal to 'keeplenx'. It is an error to"] - #[doc = " attempt to resize the standard plane. If either of 'keepleny' or 'keeplenx'"] - #[doc = " is non-zero, both must be non-zero."] - #[doc = ""] - #[doc = " Essentially, the kept material does not move. It serves to anchor the"] - #[doc = " resized plane. If there is no kept material, the plane can move freely."] - pub fn ncplane_resize( - n: *mut ncplane, - keepy: cty::c_int, - keepx: cty::c_int, - keepleny: cty::c_int, - keeplenx: cty::c_int, - yoff: cty::c_int, - xoff: cty::c_int, - ylen: cty::c_int, - xlen: cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Destroy the specified ncplane. None of its contents will be visible after"] - #[doc = " the next call to notcurses_render(). It is an error to attempt to destroy"] - #[doc = " the standard plane."] - pub fn ncplane_destroy(n: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Set the ncplane's base nccell to 'c'. The base cell is used for purposes of"] - #[doc = " rendering anywhere that the ncplane's gcluster is 0. Note that the base cell"] - #[doc = " is not affected by ncplane_erase(). 'c' must not be a secondary cell from a"] - #[doc = " multicolumn EGC."] - pub fn ncplane_set_base_cell(n: *mut ncplane, c: *const nccell) -> cty::c_int; -} -extern "C" { - #[doc = " Set the ncplane's base nccell. It will be used for purposes of rendering"] - #[doc = " anywhere that the ncplane's gcluster is 0. Note that the base cell is not"] - #[doc = " affected by ncplane_erase(). 'egc' must be an extended grapheme cluster."] - pub fn ncplane_set_base( - n: *mut ncplane, - egc: *const cty::c_char, - stylemask: u32, - channels: u64, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Extract the ncplane's base nccell into 'c'. The reference is invalidated if"] - #[doc = " 'ncp' is destroyed."] - pub fn ncplane_base(n: *mut ncplane, c: *mut nccell) -> cty::c_int; -} -extern "C" { - #[doc = " Move this plane relative to the standard plane, or the plane to which it is"] - #[doc = " bound (if it is bound to a plane). It is an error to attempt to move the"] - #[doc = " standard plane."] - pub fn ncplane_move_yx(n: *mut ncplane, y: cty::c_int, x: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Get the origin of plane 'n' relative to its bound plane, or pile (if 'n' is"] - #[doc = " a root plane). To get absolute coordinates, use ncplane_abs_yx()."] - pub fn ncplane_yx(n: *const ncplane, y: *mut cty::c_int, x: *mut cty::c_int); -} -extern "C" { - pub fn ncplane_y(n: *const ncplane) -> cty::c_int; -} -extern "C" { - pub fn ncplane_x(n: *const ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Get the origin of plane 'n' relative to its pile. Either or both of 'x' and"] - #[doc = " 'y' may be NULL."] - pub fn ncplane_abs_yx(n: *const ncplane, y: *mut cty::c_int, x: *mut cty::c_int); -} -extern "C" { - pub fn ncplane_abs_y(n: *const ncplane) -> cty::c_int; -} -extern "C" { - pub fn ncplane_abs_x(n: *const ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Get the plane to which the plane 'n' is bound, if any."] - pub fn ncplane_parent(n: *mut ncplane) -> *mut ncplane; -} -extern "C" { - pub fn ncplane_parent_const(n: *const ncplane) -> *const ncplane; -} -extern "C" { - #[doc = " Splice ncplane 'n' out of the z-buffer, and reinsert it at the top or bottom."] - pub fn ncplane_move_top(n: *mut ncplane); -} -extern "C" { - pub fn ncplane_move_bottom(n: *mut ncplane); -} -extern "C" { - #[doc = " Splice ncplane 'n' out of the z-buffer, and reinsert it above 'above'."] - #[doc = " Returns non-zero if 'n' is already in the desired location. 'n' and"] - #[doc = " 'above' must not be the same plane."] - pub fn ncplane_move_above(n: *mut ncplane, above: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Splice ncplane 'n' out of the z-buffer, and reinsert it below 'below'."] - #[doc = " Returns non-zero if 'n' is already in the desired location. 'n' and"] - #[doc = " 'below' must not be the same plane."] - pub fn ncplane_move_below(n: *mut ncplane, below: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Return the plane below this one, or NULL if this is at the bottom."] - pub fn ncplane_below(n: *mut ncplane) -> *mut ncplane; -} -extern "C" { - pub fn ncplane_above(n: *mut ncplane) -> *mut ncplane; -} -extern "C" { - #[doc = " Rotate the plane π/2 radians clockwise or counterclockwise. This cannot"] - #[doc = " be performed on arbitrary planes, because glyphs cannot be arbitrarily"] - #[doc = " rotated. The glyphs which can be rotated are limited: line-drawing"] - #[doc = " characters, spaces, half blocks, and full blocks. The plane must have"] - #[doc = " an even number of columns. Use the ncvisual rotation for a more"] - #[doc = " flexible approach."] - pub fn ncplane_rotate_cw(n: *mut ncplane) -> cty::c_int; -} -extern "C" { - pub fn ncplane_rotate_ccw(n: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Retrieve the current contents of the cell under the cursor. The EGC is"] - #[doc = " returned, or NULL on error. This EGC must be free()d by the caller. The"] - #[doc = " stylemask and channels are written to 'stylemask' and 'channels', respectively."] - pub fn ncplane_at_cursor( - n: *mut ncplane, - stylemask: *mut u16, - channels: *mut u64, - ) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Retrieve the current contents of the cell under the cursor into 'c'. This"] - #[doc = " cell is invalidated if the associated plane is destroyed. Returns the number"] - #[doc = " of bytes in the EGC, or -1 on error."] - pub fn ncplane_at_cursor_cell(n: *mut ncplane, c: *mut nccell) -> cty::c_int; -} -extern "C" { - #[doc = " Retrieve the current contents of the specified cell. The EGC is returned, or"] - #[doc = " NULL on error. This EGC must be free()d by the caller. The stylemask and"] - #[doc = " channels are written to 'stylemask' and 'channels', respectively."] - pub fn ncplane_at_yx( - n: *const ncplane, - y: cty::c_int, - x: cty::c_int, - stylemask: *mut u16, - channels: *mut u64, - ) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Retrieve the current contents of the specified cell into 'c'. This cell is"] - #[doc = " invalidated if the associated plane is destroyed. Returns the number of"] - #[doc = " bytes in the EGC, or -1 on error."] - pub fn ncplane_at_yx_cell( - n: *mut ncplane, - y: cty::c_int, - x: cty::c_int, - c: *mut nccell, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Create a flat string from the EGCs of the selected region of the ncplane"] - #[doc = " 'n'. Start at the plane's 'begy'x'begx' coordinate (which must lie on the"] - #[doc = " plane), continuing for 'leny'x'lenx' cells. Either or both of 'leny' and"] - #[doc = " 'lenx' can be specified as -1 to go through the boundary of the plane."] - pub fn ncplane_contents( - n: *const ncplane, - begy: cty::c_int, - begx: cty::c_int, - leny: cty::c_int, - lenx: cty::c_int, - ) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Manipulate the opaque user pointer associated with this plane."] - #[doc = " ncplane_set_userptr() returns the previous userptr after replacing"] - #[doc = " it with 'opaque'. the others simply return the userptr."] - pub fn ncplane_set_userptr(n: *mut ncplane, opaque: *mut cty::c_void) -> *mut cty::c_void; -} -extern "C" { - pub fn ncplane_userptr(n: *mut ncplane) -> *mut cty::c_void; -} -extern "C" { - pub fn ncplane_center_abs(n: *const ncplane, y: *mut cty::c_int, x: *mut cty::c_int); -} -extern "C" { - #[doc = " Move the cursor to the specified position (the cursor needn't be visible)."] - #[doc = " Returns -1 on error, including negative parameters, or ones exceeding the"] - #[doc = " plane's dimensions."] - pub fn ncplane_cursor_move_yx(n: *mut ncplane, y: cty::c_int, x: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Move the cursor to 0, 0. Can't fail."] - pub fn ncplane_home(n: *mut ncplane); -} -extern "C" { - #[doc = " Get the current position of the cursor within n. y and/or x may be NULL."] - pub fn ncplane_cursor_yx(n: *const ncplane, y: *mut cty::c_int, x: *mut cty::c_int); -} -extern "C" { - #[doc = " Get the current channels or attribute word for ncplane 'n'."] - pub fn ncplane_channels(n: *const ncplane) -> u64; -} -extern "C" { - #[doc = " Return the current styling for this ncplane."] - pub fn ncplane_styles(n: *const ncplane) -> u16; -} -extern "C" { - #[doc = " Replace the cell at the specified coordinates with the provided cell 'c',"] - #[doc = " and advance the cursor by the width of the cell (but not past the end of the"] - #[doc = " plane). On success, returns the number of columns the cursor was advanced."] - #[doc = " 'c' must already be associated with 'n'. On failure, -1 is returned."] - pub fn ncplane_putc_yx( - n: *mut ncplane, - y: cty::c_int, - x: cty::c_int, - c: *const nccell, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Replace the EGC underneath us, but retain the styling. The current styling"] - #[doc = " of the plane will not be changed."] - pub fn ncplane_putchar_stained(n: *mut ncplane, c: cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Replace the cell at the specified coordinates with the provided EGC, and"] - #[doc = " advance the cursor by the width of the cluster (but not past the end of the"] - #[doc = " plane). On success, returns the number of columns the cursor was advanced."] - #[doc = " On failure, -1 is returned. The number of bytes converted from gclust is"] - #[doc = " written to 'sbytes' if non-NULL."] - pub fn ncplane_putegc_yx( - n: *mut ncplane, - y: cty::c_int, - x: cty::c_int, - gclust: *const cty::c_char, - sbytes: *mut cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Replace the EGC underneath us, but retain the styling. The current styling"] - #[doc = " of the plane will not be changed."] - pub fn ncplane_putegc_stained( - n: *mut ncplane, - gclust: *const cty::c_char, - sbytes: *mut cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Replace the EGC underneath us, but retain the styling. The current styling"] - #[doc = " of the plane will not be changed."] - pub fn ncplane_putwegc_stained( - n: *mut ncplane, - gclust: *const wchar_t, - sbytes: *mut cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Write a series of EGCs to the current location, using the current style."] - #[doc = " They will be interpreted as a series of columns (according to the definition"] - #[doc = " of ncplane_putc()). Advances the cursor by some positive number of columns"] - #[doc = " (though not beyond the end of the plane); this number is returned on success."] - #[doc = " On error, a non-positive number is returned, indicating the number of columns"] - #[doc = " which were written before the error."] - pub fn ncplane_putstr_yx( - n: *mut ncplane, - y: cty::c_int, - x: cty::c_int, - gclusters: *const cty::c_char, - ) -> cty::c_int; -} -extern "C" { - pub fn ncplane_putstr_aligned( - n: *mut ncplane, - y: cty::c_int, - align: ncalign_e, - s: *const cty::c_char, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Replace a string's worth of glyphs at the current cursor location, but"] - #[doc = " retain the styling. The current styling of the plane will not be changed."] - pub fn ncplane_putstr_stained(n: *mut ncplane, s: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Write a series of EGCs to the current location, using the current style."] - #[doc = " They will be interpreted as a series of columns (according to the definition"] - #[doc = " of ncplane_putc()). Advances the cursor by some positive number of columns"] - #[doc = " (though not beyond the end of the plane); this number is returned on success."] - #[doc = " On error, a non-positive number is returned, indicating the number of columns"] - #[doc = " which were written before the error. No more than 's' bytes will be written."] - pub fn ncplane_putnstr_yx( - n: *mut ncplane, - y: cty::c_int, - x: cty::c_int, - s: size_t, - gclusters: *const cty::c_char, - ) -> cty::c_int; -} -extern "C" { - pub fn ncplane_putnstr_aligned( - n: *mut ncplane, - y: cty::c_int, - align: ncalign_e, - s: size_t, - gclustarr: *const cty::c_char, - ) -> cty::c_int; -} -extern "C" { - pub fn ncplane_putwstr_stained(n: *mut ncplane, gclustarr: *const wchar_t) -> cty::c_int; -} -extern "C" { - #[doc = " The ncplane equivalents of printf(3) and vprintf(3)."] - pub fn ncplane_vprintf_aligned( - n: *mut ncplane, - y: cty::c_int, - align: ncalign_e, - format: *const cty::c_char, - ap: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - pub fn ncplane_vprintf_yx( - n: *mut ncplane, - y: cty::c_int, - x: cty::c_int, - format: *const cty::c_char, - ap: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - pub fn ncplane_vprintf_stained( - n: *mut ncplane, - format: *const cty::c_char, - ap: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Write the specified text to the plane, breaking lines sensibly, beginning at"] - #[doc = " the specified line. Returns the number of columns written. When breaking a"] - #[doc = " line, the line will be cleared to the end of the plane (the last line will"] - #[doc = " *not* be so cleared). The number of bytes written from the input is written"] - #[doc = " to '*bytes' if it is not NULL. Cleared columns are included in the return"] - #[doc = " value, but *not* included in the number of bytes written. Leaves the cursor"] - #[doc = " at the end of output. A partial write will be accomplished as far as it can;"] - #[doc = " determine whether the write completed by inspecting '*bytes'. Can output to"] - #[doc = " multiple rows even in the absence of scrolling, but not more rows than are"] - #[doc = " available. With scrolling enabled, arbitrary amounts of data can be emitted."] - #[doc = " All provided whitespace is preserved -- ncplane_puttext() followed by an"] - #[doc = " appropriate ncplane_contents() will read back the original output."] - #[doc = ""] - #[doc = " If 'y' is -1, the first row of output is taken relative to the current"] - #[doc = " cursor: it will be left-, right-, or center-aligned in whatever remains"] - #[doc = " of the row. On subsequent rows -- or if 'y' is not -1 -- the entire row can"] - #[doc = " be used, and alignment works normally."] - #[doc = ""] - #[doc = " A newline at any point will move the cursor to the next row."] - pub fn ncplane_puttext( - n: *mut ncplane, - y: cty::c_int, - align: ncalign_e, - text: *const cty::c_char, - bytes: *mut size_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Draw horizontal or vertical lines using the specified cell, starting at the"] - #[doc = " current cursor position. The cursor will end at the cell following the last"] - #[doc = " cell output (even, perhaps counter-intuitively, when drawing vertical"] - #[doc = " lines), just as if ncplane_putc() was called at that spot. Return the"] - #[doc = " number of cells drawn on success. On error, return the negative number of"] - #[doc = " cells drawn."] - pub fn ncplane_hline_interp( - n: *mut ncplane, - c: *const nccell, - len: cty::c_int, - c1: u64, - c2: u64, - ) -> cty::c_int; -} -extern "C" { - pub fn ncplane_vline_interp( - n: *mut ncplane, - c: *const nccell, - len: cty::c_int, - c1: u64, - c2: u64, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Draw a box with its upper-left corner at the current cursor position, and its"] - #[doc = " lower-right corner at 'ystop'x'xstop'. The 6 cells provided are used to draw the"] - #[doc = " upper-left, ur, ll, and lr corners, then the horizontal and vertical lines."] - #[doc = " 'ctlword' is defined in the least significant byte, where bits [7, 4] are a"] - #[doc = " gradient mask, and [3, 0] are a border mask:"] - #[doc = " * 7, 3: top"] - #[doc = " * 6, 2: right"] - #[doc = " * 5, 1: bottom"] - #[doc = " * 4, 0: left"] - #[doc = " If the gradient bit is not set, the styling from the hl/vl cells is used for"] - #[doc = " the horizontal and vertical lines, respectively. If the gradient bit is set,"] - #[doc = " the color is linearly interpolated between the two relevant corner cells."] - #[doc = ""] - #[doc = " By default, vertexes are drawn whether their connecting edges are drawn or"] - #[doc = " not. The value of the bits corresponding to NCBOXCORNER_MASK control this,"] - #[doc = " and are interpreted as the number of connecting edges necessary to draw a"] - #[doc = " given corner. At 0 (the default), corners are always drawn. At 3, corners"] - #[doc = " are never drawn (since at most 2 edges can touch a box's corner)."] - pub fn ncplane_box( - n: *mut ncplane, - ul: *const nccell, - ur: *const nccell, - ll: *const nccell, - lr: *const nccell, - hline: *const nccell, - vline: *const nccell, - ystop: cty::c_int, - xstop: cty::c_int, - ctlword: cty::c_uint, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Starting at the specified coordinate, if its glyph is different from that of"] - #[doc = " 'c', 'c' is copied into it, and the original glyph is considered the fill"] - #[doc = " target. We do the same to all cardinally-connected cells having this same"] - #[doc = " fill target. Returns the number of cells polyfilled. An invalid initial y, x"] - #[doc = " is an error. Returns the number of cells filled, or -1 on error."] - pub fn ncplane_polyfill_yx( - n: *mut ncplane, - y: cty::c_int, - x: cty::c_int, - c: *const nccell, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Draw a gradient with its upper-left corner at the current cursor position,"] - #[doc = " stopping at 'ystop'x'xstop'. The glyph composed of 'egc' and 'stylemask' is"] - #[doc = " used for all cells. The channels specified by 'ul', 'ur', 'll', and 'lr'"] - #[doc = " are composed into foreground and background gradients. To do a vertical"] - #[doc = " gradient, 'ul' ought equal 'ur' and 'll' ought equal 'lr'. To do a"] - #[doc = " horizontal gradient, 'ul' ought equal 'll' and 'ur' ought equal 'ul'. To"] - #[doc = " color everything the same, all four channels should be equivalent. The"] - #[doc = " resulting alpha values are equal to incoming alpha values. Returns the"] - #[doc = " number of cells filled on success, or -1 on failure."] - #[doc = ""] - #[doc = " Palette-indexed color is not supported."] - #[doc = ""] - #[doc = " Preconditions for gradient operations (error otherwise):"] - #[doc = ""] - #[doc = " all: only RGB colors, unless all four channels match as default"] - #[doc = " all: all alpha values must be the same"] - #[doc = " 1x1: all four colors must be the same"] - #[doc = " 1xN: both top and both bottom colors must be the same (vertical gradient)"] - #[doc = " Nx1: both left and both right colors must be the same (horizontal gradient)"] - pub fn ncplane_gradient( - n: *mut ncplane, - egc: *const cty::c_char, - stylemask: u32, - ul: u64, - ur: u64, - ll: u64, - lr: u64, - ystop: cty::c_int, - xstop: cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Do a high-resolution gradient using upper blocks and synced backgrounds."] - #[doc = " This doubles the number of vertical gradations, but restricts you to"] - #[doc = " half blocks (appearing to be full blocks). Returns the number of cells"] - #[doc = " filled on success, or -1 on error."] - pub fn ncplane_highgradient( - n: *mut ncplane, - ul: u32, - ur: u32, - ll: u32, - lr: u32, - ystop: cty::c_int, - xstop: cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " ncplane_gradent_sized() meets ncplane_highgradient()."] - pub fn ncplane_highgradient_sized( - n: *mut ncplane, - ul: u32, - ur: u32, - ll: u32, - lr: u32, - ylen: cty::c_int, - xlen: cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Set the given style throughout the specified region, keeping content and"] - #[doc = " channels unchanged. Returns the number of cells set, or -1 on failure."] - pub fn ncplane_format( - n: *mut ncplane, - ystop: cty::c_int, - xstop: cty::c_int, - stylemask: u32, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Set the given channels throughout the specified region, keeping content and"] - #[doc = " attributes unchanged. Returns the number of cells set, or -1 on failure."] - pub fn ncplane_stain( - n: *mut ncplane, - ystop: cty::c_int, - xstop: cty::c_int, - ul: u64, - ur: u64, - ll: u64, - lr: u64, - ) -> cty::c_int; -} -extern "C" { - #[doc = " If 'src' does not intersect with 'dst', 'dst' will not be changed, but it is"] - #[doc = " not an error. If 'dst' is NULL, the operation will target the standard plane."] - pub fn ncplane_mergedown_simple(src: *const ncplane, dst: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Merge the ncplane 'src' down onto the ncplane 'dst'. This is most rigorously"] - #[doc = " defined as \"write to 'dst' the frame that would be rendered were the entire"] - #[doc = " stack made up only of the specified subregion of 'src' and, below it, the"] - #[doc = " subregion of 'dst' having the specified origin. Merging is independent of"] - #[doc = " the position of 'src' viz 'dst' on the z-axis. It is an error to define a"] - #[doc = " subregion of zero area, or that is not entirely contained within 'src'. It"] - #[doc = " is an error to define a target origin such that the projected subregion is"] - #[doc = " not entirely contained within 'dst'. Behavior is undefined if 'src' and"] - #[doc = " 'dst' are equivalent. 'dst' is modified, but 'src' remains unchanged."] - pub fn ncplane_mergedown( - src: *const ncplane, - dst: *mut ncplane, - begsrcy: cty::c_int, - begsrcx: cty::c_int, - leny: cty::c_int, - lenx: cty::c_int, - dsty: cty::c_int, - dstx: cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Erase every cell in the ncplane (each cell is initialized to the null glyph"] - #[doc = " and the default channels/styles). All cells associated with this ncplane are"] - #[doc = " invalidated, and must not be used after the call, *excluding* the base cell."] - #[doc = " The cursor is homed. The plane's active attributes are unaffected."] - pub fn ncplane_erase(n: *mut ncplane); -} -extern "C" { - pub fn ncplane_set_channels(n: *mut ncplane, channels: u64); -} -extern "C" { - #[doc = " Set the specified style bits for the ncplane 'n', whether they're actively"] - #[doc = " supported or not."] - pub fn ncplane_set_styles(n: *mut ncplane, stylebits: cty::c_uint); -} -extern "C" { - #[doc = " Add the specified styles to the ncplane's existing spec."] - pub fn ncplane_on_styles(n: *mut ncplane, stylebits: cty::c_uint); -} -extern "C" { - #[doc = " Remove the specified styles from the ncplane's existing spec."] - pub fn ncplane_off_styles(n: *mut ncplane, stylebits: cty::c_uint); -} -extern "C" { - #[doc = " Deprecated forms of above."] - pub fn ncplane_styles_set(n: *mut ncplane, stylebits: cty::c_uint); -} -extern "C" { - pub fn ncplane_styles_on(n: *mut ncplane, stylebits: cty::c_uint); -} -extern "C" { - pub fn ncplane_styles_off(n: *mut ncplane, stylebits: cty::c_uint); -} -extern "C" { - #[doc = " Set an entire 32-bit channel of the plane"] - pub fn ncplane_set_fchannel(n: *mut ncplane, channel: u32) -> u64; -} -extern "C" { - pub fn ncplane_set_bchannel(n: *mut ncplane, channel: u32) -> u64; -} -extern "C" { - #[doc = " Set the current fore/background color using RGB specifications. If the"] - #[doc = " terminal does not support directly-specified 3x8b cells (24-bit \"TrueColor\","] - #[doc = " indicated by the \"RGB\" terminfo capability), the provided values will be"] - #[doc = " interpreted in some lossy fashion. None of r, g, or b may exceed 255."] - #[doc = " \"HP-like\" terminals require setting foreground and background at the same"] - #[doc = " time using \"color pairs\"; Notcurses will manage color pairs transparently."] - pub fn ncplane_set_fg_rgb8( - n: *mut ncplane, - r: cty::c_int, - g: cty::c_int, - b: cty::c_int, - ) -> cty::c_int; -} -extern "C" { - pub fn ncplane_set_bg_rgb8( - n: *mut ncplane, - r: cty::c_int, - g: cty::c_int, - b: cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Same, but clipped to [0..255]."] - pub fn ncplane_set_bg_rgb8_clipped( - n: *mut ncplane, - r: cty::c_int, - g: cty::c_int, - b: cty::c_int, - ); -} -extern "C" { - pub fn ncplane_set_fg_rgb8_clipped( - n: *mut ncplane, - r: cty::c_int, - g: cty::c_int, - b: cty::c_int, - ); -} -extern "C" { - #[doc = " Same, but with rgb assembled into a channel (i.e. lower 24 bits)."] - pub fn ncplane_set_fg_rgb(n: *mut ncplane, channel: u32) -> cty::c_int; -} -extern "C" { - pub fn ncplane_set_bg_rgb(n: *mut ncplane, channel: u32) -> cty::c_int; -} -extern "C" { - #[doc = " Use the default color for the foreground/background."] - pub fn ncplane_set_fg_default(n: *mut ncplane); -} -extern "C" { - pub fn ncplane_set_bg_default(n: *mut ncplane); -} -extern "C" { - #[doc = " Set the ncplane's foreground palette index, set the foreground palette index"] - #[doc = " bit, set it foreground-opaque, and clear the foreground default color bit."] - pub fn ncplane_set_fg_palindex(n: *mut ncplane, idx: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn ncplane_set_bg_palindex(n: *mut ncplane, idx: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Set the alpha parameters for ncplane 'n'."] - pub fn ncplane_set_fg_alpha(n: *mut ncplane, alpha: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn ncplane_set_bg_alpha(n: *mut ncplane, alpha: cty::c_int) -> cty::c_int; -} -#[doc = " Called for each fade iteration on 'ncp'. If anything but 0 is returned,"] -#[doc = " the fading operation ceases immediately, and that value is propagated out."] -#[doc = " The recommended absolute display time target is passed in 'tspec'."] -pub type fadecb = ::core::option::Option< - unsafe extern "C" fn( - nc: *mut notcurses, - n: *mut ncplane, - arg1: *const timespec, - curry: *mut cty::c_void, - ) -> cty::c_int, ->; -extern "C" { - #[doc = " Fade the ncplane out over the provided time, calling 'fader' at each"] - #[doc = " iteration. Requires a terminal which supports truecolor, or at least palette"] - #[doc = " modification (if the terminal uses a palette, our ability to fade planes is"] - #[doc = " limited, and affected by the complexity of the rest of the screen)."] - pub fn ncplane_fadeout( - n: *mut ncplane, - ts: *const timespec, - fader: fadecb, - curry: *mut cty::c_void, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Fade the ncplane in over the specified time. Load the ncplane with the"] - #[doc = " target cells without rendering, then call this function. When it's done, the"] - #[doc = " ncplane will have reached the target levels, starting from zeroes."] - pub fn ncplane_fadein( - n: *mut ncplane, - ts: *const timespec, - fader: fadecb, - curry: *mut cty::c_void, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Rather than the simple ncplane_fade{in/out}(), ncfadectx_setup() can be"] - #[doc = " paired with a loop over ncplane_fade{in/out}_iteration() + ncfadectx_free()."] - pub fn ncfadectx_setup(n: *mut ncplane) -> *mut ncfadectx; -} -extern "C" { - #[doc = " Return the number of iterations through which 'nctx' will fade."] - pub fn ncfadectx_iterations(nctx: *const ncfadectx) -> cty::c_int; -} -extern "C" { - #[doc = " Fade out through 'iter' iterations, where"] - #[doc = " 'iter' < 'ncfadectx_iterations(nctx)'."] - pub fn ncplane_fadeout_iteration( - n: *mut ncplane, - nctx: *mut ncfadectx, - iter: cty::c_int, - fader: fadecb, - curry: *mut cty::c_void, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Fade in through 'iter' iterations, where"] - #[doc = " 'iter' < 'ncfadectx_iterations(nctx)'."] - pub fn ncplane_fadein_iteration( - n: *mut ncplane, - nctx: *mut ncfadectx, - iter: cty::c_int, - fader: fadecb, - curry: *mut cty::c_void, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Pulse the plane in and out until the callback returns non-zero, relying on"] - #[doc = " the callback 'fader' to initiate rendering. 'ts' defines the half-period"] - #[doc = " (i.e. the transition from black to full brightness, or back again). Proper"] - #[doc = " use involves preparing (but not rendering) an ncplane, then calling"] - #[doc = " ncplane_pulse(), which will fade in from black to the specified colors."] - pub fn ncplane_pulse( - n: *mut ncplane, - ts: *const timespec, - fader: fadecb, - curry: *mut cty::c_void, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Release the resources associated with 'nctx'."] - pub fn ncfadectx_free(nctx: *mut ncfadectx); -} -extern "C" { - pub fn cells_rounded_box( - n: *mut ncplane, - styles: u32, - channels: u64, - ul: *mut nccell, - ur: *mut nccell, - ll: *mut nccell, - lr: *mut nccell, - hl: *mut nccell, - vl: *mut nccell, - ) -> cty::c_int; -} -extern "C" { - pub fn cells_double_box( - n: *mut ncplane, - styles: u32, - channels: u64, - ul: *mut nccell, - ur: *mut nccell, - ll: *mut nccell, - lr: *mut nccell, - hl: *mut nccell, - vl: *mut nccell, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Open a visual at 'file', extract a codec and parameters, decode the first"] - #[doc = " image to memory."] - pub fn ncvisual_from_file(file: *const cty::c_char) -> *mut ncvisual; -} -extern "C" { - #[doc = " Prepare an ncvisual, and its underlying plane, based off RGBA content in"] - #[doc = " memory at 'rgba'. 'rgba' is laid out as 'rows' lines, each of which is"] - #[doc = " 'rowstride' bytes in length. Each line has 'cols' 32-bit 8bpc RGBA pixels"] - #[doc = " followed by possible padding (there will be 'rowstride' - 'cols' * 4 bytes"] - #[doc = " of padding). The total size of 'rgba' is thus (rows * rowstride) bytes, of"] - #[doc = " which (rows * cols * 4) bytes are actual non-padding data."] - pub fn ncvisual_from_rgba( - rgba: *const cty::c_void, - rows: cty::c_int, - rowstride: cty::c_int, - cols: cty::c_int, - ) -> *mut ncvisual; -} -extern "C" { - #[doc = " ncvisual_from_rgba(), but 'bgra' is arranged as BGRA."] - pub fn ncvisual_from_bgra( - bgra: *const cty::c_void, - rows: cty::c_int, - rowstride: cty::c_int, - cols: cty::c_int, - ) -> *mut ncvisual; -} -extern "C" { - #[doc = " Promote an ncplane 'n' to an ncvisual. The plane may contain only spaces,"] - #[doc = " half blocks, and full blocks. The latter will be checked, and any other"] - #[doc = " glyph will result in a NULL being returned. This function exists so that"] - #[doc = " planes can be subjected to ncvisual transformations. If possible, it's"] - #[doc = " better to create the ncvisual from memory using ncvisual_from_rgba()."] - pub fn ncvisual_from_plane( - n: *const ncplane, - blit: ncblitter_e, - begy: cty::c_int, - begx: cty::c_int, - leny: cty::c_int, - lenx: cty::c_int, - ) -> *mut ncvisual; -} -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncvisual_options { - #[doc = " if no ncplane is provided, one will be created using the exact size"] - #[doc = " necessary to render the source with perfect fidelity (this might be"] - #[doc = " smaller or larger than the rendering area)."] - pub n: *mut ncplane, - #[doc = " the scaling is ignored if no ncplane is provided (it ought be NCSCALE_NONE"] - #[doc = " in this case). otherwise, the source is stretched/scaled relative to the"] - #[doc = " provided ncplane."] - pub scaling: ncscale_e, - #[doc = " if an ncplane is provided, y and x specify where the visual will be"] - #[doc = " rendered on that plane. otherwise, they specify where the created ncplane"] - #[doc = " will be placed relative to the standard plane's origin. x is an ncalign_e"] - #[doc = " value if NCVISUAL_OPTION_HORALIGNED is provided. y is an ncalign_e if"] - #[doc = " NCVISUAL_OPTION_VERALIGNED is provided."] - pub y: cty::c_int, - #[doc = " if an ncplane is provided, y and x specify where the visual will be"] - #[doc = " rendered on that plane. otherwise, they specify where the created ncplane"] - #[doc = " will be placed relative to the standard plane's origin. x is an ncalign_e"] - #[doc = " value if NCVISUAL_OPTION_HORALIGNED is provided. y is an ncalign_e if"] - #[doc = " NCVISUAL_OPTION_VERALIGNED is provided."] - pub x: cty::c_int, - #[doc = " origin of rendered section"] - pub begy: cty::c_int, - #[doc = " origin of rendered section"] - pub begx: cty::c_int, - #[doc = " size of rendered section"] - pub leny: cty::c_int, - #[doc = " size of rendered section"] - pub lenx: cty::c_int, - #[doc = " glyph set to use (maps input to output cells)"] - pub blitter: ncblitter_e, - #[doc = " bitmask over NCVISUAL_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncvisual_options() { - assert_eq!( - ::core::mem::size_of::(), - 48usize, - concat!("Size of: ", stringify!(ncvisual_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncvisual_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).n as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(n) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).scaling as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(scaling) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).y as *const _ as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(y) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).x as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(x) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).begy as *const _ as usize }, - 20usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(begy) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).begx as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(begx) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).leny as *const _ as usize }, - 28usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(leny) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).lenx as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(lenx) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).blitter as *const _ as usize }, - 36usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(blitter) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(flags) - ) - ); -} -impl Default for ncvisual_options { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -extern "C" { - #[doc = " Create an RGBA flat array from the selected region of the ncplane 'nc'."] - #[doc = " Start at the plane's 'begy'x'begx' coordinate (which must lie on the"] - #[doc = " plane), continuing for 'leny'x'lenx' cells. Either or both of 'leny' and"] - #[doc = " 'lenx' can be specified as -1 to go through the boundary of the plane."] - #[doc = " Only glyphs from the specified ncblitset may be present. If 'pxdimy' and/or"] - #[doc = " 'pxdimx' are non-NULL, they will be filled in with the pixel geometry."] - pub fn ncplane_as_rgba( - n: *const ncplane, - blit: ncblitter_e, - begy: cty::c_int, - begx: cty::c_int, - leny: cty::c_int, - lenx: cty::c_int, - pxdimy: *mut cty::c_int, - pxdimx: *mut cty::c_int, - ) -> *mut u32; -} -extern "C" { - #[doc = " Get the size and ratio of ncvisual pixels to output cells along the y"] - #[doc = " ('toy') and x ('tox') axes. A ncvisual of '*y'X'*x' pixels will require"] - #[doc = " ('*y' * '*toy')X('*x' * '*tox') cells for full output. Returns non-zero"] - #[doc = " for an invalid 'vopts->blitter'. Scaling is taken into consideration."] - #[doc = " The blitter that will be used is returned in '*blitter'."] - pub fn ncvisual_blitter_geom( - nc: *const notcurses, - n: *const ncvisual, - vopts: *const ncvisual_options, - y: *mut cty::c_int, - x: *mut cty::c_int, - toy: *mut cty::c_int, - tox: *mut cty::c_int, - blitter: *mut ncblitter_e, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Destroy an ncvisual. Rendered elements will not be disrupted, but the visual"] - #[doc = " can be neither decoded nor rendered any further."] - pub fn ncvisual_destroy(ncv: *mut ncvisual); -} -extern "C" { - #[doc = " extract the next frame from an ncvisual. returns 1 on end of file, 0 on"] - #[doc = " success, and -1 on failure."] - pub fn ncvisual_decode(nc: *mut ncvisual) -> cty::c_int; -} -extern "C" { - #[doc = " decode the next frame ala ncvisual_decode(), but if we have reached the end,"] - #[doc = " rewind to the first frame of the ncvisual. a subsequent 'ncvisual_render()'"] - #[doc = " will render the first frame, as if the ncvisual had been closed and reopened."] - #[doc = " the return values remain the same as those of ncvisual_decode()."] - pub fn ncvisual_decode_loop(nc: *mut ncvisual) -> cty::c_int; -} -extern "C" { - #[doc = " Rotate the visual 'rads' radians. Only M_PI/2 and -M_PI/2 are"] - #[doc = " supported at the moment, but this will change FIXME."] - pub fn ncvisual_rotate(n: *mut ncvisual, rads: f64) -> cty::c_int; -} -extern "C" { - #[doc = " Resize the visual so that it is 'rows' X 'columns'. This is a lossy"] - #[doc = " transformation, unless the size is unchanged."] - pub fn ncvisual_resize(n: *mut ncvisual, rows: cty::c_int, cols: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Polyfill at the specified location within the ncvisual 'n', using 'rgba'."] - pub fn ncvisual_polyfill_yx( - n: *mut ncvisual, - y: cty::c_int, - x: cty::c_int, - rgba: u32, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Get the specified pixel from the specified ncvisual."] - pub fn ncvisual_at_yx( - n: *const ncvisual, - y: cty::c_int, - x: cty::c_int, - pixel: *mut u32, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Set the specified pixel in the specified ncvisual."] - pub fn ncvisual_set_yx( - n: *const ncvisual, - y: cty::c_int, - x: cty::c_int, - pixel: u32, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Render the decoded frame to the specified ncplane. If one is not provided,"] - #[doc = " one will be created, having the exact size necessary to display the visual."] - #[doc = " A subregion of the visual can be rendered using 'begx', 'begy', 'lenx', and"] - #[doc = " 'leny'. Negative values for 'begy' or 'begx' are an error. It is an error to"] - #[doc = " specify any region beyond the boundaries of the frame. Returns the"] - #[doc = " (possibly newly-created) plane to which we drew."] - pub fn ncvisual_render( - nc: *mut notcurses, - ncv: *mut ncvisual, - vopts: *const ncvisual_options, - ) -> *mut ncplane; -} -extern "C" { - #[doc = " If a subtitle ought be displayed at this time, return a heap-allocated copy"] - #[doc = " of the UTF8 text."] - pub fn ncvisual_subtitle(ncv: *const ncvisual) -> *mut cty::c_char; -} -#[doc = " Called for each frame rendered from 'ncv'. If anything but 0 is returned,"] -#[doc = " the streaming operation ceases immediately, and that value is propagated out."] -#[doc = " The recommended absolute display time target is passed in 'tspec'."] -pub type ncstreamcb = ::core::option::Option< - unsafe extern "C" fn( - arg1: *mut ncvisual, - arg2: *mut ncvisual_options, - arg3: *const timespec, - arg4: *mut cty::c_void, - ) -> cty::c_int, ->; -extern "C" { - #[doc = " Shut up and display my frames! Provide as an argument to ncvisual_stream()."] - #[doc = " If you'd like subtitles to be decoded, provide an ncplane as the curry. If the"] - #[doc = " curry is NULL, subtitles will not be displayed."] - pub fn ncvisual_simple_streamer( - ncv: *mut ncvisual, - vopts: *mut ncvisual_options, - tspec: *const timespec, - curry: *mut cty::c_void, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Stream the entirety of the media, according to its own timing. Blocking,"] - #[doc = " obviously. streamer may be NULL; it is otherwise called for each frame, and"] - #[doc = " its return value handled as outlined for streamcb. If streamer() returns"] - #[doc = " non-zero, the stream is aborted, and that value is returned. By convention,"] - #[doc = " return a positive number to indicate intentional abort from within"] - #[doc = " streamer(). 'timescale' allows the frame duration time to be scaled. For a"] - #[doc = " visual naturally running at 30FPS, a 'timescale' of 0.1 will result in"] - #[doc = " 300FPS, and a 'timescale' of 10 will result in 3FPS. It is an error to"] - #[doc = " supply 'timescale' less than or equal to 0."] - pub fn ncvisual_stream( - nc: *mut notcurses, - ncv: *mut ncvisual, - timescale: f32, - streamer: ncstreamcb, - vopts: *const ncvisual_options, - curry: *mut cty::c_void, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Blit a flat array 'data' of RGBA 32-bit values to the ncplane 'vopts->n',"] - #[doc = " which mustn't be NULL. the blit begins at 'vopts->y' and 'vopts->x' relative"] - #[doc = " to the specified plane. Each source row ought occupy 'linesize' bytes (this"] - #[doc = " might be greater than 'vopts->lenx' * 4 due to padding or partial blits). A"] - #[doc = " subregion of the input can be specified with the 'begy'x'begx' and"] - #[doc = " 'leny'x'lenx' fields from 'vopts'. Returns the number of pixels blitted, or"] - #[doc = " -1 on error."] - pub fn ncblit_rgba( - data: *const cty::c_void, - linesize: cty::c_int, - vopts: *const ncvisual_options, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Same as ncblit_rgba(), but for BGRx."] - pub fn ncblit_bgrx( - data: *const cty::c_void, - linesize: cty::c_int, - vopts: *const ncvisual_options, - ) -> cty::c_int; -} -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncreel_options { - #[doc = " bitfield; 1s will not be drawn (see bordermaskbits)"] - pub bordermask: cty::c_uint, - #[doc = " attributes used for ncreel border"] - pub borderchan: u64, - #[doc = " bitfield; same as bordermask but for tablet borders"] - pub tabletmask: cty::c_uint, - #[doc = " tablet border styling channel"] - pub tabletchan: u64, - #[doc = " focused tablet border styling channel"] - pub focusedchan: u64, - #[doc = " bitfield over NCREEL_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncreel_options() { - assert_eq!( - ::core::mem::size_of::(), - 48usize, - concat!("Size of: ", stringify!(ncreel_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncreel_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).bordermask as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncreel_options), - "::", - stringify!(bordermask) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).borderchan as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncreel_options), - "::", - stringify!(borderchan) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).tabletmask as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncreel_options), - "::", - stringify!(tabletmask) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).tabletchan as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncreel_options), - "::", - stringify!(tabletchan) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).focusedchan as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncreel_options), - "::", - stringify!(focusedchan) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(ncreel_options), - "::", - stringify!(flags) - ) - ); -} -extern "C" { - #[doc = " Take over the ncplane 'nc' and use it to draw a reel according to 'popts'."] - #[doc = " The plane will be destroyed by ncreel_destroy(); this transfers ownership."] - pub fn ncreel_create(n: *mut ncplane, popts: *const ncreel_options) -> *mut ncreel; -} -extern "C" { - #[doc = " Returns the ncplane on which this ncreel lives."] - pub fn ncreel_plane(nr: *mut ncreel) -> *mut ncplane; -} -#[doc = " Tablet draw callback, provided a tablet (from which the ncplane and userptr"] -#[doc = " may be extracted), and a bool indicating whether output ought be drawn from"] -#[doc = " the top (true) or bottom (false). Returns non-negative count of output lines,"] -#[doc = " which must be less than or equal to ncplane_dim_y(nctablet_plane(t))."] -pub type tabletcb = - ::core::option::Option cty::c_int>; -extern "C" { - #[doc = " Add a new nctablet to the provided ncreel 'nr', having the callback object"] - #[doc = " 'opaque'. Neither, either, or both of 'after' and 'before' may be specified."] - #[doc = " If neither is specified, the new tablet can be added anywhere on the reel."] - #[doc = " If one or the other is specified, the tablet will be added before or after"] - #[doc = " the specified tablet. If both are specified, the tablet will be added to the"] - #[doc = " resulting location, assuming it is valid (after->next == before->prev); if"] - #[doc = " it is not valid, or there is any other error, NULL will be returned."] - pub fn ncreel_add( - nr: *mut ncreel, - after: *mut nctablet, - before: *mut nctablet, - cb: tabletcb, - opaque: *mut cty::c_void, - ) -> *mut nctablet; -} -extern "C" { - #[doc = " Return the number of nctablets in the ncreel 'nr'."] - pub fn ncreel_tabletcount(nr: *const ncreel) -> cty::c_int; -} -extern "C" { - #[doc = " Delete the tablet specified by t from the ncreel 'nr'. Returns -1 if the"] - #[doc = " tablet cannot be found."] - pub fn ncreel_del(nr: *mut ncreel, t: *mut nctablet) -> cty::c_int; -} -extern "C" { - #[doc = " Redraw the ncreel 'nr' in its entirety. The reel will be cleared, and"] - #[doc = " tablets will be lain out, using the focused tablet as a fulcrum. Tablet"] - #[doc = " drawing callbacks will be invoked for each visible tablet."] - pub fn ncreel_redraw(nr: *mut ncreel) -> cty::c_int; -} -extern "C" { - #[doc = " Offer input 'ni' to the ncreel 'nr'. If it's relevant, this function returns"] - #[doc = " true, and the input ought not be processed further. If it's irrelevant to"] - #[doc = " the reel, false is returned. Relevant inputs include:"] - #[doc = " * a mouse click on a tablet (focuses tablet)"] - #[doc = " * a mouse scrollwheel event (rolls reel)"] - #[doc = " * up, down, pgup, or pgdown (navigates among items)"] - pub fn ncreel_offer_input(nr: *mut ncreel, ni: *const ncinput) -> bool; -} -extern "C" { - #[doc = " Return the focused tablet, if any tablets are present. This is not a copy;"] - #[doc = " be careful to use it only for the duration of a critical section."] - pub fn ncreel_focused(nr: *mut ncreel) -> *mut nctablet; -} -extern "C" { - #[doc = " Change focus to the next tablet, if one exists"] - pub fn ncreel_next(nr: *mut ncreel) -> *mut nctablet; -} -extern "C" { - #[doc = " Change focus to the previous tablet, if one exists"] - pub fn ncreel_prev(nr: *mut ncreel) -> *mut nctablet; -} -extern "C" { - #[doc = " Destroy an ncreel allocated with ncreel_create()."] - pub fn ncreel_destroy(nr: *mut ncreel); -} -extern "C" { - #[doc = " Returns a pointer to a user pointer associated with this nctablet."] - pub fn nctablet_userptr(t: *mut nctablet) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Access the ncplane associated with nctablet 't', if one exists."] - pub fn nctablet_plane(t: *mut nctablet) -> *mut ncplane; -} -extern "C" { - #[doc = " Deprecated form of nctablet_plane()."] - pub fn nctablet_ncplane(t: *mut nctablet) -> *mut ncplane; -} -extern "C" { - #[doc = " Takes an arbitrarily large number, and prints it into a fixed-size buffer by"] - #[doc = " adding the necessary SI suffix. Usually, pass a |[IB]PREFIXSTRLEN+1|-sized"] - #[doc = " buffer to generate up to |[IB]PREFIXCOLUMNS| columns' worth of EGCs. The"] - #[doc = " characteristic can occupy up through |mult-1| characters (3 for 1000, 4 for"] - #[doc = " 1024). The mantissa can occupy either zero or two characters."] - #[doc = ""] - #[doc = " Floating-point is never used, because an IEEE758 double can only losslessly"] - #[doc = " represent integers through 2^53-1."] - #[doc = ""] - #[doc = " 2^64-1 is 18446744073709551615, 18.45E(xa). KMGTPEZY thus suffice to handle"] - #[doc = " an 89-bit uintmax_t. Beyond Z(etta) and Y(otta) lie lands unspecified by SI."] - #[doc = " 2^-63 is 0.000000000000000000108, 1.08a(tto)."] - #[doc = " val: value to print"] - #[doc = " decimal: scaling. '1' if none has taken place."] - #[doc = " buf: buffer in which string will be generated"] - #[doc = " omitdec: inhibit printing of all-0 decimal portions"] - #[doc = " mult: base of suffix system (almost always 1000 or 1024)"] - #[doc = " uprefix: character to print following suffix ('i' for kibibytes basically)."] - #[doc = " only printed if suffix is actually printed (input >= mult)."] - #[doc = ""] - #[doc = " You are encouraged to consult notcurses_metric(3)."] - pub fn ncmetric( - val: uintmax_t, - decimal: uintmax_t, - buf: *mut cty::c_char, - omitdec: cty::c_int, - mult: uintmax_t, - uprefix: cty::c_int, - ) -> *const cty::c_char; -} -extern "C" { - #[doc = " Enable or disable the terminal's cursor, if supported, placing it at"] - #[doc = " 'y', 'x'. Immediate effect (no need for a call to notcurses_render())."] - #[doc = " It is an error if 'y', 'x' lies outside the standard plane."] - pub fn notcurses_cursor_enable(nc: *mut notcurses, y: cty::c_int, x: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn notcurses_cursor_disable(nc: *mut notcurses) -> cty::c_int; -} -#[doc = " Palette API. Some terminals only support 256 colors, but allow the full"] -#[doc = " palette to be specified with arbitrary RGB colors. In all cases, it's more"] -#[doc = " performant to use indexed colors, since it's much less data to write to the"] -#[doc = " terminal. If you can limit yourself to 256 colors, that's probably best."] -#[repr(C)] -#[derive(Copy, Clone)] -pub struct palette256 { - #[doc = " RGB values as regular ol' channels"] - pub chans: [u32; 256usize], -} -#[test] -fn bindgen_test_layout_palette256() { - assert_eq!( - ::core::mem::size_of::(), - 1024usize, - concat!("Size of: ", stringify!(palette256)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(palette256)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).chans as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(palette256), - "::", - stringify!(chans) - ) - ); -} -impl Default for palette256 { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -extern "C" { - #[doc = " Create a new palette store. It will be initialized with notcurses' best"] - #[doc = " knowledge of the currently configured palette. The palette upon startup"] - #[doc = " cannot be reliably detected, sadly."] - pub fn palette256_new(nc: *mut notcurses) -> *mut palette256; -} -extern "C" { - #[doc = " Attempt to configure the terminal with the provided palette 'p'. Does not"] - #[doc = " transfer ownership of 'p'; palette256_free() can (ought) still be called."] - pub fn palette256_use(nc: *mut notcurses, p: *const palette256) -> cty::c_int; -} -extern "C" { - #[doc = " Free the palette store 'p'."] - pub fn palette256_free(p: *mut palette256); -} -extern "C" { - #[doc = " Convert the plane's content to greyscale."] - pub fn ncplane_greyscale(n: *mut ncplane); -} -#[doc = " selection widget -- an ncplane with a title header and a body section. the"] -#[doc = " body section supports infinite scrolling up and down."] -#[doc = ""] -#[doc = " At all times, exactly one item is selected."] -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncselector_item { - pub option: *mut cty::c_char, - pub desc: *mut cty::c_char, - #[doc = " filled in by library"] - pub opcolumns: size_t, - #[doc = " filled in by library"] - pub desccolumns: size_t, -} -#[test] -fn bindgen_test_layout_ncselector_item() { - assert_eq!( - ::core::mem::size_of::(), - 32usize, - concat!("Size of: ", stringify!(ncselector_item)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncselector_item)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).option as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncselector_item), - "::", - stringify!(option) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).desc as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncselector_item), - "::", - stringify!(desc) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).opcolumns as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncselector_item), - "::", - stringify!(opcolumns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).desccolumns as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncselector_item), - "::", - stringify!(desccolumns) - ) - ); -} -impl Default for ncselector_item { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncselector_options { - #[doc = " title may be NULL, inhibiting riser, saving two rows."] - pub title: *mut cty::c_char, - #[doc = " secondary may be NULL"] - pub secondary: *mut cty::c_char, - #[doc = " footer may be NULL"] - pub footer: *mut cty::c_char, - #[doc = " initial items and descriptions"] - pub items: *mut ncselector_item, - #[doc = " default item (selected at start), must be < itemcount unless itemcount is"] - #[doc = " 0, in which case 'defidx' must also be 0"] - pub defidx: cty::c_uint, - #[doc = " maximum number of options to display at once, 0 to use all available space"] - pub maxdisplay: cty::c_uint, - #[doc = " option channels"] - pub opchannels: u64, - #[doc = " description channels"] - pub descchannels: u64, - #[doc = " title channels"] - pub titlechannels: u64, - #[doc = " secondary and footer channels"] - pub footchannels: u64, - #[doc = " border channels"] - pub boxchannels: u64, - #[doc = " bitfield of NCSELECTOR_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncselector_options() { - assert_eq!( - ::core::mem::size_of::(), - 88usize, - concat!("Size of: ", stringify!(ncselector_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncselector_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).title as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(title) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).secondary as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(secondary) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).footer as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(footer) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).items as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(items) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).defidx as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(defidx) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).maxdisplay as *const _ as usize }, - 36usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(maxdisplay) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).opchannels as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(opchannels) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).descchannels as *const _ as usize - }, - 48usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(descchannels) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).titlechannels as *const _ as usize - }, - 56usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(titlechannels) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).footchannels as *const _ as usize - }, - 64usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(footchannels) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).boxchannels as *const _ as usize }, - 72usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(boxchannels) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 80usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(flags) - ) - ); -} -impl Default for ncselector_options { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -extern "C" { - pub fn ncselector_create(n: *mut ncplane, opts: *const ncselector_options) -> *mut ncselector; -} -extern "C" { - #[doc = " Dynamically add or delete items. It is usually sufficient to supply a static"] - #[doc = " list of items via ncselector_options->items."] - pub fn ncselector_additem(n: *mut ncselector, item: *const ncselector_item) -> cty::c_int; -} -extern "C" { - pub fn ncselector_delitem(n: *mut ncselector, item: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Return reference to the selected option, or NULL if there are no items."] - pub fn ncselector_selected(n: *const ncselector) -> *const cty::c_char; -} -extern "C" { - #[doc = " Return a reference to the ncselector's underlying ncplane."] - pub fn ncselector_plane(n: *mut ncselector) -> *mut ncplane; -} -extern "C" { - #[doc = " Move up or down in the list. A reference to the newly-selected item is"] - #[doc = " returned, or NULL if there are no items in the list."] - pub fn ncselector_previtem(n: *mut ncselector) -> *const cty::c_char; -} -extern "C" { - pub fn ncselector_nextitem(n: *mut ncselector) -> *const cty::c_char; -} -extern "C" { - #[doc = " Offer the input to the ncselector. If it's relevant, this function returns"] - #[doc = " true, and the input ought not be processed further. If it's irrelevant to"] - #[doc = " the selector, false is returned. Relevant inputs include:"] - #[doc = " * a mouse click on an item"] - #[doc = " * a mouse scrollwheel event"] - #[doc = " * a mouse click on the scrolling arrows"] - #[doc = " * up, down, pgup, or pgdown on an unrolled menu (navigates among items)"] - pub fn ncselector_offer_input(n: *mut ncselector, nc: *const ncinput) -> bool; -} -extern "C" { - #[doc = " Destroy the ncselector. If 'item' is not NULL, the last selected option will"] - #[doc = " be strdup()ed and assigned to '*item' (and must be free()d by the caller)."] - pub fn ncselector_destroy(n: *mut ncselector, item: *mut *mut cty::c_char); -} -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncmselector_item { - pub option: *mut cty::c_char, - pub desc: *mut cty::c_char, - pub selected: bool, -} -#[test] -fn bindgen_test_layout_ncmselector_item() { - assert_eq!( - ::core::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(ncmselector_item)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncmselector_item)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).option as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncmselector_item), - "::", - stringify!(option) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).desc as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncmselector_item), - "::", - stringify!(desc) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).selected as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncmselector_item), - "::", - stringify!(selected) - ) - ); -} -impl Default for ncmselector_item { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[doc = " multiselection widget -- a selector supporting multiple selections."] -#[doc = ""] -#[doc = " Unlike the selector widget, zero to all of the items can be selected, but"] -#[doc = " also the widget does not support adding or removing items at runtime."] -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncmultiselector_options { - #[doc = " title may be NULL, inhibiting riser, saving two rows."] - pub title: *mut cty::c_char, - #[doc = " secondary may be NULL"] - pub secondary: *mut cty::c_char, - #[doc = " footer may be NULL"] - pub footer: *mut cty::c_char, - #[doc = " initial items, descriptions, and statuses"] - pub items: *mut ncmselector_item, - #[doc = " maximum number of options to display at once, 0 to use all available space"] - pub maxdisplay: cty::c_uint, - #[doc = " option channels"] - pub opchannels: u64, - #[doc = " description channels"] - pub descchannels: u64, - #[doc = " title channels"] - pub titlechannels: u64, - #[doc = " secondary and footer channels"] - pub footchannels: u64, - #[doc = " border channels"] - pub boxchannels: u64, - #[doc = " bitfield of NCMULTISELECTOR_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncmultiselector_options() { - assert_eq!( - ::core::mem::size_of::(), - 88usize, - concat!("Size of: ", stringify!(ncmultiselector_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncmultiselector_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).title as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(title) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).secondary as *const _ as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(secondary) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).footer as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(footer) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).items as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(items) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).maxdisplay as *const _ as usize - }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(maxdisplay) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).opchannels as *const _ as usize - }, - 40usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(opchannels) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).descchannels as *const _ as usize - }, - 48usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(descchannels) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).titlechannels as *const _ as usize - }, - 56usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(titlechannels) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).footchannels as *const _ as usize - }, - 64usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(footchannels) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).boxchannels as *const _ as usize - }, - 72usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(boxchannels) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 80usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(flags) - ) - ); -} -impl Default for ncmultiselector_options { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -extern "C" { - pub fn ncmultiselector_create( - n: *mut ncplane, - opts: *const ncmultiselector_options, - ) -> *mut ncmultiselector; -} -extern "C" { - #[doc = " Return selected vector. An array of bools must be provided, along with its"] - #[doc = " length. If that length doesn't match the itemcount, it is an error."] - pub fn ncmultiselector_selected( - n: *mut ncmultiselector, - selected: *mut bool, - count: cty::c_uint, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Return a reference to the ncmultiselector's underlying ncplane."] - pub fn ncmultiselector_plane(n: *mut ncmultiselector) -> *mut ncplane; -} -extern "C" { - #[doc = " Offer the input to the ncmultiselector. If it's relevant, this function"] - #[doc = " returns true, and the input ought not be processed further. If it's"] - #[doc = " irrelevant to the multiselector, false is returned. Relevant inputs include:"] - #[doc = " * a mouse click on an item"] - #[doc = " * a mouse scrollwheel event"] - #[doc = " * a mouse click on the scrolling arrows"] - #[doc = " * up, down, pgup, or pgdown on an unrolled menu (navigates among items)"] - pub fn ncmultiselector_offer_input(n: *mut ncmultiselector, nc: *const ncinput) -> bool; -} -extern "C" { - #[doc = " Destroy the ncmultiselector."] - pub fn ncmultiselector_destroy(n: *mut ncmultiselector); -} -#[doc = " each item has a curry, and zero or more subitems."] -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct nctree_item { - pub curry: *mut cty::c_void, - pub subs: *mut nctree_item, - pub subcount: cty::c_uint, -} -#[test] -fn bindgen_test_layout_nctree_item() { - assert_eq!( - ::core::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(nctree_item)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(nctree_item)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).curry as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(nctree_item), - "::", - stringify!(curry) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).subs as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(nctree_item), - "::", - stringify!(subs) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).subcount as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(nctree_item), - "::", - stringify!(subcount) - ) - ); -} -impl Default for nctree_item { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct nctree_options { - #[doc = " top-level nctree_item array"] - pub items: *const nctree_item, - #[doc = " size of |items|"] - pub count: cty::c_uint, - #[doc = " item callback function"] - pub nctreecb: ::core::option::Option< - unsafe extern "C" fn( - arg1: *mut ncplane, - arg2: *mut cty::c_void, - arg3: cty::c_int, - ) -> cty::c_int, - >, - #[doc = " columns to indent per level of hierarchy"] - pub indentcols: cty::c_int, - #[doc = " bitfield of NCTREE_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_nctree_options() { - assert_eq!( - ::core::mem::size_of::(), - 40usize, - concat!("Size of: ", stringify!(nctree_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(nctree_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).items as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(nctree_options), - "::", - stringify!(items) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).count as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(nctree_options), - "::", - stringify!(count) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).nctreecb as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(nctree_options), - "::", - stringify!(nctreecb) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).indentcols as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(nctree_options), - "::", - stringify!(indentcols) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(nctree_options), - "::", - stringify!(flags) - ) - ); -} -impl Default for nctree_options { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct nctree { - _unused: [u8; 0], -} -extern "C" { - #[doc = " |opts| may *not* be NULL, since it is necessary to define a callback"] - #[doc = " function."] - pub fn nctree_create(n: *mut ncplane, opts: *const nctree_options) -> *mut nctree; -} -extern "C" { - #[doc = " Returns the ncplane on which this nctree lives."] - pub fn nctree_plane(n: *mut nctree) -> *mut ncplane; -} -extern "C" { - #[doc = " Redraw the nctree 'n' in its entirety. The tree will be cleared, and items"] - #[doc = " will be lain out, using the focused item as a fulcrum. Item-drawing"] - #[doc = " callbacks will be invoked for each visible item."] - pub fn nctree_redraw(n: *mut nctree) -> cty::c_int; -} -extern "C" { - #[doc = " Offer input 'ni' to the nctree 'n'. If it's relevant, this function returns"] - #[doc = " true, and the input ought not be processed further. If it's irrelevant to"] - #[doc = " the tree, false is returned. Relevant inputs include:"] - #[doc = " * a mouse click on an item (focuses item)"] - #[doc = " * a mouse scrollwheel event (srolls tree)"] - #[doc = " * up, down, pgup, or pgdown (navigates among items)"] - pub fn nctree_offer_input(n: *mut nctree, ni: *const ncinput) -> bool; -} -extern "C" { - #[doc = " Return the focused item, if any items are present. This is not a copy;"] - #[doc = " be careful to use it only for the duration of a critical section."] - pub fn nctree_focused(n: *mut nctree) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Change focus to the next item."] - pub fn nctree_next(n: *mut nctree) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Change focus to the previous item."] - pub fn nctree_prev(n: *mut nctree) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Go to the item specified by the array |spec|, terminated by UINT_MAX. If"] - #[doc = " the spec is invalid, NULL is returned, and the depth of the first invalid"] - #[doc = " spec is written to *|failspec|. Otherwise, the true depth is written to"] - #[doc = " *|failspec|, and the curry is returned (|failspec| is necessary because the"] - #[doc = " curry could itself be NULL)."] - pub fn nctree_goto( - n: *mut nctree, - spec: *const cty::c_uint, - failspec: *mut cty::c_int, - ) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Destroy the nctree."] - pub fn nctree_destroy(n: *mut nctree); -} -#[doc = " Menus. Horizontal menu bars are supported, on the top and/or bottom rows."] -#[doc = " If the menu bar is longer than the screen, it will be only partially"] -#[doc = " visible. Menus may be either visible or invisible by default. In the event of"] -#[doc = " a screen resize, menus will be automatically moved/resized. Elements can be"] -#[doc = " dynamically enabled or disabled at all levels (menu, section, and item),"] -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncmenu_item { - #[doc = " utf-8 menu item, NULL for horizontal separator"] - pub desc: *mut cty::c_char, - #[doc = " shortcut, all should be distinct"] - pub shortcut: ncinput, -} -#[test] -fn bindgen_test_layout_ncmenu_item() { - assert_eq!( - ::core::mem::size_of::(), - 32usize, - concat!("Size of: ", stringify!(ncmenu_item)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncmenu_item)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).desc as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_item), - "::", - stringify!(desc) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).shortcut as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_item), - "::", - stringify!(shortcut) - ) - ); -} -impl Default for ncmenu_item { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncmenu_section { - #[doc = " utf-8 c string"] - pub name: *mut cty::c_char, - pub itemcount: cty::c_int, - pub items: *mut ncmenu_item, - #[doc = " shortcut, will be underlined if present in name"] - pub shortcut: ncinput, -} -#[test] -fn bindgen_test_layout_ncmenu_section() { - assert_eq!( - ::core::mem::size_of::(), - 48usize, - concat!("Size of: ", stringify!(ncmenu_section)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncmenu_section)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).name as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_section), - "::", - stringify!(name) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).itemcount as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_section), - "::", - stringify!(itemcount) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).items as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_section), - "::", - stringify!(items) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).shortcut as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_section), - "::", - stringify!(shortcut) - ) - ); -} -impl Default for ncmenu_section { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncmenu_options { - #[doc = " array of 'sectioncount' menu_sections"] - pub sections: *mut ncmenu_section, - #[doc = " must be positive"] - pub sectioncount: cty::c_int, - #[doc = " styling for header"] - pub headerchannels: u64, - #[doc = " styling for sections"] - pub sectionchannels: u64, - #[doc = " flag word of NCMENU_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncmenu_options() { - assert_eq!( - ::core::mem::size_of::(), - 40usize, - concat!("Size of: ", stringify!(ncmenu_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncmenu_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sections as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_options), - "::", - stringify!(sections) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sectioncount as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_options), - "::", - stringify!(sectioncount) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).headerchannels as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_options), - "::", - stringify!(headerchannels) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sectionchannels as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_options), - "::", - stringify!(sectionchannels) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_options), - "::", - stringify!(flags) - ) - ); -} -impl Default for ncmenu_options { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[repr(C)] -#[derive(Debug)] -pub struct ncmenu { - _unused: [u8; 0], -} -extern "C" { - #[doc = " Create a menu with the specified options. Menus are currently bound to an"] - #[doc = " overall Notcurses object (as opposed to a particular plane), and are"] - #[doc = " implemented as ncplanes kept atop other ncplanes."] - pub fn ncmenu_create(n: *mut ncplane, opts: *const ncmenu_options) -> *mut ncmenu; -} -extern "C" { - #[doc = " Unroll the specified menu section, making the menu visible if it was"] - #[doc = " invisible, and rolling up any menu section that is already unrolled."] - pub fn ncmenu_unroll(n: *mut ncmenu, sectionidx: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Roll up any unrolled menu section, and hide the menu if using hiding."] - pub fn ncmenu_rollup(n: *mut ncmenu) -> cty::c_int; -} -extern "C" { - #[doc = " Unroll the previous/next section (relative to current unrolled). If no"] - #[doc = " section is unrolled, the first section will be unrolled."] - pub fn ncmenu_nextsection(n: *mut ncmenu) -> cty::c_int; -} -extern "C" { - pub fn ncmenu_prevsection(n: *mut ncmenu) -> cty::c_int; -} -extern "C" { - #[doc = " Move to the previous/next item within the currently unrolled section. If no"] - #[doc = " section is unrolled, the first section will be unrolled."] - pub fn ncmenu_nextitem(n: *mut ncmenu) -> cty::c_int; -} -extern "C" { - pub fn ncmenu_previtem(n: *mut ncmenu) -> cty::c_int; -} -extern "C" { - #[doc = " Disable or enable a menu item. Returns 0 if the item was found."] - pub fn ncmenu_item_set_status( - n: *mut ncmenu, - section: *const cty::c_char, - item: *const cty::c_char, - enabled: bool, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Return the selected item description, or NULL if no section is unrolled. If"] - #[doc = " 'ni' is not NULL, and the selected item has a shortcut, 'ni' will be filled"] - #[doc = " in with that shortcut--this can allow faster matching."] - pub fn ncmenu_selected(n: *const ncmenu, ni: *mut ncinput) -> *const cty::c_char; -} -extern "C" { - #[doc = " Return the item description corresponding to the mouse click 'click'. The"] - #[doc = " item must be on an actively unrolled section, and the click must be in the"] - #[doc = " area of a valid item. If 'ni' is not NULL, and the selected item has a"] - #[doc = " shortcut, 'ni' will be filled in with the shortcut."] - pub fn ncmenu_mouse_selected( - n: *const ncmenu, - click: *const ncinput, - ni: *mut ncinput, - ) -> *const cty::c_char; -} -extern "C" { - #[doc = " Return the ncplane backing this ncmenu."] - pub fn ncmenu_plane(n: *mut ncmenu) -> *mut ncplane; -} -extern "C" { - #[doc = " Offer the input to the ncmenu. If it's relevant, this function returns true,"] - #[doc = " and the input ought not be processed further. If it's irrelevant to the"] - #[doc = " menu, false is returned. Relevant inputs include:"] - #[doc = " * mouse movement over a hidden menu"] - #[doc = " * a mouse click on a menu section (the section is unrolled)"] - #[doc = " * a mouse click outside of an unrolled menu (the menu is rolled up)"] - #[doc = " * left or right on an unrolled menu (navigates among sections)"] - #[doc = " * up or down on an unrolled menu (navigates among items)"] - #[doc = " * escape on an unrolled menu (the menu is rolled up)"] - pub fn ncmenu_offer_input(n: *mut ncmenu, nc: *const ncinput) -> bool; -} -extern "C" { - #[doc = " Destroy a menu created with ncmenu_create()."] - pub fn ncmenu_destroy(n: *mut ncmenu) -> cty::c_int; -} -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncprogbar_options { - #[doc = " upper-left channel. in the context of a progress bar,"] - pub ulchannel: u32, - #[doc = " \"up\" is the direction we are progressing towards, and"] - pub urchannel: u32, - #[doc = " \"bottom\" is the direction of origin. for monochromatic"] - pub blchannel: u32, - #[doc = " bar, all four channels ought be the same."] - pub brchannel: u32, - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncprogbar_options() { - assert_eq!( - ::core::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(ncprogbar_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncprogbar_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).ulchannel as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncprogbar_options), - "::", - stringify!(ulchannel) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).urchannel as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(ncprogbar_options), - "::", - stringify!(urchannel) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).blchannel as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncprogbar_options), - "::", - stringify!(blchannel) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).brchannel as *const _ as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(ncprogbar_options), - "::", - stringify!(brchannel) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncprogbar_options), - "::", - stringify!(flags) - ) - ); -} -extern "C" { - #[doc = " Takes ownership of the ncplane 'n', which will be destroyed by"] - #[doc = " ncprogbar_destroy(). The progress bar is initially at 0%."] - pub fn ncprogbar_create(n: *mut ncplane, opts: *const ncprogbar_options) -> *mut ncprogbar; -} -extern "C" { - #[doc = " Return a reference to the ncprogbar's underlying ncplane."] - pub fn ncprogbar_plane(n: *mut ncprogbar) -> *mut ncplane; -} -extern "C" { - #[doc = " Set the progress bar's completion, a double 0 <= 'p' <= 1."] - pub fn ncprogbar_set_progress(n: *mut ncprogbar, p: f64) -> cty::c_int; -} -extern "C" { - #[doc = " Get the progress bar's completion, a double on [0, 1]."] - pub fn ncprogbar_progress(n: *const ncprogbar) -> f64; -} -extern "C" { - #[doc = " Destroy the progress bar and its underlying ncplane."] - pub fn ncprogbar_destroy(n: *mut ncprogbar); -} -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct nctabbed_options { - #[doc = " channel for the selected tab header"] - pub selchan: u64, - #[doc = " channel for unselected tab headers"] - pub hdrchan: u64, - #[doc = " channel for the tab separator"] - pub sepchan: u64, - #[doc = " separator string (copied by nctabbed_create())"] - pub separator: *mut cty::c_char, - #[doc = " bitmask of NCTABBED_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_nctabbed_options() { - assert_eq!( - ::core::mem::size_of::(), - 40usize, - concat!("Size of: ", stringify!(nctabbed_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(nctabbed_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).selchan as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(nctabbed_options), - "::", - stringify!(selchan) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).hdrchan as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(nctabbed_options), - "::", - stringify!(hdrchan) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sepchan as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(nctabbed_options), - "::", - stringify!(sepchan) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).separator as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(nctabbed_options), - "::", - stringify!(separator) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(nctabbed_options), - "::", - stringify!(flags) - ) - ); -} -impl Default for nctabbed_options { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[doc = " Tab content drawing callback. Takes the tab it was associated to, the ncplane"] -#[doc = " on which tab content is to be drawn, and the user pointer of the tab."] -#[doc = " It is called during nctabbed_redraw()."] -pub type tabcb = ::core::option::Option< - unsafe extern "C" fn(t: *mut nctab, ncp: *mut ncplane, curry: *mut cty::c_void), ->; -extern "C" { - #[doc = " Creates a new nctabbed widget, associated with the given ncplane 'n', and with"] - #[doc = " additional options given in 'opts'. When 'opts' is NULL, it acts as if it were"] - #[doc = " called with an all-zero opts. The widget takes ownership of 'n', and destroys"] - #[doc = " it when the widget is destroyed. Returns the newly created widget. Returns"] - #[doc = " NULL on failure, also destroying 'n'."] - pub fn nctabbed_create(n: *mut ncplane, opts: *const nctabbed_options) -> *mut nctabbed; -} -extern "C" { - #[doc = " Destroy an nctabbed widget. All memory belonging to 'nt' is deallocated,"] - #[doc = " including all tabs and their names. The plane associated with 'nt' is also"] - #[doc = " destroyed. Calling this with NULL does nothing."] - pub fn nctabbed_destroy(nt: *mut nctabbed); -} -extern "C" { - #[doc = " Redraw the widget. This calls the tab callback of the currently selected tab"] - #[doc = " to draw tab contents, and draws tab headers. The tab content plane is not"] - #[doc = " modified by this function, apart from resizing the plane is necessary."] - pub fn nctabbed_redraw(nt: *mut nctabbed); -} -extern "C" { - #[doc = " Make sure the tab header of the currently selected tab is at least partially"] - #[doc = " visible. (by rotating tabs until at least one column is displayed)"] - #[doc = " Does nothing if there are no tabs."] - pub fn nctabbed_ensure_selected_header_visible(nt: *mut nctabbed); -} -extern "C" { - #[doc = " Returns the currently selected tab, or NULL if there are no tabs."] - pub fn nctabbed_selected(nt: *mut nctabbed) -> *mut nctab; -} -extern "C" { - #[doc = " Returns the leftmost tab, or NULL if there are no tabs."] - pub fn nctabbed_leftmost(nt: *mut nctabbed) -> *mut nctab; -} -extern "C" { - #[doc = " Returns the number of tabs in the widget."] - pub fn nctabbed_tabcount(nt: *mut nctabbed) -> cty::c_int; -} -extern "C" { - #[doc = " Returns the plane associated to 'nt'."] - pub fn nctabbed_plane(nt: *mut nctabbed) -> *mut ncplane; -} -extern "C" { - #[doc = " Returns the tab content plane."] - pub fn nctabbed_content_plane(nt: *mut nctabbed) -> *mut ncplane; -} -extern "C" { - #[doc = " Returns the tab callback."] - pub fn nctab_cb(t: *mut nctab) -> tabcb; -} -extern "C" { - #[doc = " Returns the tab name. This is not a copy and it should not be stored."] - pub fn nctab_name(t: *mut nctab) -> *const cty::c_char; -} -extern "C" { - #[doc = " Returns the width (in columns) of the tab's name."] - pub fn nctab_name_width(t: *mut nctab) -> cty::c_int; -} -extern "C" { - #[doc = " Returns the tab's user pointer."] - pub fn nctab_userptr(t: *mut nctab) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Returns the tab to the right of 't'. This does not change which tab is selected."] - pub fn nctab_next(t: *mut nctab) -> *mut nctab; -} -extern "C" { - #[doc = " Returns the tab to the left of 't'. This does not change which tab is selected."] - pub fn nctab_prev(t: *mut nctab) -> *mut nctab; -} -extern "C" { - #[doc = " Add a new tab to 'nt' with the given tab callback, name, and user pointer."] - #[doc = " If both 'before' and 'after' are NULL, the tab is inserted after the selected"] - #[doc = " tab. Otherwise, it gets put after 'after' (if not NULL) and before 'before'"] - #[doc = " (if not NULL). If both 'after' and 'before' are given, they must be two"] - #[doc = " neighboring tabs (the tab list is circular, so the last tab is immediately"] - #[doc = " before the leftmost tab), otherwise the function returns NULL. If 'name' is"] - #[doc = " NULL or a string containing illegal characters, the function returns NULL."] - #[doc = " On all other failures the function also returns NULL. If it returns NULL,"] - #[doc = " none of the arguments are modified, and the widget state is not altered."] - pub fn nctabbed_add( - nt: *mut nctabbed, - after: *mut nctab, - before: *mut nctab, - tcb: tabcb, - name: *const cty::c_char, - opaque: *mut cty::c_void, - ) -> *mut nctab; -} -extern "C" { - #[doc = " Remove a tab 't' from 'nt'. Its neighboring tabs become neighbors to each"] - #[doc = " other. If 't' if the selected tab, the tab after 't' becomes selected."] - #[doc = " Likewise if 't' is the leftmost tab, the tab after 't' becomes leftmost."] - #[doc = " If 't' is the only tab, there will no more be a selected or leftmost tab,"] - #[doc = " until a new tab is added. Returns -1 if 't' is NULL, and 0 otherwise."] - pub fn nctabbed_del(nt: *mut nctabbed, t: *mut nctab) -> cty::c_int; -} -extern "C" { - #[doc = " Move 't' after 'after' (if not NULL) and before 'before' (if not NULL)."] - #[doc = " If both 'after' and 'before' are NULL, the function returns -1, otherwise"] - #[doc = " it returns 0."] - pub fn nctab_move( - nt: *mut nctabbed, - t: *mut nctab, - after: *mut nctab, - before: *mut nctab, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Move 't' to the right by one tab, looping around to become leftmost if needed."] - pub fn nctab_move_right(nt: *mut nctabbed, t: *mut nctab); -} -extern "C" { - #[doc = " Move 't' to the right by one tab, looping around to become the last tab if needed."] - pub fn nctab_move_left(nt: *mut nctabbed, t: *mut nctab); -} -extern "C" { - #[doc = " Rotate the tabs of 'nt' right by 'amt' tabs, or '-amt' tabs left if 'amt' is"] - #[doc = " negative. Tabs are rotated only by changing the leftmost tab; the selected tab"] - #[doc = " stays the same. If there are no tabs, nothing happens."] - pub fn nctabbed_rotate(nt: *mut nctabbed, amt: cty::c_int); -} -extern "C" { - #[doc = " Select the tab after the currently selected tab, and return the newly selected"] - #[doc = " tab. Returns NULL if there are no tabs."] - pub fn nctabbed_next(nt: *mut nctabbed) -> *mut nctab; -} -extern "C" { - #[doc = " Select the tab before the currently selected tab, and return the newly selected"] - #[doc = " tab. Returns NULL if there are no tabs."] - pub fn nctabbed_prev(nt: *mut nctabbed) -> *mut nctab; -} -extern "C" { - #[doc = " Change the selected tab to be 't'. Returns the previously selected tab."] - pub fn nctabbed_select(nt: *mut nctabbed, t: *mut nctab) -> *mut nctab; -} -extern "C" { - #[doc = " Write the channels for tab headers, the selected tab header, and the separator"] - #[doc = " to '*hdrchan', '*selchan', and '*sepchan' respectively."] - pub fn nctabbed_channels( - nt: *mut nctabbed, - hdrchan: *mut u64, - selchan: *mut u64, - sepchan: *mut u64, - ); -} -extern "C" { - #[doc = " Returns the tab separator. This is not a copy and it should not be stored."] - #[doc = " This can be NULL, if the separator was set to NULL in ncatbbed_create() or"] - #[doc = " nctabbed_set_separator()."] - pub fn nctabbed_separator(nt: *mut nctabbed) -> *const cty::c_char; -} -extern "C" { - #[doc = " Returns the tab separator width, or zero if there is no separator."] - pub fn nctabbed_separator_width(nt: *mut nctabbed) -> cty::c_int; -} -extern "C" { - #[doc = " Set the tab headers channel for 'nt'."] - pub fn nctabbed_set_hdrchan(nt: *mut nctabbed, chan: u64); -} -extern "C" { - #[doc = " Set the selected tab header channel for 'nt'."] - pub fn nctabbed_set_selchan(nt: *mut nctabbed, chan: u64); -} -extern "C" { - #[doc = " Set the tab separator channel for 'nt'."] - pub fn nctabbed_set_sepchan(nt: *mut nctabbed, chan: u64); -} -extern "C" { - #[doc = " Set the tab callback function for 't'. Returns the previous tab callback."] - pub fn nctab_set_cb(t: *mut nctab, newcb: tabcb) -> tabcb; -} -extern "C" { - #[doc = " Change the name of 't'. Returns -1 if 'newname' is NULL, and 0 otherwise."] - pub fn nctab_set_name(t: *mut nctab, newname: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Set the user pointer of 't'. Returns the previous user pointer."] - pub fn nctab_set_userptr(t: *mut nctab, newopaque: *mut cty::c_void) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Change the tab separator for 'nt'. Returns -1 if 'separator' is not NULL and"] - #[doc = " is not a valid string, and 0 otherwise."] - pub fn nctabbed_set_separator(nt: *mut nctabbed, separator: *const cty::c_char) -> cty::c_int; -} -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncplot_options { - #[doc = " channels for the maximum and minimum levels. linear or exponential"] - #[doc = " interpolation will be applied across the domain between these two."] - pub maxchannels: u64, - pub minchannels: u64, - #[doc = " styling used for the legend, if NCPLOT_OPTION_LABELTICKSD is set"] - pub legendstyle: u16, - #[doc = " number of \"pixels\" per row x column"] - pub gridtype: ncblitter_e, - #[doc = " independent variable can either be a contiguous range, or a finite set"] - #[doc = " of keys. for a time range, say the previous hour sampled with second"] - #[doc = " resolution, the independent variable would be the range [0..3600): 3600."] - #[doc = " if rangex is 0, it is dynamically set to the number of columns."] - pub rangex: cty::c_int, - #[doc = " optional, printed by the labels"] - pub title: *const cty::c_char, - #[doc = " bitfield over NCPLOT_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncplot_options() { - assert_eq!( - ::core::mem::size_of::(), - 48usize, - concat!("Size of: ", stringify!(ncplot_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncplot_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).maxchannels as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncplot_options), - "::", - stringify!(maxchannels) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).minchannels as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncplot_options), - "::", - stringify!(minchannels) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).legendstyle as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncplot_options), - "::", - stringify!(legendstyle) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).gridtype as *const _ as usize }, - 20usize, - concat!( - "Offset of field: ", - stringify!(ncplot_options), - "::", - stringify!(gridtype) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).rangex as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncplot_options), - "::", - stringify!(rangex) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).title as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncplot_options), - "::", - stringify!(title) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(ncplot_options), - "::", - stringify!(flags) - ) - ); -} -impl Default for ncplot_options { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -extern "C" { - #[doc = " Use the provided plane 'n' for plotting according to the options 'opts'. The"] - #[doc = " plot will make free use of the entirety of the plane. For domain"] - #[doc = " autodiscovery, set miny == maxy == 0. ncuplot holds uint64_ts, while"] - #[doc = " ncdplot holds doubles."] - pub fn ncuplot_create( - n: *mut ncplane, - opts: *const ncplot_options, - miny: u64, - maxy: u64, - ) -> *mut ncuplot; -} -extern "C" { - pub fn ncdplot_create( - n: *mut ncplane, - opts: *const ncplot_options, - miny: f64, - maxy: f64, - ) -> *mut ncdplot; -} -extern "C" { - #[doc = " Return a reference to the ncplot's underlying ncplane."] - pub fn ncuplot_plane(n: *mut ncuplot) -> *mut ncplane; -} -extern "C" { - pub fn ncdplot_plane(n: *mut ncdplot) -> *mut ncplane; -} -extern "C" { - #[doc = " Add to or set the value corresponding to this x. If x is beyond the current"] - #[doc = " x window, the x window is advanced to include x, and values passing beyond"] - #[doc = " the window are lost. The first call will place the initial window. The plot"] - #[doc = " will be redrawn, but notcurses_render() is not called."] - pub fn ncuplot_add_sample(n: *mut ncuplot, x: u64, y: u64) -> cty::c_int; -} -extern "C" { - pub fn ncdplot_add_sample(n: *mut ncdplot, x: u64, y: f64) -> cty::c_int; -} -extern "C" { - pub fn ncuplot_set_sample(n: *mut ncuplot, x: u64, y: u64) -> cty::c_int; -} -extern "C" { - pub fn ncdplot_set_sample(n: *mut ncdplot, x: u64, y: f64) -> cty::c_int; -} -extern "C" { - pub fn ncuplot_sample(n: *const ncuplot, x: u64, y: *mut u64) -> cty::c_int; -} -extern "C" { - pub fn ncdplot_sample(n: *const ncdplot, x: u64, y: *mut f64) -> cty::c_int; -} -extern "C" { - pub fn ncuplot_destroy(n: *mut ncuplot); -} -extern "C" { - pub fn ncdplot_destroy(n: *mut ncdplot); -} -pub type ncfdplane_callback = ::core::option::Option< - unsafe extern "C" fn( - n: *mut ncfdplane, - buf: *const cty::c_void, - s: size_t, - curry: *mut cty::c_void, - ) -> cty::c_int, ->; -pub type ncfdplane_done_cb = ::core::option::Option< - unsafe extern "C" fn( - n: *mut ncfdplane, - fderrno: cty::c_int, - curry: *mut cty::c_void, - ) -> cty::c_int, ->; -#[doc = " read from an fd until EOF (or beyond, if follow is set), invoking the user's"] -#[doc = " callback each time. runs in its own context. on EOF or error, the finalizer"] -#[doc = " callback will be invoked, and the user ought destroy the ncfdplane. the"] -#[doc = " data is *not* guaranteed to be nul-terminated, and may contain arbitrary"] -#[doc = " zeroes."] -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncfdplane_options { - #[doc = " parameter provided to callbacks"] - pub curry: *mut cty::c_void, - #[doc = " keep reading after hitting end? (think tail -f)"] - pub follow: bool, - #[doc = " bitfield over NCOPTION_FDPLANE_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncfdplane_options() { - assert_eq!( - ::core::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(ncfdplane_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncfdplane_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).curry as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncfdplane_options), - "::", - stringify!(curry) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).follow as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncfdplane_options), - "::", - stringify!(follow) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncfdplane_options), - "::", - stringify!(flags) - ) - ); -} -impl Default for ncfdplane_options { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -extern "C" { - #[doc = " Create an ncfdplane around the fd 'fd'. Consider this function to take"] - #[doc = " ownership of the file descriptor, which will be closed in ncfdplane_destroy()."] - pub fn ncfdplane_create( - n: *mut ncplane, - opts: *const ncfdplane_options, - fd: cty::c_int, - cbfxn: ncfdplane_callback, - donecbfxn: ncfdplane_done_cb, - ) -> *mut ncfdplane; -} -extern "C" { - pub fn ncfdplane_plane(n: *mut ncfdplane) -> *mut ncplane; -} -extern "C" { - pub fn ncfdplane_destroy(n: *mut ncfdplane) -> cty::c_int; -} -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncsubproc_options { - pub curry: *mut cty::c_void, - #[doc = " restart this many seconds after an exit (watch)"] - pub restart_period: u64, - #[doc = " bitfield over NCOPTION_SUBPROC_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncsubproc_options() { - assert_eq!( - ::core::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(ncsubproc_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncsubproc_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).curry as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncsubproc_options), - "::", - stringify!(curry) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).restart_period as *const _ as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncsubproc_options), - "::", - stringify!(restart_period) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncsubproc_options), - "::", - stringify!(flags) - ) - ); -} -impl Default for ncsubproc_options { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -extern "C" { - #[doc = " see exec(2). p-types use $PATH. e-type passes environment vars."] - pub fn ncsubproc_createv( - n: *mut ncplane, - opts: *const ncsubproc_options, - bin: *const cty::c_char, - arg: *const *mut cty::c_char, - cbfxn: ncfdplane_callback, - donecbfxn: ncfdplane_done_cb, - ) -> *mut ncsubproc; -} -extern "C" { - pub fn ncsubproc_createvp( - n: *mut ncplane, - opts: *const ncsubproc_options, - bin: *const cty::c_char, - arg: *const *mut cty::c_char, - cbfxn: ncfdplane_callback, - donecbfxn: ncfdplane_done_cb, - ) -> *mut ncsubproc; -} -extern "C" { - pub fn ncsubproc_createvpe( - n: *mut ncplane, - opts: *const ncsubproc_options, - bin: *const cty::c_char, - arg: *const *mut cty::c_char, - env: *const *mut cty::c_char, - cbfxn: ncfdplane_callback, - donecbfxn: ncfdplane_done_cb, - ) -> *mut ncsubproc; -} -extern "C" { - pub fn ncsubproc_plane(n: *mut ncsubproc) -> *mut ncplane; -} -extern "C" { - pub fn ncsubproc_destroy(n: *mut ncsubproc) -> cty::c_int; -} -extern "C" { - #[doc = " Draw a QR code at the current position on the plane. If there is insufficient"] - #[doc = " room to draw the code here, or there is any other error, non-zero will be"] - #[doc = " returned. Otherwise, the QR code \"version\" (size) is returned. The QR code"] - #[doc = " is (version * 4 + 17) columns wide, and ⌈version * 4 + 17⌉ rows tall (the"] - #[doc = " properly-scaled values are written back to '*ymax' and '*xmax')."] - pub fn ncplane_qrcode( - n: *mut ncplane, - ymax: *mut cty::c_int, - xmax: *mut cty::c_int, - data: *const cty::c_void, - len: size_t, - ) -> cty::c_int; -} -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncreader_options { - #[doc = " channels used for input"] - pub tchannels: u64, - #[doc = " attributes used for input"] - pub tattrword: u32, - #[doc = " bitfield of NCREADER_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncreader_options() { - assert_eq!( - ::core::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(ncreader_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncreader_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).tchannels as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncreader_options), - "::", - stringify!(tchannels) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).tattrword as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncreader_options), - "::", - stringify!(tattrword) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncreader_options), - "::", - stringify!(flags) - ) - ); -} -extern "C" { - #[doc = " ncreaders provide freeform input in a (possibly multiline) region, supporting"] - #[doc = " optional readline keybindings. takes ownership of 'n', destroying it on any"] - #[doc = " error (ncreader_destroy() otherwise destroys the ncplane)."] - pub fn ncreader_create(n: *mut ncplane, opts: *const ncreader_options) -> *mut ncreader; -} -extern "C" { - #[doc = " empty the ncreader of any user input, and home the cursor."] - pub fn ncreader_clear(n: *mut ncreader) -> cty::c_int; -} -extern "C" { - pub fn ncreader_plane(n: *mut ncreader) -> *mut ncplane; -} -extern "C" { - #[doc = " Offer the input to the ncreader. If it's relevant, this function returns"] - #[doc = " true, and the input ought not be processed further. Almost all inputs"] - #[doc = " are relevant to an ncreader, save synthesized ones."] - pub fn ncreader_offer_input(n: *mut ncreader, ni: *const ncinput) -> bool; -} -extern "C" { - #[doc = " Atttempt to move in the specified direction. Returns 0 if a move was"] - #[doc = " successfully executed, -1 otherwise. Scrolling is taken into account."] - pub fn ncreader_move_left(n: *mut ncreader) -> cty::c_int; -} -extern "C" { - pub fn ncreader_move_right(n: *mut ncreader) -> cty::c_int; -} -extern "C" { - pub fn ncreader_move_up(n: *mut ncreader) -> cty::c_int; -} -extern "C" { - pub fn ncreader_move_down(n: *mut ncreader) -> cty::c_int; -} -extern "C" { - #[doc = " Destructively write the provided EGC to the current cursor location. Move"] - #[doc = " the cursor as necessary, scrolling if applicable."] - pub fn ncreader_write_egc(n: *mut ncreader, egc: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " return a heap-allocated copy of the current (UTF-8) contents."] - pub fn ncreader_contents(n: *const ncreader) -> *mut cty::c_char; -} -extern "C" { - #[doc = " destroy the reader and its bound plane. if 'contents' is not NULL, the"] - #[doc = " UTF-8 input will be heap-duplicated and written to 'contents'."] - pub fn ncreader_destroy(n: *mut ncreader, contents: *mut *mut cty::c_char); -} -extern "C" { - #[doc = " Dump selected Notcurses state to the supplied 'debugfp'. Output is freeform,"] - #[doc = " and subject to change. It includes geometry of all planes, from all piles."] - pub fn notcurses_debug(nc: *const notcurses, debugfp: *mut FILE); -} -extern "C" { - #[doc = " Dump selected configuration capabilities to 'debugfp'. Output is freeform,"] - #[doc = " and subject to change."] - pub fn notcurses_debug_caps(nc: *const notcurses, debugfp: *mut FILE); -} -extern "C" { - #[doc = " Get the default *media* (not plot) blitter for this environment when using"] - #[doc = " the specified scaling method. Currently, this means:"] - #[doc = " - if lacking UTF-8, NCBLIT_1x1"] - #[doc = " - otherwise, if not NCSCALE_STRETCH, NCBLIT_2x1"] - #[doc = " - otherwise, if sextants are not known to be good, NCBLIT_2x2"] - #[doc = " - otherwise NCBLIT_3x2"] - #[doc = " NCBLIT_2x2 and NCBLIT_3x2 both distort the original aspect ratio, thus"] - #[doc = " NCBLIT_2x1 is used outside of NCSCALE_STRETCH."] - pub fn ncvisual_media_defblitter(nc: *const notcurses, scale: ncscale_e) -> ncblitter_e; -} -pub type ncdirectv = ncplane; -#[repr(C)] -#[derive(Debug)] -pub struct ncdirect { - _unused: [u8; 0], -} -extern "C" { - #[doc = " Initialize a direct-mode Notcurses context on the connected terminal at 'fp'."] - #[doc = " 'fp' must be a tty. You'll usually want stdout. Direct mode supports a"] - #[doc = " limited subset of Notcurses routines which directly affect 'fp', and neither"] - #[doc = " supports nor requires notcurses_render(). This can be used to add color and"] - #[doc = " styling to text in the standard output paradigm. 'flags' is a bitmask over"] - #[doc = " NCDIRECT_OPTION_*."] - #[doc = " Returns NULL on error, including any failure initializing terminfo."] - pub fn ncdirect_init(termtype: *const cty::c_char, fp: *mut FILE, flags: u64) -> *mut ncdirect; -} -extern "C" { - #[doc = " The same as ncdirect_init(), but without any multimedia functionality,"] - #[doc = " allowing for a svelter binary. Link with notcurses-core if this is used."] - pub fn ncdirect_core_init( - termtype: *const cty::c_char, - fp: *mut FILE, - flags: u64, - ) -> *mut ncdirect; -} -extern "C" { - #[doc = " Read a (heap-allocated) line of text using the Readline library Initializes"] - #[doc = " Readline the first time it's called. For input to be echoed to the terminal,"] - #[doc = " it is necessary that NCDIRECT_OPTION_INHIBIT_CBREAK be provided to"] - #[doc = " ncdirect_init(). Returns NULL on error."] - pub fn ncdirect_readline(nc: *mut ncdirect, prompt: *const cty::c_char) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Direct mode. This API can be used to colorize and stylize output generated"] - #[doc = " outside of notcurses, without ever calling notcurses_render(). These should"] - #[doc = " not be intermixed with standard Notcurses rendering."] - pub fn ncdirect_set_fg_rgb(nc: *mut ncdirect, rgb: cty::c_uint) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_set_bg_rgb(nc: *mut ncdirect, rgb: cty::c_uint) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_set_fg_palindex(nc: *mut ncdirect, pidx: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_set_bg_palindex(nc: *mut ncdirect, pidx: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Returns the number of simultaneous colors claimed to be supported, or 1 if"] - #[doc = " there is no color support. Note that several terminal emulators advertise"] - #[doc = " more colors than they actually support, downsampling internally."] - pub fn ncdirect_palette_size(nc: *const ncdirect) -> cty::c_uint; -} -extern "C" { - #[doc = " Output the string |utf8| according to the channels |channels|. Note that"] - #[doc = " ncdirect_putstr() does not explicitly flush output buffers, so it will not"] - #[doc = " necessarily be immediately visible."] - pub fn ncdirect_putstr( - nc: *mut ncdirect, - channels: u64, - utf8: *const cty::c_char, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Formatted printing (plus alignment relative to the terminal). Returns the"] - #[doc = " number of columns printed on success."] - pub fn ncdirect_printf_aligned( - n: *mut ncdirect, - y: cty::c_int, - align: ncalign_e, - fmt: *const cty::c_char, - ... - ) -> cty::c_int; -} -extern "C" { - #[doc = " Force a flush. Returns 0 on success, -1 on failure."] - pub fn ncdirect_flush(nc: *const ncdirect) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_set_fg_default(nc: *mut ncdirect) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_set_bg_default(nc: *mut ncdirect) -> cty::c_int; -} -extern "C" { - #[doc = " Get the current number of columns/rows."] - pub fn ncdirect_dim_x(nc: *const ncdirect) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_dim_y(nc: *const ncdirect) -> cty::c_int; -} -extern "C" { - #[doc = " ncplane_styles_*() analogues"] - pub fn ncdirect_set_styles(n: *mut ncdirect, stylebits: cty::c_uint) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_on_styles(n: *mut ncdirect, stylebits: cty::c_uint) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_off_styles(n: *mut ncdirect, stylebits: cty::c_uint) -> cty::c_int; -} -extern "C" { - #[doc = " Deprecated forms of above."] - pub fn ncdirect_styles_set(n: *mut ncdirect, stylebits: cty::c_uint) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_styles_on(n: *mut ncdirect, stylebits: cty::c_uint) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_styles_off(n: *mut ncdirect, stylebits: cty::c_uint) -> cty::c_int; -} -extern "C" { - #[doc = " Move the cursor in direct mode. -1 to retain current location on that axis."] - pub fn ncdirect_cursor_move_yx(n: *mut ncdirect, y: cty::c_int, x: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_cursor_enable(nc: *mut ncdirect) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_cursor_disable(nc: *mut ncdirect) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_cursor_up(nc: *mut ncdirect, num: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_cursor_left(nc: *mut ncdirect, num: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_cursor_right(nc: *mut ncdirect, num: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_cursor_down(nc: *mut ncdirect, num: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Get the cursor position, when supported. This requires writing to the"] - #[doc = " terminal, and then reading from it. If the terminal doesn't reply, or"] - #[doc = " doesn't reply in a way we understand, the results might be deleterious."] - pub fn ncdirect_cursor_yx( - n: *mut ncdirect, - y: *mut cty::c_int, - x: *mut cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Push or pop the cursor location to the terminal's stack. The depth of this"] - #[doc = " stack, and indeed its existence, is terminal-dependent."] - pub fn ncdirect_cursor_push(n: *mut ncdirect) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_cursor_pop(n: *mut ncdirect) -> cty::c_int; -} -extern "C" { - #[doc = " Display an image using the specified blitter and scaling. The image may"] - #[doc = " be arbitrarily many rows -- the output will scroll -- but will only occupy"] - #[doc = " the column of the cursor, and those to the right. The render/raster process"] - #[doc = " can be split by using ncdirect_render_frame() and ncdirect_raster_frame()."] - pub fn ncdirect_render_image( - n: *mut ncdirect, - filename: *const cty::c_char, - align: ncalign_e, - blitter: ncblitter_e, - scale: ncscale_e, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Clear the screen."] - pub fn ncdirect_clear(nc: *mut ncdirect) -> cty::c_int; -} -extern "C" { - #[doc = " Can we load images? This requires being built against FFmpeg/OIIO."] - pub fn ncdirect_canopen_images(n: *const ncdirect) -> bool; -} -extern "C" { - #[doc = " Is our encoding UTF-8? Requires LANG being set to a UTF8 locale."] - pub fn ncdirect_canutf8(n: *const ncdirect) -> bool; -} -extern "C" { - #[doc = " This function must successfully return before NCBLIT_PIXEL is available."] - #[doc = " Returns -1 on error, 0 for no support, or 1 if pixel output is supported."] - #[doc = " Must not be called concurrently with either input or rasterization."] - pub fn ncdirect_check_pixel_support(n: *mut ncdirect) -> cty::c_int; -} -extern "C" { - #[doc = " Draw horizontal/vertical lines using the specified channels, interpolating"] - #[doc = " between them as we go. The EGC may not use more than one column. For a"] - #[doc = " horizontal line, |len| cannot exceed the screen width minus the cursor's"] - #[doc = " offset. For a vertical line, it may be as long as you'd like; the screen"] - #[doc = " will scroll as necessary. All lines start at the current cursor position."] - pub fn ncdirect_hline_interp( - n: *mut ncdirect, - egc: *const cty::c_char, - len: cty::c_int, - h1: u64, - h2: u64, - ) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_vline_interp( - n: *mut ncdirect, - egc: *const cty::c_char, - len: cty::c_int, - h1: u64, - h2: u64, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Draw a box with its upper-left corner at the current cursor position, having"] - #[doc = " dimensions |ylen|x|xlen|. See ncplane_box() for more information. The"] - #[doc = " minimum box size is 2x2, and it cannot be drawn off-screen. |wchars| is an"] - #[doc = " array of 6 wide characters: UL, UR, LL, LR, HL, VL."] - pub fn ncdirect_box( - n: *mut ncdirect, - ul: u64, - ur: u64, - ll: u64, - lr: u64, - wchars: *const wchar_t, - ylen: cty::c_int, - xlen: cty::c_int, - ctlword: cty::c_uint, - ) -> cty::c_int; -} -extern "C" { - #[doc = " ncdirect_box() with the rounded box-drawing characters"] - pub fn ncdirect_rounded_box( - n: *mut ncdirect, - ul: u64, - ur: u64, - ll: u64, - lr: u64, - ylen: cty::c_int, - xlen: cty::c_int, - ctlword: cty::c_uint, - ) -> cty::c_int; -} -extern "C" { - #[doc = " ncdirect_box() with the double box-drawing characters"] - pub fn ncdirect_double_box( - n: *mut ncdirect, - ul: u64, - ur: u64, - ll: u64, - lr: u64, - ylen: cty::c_int, - xlen: cty::c_int, - ctlword: cty::c_uint, - ) -> cty::c_int; -} -extern "C" { - #[doc = " See ppoll(2) for more detail. Provide a NULL 'ts' to block at length, a 'ts'"] - #[doc = " of 0 for non-blocking operation, and otherwise a timespec to bound blocking."] - #[doc = " Signals in sigmask (less several we handle internally) will be atomically"] - #[doc = " masked and unmasked per ppoll(2). '*sigmask' should generally contain all"] - #[doc = " signals. Returns a single Unicode code point, or (char32_t)-1 on error."] - #[doc = " 'sigmask' may be NULL. Returns 0 on a timeout. If an event is processed, the"] - #[doc = " return value is the 'id' field from that event. 'ni' may be NULL."] - pub fn ncdirect_getc( - n: *mut ncdirect, - ts: *const timespec, - sigmask: *mut sigset_t, - ni: *mut ncinput, - ) -> char32_t; -} -extern "C" { - #[doc = " Get a file descriptor suitable for input event poll()ing. When this"] - #[doc = " descriptor becomes available, you can call ncdirect_getc_nblock(),"] - #[doc = " and input ought be ready. This file descriptor is *not* necessarily"] - #[doc = " the file descriptor associated with stdin (but it might be!)."] - pub fn ncdirect_inputready_fd(n: *mut ncdirect) -> cty::c_int; -} -extern "C" { - #[doc = " Release 'nc' and any associated resources. 0 on success, non-0 on failure."] - pub fn ncdirect_stop(nc: *mut ncdirect) -> cty::c_int; -} -extern "C" { - #[doc = " Render an image using the specified blitter and scaling, but do not write"] - #[doc = " the result. The image may be arbitrarily many rows -- the output will scroll"] - #[doc = " -- but will only occupy the column of the cursor, and those to the right."] - #[doc = " To actually write (and free) this, invoke ncdirect_raster_frame(). 'maxx'"] - #[doc = " and 'maxy', if greater than 0, are used for scaling; the terminal's geometry"] - #[doc = " is otherwise used."] - pub fn ncdirect_render_frame( - n: *mut ncdirect, - filename: *const cty::c_char, - blitter: ncblitter_e, - scale: ncscale_e, - maxy: cty::c_int, - maxx: cty::c_int, - ) -> *mut ncdirectv; -} -extern "C" { - #[doc = " Takes the result of ncdirect_render_frame() and writes it to the output."] - pub fn ncdirect_raster_frame( - n: *mut ncdirect, - ncdv: *mut ncdirectv, - align: ncalign_e, - ) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_stream( - n: *mut ncdirect, - filename: *const cty::c_char, - streamer: ncstreamcb, - vopts: *mut ncvisual_options, - curry: *mut cty::c_void, - ) -> cty::c_int; -} -pub type __builtin_va_list = [__va_list_tag; 1usize]; -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct __va_list_tag { - pub gp_offset: cty::c_uint, - pub fp_offset: cty::c_uint, - pub overflow_arg_area: *mut cty::c_void, - pub reg_save_area: *mut cty::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 Default for __va_list_tag { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} diff --git a/tools/function-summary/history/bindgen_20210415.rs b/tools/function-summary/history/bindgen_20210415.rs deleted file mode 100644 index c0baec7cc..000000000 --- a/tools/function-summary/history/bindgen_20210415.rs +++ /dev/null @@ -1,9783 +0,0 @@ -/* automatically generated by rust-bindgen 0.58.1 */ - -#[repr(C)] -#[derive(Default)] -pub struct __IncompleteArrayField(::core::marker::PhantomData, [T; 0]); -impl __IncompleteArrayField { - #[inline] - pub const fn new() -> Self { - __IncompleteArrayField(::core::marker::PhantomData, []) - } - #[inline] - pub fn as_ptr(&self) -> *const T { - self as *const _ as *const T - } - #[inline] - pub fn as_mut_ptr(&mut self) -> *mut T { - self as *mut _ as *mut T - } - #[inline] - pub unsafe fn as_slice(&self, len: usize) -> &[T] { - ::core::slice::from_raw_parts(self.as_ptr(), len) - } - #[inline] - pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] { - ::core::slice::from_raw_parts_mut(self.as_mut_ptr(), len) - } -} -impl ::core::fmt::Debug for __IncompleteArrayField { - fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - fmt.write_str("__IncompleteArrayField") - } -} -pub const _TIME_H: u32 = 1; -pub const _FEATURES_H: u32 = 1; -pub const __GLIBC_USE_ISOC2X: u32 = 0; -pub const __USE_ISOC11: u32 = 1; -pub const __USE_ISOC99: u32 = 1; -pub const __USE_ISOC95: u32 = 1; -pub const _POSIX_SOURCE: u32 = 1; -pub const _POSIX_C_SOURCE: u32 = 2; -pub const __USE_POSIX_IMPLICITLY: u32 = 1; -pub const __USE_POSIX: u32 = 1; -pub const __USE_POSIX2: u32 = 1; -pub const __USE_XOPEN: u32 = 1; -pub const __USE_FORTIFY_LEVEL: u32 = 0; -pub const __GLIBC_USE_DEPRECATED_GETS: u32 = 0; -pub const __GLIBC_USE_DEPRECATED_SCANF: u32 = 0; -pub const _STDC_PREDEF_H: u32 = 1; -pub const __STDC_IEC_559__: u32 = 1; -pub const __STDC_IEC_559_COMPLEX__: u32 = 1; -pub const __STDC_ISO_10646__: u32 = 201706; -pub const __GNU_LIBRARY__: u32 = 6; -pub const __GLIBC__: u32 = 2; -pub const __GLIBC_MINOR__: u32 = 31; -pub const _SYS_CDEFS_H: u32 = 1; -pub const __glibc_c99_flexarr_available: u32 = 1; -pub const __WORDSIZE: u32 = 64; -pub const __WORDSIZE_TIME64_COMPAT32: u32 = 1; -pub const __SYSCALL_WORDSIZE: u32 = 64; -pub const __LONG_DOUBLE_USES_FLOAT128: u32 = 0; -pub const __HAVE_GENERIC_SELECTION: u32 = 1; -pub const _BITS_TIME_H: u32 = 1; -pub const _BITS_TYPES_H: u32 = 1; -pub const __TIMESIZE: u32 = 64; -pub const _BITS_TYPESIZES_H: u32 = 1; -pub const __OFF_T_MATCHES_OFF64_T: u32 = 1; -pub const __INO_T_MATCHES_INO64_T: u32 = 1; -pub const __RLIM_T_MATCHES_RLIM64_T: u32 = 1; -pub const __STATFS_MATCHES_STATFS64: u32 = 1; -pub const __FD_SETSIZE: u32 = 1024; -pub const _BITS_TIME64_H: u32 = 1; -pub const __clock_t_defined: u32 = 1; -pub const __time_t_defined: u32 = 1; -pub const __struct_tm_defined: u32 = 1; -pub const _STRUCT_TIMESPEC: u32 = 1; -pub const _BITS_ENDIAN_H: u32 = 1; -pub const __LITTLE_ENDIAN: u32 = 1234; -pub const __BIG_ENDIAN: u32 = 4321; -pub const __PDP_ENDIAN: u32 = 3412; -pub const _BITS_ENDIANNESS_H: u32 = 1; -pub const __BYTE_ORDER: u32 = 1234; -pub const __FLOAT_WORD_ORDER: u32 = 1234; -pub const TIME_UTC: u32 = 1; -pub const _UCHAR_H: u32 = 1; -pub const __mbstate_t_defined: u32 = 1; -pub const ____mbstate_t_defined: u32 = 1; -pub const _CTYPE_H: u32 = 1; -pub const _WCHAR_H: u32 = 1; -pub const __GLIBC_USE_LIB_EXT2: u32 = 0; -pub const __GLIBC_USE_IEC_60559_BFP_EXT: u32 = 0; -pub const __GLIBC_USE_IEC_60559_BFP_EXT_C2X: u32 = 0; -pub const __GLIBC_USE_IEC_60559_FUNCS_EXT: u32 = 0; -pub const __GLIBC_USE_IEC_60559_FUNCS_EXT_C2X: u32 = 0; -pub const __GLIBC_USE_IEC_60559_TYPES_EXT: u32 = 0; -pub const __HAVE_FLOAT128: u32 = 0; -pub const __HAVE_DISTINCT_FLOAT128: u32 = 0; -pub const __HAVE_FLOAT64X: u32 = 1; -pub const __HAVE_FLOAT64X_LONG_DOUBLE: u32 = 1; -pub const __HAVE_FLOAT16: u32 = 0; -pub const __HAVE_FLOAT32: u32 = 1; -pub const __HAVE_FLOAT64: u32 = 1; -pub const __HAVE_FLOAT32X: u32 = 1; -pub const __HAVE_FLOAT128X: u32 = 0; -pub const __HAVE_DISTINCT_FLOAT16: u32 = 0; -pub const __HAVE_DISTINCT_FLOAT32: u32 = 0; -pub const __HAVE_DISTINCT_FLOAT64: u32 = 0; -pub const __HAVE_DISTINCT_FLOAT32X: u32 = 0; -pub const __HAVE_DISTINCT_FLOAT64X: u32 = 0; -pub const __HAVE_DISTINCT_FLOAT128X: u32 = 0; -pub const __HAVE_FLOATN_NOT_TYPEDEF: u32 = 0; -pub const __GNUC_VA_LIST: u32 = 1; -pub const _BITS_WCHAR_H: u32 = 1; -pub const __wint_t_defined: u32 = 1; -pub const _WINT_T: u32 = 1; -pub const ____FILE_defined: u32 = 1; -pub const WEOF: u32 = 4294967295; -pub const _BITS_WCTYPE_WCHAR_H: u32 = 1; -pub const _STDIO_H: u32 = 1; -pub const _____fpos_t_defined: u32 = 1; -pub const _____fpos64_t_defined: u32 = 1; -pub const __FILE_defined: u32 = 1; -pub const __struct_FILE_defined: u32 = 1; -pub const _IO_EOF_SEEN: u32 = 16; -pub const _IO_ERR_SEEN: u32 = 32; -pub const _IO_USER_LOCK: u32 = 32768; -pub const _IOFBF: u32 = 0; -pub const _IOLBF: u32 = 1; -pub const _IONBF: u32 = 2; -pub const BUFSIZ: u32 = 8192; -pub const EOF: i32 = -1; -pub const SEEK_SET: u32 = 0; -pub const SEEK_CUR: u32 = 1; -pub const SEEK_END: u32 = 2; -pub const P_tmpdir: &'static [u8; 5usize] = b"/tmp\0"; -pub const _BITS_STDIO_LIM_H: u32 = 1; -pub const L_tmpnam: u32 = 20; -pub const TMP_MAX: u32 = 238328; -pub const FILENAME_MAX: u32 = 4096; -pub const L_ctermid: u32 = 9; -pub const L_cuserid: u32 = 9; -pub const FOPEN_MAX: u32 = 16; -pub const _GETOPT_POSIX_H: u32 = 1; -pub const _GETOPT_CORE_H: u32 = 1; -pub const _STDINT_H: u32 = 1; -pub const _BITS_STDINT_INTN_H: u32 = 1; -pub const _BITS_STDINT_UINTN_H: u32 = 1; -pub const INT8_MIN: i32 = -128; -pub const INT16_MIN: i32 = -32768; -pub const INT32_MIN: i32 = -2147483648; -pub const INT8_MAX: u32 = 127; -pub const INT16_MAX: u32 = 32767; -pub const INT32_MAX: u32 = 2147483647; -pub const UINT8_MAX: u32 = 255; -pub const UINT16_MAX: u32 = 65535; -pub const UINT32_MAX: u32 = 4294967295; -pub const INT_LEAST8_MIN: i32 = -128; -pub const INT_LEAST16_MIN: i32 = -32768; -pub const INT_LEAST32_MIN: i32 = -2147483648; -pub const INT_LEAST8_MAX: u32 = 127; -pub const INT_LEAST16_MAX: u32 = 32767; -pub const INT_LEAST32_MAX: u32 = 2147483647; -pub const UINT_LEAST8_MAX: u32 = 255; -pub const UINT_LEAST16_MAX: u32 = 65535; -pub const UINT_LEAST32_MAX: u32 = 4294967295; -pub const INT_FAST8_MIN: i32 = -128; -pub const INT_FAST16_MIN: i64 = -9223372036854775808; -pub const INT_FAST32_MIN: i64 = -9223372036854775808; -pub const INT_FAST8_MAX: u32 = 127; -pub const INT_FAST16_MAX: u64 = 9223372036854775807; -pub const INT_FAST32_MAX: u64 = 9223372036854775807; -pub const UINT_FAST8_MAX: u32 = 255; -pub const UINT_FAST16_MAX: i32 = -1; -pub const UINT_FAST32_MAX: i32 = -1; -pub const INTPTR_MIN: i64 = -9223372036854775808; -pub const INTPTR_MAX: u64 = 9223372036854775807; -pub const UINTPTR_MAX: i32 = -1; -pub const PTRDIFF_MIN: i64 = -9223372036854775808; -pub const PTRDIFF_MAX: u64 = 9223372036854775807; -pub const SIG_ATOMIC_MIN: i32 = -2147483648; -pub const SIG_ATOMIC_MAX: u32 = 2147483647; -pub const SIZE_MAX: i32 = -1; -pub const WINT_MIN: u32 = 0; -pub const WINT_MAX: u32 = 4294967295; -pub const _STDLIB_H: u32 = 1; -pub const WNOHANG: u32 = 1; -pub const WUNTRACED: u32 = 2; -pub const __WNOTHREAD: u32 = 536870912; -pub const __WALL: u32 = 1073741824; -pub const __WCLONE: u32 = 2147483648; -pub const __W_CONTINUED: u32 = 65535; -pub const __WCOREFLAG: u32 = 128; -pub const __ldiv_t_defined: u32 = 1; -pub const __lldiv_t_defined: u32 = 1; -pub const RAND_MAX: u32 = 2147483647; -pub const EXIT_FAILURE: u32 = 1; -pub const EXIT_SUCCESS: u32 = 0; -pub const _STRING_H: u32 = 1; -pub const _BITS_SIGNUM_H: u32 = 1; -pub const _BITS_SIGNUM_GENERIC_H: u32 = 1; -pub const SIGINT: u32 = 2; -pub const SIGILL: u32 = 4; -pub const SIGABRT: u32 = 6; -pub const SIGFPE: u32 = 8; -pub const SIGSEGV: u32 = 11; -pub const SIGTERM: u32 = 15; -pub const SIGHUP: u32 = 1; -pub const SIGQUIT: u32 = 3; -pub const SIGTRAP: u32 = 5; -pub const SIGKILL: u32 = 9; -pub const SIGBUS: u32 = 10; -pub const SIGSYS: u32 = 12; -pub const SIGPIPE: u32 = 13; -pub const SIGALRM: u32 = 14; -pub const SIGURG: u32 = 16; -pub const SIGSTOP: u32 = 17; -pub const SIGTSTP: u32 = 18; -pub const SIGCONT: u32 = 19; -pub const SIGCHLD: u32 = 20; -pub const SIGTTIN: u32 = 21; -pub const SIGTTOU: u32 = 22; -pub const SIGPOLL: u32 = 23; -pub const SIGXCPU: u32 = 24; -pub const SIGXFSZ: u32 = 25; -pub const SIGVTALRM: u32 = 26; -pub const SIGPROF: u32 = 27; -pub const SIGUSR1: u32 = 30; -pub const SIGUSR2: u32 = 31; -pub const SIGWINCH: u32 = 28; -pub const SIGIO: u32 = 23; -pub const SIGIOT: u32 = 6; -pub const SIGCLD: u32 = 20; -pub const __SIGRTMIN: u32 = 32; -pub const __SIGRTMAX: u32 = 32; -pub const _NSIG: u32 = 33; -pub const SIGSTKFLT: u32 = 16; -pub const SIGPWR: u32 = 30; -pub const __sig_atomic_t_defined: u32 = 1; -pub const __sigset_t_defined: u32 = 1; -pub const _BITS_SIGACTION_H: u32 = 1; -pub const SA_NOCLDSTOP: u32 = 1; -pub const SA_NOCLDWAIT: u32 = 2; -pub const SA_SIGINFO: u32 = 4; -pub const SIG_BLOCK: u32 = 0; -pub const SIG_UNBLOCK: u32 = 1; -pub const SIG_SETMASK: u32 = 2; -pub const _LIBC_LIMITS_H_: u32 = 1; -pub const MB_LEN_MAX: u32 = 16; -pub const _BITS_POSIX1_LIM_H: u32 = 1; -pub const _POSIX_AIO_LISTIO_MAX: u32 = 2; -pub const _POSIX_AIO_MAX: u32 = 1; -pub const _POSIX_ARG_MAX: u32 = 4096; -pub const _POSIX_CHILD_MAX: u32 = 6; -pub const _POSIX_DELAYTIMER_MAX: u32 = 32; -pub const _POSIX_HOST_NAME_MAX: u32 = 255; -pub const _POSIX_LINK_MAX: u32 = 8; -pub const _POSIX_LOGIN_NAME_MAX: u32 = 9; -pub const _POSIX_MAX_CANON: u32 = 255; -pub const _POSIX_MAX_INPUT: u32 = 255; -pub const _POSIX_MQ_OPEN_MAX: u32 = 8; -pub const _POSIX_MQ_PRIO_MAX: u32 = 32; -pub const _POSIX_NAME_MAX: u32 = 14; -pub const _POSIX_NGROUPS_MAX: u32 = 0; -pub const _POSIX_OPEN_MAX: u32 = 16; -pub const _POSIX_FD_SETSIZE: u32 = 16; -pub const _POSIX_PATH_MAX: u32 = 256; -pub const _POSIX_PIPE_BUF: u32 = 512; -pub const _POSIX_RE_DUP_MAX: u32 = 255; -pub const _POSIX_RTSIG_MAX: u32 = 8; -pub const _POSIX_SEM_NSEMS_MAX: u32 = 256; -pub const _POSIX_SEM_VALUE_MAX: u32 = 32767; -pub const _POSIX_SIGQUEUE_MAX: u32 = 32; -pub const _POSIX_SSIZE_MAX: u32 = 32767; -pub const _POSIX_STREAM_MAX: u32 = 8; -pub const _POSIX_SYMLINK_MAX: u32 = 255; -pub const _POSIX_SYMLOOP_MAX: u32 = 8; -pub const _POSIX_TIMER_MAX: u32 = 32; -pub const _POSIX_TTY_NAME_MAX: u32 = 9; -pub const _POSIX_TZNAME_MAX: u32 = 3; -pub const _POSIX_QLIMIT: u32 = 1; -pub const _POSIX_HIWAT: u32 = 512; -pub const _POSIX_UIO_MAXIOV: u32 = 16; -pub const _POSIX_CLOCKRES_MIN: u32 = 20000000; -pub const NR_OPEN: u32 = 1024; -pub const NGROUPS_MAX: u32 = 65536; -pub const ARG_MAX: u32 = 131072; -pub const LINK_MAX: u32 = 127; -pub const MAX_CANON: u32 = 255; -pub const MAX_INPUT: u32 = 255; -pub const NAME_MAX: u32 = 255; -pub const PATH_MAX: u32 = 4096; -pub const PIPE_BUF: u32 = 4096; -pub const XATTR_NAME_MAX: u32 = 255; -pub const XATTR_SIZE_MAX: u32 = 65536; -pub const XATTR_LIST_MAX: u32 = 65536; -pub const RTSIG_MAX: u32 = 32; -pub const _POSIX_THREAD_KEYS_MAX: u32 = 128; -pub const PTHREAD_KEYS_MAX: u32 = 1024; -pub const _POSIX_THREAD_DESTRUCTOR_ITERATIONS: u32 = 4; -pub const PTHREAD_DESTRUCTOR_ITERATIONS: u32 = 4; -pub const _POSIX_THREAD_THREADS_MAX: u32 = 64; -pub const AIO_PRIO_DELTA_MAX: u32 = 20; -pub const PTHREAD_STACK_MIN: u32 = 16384; -pub const DELAYTIMER_MAX: u32 = 2147483647; -pub const TTY_NAME_MAX: u32 = 32; -pub const LOGIN_NAME_MAX: u32 = 256; -pub const HOST_NAME_MAX: u32 = 64; -pub const MQ_PRIO_MAX: u32 = 32768; -pub const SEM_VALUE_MAX: u32 = 2147483647; -pub const _BITS_POSIX2_LIM_H: u32 = 1; -pub const _POSIX2_BC_BASE_MAX: u32 = 99; -pub const _POSIX2_BC_DIM_MAX: u32 = 2048; -pub const _POSIX2_BC_SCALE_MAX: u32 = 99; -pub const _POSIX2_BC_STRING_MAX: u32 = 1000; -pub const _POSIX2_COLL_WEIGHTS_MAX: u32 = 2; -pub const _POSIX2_EXPR_NEST_MAX: u32 = 32; -pub const _POSIX2_LINE_MAX: u32 = 2048; -pub const _POSIX2_RE_DUP_MAX: u32 = 255; -pub const _POSIX2_CHARCLASS_NAME_MAX: u32 = 14; -pub const BC_BASE_MAX: u32 = 99; -pub const BC_DIM_MAX: u32 = 2048; -pub const BC_SCALE_MAX: u32 = 99; -pub const BC_STRING_MAX: u32 = 1000; -pub const COLL_WEIGHTS_MAX: u32 = 255; -pub const EXPR_NEST_MAX: u32 = 32; -pub const LINE_MAX: u32 = 2048; -pub const CHARCLASS_NAME_MAX: u32 = 2048; -pub const RE_DUP_MAX: u32 = 32767; -pub const _XOPEN_LIM_H: u32 = 1; -pub const _XOPEN_IOV_MAX: u32 = 16; -pub const _BITS_UIO_LIM_H: u32 = 1; -pub const __IOV_MAX: u32 = 1024; -pub const IOV_MAX: u32 = 1024; -pub const NL_ARGMAX: u32 = 4096; -pub const NL_LANGMAX: u32 = 2048; -pub const NZERO: u32 = 20; -pub const WORD_BIT: u32 = 32; -pub const LONG_BIT: u32 = 64; -pub const true_: u32 = 1; -pub const false_: u32 = 0; -pub const __bool_true_false_are_defined: u32 = 1; -pub const _BYTESWAP_H: u32 = 1; -pub const _BITS_BYTESWAP_H: u32 = 1; -pub const _NETINET_IN_H: u32 = 1; -pub const _SYS_SOCKET_H: u32 = 1; -pub const __iovec_defined: u32 = 1; -pub const _SYS_TYPES_H: u32 = 1; -pub const __clockid_t_defined: u32 = 1; -pub const __timer_t_defined: u32 = 1; -pub const __BIT_TYPES_DEFINED__: u32 = 1; -pub const PF_UNSPEC: u32 = 0; -pub const PF_LOCAL: u32 = 1; -pub const PF_UNIX: u32 = 1; -pub const PF_FILE: u32 = 1; -pub const PF_INET: u32 = 2; -pub const PF_AX25: u32 = 3; -pub const PF_IPX: u32 = 4; -pub const PF_APPLETALK: u32 = 5; -pub const PF_NETROM: u32 = 6; -pub const PF_BRIDGE: u32 = 7; -pub const PF_ATMPVC: u32 = 8; -pub const PF_X25: u32 = 9; -pub const PF_INET6: u32 = 10; -pub const PF_ROSE: u32 = 11; -pub const PF_DECnet: u32 = 12; -pub const PF_NETBEUI: u32 = 13; -pub const PF_SECURITY: u32 = 14; -pub const PF_KEY: u32 = 15; -pub const PF_NETLINK: u32 = 16; -pub const PF_ROUTE: u32 = 16; -pub const PF_PACKET: u32 = 17; -pub const PF_ASH: u32 = 18; -pub const PF_ECONET: u32 = 19; -pub const PF_ATMSVC: u32 = 20; -pub const PF_RDS: u32 = 21; -pub const PF_SNA: u32 = 22; -pub const PF_IRDA: u32 = 23; -pub const PF_PPPOX: u32 = 24; -pub const PF_WANPIPE: u32 = 25; -pub const PF_LLC: u32 = 26; -pub const PF_IB: u32 = 27; -pub const PF_MPLS: u32 = 28; -pub const PF_CAN: u32 = 29; -pub const PF_TIPC: u32 = 30; -pub const PF_BLUETOOTH: u32 = 31; -pub const PF_IUCV: u32 = 32; -pub const PF_RXRPC: u32 = 33; -pub const PF_ISDN: u32 = 34; -pub const PF_PHONET: u32 = 35; -pub const PF_IEEE802154: u32 = 36; -pub const PF_CAIF: u32 = 37; -pub const PF_ALG: u32 = 38; -pub const PF_NFC: u32 = 39; -pub const PF_VSOCK: u32 = 40; -pub const PF_KCM: u32 = 41; -pub const PF_QIPCRTR: u32 = 42; -pub const PF_SMC: u32 = 43; -pub const PF_XDP: u32 = 44; -pub const PF_MAX: u32 = 45; -pub const AF_UNSPEC: u32 = 0; -pub const AF_LOCAL: u32 = 1; -pub const AF_UNIX: u32 = 1; -pub const AF_FILE: u32 = 1; -pub const AF_INET: u32 = 2; -pub const AF_AX25: u32 = 3; -pub const AF_IPX: u32 = 4; -pub const AF_APPLETALK: u32 = 5; -pub const AF_NETROM: u32 = 6; -pub const AF_BRIDGE: u32 = 7; -pub const AF_ATMPVC: u32 = 8; -pub const AF_X25: u32 = 9; -pub const AF_INET6: u32 = 10; -pub const AF_ROSE: u32 = 11; -pub const AF_DECnet: u32 = 12; -pub const AF_NETBEUI: u32 = 13; -pub const AF_SECURITY: u32 = 14; -pub const AF_KEY: u32 = 15; -pub const AF_NETLINK: u32 = 16; -pub const AF_ROUTE: u32 = 16; -pub const AF_PACKET: u32 = 17; -pub const AF_ASH: u32 = 18; -pub const AF_ECONET: u32 = 19; -pub const AF_ATMSVC: u32 = 20; -pub const AF_RDS: u32 = 21; -pub const AF_SNA: u32 = 22; -pub const AF_IRDA: u32 = 23; -pub const AF_PPPOX: u32 = 24; -pub const AF_WANPIPE: u32 = 25; -pub const AF_LLC: u32 = 26; -pub const AF_IB: u32 = 27; -pub const AF_MPLS: u32 = 28; -pub const AF_CAN: u32 = 29; -pub const AF_TIPC: u32 = 30; -pub const AF_BLUETOOTH: u32 = 31; -pub const AF_IUCV: u32 = 32; -pub const AF_RXRPC: u32 = 33; -pub const AF_ISDN: u32 = 34; -pub const AF_PHONET: u32 = 35; -pub const AF_IEEE802154: u32 = 36; -pub const AF_CAIF: u32 = 37; -pub const AF_ALG: u32 = 38; -pub const AF_NFC: u32 = 39; -pub const AF_VSOCK: u32 = 40; -pub const AF_KCM: u32 = 41; -pub const AF_QIPCRTR: u32 = 42; -pub const AF_SMC: u32 = 43; -pub const AF_XDP: u32 = 44; -pub const AF_MAX: u32 = 45; -pub const SOL_RAW: u32 = 255; -pub const SOL_DECNET: u32 = 261; -pub const SOL_X25: u32 = 262; -pub const SOL_PACKET: u32 = 263; -pub const SOL_ATM: u32 = 264; -pub const SOL_AAL: u32 = 265; -pub const SOL_IRDA: u32 = 266; -pub const SOL_NETBEUI: u32 = 267; -pub const SOL_LLC: u32 = 268; -pub const SOL_DCCP: u32 = 269; -pub const SOL_NETLINK: u32 = 270; -pub const SOL_TIPC: u32 = 271; -pub const SOL_RXRPC: u32 = 272; -pub const SOL_PPPOL2TP: u32 = 273; -pub const SOL_BLUETOOTH: u32 = 274; -pub const SOL_PNPIPE: u32 = 275; -pub const SOL_RDS: u32 = 276; -pub const SOL_IUCV: u32 = 277; -pub const SOL_CAIF: u32 = 278; -pub const SOL_ALG: u32 = 279; -pub const SOL_NFC: u32 = 280; -pub const SOL_KCM: u32 = 281; -pub const SOL_TLS: u32 = 282; -pub const SOL_XDP: u32 = 283; -pub const SOMAXCONN: u32 = 4096; -pub const _BITS_SOCKADDR_H: u32 = 1; -pub const _SS_SIZE: u32 = 128; -pub const SO_DEBUG: u32 = 1; -pub const SOL_SOCKET: u32 = 1; -pub const SO_ACCEPTCONN: u32 = 30; -pub const SO_BROADCAST: u32 = 6; -pub const SO_DONTROUTE: u32 = 5; -pub const SO_ERROR: u32 = 4; -pub const SO_KEEPALIVE: u32 = 9; -pub const SO_LINGER: u32 = 13; -pub const SO_OOBINLINE: u32 = 10; -pub const SO_RCVBUF: u32 = 8; -pub const SO_RCVLOWAT: u32 = 18; -pub const SO_RCVTIMEO: u32 = 20; -pub const SO_REUSEADDR: u32 = 2; -pub const SO_SNDBUF: u32 = 7; -pub const SO_SNDLOWAT: u32 = 19; -pub const SO_SNDTIMEO: u32 = 21; -pub const SO_TYPE: u32 = 3; -pub const __USE_KERNEL_IPV6_DEFS: u32 = 0; -pub const IP_OPTIONS: u32 = 4; -pub const IP_HDRINCL: u32 = 3; -pub const IP_TOS: u32 = 1; -pub const IP_TTL: u32 = 2; -pub const IP_RECVOPTS: u32 = 6; -pub const IP_RETOPTS: u32 = 7; -pub const IP_MULTICAST_IF: u32 = 32; -pub const IP_MULTICAST_TTL: u32 = 33; -pub const IP_MULTICAST_LOOP: u32 = 34; -pub const IP_ADD_MEMBERSHIP: u32 = 35; -pub const IP_DROP_MEMBERSHIP: u32 = 36; -pub const IP_UNBLOCK_SOURCE: u32 = 37; -pub const IP_BLOCK_SOURCE: u32 = 38; -pub const IP_ADD_SOURCE_MEMBERSHIP: u32 = 39; -pub const IP_DROP_SOURCE_MEMBERSHIP: u32 = 40; -pub const IP_MSFILTER: u32 = 41; -pub const IP_ROUTER_ALERT: u32 = 5; -pub const IP_PKTINFO: u32 = 8; -pub const IP_PKTOPTIONS: u32 = 9; -pub const IP_PMTUDISC: u32 = 10; -pub const IP_MTU_DISCOVER: u32 = 10; -pub const IP_RECVERR: u32 = 11; -pub const IP_RECVTTL: u32 = 12; -pub const IP_RECVTOS: u32 = 13; -pub const IP_MTU: u32 = 14; -pub const IP_FREEBIND: u32 = 15; -pub const IP_IPSEC_POLICY: u32 = 16; -pub const IP_XFRM_POLICY: u32 = 17; -pub const IP_PASSSEC: u32 = 18; -pub const IP_TRANSPARENT: u32 = 19; -pub const IP_MULTICAST_ALL: u32 = 49; -pub const IP_ORIGDSTADDR: u32 = 20; -pub const IP_RECVORIGDSTADDR: u32 = 20; -pub const IP_MINTTL: u32 = 21; -pub const IP_NODEFRAG: u32 = 22; -pub const IP_CHECKSUM: u32 = 23; -pub const IP_BIND_ADDRESS_NO_PORT: u32 = 24; -pub const IP_RECVFRAGSIZE: u32 = 25; -pub const IP_PMTUDISC_DONT: u32 = 0; -pub const IP_PMTUDISC_WANT: u32 = 1; -pub const IP_PMTUDISC_DO: u32 = 2; -pub const IP_PMTUDISC_PROBE: u32 = 3; -pub const IP_PMTUDISC_INTERFACE: u32 = 4; -pub const IP_PMTUDISC_OMIT: u32 = 5; -pub const IP_UNICAST_IF: u32 = 50; -pub const SOL_IP: u32 = 0; -pub const IP_DEFAULT_MULTICAST_TTL: u32 = 1; -pub const IP_DEFAULT_MULTICAST_LOOP: u32 = 1; -pub const IP_MAX_MEMBERSHIPS: u32 = 20; -pub const IPV6_ADDRFORM: u32 = 1; -pub const IPV6_2292PKTINFO: u32 = 2; -pub const IPV6_2292HOPOPTS: u32 = 3; -pub const IPV6_2292DSTOPTS: u32 = 4; -pub const IPV6_2292RTHDR: u32 = 5; -pub const IPV6_2292PKTOPTIONS: u32 = 6; -pub const IPV6_CHECKSUM: u32 = 7; -pub const IPV6_2292HOPLIMIT: u32 = 8; -pub const IPV6_NEXTHOP: u32 = 9; -pub const IPV6_AUTHHDR: u32 = 10; -pub const IPV6_UNICAST_HOPS: u32 = 16; -pub const IPV6_MULTICAST_IF: u32 = 17; -pub const IPV6_MULTICAST_HOPS: u32 = 18; -pub const IPV6_MULTICAST_LOOP: u32 = 19; -pub const IPV6_JOIN_GROUP: u32 = 20; -pub const IPV6_LEAVE_GROUP: u32 = 21; -pub const IPV6_ROUTER_ALERT: u32 = 22; -pub const IPV6_MTU_DISCOVER: u32 = 23; -pub const IPV6_MTU: u32 = 24; -pub const IPV6_RECVERR: u32 = 25; -pub const IPV6_V6ONLY: u32 = 26; -pub const IPV6_JOIN_ANYCAST: u32 = 27; -pub const IPV6_LEAVE_ANYCAST: u32 = 28; -pub const IPV6_MULTICAST_ALL: u32 = 29; -pub const IPV6_ROUTER_ALERT_ISOLATE: u32 = 30; -pub const IPV6_IPSEC_POLICY: u32 = 34; -pub const IPV6_XFRM_POLICY: u32 = 35; -pub const IPV6_HDRINCL: u32 = 36; -pub const IPV6_RECVPKTINFO: u32 = 49; -pub const IPV6_PKTINFO: u32 = 50; -pub const IPV6_RECVHOPLIMIT: u32 = 51; -pub const IPV6_HOPLIMIT: u32 = 52; -pub const IPV6_RECVHOPOPTS: u32 = 53; -pub const IPV6_HOPOPTS: u32 = 54; -pub const IPV6_RTHDRDSTOPTS: u32 = 55; -pub const IPV6_RECVRTHDR: u32 = 56; -pub const IPV6_RTHDR: u32 = 57; -pub const IPV6_RECVDSTOPTS: u32 = 58; -pub const IPV6_DSTOPTS: u32 = 59; -pub const IPV6_RECVPATHMTU: u32 = 60; -pub const IPV6_PATHMTU: u32 = 61; -pub const IPV6_DONTFRAG: u32 = 62; -pub const IPV6_RECVTCLASS: u32 = 66; -pub const IPV6_TCLASS: u32 = 67; -pub const IPV6_AUTOFLOWLABEL: u32 = 70; -pub const IPV6_ADDR_PREFERENCES: u32 = 72; -pub const IPV6_MINHOPCOUNT: u32 = 73; -pub const IPV6_ORIGDSTADDR: u32 = 74; -pub const IPV6_RECVORIGDSTADDR: u32 = 74; -pub const IPV6_TRANSPARENT: u32 = 75; -pub const IPV6_UNICAST_IF: u32 = 76; -pub const IPV6_RECVFRAGSIZE: u32 = 77; -pub const IPV6_FREEBIND: u32 = 78; -pub const IPV6_ADD_MEMBERSHIP: u32 = 20; -pub const IPV6_DROP_MEMBERSHIP: u32 = 21; -pub const IPV6_RXHOPOPTS: u32 = 54; -pub const IPV6_RXDSTOPTS: u32 = 59; -pub const IPV6_PMTUDISC_DONT: u32 = 0; -pub const IPV6_PMTUDISC_WANT: u32 = 1; -pub const IPV6_PMTUDISC_DO: u32 = 2; -pub const IPV6_PMTUDISC_PROBE: u32 = 3; -pub const IPV6_PMTUDISC_INTERFACE: u32 = 4; -pub const IPV6_PMTUDISC_OMIT: u32 = 5; -pub const SOL_IPV6: u32 = 41; -pub const SOL_ICMPV6: u32 = 58; -pub const IPV6_RTHDR_LOOSE: u32 = 0; -pub const IPV6_RTHDR_STRICT: u32 = 1; -pub const IPV6_RTHDR_TYPE_0: u32 = 0; -pub const IN_CLASSA_NET: u32 = 4278190080; -pub const IN_CLASSA_NSHIFT: u32 = 24; -pub const IN_CLASSA_HOST: u32 = 16777215; -pub const IN_CLASSA_MAX: u32 = 128; -pub const IN_CLASSB_NET: u32 = 4294901760; -pub const IN_CLASSB_NSHIFT: u32 = 16; -pub const IN_CLASSB_HOST: u32 = 65535; -pub const IN_CLASSB_MAX: u32 = 65536; -pub const IN_CLASSC_NET: u32 = 4294967040; -pub const IN_CLASSC_NSHIFT: u32 = 8; -pub const IN_CLASSC_HOST: u32 = 255; -pub const IN_LOOPBACKNET: u32 = 127; -pub const INET_ADDRSTRLEN: u32 = 16; -pub const INET6_ADDRSTRLEN: u32 = 46; -pub const _ENDIAN_H: u32 = 1; -pub const _BITS_UINTN_IDENTITY_H: u32 = 1; -pub const NCKEY_ESC: u32 = 27; -pub const NCKEY_SPACE: u32 = 32; -pub const CELL_ALPHA_HIGHCONTRAST: u32 = 805306368; -pub const CELL_ALPHA_TRANSPARENT: u32 = 536870912; -pub const CELL_ALPHA_BLEND: u32 = 268435456; -pub const CELL_ALPHA_OPAQUE: u32 = 0; -pub const CELL_BGDEFAULT_MASK: u32 = 1073741824; -pub const CELL_FGDEFAULT_MASK: u64 = 4611686018427387904; -pub const CELL_BG_RGB_MASK: u32 = 16777215; -pub const CELL_FG_RGB_MASK: u64 = 72057589742960640; -pub const CELL_BG_PALETTE: u32 = 134217728; -pub const NCPALETTESIZE: u32 = 256; -pub const CELL_FG_PALETTE: u64 = 576460752303423488; -pub const CELL_BG_ALPHA_MASK: u32 = 805306368; -pub const CELL_FG_ALPHA_MASK: u64 = 3458764513820540928; -pub const NCSTYLE_MASK: u32 = 1023; -pub const NCSTYLE_STANDOUT: u32 = 128; -pub const NCSTYLE_UNDERLINE: u32 = 64; -pub const NCSTYLE_REVERSE: u32 = 32; -pub const NCSTYLE_BLINK: u32 = 16; -pub const NCSTYLE_DIM: u32 = 8; -pub const NCSTYLE_BOLD: u32 = 4; -pub const NCSTYLE_INVIS: u32 = 2; -pub const NCSTYLE_PROTECT: u32 = 1; -pub const NCSTYLE_ITALIC: u32 = 256; -pub const NCSTYLE_STRUCK: u32 = 512; -pub const NCSTYLE_NONE: u32 = 0; -pub const NCOPTION_INHIBIT_SETLOCALE: u32 = 1; -pub const NCOPTION_NO_CLEAR_BITMAPS: u32 = 2; -pub const NCOPTION_NO_WINCH_SIGHANDLER: u32 = 4; -pub const NCOPTION_NO_QUIT_SIGHANDLERS: u32 = 8; -pub const NCOPTION_SUPPRESS_BANNERS: u32 = 32; -pub const NCOPTION_NO_ALTERNATE_SCREEN: u32 = 64; -pub const NCOPTION_NO_FONT_CHANGES: u32 = 128; -pub const NCPLANE_OPTION_HORALIGNED: u32 = 1; -pub const NCPLANE_OPTION_VERALIGNED: u32 = 2; -pub const NCPLANE_OPTION_MARGINALIZED: u32 = 4; -pub const WCHAR_MAX_UTF8BYTES: u32 = 6; -pub const NCBOXMASK_TOP: u32 = 1; -pub const NCBOXMASK_RIGHT: u32 = 2; -pub const NCBOXMASK_BOTTOM: u32 = 4; -pub const NCBOXMASK_LEFT: u32 = 8; -pub const NCBOXGRAD_TOP: u32 = 16; -pub const NCBOXGRAD_RIGHT: u32 = 32; -pub const NCBOXGRAD_BOTTOM: u32 = 64; -pub const NCBOXGRAD_LEFT: u32 = 128; -pub const NCBOXCORNER_MASK: u32 = 768; -pub const NCBOXCORNER_SHIFT: u32 = 8; -pub const NCVISUAL_OPTION_NODEGRADE: u32 = 1; -pub const NCVISUAL_OPTION_BLEND: u32 = 2; -pub const NCVISUAL_OPTION_HORALIGNED: u32 = 4; -pub const NCVISUAL_OPTION_VERALIGNED: u32 = 8; -pub const NCVISUAL_OPTION_ADDALPHA: u32 = 16; -pub const NCREEL_OPTION_INFINITESCROLL: u32 = 1; -pub const NCREEL_OPTION_CIRCULAR: u32 = 2; -pub const PREFIXCOLUMNS: u32 = 7; -pub const IPREFIXCOLUMNS: u32 = 8; -pub const BPREFIXCOLUMNS: u32 = 9; -pub const PREFIXSTRLEN: u32 = 8; -pub const IPREFIXSTRLEN: u32 = 9; -pub const BPREFIXSTRLEN: u32 = 10; -pub const NCMENU_OPTION_BOTTOM: u32 = 1; -pub const NCMENU_OPTION_HIDING: u32 = 2; -pub const NCPROGBAR_OPTION_RETROGRADE: u32 = 1; -pub const NCTABBED_OPTION_BOTTOM: u32 = 1; -pub const NCPLOT_OPTION_LABELTICKSD: u32 = 1; -pub const NCPLOT_OPTION_EXPONENTIALD: u32 = 2; -pub const NCPLOT_OPTION_VERTICALI: u32 = 4; -pub const NCPLOT_OPTION_NODEGRADE: u32 = 8; -pub const NCPLOT_OPTION_DETECTMAXONLY: u32 = 16; -pub const NCPLOT_OPTION_PRINTSAMPLE: u32 = 32; -pub const NCREADER_OPTION_HORSCROLL: u32 = 1; -pub const NCREADER_OPTION_VERSCROLL: u32 = 2; -pub const NCREADER_OPTION_NOCMDKEYS: u32 = 4; -pub const NCREADER_OPTION_CURSOR: u32 = 8; -pub const NCDIRECT_OPTION_INHIBIT_SETLOCALE: u32 = 1; -pub const NCDIRECT_OPTION_INHIBIT_CBREAK: u32 = 2; -pub const NCDIRECT_OPTION_NO_QUIT_SIGHANDLERS: u32 = 8; -pub type size_t = cty::c_ulong; -#[doc = " Convenience types."] -pub type __u_char = cty::c_uchar; -pub type __u_short = cty::c_ushort; -pub type __u_int = cty::c_uint; -pub type __u_long = cty::c_ulong; -#[doc = " Fixed-size types, underlying types depend on word size and compiler."] -pub type __int8_t = cty::c_schar; -pub type __uint8_t = cty::c_uchar; -pub type __int16_t = cty::c_short; -pub type __uint16_t = cty::c_ushort; -pub type __int32_t = cty::c_int; -pub type __uint32_t = cty::c_uint; -pub type __int64_t = cty::c_long; -pub type __uint64_t = cty::c_ulong; -#[doc = " Smallest types with at least a given width."] -pub type __int_least8_t = __int8_t; -pub type __uint_least8_t = __uint8_t; -pub type __int_least16_t = __int16_t; -pub type __uint_least16_t = __uint16_t; -pub type __int_least32_t = __int32_t; -pub type __uint_least32_t = __uint32_t; -pub type __int_least64_t = __int64_t; -pub type __uint_least64_t = __uint64_t; -pub type __quad_t = cty::c_long; -pub type __u_quad_t = cty::c_ulong; -pub type __intmax_t = cty::c_long; -pub type __uintmax_t = cty::c_ulong; -pub type __dev_t = cty::c_ulong; -pub type __uid_t = cty::c_uint; -pub type __gid_t = cty::c_uint; -pub type __ino_t = cty::c_ulong; -pub type __ino64_t = cty::c_ulong; -pub type __mode_t = cty::c_uint; -pub type __nlink_t = cty::c_ulong; -pub type __off_t = cty::c_long; -pub type __off64_t = cty::c_long; -pub type __pid_t = cty::c_int; -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct __fsid_t { - pub __val: [cty::c_int; 2usize], -} -#[test] -fn bindgen_test_layout___fsid_t() { - assert_eq!( - ::core::mem::size_of::<__fsid_t>(), - 8usize, - concat!("Size of: ", stringify!(__fsid_t)) - ); - assert_eq!( - ::core::mem::align_of::<__fsid_t>(), - 4usize, - concat!("Alignment of ", stringify!(__fsid_t)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<__fsid_t>())).__val as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__fsid_t), - "::", - stringify!(__val) - ) - ); -} -pub type __clock_t = cty::c_long; -pub type __rlim_t = cty::c_ulong; -pub type __rlim64_t = cty::c_ulong; -pub type __id_t = cty::c_uint; -pub type __time_t = cty::c_long; -pub type __useconds_t = cty::c_uint; -pub type __suseconds_t = cty::c_long; -pub type __daddr_t = cty::c_int; -pub type __key_t = cty::c_int; -pub type __clockid_t = cty::c_int; -pub type __timer_t = *mut cty::c_void; -pub type __blksize_t = cty::c_long; -pub type __blkcnt_t = cty::c_long; -pub type __blkcnt64_t = cty::c_long; -pub type __fsblkcnt_t = cty::c_ulong; -pub type __fsblkcnt64_t = cty::c_ulong; -pub type __fsfilcnt_t = cty::c_ulong; -pub type __fsfilcnt64_t = cty::c_ulong; -pub type __fsword_t = cty::c_long; -pub type __ssize_t = cty::c_long; -pub type __syscall_slong_t = cty::c_long; -pub type __syscall_ulong_t = cty::c_ulong; -#[doc = " These few don't really vary by system, they always correspond"] -#[doc = "to one of the other defined types."] -pub type __loff_t = __off64_t; -pub type __caddr_t = *mut cty::c_char; -pub type __intptr_t = cty::c_long; -pub type __socklen_t = cty::c_uint; -#[doc = " C99: An integer type that can be accessed as an atomic entity,"] -#[doc = "even in the presence of asynchronous interrupts."] -#[doc = "It is not currently necessary for this to be machine-specific."] -pub type __sig_atomic_t = cty::c_int; -extern "C" { - #[doc = " Even though CLOCKS_PER_SEC has such a strange value CLK_TCK"] - #[doc = "presents the real value for clock ticks per second for the system."] - pub fn __sysconf(arg1: cty::c_int) -> cty::c_long; -} -#[doc = " Returned by `clock'."] -pub type clock_t = __clock_t; -#[doc = " Returned by `time'."] -pub type time_t = __time_t; -#[doc = " ISO C `broken-down time' structure."] -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct tm { - #[doc = " Seconds.\t[0-60] (1 leap second)"] - pub tm_sec: cty::c_int, - #[doc = " Minutes.\t[0-59]"] - pub tm_min: cty::c_int, - #[doc = " Hours.\t[0-23]"] - pub tm_hour: cty::c_int, - #[doc = " Day.\t\t[1-31]"] - pub tm_mday: cty::c_int, - #[doc = " Month.\t[0-11]"] - pub tm_mon: cty::c_int, - #[doc = " Year\t- 1900."] - pub tm_year: cty::c_int, - #[doc = " Day of week.\t[0-6]"] - pub tm_wday: cty::c_int, - #[doc = " Days in year.[0-365]"] - pub tm_yday: cty::c_int, - #[doc = " DST.\t\t[-1/0/1]"] - pub tm_isdst: cty::c_int, - #[doc = " Seconds east of UTC."] - pub __tm_gmtoff: cty::c_long, - #[doc = " Timezone abbreviation."] - pub __tm_zone: *const cty::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 Default for tm { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[doc = " POSIX.1b structure for a time value. This is like a `struct timeval' but"] -#[doc = "has nanoseconds instead of microseconds."] -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct timespec { - #[doc = " Seconds."] - pub tv_sec: __time_t, - #[doc = " Nanoseconds."] - pub tv_nsec: __syscall_slong_t, -} -#[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) - ) - ); -} -extern "C" { - #[doc = " Time used by the program so far (user time + system time)."] - #[doc = "The result / CLOCKS_PER_SEC is program time in seconds."] - pub fn clock() -> clock_t; -} -extern "C" { - #[doc = " Return the current time and put it in *TIMER if TIMER is not NULL."] - pub fn time(__timer: *mut time_t) -> time_t; -} -extern "C" { - #[doc = " Return the difference between TIME1 and TIME0."] - pub fn difftime(__time1: time_t, __time0: time_t) -> f64; -} -extern "C" { - #[doc = " Return the `time_t' representation of TP and normalize TP."] - pub fn mktime(__tp: *mut tm) -> time_t; -} -extern "C" { - #[doc = " Format TP into S according to FORMAT."] - #[doc = "Write no more than MAXSIZE characters and return the number"] - #[doc = "of characters written, or 0 if it would exceed MAXSIZE."] - pub fn strftime( - __s: *mut cty::c_char, - __maxsize: size_t, - __format: *const cty::c_char, - __tp: *const tm, - ) -> size_t; -} -extern "C" { - #[doc = " Parse S according to FORMAT and store binary time information in TP."] - #[doc = "The return value is a pointer to the first unparsed character in S."] - pub fn strptime( - __s: *const cty::c_char, - __fmt: *const cty::c_char, - __tp: *mut tm, - ) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Return the `struct tm' representation of *TIMER"] - #[doc = "in Universal Coordinated Time (aka Greenwich Mean Time)."] - pub fn gmtime(__timer: *const time_t) -> *mut tm; -} -extern "C" { - #[doc = " Return the `struct tm' representation"] - #[doc = "of *TIMER in the local timezone."] - pub fn localtime(__timer: *const time_t) -> *mut tm; -} -extern "C" { - #[doc = " Return the `struct tm' representation of *TIMER in UTC,"] - #[doc = "using *TP to store the result."] - pub fn gmtime_r(__timer: *const time_t, __tp: *mut tm) -> *mut tm; -} -extern "C" { - #[doc = " Return the `struct tm' representation of *TIMER in local time,"] - #[doc = "using *TP to store the result."] - pub fn localtime_r(__timer: *const time_t, __tp: *mut tm) -> *mut tm; -} -extern "C" { - #[doc = " Return a string of the form \"Day Mon dd hh:mm:ss yyyy\\n\""] - #[doc = "that is the representation of TP in this format."] - pub fn asctime(__tp: *const tm) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Equivalent to `asctime (localtime (timer))'."] - pub fn ctime(__timer: *const time_t) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Return in BUF a string of the form \"Day Mon dd hh:mm:ss yyyy\\n\""] - #[doc = "that is the representation of TP in this format."] - pub fn asctime_r(__tp: *const tm, __buf: *mut cty::c_char) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Equivalent to `asctime_r (localtime_r (timer, *TMP*), buf)'."] - pub fn ctime_r(__timer: *const time_t, __buf: *mut cty::c_char) -> *mut cty::c_char; -} -extern "C" { - pub static mut __tzname: [*mut cty::c_char; 2usize]; -} -extern "C" { - pub static mut __daylight: cty::c_int; -} -extern "C" { - pub static mut __timezone: cty::c_long; -} -extern "C" { - pub static mut tzname: [*mut cty::c_char; 2usize]; -} -extern "C" { - #[doc = " Set time conversion information from the TZ environment variable."] - #[doc = "If TZ is not defined, a locale-dependent default is used."] - pub fn tzset(); -} -extern "C" { - pub static mut daylight: cty::c_int; -} -extern "C" { - pub static mut timezone: cty::c_long; -} -extern "C" { - #[doc = " Set TS to calendar time based in time base BASE."] - pub fn timespec_get(__ts: *mut timespec, __base: cty::c_int) -> cty::c_int; -} -#[doc = " Conversion state information."] -#[repr(C)] -#[derive(Copy, Clone)] -pub struct __mbstate_t { - pub __count: cty::c_int, - #[doc = " Value so far."] - pub __value: __mbstate_t__bindgen_ty_1, -} -#[repr(C)] -#[derive(Copy, Clone)] -pub union __mbstate_t__bindgen_ty_1 { - pub __wch: cty::c_uint, - pub __wchb: [cty::c_char; 4usize], -} -#[test] -fn bindgen_test_layout___mbstate_t__bindgen_ty_1() { - assert_eq!( - ::core::mem::size_of::<__mbstate_t__bindgen_ty_1>(), - 4usize, - concat!("Size of: ", stringify!(__mbstate_t__bindgen_ty_1)) - ); - assert_eq!( - ::core::mem::align_of::<__mbstate_t__bindgen_ty_1>(), - 4usize, - concat!("Alignment of ", stringify!(__mbstate_t__bindgen_ty_1)) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::<__mbstate_t__bindgen_ty_1>())).__wch as *const _ as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__mbstate_t__bindgen_ty_1), - "::", - stringify!(__wch) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::<__mbstate_t__bindgen_ty_1>())).__wchb as *const _ as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__mbstate_t__bindgen_ty_1), - "::", - stringify!(__wchb) - ) - ); -} -impl Default for __mbstate_t__bindgen_ty_1 { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[test] -fn bindgen_test_layout___mbstate_t() { - assert_eq!( - ::core::mem::size_of::<__mbstate_t>(), - 8usize, - concat!("Size of: ", stringify!(__mbstate_t)) - ); - assert_eq!( - ::core::mem::align_of::<__mbstate_t>(), - 4usize, - concat!("Alignment of ", stringify!(__mbstate_t)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<__mbstate_t>())).__count as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__mbstate_t), - "::", - stringify!(__count) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<__mbstate_t>())).__value as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(__mbstate_t), - "::", - stringify!(__value) - ) - ); -} -impl Default for __mbstate_t { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -pub type mbstate_t = __mbstate_t; -#[doc = " Define the 16-bit and 32-bit character types."] -pub type char16_t = __uint_least16_t; -pub type char32_t = __uint_least32_t; -extern "C" { - #[doc = " Write char16_t representation of multibyte character pointed"] - #[doc = "to by S to PC16."] - pub fn mbrtoc16( - __pc16: *mut char16_t, - __s: *const cty::c_char, - __n: size_t, - __p: *mut mbstate_t, - ) -> size_t; -} -extern "C" { - #[doc = " Write multibyte representation of char16_t C16 to S."] - pub fn c16rtomb(__s: *mut cty::c_char, __c16: char16_t, __ps: *mut mbstate_t) -> size_t; -} -extern "C" { - #[doc = " Write char32_t representation of multibyte character pointed"] - #[doc = "to by S to PC32."] - pub fn mbrtoc32( - __pc32: *mut char32_t, - __s: *const cty::c_char, - __n: size_t, - __p: *mut mbstate_t, - ) -> size_t; -} -extern "C" { - #[doc = " Write multibyte representation of char32_t C32 to S."] - pub fn c32rtomb(__s: *mut cty::c_char, __c32: char32_t, __ps: *mut mbstate_t) -> size_t; -} -#[doc = " UPPERCASE."] -pub const _ISupper: cty::c_uint = 256; -#[doc = " lowercase."] -pub const _ISlower: cty::c_uint = 512; -#[doc = " Alphabetic."] -pub const _ISalpha: cty::c_uint = 1024; -#[doc = " Numeric."] -pub const _ISdigit: cty::c_uint = 2048; -#[doc = " Hexadecimal numeric."] -pub const _ISxdigit: cty::c_uint = 4096; -#[doc = " Whitespace."] -pub const _ISspace: cty::c_uint = 8192; -#[doc = " Printing."] -pub const _ISprint: cty::c_uint = 16384; -#[doc = " Graphical."] -pub const _ISgraph: cty::c_uint = 32768; -#[doc = " Blank (usually SPC and TAB)."] -pub const _ISblank: cty::c_uint = 1; -#[doc = " Control character."] -pub const _IScntrl: cty::c_uint = 2; -#[doc = " Punctuation."] -pub const _ISpunct: cty::c_uint = 4; -#[doc = " Alphanumeric."] -pub const _ISalnum: cty::c_uint = 8; -pub type _bindgen_ty_1 = cty::c_uint; -extern "C" { - #[doc = " These are defined in ctype-info.c."] - #[doc = "The declarations here must match those in localeinfo.h."] - #[doc = ""] - #[doc = "In the thread-specific locale model (see `uselocale' in )"] - #[doc = "we cannot use global variables for these as was done in the past."] - #[doc = "Instead, the following accessor functions return the address of"] - #[doc = "each variable, which is local to the current thread if multithreaded."] - #[doc = ""] - #[doc = "These point into arrays of 384, so they can be indexed by any `unsigned"] - #[doc = "char' value [0,255]; by EOF (-1); or by any `signed char' value"] - #[doc = "[-128,-1). ISO C requires that the ctype functions work for `unsigned"] - #[doc = "char' values and for EOF; we also support negative `signed char' values"] - #[doc = "for broken old programs. The case conversion arrays are of `int's"] - #[doc = "rather than `unsigned char's because tolower (EOF) must be EOF, which"] - #[doc = "doesn't fit into an `unsigned char'. But today more important is that"] - #[doc = "the arrays are also used for multi-byte character sets."] - pub fn __ctype_b_loc() -> *mut *const cty::c_ushort; -} -extern "C" { - pub fn __ctype_tolower_loc() -> *mut *const __int32_t; -} -extern "C" { - pub fn __ctype_toupper_loc() -> *mut *const __int32_t; -} -extern "C" { - pub fn isalnum(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn isalpha(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn iscntrl(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn isdigit(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn islower(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn isgraph(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn isprint(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn ispunct(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn isspace(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn isupper(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn isxdigit(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Return the lowercase version of C."] - pub fn tolower(__c: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Return the uppercase version of C."] - pub fn toupper(__c: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn isblank(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Return nonzero iff C is in the ASCII set"] - #[doc = "(i.e., is no more than 7 bits wide)."] - pub fn isascii(__c: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Return the part of C that is in the ASCII set"] - #[doc = "(i.e., the low-order 7 bits of C)."] - pub fn toascii(__c: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn _toupper(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn _tolower(arg1: cty::c_int) -> cty::c_int; -} -pub type _Float32 = f32; -pub type _Float64 = f64; -pub type _Float32x = f64; -pub type _Float64x = u128; -pub type wchar_t = cty::c_int; -pub type va_list = __builtin_va_list; -pub type __gnuc_va_list = __builtin_va_list; -pub type wint_t = cty::c_uint; -pub type __FILE = _IO_FILE; -#[doc = " Scalar type that can hold values which represent locale-specific"] -#[doc = "character classifications."] -pub type wctype_t = cty::c_ulong; -#[doc = " UPPERCASE."] -pub const __ISwupper: cty::c_int = 0; -#[doc = " lowercase."] -pub const __ISwlower: cty::c_int = 1; -#[doc = " Alphabetic."] -pub const __ISwalpha: cty::c_int = 2; -#[doc = " Numeric."] -pub const __ISwdigit: cty::c_int = 3; -#[doc = " Hexadecimal numeric."] -pub const __ISwxdigit: cty::c_int = 4; -#[doc = " Whitespace."] -pub const __ISwspace: cty::c_int = 5; -#[doc = " Printing."] -pub const __ISwprint: cty::c_int = 6; -#[doc = " Graphical."] -pub const __ISwgraph: cty::c_int = 7; -#[doc = " Blank (usually SPC and TAB)."] -pub const __ISwblank: cty::c_int = 8; -#[doc = " Control character."] -pub const __ISwcntrl: cty::c_int = 9; -#[doc = " Punctuation."] -pub const __ISwpunct: cty::c_int = 10; -#[doc = " Alphanumeric."] -pub const __ISwalnum: cty::c_int = 11; -#[doc = " UPPERCASE."] -pub const _ISwupper: cty::c_int = 16777216; -#[doc = " lowercase."] -pub const _ISwlower: cty::c_int = 33554432; -#[doc = " Alphabetic."] -pub const _ISwalpha: cty::c_int = 67108864; -#[doc = " Numeric."] -pub const _ISwdigit: cty::c_int = 134217728; -#[doc = " Hexadecimal numeric."] -pub const _ISwxdigit: cty::c_int = 268435456; -#[doc = " Whitespace."] -pub const _ISwspace: cty::c_int = 536870912; -#[doc = " Printing."] -pub const _ISwprint: cty::c_int = 1073741824; -#[doc = " Graphical."] -pub const _ISwgraph: cty::c_int = -2147483648; -#[doc = " Blank (usually SPC and TAB)."] -pub const _ISwblank: cty::c_int = 65536; -#[doc = " Control character."] -pub const _ISwcntrl: cty::c_int = 131072; -#[doc = " Punctuation."] -pub const _ISwpunct: cty::c_int = 262144; -#[doc = " Alphanumeric."] -pub const _ISwalnum: cty::c_int = 524288; -pub type _bindgen_ty_2 = cty::c_int; -extern "C" { - #[doc = " Test for any wide character for which `iswalpha' or `iswdigit' is"] - #[doc = "true."] - pub fn iswalnum(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any wide character for which `iswupper' or 'iswlower' is"] - #[doc = "true, or any wide character that is one of a locale-specific set of"] - #[doc = "wide-characters for which none of `iswcntrl', `iswdigit',"] - #[doc = "`iswpunct', or `iswspace' is true."] - pub fn iswalpha(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any control wide character."] - pub fn iswcntrl(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any wide character that corresponds to a decimal-digit"] - #[doc = "character."] - pub fn iswdigit(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any wide character for which `iswprint' is true and"] - #[doc = "`iswspace' is false."] - pub fn iswgraph(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any wide character that corresponds to a lowercase letter"] - #[doc = "or is one of a locale-specific set of wide characters for which"] - #[doc = "none of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true."] - pub fn iswlower(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any printing wide character."] - pub fn iswprint(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any printing wide character that is one of a"] - #[doc = "locale-specific et of wide characters for which neither `iswspace'"] - #[doc = "nor `iswalnum' is true."] - pub fn iswpunct(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any wide character that corresponds to a locale-specific"] - #[doc = "set of wide characters for which none of `iswalnum', `iswgraph', or"] - #[doc = "`iswpunct' is true."] - pub fn iswspace(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any wide character that corresponds to an uppercase letter"] - #[doc = "or is one of a locale-specific set of wide character for which none"] - #[doc = "of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true."] - pub fn iswupper(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any wide character that corresponds to a hexadecimal-digit"] - #[doc = "character equivalent to that performed be the functions described"] - #[doc = "in the previous subclause."] - pub fn iswxdigit(__wc: wint_t) -> cty::c_int; -} -extern "C" { - pub fn iswblank(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Construct value that describes a class of wide characters identified"] - #[doc = "by the string argument PROPERTY."] - pub fn wctype(__property: *const cty::c_char) -> wctype_t; -} -extern "C" { - #[doc = " Determine whether the wide-character WC has the property described by"] - #[doc = "DESC."] - pub fn iswctype(__wc: wint_t, __desc: wctype_t) -> cty::c_int; -} -extern "C" { - #[doc = " Converts an uppercase letter to the corresponding lowercase letter."] - pub fn towlower(__wc: wint_t) -> wint_t; -} -extern "C" { - #[doc = " Converts an lowercase letter to the corresponding uppercase letter."] - pub fn towupper(__wc: wint_t) -> wint_t; -} -extern "C" { - #[doc = " Copy SRC to DEST."] - pub fn wcscpy(__dest: *mut wchar_t, __src: *const wchar_t) -> *mut wchar_t; -} -extern "C" { - #[doc = " Copy no more than N wide-characters of SRC to DEST."] - pub fn wcsncpy(__dest: *mut wchar_t, __src: *const wchar_t, __n: size_t) -> *mut wchar_t; -} -extern "C" { - #[doc = " Append SRC onto DEST."] - pub fn wcscat(__dest: *mut wchar_t, __src: *const wchar_t) -> *mut wchar_t; -} -extern "C" { - #[doc = " Append no more than N wide-characters of SRC onto DEST."] - pub fn wcsncat(__dest: *mut wchar_t, __src: *const wchar_t, __n: size_t) -> *mut wchar_t; -} -extern "C" { - #[doc = " Compare S1 and S2."] - pub fn wcscmp(__s1: *const cty::c_int, __s2: *const cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Compare N wide-characters of S1 and S2."] - pub fn wcsncmp( - __s1: *const cty::c_int, - __s2: *const cty::c_int, - __n: cty::c_ulong, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Compare S1 and S2, both interpreted as appropriate to the"] - #[doc = "LC_COLLATE category of the current locale."] - pub fn wcscoll(__s1: *const wchar_t, __s2: *const wchar_t) -> cty::c_int; -} -extern "C" { - #[doc = " Transform S2 into array pointed to by S1 such that if wcscmp is"] - #[doc = "applied to two transformed strings the result is the as applying"] - #[doc = "`wcscoll' to the original strings."] - pub fn wcsxfrm(__s1: *mut wchar_t, __s2: *const wchar_t, __n: size_t) -> size_t; -} -extern "C" { - pub fn wcschr(__wcs: *const cty::c_int, __wc: cty::c_int) -> *mut cty::c_int; -} -extern "C" { - pub fn wcsrchr(__wcs: *const wchar_t, __wc: wchar_t) -> *mut wchar_t; -} -extern "C" { - #[doc = " Return the length of the initial segmet of WCS which"] - #[doc = "consists entirely of wide characters not in REJECT."] - pub fn wcscspn(__wcs: *const wchar_t, __reject: *const wchar_t) -> size_t; -} -extern "C" { - #[doc = " Return the length of the initial segmet of WCS which"] - #[doc = "consists entirely of wide characters in ACCEPT."] - pub fn wcsspn(__wcs: *const wchar_t, __accept: *const wchar_t) -> size_t; -} -extern "C" { - pub fn wcspbrk(__wcs: *const wchar_t, __accept: *const wchar_t) -> *mut wchar_t; -} -extern "C" { - pub fn wcsstr(__haystack: *const wchar_t, __needle: *const wchar_t) -> *mut wchar_t; -} -extern "C" { - #[doc = " Divide WCS into tokens separated by characters in DELIM."] - pub fn wcstok( - __s: *mut wchar_t, - __delim: *const wchar_t, - __ptr: *mut *mut wchar_t, - ) -> *mut wchar_t; -} -extern "C" { - #[doc = " Return the number of wide characters in S."] - pub fn wcslen(__s: *const cty::c_int) -> cty::c_ulong; -} -extern "C" { - pub fn wcswcs(__haystack: *const wchar_t, __needle: *const wchar_t) -> *mut wchar_t; -} -extern "C" { - pub fn wmemchr(__s: *const cty::c_int, __c: cty::c_int, __n: cty::c_ulong) -> *mut cty::c_int; -} -extern "C" { - #[doc = " Compare N wide characters of S1 and S2."] - pub fn wmemcmp( - __s1: *const cty::c_int, - __s2: *const cty::c_int, - __n: cty::c_ulong, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Copy N wide characters of SRC to DEST."] - pub fn wmemcpy( - __s1: *mut cty::c_int, - __s2: *const cty::c_int, - __n: cty::c_ulong, - ) -> *mut cty::c_int; -} -extern "C" { - #[doc = " Copy N wide characters of SRC to DEST, guaranteeing"] - #[doc = "correct behavior for overlapping strings."] - pub fn wmemmove( - __s1: *mut cty::c_int, - __s2: *const cty::c_int, - __n: cty::c_ulong, - ) -> *mut cty::c_int; -} -extern "C" { - #[doc = " Set N wide characters of S to C."] - pub fn wmemset(__s: *mut wchar_t, __c: wchar_t, __n: size_t) -> *mut wchar_t; -} -extern "C" { - #[doc = " Determine whether C constitutes a valid (one-byte) multibyte"] - #[doc = "character."] - pub fn btowc(__c: cty::c_int) -> wint_t; -} -extern "C" { - #[doc = " Determine whether C corresponds to a member of the extended"] - #[doc = "character set whose multibyte representation is a single byte."] - pub fn wctob(__c: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Determine whether PS points to an object representing the initial"] - #[doc = "state."] - pub fn mbsinit(__ps: *const mbstate_t) -> cty::c_int; -} -extern "C" { - #[doc = " Write wide character representation of multibyte character pointed"] - #[doc = "to by S to PWC."] - pub fn mbrtowc( - __pwc: *mut wchar_t, - __s: *const cty::c_char, - __n: size_t, - __p: *mut mbstate_t, - ) -> size_t; -} -extern "C" { - #[doc = " Write multibyte representation of wide character WC to S."] - pub fn wcrtomb(__s: *mut cty::c_char, __wc: wchar_t, __ps: *mut mbstate_t) -> size_t; -} -extern "C" { - #[doc = " Return number of bytes in multibyte character pointed to by S."] - pub fn __mbrlen(__s: *const cty::c_char, __n: size_t, __ps: *mut mbstate_t) -> size_t; -} -extern "C" { - pub fn mbrlen(__s: *const cty::c_char, __n: size_t, __ps: *mut mbstate_t) -> size_t; -} -extern "C" { - #[doc = " Write wide character representation of multibyte character string"] - #[doc = "SRC to DST."] - pub fn mbsrtowcs( - __dst: *mut wchar_t, - __src: *mut *const cty::c_char, - __len: size_t, - __ps: *mut mbstate_t, - ) -> size_t; -} -extern "C" { - #[doc = " Write multibyte character representation of wide character string"] - #[doc = "SRC to DST."] - pub fn wcsrtombs( - __dst: *mut cty::c_char, - __src: *mut *const wchar_t, - __len: size_t, - __ps: *mut mbstate_t, - ) -> size_t; -} -extern "C" { - #[doc = " Determine number of column positions required for C."] - pub fn wcwidth(__c: wchar_t) -> cty::c_int; -} -extern "C" { - #[doc = " Determine number of column positions required for first N wide"] - #[doc = "characters (or fewer if S ends before this) in S."] - pub fn wcswidth(__s: *const wchar_t, __n: size_t) -> cty::c_int; -} -extern "C" { - #[doc = " Convert initial portion of the wide string NPTR to `double'"] - #[doc = "representation."] - pub fn wcstod(__nptr: *const wchar_t, __endptr: *mut *mut wchar_t) -> f64; -} -extern "C" { - #[doc = " Likewise for `float' and `long double' sizes of floating-point numbers."] - pub fn wcstof(__nptr: *const wchar_t, __endptr: *mut *mut wchar_t) -> f32; -} -extern "C" { - #[doc = " Convert initial portion of wide string NPTR to `long int'"] - #[doc = "representation."] - pub fn wcstol( - __nptr: *const wchar_t, - __endptr: *mut *mut wchar_t, - __base: cty::c_int, - ) -> cty::c_long; -} -extern "C" { - #[doc = " Convert initial portion of wide string NPTR to `unsigned long int'"] - #[doc = "representation."] - pub fn wcstoul( - __nptr: *const wchar_t, - __endptr: *mut *mut wchar_t, - __base: cty::c_int, - ) -> cty::c_ulong; -} -extern "C" { - #[doc = " Convert initial portion of wide string NPTR to `long long int'"] - #[doc = "representation."] - pub fn wcstoll( - __nptr: *const wchar_t, - __endptr: *mut *mut wchar_t, - __base: cty::c_int, - ) -> cty::c_longlong; -} -extern "C" { - #[doc = " Convert initial portion of wide string NPTR to `unsigned long long int'"] - #[doc = "representation."] - pub fn wcstoull( - __nptr: *const wchar_t, - __endptr: *mut *mut wchar_t, - __base: cty::c_int, - ) -> cty::c_ulonglong; -} -extern "C" { - #[doc = " Select orientation for stream."] - pub fn fwide(__fp: *mut __FILE, __mode: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fwprintf(__stream: *mut __FILE, __format: *const wchar_t, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to stdout."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn wprintf(__format: *const wchar_t, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output of at most N characters to S."] - pub fn swprintf(__s: *mut wchar_t, __n: size_t, __format: *const wchar_t, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to S from argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn vfwprintf( - __s: *mut __FILE, - __format: *const wchar_t, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to stdout from argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn vwprintf(__format: *const wchar_t, __arg: *mut __va_list_tag) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output of at most N character to S from argument"] - #[doc = "list ARG."] - pub fn vswprintf( - __s: *mut wchar_t, - __n: size_t, - __format: *const wchar_t, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fwscanf(__stream: *mut __FILE, __format: *const wchar_t, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from stdin."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn wscanf(__format: *const wchar_t, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S."] - pub fn swscanf(__s: *const wchar_t, __format: *const wchar_t, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - #[link_name = "\u{1}__isoc99_fwscanf"] - pub fn fwscanf1(__stream: *mut __FILE, __format: *const wchar_t, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from stdin."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - #[link_name = "\u{1}__isoc99_wscanf"] - pub fn wscanf1(__format: *const wchar_t, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S."] - #[link_name = "\u{1}__isoc99_swscanf"] - pub fn swscanf1(__s: *const wchar_t, __format: *const wchar_t, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S into argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn vfwscanf( - __s: *mut __FILE, - __format: *const wchar_t, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from stdin into argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn vwscanf(__format: *const wchar_t, __arg: *mut __va_list_tag) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S into argument list ARG."] - pub fn vswscanf( - __s: *const wchar_t, - __format: *const wchar_t, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Read a character from STREAM."] - #[doc = ""] - #[doc = "These functions are possible cancellation points and therefore not"] - #[doc = "marked with __THROW."] - pub fn fgetwc(__stream: *mut __FILE) -> wint_t; -} -extern "C" { - pub fn getwc(__stream: *mut __FILE) -> wint_t; -} -extern "C" { - #[doc = " Read a character from stdin."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn getwchar() -> wint_t; -} -extern "C" { - #[doc = " Write a character to STREAM."] - #[doc = ""] - #[doc = "These functions are possible cancellation points and therefore not"] - #[doc = "marked with __THROW."] - pub fn fputwc(__wc: wchar_t, __stream: *mut __FILE) -> wint_t; -} -extern "C" { - pub fn putwc(__wc: wchar_t, __stream: *mut __FILE) -> wint_t; -} -extern "C" { - #[doc = " Write a character to stdout."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn putwchar(__wc: wchar_t) -> wint_t; -} -extern "C" { - #[doc = " Get a newline-terminated wide character string of finite length"] - #[doc = "from STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fgetws(__ws: *mut wchar_t, __n: cty::c_int, __stream: *mut __FILE) -> *mut wchar_t; -} -extern "C" { - #[doc = " Write a string to STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fputws(__ws: *const wchar_t, __stream: *mut __FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Push a character back onto the input buffer of STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn ungetwc(__wc: wint_t, __stream: *mut __FILE) -> wint_t; -} -extern "C" { - #[doc = " Format TP into S according to FORMAT."] - #[doc = "Write no more than MAXSIZE wide characters and return the number"] - #[doc = "of wide characters written, or 0 if it would exceed MAXSIZE."] - pub fn wcsftime( - __s: *mut wchar_t, - __maxsize: size_t, - __format: *const wchar_t, - __tp: *const tm, - ) -> size_t; -} -#[doc = " The tag name of this struct is _G_fpos_t to preserve historic"] -#[doc = "C++ mangled names for functions taking fpos_t arguments."] -#[doc = "That name should not be used in new code."] -#[repr(C)] -#[derive(Copy, Clone)] -pub struct _G_fpos_t { - pub __pos: __off_t, - pub __state: __mbstate_t, -} -#[test] -fn bindgen_test_layout__G_fpos_t() { - assert_eq!( - ::core::mem::size_of::<_G_fpos_t>(), - 16usize, - concat!("Size of: ", stringify!(_G_fpos_t)) - ); - assert_eq!( - ::core::mem::align_of::<_G_fpos_t>(), - 8usize, - concat!("Alignment of ", stringify!(_G_fpos_t)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_G_fpos_t>())).__pos as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(_G_fpos_t), - "::", - stringify!(__pos) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_G_fpos_t>())).__state as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(_G_fpos_t), - "::", - stringify!(__state) - ) - ); -} -impl Default for _G_fpos_t { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[doc = " The tag name of this struct is _G_fpos_t to preserve historic"] -#[doc = "C++ mangled names for functions taking fpos_t arguments."] -#[doc = "That name should not be used in new code."] -pub type __fpos_t = _G_fpos_t; -#[doc = " The tag name of this struct is _G_fpos64_t to preserve historic"] -#[doc = "C++ mangled names for functions taking fpos_t and/or fpos64_t"] -#[doc = "arguments. That name should not be used in new code."] -#[repr(C)] -#[derive(Copy, Clone)] -pub struct _G_fpos64_t { - pub __pos: __off64_t, - pub __state: __mbstate_t, -} -#[test] -fn bindgen_test_layout__G_fpos64_t() { - assert_eq!( - ::core::mem::size_of::<_G_fpos64_t>(), - 16usize, - concat!("Size of: ", stringify!(_G_fpos64_t)) - ); - assert_eq!( - ::core::mem::align_of::<_G_fpos64_t>(), - 8usize, - concat!("Alignment of ", stringify!(_G_fpos64_t)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_G_fpos64_t>())).__pos as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(_G_fpos64_t), - "::", - stringify!(__pos) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_G_fpos64_t>())).__state as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(_G_fpos64_t), - "::", - stringify!(__state) - ) - ); -} -impl Default for _G_fpos64_t { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[doc = " The tag name of this struct is _G_fpos64_t to preserve historic"] -#[doc = "C++ mangled names for functions taking fpos_t and/or fpos64_t"] -#[doc = "arguments. That name should not be used in new code."] -pub type __fpos64_t = _G_fpos64_t; -#[doc = " The opaque type of streams. This is the definition used elsewhere."] -pub type FILE = _IO_FILE; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct _IO_marker { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct _IO_codecvt { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct _IO_wide_data { - _unused: [u8; 0], -} -pub type _IO_lock_t = cty::c_void; -#[doc = " The tag name of this struct is _IO_FILE to preserve historic"] -#[doc = "C++ mangled names for functions taking FILE* arguments."] -#[doc = "That name should not be used in new code."] -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct _IO_FILE { - #[doc = " High-order word is _IO_MAGIC; rest is flags."] - pub _flags: cty::c_int, - #[doc = " Current read pointer"] - pub _IO_read_ptr: *mut cty::c_char, - #[doc = " End of get area."] - pub _IO_read_end: *mut cty::c_char, - #[doc = " Start of putback+get area."] - pub _IO_read_base: *mut cty::c_char, - #[doc = " Start of put area."] - pub _IO_write_base: *mut cty::c_char, - #[doc = " Current put pointer."] - pub _IO_write_ptr: *mut cty::c_char, - #[doc = " End of put area."] - pub _IO_write_end: *mut cty::c_char, - #[doc = " Start of reserve area."] - pub _IO_buf_base: *mut cty::c_char, - #[doc = " End of reserve area."] - pub _IO_buf_end: *mut cty::c_char, - #[doc = " Pointer to start of non-current get area."] - pub _IO_save_base: *mut cty::c_char, - #[doc = " Pointer to first valid character of backup area"] - pub _IO_backup_base: *mut cty::c_char, - #[doc = " Pointer to end of non-current get area."] - pub _IO_save_end: *mut cty::c_char, - pub _markers: *mut _IO_marker, - pub _chain: *mut _IO_FILE, - pub _fileno: cty::c_int, - pub _flags2: cty::c_int, - #[doc = " This used to be _offset but it's too small."] - pub _old_offset: __off_t, - #[doc = " 1+column number of pbase(); 0 is unknown."] - pub _cur_column: cty::c_ushort, - pub _vtable_offset: cty::c_schar, - pub _shortbuf: [cty::c_char; 1usize], - pub _lock: *mut _IO_lock_t, - pub _offset: __off64_t, - #[doc = " Wide character stream stuff."] - pub _codecvt: *mut _IO_codecvt, - pub _wide_data: *mut _IO_wide_data, - pub _freeres_list: *mut _IO_FILE, - pub _freeres_buf: *mut cty::c_void, - pub __pad5: size_t, - pub _mode: cty::c_int, - #[doc = " Make sure we don't get into trouble again."] - pub _unused2: [cty::c_char; 20usize], -} -#[test] -fn bindgen_test_layout__IO_FILE() { - assert_eq!( - ::core::mem::size_of::<_IO_FILE>(), - 216usize, - concat!("Size of: ", stringify!(_IO_FILE)) - ); - assert_eq!( - ::core::mem::align_of::<_IO_FILE>(), - 8usize, - concat!("Alignment of ", stringify!(_IO_FILE)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._flags as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_flags) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_read_ptr as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_read_ptr) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_read_end as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_read_end) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_read_base as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_read_base) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_write_base as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_write_base) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_write_ptr as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_write_ptr) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_write_end as *const _ as usize }, - 48usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_write_end) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_buf_base as *const _ as usize }, - 56usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_buf_base) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_buf_end as *const _ as usize }, - 64usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_buf_end) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_save_base as *const _ as usize }, - 72usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_save_base) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_backup_base as *const _ as usize }, - 80usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_backup_base) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_save_end as *const _ as usize }, - 88usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_save_end) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._markers as *const _ as usize }, - 96usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_markers) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._chain as *const _ as usize }, - 104usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_chain) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._fileno as *const _ as usize }, - 112usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_fileno) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._flags2 as *const _ as usize }, - 116usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_flags2) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._old_offset as *const _ as usize }, - 120usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_old_offset) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._cur_column as *const _ as usize }, - 128usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_cur_column) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._vtable_offset as *const _ as usize }, - 130usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_vtable_offset) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._shortbuf as *const _ as usize }, - 131usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_shortbuf) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._lock as *const _ as usize }, - 136usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_lock) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._offset as *const _ as usize }, - 144usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_offset) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._codecvt as *const _ as usize }, - 152usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_codecvt) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._wide_data as *const _ as usize }, - 160usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_wide_data) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._freeres_list as *const _ as usize }, - 168usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_freeres_list) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._freeres_buf as *const _ as usize }, - 176usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_freeres_buf) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>())).__pad5 as *const _ as usize }, - 184usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(__pad5) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._mode as *const _ as usize }, - 192usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_mode) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._unused2 as *const _ as usize }, - 196usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_unused2) - ) - ); -} -impl Default for _IO_FILE { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -pub type fpos_t = __fpos_t; -extern "C" { - pub static mut stdin: *mut FILE; -} -extern "C" { - pub static mut stdout: *mut FILE; -} -extern "C" { - pub static mut stderr: *mut FILE; -} -extern "C" { - #[doc = " Remove file FILENAME."] - pub fn remove(__filename: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Rename file OLD to NEW."] - pub fn rename(__old: *const cty::c_char, __new: *const cty::c_char) -> cty::c_int; -} -extern "C" { - pub fn tmpfile() -> *mut FILE; -} -extern "C" { - #[doc = " Generate a temporary filename."] - pub fn tmpnam(__s: *mut cty::c_char) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Generate a unique temporary filename using up to five characters of PFX"] - #[doc = "if it is not NULL. The directory to put this file in is searched for"] - #[doc = "as follows: First the environment variable \"TMPDIR\" is checked."] - #[doc = "If it contains the name of a writable directory, that directory is used."] - #[doc = "If not and if DIR is not NULL, that value is checked. If that fails,"] - #[doc = "P_tmpdir is tried and finally \"/tmp\". The storage for the filename"] - #[doc = "is allocated by `malloc'."] - pub fn tempnam(__dir: *const cty::c_char, __pfx: *const cty::c_char) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Close STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fclose(__stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Flush STREAM, or all streams if STREAM is NULL."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fflush(__stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Open a file and create a new stream for it."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fopen(__filename: *const cty::c_char, __modes: *const cty::c_char) -> *mut FILE; -} -extern "C" { - #[doc = " Open a file, replacing an existing stream with it."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn freopen( - __filename: *const cty::c_char, - __modes: *const cty::c_char, - __stream: *mut FILE, - ) -> *mut FILE; -} -extern "C" { - #[doc = " Create a new stream that refers to an existing system file descriptor."] - pub fn fdopen(__fd: cty::c_int, __modes: *const cty::c_char) -> *mut FILE; -} -extern "C" { - #[doc = " If BUF is NULL, make STREAM unbuffered."] - #[doc = "Else make it use buffer BUF, of size BUFSIZ."] - pub fn setbuf(__stream: *mut FILE, __buf: *mut cty::c_char); -} -extern "C" { - #[doc = " Make STREAM use buffering mode MODE."] - #[doc = "If BUF is not NULL, use N bytes of it for buffering;"] - #[doc = "else allocate an internal buffer N bytes long."] - pub fn setvbuf( - __stream: *mut FILE, - __buf: *mut cty::c_char, - __modes: cty::c_int, - __n: size_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fprintf(__stream: *mut FILE, __format: *const cty::c_char, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to stdout."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn printf(__format: *const cty::c_char, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to S."] - pub fn sprintf(__s: *mut cty::c_char, __format: *const cty::c_char, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to S from argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn vfprintf( - __s: *mut FILE, - __format: *const cty::c_char, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to stdout from argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn vprintf(__format: *const cty::c_char, __arg: *mut __va_list_tag) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to S from argument list ARG."] - pub fn vsprintf( - __s: *mut cty::c_char, - __format: *const cty::c_char, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Maximum chars of output to write in MAXLEN."] - pub fn snprintf( - __s: *mut cty::c_char, - __maxlen: cty::c_ulong, - __format: *const cty::c_char, - ... - ) -> cty::c_int; -} -extern "C" { - pub fn vsnprintf( - __s: *mut cty::c_char, - __maxlen: cty::c_ulong, - __format: *const cty::c_char, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fscanf(__stream: *mut FILE, __format: *const cty::c_char, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from stdin."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn scanf(__format: *const cty::c_char, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S."] - pub fn sscanf(__s: *const cty::c_char, __format: *const cty::c_char, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - #[link_name = "\u{1}__isoc99_fscanf"] - pub fn fscanf1(__stream: *mut FILE, __format: *const cty::c_char, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from stdin."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - #[link_name = "\u{1}__isoc99_scanf"] - pub fn scanf1(__format: *const cty::c_char, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S."] - #[link_name = "\u{1}__isoc99_sscanf"] - pub fn sscanf1(__s: *const cty::c_char, __format: *const cty::c_char, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S into argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn vfscanf( - __s: *mut FILE, - __format: *const cty::c_char, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from stdin into argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn vscanf(__format: *const cty::c_char, __arg: *mut __va_list_tag) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S into argument list ARG."] - pub fn vsscanf( - __s: *const cty::c_char, - __format: *const cty::c_char, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S into argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - #[link_name = "\u{1}__isoc99_vfscanf"] - pub fn vfscanf1( - __s: *mut FILE, - __format: *const cty::c_char, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from stdin into argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - #[link_name = "\u{1}__isoc99_vscanf"] - pub fn vscanf1(__format: *const cty::c_char, __arg: *mut __va_list_tag) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S into argument list ARG."] - #[link_name = "\u{1}__isoc99_vsscanf"] - pub fn vsscanf1( - __s: *const cty::c_char, - __format: *const cty::c_char, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Read a character from STREAM."] - #[doc = ""] - #[doc = "These functions are possible cancellation points and therefore not"] - #[doc = "marked with __THROW."] - pub fn fgetc(__stream: *mut FILE) -> cty::c_int; -} -extern "C" { - pub fn getc(__stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Read a character from stdin."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn getchar() -> cty::c_int; -} -extern "C" { - #[doc = " Write a character to STREAM."] - #[doc = ""] - #[doc = "These functions are possible cancellation points and therefore not"] - #[doc = "marked with __THROW."] - #[doc = ""] - #[doc = "These functions is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fputc(__c: cty::c_int, __stream: *mut FILE) -> cty::c_int; -} -extern "C" { - pub fn putc(__c: cty::c_int, __stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Write a character to stdout."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn putchar(__c: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Get a word (int) from STREAM."] - pub fn getw(__stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Write a word (int) to STREAM."] - pub fn putw(__w: cty::c_int, __stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Get a newline-terminated string of finite length from STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fgets(__s: *mut cty::c_char, __n: cty::c_int, __stream: *mut FILE) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Write a string to STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fputs(__s: *const cty::c_char, __stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Write a string, followed by a newline, to stdout."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn puts(__s: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Push a character back onto the input buffer of STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn ungetc(__c: cty::c_int, __stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Read chunks of generic data from STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fread( - __ptr: *mut cty::c_void, - __size: cty::c_ulong, - __n: cty::c_ulong, - __stream: *mut FILE, - ) -> cty::c_ulong; -} -extern "C" { - #[doc = " Write chunks of generic data to STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fwrite( - __ptr: *const cty::c_void, - __size: cty::c_ulong, - __n: cty::c_ulong, - __s: *mut FILE, - ) -> cty::c_ulong; -} -extern "C" { - #[doc = " Seek to a certain position on STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fseek(__stream: *mut FILE, __off: cty::c_long, __whence: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Return the current position of STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn ftell(__stream: *mut FILE) -> cty::c_long; -} -extern "C" { - #[doc = " Rewind to the beginning of STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn rewind(__stream: *mut FILE); -} -extern "C" { - #[doc = " Get STREAM's position."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fgetpos(__stream: *mut FILE, __pos: *mut fpos_t) -> cty::c_int; -} -extern "C" { - #[doc = " Set STREAM's position."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fsetpos(__stream: *mut FILE, __pos: *const fpos_t) -> cty::c_int; -} -extern "C" { - #[doc = " Clear the error and EOF indicators for STREAM."] - pub fn clearerr(__stream: *mut FILE); -} -extern "C" { - #[doc = " Return the EOF indicator for STREAM."] - pub fn feof(__stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Return the error indicator for STREAM."] - pub fn ferror(__stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Print a message describing the meaning of the value of errno."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn perror(__s: *const cty::c_char); -} -extern "C" { - #[doc = " Return the system file descriptor for STREAM."] - pub fn fileno(__stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Create a new stream connected to a pipe running the given command."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn popen(__command: *const cty::c_char, __modes: *const cty::c_char) -> *mut FILE; -} -extern "C" { - #[doc = " Close a stream opened by popen and return the status of its child."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn pclose(__stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Return the name of the controlling terminal."] - pub fn ctermid(__s: *mut cty::c_char) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Return the name of the current user."] - pub fn cuserid(__s: *mut cty::c_char) -> *mut cty::c_char; -} -extern "C" { - pub static mut optarg: *mut cty::c_char; -} -extern "C" { - pub static mut optind: cty::c_int; -} -extern "C" { - pub static mut opterr: cty::c_int; -} -extern "C" { - pub static mut optopt: cty::c_int; -} -extern "C" { - #[doc = " Get definitions and prototypes for functions to process the"] - #[doc = "arguments in ARGV (ARGC of them, minus the program name) for"] - #[doc = "options given in OPTS."] - #[doc = ""] - #[doc = "Return the option character from OPTS just read. Return -1 when"] - #[doc = "there are no more options. For unrecognized options, or options"] - #[doc = "missing arguments, 'optopt' is set to the option letter, and '?' is"] - #[doc = "returned."] - #[doc = ""] - #[doc = "The OPTS string is a list of characters which are recognized option"] - #[doc = "letters, optionally followed by colons, specifying that that letter"] - #[doc = "takes an argument, to be placed in 'optarg'."] - #[doc = ""] - #[doc = "If a letter in OPTS is followed by two colons, its argument is"] - #[doc = "optional. This behavior is specific to the GNU 'getopt'."] - #[doc = ""] - #[doc = "The argument '--' causes premature termination of argument"] - #[doc = "scanning, explicitly telling 'getopt' that there are no more"] - #[doc = "options."] - #[doc = ""] - #[doc = "If OPTS begins with '-', then non-option arguments are treated as"] - #[doc = "arguments to the option '\\1'. This behavior is specific to the GNU"] - #[doc = "'getopt'. If OPTS begins with '+', or POSIXLY_CORRECT is set in"] - #[doc = "the environment, then do not permute arguments."] - #[doc = ""] - #[doc = "For standards compliance, the 'argv' argument has the type"] - #[doc = "char *const *, but this is inaccurate; if argument permutation is"] - #[doc = "enabled, the argv array (not the strings it points to) must be"] - #[doc = "writable."] - pub fn getopt( - ___argc: cty::c_int, - ___argv: *const *mut cty::c_char, - __shortopts: *const cty::c_char, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Slow-path routines used by the optimized inline functions in"] - #[doc = "bits/stdio.h."] - pub fn __uflow(arg1: *mut FILE) -> cty::c_int; -} -extern "C" { - pub fn __overflow(arg1: *mut FILE, arg2: cty::c_int) -> cty::c_int; -} -#[doc = " Signed."] -pub type int_least8_t = __int_least8_t; -pub type int_least16_t = __int_least16_t; -pub type int_least32_t = __int_least32_t; -pub type int_least64_t = __int_least64_t; -#[doc = " Unsigned."] -pub type uint_least8_t = __uint_least8_t; -pub type uint_least16_t = __uint_least16_t; -pub type uint_least32_t = __uint_least32_t; -pub type uint_least64_t = __uint_least64_t; -#[doc = " Signed."] -pub type int_fast8_t = cty::c_schar; -pub type int_fast16_t = cty::c_long; -pub type int_fast32_t = cty::c_long; -pub type int_fast64_t = cty::c_long; -#[doc = " Unsigned."] -pub type uint_fast8_t = cty::c_uchar; -pub type uint_fast16_t = cty::c_ulong; -pub type uint_fast32_t = cty::c_ulong; -pub type uint_fast64_t = cty::c_ulong; -#[doc = " Largest integral types."] -pub type intmax_t = __intmax_t; -pub type uintmax_t = __uintmax_t; -#[doc = " Returned by `div'."] -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct div_t { - #[doc = " Quotient."] - pub quot: cty::c_int, - #[doc = " Remainder."] - pub rem: cty::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) - ) - ); -} -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ldiv_t { - #[doc = " Quotient."] - pub quot: cty::c_long, - #[doc = " Remainder."] - pub rem: cty::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) - ) - ); -} -#[doc = " Returned by `lldiv'."] -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct lldiv_t { - #[doc = " Quotient."] - pub quot: cty::c_longlong, - #[doc = " Remainder."] - pub rem: cty::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) - ) - ); -} -extern "C" { - pub fn __ctype_get_mb_cur_max() -> size_t; -} -extern "C" { - #[doc = " Convert a string to a floating-point number."] - pub fn atof(__nptr: *const cty::c_char) -> f64; -} -extern "C" { - #[doc = " Convert a string to an integer."] - pub fn atoi(__nptr: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Convert a string to a long integer."] - pub fn atol(__nptr: *const cty::c_char) -> cty::c_long; -} -extern "C" { - #[doc = " Convert a string to a long long integer."] - pub fn atoll(__nptr: *const cty::c_char) -> cty::c_longlong; -} -extern "C" { - #[doc = " Convert a string to a floating-point number."] - pub fn strtod(__nptr: *const cty::c_char, __endptr: *mut *mut cty::c_char) -> f64; -} -extern "C" { - #[doc = " Likewise for `float' and `long double' sizes of floating-point numbers."] - pub fn strtof(__nptr: *const cty::c_char, __endptr: *mut *mut cty::c_char) -> f32; -} -extern "C" { - #[doc = " Convert a string to a long integer."] - pub fn strtol( - __nptr: *const cty::c_char, - __endptr: *mut *mut cty::c_char, - __base: cty::c_int, - ) -> cty::c_long; -} -extern "C" { - #[doc = " Convert a string to an unsigned long integer."] - pub fn strtoul( - __nptr: *const cty::c_char, - __endptr: *mut *mut cty::c_char, - __base: cty::c_int, - ) -> cty::c_ulong; -} -extern "C" { - #[doc = " Convert a string to a quadword integer."] - pub fn strtoll( - __nptr: *const cty::c_char, - __endptr: *mut *mut cty::c_char, - __base: cty::c_int, - ) -> cty::c_longlong; -} -extern "C" { - #[doc = " Convert a string to an unsigned quadword integer."] - pub fn strtoull( - __nptr: *const cty::c_char, - __endptr: *mut *mut cty::c_char, - __base: cty::c_int, - ) -> cty::c_ulonglong; -} -extern "C" { - #[doc = " Return a random integer between 0 and RAND_MAX inclusive."] - pub fn rand() -> cty::c_int; -} -extern "C" { - #[doc = " Seed the random number generator with the given number."] - pub fn srand(__seed: cty::c_uint); -} -extern "C" { - #[doc = " Return non-negative, double-precision floating-point value in [0.0,1.0)."] - pub fn drand48() -> f64; -} -extern "C" { - pub fn erand48(__xsubi: *mut cty::c_ushort) -> f64; -} -extern "C" { - #[doc = " Return non-negative, long integer in [0,2^31)."] - pub fn lrand48() -> cty::c_long; -} -extern "C" { - pub fn nrand48(__xsubi: *mut cty::c_ushort) -> cty::c_long; -} -extern "C" { - #[doc = " Return signed, long integers in [-2^31,2^31)."] - pub fn mrand48() -> cty::c_long; -} -extern "C" { - pub fn jrand48(__xsubi: *mut cty::c_ushort) -> cty::c_long; -} -extern "C" { - #[doc = " Seed random number generator."] - pub fn srand48(__seedval: cty::c_long); -} -extern "C" { - pub fn seed48(__seed16v: *mut cty::c_ushort) -> *mut cty::c_ushort; -} -extern "C" { - pub fn lcong48(__param: *mut cty::c_ushort); -} -extern "C" { - #[doc = " Allocate SIZE bytes of memory."] - pub fn malloc(__size: cty::c_ulong) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Allocate NMEMB elements of SIZE bytes each, all initialized to 0."] - pub fn calloc(__nmemb: cty::c_ulong, __size: cty::c_ulong) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Re-allocate the previously allocated block"] - #[doc = "in PTR, making the new block SIZE bytes long. */"] - #[doc = "the same pointer that was passed to it, aliasing needs to be allowed"] - #[doc = "between objects pointed by the old and new pointers."] - pub fn realloc(__ptr: *mut cty::c_void, __size: cty::c_ulong) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Free a block allocated by `malloc', `realloc' or `calloc'."] - pub fn free(__ptr: *mut cty::c_void); -} -extern "C" { - #[doc = " ISO C variant of aligned allocation."] - pub fn aligned_alloc(__alignment: size_t, __size: size_t) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Abort execution and generate a core-dump."] - pub fn abort(); -} -extern "C" { - #[doc = " Register a function to be called when `exit' is called."] - pub fn atexit(__func: ::core::option::Option) -> cty::c_int; -} -extern "C" { - pub fn at_quick_exit(__func: ::core::option::Option) -> cty::c_int; -} -extern "C" { - #[doc = " Call all functions registered with `atexit' and `on_exit',"] - #[doc = "in the reverse of the order in which they were registered,"] - #[doc = "perform stdio cleanup, and terminate program execution with STATUS."] - pub fn exit(__status: cty::c_int); -} -extern "C" { - #[doc = " Call all functions registered with `at_quick_exit' in the reverse"] - #[doc = "of the order in which they were registered and terminate program"] - #[doc = "execution with STATUS."] - pub fn quick_exit(__status: cty::c_int); -} -extern "C" { - #[doc = " Terminate the program with STATUS without calling any of the"] - #[doc = "functions registered with `atexit' or `on_exit'."] - pub fn _Exit(__status: cty::c_int); -} -extern "C" { - #[doc = " Return the value of envariable NAME, or NULL if it doesn't exist."] - pub fn getenv(__name: *const cty::c_char) -> *mut cty::c_char; -} -extern "C" { - #[doc = " The SVID says this is in , but this seems a better place.\t*/"] - #[doc = "If there is no `=', remove NAME from the environment."] - pub fn putenv(__string: *mut cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Execute the given line as a shell command."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn system(__command: *const cty::c_char) -> cty::c_int; -} -pub type __compar_fn_t = ::core::option::Option< - unsafe extern "C" fn(arg1: *const cty::c_void, arg2: *const cty::c_void) -> cty::c_int, ->; -extern "C" { - #[doc = " Do a binary search for KEY in BASE, which consists of NMEMB elements"] - #[doc = "of SIZE bytes each, using COMPAR to perform the comparisons."] - pub fn bsearch( - __key: *const cty::c_void, - __base: *const cty::c_void, - __nmemb: size_t, - __size: size_t, - __compar: __compar_fn_t, - ) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Sort NMEMB elements of BASE, of SIZE bytes each,"] - #[doc = "using COMPAR to perform the comparisons."] - pub fn qsort( - __base: *mut cty::c_void, - __nmemb: size_t, - __size: size_t, - __compar: __compar_fn_t, - ); -} -extern "C" { - #[doc = " Return the absolute value of X."] - pub fn abs(__x: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn labs(__x: cty::c_long) -> cty::c_long; -} -extern "C" { - pub fn llabs(__x: cty::c_longlong) -> cty::c_longlong; -} -extern "C" { - #[doc = " Return the `div_t', `ldiv_t' or `lldiv_t' representation"] - #[doc = "of the value of NUMER over DENOM. */"] - pub fn div(__numer: cty::c_int, __denom: cty::c_int) -> div_t; -} -extern "C" { - pub fn ldiv(__numer: cty::c_long, __denom: cty::c_long) -> ldiv_t; -} -extern "C" { - pub fn lldiv(__numer: cty::c_longlong, __denom: cty::c_longlong) -> lldiv_t; -} -extern "C" { - #[doc = " Return the length of the multibyte character"] - #[doc = "in S, which is no longer than N."] - pub fn mblen(__s: *const cty::c_char, __n: size_t) -> cty::c_int; -} -extern "C" { - #[doc = " Return the length of the given multibyte character,"] - #[doc = "putting its `wchar_t' representation in *PWC."] - pub fn mbtowc(__pwc: *mut wchar_t, __s: *const cty::c_char, __n: size_t) -> cty::c_int; -} -extern "C" { - #[doc = " Put the multibyte character represented"] - #[doc = "by WCHAR in S, returning its length."] - pub fn wctomb(__s: *mut cty::c_char, __wchar: wchar_t) -> cty::c_int; -} -extern "C" { - #[doc = " Convert a multibyte string to a wide char string."] - pub fn mbstowcs(__pwcs: *mut wchar_t, __s: *const cty::c_char, __n: size_t) -> size_t; -} -extern "C" { - #[doc = " Convert a wide char string to multibyte string."] - pub fn wcstombs(__s: *mut cty::c_char, __pwcs: *const wchar_t, __n: size_t) -> size_t; -} -extern "C" { - #[doc = " Copy N bytes of SRC to DEST."] - pub fn memcpy( - __dest: *mut cty::c_void, - __src: *const cty::c_void, - __n: cty::c_ulong, - ) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Copy N bytes of SRC to DEST, guaranteeing"] - #[doc = "correct behavior for overlapping strings."] - pub fn memmove( - __dest: *mut cty::c_void, - __src: *const cty::c_void, - __n: cty::c_ulong, - ) -> *mut cty::c_void; -} -extern "C" { - pub fn memccpy( - __dest: *mut cty::c_void, - __src: *const cty::c_void, - __c: cty::c_int, - __n: cty::c_ulong, - ) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Set N bytes of S to C."] - pub fn memset(__s: *mut cty::c_void, __c: cty::c_int, __n: cty::c_ulong) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Compare N bytes of S1 and S2."] - pub fn memcmp( - __s1: *const cty::c_void, - __s2: *const cty::c_void, - __n: cty::c_ulong, - ) -> cty::c_int; -} -extern "C" { - pub fn memchr(__s: *const cty::c_void, __c: cty::c_int, __n: cty::c_ulong) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Copy SRC to DEST."] - pub fn strcpy(__dest: *mut cty::c_char, __src: *const cty::c_char) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Copy no more than N characters of SRC to DEST."] - pub fn strncpy( - __dest: *mut cty::c_char, - __src: *const cty::c_char, - __n: cty::c_ulong, - ) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Append SRC onto DEST."] - pub fn strcat(__dest: *mut cty::c_char, __src: *const cty::c_char) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Append no more than N characters from SRC onto DEST."] - pub fn strncat( - __dest: *mut cty::c_char, - __src: *const cty::c_char, - __n: cty::c_ulong, - ) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Compare S1 and S2."] - pub fn strcmp(__s1: *const cty::c_char, __s2: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Compare N characters of S1 and S2."] - pub fn strncmp( - __s1: *const cty::c_char, - __s2: *const cty::c_char, - __n: cty::c_ulong, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Compare the collated forms of S1 and S2."] - pub fn strcoll(__s1: *const cty::c_char, __s2: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Put a transformation of SRC into no more than N bytes of DEST."] - pub fn strxfrm( - __dest: *mut cty::c_char, - __src: *const cty::c_char, - __n: cty::c_ulong, - ) -> cty::c_ulong; -} -extern "C" { - pub fn strchr(__s: *const cty::c_char, __c: cty::c_int) -> *mut cty::c_char; -} -extern "C" { - pub fn strrchr(__s: *const cty::c_char, __c: cty::c_int) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Return the length of the initial segment of S which"] - #[doc = "consists entirely of characters not in REJECT."] - pub fn strcspn(__s: *const cty::c_char, __reject: *const cty::c_char) -> cty::c_ulong; -} -extern "C" { - #[doc = " Return the length of the initial segment of S which"] - #[doc = "consists entirely of characters in ACCEPT."] - pub fn strspn(__s: *const cty::c_char, __accept: *const cty::c_char) -> cty::c_ulong; -} -extern "C" { - pub fn strpbrk(__s: *const cty::c_char, __accept: *const cty::c_char) -> *mut cty::c_char; -} -extern "C" { - pub fn strstr(__haystack: *const cty::c_char, __needle: *const cty::c_char) - -> *mut cty::c_char; -} -extern "C" { - #[doc = " Divide S into tokens separated by characters in DELIM."] - pub fn strtok(__s: *mut cty::c_char, __delim: *const cty::c_char) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Divide S into tokens separated by characters in DELIM. Information"] - #[doc = "passed between calls are stored in SAVE_PTR."] - pub fn __strtok_r( - __s: *mut cty::c_char, - __delim: *const cty::c_char, - __save_ptr: *mut *mut cty::c_char, - ) -> *mut cty::c_char; -} -extern "C" { - pub fn strtok_r( - __s: *mut cty::c_char, - __delim: *const cty::c_char, - __save_ptr: *mut *mut cty::c_char, - ) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Return the length of S."] - pub fn strlen(__s: *const cty::c_char) -> cty::c_ulong; -} -extern "C" { - #[doc = " Return a string describing the meaning of the `errno' code in ERRNUM."] - pub fn strerror(__errnum: cty::c_int) -> *mut cty::c_char; -} -#[doc = " An integral type that can be modified atomically, without the"] -#[doc = "possibility of a signal arriving in the middle of the operation."] -pub type sig_atomic_t = __sig_atomic_t; -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct __sigset_t { - pub __val: [cty::c_ulong; 16usize], -} -#[test] -fn bindgen_test_layout___sigset_t() { - assert_eq!( - ::core::mem::size_of::<__sigset_t>(), - 128usize, - concat!("Size of: ", stringify!(__sigset_t)) - ); - assert_eq!( - ::core::mem::align_of::<__sigset_t>(), - 8usize, - concat!("Alignment of ", stringify!(__sigset_t)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<__sigset_t>())).__val as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__sigset_t), - "::", - stringify!(__val) - ) - ); -} -#[doc = " A set of signals to be blocked, unblocked, or waited for."] -pub type sigset_t = __sigset_t; -pub type pid_t = __pid_t; -pub type uid_t = __uid_t; -#[doc = " Type of a signal handler."] -pub type __sighandler_t = ::core::option::Option; -extern "C" { - #[doc = " The X/Open definition of `signal' specifies the SVID semantic. Use"] - #[doc = "the additional function `sysv_signal' when X/Open compatibility is"] - #[doc = "requested."] - pub fn __sysv_signal(__sig: cty::c_int, __handler: __sighandler_t) -> __sighandler_t; -} -extern "C" { - pub fn kill(__pid: __pid_t, __sig: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Raise signal SIG, i.e., send SIG to yourself."] - pub fn raise(__sig: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Clear all signals from SET."] - pub fn sigemptyset(__set: *mut sigset_t) -> cty::c_int; -} -extern "C" { - #[doc = " Set all signals in SET."] - pub fn sigfillset(__set: *mut sigset_t) -> cty::c_int; -} -extern "C" { - #[doc = " Add SIGNO to SET."] - pub fn sigaddset(__set: *mut sigset_t, __signo: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Remove SIGNO from SET."] - pub fn sigdelset(__set: *mut sigset_t, __signo: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Return 1 if SIGNO is in SET, 0 if not."] - pub fn sigismember(__set: *const sigset_t, __signo: cty::c_int) -> cty::c_int; -} -#[doc = " Structure describing the action to be taken when a signal arrives."] -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct sigaction { - pub sa_handler: __sighandler_t, - #[doc = " Additional set of signals to be blocked."] - pub sa_mask: __sigset_t, - #[doc = " Special flags."] - pub sa_flags: cty::c_int, - #[doc = " Restore handler."] - pub sa_restorer: ::core::option::Option, -} -#[test] -fn bindgen_test_layout_sigaction() { - assert_eq!( - ::core::mem::size_of::(), - 152usize, - concat!("Size of: ", stringify!(sigaction)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(sigaction)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sa_handler as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(sigaction), - "::", - stringify!(sa_handler) - ) - ); - 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 }, - 136usize, - concat!( - "Offset of field: ", - stringify!(sigaction), - "::", - stringify!(sa_flags) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sa_restorer as *const _ as usize }, - 144usize, - concat!( - "Offset of field: ", - stringify!(sigaction), - "::", - stringify!(sa_restorer) - ) - ); -} -extern "C" { - #[doc = " Get and/or change the set of blocked signals."] - pub fn sigprocmask( - __how: cty::c_int, - __set: *const sigset_t, - __oset: *mut sigset_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Change the set of blocked signals to SET,"] - #[doc = "wait until a signal arrives, and restore the set of blocked signals."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn sigsuspend(__set: *const sigset_t) -> cty::c_int; -} -extern "C" { - #[doc = " Get and/or set the action for signal SIG."] - pub fn sigaction( - __sig: cty::c_int, - __act: *const sigaction, - __oact: *mut sigaction, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Put in SET all signals that are blocked and waiting to be delivered."] - pub fn sigpending(__set: *mut sigset_t) -> cty::c_int; -} -extern "C" { - #[doc = " Return number of available real-time signal with highest priority."] - pub fn __libc_current_sigrtmin() -> cty::c_int; -} -extern "C" { - #[doc = " Return number of available real-time signal with lowest priority."] - pub fn __libc_current_sigrtmax() -> cty::c_int; -} -#[doc = " Structure for scatter/gather I/O."] -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct iovec { - #[doc = " Pointer to data."] - pub iov_base: *mut cty::c_void, - #[doc = " Length of data."] - pub iov_len: size_t, -} -#[test] -fn bindgen_test_layout_iovec() { - assert_eq!( - ::core::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(iovec)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(iovec)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).iov_base as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(iovec), - "::", - stringify!(iov_base) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).iov_len as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(iovec), - "::", - stringify!(iov_len) - ) - ); -} -impl Default for iovec { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -pub type ino_t = __ino_t; -pub type dev_t = __dev_t; -pub type gid_t = __gid_t; -pub type mode_t = __mode_t; -pub type nlink_t = __nlink_t; -pub type off_t = __off_t; -pub type id_t = __id_t; -pub type ssize_t = __ssize_t; -pub type key_t = __key_t; -#[doc = " Clock ID used in clock and timer functions."] -pub type clockid_t = __clockid_t; -#[doc = " Timer ID returned by `timer_create'."] -pub type timer_t = __timer_t; -pub type useconds_t = __useconds_t; -pub type suseconds_t = __suseconds_t; -#[doc = " These were defined by ISO C without the first `_'."] -pub type u_int8_t = __uint8_t; -pub type u_int16_t = __uint16_t; -pub type u_int32_t = __uint32_t; -pub type u_int64_t = __uint64_t; -pub type register_t = cty::c_long; -pub type blkcnt_t = __blkcnt_t; -pub type fsblkcnt_t = __fsblkcnt_t; -pub type fsfilcnt_t = __fsfilcnt_t; -pub type socklen_t = __socklen_t; -#[doc = " Sequenced, reliable, connection-based"] -#[doc = "byte streams."] -pub const __socket_type_SOCK_STREAM: __socket_type = 1; -#[doc = " Connectionless, unreliable datagrams"] -#[doc = "of fixed maximum length."] -pub const __socket_type_SOCK_DGRAM: __socket_type = 2; -#[doc = " Raw protocol interface."] -pub const __socket_type_SOCK_RAW: __socket_type = 3; -#[doc = " Reliably-delivered messages."] -pub const __socket_type_SOCK_RDM: __socket_type = 4; -#[doc = " Sequenced, reliable, connection-based,"] -#[doc = "datagrams of fixed maximum length."] -pub const __socket_type_SOCK_SEQPACKET: __socket_type = 5; -#[doc = " Datagram Congestion Control Protocol."] -pub const __socket_type_SOCK_DCCP: __socket_type = 6; -#[doc = " Linux specific way of getting packets"] -#[doc = "at the dev level. For writing rarp and"] -#[doc = "other similar things on the user level."] -pub const __socket_type_SOCK_PACKET: __socket_type = 10; -#[doc = " Atomically set close-on-exec flag for the"] -#[doc = "new descriptor(s)."] -pub const __socket_type_SOCK_CLOEXEC: __socket_type = 524288; -#[doc = " Atomically mark descriptor(s) as"] -#[doc = "non-blocking."] -pub const __socket_type_SOCK_NONBLOCK: __socket_type = 2048; -#[doc = " Types of sockets."] -pub type __socket_type = cty::c_uint; -#[doc = " POSIX.1g specifies this type name for the `sa_family' member."] -pub type sa_family_t = cty::c_ushort; -#[doc = " Structure describing a generic socket address."] -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct sockaddr { - pub sa_family: sa_family_t, - #[doc = " Address data."] - pub sa_data: [cty::c_char; 14usize], -} -#[test] -fn bindgen_test_layout_sockaddr() { - assert_eq!( - ::core::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(sockaddr)) - ); - assert_eq!( - ::core::mem::align_of::(), - 2usize, - concat!("Alignment of ", stringify!(sockaddr)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sa_family as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(sockaddr), - "::", - stringify!(sa_family) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sa_data as *const _ as usize }, - 2usize, - concat!( - "Offset of field: ", - stringify!(sockaddr), - "::", - stringify!(sa_data) - ) - ); -} -#[repr(C)] -#[derive(Copy, Clone)] -pub struct sockaddr_storage { - pub ss_family: sa_family_t, - pub __ss_padding: [cty::c_char; 118usize], - #[doc = " Force desired alignment."] - pub __ss_align: cty::c_ulong, -} -#[test] -fn bindgen_test_layout_sockaddr_storage() { - assert_eq!( - ::core::mem::size_of::(), - 128usize, - concat!("Size of: ", stringify!(sockaddr_storage)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(sockaddr_storage)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).ss_family as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_storage), - "::", - stringify!(ss_family) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).__ss_padding as *const _ as usize }, - 2usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_storage), - "::", - stringify!(__ss_padding) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).__ss_align as *const _ as usize }, - 120usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_storage), - "::", - stringify!(__ss_align) - ) - ); -} -impl Default for sockaddr_storage { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[doc = " Process out-of-band data."] -pub const MSG_OOB: cty::c_uint = 1; -#[doc = " Peek at incoming messages."] -pub const MSG_PEEK: cty::c_uint = 2; -#[doc = " Don't use local routing."] -pub const MSG_DONTROUTE: cty::c_uint = 4; -#[doc = " Control data lost before delivery."] -pub const MSG_CTRUNC: cty::c_uint = 8; -#[doc = " Supply or ask second address."] -pub const MSG_PROXY: cty::c_uint = 16; -pub const MSG_TRUNC: cty::c_uint = 32; -#[doc = " Nonblocking IO."] -pub const MSG_DONTWAIT: cty::c_uint = 64; -#[doc = " End of record."] -pub const MSG_EOR: cty::c_uint = 128; -#[doc = " Wait for a full request."] -pub const MSG_WAITALL: cty::c_uint = 256; -pub const MSG_FIN: cty::c_uint = 512; -pub const MSG_SYN: cty::c_uint = 1024; -#[doc = " Confirm path validity."] -pub const MSG_CONFIRM: cty::c_uint = 2048; -pub const MSG_RST: cty::c_uint = 4096; -#[doc = " Fetch message from error queue."] -pub const MSG_ERRQUEUE: cty::c_uint = 8192; -#[doc = " Do not generate SIGPIPE."] -pub const MSG_NOSIGNAL: cty::c_uint = 16384; -#[doc = " Sender will send more."] -pub const MSG_MORE: cty::c_uint = 32768; -#[doc = " Wait for at least one packet to return."] -pub const MSG_WAITFORONE: cty::c_uint = 65536; -#[doc = " sendmmsg: more messages coming."] -pub const MSG_BATCH: cty::c_uint = 262144; -#[doc = " Use user data in kernel path."] -pub const MSG_ZEROCOPY: cty::c_uint = 67108864; -#[doc = " Send data in TCP SYN."] -pub const MSG_FASTOPEN: cty::c_uint = 536870912; -#[doc = " Set close_on_exit for file"] -#[doc = "descriptor received through"] -#[doc = "SCM_RIGHTS."] -pub const MSG_CMSG_CLOEXEC: cty::c_uint = 1073741824; -#[doc = " Bits in the FLAGS argument to `send', `recv', et al."] -pub type _bindgen_ty_3 = cty::c_uint; -#[doc = " Structure describing messages sent by"] -#[doc = "`sendmsg' and received by `recvmsg'."] -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct msghdr { - #[doc = " Address to send to/receive from."] - pub msg_name: *mut cty::c_void, - #[doc = " Length of address data."] - pub msg_namelen: socklen_t, - #[doc = " Vector of data to send/receive into."] - pub msg_iov: *mut iovec, - #[doc = " Number of elements in the vector."] - pub msg_iovlen: size_t, - #[doc = " Ancillary data (eg BSD filedesc passing)."] - pub msg_control: *mut cty::c_void, - #[doc = " Ancillary data buffer length."] - #[doc = " The type should be socklen_t but the"] - #[doc = "definition of the kernel is incompatible"] - #[doc = "with this."] - pub msg_controllen: size_t, - #[doc = " Flags on received message."] - pub msg_flags: cty::c_int, -} -#[test] -fn bindgen_test_layout_msghdr() { - assert_eq!( - ::core::mem::size_of::(), - 56usize, - concat!("Size of: ", stringify!(msghdr)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(msghdr)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).msg_name as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(msghdr), - "::", - stringify!(msg_name) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).msg_namelen as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(msghdr), - "::", - stringify!(msg_namelen) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).msg_iov as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(msghdr), - "::", - stringify!(msg_iov) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).msg_iovlen as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(msghdr), - "::", - stringify!(msg_iovlen) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).msg_control as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(msghdr), - "::", - stringify!(msg_control) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).msg_controllen as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(msghdr), - "::", - stringify!(msg_controllen) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).msg_flags as *const _ as usize }, - 48usize, - concat!( - "Offset of field: ", - stringify!(msghdr), - "::", - stringify!(msg_flags) - ) - ); -} -impl Default for msghdr { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[doc = " Structure used for storage of ancillary data object information."] -#[repr(C)] -#[derive(Debug, Default)] -pub struct cmsghdr { - #[doc = " Length of data in cmsg_data plus length"] - #[doc = "of cmsghdr structure."] - #[doc = " The type should be socklen_t but the"] - #[doc = "definition of the kernel is incompatible"] - #[doc = "with this."] - pub cmsg_len: size_t, - #[doc = " Originating protocol."] - pub cmsg_level: cty::c_int, - #[doc = " Protocol specific type."] - pub cmsg_type: cty::c_int, - #[doc = " Ancillary data."] - pub __cmsg_data: __IncompleteArrayField, -} -#[test] -fn bindgen_test_layout_cmsghdr() { - assert_eq!( - ::core::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(cmsghdr)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(cmsghdr)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).cmsg_len as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(cmsghdr), - "::", - stringify!(cmsg_len) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).cmsg_level as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(cmsghdr), - "::", - stringify!(cmsg_level) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).cmsg_type as *const _ as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(cmsghdr), - "::", - stringify!(cmsg_type) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).__cmsg_data as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(cmsghdr), - "::", - stringify!(__cmsg_data) - ) - ); -} -extern "C" { - pub fn __cmsg_nxthdr(__mhdr: *mut msghdr, __cmsg: *mut cmsghdr) -> *mut cmsghdr; -} -#[doc = " Transfer file descriptors."] -pub const SCM_RIGHTS: cty::c_uint = 1; -#[doc = " Socket level message types. This must match the definitions in"] -#[doc = "."] -pub type _bindgen_ty_4 = cty::c_uint; -#[doc = " Structure used to manipulate the SO_LINGER option."] -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct linger { - #[doc = " Nonzero to linger on close."] - pub l_onoff: cty::c_int, - #[doc = " Time to linger."] - pub l_linger: cty::c_int, -} -#[test] -fn bindgen_test_layout_linger() { - assert_eq!( - ::core::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(linger)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(linger)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).l_onoff as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(linger), - "::", - stringify!(l_onoff) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).l_linger as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(linger), - "::", - stringify!(l_linger) - ) - ); -} -#[doc = " No more receptions."] -pub const SHUT_RD: cty::c_uint = 0; -#[doc = " No more transmissions."] -pub const SHUT_WR: cty::c_uint = 1; -#[doc = " No more receptions or transmissions."] -pub const SHUT_RDWR: cty::c_uint = 2; -#[doc = " The following constants should be used for the second parameter of"] -#[doc = "`shutdown'."] -pub type _bindgen_ty_5 = cty::c_uint; -extern "C" { - #[doc = " Create a new socket of type TYPE in domain DOMAIN, using"] - #[doc = "protocol PROTOCOL. If PROTOCOL is zero, one is chosen automatically."] - #[doc = "Returns a file descriptor for the new socket, or -1 for errors."] - pub fn socket(__domain: cty::c_int, __type: cty::c_int, __protocol: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Create two new sockets, of type TYPE in domain DOMAIN and using"] - #[doc = "protocol PROTOCOL, which are connected to each other, and put file"] - #[doc = "descriptors for them in FDS[0] and FDS[1]. If PROTOCOL is zero,"] - #[doc = "one will be chosen automatically. Returns 0 on success, -1 for errors."] - pub fn socketpair( - __domain: cty::c_int, - __type: cty::c_int, - __protocol: cty::c_int, - __fds: *mut cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Give the socket FD the local address ADDR (which is LEN bytes long)."] - pub fn bind(__fd: cty::c_int, __addr: *const sockaddr, __len: socklen_t) -> cty::c_int; -} -extern "C" { - #[doc = " Put the local address of FD into *ADDR and its length in *LEN."] - pub fn getsockname( - __fd: cty::c_int, - __addr: *mut sockaddr, - __len: *mut socklen_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Open a connection on socket FD to peer at ADDR (which LEN bytes long)."] - #[doc = "For connectionless socket types, just set the default address to send to"] - #[doc = "and the only address from which to accept transmissions."] - #[doc = "Return 0 on success, -1 for errors."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn connect(__fd: cty::c_int, __addr: *const sockaddr, __len: socklen_t) -> cty::c_int; -} -extern "C" { - #[doc = " Put the address of the peer connected to socket FD into *ADDR"] - #[doc = "(which is *LEN bytes long), and its actual length into *LEN."] - pub fn getpeername( - __fd: cty::c_int, - __addr: *mut sockaddr, - __len: *mut socklen_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Send N bytes of BUF to socket FD. Returns the number sent or -1."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn send( - __fd: cty::c_int, - __buf: *const cty::c_void, - __n: size_t, - __flags: cty::c_int, - ) -> ssize_t; -} -extern "C" { - #[doc = " Read N bytes into BUF from socket FD."] - #[doc = "Returns the number read or -1 for errors."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn recv( - __fd: cty::c_int, - __buf: *mut cty::c_void, - __n: size_t, - __flags: cty::c_int, - ) -> ssize_t; -} -extern "C" { - #[doc = " Send N bytes of BUF on socket FD to peer at address ADDR (which is"] - #[doc = "ADDR_LEN bytes long). Returns the number sent, or -1 for errors."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn sendto( - __fd: cty::c_int, - __buf: *const cty::c_void, - __n: size_t, - __flags: cty::c_int, - __addr: *const sockaddr, - __addr_len: socklen_t, - ) -> ssize_t; -} -extern "C" { - #[doc = " Read N bytes into BUF through socket FD."] - #[doc = "If ADDR is not NULL, fill in *ADDR_LEN bytes of it with tha address of"] - #[doc = "the sender, and store the actual size of the address in *ADDR_LEN."] - #[doc = "Returns the number of bytes read or -1 for errors."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn recvfrom( - __fd: cty::c_int, - __buf: *mut cty::c_void, - __n: size_t, - __flags: cty::c_int, - __addr: *mut sockaddr, - __addr_len: *mut socklen_t, - ) -> ssize_t; -} -extern "C" { - #[doc = " Send a message described MESSAGE on socket FD."] - #[doc = "Returns the number of bytes sent, or -1 for errors."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn sendmsg(__fd: cty::c_int, __message: *const msghdr, __flags: cty::c_int) -> ssize_t; -} -extern "C" { - #[doc = " Receive a message as described by MESSAGE from socket FD."] - #[doc = "Returns the number of bytes read or -1 for errors."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn recvmsg(__fd: cty::c_int, __message: *mut msghdr, __flags: cty::c_int) -> ssize_t; -} -extern "C" { - #[doc = " Put the current value for socket FD's option OPTNAME at protocol level LEVEL"] - #[doc = "into OPTVAL (which is *OPTLEN bytes long), and set *OPTLEN to the value's"] - #[doc = "actual length. Returns 0 on success, -1 for errors."] - pub fn getsockopt( - __fd: cty::c_int, - __level: cty::c_int, - __optname: cty::c_int, - __optval: *mut cty::c_void, - __optlen: *mut socklen_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Set socket FD's option OPTNAME at protocol level LEVEL"] - #[doc = "to *OPTVAL (which is OPTLEN bytes long)."] - #[doc = "Returns 0 on success, -1 for errors."] - pub fn setsockopt( - __fd: cty::c_int, - __level: cty::c_int, - __optname: cty::c_int, - __optval: *const cty::c_void, - __optlen: socklen_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Prepare to accept connections on socket FD."] - #[doc = "N connection requests will be queued before further requests are refused."] - #[doc = "Returns 0 on success, -1 for errors."] - pub fn listen(__fd: cty::c_int, __n: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Await a connection on socket FD."] - #[doc = "When a connection arrives, open a new socket to communicate with it,"] - #[doc = "set *ADDR (which is *ADDR_LEN bytes long) to the address of the connecting"] - #[doc = "peer and *ADDR_LEN to the address's actual length, and return the"] - #[doc = "new socket's descriptor, or -1 for errors."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn accept( - __fd: cty::c_int, - __addr: *mut sockaddr, - __addr_len: *mut socklen_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Shut down all or part of the connection open on socket FD."] - #[doc = "HOW determines what to shut down:"] - #[doc = "SHUT_RD = No more receptions;"] - #[doc = "SHUT_WR = No more transmissions;"] - #[doc = "SHUT_RDWR = No more receptions or transmissions."] - #[doc = "Returns 0 on success, -1 for errors."] - pub fn shutdown(__fd: cty::c_int, __how: cty::c_int) -> cty::c_int; -} -#[doc = " Internet address."] -pub type in_addr_t = u32; -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct in_addr { - pub s_addr: in_addr_t, -} -#[test] -fn bindgen_test_layout_in_addr() { - assert_eq!( - ::core::mem::size_of::(), - 4usize, - concat!("Size of: ", stringify!(in_addr)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(in_addr)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).s_addr as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(in_addr), - "::", - stringify!(s_addr) - ) - ); -} -#[doc = " Dummy protocol for TCP."] -pub const IPPROTO_IP: cty::c_uint = 0; -#[doc = " Internet Control Message Protocol."] -pub const IPPROTO_ICMP: cty::c_uint = 1; -#[doc = " Internet Group Management Protocol."] -pub const IPPROTO_IGMP: cty::c_uint = 2; -#[doc = " IPIP tunnels (older KA9Q tunnels use 94)."] -pub const IPPROTO_IPIP: cty::c_uint = 4; -#[doc = " Transmission Control Protocol."] -pub const IPPROTO_TCP: cty::c_uint = 6; -#[doc = " Exterior Gateway Protocol."] -pub const IPPROTO_EGP: cty::c_uint = 8; -#[doc = " PUP protocol."] -pub const IPPROTO_PUP: cty::c_uint = 12; -#[doc = " User Datagram Protocol."] -pub const IPPROTO_UDP: cty::c_uint = 17; -#[doc = " XNS IDP protocol."] -pub const IPPROTO_IDP: cty::c_uint = 22; -#[doc = " SO Transport Protocol Class 4."] -pub const IPPROTO_TP: cty::c_uint = 29; -#[doc = " Datagram Congestion Control Protocol."] -pub const IPPROTO_DCCP: cty::c_uint = 33; -#[doc = " IPv6 header."] -pub const IPPROTO_IPV6: cty::c_uint = 41; -#[doc = " Reservation Protocol."] -pub const IPPROTO_RSVP: cty::c_uint = 46; -#[doc = " General Routing Encapsulation."] -pub const IPPROTO_GRE: cty::c_uint = 47; -#[doc = " encapsulating security payload."] -pub const IPPROTO_ESP: cty::c_uint = 50; -#[doc = " authentication header."] -pub const IPPROTO_AH: cty::c_uint = 51; -#[doc = " Multicast Transport Protocol."] -pub const IPPROTO_MTP: cty::c_uint = 92; -#[doc = " IP option pseudo header for BEET."] -pub const IPPROTO_BEETPH: cty::c_uint = 94; -#[doc = " Encapsulation Header."] -pub const IPPROTO_ENCAP: cty::c_uint = 98; -#[doc = " Protocol Independent Multicast."] -pub const IPPROTO_PIM: cty::c_uint = 103; -#[doc = " Compression Header Protocol."] -pub const IPPROTO_COMP: cty::c_uint = 108; -#[doc = " Stream Control Transmission Protocol."] -pub const IPPROTO_SCTP: cty::c_uint = 132; -#[doc = " UDP-Lite protocol."] -pub const IPPROTO_UDPLITE: cty::c_uint = 136; -#[doc = " MPLS in IP."] -pub const IPPROTO_MPLS: cty::c_uint = 137; -#[doc = " Raw IP packets."] -pub const IPPROTO_RAW: cty::c_uint = 255; -pub const IPPROTO_MAX: cty::c_uint = 256; -#[doc = " Standard well-defined IP protocols."] -pub type _bindgen_ty_6 = cty::c_uint; -#[doc = " IPv6 Hop-by-Hop options."] -pub const IPPROTO_HOPOPTS: cty::c_uint = 0; -#[doc = " IPv6 routing header."] -pub const IPPROTO_ROUTING: cty::c_uint = 43; -#[doc = " IPv6 fragmentation header."] -pub const IPPROTO_FRAGMENT: cty::c_uint = 44; -#[doc = " ICMPv6."] -pub const IPPROTO_ICMPV6: cty::c_uint = 58; -#[doc = " IPv6 no next header."] -pub const IPPROTO_NONE: cty::c_uint = 59; -#[doc = " IPv6 destination options."] -pub const IPPROTO_DSTOPTS: cty::c_uint = 60; -#[doc = " IPv6 mobility header."] -pub const IPPROTO_MH: cty::c_uint = 135; -pub type _bindgen_ty_7 = cty::c_uint; -#[doc = " Type to represent a port."] -pub type in_port_t = u16; -#[doc = " Echo service."] -pub const IPPORT_ECHO: cty::c_uint = 7; -#[doc = " Discard transmissions service."] -pub const IPPORT_DISCARD: cty::c_uint = 9; -#[doc = " System status service."] -pub const IPPORT_SYSTAT: cty::c_uint = 11; -#[doc = " Time of day service."] -pub const IPPORT_DAYTIME: cty::c_uint = 13; -#[doc = " Network status service."] -pub const IPPORT_NETSTAT: cty::c_uint = 15; -#[doc = " File Transfer Protocol."] -pub const IPPORT_FTP: cty::c_uint = 21; -#[doc = " Telnet protocol."] -pub const IPPORT_TELNET: cty::c_uint = 23; -#[doc = " Simple Mail Transfer Protocol."] -pub const IPPORT_SMTP: cty::c_uint = 25; -#[doc = " Timeserver service."] -pub const IPPORT_TIMESERVER: cty::c_uint = 37; -#[doc = " Domain Name Service."] -pub const IPPORT_NAMESERVER: cty::c_uint = 42; -#[doc = " Internet Whois service."] -pub const IPPORT_WHOIS: cty::c_uint = 43; -pub const IPPORT_MTP: cty::c_uint = 57; -#[doc = " Trivial File Transfer Protocol."] -pub const IPPORT_TFTP: cty::c_uint = 69; -pub const IPPORT_RJE: cty::c_uint = 77; -#[doc = " Finger service."] -pub const IPPORT_FINGER: cty::c_uint = 79; -pub const IPPORT_TTYLINK: cty::c_uint = 87; -#[doc = " SUPDUP protocol."] -pub const IPPORT_SUPDUP: cty::c_uint = 95; -#[doc = " execd service."] -pub const IPPORT_EXECSERVER: cty::c_uint = 512; -#[doc = " rlogind service."] -pub const IPPORT_LOGINSERVER: cty::c_uint = 513; -pub const IPPORT_CMDSERVER: cty::c_uint = 514; -pub const IPPORT_EFSSERVER: cty::c_uint = 520; -#[doc = " UDP ports."] -pub const IPPORT_BIFFUDP: cty::c_uint = 512; -#[doc = " UDP ports."] -pub const IPPORT_WHOSERVER: cty::c_uint = 513; -#[doc = " UDP ports."] -pub const IPPORT_ROUTESERVER: cty::c_uint = 520; -#[doc = " Ports less than this value are reserved for privileged processes."] -pub const IPPORT_RESERVED: cty::c_uint = 1024; -#[doc = " Ports greater this value are reserved for (non-privileged) servers."] -pub const IPPORT_USERRESERVED: cty::c_uint = 5000; -#[doc = " Standard well-known ports."] -pub type _bindgen_ty_8 = cty::c_uint; -#[doc = " IPv6 address"] -#[repr(C)] -#[derive(Copy, Clone)] -pub struct in6_addr { - pub __in6_u: in6_addr__bindgen_ty_1, -} -#[repr(C)] -#[derive(Copy, Clone)] -pub union in6_addr__bindgen_ty_1 { - pub __u6_addr8: [u8; 16usize], - pub __u6_addr16: [u16; 8usize], - pub __u6_addr32: [u32; 4usize], -} -#[test] -fn bindgen_test_layout_in6_addr__bindgen_ty_1() { - assert_eq!( - ::core::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(in6_addr__bindgen_ty_1)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(in6_addr__bindgen_ty_1)) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).__u6_addr8 as *const _ as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(in6_addr__bindgen_ty_1), - "::", - stringify!(__u6_addr8) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).__u6_addr16 as *const _ as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(in6_addr__bindgen_ty_1), - "::", - stringify!(__u6_addr16) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).__u6_addr32 as *const _ as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(in6_addr__bindgen_ty_1), - "::", - stringify!(__u6_addr32) - ) - ); -} -impl Default for in6_addr__bindgen_ty_1 { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[test] -fn bindgen_test_layout_in6_addr() { - assert_eq!( - ::core::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(in6_addr)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(in6_addr)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).__in6_u as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(in6_addr), - "::", - stringify!(__in6_u) - ) - ); -} -impl Default for in6_addr { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -extern "C" { - pub static in6addr_any: in6_addr; -} -extern "C" { - pub static in6addr_loopback: in6_addr; -} -#[doc = " Structure describing an Internet socket address."] -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct sockaddr_in { - pub sin_family: sa_family_t, - #[doc = " Port number."] - pub sin_port: in_port_t, - #[doc = " Internet address."] - pub sin_addr: in_addr, - #[doc = " Pad to size of `struct sockaddr'."] - pub sin_zero: [cty::c_uchar; 8usize], -} -#[test] -fn bindgen_test_layout_sockaddr_in() { - assert_eq!( - ::core::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(sockaddr_in)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(sockaddr_in)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin_family as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in), - "::", - stringify!(sin_family) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin_port as *const _ as usize }, - 2usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in), - "::", - stringify!(sin_port) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin_addr as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in), - "::", - stringify!(sin_addr) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin_zero as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in), - "::", - stringify!(sin_zero) - ) - ); -} -#[doc = " Ditto, for IPv6."] -#[repr(C)] -#[derive(Copy, Clone)] -pub struct sockaddr_in6 { - pub sin6_family: sa_family_t, - #[doc = " Transport layer port #"] - pub sin6_port: in_port_t, - #[doc = " IPv6 flow information"] - pub sin6_flowinfo: u32, - #[doc = " IPv6 address"] - pub sin6_addr: in6_addr, - #[doc = " IPv6 scope-id"] - pub sin6_scope_id: u32, -} -#[test] -fn bindgen_test_layout_sockaddr_in6() { - assert_eq!( - ::core::mem::size_of::(), - 28usize, - concat!("Size of: ", stringify!(sockaddr_in6)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(sockaddr_in6)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin6_family as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in6), - "::", - stringify!(sin6_family) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin6_port as *const _ as usize }, - 2usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in6), - "::", - stringify!(sin6_port) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin6_flowinfo as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in6), - "::", - stringify!(sin6_flowinfo) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin6_addr as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in6), - "::", - stringify!(sin6_addr) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin6_scope_id as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in6), - "::", - stringify!(sin6_scope_id) - ) - ); -} -impl Default for sockaddr_in6 { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[doc = " Likewise, for IPv6."] -#[repr(C)] -#[derive(Copy, Clone)] -pub struct ipv6_mreq { - #[doc = " IPv6 multicast address of group"] - pub ipv6mr_multiaddr: in6_addr, - #[doc = " local interface"] - pub ipv6mr_interface: cty::c_uint, -} -#[test] -fn bindgen_test_layout_ipv6_mreq() { - assert_eq!( - ::core::mem::size_of::(), - 20usize, - concat!("Size of: ", stringify!(ipv6_mreq)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(ipv6_mreq)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).ipv6mr_multiaddr as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ipv6_mreq), - "::", - stringify!(ipv6mr_multiaddr) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).ipv6mr_interface as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ipv6_mreq), - "::", - stringify!(ipv6mr_interface) - ) - ); -} -impl Default for ipv6_mreq { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -extern "C" { - #[doc = " Functions to convert between host and network byte order."] - #[doc = ""] - #[doc = "Please note that these functions normally take `unsigned long int' or"] - #[doc = "`unsigned short int' values as arguments and also return them. But"] - #[doc = "this was a short-sighted decision since on different systems the types"] - #[doc = "may have different representations but the values are always the same."] - pub fn ntohl(__netlong: u32) -> u32; -} -extern "C" { - pub fn ntohs(__netshort: u16) -> u16; -} -extern "C" { - pub fn htonl(__hostlong: u32) -> u32; -} -extern "C" { - pub fn htons(__hostshort: u16) -> u16; -} -extern "C" { - #[doc = " Get a human-readable string describing the running Notcurses version."] - pub fn notcurses_version() -> *const cty::c_char; -} -extern "C" { - #[doc = " Cannot be inline, as we want to get the versions of the actual Notcurses"] - #[doc = " library we loaded, not what we compile against."] - pub fn notcurses_version_components( - major: *mut cty::c_int, - minor: *mut cty::c_int, - patch: *mut cty::c_int, - tweak: *mut cty::c_int, - ); -} -#[repr(C)] -#[derive(Debug)] -pub struct notcurses { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncplane { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncvisual { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncuplot { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncdplot { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncprogbar { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncfdplane { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncsubproc { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncselector { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncmultiselector { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncreader { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncfadectx { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct nctablet { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncreel { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct nctab { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct nctabbed { - _unused: [u8; 0], -} -#[doc = " let the ncvisual pick"] -pub const ncblitter_e_NCBLIT_DEFAULT: ncblitter_e = 0; -#[doc = " space, compatible with ASCII"] -pub const ncblitter_e_NCBLIT_1x1: ncblitter_e = 1; -#[doc = " halves + 1x1 (space) ▄▀"] -pub const ncblitter_e_NCBLIT_2x1: ncblitter_e = 2; -#[doc = " quadrants + 2x1 ▗▐ ▖▀▟▌▙"] -pub const ncblitter_e_NCBLIT_2x2: ncblitter_e = 3; -#[doc = " sextants (*NOT* 2x2) 🬀🬁🬂🬃🬄🬅🬆🬇🬈🬉🬊🬋🬌🬍🬎🬏🬐🬑🬒🬓🬔🬕🬖🬗🬘🬙🬚🬛🬜🬝🬞"] -pub const ncblitter_e_NCBLIT_3x2: ncblitter_e = 4; -#[doc = " 4 rows, 2 cols (braille) ⡀⡄⡆⡇⢀⣀⣄⣆⣇⢠⣠⣤⣦⣧⢰⣰⣴⣶⣷⢸⣸⣼⣾⣿"] -pub const ncblitter_e_NCBLIT_BRAILLE: ncblitter_e = 5; -#[doc = " pixel graphics"] -pub const ncblitter_e_NCBLIT_PIXEL: ncblitter_e = 6; -#[doc = " four vertical levels █▆▄▂"] -pub const ncblitter_e_NCBLIT_4x1: ncblitter_e = 7; -#[doc = " eight vertical levels █▇▆▅▄▃▂▁"] -pub const ncblitter_e_NCBLIT_8x1: ncblitter_e = 8; -#[doc = " we never blit full blocks, but instead spaces (more efficient) with the"] -#[doc = " background set to the desired foreground."] -pub type ncblitter_e = cty::c_uint; -pub const ncalign_e_NCALIGN_UNALIGNED: ncalign_e = 0; -pub const ncalign_e_NCALIGN_LEFT: ncalign_e = 1; -pub const ncalign_e_NCALIGN_CENTER: ncalign_e = 2; -pub const ncalign_e_NCALIGN_RIGHT: ncalign_e = 3; -#[doc = " Alignment within a plane or terminal. Left/right-justified, or centered."] -pub type ncalign_e = cty::c_uint; -pub const ncscale_e_NCSCALE_NONE: ncscale_e = 0; -pub const ncscale_e_NCSCALE_SCALE: ncscale_e = 1; -pub const ncscale_e_NCSCALE_STRETCH: ncscale_e = 2; -pub const ncscale_e_NCSCALE_NONE_HIRES: ncscale_e = 3; -pub const ncscale_e_NCSCALE_SCALE_HIRES: ncscale_e = 4; -#[doc = " How to scale an ncvisual during rendering. NCSCALE_NONE will apply no"] -#[doc = " scaling. NCSCALE_SCALE scales a visual to the plane's size, maintaining"] -#[doc = " aspect ratio. NCSCALE_STRETCH stretches and scales the image in an"] -#[doc = " attempt to fill the entirety of the plane. NCSCALE_NONE_HIRES and"] -#[doc = " NCSCALE_SCALE_HIRES behave like their counterparts, but admit blitters"] -#[doc = " which don't preserve aspect ratio."] -pub type ncscale_e = cty::c_uint; -extern "C" { - #[doc = " Returns the number of columns occupied by a multibyte (UTF-8) string, or"] - #[doc = " -1 if a non-printable/illegal character is encountered."] - pub fn ncstrwidth(mbs: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " input functions like notcurses_getc() return ucs32-encoded char32_t. convert"] - #[doc = " a series of char32_t to utf8. result must be at least 4 bytes per input"] - #[doc = " char32_t (6 bytes per char32_t will future-proof against Unicode expansion)."] - #[doc = " the number of bytes used is returned, or -1 if passed illegal ucs32, or too"] - #[doc = " small of a buffer."] - pub fn notcurses_ucs32_to_utf8( - ucs32: *const char32_t, - ucs32count: cty::c_uint, - resultbuf: *mut cty::c_uchar, - buflen: size_t, - ) -> cty::c_int; -} -#[doc = " An nccell corresponds to a single character cell on some plane, which can be"] -#[doc = " occupied by a single grapheme cluster (some root spacing glyph, along with"] -#[doc = " possible combining characters, which might span multiple columns). At any"] -#[doc = " cell, we can have a theoretically arbitrarily long UTF-8 string, a foreground"] -#[doc = " color, a background color, and an attribute set. Valid grapheme cluster"] -#[doc = " contents include:"] -#[doc = ""] -#[doc = " * A NUL terminator,"] -#[doc = " * A single control character, followed by a NUL terminator,"] -#[doc = " * At most one spacing character, followed by zero or more nonspacing"] -#[doc = " characters, followed by a NUL terminator."] -#[doc = ""] -#[doc = " Multi-column characters can only have a single style/color throughout."] -#[doc = " Existence is suffering, and thus wcwidth() is not reliable. It's just"] -#[doc = " quoting whether or not the EGC contains a \"Wide Asian\" double-width"] -#[doc = " character. This is set for some things, like most emoji, and not set for"] -#[doc = " other things, like cuneiform. True display width is a *function of the"] -#[doc = " font and terminal*. Among the longest Unicode codepoints is"] -#[doc = ""] -#[doc = " U+FDFD ARABIC LIGATURE BISMILLAH AR-RAHMAN AR-RAHEEM ﷽"] -#[doc = ""] -#[doc = " wcwidth() rather optimistically claims this most exalted glyph to occupy"] -#[doc = " a single column. BiDi text is too complicated for me to even get into here."] -#[doc = " Be assured there are no easy answers; ours is indeed a disturbing Universe."] -#[doc = ""] -#[doc = " Each nccell occupies 16 static bytes (128 bits). The surface is thus ~1.6MB"] -#[doc = " for a (pretty large) 500x200 terminal. At 80x43, it's less than 64KB."] -#[doc = " Dynamic requirements (the egcpool) can add up to 16MB to an ncplane, but"] -#[doc = " such large pools are unlikely in common use."] -#[doc = ""] -#[doc = " We implement some small alpha compositing. Foreground and background both"] -#[doc = " have two bits of inverted alpha. The actual grapheme written to a cell is"] -#[doc = " the topmost non-zero grapheme. If its alpha is 00, its foreground color is"] -#[doc = " used unchanged. If its alpha is 10, its foreground color is derived entirely"] -#[doc = " from cells underneath it. Otherwise, the result will be a composite."] -#[doc = " Likewise for the background. If the bottom of a coordinate's zbuffer is"] -#[doc = " reached with a cumulative alpha of zero, the default is used. In this way,"] -#[doc = " a terminal configured with transparent background can be supported through"] -#[doc = " multiple occluding ncplanes. A foreground alpha of 11 requests high-contrast"] -#[doc = " text (relative to the computed background). A background alpha of 11 is"] -#[doc = " currently forbidden."] -#[doc = ""] -#[doc = " Default color takes precedence over palette or RGB, and cannot be used with"] -#[doc = " transparency. Indexed palette takes precedence over RGB. It cannot"] -#[doc = " meaningfully set transparency, but it can be mixed into a cascading color."] -#[doc = " RGB is used if neither default terminal colors nor palette indexing are in"] -#[doc = " play, and fully supports all transparency options."] -#[doc = ""] -#[doc = " This structure is exposed only so that most functions can be inlined. Do not"] -#[doc = " directly modify or access the fields of this structure; use the API."] -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct nccell { - #[doc = " 4B → 4B little endian EGC"] - pub gcluster: u32, - #[doc = " 1B → 5B (8 bits of zero)"] - pub gcluster_backstop: u8, - #[doc = " 1B → 6B (8 bits of EGC column width)"] - pub width: u8, - #[doc = " 2B → 8B (16 bits of NCSTYLE_* attributes)"] - pub stylemask: u16, - #[doc = " + 8B == 16B"] - pub channels: u64, -} -#[test] -fn bindgen_test_layout_nccell() { - assert_eq!( - ::core::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(nccell)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(nccell)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).gcluster as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(nccell), - "::", - stringify!(gcluster) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).gcluster_backstop as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(nccell), - "::", - stringify!(gcluster_backstop) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).width as *const _ as usize }, - 5usize, - concat!( - "Offset of field: ", - stringify!(nccell), - "::", - stringify!(width) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).stylemask as *const _ as usize }, - 6usize, - concat!( - "Offset of field: ", - stringify!(nccell), - "::", - stringify!(stylemask) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).channels as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(nccell), - "::", - stringify!(channels) - ) - ); -} -pub type cell = nccell; -extern "C" { - #[doc = " Breaks the UTF-8 string in 'gcluster' down, setting up the nccell 'c'."] - #[doc = " Returns the number of bytes copied out of 'gcluster', or -1 on failure. The"] - #[doc = " styling of the cell is left untouched, but any resources are released."] - pub fn nccell_load(n: *mut ncplane, c: *mut nccell, gcluster: *const cty::c_char) - -> cty::c_int; -} -extern "C" { - pub fn cell_load(n: *mut ncplane, c: *mut nccell, gcluster: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Duplicate 'c' into 'targ'; both must be/will be bound to 'n'. Returns -1 on"] - #[doc = " failure, and 0 on success."] - pub fn nccell_duplicate(n: *mut ncplane, targ: *mut nccell, c: *const nccell) -> cty::c_int; -} -extern "C" { - pub fn cell_duplicate(n: *mut ncplane, targ: *mut nccell, c: *const nccell) -> cty::c_int; -} -extern "C" { - #[doc = " Release resources held by the nccell 'c'."] - pub fn nccell_release(n: *mut ncplane, c: *mut nccell); -} -extern "C" { - pub fn cell_release(n: *mut ncplane, c: *mut nccell); -} -extern "C" { - #[doc = " return a pointer to the NUL-terminated EGC referenced by 'c'. this pointer"] - #[doc = " can be invalidated by any further operation on the plane 'n', so...watch out!"] - #[doc = " returns NULL if called on a pixel graphic."] - pub fn nccell_extended_gcluster(n: *const ncplane, c: *const nccell) -> *const cty::c_char; -} -#[doc = " default. print nothing once fullscreen service begins"] -pub const ncloglevel_e_NCLOGLEVEL_SILENT: ncloglevel_e = 0; -#[doc = " print diagnostics immediately related to crashing"] -pub const ncloglevel_e_NCLOGLEVEL_PANIC: ncloglevel_e = 1; -#[doc = " we're hanging around, but we've had a horrible fault"] -pub const ncloglevel_e_NCLOGLEVEL_FATAL: ncloglevel_e = 2; -#[doc = " we can't keep doing this, but we can do other things"] -pub const ncloglevel_e_NCLOGLEVEL_ERROR: ncloglevel_e = 3; -#[doc = " you probably don't want what's happening to happen"] -pub const ncloglevel_e_NCLOGLEVEL_WARNING: ncloglevel_e = 4; -#[doc = " \"standard information\""] -pub const ncloglevel_e_NCLOGLEVEL_INFO: ncloglevel_e = 5; -#[doc = " \"detailed information\""] -pub const ncloglevel_e_NCLOGLEVEL_VERBOSE: ncloglevel_e = 6; -#[doc = " this is honestly a bit much"] -pub const ncloglevel_e_NCLOGLEVEL_DEBUG: ncloglevel_e = 7; -#[doc = " there's probably a better way to do what you want"] -pub const ncloglevel_e_NCLOGLEVEL_TRACE: ncloglevel_e = 8; -#[doc = " These log levels consciously map cleanly to those of libav; Notcurses itself"] -#[doc = " does not use this full granularity. The log level does not affect the opening"] -#[doc = " and closing banners, which can be disabled via the notcurses_option struct's"] -#[doc = " 'suppress_banner'. Note that if stderr is connected to the same terminal on"] -#[doc = " which we're rendering, any kind of logging will disrupt the output."] -pub type ncloglevel_e = cty::c_uint; -#[doc = " Configuration for notcurses_init()."] -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct notcurses_options { - #[doc = " The name of the terminfo database entry describing this terminal. If NULL,"] - #[doc = " the environment variable TERM is used. Failure to open the terminal"] - #[doc = " definition will result in failure to initialize notcurses."] - pub termtype: *const cty::c_char, - #[doc = " If non-NULL, notcurses_render() will write each rendered frame to this"] - #[doc = " FILE* in addition to outfp. This is used primarily for debugging."] - pub renderfp: *mut FILE, - #[doc = " Progressively higher log levels result in more logging to stderr. By"] - #[doc = " default, nothing is printed to stderr once fullscreen service begins."] - pub loglevel: ncloglevel_e, - #[doc = " Desirable margins. If all are 0 (default), we will render to the entirety"] - #[doc = " of the screen. If the screen is too small, we do what we can--this is"] - #[doc = " strictly best-effort. Absolute coordinates are relative to the rendering"] - #[doc = " area ((0, 0) is always the origin of the rendering area)."] - pub margin_t: cty::c_int, - #[doc = " Desirable margins. If all are 0 (default), we will render to the entirety"] - #[doc = " of the screen. If the screen is too small, we do what we can--this is"] - #[doc = " strictly best-effort. Absolute coordinates are relative to the rendering"] - #[doc = " area ((0, 0) is always the origin of the rendering area)."] - pub margin_r: cty::c_int, - #[doc = " Desirable margins. If all are 0 (default), we will render to the entirety"] - #[doc = " of the screen. If the screen is too small, we do what we can--this is"] - #[doc = " strictly best-effort. Absolute coordinates are relative to the rendering"] - #[doc = " area ((0, 0) is always the origin of the rendering area)."] - pub margin_b: cty::c_int, - #[doc = " Desirable margins. If all are 0 (default), we will render to the entirety"] - #[doc = " of the screen. If the screen is too small, we do what we can--this is"] - #[doc = " strictly best-effort. Absolute coordinates are relative to the rendering"] - #[doc = " area ((0, 0) is always the origin of the rendering area)."] - pub margin_l: cty::c_int, - #[doc = " General flags; see NCOPTION_*. This is expressed as a bitfield so that"] - #[doc = " future options can be added without reshaping the struct. Undefined bits"] - #[doc = " must be set to 0."] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_notcurses_options() { - assert_eq!( - ::core::mem::size_of::(), - 48usize, - concat!("Size of: ", stringify!(notcurses_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(notcurses_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).termtype as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(notcurses_options), - "::", - stringify!(termtype) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).renderfp as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(notcurses_options), - "::", - stringify!(renderfp) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).loglevel as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(notcurses_options), - "::", - stringify!(loglevel) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).margin_t as *const _ as usize }, - 20usize, - concat!( - "Offset of field: ", - stringify!(notcurses_options), - "::", - stringify!(margin_t) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).margin_r as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(notcurses_options), - "::", - stringify!(margin_r) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).margin_b as *const _ as usize }, - 28usize, - concat!( - "Offset of field: ", - stringify!(notcurses_options), - "::", - stringify!(margin_b) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).margin_l as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(notcurses_options), - "::", - stringify!(margin_l) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(notcurses_options), - "::", - stringify!(flags) - ) - ); -} -impl Default for notcurses_options { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -extern "C" { - #[doc = " Lex a margin argument according to the standard Notcurses definition. There"] - #[doc = " can be either a single number, which will define all margins equally, or"] - #[doc = " there can be four numbers separated by commas."] - pub fn notcurses_lex_margins( - op: *const cty::c_char, - opts: *mut notcurses_options, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Lex a blitter."] - pub fn notcurses_lex_blitter(op: *const cty::c_char, blitter: *mut ncblitter_e) -> cty::c_int; -} -extern "C" { - #[doc = " Get the name of a blitter."] - pub fn notcurses_str_blitter(blitter: ncblitter_e) -> *const cty::c_char; -} -extern "C" { - #[doc = " Lex a scaling mode (one of \"none\", \"stretch\", \"scale\", \"hires\", or \"scalehi\")."] - pub fn notcurses_lex_scalemode(op: *const cty::c_char, scalemode: *mut ncscale_e) - -> cty::c_int; -} -extern "C" { - #[doc = " Get the name of a scaling mode."] - pub fn notcurses_str_scalemode(scalemode: ncscale_e) -> *const cty::c_char; -} -extern "C" { - #[doc = " Initialize a Notcurses context on the connected terminal at 'fp'. 'fp' must"] - #[doc = " be a tty. You'll usually want stdout. NULL can be supplied for 'fp', in"] - #[doc = " which case /dev/tty will be opened. Returns NULL on error, including any"] - #[doc = " failure initializing terminfo."] - pub fn notcurses_init(opts: *const notcurses_options, fp: *mut FILE) -> *mut notcurses; -} -extern "C" { - #[doc = " The same as notcurses_init(), but without any multimedia functionality,"] - #[doc = " allowing for a svelter binary. Link with notcurses-core if this is used."] - pub fn notcurses_core_init(opts: *const notcurses_options, fp: *mut FILE) -> *mut notcurses; -} -extern "C" { - #[doc = " Destroy a Notcurses context."] - pub fn notcurses_stop(nc: *mut notcurses) -> cty::c_int; -} -extern "C" { - #[doc = " Return the topmost plane of the pile containing 'n'."] - pub fn ncpile_top(n: *mut ncplane) -> *mut ncplane; -} -extern "C" { - #[doc = " Return the bottommost plane of the pile containing 'n'."] - pub fn ncpile_bottom(n: *mut ncplane) -> *mut ncplane; -} -extern "C" { - #[doc = " Renders the pile of which 'n' is a part. Rendering this pile again will blow"] - #[doc = " away the render. To actually write out the render, call ncpile_rasterize()."] - pub fn ncpile_render(n: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Make the physical screen match the last rendered frame from the pile of"] - #[doc = " which 'n' is a part. This is a blocking call. Don't call this before the"] - #[doc = " pile has been rendered (doing so will likely result in a blank screen)."] - pub fn ncpile_rasterize(n: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Renders and rasterizes the standard pile in one shot. Blocking call."] - pub fn notcurses_render(nc: *mut notcurses) -> cty::c_int; -} -extern "C" { - #[doc = " Perform the rendering and rasterization portion of notcurses_render(), but"] - #[doc = " do not write the resulting buffer out to the terminal. Using this function,"] - #[doc = " the user can control the writeout process, and render a second frame while"] - #[doc = " writing another. The returned buffer must be freed by the caller."] - pub fn notcurses_render_to_buffer( - nc: *mut notcurses, - buf: *mut *mut cty::c_char, - buflen: *mut size_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Write the last rendered frame, in its entirety, to 'fp'. If"] - #[doc = " notcurses_render() has not yet been called, nothing will be written."] - pub fn notcurses_render_to_file(nc: *mut notcurses, fp: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Return the topmost ncplane of the standard pile."] - pub fn notcurses_top(n: *mut notcurses) -> *mut ncplane; -} -extern "C" { - #[doc = " Return the bottommost ncplane of the standard pile."] - pub fn notcurses_bottom(n: *mut notcurses) -> *mut ncplane; -} -extern "C" { - #[doc = " Destroy all ncplanes other than the stdplane."] - pub fn notcurses_drop_planes(nc: *mut notcurses); -} -#[doc = " An input event. Cell coordinates are currently defined only for mouse events."] -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncinput { - #[doc = " identifier. Unicode codepoint or synthesized NCKEY event"] - pub id: char32_t, - #[doc = " y cell coordinate of event, -1 for undefined"] - pub y: cty::c_int, - #[doc = " x cell coordinate of event, -1 for undefined"] - pub x: cty::c_int, - #[doc = " was alt held?"] - pub alt: bool, - #[doc = " was shift held?"] - pub shift: bool, - #[doc = " was ctrl held?"] - pub ctrl: bool, - #[doc = " input event number"] - pub seqnum: u64, -} -#[test] -fn bindgen_test_layout_ncinput() { - assert_eq!( - ::core::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(ncinput)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncinput)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).id as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncinput), - "::", - stringify!(id) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).y as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(ncinput), - "::", - stringify!(y) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).x as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncinput), - "::", - stringify!(x) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).alt as *const _ as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(ncinput), - "::", - stringify!(alt) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).shift as *const _ as usize }, - 13usize, - concat!( - "Offset of field: ", - stringify!(ncinput), - "::", - stringify!(shift) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).ctrl as *const _ as usize }, - 14usize, - concat!( - "Offset of field: ", - stringify!(ncinput), - "::", - stringify!(ctrl) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).seqnum as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncinput), - "::", - stringify!(seqnum) - ) - ); -} -extern "C" { - #[doc = " See ppoll(2) for more detail. Provide a NULL 'ts' to block at length, a 'ts'"] - #[doc = " of 0 for non-blocking operation, and otherwise a timespec to bound blocking."] - #[doc = " Signals in sigmask (less several we handle internally) will be atomically"] - #[doc = " masked and unmasked per ppoll(2). It should generally contain all signals."] - #[doc = " Returns a single Unicode code point, or (char32_t)-1 on error. 'sigmask' may"] - #[doc = " be NULL. Returns 0 on a timeout. If an event is processed, the return value"] - #[doc = " is the 'id' field from that event. 'ni' may be NULL."] - pub fn notcurses_getc( - n: *mut notcurses, - ts: *const timespec, - sigmask: *mut sigset_t, - ni: *mut ncinput, - ) -> char32_t; -} -extern "C" { - #[doc = " Get a file descriptor suitable for input event poll()ing. When this"] - #[doc = " descriptor becomes available, you can call notcurses_getc_nblock(),"] - #[doc = " and input ought be ready. This file descriptor is *not* necessarily"] - #[doc = " the file descriptor associated with stdin (but it might be!)."] - pub fn notcurses_inputready_fd(n: *mut notcurses) -> cty::c_int; -} -extern "C" { - #[doc = " Enable the mouse in \"button-event tracking\" mode with focus detection and"] - #[doc = " UTF8-style extended coordinates. On failure, -1 is returned. On success, 0"] - #[doc = " is returned, and mouse events will be published to notcurses_getc()."] - pub fn notcurses_mouse_enable(n: *mut notcurses) -> cty::c_int; -} -extern "C" { - #[doc = " Disable mouse events. Any events in the input queue can still be delivered."] - pub fn notcurses_mouse_disable(n: *mut notcurses) -> cty::c_int; -} -extern "C" { - #[doc = " Disable signals originating from the terminal's line discipline, i.e."] - #[doc = " SIGINT (^C), SIGQUIT (^\\), and SIGTSTP (^Z). They are enabled by default."] - pub fn notcurses_linesigs_disable(n: *mut notcurses) -> cty::c_int; -} -extern "C" { - #[doc = " Restore signals originating from the terminal's line discipline, i.e."] - #[doc = " SIGINT (^C), SIGQUIT (^\\), and SIGTSTP (^Z), if disabled."] - pub fn notcurses_linesigs_enable(n: *mut notcurses) -> cty::c_int; -} -extern "C" { - #[doc = " Refresh the physical screen to match what was last rendered (i.e., without"] - #[doc = " reflecting any changes since the last call to notcurses_render()). This is"] - #[doc = " primarily useful if the screen is externally corrupted, or if an"] - #[doc = " NCKEY_RESIZE event has been read and you're not yet ready to render."] - pub fn notcurses_refresh( - n: *mut notcurses, - y: *mut cty::c_int, - x: *mut cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Extract the Notcurses context to which this plane is attached."] - pub fn ncplane_notcurses(n: *mut ncplane) -> *mut notcurses; -} -extern "C" { - pub fn ncplane_notcurses_const(n: *const ncplane) -> *const notcurses; -} -extern "C" { - #[doc = " Return the dimensions of this ncplane."] - pub fn ncplane_dim_yx(n: *const ncplane, y: *mut cty::c_int, x: *mut cty::c_int); -} -extern "C" { - #[doc = " Get a reference to the standard plane (one matching our current idea of the"] - #[doc = " terminal size) for this terminal. The standard plane always exists, and its"] - #[doc = " origin is always at the uppermost, leftmost cell of the terminal."] - pub fn notcurses_stdplane(nc: *mut notcurses) -> *mut ncplane; -} -extern "C" { - pub fn notcurses_stdplane_const(nc: *const notcurses) -> *const ncplane; -} -extern "C" { - #[doc = " Retrieve pixel geometry for the display region ('pxy', 'pxx'), each cell"] - #[doc = " ('celldimy', 'celldimx'), and the maximum displayable bitmap ('maxbmapy',"] - #[doc = " 'maxbmapx'). Note that this will call notcurses_check_pixel_support(),"] - #[doc = " possibly leading to an interrogation of the terminal. If bitmaps are not"] - #[doc = " supported, 'maxbmapy' and 'maxbmapx' will be 0. Any of the geometry"] - #[doc = " arguments may be NULL."] - pub fn ncplane_pixelgeom( - n: *mut ncplane, - pxy: *mut cty::c_int, - pxx: *mut cty::c_int, - celldimy: *mut cty::c_int, - celldimx: *mut cty::c_int, - maxbmapy: *mut cty::c_int, - maxbmapx: *mut cty::c_int, - ); -} -extern "C" { - #[doc = " Retrieve the contents of the specified cell as last rendered. Returns the EGC"] - #[doc = " or NULL on error. This EGC must be free()d by the caller. The stylemask and"] - #[doc = " channels are written to 'stylemask' and 'channels', respectively."] - pub fn notcurses_at_yx( - nc: *mut notcurses, - yoff: cty::c_int, - xoff: cty::c_int, - stylemask: *mut u16, - channels: *mut u64, - ) -> *mut cty::c_char; -} -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncplane_options { - #[doc = " vertical placement relative to parent plane"] - pub y: cty::c_int, - #[doc = " horizontal placement relative to parent plane"] - pub x: cty::c_int, - #[doc = " rows, must be positive (unless NCPLANE_OPTION_MARGINALIZED)"] - pub rows: cty::c_int, - #[doc = " columns, must be positive (unless NCPLANE_OPTION_MARGINALIZED)"] - pub cols: cty::c_int, - #[doc = " user curry, may be NULL"] - pub userptr: *mut cty::c_void, - #[doc = " name (used only for debugging), may be NULL"] - pub name: *const cty::c_char, - #[doc = " callback when parent is resized"] - pub resizecb: ::core::option::Option cty::c_int>, - #[doc = " closure over NCPLANE_OPTION_*"] - pub flags: u64, - #[doc = " margins (require NCPLANE_OPTION_MARGINALIZED)"] - pub margin_b: cty::c_int, - #[doc = " margins (require NCPLANE_OPTION_MARGINALIZED)"] - pub margin_r: cty::c_int, -} -#[test] -fn bindgen_test_layout_ncplane_options() { - assert_eq!( - ::core::mem::size_of::(), - 56usize, - concat!("Size of: ", stringify!(ncplane_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncplane_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).y as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(y) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).x as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(x) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).rows as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(rows) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).cols as *const _ as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(cols) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).userptr as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(userptr) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).name as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(name) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).resizecb as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(resizecb) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(flags) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).margin_b as *const _ as usize }, - 48usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(margin_b) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).margin_r as *const _ as usize }, - 52usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(margin_r) - ) - ); -} -impl Default for ncplane_options { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -extern "C" { - #[doc = " Create a new ncplane bound to plane 'n', at the offset 'y'x'x' (relative to"] - #[doc = " the origin of 'n') and the specified size. The number of 'rows' and 'cols'"] - #[doc = " must both be positive. This plane is initially at the top of the z-buffer,"] - #[doc = " as if ncplane_move_top() had been called on it. The void* 'userptr' can be"] - #[doc = " retrieved (and reset) later. A 'name' can be set, used in debugging."] - pub fn ncplane_create(n: *mut ncplane, nopts: *const ncplane_options) -> *mut ncplane; -} -extern "C" { - #[doc = " Same as ncplane_create(), but creates a new pile. The returned plane will"] - #[doc = " be the top, bottom, and root of this new pile."] - pub fn ncpile_create(nc: *mut notcurses, nopts: *const ncplane_options) -> *mut ncplane; -} -extern "C" { - #[doc = " This function will be removed in ABI3 in favor of ncplane_create()."] - #[doc = " It persists in ABI2 only for backwards compatibility."] - pub fn ncplane_new( - n: *mut ncplane, - rows: cty::c_int, - cols: cty::c_int, - y: cty::c_int, - x: cty::c_int, - opaque: *mut cty::c_void, - name: *const cty::c_char, - ) -> *mut ncplane; -} -extern "C" { - #[doc = " Suitable for use as a 'resizecb', this will resize the plane to the visual"] - #[doc = " region's size. It is used for the standard plane."] - pub fn ncplane_resize_maximize(n: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Suitable for use as a 'resizecb' with planes created with"] - #[doc = " NCPLANE_OPTION_MARGINALIZED. This will resize the plane 'n' against its"] - #[doc = " parent, attempting to enforce the supplied margins."] - pub fn ncplane_resize_marginalized(n: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Suitable for use as a 'resizecb'. This will realign the plane 'n' against"] - #[doc = " its parent, using the alignment specified at ncplane_create()-time."] - pub fn ncplane_resize_realign(n: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Replace the ncplane's existing resizecb with 'resizecb' (which may be NULL)."] - #[doc = " The standard plane's resizecb may not be changed."] - pub fn ncplane_set_resizecb( - n: *mut ncplane, - resizecb: ::core::option::Option cty::c_int>, - ); -} -extern "C" { - #[doc = " Returns the ncplane's current resize callback."] - pub fn ncplane_resizecb( - n: *const ncplane, - ) -> ::core::option::Option cty::c_int>; -} -extern "C" { - #[doc = " Plane 'n' will be unbound from its parent plane, and will be made a bound"] - #[doc = " child of 'newparent'. It is an error if 'n' or 'newparent' are NULL. If"] - #[doc = " 'newparent' is equal to 'n', 'n' becomes the root of a new pile, unless 'n'"] - #[doc = " is already the root of a pile, in which case this is a no-op. Returns 'n'."] - #[doc = " The standard plane cannot be reparented. Any planes bound to 'n' are"] - #[doc = " reparented to the previous parent of 'n'."] - pub fn ncplane_reparent(n: *mut ncplane, newparent: *mut ncplane) -> *mut ncplane; -} -extern "C" { - #[doc = " The same as ncplane_reparent(), except any planes bound to 'n' come along"] - #[doc = " with it to its new destination. Their z-order is maintained. If 'newparent'"] - #[doc = " is an ancestor of 'n', NULL is returned, and no changes are made."] - pub fn ncplane_reparent_family(n: *mut ncplane, newparent: *mut ncplane) -> *mut ncplane; -} -extern "C" { - #[doc = " Duplicate an existing ncplane. The new plane will have the same geometry,"] - #[doc = " will duplicate all content, and will start with the same rendering state."] - #[doc = " The new plane will be immediately above the old one on the z axis, and will"] - #[doc = " be bound to the same parent. Bound planes are *not* duplicated; the new"] - #[doc = " plane is bound to the parent of 'n', but has no bound planes."] - pub fn ncplane_dup(n: *const ncplane, opaque: *mut cty::c_void) -> *mut ncplane; -} -extern "C" { - #[doc = " provided a coordinate relative to the origin of 'src', map it to the same"] - #[doc = " absolute coordinate relative to the origin of 'dst'. either or both of 'y'"] - #[doc = " and 'x' may be NULL. if 'dst' is NULL, it is taken to be the standard plane."] - pub fn ncplane_translate( - src: *const ncplane, - dst: *const ncplane, - y: *mut cty::c_int, - x: *mut cty::c_int, - ); -} -extern "C" { - #[doc = " Fed absolute 'y'/'x' coordinates, determine whether that coordinate is"] - #[doc = " within the ncplane 'n'. If not, return false. If so, return true. Either"] - #[doc = " way, translate the absolute coordinates relative to 'n'. If the point is not"] - #[doc = " within 'n', these coordinates will not be within the dimensions of the plane."] - pub fn ncplane_translate_abs(n: *const ncplane, y: *mut cty::c_int, x: *mut cty::c_int) - -> bool; -} -extern "C" { - #[doc = " All planes are created with scrolling disabled. Scrolling can be dynamically"] - #[doc = " controlled with ncplane_set_scrolling(). Returns true if scrolling was"] - #[doc = " previously enabled, or false if it was disabled."] - pub fn ncplane_set_scrolling(n: *mut ncplane, scrollp: bool) -> bool; -} -extern "C" { - #[doc = " Returns a 16-bit bitmask of supported curses-style attributes"] - #[doc = " (NCSTYLE_UNDERLINE, NCSTYLE_BOLD, etc.) The attribute is only"] - #[doc = " indicated as supported if the terminal can support it together with color."] - #[doc = " For more information, see the \"ncv\" capability in terminfo(5)."] - pub fn notcurses_supported_styles(nc: *const notcurses) -> cty::c_uint; -} -extern "C" { - #[doc = " Returns the number of simultaneous colors claimed to be supported, or 1 if"] - #[doc = " there is no color support. Note that several terminal emulators advertise"] - #[doc = " more colors than they actually support, downsampling internally."] - pub fn notcurses_palette_size(nc: *const notcurses) -> cty::c_uint; -} -extern "C" { - #[doc = " Can we directly specify RGB values per cell, or only use palettes?"] - pub fn notcurses_cantruecolor(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " Can we fade? Fading requires either the \"rgb\" or \"ccc\" terminfo capability."] - pub fn notcurses_canfade(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " Can we set the \"hardware\" palette? Requires the \"ccc\" terminfo capability."] - pub fn notcurses_canchangecolor(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " Can we load images? This requires being built against FFmpeg/OIIO."] - pub fn notcurses_canopen_images(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " Can we load videos? This requires being built against FFmpeg."] - pub fn notcurses_canopen_videos(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " Is our encoding UTF-8? Requires LANG being set to a UTF8 locale."] - pub fn notcurses_canutf8(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " Can we reliably use Unicode 13 sextants?"] - pub fn notcurses_cansextant(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " Can we reliably use Unicode Braille?"] - pub fn notcurses_canbraille(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " This function must successfully return before NCBLIT_PIXEL is available."] - #[doc = " Returns -1 on error, 0 for no support, or 1 if pixel output is supported."] - #[doc = " Must not be called concurrently with either input or rasterization."] - pub fn notcurses_check_pixel_support(nc: *mut notcurses) -> cty::c_int; -} -#[doc = " whenever a new field is added here, ensure we add the proper rule to"] -#[doc = " notcurses_stats_reset(), so that values are preserved in the stash stats."] -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncstats { - #[doc = " successful ncpile_render() runs"] - pub renders: u64, - #[doc = " successful ncpile_rasterize() runs"] - pub writeouts: u64, - #[doc = " aborted renders, should be 0"] - pub failed_renders: u64, - #[doc = " aborted writes"] - pub failed_writeouts: u64, - #[doc = " bytes emitted to ttyfp"] - pub render_bytes: u64, - #[doc = " max bytes emitted for a frame"] - pub render_max_bytes: i64, - #[doc = " min bytes emitted for a frame"] - pub render_min_bytes: i64, - #[doc = " nanoseconds spent rendering"] - pub render_ns: u64, - #[doc = " max ns spent in render for a frame"] - pub render_max_ns: i64, - #[doc = " min ns spent in render for a frame"] - pub render_min_ns: i64, - #[doc = " nanoseconds spent writing frames to terminal"] - pub writeout_ns: u64, - #[doc = " max ns spent writing out a frame"] - pub writeout_max_ns: i64, - #[doc = " min ns spent writing out a frame"] - pub writeout_min_ns: i64, - #[doc = " cells we elided entirely thanks to damage maps"] - pub cellelisions: u64, - #[doc = " total number of cells emitted to terminal"] - pub cellemissions: u64, - #[doc = " RGB fg elision count"] - pub fgelisions: u64, - #[doc = " RGB fg emissions"] - pub fgemissions: u64, - #[doc = " RGB bg elision count"] - pub bgelisions: u64, - #[doc = " RGB bg emissions"] - pub bgemissions: u64, - #[doc = " default color was emitted"] - pub defaultelisions: u64, - #[doc = " default color was elided"] - pub defaultemissions: u64, - #[doc = " refresh requests (non-optimized redraw)"] - pub refreshes: u64, - #[doc = " total bytes devoted to all active framebuffers"] - pub fbbytes: u64, - #[doc = " number of planes currently in existence"] - pub planes: cty::c_uint, - #[doc = " nanoseconds spent rasterizing"] - pub raster_ns: u64, - #[doc = " max ns spent in raster for a frame"] - pub raster_max_ns: i64, - #[doc = " min ns spent in raster for a frame"] - pub raster_min_ns: i64, -} -#[test] -fn bindgen_test_layout_ncstats() { - assert_eq!( - ::core::mem::size_of::(), - 216usize, - concat!("Size of: ", stringify!(ncstats)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncstats)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).renders as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(renders) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).writeouts as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(writeouts) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).failed_renders as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(failed_renders) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).failed_writeouts as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(failed_writeouts) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).render_bytes as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(render_bytes) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).render_max_bytes as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(render_max_bytes) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).render_min_bytes as *const _ as usize }, - 48usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(render_min_bytes) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).render_ns as *const _ as usize }, - 56usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(render_ns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).render_max_ns as *const _ as usize }, - 64usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(render_max_ns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).render_min_ns as *const _ as usize }, - 72usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(render_min_ns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).writeout_ns as *const _ as usize }, - 80usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(writeout_ns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).writeout_max_ns as *const _ as usize }, - 88usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(writeout_max_ns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).writeout_min_ns as *const _ as usize }, - 96usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(writeout_min_ns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).cellelisions as *const _ as usize }, - 104usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(cellelisions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).cellemissions as *const _ as usize }, - 112usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(cellemissions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).fgelisions as *const _ as usize }, - 120usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(fgelisions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).fgemissions as *const _ as usize }, - 128usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(fgemissions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).bgelisions as *const _ as usize }, - 136usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(bgelisions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).bgemissions as *const _ as usize }, - 144usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(bgemissions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).defaultelisions as *const _ as usize }, - 152usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(defaultelisions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).defaultemissions as *const _ as usize }, - 160usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(defaultemissions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).refreshes as *const _ as usize }, - 168usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(refreshes) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).fbbytes as *const _ as usize }, - 176usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(fbbytes) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).planes as *const _ as usize }, - 184usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(planes) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).raster_ns as *const _ as usize }, - 192usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(raster_ns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).raster_max_ns as *const _ as usize }, - 200usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(raster_max_ns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).raster_min_ns as *const _ as usize }, - 208usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(raster_min_ns) - ) - ); -} -extern "C" { - #[doc = " Allocate an ncstats object. Use this rather than allocating your own, since"] - #[doc = " future versions of Notcurses might enlarge this structure."] - pub fn notcurses_stats_alloc(nc: *const notcurses) -> *mut ncstats; -} -extern "C" { - #[doc = " Acquire an atomic snapshot of the Notcurses object's stats."] - pub fn notcurses_stats(nc: *mut notcurses, stats: *mut ncstats); -} -extern "C" { - #[doc = " Reset all cumulative stats (immediate ones, such as fbbytes, are not reset),"] - #[doc = " first copying them into |*stats| (if |stats| is not NULL)."] - pub fn notcurses_stats_reset(nc: *mut notcurses, stats: *mut ncstats); -} -extern "C" { - #[doc = " Resize the specified ncplane. The four parameters 'keepy', 'keepx',"] - #[doc = " 'keepleny', and 'keeplenx' define a subset of the ncplane to keep,"] - #[doc = " unchanged. This may be a section of size 0, though none of these four"] - #[doc = " parameters may be negative. 'keepx' and 'keepy' are relative to the ncplane."] - #[doc = " They must specify a coordinate within the ncplane's totality. 'yoff' and"] - #[doc = " 'xoff' are relative to 'keepy' and 'keepx', and place the upper-left corner"] - #[doc = " of the resized ncplane. Finally, 'ylen' and 'xlen' are the dimensions of the"] - #[doc = " ncplane after resizing. 'ylen' must be greater than or equal to 'keepleny',"] - #[doc = " and 'xlen' must be greater than or equal to 'keeplenx'. It is an error to"] - #[doc = " attempt to resize the standard plane. If either of 'keepleny' or 'keeplenx'"] - #[doc = " is non-zero, both must be non-zero."] - #[doc = ""] - #[doc = " Essentially, the kept material does not move. It serves to anchor the"] - #[doc = " resized plane. If there is no kept material, the plane can move freely."] - pub fn ncplane_resize( - n: *mut ncplane, - keepy: cty::c_int, - keepx: cty::c_int, - keepleny: cty::c_int, - keeplenx: cty::c_int, - yoff: cty::c_int, - xoff: cty::c_int, - ylen: cty::c_int, - xlen: cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Destroy the specified ncplane. None of its contents will be visible after"] - #[doc = " the next call to notcurses_render(). It is an error to attempt to destroy"] - #[doc = " the standard plane."] - pub fn ncplane_destroy(n: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Set the ncplane's base nccell to 'c'. The base cell is used for purposes of"] - #[doc = " rendering anywhere that the ncplane's gcluster is 0. Note that the base cell"] - #[doc = " is not affected by ncplane_erase(). 'c' must not be a secondary cell from a"] - #[doc = " multicolumn EGC."] - pub fn ncplane_set_base_cell(n: *mut ncplane, c: *const nccell) -> cty::c_int; -} -extern "C" { - #[doc = " Set the ncplane's base nccell. It will be used for purposes of rendering"] - #[doc = " anywhere that the ncplane's gcluster is 0. Note that the base cell is not"] - #[doc = " affected by ncplane_erase(). 'egc' must be an extended grapheme cluster."] - pub fn ncplane_set_base( - n: *mut ncplane, - egc: *const cty::c_char, - stylemask: u32, - channels: u64, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Extract the ncplane's base nccell into 'c'. The reference is invalidated if"] - #[doc = " 'ncp' is destroyed."] - pub fn ncplane_base(n: *mut ncplane, c: *mut nccell) -> cty::c_int; -} -extern "C" { - #[doc = " Move this plane relative to the standard plane, or the plane to which it is"] - #[doc = " bound (if it is bound to a plane). It is an error to attempt to move the"] - #[doc = " standard plane."] - pub fn ncplane_move_yx(n: *mut ncplane, y: cty::c_int, x: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Get the origin of plane 'n' relative to its bound plane, or pile (if 'n' is"] - #[doc = " a root plane). To get absolute coordinates, use ncplane_abs_yx()."] - pub fn ncplane_yx(n: *const ncplane, y: *mut cty::c_int, x: *mut cty::c_int); -} -extern "C" { - pub fn ncplane_y(n: *const ncplane) -> cty::c_int; -} -extern "C" { - pub fn ncplane_x(n: *const ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Get the origin of plane 'n' relative to its pile. Either or both of 'x' and"] - #[doc = " 'y' may be NULL."] - pub fn ncplane_abs_yx(n: *const ncplane, y: *mut cty::c_int, x: *mut cty::c_int); -} -extern "C" { - pub fn ncplane_abs_y(n: *const ncplane) -> cty::c_int; -} -extern "C" { - pub fn ncplane_abs_x(n: *const ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Get the plane to which the plane 'n' is bound, if any."] - pub fn ncplane_parent(n: *mut ncplane) -> *mut ncplane; -} -extern "C" { - pub fn ncplane_parent_const(n: *const ncplane) -> *const ncplane; -} -extern "C" { - #[doc = " Splice ncplane 'n' out of the z-buffer, and reinsert it at the top or bottom."] - pub fn ncplane_move_top(n: *mut ncplane); -} -extern "C" { - pub fn ncplane_move_bottom(n: *mut ncplane); -} -extern "C" { - #[doc = " Splice ncplane 'n' out of the z-buffer, and reinsert it above 'above'."] - #[doc = " Returns non-zero if 'n' is already in the desired location. 'n' and"] - #[doc = " 'above' must not be the same plane."] - pub fn ncplane_move_above(n: *mut ncplane, above: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Splice ncplane 'n' out of the z-buffer, and reinsert it below 'below'."] - #[doc = " Returns non-zero if 'n' is already in the desired location. 'n' and"] - #[doc = " 'below' must not be the same plane."] - pub fn ncplane_move_below(n: *mut ncplane, below: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Return the plane below this one, or NULL if this is at the bottom."] - pub fn ncplane_below(n: *mut ncplane) -> *mut ncplane; -} -extern "C" { - pub fn ncplane_above(n: *mut ncplane) -> *mut ncplane; -} -extern "C" { - #[doc = " Rotate the plane π/2 radians clockwise or counterclockwise. This cannot"] - #[doc = " be performed on arbitrary planes, because glyphs cannot be arbitrarily"] - #[doc = " rotated. The glyphs which can be rotated are limited: line-drawing"] - #[doc = " characters, spaces, half blocks, and full blocks. The plane must have"] - #[doc = " an even number of columns. Use the ncvisual rotation for a more"] - #[doc = " flexible approach."] - pub fn ncplane_rotate_cw(n: *mut ncplane) -> cty::c_int; -} -extern "C" { - pub fn ncplane_rotate_ccw(n: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Retrieve the current contents of the cell under the cursor. The EGC is"] - #[doc = " returned, or NULL on error. This EGC must be free()d by the caller. The"] - #[doc = " stylemask and channels are written to 'stylemask' and 'channels', respectively."] - pub fn ncplane_at_cursor( - n: *mut ncplane, - stylemask: *mut u16, - channels: *mut u64, - ) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Retrieve the current contents of the cell under the cursor into 'c'. This"] - #[doc = " cell is invalidated if the associated plane is destroyed. Returns the number"] - #[doc = " of bytes in the EGC, or -1 on error."] - pub fn ncplane_at_cursor_cell(n: *mut ncplane, c: *mut nccell) -> cty::c_int; -} -extern "C" { - #[doc = " Retrieve the current contents of the specified cell. The EGC is returned, or"] - #[doc = " NULL on error. This EGC must be free()d by the caller. The stylemask and"] - #[doc = " channels are written to 'stylemask' and 'channels', respectively."] - pub fn ncplane_at_yx( - n: *const ncplane, - y: cty::c_int, - x: cty::c_int, - stylemask: *mut u16, - channels: *mut u64, - ) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Retrieve the current contents of the specified cell into 'c'. This cell is"] - #[doc = " invalidated if the associated plane is destroyed. Returns the number of"] - #[doc = " bytes in the EGC, or -1 on error."] - pub fn ncplane_at_yx_cell( - n: *mut ncplane, - y: cty::c_int, - x: cty::c_int, - c: *mut nccell, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Create a flat string from the EGCs of the selected region of the ncplane"] - #[doc = " 'n'. Start at the plane's 'begy'x'begx' coordinate (which must lie on the"] - #[doc = " plane), continuing for 'leny'x'lenx' cells. Either or both of 'leny' and"] - #[doc = " 'lenx' can be specified as -1 to go through the boundary of the plane."] - pub fn ncplane_contents( - n: *const ncplane, - begy: cty::c_int, - begx: cty::c_int, - leny: cty::c_int, - lenx: cty::c_int, - ) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Manipulate the opaque user pointer associated with this plane."] - #[doc = " ncplane_set_userptr() returns the previous userptr after replacing"] - #[doc = " it with 'opaque'. the others simply return the userptr."] - pub fn ncplane_set_userptr(n: *mut ncplane, opaque: *mut cty::c_void) -> *mut cty::c_void; -} -extern "C" { - pub fn ncplane_userptr(n: *mut ncplane) -> *mut cty::c_void; -} -extern "C" { - pub fn ncplane_center_abs(n: *const ncplane, y: *mut cty::c_int, x: *mut cty::c_int); -} -extern "C" { - #[doc = " Move the cursor to the specified position (the cursor needn't be visible)."] - #[doc = " Returns -1 on error, including negative parameters, or ones exceeding the"] - #[doc = " plane's dimensions."] - pub fn ncplane_cursor_move_yx(n: *mut ncplane, y: cty::c_int, x: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Move the cursor to 0, 0. Can't fail."] - pub fn ncplane_home(n: *mut ncplane); -} -extern "C" { - #[doc = " Get the current position of the cursor within n. y and/or x may be NULL."] - pub fn ncplane_cursor_yx(n: *const ncplane, y: *mut cty::c_int, x: *mut cty::c_int); -} -extern "C" { - #[doc = " Get the current channels or attribute word for ncplane 'n'."] - pub fn ncplane_channels(n: *const ncplane) -> u64; -} -extern "C" { - #[doc = " Return the current styling for this ncplane."] - pub fn ncplane_styles(n: *const ncplane) -> u16; -} -extern "C" { - #[doc = " Replace the cell at the specified coordinates with the provided cell 'c',"] - #[doc = " and advance the cursor by the width of the cell (but not past the end of the"] - #[doc = " plane). On success, returns the number of columns the cursor was advanced."] - #[doc = " 'c' must already be associated with 'n'. On failure, -1 is returned."] - pub fn ncplane_putc_yx( - n: *mut ncplane, - y: cty::c_int, - x: cty::c_int, - c: *const nccell, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Replace the EGC underneath us, but retain the styling. The current styling"] - #[doc = " of the plane will not be changed."] - pub fn ncplane_putchar_stained(n: *mut ncplane, c: cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Replace the cell at the specified coordinates with the provided EGC, and"] - #[doc = " advance the cursor by the width of the cluster (but not past the end of the"] - #[doc = " plane). On success, returns the number of columns the cursor was advanced."] - #[doc = " On failure, -1 is returned. The number of bytes converted from gclust is"] - #[doc = " written to 'sbytes' if non-NULL."] - pub fn ncplane_putegc_yx( - n: *mut ncplane, - y: cty::c_int, - x: cty::c_int, - gclust: *const cty::c_char, - sbytes: *mut cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Replace the EGC underneath us, but retain the styling. The current styling"] - #[doc = " of the plane will not be changed."] - pub fn ncplane_putegc_stained( - n: *mut ncplane, - gclust: *const cty::c_char, - sbytes: *mut cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Replace the EGC underneath us, but retain the styling. The current styling"] - #[doc = " of the plane will not be changed."] - pub fn ncplane_putwegc_stained( - n: *mut ncplane, - gclust: *const wchar_t, - sbytes: *mut cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Write a series of EGCs to the current location, using the current style."] - #[doc = " They will be interpreted as a series of columns (according to the definition"] - #[doc = " of ncplane_putc()). Advances the cursor by some positive number of columns"] - #[doc = " (though not beyond the end of the plane); this number is returned on success."] - #[doc = " On error, a non-positive number is returned, indicating the number of columns"] - #[doc = " which were written before the error."] - pub fn ncplane_putstr_yx( - n: *mut ncplane, - y: cty::c_int, - x: cty::c_int, - gclusters: *const cty::c_char, - ) -> cty::c_int; -} -extern "C" { - pub fn ncplane_putstr_aligned( - n: *mut ncplane, - y: cty::c_int, - align: ncalign_e, - s: *const cty::c_char, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Replace a string's worth of glyphs at the current cursor location, but"] - #[doc = " retain the styling. The current styling of the plane will not be changed."] - pub fn ncplane_putstr_stained(n: *mut ncplane, s: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Write a series of EGCs to the current location, using the current style."] - #[doc = " They will be interpreted as a series of columns (according to the definition"] - #[doc = " of ncplane_putc()). Advances the cursor by some positive number of columns"] - #[doc = " (though not beyond the end of the plane); this number is returned on success."] - #[doc = " On error, a non-positive number is returned, indicating the number of columns"] - #[doc = " which were written before the error. No more than 's' bytes will be written."] - pub fn ncplane_putnstr_yx( - n: *mut ncplane, - y: cty::c_int, - x: cty::c_int, - s: size_t, - gclusters: *const cty::c_char, - ) -> cty::c_int; -} -extern "C" { - pub fn ncplane_putnstr_aligned( - n: *mut ncplane, - y: cty::c_int, - align: ncalign_e, - s: size_t, - gclustarr: *const cty::c_char, - ) -> cty::c_int; -} -extern "C" { - pub fn ncplane_putwstr_stained(n: *mut ncplane, gclustarr: *const wchar_t) -> cty::c_int; -} -extern "C" { - #[doc = " The ncplane equivalents of printf(3) and vprintf(3)."] - pub fn ncplane_vprintf_aligned( - n: *mut ncplane, - y: cty::c_int, - align: ncalign_e, - format: *const cty::c_char, - ap: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - pub fn ncplane_vprintf_yx( - n: *mut ncplane, - y: cty::c_int, - x: cty::c_int, - format: *const cty::c_char, - ap: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - pub fn ncplane_vprintf_stained( - n: *mut ncplane, - format: *const cty::c_char, - ap: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Write the specified text to the plane, breaking lines sensibly, beginning at"] - #[doc = " the specified line. Returns the number of columns written. When breaking a"] - #[doc = " line, the line will be cleared to the end of the plane (the last line will"] - #[doc = " *not* be so cleared). The number of bytes written from the input is written"] - #[doc = " to '*bytes' if it is not NULL. Cleared columns are included in the return"] - #[doc = " value, but *not* included in the number of bytes written. Leaves the cursor"] - #[doc = " at the end of output. A partial write will be accomplished as far as it can;"] - #[doc = " determine whether the write completed by inspecting '*bytes'. Can output to"] - #[doc = " multiple rows even in the absence of scrolling, but not more rows than are"] - #[doc = " available. With scrolling enabled, arbitrary amounts of data can be emitted."] - #[doc = " All provided whitespace is preserved -- ncplane_puttext() followed by an"] - #[doc = " appropriate ncplane_contents() will read back the original output."] - #[doc = ""] - #[doc = " If 'y' is -1, the first row of output is taken relative to the current"] - #[doc = " cursor: it will be left-, right-, or center-aligned in whatever remains"] - #[doc = " of the row. On subsequent rows -- or if 'y' is not -1 -- the entire row can"] - #[doc = " be used, and alignment works normally."] - #[doc = ""] - #[doc = " A newline at any point will move the cursor to the next row."] - pub fn ncplane_puttext( - n: *mut ncplane, - y: cty::c_int, - align: ncalign_e, - text: *const cty::c_char, - bytes: *mut size_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Draw horizontal or vertical lines using the specified cell, starting at the"] - #[doc = " current cursor position. The cursor will end at the cell following the last"] - #[doc = " cell output (even, perhaps counter-intuitively, when drawing vertical"] - #[doc = " lines), just as if ncplane_putc() was called at that spot. Return the"] - #[doc = " number of cells drawn on success. On error, return the negative number of"] - #[doc = " cells drawn."] - pub fn ncplane_hline_interp( - n: *mut ncplane, - c: *const nccell, - len: cty::c_int, - c1: u64, - c2: u64, - ) -> cty::c_int; -} -extern "C" { - pub fn ncplane_vline_interp( - n: *mut ncplane, - c: *const nccell, - len: cty::c_int, - c1: u64, - c2: u64, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Draw a box with its upper-left corner at the current cursor position, and its"] - #[doc = " lower-right corner at 'ystop'x'xstop'. The 6 cells provided are used to draw the"] - #[doc = " upper-left, ur, ll, and lr corners, then the horizontal and vertical lines."] - #[doc = " 'ctlword' is defined in the least significant byte, where bits [7, 4] are a"] - #[doc = " gradient mask, and [3, 0] are a border mask:"] - #[doc = " * 7, 3: top"] - #[doc = " * 6, 2: right"] - #[doc = " * 5, 1: bottom"] - #[doc = " * 4, 0: left"] - #[doc = " If the gradient bit is not set, the styling from the hl/vl cells is used for"] - #[doc = " the horizontal and vertical lines, respectively. If the gradient bit is set,"] - #[doc = " the color is linearly interpolated between the two relevant corner cells."] - #[doc = ""] - #[doc = " By default, vertexes are drawn whether their connecting edges are drawn or"] - #[doc = " not. The value of the bits corresponding to NCBOXCORNER_MASK control this,"] - #[doc = " and are interpreted as the number of connecting edges necessary to draw a"] - #[doc = " given corner. At 0 (the default), corners are always drawn. At 3, corners"] - #[doc = " are never drawn (since at most 2 edges can touch a box's corner)."] - pub fn ncplane_box( - n: *mut ncplane, - ul: *const nccell, - ur: *const nccell, - ll: *const nccell, - lr: *const nccell, - hline: *const nccell, - vline: *const nccell, - ystop: cty::c_int, - xstop: cty::c_int, - ctlword: cty::c_uint, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Starting at the specified coordinate, if its glyph is different from that of"] - #[doc = " 'c', 'c' is copied into it, and the original glyph is considered the fill"] - #[doc = " target. We do the same to all cardinally-connected cells having this same"] - #[doc = " fill target. Returns the number of cells polyfilled. An invalid initial y, x"] - #[doc = " is an error. Returns the number of cells filled, or -1 on error."] - pub fn ncplane_polyfill_yx( - n: *mut ncplane, - y: cty::c_int, - x: cty::c_int, - c: *const nccell, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Draw a gradient with its upper-left corner at the current cursor position,"] - #[doc = " stopping at 'ystop'x'xstop'. The glyph composed of 'egc' and 'stylemask' is"] - #[doc = " used for all cells. The channels specified by 'ul', 'ur', 'll', and 'lr'"] - #[doc = " are composed into foreground and background gradients. To do a vertical"] - #[doc = " gradient, 'ul' ought equal 'ur' and 'll' ought equal 'lr'. To do a"] - #[doc = " horizontal gradient, 'ul' ought equal 'll' and 'ur' ought equal 'ul'. To"] - #[doc = " color everything the same, all four channels should be equivalent. The"] - #[doc = " resulting alpha values are equal to incoming alpha values. Returns the"] - #[doc = " number of cells filled on success, or -1 on failure."] - #[doc = ""] - #[doc = " Palette-indexed color is not supported."] - #[doc = ""] - #[doc = " Preconditions for gradient operations (error otherwise):"] - #[doc = ""] - #[doc = " all: only RGB colors, unless all four channels match as default"] - #[doc = " all: all alpha values must be the same"] - #[doc = " 1x1: all four colors must be the same"] - #[doc = " 1xN: both top and both bottom colors must be the same (vertical gradient)"] - #[doc = " Nx1: both left and both right colors must be the same (horizontal gradient)"] - pub fn ncplane_gradient( - n: *mut ncplane, - egc: *const cty::c_char, - stylemask: u32, - ul: u64, - ur: u64, - ll: u64, - lr: u64, - ystop: cty::c_int, - xstop: cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Do a high-resolution gradient using upper blocks and synced backgrounds."] - #[doc = " This doubles the number of vertical gradations, but restricts you to"] - #[doc = " half blocks (appearing to be full blocks). Returns the number of cells"] - #[doc = " filled on success, or -1 on error."] - pub fn ncplane_highgradient( - n: *mut ncplane, - ul: u32, - ur: u32, - ll: u32, - lr: u32, - ystop: cty::c_int, - xstop: cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " ncplane_gradent_sized() meets ncplane_highgradient()."] - pub fn ncplane_highgradient_sized( - n: *mut ncplane, - ul: u32, - ur: u32, - ll: u32, - lr: u32, - ylen: cty::c_int, - xlen: cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Set the given style throughout the specified region, keeping content and"] - #[doc = " channels unchanged. Returns the number of cells set, or -1 on failure."] - pub fn ncplane_format( - n: *mut ncplane, - ystop: cty::c_int, - xstop: cty::c_int, - stylemask: u32, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Set the given channels throughout the specified region, keeping content and"] - #[doc = " attributes unchanged. Returns the number of cells set, or -1 on failure."] - pub fn ncplane_stain( - n: *mut ncplane, - ystop: cty::c_int, - xstop: cty::c_int, - ul: u64, - ur: u64, - ll: u64, - lr: u64, - ) -> cty::c_int; -} -extern "C" { - #[doc = " If 'src' does not intersect with 'dst', 'dst' will not be changed, but it is"] - #[doc = " not an error. If 'dst' is NULL, the operation will target the standard plane."] - pub fn ncplane_mergedown_simple(src: *const ncplane, dst: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Merge the ncplane 'src' down onto the ncplane 'dst'. This is most rigorously"] - #[doc = " defined as \"write to 'dst' the frame that would be rendered were the entire"] - #[doc = " stack made up only of the specified subregion of 'src' and, below it, the"] - #[doc = " subregion of 'dst' having the specified origin. Merging is independent of"] - #[doc = " the position of 'src' viz 'dst' on the z-axis. It is an error to define a"] - #[doc = " subregion of zero area, or that is not entirely contained within 'src'. It"] - #[doc = " is an error to define a target origin such that the projected subregion is"] - #[doc = " not entirely contained within 'dst'. Behavior is undefined if 'src' and"] - #[doc = " 'dst' are equivalent. 'dst' is modified, but 'src' remains unchanged."] - pub fn ncplane_mergedown( - src: *const ncplane, - dst: *mut ncplane, - begsrcy: cty::c_int, - begsrcx: cty::c_int, - leny: cty::c_int, - lenx: cty::c_int, - dsty: cty::c_int, - dstx: cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Erase every cell in the ncplane (each cell is initialized to the null glyph"] - #[doc = " and the default channels/styles). All cells associated with this ncplane are"] - #[doc = " invalidated, and must not be used after the call, *excluding* the base cell."] - #[doc = " The cursor is homed. The plane's active attributes are unaffected."] - pub fn ncplane_erase(n: *mut ncplane); -} -extern "C" { - pub fn ncplane_set_channels(n: *mut ncplane, channels: u64); -} -extern "C" { - #[doc = " Set the specified style bits for the ncplane 'n', whether they're actively"] - #[doc = " supported or not."] - pub fn ncplane_set_styles(n: *mut ncplane, stylebits: cty::c_uint); -} -extern "C" { - #[doc = " Add the specified styles to the ncplane's existing spec."] - pub fn ncplane_on_styles(n: *mut ncplane, stylebits: cty::c_uint); -} -extern "C" { - #[doc = " Remove the specified styles from the ncplane's existing spec."] - pub fn ncplane_off_styles(n: *mut ncplane, stylebits: cty::c_uint); -} -extern "C" { - #[doc = " Deprecated forms of above."] - pub fn ncplane_styles_set(n: *mut ncplane, stylebits: cty::c_uint); -} -extern "C" { - pub fn ncplane_styles_on(n: *mut ncplane, stylebits: cty::c_uint); -} -extern "C" { - pub fn ncplane_styles_off(n: *mut ncplane, stylebits: cty::c_uint); -} -extern "C" { - #[doc = " Set an entire 32-bit channel of the plane"] - pub fn ncplane_set_fchannel(n: *mut ncplane, channel: u32) -> u64; -} -extern "C" { - pub fn ncplane_set_bchannel(n: *mut ncplane, channel: u32) -> u64; -} -extern "C" { - #[doc = " Set the current fore/background color using RGB specifications. If the"] - #[doc = " terminal does not support directly-specified 3x8b cells (24-bit \"TrueColor\","] - #[doc = " indicated by the \"RGB\" terminfo capability), the provided values will be"] - #[doc = " interpreted in some lossy fashion. None of r, g, or b may exceed 255."] - #[doc = " \"HP-like\" terminals require setting foreground and background at the same"] - #[doc = " time using \"color pairs\"; Notcurses will manage color pairs transparently."] - pub fn ncplane_set_fg_rgb8( - n: *mut ncplane, - r: cty::c_int, - g: cty::c_int, - b: cty::c_int, - ) -> cty::c_int; -} -extern "C" { - pub fn ncplane_set_bg_rgb8( - n: *mut ncplane, - r: cty::c_int, - g: cty::c_int, - b: cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Same, but clipped to [0..255]."] - pub fn ncplane_set_bg_rgb8_clipped( - n: *mut ncplane, - r: cty::c_int, - g: cty::c_int, - b: cty::c_int, - ); -} -extern "C" { - pub fn ncplane_set_fg_rgb8_clipped( - n: *mut ncplane, - r: cty::c_int, - g: cty::c_int, - b: cty::c_int, - ); -} -extern "C" { - #[doc = " Same, but with rgb assembled into a channel (i.e. lower 24 bits)."] - pub fn ncplane_set_fg_rgb(n: *mut ncplane, channel: u32) -> cty::c_int; -} -extern "C" { - pub fn ncplane_set_bg_rgb(n: *mut ncplane, channel: u32) -> cty::c_int; -} -extern "C" { - #[doc = " Use the default color for the foreground/background."] - pub fn ncplane_set_fg_default(n: *mut ncplane); -} -extern "C" { - pub fn ncplane_set_bg_default(n: *mut ncplane); -} -extern "C" { - #[doc = " Set the ncplane's foreground palette index, set the foreground palette index"] - #[doc = " bit, set it foreground-opaque, and clear the foreground default color bit."] - pub fn ncplane_set_fg_palindex(n: *mut ncplane, idx: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn ncplane_set_bg_palindex(n: *mut ncplane, idx: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Set the alpha parameters for ncplane 'n'."] - pub fn ncplane_set_fg_alpha(n: *mut ncplane, alpha: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn ncplane_set_bg_alpha(n: *mut ncplane, alpha: cty::c_int) -> cty::c_int; -} -#[doc = " Called for each fade iteration on 'ncp'. If anything but 0 is returned,"] -#[doc = " the fading operation ceases immediately, and that value is propagated out."] -#[doc = " The recommended absolute display time target is passed in 'tspec'."] -pub type fadecb = ::core::option::Option< - unsafe extern "C" fn( - nc: *mut notcurses, - n: *mut ncplane, - arg1: *const timespec, - curry: *mut cty::c_void, - ) -> cty::c_int, ->; -extern "C" { - #[doc = " Fade the ncplane out over the provided time, calling 'fader' at each"] - #[doc = " iteration. Requires a terminal which supports truecolor, or at least palette"] - #[doc = " modification (if the terminal uses a palette, our ability to fade planes is"] - #[doc = " limited, and affected by the complexity of the rest of the screen)."] - pub fn ncplane_fadeout( - n: *mut ncplane, - ts: *const timespec, - fader: fadecb, - curry: *mut cty::c_void, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Fade the ncplane in over the specified time. Load the ncplane with the"] - #[doc = " target cells without rendering, then call this function. When it's done, the"] - #[doc = " ncplane will have reached the target levels, starting from zeroes."] - pub fn ncplane_fadein( - n: *mut ncplane, - ts: *const timespec, - fader: fadecb, - curry: *mut cty::c_void, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Rather than the simple ncplane_fade{in/out}(), ncfadectx_setup() can be"] - #[doc = " paired with a loop over ncplane_fade{in/out}_iteration() + ncfadectx_free()."] - pub fn ncfadectx_setup(n: *mut ncplane) -> *mut ncfadectx; -} -extern "C" { - #[doc = " Return the number of iterations through which 'nctx' will fade."] - pub fn ncfadectx_iterations(nctx: *const ncfadectx) -> cty::c_int; -} -extern "C" { - #[doc = " Fade out through 'iter' iterations, where"] - #[doc = " 'iter' < 'ncfadectx_iterations(nctx)'."] - pub fn ncplane_fadeout_iteration( - n: *mut ncplane, - nctx: *mut ncfadectx, - iter: cty::c_int, - fader: fadecb, - curry: *mut cty::c_void, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Fade in through 'iter' iterations, where"] - #[doc = " 'iter' < 'ncfadectx_iterations(nctx)'."] - pub fn ncplane_fadein_iteration( - n: *mut ncplane, - nctx: *mut ncfadectx, - iter: cty::c_int, - fader: fadecb, - curry: *mut cty::c_void, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Pulse the plane in and out until the callback returns non-zero, relying on"] - #[doc = " the callback 'fader' to initiate rendering. 'ts' defines the half-period"] - #[doc = " (i.e. the transition from black to full brightness, or back again). Proper"] - #[doc = " use involves preparing (but not rendering) an ncplane, then calling"] - #[doc = " ncplane_pulse(), which will fade in from black to the specified colors."] - pub fn ncplane_pulse( - n: *mut ncplane, - ts: *const timespec, - fader: fadecb, - curry: *mut cty::c_void, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Release the resources associated with 'nctx'."] - pub fn ncfadectx_free(nctx: *mut ncfadectx); -} -extern "C" { - pub fn nccells_rounded_box( - n: *mut ncplane, - styles: u32, - channels: u64, - ul: *mut nccell, - ur: *mut nccell, - ll: *mut nccell, - lr: *mut nccell, - hl: *mut nccell, - vl: *mut nccell, - ) -> cty::c_int; -} -extern "C" { - pub fn cells_rounded_box( - n: *mut ncplane, - styles: u32, - channels: u64, - ul: *mut nccell, - ur: *mut nccell, - ll: *mut nccell, - lr: *mut nccell, - hl: *mut nccell, - vl: *mut nccell, - ) -> cty::c_int; -} -extern "C" { - pub fn nccells_double_box( - n: *mut ncplane, - styles: u32, - channels: u64, - ul: *mut nccell, - ur: *mut nccell, - ll: *mut nccell, - lr: *mut nccell, - hl: *mut nccell, - vl: *mut nccell, - ) -> cty::c_int; -} -extern "C" { - pub fn cells_double_box( - n: *mut ncplane, - styles: u32, - channels: u64, - ul: *mut nccell, - ur: *mut nccell, - ll: *mut nccell, - lr: *mut nccell, - hl: *mut nccell, - vl: *mut nccell, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Open a visual at 'file', extract a codec and parameters, decode the first"] - #[doc = " image to memory."] - pub fn ncvisual_from_file(file: *const cty::c_char) -> *mut ncvisual; -} -extern "C" { - #[doc = " Prepare an ncvisual, and its underlying plane, based off RGBA content in"] - #[doc = " memory at 'rgba'. 'rgba' is laid out as 'rows' lines, each of which is"] - #[doc = " 'rowstride' bytes in length. Each line has 'cols' 32-bit 8bpc RGBA pixels"] - #[doc = " followed by possible padding (there will be 'rowstride' - 'cols' * 4 bytes"] - #[doc = " of padding). The total size of 'rgba' is thus (rows * rowstride) bytes, of"] - #[doc = " which (rows * cols * 4) bytes are actual non-padding data."] - pub fn ncvisual_from_rgba( - rgba: *const cty::c_void, - rows: cty::c_int, - rowstride: cty::c_int, - cols: cty::c_int, - ) -> *mut ncvisual; -} -extern "C" { - #[doc = " ncvisual_from_rgba(), but 'bgra' is arranged as BGRA."] - pub fn ncvisual_from_bgra( - bgra: *const cty::c_void, - rows: cty::c_int, - rowstride: cty::c_int, - cols: cty::c_int, - ) -> *mut ncvisual; -} -extern "C" { - #[doc = " Promote an ncplane 'n' to an ncvisual. The plane may contain only spaces,"] - #[doc = " half blocks, and full blocks. The latter will be checked, and any other"] - #[doc = " glyph will result in a NULL being returned. This function exists so that"] - #[doc = " planes can be subjected to ncvisual transformations. If possible, it's"] - #[doc = " better to create the ncvisual from memory using ncvisual_from_rgba()."] - pub fn ncvisual_from_plane( - n: *const ncplane, - blit: ncblitter_e, - begy: cty::c_int, - begx: cty::c_int, - leny: cty::c_int, - lenx: cty::c_int, - ) -> *mut ncvisual; -} -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncvisual_options { - #[doc = " if no ncplane is provided, one will be created using the exact size"] - #[doc = " necessary to render the source with perfect fidelity (this might be"] - #[doc = " smaller or larger than the rendering area)."] - pub n: *mut ncplane, - #[doc = " the scaling is ignored if no ncplane is provided (it ought be NCSCALE_NONE"] - #[doc = " in this case). otherwise, the source is stretched/scaled relative to the"] - #[doc = " provided ncplane."] - pub scaling: ncscale_e, - #[doc = " if an ncplane is provided, y and x specify where the visual will be"] - #[doc = " rendered on that plane. otherwise, they specify where the created ncplane"] - #[doc = " will be placed relative to the standard plane's origin. x is an ncalign_e"] - #[doc = " value if NCVISUAL_OPTION_HORALIGNED is provided. y is an ncalign_e if"] - #[doc = " NCVISUAL_OPTION_VERALIGNED is provided."] - pub y: cty::c_int, - #[doc = " if an ncplane is provided, y and x specify where the visual will be"] - #[doc = " rendered on that plane. otherwise, they specify where the created ncplane"] - #[doc = " will be placed relative to the standard plane's origin. x is an ncalign_e"] - #[doc = " value if NCVISUAL_OPTION_HORALIGNED is provided. y is an ncalign_e if"] - #[doc = " NCVISUAL_OPTION_VERALIGNED is provided."] - pub x: cty::c_int, - #[doc = " origin of rendered section"] - pub begy: cty::c_int, - #[doc = " origin of rendered section"] - pub begx: cty::c_int, - #[doc = " size of rendered section"] - pub leny: cty::c_int, - #[doc = " size of rendered section"] - pub lenx: cty::c_int, - #[doc = " glyph set to use (maps input to output cells)"] - pub blitter: ncblitter_e, - #[doc = " bitmask over NCVISUAL_OPTION_*"] - pub flags: u64, - #[doc = " treat this color as transparent under NCVISUAL_OPTION_ADDALPHA"] - pub transcolor: u32, -} -#[test] -fn bindgen_test_layout_ncvisual_options() { - assert_eq!( - ::core::mem::size_of::(), - 56usize, - concat!("Size of: ", stringify!(ncvisual_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncvisual_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).n as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(n) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).scaling as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(scaling) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).y as *const _ as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(y) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).x as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(x) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).begy as *const _ as usize }, - 20usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(begy) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).begx as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(begx) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).leny as *const _ as usize }, - 28usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(leny) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).lenx as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(lenx) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).blitter as *const _ as usize }, - 36usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(blitter) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(flags) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).transcolor as *const _ as usize }, - 48usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(transcolor) - ) - ); -} -impl Default for ncvisual_options { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -extern "C" { - #[doc = " Create an RGBA flat array from the selected region of the ncplane 'nc'."] - #[doc = " Start at the plane's 'begy'x'begx' coordinate (which must lie on the"] - #[doc = " plane), continuing for 'leny'x'lenx' cells. Either or both of 'leny' and"] - #[doc = " 'lenx' can be specified as -1 to go through the boundary of the plane."] - #[doc = " Only glyphs from the specified ncblitset may be present. If 'pxdimy' and/or"] - #[doc = " 'pxdimx' are non-NULL, they will be filled in with the pixel geometry."] - pub fn ncplane_as_rgba( - n: *const ncplane, - blit: ncblitter_e, - begy: cty::c_int, - begx: cty::c_int, - leny: cty::c_int, - lenx: cty::c_int, - pxdimy: *mut cty::c_int, - pxdimx: *mut cty::c_int, - ) -> *mut u32; -} -extern "C" { - #[doc = " Get the size and ratio of ncvisual pixels to output cells along the y"] - #[doc = " ('toy') and x ('tox') axes. A ncvisual of '*y'X'*x' pixels will require"] - #[doc = " ('*y' * '*toy')X('*x' * '*tox') cells for full output. Returns non-zero"] - #[doc = " for an invalid 'vopts->blitter'. Scaling is taken into consideration."] - #[doc = " The blitter that will be used is returned in '*blitter'."] - pub fn ncvisual_blitter_geom( - nc: *const notcurses, - n: *const ncvisual, - vopts: *const ncvisual_options, - y: *mut cty::c_int, - x: *mut cty::c_int, - toy: *mut cty::c_int, - tox: *mut cty::c_int, - blitter: *mut ncblitter_e, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Destroy an ncvisual. Rendered elements will not be disrupted, but the visual"] - #[doc = " can be neither decoded nor rendered any further."] - pub fn ncvisual_destroy(ncv: *mut ncvisual); -} -extern "C" { - #[doc = " extract the next frame from an ncvisual. returns 1 on end of file, 0 on"] - #[doc = " success, and -1 on failure."] - pub fn ncvisual_decode(nc: *mut ncvisual) -> cty::c_int; -} -extern "C" { - #[doc = " decode the next frame ala ncvisual_decode(), but if we have reached the end,"] - #[doc = " rewind to the first frame of the ncvisual. a subsequent 'ncvisual_render()'"] - #[doc = " will render the first frame, as if the ncvisual had been closed and reopened."] - #[doc = " the return values remain the same as those of ncvisual_decode()."] - pub fn ncvisual_decode_loop(nc: *mut ncvisual) -> cty::c_int; -} -extern "C" { - #[doc = " Rotate the visual 'rads' radians. Only M_PI/2 and -M_PI/2 are"] - #[doc = " supported at the moment, but this will change FIXME."] - pub fn ncvisual_rotate(n: *mut ncvisual, rads: f64) -> cty::c_int; -} -extern "C" { - #[doc = " Resize the visual so that it is 'rows' X 'columns'. This is a lossy"] - #[doc = " transformation, unless the size is unchanged."] - pub fn ncvisual_resize(n: *mut ncvisual, rows: cty::c_int, cols: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Polyfill at the specified location within the ncvisual 'n', using 'rgba'."] - pub fn ncvisual_polyfill_yx( - n: *mut ncvisual, - y: cty::c_int, - x: cty::c_int, - rgba: u32, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Get the specified pixel from the specified ncvisual."] - pub fn ncvisual_at_yx( - n: *const ncvisual, - y: cty::c_int, - x: cty::c_int, - pixel: *mut u32, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Set the specified pixel in the specified ncvisual."] - pub fn ncvisual_set_yx( - n: *const ncvisual, - y: cty::c_int, - x: cty::c_int, - pixel: u32, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Render the decoded frame to the specified ncplane. If one is not provided,"] - #[doc = " one will be created, having the exact size necessary to display the visual."] - #[doc = " A subregion of the visual can be rendered using 'begx', 'begy', 'lenx', and"] - #[doc = " 'leny'. Negative values for 'begy' or 'begx' are an error. It is an error to"] - #[doc = " specify any region beyond the boundaries of the frame. Returns the"] - #[doc = " (possibly newly-created) plane to which we drew."] - pub fn ncvisual_render( - nc: *mut notcurses, - ncv: *mut ncvisual, - vopts: *const ncvisual_options, - ) -> *mut ncplane; -} -extern "C" { - #[doc = " If a subtitle ought be displayed at this time, return a heap-allocated copy"] - #[doc = " of the UTF8 text."] - pub fn ncvisual_subtitle(ncv: *const ncvisual) -> *mut cty::c_char; -} -#[doc = " Called for each frame rendered from 'ncv'. If anything but 0 is returned,"] -#[doc = " the streaming operation ceases immediately, and that value is propagated out."] -#[doc = " The recommended absolute display time target is passed in 'tspec'."] -pub type ncstreamcb = ::core::option::Option< - unsafe extern "C" fn( - arg1: *mut ncvisual, - arg2: *mut ncvisual_options, - arg3: *const timespec, - arg4: *mut cty::c_void, - ) -> cty::c_int, ->; -extern "C" { - #[doc = " Shut up and display my frames! Provide as an argument to ncvisual_stream()."] - #[doc = " If you'd like subtitles to be decoded, provide an ncplane as the curry. If the"] - #[doc = " curry is NULL, subtitles will not be displayed."] - pub fn ncvisual_simple_streamer( - ncv: *mut ncvisual, - vopts: *mut ncvisual_options, - tspec: *const timespec, - curry: *mut cty::c_void, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Stream the entirety of the media, according to its own timing. Blocking,"] - #[doc = " obviously. streamer may be NULL; it is otherwise called for each frame, and"] - #[doc = " its return value handled as outlined for streamcb. If streamer() returns"] - #[doc = " non-zero, the stream is aborted, and that value is returned. By convention,"] - #[doc = " return a positive number to indicate intentional abort from within"] - #[doc = " streamer(). 'timescale' allows the frame duration time to be scaled. For a"] - #[doc = " visual naturally running at 30FPS, a 'timescale' of 0.1 will result in"] - #[doc = " 300FPS, and a 'timescale' of 10 will result in 3FPS. It is an error to"] - #[doc = " supply 'timescale' less than or equal to 0."] - pub fn ncvisual_stream( - nc: *mut notcurses, - ncv: *mut ncvisual, - timescale: f32, - streamer: ncstreamcb, - vopts: *const ncvisual_options, - curry: *mut cty::c_void, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Blit a flat array 'data' of RGBA 32-bit values to the ncplane 'vopts->n',"] - #[doc = " which mustn't be NULL. the blit begins at 'vopts->y' and 'vopts->x' relative"] - #[doc = " to the specified plane. Each source row ought occupy 'linesize' bytes (this"] - #[doc = " might be greater than 'vopts->lenx' * 4 due to padding or partial blits). A"] - #[doc = " subregion of the input can be specified with the 'begy'x'begx' and"] - #[doc = " 'leny'x'lenx' fields from 'vopts'. Returns the number of pixels blitted, or"] - #[doc = " -1 on error."] - pub fn ncblit_rgba( - data: *const cty::c_void, - linesize: cty::c_int, - vopts: *const ncvisual_options, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Same as ncblit_rgba(), but for BGRx."] - pub fn ncblit_bgrx( - data: *const cty::c_void, - linesize: cty::c_int, - vopts: *const ncvisual_options, - ) -> cty::c_int; -} -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncreel_options { - #[doc = " bitfield; 1s will not be drawn (see bordermaskbits)"] - pub bordermask: cty::c_uint, - #[doc = " attributes used for ncreel border"] - pub borderchan: u64, - #[doc = " bitfield; same as bordermask but for tablet borders"] - pub tabletmask: cty::c_uint, - #[doc = " tablet border styling channel"] - pub tabletchan: u64, - #[doc = " focused tablet border styling channel"] - pub focusedchan: u64, - #[doc = " bitfield over NCREEL_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncreel_options() { - assert_eq!( - ::core::mem::size_of::(), - 48usize, - concat!("Size of: ", stringify!(ncreel_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncreel_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).bordermask as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncreel_options), - "::", - stringify!(bordermask) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).borderchan as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncreel_options), - "::", - stringify!(borderchan) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).tabletmask as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncreel_options), - "::", - stringify!(tabletmask) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).tabletchan as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncreel_options), - "::", - stringify!(tabletchan) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).focusedchan as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncreel_options), - "::", - stringify!(focusedchan) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(ncreel_options), - "::", - stringify!(flags) - ) - ); -} -extern "C" { - #[doc = " Take over the ncplane 'nc' and use it to draw a reel according to 'popts'."] - #[doc = " The plane will be destroyed by ncreel_destroy(); this transfers ownership."] - pub fn ncreel_create(n: *mut ncplane, popts: *const ncreel_options) -> *mut ncreel; -} -extern "C" { - #[doc = " Returns the ncplane on which this ncreel lives."] - pub fn ncreel_plane(nr: *mut ncreel) -> *mut ncplane; -} -#[doc = " Tablet draw callback, provided a tablet (from which the ncplane and userptr"] -#[doc = " may be extracted), and a bool indicating whether output ought be drawn from"] -#[doc = " the top (true) or bottom (false). Returns non-negative count of output lines,"] -#[doc = " which must be less than or equal to ncplane_dim_y(nctablet_plane(t))."] -pub type tabletcb = - ::core::option::Option cty::c_int>; -extern "C" { - #[doc = " Add a new nctablet to the provided ncreel 'nr', having the callback object"] - #[doc = " 'opaque'. Neither, either, or both of 'after' and 'before' may be specified."] - #[doc = " If neither is specified, the new tablet can be added anywhere on the reel."] - #[doc = " If one or the other is specified, the tablet will be added before or after"] - #[doc = " the specified tablet. If both are specified, the tablet will be added to the"] - #[doc = " resulting location, assuming it is valid (after->next == before->prev); if"] - #[doc = " it is not valid, or there is any other error, NULL will be returned."] - pub fn ncreel_add( - nr: *mut ncreel, - after: *mut nctablet, - before: *mut nctablet, - cb: tabletcb, - opaque: *mut cty::c_void, - ) -> *mut nctablet; -} -extern "C" { - #[doc = " Return the number of nctablets in the ncreel 'nr'."] - pub fn ncreel_tabletcount(nr: *const ncreel) -> cty::c_int; -} -extern "C" { - #[doc = " Delete the tablet specified by t from the ncreel 'nr'. Returns -1 if the"] - #[doc = " tablet cannot be found."] - pub fn ncreel_del(nr: *mut ncreel, t: *mut nctablet) -> cty::c_int; -} -extern "C" { - #[doc = " Redraw the ncreel 'nr' in its entirety. The reel will be cleared, and"] - #[doc = " tablets will be lain out, using the focused tablet as a fulcrum. Tablet"] - #[doc = " drawing callbacks will be invoked for each visible tablet."] - pub fn ncreel_redraw(nr: *mut ncreel) -> cty::c_int; -} -extern "C" { - #[doc = " Offer input 'ni' to the ncreel 'nr'. If it's relevant, this function returns"] - #[doc = " true, and the input ought not be processed further. If it's irrelevant to"] - #[doc = " the reel, false is returned. Relevant inputs include:"] - #[doc = " * a mouse click on a tablet (focuses tablet)"] - #[doc = " * a mouse scrollwheel event (rolls reel)"] - #[doc = " * up, down, pgup, or pgdown (navigates among items)"] - pub fn ncreel_offer_input(nr: *mut ncreel, ni: *const ncinput) -> bool; -} -extern "C" { - #[doc = " Return the focused tablet, if any tablets are present. This is not a copy;"] - #[doc = " be careful to use it only for the duration of a critical section."] - pub fn ncreel_focused(nr: *mut ncreel) -> *mut nctablet; -} -extern "C" { - #[doc = " Change focus to the next tablet, if one exists"] - pub fn ncreel_next(nr: *mut ncreel) -> *mut nctablet; -} -extern "C" { - #[doc = " Change focus to the previous tablet, if one exists"] - pub fn ncreel_prev(nr: *mut ncreel) -> *mut nctablet; -} -extern "C" { - #[doc = " Destroy an ncreel allocated with ncreel_create()."] - pub fn ncreel_destroy(nr: *mut ncreel); -} -extern "C" { - #[doc = " Returns a pointer to a user pointer associated with this nctablet."] - pub fn nctablet_userptr(t: *mut nctablet) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Access the ncplane associated with nctablet 't', if one exists."] - pub fn nctablet_plane(t: *mut nctablet) -> *mut ncplane; -} -extern "C" { - #[doc = " Deprecated form of nctablet_plane()."] - pub fn nctablet_ncplane(t: *mut nctablet) -> *mut ncplane; -} -extern "C" { - #[doc = " Takes an arbitrarily large number, and prints it into a fixed-size buffer by"] - #[doc = " adding the necessary SI suffix. Usually, pass a |[IB]PREFIXSTRLEN+1|-sized"] - #[doc = " buffer to generate up to |[IB]PREFIXCOLUMNS| columns' worth of EGCs. The"] - #[doc = " characteristic can occupy up through |mult-1| characters (3 for 1000, 4 for"] - #[doc = " 1024). The mantissa can occupy either zero or two characters."] - #[doc = ""] - #[doc = " Floating-point is never used, because an IEEE758 double can only losslessly"] - #[doc = " represent integers through 2^53-1."] - #[doc = ""] - #[doc = " 2^64-1 is 18446744073709551615, 18.45E(xa). KMGTPEZY thus suffice to handle"] - #[doc = " an 89-bit uintmax_t. Beyond Z(etta) and Y(otta) lie lands unspecified by SI."] - #[doc = " 2^-63 is 0.000000000000000000108, 1.08a(tto)."] - #[doc = " val: value to print"] - #[doc = " decimal: scaling. '1' if none has taken place."] - #[doc = " buf: buffer in which string will be generated"] - #[doc = " omitdec: inhibit printing of all-0 decimal portions"] - #[doc = " mult: base of suffix system (almost always 1000 or 1024)"] - #[doc = " uprefix: character to print following suffix ('i' for kibibytes basically)."] - #[doc = " only printed if suffix is actually printed (input >= mult)."] - #[doc = ""] - #[doc = " You are encouraged to consult notcurses_metric(3)."] - pub fn ncmetric( - val: uintmax_t, - decimal: uintmax_t, - buf: *mut cty::c_char, - omitdec: cty::c_int, - mult: uintmax_t, - uprefix: cty::c_int, - ) -> *const cty::c_char; -} -extern "C" { - #[doc = " Enable or disable the terminal's cursor, if supported, placing it at"] - #[doc = " 'y', 'x'. Immediate effect (no need for a call to notcurses_render())."] - #[doc = " It is an error if 'y', 'x' lies outside the standard plane."] - pub fn notcurses_cursor_enable(nc: *mut notcurses, y: cty::c_int, x: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn notcurses_cursor_disable(nc: *mut notcurses) -> cty::c_int; -} -#[doc = " Palette API. Some terminals only support 256 colors, but allow the full"] -#[doc = " palette to be specified with arbitrary RGB colors. In all cases, it's more"] -#[doc = " performant to use indexed colors, since it's much less data to write to the"] -#[doc = " terminal. If you can limit yourself to 256 colors, that's probably best."] -#[repr(C)] -#[derive(Copy, Clone)] -pub struct palette256 { - #[doc = " RGB values as regular ol' channels"] - pub chans: [u32; 256usize], -} -#[test] -fn bindgen_test_layout_palette256() { - assert_eq!( - ::core::mem::size_of::(), - 1024usize, - concat!("Size of: ", stringify!(palette256)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(palette256)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).chans as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(palette256), - "::", - stringify!(chans) - ) - ); -} -impl Default for palette256 { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -extern "C" { - #[doc = " Create a new palette store. It will be initialized with notcurses' best"] - #[doc = " knowledge of the currently configured palette. The palette upon startup"] - #[doc = " cannot be reliably detected, sadly."] - pub fn palette256_new(nc: *mut notcurses) -> *mut palette256; -} -extern "C" { - #[doc = " Attempt to configure the terminal with the provided palette 'p'. Does not"] - #[doc = " transfer ownership of 'p'; palette256_free() can (ought) still be called."] - pub fn palette256_use(nc: *mut notcurses, p: *const palette256) -> cty::c_int; -} -extern "C" { - #[doc = " Free the palette store 'p'."] - pub fn palette256_free(p: *mut palette256); -} -extern "C" { - #[doc = " Convert the plane's content to greyscale."] - pub fn ncplane_greyscale(n: *mut ncplane); -} -#[doc = " selection widget -- an ncplane with a title header and a body section. the"] -#[doc = " body section supports infinite scrolling up and down."] -#[doc = ""] -#[doc = " At all times, exactly one item is selected."] -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncselector_item { - pub option: *mut cty::c_char, - pub desc: *mut cty::c_char, - #[doc = " filled in by library"] - pub opcolumns: size_t, - #[doc = " filled in by library"] - pub desccolumns: size_t, -} -#[test] -fn bindgen_test_layout_ncselector_item() { - assert_eq!( - ::core::mem::size_of::(), - 32usize, - concat!("Size of: ", stringify!(ncselector_item)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncselector_item)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).option as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncselector_item), - "::", - stringify!(option) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).desc as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncselector_item), - "::", - stringify!(desc) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).opcolumns as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncselector_item), - "::", - stringify!(opcolumns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).desccolumns as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncselector_item), - "::", - stringify!(desccolumns) - ) - ); -} -impl Default for ncselector_item { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncselector_options { - #[doc = " title may be NULL, inhibiting riser, saving two rows."] - pub title: *mut cty::c_char, - #[doc = " secondary may be NULL"] - pub secondary: *mut cty::c_char, - #[doc = " footer may be NULL"] - pub footer: *mut cty::c_char, - #[doc = " initial items and descriptions"] - pub items: *mut ncselector_item, - #[doc = " default item (selected at start), must be < itemcount unless itemcount is"] - #[doc = " 0, in which case 'defidx' must also be 0"] - pub defidx: cty::c_uint, - #[doc = " maximum number of options to display at once, 0 to use all available space"] - pub maxdisplay: cty::c_uint, - #[doc = " option channels"] - pub opchannels: u64, - #[doc = " description channels"] - pub descchannels: u64, - #[doc = " title channels"] - pub titlechannels: u64, - #[doc = " secondary and footer channels"] - pub footchannels: u64, - #[doc = " border channels"] - pub boxchannels: u64, - #[doc = " bitfield of NCSELECTOR_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncselector_options() { - assert_eq!( - ::core::mem::size_of::(), - 88usize, - concat!("Size of: ", stringify!(ncselector_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncselector_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).title as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(title) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).secondary as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(secondary) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).footer as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(footer) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).items as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(items) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).defidx as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(defidx) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).maxdisplay as *const _ as usize }, - 36usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(maxdisplay) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).opchannels as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(opchannels) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).descchannels as *const _ as usize - }, - 48usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(descchannels) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).titlechannels as *const _ as usize - }, - 56usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(titlechannels) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).footchannels as *const _ as usize - }, - 64usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(footchannels) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).boxchannels as *const _ as usize }, - 72usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(boxchannels) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 80usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(flags) - ) - ); -} -impl Default for ncselector_options { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -extern "C" { - pub fn ncselector_create(n: *mut ncplane, opts: *const ncselector_options) -> *mut ncselector; -} -extern "C" { - #[doc = " Dynamically add or delete items. It is usually sufficient to supply a static"] - #[doc = " list of items via ncselector_options->items."] - pub fn ncselector_additem(n: *mut ncselector, item: *const ncselector_item) -> cty::c_int; -} -extern "C" { - pub fn ncselector_delitem(n: *mut ncselector, item: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Return reference to the selected option, or NULL if there are no items."] - pub fn ncselector_selected(n: *const ncselector) -> *const cty::c_char; -} -extern "C" { - #[doc = " Return a reference to the ncselector's underlying ncplane."] - pub fn ncselector_plane(n: *mut ncselector) -> *mut ncplane; -} -extern "C" { - #[doc = " Move up or down in the list. A reference to the newly-selected item is"] - #[doc = " returned, or NULL if there are no items in the list."] - pub fn ncselector_previtem(n: *mut ncselector) -> *const cty::c_char; -} -extern "C" { - pub fn ncselector_nextitem(n: *mut ncselector) -> *const cty::c_char; -} -extern "C" { - #[doc = " Offer the input to the ncselector. If it's relevant, this function returns"] - #[doc = " true, and the input ought not be processed further. If it's irrelevant to"] - #[doc = " the selector, false is returned. Relevant inputs include:"] - #[doc = " * a mouse click on an item"] - #[doc = " * a mouse scrollwheel event"] - #[doc = " * a mouse click on the scrolling arrows"] - #[doc = " * up, down, pgup, or pgdown on an unrolled menu (navigates among items)"] - pub fn ncselector_offer_input(n: *mut ncselector, nc: *const ncinput) -> bool; -} -extern "C" { - #[doc = " Destroy the ncselector. If 'item' is not NULL, the last selected option will"] - #[doc = " be strdup()ed and assigned to '*item' (and must be free()d by the caller)."] - pub fn ncselector_destroy(n: *mut ncselector, item: *mut *mut cty::c_char); -} -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncmselector_item { - pub option: *mut cty::c_char, - pub desc: *mut cty::c_char, - pub selected: bool, -} -#[test] -fn bindgen_test_layout_ncmselector_item() { - assert_eq!( - ::core::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(ncmselector_item)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncmselector_item)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).option as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncmselector_item), - "::", - stringify!(option) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).desc as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncmselector_item), - "::", - stringify!(desc) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).selected as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncmselector_item), - "::", - stringify!(selected) - ) - ); -} -impl Default for ncmselector_item { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[doc = " multiselection widget -- a selector supporting multiple selections."] -#[doc = ""] -#[doc = " Unlike the selector widget, zero to all of the items can be selected, but"] -#[doc = " also the widget does not support adding or removing items at runtime."] -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncmultiselector_options { - #[doc = " title may be NULL, inhibiting riser, saving two rows."] - pub title: *mut cty::c_char, - #[doc = " secondary may be NULL"] - pub secondary: *mut cty::c_char, - #[doc = " footer may be NULL"] - pub footer: *mut cty::c_char, - #[doc = " initial items, descriptions, and statuses"] - pub items: *mut ncmselector_item, - #[doc = " maximum number of options to display at once, 0 to use all available space"] - pub maxdisplay: cty::c_uint, - #[doc = " option channels"] - pub opchannels: u64, - #[doc = " description channels"] - pub descchannels: u64, - #[doc = " title channels"] - pub titlechannels: u64, - #[doc = " secondary and footer channels"] - pub footchannels: u64, - #[doc = " border channels"] - pub boxchannels: u64, - #[doc = " bitfield of NCMULTISELECTOR_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncmultiselector_options() { - assert_eq!( - ::core::mem::size_of::(), - 88usize, - concat!("Size of: ", stringify!(ncmultiselector_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncmultiselector_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).title as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(title) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).secondary as *const _ as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(secondary) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).footer as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(footer) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).items as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(items) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).maxdisplay as *const _ as usize - }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(maxdisplay) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).opchannels as *const _ as usize - }, - 40usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(opchannels) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).descchannels as *const _ as usize - }, - 48usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(descchannels) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).titlechannels as *const _ as usize - }, - 56usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(titlechannels) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).footchannels as *const _ as usize - }, - 64usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(footchannels) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).boxchannels as *const _ as usize - }, - 72usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(boxchannels) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 80usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(flags) - ) - ); -} -impl Default for ncmultiselector_options { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -extern "C" { - pub fn ncmultiselector_create( - n: *mut ncplane, - opts: *const ncmultiselector_options, - ) -> *mut ncmultiselector; -} -extern "C" { - #[doc = " Return selected vector. An array of bools must be provided, along with its"] - #[doc = " length. If that length doesn't match the itemcount, it is an error."] - pub fn ncmultiselector_selected( - n: *mut ncmultiselector, - selected: *mut bool, - count: cty::c_uint, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Return a reference to the ncmultiselector's underlying ncplane."] - pub fn ncmultiselector_plane(n: *mut ncmultiselector) -> *mut ncplane; -} -extern "C" { - #[doc = " Offer the input to the ncmultiselector. If it's relevant, this function"] - #[doc = " returns true, and the input ought not be processed further. If it's"] - #[doc = " irrelevant to the multiselector, false is returned. Relevant inputs include:"] - #[doc = " * a mouse click on an item"] - #[doc = " * a mouse scrollwheel event"] - #[doc = " * a mouse click on the scrolling arrows"] - #[doc = " * up, down, pgup, or pgdown on an unrolled menu (navigates among items)"] - pub fn ncmultiselector_offer_input(n: *mut ncmultiselector, nc: *const ncinput) -> bool; -} -extern "C" { - #[doc = " Destroy the ncmultiselector."] - pub fn ncmultiselector_destroy(n: *mut ncmultiselector); -} -#[doc = " each item has a curry, and zero or more subitems."] -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct nctree_item { - pub curry: *mut cty::c_void, - pub subs: *mut nctree_item, - pub subcount: cty::c_uint, -} -#[test] -fn bindgen_test_layout_nctree_item() { - assert_eq!( - ::core::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(nctree_item)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(nctree_item)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).curry as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(nctree_item), - "::", - stringify!(curry) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).subs as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(nctree_item), - "::", - stringify!(subs) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).subcount as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(nctree_item), - "::", - stringify!(subcount) - ) - ); -} -impl Default for nctree_item { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct nctree_options { - #[doc = " top-level nctree_item array"] - pub items: *const nctree_item, - #[doc = " size of |items|"] - pub count: cty::c_uint, - #[doc = " item callback function"] - pub nctreecb: ::core::option::Option< - unsafe extern "C" fn( - arg1: *mut ncplane, - arg2: *mut cty::c_void, - arg3: cty::c_int, - ) -> cty::c_int, - >, - #[doc = " columns to indent per level of hierarchy"] - pub indentcols: cty::c_int, - #[doc = " bitfield of NCTREE_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_nctree_options() { - assert_eq!( - ::core::mem::size_of::(), - 40usize, - concat!("Size of: ", stringify!(nctree_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(nctree_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).items as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(nctree_options), - "::", - stringify!(items) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).count as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(nctree_options), - "::", - stringify!(count) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).nctreecb as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(nctree_options), - "::", - stringify!(nctreecb) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).indentcols as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(nctree_options), - "::", - stringify!(indentcols) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(nctree_options), - "::", - stringify!(flags) - ) - ); -} -impl Default for nctree_options { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct nctree { - _unused: [u8; 0], -} -extern "C" { - #[doc = " |opts| may *not* be NULL, since it is necessary to define a callback"] - #[doc = " function."] - pub fn nctree_create(n: *mut ncplane, opts: *const nctree_options) -> *mut nctree; -} -extern "C" { - #[doc = " Returns the ncplane on which this nctree lives."] - pub fn nctree_plane(n: *mut nctree) -> *mut ncplane; -} -extern "C" { - #[doc = " Redraw the nctree 'n' in its entirety. The tree will be cleared, and items"] - #[doc = " will be lain out, using the focused item as a fulcrum. Item-drawing"] - #[doc = " callbacks will be invoked for each visible item."] - pub fn nctree_redraw(n: *mut nctree) -> cty::c_int; -} -extern "C" { - #[doc = " Offer input 'ni' to the nctree 'n'. If it's relevant, this function returns"] - #[doc = " true, and the input ought not be processed further. If it's irrelevant to"] - #[doc = " the tree, false is returned. Relevant inputs include:"] - #[doc = " * a mouse click on an item (focuses item)"] - #[doc = " * a mouse scrollwheel event (srolls tree)"] - #[doc = " * up, down, pgup, or pgdown (navigates among items)"] - pub fn nctree_offer_input(n: *mut nctree, ni: *const ncinput) -> bool; -} -extern "C" { - #[doc = " Return the focused item, if any items are present. This is not a copy;"] - #[doc = " be careful to use it only for the duration of a critical section."] - pub fn nctree_focused(n: *mut nctree) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Change focus to the next item."] - pub fn nctree_next(n: *mut nctree) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Change focus to the previous item."] - pub fn nctree_prev(n: *mut nctree) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Go to the item specified by the array |spec|, terminated by UINT_MAX. If"] - #[doc = " the spec is invalid, NULL is returned, and the depth of the first invalid"] - #[doc = " spec is written to *|failspec|. Otherwise, the true depth is written to"] - #[doc = " *|failspec|, and the curry is returned (|failspec| is necessary because the"] - #[doc = " curry could itself be NULL)."] - pub fn nctree_goto( - n: *mut nctree, - spec: *const cty::c_uint, - failspec: *mut cty::c_int, - ) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Destroy the nctree."] - pub fn nctree_destroy(n: *mut nctree); -} -#[doc = " Menus. Horizontal menu bars are supported, on the top and/or bottom rows."] -#[doc = " If the menu bar is longer than the screen, it will be only partially"] -#[doc = " visible. Menus may be either visible or invisible by default. In the event of"] -#[doc = " a screen resize, menus will be automatically moved/resized. Elements can be"] -#[doc = " dynamically enabled or disabled at all levels (menu, section, and item),"] -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncmenu_item { - #[doc = " utf-8 menu item, NULL for horizontal separator"] - pub desc: *mut cty::c_char, - #[doc = " shortcut, all should be distinct"] - pub shortcut: ncinput, -} -#[test] -fn bindgen_test_layout_ncmenu_item() { - assert_eq!( - ::core::mem::size_of::(), - 32usize, - concat!("Size of: ", stringify!(ncmenu_item)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncmenu_item)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).desc as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_item), - "::", - stringify!(desc) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).shortcut as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_item), - "::", - stringify!(shortcut) - ) - ); -} -impl Default for ncmenu_item { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncmenu_section { - #[doc = " utf-8 c string"] - pub name: *mut cty::c_char, - pub itemcount: cty::c_int, - pub items: *mut ncmenu_item, - #[doc = " shortcut, will be underlined if present in name"] - pub shortcut: ncinput, -} -#[test] -fn bindgen_test_layout_ncmenu_section() { - assert_eq!( - ::core::mem::size_of::(), - 48usize, - concat!("Size of: ", stringify!(ncmenu_section)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncmenu_section)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).name as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_section), - "::", - stringify!(name) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).itemcount as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_section), - "::", - stringify!(itemcount) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).items as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_section), - "::", - stringify!(items) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).shortcut as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_section), - "::", - stringify!(shortcut) - ) - ); -} -impl Default for ncmenu_section { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncmenu_options { - #[doc = " array of 'sectioncount' menu_sections"] - pub sections: *mut ncmenu_section, - #[doc = " must be positive"] - pub sectioncount: cty::c_int, - #[doc = " styling for header"] - pub headerchannels: u64, - #[doc = " styling for sections"] - pub sectionchannels: u64, - #[doc = " flag word of NCMENU_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncmenu_options() { - assert_eq!( - ::core::mem::size_of::(), - 40usize, - concat!("Size of: ", stringify!(ncmenu_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncmenu_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sections as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_options), - "::", - stringify!(sections) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sectioncount as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_options), - "::", - stringify!(sectioncount) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).headerchannels as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_options), - "::", - stringify!(headerchannels) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sectionchannels as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_options), - "::", - stringify!(sectionchannels) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_options), - "::", - stringify!(flags) - ) - ); -} -impl Default for ncmenu_options { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[repr(C)] -#[derive(Debug)] -pub struct ncmenu { - _unused: [u8; 0], -} -extern "C" { - #[doc = " Create a menu with the specified options. Menus are currently bound to an"] - #[doc = " overall Notcurses object (as opposed to a particular plane), and are"] - #[doc = " implemented as ncplanes kept atop other ncplanes."] - pub fn ncmenu_create(n: *mut ncplane, opts: *const ncmenu_options) -> *mut ncmenu; -} -extern "C" { - #[doc = " Unroll the specified menu section, making the menu visible if it was"] - #[doc = " invisible, and rolling up any menu section that is already unrolled."] - pub fn ncmenu_unroll(n: *mut ncmenu, sectionidx: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Roll up any unrolled menu section, and hide the menu if using hiding."] - pub fn ncmenu_rollup(n: *mut ncmenu) -> cty::c_int; -} -extern "C" { - #[doc = " Unroll the previous/next section (relative to current unrolled). If no"] - #[doc = " section is unrolled, the first section will be unrolled."] - pub fn ncmenu_nextsection(n: *mut ncmenu) -> cty::c_int; -} -extern "C" { - pub fn ncmenu_prevsection(n: *mut ncmenu) -> cty::c_int; -} -extern "C" { - #[doc = " Move to the previous/next item within the currently unrolled section. If no"] - #[doc = " section is unrolled, the first section will be unrolled."] - pub fn ncmenu_nextitem(n: *mut ncmenu) -> cty::c_int; -} -extern "C" { - pub fn ncmenu_previtem(n: *mut ncmenu) -> cty::c_int; -} -extern "C" { - #[doc = " Disable or enable a menu item. Returns 0 if the item was found."] - pub fn ncmenu_item_set_status( - n: *mut ncmenu, - section: *const cty::c_char, - item: *const cty::c_char, - enabled: bool, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Return the selected item description, or NULL if no section is unrolled. If"] - #[doc = " 'ni' is not NULL, and the selected item has a shortcut, 'ni' will be filled"] - #[doc = " in with that shortcut--this can allow faster matching."] - pub fn ncmenu_selected(n: *const ncmenu, ni: *mut ncinput) -> *const cty::c_char; -} -extern "C" { - #[doc = " Return the item description corresponding to the mouse click 'click'. The"] - #[doc = " item must be on an actively unrolled section, and the click must be in the"] - #[doc = " area of a valid item. If 'ni' is not NULL, and the selected item has a"] - #[doc = " shortcut, 'ni' will be filled in with the shortcut."] - pub fn ncmenu_mouse_selected( - n: *const ncmenu, - click: *const ncinput, - ni: *mut ncinput, - ) -> *const cty::c_char; -} -extern "C" { - #[doc = " Return the ncplane backing this ncmenu."] - pub fn ncmenu_plane(n: *mut ncmenu) -> *mut ncplane; -} -extern "C" { - #[doc = " Offer the input to the ncmenu. If it's relevant, this function returns true,"] - #[doc = " and the input ought not be processed further. If it's irrelevant to the"] - #[doc = " menu, false is returned. Relevant inputs include:"] - #[doc = " * mouse movement over a hidden menu"] - #[doc = " * a mouse click on a menu section (the section is unrolled)"] - #[doc = " * a mouse click outside of an unrolled menu (the menu is rolled up)"] - #[doc = " * left or right on an unrolled menu (navigates among sections)"] - #[doc = " * up or down on an unrolled menu (navigates among items)"] - #[doc = " * escape on an unrolled menu (the menu is rolled up)"] - pub fn ncmenu_offer_input(n: *mut ncmenu, nc: *const ncinput) -> bool; -} -extern "C" { - #[doc = " Destroy a menu created with ncmenu_create()."] - pub fn ncmenu_destroy(n: *mut ncmenu) -> cty::c_int; -} -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncprogbar_options { - #[doc = " upper-left channel. in the context of a progress bar,"] - pub ulchannel: u32, - #[doc = " \"up\" is the direction we are progressing towards, and"] - pub urchannel: u32, - #[doc = " \"bottom\" is the direction of origin. for monochromatic"] - pub blchannel: u32, - #[doc = " bar, all four channels ought be the same."] - pub brchannel: u32, - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncprogbar_options() { - assert_eq!( - ::core::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(ncprogbar_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncprogbar_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).ulchannel as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncprogbar_options), - "::", - stringify!(ulchannel) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).urchannel as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(ncprogbar_options), - "::", - stringify!(urchannel) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).blchannel as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncprogbar_options), - "::", - stringify!(blchannel) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).brchannel as *const _ as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(ncprogbar_options), - "::", - stringify!(brchannel) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncprogbar_options), - "::", - stringify!(flags) - ) - ); -} -extern "C" { - #[doc = " Takes ownership of the ncplane 'n', which will be destroyed by"] - #[doc = " ncprogbar_destroy(). The progress bar is initially at 0%."] - pub fn ncprogbar_create(n: *mut ncplane, opts: *const ncprogbar_options) -> *mut ncprogbar; -} -extern "C" { - #[doc = " Return a reference to the ncprogbar's underlying ncplane."] - pub fn ncprogbar_plane(n: *mut ncprogbar) -> *mut ncplane; -} -extern "C" { - #[doc = " Set the progress bar's completion, a double 0 <= 'p' <= 1."] - pub fn ncprogbar_set_progress(n: *mut ncprogbar, p: f64) -> cty::c_int; -} -extern "C" { - #[doc = " Get the progress bar's completion, a double on [0, 1]."] - pub fn ncprogbar_progress(n: *const ncprogbar) -> f64; -} -extern "C" { - #[doc = " Destroy the progress bar and its underlying ncplane."] - pub fn ncprogbar_destroy(n: *mut ncprogbar); -} -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct nctabbed_options { - #[doc = " channel for the selected tab header"] - pub selchan: u64, - #[doc = " channel for unselected tab headers"] - pub hdrchan: u64, - #[doc = " channel for the tab separator"] - pub sepchan: u64, - #[doc = " separator string (copied by nctabbed_create())"] - pub separator: *mut cty::c_char, - #[doc = " bitmask of NCTABBED_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_nctabbed_options() { - assert_eq!( - ::core::mem::size_of::(), - 40usize, - concat!("Size of: ", stringify!(nctabbed_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(nctabbed_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).selchan as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(nctabbed_options), - "::", - stringify!(selchan) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).hdrchan as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(nctabbed_options), - "::", - stringify!(hdrchan) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sepchan as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(nctabbed_options), - "::", - stringify!(sepchan) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).separator as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(nctabbed_options), - "::", - stringify!(separator) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(nctabbed_options), - "::", - stringify!(flags) - ) - ); -} -impl Default for nctabbed_options { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[doc = " Tab content drawing callback. Takes the tab it was associated to, the ncplane"] -#[doc = " on which tab content is to be drawn, and the user pointer of the tab."] -#[doc = " It is called during nctabbed_redraw()."] -pub type tabcb = ::core::option::Option< - unsafe extern "C" fn(t: *mut nctab, ncp: *mut ncplane, curry: *mut cty::c_void), ->; -extern "C" { - #[doc = " Creates a new nctabbed widget, associated with the given ncplane 'n', and with"] - #[doc = " additional options given in 'opts'. When 'opts' is NULL, it acts as if it were"] - #[doc = " called with an all-zero opts. The widget takes ownership of 'n', and destroys"] - #[doc = " it when the widget is destroyed. Returns the newly created widget. Returns"] - #[doc = " NULL on failure, also destroying 'n'."] - pub fn nctabbed_create(n: *mut ncplane, opts: *const nctabbed_options) -> *mut nctabbed; -} -extern "C" { - #[doc = " Destroy an nctabbed widget. All memory belonging to 'nt' is deallocated,"] - #[doc = " including all tabs and their names. The plane associated with 'nt' is also"] - #[doc = " destroyed. Calling this with NULL does nothing."] - pub fn nctabbed_destroy(nt: *mut nctabbed); -} -extern "C" { - #[doc = " Redraw the widget. This calls the tab callback of the currently selected tab"] - #[doc = " to draw tab contents, and draws tab headers. The tab content plane is not"] - #[doc = " modified by this function, apart from resizing the plane is necessary."] - pub fn nctabbed_redraw(nt: *mut nctabbed); -} -extern "C" { - #[doc = " Make sure the tab header of the currently selected tab is at least partially"] - #[doc = " visible. (by rotating tabs until at least one column is displayed)"] - #[doc = " Does nothing if there are no tabs."] - pub fn nctabbed_ensure_selected_header_visible(nt: *mut nctabbed); -} -extern "C" { - #[doc = " Returns the currently selected tab, or NULL if there are no tabs."] - pub fn nctabbed_selected(nt: *mut nctabbed) -> *mut nctab; -} -extern "C" { - #[doc = " Returns the leftmost tab, or NULL if there are no tabs."] - pub fn nctabbed_leftmost(nt: *mut nctabbed) -> *mut nctab; -} -extern "C" { - #[doc = " Returns the number of tabs in the widget."] - pub fn nctabbed_tabcount(nt: *mut nctabbed) -> cty::c_int; -} -extern "C" { - #[doc = " Returns the plane associated to 'nt'."] - pub fn nctabbed_plane(nt: *mut nctabbed) -> *mut ncplane; -} -extern "C" { - #[doc = " Returns the tab content plane."] - pub fn nctabbed_content_plane(nt: *mut nctabbed) -> *mut ncplane; -} -extern "C" { - #[doc = " Returns the tab callback."] - pub fn nctab_cb(t: *mut nctab) -> tabcb; -} -extern "C" { - #[doc = " Returns the tab name. This is not a copy and it should not be stored."] - pub fn nctab_name(t: *mut nctab) -> *const cty::c_char; -} -extern "C" { - #[doc = " Returns the width (in columns) of the tab's name."] - pub fn nctab_name_width(t: *mut nctab) -> cty::c_int; -} -extern "C" { - #[doc = " Returns the tab's user pointer."] - pub fn nctab_userptr(t: *mut nctab) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Returns the tab to the right of 't'. This does not change which tab is selected."] - pub fn nctab_next(t: *mut nctab) -> *mut nctab; -} -extern "C" { - #[doc = " Returns the tab to the left of 't'. This does not change which tab is selected."] - pub fn nctab_prev(t: *mut nctab) -> *mut nctab; -} -extern "C" { - #[doc = " Add a new tab to 'nt' with the given tab callback, name, and user pointer."] - #[doc = " If both 'before' and 'after' are NULL, the tab is inserted after the selected"] - #[doc = " tab. Otherwise, it gets put after 'after' (if not NULL) and before 'before'"] - #[doc = " (if not NULL). If both 'after' and 'before' are given, they must be two"] - #[doc = " neighboring tabs (the tab list is circular, so the last tab is immediately"] - #[doc = " before the leftmost tab), otherwise the function returns NULL. If 'name' is"] - #[doc = " NULL or a string containing illegal characters, the function returns NULL."] - #[doc = " On all other failures the function also returns NULL. If it returns NULL,"] - #[doc = " none of the arguments are modified, and the widget state is not altered."] - pub fn nctabbed_add( - nt: *mut nctabbed, - after: *mut nctab, - before: *mut nctab, - tcb: tabcb, - name: *const cty::c_char, - opaque: *mut cty::c_void, - ) -> *mut nctab; -} -extern "C" { - #[doc = " Remove a tab 't' from 'nt'. Its neighboring tabs become neighbors to each"] - #[doc = " other. If 't' if the selected tab, the tab after 't' becomes selected."] - #[doc = " Likewise if 't' is the leftmost tab, the tab after 't' becomes leftmost."] - #[doc = " If 't' is the only tab, there will no more be a selected or leftmost tab,"] - #[doc = " until a new tab is added. Returns -1 if 't' is NULL, and 0 otherwise."] - pub fn nctabbed_del(nt: *mut nctabbed, t: *mut nctab) -> cty::c_int; -} -extern "C" { - #[doc = " Move 't' after 'after' (if not NULL) and before 'before' (if not NULL)."] - #[doc = " If both 'after' and 'before' are NULL, the function returns -1, otherwise"] - #[doc = " it returns 0."] - pub fn nctab_move( - nt: *mut nctabbed, - t: *mut nctab, - after: *mut nctab, - before: *mut nctab, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Move 't' to the right by one tab, looping around to become leftmost if needed."] - pub fn nctab_move_right(nt: *mut nctabbed, t: *mut nctab); -} -extern "C" { - #[doc = " Move 't' to the right by one tab, looping around to become the last tab if needed."] - pub fn nctab_move_left(nt: *mut nctabbed, t: *mut nctab); -} -extern "C" { - #[doc = " Rotate the tabs of 'nt' right by 'amt' tabs, or '-amt' tabs left if 'amt' is"] - #[doc = " negative. Tabs are rotated only by changing the leftmost tab; the selected tab"] - #[doc = " stays the same. If there are no tabs, nothing happens."] - pub fn nctabbed_rotate(nt: *mut nctabbed, amt: cty::c_int); -} -extern "C" { - #[doc = " Select the tab after the currently selected tab, and return the newly selected"] - #[doc = " tab. Returns NULL if there are no tabs."] - pub fn nctabbed_next(nt: *mut nctabbed) -> *mut nctab; -} -extern "C" { - #[doc = " Select the tab before the currently selected tab, and return the newly selected"] - #[doc = " tab. Returns NULL if there are no tabs."] - pub fn nctabbed_prev(nt: *mut nctabbed) -> *mut nctab; -} -extern "C" { - #[doc = " Change the selected tab to be 't'. Returns the previously selected tab."] - pub fn nctabbed_select(nt: *mut nctabbed, t: *mut nctab) -> *mut nctab; -} -extern "C" { - #[doc = " Write the channels for tab headers, the selected tab header, and the separator"] - #[doc = " to '*hdrchan', '*selchan', and '*sepchan' respectively."] - pub fn nctabbed_channels( - nt: *mut nctabbed, - hdrchan: *mut u64, - selchan: *mut u64, - sepchan: *mut u64, - ); -} -extern "C" { - #[doc = " Returns the tab separator. This is not a copy and it should not be stored."] - #[doc = " This can be NULL, if the separator was set to NULL in ncatbbed_create() or"] - #[doc = " nctabbed_set_separator()."] - pub fn nctabbed_separator(nt: *mut nctabbed) -> *const cty::c_char; -} -extern "C" { - #[doc = " Returns the tab separator width, or zero if there is no separator."] - pub fn nctabbed_separator_width(nt: *mut nctabbed) -> cty::c_int; -} -extern "C" { - #[doc = " Set the tab headers channel for 'nt'."] - pub fn nctabbed_set_hdrchan(nt: *mut nctabbed, chan: u64); -} -extern "C" { - #[doc = " Set the selected tab header channel for 'nt'."] - pub fn nctabbed_set_selchan(nt: *mut nctabbed, chan: u64); -} -extern "C" { - #[doc = " Set the tab separator channel for 'nt'."] - pub fn nctabbed_set_sepchan(nt: *mut nctabbed, chan: u64); -} -extern "C" { - #[doc = " Set the tab callback function for 't'. Returns the previous tab callback."] - pub fn nctab_set_cb(t: *mut nctab, newcb: tabcb) -> tabcb; -} -extern "C" { - #[doc = " Change the name of 't'. Returns -1 if 'newname' is NULL, and 0 otherwise."] - pub fn nctab_set_name(t: *mut nctab, newname: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Set the user pointer of 't'. Returns the previous user pointer."] - pub fn nctab_set_userptr(t: *mut nctab, newopaque: *mut cty::c_void) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Change the tab separator for 'nt'. Returns -1 if 'separator' is not NULL and"] - #[doc = " is not a valid string, and 0 otherwise."] - pub fn nctabbed_set_separator(nt: *mut nctabbed, separator: *const cty::c_char) -> cty::c_int; -} -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncplot_options { - #[doc = " channels for the maximum and minimum levels. linear or exponential"] - #[doc = " interpolation will be applied across the domain between these two."] - pub maxchannels: u64, - pub minchannels: u64, - #[doc = " styling used for the legend, if NCPLOT_OPTION_LABELTICKSD is set"] - pub legendstyle: u16, - #[doc = " number of \"pixels\" per row x column"] - pub gridtype: ncblitter_e, - #[doc = " independent variable can either be a contiguous range, or a finite set"] - #[doc = " of keys. for a time range, say the previous hour sampled with second"] - #[doc = " resolution, the independent variable would be the range [0..3600): 3600."] - #[doc = " if rangex is 0, it is dynamically set to the number of columns."] - pub rangex: cty::c_int, - #[doc = " optional, printed by the labels"] - pub title: *const cty::c_char, - #[doc = " bitfield over NCPLOT_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncplot_options() { - assert_eq!( - ::core::mem::size_of::(), - 48usize, - concat!("Size of: ", stringify!(ncplot_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncplot_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).maxchannels as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncplot_options), - "::", - stringify!(maxchannels) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).minchannels as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncplot_options), - "::", - stringify!(minchannels) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).legendstyle as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncplot_options), - "::", - stringify!(legendstyle) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).gridtype as *const _ as usize }, - 20usize, - concat!( - "Offset of field: ", - stringify!(ncplot_options), - "::", - stringify!(gridtype) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).rangex as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncplot_options), - "::", - stringify!(rangex) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).title as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncplot_options), - "::", - stringify!(title) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(ncplot_options), - "::", - stringify!(flags) - ) - ); -} -impl Default for ncplot_options { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -extern "C" { - #[doc = " Use the provided plane 'n' for plotting according to the options 'opts'. The"] - #[doc = " plot will make free use of the entirety of the plane. For domain"] - #[doc = " autodiscovery, set miny == maxy == 0. ncuplot holds uint64_ts, while"] - #[doc = " ncdplot holds doubles."] - pub fn ncuplot_create( - n: *mut ncplane, - opts: *const ncplot_options, - miny: u64, - maxy: u64, - ) -> *mut ncuplot; -} -extern "C" { - pub fn ncdplot_create( - n: *mut ncplane, - opts: *const ncplot_options, - miny: f64, - maxy: f64, - ) -> *mut ncdplot; -} -extern "C" { - #[doc = " Return a reference to the ncplot's underlying ncplane."] - pub fn ncuplot_plane(n: *mut ncuplot) -> *mut ncplane; -} -extern "C" { - pub fn ncdplot_plane(n: *mut ncdplot) -> *mut ncplane; -} -extern "C" { - #[doc = " Add to or set the value corresponding to this x. If x is beyond the current"] - #[doc = " x window, the x window is advanced to include x, and values passing beyond"] - #[doc = " the window are lost. The first call will place the initial window. The plot"] - #[doc = " will be redrawn, but notcurses_render() is not called."] - pub fn ncuplot_add_sample(n: *mut ncuplot, x: u64, y: u64) -> cty::c_int; -} -extern "C" { - pub fn ncdplot_add_sample(n: *mut ncdplot, x: u64, y: f64) -> cty::c_int; -} -extern "C" { - pub fn ncuplot_set_sample(n: *mut ncuplot, x: u64, y: u64) -> cty::c_int; -} -extern "C" { - pub fn ncdplot_set_sample(n: *mut ncdplot, x: u64, y: f64) -> cty::c_int; -} -extern "C" { - pub fn ncuplot_sample(n: *const ncuplot, x: u64, y: *mut u64) -> cty::c_int; -} -extern "C" { - pub fn ncdplot_sample(n: *const ncdplot, x: u64, y: *mut f64) -> cty::c_int; -} -extern "C" { - pub fn ncuplot_destroy(n: *mut ncuplot); -} -extern "C" { - pub fn ncdplot_destroy(n: *mut ncdplot); -} -pub type ncfdplane_callback = ::core::option::Option< - unsafe extern "C" fn( - n: *mut ncfdplane, - buf: *const cty::c_void, - s: size_t, - curry: *mut cty::c_void, - ) -> cty::c_int, ->; -pub type ncfdplane_done_cb = ::core::option::Option< - unsafe extern "C" fn( - n: *mut ncfdplane, - fderrno: cty::c_int, - curry: *mut cty::c_void, - ) -> cty::c_int, ->; -#[doc = " read from an fd until EOF (or beyond, if follow is set), invoking the user's"] -#[doc = " callback each time. runs in its own context. on EOF or error, the finalizer"] -#[doc = " callback will be invoked, and the user ought destroy the ncfdplane. the"] -#[doc = " data is *not* guaranteed to be nul-terminated, and may contain arbitrary"] -#[doc = " zeroes."] -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncfdplane_options { - #[doc = " parameter provided to callbacks"] - pub curry: *mut cty::c_void, - #[doc = " keep reading after hitting end? (think tail -f)"] - pub follow: bool, - #[doc = " bitfield over NCOPTION_FDPLANE_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncfdplane_options() { - assert_eq!( - ::core::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(ncfdplane_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncfdplane_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).curry as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncfdplane_options), - "::", - stringify!(curry) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).follow as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncfdplane_options), - "::", - stringify!(follow) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncfdplane_options), - "::", - stringify!(flags) - ) - ); -} -impl Default for ncfdplane_options { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -extern "C" { - #[doc = " Create an ncfdplane around the fd 'fd'. Consider this function to take"] - #[doc = " ownership of the file descriptor, which will be closed in ncfdplane_destroy()."] - pub fn ncfdplane_create( - n: *mut ncplane, - opts: *const ncfdplane_options, - fd: cty::c_int, - cbfxn: ncfdplane_callback, - donecbfxn: ncfdplane_done_cb, - ) -> *mut ncfdplane; -} -extern "C" { - pub fn ncfdplane_plane(n: *mut ncfdplane) -> *mut ncplane; -} -extern "C" { - pub fn ncfdplane_destroy(n: *mut ncfdplane) -> cty::c_int; -} -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncsubproc_options { - pub curry: *mut cty::c_void, - #[doc = " restart this many seconds after an exit (watch)"] - pub restart_period: u64, - #[doc = " bitfield over NCOPTION_SUBPROC_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncsubproc_options() { - assert_eq!( - ::core::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(ncsubproc_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncsubproc_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).curry as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncsubproc_options), - "::", - stringify!(curry) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).restart_period as *const _ as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncsubproc_options), - "::", - stringify!(restart_period) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncsubproc_options), - "::", - stringify!(flags) - ) - ); -} -impl Default for ncsubproc_options { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -extern "C" { - #[doc = " see exec(2). p-types use $PATH. e-type passes environment vars."] - pub fn ncsubproc_createv( - n: *mut ncplane, - opts: *const ncsubproc_options, - bin: *const cty::c_char, - arg: *const *mut cty::c_char, - cbfxn: ncfdplane_callback, - donecbfxn: ncfdplane_done_cb, - ) -> *mut ncsubproc; -} -extern "C" { - pub fn ncsubproc_createvp( - n: *mut ncplane, - opts: *const ncsubproc_options, - bin: *const cty::c_char, - arg: *const *mut cty::c_char, - cbfxn: ncfdplane_callback, - donecbfxn: ncfdplane_done_cb, - ) -> *mut ncsubproc; -} -extern "C" { - pub fn ncsubproc_createvpe( - n: *mut ncplane, - opts: *const ncsubproc_options, - bin: *const cty::c_char, - arg: *const *mut cty::c_char, - env: *const *mut cty::c_char, - cbfxn: ncfdplane_callback, - donecbfxn: ncfdplane_done_cb, - ) -> *mut ncsubproc; -} -extern "C" { - pub fn ncsubproc_plane(n: *mut ncsubproc) -> *mut ncplane; -} -extern "C" { - pub fn ncsubproc_destroy(n: *mut ncsubproc) -> cty::c_int; -} -extern "C" { - #[doc = " Draw a QR code at the current position on the plane. If there is insufficient"] - #[doc = " room to draw the code here, or there is any other error, non-zero will be"] - #[doc = " returned. Otherwise, the QR code \"version\" (size) is returned. The QR code"] - #[doc = " is (version * 4 + 17) columns wide, and ⌈version * 4 + 17⌉ rows tall (the"] - #[doc = " properly-scaled values are written back to '*ymax' and '*xmax')."] - pub fn ncplane_qrcode( - n: *mut ncplane, - ymax: *mut cty::c_int, - xmax: *mut cty::c_int, - data: *const cty::c_void, - len: size_t, - ) -> cty::c_int; -} -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncreader_options { - #[doc = " channels used for input"] - pub tchannels: u64, - #[doc = " attributes used for input"] - pub tattrword: u32, - #[doc = " bitfield of NCREADER_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncreader_options() { - assert_eq!( - ::core::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(ncreader_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncreader_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).tchannels as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncreader_options), - "::", - stringify!(tchannels) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).tattrword as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncreader_options), - "::", - stringify!(tattrword) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncreader_options), - "::", - stringify!(flags) - ) - ); -} -extern "C" { - #[doc = " ncreaders provide freeform input in a (possibly multiline) region, supporting"] - #[doc = " optional readline keybindings. takes ownership of 'n', destroying it on any"] - #[doc = " error (ncreader_destroy() otherwise destroys the ncplane)."] - pub fn ncreader_create(n: *mut ncplane, opts: *const ncreader_options) -> *mut ncreader; -} -extern "C" { - #[doc = " empty the ncreader of any user input, and home the cursor."] - pub fn ncreader_clear(n: *mut ncreader) -> cty::c_int; -} -extern "C" { - pub fn ncreader_plane(n: *mut ncreader) -> *mut ncplane; -} -extern "C" { - #[doc = " Offer the input to the ncreader. If it's relevant, this function returns"] - #[doc = " true, and the input ought not be processed further. Almost all inputs"] - #[doc = " are relevant to an ncreader, save synthesized ones."] - pub fn ncreader_offer_input(n: *mut ncreader, ni: *const ncinput) -> bool; -} -extern "C" { - #[doc = " Atttempt to move in the specified direction. Returns 0 if a move was"] - #[doc = " successfully executed, -1 otherwise. Scrolling is taken into account."] - pub fn ncreader_move_left(n: *mut ncreader) -> cty::c_int; -} -extern "C" { - pub fn ncreader_move_right(n: *mut ncreader) -> cty::c_int; -} -extern "C" { - pub fn ncreader_move_up(n: *mut ncreader) -> cty::c_int; -} -extern "C" { - pub fn ncreader_move_down(n: *mut ncreader) -> cty::c_int; -} -extern "C" { - #[doc = " Destructively write the provided EGC to the current cursor location. Move"] - #[doc = " the cursor as necessary, scrolling if applicable."] - pub fn ncreader_write_egc(n: *mut ncreader, egc: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " return a heap-allocated copy of the current (UTF-8) contents."] - pub fn ncreader_contents(n: *const ncreader) -> *mut cty::c_char; -} -extern "C" { - #[doc = " destroy the reader and its bound plane. if 'contents' is not NULL, the"] - #[doc = " UTF-8 input will be heap-duplicated and written to 'contents'."] - pub fn ncreader_destroy(n: *mut ncreader, contents: *mut *mut cty::c_char); -} -extern "C" { - #[doc = " Dump selected Notcurses state to the supplied 'debugfp'. Output is freeform,"] - #[doc = " and subject to change. It includes geometry of all planes, from all piles."] - pub fn notcurses_debug(nc: *const notcurses, debugfp: *mut FILE); -} -extern "C" { - #[doc = " Dump selected configuration capabilities to 'debugfp'. Output is freeform,"] - #[doc = " and subject to change."] - pub fn notcurses_debug_caps(nc: *const notcurses, debugfp: *mut FILE); -} -extern "C" { - #[doc = " Get the default *media* (not plot) blitter for this environment when using"] - #[doc = " the specified scaling method. Currently, this means:"] - #[doc = " - if lacking UTF-8, NCBLIT_1x1"] - #[doc = " - otherwise, if not NCSCALE_STRETCH, NCBLIT_2x1"] - #[doc = " - otherwise, if sextants are not known to be good, NCBLIT_2x2"] - #[doc = " - otherwise NCBLIT_3x2"] - #[doc = " NCBLIT_2x2 and NCBLIT_3x2 both distort the original aspect ratio, thus"] - #[doc = " NCBLIT_2x1 is used outside of NCSCALE_STRETCH."] - pub fn ncvisual_media_defblitter(nc: *const notcurses, scale: ncscale_e) -> ncblitter_e; -} -pub type ncdirectv = ncplane; -#[repr(C)] -#[derive(Debug)] -pub struct ncdirect { - _unused: [u8; 0], -} -extern "C" { - #[doc = " Initialize a direct-mode Notcurses context on the connected terminal at 'fp'."] - #[doc = " 'fp' must be a tty. You'll usually want stdout. Direct mode supports a"] - #[doc = " limited subset of Notcurses routines which directly affect 'fp', and neither"] - #[doc = " supports nor requires notcurses_render(). This can be used to add color and"] - #[doc = " styling to text in the standard output paradigm. 'flags' is a bitmask over"] - #[doc = " NCDIRECT_OPTION_*."] - #[doc = " Returns NULL on error, including any failure initializing terminfo."] - pub fn ncdirect_init(termtype: *const cty::c_char, fp: *mut FILE, flags: u64) -> *mut ncdirect; -} -extern "C" { - #[doc = " The same as ncdirect_init(), but without any multimedia functionality,"] - #[doc = " allowing for a svelter binary. Link with notcurses-core if this is used."] - pub fn ncdirect_core_init( - termtype: *const cty::c_char, - fp: *mut FILE, - flags: u64, - ) -> *mut ncdirect; -} -extern "C" { - #[doc = " Read a (heap-allocated) line of text using the Readline library Initializes"] - #[doc = " Readline the first time it's called. For input to be echoed to the terminal,"] - #[doc = " it is necessary that NCDIRECT_OPTION_INHIBIT_CBREAK be provided to"] - #[doc = " ncdirect_init(). Returns NULL on error."] - pub fn ncdirect_readline(nc: *mut ncdirect, prompt: *const cty::c_char) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Direct mode. This API can be used to colorize and stylize output generated"] - #[doc = " outside of notcurses, without ever calling notcurses_render(). These should"] - #[doc = " not be intermixed with standard Notcurses rendering."] - pub fn ncdirect_set_fg_rgb(nc: *mut ncdirect, rgb: cty::c_uint) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_set_bg_rgb(nc: *mut ncdirect, rgb: cty::c_uint) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_set_fg_palindex(nc: *mut ncdirect, pidx: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_set_bg_palindex(nc: *mut ncdirect, pidx: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Returns the number of simultaneous colors claimed to be supported, or 1 if"] - #[doc = " there is no color support. Note that several terminal emulators advertise"] - #[doc = " more colors than they actually support, downsampling internally."] - pub fn ncdirect_palette_size(nc: *const ncdirect) -> cty::c_uint; -} -extern "C" { - #[doc = " Output the string |utf8| according to the channels |channels|. Note that"] - #[doc = " ncdirect_putstr() does not explicitly flush output buffers, so it will not"] - #[doc = " necessarily be immediately visible."] - pub fn ncdirect_putstr( - nc: *mut ncdirect, - channels: u64, - utf8: *const cty::c_char, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Formatted printing (plus alignment relative to the terminal). Returns the"] - #[doc = " number of columns printed on success."] - pub fn ncdirect_printf_aligned( - n: *mut ncdirect, - y: cty::c_int, - align: ncalign_e, - fmt: *const cty::c_char, - ... - ) -> cty::c_int; -} -extern "C" { - #[doc = " Force a flush. Returns 0 on success, -1 on failure."] - pub fn ncdirect_flush(nc: *const ncdirect) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_set_fg_default(nc: *mut ncdirect) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_set_bg_default(nc: *mut ncdirect) -> cty::c_int; -} -extern "C" { - #[doc = " Get the current number of columns/rows."] - pub fn ncdirect_dim_x(nc: *const ncdirect) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_dim_y(nc: *const ncdirect) -> cty::c_int; -} -extern "C" { - #[doc = " ncplane_styles_*() analogues"] - pub fn ncdirect_set_styles(n: *mut ncdirect, stylebits: cty::c_uint) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_on_styles(n: *mut ncdirect, stylebits: cty::c_uint) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_off_styles(n: *mut ncdirect, stylebits: cty::c_uint) -> cty::c_int; -} -extern "C" { - #[doc = " Deprecated forms of above."] - pub fn ncdirect_styles_set(n: *mut ncdirect, stylebits: cty::c_uint) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_styles_on(n: *mut ncdirect, stylebits: cty::c_uint) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_styles_off(n: *mut ncdirect, stylebits: cty::c_uint) -> cty::c_int; -} -extern "C" { - #[doc = " Move the cursor in direct mode. -1 to retain current location on that axis."] - pub fn ncdirect_cursor_move_yx(n: *mut ncdirect, y: cty::c_int, x: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_cursor_enable(nc: *mut ncdirect) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_cursor_disable(nc: *mut ncdirect) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_cursor_up(nc: *mut ncdirect, num: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_cursor_left(nc: *mut ncdirect, num: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_cursor_right(nc: *mut ncdirect, num: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_cursor_down(nc: *mut ncdirect, num: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Get the cursor position, when supported. This requires writing to the"] - #[doc = " terminal, and then reading from it. If the terminal doesn't reply, or"] - #[doc = " doesn't reply in a way we understand, the results might be deleterious."] - pub fn ncdirect_cursor_yx( - n: *mut ncdirect, - y: *mut cty::c_int, - x: *mut cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Push or pop the cursor location to the terminal's stack. The depth of this"] - #[doc = " stack, and indeed its existence, is terminal-dependent."] - pub fn ncdirect_cursor_push(n: *mut ncdirect) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_cursor_pop(n: *mut ncdirect) -> cty::c_int; -} -extern "C" { - #[doc = " Display an image using the specified blitter and scaling. The image may"] - #[doc = " be arbitrarily many rows -- the output will scroll -- but will only occupy"] - #[doc = " the column of the cursor, and those to the right. The render/raster process"] - #[doc = " can be split by using ncdirect_render_frame() and ncdirect_raster_frame()."] - pub fn ncdirect_render_image( - n: *mut ncdirect, - filename: *const cty::c_char, - align: ncalign_e, - blitter: ncblitter_e, - scale: ncscale_e, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Clear the screen."] - pub fn ncdirect_clear(nc: *mut ncdirect) -> cty::c_int; -} -extern "C" { - #[doc = " Can we load images? This requires being built against FFmpeg/OIIO."] - pub fn ncdirect_canopen_images(n: *const ncdirect) -> bool; -} -extern "C" { - #[doc = " Is our encoding UTF-8? Requires LANG being set to a UTF8 locale."] - pub fn ncdirect_canutf8(n: *const ncdirect) -> bool; -} -extern "C" { - #[doc = " This function must successfully return before NCBLIT_PIXEL is available."] - #[doc = " Returns -1 on error, 0 for no support, or 1 if pixel output is supported."] - #[doc = " Must not be called concurrently with either input or rasterization."] - pub fn ncdirect_check_pixel_support(n: *mut ncdirect) -> cty::c_int; -} -extern "C" { - #[doc = " Draw horizontal/vertical lines using the specified channels, interpolating"] - #[doc = " between them as we go. The EGC may not use more than one column. For a"] - #[doc = " horizontal line, |len| cannot exceed the screen width minus the cursor's"] - #[doc = " offset. For a vertical line, it may be as long as you'd like; the screen"] - #[doc = " will scroll as necessary. All lines start at the current cursor position."] - pub fn ncdirect_hline_interp( - n: *mut ncdirect, - egc: *const cty::c_char, - len: cty::c_int, - h1: u64, - h2: u64, - ) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_vline_interp( - n: *mut ncdirect, - egc: *const cty::c_char, - len: cty::c_int, - h1: u64, - h2: u64, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Draw a box with its upper-left corner at the current cursor position, having"] - #[doc = " dimensions |ylen|x|xlen|. See ncplane_box() for more information. The"] - #[doc = " minimum box size is 2x2, and it cannot be drawn off-screen. |wchars| is an"] - #[doc = " array of 6 wide characters: UL, UR, LL, LR, HL, VL."] - pub fn ncdirect_box( - n: *mut ncdirect, - ul: u64, - ur: u64, - ll: u64, - lr: u64, - wchars: *const wchar_t, - ylen: cty::c_int, - xlen: cty::c_int, - ctlword: cty::c_uint, - ) -> cty::c_int; -} -extern "C" { - #[doc = " ncdirect_box() with the rounded box-drawing characters"] - pub fn ncdirect_rounded_box( - n: *mut ncdirect, - ul: u64, - ur: u64, - ll: u64, - lr: u64, - ylen: cty::c_int, - xlen: cty::c_int, - ctlword: cty::c_uint, - ) -> cty::c_int; -} -extern "C" { - #[doc = " ncdirect_box() with the double box-drawing characters"] - pub fn ncdirect_double_box( - n: *mut ncdirect, - ul: u64, - ur: u64, - ll: u64, - lr: u64, - ylen: cty::c_int, - xlen: cty::c_int, - ctlword: cty::c_uint, - ) -> cty::c_int; -} -extern "C" { - #[doc = " See ppoll(2) for more detail. Provide a NULL 'ts' to block at length, a 'ts'"] - #[doc = " of 0 for non-blocking operation, and otherwise a timespec to bound blocking."] - #[doc = " Signals in sigmask (less several we handle internally) will be atomically"] - #[doc = " masked and unmasked per ppoll(2). '*sigmask' should generally contain all"] - #[doc = " signals. Returns a single Unicode code point, or (char32_t)-1 on error."] - #[doc = " 'sigmask' may be NULL. Returns 0 on a timeout. If an event is processed, the"] - #[doc = " return value is the 'id' field from that event. 'ni' may be NULL."] - pub fn ncdirect_getc( - n: *mut ncdirect, - ts: *const timespec, - sigmask: *mut sigset_t, - ni: *mut ncinput, - ) -> char32_t; -} -extern "C" { - #[doc = " Get a file descriptor suitable for input event poll()ing. When this"] - #[doc = " descriptor becomes available, you can call ncdirect_getc_nblock(),"] - #[doc = " and input ought be ready. This file descriptor is *not* necessarily"] - #[doc = " the file descriptor associated with stdin (but it might be!)."] - pub fn ncdirect_inputready_fd(n: *mut ncdirect) -> cty::c_int; -} -extern "C" { - #[doc = " Release 'nc' and any associated resources. 0 on success, non-0 on failure."] - pub fn ncdirect_stop(nc: *mut ncdirect) -> cty::c_int; -} -extern "C" { - #[doc = " Render an image using the specified blitter and scaling, but do not write"] - #[doc = " the result. The image may be arbitrarily many rows -- the output will scroll"] - #[doc = " -- but will only occupy the column of the cursor, and those to the right."] - #[doc = " To actually write (and free) this, invoke ncdirect_raster_frame(). 'maxx'"] - #[doc = " and 'maxy', if greater than 0, are used for scaling; the terminal's geometry"] - #[doc = " is otherwise used."] - pub fn ncdirect_render_frame( - n: *mut ncdirect, - filename: *const cty::c_char, - blitter: ncblitter_e, - scale: ncscale_e, - maxy: cty::c_int, - maxx: cty::c_int, - ) -> *mut ncdirectv; -} -extern "C" { - #[doc = " Takes the result of ncdirect_render_frame() and writes it to the output."] - pub fn ncdirect_raster_frame( - n: *mut ncdirect, - ncdv: *mut ncdirectv, - align: ncalign_e, - ) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_stream( - n: *mut ncdirect, - filename: *const cty::c_char, - streamer: ncstreamcb, - vopts: *mut ncvisual_options, - curry: *mut cty::c_void, - ) -> cty::c_int; -} -pub type __builtin_va_list = [__va_list_tag; 1usize]; -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct __va_list_tag { - pub gp_offset: cty::c_uint, - pub fp_offset: cty::c_uint, - pub overflow_arg_area: *mut cty::c_void, - pub reg_save_area: *mut cty::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 Default for __va_list_tag { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} diff --git a/tools/function-summary/history/bindgen_20210418.rs b/tools/function-summary/history/bindgen_20210418.rs deleted file mode 100644 index 1379f0593..000000000 --- a/tools/function-summary/history/bindgen_20210418.rs +++ /dev/null @@ -1,9790 +0,0 @@ -/* automatically generated by rust-bindgen 0.58.1 */ - -#[repr(C)] -#[derive(Default)] -pub struct __IncompleteArrayField(::core::marker::PhantomData, [T; 0]); -impl __IncompleteArrayField { - #[inline] - pub const fn new() -> Self { - __IncompleteArrayField(::core::marker::PhantomData, []) - } - #[inline] - pub fn as_ptr(&self) -> *const T { - self as *const _ as *const T - } - #[inline] - pub fn as_mut_ptr(&mut self) -> *mut T { - self as *mut _ as *mut T - } - #[inline] - pub unsafe fn as_slice(&self, len: usize) -> &[T] { - ::core::slice::from_raw_parts(self.as_ptr(), len) - } - #[inline] - pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] { - ::core::slice::from_raw_parts_mut(self.as_mut_ptr(), len) - } -} -impl ::core::fmt::Debug for __IncompleteArrayField { - fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - fmt.write_str("__IncompleteArrayField") - } -} -pub const _TIME_H: u32 = 1; -pub const _FEATURES_H: u32 = 1; -pub const __GLIBC_USE_ISOC2X: u32 = 0; -pub const __USE_ISOC11: u32 = 1; -pub const __USE_ISOC99: u32 = 1; -pub const __USE_ISOC95: u32 = 1; -pub const _POSIX_SOURCE: u32 = 1; -pub const _POSIX_C_SOURCE: u32 = 2; -pub const __USE_POSIX_IMPLICITLY: u32 = 1; -pub const __USE_POSIX: u32 = 1; -pub const __USE_POSIX2: u32 = 1; -pub const __USE_XOPEN: u32 = 1; -pub const __USE_FORTIFY_LEVEL: u32 = 0; -pub const __GLIBC_USE_DEPRECATED_GETS: u32 = 0; -pub const __GLIBC_USE_DEPRECATED_SCANF: u32 = 0; -pub const _STDC_PREDEF_H: u32 = 1; -pub const __STDC_IEC_559__: u32 = 1; -pub const __STDC_IEC_559_COMPLEX__: u32 = 1; -pub const __STDC_ISO_10646__: u32 = 201706; -pub const __GNU_LIBRARY__: u32 = 6; -pub const __GLIBC__: u32 = 2; -pub const __GLIBC_MINOR__: u32 = 31; -pub const _SYS_CDEFS_H: u32 = 1; -pub const __glibc_c99_flexarr_available: u32 = 1; -pub const __WORDSIZE: u32 = 64; -pub const __WORDSIZE_TIME64_COMPAT32: u32 = 1; -pub const __SYSCALL_WORDSIZE: u32 = 64; -pub const __LONG_DOUBLE_USES_FLOAT128: u32 = 0; -pub const __HAVE_GENERIC_SELECTION: u32 = 1; -pub const _BITS_TIME_H: u32 = 1; -pub const _BITS_TYPES_H: u32 = 1; -pub const __TIMESIZE: u32 = 64; -pub const _BITS_TYPESIZES_H: u32 = 1; -pub const __OFF_T_MATCHES_OFF64_T: u32 = 1; -pub const __INO_T_MATCHES_INO64_T: u32 = 1; -pub const __RLIM_T_MATCHES_RLIM64_T: u32 = 1; -pub const __STATFS_MATCHES_STATFS64: u32 = 1; -pub const __FD_SETSIZE: u32 = 1024; -pub const _BITS_TIME64_H: u32 = 1; -pub const __clock_t_defined: u32 = 1; -pub const __time_t_defined: u32 = 1; -pub const __struct_tm_defined: u32 = 1; -pub const _STRUCT_TIMESPEC: u32 = 1; -pub const _BITS_ENDIAN_H: u32 = 1; -pub const __LITTLE_ENDIAN: u32 = 1234; -pub const __BIG_ENDIAN: u32 = 4321; -pub const __PDP_ENDIAN: u32 = 3412; -pub const _BITS_ENDIANNESS_H: u32 = 1; -pub const __BYTE_ORDER: u32 = 1234; -pub const __FLOAT_WORD_ORDER: u32 = 1234; -pub const TIME_UTC: u32 = 1; -pub const _UCHAR_H: u32 = 1; -pub const __mbstate_t_defined: u32 = 1; -pub const ____mbstate_t_defined: u32 = 1; -pub const _CTYPE_H: u32 = 1; -pub const _WCHAR_H: u32 = 1; -pub const __GLIBC_USE_LIB_EXT2: u32 = 0; -pub const __GLIBC_USE_IEC_60559_BFP_EXT: u32 = 0; -pub const __GLIBC_USE_IEC_60559_BFP_EXT_C2X: u32 = 0; -pub const __GLIBC_USE_IEC_60559_FUNCS_EXT: u32 = 0; -pub const __GLIBC_USE_IEC_60559_FUNCS_EXT_C2X: u32 = 0; -pub const __GLIBC_USE_IEC_60559_TYPES_EXT: u32 = 0; -pub const __HAVE_FLOAT128: u32 = 0; -pub const __HAVE_DISTINCT_FLOAT128: u32 = 0; -pub const __HAVE_FLOAT64X: u32 = 1; -pub const __HAVE_FLOAT64X_LONG_DOUBLE: u32 = 1; -pub const __HAVE_FLOAT16: u32 = 0; -pub const __HAVE_FLOAT32: u32 = 1; -pub const __HAVE_FLOAT64: u32 = 1; -pub const __HAVE_FLOAT32X: u32 = 1; -pub const __HAVE_FLOAT128X: u32 = 0; -pub const __HAVE_DISTINCT_FLOAT16: u32 = 0; -pub const __HAVE_DISTINCT_FLOAT32: u32 = 0; -pub const __HAVE_DISTINCT_FLOAT64: u32 = 0; -pub const __HAVE_DISTINCT_FLOAT32X: u32 = 0; -pub const __HAVE_DISTINCT_FLOAT64X: u32 = 0; -pub const __HAVE_DISTINCT_FLOAT128X: u32 = 0; -pub const __HAVE_FLOATN_NOT_TYPEDEF: u32 = 0; -pub const __GNUC_VA_LIST: u32 = 1; -pub const _BITS_WCHAR_H: u32 = 1; -pub const __wint_t_defined: u32 = 1; -pub const _WINT_T: u32 = 1; -pub const ____FILE_defined: u32 = 1; -pub const WEOF: u32 = 4294967295; -pub const _BITS_WCTYPE_WCHAR_H: u32 = 1; -pub const _STDIO_H: u32 = 1; -pub const _____fpos_t_defined: u32 = 1; -pub const _____fpos64_t_defined: u32 = 1; -pub const __FILE_defined: u32 = 1; -pub const __struct_FILE_defined: u32 = 1; -pub const _IO_EOF_SEEN: u32 = 16; -pub const _IO_ERR_SEEN: u32 = 32; -pub const _IO_USER_LOCK: u32 = 32768; -pub const _IOFBF: u32 = 0; -pub const _IOLBF: u32 = 1; -pub const _IONBF: u32 = 2; -pub const BUFSIZ: u32 = 8192; -pub const EOF: i32 = -1; -pub const SEEK_SET: u32 = 0; -pub const SEEK_CUR: u32 = 1; -pub const SEEK_END: u32 = 2; -pub const P_tmpdir: &'static [u8; 5usize] = b"/tmp\0"; -pub const _BITS_STDIO_LIM_H: u32 = 1; -pub const L_tmpnam: u32 = 20; -pub const TMP_MAX: u32 = 238328; -pub const FILENAME_MAX: u32 = 4096; -pub const L_ctermid: u32 = 9; -pub const L_cuserid: u32 = 9; -pub const FOPEN_MAX: u32 = 16; -pub const _GETOPT_POSIX_H: u32 = 1; -pub const _GETOPT_CORE_H: u32 = 1; -pub const _STDINT_H: u32 = 1; -pub const _BITS_STDINT_INTN_H: u32 = 1; -pub const _BITS_STDINT_UINTN_H: u32 = 1; -pub const INT8_MIN: i32 = -128; -pub const INT16_MIN: i32 = -32768; -pub const INT32_MIN: i32 = -2147483648; -pub const INT8_MAX: u32 = 127; -pub const INT16_MAX: u32 = 32767; -pub const INT32_MAX: u32 = 2147483647; -pub const UINT8_MAX: u32 = 255; -pub const UINT16_MAX: u32 = 65535; -pub const UINT32_MAX: u32 = 4294967295; -pub const INT_LEAST8_MIN: i32 = -128; -pub const INT_LEAST16_MIN: i32 = -32768; -pub const INT_LEAST32_MIN: i32 = -2147483648; -pub const INT_LEAST8_MAX: u32 = 127; -pub const INT_LEAST16_MAX: u32 = 32767; -pub const INT_LEAST32_MAX: u32 = 2147483647; -pub const UINT_LEAST8_MAX: u32 = 255; -pub const UINT_LEAST16_MAX: u32 = 65535; -pub const UINT_LEAST32_MAX: u32 = 4294967295; -pub const INT_FAST8_MIN: i32 = -128; -pub const INT_FAST16_MIN: i64 = -9223372036854775808; -pub const INT_FAST32_MIN: i64 = -9223372036854775808; -pub const INT_FAST8_MAX: u32 = 127; -pub const INT_FAST16_MAX: u64 = 9223372036854775807; -pub const INT_FAST32_MAX: u64 = 9223372036854775807; -pub const UINT_FAST8_MAX: u32 = 255; -pub const UINT_FAST16_MAX: i32 = -1; -pub const UINT_FAST32_MAX: i32 = -1; -pub const INTPTR_MIN: i64 = -9223372036854775808; -pub const INTPTR_MAX: u64 = 9223372036854775807; -pub const UINTPTR_MAX: i32 = -1; -pub const PTRDIFF_MIN: i64 = -9223372036854775808; -pub const PTRDIFF_MAX: u64 = 9223372036854775807; -pub const SIG_ATOMIC_MIN: i32 = -2147483648; -pub const SIG_ATOMIC_MAX: u32 = 2147483647; -pub const SIZE_MAX: i32 = -1; -pub const WINT_MIN: u32 = 0; -pub const WINT_MAX: u32 = 4294967295; -pub const _STDLIB_H: u32 = 1; -pub const WNOHANG: u32 = 1; -pub const WUNTRACED: u32 = 2; -pub const __WNOTHREAD: u32 = 536870912; -pub const __WALL: u32 = 1073741824; -pub const __WCLONE: u32 = 2147483648; -pub const __W_CONTINUED: u32 = 65535; -pub const __WCOREFLAG: u32 = 128; -pub const __ldiv_t_defined: u32 = 1; -pub const __lldiv_t_defined: u32 = 1; -pub const RAND_MAX: u32 = 2147483647; -pub const EXIT_FAILURE: u32 = 1; -pub const EXIT_SUCCESS: u32 = 0; -pub const _STRING_H: u32 = 1; -pub const _BITS_SIGNUM_H: u32 = 1; -pub const _BITS_SIGNUM_GENERIC_H: u32 = 1; -pub const SIGINT: u32 = 2; -pub const SIGILL: u32 = 4; -pub const SIGABRT: u32 = 6; -pub const SIGFPE: u32 = 8; -pub const SIGSEGV: u32 = 11; -pub const SIGTERM: u32 = 15; -pub const SIGHUP: u32 = 1; -pub const SIGQUIT: u32 = 3; -pub const SIGTRAP: u32 = 5; -pub const SIGKILL: u32 = 9; -pub const SIGBUS: u32 = 10; -pub const SIGSYS: u32 = 12; -pub const SIGPIPE: u32 = 13; -pub const SIGALRM: u32 = 14; -pub const SIGURG: u32 = 16; -pub const SIGSTOP: u32 = 17; -pub const SIGTSTP: u32 = 18; -pub const SIGCONT: u32 = 19; -pub const SIGCHLD: u32 = 20; -pub const SIGTTIN: u32 = 21; -pub const SIGTTOU: u32 = 22; -pub const SIGPOLL: u32 = 23; -pub const SIGXCPU: u32 = 24; -pub const SIGXFSZ: u32 = 25; -pub const SIGVTALRM: u32 = 26; -pub const SIGPROF: u32 = 27; -pub const SIGUSR1: u32 = 30; -pub const SIGUSR2: u32 = 31; -pub const SIGWINCH: u32 = 28; -pub const SIGIO: u32 = 23; -pub const SIGIOT: u32 = 6; -pub const SIGCLD: u32 = 20; -pub const __SIGRTMIN: u32 = 32; -pub const __SIGRTMAX: u32 = 32; -pub const _NSIG: u32 = 33; -pub const SIGSTKFLT: u32 = 16; -pub const SIGPWR: u32 = 30; -pub const __sig_atomic_t_defined: u32 = 1; -pub const __sigset_t_defined: u32 = 1; -pub const _BITS_SIGACTION_H: u32 = 1; -pub const SA_NOCLDSTOP: u32 = 1; -pub const SA_NOCLDWAIT: u32 = 2; -pub const SA_SIGINFO: u32 = 4; -pub const SIG_BLOCK: u32 = 0; -pub const SIG_UNBLOCK: u32 = 1; -pub const SIG_SETMASK: u32 = 2; -pub const _LIBC_LIMITS_H_: u32 = 1; -pub const MB_LEN_MAX: u32 = 16; -pub const _BITS_POSIX1_LIM_H: u32 = 1; -pub const _POSIX_AIO_LISTIO_MAX: u32 = 2; -pub const _POSIX_AIO_MAX: u32 = 1; -pub const _POSIX_ARG_MAX: u32 = 4096; -pub const _POSIX_CHILD_MAX: u32 = 6; -pub const _POSIX_DELAYTIMER_MAX: u32 = 32; -pub const _POSIX_HOST_NAME_MAX: u32 = 255; -pub const _POSIX_LINK_MAX: u32 = 8; -pub const _POSIX_LOGIN_NAME_MAX: u32 = 9; -pub const _POSIX_MAX_CANON: u32 = 255; -pub const _POSIX_MAX_INPUT: u32 = 255; -pub const _POSIX_MQ_OPEN_MAX: u32 = 8; -pub const _POSIX_MQ_PRIO_MAX: u32 = 32; -pub const _POSIX_NAME_MAX: u32 = 14; -pub const _POSIX_NGROUPS_MAX: u32 = 0; -pub const _POSIX_OPEN_MAX: u32 = 16; -pub const _POSIX_FD_SETSIZE: u32 = 16; -pub const _POSIX_PATH_MAX: u32 = 256; -pub const _POSIX_PIPE_BUF: u32 = 512; -pub const _POSIX_RE_DUP_MAX: u32 = 255; -pub const _POSIX_RTSIG_MAX: u32 = 8; -pub const _POSIX_SEM_NSEMS_MAX: u32 = 256; -pub const _POSIX_SEM_VALUE_MAX: u32 = 32767; -pub const _POSIX_SIGQUEUE_MAX: u32 = 32; -pub const _POSIX_SSIZE_MAX: u32 = 32767; -pub const _POSIX_STREAM_MAX: u32 = 8; -pub const _POSIX_SYMLINK_MAX: u32 = 255; -pub const _POSIX_SYMLOOP_MAX: u32 = 8; -pub const _POSIX_TIMER_MAX: u32 = 32; -pub const _POSIX_TTY_NAME_MAX: u32 = 9; -pub const _POSIX_TZNAME_MAX: u32 = 3; -pub const _POSIX_QLIMIT: u32 = 1; -pub const _POSIX_HIWAT: u32 = 512; -pub const _POSIX_UIO_MAXIOV: u32 = 16; -pub const _POSIX_CLOCKRES_MIN: u32 = 20000000; -pub const NR_OPEN: u32 = 1024; -pub const NGROUPS_MAX: u32 = 65536; -pub const ARG_MAX: u32 = 131072; -pub const LINK_MAX: u32 = 127; -pub const MAX_CANON: u32 = 255; -pub const MAX_INPUT: u32 = 255; -pub const NAME_MAX: u32 = 255; -pub const PATH_MAX: u32 = 4096; -pub const PIPE_BUF: u32 = 4096; -pub const XATTR_NAME_MAX: u32 = 255; -pub const XATTR_SIZE_MAX: u32 = 65536; -pub const XATTR_LIST_MAX: u32 = 65536; -pub const RTSIG_MAX: u32 = 32; -pub const _POSIX_THREAD_KEYS_MAX: u32 = 128; -pub const PTHREAD_KEYS_MAX: u32 = 1024; -pub const _POSIX_THREAD_DESTRUCTOR_ITERATIONS: u32 = 4; -pub const PTHREAD_DESTRUCTOR_ITERATIONS: u32 = 4; -pub const _POSIX_THREAD_THREADS_MAX: u32 = 64; -pub const AIO_PRIO_DELTA_MAX: u32 = 20; -pub const PTHREAD_STACK_MIN: u32 = 16384; -pub const DELAYTIMER_MAX: u32 = 2147483647; -pub const TTY_NAME_MAX: u32 = 32; -pub const LOGIN_NAME_MAX: u32 = 256; -pub const HOST_NAME_MAX: u32 = 64; -pub const MQ_PRIO_MAX: u32 = 32768; -pub const SEM_VALUE_MAX: u32 = 2147483647; -pub const _BITS_POSIX2_LIM_H: u32 = 1; -pub const _POSIX2_BC_BASE_MAX: u32 = 99; -pub const _POSIX2_BC_DIM_MAX: u32 = 2048; -pub const _POSIX2_BC_SCALE_MAX: u32 = 99; -pub const _POSIX2_BC_STRING_MAX: u32 = 1000; -pub const _POSIX2_COLL_WEIGHTS_MAX: u32 = 2; -pub const _POSIX2_EXPR_NEST_MAX: u32 = 32; -pub const _POSIX2_LINE_MAX: u32 = 2048; -pub const _POSIX2_RE_DUP_MAX: u32 = 255; -pub const _POSIX2_CHARCLASS_NAME_MAX: u32 = 14; -pub const BC_BASE_MAX: u32 = 99; -pub const BC_DIM_MAX: u32 = 2048; -pub const BC_SCALE_MAX: u32 = 99; -pub const BC_STRING_MAX: u32 = 1000; -pub const COLL_WEIGHTS_MAX: u32 = 255; -pub const EXPR_NEST_MAX: u32 = 32; -pub const LINE_MAX: u32 = 2048; -pub const CHARCLASS_NAME_MAX: u32 = 2048; -pub const RE_DUP_MAX: u32 = 32767; -pub const _XOPEN_LIM_H: u32 = 1; -pub const _XOPEN_IOV_MAX: u32 = 16; -pub const _BITS_UIO_LIM_H: u32 = 1; -pub const __IOV_MAX: u32 = 1024; -pub const IOV_MAX: u32 = 1024; -pub const NL_ARGMAX: u32 = 4096; -pub const NL_LANGMAX: u32 = 2048; -pub const NZERO: u32 = 20; -pub const WORD_BIT: u32 = 32; -pub const LONG_BIT: u32 = 64; -pub const true_: u32 = 1; -pub const false_: u32 = 0; -pub const __bool_true_false_are_defined: u32 = 1; -pub const _BYTESWAP_H: u32 = 1; -pub const _BITS_BYTESWAP_H: u32 = 1; -pub const _NETINET_IN_H: u32 = 1; -pub const _SYS_SOCKET_H: u32 = 1; -pub const __iovec_defined: u32 = 1; -pub const _SYS_TYPES_H: u32 = 1; -pub const __clockid_t_defined: u32 = 1; -pub const __timer_t_defined: u32 = 1; -pub const __BIT_TYPES_DEFINED__: u32 = 1; -pub const PF_UNSPEC: u32 = 0; -pub const PF_LOCAL: u32 = 1; -pub const PF_UNIX: u32 = 1; -pub const PF_FILE: u32 = 1; -pub const PF_INET: u32 = 2; -pub const PF_AX25: u32 = 3; -pub const PF_IPX: u32 = 4; -pub const PF_APPLETALK: u32 = 5; -pub const PF_NETROM: u32 = 6; -pub const PF_BRIDGE: u32 = 7; -pub const PF_ATMPVC: u32 = 8; -pub const PF_X25: u32 = 9; -pub const PF_INET6: u32 = 10; -pub const PF_ROSE: u32 = 11; -pub const PF_DECnet: u32 = 12; -pub const PF_NETBEUI: u32 = 13; -pub const PF_SECURITY: u32 = 14; -pub const PF_KEY: u32 = 15; -pub const PF_NETLINK: u32 = 16; -pub const PF_ROUTE: u32 = 16; -pub const PF_PACKET: u32 = 17; -pub const PF_ASH: u32 = 18; -pub const PF_ECONET: u32 = 19; -pub const PF_ATMSVC: u32 = 20; -pub const PF_RDS: u32 = 21; -pub const PF_SNA: u32 = 22; -pub const PF_IRDA: u32 = 23; -pub const PF_PPPOX: u32 = 24; -pub const PF_WANPIPE: u32 = 25; -pub const PF_LLC: u32 = 26; -pub const PF_IB: u32 = 27; -pub const PF_MPLS: u32 = 28; -pub const PF_CAN: u32 = 29; -pub const PF_TIPC: u32 = 30; -pub const PF_BLUETOOTH: u32 = 31; -pub const PF_IUCV: u32 = 32; -pub const PF_RXRPC: u32 = 33; -pub const PF_ISDN: u32 = 34; -pub const PF_PHONET: u32 = 35; -pub const PF_IEEE802154: u32 = 36; -pub const PF_CAIF: u32 = 37; -pub const PF_ALG: u32 = 38; -pub const PF_NFC: u32 = 39; -pub const PF_VSOCK: u32 = 40; -pub const PF_KCM: u32 = 41; -pub const PF_QIPCRTR: u32 = 42; -pub const PF_SMC: u32 = 43; -pub const PF_XDP: u32 = 44; -pub const PF_MAX: u32 = 45; -pub const AF_UNSPEC: u32 = 0; -pub const AF_LOCAL: u32 = 1; -pub const AF_UNIX: u32 = 1; -pub const AF_FILE: u32 = 1; -pub const AF_INET: u32 = 2; -pub const AF_AX25: u32 = 3; -pub const AF_IPX: u32 = 4; -pub const AF_APPLETALK: u32 = 5; -pub const AF_NETROM: u32 = 6; -pub const AF_BRIDGE: u32 = 7; -pub const AF_ATMPVC: u32 = 8; -pub const AF_X25: u32 = 9; -pub const AF_INET6: u32 = 10; -pub const AF_ROSE: u32 = 11; -pub const AF_DECnet: u32 = 12; -pub const AF_NETBEUI: u32 = 13; -pub const AF_SECURITY: u32 = 14; -pub const AF_KEY: u32 = 15; -pub const AF_NETLINK: u32 = 16; -pub const AF_ROUTE: u32 = 16; -pub const AF_PACKET: u32 = 17; -pub const AF_ASH: u32 = 18; -pub const AF_ECONET: u32 = 19; -pub const AF_ATMSVC: u32 = 20; -pub const AF_RDS: u32 = 21; -pub const AF_SNA: u32 = 22; -pub const AF_IRDA: u32 = 23; -pub const AF_PPPOX: u32 = 24; -pub const AF_WANPIPE: u32 = 25; -pub const AF_LLC: u32 = 26; -pub const AF_IB: u32 = 27; -pub const AF_MPLS: u32 = 28; -pub const AF_CAN: u32 = 29; -pub const AF_TIPC: u32 = 30; -pub const AF_BLUETOOTH: u32 = 31; -pub const AF_IUCV: u32 = 32; -pub const AF_RXRPC: u32 = 33; -pub const AF_ISDN: u32 = 34; -pub const AF_PHONET: u32 = 35; -pub const AF_IEEE802154: u32 = 36; -pub const AF_CAIF: u32 = 37; -pub const AF_ALG: u32 = 38; -pub const AF_NFC: u32 = 39; -pub const AF_VSOCK: u32 = 40; -pub const AF_KCM: u32 = 41; -pub const AF_QIPCRTR: u32 = 42; -pub const AF_SMC: u32 = 43; -pub const AF_XDP: u32 = 44; -pub const AF_MAX: u32 = 45; -pub const SOL_RAW: u32 = 255; -pub const SOL_DECNET: u32 = 261; -pub const SOL_X25: u32 = 262; -pub const SOL_PACKET: u32 = 263; -pub const SOL_ATM: u32 = 264; -pub const SOL_AAL: u32 = 265; -pub const SOL_IRDA: u32 = 266; -pub const SOL_NETBEUI: u32 = 267; -pub const SOL_LLC: u32 = 268; -pub const SOL_DCCP: u32 = 269; -pub const SOL_NETLINK: u32 = 270; -pub const SOL_TIPC: u32 = 271; -pub const SOL_RXRPC: u32 = 272; -pub const SOL_PPPOL2TP: u32 = 273; -pub const SOL_BLUETOOTH: u32 = 274; -pub const SOL_PNPIPE: u32 = 275; -pub const SOL_RDS: u32 = 276; -pub const SOL_IUCV: u32 = 277; -pub const SOL_CAIF: u32 = 278; -pub const SOL_ALG: u32 = 279; -pub const SOL_NFC: u32 = 280; -pub const SOL_KCM: u32 = 281; -pub const SOL_TLS: u32 = 282; -pub const SOL_XDP: u32 = 283; -pub const SOMAXCONN: u32 = 4096; -pub const _BITS_SOCKADDR_H: u32 = 1; -pub const _SS_SIZE: u32 = 128; -pub const SO_DEBUG: u32 = 1; -pub const SOL_SOCKET: u32 = 1; -pub const SO_ACCEPTCONN: u32 = 30; -pub const SO_BROADCAST: u32 = 6; -pub const SO_DONTROUTE: u32 = 5; -pub const SO_ERROR: u32 = 4; -pub const SO_KEEPALIVE: u32 = 9; -pub const SO_LINGER: u32 = 13; -pub const SO_OOBINLINE: u32 = 10; -pub const SO_RCVBUF: u32 = 8; -pub const SO_RCVLOWAT: u32 = 18; -pub const SO_RCVTIMEO: u32 = 20; -pub const SO_REUSEADDR: u32 = 2; -pub const SO_SNDBUF: u32 = 7; -pub const SO_SNDLOWAT: u32 = 19; -pub const SO_SNDTIMEO: u32 = 21; -pub const SO_TYPE: u32 = 3; -pub const __USE_KERNEL_IPV6_DEFS: u32 = 0; -pub const IP_OPTIONS: u32 = 4; -pub const IP_HDRINCL: u32 = 3; -pub const IP_TOS: u32 = 1; -pub const IP_TTL: u32 = 2; -pub const IP_RECVOPTS: u32 = 6; -pub const IP_RETOPTS: u32 = 7; -pub const IP_MULTICAST_IF: u32 = 32; -pub const IP_MULTICAST_TTL: u32 = 33; -pub const IP_MULTICAST_LOOP: u32 = 34; -pub const IP_ADD_MEMBERSHIP: u32 = 35; -pub const IP_DROP_MEMBERSHIP: u32 = 36; -pub const IP_UNBLOCK_SOURCE: u32 = 37; -pub const IP_BLOCK_SOURCE: u32 = 38; -pub const IP_ADD_SOURCE_MEMBERSHIP: u32 = 39; -pub const IP_DROP_SOURCE_MEMBERSHIP: u32 = 40; -pub const IP_MSFILTER: u32 = 41; -pub const IP_ROUTER_ALERT: u32 = 5; -pub const IP_PKTINFO: u32 = 8; -pub const IP_PKTOPTIONS: u32 = 9; -pub const IP_PMTUDISC: u32 = 10; -pub const IP_MTU_DISCOVER: u32 = 10; -pub const IP_RECVERR: u32 = 11; -pub const IP_RECVTTL: u32 = 12; -pub const IP_RECVTOS: u32 = 13; -pub const IP_MTU: u32 = 14; -pub const IP_FREEBIND: u32 = 15; -pub const IP_IPSEC_POLICY: u32 = 16; -pub const IP_XFRM_POLICY: u32 = 17; -pub const IP_PASSSEC: u32 = 18; -pub const IP_TRANSPARENT: u32 = 19; -pub const IP_MULTICAST_ALL: u32 = 49; -pub const IP_ORIGDSTADDR: u32 = 20; -pub const IP_RECVORIGDSTADDR: u32 = 20; -pub const IP_MINTTL: u32 = 21; -pub const IP_NODEFRAG: u32 = 22; -pub const IP_CHECKSUM: u32 = 23; -pub const IP_BIND_ADDRESS_NO_PORT: u32 = 24; -pub const IP_RECVFRAGSIZE: u32 = 25; -pub const IP_PMTUDISC_DONT: u32 = 0; -pub const IP_PMTUDISC_WANT: u32 = 1; -pub const IP_PMTUDISC_DO: u32 = 2; -pub const IP_PMTUDISC_PROBE: u32 = 3; -pub const IP_PMTUDISC_INTERFACE: u32 = 4; -pub const IP_PMTUDISC_OMIT: u32 = 5; -pub const IP_UNICAST_IF: u32 = 50; -pub const SOL_IP: u32 = 0; -pub const IP_DEFAULT_MULTICAST_TTL: u32 = 1; -pub const IP_DEFAULT_MULTICAST_LOOP: u32 = 1; -pub const IP_MAX_MEMBERSHIPS: u32 = 20; -pub const IPV6_ADDRFORM: u32 = 1; -pub const IPV6_2292PKTINFO: u32 = 2; -pub const IPV6_2292HOPOPTS: u32 = 3; -pub const IPV6_2292DSTOPTS: u32 = 4; -pub const IPV6_2292RTHDR: u32 = 5; -pub const IPV6_2292PKTOPTIONS: u32 = 6; -pub const IPV6_CHECKSUM: u32 = 7; -pub const IPV6_2292HOPLIMIT: u32 = 8; -pub const IPV6_NEXTHOP: u32 = 9; -pub const IPV6_AUTHHDR: u32 = 10; -pub const IPV6_UNICAST_HOPS: u32 = 16; -pub const IPV6_MULTICAST_IF: u32 = 17; -pub const IPV6_MULTICAST_HOPS: u32 = 18; -pub const IPV6_MULTICAST_LOOP: u32 = 19; -pub const IPV6_JOIN_GROUP: u32 = 20; -pub const IPV6_LEAVE_GROUP: u32 = 21; -pub const IPV6_ROUTER_ALERT: u32 = 22; -pub const IPV6_MTU_DISCOVER: u32 = 23; -pub const IPV6_MTU: u32 = 24; -pub const IPV6_RECVERR: u32 = 25; -pub const IPV6_V6ONLY: u32 = 26; -pub const IPV6_JOIN_ANYCAST: u32 = 27; -pub const IPV6_LEAVE_ANYCAST: u32 = 28; -pub const IPV6_MULTICAST_ALL: u32 = 29; -pub const IPV6_ROUTER_ALERT_ISOLATE: u32 = 30; -pub const IPV6_IPSEC_POLICY: u32 = 34; -pub const IPV6_XFRM_POLICY: u32 = 35; -pub const IPV6_HDRINCL: u32 = 36; -pub const IPV6_RECVPKTINFO: u32 = 49; -pub const IPV6_PKTINFO: u32 = 50; -pub const IPV6_RECVHOPLIMIT: u32 = 51; -pub const IPV6_HOPLIMIT: u32 = 52; -pub const IPV6_RECVHOPOPTS: u32 = 53; -pub const IPV6_HOPOPTS: u32 = 54; -pub const IPV6_RTHDRDSTOPTS: u32 = 55; -pub const IPV6_RECVRTHDR: u32 = 56; -pub const IPV6_RTHDR: u32 = 57; -pub const IPV6_RECVDSTOPTS: u32 = 58; -pub const IPV6_DSTOPTS: u32 = 59; -pub const IPV6_RECVPATHMTU: u32 = 60; -pub const IPV6_PATHMTU: u32 = 61; -pub const IPV6_DONTFRAG: u32 = 62; -pub const IPV6_RECVTCLASS: u32 = 66; -pub const IPV6_TCLASS: u32 = 67; -pub const IPV6_AUTOFLOWLABEL: u32 = 70; -pub const IPV6_ADDR_PREFERENCES: u32 = 72; -pub const IPV6_MINHOPCOUNT: u32 = 73; -pub const IPV6_ORIGDSTADDR: u32 = 74; -pub const IPV6_RECVORIGDSTADDR: u32 = 74; -pub const IPV6_TRANSPARENT: u32 = 75; -pub const IPV6_UNICAST_IF: u32 = 76; -pub const IPV6_RECVFRAGSIZE: u32 = 77; -pub const IPV6_FREEBIND: u32 = 78; -pub const IPV6_ADD_MEMBERSHIP: u32 = 20; -pub const IPV6_DROP_MEMBERSHIP: u32 = 21; -pub const IPV6_RXHOPOPTS: u32 = 54; -pub const IPV6_RXDSTOPTS: u32 = 59; -pub const IPV6_PMTUDISC_DONT: u32 = 0; -pub const IPV6_PMTUDISC_WANT: u32 = 1; -pub const IPV6_PMTUDISC_DO: u32 = 2; -pub const IPV6_PMTUDISC_PROBE: u32 = 3; -pub const IPV6_PMTUDISC_INTERFACE: u32 = 4; -pub const IPV6_PMTUDISC_OMIT: u32 = 5; -pub const SOL_IPV6: u32 = 41; -pub const SOL_ICMPV6: u32 = 58; -pub const IPV6_RTHDR_LOOSE: u32 = 0; -pub const IPV6_RTHDR_STRICT: u32 = 1; -pub const IPV6_RTHDR_TYPE_0: u32 = 0; -pub const IN_CLASSA_NET: u32 = 4278190080; -pub const IN_CLASSA_NSHIFT: u32 = 24; -pub const IN_CLASSA_HOST: u32 = 16777215; -pub const IN_CLASSA_MAX: u32 = 128; -pub const IN_CLASSB_NET: u32 = 4294901760; -pub const IN_CLASSB_NSHIFT: u32 = 16; -pub const IN_CLASSB_HOST: u32 = 65535; -pub const IN_CLASSB_MAX: u32 = 65536; -pub const IN_CLASSC_NET: u32 = 4294967040; -pub const IN_CLASSC_NSHIFT: u32 = 8; -pub const IN_CLASSC_HOST: u32 = 255; -pub const IN_LOOPBACKNET: u32 = 127; -pub const INET_ADDRSTRLEN: u32 = 16; -pub const INET6_ADDRSTRLEN: u32 = 46; -pub const _ENDIAN_H: u32 = 1; -pub const _BITS_UINTN_IDENTITY_H: u32 = 1; -pub const NCKEY_ESC: u32 = 27; -pub const NCKEY_SPACE: u32 = 32; -pub const CELL_ALPHA_HIGHCONTRAST: u32 = 805306368; -pub const CELL_ALPHA_TRANSPARENT: u32 = 536870912; -pub const CELL_ALPHA_BLEND: u32 = 268435456; -pub const CELL_ALPHA_OPAQUE: u32 = 0; -pub const CELL_BGDEFAULT_MASK: u32 = 1073741824; -pub const CELL_FGDEFAULT_MASK: u64 = 4611686018427387904; -pub const CELL_BG_RGB_MASK: u32 = 16777215; -pub const CELL_FG_RGB_MASK: u64 = 72057589742960640; -pub const CELL_BG_PALETTE: u32 = 134217728; -pub const NCPALETTESIZE: u32 = 256; -pub const CELL_FG_PALETTE: u64 = 576460752303423488; -pub const CELL_BG_ALPHA_MASK: u32 = 805306368; -pub const CELL_FG_ALPHA_MASK: u64 = 3458764513820540928; -pub const NCSTYLE_MASK: u32 = 1023; -pub const NCSTYLE_STANDOUT: u32 = 128; -pub const NCSTYLE_UNDERLINE: u32 = 64; -pub const NCSTYLE_REVERSE: u32 = 32; -pub const NCSTYLE_BLINK: u32 = 16; -pub const NCSTYLE_DIM: u32 = 8; -pub const NCSTYLE_BOLD: u32 = 4; -pub const NCSTYLE_INVIS: u32 = 2; -pub const NCSTYLE_PROTECT: u32 = 1; -pub const NCSTYLE_ITALIC: u32 = 256; -pub const NCSTYLE_STRUCK: u32 = 512; -pub const NCSTYLE_NONE: u32 = 0; -pub const NCOPTION_INHIBIT_SETLOCALE: u32 = 1; -pub const NCOPTION_NO_CLEAR_BITMAPS: u32 = 2; -pub const NCOPTION_NO_WINCH_SIGHANDLER: u32 = 4; -pub const NCOPTION_NO_QUIT_SIGHANDLERS: u32 = 8; -pub const NCOPTION_SUPPRESS_BANNERS: u32 = 32; -pub const NCOPTION_NO_ALTERNATE_SCREEN: u32 = 64; -pub const NCOPTION_NO_FONT_CHANGES: u32 = 128; -pub const NCPLANE_OPTION_HORALIGNED: u32 = 1; -pub const NCPLANE_OPTION_VERALIGNED: u32 = 2; -pub const NCPLANE_OPTION_MARGINALIZED: u32 = 4; -pub const WCHAR_MAX_UTF8BYTES: u32 = 6; -pub const NCBOXMASK_TOP: u32 = 1; -pub const NCBOXMASK_RIGHT: u32 = 2; -pub const NCBOXMASK_BOTTOM: u32 = 4; -pub const NCBOXMASK_LEFT: u32 = 8; -pub const NCBOXGRAD_TOP: u32 = 16; -pub const NCBOXGRAD_RIGHT: u32 = 32; -pub const NCBOXGRAD_BOTTOM: u32 = 64; -pub const NCBOXGRAD_LEFT: u32 = 128; -pub const NCBOXCORNER_MASK: u32 = 768; -pub const NCBOXCORNER_SHIFT: u32 = 8; -pub const NCVISUAL_OPTION_NODEGRADE: u32 = 1; -pub const NCVISUAL_OPTION_BLEND: u32 = 2; -pub const NCVISUAL_OPTION_HORALIGNED: u32 = 4; -pub const NCVISUAL_OPTION_VERALIGNED: u32 = 8; -pub const NCVISUAL_OPTION_ADDALPHA: u32 = 16; -pub const NCREEL_OPTION_INFINITESCROLL: u32 = 1; -pub const NCREEL_OPTION_CIRCULAR: u32 = 2; -pub const PREFIXCOLUMNS: u32 = 7; -pub const IPREFIXCOLUMNS: u32 = 8; -pub const BPREFIXCOLUMNS: u32 = 9; -pub const PREFIXSTRLEN: u32 = 8; -pub const IPREFIXSTRLEN: u32 = 9; -pub const BPREFIXSTRLEN: u32 = 10; -pub const NCMENU_OPTION_BOTTOM: u32 = 1; -pub const NCMENU_OPTION_HIDING: u32 = 2; -pub const NCPROGBAR_OPTION_RETROGRADE: u32 = 1; -pub const NCTABBED_OPTION_BOTTOM: u32 = 1; -pub const NCPLOT_OPTION_LABELTICKSD: u32 = 1; -pub const NCPLOT_OPTION_EXPONENTIALD: u32 = 2; -pub const NCPLOT_OPTION_VERTICALI: u32 = 4; -pub const NCPLOT_OPTION_NODEGRADE: u32 = 8; -pub const NCPLOT_OPTION_DETECTMAXONLY: u32 = 16; -pub const NCPLOT_OPTION_PRINTSAMPLE: u32 = 32; -pub const NCREADER_OPTION_HORSCROLL: u32 = 1; -pub const NCREADER_OPTION_VERSCROLL: u32 = 2; -pub const NCREADER_OPTION_NOCMDKEYS: u32 = 4; -pub const NCREADER_OPTION_CURSOR: u32 = 8; -pub const NCDIRECT_OPTION_INHIBIT_SETLOCALE: u32 = 1; -pub const NCDIRECT_OPTION_INHIBIT_CBREAK: u32 = 2; -pub const NCDIRECT_OPTION_NO_QUIT_SIGHANDLERS: u32 = 8; -pub type size_t = cty::c_ulong; -#[doc = " Convenience types."] -pub type __u_char = cty::c_uchar; -pub type __u_short = cty::c_ushort; -pub type __u_int = cty::c_uint; -pub type __u_long = cty::c_ulong; -#[doc = " Fixed-size types, underlying types depend on word size and compiler."] -pub type __int8_t = cty::c_schar; -pub type __uint8_t = cty::c_uchar; -pub type __int16_t = cty::c_short; -pub type __uint16_t = cty::c_ushort; -pub type __int32_t = cty::c_int; -pub type __uint32_t = cty::c_uint; -pub type __int64_t = cty::c_long; -pub type __uint64_t = cty::c_ulong; -#[doc = " Smallest types with at least a given width."] -pub type __int_least8_t = __int8_t; -pub type __uint_least8_t = __uint8_t; -pub type __int_least16_t = __int16_t; -pub type __uint_least16_t = __uint16_t; -pub type __int_least32_t = __int32_t; -pub type __uint_least32_t = __uint32_t; -pub type __int_least64_t = __int64_t; -pub type __uint_least64_t = __uint64_t; -pub type __quad_t = cty::c_long; -pub type __u_quad_t = cty::c_ulong; -pub type __intmax_t = cty::c_long; -pub type __uintmax_t = cty::c_ulong; -pub type __dev_t = cty::c_ulong; -pub type __uid_t = cty::c_uint; -pub type __gid_t = cty::c_uint; -pub type __ino_t = cty::c_ulong; -pub type __ino64_t = cty::c_ulong; -pub type __mode_t = cty::c_uint; -pub type __nlink_t = cty::c_ulong; -pub type __off_t = cty::c_long; -pub type __off64_t = cty::c_long; -pub type __pid_t = cty::c_int; -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct __fsid_t { - pub __val: [cty::c_int; 2usize], -} -#[test] -fn bindgen_test_layout___fsid_t() { - assert_eq!( - ::core::mem::size_of::<__fsid_t>(), - 8usize, - concat!("Size of: ", stringify!(__fsid_t)) - ); - assert_eq!( - ::core::mem::align_of::<__fsid_t>(), - 4usize, - concat!("Alignment of ", stringify!(__fsid_t)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<__fsid_t>())).__val as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__fsid_t), - "::", - stringify!(__val) - ) - ); -} -pub type __clock_t = cty::c_long; -pub type __rlim_t = cty::c_ulong; -pub type __rlim64_t = cty::c_ulong; -pub type __id_t = cty::c_uint; -pub type __time_t = cty::c_long; -pub type __useconds_t = cty::c_uint; -pub type __suseconds_t = cty::c_long; -pub type __daddr_t = cty::c_int; -pub type __key_t = cty::c_int; -pub type __clockid_t = cty::c_int; -pub type __timer_t = *mut cty::c_void; -pub type __blksize_t = cty::c_long; -pub type __blkcnt_t = cty::c_long; -pub type __blkcnt64_t = cty::c_long; -pub type __fsblkcnt_t = cty::c_ulong; -pub type __fsblkcnt64_t = cty::c_ulong; -pub type __fsfilcnt_t = cty::c_ulong; -pub type __fsfilcnt64_t = cty::c_ulong; -pub type __fsword_t = cty::c_long; -pub type __ssize_t = cty::c_long; -pub type __syscall_slong_t = cty::c_long; -pub type __syscall_ulong_t = cty::c_ulong; -#[doc = " These few don't really vary by system, they always correspond"] -#[doc = "to one of the other defined types."] -pub type __loff_t = __off64_t; -pub type __caddr_t = *mut cty::c_char; -pub type __intptr_t = cty::c_long; -pub type __socklen_t = cty::c_uint; -#[doc = " C99: An integer type that can be accessed as an atomic entity,"] -#[doc = "even in the presence of asynchronous interrupts."] -#[doc = "It is not currently necessary for this to be machine-specific."] -pub type __sig_atomic_t = cty::c_int; -extern "C" { - #[doc = " Even though CLOCKS_PER_SEC has such a strange value CLK_TCK"] - #[doc = "presents the real value for clock ticks per second for the system."] - pub fn __sysconf(arg1: cty::c_int) -> cty::c_long; -} -#[doc = " Returned by `clock'."] -pub type clock_t = __clock_t; -#[doc = " Returned by `time'."] -pub type time_t = __time_t; -#[doc = " ISO C `broken-down time' structure."] -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct tm { - #[doc = " Seconds.\t[0-60] (1 leap second)"] - pub tm_sec: cty::c_int, - #[doc = " Minutes.\t[0-59]"] - pub tm_min: cty::c_int, - #[doc = " Hours.\t[0-23]"] - pub tm_hour: cty::c_int, - #[doc = " Day.\t\t[1-31]"] - pub tm_mday: cty::c_int, - #[doc = " Month.\t[0-11]"] - pub tm_mon: cty::c_int, - #[doc = " Year\t- 1900."] - pub tm_year: cty::c_int, - #[doc = " Day of week.\t[0-6]"] - pub tm_wday: cty::c_int, - #[doc = " Days in year.[0-365]"] - pub tm_yday: cty::c_int, - #[doc = " DST.\t\t[-1/0/1]"] - pub tm_isdst: cty::c_int, - #[doc = " Seconds east of UTC."] - pub __tm_gmtoff: cty::c_long, - #[doc = " Timezone abbreviation."] - pub __tm_zone: *const cty::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 Default for tm { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[doc = " POSIX.1b structure for a time value. This is like a `struct timeval' but"] -#[doc = "has nanoseconds instead of microseconds."] -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct timespec { - #[doc = " Seconds."] - pub tv_sec: __time_t, - #[doc = " Nanoseconds."] - pub tv_nsec: __syscall_slong_t, -} -#[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) - ) - ); -} -extern "C" { - #[doc = " Time used by the program so far (user time + system time)."] - #[doc = "The result / CLOCKS_PER_SEC is program time in seconds."] - pub fn clock() -> clock_t; -} -extern "C" { - #[doc = " Return the current time and put it in *TIMER if TIMER is not NULL."] - pub fn time(__timer: *mut time_t) -> time_t; -} -extern "C" { - #[doc = " Return the difference between TIME1 and TIME0."] - pub fn difftime(__time1: time_t, __time0: time_t) -> f64; -} -extern "C" { - #[doc = " Return the `time_t' representation of TP and normalize TP."] - pub fn mktime(__tp: *mut tm) -> time_t; -} -extern "C" { - #[doc = " Format TP into S according to FORMAT."] - #[doc = "Write no more than MAXSIZE characters and return the number"] - #[doc = "of characters written, or 0 if it would exceed MAXSIZE."] - pub fn strftime( - __s: *mut cty::c_char, - __maxsize: size_t, - __format: *const cty::c_char, - __tp: *const tm, - ) -> size_t; -} -extern "C" { - #[doc = " Parse S according to FORMAT and store binary time information in TP."] - #[doc = "The return value is a pointer to the first unparsed character in S."] - pub fn strptime( - __s: *const cty::c_char, - __fmt: *const cty::c_char, - __tp: *mut tm, - ) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Return the `struct tm' representation of *TIMER"] - #[doc = "in Universal Coordinated Time (aka Greenwich Mean Time)."] - pub fn gmtime(__timer: *const time_t) -> *mut tm; -} -extern "C" { - #[doc = " Return the `struct tm' representation"] - #[doc = "of *TIMER in the local timezone."] - pub fn localtime(__timer: *const time_t) -> *mut tm; -} -extern "C" { - #[doc = " Return the `struct tm' representation of *TIMER in UTC,"] - #[doc = "using *TP to store the result."] - pub fn gmtime_r(__timer: *const time_t, __tp: *mut tm) -> *mut tm; -} -extern "C" { - #[doc = " Return the `struct tm' representation of *TIMER in local time,"] - #[doc = "using *TP to store the result."] - pub fn localtime_r(__timer: *const time_t, __tp: *mut tm) -> *mut tm; -} -extern "C" { - #[doc = " Return a string of the form \"Day Mon dd hh:mm:ss yyyy\\n\""] - #[doc = "that is the representation of TP in this format."] - pub fn asctime(__tp: *const tm) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Equivalent to `asctime (localtime (timer))'."] - pub fn ctime(__timer: *const time_t) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Return in BUF a string of the form \"Day Mon dd hh:mm:ss yyyy\\n\""] - #[doc = "that is the representation of TP in this format."] - pub fn asctime_r(__tp: *const tm, __buf: *mut cty::c_char) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Equivalent to `asctime_r (localtime_r (timer, *TMP*), buf)'."] - pub fn ctime_r(__timer: *const time_t, __buf: *mut cty::c_char) -> *mut cty::c_char; -} -extern "C" { - pub static mut __tzname: [*mut cty::c_char; 2usize]; -} -extern "C" { - pub static mut __daylight: cty::c_int; -} -extern "C" { - pub static mut __timezone: cty::c_long; -} -extern "C" { - pub static mut tzname: [*mut cty::c_char; 2usize]; -} -extern "C" { - #[doc = " Set time conversion information from the TZ environment variable."] - #[doc = "If TZ is not defined, a locale-dependent default is used."] - pub fn tzset(); -} -extern "C" { - pub static mut daylight: cty::c_int; -} -extern "C" { - pub static mut timezone: cty::c_long; -} -extern "C" { - #[doc = " Set TS to calendar time based in time base BASE."] - pub fn timespec_get(__ts: *mut timespec, __base: cty::c_int) -> cty::c_int; -} -#[doc = " Conversion state information."] -#[repr(C)] -#[derive(Copy, Clone)] -pub struct __mbstate_t { - pub __count: cty::c_int, - #[doc = " Value so far."] - pub __value: __mbstate_t__bindgen_ty_1, -} -#[repr(C)] -#[derive(Copy, Clone)] -pub union __mbstate_t__bindgen_ty_1 { - pub __wch: cty::c_uint, - pub __wchb: [cty::c_char; 4usize], -} -#[test] -fn bindgen_test_layout___mbstate_t__bindgen_ty_1() { - assert_eq!( - ::core::mem::size_of::<__mbstate_t__bindgen_ty_1>(), - 4usize, - concat!("Size of: ", stringify!(__mbstate_t__bindgen_ty_1)) - ); - assert_eq!( - ::core::mem::align_of::<__mbstate_t__bindgen_ty_1>(), - 4usize, - concat!("Alignment of ", stringify!(__mbstate_t__bindgen_ty_1)) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::<__mbstate_t__bindgen_ty_1>())).__wch as *const _ as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__mbstate_t__bindgen_ty_1), - "::", - stringify!(__wch) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::<__mbstate_t__bindgen_ty_1>())).__wchb as *const _ as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__mbstate_t__bindgen_ty_1), - "::", - stringify!(__wchb) - ) - ); -} -impl Default for __mbstate_t__bindgen_ty_1 { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[test] -fn bindgen_test_layout___mbstate_t() { - assert_eq!( - ::core::mem::size_of::<__mbstate_t>(), - 8usize, - concat!("Size of: ", stringify!(__mbstate_t)) - ); - assert_eq!( - ::core::mem::align_of::<__mbstate_t>(), - 4usize, - concat!("Alignment of ", stringify!(__mbstate_t)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<__mbstate_t>())).__count as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__mbstate_t), - "::", - stringify!(__count) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<__mbstate_t>())).__value as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(__mbstate_t), - "::", - stringify!(__value) - ) - ); -} -impl Default for __mbstate_t { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -pub type mbstate_t = __mbstate_t; -#[doc = " Define the 16-bit and 32-bit character types."] -pub type char16_t = __uint_least16_t; -pub type char32_t = __uint_least32_t; -extern "C" { - #[doc = " Write char16_t representation of multibyte character pointed"] - #[doc = "to by S to PC16."] - pub fn mbrtoc16( - __pc16: *mut char16_t, - __s: *const cty::c_char, - __n: size_t, - __p: *mut mbstate_t, - ) -> size_t; -} -extern "C" { - #[doc = " Write multibyte representation of char16_t C16 to S."] - pub fn c16rtomb(__s: *mut cty::c_char, __c16: char16_t, __ps: *mut mbstate_t) -> size_t; -} -extern "C" { - #[doc = " Write char32_t representation of multibyte character pointed"] - #[doc = "to by S to PC32."] - pub fn mbrtoc32( - __pc32: *mut char32_t, - __s: *const cty::c_char, - __n: size_t, - __p: *mut mbstate_t, - ) -> size_t; -} -extern "C" { - #[doc = " Write multibyte representation of char32_t C32 to S."] - pub fn c32rtomb(__s: *mut cty::c_char, __c32: char32_t, __ps: *mut mbstate_t) -> size_t; -} -#[doc = " UPPERCASE."] -pub const _ISupper: cty::c_uint = 256; -#[doc = " lowercase."] -pub const _ISlower: cty::c_uint = 512; -#[doc = " Alphabetic."] -pub const _ISalpha: cty::c_uint = 1024; -#[doc = " Numeric."] -pub const _ISdigit: cty::c_uint = 2048; -#[doc = " Hexadecimal numeric."] -pub const _ISxdigit: cty::c_uint = 4096; -#[doc = " Whitespace."] -pub const _ISspace: cty::c_uint = 8192; -#[doc = " Printing."] -pub const _ISprint: cty::c_uint = 16384; -#[doc = " Graphical."] -pub const _ISgraph: cty::c_uint = 32768; -#[doc = " Blank (usually SPC and TAB)."] -pub const _ISblank: cty::c_uint = 1; -#[doc = " Control character."] -pub const _IScntrl: cty::c_uint = 2; -#[doc = " Punctuation."] -pub const _ISpunct: cty::c_uint = 4; -#[doc = " Alphanumeric."] -pub const _ISalnum: cty::c_uint = 8; -pub type _bindgen_ty_1 = cty::c_uint; -extern "C" { - #[doc = " These are defined in ctype-info.c."] - #[doc = "The declarations here must match those in localeinfo.h."] - #[doc = ""] - #[doc = "In the thread-specific locale model (see `uselocale' in )"] - #[doc = "we cannot use global variables for these as was done in the past."] - #[doc = "Instead, the following accessor functions return the address of"] - #[doc = "each variable, which is local to the current thread if multithreaded."] - #[doc = ""] - #[doc = "These point into arrays of 384, so they can be indexed by any `unsigned"] - #[doc = "char' value [0,255]; by EOF (-1); or by any `signed char' value"] - #[doc = "[-128,-1). ISO C requires that the ctype functions work for `unsigned"] - #[doc = "char' values and for EOF; we also support negative `signed char' values"] - #[doc = "for broken old programs. The case conversion arrays are of `int's"] - #[doc = "rather than `unsigned char's because tolower (EOF) must be EOF, which"] - #[doc = "doesn't fit into an `unsigned char'. But today more important is that"] - #[doc = "the arrays are also used for multi-byte character sets."] - pub fn __ctype_b_loc() -> *mut *const cty::c_ushort; -} -extern "C" { - pub fn __ctype_tolower_loc() -> *mut *const __int32_t; -} -extern "C" { - pub fn __ctype_toupper_loc() -> *mut *const __int32_t; -} -extern "C" { - pub fn isalnum(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn isalpha(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn iscntrl(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn isdigit(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn islower(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn isgraph(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn isprint(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn ispunct(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn isspace(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn isupper(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn isxdigit(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Return the lowercase version of C."] - pub fn tolower(__c: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Return the uppercase version of C."] - pub fn toupper(__c: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn isblank(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Return nonzero iff C is in the ASCII set"] - #[doc = "(i.e., is no more than 7 bits wide)."] - pub fn isascii(__c: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Return the part of C that is in the ASCII set"] - #[doc = "(i.e., the low-order 7 bits of C)."] - pub fn toascii(__c: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn _toupper(arg1: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn _tolower(arg1: cty::c_int) -> cty::c_int; -} -pub type _Float32 = f32; -pub type _Float64 = f64; -pub type _Float32x = f64; -pub type _Float64x = u128; -pub type wchar_t = cty::c_int; -pub type va_list = __builtin_va_list; -pub type __gnuc_va_list = __builtin_va_list; -pub type wint_t = cty::c_uint; -pub type __FILE = _IO_FILE; -#[doc = " Scalar type that can hold values which represent locale-specific"] -#[doc = "character classifications."] -pub type wctype_t = cty::c_ulong; -#[doc = " UPPERCASE."] -pub const __ISwupper: cty::c_int = 0; -#[doc = " lowercase."] -pub const __ISwlower: cty::c_int = 1; -#[doc = " Alphabetic."] -pub const __ISwalpha: cty::c_int = 2; -#[doc = " Numeric."] -pub const __ISwdigit: cty::c_int = 3; -#[doc = " Hexadecimal numeric."] -pub const __ISwxdigit: cty::c_int = 4; -#[doc = " Whitespace."] -pub const __ISwspace: cty::c_int = 5; -#[doc = " Printing."] -pub const __ISwprint: cty::c_int = 6; -#[doc = " Graphical."] -pub const __ISwgraph: cty::c_int = 7; -#[doc = " Blank (usually SPC and TAB)."] -pub const __ISwblank: cty::c_int = 8; -#[doc = " Control character."] -pub const __ISwcntrl: cty::c_int = 9; -#[doc = " Punctuation."] -pub const __ISwpunct: cty::c_int = 10; -#[doc = " Alphanumeric."] -pub const __ISwalnum: cty::c_int = 11; -#[doc = " UPPERCASE."] -pub const _ISwupper: cty::c_int = 16777216; -#[doc = " lowercase."] -pub const _ISwlower: cty::c_int = 33554432; -#[doc = " Alphabetic."] -pub const _ISwalpha: cty::c_int = 67108864; -#[doc = " Numeric."] -pub const _ISwdigit: cty::c_int = 134217728; -#[doc = " Hexadecimal numeric."] -pub const _ISwxdigit: cty::c_int = 268435456; -#[doc = " Whitespace."] -pub const _ISwspace: cty::c_int = 536870912; -#[doc = " Printing."] -pub const _ISwprint: cty::c_int = 1073741824; -#[doc = " Graphical."] -pub const _ISwgraph: cty::c_int = -2147483648; -#[doc = " Blank (usually SPC and TAB)."] -pub const _ISwblank: cty::c_int = 65536; -#[doc = " Control character."] -pub const _ISwcntrl: cty::c_int = 131072; -#[doc = " Punctuation."] -pub const _ISwpunct: cty::c_int = 262144; -#[doc = " Alphanumeric."] -pub const _ISwalnum: cty::c_int = 524288; -pub type _bindgen_ty_2 = cty::c_int; -extern "C" { - #[doc = " Test for any wide character for which `iswalpha' or `iswdigit' is"] - #[doc = "true."] - pub fn iswalnum(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any wide character for which `iswupper' or 'iswlower' is"] - #[doc = "true, or any wide character that is one of a locale-specific set of"] - #[doc = "wide-characters for which none of `iswcntrl', `iswdigit',"] - #[doc = "`iswpunct', or `iswspace' is true."] - pub fn iswalpha(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any control wide character."] - pub fn iswcntrl(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any wide character that corresponds to a decimal-digit"] - #[doc = "character."] - pub fn iswdigit(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any wide character for which `iswprint' is true and"] - #[doc = "`iswspace' is false."] - pub fn iswgraph(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any wide character that corresponds to a lowercase letter"] - #[doc = "or is one of a locale-specific set of wide characters for which"] - #[doc = "none of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true."] - pub fn iswlower(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any printing wide character."] - pub fn iswprint(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any printing wide character that is one of a"] - #[doc = "locale-specific et of wide characters for which neither `iswspace'"] - #[doc = "nor `iswalnum' is true."] - pub fn iswpunct(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any wide character that corresponds to a locale-specific"] - #[doc = "set of wide characters for which none of `iswalnum', `iswgraph', or"] - #[doc = "`iswpunct' is true."] - pub fn iswspace(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any wide character that corresponds to an uppercase letter"] - #[doc = "or is one of a locale-specific set of wide character for which none"] - #[doc = "of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true."] - pub fn iswupper(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Test for any wide character that corresponds to a hexadecimal-digit"] - #[doc = "character equivalent to that performed be the functions described"] - #[doc = "in the previous subclause."] - pub fn iswxdigit(__wc: wint_t) -> cty::c_int; -} -extern "C" { - pub fn iswblank(__wc: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Construct value that describes a class of wide characters identified"] - #[doc = "by the string argument PROPERTY."] - pub fn wctype(__property: *const cty::c_char) -> wctype_t; -} -extern "C" { - #[doc = " Determine whether the wide-character WC has the property described by"] - #[doc = "DESC."] - pub fn iswctype(__wc: wint_t, __desc: wctype_t) -> cty::c_int; -} -extern "C" { - #[doc = " Converts an uppercase letter to the corresponding lowercase letter."] - pub fn towlower(__wc: wint_t) -> wint_t; -} -extern "C" { - #[doc = " Converts an lowercase letter to the corresponding uppercase letter."] - pub fn towupper(__wc: wint_t) -> wint_t; -} -extern "C" { - #[doc = " Copy SRC to DEST."] - pub fn wcscpy(__dest: *mut wchar_t, __src: *const wchar_t) -> *mut wchar_t; -} -extern "C" { - #[doc = " Copy no more than N wide-characters of SRC to DEST."] - pub fn wcsncpy(__dest: *mut wchar_t, __src: *const wchar_t, __n: size_t) -> *mut wchar_t; -} -extern "C" { - #[doc = " Append SRC onto DEST."] - pub fn wcscat(__dest: *mut wchar_t, __src: *const wchar_t) -> *mut wchar_t; -} -extern "C" { - #[doc = " Append no more than N wide-characters of SRC onto DEST."] - pub fn wcsncat(__dest: *mut wchar_t, __src: *const wchar_t, __n: size_t) -> *mut wchar_t; -} -extern "C" { - #[doc = " Compare S1 and S2."] - pub fn wcscmp(__s1: *const cty::c_int, __s2: *const cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Compare N wide-characters of S1 and S2."] - pub fn wcsncmp( - __s1: *const cty::c_int, - __s2: *const cty::c_int, - __n: cty::c_ulong, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Compare S1 and S2, both interpreted as appropriate to the"] - #[doc = "LC_COLLATE category of the current locale."] - pub fn wcscoll(__s1: *const wchar_t, __s2: *const wchar_t) -> cty::c_int; -} -extern "C" { - #[doc = " Transform S2 into array pointed to by S1 such that if wcscmp is"] - #[doc = "applied to two transformed strings the result is the as applying"] - #[doc = "`wcscoll' to the original strings."] - pub fn wcsxfrm(__s1: *mut wchar_t, __s2: *const wchar_t, __n: size_t) -> size_t; -} -extern "C" { - pub fn wcschr(__wcs: *const cty::c_int, __wc: cty::c_int) -> *mut cty::c_int; -} -extern "C" { - pub fn wcsrchr(__wcs: *const wchar_t, __wc: wchar_t) -> *mut wchar_t; -} -extern "C" { - #[doc = " Return the length of the initial segmet of WCS which"] - #[doc = "consists entirely of wide characters not in REJECT."] - pub fn wcscspn(__wcs: *const wchar_t, __reject: *const wchar_t) -> size_t; -} -extern "C" { - #[doc = " Return the length of the initial segmet of WCS which"] - #[doc = "consists entirely of wide characters in ACCEPT."] - pub fn wcsspn(__wcs: *const wchar_t, __accept: *const wchar_t) -> size_t; -} -extern "C" { - pub fn wcspbrk(__wcs: *const wchar_t, __accept: *const wchar_t) -> *mut wchar_t; -} -extern "C" { - pub fn wcsstr(__haystack: *const wchar_t, __needle: *const wchar_t) -> *mut wchar_t; -} -extern "C" { - #[doc = " Divide WCS into tokens separated by characters in DELIM."] - pub fn wcstok( - __s: *mut wchar_t, - __delim: *const wchar_t, - __ptr: *mut *mut wchar_t, - ) -> *mut wchar_t; -} -extern "C" { - #[doc = " Return the number of wide characters in S."] - pub fn wcslen(__s: *const cty::c_int) -> cty::c_ulong; -} -extern "C" { - pub fn wcswcs(__haystack: *const wchar_t, __needle: *const wchar_t) -> *mut wchar_t; -} -extern "C" { - pub fn wmemchr(__s: *const cty::c_int, __c: cty::c_int, __n: cty::c_ulong) -> *mut cty::c_int; -} -extern "C" { - #[doc = " Compare N wide characters of S1 and S2."] - pub fn wmemcmp( - __s1: *const cty::c_int, - __s2: *const cty::c_int, - __n: cty::c_ulong, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Copy N wide characters of SRC to DEST."] - pub fn wmemcpy( - __s1: *mut cty::c_int, - __s2: *const cty::c_int, - __n: cty::c_ulong, - ) -> *mut cty::c_int; -} -extern "C" { - #[doc = " Copy N wide characters of SRC to DEST, guaranteeing"] - #[doc = "correct behavior for overlapping strings."] - pub fn wmemmove( - __s1: *mut cty::c_int, - __s2: *const cty::c_int, - __n: cty::c_ulong, - ) -> *mut cty::c_int; -} -extern "C" { - #[doc = " Set N wide characters of S to C."] - pub fn wmemset(__s: *mut wchar_t, __c: wchar_t, __n: size_t) -> *mut wchar_t; -} -extern "C" { - #[doc = " Determine whether C constitutes a valid (one-byte) multibyte"] - #[doc = "character."] - pub fn btowc(__c: cty::c_int) -> wint_t; -} -extern "C" { - #[doc = " Determine whether C corresponds to a member of the extended"] - #[doc = "character set whose multibyte representation is a single byte."] - pub fn wctob(__c: wint_t) -> cty::c_int; -} -extern "C" { - #[doc = " Determine whether PS points to an object representing the initial"] - #[doc = "state."] - pub fn mbsinit(__ps: *const mbstate_t) -> cty::c_int; -} -extern "C" { - #[doc = " Write wide character representation of multibyte character pointed"] - #[doc = "to by S to PWC."] - pub fn mbrtowc( - __pwc: *mut wchar_t, - __s: *const cty::c_char, - __n: size_t, - __p: *mut mbstate_t, - ) -> size_t; -} -extern "C" { - #[doc = " Write multibyte representation of wide character WC to S."] - pub fn wcrtomb(__s: *mut cty::c_char, __wc: wchar_t, __ps: *mut mbstate_t) -> size_t; -} -extern "C" { - #[doc = " Return number of bytes in multibyte character pointed to by S."] - pub fn __mbrlen(__s: *const cty::c_char, __n: size_t, __ps: *mut mbstate_t) -> size_t; -} -extern "C" { - pub fn mbrlen(__s: *const cty::c_char, __n: size_t, __ps: *mut mbstate_t) -> size_t; -} -extern "C" { - #[doc = " Write wide character representation of multibyte character string"] - #[doc = "SRC to DST."] - pub fn mbsrtowcs( - __dst: *mut wchar_t, - __src: *mut *const cty::c_char, - __len: size_t, - __ps: *mut mbstate_t, - ) -> size_t; -} -extern "C" { - #[doc = " Write multibyte character representation of wide character string"] - #[doc = "SRC to DST."] - pub fn wcsrtombs( - __dst: *mut cty::c_char, - __src: *mut *const wchar_t, - __len: size_t, - __ps: *mut mbstate_t, - ) -> size_t; -} -extern "C" { - #[doc = " Determine number of column positions required for C."] - pub fn wcwidth(__c: wchar_t) -> cty::c_int; -} -extern "C" { - #[doc = " Determine number of column positions required for first N wide"] - #[doc = "characters (or fewer if S ends before this) in S."] - pub fn wcswidth(__s: *const wchar_t, __n: size_t) -> cty::c_int; -} -extern "C" { - #[doc = " Convert initial portion of the wide string NPTR to `double'"] - #[doc = "representation."] - pub fn wcstod(__nptr: *const wchar_t, __endptr: *mut *mut wchar_t) -> f64; -} -extern "C" { - #[doc = " Likewise for `float' and `long double' sizes of floating-point numbers."] - pub fn wcstof(__nptr: *const wchar_t, __endptr: *mut *mut wchar_t) -> f32; -} -extern "C" { - #[doc = " Convert initial portion of wide string NPTR to `long int'"] - #[doc = "representation."] - pub fn wcstol( - __nptr: *const wchar_t, - __endptr: *mut *mut wchar_t, - __base: cty::c_int, - ) -> cty::c_long; -} -extern "C" { - #[doc = " Convert initial portion of wide string NPTR to `unsigned long int'"] - #[doc = "representation."] - pub fn wcstoul( - __nptr: *const wchar_t, - __endptr: *mut *mut wchar_t, - __base: cty::c_int, - ) -> cty::c_ulong; -} -extern "C" { - #[doc = " Convert initial portion of wide string NPTR to `long long int'"] - #[doc = "representation."] - pub fn wcstoll( - __nptr: *const wchar_t, - __endptr: *mut *mut wchar_t, - __base: cty::c_int, - ) -> cty::c_longlong; -} -extern "C" { - #[doc = " Convert initial portion of wide string NPTR to `unsigned long long int'"] - #[doc = "representation."] - pub fn wcstoull( - __nptr: *const wchar_t, - __endptr: *mut *mut wchar_t, - __base: cty::c_int, - ) -> cty::c_ulonglong; -} -extern "C" { - #[doc = " Select orientation for stream."] - pub fn fwide(__fp: *mut __FILE, __mode: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fwprintf(__stream: *mut __FILE, __format: *const wchar_t, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to stdout."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn wprintf(__format: *const wchar_t, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output of at most N characters to S."] - pub fn swprintf(__s: *mut wchar_t, __n: size_t, __format: *const wchar_t, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to S from argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn vfwprintf( - __s: *mut __FILE, - __format: *const wchar_t, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to stdout from argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn vwprintf(__format: *const wchar_t, __arg: *mut __va_list_tag) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output of at most N character to S from argument"] - #[doc = "list ARG."] - pub fn vswprintf( - __s: *mut wchar_t, - __n: size_t, - __format: *const wchar_t, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fwscanf(__stream: *mut __FILE, __format: *const wchar_t, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from stdin."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn wscanf(__format: *const wchar_t, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S."] - pub fn swscanf(__s: *const wchar_t, __format: *const wchar_t, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - #[link_name = "\u{1}__isoc99_fwscanf"] - pub fn fwscanf1(__stream: *mut __FILE, __format: *const wchar_t, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from stdin."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - #[link_name = "\u{1}__isoc99_wscanf"] - pub fn wscanf1(__format: *const wchar_t, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S."] - #[link_name = "\u{1}__isoc99_swscanf"] - pub fn swscanf1(__s: *const wchar_t, __format: *const wchar_t, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S into argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn vfwscanf( - __s: *mut __FILE, - __format: *const wchar_t, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from stdin into argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn vwscanf(__format: *const wchar_t, __arg: *mut __va_list_tag) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S into argument list ARG."] - pub fn vswscanf( - __s: *const wchar_t, - __format: *const wchar_t, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Read a character from STREAM."] - #[doc = ""] - #[doc = "These functions are possible cancellation points and therefore not"] - #[doc = "marked with __THROW."] - pub fn fgetwc(__stream: *mut __FILE) -> wint_t; -} -extern "C" { - pub fn getwc(__stream: *mut __FILE) -> wint_t; -} -extern "C" { - #[doc = " Read a character from stdin."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn getwchar() -> wint_t; -} -extern "C" { - #[doc = " Write a character to STREAM."] - #[doc = ""] - #[doc = "These functions are possible cancellation points and therefore not"] - #[doc = "marked with __THROW."] - pub fn fputwc(__wc: wchar_t, __stream: *mut __FILE) -> wint_t; -} -extern "C" { - pub fn putwc(__wc: wchar_t, __stream: *mut __FILE) -> wint_t; -} -extern "C" { - #[doc = " Write a character to stdout."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn putwchar(__wc: wchar_t) -> wint_t; -} -extern "C" { - #[doc = " Get a newline-terminated wide character string of finite length"] - #[doc = "from STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fgetws(__ws: *mut wchar_t, __n: cty::c_int, __stream: *mut __FILE) -> *mut wchar_t; -} -extern "C" { - #[doc = " Write a string to STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fputws(__ws: *const wchar_t, __stream: *mut __FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Push a character back onto the input buffer of STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn ungetwc(__wc: wint_t, __stream: *mut __FILE) -> wint_t; -} -extern "C" { - #[doc = " Format TP into S according to FORMAT."] - #[doc = "Write no more than MAXSIZE wide characters and return the number"] - #[doc = "of wide characters written, or 0 if it would exceed MAXSIZE."] - pub fn wcsftime( - __s: *mut wchar_t, - __maxsize: size_t, - __format: *const wchar_t, - __tp: *const tm, - ) -> size_t; -} -#[doc = " The tag name of this struct is _G_fpos_t to preserve historic"] -#[doc = "C++ mangled names for functions taking fpos_t arguments."] -#[doc = "That name should not be used in new code."] -#[repr(C)] -#[derive(Copy, Clone)] -pub struct _G_fpos_t { - pub __pos: __off_t, - pub __state: __mbstate_t, -} -#[test] -fn bindgen_test_layout__G_fpos_t() { - assert_eq!( - ::core::mem::size_of::<_G_fpos_t>(), - 16usize, - concat!("Size of: ", stringify!(_G_fpos_t)) - ); - assert_eq!( - ::core::mem::align_of::<_G_fpos_t>(), - 8usize, - concat!("Alignment of ", stringify!(_G_fpos_t)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_G_fpos_t>())).__pos as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(_G_fpos_t), - "::", - stringify!(__pos) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_G_fpos_t>())).__state as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(_G_fpos_t), - "::", - stringify!(__state) - ) - ); -} -impl Default for _G_fpos_t { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[doc = " The tag name of this struct is _G_fpos_t to preserve historic"] -#[doc = "C++ mangled names for functions taking fpos_t arguments."] -#[doc = "That name should not be used in new code."] -pub type __fpos_t = _G_fpos_t; -#[doc = " The tag name of this struct is _G_fpos64_t to preserve historic"] -#[doc = "C++ mangled names for functions taking fpos_t and/or fpos64_t"] -#[doc = "arguments. That name should not be used in new code."] -#[repr(C)] -#[derive(Copy, Clone)] -pub struct _G_fpos64_t { - pub __pos: __off64_t, - pub __state: __mbstate_t, -} -#[test] -fn bindgen_test_layout__G_fpos64_t() { - assert_eq!( - ::core::mem::size_of::<_G_fpos64_t>(), - 16usize, - concat!("Size of: ", stringify!(_G_fpos64_t)) - ); - assert_eq!( - ::core::mem::align_of::<_G_fpos64_t>(), - 8usize, - concat!("Alignment of ", stringify!(_G_fpos64_t)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_G_fpos64_t>())).__pos as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(_G_fpos64_t), - "::", - stringify!(__pos) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_G_fpos64_t>())).__state as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(_G_fpos64_t), - "::", - stringify!(__state) - ) - ); -} -impl Default for _G_fpos64_t { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[doc = " The tag name of this struct is _G_fpos64_t to preserve historic"] -#[doc = "C++ mangled names for functions taking fpos_t and/or fpos64_t"] -#[doc = "arguments. That name should not be used in new code."] -pub type __fpos64_t = _G_fpos64_t; -#[doc = " The opaque type of streams. This is the definition used elsewhere."] -pub type FILE = _IO_FILE; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct _IO_marker { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct _IO_codecvt { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct _IO_wide_data { - _unused: [u8; 0], -} -pub type _IO_lock_t = cty::c_void; -#[doc = " The tag name of this struct is _IO_FILE to preserve historic"] -#[doc = "C++ mangled names for functions taking FILE* arguments."] -#[doc = "That name should not be used in new code."] -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct _IO_FILE { - #[doc = " High-order word is _IO_MAGIC; rest is flags."] - pub _flags: cty::c_int, - #[doc = " Current read pointer"] - pub _IO_read_ptr: *mut cty::c_char, - #[doc = " End of get area."] - pub _IO_read_end: *mut cty::c_char, - #[doc = " Start of putback+get area."] - pub _IO_read_base: *mut cty::c_char, - #[doc = " Start of put area."] - pub _IO_write_base: *mut cty::c_char, - #[doc = " Current put pointer."] - pub _IO_write_ptr: *mut cty::c_char, - #[doc = " End of put area."] - pub _IO_write_end: *mut cty::c_char, - #[doc = " Start of reserve area."] - pub _IO_buf_base: *mut cty::c_char, - #[doc = " End of reserve area."] - pub _IO_buf_end: *mut cty::c_char, - #[doc = " Pointer to start of non-current get area."] - pub _IO_save_base: *mut cty::c_char, - #[doc = " Pointer to first valid character of backup area"] - pub _IO_backup_base: *mut cty::c_char, - #[doc = " Pointer to end of non-current get area."] - pub _IO_save_end: *mut cty::c_char, - pub _markers: *mut _IO_marker, - pub _chain: *mut _IO_FILE, - pub _fileno: cty::c_int, - pub _flags2: cty::c_int, - #[doc = " This used to be _offset but it's too small."] - pub _old_offset: __off_t, - #[doc = " 1+column number of pbase(); 0 is unknown."] - pub _cur_column: cty::c_ushort, - pub _vtable_offset: cty::c_schar, - pub _shortbuf: [cty::c_char; 1usize], - pub _lock: *mut _IO_lock_t, - pub _offset: __off64_t, - #[doc = " Wide character stream stuff."] - pub _codecvt: *mut _IO_codecvt, - pub _wide_data: *mut _IO_wide_data, - pub _freeres_list: *mut _IO_FILE, - pub _freeres_buf: *mut cty::c_void, - pub __pad5: size_t, - pub _mode: cty::c_int, - #[doc = " Make sure we don't get into trouble again."] - pub _unused2: [cty::c_char; 20usize], -} -#[test] -fn bindgen_test_layout__IO_FILE() { - assert_eq!( - ::core::mem::size_of::<_IO_FILE>(), - 216usize, - concat!("Size of: ", stringify!(_IO_FILE)) - ); - assert_eq!( - ::core::mem::align_of::<_IO_FILE>(), - 8usize, - concat!("Alignment of ", stringify!(_IO_FILE)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._flags as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_flags) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_read_ptr as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_read_ptr) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_read_end as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_read_end) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_read_base as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_read_base) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_write_base as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_write_base) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_write_ptr as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_write_ptr) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_write_end as *const _ as usize }, - 48usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_write_end) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_buf_base as *const _ as usize }, - 56usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_buf_base) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_buf_end as *const _ as usize }, - 64usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_buf_end) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_save_base as *const _ as usize }, - 72usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_save_base) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_backup_base as *const _ as usize }, - 80usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_backup_base) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_save_end as *const _ as usize }, - 88usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_save_end) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._markers as *const _ as usize }, - 96usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_markers) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._chain as *const _ as usize }, - 104usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_chain) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._fileno as *const _ as usize }, - 112usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_fileno) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._flags2 as *const _ as usize }, - 116usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_flags2) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._old_offset as *const _ as usize }, - 120usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_old_offset) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._cur_column as *const _ as usize }, - 128usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_cur_column) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._vtable_offset as *const _ as usize }, - 130usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_vtable_offset) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._shortbuf as *const _ as usize }, - 131usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_shortbuf) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._lock as *const _ as usize }, - 136usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_lock) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._offset as *const _ as usize }, - 144usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_offset) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._codecvt as *const _ as usize }, - 152usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_codecvt) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._wide_data as *const _ as usize }, - 160usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_wide_data) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._freeres_list as *const _ as usize }, - 168usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_freeres_list) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._freeres_buf as *const _ as usize }, - 176usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_freeres_buf) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>())).__pad5 as *const _ as usize }, - 184usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(__pad5) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._mode as *const _ as usize }, - 192usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_mode) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._unused2 as *const _ as usize }, - 196usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_unused2) - ) - ); -} -impl Default for _IO_FILE { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -pub type fpos_t = __fpos_t; -extern "C" { - pub static mut stdin: *mut FILE; -} -extern "C" { - pub static mut stdout: *mut FILE; -} -extern "C" { - pub static mut stderr: *mut FILE; -} -extern "C" { - #[doc = " Remove file FILENAME."] - pub fn remove(__filename: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Rename file OLD to NEW."] - pub fn rename(__old: *const cty::c_char, __new: *const cty::c_char) -> cty::c_int; -} -extern "C" { - pub fn tmpfile() -> *mut FILE; -} -extern "C" { - #[doc = " Generate a temporary filename."] - pub fn tmpnam(__s: *mut cty::c_char) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Generate a unique temporary filename using up to five characters of PFX"] - #[doc = "if it is not NULL. The directory to put this file in is searched for"] - #[doc = "as follows: First the environment variable \"TMPDIR\" is checked."] - #[doc = "If it contains the name of a writable directory, that directory is used."] - #[doc = "If not and if DIR is not NULL, that value is checked. If that fails,"] - #[doc = "P_tmpdir is tried and finally \"/tmp\". The storage for the filename"] - #[doc = "is allocated by `malloc'."] - pub fn tempnam(__dir: *const cty::c_char, __pfx: *const cty::c_char) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Close STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fclose(__stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Flush STREAM, or all streams if STREAM is NULL."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fflush(__stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Open a file and create a new stream for it."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fopen(__filename: *const cty::c_char, __modes: *const cty::c_char) -> *mut FILE; -} -extern "C" { - #[doc = " Open a file, replacing an existing stream with it."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn freopen( - __filename: *const cty::c_char, - __modes: *const cty::c_char, - __stream: *mut FILE, - ) -> *mut FILE; -} -extern "C" { - #[doc = " Create a new stream that refers to an existing system file descriptor."] - pub fn fdopen(__fd: cty::c_int, __modes: *const cty::c_char) -> *mut FILE; -} -extern "C" { - #[doc = " If BUF is NULL, make STREAM unbuffered."] - #[doc = "Else make it use buffer BUF, of size BUFSIZ."] - pub fn setbuf(__stream: *mut FILE, __buf: *mut cty::c_char); -} -extern "C" { - #[doc = " Make STREAM use buffering mode MODE."] - #[doc = "If BUF is not NULL, use N bytes of it for buffering;"] - #[doc = "else allocate an internal buffer N bytes long."] - pub fn setvbuf( - __stream: *mut FILE, - __buf: *mut cty::c_char, - __modes: cty::c_int, - __n: size_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fprintf(__stream: *mut FILE, __format: *const cty::c_char, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to stdout."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn printf(__format: *const cty::c_char, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to S."] - pub fn sprintf(__s: *mut cty::c_char, __format: *const cty::c_char, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to S from argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn vfprintf( - __s: *mut FILE, - __format: *const cty::c_char, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to stdout from argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn vprintf(__format: *const cty::c_char, __arg: *mut __va_list_tag) -> cty::c_int; -} -extern "C" { - #[doc = " Write formatted output to S from argument list ARG."] - pub fn vsprintf( - __s: *mut cty::c_char, - __format: *const cty::c_char, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Maximum chars of output to write in MAXLEN."] - pub fn snprintf( - __s: *mut cty::c_char, - __maxlen: cty::c_ulong, - __format: *const cty::c_char, - ... - ) -> cty::c_int; -} -extern "C" { - pub fn vsnprintf( - __s: *mut cty::c_char, - __maxlen: cty::c_ulong, - __format: *const cty::c_char, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fscanf(__stream: *mut FILE, __format: *const cty::c_char, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from stdin."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn scanf(__format: *const cty::c_char, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S."] - pub fn sscanf(__s: *const cty::c_char, __format: *const cty::c_char, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - #[link_name = "\u{1}__isoc99_fscanf"] - pub fn fscanf1(__stream: *mut FILE, __format: *const cty::c_char, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from stdin."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - #[link_name = "\u{1}__isoc99_scanf"] - pub fn scanf1(__format: *const cty::c_char, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S."] - #[link_name = "\u{1}__isoc99_sscanf"] - pub fn sscanf1(__s: *const cty::c_char, __format: *const cty::c_char, ...) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S into argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn vfscanf( - __s: *mut FILE, - __format: *const cty::c_char, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from stdin into argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn vscanf(__format: *const cty::c_char, __arg: *mut __va_list_tag) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S into argument list ARG."] - pub fn vsscanf( - __s: *const cty::c_char, - __format: *const cty::c_char, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S into argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - #[link_name = "\u{1}__isoc99_vfscanf"] - pub fn vfscanf1( - __s: *mut FILE, - __format: *const cty::c_char, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from stdin into argument list ARG."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - #[link_name = "\u{1}__isoc99_vscanf"] - pub fn vscanf1(__format: *const cty::c_char, __arg: *mut __va_list_tag) -> cty::c_int; -} -extern "C" { - #[doc = " Read formatted input from S into argument list ARG."] - #[link_name = "\u{1}__isoc99_vsscanf"] - pub fn vsscanf1( - __s: *const cty::c_char, - __format: *const cty::c_char, - __arg: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Read a character from STREAM."] - #[doc = ""] - #[doc = "These functions are possible cancellation points and therefore not"] - #[doc = "marked with __THROW."] - pub fn fgetc(__stream: *mut FILE) -> cty::c_int; -} -extern "C" { - pub fn getc(__stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Read a character from stdin."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn getchar() -> cty::c_int; -} -extern "C" { - #[doc = " Write a character to STREAM."] - #[doc = ""] - #[doc = "These functions are possible cancellation points and therefore not"] - #[doc = "marked with __THROW."] - #[doc = ""] - #[doc = "These functions is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fputc(__c: cty::c_int, __stream: *mut FILE) -> cty::c_int; -} -extern "C" { - pub fn putc(__c: cty::c_int, __stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Write a character to stdout."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn putchar(__c: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Get a word (int) from STREAM."] - pub fn getw(__stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Write a word (int) to STREAM."] - pub fn putw(__w: cty::c_int, __stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Get a newline-terminated string of finite length from STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fgets(__s: *mut cty::c_char, __n: cty::c_int, __stream: *mut FILE) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Write a string to STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fputs(__s: *const cty::c_char, __stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Write a string, followed by a newline, to stdout."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn puts(__s: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Push a character back onto the input buffer of STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn ungetc(__c: cty::c_int, __stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Read chunks of generic data from STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fread( - __ptr: *mut cty::c_void, - __size: cty::c_ulong, - __n: cty::c_ulong, - __stream: *mut FILE, - ) -> cty::c_ulong; -} -extern "C" { - #[doc = " Write chunks of generic data to STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fwrite( - __ptr: *const cty::c_void, - __size: cty::c_ulong, - __n: cty::c_ulong, - __s: *mut FILE, - ) -> cty::c_ulong; -} -extern "C" { - #[doc = " Seek to a certain position on STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fseek(__stream: *mut FILE, __off: cty::c_long, __whence: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Return the current position of STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn ftell(__stream: *mut FILE) -> cty::c_long; -} -extern "C" { - #[doc = " Rewind to the beginning of STREAM."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn rewind(__stream: *mut FILE); -} -extern "C" { - #[doc = " Get STREAM's position."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fgetpos(__stream: *mut FILE, __pos: *mut fpos_t) -> cty::c_int; -} -extern "C" { - #[doc = " Set STREAM's position."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn fsetpos(__stream: *mut FILE, __pos: *const fpos_t) -> cty::c_int; -} -extern "C" { - #[doc = " Clear the error and EOF indicators for STREAM."] - pub fn clearerr(__stream: *mut FILE); -} -extern "C" { - #[doc = " Return the EOF indicator for STREAM."] - pub fn feof(__stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Return the error indicator for STREAM."] - pub fn ferror(__stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Print a message describing the meaning of the value of errno."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn perror(__s: *const cty::c_char); -} -extern "C" { - #[doc = " Return the system file descriptor for STREAM."] - pub fn fileno(__stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Create a new stream connected to a pipe running the given command."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn popen(__command: *const cty::c_char, __modes: *const cty::c_char) -> *mut FILE; -} -extern "C" { - #[doc = " Close a stream opened by popen and return the status of its child."] - #[doc = ""] - #[doc = "This function is a possible cancellation point and therefore not"] - #[doc = "marked with __THROW."] - pub fn pclose(__stream: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Return the name of the controlling terminal."] - pub fn ctermid(__s: *mut cty::c_char) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Return the name of the current user."] - pub fn cuserid(__s: *mut cty::c_char) -> *mut cty::c_char; -} -extern "C" { - pub static mut optarg: *mut cty::c_char; -} -extern "C" { - pub static mut optind: cty::c_int; -} -extern "C" { - pub static mut opterr: cty::c_int; -} -extern "C" { - pub static mut optopt: cty::c_int; -} -extern "C" { - #[doc = " Get definitions and prototypes for functions to process the"] - #[doc = "arguments in ARGV (ARGC of them, minus the program name) for"] - #[doc = "options given in OPTS."] - #[doc = ""] - #[doc = "Return the option character from OPTS just read. Return -1 when"] - #[doc = "there are no more options. For unrecognized options, or options"] - #[doc = "missing arguments, 'optopt' is set to the option letter, and '?' is"] - #[doc = "returned."] - #[doc = ""] - #[doc = "The OPTS string is a list of characters which are recognized option"] - #[doc = "letters, optionally followed by colons, specifying that that letter"] - #[doc = "takes an argument, to be placed in 'optarg'."] - #[doc = ""] - #[doc = "If a letter in OPTS is followed by two colons, its argument is"] - #[doc = "optional. This behavior is specific to the GNU 'getopt'."] - #[doc = ""] - #[doc = "The argument '--' causes premature termination of argument"] - #[doc = "scanning, explicitly telling 'getopt' that there are no more"] - #[doc = "options."] - #[doc = ""] - #[doc = "If OPTS begins with '-', then non-option arguments are treated as"] - #[doc = "arguments to the option '\\1'. This behavior is specific to the GNU"] - #[doc = "'getopt'. If OPTS begins with '+', or POSIXLY_CORRECT is set in"] - #[doc = "the environment, then do not permute arguments."] - #[doc = ""] - #[doc = "For standards compliance, the 'argv' argument has the type"] - #[doc = "char *const *, but this is inaccurate; if argument permutation is"] - #[doc = "enabled, the argv array (not the strings it points to) must be"] - #[doc = "writable."] - pub fn getopt( - ___argc: cty::c_int, - ___argv: *const *mut cty::c_char, - __shortopts: *const cty::c_char, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Slow-path routines used by the optimized inline functions in"] - #[doc = "bits/stdio.h."] - pub fn __uflow(arg1: *mut FILE) -> cty::c_int; -} -extern "C" { - pub fn __overflow(arg1: *mut FILE, arg2: cty::c_int) -> cty::c_int; -} -#[doc = " Signed."] -pub type int_least8_t = __int_least8_t; -pub type int_least16_t = __int_least16_t; -pub type int_least32_t = __int_least32_t; -pub type int_least64_t = __int_least64_t; -#[doc = " Unsigned."] -pub type uint_least8_t = __uint_least8_t; -pub type uint_least16_t = __uint_least16_t; -pub type uint_least32_t = __uint_least32_t; -pub type uint_least64_t = __uint_least64_t; -#[doc = " Signed."] -pub type int_fast8_t = cty::c_schar; -pub type int_fast16_t = cty::c_long; -pub type int_fast32_t = cty::c_long; -pub type int_fast64_t = cty::c_long; -#[doc = " Unsigned."] -pub type uint_fast8_t = cty::c_uchar; -pub type uint_fast16_t = cty::c_ulong; -pub type uint_fast32_t = cty::c_ulong; -pub type uint_fast64_t = cty::c_ulong; -#[doc = " Largest integral types."] -pub type intmax_t = __intmax_t; -pub type uintmax_t = __uintmax_t; -#[doc = " Returned by `div'."] -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct div_t { - #[doc = " Quotient."] - pub quot: cty::c_int, - #[doc = " Remainder."] - pub rem: cty::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) - ) - ); -} -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ldiv_t { - #[doc = " Quotient."] - pub quot: cty::c_long, - #[doc = " Remainder."] - pub rem: cty::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) - ) - ); -} -#[doc = " Returned by `lldiv'."] -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct lldiv_t { - #[doc = " Quotient."] - pub quot: cty::c_longlong, - #[doc = " Remainder."] - pub rem: cty::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) - ) - ); -} -extern "C" { - pub fn __ctype_get_mb_cur_max() -> size_t; -} -extern "C" { - #[doc = " Convert a string to a floating-point number."] - pub fn atof(__nptr: *const cty::c_char) -> f64; -} -extern "C" { - #[doc = " Convert a string to an integer."] - pub fn atoi(__nptr: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Convert a string to a long integer."] - pub fn atol(__nptr: *const cty::c_char) -> cty::c_long; -} -extern "C" { - #[doc = " Convert a string to a long long integer."] - pub fn atoll(__nptr: *const cty::c_char) -> cty::c_longlong; -} -extern "C" { - #[doc = " Convert a string to a floating-point number."] - pub fn strtod(__nptr: *const cty::c_char, __endptr: *mut *mut cty::c_char) -> f64; -} -extern "C" { - #[doc = " Likewise for `float' and `long double' sizes of floating-point numbers."] - pub fn strtof(__nptr: *const cty::c_char, __endptr: *mut *mut cty::c_char) -> f32; -} -extern "C" { - #[doc = " Convert a string to a long integer."] - pub fn strtol( - __nptr: *const cty::c_char, - __endptr: *mut *mut cty::c_char, - __base: cty::c_int, - ) -> cty::c_long; -} -extern "C" { - #[doc = " Convert a string to an unsigned long integer."] - pub fn strtoul( - __nptr: *const cty::c_char, - __endptr: *mut *mut cty::c_char, - __base: cty::c_int, - ) -> cty::c_ulong; -} -extern "C" { - #[doc = " Convert a string to a quadword integer."] - pub fn strtoll( - __nptr: *const cty::c_char, - __endptr: *mut *mut cty::c_char, - __base: cty::c_int, - ) -> cty::c_longlong; -} -extern "C" { - #[doc = " Convert a string to an unsigned quadword integer."] - pub fn strtoull( - __nptr: *const cty::c_char, - __endptr: *mut *mut cty::c_char, - __base: cty::c_int, - ) -> cty::c_ulonglong; -} -extern "C" { - #[doc = " Return a random integer between 0 and RAND_MAX inclusive."] - pub fn rand() -> cty::c_int; -} -extern "C" { - #[doc = " Seed the random number generator with the given number."] - pub fn srand(__seed: cty::c_uint); -} -extern "C" { - #[doc = " Return non-negative, double-precision floating-point value in [0.0,1.0)."] - pub fn drand48() -> f64; -} -extern "C" { - pub fn erand48(__xsubi: *mut cty::c_ushort) -> f64; -} -extern "C" { - #[doc = " Return non-negative, long integer in [0,2^31)."] - pub fn lrand48() -> cty::c_long; -} -extern "C" { - pub fn nrand48(__xsubi: *mut cty::c_ushort) -> cty::c_long; -} -extern "C" { - #[doc = " Return signed, long integers in [-2^31,2^31)."] - pub fn mrand48() -> cty::c_long; -} -extern "C" { - pub fn jrand48(__xsubi: *mut cty::c_ushort) -> cty::c_long; -} -extern "C" { - #[doc = " Seed random number generator."] - pub fn srand48(__seedval: cty::c_long); -} -extern "C" { - pub fn seed48(__seed16v: *mut cty::c_ushort) -> *mut cty::c_ushort; -} -extern "C" { - pub fn lcong48(__param: *mut cty::c_ushort); -} -extern "C" { - #[doc = " Allocate SIZE bytes of memory."] - pub fn malloc(__size: cty::c_ulong) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Allocate NMEMB elements of SIZE bytes each, all initialized to 0."] - pub fn calloc(__nmemb: cty::c_ulong, __size: cty::c_ulong) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Re-allocate the previously allocated block"] - #[doc = "in PTR, making the new block SIZE bytes long. */"] - #[doc = "the same pointer that was passed to it, aliasing needs to be allowed"] - #[doc = "between objects pointed by the old and new pointers."] - pub fn realloc(__ptr: *mut cty::c_void, __size: cty::c_ulong) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Free a block allocated by `malloc', `realloc' or `calloc'."] - pub fn free(__ptr: *mut cty::c_void); -} -extern "C" { - #[doc = " ISO C variant of aligned allocation."] - pub fn aligned_alloc(__alignment: size_t, __size: size_t) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Abort execution and generate a core-dump."] - pub fn abort(); -} -extern "C" { - #[doc = " Register a function to be called when `exit' is called."] - pub fn atexit(__func: ::core::option::Option) -> cty::c_int; -} -extern "C" { - pub fn at_quick_exit(__func: ::core::option::Option) -> cty::c_int; -} -extern "C" { - #[doc = " Call all functions registered with `atexit' and `on_exit',"] - #[doc = "in the reverse of the order in which they were registered,"] - #[doc = "perform stdio cleanup, and terminate program execution with STATUS."] - pub fn exit(__status: cty::c_int); -} -extern "C" { - #[doc = " Call all functions registered with `at_quick_exit' in the reverse"] - #[doc = "of the order in which they were registered and terminate program"] - #[doc = "execution with STATUS."] - pub fn quick_exit(__status: cty::c_int); -} -extern "C" { - #[doc = " Terminate the program with STATUS without calling any of the"] - #[doc = "functions registered with `atexit' or `on_exit'."] - pub fn _Exit(__status: cty::c_int); -} -extern "C" { - #[doc = " Return the value of envariable NAME, or NULL if it doesn't exist."] - pub fn getenv(__name: *const cty::c_char) -> *mut cty::c_char; -} -extern "C" { - #[doc = " The SVID says this is in , but this seems a better place.\t*/"] - #[doc = "If there is no `=', remove NAME from the environment."] - pub fn putenv(__string: *mut cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Execute the given line as a shell command."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn system(__command: *const cty::c_char) -> cty::c_int; -} -pub type __compar_fn_t = ::core::option::Option< - unsafe extern "C" fn(arg1: *const cty::c_void, arg2: *const cty::c_void) -> cty::c_int, ->; -extern "C" { - #[doc = " Do a binary search for KEY in BASE, which consists of NMEMB elements"] - #[doc = "of SIZE bytes each, using COMPAR to perform the comparisons."] - pub fn bsearch( - __key: *const cty::c_void, - __base: *const cty::c_void, - __nmemb: size_t, - __size: size_t, - __compar: __compar_fn_t, - ) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Sort NMEMB elements of BASE, of SIZE bytes each,"] - #[doc = "using COMPAR to perform the comparisons."] - pub fn qsort( - __base: *mut cty::c_void, - __nmemb: size_t, - __size: size_t, - __compar: __compar_fn_t, - ); -} -extern "C" { - #[doc = " Return the absolute value of X."] - pub fn abs(__x: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn labs(__x: cty::c_long) -> cty::c_long; -} -extern "C" { - pub fn llabs(__x: cty::c_longlong) -> cty::c_longlong; -} -extern "C" { - #[doc = " Return the `div_t', `ldiv_t' or `lldiv_t' representation"] - #[doc = "of the value of NUMER over DENOM. */"] - pub fn div(__numer: cty::c_int, __denom: cty::c_int) -> div_t; -} -extern "C" { - pub fn ldiv(__numer: cty::c_long, __denom: cty::c_long) -> ldiv_t; -} -extern "C" { - pub fn lldiv(__numer: cty::c_longlong, __denom: cty::c_longlong) -> lldiv_t; -} -extern "C" { - #[doc = " Return the length of the multibyte character"] - #[doc = "in S, which is no longer than N."] - pub fn mblen(__s: *const cty::c_char, __n: size_t) -> cty::c_int; -} -extern "C" { - #[doc = " Return the length of the given multibyte character,"] - #[doc = "putting its `wchar_t' representation in *PWC."] - pub fn mbtowc(__pwc: *mut wchar_t, __s: *const cty::c_char, __n: size_t) -> cty::c_int; -} -extern "C" { - #[doc = " Put the multibyte character represented"] - #[doc = "by WCHAR in S, returning its length."] - pub fn wctomb(__s: *mut cty::c_char, __wchar: wchar_t) -> cty::c_int; -} -extern "C" { - #[doc = " Convert a multibyte string to a wide char string."] - pub fn mbstowcs(__pwcs: *mut wchar_t, __s: *const cty::c_char, __n: size_t) -> size_t; -} -extern "C" { - #[doc = " Convert a wide char string to multibyte string."] - pub fn wcstombs(__s: *mut cty::c_char, __pwcs: *const wchar_t, __n: size_t) -> size_t; -} -extern "C" { - #[doc = " Copy N bytes of SRC to DEST."] - pub fn memcpy( - __dest: *mut cty::c_void, - __src: *const cty::c_void, - __n: cty::c_ulong, - ) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Copy N bytes of SRC to DEST, guaranteeing"] - #[doc = "correct behavior for overlapping strings."] - pub fn memmove( - __dest: *mut cty::c_void, - __src: *const cty::c_void, - __n: cty::c_ulong, - ) -> *mut cty::c_void; -} -extern "C" { - pub fn memccpy( - __dest: *mut cty::c_void, - __src: *const cty::c_void, - __c: cty::c_int, - __n: cty::c_ulong, - ) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Set N bytes of S to C."] - pub fn memset(__s: *mut cty::c_void, __c: cty::c_int, __n: cty::c_ulong) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Compare N bytes of S1 and S2."] - pub fn memcmp( - __s1: *const cty::c_void, - __s2: *const cty::c_void, - __n: cty::c_ulong, - ) -> cty::c_int; -} -extern "C" { - pub fn memchr(__s: *const cty::c_void, __c: cty::c_int, __n: cty::c_ulong) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Copy SRC to DEST."] - pub fn strcpy(__dest: *mut cty::c_char, __src: *const cty::c_char) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Copy no more than N characters of SRC to DEST."] - pub fn strncpy( - __dest: *mut cty::c_char, - __src: *const cty::c_char, - __n: cty::c_ulong, - ) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Append SRC onto DEST."] - pub fn strcat(__dest: *mut cty::c_char, __src: *const cty::c_char) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Append no more than N characters from SRC onto DEST."] - pub fn strncat( - __dest: *mut cty::c_char, - __src: *const cty::c_char, - __n: cty::c_ulong, - ) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Compare S1 and S2."] - pub fn strcmp(__s1: *const cty::c_char, __s2: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Compare N characters of S1 and S2."] - pub fn strncmp( - __s1: *const cty::c_char, - __s2: *const cty::c_char, - __n: cty::c_ulong, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Compare the collated forms of S1 and S2."] - pub fn strcoll(__s1: *const cty::c_char, __s2: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Put a transformation of SRC into no more than N bytes of DEST."] - pub fn strxfrm( - __dest: *mut cty::c_char, - __src: *const cty::c_char, - __n: cty::c_ulong, - ) -> cty::c_ulong; -} -extern "C" { - pub fn strchr(__s: *const cty::c_char, __c: cty::c_int) -> *mut cty::c_char; -} -extern "C" { - pub fn strrchr(__s: *const cty::c_char, __c: cty::c_int) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Return the length of the initial segment of S which"] - #[doc = "consists entirely of characters not in REJECT."] - pub fn strcspn(__s: *const cty::c_char, __reject: *const cty::c_char) -> cty::c_ulong; -} -extern "C" { - #[doc = " Return the length of the initial segment of S which"] - #[doc = "consists entirely of characters in ACCEPT."] - pub fn strspn(__s: *const cty::c_char, __accept: *const cty::c_char) -> cty::c_ulong; -} -extern "C" { - pub fn strpbrk(__s: *const cty::c_char, __accept: *const cty::c_char) -> *mut cty::c_char; -} -extern "C" { - pub fn strstr(__haystack: *const cty::c_char, __needle: *const cty::c_char) - -> *mut cty::c_char; -} -extern "C" { - #[doc = " Divide S into tokens separated by characters in DELIM."] - pub fn strtok(__s: *mut cty::c_char, __delim: *const cty::c_char) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Divide S into tokens separated by characters in DELIM. Information"] - #[doc = "passed between calls are stored in SAVE_PTR."] - pub fn __strtok_r( - __s: *mut cty::c_char, - __delim: *const cty::c_char, - __save_ptr: *mut *mut cty::c_char, - ) -> *mut cty::c_char; -} -extern "C" { - pub fn strtok_r( - __s: *mut cty::c_char, - __delim: *const cty::c_char, - __save_ptr: *mut *mut cty::c_char, - ) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Return the length of S."] - pub fn strlen(__s: *const cty::c_char) -> cty::c_ulong; -} -extern "C" { - #[doc = " Return a string describing the meaning of the `errno' code in ERRNUM."] - pub fn strerror(__errnum: cty::c_int) -> *mut cty::c_char; -} -#[doc = " An integral type that can be modified atomically, without the"] -#[doc = "possibility of a signal arriving in the middle of the operation."] -pub type sig_atomic_t = __sig_atomic_t; -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct __sigset_t { - pub __val: [cty::c_ulong; 16usize], -} -#[test] -fn bindgen_test_layout___sigset_t() { - assert_eq!( - ::core::mem::size_of::<__sigset_t>(), - 128usize, - concat!("Size of: ", stringify!(__sigset_t)) - ); - assert_eq!( - ::core::mem::align_of::<__sigset_t>(), - 8usize, - concat!("Alignment of ", stringify!(__sigset_t)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<__sigset_t>())).__val as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__sigset_t), - "::", - stringify!(__val) - ) - ); -} -#[doc = " A set of signals to be blocked, unblocked, or waited for."] -pub type sigset_t = __sigset_t; -pub type pid_t = __pid_t; -pub type uid_t = __uid_t; -#[doc = " Type of a signal handler."] -pub type __sighandler_t = ::core::option::Option; -extern "C" { - #[doc = " The X/Open definition of `signal' specifies the SVID semantic. Use"] - #[doc = "the additional function `sysv_signal' when X/Open compatibility is"] - #[doc = "requested."] - pub fn __sysv_signal(__sig: cty::c_int, __handler: __sighandler_t) -> __sighandler_t; -} -extern "C" { - pub fn kill(__pid: __pid_t, __sig: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Raise signal SIG, i.e., send SIG to yourself."] - pub fn raise(__sig: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Clear all signals from SET."] - pub fn sigemptyset(__set: *mut sigset_t) -> cty::c_int; -} -extern "C" { - #[doc = " Set all signals in SET."] - pub fn sigfillset(__set: *mut sigset_t) -> cty::c_int; -} -extern "C" { - #[doc = " Add SIGNO to SET."] - pub fn sigaddset(__set: *mut sigset_t, __signo: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Remove SIGNO from SET."] - pub fn sigdelset(__set: *mut sigset_t, __signo: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Return 1 if SIGNO is in SET, 0 if not."] - pub fn sigismember(__set: *const sigset_t, __signo: cty::c_int) -> cty::c_int; -} -#[doc = " Structure describing the action to be taken when a signal arrives."] -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct sigaction { - pub sa_handler: __sighandler_t, - #[doc = " Additional set of signals to be blocked."] - pub sa_mask: __sigset_t, - #[doc = " Special flags."] - pub sa_flags: cty::c_int, - #[doc = " Restore handler."] - pub sa_restorer: ::core::option::Option, -} -#[test] -fn bindgen_test_layout_sigaction() { - assert_eq!( - ::core::mem::size_of::(), - 152usize, - concat!("Size of: ", stringify!(sigaction)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(sigaction)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sa_handler as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(sigaction), - "::", - stringify!(sa_handler) - ) - ); - 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 }, - 136usize, - concat!( - "Offset of field: ", - stringify!(sigaction), - "::", - stringify!(sa_flags) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sa_restorer as *const _ as usize }, - 144usize, - concat!( - "Offset of field: ", - stringify!(sigaction), - "::", - stringify!(sa_restorer) - ) - ); -} -extern "C" { - #[doc = " Get and/or change the set of blocked signals."] - pub fn sigprocmask( - __how: cty::c_int, - __set: *const sigset_t, - __oset: *mut sigset_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Change the set of blocked signals to SET,"] - #[doc = "wait until a signal arrives, and restore the set of blocked signals."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn sigsuspend(__set: *const sigset_t) -> cty::c_int; -} -extern "C" { - #[doc = " Get and/or set the action for signal SIG."] - pub fn sigaction( - __sig: cty::c_int, - __act: *const sigaction, - __oact: *mut sigaction, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Put in SET all signals that are blocked and waiting to be delivered."] - pub fn sigpending(__set: *mut sigset_t) -> cty::c_int; -} -extern "C" { - #[doc = " Return number of available real-time signal with highest priority."] - pub fn __libc_current_sigrtmin() -> cty::c_int; -} -extern "C" { - #[doc = " Return number of available real-time signal with lowest priority."] - pub fn __libc_current_sigrtmax() -> cty::c_int; -} -#[doc = " Structure for scatter/gather I/O."] -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct iovec { - #[doc = " Pointer to data."] - pub iov_base: *mut cty::c_void, - #[doc = " Length of data."] - pub iov_len: size_t, -} -#[test] -fn bindgen_test_layout_iovec() { - assert_eq!( - ::core::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(iovec)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(iovec)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).iov_base as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(iovec), - "::", - stringify!(iov_base) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).iov_len as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(iovec), - "::", - stringify!(iov_len) - ) - ); -} -impl Default for iovec { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -pub type ino_t = __ino_t; -pub type dev_t = __dev_t; -pub type gid_t = __gid_t; -pub type mode_t = __mode_t; -pub type nlink_t = __nlink_t; -pub type off_t = __off_t; -pub type id_t = __id_t; -pub type ssize_t = __ssize_t; -pub type key_t = __key_t; -#[doc = " Clock ID used in clock and timer functions."] -pub type clockid_t = __clockid_t; -#[doc = " Timer ID returned by `timer_create'."] -pub type timer_t = __timer_t; -pub type useconds_t = __useconds_t; -pub type suseconds_t = __suseconds_t; -#[doc = " These were defined by ISO C without the first `_'."] -pub type u_int8_t = __uint8_t; -pub type u_int16_t = __uint16_t; -pub type u_int32_t = __uint32_t; -pub type u_int64_t = __uint64_t; -pub type register_t = cty::c_long; -pub type blkcnt_t = __blkcnt_t; -pub type fsblkcnt_t = __fsblkcnt_t; -pub type fsfilcnt_t = __fsfilcnt_t; -pub type socklen_t = __socklen_t; -#[doc = " Sequenced, reliable, connection-based"] -#[doc = "byte streams."] -pub const __socket_type_SOCK_STREAM: __socket_type = 1; -#[doc = " Connectionless, unreliable datagrams"] -#[doc = "of fixed maximum length."] -pub const __socket_type_SOCK_DGRAM: __socket_type = 2; -#[doc = " Raw protocol interface."] -pub const __socket_type_SOCK_RAW: __socket_type = 3; -#[doc = " Reliably-delivered messages."] -pub const __socket_type_SOCK_RDM: __socket_type = 4; -#[doc = " Sequenced, reliable, connection-based,"] -#[doc = "datagrams of fixed maximum length."] -pub const __socket_type_SOCK_SEQPACKET: __socket_type = 5; -#[doc = " Datagram Congestion Control Protocol."] -pub const __socket_type_SOCK_DCCP: __socket_type = 6; -#[doc = " Linux specific way of getting packets"] -#[doc = "at the dev level. For writing rarp and"] -#[doc = "other similar things on the user level."] -pub const __socket_type_SOCK_PACKET: __socket_type = 10; -#[doc = " Atomically set close-on-exec flag for the"] -#[doc = "new descriptor(s)."] -pub const __socket_type_SOCK_CLOEXEC: __socket_type = 524288; -#[doc = " Atomically mark descriptor(s) as"] -#[doc = "non-blocking."] -pub const __socket_type_SOCK_NONBLOCK: __socket_type = 2048; -#[doc = " Types of sockets."] -pub type __socket_type = cty::c_uint; -#[doc = " POSIX.1g specifies this type name for the `sa_family' member."] -pub type sa_family_t = cty::c_ushort; -#[doc = " Structure describing a generic socket address."] -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct sockaddr { - pub sa_family: sa_family_t, - #[doc = " Address data."] - pub sa_data: [cty::c_char; 14usize], -} -#[test] -fn bindgen_test_layout_sockaddr() { - assert_eq!( - ::core::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(sockaddr)) - ); - assert_eq!( - ::core::mem::align_of::(), - 2usize, - concat!("Alignment of ", stringify!(sockaddr)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sa_family as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(sockaddr), - "::", - stringify!(sa_family) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sa_data as *const _ as usize }, - 2usize, - concat!( - "Offset of field: ", - stringify!(sockaddr), - "::", - stringify!(sa_data) - ) - ); -} -#[repr(C)] -#[derive(Copy, Clone)] -pub struct sockaddr_storage { - pub ss_family: sa_family_t, - pub __ss_padding: [cty::c_char; 118usize], - #[doc = " Force desired alignment."] - pub __ss_align: cty::c_ulong, -} -#[test] -fn bindgen_test_layout_sockaddr_storage() { - assert_eq!( - ::core::mem::size_of::(), - 128usize, - concat!("Size of: ", stringify!(sockaddr_storage)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(sockaddr_storage)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).ss_family as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_storage), - "::", - stringify!(ss_family) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).__ss_padding as *const _ as usize }, - 2usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_storage), - "::", - stringify!(__ss_padding) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).__ss_align as *const _ as usize }, - 120usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_storage), - "::", - stringify!(__ss_align) - ) - ); -} -impl Default for sockaddr_storage { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[doc = " Process out-of-band data."] -pub const MSG_OOB: cty::c_uint = 1; -#[doc = " Peek at incoming messages."] -pub const MSG_PEEK: cty::c_uint = 2; -#[doc = " Don't use local routing."] -pub const MSG_DONTROUTE: cty::c_uint = 4; -#[doc = " Control data lost before delivery."] -pub const MSG_CTRUNC: cty::c_uint = 8; -#[doc = " Supply or ask second address."] -pub const MSG_PROXY: cty::c_uint = 16; -pub const MSG_TRUNC: cty::c_uint = 32; -#[doc = " Nonblocking IO."] -pub const MSG_DONTWAIT: cty::c_uint = 64; -#[doc = " End of record."] -pub const MSG_EOR: cty::c_uint = 128; -#[doc = " Wait for a full request."] -pub const MSG_WAITALL: cty::c_uint = 256; -pub const MSG_FIN: cty::c_uint = 512; -pub const MSG_SYN: cty::c_uint = 1024; -#[doc = " Confirm path validity."] -pub const MSG_CONFIRM: cty::c_uint = 2048; -pub const MSG_RST: cty::c_uint = 4096; -#[doc = " Fetch message from error queue."] -pub const MSG_ERRQUEUE: cty::c_uint = 8192; -#[doc = " Do not generate SIGPIPE."] -pub const MSG_NOSIGNAL: cty::c_uint = 16384; -#[doc = " Sender will send more."] -pub const MSG_MORE: cty::c_uint = 32768; -#[doc = " Wait for at least one packet to return."] -pub const MSG_WAITFORONE: cty::c_uint = 65536; -#[doc = " sendmmsg: more messages coming."] -pub const MSG_BATCH: cty::c_uint = 262144; -#[doc = " Use user data in kernel path."] -pub const MSG_ZEROCOPY: cty::c_uint = 67108864; -#[doc = " Send data in TCP SYN."] -pub const MSG_FASTOPEN: cty::c_uint = 536870912; -#[doc = " Set close_on_exit for file"] -#[doc = "descriptor received through"] -#[doc = "SCM_RIGHTS."] -pub const MSG_CMSG_CLOEXEC: cty::c_uint = 1073741824; -#[doc = " Bits in the FLAGS argument to `send', `recv', et al."] -pub type _bindgen_ty_3 = cty::c_uint; -#[doc = " Structure describing messages sent by"] -#[doc = "`sendmsg' and received by `recvmsg'."] -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct msghdr { - #[doc = " Address to send to/receive from."] - pub msg_name: *mut cty::c_void, - #[doc = " Length of address data."] - pub msg_namelen: socklen_t, - #[doc = " Vector of data to send/receive into."] - pub msg_iov: *mut iovec, - #[doc = " Number of elements in the vector."] - pub msg_iovlen: size_t, - #[doc = " Ancillary data (eg BSD filedesc passing)."] - pub msg_control: *mut cty::c_void, - #[doc = " Ancillary data buffer length."] - #[doc = " The type should be socklen_t but the"] - #[doc = "definition of the kernel is incompatible"] - #[doc = "with this."] - pub msg_controllen: size_t, - #[doc = " Flags on received message."] - pub msg_flags: cty::c_int, -} -#[test] -fn bindgen_test_layout_msghdr() { - assert_eq!( - ::core::mem::size_of::(), - 56usize, - concat!("Size of: ", stringify!(msghdr)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(msghdr)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).msg_name as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(msghdr), - "::", - stringify!(msg_name) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).msg_namelen as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(msghdr), - "::", - stringify!(msg_namelen) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).msg_iov as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(msghdr), - "::", - stringify!(msg_iov) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).msg_iovlen as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(msghdr), - "::", - stringify!(msg_iovlen) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).msg_control as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(msghdr), - "::", - stringify!(msg_control) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).msg_controllen as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(msghdr), - "::", - stringify!(msg_controllen) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).msg_flags as *const _ as usize }, - 48usize, - concat!( - "Offset of field: ", - stringify!(msghdr), - "::", - stringify!(msg_flags) - ) - ); -} -impl Default for msghdr { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[doc = " Structure used for storage of ancillary data object information."] -#[repr(C)] -#[derive(Debug, Default)] -pub struct cmsghdr { - #[doc = " Length of data in cmsg_data plus length"] - #[doc = "of cmsghdr structure."] - #[doc = " The type should be socklen_t but the"] - #[doc = "definition of the kernel is incompatible"] - #[doc = "with this."] - pub cmsg_len: size_t, - #[doc = " Originating protocol."] - pub cmsg_level: cty::c_int, - #[doc = " Protocol specific type."] - pub cmsg_type: cty::c_int, - #[doc = " Ancillary data."] - pub __cmsg_data: __IncompleteArrayField, -} -#[test] -fn bindgen_test_layout_cmsghdr() { - assert_eq!( - ::core::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(cmsghdr)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(cmsghdr)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).cmsg_len as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(cmsghdr), - "::", - stringify!(cmsg_len) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).cmsg_level as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(cmsghdr), - "::", - stringify!(cmsg_level) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).cmsg_type as *const _ as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(cmsghdr), - "::", - stringify!(cmsg_type) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).__cmsg_data as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(cmsghdr), - "::", - stringify!(__cmsg_data) - ) - ); -} -extern "C" { - pub fn __cmsg_nxthdr(__mhdr: *mut msghdr, __cmsg: *mut cmsghdr) -> *mut cmsghdr; -} -#[doc = " Transfer file descriptors."] -pub const SCM_RIGHTS: cty::c_uint = 1; -#[doc = " Socket level message types. This must match the definitions in"] -#[doc = "."] -pub type _bindgen_ty_4 = cty::c_uint; -#[doc = " Structure used to manipulate the SO_LINGER option."] -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct linger { - #[doc = " Nonzero to linger on close."] - pub l_onoff: cty::c_int, - #[doc = " Time to linger."] - pub l_linger: cty::c_int, -} -#[test] -fn bindgen_test_layout_linger() { - assert_eq!( - ::core::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(linger)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(linger)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).l_onoff as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(linger), - "::", - stringify!(l_onoff) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).l_linger as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(linger), - "::", - stringify!(l_linger) - ) - ); -} -#[doc = " No more receptions."] -pub const SHUT_RD: cty::c_uint = 0; -#[doc = " No more transmissions."] -pub const SHUT_WR: cty::c_uint = 1; -#[doc = " No more receptions or transmissions."] -pub const SHUT_RDWR: cty::c_uint = 2; -#[doc = " The following constants should be used for the second parameter of"] -#[doc = "`shutdown'."] -pub type _bindgen_ty_5 = cty::c_uint; -extern "C" { - #[doc = " Create a new socket of type TYPE in domain DOMAIN, using"] - #[doc = "protocol PROTOCOL. If PROTOCOL is zero, one is chosen automatically."] - #[doc = "Returns a file descriptor for the new socket, or -1 for errors."] - pub fn socket(__domain: cty::c_int, __type: cty::c_int, __protocol: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Create two new sockets, of type TYPE in domain DOMAIN and using"] - #[doc = "protocol PROTOCOL, which are connected to each other, and put file"] - #[doc = "descriptors for them in FDS[0] and FDS[1]. If PROTOCOL is zero,"] - #[doc = "one will be chosen automatically. Returns 0 on success, -1 for errors."] - pub fn socketpair( - __domain: cty::c_int, - __type: cty::c_int, - __protocol: cty::c_int, - __fds: *mut cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Give the socket FD the local address ADDR (which is LEN bytes long)."] - pub fn bind(__fd: cty::c_int, __addr: *const sockaddr, __len: socklen_t) -> cty::c_int; -} -extern "C" { - #[doc = " Put the local address of FD into *ADDR and its length in *LEN."] - pub fn getsockname( - __fd: cty::c_int, - __addr: *mut sockaddr, - __len: *mut socklen_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Open a connection on socket FD to peer at ADDR (which LEN bytes long)."] - #[doc = "For connectionless socket types, just set the default address to send to"] - #[doc = "and the only address from which to accept transmissions."] - #[doc = "Return 0 on success, -1 for errors."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn connect(__fd: cty::c_int, __addr: *const sockaddr, __len: socklen_t) -> cty::c_int; -} -extern "C" { - #[doc = " Put the address of the peer connected to socket FD into *ADDR"] - #[doc = "(which is *LEN bytes long), and its actual length into *LEN."] - pub fn getpeername( - __fd: cty::c_int, - __addr: *mut sockaddr, - __len: *mut socklen_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Send N bytes of BUF to socket FD. Returns the number sent or -1."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn send( - __fd: cty::c_int, - __buf: *const cty::c_void, - __n: size_t, - __flags: cty::c_int, - ) -> ssize_t; -} -extern "C" { - #[doc = " Read N bytes into BUF from socket FD."] - #[doc = "Returns the number read or -1 for errors."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn recv( - __fd: cty::c_int, - __buf: *mut cty::c_void, - __n: size_t, - __flags: cty::c_int, - ) -> ssize_t; -} -extern "C" { - #[doc = " Send N bytes of BUF on socket FD to peer at address ADDR (which is"] - #[doc = "ADDR_LEN bytes long). Returns the number sent, or -1 for errors."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn sendto( - __fd: cty::c_int, - __buf: *const cty::c_void, - __n: size_t, - __flags: cty::c_int, - __addr: *const sockaddr, - __addr_len: socklen_t, - ) -> ssize_t; -} -extern "C" { - #[doc = " Read N bytes into BUF through socket FD."] - #[doc = "If ADDR is not NULL, fill in *ADDR_LEN bytes of it with tha address of"] - #[doc = "the sender, and store the actual size of the address in *ADDR_LEN."] - #[doc = "Returns the number of bytes read or -1 for errors."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn recvfrom( - __fd: cty::c_int, - __buf: *mut cty::c_void, - __n: size_t, - __flags: cty::c_int, - __addr: *mut sockaddr, - __addr_len: *mut socklen_t, - ) -> ssize_t; -} -extern "C" { - #[doc = " Send a message described MESSAGE on socket FD."] - #[doc = "Returns the number of bytes sent, or -1 for errors."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn sendmsg(__fd: cty::c_int, __message: *const msghdr, __flags: cty::c_int) -> ssize_t; -} -extern "C" { - #[doc = " Receive a message as described by MESSAGE from socket FD."] - #[doc = "Returns the number of bytes read or -1 for errors."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn recvmsg(__fd: cty::c_int, __message: *mut msghdr, __flags: cty::c_int) -> ssize_t; -} -extern "C" { - #[doc = " Put the current value for socket FD's option OPTNAME at protocol level LEVEL"] - #[doc = "into OPTVAL (which is *OPTLEN bytes long), and set *OPTLEN to the value's"] - #[doc = "actual length. Returns 0 on success, -1 for errors."] - pub fn getsockopt( - __fd: cty::c_int, - __level: cty::c_int, - __optname: cty::c_int, - __optval: *mut cty::c_void, - __optlen: *mut socklen_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Set socket FD's option OPTNAME at protocol level LEVEL"] - #[doc = "to *OPTVAL (which is OPTLEN bytes long)."] - #[doc = "Returns 0 on success, -1 for errors."] - pub fn setsockopt( - __fd: cty::c_int, - __level: cty::c_int, - __optname: cty::c_int, - __optval: *const cty::c_void, - __optlen: socklen_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Prepare to accept connections on socket FD."] - #[doc = "N connection requests will be queued before further requests are refused."] - #[doc = "Returns 0 on success, -1 for errors."] - pub fn listen(__fd: cty::c_int, __n: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Await a connection on socket FD."] - #[doc = "When a connection arrives, open a new socket to communicate with it,"] - #[doc = "set *ADDR (which is *ADDR_LEN bytes long) to the address of the connecting"] - #[doc = "peer and *ADDR_LEN to the address's actual length, and return the"] - #[doc = "new socket's descriptor, or -1 for errors."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn accept( - __fd: cty::c_int, - __addr: *mut sockaddr, - __addr_len: *mut socklen_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Shut down all or part of the connection open on socket FD."] - #[doc = "HOW determines what to shut down:"] - #[doc = "SHUT_RD = No more receptions;"] - #[doc = "SHUT_WR = No more transmissions;"] - #[doc = "SHUT_RDWR = No more receptions or transmissions."] - #[doc = "Returns 0 on success, -1 for errors."] - pub fn shutdown(__fd: cty::c_int, __how: cty::c_int) -> cty::c_int; -} -#[doc = " Internet address."] -pub type in_addr_t = u32; -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct in_addr { - pub s_addr: in_addr_t, -} -#[test] -fn bindgen_test_layout_in_addr() { - assert_eq!( - ::core::mem::size_of::(), - 4usize, - concat!("Size of: ", stringify!(in_addr)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(in_addr)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).s_addr as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(in_addr), - "::", - stringify!(s_addr) - ) - ); -} -#[doc = " Dummy protocol for TCP."] -pub const IPPROTO_IP: cty::c_uint = 0; -#[doc = " Internet Control Message Protocol."] -pub const IPPROTO_ICMP: cty::c_uint = 1; -#[doc = " Internet Group Management Protocol."] -pub const IPPROTO_IGMP: cty::c_uint = 2; -#[doc = " IPIP tunnels (older KA9Q tunnels use 94)."] -pub const IPPROTO_IPIP: cty::c_uint = 4; -#[doc = " Transmission Control Protocol."] -pub const IPPROTO_TCP: cty::c_uint = 6; -#[doc = " Exterior Gateway Protocol."] -pub const IPPROTO_EGP: cty::c_uint = 8; -#[doc = " PUP protocol."] -pub const IPPROTO_PUP: cty::c_uint = 12; -#[doc = " User Datagram Protocol."] -pub const IPPROTO_UDP: cty::c_uint = 17; -#[doc = " XNS IDP protocol."] -pub const IPPROTO_IDP: cty::c_uint = 22; -#[doc = " SO Transport Protocol Class 4."] -pub const IPPROTO_TP: cty::c_uint = 29; -#[doc = " Datagram Congestion Control Protocol."] -pub const IPPROTO_DCCP: cty::c_uint = 33; -#[doc = " IPv6 header."] -pub const IPPROTO_IPV6: cty::c_uint = 41; -#[doc = " Reservation Protocol."] -pub const IPPROTO_RSVP: cty::c_uint = 46; -#[doc = " General Routing Encapsulation."] -pub const IPPROTO_GRE: cty::c_uint = 47; -#[doc = " encapsulating security payload."] -pub const IPPROTO_ESP: cty::c_uint = 50; -#[doc = " authentication header."] -pub const IPPROTO_AH: cty::c_uint = 51; -#[doc = " Multicast Transport Protocol."] -pub const IPPROTO_MTP: cty::c_uint = 92; -#[doc = " IP option pseudo header for BEET."] -pub const IPPROTO_BEETPH: cty::c_uint = 94; -#[doc = " Encapsulation Header."] -pub const IPPROTO_ENCAP: cty::c_uint = 98; -#[doc = " Protocol Independent Multicast."] -pub const IPPROTO_PIM: cty::c_uint = 103; -#[doc = " Compression Header Protocol."] -pub const IPPROTO_COMP: cty::c_uint = 108; -#[doc = " Stream Control Transmission Protocol."] -pub const IPPROTO_SCTP: cty::c_uint = 132; -#[doc = " UDP-Lite protocol."] -pub const IPPROTO_UDPLITE: cty::c_uint = 136; -#[doc = " MPLS in IP."] -pub const IPPROTO_MPLS: cty::c_uint = 137; -#[doc = " Raw IP packets."] -pub const IPPROTO_RAW: cty::c_uint = 255; -pub const IPPROTO_MAX: cty::c_uint = 256; -#[doc = " Standard well-defined IP protocols."] -pub type _bindgen_ty_6 = cty::c_uint; -#[doc = " IPv6 Hop-by-Hop options."] -pub const IPPROTO_HOPOPTS: cty::c_uint = 0; -#[doc = " IPv6 routing header."] -pub const IPPROTO_ROUTING: cty::c_uint = 43; -#[doc = " IPv6 fragmentation header."] -pub const IPPROTO_FRAGMENT: cty::c_uint = 44; -#[doc = " ICMPv6."] -pub const IPPROTO_ICMPV6: cty::c_uint = 58; -#[doc = " IPv6 no next header."] -pub const IPPROTO_NONE: cty::c_uint = 59; -#[doc = " IPv6 destination options."] -pub const IPPROTO_DSTOPTS: cty::c_uint = 60; -#[doc = " IPv6 mobility header."] -pub const IPPROTO_MH: cty::c_uint = 135; -pub type _bindgen_ty_7 = cty::c_uint; -#[doc = " Type to represent a port."] -pub type in_port_t = u16; -#[doc = " Echo service."] -pub const IPPORT_ECHO: cty::c_uint = 7; -#[doc = " Discard transmissions service."] -pub const IPPORT_DISCARD: cty::c_uint = 9; -#[doc = " System status service."] -pub const IPPORT_SYSTAT: cty::c_uint = 11; -#[doc = " Time of day service."] -pub const IPPORT_DAYTIME: cty::c_uint = 13; -#[doc = " Network status service."] -pub const IPPORT_NETSTAT: cty::c_uint = 15; -#[doc = " File Transfer Protocol."] -pub const IPPORT_FTP: cty::c_uint = 21; -#[doc = " Telnet protocol."] -pub const IPPORT_TELNET: cty::c_uint = 23; -#[doc = " Simple Mail Transfer Protocol."] -pub const IPPORT_SMTP: cty::c_uint = 25; -#[doc = " Timeserver service."] -pub const IPPORT_TIMESERVER: cty::c_uint = 37; -#[doc = " Domain Name Service."] -pub const IPPORT_NAMESERVER: cty::c_uint = 42; -#[doc = " Internet Whois service."] -pub const IPPORT_WHOIS: cty::c_uint = 43; -pub const IPPORT_MTP: cty::c_uint = 57; -#[doc = " Trivial File Transfer Protocol."] -pub const IPPORT_TFTP: cty::c_uint = 69; -pub const IPPORT_RJE: cty::c_uint = 77; -#[doc = " Finger service."] -pub const IPPORT_FINGER: cty::c_uint = 79; -pub const IPPORT_TTYLINK: cty::c_uint = 87; -#[doc = " SUPDUP protocol."] -pub const IPPORT_SUPDUP: cty::c_uint = 95; -#[doc = " execd service."] -pub const IPPORT_EXECSERVER: cty::c_uint = 512; -#[doc = " rlogind service."] -pub const IPPORT_LOGINSERVER: cty::c_uint = 513; -pub const IPPORT_CMDSERVER: cty::c_uint = 514; -pub const IPPORT_EFSSERVER: cty::c_uint = 520; -#[doc = " UDP ports."] -pub const IPPORT_BIFFUDP: cty::c_uint = 512; -#[doc = " UDP ports."] -pub const IPPORT_WHOSERVER: cty::c_uint = 513; -#[doc = " UDP ports."] -pub const IPPORT_ROUTESERVER: cty::c_uint = 520; -#[doc = " Ports less than this value are reserved for privileged processes."] -pub const IPPORT_RESERVED: cty::c_uint = 1024; -#[doc = " Ports greater this value are reserved for (non-privileged) servers."] -pub const IPPORT_USERRESERVED: cty::c_uint = 5000; -#[doc = " Standard well-known ports."] -pub type _bindgen_ty_8 = cty::c_uint; -#[doc = " IPv6 address"] -#[repr(C)] -#[derive(Copy, Clone)] -pub struct in6_addr { - pub __in6_u: in6_addr__bindgen_ty_1, -} -#[repr(C)] -#[derive(Copy, Clone)] -pub union in6_addr__bindgen_ty_1 { - pub __u6_addr8: [u8; 16usize], - pub __u6_addr16: [u16; 8usize], - pub __u6_addr32: [u32; 4usize], -} -#[test] -fn bindgen_test_layout_in6_addr__bindgen_ty_1() { - assert_eq!( - ::core::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(in6_addr__bindgen_ty_1)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(in6_addr__bindgen_ty_1)) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).__u6_addr8 as *const _ as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(in6_addr__bindgen_ty_1), - "::", - stringify!(__u6_addr8) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).__u6_addr16 as *const _ as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(in6_addr__bindgen_ty_1), - "::", - stringify!(__u6_addr16) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).__u6_addr32 as *const _ as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(in6_addr__bindgen_ty_1), - "::", - stringify!(__u6_addr32) - ) - ); -} -impl Default for in6_addr__bindgen_ty_1 { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[test] -fn bindgen_test_layout_in6_addr() { - assert_eq!( - ::core::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(in6_addr)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(in6_addr)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).__in6_u as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(in6_addr), - "::", - stringify!(__in6_u) - ) - ); -} -impl Default for in6_addr { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -extern "C" { - pub static in6addr_any: in6_addr; -} -extern "C" { - pub static in6addr_loopback: in6_addr; -} -#[doc = " Structure describing an Internet socket address."] -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct sockaddr_in { - pub sin_family: sa_family_t, - #[doc = " Port number."] - pub sin_port: in_port_t, - #[doc = " Internet address."] - pub sin_addr: in_addr, - #[doc = " Pad to size of `struct sockaddr'."] - pub sin_zero: [cty::c_uchar; 8usize], -} -#[test] -fn bindgen_test_layout_sockaddr_in() { - assert_eq!( - ::core::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(sockaddr_in)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(sockaddr_in)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin_family as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in), - "::", - stringify!(sin_family) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin_port as *const _ as usize }, - 2usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in), - "::", - stringify!(sin_port) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin_addr as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in), - "::", - stringify!(sin_addr) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin_zero as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in), - "::", - stringify!(sin_zero) - ) - ); -} -#[doc = " Ditto, for IPv6."] -#[repr(C)] -#[derive(Copy, Clone)] -pub struct sockaddr_in6 { - pub sin6_family: sa_family_t, - #[doc = " Transport layer port #"] - pub sin6_port: in_port_t, - #[doc = " IPv6 flow information"] - pub sin6_flowinfo: u32, - #[doc = " IPv6 address"] - pub sin6_addr: in6_addr, - #[doc = " IPv6 scope-id"] - pub sin6_scope_id: u32, -} -#[test] -fn bindgen_test_layout_sockaddr_in6() { - assert_eq!( - ::core::mem::size_of::(), - 28usize, - concat!("Size of: ", stringify!(sockaddr_in6)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(sockaddr_in6)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin6_family as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in6), - "::", - stringify!(sin6_family) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin6_port as *const _ as usize }, - 2usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in6), - "::", - stringify!(sin6_port) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin6_flowinfo as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in6), - "::", - stringify!(sin6_flowinfo) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin6_addr as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in6), - "::", - stringify!(sin6_addr) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin6_scope_id as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in6), - "::", - stringify!(sin6_scope_id) - ) - ); -} -impl Default for sockaddr_in6 { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[doc = " Likewise, for IPv6."] -#[repr(C)] -#[derive(Copy, Clone)] -pub struct ipv6_mreq { - #[doc = " IPv6 multicast address of group"] - pub ipv6mr_multiaddr: in6_addr, - #[doc = " local interface"] - pub ipv6mr_interface: cty::c_uint, -} -#[test] -fn bindgen_test_layout_ipv6_mreq() { - assert_eq!( - ::core::mem::size_of::(), - 20usize, - concat!("Size of: ", stringify!(ipv6_mreq)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(ipv6_mreq)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).ipv6mr_multiaddr as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ipv6_mreq), - "::", - stringify!(ipv6mr_multiaddr) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).ipv6mr_interface as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ipv6_mreq), - "::", - stringify!(ipv6mr_interface) - ) - ); -} -impl Default for ipv6_mreq { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -extern "C" { - #[doc = " Functions to convert between host and network byte order."] - #[doc = ""] - #[doc = "Please note that these functions normally take `unsigned long int' or"] - #[doc = "`unsigned short int' values as arguments and also return them. But"] - #[doc = "this was a short-sighted decision since on different systems the types"] - #[doc = "may have different representations but the values are always the same."] - pub fn ntohl(__netlong: u32) -> u32; -} -extern "C" { - pub fn ntohs(__netshort: u16) -> u16; -} -extern "C" { - pub fn htonl(__hostlong: u32) -> u32; -} -extern "C" { - pub fn htons(__hostshort: u16) -> u16; -} -extern "C" { - #[doc = " Get a human-readable string describing the running Notcurses version."] - pub fn notcurses_version() -> *const cty::c_char; -} -extern "C" { - #[doc = " Cannot be inline, as we want to get the versions of the actual Notcurses"] - #[doc = " library we loaded, not what we compile against."] - pub fn notcurses_version_components( - major: *mut cty::c_int, - minor: *mut cty::c_int, - patch: *mut cty::c_int, - tweak: *mut cty::c_int, - ); -} -#[repr(C)] -#[derive(Debug)] -pub struct notcurses { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncplane { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncvisual { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncuplot { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncdplot { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncprogbar { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncfdplane { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncsubproc { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncselector { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncmultiselector { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncreader { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncfadectx { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct nctablet { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncreel { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct nctab { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct nctabbed { - _unused: [u8; 0], -} -#[doc = " let the ncvisual pick"] -pub const ncblitter_e_NCBLIT_DEFAULT: ncblitter_e = 0; -#[doc = " space, compatible with ASCII"] -pub const ncblitter_e_NCBLIT_1x1: ncblitter_e = 1; -#[doc = " halves + 1x1 (space) ▄▀"] -pub const ncblitter_e_NCBLIT_2x1: ncblitter_e = 2; -#[doc = " quadrants + 2x1 ▗▐ ▖▀▟▌▙"] -pub const ncblitter_e_NCBLIT_2x2: ncblitter_e = 3; -#[doc = " sextants (*NOT* 2x2) 🬀🬁🬂🬃🬄🬅🬆🬇🬈🬉🬊🬋🬌🬍🬎🬏🬐🬑🬒🬓🬔🬕🬖🬗🬘🬙🬚🬛🬜🬝🬞"] -pub const ncblitter_e_NCBLIT_3x2: ncblitter_e = 4; -#[doc = " 4 rows, 2 cols (braille) ⡀⡄⡆⡇⢀⣀⣄⣆⣇⢠⣠⣤⣦⣧⢰⣰⣴⣶⣷⢸⣸⣼⣾⣿"] -pub const ncblitter_e_NCBLIT_BRAILLE: ncblitter_e = 5; -#[doc = " pixel graphics"] -pub const ncblitter_e_NCBLIT_PIXEL: ncblitter_e = 6; -#[doc = " four vertical levels █▆▄▂"] -pub const ncblitter_e_NCBLIT_4x1: ncblitter_e = 7; -#[doc = " eight vertical levels █▇▆▅▄▃▂▁"] -pub const ncblitter_e_NCBLIT_8x1: ncblitter_e = 8; -#[doc = " we never blit full blocks, but instead spaces (more efficient) with the"] -#[doc = " background set to the desired foreground."] -pub type ncblitter_e = cty::c_uint; -pub const ncalign_e_NCALIGN_UNALIGNED: ncalign_e = 0; -pub const ncalign_e_NCALIGN_LEFT: ncalign_e = 1; -pub const ncalign_e_NCALIGN_CENTER: ncalign_e = 2; -pub const ncalign_e_NCALIGN_RIGHT: ncalign_e = 3; -#[doc = " Alignment within a plane or terminal. Left/right-justified, or centered."] -pub type ncalign_e = cty::c_uint; -pub const ncscale_e_NCSCALE_NONE: ncscale_e = 0; -pub const ncscale_e_NCSCALE_SCALE: ncscale_e = 1; -pub const ncscale_e_NCSCALE_STRETCH: ncscale_e = 2; -pub const ncscale_e_NCSCALE_NONE_HIRES: ncscale_e = 3; -pub const ncscale_e_NCSCALE_SCALE_HIRES: ncscale_e = 4; -#[doc = " How to scale an ncvisual during rendering. NCSCALE_NONE will apply no"] -#[doc = " scaling. NCSCALE_SCALE scales a visual to the plane's size, maintaining"] -#[doc = " aspect ratio. NCSCALE_STRETCH stretches and scales the image in an"] -#[doc = " attempt to fill the entirety of the plane. NCSCALE_NONE_HIRES and"] -#[doc = " NCSCALE_SCALE_HIRES behave like their counterparts, but admit blitters"] -#[doc = " which don't preserve aspect ratio."] -pub type ncscale_e = cty::c_uint; -extern "C" { - #[doc = " Returns the number of columns occupied by a multibyte (UTF-8) string, or"] - #[doc = " -1 if a non-printable/illegal character is encountered."] - pub fn ncstrwidth(mbs: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " input functions like notcurses_getc() return ucs32-encoded char32_t. convert"] - #[doc = " a series of char32_t to utf8. result must be at least 4 bytes per input"] - #[doc = " char32_t (6 bytes per char32_t will future-proof against Unicode expansion)."] - #[doc = " the number of bytes used is returned, or -1 if passed illegal ucs32, or too"] - #[doc = " small of a buffer."] - pub fn notcurses_ucs32_to_utf8( - ucs32: *const char32_t, - ucs32count: cty::c_uint, - resultbuf: *mut cty::c_uchar, - buflen: size_t, - ) -> cty::c_int; -} -#[doc = " An nccell corresponds to a single character cell on some plane, which can be"] -#[doc = " occupied by a single grapheme cluster (some root spacing glyph, along with"] -#[doc = " possible combining characters, which might span multiple columns). At any"] -#[doc = " cell, we can have a theoretically arbitrarily long UTF-8 string, a foreground"] -#[doc = " color, a background color, and an attribute set. Valid grapheme cluster"] -#[doc = " contents include:"] -#[doc = ""] -#[doc = " * A NUL terminator,"] -#[doc = " * A single control character, followed by a NUL terminator,"] -#[doc = " * At most one spacing character, followed by zero or more nonspacing"] -#[doc = " characters, followed by a NUL terminator."] -#[doc = ""] -#[doc = " Multi-column characters can only have a single style/color throughout."] -#[doc = " Existence is suffering, and thus wcwidth() is not reliable. It's just"] -#[doc = " quoting whether or not the EGC contains a \"Wide Asian\" double-width"] -#[doc = " character. This is set for some things, like most emoji, and not set for"] -#[doc = " other things, like cuneiform. True display width is a *function of the"] -#[doc = " font and terminal*. Among the longest Unicode codepoints is"] -#[doc = ""] -#[doc = " U+FDFD ARABIC LIGATURE BISMILLAH AR-RAHMAN AR-RAHEEM ﷽"] -#[doc = ""] -#[doc = " wcwidth() rather optimistically claims this most exalted glyph to occupy"] -#[doc = " a single column. BiDi text is too complicated for me to even get into here."] -#[doc = " Be assured there are no easy answers; ours is indeed a disturbing Universe."] -#[doc = ""] -#[doc = " Each nccell occupies 16 static bytes (128 bits). The surface is thus ~1.6MB"] -#[doc = " for a (pretty large) 500x200 terminal. At 80x43, it's less than 64KB."] -#[doc = " Dynamic requirements (the egcpool) can add up to 16MB to an ncplane, but"] -#[doc = " such large pools are unlikely in common use."] -#[doc = ""] -#[doc = " We implement some small alpha compositing. Foreground and background both"] -#[doc = " have two bits of inverted alpha. The actual grapheme written to a cell is"] -#[doc = " the topmost non-zero grapheme. If its alpha is 00, its foreground color is"] -#[doc = " used unchanged. If its alpha is 10, its foreground color is derived entirely"] -#[doc = " from cells underneath it. Otherwise, the result will be a composite."] -#[doc = " Likewise for the background. If the bottom of a coordinate's zbuffer is"] -#[doc = " reached with a cumulative alpha of zero, the default is used. In this way,"] -#[doc = " a terminal configured with transparent background can be supported through"] -#[doc = " multiple occluding ncplanes. A foreground alpha of 11 requests high-contrast"] -#[doc = " text (relative to the computed background). A background alpha of 11 is"] -#[doc = " currently forbidden."] -#[doc = ""] -#[doc = " Default color takes precedence over palette or RGB, and cannot be used with"] -#[doc = " transparency. Indexed palette takes precedence over RGB. It cannot"] -#[doc = " meaningfully set transparency, but it can be mixed into a cascading color."] -#[doc = " RGB is used if neither default terminal colors nor palette indexing are in"] -#[doc = " play, and fully supports all transparency options."] -#[doc = ""] -#[doc = " This structure is exposed only so that most functions can be inlined. Do not"] -#[doc = " directly modify or access the fields of this structure; use the API."] -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct nccell { - #[doc = " 4B → 4B little endian EGC"] - pub gcluster: u32, - #[doc = " 1B → 5B (8 bits of zero)"] - pub gcluster_backstop: u8, - #[doc = " 1B → 6B (8 bits of EGC column width)"] - pub width: u8, - #[doc = " 2B → 8B (16 bits of NCSTYLE_* attributes)"] - pub stylemask: u16, - #[doc = " + 8B == 16B"] - pub channels: u64, -} -#[test] -fn bindgen_test_layout_nccell() { - assert_eq!( - ::core::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(nccell)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(nccell)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).gcluster as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(nccell), - "::", - stringify!(gcluster) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).gcluster_backstop as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(nccell), - "::", - stringify!(gcluster_backstop) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).width as *const _ as usize }, - 5usize, - concat!( - "Offset of field: ", - stringify!(nccell), - "::", - stringify!(width) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).stylemask as *const _ as usize }, - 6usize, - concat!( - "Offset of field: ", - stringify!(nccell), - "::", - stringify!(stylemask) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).channels as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(nccell), - "::", - stringify!(channels) - ) - ); -} -pub type cell = nccell; -extern "C" { - #[doc = " Breaks the UTF-8 string in 'gcluster' down, setting up the nccell 'c'."] - #[doc = " Returns the number of bytes copied out of 'gcluster', or -1 on failure. The"] - #[doc = " styling of the cell is left untouched, but any resources are released."] - pub fn nccell_load(n: *mut ncplane, c: *mut nccell, gcluster: *const cty::c_char) - -> cty::c_int; -} -extern "C" { - pub fn cell_load(n: *mut ncplane, c: *mut nccell, gcluster: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Duplicate 'c' into 'targ'; both must be/will be bound to 'n'. Returns -1 on"] - #[doc = " failure, and 0 on success."] - pub fn nccell_duplicate(n: *mut ncplane, targ: *mut nccell, c: *const nccell) -> cty::c_int; -} -extern "C" { - pub fn cell_duplicate(n: *mut ncplane, targ: *mut nccell, c: *const nccell) -> cty::c_int; -} -extern "C" { - #[doc = " Release resources held by the nccell 'c'."] - pub fn nccell_release(n: *mut ncplane, c: *mut nccell); -} -extern "C" { - pub fn cell_release(n: *mut ncplane, c: *mut nccell); -} -extern "C" { - #[doc = " return a pointer to the NUL-terminated EGC referenced by 'c'. this pointer"] - #[doc = " can be invalidated by any further operation on the plane 'n', so...watch out!"] - #[doc = " returns NULL if called on a pixel graphic."] - pub fn nccell_extended_gcluster(n: *const ncplane, c: *const nccell) -> *const cty::c_char; -} -#[doc = " default. print nothing once fullscreen service begins"] -pub const ncloglevel_e_NCLOGLEVEL_SILENT: ncloglevel_e = 0; -#[doc = " print diagnostics immediately related to crashing"] -pub const ncloglevel_e_NCLOGLEVEL_PANIC: ncloglevel_e = 1; -#[doc = " we're hanging around, but we've had a horrible fault"] -pub const ncloglevel_e_NCLOGLEVEL_FATAL: ncloglevel_e = 2; -#[doc = " we can't keep doing this, but we can do other things"] -pub const ncloglevel_e_NCLOGLEVEL_ERROR: ncloglevel_e = 3; -#[doc = " you probably don't want what's happening to happen"] -pub const ncloglevel_e_NCLOGLEVEL_WARNING: ncloglevel_e = 4; -#[doc = " \"standard information\""] -pub const ncloglevel_e_NCLOGLEVEL_INFO: ncloglevel_e = 5; -#[doc = " \"detailed information\""] -pub const ncloglevel_e_NCLOGLEVEL_VERBOSE: ncloglevel_e = 6; -#[doc = " this is honestly a bit much"] -pub const ncloglevel_e_NCLOGLEVEL_DEBUG: ncloglevel_e = 7; -#[doc = " there's probably a better way to do what you want"] -pub const ncloglevel_e_NCLOGLEVEL_TRACE: ncloglevel_e = 8; -#[doc = " These log levels consciously map cleanly to those of libav; Notcurses itself"] -#[doc = " does not use this full granularity. The log level does not affect the opening"] -#[doc = " and closing banners, which can be disabled via the notcurses_option struct's"] -#[doc = " 'suppress_banner'. Note that if stderr is connected to the same terminal on"] -#[doc = " which we're rendering, any kind of logging will disrupt the output."] -pub type ncloglevel_e = cty::c_uint; -#[doc = " Configuration for notcurses_init()."] -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct notcurses_options { - #[doc = " The name of the terminfo database entry describing this terminal. If NULL,"] - #[doc = " the environment variable TERM is used. Failure to open the terminal"] - #[doc = " definition will result in failure to initialize notcurses."] - pub termtype: *const cty::c_char, - #[doc = " If non-NULL, notcurses_render() will write each rendered frame to this"] - #[doc = " FILE* in addition to outfp. This is used primarily for debugging."] - pub renderfp: *mut FILE, - #[doc = " Progressively higher log levels result in more logging to stderr. By"] - #[doc = " default, nothing is printed to stderr once fullscreen service begins."] - pub loglevel: ncloglevel_e, - #[doc = " Desirable margins. If all are 0 (default), we will render to the entirety"] - #[doc = " of the screen. If the screen is too small, we do what we can--this is"] - #[doc = " strictly best-effort. Absolute coordinates are relative to the rendering"] - #[doc = " area ((0, 0) is always the origin of the rendering area)."] - pub margin_t: cty::c_int, - #[doc = " Desirable margins. If all are 0 (default), we will render to the entirety"] - #[doc = " of the screen. If the screen is too small, we do what we can--this is"] - #[doc = " strictly best-effort. Absolute coordinates are relative to the rendering"] - #[doc = " area ((0, 0) is always the origin of the rendering area)."] - pub margin_r: cty::c_int, - #[doc = " Desirable margins. If all are 0 (default), we will render to the entirety"] - #[doc = " of the screen. If the screen is too small, we do what we can--this is"] - #[doc = " strictly best-effort. Absolute coordinates are relative to the rendering"] - #[doc = " area ((0, 0) is always the origin of the rendering area)."] - pub margin_b: cty::c_int, - #[doc = " Desirable margins. If all are 0 (default), we will render to the entirety"] - #[doc = " of the screen. If the screen is too small, we do what we can--this is"] - #[doc = " strictly best-effort. Absolute coordinates are relative to the rendering"] - #[doc = " area ((0, 0) is always the origin of the rendering area)."] - pub margin_l: cty::c_int, - #[doc = " General flags; see NCOPTION_*. This is expressed as a bitfield so that"] - #[doc = " future options can be added without reshaping the struct. Undefined bits"] - #[doc = " must be set to 0."] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_notcurses_options() { - assert_eq!( - ::core::mem::size_of::(), - 48usize, - concat!("Size of: ", stringify!(notcurses_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(notcurses_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).termtype as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(notcurses_options), - "::", - stringify!(termtype) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).renderfp as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(notcurses_options), - "::", - stringify!(renderfp) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).loglevel as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(notcurses_options), - "::", - stringify!(loglevel) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).margin_t as *const _ as usize }, - 20usize, - concat!( - "Offset of field: ", - stringify!(notcurses_options), - "::", - stringify!(margin_t) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).margin_r as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(notcurses_options), - "::", - stringify!(margin_r) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).margin_b as *const _ as usize }, - 28usize, - concat!( - "Offset of field: ", - stringify!(notcurses_options), - "::", - stringify!(margin_b) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).margin_l as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(notcurses_options), - "::", - stringify!(margin_l) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(notcurses_options), - "::", - stringify!(flags) - ) - ); -} -impl Default for notcurses_options { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -extern "C" { - #[doc = " Lex a margin argument according to the standard Notcurses definition. There"] - #[doc = " can be either a single number, which will define all margins equally, or"] - #[doc = " there can be four numbers separated by commas."] - pub fn notcurses_lex_margins( - op: *const cty::c_char, - opts: *mut notcurses_options, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Lex a blitter."] - pub fn notcurses_lex_blitter(op: *const cty::c_char, blitter: *mut ncblitter_e) -> cty::c_int; -} -extern "C" { - #[doc = " Get the name of a blitter."] - pub fn notcurses_str_blitter(blitter: ncblitter_e) -> *const cty::c_char; -} -extern "C" { - #[doc = " Lex a scaling mode (one of \"none\", \"stretch\", \"scale\", \"hires\", or \"scalehi\")."] - pub fn notcurses_lex_scalemode(op: *const cty::c_char, scalemode: *mut ncscale_e) - -> cty::c_int; -} -extern "C" { - #[doc = " Get the name of a scaling mode."] - pub fn notcurses_str_scalemode(scalemode: ncscale_e) -> *const cty::c_char; -} -extern "C" { - #[doc = " Initialize a Notcurses context on the connected terminal at 'fp'. 'fp' must"] - #[doc = " be a tty. You'll usually want stdout. NULL can be supplied for 'fp', in"] - #[doc = " which case /dev/tty will be opened. Returns NULL on error, including any"] - #[doc = " failure initializing terminfo."] - pub fn notcurses_init(opts: *const notcurses_options, fp: *mut FILE) -> *mut notcurses; -} -extern "C" { - #[doc = " The same as notcurses_init(), but without any multimedia functionality,"] - #[doc = " allowing for a svelter binary. Link with notcurses-core if this is used."] - pub fn notcurses_core_init(opts: *const notcurses_options, fp: *mut FILE) -> *mut notcurses; -} -extern "C" { - #[doc = " Destroy a Notcurses context."] - pub fn notcurses_stop(nc: *mut notcurses) -> cty::c_int; -} -extern "C" { - #[doc = " Return the topmost plane of the pile containing 'n'."] - pub fn ncpile_top(n: *mut ncplane) -> *mut ncplane; -} -extern "C" { - #[doc = " Return the bottommost plane of the pile containing 'n'."] - pub fn ncpile_bottom(n: *mut ncplane) -> *mut ncplane; -} -extern "C" { - #[doc = " Renders the pile of which 'n' is a part. Rendering this pile again will blow"] - #[doc = " away the render. To actually write out the render, call ncpile_rasterize()."] - pub fn ncpile_render(n: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Make the physical screen match the last rendered frame from the pile of"] - #[doc = " which 'n' is a part. This is a blocking call. Don't call this before the"] - #[doc = " pile has been rendered (doing so will likely result in a blank screen)."] - pub fn ncpile_rasterize(n: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Renders and rasterizes the standard pile in one shot. Blocking call."] - pub fn notcurses_render(nc: *mut notcurses) -> cty::c_int; -} -extern "C" { - #[doc = " Perform the rendering and rasterization portion of notcurses_render(), but"] - #[doc = " do not write the resulting buffer out to the terminal. Using this function,"] - #[doc = " the user can control the writeout process, and render a second frame while"] - #[doc = " writing another. The returned buffer must be freed by the caller."] - pub fn notcurses_render_to_buffer( - nc: *mut notcurses, - buf: *mut *mut cty::c_char, - buflen: *mut size_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Write the last rendered frame, in its entirety, to 'fp'. If"] - #[doc = " notcurses_render() has not yet been called, nothing will be written."] - pub fn notcurses_render_to_file(nc: *mut notcurses, fp: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Return the topmost ncplane of the standard pile."] - pub fn notcurses_top(n: *mut notcurses) -> *mut ncplane; -} -extern "C" { - #[doc = " Return the bottommost ncplane of the standard pile."] - pub fn notcurses_bottom(n: *mut notcurses) -> *mut ncplane; -} -extern "C" { - #[doc = " Destroy all ncplanes other than the stdplane."] - pub fn notcurses_drop_planes(nc: *mut notcurses); -} -#[doc = " An input event. Cell coordinates are currently defined only for mouse events."] -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncinput { - #[doc = " identifier. Unicode codepoint or synthesized NCKEY event"] - pub id: char32_t, - #[doc = " y cell coordinate of event, -1 for undefined"] - pub y: cty::c_int, - #[doc = " x cell coordinate of event, -1 for undefined"] - pub x: cty::c_int, - #[doc = " was alt held?"] - pub alt: bool, - #[doc = " was shift held?"] - pub shift: bool, - #[doc = " was ctrl held?"] - pub ctrl: bool, - #[doc = " input event number"] - pub seqnum: u64, -} -#[test] -fn bindgen_test_layout_ncinput() { - assert_eq!( - ::core::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(ncinput)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncinput)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).id as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncinput), - "::", - stringify!(id) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).y as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(ncinput), - "::", - stringify!(y) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).x as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncinput), - "::", - stringify!(x) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).alt as *const _ as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(ncinput), - "::", - stringify!(alt) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).shift as *const _ as usize }, - 13usize, - concat!( - "Offset of field: ", - stringify!(ncinput), - "::", - stringify!(shift) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).ctrl as *const _ as usize }, - 14usize, - concat!( - "Offset of field: ", - stringify!(ncinput), - "::", - stringify!(ctrl) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).seqnum as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncinput), - "::", - stringify!(seqnum) - ) - ); -} -extern "C" { - #[doc = " See ppoll(2) for more detail. Provide a NULL 'ts' to block at length, a 'ts'"] - #[doc = " of 0 for non-blocking operation, and otherwise a timespec to bound blocking."] - #[doc = " Signals in sigmask (less several we handle internally) will be atomically"] - #[doc = " masked and unmasked per ppoll(2). It should generally contain all signals."] - #[doc = " Returns a single Unicode code point, or (char32_t)-1 on error. 'sigmask' may"] - #[doc = " be NULL. Returns 0 on a timeout. If an event is processed, the return value"] - #[doc = " is the 'id' field from that event. 'ni' may be NULL."] - pub fn notcurses_getc( - n: *mut notcurses, - ts: *const timespec, - sigmask: *mut sigset_t, - ni: *mut ncinput, - ) -> char32_t; -} -extern "C" { - #[doc = " Get a file descriptor suitable for input event poll()ing. When this"] - #[doc = " descriptor becomes available, you can call notcurses_getc_nblock(),"] - #[doc = " and input ought be ready. This file descriptor is *not* necessarily"] - #[doc = " the file descriptor associated with stdin (but it might be!)."] - pub fn notcurses_inputready_fd(n: *mut notcurses) -> cty::c_int; -} -extern "C" { - #[doc = " Enable the mouse in \"button-event tracking\" mode with focus detection and"] - #[doc = " UTF8-style extended coordinates. On failure, -1 is returned. On success, 0"] - #[doc = " is returned, and mouse events will be published to notcurses_getc()."] - pub fn notcurses_mouse_enable(n: *mut notcurses) -> cty::c_int; -} -extern "C" { - #[doc = " Disable mouse events. Any events in the input queue can still be delivered."] - pub fn notcurses_mouse_disable(n: *mut notcurses) -> cty::c_int; -} -extern "C" { - #[doc = " Disable signals originating from the terminal's line discipline, i.e."] - #[doc = " SIGINT (^C), SIGQUIT (^\\), and SIGTSTP (^Z). They are enabled by default."] - pub fn notcurses_linesigs_disable(n: *mut notcurses) -> cty::c_int; -} -extern "C" { - #[doc = " Restore signals originating from the terminal's line discipline, i.e."] - #[doc = " SIGINT (^C), SIGQUIT (^\\), and SIGTSTP (^Z), if disabled."] - pub fn notcurses_linesigs_enable(n: *mut notcurses) -> cty::c_int; -} -extern "C" { - #[doc = " Refresh the physical screen to match what was last rendered (i.e., without"] - #[doc = " reflecting any changes since the last call to notcurses_render()). This is"] - #[doc = " primarily useful if the screen is externally corrupted, or if an"] - #[doc = " NCKEY_RESIZE event has been read and you're not yet ready to render."] - pub fn notcurses_refresh( - n: *mut notcurses, - y: *mut cty::c_int, - x: *mut cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Extract the Notcurses context to which this plane is attached."] - pub fn ncplane_notcurses(n: *mut ncplane) -> *mut notcurses; -} -extern "C" { - pub fn ncplane_notcurses_const(n: *const ncplane) -> *const notcurses; -} -extern "C" { - #[doc = " Return the dimensions of this ncplane."] - pub fn ncplane_dim_yx(n: *const ncplane, y: *mut cty::c_int, x: *mut cty::c_int); -} -extern "C" { - #[doc = " Get a reference to the standard plane (one matching our current idea of the"] - #[doc = " terminal size) for this terminal. The standard plane always exists, and its"] - #[doc = " origin is always at the uppermost, leftmost cell of the terminal."] - pub fn notcurses_stdplane(nc: *mut notcurses) -> *mut ncplane; -} -extern "C" { - pub fn notcurses_stdplane_const(nc: *const notcurses) -> *const ncplane; -} -extern "C" { - #[doc = " Retrieve pixel geometry for the display region ('pxy', 'pxx'), each cell"] - #[doc = " ('celldimy', 'celldimx'), and the maximum displayable bitmap ('maxbmapy',"] - #[doc = " 'maxbmapx'). Note that this will call notcurses_check_pixel_support(),"] - #[doc = " possibly leading to an interrogation of the terminal. If bitmaps are not"] - #[doc = " supported, 'maxbmapy' and 'maxbmapx' will be 0. Any of the geometry"] - #[doc = " arguments may be NULL."] - pub fn ncplane_pixelgeom( - n: *mut ncplane, - pxy: *mut cty::c_int, - pxx: *mut cty::c_int, - celldimy: *mut cty::c_int, - celldimx: *mut cty::c_int, - maxbmapy: *mut cty::c_int, - maxbmapx: *mut cty::c_int, - ); -} -extern "C" { - #[doc = " Retrieve the contents of the specified cell as last rendered. Returns the EGC"] - #[doc = " or NULL on error. This EGC must be free()d by the caller. The stylemask and"] - #[doc = " channels are written to 'stylemask' and 'channels', respectively."] - pub fn notcurses_at_yx( - nc: *mut notcurses, - yoff: cty::c_int, - xoff: cty::c_int, - stylemask: *mut u16, - channels: *mut u64, - ) -> *mut cty::c_char; -} -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncplane_options { - #[doc = " vertical placement relative to parent plane"] - pub y: cty::c_int, - #[doc = " horizontal placement relative to parent plane"] - pub x: cty::c_int, - #[doc = " rows, must be positive (unless NCPLANE_OPTION_MARGINALIZED)"] - pub rows: cty::c_int, - #[doc = " columns, must be positive (unless NCPLANE_OPTION_MARGINALIZED)"] - pub cols: cty::c_int, - #[doc = " user curry, may be NULL"] - pub userptr: *mut cty::c_void, - #[doc = " name (used only for debugging), may be NULL"] - pub name: *const cty::c_char, - #[doc = " callback when parent is resized"] - pub resizecb: ::core::option::Option cty::c_int>, - #[doc = " closure over NCPLANE_OPTION_*"] - pub flags: u64, - #[doc = " margins (require NCPLANE_OPTION_MARGINALIZED)"] - pub margin_b: cty::c_int, - #[doc = " margins (require NCPLANE_OPTION_MARGINALIZED)"] - pub margin_r: cty::c_int, -} -#[test] -fn bindgen_test_layout_ncplane_options() { - assert_eq!( - ::core::mem::size_of::(), - 56usize, - concat!("Size of: ", stringify!(ncplane_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncplane_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).y as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(y) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).x as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(x) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).rows as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(rows) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).cols as *const _ as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(cols) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).userptr as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(userptr) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).name as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(name) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).resizecb as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(resizecb) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(flags) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).margin_b as *const _ as usize }, - 48usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(margin_b) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).margin_r as *const _ as usize }, - 52usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(margin_r) - ) - ); -} -impl Default for ncplane_options { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -extern "C" { - #[doc = " Create a new ncplane bound to plane 'n', at the offset 'y'x'x' (relative to"] - #[doc = " the origin of 'n') and the specified size. The number of 'rows' and 'cols'"] - #[doc = " must both be positive. This plane is initially at the top of the z-buffer,"] - #[doc = " as if ncplane_move_top() had been called on it. The void* 'userptr' can be"] - #[doc = " retrieved (and reset) later. A 'name' can be set, used in debugging."] - pub fn ncplane_create(n: *mut ncplane, nopts: *const ncplane_options) -> *mut ncplane; -} -extern "C" { - #[doc = " Same as ncplane_create(), but creates a new pile. The returned plane will"] - #[doc = " be the top, bottom, and root of this new pile."] - pub fn ncpile_create(nc: *mut notcurses, nopts: *const ncplane_options) -> *mut ncplane; -} -extern "C" { - #[doc = " This function will be removed in ABI3 in favor of ncplane_create()."] - #[doc = " It persists in ABI2 only for backwards compatibility."] - pub fn ncplane_new( - n: *mut ncplane, - rows: cty::c_int, - cols: cty::c_int, - y: cty::c_int, - x: cty::c_int, - opaque: *mut cty::c_void, - name: *const cty::c_char, - ) -> *mut ncplane; -} -extern "C" { - #[doc = " Suitable for use as a 'resizecb', this will resize the plane to the visual"] - #[doc = " region's size. It is used for the standard plane."] - pub fn ncplane_resize_maximize(n: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Suitable for use as a 'resizecb' with planes created with"] - #[doc = " NCPLANE_OPTION_MARGINALIZED. This will resize the plane 'n' against its"] - #[doc = " parent, attempting to enforce the supplied margins."] - pub fn ncplane_resize_marginalized(n: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Suitable for use as a 'resizecb'. This will realign the plane 'n' against"] - #[doc = " its parent, using the alignment specified at ncplane_create()-time."] - pub fn ncplane_resize_realign(n: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Replace the ncplane's existing resizecb with 'resizecb' (which may be NULL)."] - #[doc = " The standard plane's resizecb may not be changed."] - pub fn ncplane_set_resizecb( - n: *mut ncplane, - resizecb: ::core::option::Option cty::c_int>, - ); -} -extern "C" { - #[doc = " Returns the ncplane's current resize callback."] - pub fn ncplane_resizecb( - n: *const ncplane, - ) -> ::core::option::Option cty::c_int>; -} -extern "C" { - #[doc = " Plane 'n' will be unbound from its parent plane, and will be made a bound"] - #[doc = " child of 'newparent'. It is an error if 'n' or 'newparent' are NULL. If"] - #[doc = " 'newparent' is equal to 'n', 'n' becomes the root of a new pile, unless 'n'"] - #[doc = " is already the root of a pile, in which case this is a no-op. Returns 'n'."] - #[doc = " The standard plane cannot be reparented. Any planes bound to 'n' are"] - #[doc = " reparented to the previous parent of 'n'."] - pub fn ncplane_reparent(n: *mut ncplane, newparent: *mut ncplane) -> *mut ncplane; -} -extern "C" { - #[doc = " The same as ncplane_reparent(), except any planes bound to 'n' come along"] - #[doc = " with it to its new destination. Their z-order is maintained. If 'newparent'"] - #[doc = " is an ancestor of 'n', NULL is returned, and no changes are made."] - pub fn ncplane_reparent_family(n: *mut ncplane, newparent: *mut ncplane) -> *mut ncplane; -} -extern "C" { - #[doc = " Duplicate an existing ncplane. The new plane will have the same geometry,"] - #[doc = " will duplicate all content, and will start with the same rendering state."] - #[doc = " The new plane will be immediately above the old one on the z axis, and will"] - #[doc = " be bound to the same parent. Bound planes are *not* duplicated; the new"] - #[doc = " plane is bound to the parent of 'n', but has no bound planes."] - pub fn ncplane_dup(n: *const ncplane, opaque: *mut cty::c_void) -> *mut ncplane; -} -extern "C" { - #[doc = " provided a coordinate relative to the origin of 'src', map it to the same"] - #[doc = " absolute coordinate relative to the origin of 'dst'. either or both of 'y'"] - #[doc = " and 'x' may be NULL. if 'dst' is NULL, it is taken to be the standard plane."] - pub fn ncplane_translate( - src: *const ncplane, - dst: *const ncplane, - y: *mut cty::c_int, - x: *mut cty::c_int, - ); -} -extern "C" { - #[doc = " Fed absolute 'y'/'x' coordinates, determine whether that coordinate is"] - #[doc = " within the ncplane 'n'. If not, return false. If so, return true. Either"] - #[doc = " way, translate the absolute coordinates relative to 'n'. If the point is not"] - #[doc = " within 'n', these coordinates will not be within the dimensions of the plane."] - pub fn ncplane_translate_abs(n: *const ncplane, y: *mut cty::c_int, x: *mut cty::c_int) - -> bool; -} -extern "C" { - #[doc = " All planes are created with scrolling disabled. Scrolling can be dynamically"] - #[doc = " controlled with ncplane_set_scrolling(). Returns true if scrolling was"] - #[doc = " previously enabled, or false if it was disabled."] - pub fn ncplane_set_scrolling(n: *mut ncplane, scrollp: bool) -> bool; -} -extern "C" { - #[doc = " Returns a 16-bit bitmask of supported curses-style attributes"] - #[doc = " (NCSTYLE_UNDERLINE, NCSTYLE_BOLD, etc.) The attribute is only"] - #[doc = " indicated as supported if the terminal can support it together with color."] - #[doc = " For more information, see the \"ncv\" capability in terminfo(5)."] - pub fn notcurses_supported_styles(nc: *const notcurses) -> cty::c_uint; -} -extern "C" { - #[doc = " Returns the number of simultaneous colors claimed to be supported, or 1 if"] - #[doc = " there is no color support. Note that several terminal emulators advertise"] - #[doc = " more colors than they actually support, downsampling internally."] - pub fn notcurses_palette_size(nc: *const notcurses) -> cty::c_uint; -} -extern "C" { - #[doc = " Can we directly specify RGB values per cell, or only use palettes?"] - pub fn notcurses_cantruecolor(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " Can we fade? Fading requires either the \"rgb\" or \"ccc\" terminfo capability."] - pub fn notcurses_canfade(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " Can we set the \"hardware\" palette? Requires the \"ccc\" terminfo capability."] - pub fn notcurses_canchangecolor(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " Can we load images? This requires being built against FFmpeg/OIIO."] - pub fn notcurses_canopen_images(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " Can we load videos? This requires being built against FFmpeg."] - pub fn notcurses_canopen_videos(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " Is our encoding UTF-8? Requires LANG being set to a UTF8 locale."] - pub fn notcurses_canutf8(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " Can we reliably use Unicode 13 sextants?"] - pub fn notcurses_cansextant(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " Can we reliably use Unicode Braille?"] - pub fn notcurses_canbraille(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " This function must successfully return before NCBLIT_PIXEL is available."] - #[doc = " Returns -1 on error, 0 for no support, or 1 if pixel output is supported."] - #[doc = " Must not be called concurrently with either input or rasterization."] - pub fn notcurses_check_pixel_support(nc: *mut notcurses) -> cty::c_int; -} -#[doc = " whenever a new field is added here, ensure we add the proper rule to"] -#[doc = " notcurses_stats_reset(), so that values are preserved in the stash stats."] -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncstats { - #[doc = " successful ncpile_render() runs"] - pub renders: u64, - #[doc = " successful ncpile_rasterize() runs"] - pub writeouts: u64, - #[doc = " aborted renders, should be 0"] - pub failed_renders: u64, - #[doc = " aborted writes"] - pub failed_writeouts: u64, - #[doc = " bytes emitted to ttyfp"] - pub render_bytes: u64, - #[doc = " max bytes emitted for a frame"] - pub render_max_bytes: i64, - #[doc = " min bytes emitted for a frame"] - pub render_min_bytes: i64, - #[doc = " nanoseconds spent rendering"] - pub render_ns: u64, - #[doc = " max ns spent in render for a frame"] - pub render_max_ns: i64, - #[doc = " min ns spent in render for a frame"] - pub render_min_ns: i64, - #[doc = " nanoseconds spent writing frames to terminal"] - pub writeout_ns: u64, - #[doc = " max ns spent writing out a frame"] - pub writeout_max_ns: i64, - #[doc = " min ns spent writing out a frame"] - pub writeout_min_ns: i64, - #[doc = " cells we elided entirely thanks to damage maps"] - pub cellelisions: u64, - #[doc = " total number of cells emitted to terminal"] - pub cellemissions: u64, - #[doc = " RGB fg elision count"] - pub fgelisions: u64, - #[doc = " RGB fg emissions"] - pub fgemissions: u64, - #[doc = " RGB bg elision count"] - pub bgelisions: u64, - #[doc = " RGB bg emissions"] - pub bgemissions: u64, - #[doc = " default color was emitted"] - pub defaultelisions: u64, - #[doc = " default color was elided"] - pub defaultemissions: u64, - #[doc = " refresh requests (non-optimized redraw)"] - pub refreshes: u64, - #[doc = " total bytes devoted to all active framebuffers"] - pub fbbytes: u64, - #[doc = " number of planes currently in existence"] - pub planes: cty::c_uint, - #[doc = " nanoseconds spent rasterizing"] - pub raster_ns: u64, - #[doc = " max ns spent in raster for a frame"] - pub raster_max_ns: i64, - #[doc = " min ns spent in raster for a frame"] - pub raster_min_ns: i64, -} -#[test] -fn bindgen_test_layout_ncstats() { - assert_eq!( - ::core::mem::size_of::(), - 216usize, - concat!("Size of: ", stringify!(ncstats)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncstats)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).renders as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(renders) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).writeouts as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(writeouts) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).failed_renders as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(failed_renders) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).failed_writeouts as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(failed_writeouts) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).render_bytes as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(render_bytes) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).render_max_bytes as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(render_max_bytes) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).render_min_bytes as *const _ as usize }, - 48usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(render_min_bytes) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).render_ns as *const _ as usize }, - 56usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(render_ns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).render_max_ns as *const _ as usize }, - 64usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(render_max_ns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).render_min_ns as *const _ as usize }, - 72usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(render_min_ns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).writeout_ns as *const _ as usize }, - 80usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(writeout_ns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).writeout_max_ns as *const _ as usize }, - 88usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(writeout_max_ns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).writeout_min_ns as *const _ as usize }, - 96usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(writeout_min_ns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).cellelisions as *const _ as usize }, - 104usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(cellelisions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).cellemissions as *const _ as usize }, - 112usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(cellemissions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).fgelisions as *const _ as usize }, - 120usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(fgelisions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).fgemissions as *const _ as usize }, - 128usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(fgemissions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).bgelisions as *const _ as usize }, - 136usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(bgelisions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).bgemissions as *const _ as usize }, - 144usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(bgemissions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).defaultelisions as *const _ as usize }, - 152usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(defaultelisions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).defaultemissions as *const _ as usize }, - 160usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(defaultemissions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).refreshes as *const _ as usize }, - 168usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(refreshes) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).fbbytes as *const _ as usize }, - 176usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(fbbytes) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).planes as *const _ as usize }, - 184usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(planes) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).raster_ns as *const _ as usize }, - 192usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(raster_ns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).raster_max_ns as *const _ as usize }, - 200usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(raster_max_ns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).raster_min_ns as *const _ as usize }, - 208usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(raster_min_ns) - ) - ); -} -extern "C" { - #[doc = " Allocate an ncstats object. Use this rather than allocating your own, since"] - #[doc = " future versions of Notcurses might enlarge this structure."] - pub fn notcurses_stats_alloc(nc: *const notcurses) -> *mut ncstats; -} -extern "C" { - #[doc = " Acquire an atomic snapshot of the Notcurses object's stats."] - pub fn notcurses_stats(nc: *mut notcurses, stats: *mut ncstats); -} -extern "C" { - #[doc = " Reset all cumulative stats (immediate ones, such as fbbytes, are not reset),"] - #[doc = " first copying them into |*stats| (if |stats| is not NULL)."] - pub fn notcurses_stats_reset(nc: *mut notcurses, stats: *mut ncstats); -} -extern "C" { - #[doc = " Resize the specified ncplane. The four parameters 'keepy', 'keepx',"] - #[doc = " 'keepleny', and 'keeplenx' define a subset of the ncplane to keep,"] - #[doc = " unchanged. This may be a section of size 0, though none of these four"] - #[doc = " parameters may be negative. 'keepx' and 'keepy' are relative to the ncplane."] - #[doc = " They must specify a coordinate within the ncplane's totality. 'yoff' and"] - #[doc = " 'xoff' are relative to 'keepy' and 'keepx', and place the upper-left corner"] - #[doc = " of the resized ncplane. Finally, 'ylen' and 'xlen' are the dimensions of the"] - #[doc = " ncplane after resizing. 'ylen' must be greater than or equal to 'keepleny',"] - #[doc = " and 'xlen' must be greater than or equal to 'keeplenx'. It is an error to"] - #[doc = " attempt to resize the standard plane. If either of 'keepleny' or 'keeplenx'"] - #[doc = " is non-zero, both must be non-zero."] - #[doc = ""] - #[doc = " Essentially, the kept material does not move. It serves to anchor the"] - #[doc = " resized plane. If there is no kept material, the plane can move freely."] - pub fn ncplane_resize( - n: *mut ncplane, - keepy: cty::c_int, - keepx: cty::c_int, - keepleny: cty::c_int, - keeplenx: cty::c_int, - yoff: cty::c_int, - xoff: cty::c_int, - ylen: cty::c_int, - xlen: cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Destroy the specified ncplane. None of its contents will be visible after"] - #[doc = " the next call to notcurses_render(). It is an error to attempt to destroy"] - #[doc = " the standard plane."] - pub fn ncplane_destroy(n: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Set the ncplane's base nccell to 'c'. The base cell is used for purposes of"] - #[doc = " rendering anywhere that the ncplane's gcluster is 0. Note that the base cell"] - #[doc = " is not affected by ncplane_erase(). 'c' must not be a secondary cell from a"] - #[doc = " multicolumn EGC."] - pub fn ncplane_set_base_cell(n: *mut ncplane, c: *const nccell) -> cty::c_int; -} -extern "C" { - #[doc = " Set the ncplane's base nccell. It will be used for purposes of rendering"] - #[doc = " anywhere that the ncplane's gcluster is 0. Note that the base cell is not"] - #[doc = " affected by ncplane_erase(). 'egc' must be an extended grapheme cluster."] - pub fn ncplane_set_base( - n: *mut ncplane, - egc: *const cty::c_char, - stylemask: u32, - channels: u64, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Extract the ncplane's base nccell into 'c'. The reference is invalidated if"] - #[doc = " 'ncp' is destroyed."] - pub fn ncplane_base(n: *mut ncplane, c: *mut nccell) -> cty::c_int; -} -extern "C" { - #[doc = " Move this plane relative to the standard plane, or the plane to which it is"] - #[doc = " bound (if it is bound to a plane). It is an error to attempt to move the"] - #[doc = " standard plane."] - pub fn ncplane_move_yx(n: *mut ncplane, y: cty::c_int, x: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Get the origin of plane 'n' relative to its bound plane, or pile (if 'n' is"] - #[doc = " a root plane). To get absolute coordinates, use ncplane_abs_yx()."] - pub fn ncplane_yx(n: *const ncplane, y: *mut cty::c_int, x: *mut cty::c_int); -} -extern "C" { - pub fn ncplane_y(n: *const ncplane) -> cty::c_int; -} -extern "C" { - pub fn ncplane_x(n: *const ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Get the origin of plane 'n' relative to its pile. Either or both of 'x' and"] - #[doc = " 'y' may be NULL."] - pub fn ncplane_abs_yx(n: *const ncplane, y: *mut cty::c_int, x: *mut cty::c_int); -} -extern "C" { - pub fn ncplane_abs_y(n: *const ncplane) -> cty::c_int; -} -extern "C" { - pub fn ncplane_abs_x(n: *const ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Get the plane to which the plane 'n' is bound, if any."] - pub fn ncplane_parent(n: *mut ncplane) -> *mut ncplane; -} -extern "C" { - pub fn ncplane_parent_const(n: *const ncplane) -> *const ncplane; -} -extern "C" { - #[doc = " Splice ncplane 'n' out of the z-buffer, and reinsert it at the top or bottom."] - pub fn ncplane_move_top(n: *mut ncplane); -} -extern "C" { - pub fn ncplane_move_bottom(n: *mut ncplane); -} -extern "C" { - #[doc = " Splice ncplane 'n' out of the z-buffer, and reinsert it above 'above'."] - #[doc = " Returns non-zero if 'n' is already in the desired location. 'n' and"] - #[doc = " 'above' must not be the same plane."] - pub fn ncplane_move_above(n: *mut ncplane, above: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Splice ncplane 'n' out of the z-buffer, and reinsert it below 'below'."] - #[doc = " Returns non-zero if 'n' is already in the desired location. 'n' and"] - #[doc = " 'below' must not be the same plane."] - pub fn ncplane_move_below(n: *mut ncplane, below: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Return the plane below this one, or NULL if this is at the bottom."] - pub fn ncplane_below(n: *mut ncplane) -> *mut ncplane; -} -extern "C" { - pub fn ncplane_above(n: *mut ncplane) -> *mut ncplane; -} -extern "C" { - #[doc = " Rotate the plane π/2 radians clockwise or counterclockwise. This cannot"] - #[doc = " be performed on arbitrary planes, because glyphs cannot be arbitrarily"] - #[doc = " rotated. The glyphs which can be rotated are limited: line-drawing"] - #[doc = " characters, spaces, half blocks, and full blocks. The plane must have"] - #[doc = " an even number of columns. Use the ncvisual rotation for a more"] - #[doc = " flexible approach."] - pub fn ncplane_rotate_cw(n: *mut ncplane) -> cty::c_int; -} -extern "C" { - pub fn ncplane_rotate_ccw(n: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Retrieve the current contents of the cell under the cursor. The EGC is"] - #[doc = " returned, or NULL on error. This EGC must be free()d by the caller. The"] - #[doc = " stylemask and channels are written to 'stylemask' and 'channels', respectively."] - pub fn ncplane_at_cursor( - n: *mut ncplane, - stylemask: *mut u16, - channels: *mut u64, - ) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Retrieve the current contents of the cell under the cursor into 'c'. This"] - #[doc = " cell is invalidated if the associated plane is destroyed. Returns the number"] - #[doc = " of bytes in the EGC, or -1 on error."] - pub fn ncplane_at_cursor_cell(n: *mut ncplane, c: *mut nccell) -> cty::c_int; -} -extern "C" { - #[doc = " Retrieve the current contents of the specified cell. The EGC is returned, or"] - #[doc = " NULL on error. This EGC must be free()d by the caller. The stylemask and"] - #[doc = " channels are written to 'stylemask' and 'channels', respectively."] - pub fn ncplane_at_yx( - n: *const ncplane, - y: cty::c_int, - x: cty::c_int, - stylemask: *mut u16, - channels: *mut u64, - ) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Retrieve the current contents of the specified cell into 'c'. This cell is"] - #[doc = " invalidated if the associated plane is destroyed. Returns the number of"] - #[doc = " bytes in the EGC, or -1 on error."] - pub fn ncplane_at_yx_cell( - n: *mut ncplane, - y: cty::c_int, - x: cty::c_int, - c: *mut nccell, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Create a flat string from the EGCs of the selected region of the ncplane"] - #[doc = " 'n'. Start at the plane's 'begy'x'begx' coordinate (which must lie on the"] - #[doc = " plane), continuing for 'leny'x'lenx' cells. Either or both of 'leny' and"] - #[doc = " 'lenx' can be specified as -1 to go through the boundary of the plane."] - pub fn ncplane_contents( - n: *const ncplane, - begy: cty::c_int, - begx: cty::c_int, - leny: cty::c_int, - lenx: cty::c_int, - ) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Manipulate the opaque user pointer associated with this plane."] - #[doc = " ncplane_set_userptr() returns the previous userptr after replacing"] - #[doc = " it with 'opaque'. the others simply return the userptr."] - pub fn ncplane_set_userptr(n: *mut ncplane, opaque: *mut cty::c_void) -> *mut cty::c_void; -} -extern "C" { - pub fn ncplane_userptr(n: *mut ncplane) -> *mut cty::c_void; -} -extern "C" { - pub fn ncplane_center_abs(n: *const ncplane, y: *mut cty::c_int, x: *mut cty::c_int); -} -extern "C" { - #[doc = " Move the cursor to the specified position (the cursor needn't be visible)."] - #[doc = " Returns -1 on error, including negative parameters, or ones exceeding the"] - #[doc = " plane's dimensions."] - pub fn ncplane_cursor_move_yx(n: *mut ncplane, y: cty::c_int, x: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Move the cursor to 0, 0. Can't fail."] - pub fn ncplane_home(n: *mut ncplane); -} -extern "C" { - #[doc = " Get the current position of the cursor within n. y and/or x may be NULL."] - pub fn ncplane_cursor_yx(n: *const ncplane, y: *mut cty::c_int, x: *mut cty::c_int); -} -extern "C" { - #[doc = " Get the current channels or attribute word for ncplane 'n'."] - pub fn ncplane_channels(n: *const ncplane) -> u64; -} -extern "C" { - #[doc = " Return the current styling for this ncplane."] - pub fn ncplane_styles(n: *const ncplane) -> u16; -} -extern "C" { - #[doc = " Replace the cell at the specified coordinates with the provided cell 'c',"] - #[doc = " and advance the cursor by the width of the cell (but not past the end of the"] - #[doc = " plane). On success, returns the number of columns the cursor was advanced."] - #[doc = " 'c' must already be associated with 'n'. On failure, -1 is returned."] - pub fn ncplane_putc_yx( - n: *mut ncplane, - y: cty::c_int, - x: cty::c_int, - c: *const nccell, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Replace the EGC underneath us, but retain the styling. The current styling"] - #[doc = " of the plane will not be changed."] - pub fn ncplane_putchar_stained(n: *mut ncplane, c: cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Replace the cell at the specified coordinates with the provided EGC, and"] - #[doc = " advance the cursor by the width of the cluster (but not past the end of the"] - #[doc = " plane). On success, returns the number of columns the cursor was advanced."] - #[doc = " On failure, -1 is returned. The number of bytes converted from gclust is"] - #[doc = " written to 'sbytes' if non-NULL."] - pub fn ncplane_putegc_yx( - n: *mut ncplane, - y: cty::c_int, - x: cty::c_int, - gclust: *const cty::c_char, - sbytes: *mut cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Replace the EGC underneath us, but retain the styling. The current styling"] - #[doc = " of the plane will not be changed."] - pub fn ncplane_putegc_stained( - n: *mut ncplane, - gclust: *const cty::c_char, - sbytes: *mut cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Replace the EGC underneath us, but retain the styling. The current styling"] - #[doc = " of the plane will not be changed."] - pub fn ncplane_putwegc_stained( - n: *mut ncplane, - gclust: *const wchar_t, - sbytes: *mut cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Write a series of EGCs to the current location, using the current style."] - #[doc = " They will be interpreted as a series of columns (according to the definition"] - #[doc = " of ncplane_putc()). Advances the cursor by some positive number of columns"] - #[doc = " (though not beyond the end of the plane); this number is returned on success."] - #[doc = " On error, a non-positive number is returned, indicating the number of columns"] - #[doc = " which were written before the error."] - pub fn ncplane_putstr_yx( - n: *mut ncplane, - y: cty::c_int, - x: cty::c_int, - gclusters: *const cty::c_char, - ) -> cty::c_int; -} -extern "C" { - pub fn ncplane_putstr_aligned( - n: *mut ncplane, - y: cty::c_int, - align: ncalign_e, - s: *const cty::c_char, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Replace a string's worth of glyphs at the current cursor location, but"] - #[doc = " retain the styling. The current styling of the plane will not be changed."] - pub fn ncplane_putstr_stained(n: *mut ncplane, s: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Write a series of EGCs to the current location, using the current style."] - #[doc = " They will be interpreted as a series of columns (according to the definition"] - #[doc = " of ncplane_putc()). Advances the cursor by some positive number of columns"] - #[doc = " (though not beyond the end of the plane); this number is returned on success."] - #[doc = " On error, a non-positive number is returned, indicating the number of columns"] - #[doc = " which were written before the error. No more than 's' bytes will be written."] - pub fn ncplane_putnstr_yx( - n: *mut ncplane, - y: cty::c_int, - x: cty::c_int, - s: size_t, - gclusters: *const cty::c_char, - ) -> cty::c_int; -} -extern "C" { - pub fn ncplane_putnstr_aligned( - n: *mut ncplane, - y: cty::c_int, - align: ncalign_e, - s: size_t, - gclustarr: *const cty::c_char, - ) -> cty::c_int; -} -extern "C" { - pub fn ncplane_putwstr_stained(n: *mut ncplane, gclustarr: *const wchar_t) -> cty::c_int; -} -extern "C" { - #[doc = " The ncplane equivalents of printf(3) and vprintf(3)."] - pub fn ncplane_vprintf_aligned( - n: *mut ncplane, - y: cty::c_int, - align: ncalign_e, - format: *const cty::c_char, - ap: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - pub fn ncplane_vprintf_yx( - n: *mut ncplane, - y: cty::c_int, - x: cty::c_int, - format: *const cty::c_char, - ap: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - pub fn ncplane_vprintf_stained( - n: *mut ncplane, - format: *const cty::c_char, - ap: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Write the specified text to the plane, breaking lines sensibly, beginning at"] - #[doc = " the specified line. Returns the number of columns written. When breaking a"] - #[doc = " line, the line will be cleared to the end of the plane (the last line will"] - #[doc = " *not* be so cleared). The number of bytes written from the input is written"] - #[doc = " to '*bytes' if it is not NULL. Cleared columns are included in the return"] - #[doc = " value, but *not* included in the number of bytes written. Leaves the cursor"] - #[doc = " at the end of output. A partial write will be accomplished as far as it can;"] - #[doc = " determine whether the write completed by inspecting '*bytes'. Can output to"] - #[doc = " multiple rows even in the absence of scrolling, but not more rows than are"] - #[doc = " available. With scrolling enabled, arbitrary amounts of data can be emitted."] - #[doc = " All provided whitespace is preserved -- ncplane_puttext() followed by an"] - #[doc = " appropriate ncplane_contents() will read back the original output."] - #[doc = ""] - #[doc = " If 'y' is -1, the first row of output is taken relative to the current"] - #[doc = " cursor: it will be left-, right-, or center-aligned in whatever remains"] - #[doc = " of the row. On subsequent rows -- or if 'y' is not -1 -- the entire row can"] - #[doc = " be used, and alignment works normally."] - #[doc = ""] - #[doc = " A newline at any point will move the cursor to the next row."] - pub fn ncplane_puttext( - n: *mut ncplane, - y: cty::c_int, - align: ncalign_e, - text: *const cty::c_char, - bytes: *mut size_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Draw horizontal or vertical lines using the specified cell, starting at the"] - #[doc = " current cursor position. The cursor will end at the cell following the last"] - #[doc = " cell output (even, perhaps counter-intuitively, when drawing vertical"] - #[doc = " lines), just as if ncplane_putc() was called at that spot. Return the"] - #[doc = " number of cells drawn on success. On error, return the negative number of"] - #[doc = " cells drawn."] - pub fn ncplane_hline_interp( - n: *mut ncplane, - c: *const nccell, - len: cty::c_int, - c1: u64, - c2: u64, - ) -> cty::c_int; -} -extern "C" { - pub fn ncplane_vline_interp( - n: *mut ncplane, - c: *const nccell, - len: cty::c_int, - c1: u64, - c2: u64, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Draw a box with its upper-left corner at the current cursor position, and its"] - #[doc = " lower-right corner at 'ystop'x'xstop'. The 6 cells provided are used to draw the"] - #[doc = " upper-left, ur, ll, and lr corners, then the horizontal and vertical lines."] - #[doc = " 'ctlword' is defined in the least significant byte, where bits [7, 4] are a"] - #[doc = " gradient mask, and [3, 0] are a border mask:"] - #[doc = " * 7, 3: top"] - #[doc = " * 6, 2: right"] - #[doc = " * 5, 1: bottom"] - #[doc = " * 4, 0: left"] - #[doc = " If the gradient bit is not set, the styling from the hl/vl cells is used for"] - #[doc = " the horizontal and vertical lines, respectively. If the gradient bit is set,"] - #[doc = " the color is linearly interpolated between the two relevant corner cells."] - #[doc = ""] - #[doc = " By default, vertexes are drawn whether their connecting edges are drawn or"] - #[doc = " not. The value of the bits corresponding to NCBOXCORNER_MASK control this,"] - #[doc = " and are interpreted as the number of connecting edges necessary to draw a"] - #[doc = " given corner. At 0 (the default), corners are always drawn. At 3, corners"] - #[doc = " are never drawn (since at most 2 edges can touch a box's corner)."] - pub fn ncplane_box( - n: *mut ncplane, - ul: *const nccell, - ur: *const nccell, - ll: *const nccell, - lr: *const nccell, - hline: *const nccell, - vline: *const nccell, - ystop: cty::c_int, - xstop: cty::c_int, - ctlword: cty::c_uint, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Starting at the specified coordinate, if its glyph is different from that of"] - #[doc = " 'c', 'c' is copied into it, and the original glyph is considered the fill"] - #[doc = " target. We do the same to all cardinally-connected cells having this same"] - #[doc = " fill target. Returns the number of cells polyfilled. An invalid initial y, x"] - #[doc = " is an error. Returns the number of cells filled, or -1 on error."] - pub fn ncplane_polyfill_yx( - n: *mut ncplane, - y: cty::c_int, - x: cty::c_int, - c: *const nccell, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Draw a gradient with its upper-left corner at the current cursor position,"] - #[doc = " stopping at 'ystop'x'xstop'. The glyph composed of 'egc' and 'stylemask' is"] - #[doc = " used for all cells. The channels specified by 'ul', 'ur', 'll', and 'lr'"] - #[doc = " are composed into foreground and background gradients. To do a vertical"] - #[doc = " gradient, 'ul' ought equal 'ur' and 'll' ought equal 'lr'. To do a"] - #[doc = " horizontal gradient, 'ul' ought equal 'll' and 'ur' ought equal 'ul'. To"] - #[doc = " color everything the same, all four channels should be equivalent. The"] - #[doc = " resulting alpha values are equal to incoming alpha values. Returns the"] - #[doc = " number of cells filled on success, or -1 on failure."] - #[doc = ""] - #[doc = " Palette-indexed color is not supported."] - #[doc = ""] - #[doc = " Preconditions for gradient operations (error otherwise):"] - #[doc = ""] - #[doc = " all: only RGB colors, unless all four channels match as default"] - #[doc = " all: all alpha values must be the same"] - #[doc = " 1x1: all four colors must be the same"] - #[doc = " 1xN: both top and both bottom colors must be the same (vertical gradient)"] - #[doc = " Nx1: both left and both right colors must be the same (horizontal gradient)"] - pub fn ncplane_gradient( - n: *mut ncplane, - egc: *const cty::c_char, - stylemask: u32, - ul: u64, - ur: u64, - ll: u64, - lr: u64, - ystop: cty::c_int, - xstop: cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Do a high-resolution gradient using upper blocks and synced backgrounds."] - #[doc = " This doubles the number of vertical gradations, but restricts you to"] - #[doc = " half blocks (appearing to be full blocks). Returns the number of cells"] - #[doc = " filled on success, or -1 on error."] - pub fn ncplane_highgradient( - n: *mut ncplane, - ul: u32, - ur: u32, - ll: u32, - lr: u32, - ystop: cty::c_int, - xstop: cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " ncplane_gradent_sized() meets ncplane_highgradient()."] - pub fn ncplane_highgradient_sized( - n: *mut ncplane, - ul: u32, - ur: u32, - ll: u32, - lr: u32, - ylen: cty::c_int, - xlen: cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Set the given style throughout the specified region, keeping content and"] - #[doc = " channels unchanged. Returns the number of cells set, or -1 on failure."] - pub fn ncplane_format( - n: *mut ncplane, - ystop: cty::c_int, - xstop: cty::c_int, - stylemask: u32, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Set the given channels throughout the specified region, keeping content and"] - #[doc = " attributes unchanged. Returns the number of cells set, or -1 on failure."] - pub fn ncplane_stain( - n: *mut ncplane, - ystop: cty::c_int, - xstop: cty::c_int, - ul: u64, - ur: u64, - ll: u64, - lr: u64, - ) -> cty::c_int; -} -extern "C" { - #[doc = " If 'src' does not intersect with 'dst', 'dst' will not be changed, but it is"] - #[doc = " not an error. If 'dst' is NULL, the operation will target the standard plane."] - pub fn ncplane_mergedown_simple(src: *const ncplane, dst: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Merge the ncplane 'src' down onto the ncplane 'dst'. This is most rigorously"] - #[doc = " defined as \"write to 'dst' the frame that would be rendered were the entire"] - #[doc = " stack made up only of the specified subregion of 'src' and, below it, the"] - #[doc = " subregion of 'dst' having the specified origin. Merging is independent of"] - #[doc = " the position of 'src' viz 'dst' on the z-axis. It is an error to define a"] - #[doc = " subregion of zero area, or that is not entirely contained within 'src'. It"] - #[doc = " is an error to define a target origin such that the projected subregion is"] - #[doc = " not entirely contained within 'dst'. Behavior is undefined if 'src' and"] - #[doc = " 'dst' are equivalent. 'dst' is modified, but 'src' remains unchanged."] - pub fn ncplane_mergedown( - src: *const ncplane, - dst: *mut ncplane, - begsrcy: cty::c_int, - begsrcx: cty::c_int, - leny: cty::c_int, - lenx: cty::c_int, - dsty: cty::c_int, - dstx: cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Erase every cell in the ncplane (each cell is initialized to the null glyph"] - #[doc = " and the default channels/styles). All cells associated with this ncplane are"] - #[doc = " invalidated, and must not be used after the call, *excluding* the base cell."] - #[doc = " The cursor is homed. The plane's active attributes are unaffected."] - pub fn ncplane_erase(n: *mut ncplane); -} -extern "C" { - pub fn ncplane_set_channels(n: *mut ncplane, channels: u64); -} -extern "C" { - #[doc = " Set the specified style bits for the ncplane 'n', whether they're actively"] - #[doc = " supported or not."] - pub fn ncplane_set_styles(n: *mut ncplane, stylebits: cty::c_uint); -} -extern "C" { - #[doc = " Add the specified styles to the ncplane's existing spec."] - pub fn ncplane_on_styles(n: *mut ncplane, stylebits: cty::c_uint); -} -extern "C" { - #[doc = " Remove the specified styles from the ncplane's existing spec."] - pub fn ncplane_off_styles(n: *mut ncplane, stylebits: cty::c_uint); -} -extern "C" { - #[doc = " Deprecated forms of above."] - pub fn ncplane_styles_set(n: *mut ncplane, stylebits: cty::c_uint); -} -extern "C" { - pub fn ncplane_styles_on(n: *mut ncplane, stylebits: cty::c_uint); -} -extern "C" { - pub fn ncplane_styles_off(n: *mut ncplane, stylebits: cty::c_uint); -} -extern "C" { - #[doc = " Set an entire 32-bit channel of the plane"] - pub fn ncplane_set_fchannel(n: *mut ncplane, channel: u32) -> u64; -} -extern "C" { - pub fn ncplane_set_bchannel(n: *mut ncplane, channel: u32) -> u64; -} -extern "C" { - #[doc = " Set the current fore/background color using RGB specifications. If the"] - #[doc = " terminal does not support directly-specified 3x8b cells (24-bit \"TrueColor\","] - #[doc = " indicated by the \"RGB\" terminfo capability), the provided values will be"] - #[doc = " interpreted in some lossy fashion. None of r, g, or b may exceed 255."] - #[doc = " \"HP-like\" terminals require setting foreground and background at the same"] - #[doc = " time using \"color pairs\"; Notcurses will manage color pairs transparently."] - pub fn ncplane_set_fg_rgb8( - n: *mut ncplane, - r: cty::c_int, - g: cty::c_int, - b: cty::c_int, - ) -> cty::c_int; -} -extern "C" { - pub fn ncplane_set_bg_rgb8( - n: *mut ncplane, - r: cty::c_int, - g: cty::c_int, - b: cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Same, but clipped to [0..255]."] - pub fn ncplane_set_bg_rgb8_clipped( - n: *mut ncplane, - r: cty::c_int, - g: cty::c_int, - b: cty::c_int, - ); -} -extern "C" { - pub fn ncplane_set_fg_rgb8_clipped( - n: *mut ncplane, - r: cty::c_int, - g: cty::c_int, - b: cty::c_int, - ); -} -extern "C" { - #[doc = " Same, but with rgb assembled into a channel (i.e. lower 24 bits)."] - pub fn ncplane_set_fg_rgb(n: *mut ncplane, channel: u32) -> cty::c_int; -} -extern "C" { - pub fn ncplane_set_bg_rgb(n: *mut ncplane, channel: u32) -> cty::c_int; -} -extern "C" { - #[doc = " Use the default color for the foreground/background."] - pub fn ncplane_set_fg_default(n: *mut ncplane); -} -extern "C" { - pub fn ncplane_set_bg_default(n: *mut ncplane); -} -extern "C" { - #[doc = " Set the ncplane's foreground palette index, set the foreground palette index"] - #[doc = " bit, set it foreground-opaque, and clear the foreground default color bit."] - pub fn ncplane_set_fg_palindex(n: *mut ncplane, idx: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn ncplane_set_bg_palindex(n: *mut ncplane, idx: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Set the alpha parameters for ncplane 'n'."] - pub fn ncplane_set_fg_alpha(n: *mut ncplane, alpha: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn ncplane_set_bg_alpha(n: *mut ncplane, alpha: cty::c_int) -> cty::c_int; -} -#[doc = " Called for each fade iteration on 'ncp'. If anything but 0 is returned,"] -#[doc = " the fading operation ceases immediately, and that value is propagated out."] -#[doc = " The recommended absolute display time target is passed in 'tspec'."] -pub type fadecb = ::core::option::Option< - unsafe extern "C" fn( - nc: *mut notcurses, - n: *mut ncplane, - arg1: *const timespec, - curry: *mut cty::c_void, - ) -> cty::c_int, ->; -extern "C" { - #[doc = " Fade the ncplane out over the provided time, calling 'fader' at each"] - #[doc = " iteration. Requires a terminal which supports truecolor, or at least palette"] - #[doc = " modification (if the terminal uses a palette, our ability to fade planes is"] - #[doc = " limited, and affected by the complexity of the rest of the screen)."] - pub fn ncplane_fadeout( - n: *mut ncplane, - ts: *const timespec, - fader: fadecb, - curry: *mut cty::c_void, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Fade the ncplane in over the specified time. Load the ncplane with the"] - #[doc = " target cells without rendering, then call this function. When it's done, the"] - #[doc = " ncplane will have reached the target levels, starting from zeroes."] - pub fn ncplane_fadein( - n: *mut ncplane, - ts: *const timespec, - fader: fadecb, - curry: *mut cty::c_void, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Rather than the simple ncplane_fade{in/out}(), ncfadectx_setup() can be"] - #[doc = " paired with a loop over ncplane_fade{in/out}_iteration() + ncfadectx_free()."] - pub fn ncfadectx_setup(n: *mut ncplane) -> *mut ncfadectx; -} -extern "C" { - #[doc = " Return the number of iterations through which 'nctx' will fade."] - pub fn ncfadectx_iterations(nctx: *const ncfadectx) -> cty::c_int; -} -extern "C" { - #[doc = " Fade out through 'iter' iterations, where"] - #[doc = " 'iter' < 'ncfadectx_iterations(nctx)'."] - pub fn ncplane_fadeout_iteration( - n: *mut ncplane, - nctx: *mut ncfadectx, - iter: cty::c_int, - fader: fadecb, - curry: *mut cty::c_void, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Fade in through 'iter' iterations, where"] - #[doc = " 'iter' < 'ncfadectx_iterations(nctx)'."] - pub fn ncplane_fadein_iteration( - n: *mut ncplane, - nctx: *mut ncfadectx, - iter: cty::c_int, - fader: fadecb, - curry: *mut cty::c_void, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Pulse the plane in and out until the callback returns non-zero, relying on"] - #[doc = " the callback 'fader' to initiate rendering. 'ts' defines the half-period"] - #[doc = " (i.e. the transition from black to full brightness, or back again). Proper"] - #[doc = " use involves preparing (but not rendering) an ncplane, then calling"] - #[doc = " ncplane_pulse(), which will fade in from black to the specified colors."] - pub fn ncplane_pulse( - n: *mut ncplane, - ts: *const timespec, - fader: fadecb, - curry: *mut cty::c_void, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Release the resources associated with 'nctx'."] - pub fn ncfadectx_free(nctx: *mut ncfadectx); -} -extern "C" { - pub fn nccells_rounded_box( - n: *mut ncplane, - styles: u32, - channels: u64, - ul: *mut nccell, - ur: *mut nccell, - ll: *mut nccell, - lr: *mut nccell, - hl: *mut nccell, - vl: *mut nccell, - ) -> cty::c_int; -} -extern "C" { - pub fn cells_rounded_box( - n: *mut ncplane, - styles: u32, - channels: u64, - ul: *mut nccell, - ur: *mut nccell, - ll: *mut nccell, - lr: *mut nccell, - hl: *mut nccell, - vl: *mut nccell, - ) -> cty::c_int; -} -extern "C" { - pub fn nccells_double_box( - n: *mut ncplane, - styles: u32, - channels: u64, - ul: *mut nccell, - ur: *mut nccell, - ll: *mut nccell, - lr: *mut nccell, - hl: *mut nccell, - vl: *mut nccell, - ) -> cty::c_int; -} -extern "C" { - pub fn cells_double_box( - n: *mut ncplane, - styles: u32, - channels: u64, - ul: *mut nccell, - ur: *mut nccell, - ll: *mut nccell, - lr: *mut nccell, - hl: *mut nccell, - vl: *mut nccell, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Open a visual at 'file', extract a codec and parameters, decode the first"] - #[doc = " image to memory."] - pub fn ncvisual_from_file(file: *const cty::c_char) -> *mut ncvisual; -} -extern "C" { - #[doc = " Prepare an ncvisual, and its underlying plane, based off RGBA content in"] - #[doc = " memory at 'rgba'. 'rgba' is laid out as 'rows' lines, each of which is"] - #[doc = " 'rowstride' bytes in length. Each line has 'cols' 32-bit 8bpc RGBA pixels"] - #[doc = " followed by possible padding (there will be 'rowstride' - 'cols' * 4 bytes"] - #[doc = " of padding). The total size of 'rgba' is thus (rows * rowstride) bytes, of"] - #[doc = " which (rows * cols * 4) bytes are actual non-padding data."] - pub fn ncvisual_from_rgba( - rgba: *const cty::c_void, - rows: cty::c_int, - rowstride: cty::c_int, - cols: cty::c_int, - ) -> *mut ncvisual; -} -extern "C" { - #[doc = " ncvisual_from_rgba(), but 'bgra' is arranged as BGRA."] - pub fn ncvisual_from_bgra( - bgra: *const cty::c_void, - rows: cty::c_int, - rowstride: cty::c_int, - cols: cty::c_int, - ) -> *mut ncvisual; -} -extern "C" { - #[doc = " Promote an ncplane 'n' to an ncvisual. The plane may contain only spaces,"] - #[doc = " half blocks, and full blocks. The latter will be checked, and any other"] - #[doc = " glyph will result in a NULL being returned. This function exists so that"] - #[doc = " planes can be subjected to ncvisual transformations. If possible, it's"] - #[doc = " better to create the ncvisual from memory using ncvisual_from_rgba()."] - pub fn ncvisual_from_plane( - n: *const ncplane, - blit: ncblitter_e, - begy: cty::c_int, - begx: cty::c_int, - leny: cty::c_int, - lenx: cty::c_int, - ) -> *mut ncvisual; -} -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncvisual_options { - #[doc = " if no ncplane is provided, one will be created using the exact size"] - #[doc = " necessary to render the source with perfect fidelity (this might be"] - #[doc = " smaller or larger than the rendering area)."] - pub n: *mut ncplane, - #[doc = " the scaling is ignored if no ncplane is provided (it ought be NCSCALE_NONE"] - #[doc = " in this case). otherwise, the source is stretched/scaled relative to the"] - #[doc = " provided ncplane."] - pub scaling: ncscale_e, - #[doc = " if an ncplane is provided, y and x specify where the visual will be"] - #[doc = " rendered on that plane. otherwise, they specify where the created ncplane"] - #[doc = " will be placed relative to the standard plane's origin. x is an ncalign_e"] - #[doc = " value if NCVISUAL_OPTION_HORALIGNED is provided. y is an ncalign_e if"] - #[doc = " NCVISUAL_OPTION_VERALIGNED is provided."] - pub y: cty::c_int, - #[doc = " if an ncplane is provided, y and x specify where the visual will be"] - #[doc = " rendered on that plane. otherwise, they specify where the created ncplane"] - #[doc = " will be placed relative to the standard plane's origin. x is an ncalign_e"] - #[doc = " value if NCVISUAL_OPTION_HORALIGNED is provided. y is an ncalign_e if"] - #[doc = " NCVISUAL_OPTION_VERALIGNED is provided."] - pub x: cty::c_int, - #[doc = " origin of rendered section"] - pub begy: cty::c_int, - #[doc = " origin of rendered section"] - pub begx: cty::c_int, - #[doc = " size of rendered section"] - pub leny: cty::c_int, - #[doc = " size of rendered section"] - pub lenx: cty::c_int, - #[doc = " glyph set to use (maps input to output cells)"] - pub blitter: ncblitter_e, - #[doc = " bitmask over NCVISUAL_OPTION_*"] - pub flags: u64, - #[doc = " treat this color as transparent under NCVISUAL_OPTION_ADDALPHA"] - pub transcolor: u32, -} -#[test] -fn bindgen_test_layout_ncvisual_options() { - assert_eq!( - ::core::mem::size_of::(), - 56usize, - concat!("Size of: ", stringify!(ncvisual_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncvisual_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).n as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(n) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).scaling as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(scaling) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).y as *const _ as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(y) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).x as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(x) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).begy as *const _ as usize }, - 20usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(begy) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).begx as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(begx) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).leny as *const _ as usize }, - 28usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(leny) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).lenx as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(lenx) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).blitter as *const _ as usize }, - 36usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(blitter) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(flags) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).transcolor as *const _ as usize }, - 48usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(transcolor) - ) - ); -} -impl Default for ncvisual_options { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -extern "C" { - #[doc = " Create an RGBA flat array from the selected region of the ncplane 'nc'."] - #[doc = " Start at the plane's 'begy'x'begx' coordinate (which must lie on the"] - #[doc = " plane), continuing for 'leny'x'lenx' cells. Either or both of 'leny' and"] - #[doc = " 'lenx' can be specified as -1 to go through the boundary of the plane."] - #[doc = " Only glyphs from the specified ncblitset may be present. If 'pxdimy' and/or"] - #[doc = " 'pxdimx' are non-NULL, they will be filled in with the pixel geometry."] - pub fn ncplane_as_rgba( - n: *const ncplane, - blit: ncblitter_e, - begy: cty::c_int, - begx: cty::c_int, - leny: cty::c_int, - lenx: cty::c_int, - pxdimy: *mut cty::c_int, - pxdimx: *mut cty::c_int, - ) -> *mut u32; -} -extern "C" { - #[doc = " Get the size and ratio of ncvisual pixels to output cells along the y"] - #[doc = " and x axes. The input size (in pixels) will be written to 'y' and 'x'."] - #[doc = " The scaling will be written to 'scaley' and 'scalex'. With these:"] - #[doc = " rows = (y / scaley) + !!(y % scaley) or (y + scaley - 1) / scaley"] - #[doc = " cols = (x / scalex) + !!(x % scalex) or (x + scalex - 1) / scalex"] - #[doc = " Returns non-zero for an invalid 'vopts'. The blitter that will be used"] - #[doc = " is returned in '*blitter'."] - pub fn ncvisual_blitter_geom( - nc: *const notcurses, - n: *const ncvisual, - vopts: *const ncvisual_options, - y: *mut cty::c_int, - x: *mut cty::c_int, - scaley: *mut cty::c_int, - scalex: *mut cty::c_int, - blitter: *mut ncblitter_e, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Destroy an ncvisual. Rendered elements will not be disrupted, but the visual"] - #[doc = " can be neither decoded nor rendered any further."] - pub fn ncvisual_destroy(ncv: *mut ncvisual); -} -extern "C" { - #[doc = " extract the next frame from an ncvisual. returns 1 on end of file, 0 on"] - #[doc = " success, and -1 on failure."] - pub fn ncvisual_decode(nc: *mut ncvisual) -> cty::c_int; -} -extern "C" { - #[doc = " decode the next frame ala ncvisual_decode(), but if we have reached the end,"] - #[doc = " rewind to the first frame of the ncvisual. a subsequent 'ncvisual_render()'"] - #[doc = " will render the first frame, as if the ncvisual had been closed and reopened."] - #[doc = " the return values remain the same as those of ncvisual_decode()."] - pub fn ncvisual_decode_loop(nc: *mut ncvisual) -> cty::c_int; -} -extern "C" { - #[doc = " Rotate the visual 'rads' radians. Only M_PI/2 and -M_PI/2 are"] - #[doc = " supported at the moment, but this will change FIXME."] - pub fn ncvisual_rotate(n: *mut ncvisual, rads: f64) -> cty::c_int; -} -extern "C" { - #[doc = " Resize the visual so that it is 'rows' X 'columns', using the best scheme"] - #[doc = " available. This is a lossy transformation, unless the size is unchanged."] - pub fn ncvisual_resize(n: *mut ncvisual, rows: cty::c_int, cols: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Inflate each pixel in the image to 'scale'x'scale' pixels. It is an error"] - #[doc = " if 'scale' is less than 1. The original color is retained."] - pub fn ncvisual_inflate(n: *mut ncvisual, scale: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Polyfill at the specified location within the ncvisual 'n', using 'rgba'."] - pub fn ncvisual_polyfill_yx( - n: *mut ncvisual, - y: cty::c_int, - x: cty::c_int, - rgba: u32, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Get the specified pixel from the specified ncvisual."] - pub fn ncvisual_at_yx( - n: *const ncvisual, - y: cty::c_int, - x: cty::c_int, - pixel: *mut u32, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Set the specified pixel in the specified ncvisual."] - pub fn ncvisual_set_yx( - n: *const ncvisual, - y: cty::c_int, - x: cty::c_int, - pixel: u32, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Render the decoded frame to the specified ncplane. If one is not provided,"] - #[doc = " one will be created, having the exact size necessary to display the visual."] - #[doc = " A subregion of the visual can be rendered using 'begx', 'begy', 'lenx', and"] - #[doc = " 'leny'. Negative values for 'begy' or 'begx' are an error. It is an error to"] - #[doc = " specify any region beyond the boundaries of the frame. Returns the"] - #[doc = " (possibly newly-created) plane to which we drew."] - pub fn ncvisual_render( - nc: *mut notcurses, - ncv: *mut ncvisual, - vopts: *const ncvisual_options, - ) -> *mut ncplane; -} -extern "C" { - #[doc = " If a subtitle ought be displayed at this time, return a heap-allocated copy"] - #[doc = " of the UTF8 text."] - pub fn ncvisual_subtitle(ncv: *const ncvisual) -> *mut cty::c_char; -} -#[doc = " Called for each frame rendered from 'ncv'. If anything but 0 is returned,"] -#[doc = " the streaming operation ceases immediately, and that value is propagated out."] -#[doc = " The recommended absolute display time target is passed in 'tspec'."] -pub type ncstreamcb = ::core::option::Option< - unsafe extern "C" fn( - arg1: *mut ncvisual, - arg2: *mut ncvisual_options, - arg3: *const timespec, - arg4: *mut cty::c_void, - ) -> cty::c_int, ->; -extern "C" { - #[doc = " Shut up and display my frames! Provide as an argument to ncvisual_stream()."] - #[doc = " If you'd like subtitles to be decoded, provide an ncplane as the curry. If the"] - #[doc = " curry is NULL, subtitles will not be displayed."] - pub fn ncvisual_simple_streamer( - ncv: *mut ncvisual, - vopts: *mut ncvisual_options, - tspec: *const timespec, - curry: *mut cty::c_void, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Stream the entirety of the media, according to its own timing. Blocking,"] - #[doc = " obviously. streamer may be NULL; it is otherwise called for each frame, and"] - #[doc = " its return value handled as outlined for streamcb. If streamer() returns"] - #[doc = " non-zero, the stream is aborted, and that value is returned. By convention,"] - #[doc = " return a positive number to indicate intentional abort from within"] - #[doc = " streamer(). 'timescale' allows the frame duration time to be scaled. For a"] - #[doc = " visual naturally running at 30FPS, a 'timescale' of 0.1 will result in"] - #[doc = " 300FPS, and a 'timescale' of 10 will result in 3FPS. It is an error to"] - #[doc = " supply 'timescale' less than or equal to 0."] - pub fn ncvisual_stream( - nc: *mut notcurses, - ncv: *mut ncvisual, - timescale: f32, - streamer: ncstreamcb, - vopts: *const ncvisual_options, - curry: *mut cty::c_void, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Blit a flat array 'data' of RGBA 32-bit values to the ncplane 'vopts->n',"] - #[doc = " which mustn't be NULL. the blit begins at 'vopts->y' and 'vopts->x' relative"] - #[doc = " to the specified plane. Each source row ought occupy 'linesize' bytes (this"] - #[doc = " might be greater than 'vopts->lenx' * 4 due to padding or partial blits). A"] - #[doc = " subregion of the input can be specified with the 'begy'x'begx' and"] - #[doc = " 'leny'x'lenx' fields from 'vopts'. Returns the number of pixels blitted, or"] - #[doc = " -1 on error."] - pub fn ncblit_rgba( - data: *const cty::c_void, - linesize: cty::c_int, - vopts: *const ncvisual_options, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Same as ncblit_rgba(), but for BGRx."] - pub fn ncblit_bgrx( - data: *const cty::c_void, - linesize: cty::c_int, - vopts: *const ncvisual_options, - ) -> cty::c_int; -} -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncreel_options { - #[doc = " bitfield; 1s will not be drawn (see bordermaskbits)"] - pub bordermask: cty::c_uint, - #[doc = " attributes used for ncreel border"] - pub borderchan: u64, - #[doc = " bitfield; same as bordermask but for tablet borders"] - pub tabletmask: cty::c_uint, - #[doc = " tablet border styling channel"] - pub tabletchan: u64, - #[doc = " focused tablet border styling channel"] - pub focusedchan: u64, - #[doc = " bitfield over NCREEL_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncreel_options() { - assert_eq!( - ::core::mem::size_of::(), - 48usize, - concat!("Size of: ", stringify!(ncreel_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncreel_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).bordermask as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncreel_options), - "::", - stringify!(bordermask) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).borderchan as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncreel_options), - "::", - stringify!(borderchan) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).tabletmask as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncreel_options), - "::", - stringify!(tabletmask) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).tabletchan as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncreel_options), - "::", - stringify!(tabletchan) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).focusedchan as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncreel_options), - "::", - stringify!(focusedchan) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(ncreel_options), - "::", - stringify!(flags) - ) - ); -} -extern "C" { - #[doc = " Take over the ncplane 'nc' and use it to draw a reel according to 'popts'."] - #[doc = " The plane will be destroyed by ncreel_destroy(); this transfers ownership."] - pub fn ncreel_create(n: *mut ncplane, popts: *const ncreel_options) -> *mut ncreel; -} -extern "C" { - #[doc = " Returns the ncplane on which this ncreel lives."] - pub fn ncreel_plane(nr: *mut ncreel) -> *mut ncplane; -} -#[doc = " Tablet draw callback, provided a tablet (from which the ncplane and userptr"] -#[doc = " may be extracted), and a bool indicating whether output ought be drawn from"] -#[doc = " the top (true) or bottom (false). Returns non-negative count of output lines,"] -#[doc = " which must be less than or equal to ncplane_dim_y(nctablet_plane(t))."] -pub type tabletcb = - ::core::option::Option cty::c_int>; -extern "C" { - #[doc = " Add a new nctablet to the provided ncreel 'nr', having the callback object"] - #[doc = " 'opaque'. Neither, either, or both of 'after' and 'before' may be specified."] - #[doc = " If neither is specified, the new tablet can be added anywhere on the reel."] - #[doc = " If one or the other is specified, the tablet will be added before or after"] - #[doc = " the specified tablet. If both are specified, the tablet will be added to the"] - #[doc = " resulting location, assuming it is valid (after->next == before->prev); if"] - #[doc = " it is not valid, or there is any other error, NULL will be returned."] - pub fn ncreel_add( - nr: *mut ncreel, - after: *mut nctablet, - before: *mut nctablet, - cb: tabletcb, - opaque: *mut cty::c_void, - ) -> *mut nctablet; -} -extern "C" { - #[doc = " Return the number of nctablets in the ncreel 'nr'."] - pub fn ncreel_tabletcount(nr: *const ncreel) -> cty::c_int; -} -extern "C" { - #[doc = " Delete the tablet specified by t from the ncreel 'nr'. Returns -1 if the"] - #[doc = " tablet cannot be found."] - pub fn ncreel_del(nr: *mut ncreel, t: *mut nctablet) -> cty::c_int; -} -extern "C" { - #[doc = " Redraw the ncreel 'nr' in its entirety. The reel will be cleared, and"] - #[doc = " tablets will be lain out, using the focused tablet as a fulcrum. Tablet"] - #[doc = " drawing callbacks will be invoked for each visible tablet."] - pub fn ncreel_redraw(nr: *mut ncreel) -> cty::c_int; -} -extern "C" { - #[doc = " Offer input 'ni' to the ncreel 'nr'. If it's relevant, this function returns"] - #[doc = " true, and the input ought not be processed further. If it's irrelevant to"] - #[doc = " the reel, false is returned. Relevant inputs include:"] - #[doc = " * a mouse click on a tablet (focuses tablet)"] - #[doc = " * a mouse scrollwheel event (rolls reel)"] - #[doc = " * up, down, pgup, or pgdown (navigates among items)"] - pub fn ncreel_offer_input(nr: *mut ncreel, ni: *const ncinput) -> bool; -} -extern "C" { - #[doc = " Return the focused tablet, if any tablets are present. This is not a copy;"] - #[doc = " be careful to use it only for the duration of a critical section."] - pub fn ncreel_focused(nr: *mut ncreel) -> *mut nctablet; -} -extern "C" { - #[doc = " Change focus to the next tablet, if one exists"] - pub fn ncreel_next(nr: *mut ncreel) -> *mut nctablet; -} -extern "C" { - #[doc = " Change focus to the previous tablet, if one exists"] - pub fn ncreel_prev(nr: *mut ncreel) -> *mut nctablet; -} -extern "C" { - #[doc = " Destroy an ncreel allocated with ncreel_create()."] - pub fn ncreel_destroy(nr: *mut ncreel); -} -extern "C" { - #[doc = " Returns a pointer to a user pointer associated with this nctablet."] - pub fn nctablet_userptr(t: *mut nctablet) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Access the ncplane associated with nctablet 't', if one exists."] - pub fn nctablet_plane(t: *mut nctablet) -> *mut ncplane; -} -extern "C" { - #[doc = " Deprecated form of nctablet_plane()."] - pub fn nctablet_ncplane(t: *mut nctablet) -> *mut ncplane; -} -extern "C" { - #[doc = " Takes an arbitrarily large number, and prints it into a fixed-size buffer by"] - #[doc = " adding the necessary SI suffix. Usually, pass a |[IB]PREFIXSTRLEN+1|-sized"] - #[doc = " buffer to generate up to |[IB]PREFIXCOLUMNS| columns' worth of EGCs. The"] - #[doc = " characteristic can occupy up through |mult-1| characters (3 for 1000, 4 for"] - #[doc = " 1024). The mantissa can occupy either zero or two characters."] - #[doc = ""] - #[doc = " Floating-point is never used, because an IEEE758 double can only losslessly"] - #[doc = " represent integers through 2^53-1."] - #[doc = ""] - #[doc = " 2^64-1 is 18446744073709551615, 18.45E(xa). KMGTPEZY thus suffice to handle"] - #[doc = " an 89-bit uintmax_t. Beyond Z(etta) and Y(otta) lie lands unspecified by SI."] - #[doc = " 2^-63 is 0.000000000000000000108, 1.08a(tto)."] - #[doc = " val: value to print"] - #[doc = " decimal: scaling. '1' if none has taken place."] - #[doc = " buf: buffer in which string will be generated"] - #[doc = " omitdec: inhibit printing of all-0 decimal portions"] - #[doc = " mult: base of suffix system (almost always 1000 or 1024)"] - #[doc = " uprefix: character to print following suffix ('i' for kibibytes basically)."] - #[doc = " only printed if suffix is actually printed (input >= mult)."] - #[doc = ""] - #[doc = " You are encouraged to consult notcurses_metric(3)."] - pub fn ncmetric( - val: uintmax_t, - decimal: uintmax_t, - buf: *mut cty::c_char, - omitdec: cty::c_int, - mult: uintmax_t, - uprefix: cty::c_int, - ) -> *const cty::c_char; -} -extern "C" { - #[doc = " Enable or disable the terminal's cursor, if supported, placing it at"] - #[doc = " 'y', 'x'. Immediate effect (no need for a call to notcurses_render())."] - #[doc = " It is an error if 'y', 'x' lies outside the standard plane."] - pub fn notcurses_cursor_enable(nc: *mut notcurses, y: cty::c_int, x: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn notcurses_cursor_disable(nc: *mut notcurses) -> cty::c_int; -} -#[doc = " Palette API. Some terminals only support 256 colors, but allow the full"] -#[doc = " palette to be specified with arbitrary RGB colors. In all cases, it's more"] -#[doc = " performant to use indexed colors, since it's much less data to write to the"] -#[doc = " terminal. If you can limit yourself to 256 colors, that's probably best."] -#[repr(C)] -#[derive(Copy, Clone)] -pub struct palette256 { - #[doc = " RGB values as regular ol' channels"] - pub chans: [u32; 256usize], -} -#[test] -fn bindgen_test_layout_palette256() { - assert_eq!( - ::core::mem::size_of::(), - 1024usize, - concat!("Size of: ", stringify!(palette256)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(palette256)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).chans as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(palette256), - "::", - stringify!(chans) - ) - ); -} -impl Default for palette256 { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -extern "C" { - #[doc = " Create a new palette store. It will be initialized with notcurses' best"] - #[doc = " knowledge of the currently configured palette. The palette upon startup"] - #[doc = " cannot be reliably detected, sadly."] - pub fn palette256_new(nc: *mut notcurses) -> *mut palette256; -} -extern "C" { - #[doc = " Attempt to configure the terminal with the provided palette 'p'. Does not"] - #[doc = " transfer ownership of 'p'; palette256_free() can (ought) still be called."] - pub fn palette256_use(nc: *mut notcurses, p: *const palette256) -> cty::c_int; -} -extern "C" { - #[doc = " Free the palette store 'p'."] - pub fn palette256_free(p: *mut palette256); -} -extern "C" { - #[doc = " Convert the plane's content to greyscale."] - pub fn ncplane_greyscale(n: *mut ncplane); -} -#[doc = " selection widget -- an ncplane with a title header and a body section. the"] -#[doc = " body section supports infinite scrolling up and down."] -#[doc = ""] -#[doc = " At all times, exactly one item is selected."] -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncselector_item { - pub option: *mut cty::c_char, - pub desc: *mut cty::c_char, - #[doc = " filled in by library"] - pub opcolumns: size_t, - #[doc = " filled in by library"] - pub desccolumns: size_t, -} -#[test] -fn bindgen_test_layout_ncselector_item() { - assert_eq!( - ::core::mem::size_of::(), - 32usize, - concat!("Size of: ", stringify!(ncselector_item)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncselector_item)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).option as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncselector_item), - "::", - stringify!(option) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).desc as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncselector_item), - "::", - stringify!(desc) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).opcolumns as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncselector_item), - "::", - stringify!(opcolumns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).desccolumns as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncselector_item), - "::", - stringify!(desccolumns) - ) - ); -} -impl Default for ncselector_item { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncselector_options { - #[doc = " title may be NULL, inhibiting riser, saving two rows."] - pub title: *mut cty::c_char, - #[doc = " secondary may be NULL"] - pub secondary: *mut cty::c_char, - #[doc = " footer may be NULL"] - pub footer: *mut cty::c_char, - #[doc = " initial items and descriptions"] - pub items: *mut ncselector_item, - #[doc = " default item (selected at start), must be < itemcount unless itemcount is"] - #[doc = " 0, in which case 'defidx' must also be 0"] - pub defidx: cty::c_uint, - #[doc = " maximum number of options to display at once, 0 to use all available space"] - pub maxdisplay: cty::c_uint, - #[doc = " option channels"] - pub opchannels: u64, - #[doc = " description channels"] - pub descchannels: u64, - #[doc = " title channels"] - pub titlechannels: u64, - #[doc = " secondary and footer channels"] - pub footchannels: u64, - #[doc = " border channels"] - pub boxchannels: u64, - #[doc = " bitfield of NCSELECTOR_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncselector_options() { - assert_eq!( - ::core::mem::size_of::(), - 88usize, - concat!("Size of: ", stringify!(ncselector_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncselector_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).title as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(title) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).secondary as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(secondary) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).footer as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(footer) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).items as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(items) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).defidx as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(defidx) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).maxdisplay as *const _ as usize }, - 36usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(maxdisplay) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).opchannels as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(opchannels) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).descchannels as *const _ as usize - }, - 48usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(descchannels) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).titlechannels as *const _ as usize - }, - 56usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(titlechannels) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).footchannels as *const _ as usize - }, - 64usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(footchannels) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).boxchannels as *const _ as usize }, - 72usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(boxchannels) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 80usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(flags) - ) - ); -} -impl Default for ncselector_options { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -extern "C" { - pub fn ncselector_create(n: *mut ncplane, opts: *const ncselector_options) -> *mut ncselector; -} -extern "C" { - #[doc = " Dynamically add or delete items. It is usually sufficient to supply a static"] - #[doc = " list of items via ncselector_options->items."] - pub fn ncselector_additem(n: *mut ncselector, item: *const ncselector_item) -> cty::c_int; -} -extern "C" { - pub fn ncselector_delitem(n: *mut ncselector, item: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Return reference to the selected option, or NULL if there are no items."] - pub fn ncselector_selected(n: *const ncselector) -> *const cty::c_char; -} -extern "C" { - #[doc = " Return a reference to the ncselector's underlying ncplane."] - pub fn ncselector_plane(n: *mut ncselector) -> *mut ncplane; -} -extern "C" { - #[doc = " Move up or down in the list. A reference to the newly-selected item is"] - #[doc = " returned, or NULL if there are no items in the list."] - pub fn ncselector_previtem(n: *mut ncselector) -> *const cty::c_char; -} -extern "C" { - pub fn ncselector_nextitem(n: *mut ncselector) -> *const cty::c_char; -} -extern "C" { - #[doc = " Offer the input to the ncselector. If it's relevant, this function returns"] - #[doc = " true, and the input ought not be processed further. If it's irrelevant to"] - #[doc = " the selector, false is returned. Relevant inputs include:"] - #[doc = " * a mouse click on an item"] - #[doc = " * a mouse scrollwheel event"] - #[doc = " * a mouse click on the scrolling arrows"] - #[doc = " * up, down, pgup, or pgdown on an unrolled menu (navigates among items)"] - pub fn ncselector_offer_input(n: *mut ncselector, nc: *const ncinput) -> bool; -} -extern "C" { - #[doc = " Destroy the ncselector. If 'item' is not NULL, the last selected option will"] - #[doc = " be strdup()ed and assigned to '*item' (and must be free()d by the caller)."] - pub fn ncselector_destroy(n: *mut ncselector, item: *mut *mut cty::c_char); -} -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncmselector_item { - pub option: *mut cty::c_char, - pub desc: *mut cty::c_char, - pub selected: bool, -} -#[test] -fn bindgen_test_layout_ncmselector_item() { - assert_eq!( - ::core::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(ncmselector_item)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncmselector_item)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).option as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncmselector_item), - "::", - stringify!(option) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).desc as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncmselector_item), - "::", - stringify!(desc) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).selected as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncmselector_item), - "::", - stringify!(selected) - ) - ); -} -impl Default for ncmselector_item { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[doc = " multiselection widget -- a selector supporting multiple selections."] -#[doc = ""] -#[doc = " Unlike the selector widget, zero to all of the items can be selected, but"] -#[doc = " also the widget does not support adding or removing items at runtime."] -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncmultiselector_options { - #[doc = " title may be NULL, inhibiting riser, saving two rows."] - pub title: *mut cty::c_char, - #[doc = " secondary may be NULL"] - pub secondary: *mut cty::c_char, - #[doc = " footer may be NULL"] - pub footer: *mut cty::c_char, - #[doc = " initial items, descriptions, and statuses"] - pub items: *mut ncmselector_item, - #[doc = " maximum number of options to display at once, 0 to use all available space"] - pub maxdisplay: cty::c_uint, - #[doc = " option channels"] - pub opchannels: u64, - #[doc = " description channels"] - pub descchannels: u64, - #[doc = " title channels"] - pub titlechannels: u64, - #[doc = " secondary and footer channels"] - pub footchannels: u64, - #[doc = " border channels"] - pub boxchannels: u64, - #[doc = " bitfield of NCMULTISELECTOR_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncmultiselector_options() { - assert_eq!( - ::core::mem::size_of::(), - 88usize, - concat!("Size of: ", stringify!(ncmultiselector_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncmultiselector_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).title as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(title) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).secondary as *const _ as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(secondary) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).footer as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(footer) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).items as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(items) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).maxdisplay as *const _ as usize - }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(maxdisplay) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).opchannels as *const _ as usize - }, - 40usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(opchannels) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).descchannels as *const _ as usize - }, - 48usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(descchannels) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).titlechannels as *const _ as usize - }, - 56usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(titlechannels) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).footchannels as *const _ as usize - }, - 64usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(footchannels) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).boxchannels as *const _ as usize - }, - 72usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(boxchannels) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 80usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(flags) - ) - ); -} -impl Default for ncmultiselector_options { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -extern "C" { - pub fn ncmultiselector_create( - n: *mut ncplane, - opts: *const ncmultiselector_options, - ) -> *mut ncmultiselector; -} -extern "C" { - #[doc = " Return selected vector. An array of bools must be provided, along with its"] - #[doc = " length. If that length doesn't match the itemcount, it is an error."] - pub fn ncmultiselector_selected( - n: *mut ncmultiselector, - selected: *mut bool, - count: cty::c_uint, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Return a reference to the ncmultiselector's underlying ncplane."] - pub fn ncmultiselector_plane(n: *mut ncmultiselector) -> *mut ncplane; -} -extern "C" { - #[doc = " Offer the input to the ncmultiselector. If it's relevant, this function"] - #[doc = " returns true, and the input ought not be processed further. If it's"] - #[doc = " irrelevant to the multiselector, false is returned. Relevant inputs include:"] - #[doc = " * a mouse click on an item"] - #[doc = " * a mouse scrollwheel event"] - #[doc = " * a mouse click on the scrolling arrows"] - #[doc = " * up, down, pgup, or pgdown on an unrolled menu (navigates among items)"] - pub fn ncmultiselector_offer_input(n: *mut ncmultiselector, nc: *const ncinput) -> bool; -} -extern "C" { - #[doc = " Destroy the ncmultiselector."] - pub fn ncmultiselector_destroy(n: *mut ncmultiselector); -} -#[doc = " each item has a curry, and zero or more subitems."] -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct nctree_item { - pub curry: *mut cty::c_void, - pub subs: *mut nctree_item, - pub subcount: cty::c_uint, -} -#[test] -fn bindgen_test_layout_nctree_item() { - assert_eq!( - ::core::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(nctree_item)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(nctree_item)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).curry as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(nctree_item), - "::", - stringify!(curry) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).subs as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(nctree_item), - "::", - stringify!(subs) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).subcount as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(nctree_item), - "::", - stringify!(subcount) - ) - ); -} -impl Default for nctree_item { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct nctree_options { - #[doc = " top-level nctree_item array"] - pub items: *const nctree_item, - #[doc = " size of |items|"] - pub count: cty::c_uint, - #[doc = " item callback function"] - pub nctreecb: ::core::option::Option< - unsafe extern "C" fn( - arg1: *mut ncplane, - arg2: *mut cty::c_void, - arg3: cty::c_int, - ) -> cty::c_int, - >, - #[doc = " columns to indent per level of hierarchy"] - pub indentcols: cty::c_int, - #[doc = " bitfield of NCTREE_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_nctree_options() { - assert_eq!( - ::core::mem::size_of::(), - 40usize, - concat!("Size of: ", stringify!(nctree_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(nctree_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).items as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(nctree_options), - "::", - stringify!(items) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).count as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(nctree_options), - "::", - stringify!(count) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).nctreecb as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(nctree_options), - "::", - stringify!(nctreecb) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).indentcols as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(nctree_options), - "::", - stringify!(indentcols) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(nctree_options), - "::", - stringify!(flags) - ) - ); -} -impl Default for nctree_options { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct nctree { - _unused: [u8; 0], -} -extern "C" { - #[doc = " |opts| may *not* be NULL, since it is necessary to define a callback"] - #[doc = " function."] - pub fn nctree_create(n: *mut ncplane, opts: *const nctree_options) -> *mut nctree; -} -extern "C" { - #[doc = " Returns the ncplane on which this nctree lives."] - pub fn nctree_plane(n: *mut nctree) -> *mut ncplane; -} -extern "C" { - #[doc = " Redraw the nctree 'n' in its entirety. The tree will be cleared, and items"] - #[doc = " will be lain out, using the focused item as a fulcrum. Item-drawing"] - #[doc = " callbacks will be invoked for each visible item."] - pub fn nctree_redraw(n: *mut nctree) -> cty::c_int; -} -extern "C" { - #[doc = " Offer input 'ni' to the nctree 'n'. If it's relevant, this function returns"] - #[doc = " true, and the input ought not be processed further. If it's irrelevant to"] - #[doc = " the tree, false is returned. Relevant inputs include:"] - #[doc = " * a mouse click on an item (focuses item)"] - #[doc = " * a mouse scrollwheel event (srolls tree)"] - #[doc = " * up, down, pgup, or pgdown (navigates among items)"] - pub fn nctree_offer_input(n: *mut nctree, ni: *const ncinput) -> bool; -} -extern "C" { - #[doc = " Return the focused item, if any items are present. This is not a copy;"] - #[doc = " be careful to use it only for the duration of a critical section."] - pub fn nctree_focused(n: *mut nctree) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Change focus to the next item."] - pub fn nctree_next(n: *mut nctree) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Change focus to the previous item."] - pub fn nctree_prev(n: *mut nctree) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Go to the item specified by the array |spec|, terminated by UINT_MAX. If"] - #[doc = " the spec is invalid, NULL is returned, and the depth of the first invalid"] - #[doc = " spec is written to *|failspec|. Otherwise, the true depth is written to"] - #[doc = " *|failspec|, and the curry is returned (|failspec| is necessary because the"] - #[doc = " curry could itself be NULL)."] - pub fn nctree_goto( - n: *mut nctree, - spec: *const cty::c_uint, - failspec: *mut cty::c_int, - ) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Destroy the nctree."] - pub fn nctree_destroy(n: *mut nctree); -} -#[doc = " Menus. Horizontal menu bars are supported, on the top and/or bottom rows."] -#[doc = " If the menu bar is longer than the screen, it will be only partially"] -#[doc = " visible. Menus may be either visible or invisible by default. In the event of"] -#[doc = " a screen resize, menus will be automatically moved/resized. Elements can be"] -#[doc = " dynamically enabled or disabled at all levels (menu, section, and item),"] -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncmenu_item { - #[doc = " utf-8 menu item, NULL for horizontal separator"] - pub desc: *mut cty::c_char, - #[doc = " shortcut, all should be distinct"] - pub shortcut: ncinput, -} -#[test] -fn bindgen_test_layout_ncmenu_item() { - assert_eq!( - ::core::mem::size_of::(), - 32usize, - concat!("Size of: ", stringify!(ncmenu_item)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncmenu_item)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).desc as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_item), - "::", - stringify!(desc) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).shortcut as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_item), - "::", - stringify!(shortcut) - ) - ); -} -impl Default for ncmenu_item { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncmenu_section { - #[doc = " utf-8 c string"] - pub name: *mut cty::c_char, - pub itemcount: cty::c_int, - pub items: *mut ncmenu_item, - #[doc = " shortcut, will be underlined if present in name"] - pub shortcut: ncinput, -} -#[test] -fn bindgen_test_layout_ncmenu_section() { - assert_eq!( - ::core::mem::size_of::(), - 48usize, - concat!("Size of: ", stringify!(ncmenu_section)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncmenu_section)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).name as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_section), - "::", - stringify!(name) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).itemcount as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_section), - "::", - stringify!(itemcount) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).items as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_section), - "::", - stringify!(items) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).shortcut as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_section), - "::", - stringify!(shortcut) - ) - ); -} -impl Default for ncmenu_section { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncmenu_options { - #[doc = " array of 'sectioncount' menu_sections"] - pub sections: *mut ncmenu_section, - #[doc = " must be positive"] - pub sectioncount: cty::c_int, - #[doc = " styling for header"] - pub headerchannels: u64, - #[doc = " styling for sections"] - pub sectionchannels: u64, - #[doc = " flag word of NCMENU_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncmenu_options() { - assert_eq!( - ::core::mem::size_of::(), - 40usize, - concat!("Size of: ", stringify!(ncmenu_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncmenu_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sections as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_options), - "::", - stringify!(sections) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sectioncount as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_options), - "::", - stringify!(sectioncount) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).headerchannels as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_options), - "::", - stringify!(headerchannels) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sectionchannels as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_options), - "::", - stringify!(sectionchannels) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_options), - "::", - stringify!(flags) - ) - ); -} -impl Default for ncmenu_options { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[repr(C)] -#[derive(Debug)] -pub struct ncmenu { - _unused: [u8; 0], -} -extern "C" { - #[doc = " Create a menu with the specified options. Menus are currently bound to an"] - #[doc = " overall Notcurses object (as opposed to a particular plane), and are"] - #[doc = " implemented as ncplanes kept atop other ncplanes."] - pub fn ncmenu_create(n: *mut ncplane, opts: *const ncmenu_options) -> *mut ncmenu; -} -extern "C" { - #[doc = " Unroll the specified menu section, making the menu visible if it was"] - #[doc = " invisible, and rolling up any menu section that is already unrolled."] - pub fn ncmenu_unroll(n: *mut ncmenu, sectionidx: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Roll up any unrolled menu section, and hide the menu if using hiding."] - pub fn ncmenu_rollup(n: *mut ncmenu) -> cty::c_int; -} -extern "C" { - #[doc = " Unroll the previous/next section (relative to current unrolled). If no"] - #[doc = " section is unrolled, the first section will be unrolled."] - pub fn ncmenu_nextsection(n: *mut ncmenu) -> cty::c_int; -} -extern "C" { - pub fn ncmenu_prevsection(n: *mut ncmenu) -> cty::c_int; -} -extern "C" { - #[doc = " Move to the previous/next item within the currently unrolled section. If no"] - #[doc = " section is unrolled, the first section will be unrolled."] - pub fn ncmenu_nextitem(n: *mut ncmenu) -> cty::c_int; -} -extern "C" { - pub fn ncmenu_previtem(n: *mut ncmenu) -> cty::c_int; -} -extern "C" { - #[doc = " Disable or enable a menu item. Returns 0 if the item was found."] - pub fn ncmenu_item_set_status( - n: *mut ncmenu, - section: *const cty::c_char, - item: *const cty::c_char, - enabled: bool, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Return the selected item description, or NULL if no section is unrolled. If"] - #[doc = " 'ni' is not NULL, and the selected item has a shortcut, 'ni' will be filled"] - #[doc = " in with that shortcut--this can allow faster matching."] - pub fn ncmenu_selected(n: *const ncmenu, ni: *mut ncinput) -> *const cty::c_char; -} -extern "C" { - #[doc = " Return the item description corresponding to the mouse click 'click'. The"] - #[doc = " item must be on an actively unrolled section, and the click must be in the"] - #[doc = " area of a valid item. If 'ni' is not NULL, and the selected item has a"] - #[doc = " shortcut, 'ni' will be filled in with the shortcut."] - pub fn ncmenu_mouse_selected( - n: *const ncmenu, - click: *const ncinput, - ni: *mut ncinput, - ) -> *const cty::c_char; -} -extern "C" { - #[doc = " Return the ncplane backing this ncmenu."] - pub fn ncmenu_plane(n: *mut ncmenu) -> *mut ncplane; -} -extern "C" { - #[doc = " Offer the input to the ncmenu. If it's relevant, this function returns true,"] - #[doc = " and the input ought not be processed further. If it's irrelevant to the"] - #[doc = " menu, false is returned. Relevant inputs include:"] - #[doc = " * mouse movement over a hidden menu"] - #[doc = " * a mouse click on a menu section (the section is unrolled)"] - #[doc = " * a mouse click outside of an unrolled menu (the menu is rolled up)"] - #[doc = " * left or right on an unrolled menu (navigates among sections)"] - #[doc = " * up or down on an unrolled menu (navigates among items)"] - #[doc = " * escape on an unrolled menu (the menu is rolled up)"] - pub fn ncmenu_offer_input(n: *mut ncmenu, nc: *const ncinput) -> bool; -} -extern "C" { - #[doc = " Destroy a menu created with ncmenu_create()."] - pub fn ncmenu_destroy(n: *mut ncmenu) -> cty::c_int; -} -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncprogbar_options { - #[doc = " upper-left channel. in the context of a progress bar,"] - pub ulchannel: u32, - #[doc = " \"up\" is the direction we are progressing towards, and"] - pub urchannel: u32, - #[doc = " \"bottom\" is the direction of origin. for monochromatic"] - pub blchannel: u32, - #[doc = " bar, all four channels ought be the same."] - pub brchannel: u32, - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncprogbar_options() { - assert_eq!( - ::core::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(ncprogbar_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncprogbar_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).ulchannel as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncprogbar_options), - "::", - stringify!(ulchannel) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).urchannel as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(ncprogbar_options), - "::", - stringify!(urchannel) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).blchannel as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncprogbar_options), - "::", - stringify!(blchannel) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).brchannel as *const _ as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(ncprogbar_options), - "::", - stringify!(brchannel) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncprogbar_options), - "::", - stringify!(flags) - ) - ); -} -extern "C" { - #[doc = " Takes ownership of the ncplane 'n', which will be destroyed by"] - #[doc = " ncprogbar_destroy(). The progress bar is initially at 0%."] - pub fn ncprogbar_create(n: *mut ncplane, opts: *const ncprogbar_options) -> *mut ncprogbar; -} -extern "C" { - #[doc = " Return a reference to the ncprogbar's underlying ncplane."] - pub fn ncprogbar_plane(n: *mut ncprogbar) -> *mut ncplane; -} -extern "C" { - #[doc = " Set the progress bar's completion, a double 0 <= 'p' <= 1."] - pub fn ncprogbar_set_progress(n: *mut ncprogbar, p: f64) -> cty::c_int; -} -extern "C" { - #[doc = " Get the progress bar's completion, a double on [0, 1]."] - pub fn ncprogbar_progress(n: *const ncprogbar) -> f64; -} -extern "C" { - #[doc = " Destroy the progress bar and its underlying ncplane."] - pub fn ncprogbar_destroy(n: *mut ncprogbar); -} -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct nctabbed_options { - #[doc = " channel for the selected tab header"] - pub selchan: u64, - #[doc = " channel for unselected tab headers"] - pub hdrchan: u64, - #[doc = " channel for the tab separator"] - pub sepchan: u64, - #[doc = " separator string (copied by nctabbed_create())"] - pub separator: *mut cty::c_char, - #[doc = " bitmask of NCTABBED_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_nctabbed_options() { - assert_eq!( - ::core::mem::size_of::(), - 40usize, - concat!("Size of: ", stringify!(nctabbed_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(nctabbed_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).selchan as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(nctabbed_options), - "::", - stringify!(selchan) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).hdrchan as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(nctabbed_options), - "::", - stringify!(hdrchan) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sepchan as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(nctabbed_options), - "::", - stringify!(sepchan) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).separator as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(nctabbed_options), - "::", - stringify!(separator) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(nctabbed_options), - "::", - stringify!(flags) - ) - ); -} -impl Default for nctabbed_options { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[doc = " Tab content drawing callback. Takes the tab it was associated to, the ncplane"] -#[doc = " on which tab content is to be drawn, and the user pointer of the tab."] -#[doc = " It is called during nctabbed_redraw()."] -pub type tabcb = ::core::option::Option< - unsafe extern "C" fn(t: *mut nctab, ncp: *mut ncplane, curry: *mut cty::c_void), ->; -extern "C" { - #[doc = " Creates a new nctabbed widget, associated with the given ncplane 'n', and with"] - #[doc = " additional options given in 'opts'. When 'opts' is NULL, it acts as if it were"] - #[doc = " called with an all-zero opts. The widget takes ownership of 'n', and destroys"] - #[doc = " it when the widget is destroyed. Returns the newly created widget. Returns"] - #[doc = " NULL on failure, also destroying 'n'."] - pub fn nctabbed_create(n: *mut ncplane, opts: *const nctabbed_options) -> *mut nctabbed; -} -extern "C" { - #[doc = " Destroy an nctabbed widget. All memory belonging to 'nt' is deallocated,"] - #[doc = " including all tabs and their names. The plane associated with 'nt' is also"] - #[doc = " destroyed. Calling this with NULL does nothing."] - pub fn nctabbed_destroy(nt: *mut nctabbed); -} -extern "C" { - #[doc = " Redraw the widget. This calls the tab callback of the currently selected tab"] - #[doc = " to draw tab contents, and draws tab headers. The tab content plane is not"] - #[doc = " modified by this function, apart from resizing the plane is necessary."] - pub fn nctabbed_redraw(nt: *mut nctabbed); -} -extern "C" { - #[doc = " Make sure the tab header of the currently selected tab is at least partially"] - #[doc = " visible. (by rotating tabs until at least one column is displayed)"] - #[doc = " Does nothing if there are no tabs."] - pub fn nctabbed_ensure_selected_header_visible(nt: *mut nctabbed); -} -extern "C" { - #[doc = " Returns the currently selected tab, or NULL if there are no tabs."] - pub fn nctabbed_selected(nt: *mut nctabbed) -> *mut nctab; -} -extern "C" { - #[doc = " Returns the leftmost tab, or NULL if there are no tabs."] - pub fn nctabbed_leftmost(nt: *mut nctabbed) -> *mut nctab; -} -extern "C" { - #[doc = " Returns the number of tabs in the widget."] - pub fn nctabbed_tabcount(nt: *mut nctabbed) -> cty::c_int; -} -extern "C" { - #[doc = " Returns the plane associated to 'nt'."] - pub fn nctabbed_plane(nt: *mut nctabbed) -> *mut ncplane; -} -extern "C" { - #[doc = " Returns the tab content plane."] - pub fn nctabbed_content_plane(nt: *mut nctabbed) -> *mut ncplane; -} -extern "C" { - #[doc = " Returns the tab callback."] - pub fn nctab_cb(t: *mut nctab) -> tabcb; -} -extern "C" { - #[doc = " Returns the tab name. This is not a copy and it should not be stored."] - pub fn nctab_name(t: *mut nctab) -> *const cty::c_char; -} -extern "C" { - #[doc = " Returns the width (in columns) of the tab's name."] - pub fn nctab_name_width(t: *mut nctab) -> cty::c_int; -} -extern "C" { - #[doc = " Returns the tab's user pointer."] - pub fn nctab_userptr(t: *mut nctab) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Returns the tab to the right of 't'. This does not change which tab is selected."] - pub fn nctab_next(t: *mut nctab) -> *mut nctab; -} -extern "C" { - #[doc = " Returns the tab to the left of 't'. This does not change which tab is selected."] - pub fn nctab_prev(t: *mut nctab) -> *mut nctab; -} -extern "C" { - #[doc = " Add a new tab to 'nt' with the given tab callback, name, and user pointer."] - #[doc = " If both 'before' and 'after' are NULL, the tab is inserted after the selected"] - #[doc = " tab. Otherwise, it gets put after 'after' (if not NULL) and before 'before'"] - #[doc = " (if not NULL). If both 'after' and 'before' are given, they must be two"] - #[doc = " neighboring tabs (the tab list is circular, so the last tab is immediately"] - #[doc = " before the leftmost tab), otherwise the function returns NULL. If 'name' is"] - #[doc = " NULL or a string containing illegal characters, the function returns NULL."] - #[doc = " On all other failures the function also returns NULL. If it returns NULL,"] - #[doc = " none of the arguments are modified, and the widget state is not altered."] - pub fn nctabbed_add( - nt: *mut nctabbed, - after: *mut nctab, - before: *mut nctab, - tcb: tabcb, - name: *const cty::c_char, - opaque: *mut cty::c_void, - ) -> *mut nctab; -} -extern "C" { - #[doc = " Remove a tab 't' from 'nt'. Its neighboring tabs become neighbors to each"] - #[doc = " other. If 't' if the selected tab, the tab after 't' becomes selected."] - #[doc = " Likewise if 't' is the leftmost tab, the tab after 't' becomes leftmost."] - #[doc = " If 't' is the only tab, there will no more be a selected or leftmost tab,"] - #[doc = " until a new tab is added. Returns -1 if 't' is NULL, and 0 otherwise."] - pub fn nctabbed_del(nt: *mut nctabbed, t: *mut nctab) -> cty::c_int; -} -extern "C" { - #[doc = " Move 't' after 'after' (if not NULL) and before 'before' (if not NULL)."] - #[doc = " If both 'after' and 'before' are NULL, the function returns -1, otherwise"] - #[doc = " it returns 0."] - pub fn nctab_move( - nt: *mut nctabbed, - t: *mut nctab, - after: *mut nctab, - before: *mut nctab, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Move 't' to the right by one tab, looping around to become leftmost if needed."] - pub fn nctab_move_right(nt: *mut nctabbed, t: *mut nctab); -} -extern "C" { - #[doc = " Move 't' to the right by one tab, looping around to become the last tab if needed."] - pub fn nctab_move_left(nt: *mut nctabbed, t: *mut nctab); -} -extern "C" { - #[doc = " Rotate the tabs of 'nt' right by 'amt' tabs, or '-amt' tabs left if 'amt' is"] - #[doc = " negative. Tabs are rotated only by changing the leftmost tab; the selected tab"] - #[doc = " stays the same. If there are no tabs, nothing happens."] - pub fn nctabbed_rotate(nt: *mut nctabbed, amt: cty::c_int); -} -extern "C" { - #[doc = " Select the tab after the currently selected tab, and return the newly selected"] - #[doc = " tab. Returns NULL if there are no tabs."] - pub fn nctabbed_next(nt: *mut nctabbed) -> *mut nctab; -} -extern "C" { - #[doc = " Select the tab before the currently selected tab, and return the newly selected"] - #[doc = " tab. Returns NULL if there are no tabs."] - pub fn nctabbed_prev(nt: *mut nctabbed) -> *mut nctab; -} -extern "C" { - #[doc = " Change the selected tab to be 't'. Returns the previously selected tab."] - pub fn nctabbed_select(nt: *mut nctabbed, t: *mut nctab) -> *mut nctab; -} -extern "C" { - #[doc = " Write the channels for tab headers, the selected tab header, and the separator"] - #[doc = " to '*hdrchan', '*selchan', and '*sepchan' respectively."] - pub fn nctabbed_channels( - nt: *mut nctabbed, - hdrchan: *mut u64, - selchan: *mut u64, - sepchan: *mut u64, - ); -} -extern "C" { - #[doc = " Returns the tab separator. This is not a copy and it should not be stored."] - #[doc = " This can be NULL, if the separator was set to NULL in ncatbbed_create() or"] - #[doc = " nctabbed_set_separator()."] - pub fn nctabbed_separator(nt: *mut nctabbed) -> *const cty::c_char; -} -extern "C" { - #[doc = " Returns the tab separator width, or zero if there is no separator."] - pub fn nctabbed_separator_width(nt: *mut nctabbed) -> cty::c_int; -} -extern "C" { - #[doc = " Set the tab headers channel for 'nt'."] - pub fn nctabbed_set_hdrchan(nt: *mut nctabbed, chan: u64); -} -extern "C" { - #[doc = " Set the selected tab header channel for 'nt'."] - pub fn nctabbed_set_selchan(nt: *mut nctabbed, chan: u64); -} -extern "C" { - #[doc = " Set the tab separator channel for 'nt'."] - pub fn nctabbed_set_sepchan(nt: *mut nctabbed, chan: u64); -} -extern "C" { - #[doc = " Set the tab callback function for 't'. Returns the previous tab callback."] - pub fn nctab_set_cb(t: *mut nctab, newcb: tabcb) -> tabcb; -} -extern "C" { - #[doc = " Change the name of 't'. Returns -1 if 'newname' is NULL, and 0 otherwise."] - pub fn nctab_set_name(t: *mut nctab, newname: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Set the user pointer of 't'. Returns the previous user pointer."] - pub fn nctab_set_userptr(t: *mut nctab, newopaque: *mut cty::c_void) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Change the tab separator for 'nt'. Returns -1 if 'separator' is not NULL and"] - #[doc = " is not a valid string, and 0 otherwise."] - pub fn nctabbed_set_separator(nt: *mut nctabbed, separator: *const cty::c_char) -> cty::c_int; -} -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncplot_options { - #[doc = " channels for the maximum and minimum levels. linear or exponential"] - #[doc = " interpolation will be applied across the domain between these two."] - pub maxchannels: u64, - pub minchannels: u64, - #[doc = " styling used for the legend, if NCPLOT_OPTION_LABELTICKSD is set"] - pub legendstyle: u16, - #[doc = " number of \"pixels\" per row x column"] - pub gridtype: ncblitter_e, - #[doc = " independent variable can either be a contiguous range, or a finite set"] - #[doc = " of keys. for a time range, say the previous hour sampled with second"] - #[doc = " resolution, the independent variable would be the range [0..3600): 3600."] - #[doc = " if rangex is 0, it is dynamically set to the number of columns."] - pub rangex: cty::c_int, - #[doc = " optional, printed by the labels"] - pub title: *const cty::c_char, - #[doc = " bitfield over NCPLOT_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncplot_options() { - assert_eq!( - ::core::mem::size_of::(), - 48usize, - concat!("Size of: ", stringify!(ncplot_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncplot_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).maxchannels as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncplot_options), - "::", - stringify!(maxchannels) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).minchannels as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncplot_options), - "::", - stringify!(minchannels) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).legendstyle as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncplot_options), - "::", - stringify!(legendstyle) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).gridtype as *const _ as usize }, - 20usize, - concat!( - "Offset of field: ", - stringify!(ncplot_options), - "::", - stringify!(gridtype) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).rangex as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncplot_options), - "::", - stringify!(rangex) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).title as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncplot_options), - "::", - stringify!(title) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(ncplot_options), - "::", - stringify!(flags) - ) - ); -} -impl Default for ncplot_options { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -extern "C" { - #[doc = " Use the provided plane 'n' for plotting according to the options 'opts'. The"] - #[doc = " plot will make free use of the entirety of the plane. For domain"] - #[doc = " autodiscovery, set miny == maxy == 0. ncuplot holds uint64_ts, while"] - #[doc = " ncdplot holds doubles."] - pub fn ncuplot_create( - n: *mut ncplane, - opts: *const ncplot_options, - miny: u64, - maxy: u64, - ) -> *mut ncuplot; -} -extern "C" { - pub fn ncdplot_create( - n: *mut ncplane, - opts: *const ncplot_options, - miny: f64, - maxy: f64, - ) -> *mut ncdplot; -} -extern "C" { - #[doc = " Return a reference to the ncplot's underlying ncplane."] - pub fn ncuplot_plane(n: *mut ncuplot) -> *mut ncplane; -} -extern "C" { - pub fn ncdplot_plane(n: *mut ncdplot) -> *mut ncplane; -} -extern "C" { - #[doc = " Add to or set the value corresponding to this x. If x is beyond the current"] - #[doc = " x window, the x window is advanced to include x, and values passing beyond"] - #[doc = " the window are lost. The first call will place the initial window. The plot"] - #[doc = " will be redrawn, but notcurses_render() is not called."] - pub fn ncuplot_add_sample(n: *mut ncuplot, x: u64, y: u64) -> cty::c_int; -} -extern "C" { - pub fn ncdplot_add_sample(n: *mut ncdplot, x: u64, y: f64) -> cty::c_int; -} -extern "C" { - pub fn ncuplot_set_sample(n: *mut ncuplot, x: u64, y: u64) -> cty::c_int; -} -extern "C" { - pub fn ncdplot_set_sample(n: *mut ncdplot, x: u64, y: f64) -> cty::c_int; -} -extern "C" { - pub fn ncuplot_sample(n: *const ncuplot, x: u64, y: *mut u64) -> cty::c_int; -} -extern "C" { - pub fn ncdplot_sample(n: *const ncdplot, x: u64, y: *mut f64) -> cty::c_int; -} -extern "C" { - pub fn ncuplot_destroy(n: *mut ncuplot); -} -extern "C" { - pub fn ncdplot_destroy(n: *mut ncdplot); -} -pub type ncfdplane_callback = ::core::option::Option< - unsafe extern "C" fn( - n: *mut ncfdplane, - buf: *const cty::c_void, - s: size_t, - curry: *mut cty::c_void, - ) -> cty::c_int, ->; -pub type ncfdplane_done_cb = ::core::option::Option< - unsafe extern "C" fn( - n: *mut ncfdplane, - fderrno: cty::c_int, - curry: *mut cty::c_void, - ) -> cty::c_int, ->; -#[doc = " read from an fd until EOF (or beyond, if follow is set), invoking the user's"] -#[doc = " callback each time. runs in its own context. on EOF or error, the finalizer"] -#[doc = " callback will be invoked, and the user ought destroy the ncfdplane. the"] -#[doc = " data is *not* guaranteed to be nul-terminated, and may contain arbitrary"] -#[doc = " zeroes."] -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncfdplane_options { - #[doc = " parameter provided to callbacks"] - pub curry: *mut cty::c_void, - #[doc = " keep reading after hitting end? (think tail -f)"] - pub follow: bool, - #[doc = " bitfield over NCOPTION_FDPLANE_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncfdplane_options() { - assert_eq!( - ::core::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(ncfdplane_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncfdplane_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).curry as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncfdplane_options), - "::", - stringify!(curry) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).follow as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncfdplane_options), - "::", - stringify!(follow) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncfdplane_options), - "::", - stringify!(flags) - ) - ); -} -impl Default for ncfdplane_options { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -extern "C" { - #[doc = " Create an ncfdplane around the fd 'fd'. Consider this function to take"] - #[doc = " ownership of the file descriptor, which will be closed in ncfdplane_destroy()."] - pub fn ncfdplane_create( - n: *mut ncplane, - opts: *const ncfdplane_options, - fd: cty::c_int, - cbfxn: ncfdplane_callback, - donecbfxn: ncfdplane_done_cb, - ) -> *mut ncfdplane; -} -extern "C" { - pub fn ncfdplane_plane(n: *mut ncfdplane) -> *mut ncplane; -} -extern "C" { - pub fn ncfdplane_destroy(n: *mut ncfdplane) -> cty::c_int; -} -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncsubproc_options { - pub curry: *mut cty::c_void, - #[doc = " restart this many seconds after an exit (watch)"] - pub restart_period: u64, - #[doc = " bitfield over NCOPTION_SUBPROC_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncsubproc_options() { - assert_eq!( - ::core::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(ncsubproc_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncsubproc_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).curry as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncsubproc_options), - "::", - stringify!(curry) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).restart_period as *const _ as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncsubproc_options), - "::", - stringify!(restart_period) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncsubproc_options), - "::", - stringify!(flags) - ) - ); -} -impl Default for ncsubproc_options { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -extern "C" { - #[doc = " see exec(2). p-types use $PATH. e-type passes environment vars."] - pub fn ncsubproc_createv( - n: *mut ncplane, - opts: *const ncsubproc_options, - bin: *const cty::c_char, - arg: *const *mut cty::c_char, - cbfxn: ncfdplane_callback, - donecbfxn: ncfdplane_done_cb, - ) -> *mut ncsubproc; -} -extern "C" { - pub fn ncsubproc_createvp( - n: *mut ncplane, - opts: *const ncsubproc_options, - bin: *const cty::c_char, - arg: *const *mut cty::c_char, - cbfxn: ncfdplane_callback, - donecbfxn: ncfdplane_done_cb, - ) -> *mut ncsubproc; -} -extern "C" { - pub fn ncsubproc_createvpe( - n: *mut ncplane, - opts: *const ncsubproc_options, - bin: *const cty::c_char, - arg: *const *mut cty::c_char, - env: *const *mut cty::c_char, - cbfxn: ncfdplane_callback, - donecbfxn: ncfdplane_done_cb, - ) -> *mut ncsubproc; -} -extern "C" { - pub fn ncsubproc_plane(n: *mut ncsubproc) -> *mut ncplane; -} -extern "C" { - pub fn ncsubproc_destroy(n: *mut ncsubproc) -> cty::c_int; -} -extern "C" { - #[doc = " Draw a QR code at the current position on the plane. If there is insufficient"] - #[doc = " room to draw the code here, or there is any other error, non-zero will be"] - #[doc = " returned. Otherwise, the QR code \"version\" (size) is returned. The QR code"] - #[doc = " is (version * 4 + 17) columns wide, and ⌈version * 4 + 17⌉ rows tall (the"] - #[doc = " properly-scaled values are written back to '*ymax' and '*xmax')."] - pub fn ncplane_qrcode( - n: *mut ncplane, - ymax: *mut cty::c_int, - xmax: *mut cty::c_int, - data: *const cty::c_void, - len: size_t, - ) -> cty::c_int; -} -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncreader_options { - #[doc = " channels used for input"] - pub tchannels: u64, - #[doc = " attributes used for input"] - pub tattrword: u32, - #[doc = " bitfield of NCREADER_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncreader_options() { - assert_eq!( - ::core::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(ncreader_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncreader_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).tchannels as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncreader_options), - "::", - stringify!(tchannels) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).tattrword as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncreader_options), - "::", - stringify!(tattrword) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncreader_options), - "::", - stringify!(flags) - ) - ); -} -extern "C" { - #[doc = " ncreaders provide freeform input in a (possibly multiline) region, supporting"] - #[doc = " optional readline keybindings. takes ownership of 'n', destroying it on any"] - #[doc = " error (ncreader_destroy() otherwise destroys the ncplane)."] - pub fn ncreader_create(n: *mut ncplane, opts: *const ncreader_options) -> *mut ncreader; -} -extern "C" { - #[doc = " empty the ncreader of any user input, and home the cursor."] - pub fn ncreader_clear(n: *mut ncreader) -> cty::c_int; -} -extern "C" { - pub fn ncreader_plane(n: *mut ncreader) -> *mut ncplane; -} -extern "C" { - #[doc = " Offer the input to the ncreader. If it's relevant, this function returns"] - #[doc = " true, and the input ought not be processed further. Almost all inputs"] - #[doc = " are relevant to an ncreader, save synthesized ones."] - pub fn ncreader_offer_input(n: *mut ncreader, ni: *const ncinput) -> bool; -} -extern "C" { - #[doc = " Atttempt to move in the specified direction. Returns 0 if a move was"] - #[doc = " successfully executed, -1 otherwise. Scrolling is taken into account."] - pub fn ncreader_move_left(n: *mut ncreader) -> cty::c_int; -} -extern "C" { - pub fn ncreader_move_right(n: *mut ncreader) -> cty::c_int; -} -extern "C" { - pub fn ncreader_move_up(n: *mut ncreader) -> cty::c_int; -} -extern "C" { - pub fn ncreader_move_down(n: *mut ncreader) -> cty::c_int; -} -extern "C" { - #[doc = " Destructively write the provided EGC to the current cursor location. Move"] - #[doc = " the cursor as necessary, scrolling if applicable."] - pub fn ncreader_write_egc(n: *mut ncreader, egc: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " return a heap-allocated copy of the current (UTF-8) contents."] - pub fn ncreader_contents(n: *const ncreader) -> *mut cty::c_char; -} -extern "C" { - #[doc = " destroy the reader and its bound plane. if 'contents' is not NULL, the"] - #[doc = " UTF-8 input will be heap-duplicated and written to 'contents'."] - pub fn ncreader_destroy(n: *mut ncreader, contents: *mut *mut cty::c_char); -} -extern "C" { - #[doc = " Dump selected Notcurses state to the supplied 'debugfp'. Output is freeform,"] - #[doc = " and subject to change. It includes geometry of all planes, from all piles."] - pub fn notcurses_debug(nc: *const notcurses, debugfp: *mut FILE); -} -extern "C" { - #[doc = " Dump selected configuration capabilities to 'debugfp'. Output is freeform,"] - #[doc = " and subject to change."] - pub fn notcurses_debug_caps(nc: *const notcurses, debugfp: *mut FILE); -} -extern "C" { - #[doc = " Get the default *media* (not plot) blitter for this environment when using"] - #[doc = " the specified scaling method. Currently, this means:"] - #[doc = " - if lacking UTF-8, NCBLIT_1x1"] - #[doc = " - otherwise, if not NCSCALE_STRETCH, NCBLIT_2x1"] - #[doc = " - otherwise, if sextants are not known to be good, NCBLIT_2x2"] - #[doc = " - otherwise NCBLIT_3x2"] - #[doc = " NCBLIT_2x2 and NCBLIT_3x2 both distort the original aspect ratio, thus"] - #[doc = " NCBLIT_2x1 is used outside of NCSCALE_STRETCH."] - pub fn ncvisual_media_defblitter(nc: *const notcurses, scale: ncscale_e) -> ncblitter_e; -} -pub type ncdirectv = ncplane; -#[repr(C)] -#[derive(Debug)] -pub struct ncdirect { - _unused: [u8; 0], -} -extern "C" { - #[doc = " Initialize a direct-mode Notcurses context on the connected terminal at 'fp'."] - #[doc = " 'fp' must be a tty. You'll usually want stdout. Direct mode supports a"] - #[doc = " limited subset of Notcurses routines which directly affect 'fp', and neither"] - #[doc = " supports nor requires notcurses_render(). This can be used to add color and"] - #[doc = " styling to text in the standard output paradigm. 'flags' is a bitmask over"] - #[doc = " NCDIRECT_OPTION_*."] - #[doc = " Returns NULL on error, including any failure initializing terminfo."] - pub fn ncdirect_init(termtype: *const cty::c_char, fp: *mut FILE, flags: u64) -> *mut ncdirect; -} -extern "C" { - #[doc = " The same as ncdirect_init(), but without any multimedia functionality,"] - #[doc = " allowing for a svelter binary. Link with notcurses-core if this is used."] - pub fn ncdirect_core_init( - termtype: *const cty::c_char, - fp: *mut FILE, - flags: u64, - ) -> *mut ncdirect; -} -extern "C" { - #[doc = " Read a (heap-allocated) line of text using the Readline library Initializes"] - #[doc = " Readline the first time it's called. For input to be echoed to the terminal,"] - #[doc = " it is necessary that NCDIRECT_OPTION_INHIBIT_CBREAK be provided to"] - #[doc = " ncdirect_init(). Returns NULL on error."] - pub fn ncdirect_readline(nc: *mut ncdirect, prompt: *const cty::c_char) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Direct mode. This API can be used to colorize and stylize output generated"] - #[doc = " outside of notcurses, without ever calling notcurses_render(). These should"] - #[doc = " not be intermixed with standard Notcurses rendering."] - pub fn ncdirect_set_fg_rgb(nc: *mut ncdirect, rgb: cty::c_uint) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_set_bg_rgb(nc: *mut ncdirect, rgb: cty::c_uint) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_set_fg_palindex(nc: *mut ncdirect, pidx: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_set_bg_palindex(nc: *mut ncdirect, pidx: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Returns the number of simultaneous colors claimed to be supported, or 1 if"] - #[doc = " there is no color support. Note that several terminal emulators advertise"] - #[doc = " more colors than they actually support, downsampling internally."] - pub fn ncdirect_palette_size(nc: *const ncdirect) -> cty::c_uint; -} -extern "C" { - #[doc = " Output the string |utf8| according to the channels |channels|. Note that"] - #[doc = " ncdirect_putstr() does not explicitly flush output buffers, so it will not"] - #[doc = " necessarily be immediately visible."] - pub fn ncdirect_putstr( - nc: *mut ncdirect, - channels: u64, - utf8: *const cty::c_char, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Formatted printing (plus alignment relative to the terminal). Returns the"] - #[doc = " number of columns printed on success."] - pub fn ncdirect_printf_aligned( - n: *mut ncdirect, - y: cty::c_int, - align: ncalign_e, - fmt: *const cty::c_char, - ... - ) -> cty::c_int; -} -extern "C" { - #[doc = " Force a flush. Returns 0 on success, -1 on failure."] - pub fn ncdirect_flush(nc: *const ncdirect) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_set_fg_default(nc: *mut ncdirect) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_set_bg_default(nc: *mut ncdirect) -> cty::c_int; -} -extern "C" { - #[doc = " Get the current number of columns/rows."] - pub fn ncdirect_dim_x(nc: *const ncdirect) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_dim_y(nc: *const ncdirect) -> cty::c_int; -} -extern "C" { - #[doc = " ncplane_styles_*() analogues"] - pub fn ncdirect_set_styles(n: *mut ncdirect, stylebits: cty::c_uint) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_on_styles(n: *mut ncdirect, stylebits: cty::c_uint) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_off_styles(n: *mut ncdirect, stylebits: cty::c_uint) -> cty::c_int; -} -extern "C" { - #[doc = " Deprecated forms of above."] - pub fn ncdirect_styles_set(n: *mut ncdirect, stylebits: cty::c_uint) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_styles_on(n: *mut ncdirect, stylebits: cty::c_uint) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_styles_off(n: *mut ncdirect, stylebits: cty::c_uint) -> cty::c_int; -} -extern "C" { - #[doc = " Move the cursor in direct mode. -1 to retain current location on that axis."] - pub fn ncdirect_cursor_move_yx(n: *mut ncdirect, y: cty::c_int, x: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_cursor_enable(nc: *mut ncdirect) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_cursor_disable(nc: *mut ncdirect) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_cursor_up(nc: *mut ncdirect, num: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_cursor_left(nc: *mut ncdirect, num: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_cursor_right(nc: *mut ncdirect, num: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_cursor_down(nc: *mut ncdirect, num: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Get the cursor position, when supported. This requires writing to the"] - #[doc = " terminal, and then reading from it. If the terminal doesn't reply, or"] - #[doc = " doesn't reply in a way we understand, the results might be deleterious."] - pub fn ncdirect_cursor_yx( - n: *mut ncdirect, - y: *mut cty::c_int, - x: *mut cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Push or pop the cursor location to the terminal's stack. The depth of this"] - #[doc = " stack, and indeed its existence, is terminal-dependent."] - pub fn ncdirect_cursor_push(n: *mut ncdirect) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_cursor_pop(n: *mut ncdirect) -> cty::c_int; -} -extern "C" { - #[doc = " Display an image using the specified blitter and scaling. The image may"] - #[doc = " be arbitrarily many rows -- the output will scroll -- but will only occupy"] - #[doc = " the column of the cursor, and those to the right. The render/raster process"] - #[doc = " can be split by using ncdirect_render_frame() and ncdirect_raster_frame()."] - pub fn ncdirect_render_image( - n: *mut ncdirect, - filename: *const cty::c_char, - align: ncalign_e, - blitter: ncblitter_e, - scale: ncscale_e, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Clear the screen."] - pub fn ncdirect_clear(nc: *mut ncdirect) -> cty::c_int; -} -extern "C" { - #[doc = " Can we load images? This requires being built against FFmpeg/OIIO."] - pub fn ncdirect_canopen_images(n: *const ncdirect) -> bool; -} -extern "C" { - #[doc = " Is our encoding UTF-8? Requires LANG being set to a UTF8 locale."] - pub fn ncdirect_canutf8(n: *const ncdirect) -> bool; -} -extern "C" { - #[doc = " This function must successfully return before NCBLIT_PIXEL is available."] - #[doc = " Returns -1 on error, 0 for no support, or 1 if pixel output is supported."] - #[doc = " Must not be called concurrently with either input or rasterization."] - pub fn ncdirect_check_pixel_support(n: *mut ncdirect) -> cty::c_int; -} -extern "C" { - #[doc = " Draw horizontal/vertical lines using the specified channels, interpolating"] - #[doc = " between them as we go. The EGC may not use more than one column. For a"] - #[doc = " horizontal line, |len| cannot exceed the screen width minus the cursor's"] - #[doc = " offset. For a vertical line, it may be as long as you'd like; the screen"] - #[doc = " will scroll as necessary. All lines start at the current cursor position."] - pub fn ncdirect_hline_interp( - n: *mut ncdirect, - egc: *const cty::c_char, - len: cty::c_int, - h1: u64, - h2: u64, - ) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_vline_interp( - n: *mut ncdirect, - egc: *const cty::c_char, - len: cty::c_int, - h1: u64, - h2: u64, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Draw a box with its upper-left corner at the current cursor position, having"] - #[doc = " dimensions |ylen|x|xlen|. See ncplane_box() for more information. The"] - #[doc = " minimum box size is 2x2, and it cannot be drawn off-screen. |wchars| is an"] - #[doc = " array of 6 wide characters: UL, UR, LL, LR, HL, VL."] - pub fn ncdirect_box( - n: *mut ncdirect, - ul: u64, - ur: u64, - ll: u64, - lr: u64, - wchars: *const wchar_t, - ylen: cty::c_int, - xlen: cty::c_int, - ctlword: cty::c_uint, - ) -> cty::c_int; -} -extern "C" { - #[doc = " ncdirect_box() with the rounded box-drawing characters"] - pub fn ncdirect_rounded_box( - n: *mut ncdirect, - ul: u64, - ur: u64, - ll: u64, - lr: u64, - ylen: cty::c_int, - xlen: cty::c_int, - ctlword: cty::c_uint, - ) -> cty::c_int; -} -extern "C" { - #[doc = " ncdirect_box() with the double box-drawing characters"] - pub fn ncdirect_double_box( - n: *mut ncdirect, - ul: u64, - ur: u64, - ll: u64, - lr: u64, - ylen: cty::c_int, - xlen: cty::c_int, - ctlword: cty::c_uint, - ) -> cty::c_int; -} -extern "C" { - #[doc = " See ppoll(2) for more detail. Provide a NULL 'ts' to block at length, a 'ts'"] - #[doc = " of 0 for non-blocking operation, and otherwise a timespec to bound blocking."] - #[doc = " Signals in sigmask (less several we handle internally) will be atomically"] - #[doc = " masked and unmasked per ppoll(2). '*sigmask' should generally contain all"] - #[doc = " signals. Returns a single Unicode code point, or (char32_t)-1 on error."] - #[doc = " 'sigmask' may be NULL. Returns 0 on a timeout. If an event is processed, the"] - #[doc = " return value is the 'id' field from that event. 'ni' may be NULL."] - pub fn ncdirect_getc( - n: *mut ncdirect, - ts: *const timespec, - sigmask: *mut sigset_t, - ni: *mut ncinput, - ) -> char32_t; -} -extern "C" { - #[doc = " Get a file descriptor suitable for input event poll()ing. When this"] - #[doc = " descriptor becomes available, you can call ncdirect_getc_nblock(),"] - #[doc = " and input ought be ready. This file descriptor is *not* necessarily"] - #[doc = " the file descriptor associated with stdin (but it might be!)."] - pub fn ncdirect_inputready_fd(n: *mut ncdirect) -> cty::c_int; -} -extern "C" { - #[doc = " Release 'nc' and any associated resources. 0 on success, non-0 on failure."] - pub fn ncdirect_stop(nc: *mut ncdirect) -> cty::c_int; -} -extern "C" { - #[doc = " Render an image using the specified blitter and scaling, but do not write"] - #[doc = " the result. The image may be arbitrarily many rows -- the output will scroll"] - #[doc = " -- but will only occupy the column of the cursor, and those to the right."] - #[doc = " To actually write (and free) this, invoke ncdirect_raster_frame(). 'maxx'"] - #[doc = " and 'maxy', if greater than 0, are used for scaling; the terminal's geometry"] - #[doc = " is otherwise used."] - pub fn ncdirect_render_frame( - n: *mut ncdirect, - filename: *const cty::c_char, - blitter: ncblitter_e, - scale: ncscale_e, - maxy: cty::c_int, - maxx: cty::c_int, - ) -> *mut ncdirectv; -} -extern "C" { - #[doc = " Takes the result of ncdirect_render_frame() and writes it to the output."] - pub fn ncdirect_raster_frame( - n: *mut ncdirect, - ncdv: *mut ncdirectv, - align: ncalign_e, - ) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_stream( - n: *mut ncdirect, - filename: *const cty::c_char, - streamer: ncstreamcb, - vopts: *mut ncvisual_options, - curry: *mut cty::c_void, - ) -> cty::c_int; -} -pub type __builtin_va_list = [__va_list_tag; 1usize]; -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct __va_list_tag { - pub gp_offset: cty::c_uint, - pub fp_offset: cty::c_uint, - pub overflow_arg_area: *mut cty::c_void, - pub reg_save_area: *mut cty::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 Default for __va_list_tag { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} diff --git a/tools/function-summary/history/bindgen_20210603.rs b/tools/function-summary/history/bindgen_20210603.rs deleted file mode 100644 index 4dde43878..000000000 --- a/tools/function-summary/history/bindgen_20210603.rs +++ /dev/null @@ -1,7620 +0,0 @@ -/* automatically generated by rust-bindgen 0.57.0 */ - -#[repr(C)] -#[derive(Default)] -pub struct __IncompleteArrayField(::core::marker::PhantomData, [T; 0]); -impl __IncompleteArrayField { - #[inline] - pub const fn new() -> Self { - __IncompleteArrayField(::core::marker::PhantomData, []) - } - #[inline] - pub fn as_ptr(&self) -> *const T { - self as *const _ as *const T - } - #[inline] - pub fn as_mut_ptr(&mut self) -> *mut T { - self as *mut _ as *mut T - } - #[inline] - pub unsafe fn as_slice(&self, len: usize) -> &[T] { - ::core::slice::from_raw_parts(self.as_ptr(), len) - } - #[inline] - pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] { - ::core::slice::from_raw_parts_mut(self.as_mut_ptr(), len) - } -} -impl ::core::fmt::Debug for __IncompleteArrayField { - fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - fmt.write_str("__IncompleteArrayField") - } -} -pub const _TIME_H: u32 = 1; -pub const _FEATURES_H: u32 = 1; -pub const _STDC_PREDEF_H: u32 = 1; -pub const _SYS_CDEFS_H: u32 = 1; -pub const __glibc_c99_flexarr_available: u32 = 1; -pub const __clock_t_defined: u32 = 1; -pub const __time_t_defined: u32 = 1; -pub const __struct_tm_defined: u32 = 1; -pub const _STRUCT_TIMESPEC: u32 = 1; -pub const _UCHAR_H: u32 = 1; -pub const __mbstate_t_defined: u32 = 1; -pub const ____mbstate_t_defined: u32 = 1; -pub const _CTYPE_H: u32 = 1; -pub const _WCHAR_H: u32 = 1; -pub const __wint_t_defined: u32 = 1; -pub const _WINT_T: u32 = 1; -pub const ____FILE_defined: u32 = 1; -pub const _STDIO_H: u32 = 1; -pub const _____fpos_t_defined: u32 = 1; -pub const _____fpos64_t_defined: u32 = 1; -pub const __struct_FILE_defined: u32 = 1; -pub const _IO_EOF_SEEN: u32 = 16; -pub const _IO_ERR_SEEN: u32 = 32; -pub const _IO_USER_LOCK: u32 = 32768; -pub const _IOFBF: u32 = 0; -pub const _IOLBF: u32 = 1; -pub const _IONBF: u32 = 2; -pub const BUFSIZ: u32 = 8192; -pub const EOF: i32 = -1; -pub const P_tmpdir: &'static [u8; 5usize] = b"/tmp\0"; -pub const FILENAME_MAX: u32 = 4096; -pub const FOPEN_MAX: u32 = 16; -pub const _GETOPT_POSIX_H: u32 = 1; -pub const _GETOPT_CORE_H: u32 = 1; -pub const _STDINT_H: u32 = 1; -pub const INT8_MIN: i32 = -128; -pub const INT16_MIN: i32 = -32768; -pub const INT32_MIN: i32 = -2147483648; -pub const INT8_MAX: u32 = 127; -pub const INT16_MAX: u32 = 32767; -pub const INT32_MAX: u32 = 2147483647; -pub const INT_LEAST8_MIN: i32 = -128; -pub const INT_LEAST16_MIN: i32 = -32768; -pub const INT_LEAST32_MIN: i32 = -2147483648; -pub const INT_LEAST8_MAX: u32 = 127; -pub const INT_LEAST16_MAX: u32 = 32767; -pub const INT_LEAST32_MAX: u32 = 2147483647; -pub const INT_FAST8_MIN: i32 = -128; -pub const INT_FAST16_MIN: i64 = -9223372036854775808; -pub const INT_FAST32_MIN: i64 = -9223372036854775808; -pub const INT_FAST8_MAX: u32 = 127; -pub const INT_FAST16_MAX: u64 = 9223372036854775807; -pub const INT_FAST32_MAX: u64 = 9223372036854775807; -pub const INTPTR_MIN: i64 = -9223372036854775808; -pub const INTPTR_MAX: u64 = 9223372036854775807; -pub const PTRDIFF_MIN: i64 = -9223372036854775808; -pub const PTRDIFF_MAX: u64 = 9223372036854775807; -pub const _STDLIB_H: u32 = 1; -pub const __ldiv_t_defined: u32 = 1; -pub const __lldiv_t_defined: u32 = 1; -pub const EXIT_FAILURE: u32 = 1; -pub const EXIT_SUCCESS: u32 = 0; -pub const _STRING_H: u32 = 1; -pub const _NSIG: u32 = 33; -pub const __sig_atomic_t_defined: u32 = 1; -pub const __sigset_t_defined: u32 = 1; -pub const _LIBC_LIMITS_H_: u32 = 1; -pub const PATH_MAX: u32 = 4096; -pub const PIPE_BUF: u32 = 4096; -pub const PTHREAD_KEYS_MAX: u32 = 1024; -pub const PTHREAD_DESTRUCTOR_ITERATIONS: u32 = 4; -pub const PTHREAD_STACK_MIN: u32 = 16384; -pub const BC_BASE_MAX: u32 = 99; -pub const BC_DIM_MAX: u32 = 2048; -pub const BC_SCALE_MAX: u32 = 99; -pub const BC_STRING_MAX: u32 = 1000; -pub const COLL_WEIGHTS_MAX: u32 = 255; -pub const EXPR_NEST_MAX: u32 = 32; -pub const CHARCLASS_NAME_MAX: u32 = 2048; -pub const _XOPEN_LIM_H: u32 = 1; -pub const _XOPEN_IOV_MAX: u32 = 16; -pub const IOV_MAX: u32 = 1024; -pub const true_: u32 = 1; -pub const false_: u32 = 0; -pub const __bool_true_false_are_defined: u32 = 1; -pub const _BYTESWAP_H: u32 = 1; -pub const _NETINET_IN_H: u32 = 1; -pub const _SYS_SOCKET_H: u32 = 1; -pub const __iovec_defined: u32 = 1; -pub const _SYS_TYPES_H: u32 = 1; -pub const __clockid_t_defined: u32 = 1; -pub const __timer_t_defined: u32 = 1; -pub const _SS_SIZE: u32 = 128; -pub const IN_CLASSA_NET: u32 = 4278190080; -pub const IN_CLASSA_NSHIFT: u32 = 24; -pub const IN_CLASSA_HOST: u32 = 16777215; -pub const IN_CLASSA_MAX: u32 = 128; -pub const IN_CLASSB_NET: u32 = 4294901760; -pub const IN_CLASSB_NSHIFT: u32 = 16; -pub const IN_CLASSB_HOST: u32 = 65535; -pub const IN_CLASSB_MAX: u32 = 65536; -pub const IN_CLASSC_NET: u32 = 4294967040; -pub const IN_CLASSC_NSHIFT: u32 = 8; -pub const IN_CLASSC_HOST: u32 = 255; -pub const IN_LOOPBACKNET: u32 = 127; -pub const INET_ADDRSTRLEN: u32 = 16; -pub const INET6_ADDRSTRLEN: u32 = 46; -pub const _ENDIAN_H: u32 = 1; -pub const NCKEY_ESC: u32 = 27; -pub const NCKEY_SPACE: u32 = 32; -pub const CELL_ALPHA_HIGHCONTRAST: u32 = 805306368; -pub const CELL_ALPHA_TRANSPARENT: u32 = 536870912; -pub const CELL_ALPHA_BLEND: u32 = 268435456; -pub const CELL_ALPHA_OPAQUE: u32 = 0; -pub const CELL_BGDEFAULT_MASK: u32 = 1073741824; -pub const CELL_FGDEFAULT_MASK: u64 = 4611686018427387904; -pub const CELL_BG_RGB_MASK: u32 = 16777215; -pub const CELL_FG_RGB_MASK: u64 = 72057589742960640; -pub const CELL_BG_PALETTE: u32 = 134217728; -pub const NCPALETTESIZE: u32 = 256; -pub const CELL_FG_PALETTE: u64 = 576460752303423488; -pub const CELL_BG_ALPHA_MASK: u32 = 805306368; -pub const CELL_FG_ALPHA_MASK: u64 = 3458764513820540928; -pub const NCSTYLE_MASK: u32 = 1023; -pub const NCSTYLE_STANDOUT: u32 = 128; -pub const NCSTYLE_UNDERLINE: u32 = 64; -pub const NCSTYLE_REVERSE: u32 = 32; -pub const NCSTYLE_BLINK: u32 = 16; -pub const NCSTYLE_DIM: u32 = 8; -pub const NCSTYLE_BOLD: u32 = 4; -pub const NCSTYLE_INVIS: u32 = 2; -pub const NCSTYLE_PROTECT: u32 = 1; -pub const NCSTYLE_ITALIC: u32 = 256; -pub const NCSTYLE_STRUCK: u32 = 512; -pub const NCSTYLE_NONE: u32 = 0; -pub const NCOPTION_INHIBIT_SETLOCALE: u32 = 1; -pub const NCOPTION_NO_CLEAR_BITMAPS: u32 = 2; -pub const NCOPTION_NO_WINCH_SIGHANDLER: u32 = 4; -pub const NCOPTION_NO_QUIT_SIGHANDLERS: u32 = 8; -pub const NCOPTION_SUPPRESS_BANNERS: u32 = 32; -pub const NCOPTION_NO_ALTERNATE_SCREEN: u32 = 64; -pub const NCOPTION_NO_FONT_CHANGES: u32 = 128; -pub const NCPLANE_OPTION_HORALIGNED: u32 = 1; -pub const NCPLANE_OPTION_VERALIGNED: u32 = 2; -pub const NCPLANE_OPTION_MARGINALIZED: u32 = 4; -pub const NCBOXMASK_TOP: u32 = 1; -pub const NCBOXMASK_RIGHT: u32 = 2; -pub const NCBOXMASK_BOTTOM: u32 = 4; -pub const NCBOXMASK_LEFT: u32 = 8; -pub const NCBOXGRAD_TOP: u32 = 16; -pub const NCBOXGRAD_RIGHT: u32 = 32; -pub const NCBOXGRAD_BOTTOM: u32 = 64; -pub const NCBOXGRAD_LEFT: u32 = 128; -pub const NCBOXCORNER_MASK: u32 = 768; -pub const NCBOXCORNER_SHIFT: u32 = 8; -pub const NCVISUAL_OPTION_NODEGRADE: u32 = 1; -pub const NCVISUAL_OPTION_BLEND: u32 = 2; -pub const NCVISUAL_OPTION_HORALIGNED: u32 = 4; -pub const NCVISUAL_OPTION_VERALIGNED: u32 = 8; -pub const NCVISUAL_OPTION_ADDALPHA: u32 = 16; -pub const NCVISUAL_OPTION_CHILDPLANE: u32 = 32; -pub const NCREEL_OPTION_INFINITESCROLL: u32 = 1; -pub const NCREEL_OPTION_CIRCULAR: u32 = 2; -pub const PREFIXCOLUMNS: u32 = 7; -pub const IPREFIXCOLUMNS: u32 = 8; -pub const BPREFIXCOLUMNS: u32 = 9; -pub const PREFIXSTRLEN: u32 = 8; -pub const IPREFIXSTRLEN: u32 = 9; -pub const BPREFIXSTRLEN: u32 = 10; -pub const NCMENU_OPTION_BOTTOM: u32 = 1; -pub const NCMENU_OPTION_HIDING: u32 = 2; -pub const NCPROGBAR_OPTION_RETROGRADE: u32 = 1; -pub const NCTABBED_OPTION_BOTTOM: u32 = 1; -pub const NCPLOT_OPTION_LABELTICKSD: u32 = 1; -pub const NCPLOT_OPTION_EXPONENTIALD: u32 = 2; -pub const NCPLOT_OPTION_VERTICALI: u32 = 4; -pub const NCPLOT_OPTION_NODEGRADE: u32 = 8; -pub const NCPLOT_OPTION_DETECTMAXONLY: u32 = 16; -pub const NCPLOT_OPTION_PRINTSAMPLE: u32 = 32; -pub const NCREADER_OPTION_HORSCROLL: u32 = 1; -pub const NCREADER_OPTION_VERSCROLL: u32 = 2; -pub const NCREADER_OPTION_NOCMDKEYS: u32 = 4; -pub const NCREADER_OPTION_CURSOR: u32 = 8; -pub const NCDIRECT_OPTION_INHIBIT_SETLOCALE: u32 = 1; -pub const NCDIRECT_OPTION_INHIBIT_CBREAK: u32 = 2; -pub const NCDIRECT_OPTION_NO_QUIT_SIGHANDLERS: u32 = 8; -pub type size_t = cty::c_ulong; -#[doc = " Convenience types."] -pub type __u_char = cty::c_uchar; -pub type __u_short = cty::c_ushort; -pub type __u_int = cty::c_uint; -pub type __u_long = cty::c_ulong; -#[doc = " Fixed-size types, underlying types depend on word size and compiler."] -pub type __int8_t = cty::c_schar; -pub type __uint8_t = cty::c_uchar; -pub type __int16_t = cty::c_short; -pub type __uint16_t = cty::c_ushort; -pub type __int32_t = cty::c_int; -pub type __uint32_t = cty::c_uint; -pub type __int64_t = cty::c_long; -pub type __uint64_t = cty::c_ulong; -#[doc = " Smallest types with at least a given width."] -pub type __int_least8_t = __int8_t; -pub type __uint_least8_t = __uint8_t; -pub type __int_least16_t = __int16_t; -pub type __uint_least16_t = __uint16_t; -pub type __int_least32_t = __int32_t; -pub type __uint_least32_t = __uint32_t; -pub type __int_least64_t = __int64_t; -pub type __uint_least64_t = __uint64_t; -pub type __quad_t = cty::c_long; -pub type __u_quad_t = cty::c_ulong; -pub type __intmax_t = cty::c_long; -pub type __uintmax_t = cty::c_ulong; -pub type __dev_t = cty::c_ulong; -pub type __uid_t = cty::c_uint; -pub type __gid_t = cty::c_uint; -pub type __ino_t = cty::c_ulong; -pub type __ino64_t = cty::c_ulong; -pub type __mode_t = cty::c_uint; -pub type __nlink_t = cty::c_ulong; -pub type __off_t = cty::c_long; -pub type __off64_t = cty::c_long; -pub type __pid_t = cty::c_int; -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct __fsid_t { - pub __val: [cty::c_int; 2usize], -} -#[test] -fn bindgen_test_layout___fsid_t() { - assert_eq!( - ::core::mem::size_of::<__fsid_t>(), - 8usize, - concat!("Size of: ", stringify!(__fsid_t)) - ); - assert_eq!( - ::core::mem::align_of::<__fsid_t>(), - 4usize, - concat!("Alignment of ", stringify!(__fsid_t)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<__fsid_t>())).__val as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__fsid_t), - "::", - stringify!(__val) - ) - ); -} -pub type __clock_t = cty::c_long; -pub type __rlim_t = cty::c_ulong; -pub type __rlim64_t = cty::c_ulong; -pub type __id_t = cty::c_uint; -pub type __time_t = cty::c_long; -pub type __useconds_t = cty::c_uint; -pub type __suseconds_t = cty::c_long; -pub type __daddr_t = cty::c_int; -pub type __key_t = cty::c_int; -pub type __clockid_t = cty::c_int; -pub type __timer_t = *mut cty::c_void; -pub type __blksize_t = cty::c_long; -pub type __blkcnt_t = cty::c_long; -pub type __blkcnt64_t = cty::c_long; -pub type __fsblkcnt_t = cty::c_ulong; -pub type __fsblkcnt64_t = cty::c_ulong; -pub type __fsfilcnt_t = cty::c_ulong; -pub type __fsfilcnt64_t = cty::c_ulong; -pub type __fsword_t = cty::c_long; -pub type __ssize_t = cty::c_long; -pub type __syscall_slong_t = cty::c_long; -pub type __syscall_ulong_t = cty::c_ulong; -#[doc = " These few don't really vary by system, they always correspond"] -#[doc = "to one of the other defined types."] -pub type __loff_t = __off64_t; -pub type __caddr_t = *mut cty::c_char; -pub type __intptr_t = cty::c_long; -pub type __socklen_t = cty::c_uint; -#[doc = " C99: An integer type that can be accessed as an atomic entity,"] -#[doc = "even in the presence of asynchronous interrupts."] -#[doc = "It is not currently necessary for this to be machine-specific."] -pub type __sig_atomic_t = cty::c_int; -#[doc = " Returned by `clock'."] -pub type clock_t = __clock_t; -#[doc = " Returned by `time'."] -pub type time_t = __time_t; -#[doc = " ISO C `broken-down time' structure."] -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct tm { - #[doc = " Seconds.\t[0-60] (1 leap second)"] - pub tm_sec: cty::c_int, - #[doc = " Minutes.\t[0-59]"] - pub tm_min: cty::c_int, - #[doc = " Hours.\t[0-23]"] - pub tm_hour: cty::c_int, - #[doc = " Day.\t\t[1-31]"] - pub tm_mday: cty::c_int, - #[doc = " Month.\t[0-11]"] - pub tm_mon: cty::c_int, - #[doc = " Year\t- 1900."] - pub tm_year: cty::c_int, - #[doc = " Day of week.\t[0-6]"] - pub tm_wday: cty::c_int, - #[doc = " Days in year.[0-365]"] - pub tm_yday: cty::c_int, - #[doc = " DST.\t\t[-1/0/1]"] - pub tm_isdst: cty::c_int, - #[doc = " Seconds east of UTC."] - pub __tm_gmtoff: cty::c_long, - #[doc = " Timezone abbreviation."] - pub __tm_zone: *const cty::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 Default for tm { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[doc = " POSIX.1b structure for a time value. This is like a `struct timeval' but"] -#[doc = "has nanoseconds instead of microseconds."] -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct timespec { - #[doc = " Seconds."] - pub tv_sec: __time_t, - #[doc = " Nanoseconds."] - pub tv_nsec: __syscall_slong_t, -} -#[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) - ) - ); -} -extern "C" { - pub static mut __tzname: [*mut cty::c_char; 2usize]; -} -extern "C" { - pub static mut __daylight: cty::c_int; -} -extern "C" { - pub static mut __timezone: cty::c_long; -} -extern "C" { - pub static mut tzname: [*mut cty::c_char; 2usize]; -} -extern "C" { - pub static mut daylight: cty::c_int; -} -extern "C" { - pub static mut timezone: cty::c_long; -} -#[doc = " Conversion state information."] -#[repr(C)] -#[derive(Copy, Clone)] -pub struct __mbstate_t { - pub __count: cty::c_int, - #[doc = " Value so far."] - pub __value: __mbstate_t__bindgen_ty_1, -} -#[repr(C)] -#[derive(Copy, Clone)] -pub union __mbstate_t__bindgen_ty_1 { - pub __wch: cty::c_uint, - pub __wchb: [cty::c_char; 4usize], - _bindgen_union_align: u32, -} -#[test] -fn bindgen_test_layout___mbstate_t__bindgen_ty_1() { - assert_eq!( - ::core::mem::size_of::<__mbstate_t__bindgen_ty_1>(), - 4usize, - concat!("Size of: ", stringify!(__mbstate_t__bindgen_ty_1)) - ); - assert_eq!( - ::core::mem::align_of::<__mbstate_t__bindgen_ty_1>(), - 4usize, - concat!("Alignment of ", stringify!(__mbstate_t__bindgen_ty_1)) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::<__mbstate_t__bindgen_ty_1>())).__wch as *const _ as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__mbstate_t__bindgen_ty_1), - "::", - stringify!(__wch) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::<__mbstate_t__bindgen_ty_1>())).__wchb as *const _ as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__mbstate_t__bindgen_ty_1), - "::", - stringify!(__wchb) - ) - ); -} -impl Default for __mbstate_t__bindgen_ty_1 { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[test] -fn bindgen_test_layout___mbstate_t() { - assert_eq!( - ::core::mem::size_of::<__mbstate_t>(), - 8usize, - concat!("Size of: ", stringify!(__mbstate_t)) - ); - assert_eq!( - ::core::mem::align_of::<__mbstate_t>(), - 4usize, - concat!("Alignment of ", stringify!(__mbstate_t)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<__mbstate_t>())).__count as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__mbstate_t), - "::", - stringify!(__count) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<__mbstate_t>())).__value as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(__mbstate_t), - "::", - stringify!(__value) - ) - ); -} -impl Default for __mbstate_t { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -pub type mbstate_t = __mbstate_t; -#[doc = " Define the 16-bit and 32-bit character types."] -pub type char16_t = __uint_least16_t; -pub type char32_t = __uint_least32_t; -pub type _Float32 = f32; -pub type _Float64 = f64; -pub type _Float32x = f64; -pub type _Float64x = u128; -pub type wchar_t = cty::c_int; -pub type va_list = __builtin_va_list; -pub type __gnuc_va_list = __builtin_va_list; -pub type wint_t = cty::c_uint; -#[doc = " Scalar type that can hold values which represent locale-specific"] -#[doc = "character classifications."] -pub type wctype_t = cty::c_ulong; -#[doc = " The tag name of this struct is _G_fpos_t to preserve historic"] -#[doc = "C++ mangled names for functions taking fpos_t arguments."] -#[doc = "That name should not be used in new code."] -#[repr(C)] -#[derive(Copy, Clone)] -pub struct _G_fpos_t { - pub __pos: __off_t, - pub __state: __mbstate_t, -} -#[test] -fn bindgen_test_layout__G_fpos_t() { - assert_eq!( - ::core::mem::size_of::<_G_fpos_t>(), - 16usize, - concat!("Size of: ", stringify!(_G_fpos_t)) - ); - assert_eq!( - ::core::mem::align_of::<_G_fpos_t>(), - 8usize, - concat!("Alignment of ", stringify!(_G_fpos_t)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_G_fpos_t>())).__pos as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(_G_fpos_t), - "::", - stringify!(__pos) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_G_fpos_t>())).__state as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(_G_fpos_t), - "::", - stringify!(__state) - ) - ); -} -impl Default for _G_fpos_t { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[doc = " The tag name of this struct is _G_fpos_t to preserve historic"] -#[doc = "C++ mangled names for functions taking fpos_t arguments."] -#[doc = "That name should not be used in new code."] -pub type __fpos_t = _G_fpos_t; -#[doc = " The tag name of this struct is _G_fpos64_t to preserve historic"] -#[doc = "C++ mangled names for functions taking fpos_t and/or fpos64_t"] -#[doc = "arguments. That name should not be used in new code."] -#[repr(C)] -#[derive(Copy, Clone)] -pub struct _G_fpos64_t { - pub __pos: __off64_t, - pub __state: __mbstate_t, -} -#[test] -fn bindgen_test_layout__G_fpos64_t() { - assert_eq!( - ::core::mem::size_of::<_G_fpos64_t>(), - 16usize, - concat!("Size of: ", stringify!(_G_fpos64_t)) - ); - assert_eq!( - ::core::mem::align_of::<_G_fpos64_t>(), - 8usize, - concat!("Alignment of ", stringify!(_G_fpos64_t)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_G_fpos64_t>())).__pos as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(_G_fpos64_t), - "::", - stringify!(__pos) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_G_fpos64_t>())).__state as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(_G_fpos64_t), - "::", - stringify!(__state) - ) - ); -} -impl Default for _G_fpos64_t { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[doc = " The tag name of this struct is _G_fpos64_t to preserve historic"] -#[doc = "C++ mangled names for functions taking fpos_t and/or fpos64_t"] -#[doc = "arguments. That name should not be used in new code."] -pub type __fpos64_t = _G_fpos64_t; -#[doc = " The opaque type of streams. This is the definition used elsewhere."] -pub type FILE = _IO_FILE; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct _IO_marker { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct _IO_codecvt { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct _IO_wide_data { - _unused: [u8; 0], -} -pub type _IO_lock_t = cty::c_void; -#[doc = " The tag name of this struct is _IO_FILE to preserve historic"] -#[doc = "C++ mangled names for functions taking FILE* arguments."] -#[doc = "That name should not be used in new code."] -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct _IO_FILE { - #[doc = " High-order word is _IO_MAGIC; rest is flags."] - pub _flags: cty::c_int, - #[doc = " Current read pointer"] - pub _IO_read_ptr: *mut cty::c_char, - #[doc = " End of get area."] - pub _IO_read_end: *mut cty::c_char, - #[doc = " Start of putback+get area."] - pub _IO_read_base: *mut cty::c_char, - #[doc = " Start of put area."] - pub _IO_write_base: *mut cty::c_char, - #[doc = " Current put pointer."] - pub _IO_write_ptr: *mut cty::c_char, - #[doc = " End of put area."] - pub _IO_write_end: *mut cty::c_char, - #[doc = " Start of reserve area."] - pub _IO_buf_base: *mut cty::c_char, - #[doc = " End of reserve area."] - pub _IO_buf_end: *mut cty::c_char, - #[doc = " Pointer to start of non-current get area."] - pub _IO_save_base: *mut cty::c_char, - #[doc = " Pointer to first valid character of backup area"] - pub _IO_backup_base: *mut cty::c_char, - #[doc = " Pointer to end of non-current get area."] - pub _IO_save_end: *mut cty::c_char, - pub _markers: *mut _IO_marker, - pub _chain: *mut _IO_FILE, - pub _fileno: cty::c_int, - pub _flags2: cty::c_int, - #[doc = " This used to be _offset but it's too small."] - pub _old_offset: __off_t, - #[doc = " 1+column number of pbase(); 0 is unknown."] - pub _cur_column: cty::c_ushort, - pub _vtable_offset: cty::c_schar, - pub _shortbuf: [cty::c_char; 1usize], - pub _lock: *mut _IO_lock_t, - pub _offset: __off64_t, - #[doc = " Wide character stream stuff."] - pub _codecvt: *mut _IO_codecvt, - pub _wide_data: *mut _IO_wide_data, - pub _freeres_list: *mut _IO_FILE, - pub _freeres_buf: *mut cty::c_void, - pub __pad5: size_t, - pub _mode: cty::c_int, - #[doc = " Make sure we don't get into trouble again."] - pub _unused2: [cty::c_char; 20usize], -} -#[test] -fn bindgen_test_layout__IO_FILE() { - assert_eq!( - ::core::mem::size_of::<_IO_FILE>(), - 216usize, - concat!("Size of: ", stringify!(_IO_FILE)) - ); - assert_eq!( - ::core::mem::align_of::<_IO_FILE>(), - 8usize, - concat!("Alignment of ", stringify!(_IO_FILE)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._flags as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_flags) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_read_ptr as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_read_ptr) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_read_end as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_read_end) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_read_base as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_read_base) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_write_base as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_write_base) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_write_ptr as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_write_ptr) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_write_end as *const _ as usize }, - 48usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_write_end) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_buf_base as *const _ as usize }, - 56usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_buf_base) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_buf_end as *const _ as usize }, - 64usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_buf_end) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_save_base as *const _ as usize }, - 72usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_save_base) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_backup_base as *const _ as usize }, - 80usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_backup_base) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._IO_save_end as *const _ as usize }, - 88usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_save_end) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._markers as *const _ as usize }, - 96usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_markers) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._chain as *const _ as usize }, - 104usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_chain) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._fileno as *const _ as usize }, - 112usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_fileno) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._flags2 as *const _ as usize }, - 116usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_flags2) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._old_offset as *const _ as usize }, - 120usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_old_offset) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._cur_column as *const _ as usize }, - 128usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_cur_column) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._vtable_offset as *const _ as usize }, - 130usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_vtable_offset) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._shortbuf as *const _ as usize }, - 131usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_shortbuf) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._lock as *const _ as usize }, - 136usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_lock) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._offset as *const _ as usize }, - 144usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_offset) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._codecvt as *const _ as usize }, - 152usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_codecvt) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._wide_data as *const _ as usize }, - 160usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_wide_data) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._freeres_list as *const _ as usize }, - 168usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_freeres_list) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._freeres_buf as *const _ as usize }, - 176usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_freeres_buf) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>())).__pad5 as *const _ as usize }, - 184usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(__pad5) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._mode as *const _ as usize }, - 192usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_mode) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<_IO_FILE>()))._unused2 as *const _ as usize }, - 196usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_unused2) - ) - ); -} -impl Default for _IO_FILE { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -pub type fpos_t = __fpos_t; -extern "C" { - pub static mut stdin: *mut FILE; -} -extern "C" { - pub static mut stdout: *mut FILE; -} -extern "C" { - pub static mut stderr: *mut FILE; -} -extern "C" { - pub static mut optarg: *mut cty::c_char; -} -extern "C" { - pub static mut optind: cty::c_int; -} -extern "C" { - pub static mut opterr: cty::c_int; -} -extern "C" { - pub static mut optopt: cty::c_int; -} -#[doc = " Signed."] -pub type int_least8_t = __int_least8_t; -pub type int_least16_t = __int_least16_t; -pub type int_least32_t = __int_least32_t; -pub type int_least64_t = __int_least64_t; -#[doc = " Unsigned."] -pub type uint_least8_t = __uint_least8_t; -pub type uint_least16_t = __uint_least16_t; -pub type uint_least32_t = __uint_least32_t; -pub type uint_least64_t = __uint_least64_t; -#[doc = " Signed."] -pub type int_fast8_t = cty::c_schar; -pub type int_fast16_t = cty::c_long; -pub type int_fast32_t = cty::c_long; -pub type int_fast64_t = cty::c_long; -#[doc = " Unsigned."] -pub type uint_fast8_t = cty::c_uchar; -pub type uint_fast16_t = cty::c_ulong; -pub type uint_fast32_t = cty::c_ulong; -pub type uint_fast64_t = cty::c_ulong; -#[doc = " Largest integral types."] -pub type intmax_t = __intmax_t; -pub type uintmax_t = __uintmax_t; -#[doc = " Returned by `div'."] -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct div_t { - #[doc = " Quotient."] - pub quot: cty::c_int, - #[doc = " Remainder."] - pub rem: cty::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) - ) - ); -} -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ldiv_t { - #[doc = " Quotient."] - pub quot: cty::c_long, - #[doc = " Remainder."] - pub rem: cty::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) - ) - ); -} -#[doc = " Returned by `lldiv'."] -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct lldiv_t { - #[doc = " Quotient."] - pub quot: cty::c_longlong, - #[doc = " Remainder."] - pub rem: cty::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) - ) - ); -} -pub type __compar_fn_t = ::core::option::Option< - unsafe extern "C" fn(arg1: *const cty::c_void, arg2: *const cty::c_void) -> cty::c_int, ->; -#[doc = " An integral type that can be modified atomically, without the"] -#[doc = "possibility of a signal arriving in the middle of the operation."] -pub type sig_atomic_t = __sig_atomic_t; -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct __sigset_t { - pub __val: [cty::c_ulong; 16usize], -} -#[test] -fn bindgen_test_layout___sigset_t() { - assert_eq!( - ::core::mem::size_of::<__sigset_t>(), - 128usize, - concat!("Size of: ", stringify!(__sigset_t)) - ); - assert_eq!( - ::core::mem::align_of::<__sigset_t>(), - 8usize, - concat!("Alignment of ", stringify!(__sigset_t)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::<__sigset_t>())).__val as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__sigset_t), - "::", - stringify!(__val) - ) - ); -} -#[doc = " A set of signals to be blocked, unblocked, or waited for."] -pub type sigset_t = __sigset_t; -pub type pid_t = __pid_t; -pub type uid_t = __uid_t; -#[doc = " Type of a signal handler."] -pub type __sighandler_t = ::core::option::Option; -extern "C" { - #[link_name = "\u{1}__sysv_signal"] - pub fn signal(__sig: cty::c_int, __handler: __sighandler_t) -> __sighandler_t; -} -extern "C" { - #[doc = " Clear all signals from SET."] - pub fn sigemptyset(__set: *mut sigset_t) -> cty::c_int; -} -extern "C" { - #[doc = " Set all signals in SET."] - pub fn sigfillset(__set: *mut sigset_t) -> cty::c_int; -} -extern "C" { - #[doc = " Add SIGNO to SET."] - pub fn sigaddset(__set: *mut sigset_t, __signo: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Remove SIGNO from SET."] - pub fn sigdelset(__set: *mut sigset_t, __signo: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Return 1 if SIGNO is in SET, 0 if not."] - pub fn sigismember(__set: *const sigset_t, __signo: cty::c_int) -> cty::c_int; -} -#[doc = " Structure describing the action to be taken when a signal arrives."] -#[repr(C)] -pub struct sigaction { - pub sa_handler: __sighandler_t, - #[doc = " Additional set of signals to be blocked."] - pub sa_mask: __sigset_t, - #[doc = " Special flags."] - pub sa_flags: cty::c_int, - #[doc = " Restore handler."] - pub sa_restorer: ::core::option::Option, -} -#[test] -fn bindgen_test_layout_sigaction() { - assert_eq!( - ::core::mem::size_of::(), - 152usize, - concat!("Size of: ", stringify!(sigaction)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(sigaction)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sa_handler as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(sigaction), - "::", - stringify!(sa_handler) - ) - ); - 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 }, - 136usize, - concat!( - "Offset of field: ", - stringify!(sigaction), - "::", - stringify!(sa_flags) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sa_restorer as *const _ as usize }, - 144usize, - concat!( - "Offset of field: ", - stringify!(sigaction), - "::", - stringify!(sa_restorer) - ) - ); -} -impl Default for sigaction { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -extern "C" { - #[doc = " Get and/or change the set of blocked signals."] - pub fn sigprocmask( - __how: cty::c_int, - __set: *const sigset_t, - __oset: *mut sigset_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Change the set of blocked signals to SET,"] - #[doc = "wait until a signal arrives, and restore the set of blocked signals."] - #[doc = ""] - #[doc = "This function is a cancellation point and therefore not marked with"] - #[doc = "__THROW."] - pub fn sigsuspend(__set: *const sigset_t) -> cty::c_int; -} -extern "C" { - #[doc = " Get and/or set the action for signal SIG."] - pub fn sigaction( - __sig: cty::c_int, - __act: *const sigaction, - __oact: *mut sigaction, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Put in SET all signals that are blocked and waiting to be delivered."] - pub fn sigpending(__set: *mut sigset_t) -> cty::c_int; -} -#[doc = " Structure for scatter/gather I/O."] -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct iovec { - #[doc = " Pointer to data."] - pub iov_base: *mut cty::c_void, - #[doc = " Length of data."] - pub iov_len: size_t, -} -#[test] -fn bindgen_test_layout_iovec() { - assert_eq!( - ::core::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(iovec)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(iovec)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).iov_base as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(iovec), - "::", - stringify!(iov_base) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).iov_len as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(iovec), - "::", - stringify!(iov_len) - ) - ); -} -impl Default for iovec { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -pub type ino_t = __ino_t; -pub type dev_t = __dev_t; -pub type gid_t = __gid_t; -pub type mode_t = __mode_t; -pub type nlink_t = __nlink_t; -pub type off_t = __off_t; -pub type id_t = __id_t; -pub type ssize_t = __ssize_t; -pub type key_t = __key_t; -#[doc = " Clock ID used in clock and timer functions."] -pub type clockid_t = __clockid_t; -#[doc = " Timer ID returned by `timer_create'."] -pub type timer_t = __timer_t; -pub type useconds_t = __useconds_t; -pub type suseconds_t = __suseconds_t; -#[doc = " These were defined by ISO C without the first `_'."] -pub type u_int8_t = __uint8_t; -pub type u_int16_t = __uint16_t; -pub type u_int32_t = __uint32_t; -pub type u_int64_t = __uint64_t; -pub type register_t = cty::c_long; -pub type blkcnt_t = __blkcnt_t; -pub type fsblkcnt_t = __fsblkcnt_t; -pub type fsfilcnt_t = __fsfilcnt_t; -pub type socklen_t = __socklen_t; -#[doc = " Sequenced, reliable, connection-based"] -#[doc = "byte streams."] -pub const __socket_type_SOCK_STREAM: __socket_type = 1; -#[doc = " Connectionless, unreliable datagrams"] -#[doc = "of fixed maximum length."] -pub const __socket_type_SOCK_DGRAM: __socket_type = 2; -#[doc = " Raw protocol interface."] -pub const __socket_type_SOCK_RAW: __socket_type = 3; -#[doc = " Reliably-delivered messages."] -pub const __socket_type_SOCK_RDM: __socket_type = 4; -#[doc = " Sequenced, reliable, connection-based,"] -#[doc = "datagrams of fixed maximum length."] -pub const __socket_type_SOCK_SEQPACKET: __socket_type = 5; -#[doc = " Datagram Congestion Control Protocol."] -pub const __socket_type_SOCK_DCCP: __socket_type = 6; -#[doc = " Linux specific way of getting packets"] -#[doc = "at the dev level. For writing rarp and"] -#[doc = "other similar things on the user level."] -pub const __socket_type_SOCK_PACKET: __socket_type = 10; -#[doc = " Atomically set close-on-exec flag for the"] -#[doc = "new descriptor(s)."] -pub const __socket_type_SOCK_CLOEXEC: __socket_type = 524288; -#[doc = " Atomically mark descriptor(s) as"] -#[doc = "non-blocking."] -pub const __socket_type_SOCK_NONBLOCK: __socket_type = 2048; -#[doc = " Types of sockets."] -pub type __socket_type = cty::c_uint; -#[doc = " POSIX.1g specifies this type name for the `sa_family' member."] -pub type sa_family_t = cty::c_ushort; -#[doc = " Structure describing a generic socket address."] -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct sockaddr { - pub sa_family: sa_family_t, - #[doc = " Address data."] - pub sa_data: [cty::c_char; 14usize], -} -#[test] -fn bindgen_test_layout_sockaddr() { - assert_eq!( - ::core::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(sockaddr)) - ); - assert_eq!( - ::core::mem::align_of::(), - 2usize, - concat!("Alignment of ", stringify!(sockaddr)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sa_family as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(sockaddr), - "::", - stringify!(sa_family) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sa_data as *const _ as usize }, - 2usize, - concat!( - "Offset of field: ", - stringify!(sockaddr), - "::", - stringify!(sa_data) - ) - ); -} -#[repr(C)] -#[derive(Copy, Clone)] -pub struct sockaddr_storage { - pub ss_family: sa_family_t, - pub __ss_padding: [cty::c_char; 118usize], - #[doc = " Force desired alignment."] - pub __ss_align: cty::c_ulong, -} -#[test] -fn bindgen_test_layout_sockaddr_storage() { - assert_eq!( - ::core::mem::size_of::(), - 128usize, - concat!("Size of: ", stringify!(sockaddr_storage)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(sockaddr_storage)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).ss_family as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_storage), - "::", - stringify!(ss_family) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).__ss_padding as *const _ as usize }, - 2usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_storage), - "::", - stringify!(__ss_padding) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).__ss_align as *const _ as usize }, - 120usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_storage), - "::", - stringify!(__ss_align) - ) - ); -} -impl Default for sockaddr_storage { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[doc = " Structure describing messages sent by"] -#[doc = "`sendmsg' and received by `recvmsg'."] -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct msghdr { - #[doc = " Address to send to/receive from."] - pub msg_name: *mut cty::c_void, - #[doc = " Length of address data."] - pub msg_namelen: socklen_t, - #[doc = " Vector of data to send/receive into."] - pub msg_iov: *mut iovec, - #[doc = " Number of elements in the vector."] - pub msg_iovlen: size_t, - #[doc = " Ancillary data (eg BSD filedesc passing)."] - pub msg_control: *mut cty::c_void, - #[doc = " Ancillary data buffer length."] - #[doc = " The type should be socklen_t but the"] - #[doc = "definition of the kernel is incompatible"] - #[doc = "with this."] - pub msg_controllen: size_t, - #[doc = " Flags on received message."] - pub msg_flags: cty::c_int, -} -#[test] -fn bindgen_test_layout_msghdr() { - assert_eq!( - ::core::mem::size_of::(), - 56usize, - concat!("Size of: ", stringify!(msghdr)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(msghdr)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).msg_name as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(msghdr), - "::", - stringify!(msg_name) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).msg_namelen as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(msghdr), - "::", - stringify!(msg_namelen) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).msg_iov as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(msghdr), - "::", - stringify!(msg_iov) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).msg_iovlen as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(msghdr), - "::", - stringify!(msg_iovlen) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).msg_control as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(msghdr), - "::", - stringify!(msg_control) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).msg_controllen as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(msghdr), - "::", - stringify!(msg_controllen) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).msg_flags as *const _ as usize }, - 48usize, - concat!( - "Offset of field: ", - stringify!(msghdr), - "::", - stringify!(msg_flags) - ) - ); -} -impl Default for msghdr { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[doc = " Structure used for storage of ancillary data object information."] -#[repr(C)] -#[derive(Debug, Default)] -pub struct cmsghdr { - #[doc = " Length of data in cmsg_data plus length"] - #[doc = "of cmsghdr structure."] - #[doc = " The type should be socklen_t but the"] - #[doc = "definition of the kernel is incompatible"] - #[doc = "with this."] - pub cmsg_len: size_t, - #[doc = " Originating protocol."] - pub cmsg_level: cty::c_int, - #[doc = " Protocol specific type."] - pub cmsg_type: cty::c_int, - #[doc = " Ancillary data."] - pub __cmsg_data: __IncompleteArrayField, -} -#[test] -fn bindgen_test_layout_cmsghdr() { - assert_eq!( - ::core::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(cmsghdr)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(cmsghdr)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).cmsg_len as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(cmsghdr), - "::", - stringify!(cmsg_len) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).cmsg_level as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(cmsghdr), - "::", - stringify!(cmsg_level) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).cmsg_type as *const _ as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(cmsghdr), - "::", - stringify!(cmsg_type) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).__cmsg_data as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(cmsghdr), - "::", - stringify!(__cmsg_data) - ) - ); -} -#[doc = " Structure used to manipulate the SO_LINGER option."] -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct linger { - #[doc = " Nonzero to linger on close."] - pub l_onoff: cty::c_int, - #[doc = " Time to linger."] - pub l_linger: cty::c_int, -} -#[test] -fn bindgen_test_layout_linger() { - assert_eq!( - ::core::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(linger)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(linger)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).l_onoff as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(linger), - "::", - stringify!(l_onoff) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).l_linger as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(linger), - "::", - stringify!(l_linger) - ) - ); -} -#[doc = " Internet address."] -pub type in_addr_t = u32; -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct in_addr { - pub s_addr: in_addr_t, -} -#[test] -fn bindgen_test_layout_in_addr() { - assert_eq!( - ::core::mem::size_of::(), - 4usize, - concat!("Size of: ", stringify!(in_addr)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(in_addr)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).s_addr as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(in_addr), - "::", - stringify!(s_addr) - ) - ); -} -#[doc = " Type to represent a port."] -pub type in_port_t = u16; -#[doc = " IPv6 address"] -#[repr(C)] -#[derive(Copy, Clone)] -pub struct in6_addr { - pub __in6_u: in6_addr__bindgen_ty_1, -} -#[repr(C)] -#[derive(Copy, Clone)] -pub union in6_addr__bindgen_ty_1 { - pub __u6_addr8: [u8; 16usize], - pub __u6_addr16: [u16; 8usize], - pub __u6_addr32: [u32; 4usize], - _bindgen_union_align: [u32; 4usize], -} -#[test] -fn bindgen_test_layout_in6_addr__bindgen_ty_1() { - assert_eq!( - ::core::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(in6_addr__bindgen_ty_1)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(in6_addr__bindgen_ty_1)) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).__u6_addr8 as *const _ as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(in6_addr__bindgen_ty_1), - "::", - stringify!(__u6_addr8) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).__u6_addr16 as *const _ as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(in6_addr__bindgen_ty_1), - "::", - stringify!(__u6_addr16) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).__u6_addr32 as *const _ as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(in6_addr__bindgen_ty_1), - "::", - stringify!(__u6_addr32) - ) - ); -} -impl Default for in6_addr__bindgen_ty_1 { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[test] -fn bindgen_test_layout_in6_addr() { - assert_eq!( - ::core::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(in6_addr)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(in6_addr)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).__in6_u as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(in6_addr), - "::", - stringify!(__in6_u) - ) - ); -} -impl Default for in6_addr { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -extern "C" { - pub static in6addr_any: in6_addr; -} -extern "C" { - pub static in6addr_loopback: in6_addr; -} -#[doc = " Structure describing an Internet socket address."] -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct sockaddr_in { - pub sin_family: sa_family_t, - #[doc = " Port number."] - pub sin_port: in_port_t, - #[doc = " Internet address."] - pub sin_addr: in_addr, - #[doc = " Pad to size of `struct sockaddr'."] - pub sin_zero: [cty::c_uchar; 8usize], -} -#[test] -fn bindgen_test_layout_sockaddr_in() { - assert_eq!( - ::core::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(sockaddr_in)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(sockaddr_in)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin_family as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in), - "::", - stringify!(sin_family) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin_port as *const _ as usize }, - 2usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in), - "::", - stringify!(sin_port) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin_addr as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in), - "::", - stringify!(sin_addr) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin_zero as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in), - "::", - stringify!(sin_zero) - ) - ); -} -#[doc = " Ditto, for IPv6."] -#[repr(C)] -#[derive(Copy, Clone)] -pub struct sockaddr_in6 { - pub sin6_family: sa_family_t, - #[doc = " Transport layer port #"] - pub sin6_port: in_port_t, - #[doc = " IPv6 flow information"] - pub sin6_flowinfo: u32, - #[doc = " IPv6 address"] - pub sin6_addr: in6_addr, - #[doc = " IPv6 scope-id"] - pub sin6_scope_id: u32, -} -#[test] -fn bindgen_test_layout_sockaddr_in6() { - assert_eq!( - ::core::mem::size_of::(), - 28usize, - concat!("Size of: ", stringify!(sockaddr_in6)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(sockaddr_in6)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin6_family as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in6), - "::", - stringify!(sin6_family) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin6_port as *const _ as usize }, - 2usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in6), - "::", - stringify!(sin6_port) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin6_flowinfo as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in6), - "::", - stringify!(sin6_flowinfo) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin6_addr as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in6), - "::", - stringify!(sin6_addr) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sin6_scope_id as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(sockaddr_in6), - "::", - stringify!(sin6_scope_id) - ) - ); -} -impl Default for sockaddr_in6 { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[doc = " Likewise, for IPv6."] -#[repr(C)] -#[derive(Copy, Clone)] -pub struct ipv6_mreq { - #[doc = " IPv6 multicast address of group"] - pub ipv6mr_multiaddr: in6_addr, - #[doc = " local interface"] - pub ipv6mr_interface: cty::c_uint, -} -#[test] -fn bindgen_test_layout_ipv6_mreq() { - assert_eq!( - ::core::mem::size_of::(), - 20usize, - concat!("Size of: ", stringify!(ipv6_mreq)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(ipv6_mreq)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).ipv6mr_multiaddr as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ipv6_mreq), - "::", - stringify!(ipv6mr_multiaddr) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).ipv6mr_interface as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ipv6_mreq), - "::", - stringify!(ipv6mr_interface) - ) - ); -} -impl Default for ipv6_mreq { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -extern "C" { - #[doc = " Get a human-readable string describing the running Notcurses version."] - pub fn notcurses_version() -> *const cty::c_char; -} -extern "C" { - #[doc = " Cannot be inline, as we want to get the versions of the actual Notcurses"] - #[doc = " library we loaded, not what we compile against."] - pub fn notcurses_version_components( - major: *mut cty::c_int, - minor: *mut cty::c_int, - patch: *mut cty::c_int, - tweak: *mut cty::c_int, - ); -} -#[repr(C)] -#[derive(Debug)] -pub struct notcurses { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncplane { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncvisual { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncuplot { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncdplot { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncprogbar { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncfdplane { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncsubproc { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncselector { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncmultiselector { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncreader { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ncfadectx { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct nctablet { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug)] -pub struct ncreel { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct nctab { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct nctabbed { - _unused: [u8; 0], -} -#[doc = " let the ncvisual pick"] -pub const ncblitter_e_NCBLIT_DEFAULT: ncblitter_e = 0; -#[doc = " space, compatible with ASCII"] -pub const ncblitter_e_NCBLIT_1x1: ncblitter_e = 1; -#[doc = " halves + 1x1 (space) ▄▀"] -pub const ncblitter_e_NCBLIT_2x1: ncblitter_e = 2; -#[doc = " quadrants + 2x1 ▗▐ ▖▀▟▌▙"] -pub const ncblitter_e_NCBLIT_2x2: ncblitter_e = 3; -#[doc = " sextants (*NOT* 2x2) 🬀🬁🬂🬃🬄🬅🬆🬇🬈🬉🬊🬋🬌🬍🬎🬏🬐🬑🬒🬓🬔🬕🬖🬗🬘🬙🬚🬛🬜🬝🬞"] -pub const ncblitter_e_NCBLIT_3x2: ncblitter_e = 4; -#[doc = " 4 rows, 2 cols (braille) ⡀⡄⡆⡇⢀⣀⣄⣆⣇⢠⣠⣤⣦⣧⢰⣰⣴⣶⣷⢸⣸⣼⣾⣿"] -pub const ncblitter_e_NCBLIT_BRAILLE: ncblitter_e = 5; -#[doc = " pixel graphics"] -pub const ncblitter_e_NCBLIT_PIXEL: ncblitter_e = 6; -#[doc = " four vertical levels █▆▄▂"] -pub const ncblitter_e_NCBLIT_4x1: ncblitter_e = 7; -#[doc = " eight vertical levels █▇▆▅▄▃▂▁"] -pub const ncblitter_e_NCBLIT_8x1: ncblitter_e = 8; -#[doc = " we never blit full blocks, but instead spaces (more efficient) with the"] -#[doc = " background set to the desired foreground."] -pub type ncblitter_e = cty::c_uint; -pub const ncalign_e_NCALIGN_UNALIGNED: ncalign_e = 0; -pub const ncalign_e_NCALIGN_LEFT: ncalign_e = 1; -pub const ncalign_e_NCALIGN_CENTER: ncalign_e = 2; -pub const ncalign_e_NCALIGN_RIGHT: ncalign_e = 3; -#[doc = " Alignment within a plane or terminal. Left/right-justified, or centered."] -pub type ncalign_e = cty::c_uint; -pub const ncscale_e_NCSCALE_NONE: ncscale_e = 0; -pub const ncscale_e_NCSCALE_SCALE: ncscale_e = 1; -pub const ncscale_e_NCSCALE_STRETCH: ncscale_e = 2; -pub const ncscale_e_NCSCALE_NONE_HIRES: ncscale_e = 3; -pub const ncscale_e_NCSCALE_SCALE_HIRES: ncscale_e = 4; -pub const ncscale_e_NCSCALE_INFLATE: ncscale_e = 5; -#[doc = " How to scale an ncvisual during rendering. NCSCALE_NONE will apply no"] -#[doc = " scaling. NCSCALE_SCALE scales a visual to the plane's size, maintaining"] -#[doc = " aspect ratio. NCSCALE_INFLATE does the same, but without interpolation."] -#[doc = " NCSCALE_STRETCH stretches and scales the image in an attempt to fill the"] -#[doc = " entirety of the plane. NCSCALE_NONE_HIRES and NCSCALE_SCALE_HIRES behave"] -#[doc = " like their counterparts, but admit blitters which don't preserve aspect"] -#[doc = " ratio."] -pub type ncscale_e = cty::c_uint; -extern "C" { - #[doc = " Returns the number of columns occupied by a multibyte (UTF-8) string, or"] - #[doc = " -1 if a non-printable/illegal character is encountered."] - pub fn ncstrwidth(mbs: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " input functions like notcurses_getc() return ucs32-encoded char32_t. convert"] - #[doc = " a series of char32_t to utf8. result must be at least 4 bytes per input"] - #[doc = " char32_t (6 bytes per char32_t will future-proof against Unicode expansion)."] - #[doc = " the number of bytes used is returned, or -1 if passed illegal ucs32, or too"] - #[doc = " small of a buffer."] - pub fn notcurses_ucs32_to_utf8( - ucs32: *const char32_t, - ucs32count: cty::c_uint, - resultbuf: *mut cty::c_uchar, - buflen: size_t, - ) -> cty::c_int; -} -#[doc = " An nccell corresponds to a single character cell on some plane, which can be"] -#[doc = " occupied by a single grapheme cluster (some root spacing glyph, along with"] -#[doc = " possible combining characters, which might span multiple columns). At any"] -#[doc = " cell, we can have a theoretically arbitrarily long UTF-8 string, a foreground"] -#[doc = " color, a background color, and an attribute set. Valid grapheme cluster"] -#[doc = " contents include:"] -#[doc = ""] -#[doc = " * A NUL terminator,"] -#[doc = " * A single control character, followed by a NUL terminator,"] -#[doc = " * At most one spacing character, followed by zero or more nonspacing"] -#[doc = " characters, followed by a NUL terminator."] -#[doc = ""] -#[doc = " Multi-column characters can only have a single style/color throughout."] -#[doc = " Existence is suffering, and thus wcwidth() is not reliable. It's just"] -#[doc = " quoting whether or not the EGC contains a \"Wide Asian\" double-width"] -#[doc = " character. This is set for some things, like most emoji, and not set for"] -#[doc = " other things, like cuneiform. True display width is a *function of the"] -#[doc = " font and terminal*. Among the longest Unicode codepoints is"] -#[doc = ""] -#[doc = " U+FDFD ARABIC LIGATURE BISMILLAH AR-RAHMAN AR-RAHEEM ﷽"] -#[doc = ""] -#[doc = " wcwidth() rather optimistically claims this most exalted glyph to occupy"] -#[doc = " a single column. BiDi text is too complicated for me to even get into here."] -#[doc = " Be assured there are no easy answers; ours is indeed a disturbing Universe."] -#[doc = ""] -#[doc = " Each nccell occupies 16 static bytes (128 bits). The surface is thus ~1.6MB"] -#[doc = " for a (pretty large) 500x200 terminal. At 80x43, it's less than 64KB."] -#[doc = " Dynamic requirements (the egcpool) can add up to 16MB to an ncplane, but"] -#[doc = " such large pools are unlikely in common use."] -#[doc = ""] -#[doc = " We implement some small alpha compositing. Foreground and background both"] -#[doc = " have two bits of inverted alpha. The actual grapheme written to a cell is"] -#[doc = " the topmost non-zero grapheme. If its alpha is 00, its foreground color is"] -#[doc = " used unchanged. If its alpha is 10, its foreground color is derived entirely"] -#[doc = " from cells underneath it. Otherwise, the result will be a composite."] -#[doc = " Likewise for the background. If the bottom of a coordinate's zbuffer is"] -#[doc = " reached with a cumulative alpha of zero, the default is used. In this way,"] -#[doc = " a terminal configured with transparent background can be supported through"] -#[doc = " multiple occluding ncplanes. A foreground alpha of 11 requests high-contrast"] -#[doc = " text (relative to the computed background). A background alpha of 11 is"] -#[doc = " currently forbidden."] -#[doc = ""] -#[doc = " Default color takes precedence over palette or RGB, and cannot be used with"] -#[doc = " transparency. Indexed palette takes precedence over RGB. It cannot"] -#[doc = " meaningfully set transparency, but it can be mixed into a cascading color."] -#[doc = " RGB is used if neither default terminal colors nor palette indexing are in"] -#[doc = " play, and fully supports all transparency options."] -#[doc = ""] -#[doc = " This structure is exposed only so that most functions can be inlined. Do not"] -#[doc = " directly modify or access the fields of this structure; use the API."] -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct nccell { - #[doc = " 4B → 4B little endian EGC"] - pub gcluster: u32, - #[doc = " 1B → 5B (8 bits of zero)"] - pub gcluster_backstop: u8, - #[doc = " 1B → 6B (8 bits of EGC column width)"] - pub width: u8, - #[doc = " 2B → 8B (16 bits of NCSTYLE_* attributes)"] - pub stylemask: u16, - #[doc = " + 8B == 16B"] - pub channels: u64, -} -#[test] -fn bindgen_test_layout_nccell() { - assert_eq!( - ::core::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(nccell)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(nccell)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).gcluster as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(nccell), - "::", - stringify!(gcluster) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).gcluster_backstop as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(nccell), - "::", - stringify!(gcluster_backstop) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).width as *const _ as usize }, - 5usize, - concat!( - "Offset of field: ", - stringify!(nccell), - "::", - stringify!(width) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).stylemask as *const _ as usize }, - 6usize, - concat!( - "Offset of field: ", - stringify!(nccell), - "::", - stringify!(stylemask) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).channels as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(nccell), - "::", - stringify!(channels) - ) - ); -} -extern "C" { - #[doc = " Breaks the UTF-8 string in 'gcluster' down, setting up the nccell 'c'."] - #[doc = " Returns the number of bytes copied out of 'gcluster', or -1 on failure. The"] - #[doc = " styling of the cell is left untouched, but any resources are released."] - pub fn nccell_load(n: *mut ncplane, c: *mut nccell, gcluster: *const cty::c_char) - -> cty::c_int; -} -extern "C" { - #[doc = " Duplicate 'c' into 'targ'; both must be/will be bound to 'n'. Returns -1 on"] - #[doc = " failure, and 0 on success."] - pub fn nccell_duplicate(n: *mut ncplane, targ: *mut nccell, c: *const nccell) -> cty::c_int; -} -extern "C" { - #[doc = " Release resources held by the nccell 'c'."] - pub fn nccell_release(n: *mut ncplane, c: *mut nccell); -} -extern "C" { - #[doc = " return a pointer to the NUL-terminated EGC referenced by 'c'. this pointer"] - #[doc = " can be invalidated by any further operation on the plane 'n', so...watch out!"] - pub fn nccell_extended_gcluster(n: *const ncplane, c: *const nccell) -> *const cty::c_char; -} -extern "C" { - #[doc = " return the number of columns occupied by 'c'. returns -1 if passed a"] - #[doc = " sprixcell. see ncstrwidth() for an equivalent for multiple EGCs."] - pub fn nccell_width(n: *const ncplane, c: *const nccell) -> cty::c_int; -} -#[doc = " default. print nothing once fullscreen service begins"] -pub const ncloglevel_e_NCLOGLEVEL_SILENT: ncloglevel_e = 0; -#[doc = " print diagnostics immediately related to crashing"] -pub const ncloglevel_e_NCLOGLEVEL_PANIC: ncloglevel_e = 1; -#[doc = " we're hanging around, but we've had a horrible fault"] -pub const ncloglevel_e_NCLOGLEVEL_FATAL: ncloglevel_e = 2; -#[doc = " we can't keep doing this, but we can do other things"] -pub const ncloglevel_e_NCLOGLEVEL_ERROR: ncloglevel_e = 3; -#[doc = " you probably don't want what's happening to happen"] -pub const ncloglevel_e_NCLOGLEVEL_WARNING: ncloglevel_e = 4; -#[doc = " \"standard information\""] -pub const ncloglevel_e_NCLOGLEVEL_INFO: ncloglevel_e = 5; -#[doc = " \"detailed information\""] -pub const ncloglevel_e_NCLOGLEVEL_VERBOSE: ncloglevel_e = 6; -#[doc = " this is honestly a bit much"] -pub const ncloglevel_e_NCLOGLEVEL_DEBUG: ncloglevel_e = 7; -#[doc = " there's probably a better way to do what you want"] -pub const ncloglevel_e_NCLOGLEVEL_TRACE: ncloglevel_e = 8; -#[doc = " These log levels consciously map cleanly to those of libav; Notcurses itself"] -#[doc = " does not use this full granularity. The log level does not affect the opening"] -#[doc = " and closing banners, which can be disabled via the notcurses_option struct's"] -#[doc = " 'suppress_banner'. Note that if stderr is connected to the same terminal on"] -#[doc = " which we're rendering, any kind of logging will disrupt the output."] -pub type ncloglevel_e = cty::c_uint; -#[doc = " Configuration for notcurses_init()."] -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct notcurses_options { - #[doc = " The name of the terminfo database entry describing this terminal. If NULL,"] - #[doc = " the environment variable TERM is used. Failure to open the terminal"] - #[doc = " definition will result in failure to initialize notcurses."] - pub termtype: *const cty::c_char, - #[doc = " If non-NULL, notcurses_render() will write each rendered frame to this"] - #[doc = " FILE* in addition to outfp. This is used primarily for debugging."] - pub renderfp: *mut FILE, - #[doc = " Progressively higher log levels result in more logging to stderr. By"] - #[doc = " default, nothing is printed to stderr once fullscreen service begins."] - pub loglevel: ncloglevel_e, - #[doc = " Desirable margins. If all are 0 (default), we will render to the entirety"] - #[doc = " of the screen. If the screen is too small, we do what we can--this is"] - #[doc = " strictly best-effort. Absolute coordinates are relative to the rendering"] - #[doc = " area ((0, 0) is always the origin of the rendering area)."] - pub margin_t: cty::c_int, - #[doc = " Desirable margins. If all are 0 (default), we will render to the entirety"] - #[doc = " of the screen. If the screen is too small, we do what we can--this is"] - #[doc = " strictly best-effort. Absolute coordinates are relative to the rendering"] - #[doc = " area ((0, 0) is always the origin of the rendering area)."] - pub margin_r: cty::c_int, - #[doc = " Desirable margins. If all are 0 (default), we will render to the entirety"] - #[doc = " of the screen. If the screen is too small, we do what we can--this is"] - #[doc = " strictly best-effort. Absolute coordinates are relative to the rendering"] - #[doc = " area ((0, 0) is always the origin of the rendering area)."] - pub margin_b: cty::c_int, - #[doc = " Desirable margins. If all are 0 (default), we will render to the entirety"] - #[doc = " of the screen. If the screen is too small, we do what we can--this is"] - #[doc = " strictly best-effort. Absolute coordinates are relative to the rendering"] - #[doc = " area ((0, 0) is always the origin of the rendering area)."] - pub margin_l: cty::c_int, - #[doc = " General flags; see NCOPTION_*. This is expressed as a bitfield so that"] - #[doc = " future options can be added without reshaping the struct. Undefined bits"] - #[doc = " must be set to 0."] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_notcurses_options() { - assert_eq!( - ::core::mem::size_of::(), - 48usize, - concat!("Size of: ", stringify!(notcurses_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(notcurses_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).termtype as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(notcurses_options), - "::", - stringify!(termtype) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).renderfp as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(notcurses_options), - "::", - stringify!(renderfp) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).loglevel as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(notcurses_options), - "::", - stringify!(loglevel) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).margin_t as *const _ as usize }, - 20usize, - concat!( - "Offset of field: ", - stringify!(notcurses_options), - "::", - stringify!(margin_t) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).margin_r as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(notcurses_options), - "::", - stringify!(margin_r) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).margin_b as *const _ as usize }, - 28usize, - concat!( - "Offset of field: ", - stringify!(notcurses_options), - "::", - stringify!(margin_b) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).margin_l as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(notcurses_options), - "::", - stringify!(margin_l) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(notcurses_options), - "::", - stringify!(flags) - ) - ); -} -impl Default for notcurses_options { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -extern "C" { - #[doc = " Lex a margin argument according to the standard Notcurses definition. There"] - #[doc = " can be either a single number, which will define all margins equally, or"] - #[doc = " there can be four numbers separated by commas."] - pub fn notcurses_lex_margins( - op: *const cty::c_char, - opts: *mut notcurses_options, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Lex a blitter."] - pub fn notcurses_lex_blitter(op: *const cty::c_char, blitter: *mut ncblitter_e) -> cty::c_int; -} -extern "C" { - #[doc = " Get the name of a blitter."] - pub fn notcurses_str_blitter(blitter: ncblitter_e) -> *const cty::c_char; -} -extern "C" { - #[doc = " Lex a scaling mode (one of \"none\", \"stretch\", \"scale\", \"hires\","] - #[doc = " \"scalehi\", or \"inflate\")."] - pub fn notcurses_lex_scalemode(op: *const cty::c_char, scalemode: *mut ncscale_e) - -> cty::c_int; -} -extern "C" { - #[doc = " Get the name of a scaling mode."] - pub fn notcurses_str_scalemode(scalemode: ncscale_e) -> *const cty::c_char; -} -extern "C" { - #[doc = " Initialize a Notcurses context on the connected terminal at 'fp'. 'fp' must"] - #[doc = " be a tty. You'll usually want stdout. NULL can be supplied for 'fp', in"] - #[doc = " which case /dev/tty will be opened. Returns NULL on error, including any"] - #[doc = " failure initializing terminfo."] - pub fn notcurses_init(opts: *const notcurses_options, fp: *mut FILE) -> *mut notcurses; -} -extern "C" { - #[doc = " The same as notcurses_init(), but without any multimedia functionality,"] - #[doc = " allowing for a svelter binary. Link with notcurses-core if this is used."] - pub fn notcurses_core_init(opts: *const notcurses_options, fp: *mut FILE) -> *mut notcurses; -} -extern "C" { - #[doc = " Destroy a Notcurses context."] - pub fn notcurses_stop(nc: *mut notcurses) -> cty::c_int; -} -extern "C" { - #[doc = " Return the topmost plane of the pile containing 'n'."] - pub fn ncpile_top(n: *mut ncplane) -> *mut ncplane; -} -extern "C" { - #[doc = " Return the bottommost plane of the pile containing 'n'."] - pub fn ncpile_bottom(n: *mut ncplane) -> *mut ncplane; -} -extern "C" { - #[doc = " Renders the pile of which 'n' is a part. Rendering this pile again will blow"] - #[doc = " away the render. To actually write out the render, call ncpile_rasterize()."] - pub fn ncpile_render(n: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Make the physical screen match the last rendered frame from the pile of"] - #[doc = " which 'n' is a part. This is a blocking call. Don't call this before the"] - #[doc = " pile has been rendered (doing so will likely result in a blank screen)."] - pub fn ncpile_rasterize(n: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Renders and rasterizes the standard pile in one shot. Blocking call."] - pub fn notcurses_render(nc: *mut notcurses) -> cty::c_int; -} -extern "C" { - #[doc = " Perform the rendering and rasterization portion of notcurses_render(), but"] - #[doc = " do not write the resulting buffer out to the terminal. Using this function,"] - #[doc = " the user can control the writeout process, and render a second frame while"] - #[doc = " writing another. The returned buffer must be freed by the caller."] - pub fn notcurses_render_to_buffer( - nc: *mut notcurses, - buf: *mut *mut cty::c_char, - buflen: *mut size_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Write the last rendered frame, in its entirety, to 'fp'. If"] - #[doc = " notcurses_render() has not yet been called, nothing will be written."] - pub fn notcurses_render_to_file(nc: *mut notcurses, fp: *mut FILE) -> cty::c_int; -} -extern "C" { - #[doc = " Return the topmost ncplane of the standard pile."] - pub fn notcurses_top(n: *mut notcurses) -> *mut ncplane; -} -extern "C" { - #[doc = " Return the bottommost ncplane of the standard pile."] - pub fn notcurses_bottom(n: *mut notcurses) -> *mut ncplane; -} -extern "C" { - #[doc = " Destroy all ncplanes other than the stdplane."] - pub fn notcurses_drop_planes(nc: *mut notcurses); -} -#[doc = " An input event. Cell coordinates are currently defined only for mouse events."] -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncinput { - #[doc = " identifier. Unicode codepoint or synthesized NCKEY event"] - pub id: char32_t, - #[doc = " y cell coordinate of event, -1 for undefined"] - pub y: cty::c_int, - #[doc = " x cell coordinate of event, -1 for undefined"] - pub x: cty::c_int, - #[doc = " was alt held?"] - pub alt: bool, - #[doc = " was shift held?"] - pub shift: bool, - #[doc = " was ctrl held?"] - pub ctrl: bool, - #[doc = " input event number"] - pub seqnum: u64, -} -#[test] -fn bindgen_test_layout_ncinput() { - assert_eq!( - ::core::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(ncinput)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncinput)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).id as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncinput), - "::", - stringify!(id) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).y as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(ncinput), - "::", - stringify!(y) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).x as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncinput), - "::", - stringify!(x) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).alt as *const _ as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(ncinput), - "::", - stringify!(alt) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).shift as *const _ as usize }, - 13usize, - concat!( - "Offset of field: ", - stringify!(ncinput), - "::", - stringify!(shift) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).ctrl as *const _ as usize }, - 14usize, - concat!( - "Offset of field: ", - stringify!(ncinput), - "::", - stringify!(ctrl) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).seqnum as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncinput), - "::", - stringify!(seqnum) - ) - ); -} -extern "C" { - #[doc = " See ppoll(2) for more detail. Provide a NULL 'ts' to block at length, a 'ts'"] - #[doc = " of 0 for non-blocking operation, and otherwise a timespec to bound blocking."] - #[doc = " Signals in sigmask (less several we handle internally) will be atomically"] - #[doc = " masked and unmasked per ppoll(2). It should generally contain all signals."] - #[doc = " Returns a single Unicode code point, or (char32_t)-1 on error. 'sigmask' may"] - #[doc = " be NULL. Returns 0 on a timeout. If an event is processed, the return value"] - #[doc = " is the 'id' field from that event. 'ni' may be NULL."] - pub fn notcurses_getc( - n: *mut notcurses, - ts: *const timespec, - sigmask: *const sigset_t, - ni: *mut ncinput, - ) -> char32_t; -} -extern "C" { - #[doc = " Get a file descriptor suitable for input event poll()ing. When this"] - #[doc = " descriptor becomes available, you can call notcurses_getc_nblock(),"] - #[doc = " and input ought be ready. This file descriptor is *not* necessarily"] - #[doc = " the file descriptor associated with stdin (but it might be!)."] - pub fn notcurses_inputready_fd(n: *mut notcurses) -> cty::c_int; -} -extern "C" { - #[doc = " Enable the mouse in \"button-event tracking\" mode with focus detection and"] - #[doc = " UTF8-style extended coordinates. On failure, -1 is returned. On success, 0"] - #[doc = " is returned, and mouse events will be published to notcurses_getc()."] - pub fn notcurses_mouse_enable(n: *mut notcurses) -> cty::c_int; -} -extern "C" { - #[doc = " Disable mouse events. Any events in the input queue can still be delivered."] - pub fn notcurses_mouse_disable(n: *mut notcurses) -> cty::c_int; -} -extern "C" { - #[doc = " Disable signals originating from the terminal's line discipline, i.e."] - #[doc = " SIGINT (^C), SIGQUIT (^\\), and SIGTSTP (^Z). They are enabled by default."] - pub fn notcurses_linesigs_disable(n: *mut notcurses) -> cty::c_int; -} -extern "C" { - #[doc = " Restore signals originating from the terminal's line discipline, i.e."] - #[doc = " SIGINT (^C), SIGQUIT (^\\), and SIGTSTP (^Z), if disabled."] - pub fn notcurses_linesigs_enable(n: *mut notcurses) -> cty::c_int; -} -extern "C" { - #[doc = " Refresh the physical screen to match what was last rendered (i.e., without"] - #[doc = " reflecting any changes since the last call to notcurses_render()). This is"] - #[doc = " primarily useful if the screen is externally corrupted, or if an"] - #[doc = " NCKEY_RESIZE event has been read and you're not yet ready to render."] - pub fn notcurses_refresh( - n: *mut notcurses, - y: *mut cty::c_int, - x: *mut cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Extract the Notcurses context to which this plane is attached."] - pub fn ncplane_notcurses(n: *mut ncplane) -> *mut notcurses; -} -extern "C" { - pub fn ncplane_notcurses_const(n: *const ncplane) -> *const notcurses; -} -extern "C" { - #[doc = " Return the dimensions of this ncplane."] - pub fn ncplane_dim_yx(n: *const ncplane, y: *mut cty::c_int, x: *mut cty::c_int); -} -extern "C" { - #[doc = " Get a reference to the standard plane (one matching our current idea of the"] - #[doc = " terminal size) for this terminal. The standard plane always exists, and its"] - #[doc = " origin is always at the uppermost, leftmost cell of the terminal."] - pub fn notcurses_stdplane(nc: *mut notcurses) -> *mut ncplane; -} -extern "C" { - pub fn notcurses_stdplane_const(nc: *const notcurses) -> *const ncplane; -} -extern "C" { - #[doc = " Retrieve pixel geometry for the display region ('pxy', 'pxx'), each cell"] - #[doc = " ('celldimy', 'celldimx'), and the maximum displayable bitmap ('maxbmapy',"] - #[doc = " 'maxbmapx'). Note that this will call notcurses_check_pixel_support(),"] - #[doc = " possibly leading to an interrogation of the terminal. If bitmaps are not"] - #[doc = " supported, 'maxbmapy' and 'maxbmapx' will be 0. Any of the geometry"] - #[doc = " arguments may be NULL."] - pub fn ncplane_pixelgeom( - n: *mut ncplane, - pxy: *mut cty::c_int, - pxx: *mut cty::c_int, - celldimy: *mut cty::c_int, - celldimx: *mut cty::c_int, - maxbmapy: *mut cty::c_int, - maxbmapx: *mut cty::c_int, - ); -} -extern "C" { - #[doc = " Retrieve the contents of the specified cell as last rendered. Returns the EGC"] - #[doc = " or NULL on error. This EGC must be free()d by the caller. The stylemask and"] - #[doc = " channels are written to 'stylemask' and 'channels', respectively."] - pub fn notcurses_at_yx( - nc: *mut notcurses, - yoff: cty::c_int, - xoff: cty::c_int, - stylemask: *mut u16, - channels: *mut u64, - ) -> *mut cty::c_char; -} -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncplane_options { - #[doc = " vertical placement relative to parent plane"] - pub y: cty::c_int, - #[doc = " horizontal placement relative to parent plane"] - pub x: cty::c_int, - #[doc = " rows, must be positive (unless NCPLANE_OPTION_MARGINALIZED)"] - pub rows: cty::c_int, - #[doc = " columns, must be positive (unless NCPLANE_OPTION_MARGINALIZED)"] - pub cols: cty::c_int, - #[doc = " user curry, may be NULL"] - pub userptr: *mut cty::c_void, - #[doc = " name (used only for debugging), may be NULL"] - pub name: *const cty::c_char, - #[doc = " callback when parent is resized"] - pub resizecb: ::core::option::Option cty::c_int>, - #[doc = " closure over NCPLANE_OPTION_*"] - pub flags: u64, - #[doc = " margins (require NCPLANE_OPTION_MARGINALIZED)"] - pub margin_b: cty::c_int, - #[doc = " margins (require NCPLANE_OPTION_MARGINALIZED)"] - pub margin_r: cty::c_int, -} -#[test] -fn bindgen_test_layout_ncplane_options() { - assert_eq!( - ::core::mem::size_of::(), - 56usize, - concat!("Size of: ", stringify!(ncplane_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncplane_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).y as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(y) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).x as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(x) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).rows as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(rows) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).cols as *const _ as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(cols) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).userptr as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(userptr) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).name as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(name) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).resizecb as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(resizecb) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(flags) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).margin_b as *const _ as usize }, - 48usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(margin_b) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).margin_r as *const _ as usize }, - 52usize, - concat!( - "Offset of field: ", - stringify!(ncplane_options), - "::", - stringify!(margin_r) - ) - ); -} -impl Default for ncplane_options { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -extern "C" { - #[doc = " Create a new ncplane bound to plane 'n', at the offset 'y'x'x' (relative to"] - #[doc = " the origin of 'n') and the specified size. The number of 'rows' and 'cols'"] - #[doc = " must both be positive. This plane is initially at the top of the z-buffer,"] - #[doc = " as if ncplane_move_top() had been called on it. The void* 'userptr' can be"] - #[doc = " retrieved (and reset) later. A 'name' can be set, used in debugging."] - pub fn ncplane_create(n: *mut ncplane, nopts: *const ncplane_options) -> *mut ncplane; -} -extern "C" { - #[doc = " Same as ncplane_create(), but creates a new pile. The returned plane will"] - #[doc = " be the top, bottom, and root of this new pile."] - pub fn ncpile_create(nc: *mut notcurses, nopts: *const ncplane_options) -> *mut ncplane; -} -extern "C" { - #[doc = " Suitable for use as a 'resizecb', this will resize the plane to the visual"] - #[doc = " region's size. It is used for the standard plane."] - pub fn ncplane_resize_maximize(n: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Suitable for use as a 'resizecb' with planes created with"] - #[doc = " NCPLANE_OPTION_MARGINALIZED. This will resize the plane 'n' against its"] - #[doc = " parent, attempting to enforce the supplied margins."] - pub fn ncplane_resize_marginalized(n: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Suitable for use as a 'resizecb'. This will realign the plane 'n' against"] - #[doc = " its parent, using the alignment specified at ncplane_create()-time."] - pub fn ncplane_resize_realign(n: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Replace the ncplane's existing resizecb with 'resizecb' (which may be NULL)."] - #[doc = " The standard plane's resizecb may not be changed."] - pub fn ncplane_set_resizecb( - n: *mut ncplane, - resizecb: ::core::option::Option cty::c_int>, - ); -} -extern "C" { - #[doc = " Returns the ncplane's current resize callback."] - pub fn ncplane_resizecb( - n: *const ncplane, - ) -> ::core::option::Option cty::c_int>; -} -extern "C" { - #[doc = " Plane 'n' will be unbound from its parent plane, and will be made a bound"] - #[doc = " child of 'newparent'. It is an error if 'n' or 'newparent' are NULL. If"] - #[doc = " 'newparent' is equal to 'n', 'n' becomes the root of a new pile, unless 'n'"] - #[doc = " is already the root of a pile, in which case this is a no-op. Returns 'n'."] - #[doc = " The standard plane cannot be reparented. Any planes bound to 'n' are"] - #[doc = " reparented to the previous parent of 'n'."] - pub fn ncplane_reparent(n: *mut ncplane, newparent: *mut ncplane) -> *mut ncplane; -} -extern "C" { - #[doc = " The same as ncplane_reparent(), except any planes bound to 'n' come along"] - #[doc = " with it to its new destination. Their z-order is maintained. If 'newparent'"] - #[doc = " is an ancestor of 'n', NULL is returned, and no changes are made."] - pub fn ncplane_reparent_family(n: *mut ncplane, newparent: *mut ncplane) -> *mut ncplane; -} -extern "C" { - #[doc = " Duplicate an existing ncplane. The new plane will have the same geometry,"] - #[doc = " will duplicate all content, and will start with the same rendering state."] - #[doc = " The new plane will be immediately above the old one on the z axis, and will"] - #[doc = " be bound to the same parent. Bound planes are *not* duplicated; the new"] - #[doc = " plane is bound to the parent of 'n', but has no bound planes."] - pub fn ncplane_dup(n: *const ncplane, opaque: *mut cty::c_void) -> *mut ncplane; -} -extern "C" { - #[doc = " provided a coordinate relative to the origin of 'src', map it to the same"] - #[doc = " absolute coordinate relative to the origin of 'dst'. either or both of 'y'"] - #[doc = " and 'x' may be NULL. if 'dst' is NULL, it is taken to be the standard plane."] - pub fn ncplane_translate( - src: *const ncplane, - dst: *const ncplane, - y: *mut cty::c_int, - x: *mut cty::c_int, - ); -} -extern "C" { - #[doc = " Fed absolute 'y'/'x' coordinates, determine whether that coordinate is"] - #[doc = " within the ncplane 'n'. If not, return false. If so, return true. Either"] - #[doc = " way, translate the absolute coordinates relative to 'n'. If the point is not"] - #[doc = " within 'n', these coordinates will not be within the dimensions of the plane."] - pub fn ncplane_translate_abs(n: *const ncplane, y: *mut cty::c_int, x: *mut cty::c_int) - -> bool; -} -extern "C" { - #[doc = " All planes are created with scrolling disabled. Scrolling can be dynamically"] - #[doc = " controlled with ncplane_set_scrolling(). Returns true if scrolling was"] - #[doc = " previously enabled, or false if it was disabled."] - pub fn ncplane_set_scrolling(n: *mut ncplane, scrollp: bool) -> bool; -} -extern "C" { - #[doc = " Returns a 16-bit bitmask of supported curses-style attributes"] - #[doc = " (NCSTYLE_UNDERLINE, NCSTYLE_BOLD, etc.) The attribute is only"] - #[doc = " indicated as supported if the terminal can support it together with color."] - #[doc = " For more information, see the \"ncv\" capability in terminfo(5)."] - pub fn notcurses_supported_styles(nc: *const notcurses) -> cty::c_uint; -} -extern "C" { - #[doc = " Returns the number of simultaneous colors claimed to be supported, or 1 if"] - #[doc = " there is no color support. Note that several terminal emulators advertise"] - #[doc = " more colors than they actually support, downsampling internally."] - pub fn notcurses_palette_size(nc: *const notcurses) -> cty::c_uint; -} -extern "C" { - #[doc = " Can we directly specify RGB values per cell, or only use palettes?"] - pub fn notcurses_cantruecolor(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " Can we fade? Fading requires either the \"rgb\" or \"ccc\" terminfo capability."] - pub fn notcurses_canfade(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " Can we set the \"hardware\" palette? Requires the \"ccc\" terminfo capability."] - pub fn notcurses_canchangecolor(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " Can we load images? This requires being built against FFmpeg/OIIO."] - pub fn notcurses_canopen_images(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " Can we load videos? This requires being built against FFmpeg."] - pub fn notcurses_canopen_videos(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " Is our encoding UTF-8? Requires LANG being set to a UTF8 locale."] - pub fn notcurses_canutf8(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " Can we reliably use Unicode halfblocks?"] - pub fn notcurses_canhalfblock(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " Can we reliably use Unicode quadrants?"] - pub fn notcurses_canquadrant(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " Can we reliably use Unicode 13 sextants?"] - pub fn notcurses_cansextant(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " Can we reliably use Unicode Braille?"] - pub fn notcurses_canbraille(nc: *const notcurses) -> bool; -} -extern "C" { - #[doc = " This function must successfully return before NCBLIT_PIXEL is available."] - #[doc = " Returns -1 on error, 0 for no support, or 1 if pixel output is supported."] - #[doc = " Must not be called concurrently with either input or rasterization."] - pub fn notcurses_check_pixel_support(nc: *mut notcurses) -> cty::c_int; -} -#[doc = " whenever a new field is added here, ensure we add the proper rule to"] -#[doc = " notcurses_stats_reset(), so that values are preserved in the stash stats."] -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncstats { - #[doc = " successful ncpile_render() runs"] - pub renders: u64, - #[doc = " successful ncpile_rasterize() runs"] - pub writeouts: u64, - #[doc = " aborted renders, should be 0"] - pub failed_renders: u64, - #[doc = " aborted writes"] - pub failed_writeouts: u64, - #[doc = " bytes emitted to ttyfp"] - pub render_bytes: u64, - #[doc = " max bytes emitted for a frame"] - pub render_max_bytes: i64, - #[doc = " min bytes emitted for a frame"] - pub render_min_bytes: i64, - #[doc = " nanoseconds spent rendering"] - pub render_ns: u64, - #[doc = " max ns spent in render for a frame"] - pub render_max_ns: i64, - #[doc = " min ns spent in render for a frame"] - pub render_min_ns: i64, - #[doc = " nanoseconds spent writing frames to terminal"] - pub writeout_ns: u64, - #[doc = " max ns spent writing out a frame"] - pub writeout_max_ns: i64, - #[doc = " min ns spent writing out a frame"] - pub writeout_min_ns: i64, - #[doc = " cells we elided entirely thanks to damage maps"] - pub cellelisions: u64, - #[doc = " total number of cells emitted to terminal"] - pub cellemissions: u64, - #[doc = " RGB fg elision count"] - pub fgelisions: u64, - #[doc = " RGB fg emissions"] - pub fgemissions: u64, - #[doc = " RGB bg elision count"] - pub bgelisions: u64, - #[doc = " RGB bg emissions"] - pub bgemissions: u64, - #[doc = " default color was emitted"] - pub defaultelisions: u64, - #[doc = " default color was elided"] - pub defaultemissions: u64, - #[doc = " refresh requests (non-optimized redraw)"] - pub refreshes: u64, - #[doc = " total bytes devoted to all active framebuffers"] - pub fbbytes: u64, - #[doc = " number of planes currently in existence"] - pub planes: cty::c_uint, - #[doc = " nanoseconds spent rasterizing"] - pub raster_ns: u64, - #[doc = " max ns spent in raster for a frame"] - pub raster_max_ns: i64, - #[doc = " min ns spent in raster for a frame"] - pub raster_min_ns: i64, - #[doc = " sprixel draw count"] - pub sprixelemissions: u64, - #[doc = " sprixel elision count"] - pub sprixelelisions: u64, -} -#[test] -fn bindgen_test_layout_ncstats() { - assert_eq!( - ::core::mem::size_of::(), - 232usize, - concat!("Size of: ", stringify!(ncstats)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncstats)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).renders as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(renders) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).writeouts as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(writeouts) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).failed_renders as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(failed_renders) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).failed_writeouts as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(failed_writeouts) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).render_bytes as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(render_bytes) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).render_max_bytes as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(render_max_bytes) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).render_min_bytes as *const _ as usize }, - 48usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(render_min_bytes) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).render_ns as *const _ as usize }, - 56usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(render_ns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).render_max_ns as *const _ as usize }, - 64usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(render_max_ns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).render_min_ns as *const _ as usize }, - 72usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(render_min_ns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).writeout_ns as *const _ as usize }, - 80usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(writeout_ns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).writeout_max_ns as *const _ as usize }, - 88usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(writeout_max_ns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).writeout_min_ns as *const _ as usize }, - 96usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(writeout_min_ns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).cellelisions as *const _ as usize }, - 104usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(cellelisions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).cellemissions as *const _ as usize }, - 112usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(cellemissions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).fgelisions as *const _ as usize }, - 120usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(fgelisions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).fgemissions as *const _ as usize }, - 128usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(fgemissions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).bgelisions as *const _ as usize }, - 136usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(bgelisions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).bgemissions as *const _ as usize }, - 144usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(bgemissions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).defaultelisions as *const _ as usize }, - 152usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(defaultelisions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).defaultemissions as *const _ as usize }, - 160usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(defaultemissions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).refreshes as *const _ as usize }, - 168usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(refreshes) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).fbbytes as *const _ as usize }, - 176usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(fbbytes) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).planes as *const _ as usize }, - 184usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(planes) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).raster_ns as *const _ as usize }, - 192usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(raster_ns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).raster_max_ns as *const _ as usize }, - 200usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(raster_max_ns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).raster_min_ns as *const _ as usize }, - 208usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(raster_min_ns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sprixelemissions as *const _ as usize }, - 216usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(sprixelemissions) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sprixelelisions as *const _ as usize }, - 224usize, - concat!( - "Offset of field: ", - stringify!(ncstats), - "::", - stringify!(sprixelelisions) - ) - ); -} -extern "C" { - #[doc = " Allocate an ncstats object. Use this rather than allocating your own, since"] - #[doc = " future versions of Notcurses might enlarge this structure."] - pub fn notcurses_stats_alloc(nc: *const notcurses) -> *mut ncstats; -} -extern "C" { - #[doc = " Acquire an atomic snapshot of the Notcurses object's stats."] - pub fn notcurses_stats(nc: *mut notcurses, stats: *mut ncstats); -} -extern "C" { - #[doc = " Reset all cumulative stats (immediate ones, such as fbbytes, are not reset),"] - #[doc = " first copying them into |*stats| (if |stats| is not NULL)."] - pub fn notcurses_stats_reset(nc: *mut notcurses, stats: *mut ncstats); -} -extern "C" { - #[doc = " Resize the specified ncplane. The four parameters 'keepy', 'keepx',"] - #[doc = " 'keepleny', and 'keeplenx' define a subset of the ncplane to keep,"] - #[doc = " unchanged. This may be a section of size 0, though none of these four"] - #[doc = " parameters may be negative. 'keepx' and 'keepy' are relative to the ncplane."] - #[doc = " They must specify a coordinate within the ncplane's totality. 'yoff' and"] - #[doc = " 'xoff' are relative to 'keepy' and 'keepx', and place the upper-left corner"] - #[doc = " of the resized ncplane. Finally, 'ylen' and 'xlen' are the dimensions of the"] - #[doc = " ncplane after resizing. 'ylen' must be greater than or equal to 'keepleny',"] - #[doc = " and 'xlen' must be greater than or equal to 'keeplenx'. It is an error to"] - #[doc = " attempt to resize the standard plane. If either of 'keepleny' or 'keeplenx'"] - #[doc = " is non-zero, both must be non-zero."] - #[doc = ""] - #[doc = " Essentially, the kept material does not move. It serves to anchor the"] - #[doc = " resized plane. If there is no kept material, the plane can move freely."] - pub fn ncplane_resize( - n: *mut ncplane, - keepy: cty::c_int, - keepx: cty::c_int, - keepleny: cty::c_int, - keeplenx: cty::c_int, - yoff: cty::c_int, - xoff: cty::c_int, - ylen: cty::c_int, - xlen: cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Destroy the specified ncplane. None of its contents will be visible after"] - #[doc = " the next call to notcurses_render(). It is an error to attempt to destroy"] - #[doc = " the standard plane."] - pub fn ncplane_destroy(n: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Set the ncplane's base nccell to 'c'. The base cell is used for purposes of"] - #[doc = " rendering anywhere that the ncplane's gcluster is 0. Note that the base cell"] - #[doc = " is not affected by ncplane_erase(). 'c' must not be a secondary cell from a"] - #[doc = " multicolumn EGC."] - pub fn ncplane_set_base_cell(n: *mut ncplane, c: *const nccell) -> cty::c_int; -} -extern "C" { - #[doc = " Set the ncplane's base nccell. It will be used for purposes of rendering"] - #[doc = " anywhere that the ncplane's gcluster is 0. Note that the base cell is not"] - #[doc = " affected by ncplane_erase(). 'egc' must be an extended grapheme cluster."] - pub fn ncplane_set_base( - n: *mut ncplane, - egc: *const cty::c_char, - stylemask: u32, - channels: u64, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Extract the ncplane's base nccell into 'c'. The reference is invalidated if"] - #[doc = " 'ncp' is destroyed."] - pub fn ncplane_base(n: *mut ncplane, c: *mut nccell) -> cty::c_int; -} -extern "C" { - #[doc = " Move this plane relative to the standard plane, or the plane to which it is"] - #[doc = " bound (if it is bound to a plane). It is an error to attempt to move the"] - #[doc = " standard plane."] - pub fn ncplane_move_yx(n: *mut ncplane, y: cty::c_int, x: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Get the origin of plane 'n' relative to its bound plane, or pile (if 'n' is"] - #[doc = " a root plane). To get absolute coordinates, use ncplane_abs_yx()."] - pub fn ncplane_yx(n: *const ncplane, y: *mut cty::c_int, x: *mut cty::c_int); -} -extern "C" { - pub fn ncplane_y(n: *const ncplane) -> cty::c_int; -} -extern "C" { - pub fn ncplane_x(n: *const ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Get the origin of plane 'n' relative to its pile. Either or both of 'x' and"] - #[doc = " 'y' may be NULL."] - pub fn ncplane_abs_yx(n: *const ncplane, y: *mut cty::c_int, x: *mut cty::c_int); -} -extern "C" { - pub fn ncplane_abs_y(n: *const ncplane) -> cty::c_int; -} -extern "C" { - pub fn ncplane_abs_x(n: *const ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Get the plane to which the plane 'n' is bound, if any."] - pub fn ncplane_parent(n: *mut ncplane) -> *mut ncplane; -} -extern "C" { - pub fn ncplane_parent_const(n: *const ncplane) -> *const ncplane; -} -extern "C" { - #[doc = " Splice ncplane 'n' out of the z-buffer, and reinsert it at the top or bottom."] - pub fn ncplane_move_top(n: *mut ncplane); -} -extern "C" { - pub fn ncplane_move_bottom(n: *mut ncplane); -} -extern "C" { - #[doc = " Splice ncplane 'n' out of the z-buffer, and reinsert it above 'above'."] - #[doc = " Returns non-zero if 'n' is already in the desired location. 'n' and"] - #[doc = " 'above' must not be the same plane."] - pub fn ncplane_move_above(n: *mut ncplane, above: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Splice ncplane 'n' out of the z-buffer, and reinsert it below 'below'."] - #[doc = " Returns non-zero if 'n' is already in the desired location. 'n' and"] - #[doc = " 'below' must not be the same plane."] - pub fn ncplane_move_below(n: *mut ncplane, below: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Return the plane below this one, or NULL if this is at the bottom."] - pub fn ncplane_below(n: *mut ncplane) -> *mut ncplane; -} -extern "C" { - pub fn ncplane_above(n: *mut ncplane) -> *mut ncplane; -} -extern "C" { - #[doc = " Rotate the plane π/2 radians clockwise or counterclockwise. This cannot"] - #[doc = " be performed on arbitrary planes, because glyphs cannot be arbitrarily"] - #[doc = " rotated. The glyphs which can be rotated are limited: line-drawing"] - #[doc = " characters, spaces, half blocks, and full blocks. The plane must have"] - #[doc = " an even number of columns. Use the ncvisual rotation for a more"] - #[doc = " flexible approach."] - pub fn ncplane_rotate_cw(n: *mut ncplane) -> cty::c_int; -} -extern "C" { - pub fn ncplane_rotate_ccw(n: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Retrieve the current contents of the cell under the cursor. The EGC is"] - #[doc = " returned, or NULL on error. This EGC must be free()d by the caller. The"] - #[doc = " stylemask and channels are written to 'stylemask' and 'channels', respectively."] - pub fn ncplane_at_cursor( - n: *mut ncplane, - stylemask: *mut u16, - channels: *mut u64, - ) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Retrieve the current contents of the cell under the cursor into 'c'. This"] - #[doc = " cell is invalidated if the associated plane is destroyed. Returns the number"] - #[doc = " of bytes in the EGC, or -1 on error."] - pub fn ncplane_at_cursor_cell(n: *mut ncplane, c: *mut nccell) -> cty::c_int; -} -extern "C" { - #[doc = " Retrieve the current contents of the specified cell. The EGC is returned, or"] - #[doc = " NULL on error. This EGC must be free()d by the caller. The stylemask and"] - #[doc = " channels are written to 'stylemask' and 'channels', respectively. The return"] - #[doc = " represents how the cell will be used during rendering, and thus integrates"] - #[doc = " any base cell where appropriate. If called upon the secondary columns of a"] - #[doc = " wide glyph, the EGC will be returned (i.e. this function does not distinguish"] - #[doc = " between the primary and secondary columns of a wide glyph)."] - pub fn ncplane_at_yx( - n: *const ncplane, - y: cty::c_int, - x: cty::c_int, - stylemask: *mut u16, - channels: *mut u64, - ) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Retrieve the current contents of the specified cell into 'c'. This cell is"] - #[doc = " invalidated if the associated plane is destroyed. Returns the number of"] - #[doc = " bytes in the EGC, or -1 on error. Unlike ncplane_at_yx(), when called upon"] - #[doc = " the secondary columns of a wide glyph, the return can be distinguished from"] - #[doc = " the primary column (nccell_wide_right_p(c) will return true)."] - pub fn ncplane_at_yx_cell( - n: *mut ncplane, - y: cty::c_int, - x: cty::c_int, - c: *mut nccell, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Create a flat string from the EGCs of the selected region of the ncplane"] - #[doc = " 'n'. Start at the plane's 'begy'x'begx' coordinate (which must lie on the"] - #[doc = " plane), continuing for 'leny'x'lenx' cells. Either or both of 'leny' and"] - #[doc = " 'lenx' can be specified as -1 to go through the boundary of the plane."] - pub fn ncplane_contents( - n: *mut ncplane, - begy: cty::c_int, - begx: cty::c_int, - leny: cty::c_int, - lenx: cty::c_int, - ) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Manipulate the opaque user pointer associated with this plane."] - #[doc = " ncplane_set_userptr() returns the previous userptr after replacing"] - #[doc = " it with 'opaque'. the others simply return the userptr."] - pub fn ncplane_set_userptr(n: *mut ncplane, opaque: *mut cty::c_void) -> *mut cty::c_void; -} -extern "C" { - pub fn ncplane_userptr(n: *mut ncplane) -> *mut cty::c_void; -} -extern "C" { - pub fn ncplane_center_abs(n: *const ncplane, y: *mut cty::c_int, x: *mut cty::c_int); -} -extern "C" { - #[doc = " Move the cursor to the specified position (the cursor needn't be visible)."] - #[doc = " Returns -1 on error, including negative parameters, or ones exceeding the"] - #[doc = " plane's dimensions."] - pub fn ncplane_cursor_move_yx(n: *mut ncplane, y: cty::c_int, x: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Move the cursor to 0, 0. Can't fail."] - pub fn ncplane_home(n: *mut ncplane); -} -extern "C" { - #[doc = " Get the current position of the cursor within n. y and/or x may be NULL."] - pub fn ncplane_cursor_yx(n: *const ncplane, y: *mut cty::c_int, x: *mut cty::c_int); -} -extern "C" { - #[doc = " Get the current channels or attribute word for ncplane 'n'."] - pub fn ncplane_channels(n: *const ncplane) -> u64; -} -extern "C" { - #[doc = " Return the current styling for this ncplane."] - pub fn ncplane_styles(n: *const ncplane) -> u16; -} -extern "C" { - #[doc = " Replace the cell at the specified coordinates with the provided cell 'c',"] - #[doc = " and advance the cursor by the width of the cell (but not past the end of the"] - #[doc = " plane). On success, returns the number of columns the cursor was advanced."] - #[doc = " 'c' must already be associated with 'n'. On failure, -1 is returned."] - pub fn ncplane_putc_yx( - n: *mut ncplane, - y: cty::c_int, - x: cty::c_int, - c: *const nccell, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Replace the EGC underneath us, but retain the styling. The current styling"] - #[doc = " of the plane will not be changed."] - pub fn ncplane_putchar_stained(n: *mut ncplane, c: cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Replace the cell at the specified coordinates with the provided EGC, and"] - #[doc = " advance the cursor by the width of the cluster (but not past the end of the"] - #[doc = " plane). On success, returns the number of columns the cursor was advanced."] - #[doc = " On failure, -1 is returned. The number of bytes converted from gclust is"] - #[doc = " written to 'sbytes' if non-NULL."] - pub fn ncplane_putegc_yx( - n: *mut ncplane, - y: cty::c_int, - x: cty::c_int, - gclust: *const cty::c_char, - sbytes: *mut cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Replace the EGC underneath us, but retain the styling. The current styling"] - #[doc = " of the plane will not be changed."] - pub fn ncplane_putegc_stained( - n: *mut ncplane, - gclust: *const cty::c_char, - sbytes: *mut cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Replace the EGC underneath us, but retain the styling. The current styling"] - #[doc = " of the plane will not be changed."] - pub fn ncplane_putwegc_stained( - n: *mut ncplane, - gclust: *const wchar_t, - sbytes: *mut cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Write a series of EGCs to the current location, using the current style."] - #[doc = " They will be interpreted as a series of columns (according to the definition"] - #[doc = " of ncplane_putc()). Advances the cursor by some positive number of columns"] - #[doc = " (though not beyond the end of the plane); this number is returned on success."] - #[doc = " On error, a non-positive number is returned, indicating the number of columns"] - #[doc = " which were written before the error."] - pub fn ncplane_putstr_yx( - n: *mut ncplane, - y: cty::c_int, - x: cty::c_int, - gclusters: *const cty::c_char, - ) -> cty::c_int; -} -extern "C" { - pub fn ncplane_putstr_aligned( - n: *mut ncplane, - y: cty::c_int, - align: ncalign_e, - s: *const cty::c_char, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Replace a string's worth of glyphs at the current cursor location, but"] - #[doc = " retain the styling. The current styling of the plane will not be changed."] - pub fn ncplane_putstr_stained(n: *mut ncplane, s: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Write a series of EGCs to the current location, using the current style."] - #[doc = " They will be interpreted as a series of columns (according to the definition"] - #[doc = " of ncplane_putc()). Advances the cursor by some positive number of columns"] - #[doc = " (though not beyond the end of the plane); this number is returned on success."] - #[doc = " On error, a non-positive number is returned, indicating the number of columns"] - #[doc = " which were written before the error. No more than 's' bytes will be written."] - pub fn ncplane_putnstr_yx( - n: *mut ncplane, - y: cty::c_int, - x: cty::c_int, - s: size_t, - gclusters: *const cty::c_char, - ) -> cty::c_int; -} -extern "C" { - pub fn ncplane_putnstr_aligned( - n: *mut ncplane, - y: cty::c_int, - align: ncalign_e, - s: size_t, - gclustarr: *const cty::c_char, - ) -> cty::c_int; -} -extern "C" { - pub fn ncplane_putwstr_stained(n: *mut ncplane, gclustarr: *const wchar_t) -> cty::c_int; -} -extern "C" { - #[doc = " The ncplane equivalents of printf(3) and vprintf(3)."] - pub fn ncplane_vprintf_aligned( - n: *mut ncplane, - y: cty::c_int, - align: ncalign_e, - format: *const cty::c_char, - ap: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - pub fn ncplane_vprintf_yx( - n: *mut ncplane, - y: cty::c_int, - x: cty::c_int, - format: *const cty::c_char, - ap: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - pub fn ncplane_vprintf_stained( - n: *mut ncplane, - format: *const cty::c_char, - ap: *mut __va_list_tag, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Write the specified text to the plane, breaking lines sensibly, beginning at"] - #[doc = " the specified line. Returns the number of columns written. When breaking a"] - #[doc = " line, the line will be cleared to the end of the plane (the last line will"] - #[doc = " *not* be so cleared). The number of bytes written from the input is written"] - #[doc = " to '*bytes' if it is not NULL. Cleared columns are included in the return"] - #[doc = " value, but *not* included in the number of bytes written. Leaves the cursor"] - #[doc = " at the end of output. A partial write will be accomplished as far as it can;"] - #[doc = " determine whether the write completed by inspecting '*bytes'. Can output to"] - #[doc = " multiple rows even in the absence of scrolling, but not more rows than are"] - #[doc = " available. With scrolling enabled, arbitrary amounts of data can be emitted."] - #[doc = " All provided whitespace is preserved -- ncplane_puttext() followed by an"] - #[doc = " appropriate ncplane_contents() will read back the original output."] - #[doc = ""] - #[doc = " If 'y' is -1, the first row of output is taken relative to the current"] - #[doc = " cursor: it will be left-, right-, or center-aligned in whatever remains"] - #[doc = " of the row. On subsequent rows -- or if 'y' is not -1 -- the entire row can"] - #[doc = " be used, and alignment works normally."] - #[doc = ""] - #[doc = " A newline at any point will move the cursor to the next row."] - pub fn ncplane_puttext( - n: *mut ncplane, - y: cty::c_int, - align: ncalign_e, - text: *const cty::c_char, - bytes: *mut size_t, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Draw horizontal or vertical lines using the specified cell, starting at the"] - #[doc = " current cursor position. The cursor will end at the cell following the last"] - #[doc = " cell output (even, perhaps counter-intuitively, when drawing vertical"] - #[doc = " lines), just as if ncplane_putc() was called at that spot. Return the"] - #[doc = " number of cells drawn on success. On error, return the negative number of"] - #[doc = " cells drawn."] - pub fn ncplane_hline_interp( - n: *mut ncplane, - c: *const nccell, - len: cty::c_int, - c1: u64, - c2: u64, - ) -> cty::c_int; -} -extern "C" { - pub fn ncplane_vline_interp( - n: *mut ncplane, - c: *const nccell, - len: cty::c_int, - c1: u64, - c2: u64, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Draw a box with its upper-left corner at the current cursor position, and its"] - #[doc = " lower-right corner at 'ystop'x'xstop'. The 6 cells provided are used to draw the"] - #[doc = " upper-left, ur, ll, and lr corners, then the horizontal and vertical lines."] - #[doc = " 'ctlword' is defined in the least significant byte, where bits [7, 4] are a"] - #[doc = " gradient mask, and [3, 0] are a border mask:"] - #[doc = " * 7, 3: top"] - #[doc = " * 6, 2: right"] - #[doc = " * 5, 1: bottom"] - #[doc = " * 4, 0: left"] - #[doc = " If the gradient bit is not set, the styling from the hl/vl cells is used for"] - #[doc = " the horizontal and vertical lines, respectively. If the gradient bit is set,"] - #[doc = " the color is linearly interpolated between the two relevant corner cells."] - #[doc = ""] - #[doc = " By default, vertexes are drawn whether their connecting edges are drawn or"] - #[doc = " not. The value of the bits corresponding to NCBOXCORNER_MASK control this,"] - #[doc = " and are interpreted as the number of connecting edges necessary to draw a"] - #[doc = " given corner. At 0 (the default), corners are always drawn. At 3, corners"] - #[doc = " are never drawn (since at most 2 edges can touch a box's corner)."] - pub fn ncplane_box( - n: *mut ncplane, - ul: *const nccell, - ur: *const nccell, - ll: *const nccell, - lr: *const nccell, - hline: *const nccell, - vline: *const nccell, - ystop: cty::c_int, - xstop: cty::c_int, - ctlword: cty::c_uint, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Starting at the specified coordinate, if its glyph is different from that of"] - #[doc = " 'c', 'c' is copied into it, and the original glyph is considered the fill"] - #[doc = " target. We do the same to all cardinally-connected cells having this same"] - #[doc = " fill target. Returns the number of cells polyfilled. An invalid initial y, x"] - #[doc = " is an error. Returns the number of cells filled, or -1 on error."] - pub fn ncplane_polyfill_yx( - n: *mut ncplane, - y: cty::c_int, - x: cty::c_int, - c: *const nccell, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Draw a gradient with its upper-left corner at the current cursor position,"] - #[doc = " stopping at 'ystop'x'xstop'. The glyph composed of 'egc' and 'stylemask' is"] - #[doc = " used for all cells. The channels specified by 'ul', 'ur', 'll', and 'lr'"] - #[doc = " are composed into foreground and background gradients. To do a vertical"] - #[doc = " gradient, 'ul' ought equal 'ur' and 'll' ought equal 'lr'. To do a"] - #[doc = " horizontal gradient, 'ul' ought equal 'll' and 'ur' ought equal 'ul'. To"] - #[doc = " color everything the same, all four channels should be equivalent. The"] - #[doc = " resulting alpha values are equal to incoming alpha values. Returns the"] - #[doc = " number of cells filled on success, or -1 on failure."] - #[doc = ""] - #[doc = " Palette-indexed color is not supported."] - #[doc = ""] - #[doc = " Preconditions for gradient operations (error otherwise):"] - #[doc = ""] - #[doc = " all: only RGB colors, unless all four channels match as default"] - #[doc = " all: all alpha values must be the same"] - #[doc = " 1x1: all four colors must be the same"] - #[doc = " 1xN: both top and both bottom colors must be the same (vertical gradient)"] - #[doc = " Nx1: both left and both right colors must be the same (horizontal gradient)"] - pub fn ncplane_gradient( - n: *mut ncplane, - egc: *const cty::c_char, - stylemask: u32, - ul: u64, - ur: u64, - ll: u64, - lr: u64, - ystop: cty::c_int, - xstop: cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Do a high-resolution gradient using upper blocks and synced backgrounds."] - #[doc = " This doubles the number of vertical gradations, but restricts you to"] - #[doc = " half blocks (appearing to be full blocks). Returns the number of cells"] - #[doc = " filled on success, or -1 on error."] - pub fn ncplane_highgradient( - n: *mut ncplane, - ul: u32, - ur: u32, - ll: u32, - lr: u32, - ystop: cty::c_int, - xstop: cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " ncplane_gradent_sized() meets ncplane_highgradient()."] - pub fn ncplane_highgradient_sized( - n: *mut ncplane, - ul: u32, - ur: u32, - ll: u32, - lr: u32, - ylen: cty::c_int, - xlen: cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Set the given style throughout the specified region, keeping content and"] - #[doc = " channels unchanged. Returns the number of cells set, or -1 on failure."] - pub fn ncplane_format( - n: *mut ncplane, - ystop: cty::c_int, - xstop: cty::c_int, - stylemask: u32, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Set the given channels throughout the specified region, keeping content and"] - #[doc = " attributes unchanged. Returns the number of cells set, or -1 on failure."] - pub fn ncplane_stain( - n: *mut ncplane, - ystop: cty::c_int, - xstop: cty::c_int, - ul: u64, - ur: u64, - ll: u64, - lr: u64, - ) -> cty::c_int; -} -extern "C" { - #[doc = " If 'src' does not intersect with 'dst', 'dst' will not be changed, but it is"] - #[doc = " not an error. If 'dst' is NULL, the operation will target the standard plane."] - pub fn ncplane_mergedown_simple(src: *mut ncplane, dst: *mut ncplane) -> cty::c_int; -} -extern "C" { - #[doc = " Merge the ncplane 'src' down onto the ncplane 'dst'. This is most rigorously"] - #[doc = " defined as \"write to 'dst' the frame that would be rendered were the entire"] - #[doc = " stack made up only of the specified subregion of 'src' and, below it, the"] - #[doc = " subregion of 'dst' having the specified origin. Merging is independent of"] - #[doc = " the position of 'src' viz 'dst' on the z-axis. It is an error to define a"] - #[doc = " subregion of zero area, or that is not entirely contained within 'src'. It"] - #[doc = " is an error to define a target origin such that the projected subregion is"] - #[doc = " not entirely contained within 'dst'. Behavior is undefined if 'src' and"] - #[doc = " 'dst' are equivalent. 'dst' is modified, but 'src' remains unchanged."] - #[doc = " neither 'src' nor 'dst' may have sprixels."] - pub fn ncplane_mergedown( - src: *mut ncplane, - dst: *mut ncplane, - begsrcy: cty::c_int, - begsrcx: cty::c_int, - leny: cty::c_int, - lenx: cty::c_int, - dsty: cty::c_int, - dstx: cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Erase every cell in the ncplane (each cell is initialized to the null glyph"] - #[doc = " and the default channels/styles). All cells associated with this ncplane are"] - #[doc = " invalidated, and must not be used after the call, *excluding* the base cell."] - #[doc = " The cursor is homed. The plane's active attributes are unaffected."] - pub fn ncplane_erase(n: *mut ncplane); -} -extern "C" { - #[doc = " Erase every cell in the region starting at {ystart, xstart} and having size"] - #[doc = " {ylen, xlen}. It is an error if any of ystart, xstart, ylen, or xlen is"] - #[doc = " negative. A value of 0 may be provided for ylen and/or xlen, meaning to"] - #[doc = " erase everything along that dimension. It is an error if ystart + ylen"] - #[doc = " or xstart + xlen is not in the plane."] - pub fn ncplane_erase_region( - n: *mut ncplane, - ystart: cty::c_int, - xstart: cty::c_int, - ylen: cty::c_int, - xlen: cty::c_int, - ) -> cty::c_int; -} -extern "C" { - pub fn ncplane_set_channels(n: *mut ncplane, channels: u64); -} -extern "C" { - #[doc = " Set the specified style bits for the ncplane 'n', whether they're actively"] - #[doc = " supported or not."] - pub fn ncplane_set_styles(n: *mut ncplane, stylebits: cty::c_uint); -} -extern "C" { - #[doc = " Add the specified styles to the ncplane's existing spec."] - pub fn ncplane_on_styles(n: *mut ncplane, stylebits: cty::c_uint); -} -extern "C" { - #[doc = " Remove the specified styles from the ncplane's existing spec."] - pub fn ncplane_off_styles(n: *mut ncplane, stylebits: cty::c_uint); -} -extern "C" { - #[doc = " Set an entire 32-bit channel of the plane"] - pub fn ncplane_set_fchannel(n: *mut ncplane, channel: u32) -> u64; -} -extern "C" { - pub fn ncplane_set_bchannel(n: *mut ncplane, channel: u32) -> u64; -} -extern "C" { - #[doc = " Set the current fore/background color using RGB specifications. If the"] - #[doc = " terminal does not support directly-specified 3x8b cells (24-bit \"TrueColor\","] - #[doc = " indicated by the \"RGB\" terminfo capability), the provided values will be"] - #[doc = " interpreted in some lossy fashion. None of r, g, or b may exceed 255."] - #[doc = " \"HP-like\" terminals require setting foreground and background at the same"] - #[doc = " time using \"color pairs\"; Notcurses will manage color pairs transparently."] - pub fn ncplane_set_fg_rgb8( - n: *mut ncplane, - r: cty::c_int, - g: cty::c_int, - b: cty::c_int, - ) -> cty::c_int; -} -extern "C" { - pub fn ncplane_set_bg_rgb8( - n: *mut ncplane, - r: cty::c_int, - g: cty::c_int, - b: cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Same, but clipped to [0..255]."] - pub fn ncplane_set_bg_rgb8_clipped( - n: *mut ncplane, - r: cty::c_int, - g: cty::c_int, - b: cty::c_int, - ); -} -extern "C" { - pub fn ncplane_set_fg_rgb8_clipped( - n: *mut ncplane, - r: cty::c_int, - g: cty::c_int, - b: cty::c_int, - ); -} -extern "C" { - #[doc = " Same, but with rgb assembled into a channel (i.e. lower 24 bits)."] - pub fn ncplane_set_fg_rgb(n: *mut ncplane, channel: u32) -> cty::c_int; -} -extern "C" { - pub fn ncplane_set_bg_rgb(n: *mut ncplane, channel: u32) -> cty::c_int; -} -extern "C" { - #[doc = " Use the default color for the foreground/background."] - pub fn ncplane_set_fg_default(n: *mut ncplane); -} -extern "C" { - pub fn ncplane_set_bg_default(n: *mut ncplane); -} -extern "C" { - #[doc = " Set the ncplane's foreground palette index, set the foreground palette index"] - #[doc = " bit, set it foreground-opaque, and clear the foreground default color bit."] - pub fn ncplane_set_fg_palindex(n: *mut ncplane, idx: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn ncplane_set_bg_palindex(n: *mut ncplane, idx: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Set the alpha parameters for ncplane 'n'."] - pub fn ncplane_set_fg_alpha(n: *mut ncplane, alpha: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn ncplane_set_bg_alpha(n: *mut ncplane, alpha: cty::c_int) -> cty::c_int; -} -#[doc = " Called for each fade iteration on 'ncp'. If anything but 0 is returned,"] -#[doc = " the fading operation ceases immediately, and that value is propagated out."] -#[doc = " The recommended absolute display time target is passed in 'tspec'."] -pub type fadecb = ::core::option::Option< - unsafe extern "C" fn( - nc: *mut notcurses, - n: *mut ncplane, - arg1: *const timespec, - curry: *mut cty::c_void, - ) -> cty::c_int, ->; -extern "C" { - #[doc = " Fade the ncplane out over the provided time, calling 'fader' at each"] - #[doc = " iteration. Requires a terminal which supports truecolor, or at least palette"] - #[doc = " modification (if the terminal uses a palette, our ability to fade planes is"] - #[doc = " limited, and affected by the complexity of the rest of the screen)."] - pub fn ncplane_fadeout( - n: *mut ncplane, - ts: *const timespec, - fader: fadecb, - curry: *mut cty::c_void, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Fade the ncplane in over the specified time. Load the ncplane with the"] - #[doc = " target cells without rendering, then call this function. When it's done, the"] - #[doc = " ncplane will have reached the target levels, starting from zeroes."] - pub fn ncplane_fadein( - n: *mut ncplane, - ts: *const timespec, - fader: fadecb, - curry: *mut cty::c_void, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Rather than the simple ncplane_fade{in/out}(), ncfadectx_setup() can be"] - #[doc = " paired with a loop over ncplane_fade{in/out}_iteration() + ncfadectx_free()."] - pub fn ncfadectx_setup(n: *mut ncplane) -> *mut ncfadectx; -} -extern "C" { - #[doc = " Return the number of iterations through which 'nctx' will fade."] - pub fn ncfadectx_iterations(nctx: *const ncfadectx) -> cty::c_int; -} -extern "C" { - #[doc = " Fade out through 'iter' iterations, where"] - #[doc = " 'iter' < 'ncfadectx_iterations(nctx)'."] - pub fn ncplane_fadeout_iteration( - n: *mut ncplane, - nctx: *mut ncfadectx, - iter: cty::c_int, - fader: fadecb, - curry: *mut cty::c_void, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Fade in through 'iter' iterations, where"] - #[doc = " 'iter' < 'ncfadectx_iterations(nctx)'."] - pub fn ncplane_fadein_iteration( - n: *mut ncplane, - nctx: *mut ncfadectx, - iter: cty::c_int, - fader: fadecb, - curry: *mut cty::c_void, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Pulse the plane in and out until the callback returns non-zero, relying on"] - #[doc = " the callback 'fader' to initiate rendering. 'ts' defines the half-period"] - #[doc = " (i.e. the transition from black to full brightness, or back again). Proper"] - #[doc = " use involves preparing (but not rendering) an ncplane, then calling"] - #[doc = " ncplane_pulse(), which will fade in from black to the specified colors."] - pub fn ncplane_pulse( - n: *mut ncplane, - ts: *const timespec, - fader: fadecb, - curry: *mut cty::c_void, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Release the resources associated with 'nctx'."] - pub fn ncfadectx_free(nctx: *mut ncfadectx); -} -extern "C" { - pub fn nccells_rounded_box( - n: *mut ncplane, - styles: u32, - channels: u64, - ul: *mut nccell, - ur: *mut nccell, - ll: *mut nccell, - lr: *mut nccell, - hl: *mut nccell, - vl: *mut nccell, - ) -> cty::c_int; -} -extern "C" { - pub fn nccells_double_box( - n: *mut ncplane, - styles: u32, - channels: u64, - ul: *mut nccell, - ur: *mut nccell, - ll: *mut nccell, - lr: *mut nccell, - hl: *mut nccell, - vl: *mut nccell, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Open a visual at 'file', extract a codec and parameters, decode the first"] - #[doc = " image to memory."] - pub fn ncvisual_from_file(file: *const cty::c_char) -> *mut ncvisual; -} -extern "C" { - #[doc = " Prepare an ncvisual, and its underlying plane, based off RGBA content in"] - #[doc = " memory at 'rgba'. 'rgba' is laid out as 'rows' lines, each of which is"] - #[doc = " 'rowstride' bytes in length. Each line has 'cols' 32-bit 8bpc RGBA pixels"] - #[doc = " followed by possible padding (there will be 'rowstride' - 'cols' * 4 bytes"] - #[doc = " of padding). The total size of 'rgba' is thus (rows * rowstride) bytes, of"] - #[doc = " which (rows * cols * 4) bytes are actual non-padding data."] - pub fn ncvisual_from_rgba( - rgba: *const cty::c_void, - rows: cty::c_int, - rowstride: cty::c_int, - cols: cty::c_int, - ) -> *mut ncvisual; -} -extern "C" { - #[doc = " ncvisual_from_rgba(), but 'bgra' is arranged as BGRA."] - pub fn ncvisual_from_bgra( - bgra: *const cty::c_void, - rows: cty::c_int, - rowstride: cty::c_int, - cols: cty::c_int, - ) -> *mut ncvisual; -} -extern "C" { - #[doc = " Promote an ncplane 'n' to an ncvisual. The plane may contain only spaces,"] - #[doc = " half blocks, and full blocks. The latter will be checked, and any other"] - #[doc = " glyph will result in a NULL being returned. This function exists so that"] - #[doc = " planes can be subjected to ncvisual transformations. If possible, it's"] - #[doc = " better to create the ncvisual from memory using ncvisual_from_rgba()."] - pub fn ncvisual_from_plane( - n: *const ncplane, - blit: ncblitter_e, - begy: cty::c_int, - begx: cty::c_int, - leny: cty::c_int, - lenx: cty::c_int, - ) -> *mut ncvisual; -} -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncvisual_options { - #[doc = " if no ncplane is provided, one will be created using the exact size"] - #[doc = " necessary to render the source with perfect fidelity (this might be"] - #[doc = " smaller or larger than the rendering area). if NCVISUAL_OPTION_CHILDPLANE"] - #[doc = " is provided, this must be non-NULL, and will be interpreted as the parent."] - pub n: *mut ncplane, - #[doc = " the scaling is ignored if no ncplane is provided (it ought be NCSCALE_NONE"] - #[doc = " in this case). otherwise, the source is stretched/scaled relative to the"] - #[doc = " provided ncplane."] - pub scaling: ncscale_e, - #[doc = " if an ncplane is provided, y and x specify where the visual will be"] - #[doc = " rendered on that plane. otherwise, they specify where the created ncplane"] - #[doc = " will be placed relative to the standard plane's origin. x is an ncalign_e"] - #[doc = " value if NCVISUAL_OPTION_HORALIGNED is provided. y is an ncalign_e if"] - #[doc = " NCVISUAL_OPTION_VERALIGNED is provided."] - pub y: cty::c_int, - #[doc = " if an ncplane is provided, y and x specify where the visual will be"] - #[doc = " rendered on that plane. otherwise, they specify where the created ncplane"] - #[doc = " will be placed relative to the standard plane's origin. x is an ncalign_e"] - #[doc = " value if NCVISUAL_OPTION_HORALIGNED is provided. y is an ncalign_e if"] - #[doc = " NCVISUAL_OPTION_VERALIGNED is provided."] - pub x: cty::c_int, - #[doc = " origin of rendered section"] - pub begy: cty::c_int, - #[doc = " origin of rendered section"] - pub begx: cty::c_int, - #[doc = " size of rendered section"] - pub leny: cty::c_int, - #[doc = " size of rendered section"] - pub lenx: cty::c_int, - #[doc = " glyph set to use (maps input to output cells)"] - pub blitter: ncblitter_e, - #[doc = " bitmask over NCVISUAL_OPTION_*"] - pub flags: u64, - #[doc = " treat this color as transparent under NCVISUAL_OPTION_ADDALPHA"] - pub transcolor: u32, -} -#[test] -fn bindgen_test_layout_ncvisual_options() { - assert_eq!( - ::core::mem::size_of::(), - 56usize, - concat!("Size of: ", stringify!(ncvisual_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncvisual_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).n as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(n) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).scaling as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(scaling) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).y as *const _ as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(y) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).x as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(x) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).begy as *const _ as usize }, - 20usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(begy) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).begx as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(begx) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).leny as *const _ as usize }, - 28usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(leny) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).lenx as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(lenx) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).blitter as *const _ as usize }, - 36usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(blitter) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(flags) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).transcolor as *const _ as usize }, - 48usize, - concat!( - "Offset of field: ", - stringify!(ncvisual_options), - "::", - stringify!(transcolor) - ) - ); -} -impl Default for ncvisual_options { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -extern "C" { - #[doc = " Create an RGBA flat array from the selected region of the ncplane 'nc'."] - #[doc = " Start at the plane's 'begy'x'begx' coordinate (which must lie on the"] - #[doc = " plane), continuing for 'leny'x'lenx' cells. Either or both of 'leny' and"] - #[doc = " 'lenx' can be specified as -1 to go through the boundary of the plane."] - #[doc = " Only glyphs from the specified ncblitset may be present. If 'pxdimy' and/or"] - #[doc = " 'pxdimx' are non-NULL, they will be filled in with the pixel geometry."] - pub fn ncplane_as_rgba( - n: *const ncplane, - blit: ncblitter_e, - begy: cty::c_int, - begx: cty::c_int, - leny: cty::c_int, - lenx: cty::c_int, - pxdimy: *mut cty::c_int, - pxdimx: *mut cty::c_int, - ) -> *mut u32; -} -extern "C" { - #[doc = " Get the size and ratio of ncvisual pixels to output cells along the y"] - #[doc = " and x axes. The input size (in pixels) will be written to 'y' and 'x'."] - #[doc = " The scaling will be written to 'scaley' and 'scalex'. With these:"] - #[doc = " rows = (y / scaley) + !!(y % scaley) or (y + scaley - 1) / scaley"] - #[doc = " cols = (x / scalex) + !!(x % scalex) or (x + scalex - 1) / scalex"] - #[doc = " Returns non-zero for an invalid 'vopts'. The blitter that will be used"] - #[doc = " is returned in '*blitter'."] - pub fn ncvisual_blitter_geom( - nc: *const notcurses, - n: *const ncvisual, - vopts: *const ncvisual_options, - y: *mut cty::c_int, - x: *mut cty::c_int, - scaley: *mut cty::c_int, - scalex: *mut cty::c_int, - blitter: *mut ncblitter_e, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Destroy an ncvisual. Rendered elements will not be disrupted, but the visual"] - #[doc = " can be neither decoded nor rendered any further."] - pub fn ncvisual_destroy(ncv: *mut ncvisual); -} -extern "C" { - #[doc = " extract the next frame from an ncvisual. returns 1 on end of file, 0 on"] - #[doc = " success, and -1 on failure."] - pub fn ncvisual_decode(nc: *mut ncvisual) -> cty::c_int; -} -extern "C" { - #[doc = " decode the next frame ala ncvisual_decode(), but if we have reached the end,"] - #[doc = " rewind to the first frame of the ncvisual. a subsequent 'ncvisual_render()'"] - #[doc = " will render the first frame, as if the ncvisual had been closed and reopened."] - #[doc = " the return values remain the same as those of ncvisual_decode()."] - pub fn ncvisual_decode_loop(nc: *mut ncvisual) -> cty::c_int; -} -extern "C" { - #[doc = " Rotate the visual 'rads' radians. Only M_PI/2 and -M_PI/2 are"] - #[doc = " supported at the moment, but this will change FIXME."] - pub fn ncvisual_rotate(n: *mut ncvisual, rads: f64) -> cty::c_int; -} -extern "C" { - #[doc = " Scale the visual to 'rows' X 'columns' pixels, using the best scheme"] - #[doc = " available. This is a lossy transformation, unless the size is unchanged."] - pub fn ncvisual_resize(n: *mut ncvisual, rows: cty::c_int, cols: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Inflate each pixel in the image to 'scale'x'scale' pixels. It is an error"] - #[doc = " if 'scale' is less than 1. The original color is retained."] - pub fn ncvisual_inflate(n: *mut ncvisual, scale: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Polyfill at the specified location within the ncvisual 'n', using 'rgba'."] - pub fn ncvisual_polyfill_yx( - n: *mut ncvisual, - y: cty::c_int, - x: cty::c_int, - rgba: u32, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Get the specified pixel from the specified ncvisual."] - pub fn ncvisual_at_yx( - n: *const ncvisual, - y: cty::c_int, - x: cty::c_int, - pixel: *mut u32, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Set the specified pixel in the specified ncvisual."] - pub fn ncvisual_set_yx( - n: *const ncvisual, - y: cty::c_int, - x: cty::c_int, - pixel: u32, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Render the decoded frame to the specified ncplane. If one is not provided,"] - #[doc = " one will be created, having the exact size necessary to display the visual."] - #[doc = " A subregion of the visual can be rendered using 'begx', 'begy', 'lenx', and"] - #[doc = " 'leny'. Negative values for 'begy' or 'begx' are an error. It is an error to"] - #[doc = " specify any region beyond the boundaries of the frame. Returns the"] - #[doc = " (possibly newly-created) plane to which we drew."] - pub fn ncvisual_render( - nc: *mut notcurses, - ncv: *mut ncvisual, - vopts: *const ncvisual_options, - ) -> *mut ncplane; -} -extern "C" { - #[doc = " If a subtitle ought be displayed at this time, return a heap-allocated copy"] - #[doc = " of the UTF8 text."] - pub fn ncvisual_subtitle(ncv: *const ncvisual) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Get the default *media* (not plot) blitter for this environment when using"] - #[doc = " the specified scaling method. Currently, this means:"] - #[doc = " - if lacking UTF-8, NCBLIT_1x1"] - #[doc = " - otherwise, if not NCSCALE_STRETCH, NCBLIT_2x1"] - #[doc = " - otherwise, if sextants are not known to be good, NCBLIT_2x2"] - #[doc = " - otherwise NCBLIT_3x2"] - #[doc = " NCBLIT_2x2 and NCBLIT_3x2 both distort the original aspect ratio, thus"] - #[doc = " NCBLIT_2x1 is used outside of NCSCALE_STRETCH."] - pub fn ncvisual_media_defblitter(nc: *const notcurses, scale: ncscale_e) -> ncblitter_e; -} -#[doc = " Called for each frame rendered from 'ncv'. If anything but 0 is returned,"] -#[doc = " the streaming operation ceases immediately, and that value is propagated out."] -#[doc = " The recommended absolute display time target is passed in 'tspec'."] -pub type ncstreamcb = ::core::option::Option< - unsafe extern "C" fn( - arg1: *mut ncvisual, - arg2: *mut ncvisual_options, - arg3: *const timespec, - arg4: *mut cty::c_void, - ) -> cty::c_int, ->; -extern "C" { - #[doc = " Shut up and display my frames! Provide as an argument to ncvisual_stream()."] - #[doc = " If you'd like subtitles to be decoded, provide an ncplane as the curry. If the"] - #[doc = " curry is NULL, subtitles will not be displayed."] - pub fn ncvisual_simple_streamer( - ncv: *mut ncvisual, - vopts: *mut ncvisual_options, - tspec: *const timespec, - curry: *mut cty::c_void, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Stream the entirety of the media, according to its own timing. Blocking,"] - #[doc = " obviously. streamer may be NULL; it is otherwise called for each frame, and"] - #[doc = " its return value handled as outlined for streamcb. If streamer() returns"] - #[doc = " non-zero, the stream is aborted, and that value is returned. By convention,"] - #[doc = " return a positive number to indicate intentional abort from within"] - #[doc = " streamer(). 'timescale' allows the frame duration time to be scaled. For a"] - #[doc = " visual naturally running at 30FPS, a 'timescale' of 0.1 will result in"] - #[doc = " 300FPS, and a 'timescale' of 10 will result in 3FPS. It is an error to"] - #[doc = " supply 'timescale' less than or equal to 0."] - pub fn ncvisual_stream( - nc: *mut notcurses, - ncv: *mut ncvisual, - timescale: f32, - streamer: ncstreamcb, - vopts: *const ncvisual_options, - curry: *mut cty::c_void, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Blit a flat array 'data' of RGBA 32-bit values to the ncplane 'vopts->n',"] - #[doc = " which mustn't be NULL. the blit begins at 'vopts->y' and 'vopts->x' relative"] - #[doc = " to the specified plane. Each source row ought occupy 'linesize' bytes (this"] - #[doc = " might be greater than 'vopts->lenx' * 4 due to padding or partial blits). A"] - #[doc = " subregion of the input can be specified with the 'begy'x'begx' and"] - #[doc = " 'leny'x'lenx' fields from 'vopts'. Returns the number of pixels blitted, or"] - #[doc = " -1 on error."] - pub fn ncblit_rgba( - data: *const cty::c_void, - linesize: cty::c_int, - vopts: *const ncvisual_options, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Same as ncblit_rgba(), but for BGRx."] - pub fn ncblit_bgrx( - data: *const cty::c_void, - linesize: cty::c_int, - vopts: *const ncvisual_options, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Supply an alpha value [0..255] to be applied throughout. linesize must be"] - #[doc = " a multiple of 3 for this RGB data."] - pub fn ncblit_rgb_packed( - data: *const cty::c_void, - linesize: cty::c_int, - vopts: *const ncvisual_options, - alpha: cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Supply an alpha value [0..255] to be applied throughout. linesize must be"] - #[doc = " a multiple of 4 for this RGBx data."] - pub fn ncblit_rgb_loose( - data: *const cty::c_void, - linesize: cty::c_int, - vopts: *const ncvisual_options, - alpha: cty::c_int, - ) -> cty::c_int; -} -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncreel_options { - #[doc = " bitfield; 1s will not be drawn (see bordermaskbits)"] - pub bordermask: cty::c_uint, - #[doc = " attributes used for ncreel border"] - pub borderchan: u64, - #[doc = " bitfield; same as bordermask but for tablet borders"] - pub tabletmask: cty::c_uint, - #[doc = " tablet border styling channel"] - pub tabletchan: u64, - #[doc = " focused tablet border styling channel"] - pub focusedchan: u64, - #[doc = " bitfield over NCREEL_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncreel_options() { - assert_eq!( - ::core::mem::size_of::(), - 48usize, - concat!("Size of: ", stringify!(ncreel_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncreel_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).bordermask as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncreel_options), - "::", - stringify!(bordermask) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).borderchan as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncreel_options), - "::", - stringify!(borderchan) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).tabletmask as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncreel_options), - "::", - stringify!(tabletmask) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).tabletchan as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncreel_options), - "::", - stringify!(tabletchan) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).focusedchan as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncreel_options), - "::", - stringify!(focusedchan) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(ncreel_options), - "::", - stringify!(flags) - ) - ); -} -extern "C" { - #[doc = " Take over the ncplane 'nc' and use it to draw a reel according to 'popts'."] - #[doc = " The plane will be destroyed by ncreel_destroy(); this transfers ownership."] - pub fn ncreel_create(n: *mut ncplane, popts: *const ncreel_options) -> *mut ncreel; -} -extern "C" { - #[doc = " Returns the ncplane on which this ncreel lives."] - pub fn ncreel_plane(nr: *mut ncreel) -> *mut ncplane; -} -#[doc = " Tablet draw callback, provided a tablet (from which the ncplane and userptr"] -#[doc = " may be extracted), and a bool indicating whether output ought be drawn from"] -#[doc = " the top (true) or bottom (false). Returns non-negative count of output lines,"] -#[doc = " which must be less than or equal to ncplane_dim_y(nctablet_plane(t))."] -pub type tabletcb = - ::core::option::Option cty::c_int>; -extern "C" { - #[doc = " Add a new nctablet to the provided ncreel 'nr', having the callback object"] - #[doc = " 'opaque'. Neither, either, or both of 'after' and 'before' may be specified."] - #[doc = " If neither is specified, the new tablet can be added anywhere on the reel."] - #[doc = " If one or the other is specified, the tablet will be added before or after"] - #[doc = " the specified tablet. If both are specified, the tablet will be added to the"] - #[doc = " resulting location, assuming it is valid (after->next == before->prev); if"] - #[doc = " it is not valid, or there is any other error, NULL will be returned."] - pub fn ncreel_add( - nr: *mut ncreel, - after: *mut nctablet, - before: *mut nctablet, - cb: tabletcb, - opaque: *mut cty::c_void, - ) -> *mut nctablet; -} -extern "C" { - #[doc = " Return the number of nctablets in the ncreel 'nr'."] - pub fn ncreel_tabletcount(nr: *const ncreel) -> cty::c_int; -} -extern "C" { - #[doc = " Delete the tablet specified by t from the ncreel 'nr'. Returns -1 if the"] - #[doc = " tablet cannot be found."] - pub fn ncreel_del(nr: *mut ncreel, t: *mut nctablet) -> cty::c_int; -} -extern "C" { - #[doc = " Redraw the ncreel 'nr' in its entirety. The reel will be cleared, and"] - #[doc = " tablets will be lain out, using the focused tablet as a fulcrum. Tablet"] - #[doc = " drawing callbacks will be invoked for each visible tablet."] - pub fn ncreel_redraw(nr: *mut ncreel) -> cty::c_int; -} -extern "C" { - #[doc = " Offer input 'ni' to the ncreel 'nr'. If it's relevant, this function returns"] - #[doc = " true, and the input ought not be processed further. If it's irrelevant to"] - #[doc = " the reel, false is returned. Relevant inputs include:"] - #[doc = " * a mouse click on a tablet (focuses tablet)"] - #[doc = " * a mouse scrollwheel event (rolls reel)"] - #[doc = " * up, down, pgup, or pgdown (navigates among items)"] - pub fn ncreel_offer_input(nr: *mut ncreel, ni: *const ncinput) -> bool; -} -extern "C" { - #[doc = " Return the focused tablet, if any tablets are present. This is not a copy;"] - #[doc = " be careful to use it only for the duration of a critical section."] - pub fn ncreel_focused(nr: *mut ncreel) -> *mut nctablet; -} -extern "C" { - #[doc = " Change focus to the next tablet, if one exists"] - pub fn ncreel_next(nr: *mut ncreel) -> *mut nctablet; -} -extern "C" { - #[doc = " Change focus to the previous tablet, if one exists"] - pub fn ncreel_prev(nr: *mut ncreel) -> *mut nctablet; -} -extern "C" { - #[doc = " Destroy an ncreel allocated with ncreel_create()."] - pub fn ncreel_destroy(nr: *mut ncreel); -} -extern "C" { - #[doc = " Returns a pointer to a user pointer associated with this nctablet."] - pub fn nctablet_userptr(t: *mut nctablet) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Access the ncplane associated with nctablet 't', if one exists."] - pub fn nctablet_plane(t: *mut nctablet) -> *mut ncplane; -} -extern "C" { - #[doc = " Floating-point is never used, because an IEEE758 double can only losslessly"] - #[doc = " represent integers through 2^53-1."] - #[doc = ""] - #[doc = " 2^64-1 is 18446744073709551615, 18.45E(xa). KMGTPEZY thus suffice to handle"] - #[doc = " an 89-bit uintmax_t. Beyond Z(etta) and Y(otta) lie lands unspecified by SI."] - #[doc = " 2^-63 is 0.000000000000000000108, 1.08a(tto)."] - #[doc = " val: value to print"] - #[doc = " decimal: scaling. '1' if none has taken place."] - #[doc = " buf: buffer in which string will be generated"] - #[doc = " omitdec: inhibit printing of all-0 decimal portions"] - #[doc = " mult: base of suffix system (almost always 1000 or 1024)"] - #[doc = " uprefix: character to print following suffix ('i' for kibibytes basically)."] - #[doc = " only printed if suffix is actually printed (input >= mult)."] - #[doc = ""] - #[doc = " You are encouraged to consult notcurses_metric(3)."] - pub fn ncmetric( - val: uintmax_t, - decimal: uintmax_t, - buf: *mut cty::c_char, - omitdec: cty::c_int, - mult: uintmax_t, - uprefix: cty::c_int, - ) -> *const cty::c_char; -} -extern "C" { - #[doc = " Enable or disable the terminal's cursor, if supported, placing it at"] - #[doc = " 'y', 'x'. Immediate effect (no need for a call to notcurses_render())."] - #[doc = " It is an error if 'y', 'x' lies outside the standard plane. Can be"] - #[doc = " called while already visible to move the cursor."] - pub fn notcurses_cursor_enable(nc: *mut notcurses, y: cty::c_int, x: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Get the current location of the terminal's cursor, whether visible or not."] - pub fn notcurses_cursor_yx( - nc: *mut notcurses, - y: *mut cty::c_int, - x: *mut cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Disable the hardware cursor. It is an error to call this while the"] - #[doc = " cursor is already disabled."] - pub fn notcurses_cursor_disable(nc: *mut notcurses) -> cty::c_int; -} -#[doc = " Palette API. Some terminals only support 256 colors, but allow the full"] -#[doc = " palette to be specified with arbitrary RGB colors. In all cases, it's more"] -#[doc = " performant to use indexed colors, since it's much less data to write to the"] -#[doc = " terminal. If you can limit yourself to 256 colors, that's probably best."] -#[repr(C)] -#[derive(Copy, Clone)] -pub struct ncpalette { - #[doc = " RGB values as regular ol' channels"] - pub chans: [u32; 256usize], -} -#[test] -fn bindgen_test_layout_ncpalette() { - assert_eq!( - ::core::mem::size_of::(), - 1024usize, - concat!("Size of: ", stringify!(ncpalette)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(ncpalette)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).chans as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncpalette), - "::", - stringify!(chans) - ) - ); -} -impl Default for ncpalette { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -extern "C" { - #[doc = " Create a new palette store. It will be initialized with notcurses' best"] - #[doc = " knowledge of the currently configured palette. The palette upon startup"] - #[doc = " cannot be reliably detected, sadly."] - pub fn ncpalette_new(nc: *mut notcurses) -> *mut ncpalette; -} -extern "C" { - #[doc = " Attempt to configure the terminal with the provided palette 'p'. Does not"] - #[doc = " transfer ownership of 'p'; palette256_free() can (ought) still be called."] - pub fn ncpalette_use(nc: *mut notcurses, p: *const ncpalette) -> cty::c_int; -} -extern "C" { - #[doc = " Free the palette store 'p'."] - pub fn ncpalette_free(p: *mut ncpalette); -} -extern "C" { - #[doc = " Convert the plane's content to greyscale."] - pub fn ncplane_greyscale(n: *mut ncplane); -} -#[doc = " selection widget -- an ncplane with a title header and a body section. the"] -#[doc = " body section supports infinite scrolling up and down."] -#[doc = ""] -#[doc = " At all times, exactly one item is selected."] -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncselector_item { - pub option: *mut cty::c_char, - pub desc: *mut cty::c_char, - #[doc = " filled in by library"] - pub opcolumns: size_t, - #[doc = " filled in by library"] - pub desccolumns: size_t, -} -#[test] -fn bindgen_test_layout_ncselector_item() { - assert_eq!( - ::core::mem::size_of::(), - 32usize, - concat!("Size of: ", stringify!(ncselector_item)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncselector_item)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).option as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncselector_item), - "::", - stringify!(option) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).desc as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncselector_item), - "::", - stringify!(desc) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).opcolumns as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncselector_item), - "::", - stringify!(opcolumns) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).desccolumns as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncselector_item), - "::", - stringify!(desccolumns) - ) - ); -} -impl Default for ncselector_item { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncselector_options { - #[doc = " title may be NULL, inhibiting riser, saving two rows."] - pub title: *mut cty::c_char, - #[doc = " secondary may be NULL"] - pub secondary: *mut cty::c_char, - #[doc = " footer may be NULL"] - pub footer: *mut cty::c_char, - #[doc = " initial items and descriptions"] - pub items: *mut ncselector_item, - #[doc = " default item (selected at start), must be < itemcount unless itemcount is"] - #[doc = " 0, in which case 'defidx' must also be 0"] - pub defidx: cty::c_uint, - #[doc = " maximum number of options to display at once, 0 to use all available space"] - pub maxdisplay: cty::c_uint, - #[doc = " option channels"] - pub opchannels: u64, - #[doc = " description channels"] - pub descchannels: u64, - #[doc = " title channels"] - pub titlechannels: u64, - #[doc = " secondary and footer channels"] - pub footchannels: u64, - #[doc = " border channels"] - pub boxchannels: u64, - #[doc = " bitfield of NCSELECTOR_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncselector_options() { - assert_eq!( - ::core::mem::size_of::(), - 88usize, - concat!("Size of: ", stringify!(ncselector_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncselector_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).title as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(title) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).secondary as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(secondary) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).footer as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(footer) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).items as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(items) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).defidx as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(defidx) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).maxdisplay as *const _ as usize }, - 36usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(maxdisplay) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).opchannels as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(opchannels) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).descchannels as *const _ as usize - }, - 48usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(descchannels) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).titlechannels as *const _ as usize - }, - 56usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(titlechannels) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).footchannels as *const _ as usize - }, - 64usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(footchannels) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).boxchannels as *const _ as usize }, - 72usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(boxchannels) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 80usize, - concat!( - "Offset of field: ", - stringify!(ncselector_options), - "::", - stringify!(flags) - ) - ); -} -impl Default for ncselector_options { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -extern "C" { - pub fn ncselector_create(n: *mut ncplane, opts: *const ncselector_options) -> *mut ncselector; -} -extern "C" { - #[doc = " Dynamically add or delete items. It is usually sufficient to supply a static"] - #[doc = " list of items via ncselector_options->items."] - pub fn ncselector_additem(n: *mut ncselector, item: *const ncselector_item) -> cty::c_int; -} -extern "C" { - pub fn ncselector_delitem(n: *mut ncselector, item: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Return reference to the selected option, or NULL if there are no items."] - pub fn ncselector_selected(n: *const ncselector) -> *const cty::c_char; -} -extern "C" { - #[doc = " Return a reference to the ncselector's underlying ncplane."] - pub fn ncselector_plane(n: *mut ncselector) -> *mut ncplane; -} -extern "C" { - #[doc = " Move up or down in the list. A reference to the newly-selected item is"] - #[doc = " returned, or NULL if there are no items in the list."] - pub fn ncselector_previtem(n: *mut ncselector) -> *const cty::c_char; -} -extern "C" { - pub fn ncselector_nextitem(n: *mut ncselector) -> *const cty::c_char; -} -extern "C" { - #[doc = " Offer the input to the ncselector. If it's relevant, this function returns"] - #[doc = " true, and the input ought not be processed further. If it's irrelevant to"] - #[doc = " the selector, false is returned. Relevant inputs include:"] - #[doc = " * a mouse click on an item"] - #[doc = " * a mouse scrollwheel event"] - #[doc = " * a mouse click on the scrolling arrows"] - #[doc = " * up, down, pgup, or pgdown on an unrolled menu (navigates among items)"] - pub fn ncselector_offer_input(n: *mut ncselector, nc: *const ncinput) -> bool; -} -extern "C" { - #[doc = " Destroy the ncselector. If 'item' is not NULL, the last selected option will"] - #[doc = " be strdup()ed and assigned to '*item' (and must be free()d by the caller)."] - pub fn ncselector_destroy(n: *mut ncselector, item: *mut *mut cty::c_char); -} -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncmselector_item { - pub option: *mut cty::c_char, - pub desc: *mut cty::c_char, - pub selected: bool, -} -#[test] -fn bindgen_test_layout_ncmselector_item() { - assert_eq!( - ::core::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(ncmselector_item)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncmselector_item)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).option as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncmselector_item), - "::", - stringify!(option) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).desc as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncmselector_item), - "::", - stringify!(desc) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).selected as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncmselector_item), - "::", - stringify!(selected) - ) - ); -} -impl Default for ncmselector_item { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[doc = " multiselection widget -- a selector supporting multiple selections."] -#[doc = ""] -#[doc = " Unlike the selector widget, zero to all of the items can be selected, but"] -#[doc = " also the widget does not support adding or removing items at runtime."] -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncmultiselector_options { - #[doc = " title may be NULL, inhibiting riser, saving two rows."] - pub title: *mut cty::c_char, - #[doc = " secondary may be NULL"] - pub secondary: *mut cty::c_char, - #[doc = " footer may be NULL"] - pub footer: *mut cty::c_char, - #[doc = " initial items, descriptions, and statuses"] - pub items: *mut ncmselector_item, - #[doc = " maximum number of options to display at once, 0 to use all available space"] - pub maxdisplay: cty::c_uint, - #[doc = " option channels"] - pub opchannels: u64, - #[doc = " description channels"] - pub descchannels: u64, - #[doc = " title channels"] - pub titlechannels: u64, - #[doc = " secondary and footer channels"] - pub footchannels: u64, - #[doc = " border channels"] - pub boxchannels: u64, - #[doc = " bitfield of NCMULTISELECTOR_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncmultiselector_options() { - assert_eq!( - ::core::mem::size_of::(), - 88usize, - concat!("Size of: ", stringify!(ncmultiselector_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncmultiselector_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).title as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(title) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).secondary as *const _ as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(secondary) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).footer as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(footer) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).items as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(items) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).maxdisplay as *const _ as usize - }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(maxdisplay) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).opchannels as *const _ as usize - }, - 40usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(opchannels) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).descchannels as *const _ as usize - }, - 48usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(descchannels) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).titlechannels as *const _ as usize - }, - 56usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(titlechannels) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).footchannels as *const _ as usize - }, - 64usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(footchannels) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).boxchannels as *const _ as usize - }, - 72usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(boxchannels) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 80usize, - concat!( - "Offset of field: ", - stringify!(ncmultiselector_options), - "::", - stringify!(flags) - ) - ); -} -impl Default for ncmultiselector_options { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -extern "C" { - pub fn ncmultiselector_create( - n: *mut ncplane, - opts: *const ncmultiselector_options, - ) -> *mut ncmultiselector; -} -extern "C" { - #[doc = " Return selected vector. An array of bools must be provided, along with its"] - #[doc = " length. If that length doesn't match the itemcount, it is an error."] - pub fn ncmultiselector_selected( - n: *mut ncmultiselector, - selected: *mut bool, - count: cty::c_uint, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Return a reference to the ncmultiselector's underlying ncplane."] - pub fn ncmultiselector_plane(n: *mut ncmultiselector) -> *mut ncplane; -} -extern "C" { - #[doc = " Offer the input to the ncmultiselector. If it's relevant, this function"] - #[doc = " returns true, and the input ought not be processed further. If it's"] - #[doc = " irrelevant to the multiselector, false is returned. Relevant inputs include:"] - #[doc = " * a mouse click on an item"] - #[doc = " * a mouse scrollwheel event"] - #[doc = " * a mouse click on the scrolling arrows"] - #[doc = " * up, down, pgup, or pgdown on an unrolled menu (navigates among items)"] - pub fn ncmultiselector_offer_input(n: *mut ncmultiselector, nc: *const ncinput) -> bool; -} -extern "C" { - #[doc = " Destroy the ncmultiselector."] - pub fn ncmultiselector_destroy(n: *mut ncmultiselector); -} -#[doc = " each item has a curry, and zero or more subitems."] -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct nctree_item { - pub curry: *mut cty::c_void, - pub subs: *mut nctree_item, - pub subcount: cty::c_uint, -} -#[test] -fn bindgen_test_layout_nctree_item() { - assert_eq!( - ::core::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(nctree_item)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(nctree_item)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).curry as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(nctree_item), - "::", - stringify!(curry) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).subs as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(nctree_item), - "::", - stringify!(subs) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).subcount as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(nctree_item), - "::", - stringify!(subcount) - ) - ); -} -impl Default for nctree_item { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct nctree_options { - #[doc = " top-level nctree_item array"] - pub items: *const nctree_item, - #[doc = " size of |items|"] - pub count: cty::c_uint, - #[doc = " item callback function"] - pub nctreecb: ::core::option::Option< - unsafe extern "C" fn( - arg1: *mut ncplane, - arg2: *mut cty::c_void, - arg3: cty::c_int, - ) -> cty::c_int, - >, - #[doc = " columns to indent per level of hierarchy"] - pub indentcols: cty::c_int, - #[doc = " bitfield of NCTREE_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_nctree_options() { - assert_eq!( - ::core::mem::size_of::(), - 40usize, - concat!("Size of: ", stringify!(nctree_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(nctree_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).items as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(nctree_options), - "::", - stringify!(items) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).count as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(nctree_options), - "::", - stringify!(count) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).nctreecb as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(nctree_options), - "::", - stringify!(nctreecb) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).indentcols as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(nctree_options), - "::", - stringify!(indentcols) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(nctree_options), - "::", - stringify!(flags) - ) - ); -} -impl Default for nctree_options { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct nctree { - _unused: [u8; 0], -} -extern "C" { - #[doc = " |opts| may *not* be NULL, since it is necessary to define a callback"] - #[doc = " function."] - pub fn nctree_create(n: *mut ncplane, opts: *const nctree_options) -> *mut nctree; -} -extern "C" { - #[doc = " Returns the ncplane on which this nctree lives."] - pub fn nctree_plane(n: *mut nctree) -> *mut ncplane; -} -extern "C" { - #[doc = " Redraw the nctree 'n' in its entirety. The tree will be cleared, and items"] - #[doc = " will be lain out, using the focused item as a fulcrum. Item-drawing"] - #[doc = " callbacks will be invoked for each visible item."] - pub fn nctree_redraw(n: *mut nctree) -> cty::c_int; -} -extern "C" { - #[doc = " Offer input 'ni' to the nctree 'n'. If it's relevant, this function returns"] - #[doc = " true, and the input ought not be processed further. If it's irrelevant to"] - #[doc = " the tree, false is returned. Relevant inputs include:"] - #[doc = " * a mouse click on an item (focuses item)"] - #[doc = " * a mouse scrollwheel event (srolls tree)"] - #[doc = " * up, down, pgup, or pgdown (navigates among items)"] - pub fn nctree_offer_input(n: *mut nctree, ni: *const ncinput) -> bool; -} -extern "C" { - #[doc = " Return the focused item, if any items are present. This is not a copy;"] - #[doc = " be careful to use it only for the duration of a critical section."] - pub fn nctree_focused(n: *mut nctree) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Change focus to the next item."] - pub fn nctree_next(n: *mut nctree) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Change focus to the previous item."] - pub fn nctree_prev(n: *mut nctree) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Go to the item specified by the array |spec|, terminated by UINT_MAX. If"] - #[doc = " the spec is invalid, NULL is returned, and the depth of the first invalid"] - #[doc = " spec is written to *|failspec|. Otherwise, the true depth is written to"] - #[doc = " *|failspec|, and the curry is returned (|failspec| is necessary because the"] - #[doc = " curry could itself be NULL)."] - pub fn nctree_goto( - n: *mut nctree, - spec: *const cty::c_uint, - failspec: *mut cty::c_int, - ) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Destroy the nctree."] - pub fn nctree_destroy(n: *mut nctree); -} -#[doc = " Menus. Horizontal menu bars are supported, on the top and/or bottom rows."] -#[doc = " If the menu bar is longer than the screen, it will be only partially"] -#[doc = " visible. Menus may be either visible or invisible by default. In the event of"] -#[doc = " a screen resize, menus will be automatically moved/resized. Elements can be"] -#[doc = " dynamically enabled or disabled at all levels (menu, section, and item),"] -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncmenu_item { - #[doc = " utf-8 menu item, NULL for horizontal separator"] - pub desc: *mut cty::c_char, - #[doc = " shortcut, all should be distinct"] - pub shortcut: ncinput, -} -#[test] -fn bindgen_test_layout_ncmenu_item() { - assert_eq!( - ::core::mem::size_of::(), - 32usize, - concat!("Size of: ", stringify!(ncmenu_item)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncmenu_item)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).desc as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_item), - "::", - stringify!(desc) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).shortcut as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_item), - "::", - stringify!(shortcut) - ) - ); -} -impl Default for ncmenu_item { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncmenu_section { - #[doc = " utf-8 c string"] - pub name: *mut cty::c_char, - pub itemcount: cty::c_int, - pub items: *mut ncmenu_item, - #[doc = " shortcut, will be underlined if present in name"] - pub shortcut: ncinput, -} -#[test] -fn bindgen_test_layout_ncmenu_section() { - assert_eq!( - ::core::mem::size_of::(), - 48usize, - concat!("Size of: ", stringify!(ncmenu_section)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncmenu_section)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).name as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_section), - "::", - stringify!(name) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).itemcount as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_section), - "::", - stringify!(itemcount) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).items as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_section), - "::", - stringify!(items) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).shortcut as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_section), - "::", - stringify!(shortcut) - ) - ); -} -impl Default for ncmenu_section { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncmenu_options { - #[doc = " array of 'sectioncount' menu_sections"] - pub sections: *mut ncmenu_section, - #[doc = " must be positive"] - pub sectioncount: cty::c_int, - #[doc = " styling for header"] - pub headerchannels: u64, - #[doc = " styling for sections"] - pub sectionchannels: u64, - #[doc = " flag word of NCMENU_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncmenu_options() { - assert_eq!( - ::core::mem::size_of::(), - 40usize, - concat!("Size of: ", stringify!(ncmenu_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncmenu_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sections as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_options), - "::", - stringify!(sections) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sectioncount as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_options), - "::", - stringify!(sectioncount) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).headerchannels as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_options), - "::", - stringify!(headerchannels) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sectionchannels as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_options), - "::", - stringify!(sectionchannels) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncmenu_options), - "::", - stringify!(flags) - ) - ); -} -impl Default for ncmenu_options { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[repr(C)] -#[derive(Debug)] -pub struct ncmenu { - _unused: [u8; 0], -} -extern "C" { - #[doc = " Create a menu with the specified options. Menus are currently bound to an"] - #[doc = " overall Notcurses object (as opposed to a particular plane), and are"] - #[doc = " implemented as ncplanes kept atop other ncplanes."] - pub fn ncmenu_create(n: *mut ncplane, opts: *const ncmenu_options) -> *mut ncmenu; -} -extern "C" { - #[doc = " Unroll the specified menu section, making the menu visible if it was"] - #[doc = " invisible, and rolling up any menu section that is already unrolled."] - pub fn ncmenu_unroll(n: *mut ncmenu, sectionidx: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Roll up any unrolled menu section, and hide the menu if using hiding."] - pub fn ncmenu_rollup(n: *mut ncmenu) -> cty::c_int; -} -extern "C" { - #[doc = " Unroll the previous/next section (relative to current unrolled). If no"] - #[doc = " section is unrolled, the first section will be unrolled."] - pub fn ncmenu_nextsection(n: *mut ncmenu) -> cty::c_int; -} -extern "C" { - pub fn ncmenu_prevsection(n: *mut ncmenu) -> cty::c_int; -} -extern "C" { - #[doc = " Move to the previous/next item within the currently unrolled section. If no"] - #[doc = " section is unrolled, the first section will be unrolled."] - pub fn ncmenu_nextitem(n: *mut ncmenu) -> cty::c_int; -} -extern "C" { - pub fn ncmenu_previtem(n: *mut ncmenu) -> cty::c_int; -} -extern "C" { - #[doc = " Disable or enable a menu item. Returns 0 if the item was found."] - pub fn ncmenu_item_set_status( - n: *mut ncmenu, - section: *const cty::c_char, - item: *const cty::c_char, - enabled: bool, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Return the selected item description, or NULL if no section is unrolled. If"] - #[doc = " 'ni' is not NULL, and the selected item has a shortcut, 'ni' will be filled"] - #[doc = " in with that shortcut--this can allow faster matching."] - pub fn ncmenu_selected(n: *const ncmenu, ni: *mut ncinput) -> *const cty::c_char; -} -extern "C" { - #[doc = " Return the item description corresponding to the mouse click 'click'. The"] - #[doc = " item must be on an actively unrolled section, and the click must be in the"] - #[doc = " area of a valid item. If 'ni' is not NULL, and the selected item has a"] - #[doc = " shortcut, 'ni' will be filled in with the shortcut."] - pub fn ncmenu_mouse_selected( - n: *const ncmenu, - click: *const ncinput, - ni: *mut ncinput, - ) -> *const cty::c_char; -} -extern "C" { - #[doc = " Return the ncplane backing this ncmenu."] - pub fn ncmenu_plane(n: *mut ncmenu) -> *mut ncplane; -} -extern "C" { - #[doc = " Offer the input to the ncmenu. If it's relevant, this function returns true,"] - #[doc = " and the input ought not be processed further. If it's irrelevant to the"] - #[doc = " menu, false is returned. Relevant inputs include:"] - #[doc = " * mouse movement over a hidden menu"] - #[doc = " * a mouse click on a menu section (the section is unrolled)"] - #[doc = " * a mouse click outside of an unrolled menu (the menu is rolled up)"] - #[doc = " * left or right on an unrolled menu (navigates among sections)"] - #[doc = " * up or down on an unrolled menu (navigates among items)"] - #[doc = " * escape on an unrolled menu (the menu is rolled up)"] - pub fn ncmenu_offer_input(n: *mut ncmenu, nc: *const ncinput) -> bool; -} -extern "C" { - #[doc = " Destroy a menu created with ncmenu_create()."] - pub fn ncmenu_destroy(n: *mut ncmenu) -> cty::c_int; -} -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncprogbar_options { - #[doc = " upper-left channel. in the context of a progress bar,"] - pub ulchannel: u32, - #[doc = " \"up\" is the direction we are progressing towards, and"] - pub urchannel: u32, - #[doc = " \"bottom\" is the direction of origin. for monochromatic"] - pub blchannel: u32, - #[doc = " bar, all four channels ought be the same."] - pub brchannel: u32, - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncprogbar_options() { - assert_eq!( - ::core::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(ncprogbar_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncprogbar_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).ulchannel as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncprogbar_options), - "::", - stringify!(ulchannel) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).urchannel as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(ncprogbar_options), - "::", - stringify!(urchannel) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).blchannel as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncprogbar_options), - "::", - stringify!(blchannel) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).brchannel as *const _ as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(ncprogbar_options), - "::", - stringify!(brchannel) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncprogbar_options), - "::", - stringify!(flags) - ) - ); -} -extern "C" { - #[doc = " Takes ownership of the ncplane 'n', which will be destroyed by"] - #[doc = " ncprogbar_destroy(). The progress bar is initially at 0%."] - pub fn ncprogbar_create(n: *mut ncplane, opts: *const ncprogbar_options) -> *mut ncprogbar; -} -extern "C" { - #[doc = " Return a reference to the ncprogbar's underlying ncplane."] - pub fn ncprogbar_plane(n: *mut ncprogbar) -> *mut ncplane; -} -extern "C" { - #[doc = " Set the progress bar's completion, a double 0 <= 'p' <= 1."] - pub fn ncprogbar_set_progress(n: *mut ncprogbar, p: f64) -> cty::c_int; -} -extern "C" { - #[doc = " Get the progress bar's completion, a double on [0, 1]."] - pub fn ncprogbar_progress(n: *const ncprogbar) -> f64; -} -extern "C" { - #[doc = " Destroy the progress bar and its underlying ncplane."] - pub fn ncprogbar_destroy(n: *mut ncprogbar); -} -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct nctabbed_options { - #[doc = " channel for the selected tab header"] - pub selchan: u64, - #[doc = " channel for unselected tab headers"] - pub hdrchan: u64, - #[doc = " channel for the tab separator"] - pub sepchan: u64, - #[doc = " separator string (copied by nctabbed_create())"] - pub separator: *mut cty::c_char, - #[doc = " bitmask of NCTABBED_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_nctabbed_options() { - assert_eq!( - ::core::mem::size_of::(), - 40usize, - concat!("Size of: ", stringify!(nctabbed_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(nctabbed_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).selchan as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(nctabbed_options), - "::", - stringify!(selchan) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).hdrchan as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(nctabbed_options), - "::", - stringify!(hdrchan) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).sepchan as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(nctabbed_options), - "::", - stringify!(sepchan) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).separator as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(nctabbed_options), - "::", - stringify!(separator) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(nctabbed_options), - "::", - stringify!(flags) - ) - ); -} -impl Default for nctabbed_options { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -#[doc = " Tab content drawing callback. Takes the tab it was associated to, the ncplane"] -#[doc = " on which tab content is to be drawn, and the user pointer of the tab."] -#[doc = " It is called during nctabbed_redraw()."] -pub type tabcb = ::core::option::Option< - unsafe extern "C" fn(t: *mut nctab, ncp: *mut ncplane, curry: *mut cty::c_void), ->; -extern "C" { - #[doc = " Creates a new nctabbed widget, associated with the given ncplane 'n', and with"] - #[doc = " additional options given in 'opts'. When 'opts' is NULL, it acts as if it were"] - #[doc = " called with an all-zero opts. The widget takes ownership of 'n', and destroys"] - #[doc = " it when the widget is destroyed. Returns the newly created widget. Returns"] - #[doc = " NULL on failure, also destroying 'n'."] - pub fn nctabbed_create(n: *mut ncplane, opts: *const nctabbed_options) -> *mut nctabbed; -} -extern "C" { - #[doc = " Destroy an nctabbed widget. All memory belonging to 'nt' is deallocated,"] - #[doc = " including all tabs and their names. The plane associated with 'nt' is also"] - #[doc = " destroyed. Calling this with NULL does nothing."] - pub fn nctabbed_destroy(nt: *mut nctabbed); -} -extern "C" { - #[doc = " Redraw the widget. This calls the tab callback of the currently selected tab"] - #[doc = " to draw tab contents, and draws tab headers. The tab content plane is not"] - #[doc = " modified by this function, apart from resizing the plane is necessary."] - pub fn nctabbed_redraw(nt: *mut nctabbed); -} -extern "C" { - #[doc = " Make sure the tab header of the currently selected tab is at least partially"] - #[doc = " visible. (by rotating tabs until at least one column is displayed)"] - #[doc = " Does nothing if there are no tabs."] - pub fn nctabbed_ensure_selected_header_visible(nt: *mut nctabbed); -} -extern "C" { - #[doc = " Returns the currently selected tab, or NULL if there are no tabs."] - pub fn nctabbed_selected(nt: *mut nctabbed) -> *mut nctab; -} -extern "C" { - #[doc = " Returns the leftmost tab, or NULL if there are no tabs."] - pub fn nctabbed_leftmost(nt: *mut nctabbed) -> *mut nctab; -} -extern "C" { - #[doc = " Returns the number of tabs in the widget."] - pub fn nctabbed_tabcount(nt: *mut nctabbed) -> cty::c_int; -} -extern "C" { - #[doc = " Returns the plane associated to 'nt'."] - pub fn nctabbed_plane(nt: *mut nctabbed) -> *mut ncplane; -} -extern "C" { - #[doc = " Returns the tab content plane."] - pub fn nctabbed_content_plane(nt: *mut nctabbed) -> *mut ncplane; -} -extern "C" { - #[doc = " Returns the tab callback."] - pub fn nctab_cb(t: *mut nctab) -> tabcb; -} -extern "C" { - #[doc = " Returns the tab name. This is not a copy and it should not be stored."] - pub fn nctab_name(t: *mut nctab) -> *const cty::c_char; -} -extern "C" { - #[doc = " Returns the width (in columns) of the tab's name."] - pub fn nctab_name_width(t: *mut nctab) -> cty::c_int; -} -extern "C" { - #[doc = " Returns the tab's user pointer."] - pub fn nctab_userptr(t: *mut nctab) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Returns the tab to the right of 't'. This does not change which tab is selected."] - pub fn nctab_next(t: *mut nctab) -> *mut nctab; -} -extern "C" { - #[doc = " Returns the tab to the left of 't'. This does not change which tab is selected."] - pub fn nctab_prev(t: *mut nctab) -> *mut nctab; -} -extern "C" { - #[doc = " Add a new tab to 'nt' with the given tab callback, name, and user pointer."] - #[doc = " If both 'before' and 'after' are NULL, the tab is inserted after the selected"] - #[doc = " tab. Otherwise, it gets put after 'after' (if not NULL) and before 'before'"] - #[doc = " (if not NULL). If both 'after' and 'before' are given, they must be two"] - #[doc = " neighboring tabs (the tab list is circular, so the last tab is immediately"] - #[doc = " before the leftmost tab), otherwise the function returns NULL. If 'name' is"] - #[doc = " NULL or a string containing illegal characters, the function returns NULL."] - #[doc = " On all other failures the function also returns NULL. If it returns NULL,"] - #[doc = " none of the arguments are modified, and the widget state is not altered."] - pub fn nctabbed_add( - nt: *mut nctabbed, - after: *mut nctab, - before: *mut nctab, - tcb: tabcb, - name: *const cty::c_char, - opaque: *mut cty::c_void, - ) -> *mut nctab; -} -extern "C" { - #[doc = " Remove a tab 't' from 'nt'. Its neighboring tabs become neighbors to each"] - #[doc = " other. If 't' if the selected tab, the tab after 't' becomes selected."] - #[doc = " Likewise if 't' is the leftmost tab, the tab after 't' becomes leftmost."] - #[doc = " If 't' is the only tab, there will no more be a selected or leftmost tab,"] - #[doc = " until a new tab is added. Returns -1 if 't' is NULL, and 0 otherwise."] - pub fn nctabbed_del(nt: *mut nctabbed, t: *mut nctab) -> cty::c_int; -} -extern "C" { - #[doc = " Move 't' after 'after' (if not NULL) and before 'before' (if not NULL)."] - #[doc = " If both 'after' and 'before' are NULL, the function returns -1, otherwise"] - #[doc = " it returns 0."] - pub fn nctab_move( - nt: *mut nctabbed, - t: *mut nctab, - after: *mut nctab, - before: *mut nctab, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Move 't' to the right by one tab, looping around to become leftmost if needed."] - pub fn nctab_move_right(nt: *mut nctabbed, t: *mut nctab); -} -extern "C" { - #[doc = " Move 't' to the right by one tab, looping around to become the last tab if needed."] - pub fn nctab_move_left(nt: *mut nctabbed, t: *mut nctab); -} -extern "C" { - #[doc = " Rotate the tabs of 'nt' right by 'amt' tabs, or '-amt' tabs left if 'amt' is"] - #[doc = " negative. Tabs are rotated only by changing the leftmost tab; the selected tab"] - #[doc = " stays the same. If there are no tabs, nothing happens."] - pub fn nctabbed_rotate(nt: *mut nctabbed, amt: cty::c_int); -} -extern "C" { - #[doc = " Select the tab after the currently selected tab, and return the newly selected"] - #[doc = " tab. Returns NULL if there are no tabs."] - pub fn nctabbed_next(nt: *mut nctabbed) -> *mut nctab; -} -extern "C" { - #[doc = " Select the tab before the currently selected tab, and return the newly selected"] - #[doc = " tab. Returns NULL if there are no tabs."] - pub fn nctabbed_prev(nt: *mut nctabbed) -> *mut nctab; -} -extern "C" { - #[doc = " Change the selected tab to be 't'. Returns the previously selected tab."] - pub fn nctabbed_select(nt: *mut nctabbed, t: *mut nctab) -> *mut nctab; -} -extern "C" { - #[doc = " Write the channels for tab headers, the selected tab header, and the separator"] - #[doc = " to '*hdrchan', '*selchan', and '*sepchan' respectively."] - pub fn nctabbed_channels( - nt: *mut nctabbed, - hdrchan: *mut u64, - selchan: *mut u64, - sepchan: *mut u64, - ); -} -extern "C" { - #[doc = " Returns the tab separator. This is not a copy and it should not be stored."] - #[doc = " This can be NULL, if the separator was set to NULL in ncatbbed_create() or"] - #[doc = " nctabbed_set_separator()."] - pub fn nctabbed_separator(nt: *mut nctabbed) -> *const cty::c_char; -} -extern "C" { - #[doc = " Returns the tab separator width, or zero if there is no separator."] - pub fn nctabbed_separator_width(nt: *mut nctabbed) -> cty::c_int; -} -extern "C" { - #[doc = " Set the tab headers channel for 'nt'."] - pub fn nctabbed_set_hdrchan(nt: *mut nctabbed, chan: u64); -} -extern "C" { - #[doc = " Set the selected tab header channel for 'nt'."] - pub fn nctabbed_set_selchan(nt: *mut nctabbed, chan: u64); -} -extern "C" { - #[doc = " Set the tab separator channel for 'nt'."] - pub fn nctabbed_set_sepchan(nt: *mut nctabbed, chan: u64); -} -extern "C" { - #[doc = " Set the tab callback function for 't'. Returns the previous tab callback."] - pub fn nctab_set_cb(t: *mut nctab, newcb: tabcb) -> tabcb; -} -extern "C" { - #[doc = " Change the name of 't'. Returns -1 if 'newname' is NULL, and 0 otherwise."] - pub fn nctab_set_name(t: *mut nctab, newname: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " Set the user pointer of 't'. Returns the previous user pointer."] - pub fn nctab_set_userptr(t: *mut nctab, newopaque: *mut cty::c_void) -> *mut cty::c_void; -} -extern "C" { - #[doc = " Change the tab separator for 'nt'. Returns -1 if 'separator' is not NULL and"] - #[doc = " is not a valid string, and 0 otherwise."] - pub fn nctabbed_set_separator(nt: *mut nctabbed, separator: *const cty::c_char) -> cty::c_int; -} -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncplot_options { - #[doc = " channels for the maximum and minimum levels. linear or exponential"] - #[doc = " interpolation will be applied across the domain between these two."] - pub maxchannels: u64, - pub minchannels: u64, - #[doc = " styling used for the legend, if NCPLOT_OPTION_LABELTICKSD is set"] - pub legendstyle: u16, - #[doc = " number of \"pixels\" per row x column"] - pub gridtype: ncblitter_e, - #[doc = " independent variable can either be a contiguous range, or a finite set"] - #[doc = " of keys. for a time range, say the previous hour sampled with second"] - #[doc = " resolution, the independent variable would be the range [0..3600): 3600."] - #[doc = " if rangex is 0, it is dynamically set to the number of columns."] - pub rangex: cty::c_int, - #[doc = " optional, printed by the labels"] - pub title: *const cty::c_char, - #[doc = " bitfield over NCPLOT_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncplot_options() { - assert_eq!( - ::core::mem::size_of::(), - 48usize, - concat!("Size of: ", stringify!(ncplot_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncplot_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).maxchannels as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncplot_options), - "::", - stringify!(maxchannels) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).minchannels as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncplot_options), - "::", - stringify!(minchannels) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).legendstyle as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncplot_options), - "::", - stringify!(legendstyle) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).gridtype as *const _ as usize }, - 20usize, - concat!( - "Offset of field: ", - stringify!(ncplot_options), - "::", - stringify!(gridtype) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).rangex as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncplot_options), - "::", - stringify!(rangex) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).title as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncplot_options), - "::", - stringify!(title) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(ncplot_options), - "::", - stringify!(flags) - ) - ); -} -impl Default for ncplot_options { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -extern "C" { - #[doc = " Use the provided plane 'n' for plotting according to the options 'opts'. The"] - #[doc = " plot will make free use of the entirety of the plane. For domain"] - #[doc = " autodiscovery, set miny == maxy == 0. ncuplot holds uint64_ts, while"] - #[doc = " ncdplot holds doubles."] - pub fn ncuplot_create( - n: *mut ncplane, - opts: *const ncplot_options, - miny: u64, - maxy: u64, - ) -> *mut ncuplot; -} -extern "C" { - pub fn ncdplot_create( - n: *mut ncplane, - opts: *const ncplot_options, - miny: f64, - maxy: f64, - ) -> *mut ncdplot; -} -extern "C" { - #[doc = " Return a reference to the ncplot's underlying ncplane."] - pub fn ncuplot_plane(n: *mut ncuplot) -> *mut ncplane; -} -extern "C" { - pub fn ncdplot_plane(n: *mut ncdplot) -> *mut ncplane; -} -extern "C" { - #[doc = " Add to or set the value corresponding to this x. If x is beyond the current"] - #[doc = " x window, the x window is advanced to include x, and values passing beyond"] - #[doc = " the window are lost. The first call will place the initial window. The plot"] - #[doc = " will be redrawn, but notcurses_render() is not called."] - pub fn ncuplot_add_sample(n: *mut ncuplot, x: u64, y: u64) -> cty::c_int; -} -extern "C" { - pub fn ncdplot_add_sample(n: *mut ncdplot, x: u64, y: f64) -> cty::c_int; -} -extern "C" { - pub fn ncuplot_set_sample(n: *mut ncuplot, x: u64, y: u64) -> cty::c_int; -} -extern "C" { - pub fn ncdplot_set_sample(n: *mut ncdplot, x: u64, y: f64) -> cty::c_int; -} -extern "C" { - pub fn ncuplot_sample(n: *const ncuplot, x: u64, y: *mut u64) -> cty::c_int; -} -extern "C" { - pub fn ncdplot_sample(n: *const ncdplot, x: u64, y: *mut f64) -> cty::c_int; -} -extern "C" { - pub fn ncuplot_destroy(n: *mut ncuplot); -} -extern "C" { - pub fn ncdplot_destroy(n: *mut ncdplot); -} -pub type ncfdplane_callback = ::core::option::Option< - unsafe extern "C" fn( - n: *mut ncfdplane, - buf: *const cty::c_void, - s: size_t, - curry: *mut cty::c_void, - ) -> cty::c_int, ->; -pub type ncfdplane_done_cb = ::core::option::Option< - unsafe extern "C" fn( - n: *mut ncfdplane, - fderrno: cty::c_int, - curry: *mut cty::c_void, - ) -> cty::c_int, ->; -#[doc = " read from an fd until EOF (or beyond, if follow is set), invoking the user's"] -#[doc = " callback each time. runs in its own context. on EOF or error, the finalizer"] -#[doc = " callback will be invoked, and the user ought destroy the ncfdplane. the"] -#[doc = " data is *not* guaranteed to be nul-terminated, and may contain arbitrary"] -#[doc = " zeroes."] -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncfdplane_options { - #[doc = " parameter provided to callbacks"] - pub curry: *mut cty::c_void, - #[doc = " keep reading after hitting end? (think tail -f)"] - pub follow: bool, - #[doc = " bitfield over NCOPTION_FDPLANE_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncfdplane_options() { - assert_eq!( - ::core::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(ncfdplane_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncfdplane_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).curry as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncfdplane_options), - "::", - stringify!(curry) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).follow as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncfdplane_options), - "::", - stringify!(follow) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncfdplane_options), - "::", - stringify!(flags) - ) - ); -} -impl Default for ncfdplane_options { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -extern "C" { - #[doc = " Create an ncfdplane around the fd 'fd'. Consider this function to take"] - #[doc = " ownership of the file descriptor, which will be closed in ncfdplane_destroy()."] - pub fn ncfdplane_create( - n: *mut ncplane, - opts: *const ncfdplane_options, - fd: cty::c_int, - cbfxn: ncfdplane_callback, - donecbfxn: ncfdplane_done_cb, - ) -> *mut ncfdplane; -} -extern "C" { - pub fn ncfdplane_plane(n: *mut ncfdplane) -> *mut ncplane; -} -extern "C" { - pub fn ncfdplane_destroy(n: *mut ncfdplane) -> cty::c_int; -} -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncsubproc_options { - pub curry: *mut cty::c_void, - #[doc = " restart this many seconds after an exit (watch)"] - pub restart_period: u64, - #[doc = " bitfield over NCOPTION_SUBPROC_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncsubproc_options() { - assert_eq!( - ::core::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(ncsubproc_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncsubproc_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).curry as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncsubproc_options), - "::", - stringify!(curry) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).restart_period as *const _ as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncsubproc_options), - "::", - stringify!(restart_period) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncsubproc_options), - "::", - stringify!(flags) - ) - ); -} -impl Default for ncsubproc_options { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} -extern "C" { - #[doc = " see exec(2). p-types use $PATH. e-type passes environment vars."] - pub fn ncsubproc_createv( - n: *mut ncplane, - opts: *const ncsubproc_options, - bin: *const cty::c_char, - arg: *const *mut cty::c_char, - cbfxn: ncfdplane_callback, - donecbfxn: ncfdplane_done_cb, - ) -> *mut ncsubproc; -} -extern "C" { - pub fn ncsubproc_createvp( - n: *mut ncplane, - opts: *const ncsubproc_options, - bin: *const cty::c_char, - arg: *const *mut cty::c_char, - cbfxn: ncfdplane_callback, - donecbfxn: ncfdplane_done_cb, - ) -> *mut ncsubproc; -} -extern "C" { - pub fn ncsubproc_createvpe( - n: *mut ncplane, - opts: *const ncsubproc_options, - bin: *const cty::c_char, - arg: *const *mut cty::c_char, - env: *const *mut cty::c_char, - cbfxn: ncfdplane_callback, - donecbfxn: ncfdplane_done_cb, - ) -> *mut ncsubproc; -} -extern "C" { - pub fn ncsubproc_plane(n: *mut ncsubproc) -> *mut ncplane; -} -extern "C" { - pub fn ncsubproc_destroy(n: *mut ncsubproc) -> cty::c_int; -} -extern "C" { - #[doc = " Draw a QR code at the current position on the plane. If there is insufficient"] - #[doc = " room to draw the code here, or there is any other error, non-zero will be"] - #[doc = " returned. Otherwise, the QR code \"version\" (size) is returned. The QR code"] - #[doc = " is (version * 4 + 17) columns wide, and ⌈version * 4 + 17⌉ rows tall (the"] - #[doc = " properly-scaled values are written back to '*ymax' and '*xmax')."] - pub fn ncplane_qrcode( - n: *mut ncplane, - ymax: *mut cty::c_int, - xmax: *mut cty::c_int, - data: *const cty::c_void, - len: size_t, - ) -> cty::c_int; -} -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncreader_options { - #[doc = " channels used for input"] - pub tchannels: u64, - #[doc = " attributes used for input"] - pub tattrword: u32, - #[doc = " bitfield of NCREADER_OPTION_*"] - pub flags: u64, -} -#[test] -fn bindgen_test_layout_ncreader_options() { - assert_eq!( - ::core::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(ncreader_options)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ncreader_options)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).tchannels as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncreader_options), - "::", - stringify!(tchannels) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).tattrword as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncreader_options), - "::", - stringify!(tattrword) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).flags as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncreader_options), - "::", - stringify!(flags) - ) - ); -} -extern "C" { - #[doc = " ncreaders provide freeform input in a (possibly multiline) region, supporting"] - #[doc = " optional readline keybindings. takes ownership of 'n', destroying it on any"] - #[doc = " error (ncreader_destroy() otherwise destroys the ncplane)."] - pub fn ncreader_create(n: *mut ncplane, opts: *const ncreader_options) -> *mut ncreader; -} -extern "C" { - #[doc = " empty the ncreader of any user input, and home the cursor."] - pub fn ncreader_clear(n: *mut ncreader) -> cty::c_int; -} -extern "C" { - pub fn ncreader_plane(n: *mut ncreader) -> *mut ncplane; -} -extern "C" { - #[doc = " Offer the input to the ncreader. If it's relevant, this function returns"] - #[doc = " true, and the input ought not be processed further. Almost all inputs"] - #[doc = " are relevant to an ncreader, save synthesized ones."] - pub fn ncreader_offer_input(n: *mut ncreader, ni: *const ncinput) -> bool; -} -extern "C" { - #[doc = " Atttempt to move in the specified direction. Returns 0 if a move was"] - #[doc = " successfully executed, -1 otherwise. Scrolling is taken into account."] - pub fn ncreader_move_left(n: *mut ncreader) -> cty::c_int; -} -extern "C" { - pub fn ncreader_move_right(n: *mut ncreader) -> cty::c_int; -} -extern "C" { - pub fn ncreader_move_up(n: *mut ncreader) -> cty::c_int; -} -extern "C" { - pub fn ncreader_move_down(n: *mut ncreader) -> cty::c_int; -} -extern "C" { - #[doc = " Destructively write the provided EGC to the current cursor location. Move"] - #[doc = " the cursor as necessary, scrolling if applicable."] - pub fn ncreader_write_egc(n: *mut ncreader, egc: *const cty::c_char) -> cty::c_int; -} -extern "C" { - #[doc = " return a heap-allocated copy of the current (UTF-8) contents."] - pub fn ncreader_contents(n: *const ncreader) -> *mut cty::c_char; -} -extern "C" { - #[doc = " destroy the reader and its bound plane. if 'contents' is not NULL, the"] - #[doc = " UTF-8 input will be heap-duplicated and written to 'contents'."] - pub fn ncreader_destroy(n: *mut ncreader, contents: *mut *mut cty::c_char); -} -extern "C" { - #[doc = " Dump selected Notcurses state to the supplied 'debugfp'. Output is freeform,"] - #[doc = " newline-delimited, and subject to change. It includes geometry of all"] - #[doc = " planes, from all piles. No line has more than 80 columns' worth of output."] - pub fn notcurses_debug(nc: *const notcurses, debugfp: *mut FILE); -} -extern "C" { - #[doc = " Dump selected configuration capabilities to 'debugfp'. Output is freeform,"] - #[doc = " newline-delimited, and subject to change."] - pub fn notcurses_debug_caps(nc: *const notcurses, debugfp: *mut FILE); -} -extern "C" { - #[doc = " This function will be removed in ABI3 in favor of ncplane_create()."] - #[doc = " It persists in ABI2 only for backwards compatibility."] - pub fn ncplane_new( - n: *mut ncplane, - rows: cty::c_int, - cols: cty::c_int, - y: cty::c_int, - x: cty::c_int, - opaque: *mut cty::c_void, - name: *const cty::c_char, - ) -> *mut ncplane; -} -extern "C" { - pub fn ncplane_styles_set(n: *mut ncplane, stylebits: cty::c_uint); -} -extern "C" { - pub fn ncplane_styles_on(n: *mut ncplane, stylebits: cty::c_uint); -} -extern "C" { - pub fn ncplane_styles_off(n: *mut ncplane, stylebits: cty::c_uint); -} -extern "C" { - #[doc = " Deprecated form of nctablet_plane()."] - pub fn nctablet_ncplane(t: *mut nctablet) -> *mut ncplane; -} -pub type palette256 = ncpalette; -pub type cell = nccell; -#[repr(C)] -#[derive(Debug)] -pub struct ncdirect { - _unused: [u8; 0], -} -extern "C" { - #[doc = " Initialize a direct-mode Notcurses context on the connected terminal at 'fp'."] - #[doc = " 'fp' must be a tty. You'll usually want stdout. Direct mode supports a"] - #[doc = " limited subset of Notcurses routines which directly affect 'fp', and neither"] - #[doc = " supports nor requires notcurses_render(). This can be used to add color and"] - #[doc = " styling to text in the standard output paradigm. 'flags' is a bitmask over"] - #[doc = " NCDIRECT_OPTION_*."] - #[doc = " Returns NULL on error, including any failure initializing terminfo."] - pub fn ncdirect_init(termtype: *const cty::c_char, fp: *mut FILE, flags: u64) -> *mut ncdirect; -} -extern "C" { - #[doc = " The same as ncdirect_init(), but without any multimedia functionality,"] - #[doc = " allowing for a svelter binary. Link with notcurses-core if this is used."] - pub fn ncdirect_core_init( - termtype: *const cty::c_char, - fp: *mut FILE, - flags: u64, - ) -> *mut ncdirect; -} -extern "C" { - #[doc = " Read a (heap-allocated) line of text using the Readline library Initializes"] - #[doc = " Readline the first time it's called. For input to be echoed to the terminal,"] - #[doc = " it is necessary that NCDIRECT_OPTION_INHIBIT_CBREAK be provided to"] - #[doc = " ncdirect_init(). Returns NULL on error."] - pub fn ncdirect_readline(nc: *mut ncdirect, prompt: *const cty::c_char) -> *mut cty::c_char; -} -extern "C" { - #[doc = " Direct mode. This API can be used to colorize and stylize output generated"] - #[doc = " outside of notcurses, without ever calling notcurses_render(). These should"] - #[doc = " not be intermixed with standard Notcurses rendering."] - pub fn ncdirect_set_fg_rgb(nc: *mut ncdirect, rgb: cty::c_uint) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_set_bg_rgb(nc: *mut ncdirect, rgb: cty::c_uint) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_set_fg_palindex(nc: *mut ncdirect, pidx: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_set_bg_palindex(nc: *mut ncdirect, pidx: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Returns the number of simultaneous colors claimed to be supported, or 1 if"] - #[doc = " there is no color support. Note that several terminal emulators advertise"] - #[doc = " more colors than they actually support, downsampling internally."] - pub fn ncdirect_palette_size(nc: *const ncdirect) -> cty::c_uint; -} -extern "C" { - #[doc = " Output the string |utf8| according to the channels |channels|. Note that"] - #[doc = " ncdirect_putstr() does not explicitly flush output buffers, so it will not"] - #[doc = " necessarily be immediately visible."] - pub fn ncdirect_putstr( - nc: *mut ncdirect, - channels: u64, - utf8: *const cty::c_char, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Formatted printing (plus alignment relative to the terminal). Returns the"] - #[doc = " number of columns printed on success."] - pub fn ncdirect_printf_aligned( - n: *mut ncdirect, - y: cty::c_int, - align: ncalign_e, - fmt: *const cty::c_char, - ... - ) -> cty::c_int; -} -extern "C" { - #[doc = " Force a flush. Returns 0 on success, -1 on failure."] - pub fn ncdirect_flush(nc: *const ncdirect) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_set_fg_default(nc: *mut ncdirect) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_set_bg_default(nc: *mut ncdirect) -> cty::c_int; -} -extern "C" { - #[doc = " Get the current number of columns/rows."] - pub fn ncdirect_dim_x(nc: *const ncdirect) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_dim_y(nc: *const ncdirect) -> cty::c_int; -} -extern "C" { - #[doc = " Returns a 16-bit bitmask of supported curses-style attributes"] - #[doc = " (NCSTYLE_UNDERLINE, NCSTYLE_BOLD, etc.) The attribute is only"] - #[doc = " indicated as supported if the terminal can support it together with color."] - #[doc = " For more information, see the \"ncv\" capability in terminfo(5)."] - pub fn ncdirect_supported_styles(nc: *const ncdirect) -> cty::c_uint; -} -extern "C" { - #[doc = " ncplane_styles_*() analogues"] - pub fn ncdirect_set_styles(n: *mut ncdirect, stylebits: cty::c_uint) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_on_styles(n: *mut ncdirect, stylebits: cty::c_uint) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_off_styles(n: *mut ncdirect, stylebits: cty::c_uint) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_styles(n: *mut ncdirect) -> cty::c_uint; -} -extern "C" { - #[doc = " Deprecated forms of above."] - pub fn ncdirect_styles_set(n: *mut ncdirect, stylebits: cty::c_uint) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_styles_on(n: *mut ncdirect, stylebits: cty::c_uint) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_styles_off(n: *mut ncdirect, stylebits: cty::c_uint) -> cty::c_int; -} -extern "C" { - #[doc = " Move the cursor in direct mode. -1 to retain current location on that axis."] - pub fn ncdirect_cursor_move_yx(n: *mut ncdirect, y: cty::c_int, x: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_cursor_enable(nc: *mut ncdirect) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_cursor_disable(nc: *mut ncdirect) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_cursor_up(nc: *mut ncdirect, num: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_cursor_left(nc: *mut ncdirect, num: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_cursor_right(nc: *mut ncdirect, num: cty::c_int) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_cursor_down(nc: *mut ncdirect, num: cty::c_int) -> cty::c_int; -} -extern "C" { - #[doc = " Get the cursor position, when supported. This requires writing to the"] - #[doc = " terminal, and then reading from it. If the terminal doesn't reply, or"] - #[doc = " doesn't reply in a way we understand, the results might be deleterious."] - pub fn ncdirect_cursor_yx( - n: *mut ncdirect, - y: *mut cty::c_int, - x: *mut cty::c_int, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Push or pop the cursor location to the terminal's stack. The depth of this"] - #[doc = " stack, and indeed its existence, is terminal-dependent."] - pub fn ncdirect_cursor_push(n: *mut ncdirect) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_cursor_pop(n: *mut ncdirect) -> cty::c_int; -} -extern "C" { - #[doc = " Clear the screen."] - pub fn ncdirect_clear(nc: *mut ncdirect) -> cty::c_int; -} -extern "C" { - #[doc = " Can we load images? This requires being built against FFmpeg/OIIO."] - pub fn ncdirect_canopen_images(n: *const ncdirect) -> bool; -} -extern "C" { - #[doc = " Is our encoding UTF-8? Requires LANG being set to a UTF8 locale."] - pub fn ncdirect_canutf8(n: *const ncdirect) -> bool; -} -extern "C" { - #[doc = " This function must successfully return before NCBLIT_PIXEL is available."] - #[doc = " Returns -1 on error, 0 for no support, or 1 if pixel output is supported."] - #[doc = " Must not be called concurrently with either input or rasterization."] - pub fn ncdirect_check_pixel_support(n: *mut ncdirect) -> cty::c_int; -} -extern "C" { - #[doc = " Draw horizontal/vertical lines using the specified channels, interpolating"] - #[doc = " between them as we go. The EGC may not use more than one column. For a"] - #[doc = " horizontal line, |len| cannot exceed the screen width minus the cursor's"] - #[doc = " offset. For a vertical line, it may be as long as you'd like; the screen"] - #[doc = " will scroll as necessary. All lines start at the current cursor position."] - pub fn ncdirect_hline_interp( - n: *mut ncdirect, - egc: *const cty::c_char, - len: cty::c_int, - h1: u64, - h2: u64, - ) -> cty::c_int; -} -extern "C" { - pub fn ncdirect_vline_interp( - n: *mut ncdirect, - egc: *const cty::c_char, - len: cty::c_int, - h1: u64, - h2: u64, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Draw a box with its upper-left corner at the current cursor position, having"] - #[doc = " dimensions |ylen|x|xlen|. See ncplane_box() for more information. The"] - #[doc = " minimum box size is 2x2, and it cannot be drawn off-screen. |wchars| is an"] - #[doc = " array of 6 wide characters: UL, UR, LL, LR, HL, VL."] - pub fn ncdirect_box( - n: *mut ncdirect, - ul: u64, - ur: u64, - ll: u64, - lr: u64, - wchars: *const wchar_t, - ylen: cty::c_int, - xlen: cty::c_int, - ctlword: cty::c_uint, - ) -> cty::c_int; -} -extern "C" { - #[doc = " ncdirect_box() with the rounded box-drawing characters"] - pub fn ncdirect_rounded_box( - n: *mut ncdirect, - ul: u64, - ur: u64, - ll: u64, - lr: u64, - ylen: cty::c_int, - xlen: cty::c_int, - ctlword: cty::c_uint, - ) -> cty::c_int; -} -extern "C" { - #[doc = " ncdirect_box() with the double box-drawing characters"] - pub fn ncdirect_double_box( - n: *mut ncdirect, - ul: u64, - ur: u64, - ll: u64, - lr: u64, - ylen: cty::c_int, - xlen: cty::c_int, - ctlword: cty::c_uint, - ) -> cty::c_int; -} -extern "C" { - #[doc = " See ppoll(2) for more detail. Provide a NULL 'ts' to block at length, a 'ts'"] - #[doc = " of 0 for non-blocking operation, and otherwise a timespec to bound blocking."] - #[doc = " Signals in sigmask (less several we handle internally) will be atomically"] - #[doc = " masked and unmasked per ppoll(2). '*sigmask' should generally contain all"] - #[doc = " signals. Returns a single Unicode code point, or (char32_t)-1 on error."] - #[doc = " 'sigmask' may be NULL. Returns 0 on a timeout. If an event is processed, the"] - #[doc = " return value is the 'id' field from that event. 'ni' may be NULL."] - pub fn ncdirect_getc( - n: *mut ncdirect, - ts: *const timespec, - sigmask: *mut sigset_t, - ni: *mut ncinput, - ) -> char32_t; -} -extern "C" { - #[doc = " Get a file descriptor suitable for input event poll()ing. When this"] - #[doc = " descriptor becomes available, you can call ncdirect_getc_nblock(),"] - #[doc = " and input ought be ready. This file descriptor is *not* necessarily"] - #[doc = " the file descriptor associated with stdin (but it might be!)."] - pub fn ncdirect_inputready_fd(n: *mut ncdirect) -> cty::c_int; -} -extern "C" { - #[doc = " Release 'nc' and any associated resources. 0 on success, non-0 on failure."] - pub fn ncdirect_stop(nc: *mut ncdirect) -> cty::c_int; -} -pub type ncdirectv = ncplane; -pub type ncdirectf = ncvisual; -#[doc = " FIXME this ought be used in the rendered mode API as well; it's currently"] -#[doc = " only used by direct mode. describes all geometries of an ncvisual--both those"] -#[doc = " which are inherent, and those in a given rendering regime. pixy and pixx are"] -#[doc = " the true internal pixel geometry, taken directly from the load (and updated"] -#[doc = " by ncvisual_resize()). cdimy/cdimx are the cell pixel geometry *at the time"] -#[doc = " of this call* (it can change with a font change, in which case all values"] -#[doc = " other than pixy/pixx are invalidated). rpixy/rpixx are the pixel geometry as"] -#[doc = " handed to the blitter, following any scaling. scaley/scalex are the number"] -#[doc = " of input pixels drawn to full cell; when using NCBLIT_PIXEL, they are"] -#[doc = " equivalent to cdimy/cdimx. rcelly/rcellx are the cell geometry as written by"] -#[doc = " the blitter, following any padding (there is padding whenever rpix{y, x} is"] -#[doc = " not evenly divided by scale{y, x}, and also sometimes for Sixel)."] -#[doc = " maxpixely/maxpixelx are defined only when NCBLIT_PIXEL is used, and specify"] -#[doc = " the largest bitmap that the terminal is willing to accept."] -#[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct ncvgeom { - #[doc = " true pixel geometry of ncvisual data"] - pub pixy: cty::c_int, - #[doc = " true pixel geometry of ncvisual data"] - pub pixx: cty::c_int, - #[doc = " terminal cell geometry when this was calculated"] - pub cdimy: cty::c_int, - #[doc = " terminal cell geometry when this was calculated"] - pub cdimx: cty::c_int, - #[doc = " rendered pixel geometry"] - pub rpixy: cty::c_int, - #[doc = " rendered pixel geometry"] - pub rpixx: cty::c_int, - #[doc = " rendered cell geometry"] - pub rcelly: cty::c_int, - #[doc = " rendered cell geometry"] - pub rcellx: cty::c_int, - #[doc = " pixels per filled cell"] - pub scaley: cty::c_int, - #[doc = " pixels per filled cell"] - pub scalex: cty::c_int, - #[doc = " only defined for NCBLIT_PIXEL"] - pub maxpixely: cty::c_int, - #[doc = " only defined for NCBLIT_PIXEL"] - pub maxpixelx: cty::c_int, -} -#[test] -fn bindgen_test_layout_ncvgeom() { - assert_eq!( - ::core::mem::size_of::(), - 48usize, - concat!("Size of: ", stringify!(ncvgeom)) - ); - assert_eq!( - ::core::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(ncvgeom)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).pixy as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ncvgeom), - "::", - stringify!(pixy) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).pixx as *const _ as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(ncvgeom), - "::", - stringify!(pixx) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).cdimy as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ncvgeom), - "::", - stringify!(cdimy) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).cdimx as *const _ as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(ncvgeom), - "::", - stringify!(cdimx) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).rpixy as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ncvgeom), - "::", - stringify!(rpixy) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).rpixx as *const _ as usize }, - 20usize, - concat!( - "Offset of field: ", - stringify!(ncvgeom), - "::", - stringify!(rpixx) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).rcelly as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ncvgeom), - "::", - stringify!(rcelly) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).rcellx as *const _ as usize }, - 28usize, - concat!( - "Offset of field: ", - stringify!(ncvgeom), - "::", - stringify!(rcellx) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).scaley as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ncvgeom), - "::", - stringify!(scaley) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).scalex as *const _ as usize }, - 36usize, - concat!( - "Offset of field: ", - stringify!(ncvgeom), - "::", - stringify!(scalex) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).maxpixely as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(ncvgeom), - "::", - stringify!(maxpixely) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).maxpixelx as *const _ as usize }, - 44usize, - concat!( - "Offset of field: ", - stringify!(ncvgeom), - "::", - stringify!(maxpixelx) - ) - ); -} -extern "C" { - #[doc = " Display an image using the specified blitter and scaling. The image may"] - #[doc = " be arbitrarily many rows -- the output will scroll -- but will only occupy"] - #[doc = " the column of the cursor, and those to the right. The render/raster process"] - #[doc = " can be split by using ncdirect_render_frame() and ncdirect_raster_frame()."] - pub fn ncdirect_render_image( - n: *mut ncdirect, - filename: *const cty::c_char, - align: ncalign_e, - blitter: ncblitter_e, - scale: ncscale_e, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Render an image using the specified blitter and scaling, but do not write"] - #[doc = " the result. The image may be arbitrarily many rows -- the output will scroll"] - #[doc = " -- but will only occupy the column of the cursor, and those to the right."] - #[doc = " To actually write (and free) this, invoke ncdirect_raster_frame(). 'maxx'"] - #[doc = " and 'maxy' (cell geometry, *not* pixel), if greater than 0, are used for"] - #[doc = " scaling; the terminal's geometry is otherwise used."] - pub fn ncdirect_render_frame( - n: *mut ncdirect, - filename: *const cty::c_char, - blitter: ncblitter_e, - scale: ncscale_e, - maxy: cty::c_int, - maxx: cty::c_int, - ) -> *mut ncdirectv; -} -extern "C" { - #[doc = " Takes the result of ncdirect_render_frame() and writes it to the output,"] - #[doc = " freeing it on all paths."] - pub fn ncdirect_raster_frame( - n: *mut ncdirect, - ncdv: *mut ncdirectv, - align: ncalign_e, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Load media from disk, but do not yet render it (presumably because you want"] - #[doc = " to get its geometry via ncdirect_geom_frame(), or to use the same file with"] - #[doc = " ncdirect_render_loaded_frame() multiple times). You must destroy the result"] - #[doc = " with ncdirectf_free();"] - pub fn ncdirectf_from_file(n: *mut ncdirect, filename: *const cty::c_char) -> *mut ncdirectf; -} -extern "C" { - #[doc = " Free a ncdirectf returned from ncdirectf_from_file()."] - pub fn ncdirectf_free(frame: *mut ncdirectf); -} -extern "C" { - #[doc = " Same as ncdirect_render_frame(), except 'frame' must already have been"] - #[doc = " loaded. A loaded frame may be rendered in different ways before it is"] - #[doc = " destroyed."] - pub fn ncdirectf_render( - n: *mut ncdirect, - frame: *mut ncdirectf, - blitter: ncblitter_e, - scale: ncscale_e, - maxy: cty::c_int, - maxx: cty::c_int, - ) -> *mut ncdirectv; -} -extern "C" { - #[doc = " Having loaded the frame 'frame', get the geometry of a potential render."] - pub fn ncdirectf_geom( - n: *mut ncdirect, - frame: *mut ncdirectf, - blitter: *mut ncblitter_e, - scale: ncscale_e, - maxy: cty::c_int, - maxx: cty::c_int, - geom: *mut ncvgeom, - ) -> cty::c_int; -} -extern "C" { - #[doc = " Load successive frames from a file, invoking 'streamer' on each."] - pub fn ncdirect_stream( - n: *mut ncdirect, - filename: *const cty::c_char, - streamer: ncstreamcb, - vopts: *mut ncvisual_options, - curry: *mut cty::c_void, - ) -> cty::c_int; -} -pub type __builtin_va_list = [__va_list_tag; 1usize]; -#[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] -pub struct __va_list_tag { - pub gp_offset: cty::c_uint, - pub fp_offset: cty::c_uint, - pub overflow_arg_area: *mut cty::c_void, - pub reg_save_area: *mut cty::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 Default for __va_list_tag { - fn default() -> Self { - unsafe { ::core::mem::zeroed() } - } -} diff --git a/tools/function-summary/history/changes-20201126-20211227.txt b/tools/function-summary/history/changes-20201126-20211227.txt deleted file mode 100644 index c257da3e7..000000000 --- a/tools/function-summary/history/changes-20201126-20211227.txt +++ /dev/null @@ -1,79 +0,0 @@ -0d0 - -Differences between files: -========================== -out-20201126/bindgen/ncdirect out-20201227/bindgen/ncdirect -out-20201126/bindgen/ncpile out-20201227/bindgen/ncpile -out-20201126/bindgen/ncplane out-20201227/bindgen/ncplane -out-20201126/bindgen/ncvisual out-20201227/bindgen/ncvisual -out-20201126/bindgen/notcurses out-20201227/bindgen/notcurses -out-20201126/static/cell out-20201227/static/cell -out-20201126/static/ncplane out-20201227/static/ncplane -out-20201126/static/ncvisual out-20201227/static/ncvisual - -broken down: -============ - -diff out-20201126/bindgen/ncdirect out-20201227/bindgen/ncdirect: -31a32,33 -> ncdirect_raster_frame -> ncdirect_render_frame - -diff out-20201126/bindgen/ncpile out-20201227/bindgen/ncpile: -0a1 -> ncpile_bottom -3a5 -> ncpile_top - -diff out-20201126/bindgen/ncplane out-20201227/bindgen/ncplane: -2a3 -> ncplane_at_cursor_cell -3a5 -> ncplane_at_yx_cell -60a63 -> ncplane_resize_maximize - -diff out-20201126/bindgen/ncvisual out-20201227/bindgen/ncvisual: -9a10 -> ncvisual_media_defblitter - -diff out-20201126/bindgen/notcurses out-20201227/bindgen/notcurses: -6a7 -> notcurses_cansextant -19a21,22 -> notcurses_linesigs_disable -> notcurses_linesigs_enable - -diff out-20201126/static/cell out-20201227/static/cell: -19a20 -> cell_load_egc32 - -diff out-20201126/static/ncplane out-20201227/static/ncplane: -2,3d1 -< ncplane_at_cursor_cell -< ncplane_at_yx_cell -9a8 -> ncplane_descendant_p - -diff out-20201126/static/ncvisual out-20201227/static/ncvisual: -1d0 -< ncvisual_default_blitter - -Only in one path: -================= -Only in out-20201227/bindgen: ncprogbar -Only in out-20201227/static: ncprogbar - -display contents: -================= - -cat out-20201227/bindgen/ncprogbar: -------------------- -ncprogbar_create -ncprogbar_destroy -ncprogbar_plane -ncprogbar_progress -ncprogbar_set_progress - -cat out-20201227/static/ncprogbar: -------------------- diff --git a/tools/function-summary/history/changes-20201227-20210321.txt b/tools/function-summary/history/changes-20201227-20210321.txt deleted file mode 100644 index 82e131d84..000000000 --- a/tools/function-summary/history/changes-20201227-20210321.txt +++ /dev/null @@ -1,104 +0,0 @@ -0d0 - -Differences between files: -========================== -out-20201227/bindgen/ncdirect out-20210321/bindgen/ncdirect -out-20201227/bindgen/ncplane out-20210321/bindgen/ncplane -out-20201227/bindgen/notcurses out-20210321/bindgen/notcurses -out-20201227/static/cell out-20210321/static/cell -out-20201227/static/channel out-20210321/static/channel -out-20201227/static/_NON_FILTERED out-20210321/static/_NON_FILTERED - -broken down: -============ - -diff out-20201227/bindgen/ncdirect out-20210321/bindgen/ncdirect: -1,3d0 -< ncdirect_bg_default -< ncdirect_bg_palindex -< ncdirect_bg_rgb -6a4 -> ncdirect_check_pixel_support -7a6 -> ncdirect_core_init -21,23d19 -< ncdirect_fg_default -< ncdirect_fg_palindex -< ncdirect_fg_rgb -28a25,26 -> ncdirect_off_styles -> ncdirect_on_styles -32a31 -> ncdirect_readline -35a35,41 -> ncdirect_set_bg_default -> ncdirect_set_bg_palindex -> ncdirect_set_bg_rgb -> ncdirect_set_fg_default -> ncdirect_set_fg_palindex -> ncdirect_set_fg_rgb -> ncdirect_set_styles - -diff out-20201227/bindgen/ncplane out-20210321/bindgen/ncplane: -1a2,4 -> ncplane_abs_x -> ncplane_abs_y -> ncplane_abs_yx - -diff out-20201227/bindgen/notcurses out-20210321/bindgen/notcurses: -2a3 -> notcurses_canbraille -6a8 -> notcurses_canpixel -8d9 -< notcurses_cansixel -10a12,13 -> notcurses_check_pixel_support -> notcurses_core_init - -diff out-20201227/static/cell out-20210321/static/cell: -1d0 -< cell_bchannel -11d9 -< cell_fchannel -24d21 -< cell_set_bchannel -31d27 -< cell_set_fchannel - -diff out-20201227/static/channel out-20210321/static/channel: -4a5 -> channel_palindex -10a12 -> channels_bg_palindex -17a20 -> channel_set_palindex -22a26 -> channels_fg_palindex - -diff out-20201227/static/_NON_FILTERED out-20210321/static/_NON_FILTERED: -0a1 -> ALLOC static inline char* - -Only in one path: -================= -Only in out-20210321/bindgen: nctree -Only in out-20210321/static: nctree - -display contents: -================= - -cat out-20210321/bindgen/nctree: -------------------- -nctree_create -nctree_destroy -nctree_focused -nctree_goto -nctree_next -nctree_offer_input -nctree_plane -nctree_prev -nctree_redraw - -cat out-20210321/static/nctree: -------------------- diff --git a/tools/function-summary/history/changes-20210321-20210406.txt b/tools/function-summary/history/changes-20210321-20210406.txt deleted file mode 100644 index 3b48516b3..000000000 --- a/tools/function-summary/history/changes-20210321-20210406.txt +++ /dev/null @@ -1,82 +0,0 @@ -0d0 - -Differences between files: -========================== -out-20210321/bindgen/ncplane out-20210406/bindgen/ncplane -out-20210321/bindgen/notcurses out-20210406/bindgen/notcurses -out-20210321/static/ncplane out-20210406/static/ncplane - -broken down: -============ - -diff out-20210321/bindgen/ncplane out-20210406/bindgen/ncplane: -65a66 -> ncplane_resize_marginalized - -diff out-20210321/bindgen/notcurses out-20210406/bindgen/notcurses: -8d7 -< notcurses_canpixel -16a16 -> notcurses_debug_caps - -diff out-20210321/static/ncplane out-20210406/static/ncplane: -1d0 -< ncplane_align -18a18 -> ncplane_halign -39a40 -> ncplane_valign - -Only in one path: -================= -Only in out-20210406/bindgen: nctab -Only in out-20210406/static: nctab - -display contents: -================= - -cat out-20210406/bindgen/nctab: -------------------- -nctabbed_add -nctabbed_channels -nctabbed_content_plane -nctabbed_create -nctabbed_del -nctabbed_destroy -nctabbed_ensure_selected_header_visible -nctabbed_leftmost -nctabbed_next -nctabbed_plane -nctabbed_prev -nctabbed_redraw -nctabbed_rotate -nctabbed_select -nctabbed_selected -nctabbed_separator -nctabbed_separator_width -nctabbed_set_hdrchan -nctabbed_set_selchan -nctabbed_set_separator -nctabbed_set_sepchan -nctabbed_tabcount -nctab_cb -nctablet_ncplane -nctablet_plane -nctablet_userptr -nctab_move -nctab_move_left -nctab_move_right -nctab_name -nctab_name_width -nctab_next -nctab_prev -nctab_set_cb -nctab_set_name -nctab_set_userptr -nctab_userptr - -cat out-20210406/static/nctab: -------------------- -nctabbed_hdrchan -nctabbed_selchan -nctabbed_sepchan diff --git a/tools/function-summary/history/changes-20210406-20210410.txt b/tools/function-summary/history/changes-20210406-20210410.txt deleted file mode 100644 index 669640eb2..000000000 --- a/tools/function-summary/history/changes-20210406-20210410.txt +++ /dev/null @@ -1,60 +0,0 @@ -0d0 - -Differences between files: -========================== -out-20210406/bindgen/ncdirect out-20210410/bindgen/ncdirect -out-20210406/bindgen/ncplane out-20210410/bindgen/ncplane -out-20210406/bindgen/ncvisual out-20210410/bindgen/ncvisual -out-20210406/static/ncplane out-20210410/static/ncplane -out-20210406/static/ncvisual out-20210410/static/ncvisual -out-20210406/static/_NON_FILTERED out-20210410/static/_NON_FILTERED - -broken down: -============ - -diff out-20210406/bindgen/ncdirect out-20210410/bindgen/ncdirect: -42a43 -> ncdirect_stream - -diff out-20210406/bindgen/ncplane out-20210410/bindgen/ncplane: -4a5 -> ncplane_as_rgba -46a48 -> ncplane_pixelgeom -69d70 -< ncplane_rgba - -diff out-20210406/bindgen/ncvisual out-20210410/bindgen/ncvisual: -1a2 -> ncvisual_blitter_geom -9d9 -< ncvisual_geom - -diff out-20210406/static/ncplane out-20210410/static/ncplane: -37a38 -> ncplane_rgba - -diff out-20210406/static/ncvisual out-20210410/static/ncvisual: -0a1 -> ncvisual_geom - -diff out-20210406/static/_NON_FILTERED out-20210410/static/_NON_FILTERED: -1a2 -> __attribute__ - -Only in one path: -================= -Only in out-20210406/bindgen: nctablet -Only in out-20210406/static: nctablet - -display contents: -================= - -cat out-20210406/bindgen/nctablet: -------------------- -nctablet_ncplane -nctablet_plane -nctablet_userptr - -cat out-20210406/static/nctablet: -------------------- diff --git a/tools/function-summary/history/changes-20210410-20210415.txt b/tools/function-summary/history/changes-20210410-20210415.txt deleted file mode 100644 index 89d12da88..000000000 --- a/tools/function-summary/history/changes-20210410-20210415.txt +++ /dev/null @@ -1,29 +0,0 @@ -0d0 - -Differences between files: -========================== -out-20210410/bindgen/cell out-20210415/bindgen/cell -out-20210410/bindgen/_NON_FILTERED out-20210415/bindgen/_NON_FILTERED - -broken down: -============ - -diff out-20210410/bindgen/cell out-20210415/bindgen/cell: -2d1 -< cell_extended_gcluster - -diff out-20210410/bindgen/_NON_FILTERED out-20210415/bindgen/_NON_FILTERED: -140a141,146 -> nccell_duplicate -> nccell_extended_gcluster -> nccell_load -> nccell_release -> nccells_double_box -> nccells_rounded_box - -Only in one path: -================= - - -display contents: -================= diff --git a/tools/function-summary/history/changes-20210415-20210418.txt b/tools/function-summary/history/changes-20210415-20210418.txt deleted file mode 100644 index 0ac09ed4a..000000000 --- a/tools/function-summary/history/changes-20210415-20210418.txt +++ /dev/null @@ -1,62 +0,0 @@ -0d0 - -Differences between files: -========================== -out-20210415/bindgen/ncvisual out-20210418/bindgen/ncvisual -out-20210415/static/_NON_FILTERED out-20210418/static/_NON_FILTERED - -broken down: -============ - -diff out-20210415/bindgen/ncvisual out-20210418/bindgen/ncvisual: -9a10 -> ncvisual_inflate - -diff out-20210415/static/_NON_FILTERED out-20210418/static/_NON_FILTERED: -23a24,39 -> __attribute__ -> __attribute__ -> __attribute__ -> __attribute__ -> __attribute__ -> __attribute__ -> __attribute__ -> __attribute__ -> __attribute__ -> __attribute__ -> __attribute__ -> __attribute__ -> __attribute__ -> __attribute__ -> __attribute__ -> __attribute__ -25a42,46 -> nccell_bg_alpha -> nccell_bg_default_p -> nccell_bg_palindex -> nccell_bg_palindex_p -> nccell_bg_rgb -27a49 -> nccell_double_wide_p -28a51,55 -> nccell_fg_alpha -> nccell_fg_default_p -> nccell_fg_palindex -> nccell_fg_palindex_p -> nccell_fg_rgb -37a65 -> nccell_set_bg_palindex -39a68 -> nccell_set_bg_rgb8_clipped -41a71 -> nccell_set_fg_palindex -48a79,80 -> nccell_wide_left_p -> nccell_wide_right_p - -Only in one path: -================= - - -display contents: -================= diff --git a/tools/function-summary/history/changes-20210418-20210603.txt b/tools/function-summary/history/changes-20210418-20210603.txt deleted file mode 100644 index aed6dd8b0..000000000 --- a/tools/function-summary/history/changes-20210418-20210603.txt +++ /dev/null @@ -1,470 +0,0 @@ -0d0 - -Differences between files: -========================== -out-20210418/bindgen/cell out-20210603/bindgen/cell -out-20210418/bindgen/ncblit out-20210603/bindgen/ncblit -out-20210418/bindgen/ncdirect out-20210603/bindgen/ncdirect -out-20210418/bindgen/ncplane out-20210603/bindgen/ncplane -out-20210418/bindgen/_NON_FILTERED out-20210603/bindgen/_NON_FILTERED -out-20210418/bindgen/notcurses out-20210603/bindgen/notcurses -out-20210418/bindgen/palette out-20210603/bindgen/palette -out-20210418/static/cell out-20210603/static/cell -out-20210418/static/ncplane out-20210603/static/ncplane -out-20210418/static/ncvisual out-20210603/static/ncvisual -out-20210418/static/_NON_FILTERED out-20210603/static/_NON_FILTERED - -broken down: -============ - -diff out-20210418/bindgen/cell out-20210603/bindgen/cell: -1,5d0 -< cell_duplicate -< cell_load -< cell_release -< cells_double_box -< cells_rounded_box - -diff out-20210418/bindgen/ncblit out-20210603/bindgen/ncblit: -2a3,4 -> ncblit_rgb_loose -> ncblit_rgb_packed - -diff out-20210418/bindgen/ncdirect out-20210603/bindgen/ncdirect: -19a20,22 -> ncdirectf_free -> ncdirectf_from_file -> ncdirectf_geom -20a24 -> ncdirectf_render -43a48 -> ncdirect_styles -46a52 -> ncdirect_supported_styles - -diff out-20210418/bindgen/ncplane out-20210603/bindgen/ncplane: -22a23 -> ncplane_erase_region - -diff out-20210418/bindgen/_NON_FILTERED out-20210603/bindgen/_NON_FILTERED: -1,6d0 -< abort -< abs -< accept -< aligned_alloc -< asctime -< asctime_r -9,140d2 -< atexit -< atof -< atoi -< atol -< atoll -< at_quick_exit -< bind -< bsearch -< btowc -< c16rtomb -< c32rtomb -< calloc -< clearerr -< clock -< __cmsg_nxthdr -< connect -< ctermid -< ctime -< ctime_r -< __ctype_b_loc -< __ctype_get_mb_cur_max -< __ctype_tolower_loc -< __ctype_toupper_loc -< cuserid -< difftime -< div -< drand48 -< erand48 -< exit -< _Exit -< fclose -< fdopen -< feof -< ferror -< fflush -< fgetc -< fgetpos -< fgets -< fgetwc -< fgetws -< fileno -< fopen -< fprintf -< fputc -< fputs -< fputwc -< fputws -< fread -< free -< freopen -< fscanf -< fscanf1 -< fseek -< fsetpos -< ftell -< fwide -< fwprintf -< fwrite -< fwscanf -< fwscanf1 -< getc -< getchar -< getenv -< getopt -< getpeername -< getsockname -< getsockopt -< getw -< getwc -< getwchar -< gmtime -< gmtime_r -< htonl -< htons -< isalnum -< isalpha -< isascii -< isblank -< iscntrl -< isdigit -< isgraph -< islower -< isprint -< ispunct -< isspace -< isupper -< iswalnum -< iswalpha -< iswblank -< iswcntrl -< iswctype -< iswdigit -< iswgraph -< iswlower -< iswprint -< iswpunct -< iswspace -< iswupper -< iswxdigit -< isxdigit -< jrand48 -< kill -< labs -< lcong48 -< ldiv -< __libc_current_sigrtmax -< __libc_current_sigrtmin -< listen -< llabs -< lldiv -< localtime -< localtime_r -< lrand48 -< malloc -< mblen -< __mbrlen -< mbrlen -< mbrtoc16 -< mbrtoc32 -< mbrtowc -< mbsinit -< mbsrtowcs -< mbstowcs -< mbtowc -< memccpy -< memchr -< memcmp -< memcpy -< memmove -< memset -< mktime -< mrand48 -146a9,12 -> nccell_width -> ncpalette_free -> ncpalette_new -> ncpalette_use -148,183d13 -< nrand48 -< ntohl -< ntohs -< __overflow -< pclose -< perror -< popen -< printf -< putc -< putchar -< putenv -< puts -< putw -< putwc -< putwchar -< qsort -< quick_exit -< raise -< rand -< realloc -< recv -< recvfrom -< recvmsg -< remove -< rename -< rewind -< scanf -< scanf1 -< seed48 -< send -< sendmsg -< sendto -< setbuf -< setsockopt -< setvbuf -< shutdown -189a20 -> signal -193,305d23 -< snprintf -< socket -< socketpair -< sprintf -< srand -< srand48 -< sscanf -< sscanf1 -< strcat -< strchr -< strcmp -< strcoll -< strcpy -< strcspn -< strerror -< strftime -< strlen -< strncat -< strncmp -< strncpy -< strpbrk -< strptime -< strrchr -< strspn -< strstr -< strtod -< strtof -< strtok -< __strtok_r -< strtok_r -< strtol -< strtoll -< strtoul -< strtoull -< strxfrm -< swprintf -< swscanf -< swscanf1 -< __sysconf -< system -< __sysv_signal -< tempnam -< time -< timespec_get -< tmpfile -< tmpnam -< toascii -< _tolower -< tolower -< _toupper -< toupper -< towlower -< towupper -< tzset -< __uflow -< ungetc -< ungetwc -< vfprintf -< vfscanf -< vfscanf1 -< vfwprintf -< vfwscanf -< vprintf -< vscanf -< vscanf1 -< vsnprintf -< vsprintf -< vsscanf -< vsscanf1 -< vswprintf -< vswscanf -< vwprintf -< vwscanf -< wcrtomb -< wcscat -< wcschr -< wcscmp -< wcscoll -< wcscpy -< wcscspn -< wcsftime -< wcslen -< wcsncat -< wcsncmp -< wcsncpy -< wcspbrk -< wcsrchr -< wcsrtombs -< wcsspn -< wcsstr -< wcstod -< wcstof -< wcstok -< wcstol -< wcstoll -< wcstombs -< wcstoul -< wcstoull -< wcswcs -< wcswidth -< wcsxfrm -< wctob -< wctomb -< wctype -< wcwidth -< wmemchr -< wmemcmp -< wmemcpy -< wmemmove -< wmemset -< wprintf -< wscanf -< wscanf1 - -diff out-20210418/bindgen/notcurses out-20210603/bindgen/notcurses: -5a6 -> notcurses_canhalfblock -7a9 -> notcurses_canquadrant -14a17 -> notcurses_cursor_yx - -diff out-20210418/bindgen/palette out-20210603/bindgen/palette: -1,3d0 -< palette256_free -< palette256_new -< palette256_use - -diff out-20210418/static/cell out-20210603/static/cell: -9d8 -< cell_extended_gcluster - -diff out-20210418/static/ncplane out-20210603/static/ncplane: -0a1 -> ncplane_align - -diff out-20210418/static/ncvisual out-20210603/static/ncvisual: -0a1 -> ncvisual_default_blitter -1a3 -> ncvisualplane_create - -diff out-20210418/static/_NON_FILTERED out-20210603/static/_NON_FILTERED: -4,39d3 -< __attribute__ -< __attribute__ -< __attribute__ -< __attribute__ -< __attribute__ -< __attribute__ -< __attribute__ -< __attribute__ -< __attribute__ -< __attribute__ -< __attribute__ -< __attribute__ -< __attribute__ -< __attribute__ -< __attribute__ -< __attribute__ -< __attribute__ -< __attribute__ -< __attribute__ -< __attribute__ -< __attribute__ -< __attribute__ -< __attribute__ -< __attribute__ -< __attribute__ -< __attribute__ -< __attribute__ -< __attribute__ -< __attribute__ -< __attribute__ -< __attribute__ -< __attribute__ -< __attribute__ -< __attribute__ -< __attribute__ -< __attribute__ -80a45,87 -> ncchannel_alpha -> ncchannel_b -> ncchannel_default_p -> ncchannel_g -> ncchannel_palindex -> ncchannel_palindex_p -> ncchannel_r -> ncchannel_rgb8 -> ncchannels_bchannel -> ncchannels_bg_alpha -> ncchannels_bg_default_p -> ncchannels_bg_palindex -> ncchannels_bg_palindex_p -> ncchannels_bg_rgb -> ncchannels_bg_rgb8 -> ncchannels_combine -> ncchannel_set -> ncchannel_set_alpha -> ncchannel_set_default -> ncchannel_set_palindex -> ncchannel_set_rgb8 -> ncchannel_set_rgb8_clipped -> ncchannels_fchannel -> ncchannels_fg_alpha -> ncchannels_fg_default_p -> ncchannels_fg_palindex -> ncchannels_fg_palindex_p -> ncchannels_fg_rgb -> ncchannels_fg_rgb8 -> ncchannels_set_bchannel -> ncchannels_set_bg_alpha -> ncchannels_set_bg_default -> ncchannels_set_bg_palindex -> ncchannels_set_bg_rgb -> ncchannels_set_bg_rgb8 -> ncchannels_set_bg_rgb8_clipped -> ncchannels_set_fchannel -> ncchannels_set_fg_alpha -> ncchannels_set_fg_default -> ncchannels_set_fg_palindex -> ncchannels_set_fg_rgb -> ncchannels_set_fg_rgb8 -> ncchannels_set_fg_rgb8_clipped -81a89,92 -> ncinput_nomod_p -> ncpalette_set -> ncpalette_get_rgb8 -> ncpalette_set_rgb8 - -Only in one path: -================= - - -display contents: -================= diff --git a/tools/release.sh b/tools/release.sh index 40978e0f1..9560e5ff3 100755 --- a/tools/release.sh +++ b/tools/release.sh @@ -35,8 +35,6 @@ done sed -i -e "s/v$OLDVERSION/v$VERSION/g" doc/man/index.html sed -i -e "s/version=\"$OLDVERSION\"/version=\"$VERSION\"/" cffi/setup.py sed -i -e "s/version=\"$OLDVERSION\"/version=\"$VERSION\"/" python/setup.py -sed -i -e "s/^version = \"$OLDVERSION\"$/version = \"$VERSION\"/" rust/Cargo.toml -sed -i -e "s/atleast_version(\"$OLDVERSION\")/atleast_version(\"$VERSION\")/" rust/build/build.rs BUILDDIR="build-$VERSION" @@ -80,12 +78,6 @@ cd ../cffi python3 setup.py sdist python3 setup.py build twine upload -s -udankamongmen dist/* -cd ../rust -cargo clean -cargo publish - -cd ../tools/ -./rustdoc-update-gh-pages.sh cd "../$BUILDDIR" cat install_manifest.txt | sudo xargs rm diff --git a/tools/rustdoc-update-gh-pages.sh b/tools/rustdoc-update-gh-pages.sh deleted file mode 100755 index fdf7c8919..000000000 --- a/tools/rustdoc-update-gh-pages.sh +++ /dev/null @@ -1,118 +0,0 @@ -#!/bin/sh -# -# SCRIPT TO BUILD THE RUST DOCS FROM THE GITHUB REPO -# -# Make sure you have the notcurses dependencies installed, -# and your github credentials in order, so that you can push. -# -# This script: -# - clones the full notcurses repo inside $WORKING_DIR -# - compiles & installs notcurses inside $WORKING_DIR -# - compiles the rust documentation inside $WORKING_DIR -# - commits and pushes the new docs to the $DOCS_BRANCH branch -# - deletes $WORKING_DIR -# -# WARNING: This script: -# - Does NOT fetch the latest tag, but the master branch. -# - Does NOT check first the version in $DOCS_BRANCH, but commits always. -# -# This script is intended to be used just once per release, -# and immediately after the release is published. -# -# The decision to clone and compile everything from scratch has been made -# in order to not risk interfering with the actual working repository, since -# switching between branches can be very messy in certain situations. -# -set -e - - -WORKING_DIR=rustdoc-build -DOCS_BRANCH="gh-pages" - - -# 1. CLONE REPO & COMPILE NOTCURSES -# -# - contain everything in a subfolder - -git clone git@github.com:dankamongmen/notcurses.git $WORKING_DIR -if [ $? -ne 0 ]; then - echo "ERROR cloning notcurses repo via SSH protocol." - exit -fi - -cd $WORKING_DIR -rm -rf build -mkdir -p build -cd build - -cmake -DCMAKE_INSTALL_PREFIX=./usr/ .. -if [ $? -ne 0 ]; then - echo "ERROR configuring notcurses with cmake." - exit -fi - -make -j`nproc` -if [ $? -ne 0 ]; then - echo "ERROR compiling notcurses." - exit -fi - -make install -if [ $? -ne 0 ]; then - echo "ERROR installing notcurses." - exit -fi - -export PKG_CONFIG_PATH=`pwd`/usr/lib/pkgconfig - - -# 2. BUILD THE RUST DOCS -# -# - -cd ../rust -unset CARGO_TARGET_DIR - -cargo doc --no-deps -if [ $? -ne 0 ]; then - echo "ERROR building rust docs." - exit -fi - -VERSION=`grep ^version Cargo.toml | cut -d'"' -f2` - - -# 3. UPDATE REPO -# -# - -git checkout $DOCS_BRANCH -if [ $? -ne 0 ]; then - echo "ERROR switching to $DOCS_BRANCH branch." - exit -fi - -cd .. - -rm -rf rustdoc -mv rust/target/doc rustdoc - -git add rustdoc -git commit -m "update rust docs to $VERSION" -if [ $? -ne 0 ]; then - echo "ERROR commiting version $VERSION." - exit -fi - -git push -if [ $? -ne 0 ]; then - echo "ERROR pushing version $VERSION to $DOCS_BRANCH branch." - exit -fi - -cd .. -rm -rf $WORKING_DIR - -git pull - -echo "Done!"