From 977ca5489339feb0abd3454f20203d7be2051eb4 Mon Sep 17 00:00:00 2001 From: Nicholas Mazzuca Date: Mon, 16 Mar 2015 09:57:26 -0700 Subject: [PATCH] Change sdl2-sys to #![no_std] --- sdl2-sys/src/audio.rs | 9 +++------ sdl2-sys/src/controller.rs | 1 + sdl2-sys/src/event.rs | 1 + sdl2-sys/src/haptic.rs | 1 + sdl2-sys/src/lib.rs | 3 +++ sdl2-sys/src/rect.rs | 5 +++-- sdl2-sys/src/timer.rs | 4 ++-- sdl2-sys/src/video.rs | 1 + 8 files changed, 15 insertions(+), 10 deletions(-) diff --git a/sdl2-sys/src/audio.rs b/sdl2-sys/src/audio.rs index f3743780..9e7d5343 100644 --- a/sdl2-sys/src/audio.rs +++ b/sdl2-sys/src/audio.rs @@ -1,3 +1,4 @@ +use core::prelude::*; use libc::{c_int, c_uint, c_void, uint8_t, uint32_t}; use libc::{uint16_t, c_double, c_char}; use super::rwops::SDL_RWops; @@ -24,9 +25,7 @@ pub const AUDIO_S32SYS : SDL_AudioFormat = AUDIO_S32LSB; pub const AUDIO_F32SYS : SDL_AudioFormat = AUDIO_F32LSB; pub type SDL_AudioCallback = - ::std::option::Option; + Option; #[allow(missing_copy_implementations)] #[repr(C)] pub struct SDL_AudioSpec { @@ -41,9 +40,7 @@ pub struct SDL_AudioSpec { pub userdata: *const c_void, } pub type SDL_AudioFilter = - ::std::option::Option; + Option; #[allow(dead_code, missing_copy_implementations, raw_pointer_derive)] #[derive(Copy)] #[repr(C)] diff --git a/sdl2-sys/src/controller.rs b/sdl2-sys/src/controller.rs index 16976df6..e85a7590 100644 --- a/sdl2-sys/src/controller.rs +++ b/sdl2-sys/src/controller.rs @@ -1,3 +1,4 @@ +use core::prelude::*; use libc::{c_int, c_char, c_uchar, c_uint, c_void, int16_t, uint8_t}; use joystick::{SDL_Joystick, SDL_JoystickGUID}; diff --git a/sdl2-sys/src/event.rs b/sdl2-sys/src/event.rs index 29ddb180..5bd55005 100644 --- a/sdl2-sys/src/event.rs +++ b/sdl2-sys/src/event.rs @@ -6,6 +6,7 @@ use gesture::SDL_GestureID; use keyboard::SDL_Keysym; use touch::SDL_FingerID; use touch::SDL_TouchID; +use core::prelude::*; pub type SDL_bool = c_int; diff --git a/sdl2-sys/src/haptic.rs b/sdl2-sys/src/haptic.rs index 0608f506..83039741 100644 --- a/sdl2-sys/src/haptic.rs +++ b/sdl2-sys/src/haptic.rs @@ -1,4 +1,5 @@ use joystick::SDL_Joystick; +use core::prelude::*; use libc::{c_int, c_uint, c_char, c_float, c_void, int16_t, int32_t, uint8_t, uint16_t, uint32_t}; pub const SDL_HAPTIC_CONSTANT: uint16_t = 1 << 0; diff --git a/sdl2-sys/src/lib.rs b/sdl2-sys/src/lib.rs index 2a9a181c..28fc7b82 100644 --- a/sdl2-sys/src/lib.rs +++ b/sdl2-sys/src/lib.rs @@ -1,6 +1,9 @@ +#![feature(no_std, core)] +#![no_std] #![allow(non_camel_case_types)] extern crate libc; +extern crate core; pub mod scancode; pub mod keycode; diff --git a/sdl2-sys/src/rect.rs b/sdl2-sys/src/rect.rs index e26955e8..573a27b7 100644 --- a/sdl2-sys/src/rect.rs +++ b/sdl2-sys/src/rect.rs @@ -2,7 +2,8 @@ Rectangle Functions */ -use std::mem; +use core::prelude::*; +use core::intrinsics::transmute; use libc::c_int; /// A structure that defines a two dimensional point. @@ -71,7 +72,7 @@ impl Rect { ll::SDL_EnclosePoints( points.as_ptr(), points.len() as c_int, - mem::transmute(clip.as_ref()), + transmute(clip.as_ref()), &out ) != 0 }; diff --git a/sdl2-sys/src/timer.rs b/sdl2-sys/src/timer.rs index 1e29222f..b4a7791d 100644 --- a/sdl2-sys/src/timer.rs +++ b/sdl2-sys/src/timer.rs @@ -1,9 +1,9 @@ +use core::prelude::*; use libc::{uint32_t, uint64_t, c_void, c_int}; //SDL_timer.h pub type SDL_TimerCallback = - ::std::option::Option uint32_t>; + Option uint32_t>; pub type SDL_TimerID = c_int; extern "C" { pub fn SDL_GetTicks() -> uint32_t; diff --git a/sdl2-sys/src/video.rs b/sdl2-sys/src/video.rs index 095d30e6..2ddf7a9d 100644 --- a/sdl2-sys/src/video.rs +++ b/sdl2-sys/src/video.rs @@ -1,6 +1,7 @@ use rect::Rect; use surface::SDL_Surface; +use core::prelude::*; use libc::{c_void, c_int, c_float, c_char, uint16_t, uint32_t}; pub type SDL_Rect = Rect;