2011-12-20 12:29:59 -08:00
|
|
|
// Top-level, visible-everywhere definitions.
|
|
|
|
|
2012-03-02 17:20:00 -08:00
|
|
|
// Export various ubiquitous types, constructors, methods.
|
2011-12-20 12:29:59 -08:00
|
|
|
|
2012-02-21 09:23:01 -08:00
|
|
|
import option::{some, none};
|
2012-03-13 14:39:28 -07:00
|
|
|
import option = option::option;
|
2012-03-02 17:20:00 -08:00
|
|
|
import path = path::path;
|
2012-08-07 18:10:06 -07:00
|
|
|
import tuple::{tuple_ops, extended_tuple_ops};
|
|
|
|
import str::{str_slice, unique_str};
|
2012-07-11 15:00:40 -07:00
|
|
|
import vec::{const_vector, copyable_vector, immutable_vector};
|
|
|
|
import vec::{immutable_copyable_vector, iter_trait_extensions, vec_concat};
|
2012-07-20 15:33:18 -07:00
|
|
|
import iter::{base_iter, extended_iter, copyable_iter, times, timesi};
|
2012-07-11 15:00:40 -07:00
|
|
|
import num::num;
|
2012-08-07 18:10:06 -07:00
|
|
|
import ptr::ptr;
|
2012-08-13 14:58:09 -07:00
|
|
|
import to_str::to_str;
|
2012-03-17 18:02:45 -07:00
|
|
|
|
|
|
|
export path, option, some, none, unreachable;
|
2012-03-16 17:35:38 -07:00
|
|
|
export extensions;
|
2012-06-24 00:05:52 -04:00
|
|
|
// The following exports are the extension impls for numeric types
|
2012-07-20 15:33:18 -07:00
|
|
|
export num, times, timesi;
|
2012-07-11 15:00:40 -07:00
|
|
|
// The following exports are the common traits
|
|
|
|
export str_slice, unique_str;
|
|
|
|
export const_vector, copyable_vector, immutable_vector;
|
|
|
|
export immutable_copyable_vector, iter_trait_extensions, vec_concat;
|
|
|
|
export base_iter, copyable_iter, extended_iter;
|
2012-07-17 16:49:54 -07:00
|
|
|
export tuple_ops, extended_tuple_ops;
|
2012-07-11 15:00:40 -07:00
|
|
|
export ptr;
|
2012-08-13 14:58:09 -07:00
|
|
|
export to_str;
|
2012-07-28 14:13:08 -07:00
|
|
|
|
2012-07-25 18:36:18 -07:00
|
|
|
// The following exports are the core operators and kinds
|
2012-07-28 14:13:08 -07:00
|
|
|
// The compiler has special knowlege of these so we must not duplicate them
|
|
|
|
// when compiling for testing
|
|
|
|
#[cfg(notest)]
|
|
|
|
import ops::{const, copy, send, owned};
|
|
|
|
#[cfg(notest)]
|
2012-07-28 14:14:17 -07:00
|
|
|
import ops::{add, sub, mul, div, modulo, neg, bitand, bitor, bitxor};
|
2012-07-28 14:13:08 -07:00
|
|
|
#[cfg(notest)]
|
2012-07-28 14:14:17 -07:00
|
|
|
import ops::{shl, shr, index};
|
2012-07-28 14:13:08 -07:00
|
|
|
|
|
|
|
#[cfg(notest)]
|
2012-07-25 18:36:18 -07:00
|
|
|
export const, copy, send, owned;
|
2012-07-28 14:13:08 -07:00
|
|
|
#[cfg(notest)]
|
2012-07-28 14:14:17 -07:00
|
|
|
export add, sub, mul, div, modulo, neg, bitand, bitor, bitxor;
|
|
|
|
#[cfg(notest)]
|
|
|
|
export shl, shr, index;
|
2011-12-20 12:29:59 -08:00
|
|
|
|
2012-07-28 16:05:38 -07:00
|
|
|
#[cfg(test)]
|
|
|
|
use coreops(name = "core", vers = "0.3");
|
|
|
|
|
|
|
|
#[cfg(test)]
|
|
|
|
import coreops::ops::{const, copy, send, owned};
|
|
|
|
#[cfg(test)]
|
|
|
|
import coreops::ops::{add, sub, mul, div, modulo, neg, bitand, bitor, bitxor};
|
|
|
|
#[cfg(test)]
|
|
|
|
import coreops::ops::{shl, shr, index};
|
|
|
|
|
|
|
|
|
2011-12-20 12:29:59 -08:00
|
|
|
// Export the log levels as global constants. Higher levels mean
|
|
|
|
// more-verbosity. Error is the bottom level, default logging level is
|
|
|
|
// warn-and-below.
|
|
|
|
|
2011-12-22 10:30:04 -08:00
|
|
|
export error, warn, info, debug;
|
2012-01-24 00:54:17 -08:00
|
|
|
|
2012-07-04 22:53:12 +01:00
|
|
|
/// The error log level
|
2011-12-22 10:30:04 -08:00
|
|
|
const error : u32 = 0_u32;
|
2012-07-04 22:53:12 +01:00
|
|
|
/// The warning log level
|
2011-12-22 10:30:04 -08:00
|
|
|
const warn : u32 = 1_u32;
|
2012-07-04 22:53:12 +01:00
|
|
|
/// The info log level
|
2011-12-22 10:30:04 -08:00
|
|
|
const info : u32 = 2_u32;
|
2012-07-04 22:53:12 +01:00
|
|
|
/// The debug log level
|
2011-12-22 10:30:04 -08:00
|
|
|
const debug : u32 = 3_u32;
|
2011-12-22 14:42:52 -08:00
|
|
|
|
|
|
|
// A curious inner-module that's not exported that contains the binding
|
|
|
|
// 'core' so that macro-expanded references to core::error and such
|
|
|
|
// can be resolved within libcore.
|
|
|
|
mod core {
|
|
|
|
const error : u32 = 0_u32;
|
|
|
|
const warn : u32 = 1_u32;
|
|
|
|
const info : u32 = 2_u32;
|
|
|
|
const debug : u32 = 3_u32;
|
2012-01-17 16:45:22 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Similar to above. Some magic to make core testable.
|
|
|
|
#[cfg(test)]
|
|
|
|
mod std {
|
2012-07-11 09:09:08 -07:00
|
|
|
use std(vers = "0.3");
|
2012-01-17 16:45:22 -08:00
|
|
|
import std::test;
|
2012-01-20 11:12:03 -05:00
|
|
|
}
|
2012-03-08 14:29:17 -08:00
|
|
|
|
2012-07-04 22:53:12 +01:00
|
|
|
/**
|
|
|
|
* A standard function to use to indicate unreachable code. Because the
|
|
|
|
* function is guaranteed to fail typestate will correctly identify
|
|
|
|
* any code paths following the appearance of this function as unreachable.
|
|
|
|
*/
|
2012-03-08 14:29:17 -08:00
|
|
|
fn unreachable() -> ! {
|
2012-07-13 22:57:48 -07:00
|
|
|
fail ~"Internal error: entered unreachable code";
|
2012-03-08 14:29:17 -08:00
|
|
|
}
|
|
|
|
|