Browse Source

ctru-sys: recreate types.h and libc bindings

pull/10/head
Fenrir 8 years ago
parent
commit
63d8c50b48
  1. 1
      ctru-sys/src/gpu/shaderProgram.rs
  2. 5
      ctru-sys/src/lib.rs
  3. 1
      ctru-sys/src/os.rs
  4. 3
      ctru-sys/src/services/cam.rs
  5. 3
      ctru-sys/src/services/gspgpu.rs
  6. 1
      ctru-sys/src/services/hid.rs
  7. 1
      ctru-sys/src/services/irrst.rs
  8. 3
      ctru-sys/src/services/y2r.rs
  9. 63
      ctru-sys/src/sys/libc.rs
  10. 2
      ctru-sys/src/sys/mod.rs
  11. 52
      ctru-sys/src/types.rs

1
ctru-sys/src/gpu/shaderProgram.rs

@ -1,4 +1,3 @@ @@ -1,4 +1,3 @@
use ::Result;
use ::types::*;
use gpu::shbin::*;

5
ctru-sys/src/lib.rs

@ -25,8 +25,3 @@ pub mod types; @@ -25,8 +25,3 @@ pub mod types;
pub use self::sys::*;
pub use self::types::*;
pub type Result = i32;
pub type Handle = u32;
pub type ThreadFunc = Option<extern "C" fn(arg1: *mut libc::c_void) -> ()>;

1
ctru-sys/src/os.rs

@ -1,6 +1,5 @@ @@ -1,6 +1,5 @@
//TODO: Fix Bindgen's issues again.
use ::Result;
use libc::c_void;
use types::*;

3
ctru-sys/src/services/cam.rs

@ -1,7 +1,6 @@ @@ -1,7 +1,6 @@
// TODO: Determine if anonymous enums are properly represented (they probably aren't)
use ::{Handle, Result};
use libc::c_void;
use ::libc::c_void;
use ::types::*;
#[derive(Clone, Copy)]

3
ctru-sys/src/services/gspgpu.rs

@ -1,4 +1,3 @@ @@ -1,4 +1,3 @@
use ::{Handle, Result};
use ::libc::c_void;
use ::types::*;
@ -74,8 +73,6 @@ pub enum GSPGPU_Event { @@ -74,8 +73,6 @@ pub enum GSPGPU_Event {
GSPGPU_EVENT_MAX = 7,
}
use ThreadFunc;
extern "C" {
pub fn gspInit() -> Result;
pub fn gspExit();

1
ctru-sys/src/services/hid.rs

@ -1,5 +1,4 @@ @@ -1,5 +1,4 @@
use ::types::*;
use ::{Result, Handle};
pub const HID_SHAREDMEM_DEFAULT: u32 = 0x10000000;

1
ctru-sys/src/services/irrst.rs

@ -1,4 +1,3 @@ @@ -1,4 +1,3 @@
use ::{Result, Handle};
use ::types::*;
use super::hid::circlePosition;

3
ctru-sys/src/services/y2r.rs

@ -1,6 +1,5 @@ @@ -1,6 +1,5 @@
use ::{Handle, Result};
use ::libc::c_void;
use ::types::*;
use ::libc::c_void;
#[derive(Clone, Copy)]
#[repr(C)]

63
ctru-sys/src/sys/libc.rs

@ -1,3 +1,8 @@ @@ -1,3 +1,8 @@
#![allow(dead_code,
non_camel_case_types,
non_upper_case_globals,
non_snake_case)]
pub const STDOUT_FILENO: c_int = 1;
#[repr(u8)]
@ -19,10 +24,66 @@ pub type c_longlong = i64; @@ -19,10 +24,66 @@ pub type c_longlong = i64;
pub type c_ulonglong = u64;
pub type c_float = f32;
pub type c_double = f64;
pub type size_t = usize;
pub type ssize_t = isize;
pub type u_char = c_uchar;
pub type u_short = c_ushort;
pub type u_int = c_uint;
pub type u_long = c_ulong;
pub type ushort = c_ushort;
pub type uint_ = c_uint;
pub type ulong = c_ulong;
pub type clock_t = c_ulong;
pub type time_t = c_long;
#[repr(C)]
#[derive(Copy, Clone)]
#[derive(Debug)]
pub struct timespec {
pub tv_sec: time_t,
pub tv_nsec: c_long,
}
impl ::core::default::Default for timespec {
fn default() -> Self { unsafe { ::core::mem::zeroed() } }
}
#[repr(C)]
#[derive(Copy, Clone)]
#[derive(Debug)]
pub struct itimerspec {
pub it_interval: timespec,
pub it_value: timespec,
}
impl ::core::default::Default for itimerspec {
fn default() -> Self { unsafe { ::core::mem::zeroed() } }
}
pub type daddr_t = c_long;
pub type caddr_t = *mut c_char;
pub type ino_t = c_uint;
pub type off_t = c_long;
pub type dev_t = c_int;
pub type uid_t = c_ushort;
pub type gid_t = c_ushort;
pub type pid_t = c_int;
pub type key_t = c_long;
pub type mode_t = c_uint;
pub type nlink_t = c_ushort;
pub type fd_mask = c_long;
#[repr(C)]
#[derive(Copy, Clone)]
#[derive(Debug)]
pub struct _types_fd_set {
pub fds_bits: [fd_mask; 1usize],
}
impl ::core::default::Default for _types_fd_set {
fn default() -> Self { unsafe { ::core::mem::zeroed() } }
}
pub type clockid_t = c_ulong;
pub type timer_t = c_ulong;
pub type useconds_t = c_ulong;
pub type suseconds_t = c_long;
pub type fsblkcnt_t = c_uint;
pub type fsfilcnt_t = c_uint;
extern "C" {
pub fn memchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void;
pub fn memrchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void;

2
ctru-sys/src/sys/mod.rs

@ -1,2 +1,2 @@ @@ -1,2 +1,2 @@
pub mod lock;
pub mod libc;
pub mod lock;

52
ctru-sys/src/types.rs

@ -1,35 +1,27 @@ @@ -1,35 +1,27 @@
#[repr(C)]
pub enum mediatypes_enum {
mediatype_NAND = 0,
mediatype_SDMC = 1,
mediatype_GAMECARD = 2,
}
/* automatically generated by rust-bindgen */
#![allow(dead_code,
non_camel_case_types,
non_upper_case_globals,
non_snake_case)]
pub type u8_ = u8;
pub type u16_ = u16;
pub type u32_ = u32;
pub type u64_ = u64;
pub type s8 = i8;
pub type s16 = i16;
pub type s32 = i32;
pub type s64 = i64;
// UHH, DUNNO HOW TO USE VOLATILES ????
pub type vu8 = u8;
pub type vu32 = u32;
// typedef uint8_t u8;
// typedef uint16_t u16;
// typedef uint32_t u32;
// typedef uint64_t u64;
//
// typedef int8_t s8;
// typedef int16_t s16;
// typedef int32_t s32;
// typedef int64_t s64;
//
// typedef volatile u8 vu8;
// typedef volatile u16 vu16;
// typedef volatile u32 vu32;
// typedef volatile u64 vu64;
//
// typedef volatile s8 vs8;
// typedef volatile s16 vs16;
// typedef volatile s32 vs32;
// typedef volatile s64 vs64;
pub type vu8 = u8_;
pub type vu16 = u16_;
pub type vu32 = u32_;
pub type vu64 = u64_;
pub type vs8 = s8;
pub type vs16 = s16;
pub type vs32 = s32;
pub type vs64 = s64;
pub type Handle = u32_;
pub type Result = s32;
pub type ThreadFunc =
::core::option::Option<unsafe extern "C" fn(arg1: *mut ::libc::c_void)>;
pub type voidfn = ::core::option::Option<extern "C" fn()>;

Loading…
Cancel
Save