De-export std::{dbg,sha1,md4,tempfile,term}. Part of #3583.

This commit is contained in:
Graydon Hoare 2012-09-27 18:03:00 -07:00
parent 438bdd687b
commit 86041c421d
6 changed files with 36 additions and 49 deletions

View File

@ -4,13 +4,6 @@
use cast::reinterpret_cast;
export debug_tydesc;
export debug_opaque;
export debug_box;
export debug_tag;
export debug_fn;
export ptr_cast;
export breakpoint;
#[abi = "cdecl"]
extern mod rustrt {
@ -24,34 +17,34 @@ extern mod rustrt {
fn rust_dbg_breakpoint();
}
fn debug_tydesc<T>() {
pub fn debug_tydesc<T>() {
rustrt::debug_tydesc(sys::get_type_desc::<T>());
}
fn debug_opaque<T>(+x: T) {
pub fn debug_opaque<T>(+x: T) {
rustrt::debug_opaque(sys::get_type_desc::<T>(), ptr::addr_of(x) as *());
}
fn debug_box<T>(x: @T) {
pub fn debug_box<T>(x: @T) {
rustrt::debug_box(sys::get_type_desc::<T>(), ptr::addr_of(x) as *());
}
fn debug_tag<T>(+x: T) {
pub fn debug_tag<T>(+x: T) {
rustrt::debug_tag(sys::get_type_desc::<T>(), ptr::addr_of(x) as *());
}
fn debug_fn<T>(+x: T) {
pub fn debug_fn<T>(+x: T) {
rustrt::debug_fn(sys::get_type_desc::<T>(), ptr::addr_of(x) as *());
}
unsafe fn ptr_cast<T, U>(x: @T) -> @U {
pub unsafe fn ptr_cast<T, U>(x: @T) -> @U {
reinterpret_cast(
&rustrt::debug_ptrcast(sys::get_type_desc::<T>(),
reinterpret_cast(&x)))
}
/// Triggers a debugger breakpoint
fn breakpoint() {
pub fn breakpoint() {
rustrt::rust_dbg_breakpoint();
}

View File

@ -1,7 +1,7 @@
#[forbid(deprecated_mode)];
#[forbid(deprecated_pattern)];
fn md4(msg: &[u8]) -> {a: u32, b: u32, c: u32, d: u32} {
pub fn md4(msg: &[u8]) -> {a: u32, b: u32, c: u32, d: u32} {
// subtle: if orig_len is merely uint, then the code below
// which performs shifts by 32 bits or more has undefined
// results.
@ -85,7 +85,7 @@ fn md4(msg: &[u8]) -> {a: u32, b: u32, c: u32, d: u32} {
return {a: a, b: b, c: c, d: d};
}
fn md4_str(msg: &[u8]) -> ~str {
pub fn md4_str(msg: &[u8]) -> ~str {
let {a, b, c, d} = md4(msg);
fn app(a: u32, b: u32, c: u32, d: u32, f: fn(u32)) {
f(a); f(b); f(c); f(d);
@ -103,7 +103,7 @@ fn md4_str(msg: &[u8]) -> ~str {
result
}
fn md4_text(msg: &str) -> ~str { md4_str(str::to_bytes(msg)) }
pub fn md4_text(msg: &str) -> ~str { md4_str(str::to_bytes(msg)) }
#[test]
fn test_md4() {

View File

@ -20,7 +20,6 @@
* implementation, which is written for clarity, not speed. At some
* point this will want to be rewritten.
*/
export sha1;
/// The SHA-1 interface
trait Sha1 {
@ -53,7 +52,7 @@ const k3: u32 = 0xCA62C1D6u32;
/// Construct a `sha` object
fn sha1() -> Sha1 {
pub fn sha1() -> Sha1 {
type Sha1State =
{h: ~[mut u32],
mut len_low: u32,

View File

@ -110,19 +110,14 @@ mod treemap;
mod ebml;
#[legacy_exports]
mod ebml2;
#[legacy_exports]
mod dbg;
#[legacy_exports]
mod getopts;
#[legacy_exports]
mod json;
#[legacy_exports]
mod sha1;
#[legacy_exports]
mod md4;
#[legacy_exports]
mod tempfile;
#[legacy_exports]
mod term;
#[legacy_exports]
mod time;

View File

@ -6,7 +6,7 @@
use core::option;
use option::{None, Some};
fn mkdtemp(tmpdir: &Path, suffix: &str) -> Option<Path> {
pub fn mkdtemp(tmpdir: &Path, suffix: &str) -> Option<Path> {
let r = rand::Rng();
let mut i = 0u;
while (i < 1000u) {

View File

@ -6,35 +6,35 @@ use core::Option;
// FIXME (#2807): Windows support.
const color_black: u8 = 0u8;
const color_red: u8 = 1u8;
const color_green: u8 = 2u8;
const color_yellow: u8 = 3u8;
const color_blue: u8 = 4u8;
const color_magenta: u8 = 5u8;
const color_cyan: u8 = 6u8;
const color_light_gray: u8 = 7u8;
const color_light_grey: u8 = 7u8;
const color_dark_gray: u8 = 8u8;
const color_dark_grey: u8 = 8u8;
const color_bright_red: u8 = 9u8;
const color_bright_green: u8 = 10u8;
const color_bright_yellow: u8 = 11u8;
const color_bright_blue: u8 = 12u8;
const color_bright_magenta: u8 = 13u8;
const color_bright_cyan: u8 = 14u8;
const color_bright_white: u8 = 15u8;
pub const color_black: u8 = 0u8;
pub const color_red: u8 = 1u8;
pub const color_green: u8 = 2u8;
pub const color_yellow: u8 = 3u8;
pub const color_blue: u8 = 4u8;
pub const color_magenta: u8 = 5u8;
pub const color_cyan: u8 = 6u8;
pub const color_light_gray: u8 = 7u8;
pub const color_light_grey: u8 = 7u8;
pub const color_dark_gray: u8 = 8u8;
pub const color_dark_grey: u8 = 8u8;
pub const color_bright_red: u8 = 9u8;
pub const color_bright_green: u8 = 10u8;
pub const color_bright_yellow: u8 = 11u8;
pub const color_bright_blue: u8 = 12u8;
pub const color_bright_magenta: u8 = 13u8;
pub const color_bright_cyan: u8 = 14u8;
pub const color_bright_white: u8 = 15u8;
fn esc(writer: io::Writer) { writer.write(~[0x1bu8, '[' as u8]); }
pub fn esc(writer: io::Writer) { writer.write(~[0x1bu8, '[' as u8]); }
/// Reset the foreground and background colors to default
fn reset(writer: io::Writer) {
pub fn reset(writer: io::Writer) {
esc(writer);
writer.write(~['0' as u8, 'm' as u8]);
}
/// Returns true if the terminal supports color
fn color_supported() -> bool {
pub fn color_supported() -> bool {
let supported_terms = ~[~"xterm-color", ~"xterm",
~"screen-bce", ~"xterm-256color"];
return match os::getenv(~"TERM") {
@ -48,7 +48,7 @@ fn color_supported() -> bool {
};
}
fn set_color(writer: io::Writer, first_char: u8, color: u8) {
pub fn set_color(writer: io::Writer, first_char: u8, color: u8) {
assert (color < 16u8);
esc(writer);
let mut color = color;
@ -57,12 +57,12 @@ fn set_color(writer: io::Writer, first_char: u8, color: u8) {
}
/// Set the foreground color
fn fg(writer: io::Writer, color: u8) {
pub fn fg(writer: io::Writer, color: u8) {
return set_color(writer, '3' as u8, color);
}
/// Set the background color
fn bg(writer: io::Writer, color: u8) {
pub fn bg(writer: io::Writer, color: u8) {
return set_color(writer, '4' as u8, color);
}