]> git.lizzy.rs Git - rust.git/commitdiff
Don't attempt to export uv functions directly
authorAlex Crichton <alex@alexcrichton.com>
Thu, 17 Oct 2013 18:28:05 +0000 (11:28 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Thu, 24 Oct 2013 21:21:57 +0000 (14:21 -0700)
src/libstd/rt/io/stdio.rs
src/libstd/rt/rtio.rs
src/libstd/rt/uv/pipe.rs
src/libstd/rt/uv/tty.rs
src/libstd/rt/uv/uvio.rs
src/libstd/rt/uv/uvll.rs
src/rt/rust_uv.cpp
src/rt/rustrt.def.in

index a3cbe87431de00b34ac7d3fb6167f831731d118b..52838425422ca1edfa26a926b90aef3f1193ecd5 100644 (file)
@@ -115,13 +115,6 @@ pub fn set_raw(&mut self, raw: bool) {
             Err(e) => io_error::cond.raise(e),
         }
     }
-
-    /// Resets the mode of this stream back to its original state.
-    ///
-    /// # Failure
-    ///
-    /// This function cannot fail.
-    pub fn reset_mode(&mut self) { self.inner.reset_mode(); }
 }
 
 impl Reader for StdReader {
@@ -177,13 +170,6 @@ pub fn set_raw(&mut self, raw: bool) {
             Err(e) => io_error::cond.raise(e),
         }
     }
-
-    /// Resets the mode of this stream back to its original state.
-    ///
-    /// # Failure
-    ///
-    /// This function cannot fail.
-    pub fn reset_mode(&mut self) { self.inner.reset_mode(); }
 }
 
 impl Writer for StdWriter {
index 897bf328f23673bd4eef26e114e56c25a1f0d95b..924d9c4bff19974c48c8015bc60ef6e9e456bf3f 100644 (file)
@@ -186,7 +186,6 @@ pub trait RtioTTY {
     fn read(&mut self, buf: &mut [u8]) -> Result<uint, IoError>;
     fn write(&mut self, buf: &[u8]) -> Result<(), IoError>;
     fn set_raw(&mut self, raw: bool) -> Result<(), IoError>;
-    fn reset_mode(&mut self);
     fn get_winsize(&mut self) -> Result<(int, int), IoError>;
 }
 
index 2ad5079e5d546dd7bf65126b492b1081bccb5e5f..74b9312954c83b94703d4418c66a6d1f07f6e042 100644 (file)
@@ -40,7 +40,7 @@ pub fn as_stream(&self) -> net::StreamWatcher {
 
     #[fixed_stack_segment] #[inline(never)]
     pub fn open(&mut self, file: libc::c_int) -> Result<(), uv::UvError> {
-        match unsafe { uvll::uv_pipe_open(self.native_handle(), file) } {
+        match unsafe { uvll::pipe_open(self.native_handle(), file) } {
             0 => Ok(()),
             n => Err(uv::UvError(n))
         }
@@ -49,7 +49,7 @@ pub fn open(&mut self, file: libc::c_int) -> Result<(), uv::UvError> {
     #[fixed_stack_segment] #[inline(never)]
     pub fn bind(&mut self, name: &CString) -> Result<(), uv::UvError> {
         do name.with_ref |name| {
-            match unsafe { uvll::uv_pipe_bind(self.native_handle(), name) } {
+            match unsafe { uvll::pipe_bind(self.native_handle(), name) } {
                 0 => Ok(()),
                 n => Err(uv::UvError(n))
             }
@@ -68,10 +68,10 @@ pub fn connect(&mut self, name: &CString, cb: uv::ConnectionCallback) {
         let name = do name.with_ref |p| { p };
 
         unsafe {
-            uvll::uv_pipe_connect(connect.native_handle(),
-                                  self.native_handle(),
-                                  name,
-                                  connect_cb)
+            uvll::pipe_connect(connect.native_handle(),
+                               self.native_handle(),
+                               name,
+                               connect_cb)
         }
 
         extern "C" fn connect_cb(req: *uvll::uv_connect_t, status: libc::c_int) {
index 4c9a08f95bf84974332045d3fe55c4518559063e..f44c5ae8eff611b88f8ea635db0b57581ae25462 100644 (file)
@@ -29,8 +29,8 @@ pub fn new(loop_: &uv::Loop, fd: libc::c_int, readable: bool) ->
         assert!(handle.is_not_null());
 
         let ret = unsafe {
-            uvll::uv_tty_init(loop_.native_handle(), handle, fd as libc::c_int,
-                              readable as libc::c_int)
+            uvll::tty_init(loop_.native_handle(), handle, fd as libc::c_int,
+                           readable as libc::c_int)
         };
         match ret {
             0 => {
@@ -52,17 +52,12 @@ pub fn as_stream(&self) -> net::StreamWatcher {
     #[fixed_stack_segment] #[inline(never)]
     pub fn set_mode(&self, raw: bool) -> Result<(), uv::UvError> {
         let raw = raw as libc::c_int;
-        match unsafe { uvll::uv_tty_set_mode(self.native_handle(), raw) } {
+        match unsafe { uvll::tty_set_mode(self.native_handle(), raw) } {
             0 => Ok(()),
             n => Err(uv::UvError(n))
         }
     }
 
-    #[fixed_stack_segment] #[inline(never)]
-    pub fn reset_mode(&self) {
-        unsafe { uvll::uv_tty_reset_mode(self.native_handle()) }
-    }
-
     #[fixed_stack_segment] #[inline(never)] #[allow(unused_mut)]
     pub fn get_winsize(&self) -> Result<(int, int), uv::UvError> {
         let mut width: libc::c_int = 0;
@@ -70,8 +65,8 @@ pub fn get_winsize(&self) -> Result<(int, int), uv::UvError> {
         let widthptr: *libc::c_int = &width;
         let heightptr: *libc::c_int = &width;
 
-        match unsafe { uvll::uv_tty_get_winsize(self.native_handle(),
-                                                widthptr, heightptr) } {
+        match unsafe { uvll::tty_get_winsize(self.native_handle(),
+                                             widthptr, heightptr) } {
             0 => Ok((width as int, height as int)),
             n => Err(uv::UvError(n))
         }
index 96719e989721bc25c05c047ace18a1a610870349..3858b64915ac303afc236bc206cd5c7e5e1fb80c 100644 (file)
@@ -1829,10 +1829,6 @@ fn set_raw(&mut self, raw: bool) -> Result<(), IoError> {
         }
     }
 
-    fn reset_mode(&mut self) {
-        do self.home_for_io |self_| { self_.tty.reset_mode() }
-    }
-
     fn get_winsize(&mut self) -> Result<(int, int), IoError> {
         do self.home_for_io |self_| {
             match self_.tty.get_winsize() {
index 8ef1d1768b8c430261962579def0b3b07f2f530d..e78b2579779f91de27f74e3a1d1bd60dbb92dcda 100644 (file)
@@ -959,6 +959,33 @@ pub unsafe fn freeaddrinfo(ai: *addrinfo) {
     #[fixed_stack_segment]; #[inline(never)];
     rust_uv_freeaddrinfo(ai);
 }
+pub unsafe fn pipe_open(pipe: *uv_pipe_t, file: c_int) -> c_int {
+    #[fixed_stack_segment]; #[inline(never)];
+    rust_uv_pipe_open(pipe, file)
+}
+pub unsafe fn pipe_bind(pipe: *uv_pipe_t, name: *c_char) -> c_int {
+    #[fixed_stack_segment]; #[inline(never)];
+    rust_uv_pipe_bind(pipe, name)
+}
+pub unsafe fn pipe_connect(req: *uv_connect_t, handle: *uv_pipe_t,
+                           name: *c_char, cb: uv_connect_cb) {
+    #[fixed_stack_segment]; #[inline(never)];
+    rust_uv_pipe_connect(req, handle, name, cb)
+}
+pub unsafe fn tty_init(loop_ptr: *uv_loop_t, tty: *uv_tty_t, fd: c_int,
+                       readable: c_int) -> c_int {
+    #[fixed_stack_segment]; #[inline(never)];
+    rust_uv_tty_init(loop_ptr, tty, fd, readable)
+}
+pub unsafe fn tty_set_mode(tty: *uv_tty_t, mode: c_int) -> c_int {
+    #[fixed_stack_segment]; #[inline(never)];
+    rust_uv_tty_set_mode(tty, mode)
+}
+pub unsafe fn tty_get_winsize(tty: *uv_tty_t, width: *c_int,
+                              height: *c_int) -> c_int {
+    #[fixed_stack_segment]; #[inline(never)];
+    rust_uv_tty_get_winsize(tty, width, height)
+}
 
 pub struct uv_err_data {
     priv err_name: ~str,
@@ -1104,16 +1131,15 @@ fn rust_set_stdio_container_stream(c: *uv_stdio_container_t,
                                        stream: *uv_stream_t);
     fn rust_uv_pipe_init(loop_ptr: *c_void, p: *uv_pipe_t, ipc: c_int) -> c_int;
 
-    pub fn uv_pipe_open(pipe: *uv_pipe_t, file: c_int) -> c_int;
-    pub fn uv_pipe_bind(pipe: *uv_pipe_t, name: *c_char) -> c_int;
-    pub fn uv_pipe_connect(req: *uv_connect_t, handle: *uv_pipe_t,
-                           name: *c_char, cb: uv_connect_cb);
-    pub fn uv_tty_init(loop_ptr: *uv_loop_t, tty: *uv_tty_t, fd: c_int,
-                       readable: c_int) -> c_int;
-    pub fn uv_tty_set_mode(tty: *uv_tty_t, mode: c_int) -> c_int;
-    pub fn uv_tty_reset_mode(tty: *uv_tty_t);
-    pub fn uv_tty_get_winsize(tty: *uv_tty_t, width: *c_int,
-                              height: *c_int) -> c_int;
+    fn rust_uv_pipe_open(pipe: *uv_pipe_t, file: c_int) -> c_int;
+    fn rust_uv_pipe_bind(pipe: *uv_pipe_t, name: *c_char) -> c_int;
+    fn rust_uv_pipe_connect(req: *uv_connect_t, handle: *uv_pipe_t,
+                            name: *c_char, cb: uv_connect_cb);
+    fn rust_uv_tty_init(loop_ptr: *uv_loop_t, tty: *uv_tty_t, fd: c_int,
+                        readable: c_int) -> c_int;
+    fn rust_uv_tty_set_mode(tty: *uv_tty_t, mode: c_int) -> c_int;
+    fn rust_uv_tty_get_winsize(tty: *uv_tty_t, width: *c_int,
+                               height: *c_int) -> c_int;
 
     // These should all really be constants...
     #[rust_stack] pub fn rust_SOCK_STREAM() -> c_int;
index 29d0800237b6bc14e6ed6052346ec8aa75ba4fb2..a47b3446d34426dff90675d4021b175c54d10ed5 100644 (file)
@@ -650,3 +650,34 @@ extern "C" int rust_AI_NUMERICHOST()  { return AI_NUMERICHOST; }
 extern "C" int rust_AI_NUMERICSERV()  { return AI_NUMERICSERV; }
 extern "C" int rust_AI_PASSIVE()  { return AI_PASSIVE; }
 extern "C" int rust_AI_V4MAPPED()  { return AI_V4MAPPED; }
+
+extern "C" int
+rust_uv_pipe_open(uv_pipe_t *pipe, int file) {
+    return uv_pipe_open(pipe, file);
+}
+
+extern "C" int
+rust_uv_pipe_bind(uv_pipe_t *pipe, char *name) {
+    return uv_pipe_bind(pipe, name);
+}
+
+extern "C" void
+rust_uv_pipe_connect(uv_connect_t *req, uv_pipe_t *handle,
+                     char *name, uv_connect_cb cb) {
+    uv_pipe_connect(req, handle, name, cb);
+}
+
+extern "C" int
+rust_uv_tty_init(uv_loop_t *loop, uv_tty_t *tty, int fd, int readable) {
+    return uv_tty_init(loop, tty, fd, readable);
+}
+
+extern "C" int
+rust_uv_tty_set_mode(uv_tty_t *tty, int mode) {
+    return uv_tty_set_mode(tty, mode);
+}
+
+extern "C" int
+rust_uv_tty_get_winsize(uv_tty_t *tty, int *width, int *height) {
+    return uv_tty_get_winsize(tty, width, height);
+}
index 5945fdc3e59b15b24f6ef4b6d5c3248786c5388e..58862da31db5c163e22dc77e89ce19c286ba00ac 100644 (file)
@@ -211,10 +211,9 @@ rust_AI_NUMERICHOST
 rust_AI_NUMERICSERV
 rust_AI_PASSIVE
 rust_AI_V4MAPPED
-uv_pipe_open
-uv_pipe_bind
-uv_pipe_connect
-uv_tty_init
-uv_tty_set_mode
-uv_tty_reset_mode
-uv_tty_get_winsize
+rust_uv_pipe_open
+rust_uv_pipe_bind
+rust_uv_pipe_connect
+rust_uv_tty_init
+rust_uv_tty_set_mode
+rust_uv_tty_get_winsize