mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-10 09:39:03 -04:00
make it compatible with no_std environment
This commit is contained in:
parent
799407f98c
commit
0362a11f63
@ -19,7 +19,12 @@ categories = [
|
|||||||
keywords = ["tui", "cli", "terminal", "ncurses", "ffi"]
|
keywords = ["tui", "cli", "terminal", "ncurses", "ffi"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
libc = "0.2.74"
|
libc = {version = "0.2.74", default-features = false}
|
||||||
|
cty = "0.2.1"
|
||||||
|
# blocked by: https://github.com/Amanieu/cstr_core/issues/4
|
||||||
|
# cstr_core = "0.2"
|
||||||
|
cstr_core = {path = "../../../../_temp_clones/cstr_core"}
|
||||||
|
libc-print = "0.1.13"
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
bindgen = ">= 0.52.0"
|
bindgen = ">= 0.52.0"
|
||||||
|
@ -21,6 +21,8 @@ fn main() {
|
|||||||
// The bindgen::Builder is the main entry point to bindgen, and lets you
|
// The bindgen::Builder is the main entry point to bindgen, and lets you
|
||||||
// build up options for the resulting bindings.
|
// build up options for the resulting bindings.
|
||||||
let mut builder = bindgen::Builder::default()
|
let mut builder = bindgen::Builder::default()
|
||||||
|
.use_core()
|
||||||
|
.ctypes_prefix("cty")
|
||||||
.clang_arg("-D_XOPEN_SOURCE")
|
.clang_arg("-D_XOPEN_SOURCE")
|
||||||
// The input header we would like to generate
|
// The input header we would like to generate
|
||||||
// builder for.
|
// builder for.
|
||||||
|
@ -66,7 +66,7 @@
|
|||||||
// - ? gcluster (&str) > type alias?
|
// - ? gcluster (&str) > type alias?
|
||||||
// - ? attr (u32) > type alias?
|
// - ? attr (u32) > type alias?
|
||||||
|
|
||||||
use std::ffi::CString;
|
use cstr_core::CString;
|
||||||
|
|
||||||
use crate as ffi;
|
use crate as ffi;
|
||||||
use crate::types::{ChannelPair, IntResult};
|
use crate::types::{ChannelPair, IntResult};
|
||||||
@ -141,7 +141,6 @@ pub fn cells_load_box(
|
|||||||
// return -1;
|
// return -1;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
// static inline void
|
// static inline void
|
||||||
// cell_init(cell* c){
|
// cell_init(cell* c){
|
||||||
// memset(c, 0, sizeof(*c));
|
// memset(c, 0, sizeof(*c));
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#![allow(non_upper_case_globals)]
|
#![allow(non_upper_case_globals)]
|
||||||
#![allow(non_camel_case_types)]
|
#![allow(non_camel_case_types)]
|
||||||
#![allow(non_snake_case)]
|
#![allow(non_snake_case)]
|
||||||
|
#![no_std]
|
||||||
|
|
||||||
mod cells;
|
mod cells;
|
||||||
mod channel;
|
mod channel;
|
||||||
@ -23,9 +24,10 @@ include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use std::ffi::{CStr, CString};
|
use core::ptr::{null, null_mut};
|
||||||
use std::ptr::{null, null_mut};
|
use cstr_core::{CStr, CString};
|
||||||
|
|
||||||
|
use libc_print::*;
|
||||||
use serial_test::serial; // serialize tests w/ ffi::notcurses_init()
|
use serial_test::serial; // serialize tests w/ ffi::notcurses_init()
|
||||||
|
|
||||||
use crate as ffi;
|
use crate as ffi;
|
||||||
@ -39,7 +41,7 @@ mod tests {
|
|||||||
CStr::from_ptr(s)
|
CStr::from_ptr(s)
|
||||||
};
|
};
|
||||||
let r_str = c_str.to_str().unwrap();
|
let r_str = c_str.to_str().unwrap();
|
||||||
println!("rust-bound notcurses v{}", r_str);
|
libc_println!("rust-bound notcurses v{}", r_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -140,8 +140,8 @@
|
|||||||
// ncplane_vline
|
// ncplane_vline
|
||||||
// ncplane_vprintf
|
// ncplane_vprintf
|
||||||
|
|
||||||
use std::ffi::CString;
|
use core::ptr::null_mut;
|
||||||
use std::ptr::null_mut;
|
use cstr_core::CString;
|
||||||
|
|
||||||
use crate as ffi;
|
use crate as ffi;
|
||||||
use ffi::types::IntResult;
|
use ffi::types::IntResult;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user