This will allow methods like read_line() on RefReader, LimitReader, etc.
probe CFG_XELATEX xelatex
probe CFG_LUALATEX lualatex
probe CFG_GDB gdb
+probe CFG_LLDB lldb
+
+if [ ! -z "$CFG_LLDB" ]
+then
+ # If CFG_LLDB_PYTHON_DIR is not already set from the outside and valid, try to read it from
+ # LLDB via the -P commandline options.
+ if [ -z "$CFG_LLDB_PYTHON_DIR" ] || [ ! -d "$CFG_LLDB_PYTHON_DIR" ]
+ then
+ CFG_LLDB_PYTHON_DIR=$($CFG_LLDB -P)
+
+ # If CFG_LLDB_PYTHON_DIR is not a valid directory, set it to something more readable
+ if [ ! -d "$CFG_LLDB_PYTHON_DIR" ]
+ then
+ CFG_LLDB_PYTHON_DIR="LLDB_PYTHON_DIRECTORY_NOT_FOUND"
+ fi
+
+ putvar CFG_LLDB_PYTHON_DIR
+ fi
+fi
+
if [ "$CFG_OSTYPE" = "unknown-linux-gnu" ]
then
probe CFG_PAXCTL paxctl /sbin/paxctl
make_dir $h/test/run-pass-fulldeps
make_dir $h/test/run-fail
make_dir $h/test/compile-fail
+ make_dir $h/test/compile-fail-fulldeps
make_dir $h/test/bench
make_dir $h/test/perf
make_dir $h/test/pretty
- make_dir $h/test/debug-info
+ make_dir $h/test/debuginfo-gdb
+ make_dir $h/test/debuginfo-lldb
make_dir $h/test/codegen
make_dir $h/test/doc-tutorial
make_dir $h/test/doc-guide-ffi
TARGET_CRATES := libc std green rustuv native flate arena glob term semver \
uuid serialize sync getopts collections num test time rand \
- workcache url log regex graphviz
+ workcache url log regex graphviz core
HOST_CRATES := syntax rustc rustdoc fourcc hexfloat regex_macros
CRATES := $(TARGET_CRATES) $(HOST_CRATES)
TOOLS := compiletest rustdoc rustc
-DEPS_std := libc native:rustrt native:compiler-rt native:backtrace
+DEPS_core :=
+DEPS_std := core libc native:rustrt native:compiler-rt native:backtrace
DEPS_green := std rand native:context_switch
DEPS_rustuv := std native:uv native:uv_support
DEPS_native := std
TOOL_SOURCE_rustdoc := $(S)src/driver/driver.rs
TOOL_SOURCE_rustc := $(S)src/driver/driver.rs
+ONLY_RLIB_core := 1
+
################################################################################
# You should not need to edit below this line
################################################################################
# $(5) - the name of the crate being processed
define CP_HOST_STAGE_N_CRATE
+ifeq ($$(ONLY_RLIB_$(5)),)
$$(HLIB$(2)_H_$(4))/stamp.$(5): \
$$(TLIB$(1)_T_$(3)_H_$(4))/stamp.$(5) \
$$(RUST_DEPS_$(5):%=$$(HLIB$(2)_H_$(4))/stamp.%) \
$$(HLIB$(2)_H_$(4))
$$(call LIST_ALL_OLD_GLOB_MATCHES,\
$$(dir $$@)$$(call CFG_LIB_GLOB_$(3),$(5)))
+else
+$$(HLIB$(2)_H_$(4))/stamp.$(5):
+ $$(Q)touch $$@
+endif
endef
# $(4) - the host triple (same as $(3))
define CP_HOST_STAGE_N
-$$(HBIN$(2)_H_$(4))/:
- @mkdir -p $$@
-
ifneq ($(CFG_LIBDIR_RELATIVE),bin)
$$(HLIB$(2)_H_$(4))/:
@mkdir -p $$@
check-stage$(1)-T-$(2)-H-$(3)-rfail-exec \
check-stage$(1)-T-$(2)-H-$(3)-cfail-exec \
check-stage$(1)-T-$(2)-H-$(3)-rpass-full-exec \
+ check-stage$(1)-T-$(2)-H-$(3)-cfail-full-exec \
check-stage$(1)-T-$(2)-H-$(3)-rmake-exec \
check-stage$(1)-T-$(2)-H-$(3)-crates-exec \
check-stage$(1)-T-$(2)-H-$(3)-doc-crates-exec \
check-stage$(1)-T-$(2)-H-$(3)-bench-exec \
- check-stage$(1)-T-$(2)-H-$(3)-debuginfo-exec \
+ check-stage$(1)-T-$(2)-H-$(3)-debuginfo-gdb-exec \
+ check-stage$(1)-T-$(2)-H-$(3)-debuginfo-lldb-exec \
check-stage$(1)-T-$(2)-H-$(3)-codegen-exec \
check-stage$(1)-T-$(2)-H-$(3)-doc-exec \
check-stage$(1)-T-$(2)-H-$(3)-pretty-exec
RPASS_RS := $(wildcard $(S)src/test/run-pass/*.rs)
RPASS_FULL_RC := $(wildcard $(S)src/test/run-pass-fulldeps/*.rc)
RPASS_FULL_RS := $(wildcard $(S)src/test/run-pass-fulldeps/*.rs)
+CFAIL_FULL_RC := $(wildcard $(S)src/test/compile-fail-fulldeps/*.rc)
+CFAIL_FULL_RS := $(wildcard $(S)src/test/compile-fail-fulldeps/*.rs)
RFAIL_RC := $(wildcard $(S)src/test/run-fail/*.rc)
RFAIL_RS := $(wildcard $(S)src/test/run-fail/*.rs)
CFAIL_RC := $(wildcard $(S)src/test/compile-fail/*.rc)
CFAIL_RS := $(wildcard $(S)src/test/compile-fail/*.rs)
BENCH_RS := $(wildcard $(S)src/test/bench/*.rs)
PRETTY_RS := $(wildcard $(S)src/test/pretty/*.rs)
-DEBUGINFO_RS := $(wildcard $(S)src/test/debug-info/*.rs)
+DEBUGINFO_GDB_RS := $(wildcard $(S)src/test/debuginfo/*.rs)
+DEBUGINFO_LLDB_RS := $(wildcard $(S)src/test/debuginfo/*.rs)
CODEGEN_RS := $(wildcard $(S)src/test/codegen/*.rs)
CODEGEN_CC := $(wildcard $(S)src/test/codegen/*.cc)
RPASS_TESTS := $(RPASS_RC) $(RPASS_RS)
RPASS_FULL_TESTS := $(RPASS_FULL_RC) $(RPASS_FULL_RS)
+CFAIL_FULL_TESTS := $(CFAIL_FULL_RC) $(CFAIL_FULL_RS)
RFAIL_TESTS := $(RFAIL_RC) $(RFAIL_RS)
CFAIL_TESTS := $(CFAIL_RC) $(CFAIL_RS)
BENCH_TESTS := $(BENCH_RS)
PERF_TESTS := $(PERF_RS)
PRETTY_TESTS := $(PRETTY_RS)
-DEBUGINFO_TESTS := $(DEBUGINFO_RS)
+DEBUGINFO_GDB_TESTS := $(DEBUGINFO_GDB_RS)
+DEBUGINFO_LLDB_TESTS := $(DEBUGINFO_LLDB_RS)
CODEGEN_TESTS := $(CODEGEN_RS) $(CODEGEN_CC)
CTEST_SRC_BASE_rpass = run-pass
CTEST_MODE_rpass-full = run-pass
CTEST_RUNTOOL_rpass-full = $(CTEST_RUNTOOL)
+CTEST_SRC_BASE_cfail-full = compile-fail-fulldeps
+CTEST_BUILD_BASE_cfail-full = compile-fail-fulldeps
+CTEST_MODE_cfail-full = compile-fail
+CTEST_RUNTOOL_cfail-full = $(CTEST_RUNTOOL)
+
CTEST_SRC_BASE_rfail = run-fail
CTEST_BUILD_BASE_rfail = run-fail
CTEST_MODE_rfail = run-fail
CTEST_MODE_perf = run-pass
CTEST_RUNTOOL_perf = $(CTEST_PERF_RUNTOOL)
-CTEST_SRC_BASE_debuginfo = debug-info
-CTEST_BUILD_BASE_debuginfo = debug-info
-CTEST_MODE_debuginfo = debug-info
-CTEST_RUNTOOL_debuginfo = $(CTEST_RUNTOOL)
+CTEST_SRC_BASE_debuginfo-gdb = debuginfo
+CTEST_BUILD_BASE_debuginfo-gdb = debuginfo-gdb
+CTEST_MODE_debuginfo-gdb = debuginfo-gdb
+CTEST_RUNTOOL_debuginfo-gdb = $(CTEST_RUNTOOL)
+
+CTEST_SRC_BASE_debuginfo-lldb = debuginfo
+CTEST_BUILD_BASE_debuginfo-lldb = debuginfo-lldb
+CTEST_MODE_debuginfo-lldb = debuginfo-lldb
+CTEST_RUNTOOL_debuginfo-lldb = $(CTEST_RUNTOOL)
CTEST_SRC_BASE_codegen = codegen
CTEST_BUILD_BASE_codegen = codegen
# during attempts to run those tests.
ifeq ($(CFG_GDB),)
-CTEST_DISABLE_debuginfo = "no gdb found"
+CTEST_DISABLE_debuginfo-gdb = "no gdb found"
endif
+ifeq ($(CFG_LLDB),)
+CTEST_DISABLE_debuginfo-lldb = "no lldb found"
+endif
+
+# Completely disable LLDB tests for now
+CTEST_DISABLE_debuginfo-lldb = "LLDB tests are not enabled yet"
+
ifeq ($(CFG_CLANG),)
CTEST_DISABLE_codegen = "no clang found"
endif
ifeq ($(CFG_OSTYPE),apple-darwin)
-CTEST_DISABLE_debuginfo = "gdb on darwing needs root"
+CTEST_DISABLE_debuginfo-gdb = "gdb on darwing needs root"
endif
# CTEST_DISABLE_NONSELFHOST_$(TEST_GROUP), if set, will cause that
--adb-path=$(CFG_ADB) \
--adb-test-dir=$(CFG_ADB_TEST_DIR) \
--host-rustcflags "$(RUSTC_FLAGS_$(3)) $$(CTEST_RUSTC_FLAGS) -L $$(RT_OUTPUT_DIR_$(3))" \
+ --lldb-python-dir=$(CFG_LLDB_PYTHON_DIR) \
--target-rustcflags "$(RUSTC_FLAGS_$(2)) $$(CTEST_RUSTC_FLAGS) -L $$(RT_OUTPUT_DIR_$(2))" \
$$(CTEST_TESTARGS)
CTEST_DEPS_rpass_$(1)-T-$(2)-H-$(3) = $$(RPASS_TESTS)
CTEST_DEPS_rpass-full_$(1)-T-$(2)-H-$(3) = $$(RPASS_FULL_TESTS) $$(CSREQ$(1)_T_$(3)_H_$(3)) $$(SREQ$(1)_T_$(2)_H_$(3))
+CTEST_DEPS_cfail-full_$(1)-T-$(2)-H-$(3) = $$(CFAIL_FULL_TESTS) $$(CSREQ$(1)_T_$(3)_H_$(3)) $$(SREQ$(1)_T_$(2)_H_$(3))
CTEST_DEPS_rfail_$(1)-T-$(2)-H-$(3) = $$(RFAIL_TESTS)
CTEST_DEPS_cfail_$(1)-T-$(2)-H-$(3) = $$(CFAIL_TESTS)
CTEST_DEPS_bench_$(1)-T-$(2)-H-$(3) = $$(BENCH_TESTS)
CTEST_DEPS_perf_$(1)-T-$(2)-H-$(3) = $$(PERF_TESTS)
-CTEST_DEPS_debuginfo_$(1)-T-$(2)-H-$(3) = $$(DEBUGINFO_TESTS)
+CTEST_DEPS_debuginfo-gdb_$(1)-T-$(2)-H-$(3) = $$(DEBUGINFO_GDB_TESTS)
+CTEST_DEPS_debuginfo-lldb_$(1)-T-$(2)-H-$(3) = $$(DEBUGINFO_LLDB_TESTS)
CTEST_DEPS_codegen_$(1)-T-$(2)-H-$(3) = $$(CODEGEN_TESTS)
endef
endef
-CTEST_NAMES = rpass rpass-full rfail cfail bench perf debuginfo codegen
+CTEST_NAMES = rpass rpass-full cfail-full rfail cfail bench perf debuginfo-gdb debuginfo-lldb codegen
$(foreach host,$(CFG_HOST), \
$(eval $(foreach target,$(CFG_TARGET), \
$(foreach crate,$(TEST_DOC_CRATES),doc-crate-$(crate)) \
rpass \
rpass-full \
+ cfail-full \
rfail \
cfail \
bench \
perf \
rmake \
- debuginfo \
+ debuginfo-gdb \
+ debuginfo-lldb \
codegen \
doc \
$(foreach docname,$(DOCS),doc-$(docname)) \
mode_run_fail,
mode_run_pass,
mode_pretty,
- mode_debug_info,
+ mode_debug_info_gdb,
+ mode_debug_info_lldb,
mode_codegen
}
// status whether android device available or not
pub adb_device_status: bool,
+ // the path containing LLDB's Python module
+ pub lldb_python_dir: Option<~str>,
+
// Explain what's going on
pub verbose: bool
use std::io;
use std::io::fs;
use getopts::{optopt, optflag, reqopt};
-use common::config;
-use common::mode_run_pass;
-use common::mode_run_fail;
-use common::mode_compile_fail;
-use common::mode_pretty;
-use common::mode_debug_info;
-use common::mode_codegen;
-use common::mode;
+use common::{config, mode_run_pass, mode_run_fail, mode_compile_fail, mode_pretty,
+ mode_debug_info_gdb, mode_debug_info_lldb, mode_codegen, mode};
use util::logv;
pub mod procsrv;
optopt("", "host", "the host to build for", "HOST"),
optopt("", "adb-path", "path to the android debugger", "PATH"),
optopt("", "adb-test-dir", "path to tests for the android debugger", "PATH"),
+ optopt("", "lldb-python-dir", "directory containing LLDB's python module", "PATH"),
optopt("", "test-shard", "run shard A, of B shards, worth of the testsuite", "A.B"),
optflag("h", "help", "show this message"));
"arm-linux-androideabi" == opt_str2(matches.opt_str("target")) &&
"(none)" != opt_str2(matches.opt_str("adb-test-dir")) &&
!opt_str2(matches.opt_str("adb-test-dir")).is_empty(),
+ lldb_python_dir: matches.opt_str("lldb-python-dir"),
test_shard: test::opt_shard(matches.opt_str("test-shard")),
verbose: matches.opt_present("verbose")
}
pub fn str_mode(s: ~str) -> mode {
match s.as_slice() {
- "compile-fail" => mode_compile_fail,
- "run-fail" => mode_run_fail,
- "run-pass" => mode_run_pass,
- "pretty" => mode_pretty,
- "debug-info" => mode_debug_info,
- "codegen" => mode_codegen,
- _ => fail!("invalid mode")
+ "compile-fail" => mode_compile_fail,
+ "run-fail" => mode_run_fail,
+ "run-pass" => mode_run_pass,
+ "pretty" => mode_pretty,
+ "debuginfo-gdb" => mode_debug_info_gdb,
+ "debuginfo-lldb" => mode_debug_info_lldb,
+ "codegen" => mode_codegen,
+ s => fail!("invalid mode: " + s)
}
}
mode_run_fail => "run-fail".to_owned(),
mode_run_pass => "run-pass".to_owned(),
mode_pretty => "pretty".to_owned(),
- mode_debug_info => "debug-info".to_owned(),
+ mode_debug_info_gdb => "debuginfo-gdb".to_owned(),
+ mode_debug_info_lldb => "debuginfo-lldb".to_owned(),
mode_codegen => "codegen".to_owned(),
}
}
pub fn run_tests(config: &config) {
if config.target == "arm-linux-androideabi".to_owned() {
match config.mode{
- mode_debug_info => {
+ mode_debug_info_gdb => {
println!("arm-linux-androideabi debug-info \
test uses tcp 5039 port. please reserve it");
}
pub aux_builds: Vec<~str> ,
// Environment settings to use during execution
pub exec_env: Vec<(~str,~str)> ,
- // Commands to be given to the debugger, when testing debug info
- pub debugger_cmds: Vec<~str> ,
// Lines to check if they appear in the expected debugger output
pub check_lines: Vec<~str> ,
// Flag to force a crate to be built with the host architecture
let mut compile_flags = None;
let mut run_flags = None;
let mut pp_exact = None;
- let mut debugger_cmds = Vec::new();
let mut check_lines = Vec::new();
let mut force_host = false;
let mut check_stdout = false;
None => {}
}
- match parse_debugger_cmd(ln) {
- Some(dc) => debugger_cmds.push(dc),
- None => ()
- };
-
match parse_check_line(ln) {
Some(cl) => check_lines.push(cl),
None => ()
pp_exact: pp_exact,
aux_builds: aux_builds,
exec_env: exec_env,
- debugger_cmds: debugger_cmds,
check_lines: check_lines,
force_host: force_host,
check_stdout: check_stdout,
parse_name_value_directive(line, "run-flags".to_owned())
}
-fn parse_debugger_cmd(line: &str) -> Option<~str> {
- parse_name_value_directive(line, "debugger".to_owned())
-}
-
fn parse_check_line(line: &str) -> Option<~str> {
parse_name_value_directive(line, "check".to_owned())
}
line.contains(directive)
}
-fn parse_name_value_directive(line: &str,
+pub fn parse_name_value_directive(line: &str,
directive: ~str) -> Option<~str> {
let keycolon = directive + ":";
match line.find_str(keycolon) {
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use common::config;
-use common::mode_compile_fail;
-use common::mode_pretty;
-use common::mode_run_fail;
-use common::mode_run_pass;
+use common::{config, mode_compile_fail, mode_pretty, mode_run_fail, mode_run_pass};
use errors;
use header::TestProps;
-use header::load_props;
+use header;
use procsrv;
use util::logv;
#[cfg(target_os = "win32")]
}
let testfile = Path::new(testfile);
debug!("running {}", testfile.display());
- let props = load_props(&testfile);
+ let props = header::load_props(&testfile);
debug!("loaded props");
match config.mode {
mode_compile_fail => run_cfail_test(&config, &props, &testfile),
mode_run_fail => run_rfail_test(&config, &props, &testfile),
mode_run_pass => run_rpass_test(&config, &props, &testfile),
mode_pretty => run_pretty_test(&config, &props, &testfile),
- mode_debug_info => run_debuginfo_test(&config, &props, &testfile),
+ mode_debug_info_gdb => run_debuginfo_gdb_test(&config, &props, &testfile),
+ mode_debug_info_lldb => run_debuginfo_lldb_test(&config, &props, &testfile),
mode_codegen => run_codegen_test(&config, &props, &testfile, mm)
}
}
} else {
check_error_patterns(props, testfile, &proc_res);
}
+ check_no_compiler_crash(&proc_res);
}
fn run_rfail_test(config: &config, props: &TestProps, testfile: &Path) {
}
}
-fn run_debuginfo_test(config: &config, props: &TestProps, testfile: &Path) {
+fn run_debuginfo_gdb_test(config: &config, props: &TestProps, testfile: &Path) {
let mut config = config {
target_rustcflags: cleanup_debug_info_options(&config.target_rustcflags),
host_rustcflags: cleanup_debug_info_options(&config.host_rustcflags),
};
let config = &mut config;
- let check_lines = &props.check_lines;
- let mut cmds = props.debugger_cmds.connect("\n");
+ let DebuggerCommands { commands, check_lines, .. } = parse_debugger_commands(testfile, "gdb");
+ let mut cmds = commands.connect("\n");
// compile test file (it shoud have 'compile-flags:-g' in the header)
- let mut proc_res = compile_test(config, props, testfile);
- if !proc_res.status.success() {
- fatal_ProcRes("compilation failed!".to_owned(), &proc_res);
+ let compiler_run_result = compile_test(config, props, testfile);
+ if !compiler_run_result.status.success() {
+ fatal_ProcRes("compilation failed!".to_owned(), &compiler_run_result);
}
let exe_file = make_exe_name(config, testfile);
let mut proc_args;
+ let debugger_run_result;
match config.target.as_slice() {
"arm-linux-androideabi" => {
cmdline
};
- proc_res = ProcRes {status: status,
- stdout: out,
- stderr: err,
- cmdline: cmdline};
+ debugger_run_result = ProcRes {
+ status: status,
+ stdout: out,
+ stderr: err,
+ cmdline: cmdline
+ };
process.signal_kill().unwrap();
}
"-command=" + debugger_script.as_str().unwrap().to_owned(),
exe_file.as_str().unwrap().to_owned());
proc_args = ProcArgs {prog: debugger(), args: debugger_opts};
- proc_res = compose_and_run(config, testfile, proc_args, Vec::new(), "", None);
+ debugger_run_result = compose_and_run(config,
+ testfile,
+ proc_args,
+ Vec::new(),
+ "",
+ None);
}
}
- if !proc_res.status.success() {
+ if !debugger_run_result.status.success() {
fatal("gdb failed to execute".to_owned());
}
+
+ check_debugger_output(&debugger_run_result, check_lines.as_slice());
+}
+
+fn run_debuginfo_lldb_test(config: &config, props: &TestProps, testfile: &Path) {
+ use std::io::process::{Process, ProcessConfig, ProcessOutput};
+
+ if config.lldb_python_dir.is_none() {
+ fatal("Can't run LLDB test because LLDB's python path is not set.".to_owned());
+ }
+
+ let mut config = config {
+ target_rustcflags: cleanup_debug_info_options(&config.target_rustcflags),
+ host_rustcflags: cleanup_debug_info_options(&config.host_rustcflags),
+ .. config.clone()
+ };
+
+ let config = &mut config;
+
+ // compile test file (it shoud have 'compile-flags:-g' in the header)
+ let compile_result = compile_test(config, props, testfile);
+ if !compile_result.status.success() {
+ fatal_ProcRes("compilation failed!".to_owned(), &compile_result);
+ }
+
+ let exe_file = make_exe_name(config, testfile);
+
+ // Parse debugger commands etc from test files
+ let DebuggerCommands {
+ commands,
+ check_lines,
+ breakpoint_lines
+ } = parse_debugger_commands(testfile, "lldb");
+
+ // Write debugger script:
+ // We don't want to hang when calling `quit` while the process is still running
+ let mut script_str = StrBuf::from_str("settings set auto-confirm true\n");
+
+ // Set breakpoints on every line that contains the string "#break"
+ for line in breakpoint_lines.iter() {
+ script_str.push_str(format!("breakpoint set --line {}\n", line));
+ }
+
+ // Append the other commands
+ for line in commands.iter() {
+ script_str.push_str(line.as_slice());
+ script_str.push_str("\n");
+ }
+
+ // Finally, quit the debugger
+ script_str.push_str("quit\n");
+
+ // Write the script into a file
+ debug!("script_str = {}", script_str);
+ dump_output_file(config, testfile, script_str.into_owned(), "debugger.script");
+ let debugger_script = make_out_name(config, testfile, "debugger.script");
+
+ // Let LLDB execute the script via lldb_batchmode.py
+ let debugger_run_result = run_lldb(config, &exe_file, &debugger_script);
+
+ if !debugger_run_result.status.success() {
+ fatal_ProcRes("Error while running LLDB".to_owned(), &debugger_run_result);
+ }
+
+ check_debugger_output(&debugger_run_result, check_lines.as_slice());
+
+ fn run_lldb(config: &config, test_executable: &Path, debugger_script: &Path) -> ProcRes {
+ // Prepare the lldb_batchmode which executes the debugger script
+ let lldb_batchmode_script = "./src/etc/lldb_batchmode.py".to_owned();
+ let test_executable_str = test_executable.as_str().unwrap().to_owned();
+ let debugger_script_str = debugger_script.as_str().unwrap().to_owned();
+ let commandline = format!("python {} {} {}",
+ lldb_batchmode_script.as_slice(),
+ test_executable_str.as_slice(),
+ debugger_script_str.as_slice());
+
+ let args = &[lldb_batchmode_script, test_executable_str, debugger_script_str];
+ let env = &[("PYTHONPATH".to_owned(), config.lldb_python_dir.clone().unwrap())];
+
+ let mut opt_process = Process::configure(ProcessConfig {
+ program: "python",
+ args: args,
+ env: Some(env),
+ .. ProcessConfig::new()
+ });
+
+ let (status, out, err) = match opt_process {
+ Ok(ref mut process) => {
+ let ProcessOutput { status, output, error } = process.wait_with_output();
+
+ (status,
+ str::from_utf8(output.as_slice()).unwrap().to_owned(),
+ str::from_utf8(error.as_slice()).unwrap().to_owned())
+ },
+ Err(e) => {
+ fatal(format!("Failed to setup Python process for LLDB script: {}", e))
+ }
+ };
+
+ dump_output(config, test_executable, out, err);
+ return ProcRes {
+ status: status,
+ stdout: out,
+ stderr: err,
+ cmdline: commandline
+ };
+ }
+}
+
+struct DebuggerCommands
+{
+ commands: Vec<~str>,
+ check_lines: Vec<~str>,
+ breakpoint_lines: Vec<uint>
+}
+
+fn parse_debugger_commands(file_path: &Path, debugger_prefix: &str) -> DebuggerCommands {
+ use std::io::{BufferedReader, File};
+
+ let command_directive = debugger_prefix + "-command";
+ let check_directive = debugger_prefix + "-check";
+
+ let mut breakpoint_lines = vec!();
+ let mut commands = vec!();
+ let mut check_lines = vec!();
+ let mut counter = 1;
+ let mut reader = BufferedReader::new(File::open(file_path).unwrap());
+ for line in reader.lines() {
+ match line {
+ Ok(line) => {
+ if line.contains("#break") {
+ breakpoint_lines.push(counter);
+ }
+
+ header::parse_name_value_directive(line, command_directive.clone())
+ .map(|cmd| commands.push(cmd));
+
+ header::parse_name_value_directive(line, check_directive.clone())
+ .map(|cmd| check_lines.push(cmd));
+ }
+ Err(e) => {
+ fatal(format!("Error while parsing debugger commands: {}", e))
+ }
+ }
+ counter += 1;
+ }
+
+ DebuggerCommands {
+ commands: commands,
+ check_lines: check_lines,
+ breakpoint_lines: breakpoint_lines
+ }
+}
+
+fn cleanup_debug_info_options(options: &Option<~str>) -> Option<~str> {
+ if options.is_none() {
+ return None;
+ }
+
+ // Remove options that are either unwanted (-O) or may lead to duplicates due to RUSTFLAGS.
+ let options_to_remove = ["-O".to_owned(), "-g".to_owned(), "--debuginfo".to_owned()];
+ let new_options = split_maybe_args(options).move_iter()
+ .filter(|x| !options_to_remove.contains(x))
+ .collect::<Vec<~str>>()
+ .connect(" ");
+ Some(new_options)
+}
+
+fn check_debugger_output(debugger_run_result: &ProcRes, check_lines: &[~str]) {
let num_check_lines = check_lines.len();
if num_check_lines > 0 {
// Allow check lines to leave parts unspecified (e.g., uninitialized
// bits in the wrong case of an enum) with the notation "[...]".
let check_fragments: Vec<Vec<~str>> =
check_lines.iter().map(|s| {
- s.split_str("[...]").map(|x| x.to_str()).collect()
+ s.trim().split_str("[...]").map(|x| x.to_str()).collect()
}).collect();
// check if each line in props.check_lines appears in the
// output (in order)
let mut i = 0u;
- for line in proc_res.stdout.lines() {
+ for line in debugger_run_result.stdout.lines() {
let mut rest = line.trim();
let mut first = true;
let mut failed = false;
}
if i != num_check_lines {
fatal_ProcRes(format!("line not found in debugger output: {}",
- *check_lines.get(i)), &proc_res);
+ check_lines.get(i).unwrap()), debugger_run_result);
}
}
-
- fn cleanup_debug_info_options(options: &Option<~str>) -> Option<~str> {
- if options.is_none() {
- return None;
- }
-
- // Remove options that are either unwanted (-O) or may lead to duplicates due to RUSTFLAGS.
- let options_to_remove = ["-O".to_owned(), "-g".to_owned(), "--debuginfo".to_owned()];
- let new_options = split_maybe_args(options).move_iter()
- .filter(|x| !options_to_remove.contains(x))
- .collect::<Vec<~str>>()
- .connect(" ");
- Some(new_options)
- }
}
fn check_error_patterns(props: &TestProps,
}
}
+fn check_no_compiler_crash(proc_res: &ProcRes) {
+ for line in proc_res.stderr.lines() {
+ if line.starts_with("error: internal compiler error:") {
+ fatal_ProcRes("compiler encountered internal error".to_owned(),
+ proc_res);
+ }
+ }
+}
+
fn check_expected_errors(expected_errors: Vec<errors::ExpectedError> ,
testfile: &Path,
proc_res: &ProcRes) {
for rel_ab in props.aux_builds.iter() {
let abs_ab = config.aux_base.join(rel_ab.as_slice());
- let aux_props = load_props(&abs_ab);
+ let aux_props = header::load_props(&abs_ab);
let crate_type = if aux_props.no_prefer_dynamic {
Vec::new()
} else {
* The signed two's complement word types `i8`, `i16`, `i32` and `i64`, with
values drawn from the integer intervals [-(2^(7)), 2^7 - 1],
- [-(2^(15)), 2^15 - 1], $[-(2^(31)), 2^31 - 1], [-(2^(63)), 2^63 - 1]
+ [-(2^(15)), 2^15 - 1], [-(2^(31)), 2^31 - 1], [-(2^(63)), 2^63 - 1]
respectively.
* The IEEE 754-2008 `binary32` and `binary64` floating-point types: `f32` and
--- /dev/null
+# Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+# file at the top-level directory of this distribution and at
+# http://rust-lang.org/COPYRIGHT.
+#
+# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+# option. This file may not be copied, modified, or distributed
+# except according to those terms.
+
+# This script allows to use LLDB in a way similar to GDB's batch mode. That is, given a text file
+# containing LLDB commands (one command per line), this script will execute the commands one after
+# the other.
+# LLDB also has the -s and -S commandline options which also execute a list of commands from a text
+# file. However, this command are execute `immediately`: a the command of a `run` or `continue`
+# command will be executed immediately after the `run` or `continue`, without waiting for the next
+# breakpoint to be hit. This a command sequence like the following will not yield reliable results:
+#
+# break 11
+# run
+# print x
+#
+# Most of the time the `print` command will be executed while the program is still running will thus
+# fail. Using this Python script, the above will work as expected.
+
+from __future__ import print_function
+import lldb
+import os
+import sys
+import threading
+import re
+import atexit
+
+# Terminate the debugger
+atexit.register(lambda: lldb.SBDebugger.Terminate())
+
+# Set this to True for additional output
+DEBUG_OUTPUT = False
+
+def print_debug(s):
+ "Print something if DEBUG_OUTPUT is True"
+ global DEBUG_OUTPUT
+ if DEBUG_OUTPUT:
+ print("DEBUG: " + str(s))
+
+
+def normalize_whitespace(s):
+ "Replace newlines, tabs, multiple spaces, etc with exactly one space"
+ return re.sub("\s+", " ", s)
+
+
+# This callback is registered with every breakpoint and makes sure that the frame containing the
+# breakpoint location is selected
+def breakpoint_callback(frame, bp_loc, dict):
+ "Called whenever a breakpoint is hit"
+ print("Hit breakpoint " + str(bp_loc))
+
+ # Select the frame and the thread containing it
+ frame.thread.process.SetSelectedThread(frame.thread)
+ frame.thread.SetSelectedFrame(frame.idx)
+
+ # Returning True means that we actually want to stop at this breakpoint
+ return True
+
+
+# This is a list of breakpoints that are not registered with the breakpoint callback. The list is
+# populated by the breakpoint listener and checked/emptied whenever a command has been executed
+new_breakpoints = []
+
+# This set contains all breakpoint ids that have already been registered with a callback, and is
+# used to avoid hooking callbacks into breakpoints more than once
+registered_breakpoints = set()
+
+def execute_command(command_interpreter, command):
+ "Executes a single CLI command"
+ global new_breakpoints
+ global registered_breakpoints
+
+ res = lldb.SBCommandReturnObject()
+ print(command)
+ command_interpreter.HandleCommand(command, res)
+
+ if res.Succeeded():
+ if res.HasResult():
+ print(normalize_whitespace(res.GetOutput()), end = '\n')
+
+ # If the command introduced any breakpoints, make sure to register them with the breakpoint
+ # callback
+ while len(new_breakpoints) > 0:
+ res.Clear()
+ breakpoint_id = new_breakpoints.pop()
+
+ if breakpoint_id in registered_breakpoints:
+ print_debug("breakpoint with id %s is already registered. Ignoring." % str(breakpoint_id))
+ else:
+ print_debug("registering breakpoint callback, id = " + str(breakpoint_id))
+ callback_command = "breakpoint command add -F breakpoint_callback " + str(breakpoint_id)
+ command_interpreter.HandleCommand(callback_command, res)
+ if res.Succeeded():
+ print_debug("successfully registered breakpoint callback, id = " + str(breakpoint_id))
+ registered_breakpoints.add(breakpoint_id)
+ else:
+ print("Error while trying to register breakpoint callback, id = " + str(breakpoint_id))
+ else:
+ print(res.GetError())
+
+
+def start_breakpoint_listener(target):
+ "Listens for breakpoints being added and adds new ones to the callback registration list"
+ listener = lldb.SBListener("breakpoint listener")
+
+ def listen():
+ event = lldb.SBEvent()
+ try:
+ while True:
+ if listener.WaitForEvent(120, event):
+ if lldb.SBBreakpoint.EventIsBreakpointEvent(event) and \
+ lldb.SBBreakpoint.GetBreakpointEventTypeFromEvent(event) == \
+ lldb.eBreakpointEventTypeAdded:
+ global new_breakpoints
+ breakpoint = lldb.SBBreakpoint.GetBreakpointFromEvent(event)
+ print_debug("breakpoint added, id = " + str(breakpoint.id))
+ new_breakpoints.append(breakpoint.id)
+ except:
+ print_debug("breakpoint listener shutting down")
+
+ # Start the listener and let it run as a daemon
+ listener_thread = threading.Thread(target = listen)
+ listener_thread.daemon = True
+ listener_thread.start()
+
+ # Register the listener with the target
+ target.GetBroadcaster().AddListener(listener, lldb.SBTarget.eBroadcastBitBreakpointChanged)
+
+
+####################################################################################################
+# ~main
+####################################################################################################
+
+if len(sys.argv) != 3:
+ print("usage: python lldb_batchmode.py target-path script-path")
+ sys.exit(1)
+
+target_path = sys.argv[1]
+script_path = sys.argv[2]
+
+
+# Create a new debugger instance
+debugger = lldb.SBDebugger.Create()
+
+# When we step or continue, don't return from the function until the process
+# stops. We do this by setting the async mode to false.
+debugger.SetAsync(False)
+
+# Create a target from a file and arch
+print("Creating a target for '%s'" % target_path)
+target = debugger.CreateTargetWithFileAndArch(target_path, lldb.LLDB_ARCH_DEFAULT)
+
+if not target:
+ print("Could not create debugging target '" + target_path + "'. Aborting.", file=sys.stderr)
+ sys.exit(1)
+
+
+# Register the breakpoint callback for every breakpoint
+start_breakpoint_listener(target)
+
+command_interpreter = debugger.GetCommandInterpreter()
+
+try:
+ script_file = open(script_path, 'r')
+
+ for line in script_file:
+ command = line.strip()
+ if command != '':
+ execute_command(command_interpreter, command)
+
+except IOError as e:
+ print("Could not read debugging script '%s'." % script_path, file = sys.stderr)
+ print(e, file = sys.stderr)
+ print("Aborting.", file = sys.stderr)
+ sys.exit(1)
+finally:
+ script_file.close()
+
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Traits for dynamic typing of any type (through runtime reflection)
+//!
+//! This module implements the `Any` trait, which enables dynamic typing
+//! of any type, through runtime reflection.
+//!
+//! `Any` itself can be used to get a `TypeId`, and has more features when used as a trait object.
+//! As `&Any` (a borrowed trait object), it has the `is` and `as_ref` methods, to test if the
+//! contained value is of a given type, and to get a reference to the inner value as a type. As
+//! `&mut Any`, there is also the `as_mut` method, for getting a mutable reference to the inner
+//! value. `Box<Any>` adds the `move` method, which will unwrap a `Box<T>` from the object. See
+//! the extension traits (`*Ext`) for the full details.
+
+use cast::{transmute, transmute_copy};
+use option::{Option, Some, None};
+use owned::Box;
+use raw::TraitObject;
+use result::{Result, Ok, Err};
+use intrinsics::TypeId;
+use intrinsics;
+
+/// A type with no inhabitants
+pub enum Void { }
+
+///////////////////////////////////////////////////////////////////////////////
+// Any trait
+///////////////////////////////////////////////////////////////////////////////
+
+/// The `Any` trait is implemented by all types, and can be used as a trait object
+/// for dynamic typing
+pub trait Any {
+ /// Get the `TypeId` of `self`
+ fn get_type_id(&self) -> TypeId;
+}
+
+impl<T: 'static> Any for T {
+ /// Get the `TypeId` of `self`
+ fn get_type_id(&self) -> TypeId {
+ TypeId::of::<T>()
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// Extension methods for Any trait objects.
+// Implemented as three extension traits so that the methods can be generic.
+///////////////////////////////////////////////////////////////////////////////
+
+/// Extension methods for a referenced `Any` trait object
+pub trait AnyRefExt<'a> {
+ /// Returns true if the boxed type is the same as `T`
+ fn is<T: 'static>(self) -> bool;
+
+ /// Returns some reference to the boxed value if it is of type `T`, or
+ /// `None` if it isn't.
+ fn as_ref<T: 'static>(self) -> Option<&'a T>;
+}
+
+impl<'a> AnyRefExt<'a> for &'a Any {
+ #[inline]
+ fn is<T: 'static>(self) -> bool {
+ // Get TypeId of the type this function is instantiated with
+ let t = TypeId::of::<T>();
+
+ // Get TypeId of the type in the trait object
+ let boxed = self.get_type_id();
+
+ // Compare both TypeIds on equality
+ t == boxed
+ }
+
+ #[inline]
+ fn as_ref<T: 'static>(self) -> Option<&'a T> {
+ if self.is::<T>() {
+ unsafe {
+ // Get the raw representation of the trait object
+ let to: TraitObject = transmute_copy(&self);
+
+ // Extract the data pointer
+ Some(transmute(to.data))
+ }
+ } else {
+ None
+ }
+ }
+}
+
+/// Extension methods for a mutable referenced `Any` trait object
+pub trait AnyMutRefExt<'a> {
+ /// Returns some mutable reference to the boxed value if it is of type `T`, or
+ /// `None` if it isn't.
+ fn as_mut<T: 'static>(self) -> Option<&'a mut T>;
+}
+
+impl<'a> AnyMutRefExt<'a> for &'a mut Any {
+ #[inline]
+ fn as_mut<T: 'static>(self) -> Option<&'a mut T> {
+ if self.is::<T>() {
+ unsafe {
+ // Get the raw representation of the trait object
+ let to: TraitObject = transmute_copy(&self);
+
+ // Extract the data pointer
+ Some(transmute(to.data))
+ }
+ } else {
+ None
+ }
+ }
+}
+
+/// Extension methods for an owning `Any` trait object
+pub trait AnyOwnExt {
+ /// Returns the boxed value if it is of type `T`, or
+ /// `Err(Self)` if it isn't.
+ fn move<T: 'static>(self) -> Result<Box<T>, Self>;
+}
+
+impl AnyOwnExt for Box<Any> {
+ #[inline]
+ fn move<T: 'static>(self) -> Result<Box<T>, Box<Any>> {
+ if self.is::<T>() {
+ unsafe {
+ // Get the raw representation of the trait object
+ let to: TraitObject = transmute_copy(&self);
+
+ // Prevent destructor on self being run
+ intrinsics::forget(self);
+
+ // Extract the data pointer
+ Ok(transmute(to.data))
+ }
+ } else {
+ Err(self)
+ }
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use prelude::*;
+ use super::*;
+ use owned::Box;
+ use realstd::str::StrAllocating;
+
+ #[deriving(Eq, Show)]
+ struct Test;
+
+ static TEST: &'static str = "Test";
+
+ #[test]
+ fn any_referenced() {
+ let (a, b, c) = (&5u as &Any, &TEST as &Any, &Test as &Any);
+
+ assert!(a.is::<uint>());
+ assert!(!b.is::<uint>());
+ assert!(!c.is::<uint>());
+
+ assert!(!a.is::<&'static str>());
+ assert!(b.is::<&'static str>());
+ assert!(!c.is::<&'static str>());
+
+ assert!(!a.is::<Test>());
+ assert!(!b.is::<Test>());
+ assert!(c.is::<Test>());
+ }
+
+ #[test]
+ fn any_owning() {
+ let (a, b, c) = (box 5u as Box<Any>, box TEST as Box<Any>, box Test as Box<Any>);
+
+ assert!(a.is::<uint>());
+ assert!(!b.is::<uint>());
+ assert!(!c.is::<uint>());
+
+ assert!(!a.is::<&'static str>());
+ assert!(b.is::<&'static str>());
+ assert!(!c.is::<&'static str>());
+
+ assert!(!a.is::<Test>());
+ assert!(!b.is::<Test>());
+ assert!(c.is::<Test>());
+ }
+
+ #[test]
+ fn any_as_ref() {
+ let a = &5u as &Any;
+
+ match a.as_ref::<uint>() {
+ Some(&5) => {}
+ x => fail!("Unexpected value {:?}", x)
+ }
+
+ match a.as_ref::<Test>() {
+ None => {}
+ x => fail!("Unexpected value {:?}", x)
+ }
+ }
+
+ #[test]
+ fn any_as_mut() {
+ let mut a = 5u;
+ let mut b = box 7u;
+
+ let a_r = &mut a as &mut Any;
+ let tmp: &mut uint = b;
+ let b_r = tmp as &mut Any;
+
+ match a_r.as_mut::<uint>() {
+ Some(x) => {
+ assert_eq!(*x, 5u);
+ *x = 612;
+ }
+ x => fail!("Unexpected value {:?}", x)
+ }
+
+ match b_r.as_mut::<uint>() {
+ Some(x) => {
+ assert_eq!(*x, 7u);
+ *x = 413;
+ }
+ x => fail!("Unexpected value {:?}", x)
+ }
+
+ match a_r.as_mut::<Test>() {
+ None => (),
+ x => fail!("Unexpected value {:?}", x)
+ }
+
+ match b_r.as_mut::<Test>() {
+ None => (),
+ x => fail!("Unexpected value {:?}", x)
+ }
+
+ match a_r.as_mut::<uint>() {
+ Some(&612) => {}
+ x => fail!("Unexpected value {:?}", x)
+ }
+
+ match b_r.as_mut::<uint>() {
+ Some(&413) => {}
+ x => fail!("Unexpected value {:?}", x)
+ }
+ }
+
+ #[test]
+ fn any_move() {
+ let a = box 8u as Box<Any>;
+ let b = box Test as Box<Any>;
+
+ match a.move::<uint>() {
+ Ok(a) => { assert_eq!(a, box 8u); }
+ Err(..) => fail!()
+ }
+ match b.move::<Test>() {
+ Ok(a) => { assert_eq!(a, box Test); }
+ Err(..) => fail!()
+ }
+
+ let a = box 8u as Box<Any>;
+ let b = box Test as Box<Any>;
+
+ assert!(a.move::<Box<Test>>().is_err());
+ assert!(b.move::<Box<uint>>().is_err());
+ }
+
+ #[test]
+ fn test_show() {
+ let a = box 8u as Box<::realcore::any::Any>;
+ let b = box Test as Box<::realcore::any::Any>;
+ assert_eq!(format!("{}", a), "Box<Any>".to_owned());
+ assert_eq!(format!("{}", b), "Box<Any>".to_owned());
+
+ let a = &8u as &::realcore::any::Any;
+ let b = &Test as &::realcore::any::Any;
+ assert_eq!(format!("{}", a), "&Any".to_owned());
+ assert_eq!(format!("{}", b), "&Any".to_owned());
+ }
+}
+
+#[cfg(test)]
+mod bench {
+ extern crate test;
+
+ use any::{Any, AnyRefExt};
+ use option::Some;
+ use self::test::Bencher;
+
+ #[bench]
+ fn bench_as_ref(b: &mut Bencher) {
+ b.iter(|| {
+ let mut x = 0; let mut y = &mut x as &mut Any;
+ test::black_box(&mut y);
+ test::black_box(y.as_ref::<int>() == Some(&0));
+ });
+ }
+}
--- /dev/null
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Operations on boolean values (`bool` type)
+//!
+//! A quick summary:
+//!
+//! Implementations of the following traits:
+//!
+//! * `Not`
+//! * `Ord`
+//! * `TotalOrd`
+//! * `Eq`
+//! * `Default`
+//! * `Zero`
+//!
+//! A `to_bit` conversion function.
+
+use num::{Int, one, zero};
+
+#[cfg(not(test))] use cmp::{Eq, Ord, TotalOrd, Ordering, TotalEq};
+#[cfg(not(test))] use ops::{Not, BitAnd, BitOr, BitXor};
+#[cfg(not(test))] use default::Default;
+
+/////////////////////////////////////////////////////////////////////////////
+// Freestanding functions
+/////////////////////////////////////////////////////////////////////////////
+
+/// Convert a `bool` to an integer.
+///
+/// # Examples
+///
+/// ```rust
+/// use std::bool;
+///
+/// assert_eq!(bool::to_bit::<u8>(true), 1u8);
+/// assert_eq!(bool::to_bit::<u8>(false), 0u8);
+/// ```
+#[inline]
+pub fn to_bit<N: Int>(p: bool) -> N {
+ if p { one() } else { zero() }
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// Trait impls on `bool`
+/////////////////////////////////////////////////////////////////////////////
+
+#[cfg(not(test))]
+impl Not<bool> for bool {
+ /// The logical complement of a boolean value.
+ ///
+ /// # Examples
+ ///
+ /// ```rust
+ /// assert_eq!(!true, false);
+ /// assert_eq!(!false, true);
+ /// ```
+ #[inline]
+ fn not(&self) -> bool { !*self }
+}
+
+#[cfg(not(test))]
+impl BitAnd<bool, bool> for bool {
+ /// Conjunction of two boolean values.
+ ///
+ /// # Examples
+ ///
+ /// ```rust
+ /// assert_eq!(false.bitand(&false), false);
+ /// assert_eq!(true.bitand(&false), false);
+ /// assert_eq!(false.bitand(&true), false);
+ /// assert_eq!(true.bitand(&true), true);
+ ///
+ /// assert_eq!(false & false, false);
+ /// assert_eq!(true & false, false);
+ /// assert_eq!(false & true, false);
+ /// assert_eq!(true & true, true);
+ /// ```
+ #[inline]
+ fn bitand(&self, b: &bool) -> bool { *self & *b }
+}
+
+#[cfg(not(test))]
+impl BitOr<bool, bool> for bool {
+ /// Disjunction of two boolean values.
+ ///
+ /// # Examples
+ ///
+ /// ```rust
+ /// assert_eq!(false.bitor(&false), false);
+ /// assert_eq!(true.bitor(&false), true);
+ /// assert_eq!(false.bitor(&true), true);
+ /// assert_eq!(true.bitor(&true), true);
+ ///
+ /// assert_eq!(false | false, false);
+ /// assert_eq!(true | false, true);
+ /// assert_eq!(false | true, true);
+ /// assert_eq!(true | true, true);
+ /// ```
+ #[inline]
+ fn bitor(&self, b: &bool) -> bool { *self | *b }
+}
+
+#[cfg(not(test))]
+impl BitXor<bool, bool> for bool {
+ /// An 'exclusive or' of two boolean values.
+ ///
+ /// 'exclusive or' is identical to `or(and(a, not(b)), and(not(a), b))`.
+ ///
+ /// # Examples
+ ///
+ /// ```rust
+ /// assert_eq!(false.bitxor(&false), false);
+ /// assert_eq!(true.bitxor(&false), true);
+ /// assert_eq!(false.bitxor(&true), true);
+ /// assert_eq!(true.bitxor(&true), false);
+ ///
+ /// assert_eq!(false ^ false, false);
+ /// assert_eq!(true ^ false, true);
+ /// assert_eq!(false ^ true, true);
+ /// assert_eq!(true ^ true, false);
+ /// ```
+ #[inline]
+ fn bitxor(&self, b: &bool) -> bool { *self ^ *b }
+}
+
+#[cfg(not(test))]
+impl Ord for bool {
+ #[inline]
+ fn lt(&self, other: &bool) -> bool {
+ to_bit::<u8>(*self) < to_bit(*other)
+ }
+}
+
+#[cfg(not(test))]
+impl TotalOrd for bool {
+ #[inline]
+ fn cmp(&self, other: &bool) -> Ordering {
+ to_bit::<u8>(*self).cmp(&to_bit(*other))
+ }
+}
+
+/// Equality between two boolean values.
+///
+/// Two booleans are equal if they have the same value.
+///
+/// # Examples
+///
+/// ```rust
+/// assert_eq!(false.eq(&true), false);
+/// assert_eq!(false == false, true);
+/// assert_eq!(false != true, true);
+/// assert_eq!(false.ne(&false), false);
+/// ```
+#[cfg(not(test))]
+impl Eq for bool {
+ #[inline]
+ fn eq(&self, other: &bool) -> bool { (*self) == (*other) }
+}
+
+#[cfg(not(test))]
+impl TotalEq for bool {}
+
+#[cfg(not(test))]
+impl Default for bool {
+ fn default() -> bool { false }
+}
+
+#[cfg(test)]
+mod tests {
+ use realstd::prelude::*;
+ use super::to_bit;
+
+ #[test]
+ fn test_to_bit() {
+ assert_eq!(to_bit::<u8>(true), 1u8);
+ assert_eq!(to_bit::<u8>(false), 0u8);
+ }
+
+ #[test]
+ fn test_eq() {
+ assert_eq!(false.eq(&true), false);
+ assert_eq!(false == false, true);
+ assert_eq!(false != true, true);
+ assert_eq!(false.ne(&false), false);
+ }
+
+ #[test]
+ fn test_bitand() {
+ assert_eq!(false.bitand(&false), false);
+ assert_eq!(true.bitand(&false), false);
+ assert_eq!(false.bitand(&true), false);
+ assert_eq!(true.bitand(&true), true);
+
+ assert_eq!(false & false, false);
+ assert_eq!(true & false, false);
+ assert_eq!(false & true, false);
+ assert_eq!(true & true, true);
+ }
+
+ #[test]
+ fn test_bitor() {
+ assert_eq!(false.bitor(&false), false);
+ assert_eq!(true.bitor(&false), true);
+ assert_eq!(false.bitor(&true), true);
+ assert_eq!(true.bitor(&true), true);
+
+ assert_eq!(false | false, false);
+ assert_eq!(true | false, true);
+ assert_eq!(false | true, true);
+ assert_eq!(true | true, true);
+ }
+
+ #[test]
+ fn test_bitxor() {
+ assert_eq!(false.bitxor(&false), false);
+ assert_eq!(true.bitxor(&false), true);
+ assert_eq!(false.bitxor(&true), true);
+ assert_eq!(true.bitxor(&true), false);
+
+ assert_eq!(false ^ false, false);
+ assert_eq!(true ^ false, true);
+ assert_eq!(false ^ true, true);
+ assert_eq!(true ^ true, false);
+ }
+
+ #[test]
+ fn test_not() {
+ assert_eq!(!true, false);
+ assert_eq!(!false, true);
+ }
+
+ #[test]
+ fn test_to_str() {
+ assert_eq!(false.to_str(), "false".to_owned());
+ assert_eq!(true.to_str(), "true".to_owned());
+ }
+
+ #[test]
+ fn test_ord() {
+ assert!(true > false);
+ assert!(!(false > true));
+
+ assert!(false < true);
+ assert!(!(true < false));
+
+ assert!(false <= false);
+ assert!(false >= false);
+ assert!(true <= true);
+ assert!(true >= true);
+
+ assert!(false <= true);
+ assert!(!(false >= true));
+ assert!(true >= false);
+ assert!(!(true <= false));
+ }
+
+ #[test]
+ fn test_totalord() {
+ assert!(true.cmp(&true) == Equal);
+ assert!(false.cmp(&false) == Equal);
+ assert!(true.cmp(&false) == Greater);
+ assert!(false.cmp(&true) == Less);
+ }
+}
--- /dev/null
+// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Unsafe casting functions
+
+use mem;
+use intrinsics;
+use ptr::copy_nonoverlapping_memory;
+
+/// Casts the value at `src` to U. The two types must have the same length.
+#[inline]
+pub unsafe fn transmute_copy<T, U>(src: &T) -> U {
+ let mut dest: U = mem::uninit();
+ let dest_ptr: *mut u8 = transmute(&mut dest);
+ let src_ptr: *u8 = transmute(src);
+ copy_nonoverlapping_memory(dest_ptr, src_ptr, mem::size_of::<U>());
+ dest
+}
+
+/**
+ * Move a thing into the void
+ *
+ * The forget function will take ownership of the provided value but neglect
+ * to run any required cleanup or memory-management operations on it.
+ */
+#[inline]
+pub unsafe fn forget<T>(thing: T) { intrinsics::forget(thing); }
+
+/**
+ * Force-increment the reference count on a shared box. If used
+ * carelessly, this can leak the box.
+ */
+#[inline]
+pub unsafe fn bump_box_refcount<T>(t: @T) { forget(t); }
+
+/**
+ * Transform a value of one type into a value of another type.
+ * Both types must have the same size and alignment.
+ *
+ * # Example
+ *
+ * ```rust
+ * use std::cast;
+ *
+ * let v: &[u8] = unsafe { cast::transmute("L") };
+ * assert!(v == [76u8]);
+ * ```
+ */
+#[inline]
+pub unsafe fn transmute<L, G>(thing: L) -> G {
+ intrinsics::transmute(thing)
+}
+
+/// Coerce an immutable reference to be mutable.
+#[inline]
+#[deprecated="casting &T to &mut T is undefined behaviour: use Cell<T>, RefCell<T> or Unsafe<T>"]
+pub unsafe fn transmute_mut<'a,T>(ptr: &'a T) -> &'a mut T { transmute(ptr) }
+
+/// Coerce a reference to have an arbitrary associated lifetime.
+#[inline]
+pub unsafe fn transmute_lifetime<'a,'b,T>(ptr: &'a T) -> &'b T {
+ transmute(ptr)
+}
+
+/// Coerce an immutable reference to be mutable.
+#[inline]
+pub unsafe fn transmute_mut_unsafe<T>(ptr: *T) -> *mut T {
+ transmute(ptr)
+}
+
+/// Coerce a mutable reference to have an arbitrary associated lifetime.
+#[inline]
+pub unsafe fn transmute_mut_lifetime<'a,'b,T>(ptr: &'a mut T) -> &'b mut T {
+ transmute(ptr)
+}
+
+/// Transforms lifetime of the second pointer to match the first.
+#[inline]
+pub unsafe fn copy_lifetime<'a,S,T>(_ptr: &'a S, ptr: &T) -> &'a T {
+ transmute_lifetime(ptr)
+}
+
+/// Transforms lifetime of the second pointer to match the first.
+#[inline]
+pub unsafe fn copy_mut_lifetime<'a,S,T>(_ptr: &'a mut S, ptr: &mut T) -> &'a mut T {
+ transmute_mut_lifetime(ptr)
+}
+
+/// Transforms lifetime of the second pointer to match the first.
+#[inline]
+pub unsafe fn copy_lifetime_vec<'a,S,T>(_ptr: &'a [S], ptr: &T) -> &'a T {
+ transmute_lifetime(ptr)
+}
+
+
+/****************************************************************************
+ * Tests
+ ****************************************************************************/
+
+#[cfg(test)]
+mod tests {
+ use cast::{bump_box_refcount, transmute};
+ use raw;
+ use realstd::str::StrAllocating;
+
+ #[test]
+ fn test_transmute_copy() {
+ assert_eq!(1u, unsafe { ::cast::transmute_copy(&1) });
+ }
+
+ #[test]
+ fn test_bump_managed_refcount() {
+ unsafe {
+ let managed = @"box box box".to_owned(); // refcount 1
+ bump_box_refcount(managed); // refcount 2
+ let ptr: *int = transmute(managed); // refcount 2
+ let _box1: @~str = ::cast::transmute_copy(&ptr);
+ let _box2: @~str = ::cast::transmute_copy(&ptr);
+ assert!(*_box1 == "box box box".to_owned());
+ assert!(*_box2 == "box box box".to_owned());
+ // Will destroy _box1 and _box2. Without the bump, this would
+ // use-after-free. With too many bumps, it would leak.
+ }
+ }
+
+ #[test]
+ fn test_transmute() {
+ unsafe {
+ let x = @100u8;
+ let x: *raw::Box<u8> = transmute(x);
+ assert!((*x).data == 100);
+ let _x: @int = transmute(x);
+ }
+ }
+
+ #[test]
+ fn test_transmute2() {
+ unsafe {
+ assert_eq!(box [76u8], transmute("L".to_owned()));
+ }
+ }
+}
--- /dev/null
+// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Types dealing with dynamic mutability
+
+use clone::Clone;
+use cmp::Eq;
+use kinds::{marker, Copy};
+use ops::{Deref, DerefMut, Drop};
+use option::{None, Option, Some};
+use ty::Unsafe;
+
+/// A mutable memory location that admits only `Copy` data.
+pub struct Cell<T> {
+ value: Unsafe<T>,
+ noshare: marker::NoShare,
+}
+
+impl<T:Copy> Cell<T> {
+ /// Creates a new `Cell` containing the given value.
+ pub fn new(value: T) -> Cell<T> {
+ Cell {
+ value: Unsafe::new(value),
+ noshare: marker::NoShare,
+ }
+ }
+
+ /// Returns a copy of the contained value.
+ #[inline]
+ pub fn get(&self) -> T {
+ unsafe{ *self.value.get() }
+ }
+
+ /// Sets the contained value.
+ #[inline]
+ pub fn set(&self, value: T) {
+ unsafe {
+ *self.value.get() = value;
+ }
+ }
+}
+
+impl<T:Copy> Clone for Cell<T> {
+ fn clone(&self) -> Cell<T> {
+ Cell::new(self.get())
+ }
+}
+
+impl<T:Eq + Copy> Eq for Cell<T> {
+ fn eq(&self, other: &Cell<T>) -> bool {
+ self.get() == other.get()
+ }
+}
+
+/// A mutable memory location with dynamically checked borrow rules
+pub struct RefCell<T> {
+ value: Unsafe<T>,
+ borrow: Cell<BorrowFlag>,
+ nocopy: marker::NoCopy,
+ noshare: marker::NoShare,
+}
+
+// Values [1, MAX-1] represent the number of `Ref` active
+// (will not outgrow its range since `uint` is the size of the address space)
+type BorrowFlag = uint;
+static UNUSED: BorrowFlag = 0;
+static WRITING: BorrowFlag = -1;
+
+impl<T> RefCell<T> {
+ /// Create a new `RefCell` containing `value`
+ pub fn new(value: T) -> RefCell<T> {
+ RefCell {
+ value: Unsafe::new(value),
+ borrow: Cell::new(UNUSED),
+ nocopy: marker::NoCopy,
+ noshare: marker::NoShare,
+ }
+ }
+
+ /// Consumes the `RefCell`, returning the wrapped value.
+ pub fn unwrap(self) -> T {
+ debug_assert!(self.borrow.get() == UNUSED);
+ unsafe{self.value.unwrap()}
+ }
+
+ /// Attempts to immutably borrow the wrapped value.
+ ///
+ /// The borrow lasts until the returned `Ref` exits scope. Multiple
+ /// immutable borrows can be taken out at the same time.
+ ///
+ /// Returns `None` if the value is currently mutably borrowed.
+ pub fn try_borrow<'a>(&'a self) -> Option<Ref<'a, T>> {
+ match self.borrow.get() {
+ WRITING => None,
+ borrow => {
+ self.borrow.set(borrow + 1);
+ Some(Ref { parent: self })
+ }
+ }
+ }
+
+ /// Immutably borrows the wrapped value.
+ ///
+ /// The borrow lasts until the returned `Ref` exits scope. Multiple
+ /// immutable borrows can be taken out at the same time.
+ ///
+ /// # Failure
+ ///
+ /// Fails if the value is currently mutably borrowed.
+ pub fn borrow<'a>(&'a self) -> Ref<'a, T> {
+ match self.try_borrow() {
+ Some(ptr) => ptr,
+ None => fail!("RefCell<T> already mutably borrowed")
+ }
+ }
+
+ /// Mutably borrows the wrapped value.
+ ///
+ /// The borrow lasts until the returned `RefMut` exits scope. The value
+ /// cannot be borrowed while this borrow is active.
+ ///
+ /// Returns `None` if the value is currently borrowed.
+ pub fn try_borrow_mut<'a>(&'a self) -> Option<RefMut<'a, T>> {
+ match self.borrow.get() {
+ UNUSED => {
+ self.borrow.set(WRITING);
+ Some(RefMut { parent: self })
+ },
+ _ => None
+ }
+ }
+
+ /// Mutably borrows the wrapped value.
+ ///
+ /// The borrow lasts until the returned `RefMut` exits scope. The value
+ /// cannot be borrowed while this borrow is active.
+ ///
+ /// # Failure
+ ///
+ /// Fails if the value is currently borrowed.
+ pub fn borrow_mut<'a>(&'a self) -> RefMut<'a, T> {
+ match self.try_borrow_mut() {
+ Some(ptr) => ptr,
+ None => fail!("RefCell<T> already borrowed")
+ }
+ }
+}
+
+impl<T: Clone> Clone for RefCell<T> {
+ fn clone(&self) -> RefCell<T> {
+ RefCell::new(self.borrow().clone())
+ }
+}
+
+impl<T: Eq> Eq for RefCell<T> {
+ fn eq(&self, other: &RefCell<T>) -> bool {
+ *self.borrow() == *other.borrow()
+ }
+}
+
+/// Wraps a borrowed reference to a value in a `RefCell` box.
+pub struct Ref<'b, T> {
+ parent: &'b RefCell<T>
+}
+
+#[unsafe_destructor]
+impl<'b, T> Drop for Ref<'b, T> {
+ fn drop(&mut self) {
+ let borrow = self.parent.borrow.get();
+ debug_assert!(borrow != WRITING && borrow != UNUSED);
+ self.parent.borrow.set(borrow - 1);
+ }
+}
+
+impl<'b, T> Deref<T> for Ref<'b, T> {
+ #[inline]
+ fn deref<'a>(&'a self) -> &'a T {
+ unsafe { &*self.parent.value.get() }
+ }
+}
+
+/// Wraps a mutable borrowed reference to a value in a `RefCell` box.
+pub struct RefMut<'b, T> {
+ parent: &'b RefCell<T>
+}
+
+#[unsafe_destructor]
+impl<'b, T> Drop for RefMut<'b, T> {
+ fn drop(&mut self) {
+ let borrow = self.parent.borrow.get();
+ debug_assert!(borrow == WRITING);
+ self.parent.borrow.set(UNUSED);
+ }
+}
+
+impl<'b, T> Deref<T> for RefMut<'b, T> {
+ #[inline]
+ fn deref<'a>(&'a self) -> &'a T {
+ unsafe { &*self.parent.value.get() }
+ }
+}
+
+impl<'b, T> DerefMut<T> for RefMut<'b, T> {
+ #[inline]
+ fn deref_mut<'a>(&'a mut self) -> &'a mut T {
+ unsafe { &mut *self.parent.value.get() }
+ }
+}
+
+#[cfg(test)]
+mod test {
+ use super::*;
+
+ #[test]
+ fn smoketest_cell() {
+ let x = Cell::new(10);
+ assert!(x == Cell::new(10));
+ assert!(x.get() == 10);
+ x.set(20);
+ assert!(x == Cell::new(20));
+ assert!(x.get() == 20);
+
+ let y = Cell::new((30, 40));
+ assert!(y == Cell::new((30, 40)));
+ assert!(y.get() == (30, 40));
+ }
+
+ #[test]
+ fn cell_has_sensible_show() {
+ use str::StrSlice;
+
+ let x = ::realcore::cell::Cell::new("foo bar");
+ assert!(format!("{}", x).contains(x.get()));
+
+ x.set("baz qux");
+ assert!(format!("{}", x).contains(x.get()));
+ }
+
+ #[test]
+ fn double_imm_borrow() {
+ let x = RefCell::new(0);
+ let _b1 = x.borrow();
+ x.borrow();
+ }
+
+ #[test]
+ fn no_mut_then_imm_borrow() {
+ let x = RefCell::new(0);
+ let _b1 = x.borrow_mut();
+ assert!(x.try_borrow().is_none());
+ }
+
+ #[test]
+ fn no_imm_then_borrow_mut() {
+ let x = RefCell::new(0);
+ let _b1 = x.borrow();
+ assert!(x.try_borrow_mut().is_none());
+ }
+
+ #[test]
+ fn no_double_borrow_mut() {
+ let x = RefCell::new(0);
+ let _b1 = x.borrow_mut();
+ assert!(x.try_borrow_mut().is_none());
+ }
+
+ #[test]
+ fn imm_release_borrow_mut() {
+ let x = RefCell::new(0);
+ {
+ let _b1 = x.borrow();
+ }
+ x.borrow_mut();
+ }
+
+ #[test]
+ fn mut_release_borrow_mut() {
+ let x = RefCell::new(0);
+ {
+ let _b1 = x.borrow_mut();
+ }
+ x.borrow();
+ }
+
+ #[test]
+ fn double_borrow_single_release_no_borrow_mut() {
+ let x = RefCell::new(0);
+ let _b1 = x.borrow();
+ {
+ let _b2 = x.borrow();
+ }
+ assert!(x.try_borrow_mut().is_none());
+ }
+
+ #[test]
+ #[should_fail]
+ fn discard_doesnt_unborrow() {
+ let x = RefCell::new(0);
+ let _b = x.borrow();
+ let _ = _b;
+ let _b = x.borrow_mut();
+ }
+}
--- /dev/null
+// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Character manipulation (`char` type, Unicode Scalar Value)
+//!
+//! This module provides the `Char` trait, as well as its implementation
+//! for the primitive `char` type, in order to allow basic character manipulation.
+//!
+//! A `char` actually represents a
+//! *[Unicode Scalar Value](http://www.unicode.org/glossary/#unicode_scalar_value)*,
+//! as it can contain any Unicode code point except high-surrogate and
+//! low-surrogate code points.
+//!
+//! As such, only values in the ranges \[0x0,0xD7FF\] and \[0xE000,0x10FFFF\]
+//! (inclusive) are allowed. A `char` can always be safely cast to a `u32`;
+//! however the converse is not always true due to the above range limits
+//! and, as such, should be performed via the `from_u32` function..
+
+
+use cast::transmute;
+use option::{None, Option, Some};
+use iter::{Iterator, range_step};
+use unicode::{derived_property, property, general_category, decompose, conversions};
+
+#[cfg(not(test))] use cmp::{Eq, Ord, TotalEq, TotalOrd, Ordering};
+#[cfg(not(test))] use default::Default;
+
+// UTF-8 ranges and tags for encoding characters
+static TAG_CONT: uint = 128u;
+static MAX_ONE_B: uint = 128u;
+static TAG_TWO_B: uint = 192u;
+static MAX_TWO_B: uint = 2048u;
+static TAG_THREE_B: uint = 224u;
+static MAX_THREE_B: uint = 65536u;
+static TAG_FOUR_B: uint = 240u;
+
+/*
+ Lu Uppercase_Letter an uppercase letter
+ Ll Lowercase_Letter a lowercase letter
+ Lt Titlecase_Letter a digraphic character, with first part uppercase
+ Lm Modifier_Letter a modifier letter
+ Lo Other_Letter other letters, including syllables and ideographs
+ Mn Nonspacing_Mark a nonspacing combining mark (zero advance width)
+ Mc Spacing_Mark a spacing combining mark (positive advance width)
+ Me Enclosing_Mark an enclosing combining mark
+ Nd Decimal_Number a decimal digit
+ Nl Letter_Number a letterlike numeric character
+ No Other_Number a numeric character of other type
+ Pc Connector_Punctuation a connecting punctuation mark, like a tie
+ Pd Dash_Punctuation a dash or hyphen punctuation mark
+ Ps Open_Punctuation an opening punctuation mark (of a pair)
+ Pe Close_Punctuation a closing punctuation mark (of a pair)
+ Pi Initial_Punctuation an initial quotation mark
+ Pf Final_Punctuation a final quotation mark
+ Po Other_Punctuation a punctuation mark of other type
+ Sm Math_Symbol a symbol of primarily mathematical use
+ Sc Currency_Symbol a currency sign
+ Sk Modifier_Symbol a non-letterlike modifier symbol
+ So Other_Symbol a symbol of other type
+ Zs Space_Separator a space character (of various non-zero widths)
+ Zl Line_Separator U+2028 LINE SEPARATOR only
+ Zp Paragraph_Separator U+2029 PARAGRAPH SEPARATOR only
+ Cc Control a C0 or C1 control code
+ Cf Format a format control character
+ Cs Surrogate a surrogate code point
+ Co Private_Use a private-use character
+ Cn Unassigned a reserved unassigned code point or a noncharacter
+*/
+
+/// The highest valid code point
+pub static MAX: char = '\U0010ffff';
+
+/// Converts from `u32` to a `char`
+#[inline]
+pub fn from_u32(i: u32) -> Option<char> {
+ // catch out-of-bounds and surrogates
+ if (i > MAX as u32) || (i >= 0xD800 && i <= 0xDFFF) {
+ None
+ } else {
+ Some(unsafe { transmute(i) })
+ }
+}
+
+/// Returns whether the specified `char` is considered a Unicode alphabetic
+/// code point
+pub fn is_alphabetic(c: char) -> bool { derived_property::Alphabetic(c) }
+
+/// Returns whether the specified `char` satisfies the 'XID_Start' Unicode property
+///
+/// 'XID_Start' is a Unicode Derived Property specified in
+/// [UAX #31](http://unicode.org/reports/tr31/#NFKC_Modifications),
+/// mostly similar to ID_Start but modified for closure under NFKx.
+pub fn is_XID_start(c: char) -> bool { derived_property::XID_Start(c) }
+
+/// Returns whether the specified `char` satisfies the 'XID_Continue' Unicode property
+///
+/// 'XID_Continue' is a Unicode Derived Property specified in
+/// [UAX #31](http://unicode.org/reports/tr31/#NFKC_Modifications),
+/// mostly similar to 'ID_Continue' but modified for closure under NFKx.
+pub fn is_XID_continue(c: char) -> bool { derived_property::XID_Continue(c) }
+
+///
+/// Indicates whether a `char` is in lower case
+///
+/// This is defined according to the terms of the Unicode Derived Core Property 'Lowercase'.
+///
+#[inline]
+pub fn is_lowercase(c: char) -> bool { derived_property::Lowercase(c) }
+
+///
+/// Indicates whether a `char` is in upper case
+///
+/// This is defined according to the terms of the Unicode Derived Core Property 'Uppercase'.
+///
+#[inline]
+pub fn is_uppercase(c: char) -> bool { derived_property::Uppercase(c) }
+
+///
+/// Indicates whether a `char` is whitespace
+///
+/// Whitespace is defined in terms of the Unicode Property 'White_Space'.
+///
+#[inline]
+pub fn is_whitespace(c: char) -> bool {
+ // As an optimization ASCII whitespace characters are checked separately
+ c == ' '
+ || ('\x09' <= c && c <= '\x0d')
+ || property::White_Space(c)
+}
+
+///
+/// Indicates whether a `char` is alphanumeric
+///
+/// Alphanumericness is defined in terms of the Unicode General Categories
+/// 'Nd', 'Nl', 'No' and the Derived Core Property 'Alphabetic'.
+///
+#[inline]
+pub fn is_alphanumeric(c: char) -> bool {
+ derived_property::Alphabetic(c)
+ || general_category::Nd(c)
+ || general_category::Nl(c)
+ || general_category::No(c)
+}
+
+///
+/// Indicates whether a `char` is a control code point
+///
+/// Control code points are defined in terms of the Unicode General Category
+/// 'Cc'.
+///
+#[inline]
+pub fn is_control(c: char) -> bool { general_category::Cc(c) }
+
+/// Indicates whether the `char` is numeric (Nd, Nl, or No)
+#[inline]
+pub fn is_digit(c: char) -> bool {
+ general_category::Nd(c)
+ || general_category::Nl(c)
+ || general_category::No(c)
+}
+
+///
+/// Checks if a `char` parses as a numeric digit in the given radix
+///
+/// Compared to `is_digit()`, this function only recognizes the
+/// characters `0-9`, `a-z` and `A-Z`.
+///
+/// # Return value
+///
+/// Returns `true` if `c` is a valid digit under `radix`, and `false`
+/// otherwise.
+///
+/// # Failure
+///
+/// Fails if given a `radix` > 36.
+///
+/// # Note
+///
+/// This just wraps `to_digit()`.
+///
+#[inline]
+pub fn is_digit_radix(c: char, radix: uint) -> bool {
+ match to_digit(c, radix) {
+ Some(_) => true,
+ None => false,
+ }
+}
+
+///
+/// Converts a `char` to the corresponding digit
+///
+/// # Return value
+///
+/// If `c` is between '0' and '9', the corresponding value
+/// between 0 and 9. If `c` is 'a' or 'A', 10. If `c` is
+/// 'b' or 'B', 11, etc. Returns none if the `char` does not
+/// refer to a digit in the given radix.
+///
+/// # Failure
+///
+/// Fails if given a `radix` outside the range `[0..36]`.
+///
+#[inline]
+pub fn to_digit(c: char, radix: uint) -> Option<uint> {
+ if radix > 36 {
+ fail!("to_digit: radix is too high (maximum 36)");
+ }
+ let val = match c {
+ '0' .. '9' => c as uint - ('0' as uint),
+ 'a' .. 'z' => c as uint + 10u - ('a' as uint),
+ 'A' .. 'Z' => c as uint + 10u - ('A' as uint),
+ _ => return None,
+ };
+ if val < radix { Some(val) }
+ else { None }
+}
+
+/// Convert a char to its uppercase equivalent
+///
+/// The case-folding performed is the common or simple mapping:
+/// it maps one unicode codepoint (one char in Rust) to its uppercase equivalent according
+/// to the Unicode database at ftp://ftp.unicode.org/Public/UNIDATA/UnicodeData.txt
+/// The additional SpecialCasing.txt is not considered here, as it expands to multiple
+/// codepoints in some cases.
+///
+/// A full reference can be found here
+/// http://www.unicode.org/versions/Unicode4.0.0/ch03.pdf#G33992
+///
+/// # Return value
+///
+/// Returns the char itself if no conversion was made
+#[inline]
+pub fn to_uppercase(c: char) -> char {
+ conversions::to_upper(c)
+}
+
+/// Convert a char to its lowercase equivalent
+///
+/// The case-folding performed is the common or simple mapping
+/// see `to_uppercase` for references and more information
+///
+/// # Return value
+///
+/// Returns the char itself if no conversion if possible
+#[inline]
+pub fn to_lowercase(c: char) -> char {
+ conversions::to_lower(c)
+}
+
+///
+/// Converts a number to the character representing it
+///
+/// # Return value
+///
+/// Returns `Some(char)` if `num` represents one digit under `radix`,
+/// using one character of `0-9` or `a-z`, or `None` if it doesn't.
+///
+/// # Failure
+///
+/// Fails if given an `radix` > 36.
+///
+#[inline]
+pub fn from_digit(num: uint, radix: uint) -> Option<char> {
+ if radix > 36 {
+ fail!("from_digit: radix is to high (maximum 36)");
+ }
+ if num < radix {
+ unsafe {
+ if num < 10 {
+ Some(transmute(('0' as uint + num) as u32))
+ } else {
+ Some(transmute(('a' as uint + num - 10u) as u32))
+ }
+ }
+ } else {
+ None
+ }
+}
+
+// Constants from Unicode 6.2.0 Section 3.12 Conjoining Jamo Behavior
+static S_BASE: uint = 0xAC00;
+static L_BASE: uint = 0x1100;
+static V_BASE: uint = 0x1161;
+static T_BASE: uint = 0x11A7;
+static L_COUNT: uint = 19;
+static V_COUNT: uint = 21;
+static T_COUNT: uint = 28;
+static N_COUNT: uint = (V_COUNT * T_COUNT);
+static S_COUNT: uint = (L_COUNT * N_COUNT);
+
+// Decompose a precomposed Hangul syllable
+fn decompose_hangul(s: char, f: |char|) {
+ let si = s as uint - S_BASE;
+
+ let li = si / N_COUNT;
+ unsafe {
+ f(transmute((L_BASE + li) as u32));
+
+ let vi = (si % N_COUNT) / T_COUNT;
+ f(transmute((V_BASE + vi) as u32));
+
+ let ti = si % T_COUNT;
+ if ti > 0 {
+ f(transmute((T_BASE + ti) as u32));
+ }
+ }
+}
+
+/// Returns the canonical decomposition of a character
+pub fn decompose_canonical(c: char, f: |char|) {
+ if (c as uint) < S_BASE || (c as uint) >= (S_BASE + S_COUNT) {
+ decompose::canonical(c, f);
+ } else {
+ decompose_hangul(c, f);
+ }
+}
+
+/// Returns the compatibility decomposition of a character
+pub fn decompose_compatible(c: char, f: |char|) {
+ if (c as uint) < S_BASE || (c as uint) >= (S_BASE + S_COUNT) {
+ decompose::compatibility(c, f);
+ } else {
+ decompose_hangul(c, f);
+ }
+}
+
+///
+/// Returns the hexadecimal Unicode escape of a `char`
+///
+/// The rules are as follows:
+///
+/// - chars in [0,0xff] get 2-digit escapes: `\\xNN`
+/// - chars in [0x100,0xffff] get 4-digit escapes: `\\uNNNN`
+/// - chars above 0x10000 get 8-digit escapes: `\\UNNNNNNNN`
+///
+pub fn escape_unicode(c: char, f: |char|) {
+ // avoid calling str::to_str_radix because we don't really need to allocate
+ // here.
+ f('\\');
+ let pad = match () {
+ _ if c <= '\xff' => { f('x'); 2 }
+ _ if c <= '\uffff' => { f('u'); 4 }
+ _ => { f('U'); 8 }
+ };
+ for offset in range_step::<i32>(4 * (pad - 1), -1, -4) {
+ unsafe {
+ match ((c as i32) >> offset) & 0xf {
+ i @ 0 .. 9 => { f(transmute('0' as i32 + i)); }
+ i => { f(transmute('a' as i32 + (i - 10))); }
+ }
+ }
+ }
+}
+
+///
+/// Returns a 'default' ASCII and C++11-like literal escape of a `char`
+///
+/// The default is chosen with a bias toward producing literals that are
+/// legal in a variety of languages, including C++11 and similar C-family
+/// languages. The exact rules are:
+///
+/// - Tab, CR and LF are escaped as '\t', '\r' and '\n' respectively.
+/// - Single-quote, double-quote and backslash chars are backslash-escaped.
+/// - Any other chars in the range [0x20,0x7e] are not escaped.
+/// - Any other chars are given hex unicode escapes; see `escape_unicode`.
+///
+pub fn escape_default(c: char, f: |char|) {
+ match c {
+ '\t' => { f('\\'); f('t'); }
+ '\r' => { f('\\'); f('r'); }
+ '\n' => { f('\\'); f('n'); }
+ '\\' => { f('\\'); f('\\'); }
+ '\'' => { f('\\'); f('\''); }
+ '"' => { f('\\'); f('"'); }
+ '\x20' .. '\x7e' => { f(c); }
+ _ => c.escape_unicode(f),
+ }
+}
+
+/// Returns the amount of bytes this `char` would need if encoded in UTF-8
+pub fn len_utf8_bytes(c: char) -> uint {
+ static MAX_ONE_B: uint = 128u;
+ static MAX_TWO_B: uint = 2048u;
+ static MAX_THREE_B: uint = 65536u;
+ static MAX_FOUR_B: uint = 2097152u;
+
+ let code = c as uint;
+ match () {
+ _ if code < MAX_ONE_B => 1u,
+ _ if code < MAX_TWO_B => 2u,
+ _ if code < MAX_THREE_B => 3u,
+ _ if code < MAX_FOUR_B => 4u,
+ _ => fail!("invalid character!"),
+ }
+}
+
+/// Useful functions for Unicode characters.
+pub trait Char {
+ /// Returns whether the specified character is considered a Unicode
+ /// alphabetic code point.
+ fn is_alphabetic(&self) -> bool;
+
+ /// Returns whether the specified character satisfies the 'XID_Start'
+ /// Unicode property.
+ ///
+ /// 'XID_Start' is a Unicode Derived Property specified in
+ /// [UAX #31](http://unicode.org/reports/tr31/#NFKC_Modifications),
+ /// mostly similar to ID_Start but modified for closure under NFKx.
+ fn is_XID_start(&self) -> bool;
+
+ /// Returns whether the specified `char` satisfies the 'XID_Continue'
+ /// Unicode property.
+ ///
+ /// 'XID_Continue' is a Unicode Derived Property specified in
+ /// [UAX #31](http://unicode.org/reports/tr31/#NFKC_Modifications),
+ /// mostly similar to 'ID_Continue' but modified for closure under NFKx.
+ fn is_XID_continue(&self) -> bool;
+
+
+ /// Indicates whether a character is in lowercase.
+ ///
+ /// This is defined according to the terms of the Unicode Derived Core
+ /// Property `Lowercase`.
+ fn is_lowercase(&self) -> bool;
+
+ /// Indicates whether a character is in uppercase.
+ ///
+ /// This is defined according to the terms of the Unicode Derived Core
+ /// Property `Uppercase`.
+ fn is_uppercase(&self) -> bool;
+
+ /// Indicates whether a character is whitespace.
+ ///
+ /// Whitespace is defined in terms of the Unicode Property `White_Space`.
+ fn is_whitespace(&self) -> bool;
+
+ /// Indicates whether a character is alphanumeric.
+ ///
+ /// Alphanumericness is defined in terms of the Unicode General Categories
+ /// 'Nd', 'Nl', 'No' and the Derived Core Property 'Alphabetic'.
+ fn is_alphanumeric(&self) -> bool;
+
+ /// Indicates whether a character is a control code point.
+ ///
+ /// Control code points are defined in terms of the Unicode General
+ /// Category `Cc`.
+ fn is_control(&self) -> bool;
+
+ /// Indicates whether the character is numeric (Nd, Nl, or No).
+ fn is_digit(&self) -> bool;
+
+ /// Checks if a `char` parses as a numeric digit in the given radix.
+ ///
+ /// Compared to `is_digit()`, this function only recognizes the characters
+ /// `0-9`, `a-z` and `A-Z`.
+ ///
+ /// # Return value
+ ///
+ /// Returns `true` if `c` is a valid digit under `radix`, and `false`
+ /// otherwise.
+ ///
+ /// # Failure
+ ///
+ /// Fails if given a radix > 36.
+ fn is_digit_radix(&self, radix: uint) -> bool;
+
+ /// Converts a character to the corresponding digit.
+ ///
+ /// # Return value
+ ///
+ /// If `c` is between '0' and '9', the corresponding value between 0 and
+ /// 9. If `c` is 'a' or 'A', 10. If `c` is 'b' or 'B', 11, etc. Returns
+ /// none if the character does not refer to a digit in the given radix.
+ ///
+ /// # Failure
+ ///
+ /// Fails if given a radix outside the range [0..36].
+ fn to_digit(&self, radix: uint) -> Option<uint>;
+
+ /// Converts a character to its lowercase equivalent.
+ ///
+ /// The case-folding performed is the common or simple mapping. See
+ /// `to_uppercase()` for references and more information.
+ ///
+ /// # Return value
+ ///
+ /// Returns the lowercase equivalent of the character, or the character
+ /// itself if no conversion is possible.
+ fn to_lowercase(&self) -> char;
+
+ /// Converts a character to its uppercase equivalent.
+ ///
+ /// The case-folding performed is the common or simple mapping: it maps
+ /// one unicode codepoint (one character in Rust) to its uppercase
+ /// equivalent according to the Unicode database [1]. The additional
+ /// `SpecialCasing.txt` is not considered here, as it expands to multiple
+ /// codepoints in some cases.
+ ///
+ /// A full reference can be found here [2].
+ ///
+ /// # Return value
+ ///
+ /// Returns the uppercase equivalent of the character, or the character
+ /// itself if no conversion was made.
+ ///
+ /// [1]: ftp://ftp.unicode.org/Public/UNIDATA/UnicodeData.txt
+ ///
+ /// [2]: http://www.unicode.org/versions/Unicode4.0.0/ch03.pdf#G33992
+ fn to_uppercase(&self) -> char;
+
+ /// Converts a number to the character representing it.
+ ///
+ /// # Return value
+ ///
+ /// Returns `Some(char)` if `num` represents one digit under `radix`,
+ /// using one character of `0-9` or `a-z`, or `None` if it doesn't.
+ ///
+ /// # Failure
+ ///
+ /// Fails if given a radix > 36.
+ fn from_digit(num: uint, radix: uint) -> Option<char>;
+
+ /// Returns the hexadecimal Unicode escape of a character.
+ ///
+ /// The rules are as follows:
+ ///
+ /// * Characters in [0,0xff] get 2-digit escapes: `\\xNN`
+ /// * Characters in [0x100,0xffff] get 4-digit escapes: `\\uNNNN`.
+ /// * Characters above 0x10000 get 8-digit escapes: `\\UNNNNNNNN`.
+ fn escape_unicode(&self, f: |char|);
+
+ /// Returns a 'default' ASCII and C++11-like literal escape of a
+ /// character.
+ ///
+ /// The default is chosen with a bias toward producing literals that are
+ /// legal in a variety of languages, including C++11 and similar C-family
+ /// languages. The exact rules are:
+ ///
+ /// * Tab, CR and LF are escaped as '\t', '\r' and '\n' respectively.
+ /// * Single-quote, double-quote and backslash chars are backslash-
+ /// escaped.
+ /// * Any other chars in the range [0x20,0x7e] are not escaped.
+ /// * Any other chars are given hex unicode escapes; see `escape_unicode`.
+ fn escape_default(&self, f: |char|);
+
+ /// Returns the amount of bytes this character would need if encoded in
+ /// UTF-8.
+ fn len_utf8_bytes(&self) -> uint;
+
+ /// Encodes this character as UTF-8 into the provided byte buffer.
+ ///
+ /// The buffer must be at least 4 bytes long or a runtime failure may
+ /// occur.
+ ///
+ /// This will then return the number of bytes written to the slice.
+ fn encode_utf8(&self, dst: &mut [u8]) -> uint;
+
+ /// Encodes this character as UTF-16 into the provided `u16` buffer.
+ ///
+ /// The buffer must be at least 2 elements long or a runtime failure may
+ /// occur.
+ ///
+ /// This will then return the number of `u16`s written to the slice.
+ fn encode_utf16(&self, dst: &mut [u16]) -> uint;
+}
+
+impl Char for char {
+ fn is_alphabetic(&self) -> bool { is_alphabetic(*self) }
+
+ fn is_XID_start(&self) -> bool { is_XID_start(*self) }
+
+ fn is_XID_continue(&self) -> bool { is_XID_continue(*self) }
+
+ fn is_lowercase(&self) -> bool { is_lowercase(*self) }
+
+ fn is_uppercase(&self) -> bool { is_uppercase(*self) }
+
+ fn is_whitespace(&self) -> bool { is_whitespace(*self) }
+
+ fn is_alphanumeric(&self) -> bool { is_alphanumeric(*self) }
+
+ fn is_control(&self) -> bool { is_control(*self) }
+
+ fn is_digit(&self) -> bool { is_digit(*self) }
+
+ fn is_digit_radix(&self, radix: uint) -> bool { is_digit_radix(*self, radix) }
+
+ fn to_digit(&self, radix: uint) -> Option<uint> { to_digit(*self, radix) }
+
+ fn to_lowercase(&self) -> char { to_lowercase(*self) }
+
+ fn to_uppercase(&self) -> char { to_uppercase(*self) }
+
+ fn from_digit(num: uint, radix: uint) -> Option<char> { from_digit(num, radix) }
+
+ fn escape_unicode(&self, f: |char|) { escape_unicode(*self, f) }
+
+ fn escape_default(&self, f: |char|) { escape_default(*self, f) }
+
+ fn len_utf8_bytes(&self) -> uint { len_utf8_bytes(*self) }
+
+ fn encode_utf8(&self, dst: &mut [u8]) -> uint {
+ let code = *self as uint;
+ if code < MAX_ONE_B {
+ dst[0] = code as u8;
+ return 1;
+ } else if code < MAX_TWO_B {
+ dst[0] = (code >> 6u & 31u | TAG_TWO_B) as u8;
+ dst[1] = (code & 63u | TAG_CONT) as u8;
+ return 2;
+ } else if code < MAX_THREE_B {
+ dst[0] = (code >> 12u & 15u | TAG_THREE_B) as u8;
+ dst[1] = (code >> 6u & 63u | TAG_CONT) as u8;
+ dst[2] = (code & 63u | TAG_CONT) as u8;
+ return 3;
+ } else {
+ dst[0] = (code >> 18u & 7u | TAG_FOUR_B) as u8;
+ dst[1] = (code >> 12u & 63u | TAG_CONT) as u8;
+ dst[2] = (code >> 6u & 63u | TAG_CONT) as u8;
+ dst[3] = (code & 63u | TAG_CONT) as u8;
+ return 4;
+ }
+ }
+
+ fn encode_utf16(&self, dst: &mut [u16]) -> uint {
+ let mut ch = *self as uint;
+ if (ch & 0xFFFF_u) == ch {
+ // The BMP falls through (assuming non-surrogate, as it
+ // should)
+ assert!(ch <= 0xD7FF_u || ch >= 0xE000_u);
+ dst[0] = ch as u16;
+ 1
+ } else {
+ // Supplementary planes break into surrogates.
+ assert!(ch >= 0x1_0000_u && ch <= 0x10_FFFF_u);
+ ch -= 0x1_0000_u;
+ dst[0] = 0xD800_u16 | ((ch >> 10) as u16);
+ dst[1] = 0xDC00_u16 | ((ch as u16) & 0x3FF_u16);
+ 2
+ }
+ }
+}
+
+#[cfg(not(test))]
+impl Eq for char {
+ #[inline]
+ fn eq(&self, other: &char) -> bool { (*self) == (*other) }
+}
+
+#[cfg(not(test))]
+impl TotalEq for char {}
+
+#[cfg(not(test))]
+impl Ord for char {
+ #[inline]
+ fn lt(&self, other: &char) -> bool { *self < *other }
+}
+
+#[cfg(not(test))]
+impl TotalOrd for char {
+ fn cmp(&self, other: &char) -> Ordering {
+ (*self as u32).cmp(&(*other as u32))
+ }
+}
+
+#[cfg(not(test))]
+impl Default for char {
+ #[inline]
+ fn default() -> char { '\x00' }
+}
+
+#[cfg(test)]
+mod test {
+ use super::{escape_unicode, escape_default};
+
+ use realcore::char::Char;
+ use slice::ImmutableVector;
+ use realstd::option::{Some, None};
+ use realstd::strbuf::StrBuf;
+ use realstd::str::StrAllocating;
+
+ #[test]
+ fn test_is_lowercase() {
+ assert!('a'.is_lowercase());
+ assert!('ö'.is_lowercase());
+ assert!('ß'.is_lowercase());
+ assert!(!'Ü'.is_lowercase());
+ assert!(!'P'.is_lowercase());
+ }
+
+ #[test]
+ fn test_is_uppercase() {
+ assert!(!'h'.is_uppercase());
+ assert!(!'ä'.is_uppercase());
+ assert!(!'ß'.is_uppercase());
+ assert!('Ö'.is_uppercase());
+ assert!('T'.is_uppercase());
+ }
+
+ #[test]
+ fn test_is_whitespace() {
+ assert!(' '.is_whitespace());
+ assert!('\u2007'.is_whitespace());
+ assert!('\t'.is_whitespace());
+ assert!('\n'.is_whitespace());
+ assert!(!'a'.is_whitespace());
+ assert!(!'_'.is_whitespace());
+ assert!(!'\u0000'.is_whitespace());
+ }
+
+ #[test]
+ fn test_to_digit() {
+ assert_eq!('0'.to_digit(10u), Some(0u));
+ assert_eq!('1'.to_digit(2u), Some(1u));
+ assert_eq!('2'.to_digit(3u), Some(2u));
+ assert_eq!('9'.to_digit(10u), Some(9u));
+ assert_eq!('a'.to_digit(16u), Some(10u));
+ assert_eq!('A'.to_digit(16u), Some(10u));
+ assert_eq!('b'.to_digit(16u), Some(11u));
+ assert_eq!('B'.to_digit(16u), Some(11u));
+ assert_eq!('z'.to_digit(36u), Some(35u));
+ assert_eq!('Z'.to_digit(36u), Some(35u));
+ assert_eq!(' '.to_digit(10u), None);
+ assert_eq!('$'.to_digit(36u), None);
+ }
+
+ #[test]
+ fn test_to_lowercase() {
+ assert_eq!('A'.to_lowercase(), 'a');
+ assert_eq!('Ö'.to_lowercase(), 'ö');
+ assert_eq!('ß'.to_lowercase(), 'ß');
+ assert_eq!('Ü'.to_lowercase(), 'ü');
+ assert_eq!('💩'.to_lowercase(), '💩');
+ assert_eq!('Σ'.to_lowercase(), 'σ');
+ assert_eq!('Τ'.to_lowercase(), 'τ');
+ assert_eq!('Ι'.to_lowercase(), 'ι');
+ assert_eq!('Γ'.to_lowercase(), 'γ');
+ assert_eq!('Μ'.to_lowercase(), 'μ');
+ assert_eq!('Α'.to_lowercase(), 'α');
+ assert_eq!('Σ'.to_lowercase(), 'σ');
+ }
+
+ #[test]
+ fn test_to_uppercase() {
+ assert_eq!('a'.to_uppercase(), 'A');
+ assert_eq!('ö'.to_uppercase(), 'Ö');
+ assert_eq!('ß'.to_uppercase(), 'ß'); // not ẞ: Latin capital letter sharp s
+ assert_eq!('ü'.to_uppercase(), 'Ü');
+ assert_eq!('💩'.to_uppercase(), '💩');
+
+ assert_eq!('σ'.to_uppercase(), 'Σ');
+ assert_eq!('τ'.to_uppercase(), 'Τ');
+ assert_eq!('ι'.to_uppercase(), 'Ι');
+ assert_eq!('γ'.to_uppercase(), 'Γ');
+ assert_eq!('μ'.to_uppercase(), 'Μ');
+ assert_eq!('α'.to_uppercase(), 'Α');
+ assert_eq!('ς'.to_uppercase(), 'Σ');
+ }
+
+ #[test]
+ fn test_is_control() {
+ assert!('\u0000'.is_control());
+ assert!('\u0003'.is_control());
+ assert!('\u0006'.is_control());
+ assert!('\u0009'.is_control());
+ assert!('\u007f'.is_control());
+ assert!('\u0092'.is_control());
+ assert!(!'\u0020'.is_control());
+ assert!(!'\u0055'.is_control());
+ assert!(!'\u0068'.is_control());
+ }
+
+ #[test]
+ fn test_is_digit() {
+ assert!('2'.is_digit());
+ assert!('7'.is_digit());
+ assert!(!'c'.is_digit());
+ assert!(!'i'.is_digit());
+ assert!(!'z'.is_digit());
+ assert!(!'Q'.is_digit());
+ }
+
+ #[test]
+ fn test_escape_default() {
+ fn string(c: char) -> ~str {
+ let mut result = StrBuf::new();
+ escape_default(c, |c| { result.push_char(c); });
+ return result.into_owned();
+ }
+ assert_eq!(string('\n'), "\\n".to_owned());
+ assert_eq!(string('\r'), "\\r".to_owned());
+ assert_eq!(string('\''), "\\'".to_owned());
+ assert_eq!(string('"'), "\\\"".to_owned());
+ assert_eq!(string(' '), " ".to_owned());
+ assert_eq!(string('a'), "a".to_owned());
+ assert_eq!(string('~'), "~".to_owned());
+ assert_eq!(string('\x00'), "\\x00".to_owned());
+ assert_eq!(string('\x1f'), "\\x1f".to_owned());
+ assert_eq!(string('\x7f'), "\\x7f".to_owned());
+ assert_eq!(string('\xff'), "\\xff".to_owned());
+ assert_eq!(string('\u011b'), "\\u011b".to_owned());
+ assert_eq!(string('\U0001d4b6'), "\\U0001d4b6".to_owned());
+ }
+
+ #[test]
+ fn test_escape_unicode() {
+ fn string(c: char) -> ~str {
+ let mut result = StrBuf::new();
+ escape_unicode(c, |c| { result.push_char(c); });
+ return result.into_owned();
+ }
+ assert_eq!(string('\x00'), "\\x00".to_owned());
+ assert_eq!(string('\n'), "\\x0a".to_owned());
+ assert_eq!(string(' '), "\\x20".to_owned());
+ assert_eq!(string('a'), "\\x61".to_owned());
+ assert_eq!(string('\u011b'), "\\u011b".to_owned());
+ assert_eq!(string('\U0001d4b6'), "\\U0001d4b6".to_owned());
+ }
+
+ #[test]
+ fn test_to_str() {
+ use realstd::to_str::ToStr;
+ let s = 't'.to_str();
+ assert_eq!(s, "t".to_owned());
+ }
+
+ #[test]
+ fn test_encode_utf8() {
+ fn check(input: char, expect: &[u8]) {
+ let mut buf = [0u8, ..4];
+ let n = input.encode_utf8(buf /* as mut slice! */);
+ assert_eq!(buf.slice_to(n), expect);
+ }
+
+ check('x', [0x78]);
+ check('\u00e9', [0xc3, 0xa9]);
+ check('\ua66e', [0xea, 0x99, 0xae]);
+ check('\U0001f4a9', [0xf0, 0x9f, 0x92, 0xa9]);
+ }
+
+ #[test]
+ fn test_encode_utf16() {
+ fn check(input: char, expect: &[u16]) {
+ let mut buf = [0u16, ..2];
+ let n = input.encode_utf16(buf /* as mut slice! */);
+ assert_eq!(buf.slice_to(n), expect);
+ }
+
+ check('x', [0x0078]);
+ check('\u00e9', [0x00e9]);
+ check('\ua66e', [0xa66e]);
+ check('\U0001f4a9', [0xd83d, 0xdca9]);
+ }
+}
--- /dev/null
+// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+/*! The `Clone` trait for types that cannot be 'implicitly copied'
+
+In Rust, some simple types are "implicitly copyable" and when you
+assign them or pass them as arguments, the receiver will get a copy,
+leaving the original value in place. These types do not require
+allocation to copy and do not have finalizers (i.e. they do not
+contain owned boxes or implement `Drop`), so the compiler considers
+them cheap and safe to copy. For other types copies must be made
+explicitly, by convention implementing the `Clone` trait and calling
+the `clone` method.
+
+*/
+
+use owned::Box;
+
+/// A common trait for cloning an object.
+pub trait Clone {
+ /// Returns a copy of the value. The contents of owned pointers
+ /// are copied to maintain uniqueness, while the contents of
+ /// managed pointers are not copied.
+ fn clone(&self) -> Self;
+
+ /// Perform copy-assignment from `source`.
+ ///
+ /// `a.clone_from(&b)` is equivalent to `a = b.clone()` in functionality,
+ /// but can be overridden to reuse the resources of `a` to avoid unnecessary
+ /// allocations.
+ #[inline(always)]
+ fn clone_from(&mut self, source: &Self) {
+ *self = source.clone()
+ }
+}
+
+impl<T: Clone> Clone for Box<T> {
+ /// Return a copy of the owned box.
+ #[inline]
+ fn clone(&self) -> Box<T> { box {(**self).clone()} }
+
+ /// Perform copy-assignment from `source` by reusing the existing allocation.
+ #[inline]
+ fn clone_from(&mut self, source: &Box<T>) {
+ (**self).clone_from(&(**source));
+ }
+}
+
+impl<T> Clone for @T {
+ /// Return a shallow copy of the managed box.
+ #[inline]
+ fn clone(&self) -> @T { *self }
+}
+
+impl<'a, T> Clone for &'a T {
+ /// Return a shallow copy of the reference.
+ #[inline]
+ fn clone(&self) -> &'a T { *self }
+}
+
+impl<'a, T> Clone for &'a [T] {
+ /// Return a shallow copy of the slice.
+ #[inline]
+ fn clone(&self) -> &'a [T] { *self }
+}
+
+impl<'a> Clone for &'a str {
+ /// Return a shallow copy of the slice.
+ #[inline]
+ fn clone(&self) -> &'a str { *self }
+}
+
+macro_rules! clone_impl(
+ ($t:ty) => {
+ impl Clone for $t {
+ /// Return a deep copy of the value.
+ #[inline]
+ fn clone(&self) -> $t { *self }
+ }
+ }
+)
+
+clone_impl!(int)
+clone_impl!(i8)
+clone_impl!(i16)
+clone_impl!(i32)
+clone_impl!(i64)
+
+clone_impl!(uint)
+clone_impl!(u8)
+clone_impl!(u16)
+clone_impl!(u32)
+clone_impl!(u64)
+
+clone_impl!(f32)
+clone_impl!(f64)
+
+clone_impl!(())
+clone_impl!(bool)
+clone_impl!(char)
+
+macro_rules! extern_fn_clone(
+ ($($A:ident),*) => (
+ impl<$($A,)* ReturnType> Clone for extern "Rust" fn($($A),*) -> ReturnType {
+ /// Return a copy of a function pointer
+ #[inline]
+ fn clone(&self) -> extern "Rust" fn($($A),*) -> ReturnType { *self }
+ }
+ )
+)
+
+extern_fn_clone!()
+extern_fn_clone!(A)
+extern_fn_clone!(A, B)
+extern_fn_clone!(A, B, C)
+extern_fn_clone!(A, B, C, D)
+extern_fn_clone!(A, B, C, D, E)
+extern_fn_clone!(A, B, C, D, E, F)
+extern_fn_clone!(A, B, C, D, E, F, G)
+extern_fn_clone!(A, B, C, D, E, F, G, H)
+
+#[cfg(test)]
+mod test {
+ use prelude::*;
+ use owned::Box;
+
+ #[test]
+ fn test_owned_clone() {
+ let a = box 5i;
+ let b: Box<int> = a.clone();
+ assert_eq!(a, b);
+ }
+
+ #[test]
+ fn test_managed_clone() {
+ let a = @5i;
+ let b: @int = a.clone();
+ assert_eq!(a, b);
+ }
+
+ #[test]
+ fn test_borrowed_clone() {
+ let x = 5i;
+ let y: &int = &x;
+ let z: &int = (&y).clone();
+ assert_eq!(*z, 5);
+ }
+
+ #[test]
+ fn test_clone_from() {
+ let a = box 5;
+ let mut b = box 10;
+ b.clone_from(&a);
+ assert_eq!(*b, 5);
+ }
+
+ #[test]
+ fn test_extern_fn_clone() {
+ trait Empty {}
+ impl Empty for int {}
+
+ fn test_fn_a() -> f64 { 1.0 }
+ fn test_fn_b<T: Empty>(x: T) -> T { x }
+ fn test_fn_c(_: int, _: f64, _: ~[int], _: int, _: int, _: int) {}
+
+ let _ = test_fn_a.clone();
+ let _ = test_fn_b::<int>.clone();
+ let _ = test_fn_c.clone();
+ }
+}
--- /dev/null
+// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Defines the `Ord` and `Eq` comparison traits.
+//!
+//! This module defines both `Ord` and `Eq` traits which are used by the
+//! compiler to implement comparison operators. Rust programs may implement
+//!`Ord` to overload the `<`, `<=`, `>`, and `>=` operators, and may implement
+//! `Eq` to overload the `==` and `!=` operators.
+//!
+//! For example, to define a type with a customized definition for the Eq
+//! operators, you could do the following:
+//!
+//! ```rust
+//! // Our type.
+//! struct SketchyNum {
+//! num : int
+//! }
+//!
+//! // Our implementation of `Eq` to support `==` and `!=`.
+//! impl Eq for SketchyNum {
+//! // Our custom eq allows numbers which are near each other to be equal! :D
+//! fn eq(&self, other: &SketchyNum) -> bool {
+//! (self.num - other.num).abs() < 5
+//! }
+//! }
+//!
+//! // Now these binary operators will work when applied!
+//! assert!(SketchyNum {num: 37} == SketchyNum {num: 34});
+//! assert!(SketchyNum {num: 25} != SketchyNum {num: 57});
+//! ```
+
+/// Trait for values that can be compared for equality and inequality.
+///
+/// This trait allows partial equality, where types can be unordered instead of
+/// strictly equal or unequal. For example, with the built-in floating-point
+/// types `a == b` and `a != b` will both evaluate to false if either `a` or
+/// `b` is NaN (cf. IEEE 754-2008 section 5.11).
+///
+/// Eq only requires the `eq` method to be implemented; `ne` is its negation by
+/// default.
+///
+/// Eventually, this will be implemented by default for types that implement
+/// `TotalEq`.
+#[lang="eq"]
+pub trait Eq {
+ /// This method tests for `self` and `other` values to be equal, and is used by `==`.
+ fn eq(&self, other: &Self) -> bool;
+
+ /// This method tests for `!=`.
+ #[inline]
+ fn ne(&self, other: &Self) -> bool { !self.eq(other) }
+}
+
+/// Trait for equality comparisons which are [equivalence relations](
+/// https://en.wikipedia.org/wiki/Equivalence_relation).
+///
+/// This means, that in addition to `a == b` and `a != b` being strict
+/// inverses, the equality must be (for all `a`, `b` and `c`):
+///
+/// - reflexive: `a == a`;
+/// - symmetric: `a == b` implies `b == a`; and
+/// - transitive: `a == b` and `b == c` implies `a == c`.
+pub trait TotalEq: Eq {
+ // FIXME #13101: this method is used solely by #[deriving] to
+ // assert that every component of a type implements #[deriving]
+ // itself, the current deriving infrastructure means doing this
+ // assertion without using a method on this trait is nearly
+ // impossible.
+ //
+ // This should never be implemented by hand.
+ #[doc(hidden)]
+ #[inline(always)]
+ fn assert_receiver_is_total_eq(&self) {}
+}
+
+/// An ordering is, e.g, a result of a comparison between two values.
+#[deriving(Clone, Eq)]
+pub enum Ordering {
+ /// An ordering where a compared value is less [than another].
+ Less = -1,
+ /// An ordering where a compared value is equal [to another].
+ Equal = 0,
+ /// An ordering where a compared value is greater [than another].
+ Greater = 1
+}
+
+/// Trait for types that form a [total order](
+/// https://en.wikipedia.org/wiki/Total_order).
+///
+/// An order is a total order if it is (for all `a`, `b` and `c`):
+///
+/// - total and antisymmetric: exactly one of `a < b`, `a == b` or `a > b` is
+/// true; and
+/// - transitive, `a < b` and `b < c` implies `a < c`. The same must hold for
+/// both `==` and `>`.
+pub trait TotalOrd: TotalEq + Ord {
+ /// This method returns an ordering between `self` and `other` values.
+ ///
+ /// By convention, `self.cmp(&other)` returns the ordering matching
+ /// the expression `self <operator> other` if true. For example:
+ ///
+ /// ```
+ /// assert_eq!( 5u.cmp(&10), Less); // because 5 < 10
+ /// assert_eq!(10u.cmp(&5), Greater); // because 10 > 5
+ /// assert_eq!( 5u.cmp(&5), Equal); // because 5 == 5
+ /// ```
+ fn cmp(&self, other: &Self) -> Ordering;
+}
+
+impl TotalEq for Ordering {}
+
+impl TotalOrd for Ordering {
+ #[inline]
+ fn cmp(&self, other: &Ordering) -> Ordering {
+ (*self as int).cmp(&(*other as int))
+ }
+}
+
+impl Ord for Ordering {
+ #[inline]
+ fn lt(&self, other: &Ordering) -> bool { (*self as int) < (*other as int) }
+}
+
+/// Combine orderings, lexically.
+///
+/// For example for a type `(int, int)`, two comparisons could be done.
+/// If the first ordering is different, the first ordering is all that must be returned.
+/// If the first ordering is equal, then second ordering is returned.
+#[inline]
+pub fn lexical_ordering(o1: Ordering, o2: Ordering) -> Ordering {
+ match o1 {
+ Equal => o2,
+ _ => o1
+ }
+}
+
+/// Trait for values that can be compared for a sort-order.
+///
+/// Ord only requires implementation of the `lt` method,
+/// with the others generated from default implementations.
+///
+/// However it remains possible to implement the others separately,
+/// for compatibility with floating-point NaN semantics
+/// (cf. IEEE 754-2008 section 5.11).
+#[lang="ord"]
+pub trait Ord: Eq {
+ /// This method tests less than (for `self` and `other`) and is used by the `<` operator.
+ fn lt(&self, other: &Self) -> bool;
+
+ /// This method tests less than or equal to (`<=`).
+ #[inline]
+ fn le(&self, other: &Self) -> bool { !other.lt(self) }
+
+ /// This method tests greater than (`>`).
+ #[inline]
+ fn gt(&self, other: &Self) -> bool { other.lt(self) }
+
+ /// This method tests greater than or equal to (`>=`).
+ #[inline]
+ fn ge(&self, other: &Self) -> bool { !self.lt(other) }
+}
+
+/// The equivalence relation. Two values may be equivalent even if they are
+/// of different types. The most common use case for this relation is
+/// container types; e.g. it is often desirable to be able to use `&str`
+/// values to look up entries in a container with `~str` keys.
+pub trait Equiv<T> {
+ /// Implement this function to decide equivalent values.
+ fn equiv(&self, other: &T) -> bool;
+}
+
+/// Compare and return the minimum of two values.
+#[inline]
+pub fn min<T: TotalOrd>(v1: T, v2: T) -> T {
+ if v1 < v2 { v1 } else { v2 }
+}
+
+/// Compare and return the maximum of two values.
+#[inline]
+pub fn max<T: TotalOrd>(v1: T, v2: T) -> T {
+ if v1 > v2 { v1 } else { v2 }
+}
+
+// Implementation of Eq/TotalEq for some primitive types
+#[cfg(not(test))]
+mod impls {
+ use cmp::{Ord, TotalOrd, Eq, TotalEq, Ordering};
+ use owned::Box;
+
+ // & pointers
+ impl<'a, T: Eq> Eq for &'a T {
+ #[inline]
+ fn eq(&self, other: & &'a T) -> bool { *(*self) == *(*other) }
+ #[inline]
+ fn ne(&self, other: & &'a T) -> bool { *(*self) != *(*other) }
+ }
+ impl<'a, T: Ord> Ord for &'a T {
+ #[inline]
+ fn lt(&self, other: & &'a T) -> bool { *(*self) < *(*other) }
+ #[inline]
+ fn le(&self, other: & &'a T) -> bool { *(*self) <= *(*other) }
+ #[inline]
+ fn ge(&self, other: & &'a T) -> bool { *(*self) >= *(*other) }
+ #[inline]
+ fn gt(&self, other: & &'a T) -> bool { *(*self) > *(*other) }
+ }
+ impl<'a, T: TotalOrd> TotalOrd for &'a T {
+ #[inline]
+ fn cmp(&self, other: & &'a T) -> Ordering { (**self).cmp(*other) }
+ }
+ impl<'a, T: TotalEq> TotalEq for &'a T {}
+
+ // @ pointers
+ impl<T:Eq> Eq for @T {
+ #[inline]
+ fn eq(&self, other: &@T) -> bool { *(*self) == *(*other) }
+ #[inline]
+ fn ne(&self, other: &@T) -> bool { *(*self) != *(*other) }
+ }
+ impl<T:Ord> Ord for @T {
+ #[inline]
+ fn lt(&self, other: &@T) -> bool { *(*self) < *(*other) }
+ #[inline]
+ fn le(&self, other: &@T) -> bool { *(*self) <= *(*other) }
+ #[inline]
+ fn ge(&self, other: &@T) -> bool { *(*self) >= *(*other) }
+ #[inline]
+ fn gt(&self, other: &@T) -> bool { *(*self) > *(*other) }
+ }
+ impl<T: TotalOrd> TotalOrd for @T {
+ #[inline]
+ fn cmp(&self, other: &@T) -> Ordering { (**self).cmp(*other) }
+ }
+ impl<T: TotalEq> TotalEq for @T {}
+
+ // box pointers
+ impl<T:Eq> Eq for Box<T> {
+ #[inline]
+ fn eq(&self, other: &Box<T>) -> bool { *(*self) == *(*other) }
+ #[inline]
+ fn ne(&self, other: &Box<T>) -> bool { *(*self) != *(*other) }
+ }
+ impl<T:Ord> Ord for Box<T> {
+ #[inline]
+ fn lt(&self, other: &Box<T>) -> bool { *(*self) < *(*other) }
+ #[inline]
+ fn le(&self, other: &Box<T>) -> bool { *(*self) <= *(*other) }
+ #[inline]
+ fn ge(&self, other: &Box<T>) -> bool { *(*self) >= *(*other) }
+ #[inline]
+ fn gt(&self, other: &Box<T>) -> bool { *(*self) > *(*other) }
+ }
+ impl<T: TotalOrd> TotalOrd for Box<T> {
+ #[inline]
+ fn cmp(&self, other: &Box<T>) -> Ordering { (**self).cmp(*other) }
+ }
+ impl<T: TotalEq> TotalEq for Box<T> {}
+}
+
+#[cfg(test)]
+mod test {
+ use super::lexical_ordering;
+
+ #[test]
+ fn test_int_totalord() {
+ assert_eq!(5u.cmp(&10), Less);
+ assert_eq!(10u.cmp(&5), Greater);
+ assert_eq!(5u.cmp(&5), Equal);
+ assert_eq!((-5u).cmp(&12), Less);
+ assert_eq!(12u.cmp(-5), Greater);
+ }
+
+ #[test]
+ fn test_ordering_order() {
+ assert!(Less < Equal);
+ assert_eq!(Greater.cmp(&Less), Greater);
+ }
+
+ #[test]
+ fn test_lexical_ordering() {
+ fn t(o1: Ordering, o2: Ordering, e: Ordering) {
+ assert_eq!(lexical_ordering(o1, o2), e);
+ }
+
+ let xs = [Less, Equal, Greater];
+ for &o in xs.iter() {
+ t(Less, o, Less);
+ t(Equal, o, o);
+ t(Greater, o, Greater);
+ }
+ }
+
+ #[test]
+ fn test_user_defined_eq() {
+ // Our type.
+ struct SketchyNum {
+ num : int
+ }
+
+ // Our implementation of `Eq` to support `==` and `!=`.
+ impl Eq for SketchyNum {
+ // Our custom eq allows numbers which are near each other to be equal! :D
+ fn eq(&self, other: &SketchyNum) -> bool {
+ (self.num - other.num).abs() < 5
+ }
+ }
+
+ // Now these binary operators will work when applied!
+ assert!(SketchyNum {num: 37} == SketchyNum {num: 34});
+ assert!(SketchyNum {num: 25} != SketchyNum {num: 57});
+ }
+}
--- /dev/null
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Traits for generic containers (including `Map` and `Set`)
+
+use option::Option;
+
+/// A trait to represent the abstract idea of a container. The only concrete
+/// knowledge known is the number of elements contained within.
+pub trait Container {
+ /// Return the number of elements in the container
+ fn len(&self) -> uint;
+
+ /// Return true if the container contains no elements
+ #[inline]
+ fn is_empty(&self) -> bool {
+ self.len() == 0
+ }
+}
+
+/// A trait to represent mutable containers
+pub trait Mutable: Container {
+ /// Clear the container, removing all values.
+ fn clear(&mut self);
+}
+
+/// A map is a key-value store where values may be looked up by their keys. This
+/// trait provides basic operations to operate on these stores.
+pub trait Map<K, V>: Container {
+ /// Return a reference to the value corresponding to the key
+ fn find<'a>(&'a self, key: &K) -> Option<&'a V>;
+
+ /// Return true if the map contains a value for the specified key
+ #[inline]
+ fn contains_key(&self, key: &K) -> bool {
+ self.find(key).is_some()
+ }
+}
+
+/// This trait provides basic operations to modify the contents of a map.
+pub trait MutableMap<K, V>: Map<K, V> + Mutable {
+ /// Insert a key-value pair into the map. An existing value for a
+ /// key is replaced by the new value. Return true if the key did
+ /// not already exist in the map.
+ #[inline]
+ fn insert(&mut self, key: K, value: V) -> bool {
+ self.swap(key, value).is_none()
+ }
+
+ /// Remove a key-value pair from the map. Return true if the key
+ /// was present in the map, otherwise false.
+ #[inline]
+ fn remove(&mut self, key: &K) -> bool {
+ self.pop(key).is_some()
+ }
+
+ /// Insert a key-value pair from the map. If the key already had a value
+ /// present in the map, that value is returned. Otherwise None is returned.
+ fn swap(&mut self, k: K, v: V) -> Option<V>;
+
+ /// Removes a key from the map, returning the value at the key if the key
+ /// was previously in the map.
+ fn pop(&mut self, k: &K) -> Option<V>;
+
+ /// Return a mutable reference to the value corresponding to the key
+ fn find_mut<'a>(&'a mut self, key: &K) -> Option<&'a mut V>;
+}
+
+/// A set is a group of objects which are each distinct from one another. This
+/// trait represents actions which can be performed on sets to iterate over
+/// them.
+pub trait Set<T>: Container {
+ /// Return true if the set contains a value
+ fn contains(&self, value: &T) -> bool;
+
+ /// Return true if the set has no elements in common with `other`.
+ /// This is equivalent to checking for an empty intersection.
+ fn is_disjoint(&self, other: &Self) -> bool;
+
+ /// Return true if the set is a subset of another
+ fn is_subset(&self, other: &Self) -> bool;
+
+ /// Return true if the set is a superset of another
+ fn is_superset(&self, other: &Self) -> bool {
+ other.is_subset(self)
+ }
+
+ // FIXME #8154: Add difference, sym. difference, intersection and union iterators
+}
+
+/// This trait represents actions which can be performed on sets to mutate
+/// them.
+pub trait MutableSet<T>: Set<T> + Mutable {
+ /// Add a value to the set. Return true if the value was not already
+ /// present in the set.
+ fn insert(&mut self, value: T) -> bool;
+
+ /// Remove a value from the set. Return true if the value was
+ /// present in the set.
+ fn remove(&mut self, value: &T) -> bool;
+}
--- /dev/null
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! The `Default` trait for types which may have meaningful default values
+
+use owned::Box;
+
+/// A trait that types which have a useful default value should implement.
+pub trait Default {
+ /// Return the "default value" for a type.
+ fn default() -> Self;
+}
+
+impl<T: Default + 'static> Default for @T {
+ fn default() -> @T { @Default::default() }
+}
+
+impl<T: Default> Default for Box<T> {
+ fn default() -> Box<T> { box Default::default() }
+}
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Failure support for libcore
+
+#![allow(dead_code)]
+
+#[cfg(not(test))]
+use str::raw::c_str_to_static_slice;
+
+// FIXME: Once std::fmt is in libcore, all of these functions should delegate
+// to a common failure function with this signature:
+//
+// extern {
+// fn rust_unwind(f: &fmt::Arguments, file: &str, line: uint) -> !;
+// }
+//
+// Each of these functions can create a temporary fmt::Arguments
+// structure to pass to this function.
+
+#[cold] #[inline(never)] // this is the slow path, always
+#[lang="fail_"]
+#[cfg(not(test))]
+fn fail_(expr: *u8, file: *u8, line: uint) -> ! {
+ unsafe {
+ let expr = c_str_to_static_slice(expr as *i8);
+ let file = c_str_to_static_slice(file as *i8);
+ begin_unwind(expr, file, line)
+ }
+}
+
+#[cold]
+#[lang="fail_bounds_check"]
+#[cfg(not(test))]
+fn fail_bounds_check(file: *u8, line: uint, index: uint, len: uint) -> ! {
+ #[allow(ctypes)]
+ extern { fn rust_fail_bounds_check(file: *u8, line: uint,
+ index: uint, len: uint,) -> !; }
+ unsafe { rust_fail_bounds_check(file, line, index, len) }
+}
+
+#[cold]
+pub fn begin_unwind(msg: &str, file: &'static str, line: uint) -> ! {
+ #[allow(ctypes)]
+ extern { fn rust_begin_unwind(msg: &str, file: &'static str,
+ line: uint) -> !; }
+ unsafe { rust_begin_unwind(msg, file, line) }
+}
--- /dev/null
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+/*!
+The Finally trait provides a method, `finally` on
+stack closures that emulates Java-style try/finally blocks.
+
+Using the `finally` method is sometimes convenient, but the type rules
+prohibit any shared, mutable state between the "try" case and the
+"finally" case. For advanced cases, the `try_finally` function can
+also be used. See that function for more details.
+
+# Example
+
+```
+use std::unstable::finally::Finally;
+
+(|| {
+ // ...
+}).finally(|| {
+ // this code is always run
+})
+```
+*/
+
+#![experimental]
+
+use ops::Drop;
+
+/// A trait for executing a destructor unconditionally after a block of code,
+/// regardless of whether the blocked fails.
+pub trait Finally<T> {
+ /// Executes this object, unconditionally running `dtor` after this block of
+ /// code has run.
+ fn finally(&mut self, dtor: ||) -> T;
+}
+
+impl<'a,T> Finally<T> for ||: 'a -> T {
+ fn finally(&mut self, dtor: ||) -> T {
+ try_finally(&mut (), self,
+ |_, f| (*f)(),
+ |_| dtor())
+ }
+}
+
+impl<T> Finally<T> for fn() -> T {
+ fn finally(&mut self, dtor: ||) -> T {
+ try_finally(&mut (), (),
+ |_, _| (*self)(),
+ |_| dtor())
+ }
+}
+
+/**
+ * The most general form of the `finally` functions. The function
+ * `try_fn` will be invoked first; whether or not it fails, the
+ * function `finally_fn` will be invoked next. The two parameters
+ * `mutate` and `drop` are used to thread state through the two
+ * closures. `mutate` is used for any shared, mutable state that both
+ * closures require access to; `drop` is used for any state that the
+ * `try_fn` requires ownership of.
+ *
+ * **WARNING:** While shared, mutable state between the try and finally
+ * function is often necessary, one must be very careful; the `try`
+ * function could have failed at any point, so the values of the shared
+ * state may be inconsistent.
+ *
+ * # Example
+ *
+ * ```
+ * use std::unstable::finally::try_finally;
+ *
+ * struct State<'a> { buffer: &'a mut [u8], len: uint }
+ * # let mut buf = [];
+ * let mut state = State { buffer: buf, len: 0 };
+ * try_finally(
+ * &mut state, (),
+ * |state, ()| {
+ * // use state.buffer, state.len
+ * },
+ * |state| {
+ * // use state.buffer, state.len to cleanup
+ * })
+ * ```
+ */
+pub fn try_finally<T,U,R>(mutate: &mut T,
+ drop: U,
+ try_fn: |&mut T, U| -> R,
+ finally_fn: |&mut T|)
+ -> R {
+ let f = Finallyalizer {
+ mutate: mutate,
+ dtor: finally_fn,
+ };
+ try_fn(&mut *f.mutate, drop)
+}
+
+struct Finallyalizer<'a,A> {
+ mutate: &'a mut A,
+ dtor: |&mut A|: 'a
+}
+
+#[unsafe_destructor]
+impl<'a,A> Drop for Finallyalizer<'a,A> {
+ #[inline]
+ fn drop(&mut self) {
+ (self.dtor)(self.mutate);
+ }
+}
+
+#[cfg(test)]
+mod test {
+ use super::{try_finally, Finally};
+ use realstd::task::failing;
+
+ #[test]
+ fn test_success() {
+ let mut i = 0;
+ try_finally(
+ &mut i, (),
+ |i, ()| {
+ *i = 10;
+ },
+ |i| {
+ assert!(!failing());
+ assert_eq!(*i, 10);
+ *i = 20;
+ });
+ assert_eq!(i, 20);
+ }
+
+ #[test]
+ #[should_fail]
+ fn test_fail() {
+ let mut i = 0;
+ try_finally(
+ &mut i, (),
+ |i, ()| {
+ *i = 10;
+ fail!();
+ },
+ |i| {
+ assert!(failing());
+ assert_eq!(*i, 10);
+ })
+ }
+
+ #[test]
+ fn test_retval() {
+ let mut closure: || -> int = || 10;
+ let i = closure.finally(|| { });
+ assert_eq!(i, 10);
+ }
+
+ #[test]
+ fn test_compact() {
+ fn do_some_fallible_work() {}
+ fn but_always_run_this_function() { }
+ let mut f = do_some_fallible_work;
+ f.finally(but_always_run_this_function);
+ }
+}
--- /dev/null
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+/*! rustc compiler intrinsics.
+
+The corresponding definitions are in librustc/middle/trans/foreign.rs.
+
+# Volatiles
+
+The volatile intrinsics provide operations intended to act on I/O
+memory, which are guaranteed to not be reordered by the compiler
+across other volatile intrinsics. See the LLVM documentation on
+[[volatile]].
+
+[volatile]: http://llvm.org/docs/LangRef.html#volatile-memory-accesses
+
+# Atomics
+
+The atomic intrinsics provide common atomic operations on machine
+words, with multiple possible memory orderings. They obey the same
+semantics as C++11. See the LLVM documentation on [[atomics]].
+
+[atomics]: http://llvm.org/docs/Atomics.html
+
+A quick refresher on memory ordering:
+
+* Acquire - a barrier for acquiring a lock. Subsequent reads and writes
+ take place after the barrier.
+* Release - a barrier for releasing a lock. Preceding reads and writes
+ take place before the barrier.
+* Sequentially consistent - sequentially consistent operations are
+ guaranteed to happen in order. This is the standard mode for working
+ with atomic types and is equivalent to Java's `volatile`.
+
+*/
+
+#![experimental]
+#![allow(missing_doc)]
+
+// This is needed to prevent duplicate lang item definitions.
+#[cfg(test)]
+pub use realcore::intrinsics::{TyDesc, Opaque, TyVisitor, TypeId};
+
+pub type GlueFn = extern "Rust" fn(*i8);
+
+#[lang="ty_desc"]
+#[cfg(not(test))]
+pub struct TyDesc {
+ // sizeof(T)
+ pub size: uint,
+
+ // alignof(T)
+ pub align: uint,
+
+ // Called when a value of type `T` is no longer needed
+ pub drop_glue: GlueFn,
+
+ // Called by reflection visitor to visit a value of type `T`
+ pub visit_glue: GlueFn,
+
+ // Name corresponding to the type
+ pub name: &'static str,
+}
+
+#[lang="opaque"]
+#[cfg(not(test))]
+pub enum Opaque { }
+
+pub type Disr = u64;
+
+#[lang="ty_visitor"]
+#[cfg(not(test))]
+pub trait TyVisitor {
+ fn visit_bot(&mut self) -> bool;
+ fn visit_nil(&mut self) -> bool;
+ fn visit_bool(&mut self) -> bool;
+
+ fn visit_int(&mut self) -> bool;
+ fn visit_i8(&mut self) -> bool;
+ fn visit_i16(&mut self) -> bool;
+ fn visit_i32(&mut self) -> bool;
+ fn visit_i64(&mut self) -> bool;
+
+ fn visit_uint(&mut self) -> bool;
+ fn visit_u8(&mut self) -> bool;
+ fn visit_u16(&mut self) -> bool;
+ fn visit_u32(&mut self) -> bool;
+ fn visit_u64(&mut self) -> bool;
+
+ fn visit_f32(&mut self) -> bool;
+ fn visit_f64(&mut self) -> bool;
+ fn visit_f128(&mut self) -> bool;
+
+ fn visit_char(&mut self) -> bool;
+
+ fn visit_estr_box(&mut self) -> bool;
+ fn visit_estr_uniq(&mut self) -> bool;
+ fn visit_estr_slice(&mut self) -> bool;
+ fn visit_estr_fixed(&mut self, n: uint, sz: uint, align: uint) -> bool;
+
+ fn visit_box(&mut self, mtbl: uint, inner: *TyDesc) -> bool;
+ fn visit_uniq(&mut self, mtbl: uint, inner: *TyDesc) -> bool;
+ fn visit_ptr(&mut self, mtbl: uint, inner: *TyDesc) -> bool;
+ fn visit_rptr(&mut self, mtbl: uint, inner: *TyDesc) -> bool;
+
+ fn visit_evec_box(&mut self, mtbl: uint, inner: *TyDesc) -> bool;
+ fn visit_evec_uniq(&mut self, mtbl: uint, inner: *TyDesc) -> bool;
+ fn visit_evec_slice(&mut self, mtbl: uint, inner: *TyDesc) -> bool;
+ fn visit_evec_fixed(&mut self, n: uint, sz: uint, align: uint,
+ mtbl: uint, inner: *TyDesc) -> bool;
+
+ fn visit_enter_rec(&mut self, n_fields: uint,
+ sz: uint, align: uint) -> bool;
+ fn visit_rec_field(&mut self, i: uint, name: &str,
+ mtbl: uint, inner: *TyDesc) -> bool;
+ fn visit_leave_rec(&mut self, n_fields: uint,
+ sz: uint, align: uint) -> bool;
+
+ fn visit_enter_class(&mut self, name: &str, named_fields: bool, n_fields: uint,
+ sz: uint, align: uint) -> bool;
+ fn visit_class_field(&mut self, i: uint, name: &str, named: bool,
+ mtbl: uint, inner: *TyDesc) -> bool;
+ fn visit_leave_class(&mut self, name: &str, named_fields: bool, n_fields: uint,
+ sz: uint, align: uint) -> bool;
+
+ fn visit_enter_tup(&mut self, n_fields: uint,
+ sz: uint, align: uint) -> bool;
+ fn visit_tup_field(&mut self, i: uint, inner: *TyDesc) -> bool;
+ fn visit_leave_tup(&mut self, n_fields: uint,
+ sz: uint, align: uint) -> bool;
+
+ fn visit_enter_enum(&mut self, n_variants: uint,
+ get_disr: extern unsafe fn(ptr: *Opaque) -> Disr,
+ sz: uint, align: uint) -> bool;
+ fn visit_enter_enum_variant(&mut self, variant: uint,
+ disr_val: Disr,
+ n_fields: uint,
+ name: &str) -> bool;
+ fn visit_enum_variant_field(&mut self, i: uint, offset: uint, inner: *TyDesc) -> bool;
+ fn visit_leave_enum_variant(&mut self, variant: uint,
+ disr_val: Disr,
+ n_fields: uint,
+ name: &str) -> bool;
+ fn visit_leave_enum(&mut self, n_variants: uint,
+ get_disr: extern unsafe fn(ptr: *Opaque) -> Disr,
+ sz: uint, align: uint) -> bool;
+
+ fn visit_enter_fn(&mut self, purity: uint, proto: uint,
+ n_inputs: uint, retstyle: uint) -> bool;
+ fn visit_fn_input(&mut self, i: uint, mode: uint, inner: *TyDesc) -> bool;
+ fn visit_fn_output(&mut self, retstyle: uint, variadic: bool, inner: *TyDesc) -> bool;
+ fn visit_leave_fn(&mut self, purity: uint, proto: uint,
+ n_inputs: uint, retstyle: uint) -> bool;
+
+ fn visit_trait(&mut self, name: &str) -> bool;
+ fn visit_param(&mut self, i: uint) -> bool;
+ fn visit_self(&mut self) -> bool;
+}
+
+extern "rust-intrinsic" {
+
+ // NB: These intrinsics take unsafe pointers because they mutate aliased
+ // memory, which is not valid for either `&` or `&mut`.
+
+ pub fn atomic_cxchg<T>(dst: *mut T, old: T, src: T) -> T;
+ pub fn atomic_cxchg_acq<T>(dst: *mut T, old: T, src: T) -> T;
+ pub fn atomic_cxchg_rel<T>(dst: *mut T, old: T, src: T) -> T;
+ pub fn atomic_cxchg_acqrel<T>(dst: *mut T, old: T, src: T) -> T;
+ pub fn atomic_cxchg_relaxed<T>(dst: *mut T, old: T, src: T) -> T;
+
+ pub fn atomic_load<T>(src: *T) -> T;
+ pub fn atomic_load_acq<T>(src: *T) -> T;
+ pub fn atomic_load_relaxed<T>(src: *T) -> T;
+
+ pub fn atomic_store<T>(dst: *mut T, val: T);
+ pub fn atomic_store_rel<T>(dst: *mut T, val: T);
+ pub fn atomic_store_relaxed<T>(dst: *mut T, val: T);
+
+ pub fn atomic_xchg<T>(dst: *mut T, src: T) -> T;
+ pub fn atomic_xchg_acq<T>(dst: *mut T, src: T) -> T;
+ pub fn atomic_xchg_rel<T>(dst: *mut T, src: T) -> T;
+ pub fn atomic_xchg_acqrel<T>(dst: *mut T, src: T) -> T;
+ pub fn atomic_xchg_relaxed<T>(dst: *mut T, src: T) -> T;
+
+ pub fn atomic_xadd<T>(dst: *mut T, src: T) -> T;
+ pub fn atomic_xadd_acq<T>(dst: *mut T, src: T) -> T;
+ pub fn atomic_xadd_rel<T>(dst: *mut T, src: T) -> T;
+ pub fn atomic_xadd_acqrel<T>(dst: *mut T, src: T) -> T;
+ pub fn atomic_xadd_relaxed<T>(dst: *mut T, src: T) -> T;
+
+ pub fn atomic_xsub<T>(dst: *mut T, src: T) -> T;
+ pub fn atomic_xsub_acq<T>(dst: *mut T, src: T) -> T;
+ pub fn atomic_xsub_rel<T>(dst: *mut T, src: T) -> T;
+ pub fn atomic_xsub_acqrel<T>(dst: *mut T, src: T) -> T;
+ pub fn atomic_xsub_relaxed<T>(dst: *mut T, src: T) -> T;
+
+ pub fn atomic_and<T>(dst: *mut T, src: T) -> T;
+ pub fn atomic_and_acq<T>(dst: *mut T, src: T) -> T;
+ pub fn atomic_and_rel<T>(dst: *mut T, src: T) -> T;
+ pub fn atomic_and_acqrel<T>(dst: *mut T, src: T) -> T;
+ pub fn atomic_and_relaxed<T>(dst: *mut T, src: T) -> T;
+
+ pub fn atomic_nand<T>(dst: *mut T, src: T) -> T;
+ pub fn atomic_nand_acq<T>(dst: *mut T, src: T) -> T;
+ pub fn atomic_nand_rel<T>(dst: *mut T, src: T) -> T;
+ pub fn atomic_nand_acqrel<T>(dst: *mut T, src: T) -> T;
+ pub fn atomic_nand_relaxed<T>(dst: *mut T, src: T) -> T;
+
+ pub fn atomic_or<T>(dst: *mut T, src: T) -> T;
+ pub fn atomic_or_acq<T>(dst: *mut T, src: T) -> T;
+ pub fn atomic_or_rel<T>(dst: *mut T, src: T) -> T;
+ pub fn atomic_or_acqrel<T>(dst: *mut T, src: T) -> T;
+ pub fn atomic_or_relaxed<T>(dst: *mut T, src: T) -> T;
+
+ pub fn atomic_xor<T>(dst: *mut T, src: T) -> T;
+ pub fn atomic_xor_acq<T>(dst: *mut T, src: T) -> T;
+ pub fn atomic_xor_rel<T>(dst: *mut T, src: T) -> T;
+ pub fn atomic_xor_acqrel<T>(dst: *mut T, src: T) -> T;
+ pub fn atomic_xor_relaxed<T>(dst: *mut T, src: T) -> T;
+
+ pub fn atomic_max<T>(dst: *mut T, src: T) -> T;
+ pub fn atomic_max_acq<T>(dst: *mut T, src: T) -> T;
+ pub fn atomic_max_rel<T>(dst: *mut T, src: T) -> T;
+ pub fn atomic_max_acqrel<T>(dst: *mut T, src: T) -> T;
+ pub fn atomic_max_relaxed<T>(dst: *mut T, src: T) -> T;
+
+ pub fn atomic_min<T>(dst: *mut T, src: T) -> T;
+ pub fn atomic_min_acq<T>(dst: *mut T, src: T) -> T;
+ pub fn atomic_min_rel<T>(dst: *mut T, src: T) -> T;
+ pub fn atomic_min_acqrel<T>(dst: *mut T, src: T) -> T;
+ pub fn atomic_min_relaxed<T>(dst: *mut T, src: T) -> T;
+
+ pub fn atomic_umin<T>(dst: *mut T, src: T) -> T;
+ pub fn atomic_umin_acq<T>(dst: *mut T, src: T) -> T;
+ pub fn atomic_umin_rel<T>(dst: *mut T, src: T) -> T;
+ pub fn atomic_umin_acqrel<T>(dst: *mut T, src: T) -> T;
+ pub fn atomic_umin_relaxed<T>(dst: *mut T, src: T) -> T;
+
+ pub fn atomic_umax<T>(dst: *mut T, src: T) -> T;
+ pub fn atomic_umax_acq<T>(dst: *mut T, src: T) -> T;
+ pub fn atomic_umax_rel<T>(dst: *mut T, src: T) -> T;
+ pub fn atomic_umax_acqrel<T>(dst: *mut T, src: T) -> T;
+ pub fn atomic_umax_relaxed<T>(dst: *mut T, src: T) -> T;
+}
+
+extern "rust-intrinsic" {
+
+ pub fn atomic_fence();
+ pub fn atomic_fence_acq();
+ pub fn atomic_fence_rel();
+ pub fn atomic_fence_acqrel();
+
+ /// Abort the execution of the process.
+ pub fn abort() -> !;
+
+ /// Execute a breakpoint trap, for inspection by a debugger.
+ pub fn breakpoint();
+
+ /// The size of a type in bytes.
+ ///
+ /// This is the exact number of bytes in memory taken up by a
+ /// value of the given type. In other words, a memset of this size
+ /// would *exactly* overwrite a value. When laid out in vectors
+ /// and structures there may be additional padding between
+ /// elements.
+ pub fn size_of<T>() -> uint;
+
+ /// Move a value to an uninitialized memory location.
+ ///
+ /// Drop glue is not run on the destination.
+ pub fn move_val_init<T>(dst: &mut T, src: T);
+
+ pub fn min_align_of<T>() -> uint;
+ pub fn pref_align_of<T>() -> uint;
+
+ /// Get a static pointer to a type descriptor.
+ pub fn get_tydesc<T>() -> *TyDesc;
+
+ /// Gets an identifier which is globally unique to the specified type. This
+ /// function will return the same value for a type regardless of whichever
+ /// crate it is invoked in.
+ pub fn type_id<T: 'static>() -> TypeId;
+
+
+ /// Create a value initialized to zero.
+ ///
+ /// `init` is unsafe because it returns a zeroed-out datum,
+ /// which is unsafe unless T is Copy.
+ pub fn init<T>() -> T;
+
+ /// Create an uninitialized value.
+ pub fn uninit<T>() -> T;
+
+ /// Move a value out of scope without running drop glue.
+ ///
+ /// `forget` is unsafe because the caller is responsible for
+ /// ensuring the argument is deallocated already.
+ pub fn forget<T>(_: T) -> ();
+ pub fn transmute<T,U>(e: T) -> U;
+
+ /// Returns `true` if a type requires drop glue.
+ pub fn needs_drop<T>() -> bool;
+
+ /// Returns `true` if a type is managed (will be allocated on the local heap)
+ pub fn owns_managed<T>() -> bool;
+
+ pub fn visit_tydesc(td: *TyDesc, tv: &mut TyVisitor);
+
+ /// Calculates the offset from a pointer. The offset *must* be in-bounds of
+ /// the object, or one-byte-past-the-end. An arithmetic overflow is also
+ /// undefined behaviour.
+ ///
+ /// This is implemented as an intrinsic to avoid converting to and from an
+ /// integer, since the conversion would throw away aliasing information.
+ pub fn offset<T>(dst: *T, offset: int) -> *T;
+
+ /// Equivalent to the appropriate `llvm.memcpy.p0i8.0i8.*` intrinsic, with
+ /// a size of `count` * `size_of::<T>()` and an alignment of
+ /// `min_align_of::<T>()`
+ pub fn copy_nonoverlapping_memory<T>(dst: *mut T, src: *T, count: uint);
+
+ /// Equivalent to the appropriate `llvm.memmove.p0i8.0i8.*` intrinsic, with
+ /// a size of `count` * `size_of::<T>()` and an alignment of
+ /// `min_align_of::<T>()`
+ pub fn copy_memory<T>(dst: *mut T, src: *T, count: uint);
+
+ /// Equivalent to the appropriate `llvm.memset.p0i8.*` intrinsic, with a
+ /// size of `count` * `size_of::<T>()` and an alignment of
+ /// `min_align_of::<T>()`
+ pub fn set_memory<T>(dst: *mut T, val: u8, count: uint);
+
+ /// Equivalent to the appropriate `llvm.memcpy.p0i8.0i8.*` intrinsic, with
+ /// a size of `count` * `size_of::<T>()` and an alignment of
+ /// `min_align_of::<T>()`
+ ///
+ /// The volatile parameter parameter is set to `true`, so it will not be optimized out.
+ pub fn volatile_copy_nonoverlapping_memory<T>(dst: *mut T, src: *T, count: uint);
+ /// Equivalent to the appropriate `llvm.memmove.p0i8.0i8.*` intrinsic, with
+ /// a size of `count` * `size_of::<T>()` and an alignment of
+ /// `min_align_of::<T>()`
+ ///
+ /// The volatile parameter parameter is set to `true`, so it will not be optimized out.
+ pub fn volatile_copy_memory<T>(dst: *mut T, src: *T, count: uint);
+ /// Equivalent to the appropriate `llvm.memset.p0i8.*` intrinsic, with a
+ /// size of `count` * `size_of::<T>()` and an alignment of
+ /// `min_align_of::<T>()`.
+ ///
+ /// The volatile parameter parameter is set to `true`, so it will not be optimized out.
+ pub fn volatile_set_memory<T>(dst: *mut T, val: u8, count: uint);
+
+ /// Perform a volatile load from the `src` pointer.
+ pub fn volatile_load<T>(src: *T) -> T;
+ /// Perform a volatile store to the `dst` pointer.
+ pub fn volatile_store<T>(dst: *mut T, val: T);
+
+ pub fn sqrtf32(x: f32) -> f32;
+ pub fn sqrtf64(x: f64) -> f64;
+
+ pub fn powif32(a: f32, x: i32) -> f32;
+ pub fn powif64(a: f64, x: i32) -> f64;
+
+ pub fn sinf32(x: f32) -> f32;
+ pub fn sinf64(x: f64) -> f64;
+
+ pub fn cosf32(x: f32) -> f32;
+ pub fn cosf64(x: f64) -> f64;
+
+ pub fn powf32(a: f32, x: f32) -> f32;
+ pub fn powf64(a: f64, x: f64) -> f64;
+
+ pub fn expf32(x: f32) -> f32;
+ pub fn expf64(x: f64) -> f64;
+
+ pub fn exp2f32(x: f32) -> f32;
+ pub fn exp2f64(x: f64) -> f64;
+
+ pub fn logf32(x: f32) -> f32;
+ pub fn logf64(x: f64) -> f64;
+
+ pub fn log10f32(x: f32) -> f32;
+ pub fn log10f64(x: f64) -> f64;
+
+ pub fn log2f32(x: f32) -> f32;
+ pub fn log2f64(x: f64) -> f64;
+
+ pub fn fmaf32(a: f32, b: f32, c: f32) -> f32;
+ pub fn fmaf64(a: f64, b: f64, c: f64) -> f64;
+
+ pub fn fabsf32(x: f32) -> f32;
+ pub fn fabsf64(x: f64) -> f64;
+
+ pub fn copysignf32(x: f32, y: f32) -> f32;
+ pub fn copysignf64(x: f64, y: f64) -> f64;
+
+ pub fn floorf32(x: f32) -> f32;
+ pub fn floorf64(x: f64) -> f64;
+
+ pub fn ceilf32(x: f32) -> f32;
+ pub fn ceilf64(x: f64) -> f64;
+
+ pub fn truncf32(x: f32) -> f32;
+ pub fn truncf64(x: f64) -> f64;
+
+ pub fn rintf32(x: f32) -> f32;
+ pub fn rintf64(x: f64) -> f64;
+
+ pub fn nearbyintf32(x: f32) -> f32;
+ pub fn nearbyintf64(x: f64) -> f64;
+
+ pub fn roundf32(x: f32) -> f32;
+ pub fn roundf64(x: f64) -> f64;
+
+ pub fn ctpop8(x: u8) -> u8;
+ pub fn ctpop16(x: u16) -> u16;
+ pub fn ctpop32(x: u32) -> u32;
+ pub fn ctpop64(x: u64) -> u64;
+
+ pub fn ctlz8(x: u8) -> u8;
+ pub fn ctlz16(x: u16) -> u16;
+ pub fn ctlz32(x: u32) -> u32;
+ pub fn ctlz64(x: u64) -> u64;
+
+ pub fn cttz8(x: u8) -> u8;
+ pub fn cttz16(x: u16) -> u16;
+ pub fn cttz32(x: u32) -> u32;
+ pub fn cttz64(x: u64) -> u64;
+
+ pub fn bswap16(x: u16) -> u16;
+ pub fn bswap32(x: u32) -> u32;
+ pub fn bswap64(x: u64) -> u64;
+
+ pub fn i8_add_with_overflow(x: i8, y: i8) -> (i8, bool);
+ pub fn i16_add_with_overflow(x: i16, y: i16) -> (i16, bool);
+ pub fn i32_add_with_overflow(x: i32, y: i32) -> (i32, bool);
+ pub fn i64_add_with_overflow(x: i64, y: i64) -> (i64, bool);
+
+ pub fn u8_add_with_overflow(x: u8, y: u8) -> (u8, bool);
+ pub fn u16_add_with_overflow(x: u16, y: u16) -> (u16, bool);
+ pub fn u32_add_with_overflow(x: u32, y: u32) -> (u32, bool);
+ pub fn u64_add_with_overflow(x: u64, y: u64) -> (u64, bool);
+
+ pub fn i8_sub_with_overflow(x: i8, y: i8) -> (i8, bool);
+ pub fn i16_sub_with_overflow(x: i16, y: i16) -> (i16, bool);
+ pub fn i32_sub_with_overflow(x: i32, y: i32) -> (i32, bool);
+ pub fn i64_sub_with_overflow(x: i64, y: i64) -> (i64, bool);
+
+ pub fn u8_sub_with_overflow(x: u8, y: u8) -> (u8, bool);
+ pub fn u16_sub_with_overflow(x: u16, y: u16) -> (u16, bool);
+ pub fn u32_sub_with_overflow(x: u32, y: u32) -> (u32, bool);
+ pub fn u64_sub_with_overflow(x: u64, y: u64) -> (u64, bool);
+
+ pub fn i8_mul_with_overflow(x: i8, y: i8) -> (i8, bool);
+ pub fn i16_mul_with_overflow(x: i16, y: i16) -> (i16, bool);
+ pub fn i32_mul_with_overflow(x: i32, y: i32) -> (i32, bool);
+ pub fn i64_mul_with_overflow(x: i64, y: i64) -> (i64, bool);
+
+ pub fn u8_mul_with_overflow(x: u8, y: u8) -> (u8, bool);
+ pub fn u16_mul_with_overflow(x: u16, y: u16) -> (u16, bool);
+ pub fn u32_mul_with_overflow(x: u32, y: u32) -> (u32, bool);
+ pub fn u64_mul_with_overflow(x: u64, y: u64) -> (u64, bool);
+}
+
+
+/// `TypeId` represents a globally unique identifier for a type
+#[lang="type_id"] // This needs to be kept in lockstep with the code in trans/intrinsic.rs and
+ // middle/lang_items.rs
+#[deriving(Eq, TotalEq)]
+#[cfg(not(test))]
+pub struct TypeId {
+ t: u64,
+}
+
+#[cfg(not(test))]
+impl TypeId {
+ /// Returns the `TypeId` of the type this generic function has been instantiated with
+ pub fn of<T: 'static>() -> TypeId {
+ unsafe { type_id::<T>() }
+ }
+ pub fn hash(&self) -> u64 { self.t }
+}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+/*!
+
+Composable external iterators
+
+# The `Iterator` trait
+
+This module defines Rust's core iteration trait. The `Iterator` trait has one
+unimplemented method, `next`. All other methods are derived through default
+methods to perform operations such as `zip`, `chain`, `enumerate`, and `fold`.
+
+The goal of this module is to unify iteration across all containers in Rust.
+An iterator can be considered as a state machine which is used to track which
+element will be yielded next.
+
+There are various extensions also defined in this module to assist with various
+types of iteration, such as the `DoubleEndedIterator` for iterating in reverse,
+the `FromIterator` trait for creating a container from an iterator, and much
+more.
+
+## Rust's `for` loop
+
+The special syntax used by rust's `for` loop is based around the `Iterator`
+trait defined in this module. For loops can be viewed as a syntactical expansion
+into a `loop`, for example, the `for` loop in this example is essentially
+translated to the `loop` below.
+
+```rust
+let values = ~[1, 2, 3];
+
+// "Syntactical sugar" taking advantage of an iterator
+for &x in values.iter() {
+ println!("{}", x);
+}
+
+// Rough translation of the iteration without a `for` iterator.
+let mut it = values.iter();
+loop {
+ match it.next() {
+ Some(&x) => {
+ println!("{}", x);
+ }
+ None => { break }
+ }
+}
+```
+
+This `for` loop syntax can be applied to any iterator over any type.
+
+## Iteration protocol and more
+
+More detailed information about iterators can be found in the [container
+guide](http://static.rust-lang.org/doc/master/guide-container.html) with
+the rest of the rust manuals.
+
+*/
+
+use cmp;
+use num::{Zero, One, CheckedAdd, CheckedSub, Saturating, ToPrimitive, Int};
+use option::{Option, Some, None};
+use ops::{Add, Mul, Sub};
+use cmp::{Eq, Ord, TotalOrd};
+use clone::Clone;
+use uint;
+use mem;
+
+/// Conversion from an `Iterator`
+pub trait FromIterator<A> {
+ /// Build a container with elements from an external iterator.
+ fn from_iter<T: Iterator<A>>(iterator: T) -> Self;
+}
+
+/// A type growable from an `Iterator` implementation
+pub trait Extendable<A>: FromIterator<A> {
+ /// Extend a container with the elements yielded by an iterator
+ fn extend<T: Iterator<A>>(&mut self, iterator: T);
+}
+
+/// An interface for dealing with "external iterators". These types of iterators
+/// can be resumed at any time as all state is stored internally as opposed to
+/// being located on the call stack.
+///
+/// The Iterator protocol states that an iterator yields a (potentially-empty,
+/// potentially-infinite) sequence of values, and returns `None` to signal that
+/// it's finished. The Iterator protocol does not define behavior after `None`
+/// is returned. A concrete Iterator implementation may choose to behave however
+/// it wishes, either by returning `None` infinitely, or by doing something
+/// else.
+pub trait Iterator<A> {
+ /// Advance the iterator and return the next value. Return `None` when the end is reached.
+ fn next(&mut self) -> Option<A>;
+
+ /// Return a lower bound and upper bound on the remaining length of the iterator.
+ ///
+ /// The common use case for the estimate is pre-allocating space to store the results.
+ #[inline]
+ fn size_hint(&self) -> (uint, Option<uint>) { (0, None) }
+
+ /// Chain this iterator with another, returning a new iterator which will
+ /// finish iterating over the current iterator, and then it will iterate
+ /// over the other specified iterator.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// let a = [0];
+ /// let b = [1];
+ /// let mut it = a.iter().chain(b.iter());
+ /// assert_eq!(it.next().unwrap(), &0);
+ /// assert_eq!(it.next().unwrap(), &1);
+ /// assert!(it.next().is_none());
+ /// ```
+ #[inline]
+ fn chain<U: Iterator<A>>(self, other: U) -> Chain<Self, U> {
+ Chain{a: self, b: other, flag: false}
+ }
+
+ /// Creates an iterator which iterates over both this and the specified
+ /// iterators simultaneously, yielding the two elements as pairs. When
+ /// either iterator returns None, all further invocations of next() will
+ /// return None.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// let a = [0];
+ /// let b = [1];
+ /// let mut it = a.iter().zip(b.iter());
+ /// assert_eq!(it.next().unwrap(), (&0, &1));
+ /// assert!(it.next().is_none());
+ /// ```
+ #[inline]
+ fn zip<B, U: Iterator<B>>(self, other: U) -> Zip<Self, U> {
+ Zip{a: self, b: other}
+ }
+
+ /// Creates a new iterator which will apply the specified function to each
+ /// element returned by the first, yielding the mapped element instead.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// let a = [1, 2];
+ /// let mut it = a.iter().map(|&x| 2 * x);
+ /// assert_eq!(it.next().unwrap(), 2);
+ /// assert_eq!(it.next().unwrap(), 4);
+ /// assert!(it.next().is_none());
+ /// ```
+ #[inline]
+ fn map<'r, B>(self, f: |A|: 'r -> B) -> Map<'r, A, B, Self> {
+ Map{iter: self, f: f}
+ }
+
+ /// Creates an iterator which applies the predicate to each element returned
+ /// by this iterator. Only elements which have the predicate evaluate to
+ /// `true` will be yielded.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// let a = [1, 2];
+ /// let mut it = a.iter().filter(|&x| *x > 1);
+ /// assert_eq!(it.next().unwrap(), &2);
+ /// assert!(it.next().is_none());
+ /// ```
+ #[inline]
+ fn filter<'r>(self, predicate: |&A|: 'r -> bool) -> Filter<'r, A, Self> {
+ Filter{iter: self, predicate: predicate}
+ }
+
+ /// Creates an iterator which both filters and maps elements.
+ /// If the specified function returns None, the element is skipped.
+ /// Otherwise the option is unwrapped and the new value is yielded.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// let a = [1, 2];
+ /// let mut it = a.iter().filter_map(|&x| if x > 1 {Some(2 * x)} else {None});
+ /// assert_eq!(it.next().unwrap(), 4);
+ /// assert!(it.next().is_none());
+ /// ```
+ #[inline]
+ fn filter_map<'r, B>(self, f: |A|: 'r -> Option<B>) -> FilterMap<'r, A, B, Self> {
+ FilterMap { iter: self, f: f }
+ }
+
+ /// Creates an iterator which yields a pair of the value returned by this
+ /// iterator plus the current index of iteration.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// let a = [100, 200];
+ /// let mut it = a.iter().enumerate();
+ /// assert_eq!(it.next().unwrap(), (0, &100));
+ /// assert_eq!(it.next().unwrap(), (1, &200));
+ /// assert!(it.next().is_none());
+ /// ```
+ #[inline]
+ fn enumerate(self) -> Enumerate<Self> {
+ Enumerate{iter: self, count: 0}
+ }
+
+
+ /// Creates an iterator that has a `.peek()` method
+ /// that returns an optional reference to the next element.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// let xs = [100, 200, 300];
+ /// let mut it = xs.iter().map(|x| *x).peekable();
+ /// assert_eq!(it.peek().unwrap(), &100);
+ /// assert_eq!(it.next().unwrap(), 100);
+ /// assert_eq!(it.next().unwrap(), 200);
+ /// assert_eq!(it.peek().unwrap(), &300);
+ /// assert_eq!(it.peek().unwrap(), &300);
+ /// assert_eq!(it.next().unwrap(), 300);
+ /// assert!(it.peek().is_none());
+ /// assert!(it.next().is_none());
+ /// ```
+ #[inline]
+ fn peekable(self) -> Peekable<A, Self> {
+ Peekable{iter: self, peeked: None}
+ }
+
+ /// Creates an iterator which invokes the predicate on elements until it
+ /// returns false. Once the predicate returns false, all further elements are
+ /// yielded.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// let a = [1, 2, 3, 2, 1];
+ /// let mut it = a.iter().skip_while(|&a| *a < 3);
+ /// assert_eq!(it.next().unwrap(), &3);
+ /// assert_eq!(it.next().unwrap(), &2);
+ /// assert_eq!(it.next().unwrap(), &1);
+ /// assert!(it.next().is_none());
+ /// ```
+ #[inline]
+ fn skip_while<'r>(self, predicate: |&A|: 'r -> bool) -> SkipWhile<'r, A, Self> {
+ SkipWhile{iter: self, flag: false, predicate: predicate}
+ }
+
+ /// Creates an iterator which yields elements so long as the predicate
+ /// returns true. After the predicate returns false for the first time, no
+ /// further elements will be yielded.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// let a = [1, 2, 3, 2, 1];
+ /// let mut it = a.iter().take_while(|&a| *a < 3);
+ /// assert_eq!(it.next().unwrap(), &1);
+ /// assert_eq!(it.next().unwrap(), &2);
+ /// assert!(it.next().is_none());
+ /// ```
+ #[inline]
+ fn take_while<'r>(self, predicate: |&A|: 'r -> bool) -> TakeWhile<'r, A, Self> {
+ TakeWhile{iter: self, flag: false, predicate: predicate}
+ }
+
+ /// Creates an iterator which skips the first `n` elements of this iterator,
+ /// and then it yields all further items.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// let a = [1, 2, 3, 4, 5];
+ /// let mut it = a.iter().skip(3);
+ /// assert_eq!(it.next().unwrap(), &4);
+ /// assert_eq!(it.next().unwrap(), &5);
+ /// assert!(it.next().is_none());
+ /// ```
+ #[inline]
+ fn skip(self, n: uint) -> Skip<Self> {
+ Skip{iter: self, n: n}
+ }
+
+ /// Creates an iterator which yields the first `n` elements of this
+ /// iterator, and then it will always return None.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// let a = [1, 2, 3, 4, 5];
+ /// let mut it = a.iter().take(3);
+ /// assert_eq!(it.next().unwrap(), &1);
+ /// assert_eq!(it.next().unwrap(), &2);
+ /// assert_eq!(it.next().unwrap(), &3);
+ /// assert!(it.next().is_none());
+ /// ```
+ #[inline]
+ fn take(self, n: uint) -> Take<Self> {
+ Take{iter: self, n: n}
+ }
+
+ /// Creates a new iterator which behaves in a similar fashion to fold.
+ /// There is a state which is passed between each iteration and can be
+ /// mutated as necessary. The yielded values from the closure are yielded
+ /// from the Scan instance when not None.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// let a = [1, 2, 3, 4, 5];
+ /// let mut it = a.iter().scan(1, |fac, &x| {
+ /// *fac = *fac * x;
+ /// Some(*fac)
+ /// });
+ /// assert_eq!(it.next().unwrap(), 1);
+ /// assert_eq!(it.next().unwrap(), 2);
+ /// assert_eq!(it.next().unwrap(), 6);
+ /// assert_eq!(it.next().unwrap(), 24);
+ /// assert_eq!(it.next().unwrap(), 120);
+ /// assert!(it.next().is_none());
+ /// ```
+ #[inline]
+ fn scan<'r, St, B>(self, initial_state: St, f: |&mut St, A|: 'r -> Option<B>)
+ -> Scan<'r, A, B, Self, St> {
+ Scan{iter: self, f: f, state: initial_state}
+ }
+
+ /// Creates an iterator that maps each element to an iterator,
+ /// and yields the elements of the produced iterators
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// use std::iter::count;
+ ///
+ /// let xs = [2u, 3];
+ /// let ys = [0u, 1, 0, 1, 2];
+ /// let mut it = xs.iter().flat_map(|&x| count(0u, 1).take(x));
+ /// // Check that `it` has the same elements as `ys`
+ /// let mut i = 0;
+ /// for x in it {
+ /// assert_eq!(x, ys[i]);
+ /// i += 1;
+ /// }
+ /// ```
+ #[inline]
+ fn flat_map<'r, B, U: Iterator<B>>(self, f: |A|: 'r -> U)
+ -> FlatMap<'r, A, Self, U> {
+ FlatMap{iter: self, f: f, frontiter: None, backiter: None }
+ }
+
+ /// Creates an iterator that yields `None` forever after the underlying
+ /// iterator yields `None`. Random-access iterator behavior is not
+ /// affected, only single and double-ended iterator behavior.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// fn process<U: Iterator<int>>(it: U) -> int {
+ /// let mut it = it.fuse();
+ /// let mut sum = 0;
+ /// for x in it {
+ /// if x > 5 {
+ /// continue;
+ /// }
+ /// sum += x;
+ /// }
+ /// // did we exhaust the iterator?
+ /// if it.next().is_none() {
+ /// sum += 1000;
+ /// }
+ /// sum
+ /// }
+ /// let x = ~[1,2,3,7,8,9];
+ /// assert_eq!(process(x.move_iter()), 1006);
+ /// ```
+ #[inline]
+ fn fuse(self) -> Fuse<Self> {
+ Fuse{iter: self, done: false}
+ }
+
+ /// Creates an iterator that calls a function with a reference to each
+ /// element before yielding it. This is often useful for debugging an
+ /// iterator pipeline.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// use std::iter::AdditiveIterator;
+ ///
+ /// let xs = [1u, 4, 2, 3, 8, 9, 6];
+ /// let sum = xs.iter()
+ /// .map(|&x| x)
+ /// .inspect(|&x| println!("filtering {}", x))
+ /// .filter(|&x| x % 2 == 0)
+ /// .inspect(|&x| println!("{} made it through", x))
+ /// .sum();
+ /// println!("{}", sum);
+ /// ```
+ #[inline]
+ fn inspect<'r>(self, f: |&A|: 'r) -> Inspect<'r, A, Self> {
+ Inspect{iter: self, f: f}
+ }
+
+ /// Creates a wrapper around a mutable reference to the iterator.
+ ///
+ /// This is useful to allow applying iterator adaptors while still
+ /// retaining ownership of the original iterator value.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// let mut xs = range(0, 10);
+ /// // sum the first five values
+ /// let partial_sum = xs.by_ref().take(5).fold(0, |a, b| a + b);
+ /// assert!(partial_sum == 10);
+ /// // xs.next() is now `5`
+ /// assert!(xs.next() == Some(5));
+ /// ```
+ fn by_ref<'r>(&'r mut self) -> ByRef<'r, Self> {
+ ByRef{iter: self}
+ }
+
+ /// Apply a function to each element, or stop iterating if the
+ /// function returns `false`.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// range(0, 5).advance(|x| {print!("{} ", x); true});
+ /// ```
+ #[inline]
+ fn advance(&mut self, f: |A| -> bool) -> bool {
+ loop {
+ match self.next() {
+ Some(x) => {
+ if !f(x) { return false; }
+ }
+ None => { return true; }
+ }
+ }
+ }
+
+ /// Loops through the entire iterator, collecting all of the elements into
+ /// a container implementing `FromIterator`.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// let a = [1, 2, 3, 4, 5];
+ /// let b: ~[int] = a.iter().map(|&x| x).collect();
+ /// assert!(a == b);
+ /// ```
+ #[inline]
+ fn collect<B: FromIterator<A>>(&mut self) -> B {
+ FromIterator::from_iter(self.by_ref())
+ }
+
+ /// Loops through `n` iterations, returning the `n`th element of the
+ /// iterator.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// let a = [1, 2, 3, 4, 5];
+ /// let mut it = a.iter();
+ /// assert!(it.nth(2).unwrap() == &3);
+ /// assert!(it.nth(2) == None);
+ /// ```
+ #[inline]
+ fn nth(&mut self, mut n: uint) -> Option<A> {
+ loop {
+ match self.next() {
+ Some(x) => if n == 0 { return Some(x) },
+ None => return None
+ }
+ n -= 1;
+ }
+ }
+
+ /// Loops through the entire iterator, returning the last element of the
+ /// iterator.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// let a = [1, 2, 3, 4, 5];
+ /// assert!(a.iter().last().unwrap() == &5);
+ /// ```
+ #[inline]
+ fn last(&mut self) -> Option<A> {
+ let mut last = None;
+ for x in *self { last = Some(x); }
+ last
+ }
+
+ /// Performs a fold operation over the entire iterator, returning the
+ /// eventual state at the end of the iteration.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// let a = [1, 2, 3, 4, 5];
+ /// assert!(a.iter().fold(0, |a, &b| a + b) == 15);
+ /// ```
+ #[inline]
+ fn fold<B>(&mut self, init: B, f: |B, A| -> B) -> B {
+ let mut accum = init;
+ loop {
+ match self.next() {
+ Some(x) => { accum = f(accum, x); }
+ None => { break; }
+ }
+ }
+ accum
+ }
+
+ /// Counts the number of elements in this iterator.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// let a = [1, 2, 3, 4, 5];
+ /// let mut it = a.iter();
+ /// assert!(it.len() == 5);
+ /// assert!(it.len() == 0);
+ /// ```
+ #[inline]
+ fn len(&mut self) -> uint {
+ self.fold(0, |cnt, _x| cnt + 1)
+ }
+
+ /// Tests whether the predicate holds true for all elements in the iterator.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// let a = [1, 2, 3, 4, 5];
+ /// assert!(a.iter().all(|x| *x > 0));
+ /// assert!(!a.iter().all(|x| *x > 2));
+ /// ```
+ #[inline]
+ fn all(&mut self, f: |A| -> bool) -> bool {
+ for x in *self { if !f(x) { return false; } }
+ true
+ }
+
+ /// Tests whether any element of an iterator satisfies the specified
+ /// predicate.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// let a = [1, 2, 3, 4, 5];
+ /// let mut it = a.iter();
+ /// assert!(it.any(|x| *x == 3));
+ /// assert!(!it.any(|x| *x == 3));
+ /// ```
+ #[inline]
+ fn any(&mut self, f: |A| -> bool) -> bool {
+ for x in *self { if f(x) { return true; } }
+ false
+ }
+
+ /// Return the first element satisfying the specified predicate
+ #[inline]
+ fn find(&mut self, predicate: |&A| -> bool) -> Option<A> {
+ for x in *self {
+ if predicate(&x) { return Some(x) }
+ }
+ None
+ }
+
+ /// Return the index of the first element satisfying the specified predicate
+ #[inline]
+ fn position(&mut self, predicate: |A| -> bool) -> Option<uint> {
+ let mut i = 0;
+ for x in *self {
+ if predicate(x) {
+ return Some(i);
+ }
+ i += 1;
+ }
+ None
+ }
+
+ /// Count the number of elements satisfying the specified predicate
+ #[inline]
+ fn count(&mut self, predicate: |A| -> bool) -> uint {
+ let mut i = 0;
+ for x in *self {
+ if predicate(x) { i += 1 }
+ }
+ i
+ }
+
+ /// Return the element that gives the maximum value from the
+ /// specified function.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// let xs = [-3i, 0, 1, 5, -10];
+ /// assert_eq!(*xs.iter().max_by(|x| x.abs()).unwrap(), -10);
+ /// ```
+ #[inline]
+ fn max_by<B: TotalOrd>(&mut self, f: |&A| -> B) -> Option<A> {
+ self.fold(None, |max: Option<(A, B)>, x| {
+ let x_val = f(&x);
+ match max {
+ None => Some((x, x_val)),
+ Some((y, y_val)) => if x_val > y_val {
+ Some((x, x_val))
+ } else {
+ Some((y, y_val))
+ }
+ }
+ }).map(|(x, _)| x)
+ }
+
+ /// Return the element that gives the minimum value from the
+ /// specified function.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// let xs = [-3i, 0, 1, 5, -10];
+ /// assert_eq!(*xs.iter().min_by(|x| x.abs()).unwrap(), 0);
+ /// ```
+ #[inline]
+ fn min_by<B: TotalOrd>(&mut self, f: |&A| -> B) -> Option<A> {
+ self.fold(None, |min: Option<(A, B)>, x| {
+ let x_val = f(&x);
+ match min {
+ None => Some((x, x_val)),
+ Some((y, y_val)) => if x_val < y_val {
+ Some((x, x_val))
+ } else {
+ Some((y, y_val))
+ }
+ }
+ }).map(|(x, _)| x)
+ }
+}
+
+/// A range iterator able to yield elements from both ends
+pub trait DoubleEndedIterator<A>: Iterator<A> {
+ /// Yield an element from the end of the range, returning `None` if the range is empty.
+ fn next_back(&mut self) -> Option<A>;
+
+ /// Change the direction of the iterator
+ ///
+ /// The flipped iterator swaps the ends on an iterator that can already
+ /// be iterated from the front and from the back.
+ ///
+ ///
+ /// If the iterator also implements RandomAccessIterator, the flipped
+ /// iterator is also random access, with the indices starting at the back
+ /// of the original iterator.
+ ///
+ /// Note: Random access with flipped indices still only applies to the first
+ /// `uint::MAX` elements of the original iterator.
+ #[inline]
+ fn rev(self) -> Rev<Self> {
+ Rev{iter: self}
+ }
+}
+
+/// A double-ended iterator yielding mutable references
+pub trait MutableDoubleEndedIterator {
+ // FIXME: #5898: should be called `reverse`
+ /// Use an iterator to reverse a container in-place
+ fn reverse_(&mut self);
+}
+
+impl<'a, A, T: DoubleEndedIterator<&'a mut A>> MutableDoubleEndedIterator for T {
+ // FIXME: #5898: should be called `reverse`
+ /// Use an iterator to reverse a container in-place
+ fn reverse_(&mut self) {
+ loop {
+ match (self.next(), self.next_back()) {
+ (Some(x), Some(y)) => mem::swap(x, y),
+ _ => break
+ }
+ }
+ }
+}
+
+
+/// An object implementing random access indexing by `uint`
+///
+/// A `RandomAccessIterator` should be either infinite or a `DoubleEndedIterator`.
+pub trait RandomAccessIterator<A>: Iterator<A> {
+ /// Return the number of indexable elements. At most `std::uint::MAX`
+ /// elements are indexable, even if the iterator represents a longer range.
+ fn indexable(&self) -> uint;
+
+ /// Return an element at an index
+ fn idx(&mut self, index: uint) -> Option<A>;
+}
+
+/// An iterator that knows its exact length
+///
+/// This trait is a helper for iterators like the vector iterator, so that
+/// it can support double-ended enumeration.
+///
+/// `Iterator::size_hint` *must* return the exact size of the iterator.
+/// Note that the size must fit in `uint`.
+pub trait ExactSize<A> : DoubleEndedIterator<A> {
+ /// Return the index of the last element satisfying the specified predicate
+ ///
+ /// If no element matches, None is returned.
+ #[inline]
+ fn rposition(&mut self, predicate: |A| -> bool) -> Option<uint> {
+ let (lower, upper) = self.size_hint();
+ assert!(upper == Some(lower));
+ let mut i = lower;
+ loop {
+ match self.next_back() {
+ None => break,
+ Some(x) => {
+ i = match i.checked_sub(&1) {
+ Some(x) => x,
+ None => fail!("rposition: incorrect ExactSize")
+ };
+ if predicate(x) {
+ return Some(i)
+ }
+ }
+ }
+ }
+ None
+ }
+}
+
+// All adaptors that preserve the size of the wrapped iterator are fine
+// Adaptors that may overflow in `size_hint` are not, i.e. `Chain`.
+impl<A, T: ExactSize<A>> ExactSize<(uint, A)> for Enumerate<T> {}
+impl<'a, A, T: ExactSize<A>> ExactSize<A> for Inspect<'a, A, T> {}
+impl<A, T: ExactSize<A>> ExactSize<A> for Rev<T> {}
+impl<'a, A, B, T: ExactSize<A>> ExactSize<B> for Map<'a, A, B, T> {}
+impl<A, B, T: ExactSize<A>, U: ExactSize<B>> ExactSize<(A, B)> for Zip<T, U> {}
+
+/// An double-ended iterator with the direction inverted
+#[deriving(Clone)]
+pub struct Rev<T> {
+ iter: T
+}
+
+impl<A, T: DoubleEndedIterator<A>> Iterator<A> for Rev<T> {
+ #[inline]
+ fn next(&mut self) -> Option<A> { self.iter.next_back() }
+ #[inline]
+ fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() }
+}
+
+impl<A, T: DoubleEndedIterator<A>> DoubleEndedIterator<A> for Rev<T> {
+ #[inline]
+ fn next_back(&mut self) -> Option<A> { self.iter.next() }
+}
+
+impl<A, T: DoubleEndedIterator<A> + RandomAccessIterator<A>> RandomAccessIterator<A>
+ for Rev<T> {
+ #[inline]
+ fn indexable(&self) -> uint { self.iter.indexable() }
+ #[inline]
+ fn idx(&mut self, index: uint) -> Option<A> {
+ let amt = self.indexable();
+ self.iter.idx(amt - index - 1)
+ }
+}
+
+/// A mutable reference to an iterator
+pub struct ByRef<'a, T> {
+ iter: &'a mut T
+}
+
+impl<'a, A, T: Iterator<A>> Iterator<A> for ByRef<'a, T> {
+ #[inline]
+ fn next(&mut self) -> Option<A> { self.iter.next() }
+ #[inline]
+ fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() }
+}
+
+impl<'a, A, T: DoubleEndedIterator<A>> DoubleEndedIterator<A> for ByRef<'a, T> {
+ #[inline]
+ fn next_back(&mut self) -> Option<A> { self.iter.next_back() }
+}
+
+/// A trait for iterators over elements which can be added together
+pub trait AdditiveIterator<A> {
+ /// Iterates over the entire iterator, summing up all the elements
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// use std::iter::AdditiveIterator;
+ ///
+ /// let a = [1, 2, 3, 4, 5];
+ /// let mut it = a.iter().map(|&x| x);
+ /// assert!(it.sum() == 15);
+ /// ```
+ fn sum(&mut self) -> A;
+}
+
+impl<A: Add<A, A> + Zero, T: Iterator<A>> AdditiveIterator<A> for T {
+ #[inline]
+ fn sum(&mut self) -> A {
+ let zero: A = Zero::zero();
+ self.fold(zero, |s, x| s + x)
+ }
+}
+
+/// A trait for iterators over elements whose elements can be multiplied
+/// together.
+pub trait MultiplicativeIterator<A> {
+ /// Iterates over the entire iterator, multiplying all the elements
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// use std::iter::{count, MultiplicativeIterator};
+ ///
+ /// fn factorial(n: uint) -> uint {
+ /// count(1u, 1).take_while(|&i| i <= n).product()
+ /// }
+ /// assert!(factorial(0) == 1);
+ /// assert!(factorial(1) == 1);
+ /// assert!(factorial(5) == 120);
+ /// ```
+ fn product(&mut self) -> A;
+}
+
+impl<A: Mul<A, A> + One, T: Iterator<A>> MultiplicativeIterator<A> for T {
+ #[inline]
+ fn product(&mut self) -> A {
+ let one: A = One::one();
+ self.fold(one, |p, x| p * x)
+ }
+}
+
+/// A trait for iterators over elements which can be compared to one another.
+/// The type of each element must ascribe to the `Ord` trait.
+pub trait OrdIterator<A> {
+ /// Consumes the entire iterator to return the maximum element.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// let a = [1, 2, 3, 4, 5];
+ /// assert!(a.iter().max().unwrap() == &5);
+ /// ```
+ fn max(&mut self) -> Option<A>;
+
+ /// Consumes the entire iterator to return the minimum element.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// let a = [1, 2, 3, 4, 5];
+ /// assert!(a.iter().min().unwrap() == &1);
+ /// ```
+ fn min(&mut self) -> Option<A>;
+
+ /// `min_max` finds the minimum and maximum elements in the iterator.
+ ///
+ /// The return type `MinMaxResult` is an enum of three variants:
+ /// - `NoElements` if the iterator is empty.
+ /// - `OneElement(x)` if the iterator has exactly one element.
+ /// - `MinMax(x, y)` is returned otherwise, where `x <= y`. Two values are equal if and only if
+ /// there is more than one element in the iterator and all elements are equal.
+ ///
+ /// On an iterator of length `n`, `min_max` does `1.5 * n` comparisons,
+ /// and so faster than calling `min` and `max separately which does `2 * n` comparisons.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// use std::iter::{NoElements, OneElement, MinMax};
+ ///
+ /// let v: [int, ..0] = [];
+ /// assert_eq!(v.iter().min_max(), NoElements);
+ ///
+ /// let v = [1i];
+ /// assert!(v.iter().min_max() == OneElement(&1));
+ ///
+ /// let v = [1i, 2, 3, 4, 5];
+ /// assert!(v.iter().min_max() == MinMax(&1, &5));
+ ///
+ /// let v = [1i, 2, 3, 4, 5, 6];
+ /// assert!(v.iter().min_max() == MinMax(&1, &6));
+ ///
+ /// let v = [1i, 1, 1, 1];
+ /// assert!(v.iter().min_max() == MinMax(&1, &1));
+ /// ```
+ fn min_max(&mut self) -> MinMaxResult<A>;
+}
+
+impl<A: TotalOrd, T: Iterator<A>> OrdIterator<A> for T {
+ #[inline]
+ fn max(&mut self) -> Option<A> {
+ self.fold(None, |max, x| {
+ match max {
+ None => Some(x),
+ Some(y) => Some(cmp::max(x, y))
+ }
+ })
+ }
+
+ #[inline]
+ fn min(&mut self) -> Option<A> {
+ self.fold(None, |min, x| {
+ match min {
+ None => Some(x),
+ Some(y) => Some(cmp::min(x, y))
+ }
+ })
+ }
+
+ fn min_max(&mut self) -> MinMaxResult<A> {
+ let (mut min, mut max) = match self.next() {
+ None => return NoElements,
+ Some(x) => {
+ match self.next() {
+ None => return OneElement(x),
+ Some(y) => if x < y {(x, y)} else {(y,x)}
+ }
+ }
+ };
+
+ loop {
+ // `first` and `second` are the two next elements we want to look at.
+ // We first compare `first` and `second` (#1). The smaller one is then compared to
+ // current minimum (#2). The larger one is compared to current maximum (#3). This
+ // way we do 3 comparisons for 2 elements.
+ let first = match self.next() {
+ None => break,
+ Some(x) => x
+ };
+ let second = match self.next() {
+ None => {
+ if first < min {
+ min = first;
+ } else if first > max {
+ max = first;
+ }
+ break;
+ }
+ Some(x) => x
+ };
+ if first < second {
+ if first < min {min = first;}
+ if max < second {max = second;}
+ } else {
+ if second < min {min = second;}
+ if max < first {max = first;}
+ }
+ }
+
+ MinMax(min, max)
+ }
+}
+
+/// `MinMaxResult` is an enum returned by `min_max`. See `OrdIterator::min_max` for more detail.
+#[deriving(Clone, Eq)]
+pub enum MinMaxResult<T> {
+ /// Empty iterator
+ NoElements,
+
+ /// Iterator with one element, so the minimum and maximum are the same
+ OneElement(T),
+
+ /// More than one element in the iterator, the first element is not larger than the second
+ MinMax(T, T)
+}
+
+impl<T: Clone> MinMaxResult<T> {
+ /// `into_option` creates an `Option` of type `(T,T)`. The returned `Option` has variant
+ /// `None` if and only if the `MinMaxResult` has variant `NoElements`. Otherwise variant
+ /// `Some(x,y)` is returned where `x <= y`. If `MinMaxResult` has variant `OneElement(x)`,
+ /// performing this operation will make one clone of `x`.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// use std::iter::{NoElements, OneElement, MinMax, MinMaxResult};
+ ///
+ /// let r: MinMaxResult<int> = NoElements;
+ /// assert_eq!(r.into_option(), None)
+ ///
+ /// let r = OneElement(1);
+ /// assert_eq!(r.into_option(), Some((1,1)));
+ ///
+ /// let r = MinMax(1,2);
+ /// assert_eq!(r.into_option(), Some((1,2)));
+ /// ```
+ pub fn into_option(self) -> Option<(T,T)> {
+ match self {
+ NoElements => None,
+ OneElement(x) => Some((x.clone(), x)),
+ MinMax(x, y) => Some((x, y))
+ }
+ }
+}
+
+/// A trait for iterators that are cloneable.
+pub trait CloneableIterator {
+ /// Repeats an iterator endlessly
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// use std::iter::{CloneableIterator, count};
+ ///
+ /// let a = count(1,1).take(1);
+ /// let mut cy = a.cycle();
+ /// assert_eq!(cy.next(), Some(1));
+ /// assert_eq!(cy.next(), Some(1));
+ /// ```
+ fn cycle(self) -> Cycle<Self>;
+}
+
+impl<A, T: Clone + Iterator<A>> CloneableIterator for T {
+ #[inline]
+ fn cycle(self) -> Cycle<T> {
+ Cycle{orig: self.clone(), iter: self}
+ }
+}
+
+/// An iterator that repeats endlessly
+#[deriving(Clone)]
+pub struct Cycle<T> {
+ orig: T,
+ iter: T,
+}
+
+impl<A, T: Clone + Iterator<A>> Iterator<A> for Cycle<T> {
+ #[inline]
+ fn next(&mut self) -> Option<A> {
+ match self.iter.next() {
+ None => { self.iter = self.orig.clone(); self.iter.next() }
+ y => y
+ }
+ }
+
+ #[inline]
+ fn size_hint(&self) -> (uint, Option<uint>) {
+ // the cycle iterator is either empty or infinite
+ match self.orig.size_hint() {
+ sz @ (0, Some(0)) => sz,
+ (0, _) => (0, None),
+ _ => (uint::MAX, None)
+ }
+ }
+}
+
+impl<A, T: Clone + RandomAccessIterator<A>> RandomAccessIterator<A> for Cycle<T> {
+ #[inline]
+ fn indexable(&self) -> uint {
+ if self.orig.indexable() > 0 {
+ uint::MAX
+ } else {
+ 0
+ }
+ }
+
+ #[inline]
+ fn idx(&mut self, index: uint) -> Option<A> {
+ let liter = self.iter.indexable();
+ let lorig = self.orig.indexable();
+ if lorig == 0 {
+ None
+ } else if index < liter {
+ self.iter.idx(index)
+ } else {
+ self.orig.idx((index - liter) % lorig)
+ }
+ }
+}
+
+/// An iterator which strings two iterators together
+#[deriving(Clone)]
+pub struct Chain<T, U> {
+ a: T,
+ b: U,
+ flag: bool,
+}
+
+impl<A, T: Iterator<A>, U: Iterator<A>> Iterator<A> for Chain<T, U> {
+ #[inline]
+ fn next(&mut self) -> Option<A> {
+ if self.flag {
+ self.b.next()
+ } else {
+ match self.a.next() {
+ Some(x) => return Some(x),
+ _ => ()
+ }
+ self.flag = true;
+ self.b.next()
+ }
+ }
+
+ #[inline]
+ fn size_hint(&self) -> (uint, Option<uint>) {
+ let (a_lower, a_upper) = self.a.size_hint();
+ let (b_lower, b_upper) = self.b.size_hint();
+
+ let lower = a_lower.saturating_add(b_lower);
+
+ let upper = match (a_upper, b_upper) {
+ (Some(x), Some(y)) => x.checked_add(&y),
+ _ => None
+ };
+
+ (lower, upper)
+ }
+}
+
+impl<A, T: DoubleEndedIterator<A>, U: DoubleEndedIterator<A>> DoubleEndedIterator<A>
+for Chain<T, U> {
+ #[inline]
+ fn next_back(&mut self) -> Option<A> {
+ match self.b.next_back() {
+ Some(x) => Some(x),
+ None => self.a.next_back()
+ }
+ }
+}
+
+impl<A, T: RandomAccessIterator<A>, U: RandomAccessIterator<A>> RandomAccessIterator<A>
+for Chain<T, U> {
+ #[inline]
+ fn indexable(&self) -> uint {
+ let (a, b) = (self.a.indexable(), self.b.indexable());
+ a.saturating_add(b)
+ }
+
+ #[inline]
+ fn idx(&mut self, index: uint) -> Option<A> {
+ let len = self.a.indexable();
+ if index < len {
+ self.a.idx(index)
+ } else {
+ self.b.idx(index - len)
+ }
+ }
+}
+
+/// An iterator which iterates two other iterators simultaneously
+#[deriving(Clone)]
+pub struct Zip<T, U> {
+ a: T,
+ b: U
+}
+
+impl<A, B, T: Iterator<A>, U: Iterator<B>> Iterator<(A, B)> for Zip<T, U> {
+ #[inline]
+ fn next(&mut self) -> Option<(A, B)> {
+ match self.a.next() {
+ None => None,
+ Some(x) => match self.b.next() {
+ None => None,
+ Some(y) => Some((x, y))
+ }
+ }
+ }
+
+ #[inline]
+ fn size_hint(&self) -> (uint, Option<uint>) {
+ let (a_lower, a_upper) = self.a.size_hint();
+ let (b_lower, b_upper) = self.b.size_hint();
+
+ let lower = cmp::min(a_lower, b_lower);
+
+ let upper = match (a_upper, b_upper) {
+ (Some(x), Some(y)) => Some(cmp::min(x,y)),
+ (Some(x), None) => Some(x),
+ (None, Some(y)) => Some(y),
+ (None, None) => None
+ };
+
+ (lower, upper)
+ }
+}
+
+impl<A, B, T: ExactSize<A>, U: ExactSize<B>> DoubleEndedIterator<(A, B)>
+for Zip<T, U> {
+ #[inline]
+ fn next_back(&mut self) -> Option<(A, B)> {
+ let (a_sz, a_upper) = self.a.size_hint();
+ let (b_sz, b_upper) = self.b.size_hint();
+ assert!(a_upper == Some(a_sz));
+ assert!(b_upper == Some(b_sz));
+ if a_sz < b_sz {
+ for _ in range(0, b_sz - a_sz) { self.b.next_back(); }
+ } else if a_sz > b_sz {
+ for _ in range(0, a_sz - b_sz) { self.a.next_back(); }
+ }
+ let (a_sz, _) = self.a.size_hint();
+ let (b_sz, _) = self.b.size_hint();
+ assert!(a_sz == b_sz);
+ match (self.a.next_back(), self.b.next_back()) {
+ (Some(x), Some(y)) => Some((x, y)),
+ _ => None
+ }
+ }
+}
+
+impl<A, B, T: RandomAccessIterator<A>, U: RandomAccessIterator<B>>
+RandomAccessIterator<(A, B)> for Zip<T, U> {
+ #[inline]
+ fn indexable(&self) -> uint {
+ cmp::min(self.a.indexable(), self.b.indexable())
+ }
+
+ #[inline]
+ fn idx(&mut self, index: uint) -> Option<(A, B)> {
+ match self.a.idx(index) {
+ None => None,
+ Some(x) => match self.b.idx(index) {
+ None => None,
+ Some(y) => Some((x, y))
+ }
+ }
+ }
+}
+
+/// An iterator which maps the values of `iter` with `f`
+pub struct Map<'a, A, B, T> {
+ iter: T,
+ f: |A|: 'a -> B
+}
+
+impl<'a, A, B, T> Map<'a, A, B, T> {
+ #[inline]
+ fn do_map(&mut self, elt: Option<A>) -> Option<B> {
+ match elt {
+ Some(a) => Some((self.f)(a)),
+ _ => None
+ }
+ }
+}
+
+impl<'a, A, B, T: Iterator<A>> Iterator<B> for Map<'a, A, B, T> {
+ #[inline]
+ fn next(&mut self) -> Option<B> {
+ let next = self.iter.next();
+ self.do_map(next)
+ }
+
+ #[inline]
+ fn size_hint(&self) -> (uint, Option<uint>) {
+ self.iter.size_hint()
+ }
+}
+
+impl<'a, A, B, T: DoubleEndedIterator<A>> DoubleEndedIterator<B> for Map<'a, A, B, T> {
+ #[inline]
+ fn next_back(&mut self) -> Option<B> {
+ let next = self.iter.next_back();
+ self.do_map(next)
+ }
+}
+
+impl<'a, A, B, T: RandomAccessIterator<A>> RandomAccessIterator<B> for Map<'a, A, B, T> {
+ #[inline]
+ fn indexable(&self) -> uint {
+ self.iter.indexable()
+ }
+
+ #[inline]
+ fn idx(&mut self, index: uint) -> Option<B> {
+ let elt = self.iter.idx(index);
+ self.do_map(elt)
+ }
+}
+
+/// An iterator which filters the elements of `iter` with `predicate`
+pub struct Filter<'a, A, T> {
+ iter: T,
+ predicate: |&A|: 'a -> bool
+}
+
+impl<'a, A, T: Iterator<A>> Iterator<A> for Filter<'a, A, T> {
+ #[inline]
+ fn next(&mut self) -> Option<A> {
+ for x in self.iter {
+ if (self.predicate)(&x) {
+ return Some(x);
+ } else {
+ continue
+ }
+ }
+ None
+ }
+
+ #[inline]
+ fn size_hint(&self) -> (uint, Option<uint>) {
+ let (_, upper) = self.iter.size_hint();
+ (0, upper) // can't know a lower bound, due to the predicate
+ }
+}
+
+impl<'a, A, T: DoubleEndedIterator<A>> DoubleEndedIterator<A> for Filter<'a, A, T> {
+ #[inline]
+ fn next_back(&mut self) -> Option<A> {
+ loop {
+ match self.iter.next_back() {
+ None => return None,
+ Some(x) => {
+ if (self.predicate)(&x) {
+ return Some(x);
+ } else {
+ continue
+ }
+ }
+ }
+ }
+ }
+}
+
+/// An iterator which uses `f` to both filter and map elements from `iter`
+pub struct FilterMap<'a, A, B, T> {
+ iter: T,
+ f: |A|: 'a -> Option<B>
+}
+
+impl<'a, A, B, T: Iterator<A>> Iterator<B> for FilterMap<'a, A, B, T> {
+ #[inline]
+ fn next(&mut self) -> Option<B> {
+ for x in self.iter {
+ match (self.f)(x) {
+ Some(y) => return Some(y),
+ None => ()
+ }
+ }
+ None
+ }
+
+ #[inline]
+ fn size_hint(&self) -> (uint, Option<uint>) {
+ let (_, upper) = self.iter.size_hint();
+ (0, upper) // can't know a lower bound, due to the predicate
+ }
+}
+
+impl<'a, A, B, T: DoubleEndedIterator<A>> DoubleEndedIterator<B>
+for FilterMap<'a, A, B, T> {
+ #[inline]
+ fn next_back(&mut self) -> Option<B> {
+ loop {
+ match self.iter.next_back() {
+ None => return None,
+ Some(x) => {
+ match (self.f)(x) {
+ Some(y) => return Some(y),
+ None => ()
+ }
+ }
+ }
+ }
+ }
+}
+
+/// An iterator which yields the current count and the element during iteration
+#[deriving(Clone)]
+pub struct Enumerate<T> {
+ iter: T,
+ count: uint
+}
+
+impl<A, T: Iterator<A>> Iterator<(uint, A)> for Enumerate<T> {
+ #[inline]
+ fn next(&mut self) -> Option<(uint, A)> {
+ match self.iter.next() {
+ Some(a) => {
+ let ret = Some((self.count, a));
+ self.count += 1;
+ ret
+ }
+ _ => None
+ }
+ }
+
+ #[inline]
+ fn size_hint(&self) -> (uint, Option<uint>) {
+ self.iter.size_hint()
+ }
+}
+
+impl<A, T: ExactSize<A>> DoubleEndedIterator<(uint, A)> for Enumerate<T> {
+ #[inline]
+ fn next_back(&mut self) -> Option<(uint, A)> {
+ match self.iter.next_back() {
+ Some(a) => {
+ let (lower, upper) = self.iter.size_hint();
+ assert!(upper == Some(lower));
+ Some((self.count + lower, a))
+ }
+ _ => None
+ }
+ }
+}
+
+impl<A, T: RandomAccessIterator<A>> RandomAccessIterator<(uint, A)> for Enumerate<T> {
+ #[inline]
+ fn indexable(&self) -> uint {
+ self.iter.indexable()
+ }
+
+ #[inline]
+ fn idx(&mut self, index: uint) -> Option<(uint, A)> {
+ match self.iter.idx(index) {
+ Some(a) => Some((self.count + index, a)),
+ _ => None,
+ }
+ }
+}
+
+/// An iterator with a `peek()` that returns an optional reference to the next element.
+pub struct Peekable<A, T> {
+ iter: T,
+ peeked: Option<A>,
+}
+
+impl<A, T: Iterator<A>> Iterator<A> for Peekable<A, T> {
+ #[inline]
+ fn next(&mut self) -> Option<A> {
+ if self.peeked.is_some() { self.peeked.take() }
+ else { self.iter.next() }
+ }
+
+ #[inline]
+ fn size_hint(&self) -> (uint, Option<uint>) {
+ let (lo, hi) = self.iter.size_hint();
+ if self.peeked.is_some() {
+ let lo = lo.saturating_add(1);
+ let hi = match hi {
+ Some(x) => x.checked_add(&1),
+ None => None
+ };
+ (lo, hi)
+ } else {
+ (lo, hi)
+ }
+ }
+}
+
+impl<'a, A, T: Iterator<A>> Peekable<A, T> {
+ /// Return a reference to the next element of the iterator with out advancing it,
+ /// or None if the iterator is exhausted.
+ #[inline]
+ pub fn peek(&'a mut self) -> Option<&'a A> {
+ if self.peeked.is_none() {
+ self.peeked = self.iter.next();
+ }
+ match self.peeked {
+ Some(ref value) => Some(value),
+ None => None,
+ }
+ }
+
+ /// Check whether peekable iterator is empty or not.
+ #[inline]
+ pub fn is_empty(&mut self) -> bool {
+ self.peek().is_none()
+ }
+}
+
+/// An iterator which rejects elements while `predicate` is true
+pub struct SkipWhile<'a, A, T> {
+ iter: T,
+ flag: bool,
+ predicate: |&A|: 'a -> bool
+}
+
+impl<'a, A, T: Iterator<A>> Iterator<A> for SkipWhile<'a, A, T> {
+ #[inline]
+ fn next(&mut self) -> Option<A> {
+ let mut next = self.iter.next();
+ if self.flag {
+ next
+ } else {
+ loop {
+ match next {
+ Some(x) => {
+ if (self.predicate)(&x) {
+ next = self.iter.next();
+ continue
+ } else {
+ self.flag = true;
+ return Some(x)
+ }
+ }
+ None => return None
+ }
+ }
+ }
+ }
+
+ #[inline]
+ fn size_hint(&self) -> (uint, Option<uint>) {
+ let (_, upper) = self.iter.size_hint();
+ (0, upper) // can't know a lower bound, due to the predicate
+ }
+}
+
+/// An iterator which only accepts elements while `predicate` is true
+pub struct TakeWhile<'a, A, T> {
+ iter: T,
+ flag: bool,
+ predicate: |&A|: 'a -> bool
+}
+
+impl<'a, A, T: Iterator<A>> Iterator<A> for TakeWhile<'a, A, T> {
+ #[inline]
+ fn next(&mut self) -> Option<A> {
+ if self.flag {
+ None
+ } else {
+ match self.iter.next() {
+ Some(x) => {
+ if (self.predicate)(&x) {
+ Some(x)
+ } else {
+ self.flag = true;
+ None
+ }
+ }
+ None => None
+ }
+ }
+ }
+
+ #[inline]
+ fn size_hint(&self) -> (uint, Option<uint>) {
+ let (_, upper) = self.iter.size_hint();
+ (0, upper) // can't know a lower bound, due to the predicate
+ }
+}
+
+/// An iterator which skips over `n` elements of `iter`.
+#[deriving(Clone)]
+pub struct Skip<T> {
+ iter: T,
+ n: uint
+}
+
+impl<A, T: Iterator<A>> Iterator<A> for Skip<T> {
+ #[inline]
+ fn next(&mut self) -> Option<A> {
+ let mut next = self.iter.next();
+ if self.n == 0 {
+ next
+ } else {
+ let mut n = self.n;
+ while n > 0 {
+ n -= 1;
+ match next {
+ Some(_) => {
+ next = self.iter.next();
+ continue
+ }
+ None => {
+ self.n = 0;
+ return None
+ }
+ }
+ }
+ self.n = 0;
+ next
+ }
+ }
+
+ #[inline]
+ fn size_hint(&self) -> (uint, Option<uint>) {
+ let (lower, upper) = self.iter.size_hint();
+
+ let lower = lower.saturating_sub(self.n);
+
+ let upper = match upper {
+ Some(x) => Some(x.saturating_sub(self.n)),
+ None => None
+ };
+
+ (lower, upper)
+ }
+}
+
+impl<A, T: RandomAccessIterator<A>> RandomAccessIterator<A> for Skip<T> {
+ #[inline]
+ fn indexable(&self) -> uint {
+ self.iter.indexable().saturating_sub(self.n)
+ }
+
+ #[inline]
+ fn idx(&mut self, index: uint) -> Option<A> {
+ if index >= self.indexable() {
+ None
+ } else {
+ self.iter.idx(index + self.n)
+ }
+ }
+}
+
+/// An iterator which only iterates over the first `n` iterations of `iter`.
+#[deriving(Clone)]
+pub struct Take<T> {
+ iter: T,
+ n: uint
+}
+
+impl<A, T: Iterator<A>> Iterator<A> for Take<T> {
+ #[inline]
+ fn next(&mut self) -> Option<A> {
+ if self.n != 0 {
+ self.n -= 1;
+ self.iter.next()
+ } else {
+ None
+ }
+ }
+
+ #[inline]
+ fn size_hint(&self) -> (uint, Option<uint>) {
+ let (lower, upper) = self.iter.size_hint();
+
+ let lower = cmp::min(lower, self.n);
+
+ let upper = match upper {
+ Some(x) if x < self.n => Some(x),
+ _ => Some(self.n)
+ };
+
+ (lower, upper)
+ }
+}
+
+impl<A, T: RandomAccessIterator<A>> RandomAccessIterator<A> for Take<T> {
+ #[inline]
+ fn indexable(&self) -> uint {
+ cmp::min(self.iter.indexable(), self.n)
+ }
+
+ #[inline]
+ fn idx(&mut self, index: uint) -> Option<A> {
+ if index >= self.n {
+ None
+ } else {
+ self.iter.idx(index)
+ }
+ }
+}
+
+
+/// An iterator to maintain state while iterating another iterator
+pub struct Scan<'a, A, B, T, St> {
+ iter: T,
+ f: |&mut St, A|: 'a -> Option<B>,
+
+ /// The current internal state to be passed to the closure next.
+ pub state: St,
+}
+
+impl<'a, A, B, T: Iterator<A>, St> Iterator<B> for Scan<'a, A, B, T, St> {
+ #[inline]
+ fn next(&mut self) -> Option<B> {
+ self.iter.next().and_then(|a| (self.f)(&mut self.state, a))
+ }
+
+ #[inline]
+ fn size_hint(&self) -> (uint, Option<uint>) {
+ let (_, upper) = self.iter.size_hint();
+ (0, upper) // can't know a lower bound, due to the scan function
+ }
+}
+
+/// An iterator that maps each element to an iterator,
+/// and yields the elements of the produced iterators
+///
+pub struct FlatMap<'a, A, T, U> {
+ iter: T,
+ f: |A|: 'a -> U,
+ frontiter: Option<U>,
+ backiter: Option<U>,
+}
+
+impl<'a, A, T: Iterator<A>, B, U: Iterator<B>> Iterator<B> for FlatMap<'a, A, T, U> {
+ #[inline]
+ fn next(&mut self) -> Option<B> {
+ loop {
+ for inner in self.frontiter.mut_iter() {
+ for x in *inner {
+ return Some(x)
+ }
+ }
+ match self.iter.next().map(|x| (self.f)(x)) {
+ None => return self.backiter.as_mut().and_then(|it| it.next()),
+ next => self.frontiter = next,
+ }
+ }
+ }
+
+ #[inline]
+ fn size_hint(&self) -> (uint, Option<uint>) {
+ let (flo, fhi) = self.frontiter.as_ref().map_or((0, Some(0)), |it| it.size_hint());
+ let (blo, bhi) = self.backiter.as_ref().map_or((0, Some(0)), |it| it.size_hint());
+ let lo = flo.saturating_add(blo);
+ match (self.iter.size_hint(), fhi, bhi) {
+ ((0, Some(0)), Some(a), Some(b)) => (lo, a.checked_add(&b)),
+ _ => (lo, None)
+ }
+ }
+}
+
+impl<'a,
+ A, T: DoubleEndedIterator<A>,
+ B, U: DoubleEndedIterator<B>> DoubleEndedIterator<B>
+ for FlatMap<'a, A, T, U> {
+ #[inline]
+ fn next_back(&mut self) -> Option<B> {
+ loop {
+ for inner in self.backiter.mut_iter() {
+ match inner.next_back() {
+ None => (),
+ y => return y
+ }
+ }
+ match self.iter.next_back().map(|x| (self.f)(x)) {
+ None => return self.frontiter.as_mut().and_then(|it| it.next_back()),
+ next => self.backiter = next,
+ }
+ }
+ }
+}
+
+/// An iterator that yields `None` forever after the underlying iterator
+/// yields `None` once.
+#[deriving(Clone)]
+pub struct Fuse<T> {
+ iter: T,
+ done: bool
+}
+
+impl<A, T: Iterator<A>> Iterator<A> for Fuse<T> {
+ #[inline]
+ fn next(&mut self) -> Option<A> {
+ if self.done {
+ None
+ } else {
+ match self.iter.next() {
+ None => {
+ self.done = true;
+ None
+ }
+ x => x
+ }
+ }
+ }
+
+ #[inline]
+ fn size_hint(&self) -> (uint, Option<uint>) {
+ if self.done {
+ (0, Some(0))
+ } else {
+ self.iter.size_hint()
+ }
+ }
+}
+
+impl<A, T: DoubleEndedIterator<A>> DoubleEndedIterator<A> for Fuse<T> {
+ #[inline]
+ fn next_back(&mut self) -> Option<A> {
+ if self.done {
+ None
+ } else {
+ match self.iter.next_back() {
+ None => {
+ self.done = true;
+ None
+ }
+ x => x
+ }
+ }
+ }
+}
+
+// Allow RandomAccessIterators to be fused without affecting random-access behavior
+impl<A, T: RandomAccessIterator<A>> RandomAccessIterator<A> for Fuse<T> {
+ #[inline]
+ fn indexable(&self) -> uint {
+ self.iter.indexable()
+ }
+
+ #[inline]
+ fn idx(&mut self, index: uint) -> Option<A> {
+ self.iter.idx(index)
+ }
+}
+
+impl<T> Fuse<T> {
+ /// Resets the fuse such that the next call to .next() or .next_back() will
+ /// call the underlying iterator again even if it previously returned None.
+ #[inline]
+ pub fn reset_fuse(&mut self) {
+ self.done = false
+ }
+}
+
+/// An iterator that calls a function with a reference to each
+/// element before yielding it.
+pub struct Inspect<'a, A, T> {
+ iter: T,
+ f: |&A|: 'a
+}
+
+impl<'a, A, T> Inspect<'a, A, T> {
+ #[inline]
+ fn do_inspect(&mut self, elt: Option<A>) -> Option<A> {
+ match elt {
+ Some(ref a) => (self.f)(a),
+ None => ()
+ }
+
+ elt
+ }
+}
+
+impl<'a, A, T: Iterator<A>> Iterator<A> for Inspect<'a, A, T> {
+ #[inline]
+ fn next(&mut self) -> Option<A> {
+ let next = self.iter.next();
+ self.do_inspect(next)
+ }
+
+ #[inline]
+ fn size_hint(&self) -> (uint, Option<uint>) {
+ self.iter.size_hint()
+ }
+}
+
+impl<'a, A, T: DoubleEndedIterator<A>> DoubleEndedIterator<A>
+for Inspect<'a, A, T> {
+ #[inline]
+ fn next_back(&mut self) -> Option<A> {
+ let next = self.iter.next_back();
+ self.do_inspect(next)
+ }
+}
+
+impl<'a, A, T: RandomAccessIterator<A>> RandomAccessIterator<A>
+for Inspect<'a, A, T> {
+ #[inline]
+ fn indexable(&self) -> uint {
+ self.iter.indexable()
+ }
+
+ #[inline]
+ fn idx(&mut self, index: uint) -> Option<A> {
+ let element = self.iter.idx(index);
+ self.do_inspect(element)
+ }
+}
+
+/// An iterator which just modifies the contained state throughout iteration.
+pub struct Unfold<'a, A, St> {
+ f: |&mut St|: 'a -> Option<A>,
+ /// Internal state that will be yielded on the next iteration
+ pub state: St,
+}
+
+impl<'a, A, St> Unfold<'a, A, St> {
+ /// Creates a new iterator with the specified closure as the "iterator
+ /// function" and an initial state to eventually pass to the iterator
+ #[inline]
+ pub fn new<'a>(initial_state: St, f: |&mut St|: 'a -> Option<A>)
+ -> Unfold<'a, A, St> {
+ Unfold {
+ f: f,
+ state: initial_state
+ }
+ }
+}
+
+impl<'a, A, St> Iterator<A> for Unfold<'a, A, St> {
+ #[inline]
+ fn next(&mut self) -> Option<A> {
+ (self.f)(&mut self.state)
+ }
+
+ #[inline]
+ fn size_hint(&self) -> (uint, Option<uint>) {
+ // no possible known bounds at this point
+ (0, None)
+ }
+}
+
+/// An infinite iterator starting at `start` and advancing by `step` with each
+/// iteration
+#[deriving(Clone)]
+pub struct Counter<A> {
+ /// The current state the counter is at (next value to be yielded)
+ state: A,
+ /// The amount that this iterator is stepping by
+ step: A,
+}
+
+/// Creates a new counter with the specified start/step
+#[inline]
+pub fn count<A>(start: A, step: A) -> Counter<A> {
+ Counter{state: start, step: step}
+}
+
+impl<A: Add<A, A> + Clone> Iterator<A> for Counter<A> {
+ #[inline]
+ fn next(&mut self) -> Option<A> {
+ let result = self.state.clone();
+ self.state = self.state + self.step;
+ Some(result)
+ }
+
+ #[inline]
+ fn size_hint(&self) -> (uint, Option<uint>) {
+ (uint::MAX, None) // Too bad we can't specify an infinite lower bound
+ }
+}
+
+/// An iterator over the range [start, stop)
+#[deriving(Clone)]
+pub struct Range<A> {
+ state: A,
+ stop: A,
+ one: A
+}
+
+/// Return an iterator over the range [start, stop)
+#[inline]
+pub fn range<A: Add<A, A> + Ord + Clone + One>(start: A, stop: A) -> Range<A> {
+ Range{state: start, stop: stop, one: One::one()}
+}
+
+// FIXME: #10414: Unfortunate type bound
+impl<A: Add<A, A> + Ord + Clone + ToPrimitive> Iterator<A> for Range<A> {
+ #[inline]
+ fn next(&mut self) -> Option<A> {
+ if self.state < self.stop {
+ let result = self.state.clone();
+ self.state = self.state + self.one;
+ Some(result)
+ } else {
+ None
+ }
+ }
+
+ #[inline]
+ fn size_hint(&self) -> (uint, Option<uint>) {
+ // This first checks if the elements are representable as i64. If they aren't, try u64 (to
+ // handle cases like range(huge, huger)). We don't use uint/int because the difference of
+ // the i64/u64 might lie within their range.
+ let bound = match self.state.to_i64() {
+ Some(a) => {
+ let sz = self.stop.to_i64().map(|b| b.checked_sub(&a));
+ match sz {
+ Some(Some(bound)) => bound.to_uint(),
+ _ => None,
+ }
+ },
+ None => match self.state.to_u64() {
+ Some(a) => {
+ let sz = self.stop.to_u64().map(|b| b.checked_sub(&a));
+ match sz {
+ Some(Some(bound)) => bound.to_uint(),
+ _ => None
+ }
+ },
+ None => None
+ }
+ };
+
+ match bound {
+ Some(b) => (b, Some(b)),
+ // Standard fallback for unbounded/unrepresentable bounds
+ None => (0, None)
+ }
+ }
+}
+
+/// `Int` is required to ensure the range will be the same regardless of
+/// the direction it is consumed.
+impl<A: Int + Ord + Clone + ToPrimitive> DoubleEndedIterator<A> for Range<A> {
+ #[inline]
+ fn next_back(&mut self) -> Option<A> {
+ if self.stop > self.state {
+ self.stop = self.stop - self.one;
+ Some(self.stop.clone())
+ } else {
+ None
+ }
+ }
+}
+
+/// An iterator over the range [start, stop]
+#[deriving(Clone)]
+pub struct RangeInclusive<A> {
+ range: Range<A>,
+ done: bool,
+}
+
+/// Return an iterator over the range [start, stop]
+#[inline]
+pub fn range_inclusive<A: Add<A, A> + Ord + Clone + One + ToPrimitive>(start: A, stop: A)
+ -> RangeInclusive<A> {
+ RangeInclusive{range: range(start, stop), done: false}
+}
+
+impl<A: Add<A, A> + Ord + Clone + ToPrimitive> Iterator<A> for RangeInclusive<A> {
+ #[inline]
+ fn next(&mut self) -> Option<A> {
+ match self.range.next() {
+ Some(x) => Some(x),
+ None => {
+ if !self.done && self.range.state == self.range.stop {
+ self.done = true;
+ Some(self.range.stop.clone())
+ } else {
+ None
+ }
+ }
+ }
+ }
+
+ #[inline]
+ fn size_hint(&self) -> (uint, Option<uint>) {
+ let (lo, hi) = self.range.size_hint();
+ if self.done {
+ (lo, hi)
+ } else {
+ let lo = lo.saturating_add(1);
+ let hi = match hi {
+ Some(x) => x.checked_add(&1),
+ None => None
+ };
+ (lo, hi)
+ }
+ }
+}
+
+impl<A: Sub<A, A> + Int + Ord + Clone + ToPrimitive> DoubleEndedIterator<A>
+ for RangeInclusive<A> {
+ #[inline]
+ fn next_back(&mut self) -> Option<A> {
+ if self.range.stop > self.range.state {
+ let result = self.range.stop.clone();
+ self.range.stop = self.range.stop - self.range.one;
+ Some(result)
+ } else if !self.done && self.range.state == self.range.stop {
+ self.done = true;
+ Some(self.range.stop.clone())
+ } else {
+ None
+ }
+ }
+}
+
+/// An iterator over the range [start, stop) by `step`. It handles overflow by stopping.
+#[deriving(Clone)]
+pub struct RangeStep<A> {
+ state: A,
+ stop: A,
+ step: A,
+ rev: bool,
+}
+
+/// Return an iterator over the range [start, stop) by `step`. It handles overflow by stopping.
+#[inline]
+pub fn range_step<A: CheckedAdd + Ord + Clone + Zero>(start: A, stop: A, step: A) -> RangeStep<A> {
+ let rev = step < Zero::zero();
+ RangeStep{state: start, stop: stop, step: step, rev: rev}
+}
+
+impl<A: CheckedAdd + Ord + Clone> Iterator<A> for RangeStep<A> {
+ #[inline]
+ fn next(&mut self) -> Option<A> {
+ if (self.rev && self.state > self.stop) || (!self.rev && self.state < self.stop) {
+ let result = self.state.clone();
+ match self.state.checked_add(&self.step) {
+ Some(x) => self.state = x,
+ None => self.state = self.stop.clone()
+ }
+ Some(result)
+ } else {
+ None
+ }
+ }
+}
+
+/// An iterator over the range [start, stop] by `step`. It handles overflow by stopping.
+#[deriving(Clone)]
+pub struct RangeStepInclusive<A> {
+ state: A,
+ stop: A,
+ step: A,
+ rev: bool,
+ done: bool,
+}
+
+/// Return an iterator over the range [start, stop] by `step`. It handles overflow by stopping.
+#[inline]
+pub fn range_step_inclusive<A: CheckedAdd + Ord + Clone + Zero>(start: A, stop: A,
+ step: A) -> RangeStepInclusive<A> {
+ let rev = step < Zero::zero();
+ RangeStepInclusive{state: start, stop: stop, step: step, rev: rev, done: false}
+}
+
+impl<A: CheckedAdd + Ord + Clone + Eq> Iterator<A> for RangeStepInclusive<A> {
+ #[inline]
+ fn next(&mut self) -> Option<A> {
+ if !self.done && ((self.rev && self.state >= self.stop) ||
+ (!self.rev && self.state <= self.stop)) {
+ let result = self.state.clone();
+ match self.state.checked_add(&self.step) {
+ Some(x) => self.state = x,
+ None => self.done = true
+ }
+ Some(result)
+ } else {
+ None
+ }
+ }
+}
+
+/// An iterator that repeats an element endlessly
+#[deriving(Clone)]
+pub struct Repeat<A> {
+ element: A
+}
+
+impl<A: Clone> Repeat<A> {
+ /// Create a new `Repeat` that endlessly repeats the element `elt`.
+ #[inline]
+ pub fn new(elt: A) -> Repeat<A> {
+ Repeat{element: elt}
+ }
+}
+
+impl<A: Clone> Iterator<A> for Repeat<A> {
+ #[inline]
+ fn next(&mut self) -> Option<A> { self.idx(0) }
+ #[inline]
+ fn size_hint(&self) -> (uint, Option<uint>) { (uint::MAX, None) }
+}
+
+impl<A: Clone> DoubleEndedIterator<A> for Repeat<A> {
+ #[inline]
+ fn next_back(&mut self) -> Option<A> { self.idx(0) }
+}
+
+impl<A: Clone> RandomAccessIterator<A> for Repeat<A> {
+ #[inline]
+ fn indexable(&self) -> uint { uint::MAX }
+ #[inline]
+ fn idx(&mut self, _: uint) -> Option<A> { Some(self.element.clone()) }
+}
+
+/// Functions for lexicographical ordering of sequences.
+///
+/// Lexicographical ordering through `<`, `<=`, `>=`, `>` requires
+/// that the elements implement both `Eq` and `Ord`.
+///
+/// If two sequences are equal up until the point where one ends,
+/// the shorter sequence compares less.
+pub mod order {
+ use cmp;
+ use cmp::{TotalEq, TotalOrd, Ord, Eq};
+ use option::{Some, None};
+ use super::Iterator;
+
+ /// Compare `a` and `b` for equality using `TotalEq`
+ pub fn equals<A: TotalEq, T: Iterator<A>>(mut a: T, mut b: T) -> bool {
+ loop {
+ match (a.next(), b.next()) {
+ (None, None) => return true,
+ (None, _) | (_, None) => return false,
+ (Some(x), Some(y)) => if x != y { return false },
+ }
+ }
+ }
+
+ /// Order `a` and `b` lexicographically using `TotalOrd`
+ pub fn cmp<A: TotalOrd, T: Iterator<A>>(mut a: T, mut b: T) -> cmp::Ordering {
+ loop {
+ match (a.next(), b.next()) {
+ (None, None) => return cmp::Equal,
+ (None, _ ) => return cmp::Less,
+ (_ , None) => return cmp::Greater,
+ (Some(x), Some(y)) => match x.cmp(&y) {
+ cmp::Equal => (),
+ non_eq => return non_eq,
+ },
+ }
+ }
+ }
+
+ /// Compare `a` and `b` for equality (Using partial equality, `Eq`)
+ pub fn eq<A: Eq, T: Iterator<A>>(mut a: T, mut b: T) -> bool {
+ loop {
+ match (a.next(), b.next()) {
+ (None, None) => return true,
+ (None, _) | (_, None) => return false,
+ (Some(x), Some(y)) => if !x.eq(&y) { return false },
+ }
+ }
+ }
+
+ /// Compare `a` and `b` for nonequality (Using partial equality, `Eq`)
+ pub fn ne<A: Eq, T: Iterator<A>>(mut a: T, mut b: T) -> bool {
+ loop {
+ match (a.next(), b.next()) {
+ (None, None) => return false,
+ (None, _) | (_, None) => return true,
+ (Some(x), Some(y)) => if x.ne(&y) { return true },
+ }
+ }
+ }
+
+ /// Return `a` < `b` lexicographically (Using partial order, `Ord`)
+ pub fn lt<A: Ord, T: Iterator<A>>(mut a: T, mut b: T) -> bool {
+ loop {
+ match (a.next(), b.next()) {
+ (None, None) => return false,
+ (None, _ ) => return true,
+ (_ , None) => return false,
+ (Some(x), Some(y)) => if x.ne(&y) { return x.lt(&y) },
+ }
+ }
+ }
+
+ /// Return `a` <= `b` lexicographically (Using partial order, `Ord`)
+ pub fn le<A: Ord, T: Iterator<A>>(mut a: T, mut b: T) -> bool {
+ loop {
+ match (a.next(), b.next()) {
+ (None, None) => return true,
+ (None, _ ) => return true,
+ (_ , None) => return false,
+ (Some(x), Some(y)) => if x.ne(&y) { return x.le(&y) },
+ }
+ }
+ }
+
+ /// Return `a` > `b` lexicographically (Using partial order, `Ord`)
+ pub fn gt<A: Ord, T: Iterator<A>>(mut a: T, mut b: T) -> bool {
+ loop {
+ match (a.next(), b.next()) {
+ (None, None) => return false,
+ (None, _ ) => return false,
+ (_ , None) => return true,
+ (Some(x), Some(y)) => if x.ne(&y) { return x.gt(&y) },
+ }
+ }
+ }
+
+ /// Return `a` >= `b` lexicographically (Using partial order, `Ord`)
+ pub fn ge<A: Ord, T: Iterator<A>>(mut a: T, mut b: T) -> bool {
+ loop {
+ match (a.next(), b.next()) {
+ (None, None) => return true,
+ (None, _ ) => return false,
+ (_ , None) => return true,
+ (Some(x), Some(y)) => if x.ne(&y) { return x.ge(&y) },
+ }
+ }
+ }
+
+ #[test]
+ fn test_lt() {
+ use slice::ImmutableVector;
+
+ let empty: [int, ..0] = [];
+ let xs = [1,2,3];
+ let ys = [1,2,0];
+
+ assert!(!lt(xs.iter(), ys.iter()));
+ assert!(!le(xs.iter(), ys.iter()));
+ assert!( gt(xs.iter(), ys.iter()));
+ assert!( ge(xs.iter(), ys.iter()));
+
+ assert!( lt(ys.iter(), xs.iter()));
+ assert!( le(ys.iter(), xs.iter()));
+ assert!(!gt(ys.iter(), xs.iter()));
+ assert!(!ge(ys.iter(), xs.iter()));
+
+ assert!( lt(empty.iter(), xs.iter()));
+ assert!( le(empty.iter(), xs.iter()));
+ assert!(!gt(empty.iter(), xs.iter()));
+ assert!(!ge(empty.iter(), xs.iter()));
+
+ // Sequence with NaN
+ let u = [1.0, 2.0];
+ let v = [0.0/0.0, 3.0];
+
+ assert!(!lt(u.iter(), v.iter()));
+ assert!(!le(u.iter(), v.iter()));
+ assert!(!gt(u.iter(), v.iter()));
+ assert!(!ge(u.iter(), v.iter()));
+
+ let a = [0.0/0.0];
+ let b = [1.0];
+ let c = [2.0];
+
+ assert!(lt(a.iter(), b.iter()) == (a[0] < b[0]));
+ assert!(le(a.iter(), b.iter()) == (a[0] <= b[0]));
+ assert!(gt(a.iter(), b.iter()) == (a[0] > b[0]));
+ assert!(ge(a.iter(), b.iter()) == (a[0] >= b[0]));
+
+ assert!(lt(c.iter(), b.iter()) == (c[0] < b[0]));
+ assert!(le(c.iter(), b.iter()) == (c[0] <= b[0]));
+ assert!(gt(c.iter(), b.iter()) == (c[0] > b[0]));
+ assert!(ge(c.iter(), b.iter()) == (c[0] >= b[0]));
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use realstd::prelude::*;
+ use realstd::iter::*;
+ use realstd::num;
+
+ use cmp;
+ use owned::Box;
+ use uint;
+
+ #[test]
+ fn test_counter_from_iter() {
+ let it = count(0, 5).take(10);
+ let xs: ~[int] = FromIterator::from_iter(it);
+ assert_eq!(xs, box [0, 5, 10, 15, 20, 25, 30, 35, 40, 45]);
+ }
+
+ #[test]
+ fn test_iterator_chain() {
+ let xs = [0u, 1, 2, 3, 4, 5];
+ let ys = [30u, 40, 50, 60];
+ let expected = [0, 1, 2, 3, 4, 5, 30, 40, 50, 60];
+ let mut it = xs.iter().chain(ys.iter());
+ let mut i = 0;
+ for &x in it {
+ assert_eq!(x, expected[i]);
+ i += 1;
+ }
+ assert_eq!(i, expected.len());
+
+ let ys = count(30u, 10).take(4);
+ let mut it = xs.iter().map(|&x| x).chain(ys);
+ let mut i = 0;
+ for x in it {
+ assert_eq!(x, expected[i]);
+ i += 1;
+ }
+ assert_eq!(i, expected.len());
+ }
+
+ #[test]
+ fn test_filter_map() {
+ let mut it = count(0u, 1u).take(10)
+ .filter_map(|x| if x % 2 == 0 { Some(x*x) } else { None });
+ assert_eq!(it.collect::<~[uint]>(), box [0*0, 2*2, 4*4, 6*6, 8*8]);
+ }
+
+ #[test]
+ fn test_iterator_enumerate() {
+ let xs = [0u, 1, 2, 3, 4, 5];
+ let mut it = xs.iter().enumerate();
+ for (i, &x) in it {
+ assert_eq!(i, x);
+ }
+ }
+
+ #[test]
+ fn test_iterator_peekable() {
+ let xs = box [0u, 1, 2, 3, 4, 5];
+ let mut it = xs.iter().map(|&x|x).peekable();
+ assert_eq!(it.peek().unwrap(), &0);
+ assert_eq!(it.next().unwrap(), 0);
+ assert_eq!(it.next().unwrap(), 1);
+ assert_eq!(it.next().unwrap(), 2);
+ assert_eq!(it.peek().unwrap(), &3);
+ assert_eq!(it.peek().unwrap(), &3);
+ assert_eq!(it.next().unwrap(), 3);
+ assert_eq!(it.next().unwrap(), 4);
+ assert_eq!(it.peek().unwrap(), &5);
+ assert_eq!(it.next().unwrap(), 5);
+ assert!(it.peek().is_none());
+ assert!(it.next().is_none());
+ }
+
+ #[test]
+ fn test_iterator_take_while() {
+ let xs = [0u, 1, 2, 3, 5, 13, 15, 16, 17, 19];
+ let ys = [0u, 1, 2, 3, 5, 13];
+ let mut it = xs.iter().take_while(|&x| *x < 15u);
+ let mut i = 0;
+ for &x in it {
+ assert_eq!(x, ys[i]);
+ i += 1;
+ }
+ assert_eq!(i, ys.len());
+ }
+
+ #[test]
+ fn test_iterator_skip_while() {
+ let xs = [0u, 1, 2, 3, 5, 13, 15, 16, 17, 19];
+ let ys = [15, 16, 17, 19];
+ let mut it = xs.iter().skip_while(|&x| *x < 15u);
+ let mut i = 0;
+ for &x in it {
+ assert_eq!(x, ys[i]);
+ i += 1;
+ }
+ assert_eq!(i, ys.len());
+ }
+
+ #[test]
+ fn test_iterator_skip() {
+ let xs = [0u, 1, 2, 3, 5, 13, 15, 16, 17, 19, 20, 30];
+ let ys = [13, 15, 16, 17, 19, 20, 30];
+ let mut it = xs.iter().skip(5);
+ let mut i = 0;
+ for &x in it {
+ assert_eq!(x, ys[i]);
+ i += 1;
+ }
+ assert_eq!(i, ys.len());
+ }
+
+ #[test]
+ fn test_iterator_take() {
+ let xs = [0u, 1, 2, 3, 5, 13, 15, 16, 17, 19];
+ let ys = [0u, 1, 2, 3, 5];
+ let mut it = xs.iter().take(5);
+ let mut i = 0;
+ for &x in it {
+ assert_eq!(x, ys[i]);
+ i += 1;
+ }
+ assert_eq!(i, ys.len());
+ }
+
+ #[test]
+ fn test_iterator_scan() {
+ // test the type inference
+ fn add(old: &mut int, new: &uint) -> Option<f64> {
+ *old += *new as int;
+ Some(*old as f64)
+ }
+ let xs = [0u, 1, 2, 3, 4];
+ let ys = [0f64, 1.0, 3.0, 6.0, 10.0];
+
+ let mut it = xs.iter().scan(0, add);
+ let mut i = 0;
+ for x in it {
+ assert_eq!(x, ys[i]);
+ i += 1;
+ }
+ assert_eq!(i, ys.len());
+ }
+
+ #[test]
+ fn test_iterator_flat_map() {
+ let xs = [0u, 3, 6];
+ let ys = [0u, 1, 2, 3, 4, 5, 6, 7, 8];
+ let mut it = xs.iter().flat_map(|&x| count(x, 1).take(3));
+ let mut i = 0;
+ for x in it {
+ assert_eq!(x, ys[i]);
+ i += 1;
+ }
+ assert_eq!(i, ys.len());
+ }
+
+ #[test]
+ fn test_inspect() {
+ let xs = [1u, 2, 3, 4];
+ let mut n = 0;
+
+ let ys = xs.iter()
+ .map(|&x| x)
+ .inspect(|_| n += 1)
+ .collect::<~[uint]>();
+
+ assert_eq!(n, xs.len());
+ assert_eq!(xs.as_slice(), ys.as_slice());
+ }
+
+ #[test]
+ fn test_unfoldr() {
+ fn count(st: &mut uint) -> Option<uint> {
+ if *st < 10 {
+ let ret = Some(*st);
+ *st += 1;
+ ret
+ } else {
+ None
+ }
+ }
+
+ let mut it = Unfold::new(0, count);
+ let mut i = 0;
+ for counted in it {
+ assert_eq!(counted, i);
+ i += 1;
+ }
+ assert_eq!(i, 10);
+ }
+
+ #[test]
+ fn test_cycle() {
+ let cycle_len = 3;
+ let it = count(0u, 1).take(cycle_len).cycle();
+ assert_eq!(it.size_hint(), (uint::MAX, None));
+ for (i, x) in it.take(100).enumerate() {
+ assert_eq!(i % cycle_len, x);
+ }
+
+ let mut it = count(0u, 1).take(0).cycle();
+ assert_eq!(it.size_hint(), (0, Some(0)));
+ assert_eq!(it.next(), None);
+ }
+
+ #[test]
+ fn test_iterator_nth() {
+ let v = &[0, 1, 2, 3, 4];
+ for i in range(0u, v.len()) {
+ assert_eq!(v.iter().nth(i).unwrap(), &v[i]);
+ }
+ }
+
+ #[test]
+ fn test_iterator_last() {
+ let v = &[0, 1, 2, 3, 4];
+ assert_eq!(v.iter().last().unwrap(), &4);
+ assert_eq!(v.slice(0, 1).iter().last().unwrap(), &0);
+ }
+
+ #[test]
+ fn test_iterator_len() {
+ let v = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
+ assert_eq!(v.slice(0, 4).iter().len(), 4);
+ assert_eq!(v.slice(0, 10).iter().len(), 10);
+ assert_eq!(v.slice(0, 0).iter().len(), 0);
+ }
+
+ #[test]
+ fn test_iterator_sum() {
+ let v = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
+ assert_eq!(v.slice(0, 4).iter().map(|&x| x).sum(), 6);
+ assert_eq!(v.iter().map(|&x| x).sum(), 55);
+ assert_eq!(v.slice(0, 0).iter().map(|&x| x).sum(), 0);
+ }
+
+ #[test]
+ fn test_iterator_product() {
+ let v = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
+ assert_eq!(v.slice(0, 4).iter().map(|&x| x).product(), 0);
+ assert_eq!(v.slice(1, 5).iter().map(|&x| x).product(), 24);
+ assert_eq!(v.slice(0, 0).iter().map(|&x| x).product(), 1);
+ }
+
+ #[test]
+ fn test_iterator_max() {
+ let v = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
+ assert_eq!(v.slice(0, 4).iter().map(|&x| x).max(), Some(3));
+ assert_eq!(v.iter().map(|&x| x).max(), Some(10));
+ assert_eq!(v.slice(0, 0).iter().map(|&x| x).max(), None);
+ }
+
+ #[test]
+ fn test_iterator_min() {
+ let v = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
+ assert_eq!(v.slice(0, 4).iter().map(|&x| x).min(), Some(0));
+ assert_eq!(v.iter().map(|&x| x).min(), Some(0));
+ assert_eq!(v.slice(0, 0).iter().map(|&x| x).min(), None);
+ }
+
+ #[test]
+ fn test_iterator_size_hint() {
+ let c = count(0, 1);
+ let v = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
+ let v2 = &[10, 11, 12];
+ let vi = v.iter();
+
+ assert_eq!(c.size_hint(), (uint::MAX, None));
+ assert_eq!(vi.size_hint(), (10, Some(10)));
+
+ assert_eq!(c.take(5).size_hint(), (5, Some(5)));
+ assert_eq!(c.skip(5).size_hint().val1(), None);
+ assert_eq!(c.take_while(|_| false).size_hint(), (0, None));
+ assert_eq!(c.skip_while(|_| false).size_hint(), (0, None));
+ assert_eq!(c.enumerate().size_hint(), (uint::MAX, None));
+ assert_eq!(c.chain(vi.map(|&i| i)).size_hint(), (uint::MAX, None));
+ assert_eq!(c.zip(vi).size_hint(), (10, Some(10)));
+ assert_eq!(c.scan(0, |_,_| Some(0)).size_hint(), (0, None));
+ assert_eq!(c.filter(|_| false).size_hint(), (0, None));
+ assert_eq!(c.map(|_| 0).size_hint(), (uint::MAX, None));
+ assert_eq!(c.filter_map(|_| Some(0)).size_hint(), (0, None));
+
+ assert_eq!(vi.take(5).size_hint(), (5, Some(5)));
+ assert_eq!(vi.take(12).size_hint(), (10, Some(10)));
+ assert_eq!(vi.skip(3).size_hint(), (7, Some(7)));
+ assert_eq!(vi.skip(12).size_hint(), (0, Some(0)));
+ assert_eq!(vi.take_while(|_| false).size_hint(), (0, Some(10)));
+ assert_eq!(vi.skip_while(|_| false).size_hint(), (0, Some(10)));
+ assert_eq!(vi.enumerate().size_hint(), (10, Some(10)));
+ assert_eq!(vi.chain(v2.iter()).size_hint(), (13, Some(13)));
+ assert_eq!(vi.zip(v2.iter()).size_hint(), (3, Some(3)));
+ assert_eq!(vi.scan(0, |_,_| Some(0)).size_hint(), (0, Some(10)));
+ assert_eq!(vi.filter(|_| false).size_hint(), (0, Some(10)));
+ assert_eq!(vi.map(|i| i+1).size_hint(), (10, Some(10)));
+ assert_eq!(vi.filter_map(|_| Some(0)).size_hint(), (0, Some(10)));
+ }
+
+ #[test]
+ fn test_collect() {
+ let a = box [1, 2, 3, 4, 5];
+ let b: ~[int] = a.iter().map(|&x| x).collect();
+ assert_eq!(a, b);
+ }
+
+ #[test]
+ fn test_all() {
+ let v: Box<&[int]> = box &[1, 2, 3, 4, 5];
+ assert!(v.iter().all(|&x| x < 10));
+ assert!(!v.iter().all(|&x| x % 2 == 0));
+ assert!(!v.iter().all(|&x| x > 100));
+ assert!(v.slice(0, 0).iter().all(|_| fail!()));
+ }
+
+ #[test]
+ fn test_any() {
+ let v: Box<&[int]> = box &[1, 2, 3, 4, 5];
+ assert!(v.iter().any(|&x| x < 10));
+ assert!(v.iter().any(|&x| x % 2 == 0));
+ assert!(!v.iter().any(|&x| x > 100));
+ assert!(!v.slice(0, 0).iter().any(|_| fail!()));
+ }
+
+ #[test]
+ fn test_find() {
+ let v: &[int] = &[1, 3, 9, 27, 103, 14, 11];
+ assert_eq!(*v.iter().find(|x| *x & 1 == 0).unwrap(), 14);
+ assert_eq!(*v.iter().find(|x| *x % 3 == 0).unwrap(), 3);
+ assert!(v.iter().find(|x| *x % 12 == 0).is_none());
+ }
+
+ #[test]
+ fn test_position() {
+ let v = &[1, 3, 9, 27, 103, 14, 11];
+ assert_eq!(v.iter().position(|x| *x & 1 == 0).unwrap(), 5);
+ assert_eq!(v.iter().position(|x| *x % 3 == 0).unwrap(), 1);
+ assert!(v.iter().position(|x| *x % 12 == 0).is_none());
+ }
+
+ #[test]
+ fn test_count() {
+ let xs = &[1, 2, 2, 1, 5, 9, 0, 2];
+ assert_eq!(xs.iter().count(|x| *x == 2), 3);
+ assert_eq!(xs.iter().count(|x| *x == 5), 1);
+ assert_eq!(xs.iter().count(|x| *x == 95), 0);
+ }
+
+ #[test]
+ fn test_max_by() {
+ let xs: &[int] = &[-3, 0, 1, 5, -10];
+ assert_eq!(*xs.iter().max_by(|x| x.abs()).unwrap(), -10);
+ }
+
+ #[test]
+ fn test_min_by() {
+ let xs: &[int] = &[-3, 0, 1, 5, -10];
+ assert_eq!(*xs.iter().min_by(|x| x.abs()).unwrap(), 0);
+ }
+
+ #[test]
+ fn test_by_ref() {
+ let mut xs = range(0, 10);
+ // sum the first five values
+ let partial_sum = xs.by_ref().take(5).fold(0, |a, b| a + b);
+ assert_eq!(partial_sum, 10);
+ assert_eq!(xs.next(), Some(5));
+ }
+
+ #[test]
+ fn test_rev() {
+ let xs = [2, 4, 6, 8, 10, 12, 14, 16];
+ let mut it = xs.iter();
+ it.next();
+ it.next();
+ assert_eq!(it.rev().map(|&x| x).collect::<~[int]>(), box [16, 14, 12, 10, 8, 6]);
+ }
+
+ #[test]
+ fn test_double_ended_map() {
+ let xs = [1, 2, 3, 4, 5, 6];
+ let mut it = xs.iter().map(|&x| x * -1);
+ assert_eq!(it.next(), Some(-1));
+ assert_eq!(it.next(), Some(-2));
+ assert_eq!(it.next_back(), Some(-6));
+ assert_eq!(it.next_back(), Some(-5));
+ assert_eq!(it.next(), Some(-3));
+ assert_eq!(it.next_back(), Some(-4));
+ assert_eq!(it.next(), None);
+ }
+
+ #[test]
+ fn test_double_ended_enumerate() {
+ let xs = [1, 2, 3, 4, 5, 6];
+ let mut it = xs.iter().map(|&x| x).enumerate();
+ assert_eq!(it.next(), Some((0, 1)));
+ assert_eq!(it.next(), Some((1, 2)));
+ assert_eq!(it.next_back(), Some((5, 6)));
+ assert_eq!(it.next_back(), Some((4, 5)));
+ assert_eq!(it.next_back(), Some((3, 4)));
+ assert_eq!(it.next_back(), Some((2, 3)));
+ assert_eq!(it.next(), None);
+ }
+
+ #[test]
+ fn test_double_ended_zip() {
+ let xs = [1, 2, 3, 4, 5, 6];
+ let ys = [1, 2, 3, 7];
+ let a = xs.iter().map(|&x| x);
+ let b = ys.iter().map(|&x| x);
+ let mut it = a.zip(b);
+ assert_eq!(it.next(), Some((1, 1)));
+ assert_eq!(it.next(), Some((2, 2)));
+ assert_eq!(it.next_back(), Some((4, 7)));
+ assert_eq!(it.next_back(), Some((3, 3)));
+ assert_eq!(it.next(), None);
+ }
+
+ #[test]
+ fn test_double_ended_filter() {
+ let xs = [1, 2, 3, 4, 5, 6];
+ let mut it = xs.iter().filter(|&x| *x & 1 == 0);
+ assert_eq!(it.next_back().unwrap(), &6);
+ assert_eq!(it.next_back().unwrap(), &4);
+ assert_eq!(it.next().unwrap(), &2);
+ assert_eq!(it.next_back(), None);
+ }
+
+ #[test]
+ fn test_double_ended_filter_map() {
+ let xs = [1, 2, 3, 4, 5, 6];
+ let mut it = xs.iter().filter_map(|&x| if x & 1 == 0 { Some(x * 2) } else { None });
+ assert_eq!(it.next_back().unwrap(), 12);
+ assert_eq!(it.next_back().unwrap(), 8);
+ assert_eq!(it.next().unwrap(), 4);
+ assert_eq!(it.next_back(), None);
+ }
+
+ #[test]
+ fn test_double_ended_chain() {
+ let xs = [1, 2, 3, 4, 5];
+ let ys = box [7, 9, 11];
+ let mut it = xs.iter().chain(ys.iter()).rev();
+ assert_eq!(it.next().unwrap(), &11)
+ assert_eq!(it.next().unwrap(), &9)
+ assert_eq!(it.next_back().unwrap(), &1)
+ assert_eq!(it.next_back().unwrap(), &2)
+ assert_eq!(it.next_back().unwrap(), &3)
+ assert_eq!(it.next_back().unwrap(), &4)
+ assert_eq!(it.next_back().unwrap(), &5)
+ assert_eq!(it.next_back().unwrap(), &7)
+ assert_eq!(it.next_back(), None)
+ }
+
+ #[test]
+ fn test_rposition() {
+ fn f(xy: &(int, char)) -> bool { let (_x, y) = *xy; y == 'b' }
+ fn g(xy: &(int, char)) -> bool { let (_x, y) = *xy; y == 'd' }
+ let v = box [(0, 'a'), (1, 'b'), (2, 'c'), (3, 'b')];
+
+ assert_eq!(v.iter().rposition(f), Some(3u));
+ assert!(v.iter().rposition(g).is_none());
+ }
+
+ #[test]
+ #[should_fail]
+ fn test_rposition_fail() {
+ let v = [(box 0, @0), (box 0, @0), (box 0, @0), (box 0, @0)];
+ let mut i = 0;
+ v.iter().rposition(|_elt| {
+ if i == 2 {
+ fail!()
+ }
+ i += 1;
+ false
+ });
+ }
+
+
+ #[cfg(test)]
+ fn check_randacc_iter<A: Eq, T: Clone + RandomAccessIterator<A>>(a: T, len: uint)
+ {
+ let mut b = a.clone();
+ assert_eq!(len, b.indexable());
+ let mut n = 0;
+ for (i, elt) in a.enumerate() {
+ assert!(Some(elt) == b.idx(i));
+ n += 1;
+ }
+ assert_eq!(n, len);
+ assert!(None == b.idx(n));
+ // call recursively to check after picking off an element
+ if len > 0 {
+ b.next();
+ check_randacc_iter(b, len-1);
+ }
+ }
+
+
+ #[test]
+ fn test_double_ended_flat_map() {
+ let u = [0u,1];
+ let v = [5,6,7,8];
+ let mut it = u.iter().flat_map(|x| v.slice(*x, v.len()).iter());
+ assert_eq!(it.next_back().unwrap(), &8);
+ assert_eq!(it.next().unwrap(), &5);
+ assert_eq!(it.next_back().unwrap(), &7);
+ assert_eq!(it.next_back().unwrap(), &6);
+ assert_eq!(it.next_back().unwrap(), &8);
+ assert_eq!(it.next().unwrap(), &6);
+ assert_eq!(it.next_back().unwrap(), &7);
+ assert_eq!(it.next_back(), None);
+ assert_eq!(it.next(), None);
+ assert_eq!(it.next_back(), None);
+ }
+
+ #[test]
+ fn test_random_access_chain() {
+ let xs = [1, 2, 3, 4, 5];
+ let ys = box [7, 9, 11];
+ let mut it = xs.iter().chain(ys.iter());
+ assert_eq!(it.idx(0).unwrap(), &1);
+ assert_eq!(it.idx(5).unwrap(), &7);
+ assert_eq!(it.idx(7).unwrap(), &11);
+ assert!(it.idx(8).is_none());
+
+ it.next();
+ it.next();
+ it.next_back();
+
+ assert_eq!(it.idx(0).unwrap(), &3);
+ assert_eq!(it.idx(4).unwrap(), &9);
+ assert!(it.idx(6).is_none());
+
+ check_randacc_iter(it, xs.len() + ys.len() - 3);
+ }
+
+ #[test]
+ fn test_random_access_enumerate() {
+ let xs = [1, 2, 3, 4, 5];
+ check_randacc_iter(xs.iter().enumerate(), xs.len());
+ }
+
+ #[test]
+ fn test_random_access_rev() {
+ let xs = [1, 2, 3, 4, 5];
+ check_randacc_iter(xs.iter().rev(), xs.len());
+ let mut it = xs.iter().rev();
+ it.next();
+ it.next_back();
+ it.next();
+ check_randacc_iter(it, xs.len() - 3);
+ }
+
+ #[test]
+ fn test_random_access_zip() {
+ let xs = [1, 2, 3, 4, 5];
+ let ys = [7, 9, 11];
+ check_randacc_iter(xs.iter().zip(ys.iter()), cmp::min(xs.len(), ys.len()));
+ }
+
+ #[test]
+ fn test_random_access_take() {
+ let xs = [1, 2, 3, 4, 5];
+ let empty: &[int] = [];
+ check_randacc_iter(xs.iter().take(3), 3);
+ check_randacc_iter(xs.iter().take(20), xs.len());
+ check_randacc_iter(xs.iter().take(0), 0);
+ check_randacc_iter(empty.iter().take(2), 0);
+ }
+
+ #[test]
+ fn test_random_access_skip() {
+ let xs = [1, 2, 3, 4, 5];
+ let empty: &[int] = [];
+ check_randacc_iter(xs.iter().skip(2), xs.len() - 2);
+ check_randacc_iter(empty.iter().skip(2), 0);
+ }
+
+ #[test]
+ fn test_random_access_inspect() {
+ let xs = [1, 2, 3, 4, 5];
+
+ // test .map and .inspect that don't implement Clone
+ let mut it = xs.iter().inspect(|_| {});
+ assert_eq!(xs.len(), it.indexable());
+ for (i, elt) in xs.iter().enumerate() {
+ assert_eq!(Some(elt), it.idx(i));
+ }
+
+ }
+
+ #[test]
+ fn test_random_access_map() {
+ let xs = [1, 2, 3, 4, 5];
+
+ let mut it = xs.iter().map(|x| *x);
+ assert_eq!(xs.len(), it.indexable());
+ for (i, elt) in xs.iter().enumerate() {
+ assert_eq!(Some(*elt), it.idx(i));
+ }
+ }
+
+ #[test]
+ fn test_random_access_cycle() {
+ let xs = [1, 2, 3, 4, 5];
+ let empty: &[int] = [];
+ check_randacc_iter(xs.iter().cycle().take(27), 27);
+ check_randacc_iter(empty.iter().cycle(), 0);
+ }
+
+ #[test]
+ fn test_double_ended_range() {
+ assert_eq!(range(11i, 14).rev().collect::<~[int]>(), box [13i, 12, 11]);
+ for _ in range(10i, 0).rev() {
+ fail!("unreachable");
+ }
+
+ assert_eq!(range(11u, 14).rev().collect::<~[uint]>(), box [13u, 12, 11]);
+ for _ in range(10u, 0).rev() {
+ fail!("unreachable");
+ }
+ }
+
+ #[test]
+ fn test_range() {
+ /// A mock type to check Range when ToPrimitive returns None
+ struct Foo;
+
+ impl ToPrimitive for Foo {
+ fn to_i64(&self) -> Option<i64> { None }
+ fn to_u64(&self) -> Option<u64> { None }
+ }
+
+ impl Add<Foo, Foo> for Foo {
+ fn add(&self, _: &Foo) -> Foo {
+ Foo
+ }
+ }
+
+ impl Eq for Foo {
+ fn eq(&self, _: &Foo) -> bool {
+ true
+ }
+ }
+
+ impl Ord for Foo {
+ fn lt(&self, _: &Foo) -> bool {
+ false
+ }
+ }
+
+ impl Clone for Foo {
+ fn clone(&self) -> Foo {
+ Foo
+ }
+ }
+
+ impl Mul<Foo, Foo> for Foo {
+ fn mul(&self, _: &Foo) -> Foo {
+ Foo
+ }
+ }
+
+ impl num::One for Foo {
+ fn one() -> Foo {
+ Foo
+ }
+ }
+
+ assert_eq!(range(0i, 5).collect::<~[int]>(), box [0i, 1, 2, 3, 4]);
+ assert_eq!(range(-10i, -1).collect::<~[int]>(), box [-10, -9, -8, -7, -6, -5, -4, -3, -2]);
+ assert_eq!(range(0i, 5).rev().collect::<~[int]>(), box [4, 3, 2, 1, 0]);
+ assert_eq!(range(200, -5).collect::<~[int]>(), box []);
+ assert_eq!(range(200, -5).rev().collect::<~[int]>(), box []);
+ assert_eq!(range(200, 200).collect::<~[int]>(), box []);
+ assert_eq!(range(200, 200).rev().collect::<~[int]>(), box []);
+
+ assert_eq!(range(0i, 100).size_hint(), (100, Some(100)));
+ // this test is only meaningful when sizeof uint < sizeof u64
+ assert_eq!(range(uint::MAX - 1, uint::MAX).size_hint(), (1, Some(1)));
+ assert_eq!(range(-10i, -1).size_hint(), (9, Some(9)));
+ assert_eq!(range(Foo, Foo).size_hint(), (0, None));
+ }
+
+ #[test]
+ fn test_range_inclusive() {
+ assert_eq!(range_inclusive(0i, 5).collect::<~[int]>(), box [0i, 1, 2, 3, 4, 5]);
+ assert_eq!(range_inclusive(0i, 5).rev().collect::<~[int]>(), box [5i, 4, 3, 2, 1, 0]);
+ assert_eq!(range_inclusive(200, -5).collect::<~[int]>(), box []);
+ assert_eq!(range_inclusive(200, -5).rev().collect::<~[int]>(), box []);
+ assert_eq!(range_inclusive(200, 200).collect::<~[int]>(), box [200]);
+ assert_eq!(range_inclusive(200, 200).rev().collect::<~[int]>(), box [200]);
+ }
+
+ #[test]
+ fn test_range_step() {
+ assert_eq!(range_step(0i, 20, 5).collect::<~[int]>(), box [0, 5, 10, 15]);
+ assert_eq!(range_step(20i, 0, -5).collect::<~[int]>(), box [20, 15, 10, 5]);
+ assert_eq!(range_step(20i, 0, -6).collect::<~[int]>(), box [20, 14, 8, 2]);
+ assert_eq!(range_step(200u8, 255, 50).collect::<~[u8]>(), box [200u8, 250]);
+ assert_eq!(range_step(200, -5, 1).collect::<~[int]>(), box []);
+ assert_eq!(range_step(200, 200, 1).collect::<~[int]>(), box []);
+ }
+
+ #[test]
+ fn test_range_step_inclusive() {
+ assert_eq!(range_step_inclusive(0i, 20, 5).collect::<~[int]>(), box [0, 5, 10, 15, 20]);
+ assert_eq!(range_step_inclusive(20i, 0, -5).collect::<~[int]>(), box [20, 15, 10, 5, 0]);
+ assert_eq!(range_step_inclusive(20i, 0, -6).collect::<~[int]>(), box [20, 14, 8, 2]);
+ assert_eq!(range_step_inclusive(200u8, 255, 50).collect::<~[u8]>(), box [200u8, 250]);
+ assert_eq!(range_step_inclusive(200, -5, 1).collect::<~[int]>(), box []);
+ assert_eq!(range_step_inclusive(200, 200, 1).collect::<~[int]>(), box [200]);
+ }
+
+ #[test]
+ fn test_reverse() {
+ let mut ys = [1, 2, 3, 4, 5];
+ ys.mut_iter().reverse_();
+ assert!(ys == [5, 4, 3, 2, 1]);
+ }
+
+ #[test]
+ fn test_peekable_is_empty() {
+ let a = [1];
+ let mut it = a.iter().peekable();
+ assert!( !it.is_empty() );
+ it.next();
+ assert!( it.is_empty() );
+ }
+
+ #[test]
+ fn test_min_max() {
+ let v: [int, ..0] = [];
+ assert_eq!(v.iter().min_max(), NoElements);
+
+ let v = [1i];
+ assert!(v.iter().min_max() == OneElement(&1));
+
+ let v = [1i, 2, 3, 4, 5];
+ assert!(v.iter().min_max() == MinMax(&1, &5));
+
+ let v = [1i, 2, 3, 4, 5, 6];
+ assert!(v.iter().min_max() == MinMax(&1, &6));
+
+ let v = [1i, 1, 1, 1];
+ assert!(v.iter().min_max() == MinMax(&1, &1));
+ }
+
+ #[test]
+ fn test_MinMaxResult() {
+ let r: MinMaxResult<int> = NoElements;
+ assert_eq!(r.into_option(), None)
+
+ let r = OneElement(1);
+ assert_eq!(r.into_option(), Some((1,1)));
+
+ let r = MinMax(1,2);
+ assert_eq!(r.into_option(), Some((1,2)));
+ }
+}
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+/*!
+Primitive traits representing basic 'kinds' of types
+
+Rust types can be classified in various useful ways according to
+intrinsic properties of the type. These classifications, often called
+'kinds', are represented as traits.
+
+They cannot be implemented by user code, but are instead implemented
+by the compiler automatically for the types to which they apply.
+
+*/
+
+/// Types able to be transferred across task boundaries.
+#[lang="send"]
+pub trait Send {
+ // empty.
+}
+
+/// Types with a constant size known at compile-time.
+#[lang="sized"]
+pub trait Sized {
+ // Empty.
+}
+
+/// Types that can be copied by simply copying bits (i.e. `memcpy`).
+#[lang="copy"]
+pub trait Copy {
+ // Empty.
+}
+
+/// Types that can be safely shared between tasks when aliased.
+///
+/// The precise definition is: a type `T` is `Share` if `&T` is
+/// thread-safe. In other words, there is no possibility of data races
+/// when passing `&T` references between tasks.
+///
+/// As one would expect, primitive types like `u8` and `f64` are all
+/// `Share`, and so are simple aggregate types containing them (like
+/// tuples, structs and enums). More instances of basic `Share` types
+/// include "immutable" types like `&T` and those with simple
+/// inherited mutability, such as `Box<T>`, `Vec<T>` and most other
+/// collection types. (Generic parameters need to be `Share` for their
+/// container to be `Share`.)
+///
+/// A somewhat surprising consequence of the definition is `&mut T` is
+/// `Share` (if `T` is `Share`) even though it seems that it might
+/// provide unsynchronised mutation. The trick is a mutable reference
+/// stored in an aliasable reference (that is, `& &mut T`) becomes
+/// read-only, as if it were a `& &T`, hence there is no risk of a data
+/// race.
+///
+/// Types that are not `Share` are those that have "interior
+/// mutability" in a non-thread-safe way, such as `Cell` and `RefCell`
+/// in `std::cell`. These types allow for mutation of their contents
+/// even when in an immutable, aliasable slot, e.g. the contents of
+/// `&Cell<T>` can be `.set`, and do not ensure data races are
+/// impossible, hence they cannot be `Share`. A higher level example
+/// of a non-`Share` type is the reference counted pointer
+/// `std::rc::Rc`, because any reference `&Rc<T>` can clone a new
+/// reference, which modifies the reference counts in a non-atomic
+/// way.
+///
+/// For cases when one does need thread-safe interior mutability,
+/// types like the atomics in `std::sync` and `Mutex` & `RWLock` in
+/// the `sync` crate do ensure that any mutation cannot cause data
+/// races. Hence these types are `Share`.
+///
+/// Users writing their own types with interior mutability (or anything
+/// else that is not thread-safe) should use the `NoShare` marker type
+/// (from `std::kinds::marker`) to ensure that the compiler doesn't
+/// consider the user-defined type to be `Share`. Any types with
+/// interior mutability must also use the `std::ty::Unsafe` wrapper
+/// around the value(s) which can be mutated when behind a `&`
+/// reference; not doing this is undefined behaviour (for example,
+/// `transmute`-ing from `&T` to `&mut T` is illegal).
+#[lang="share"]
+pub trait Share {
+ // Empty
+}
+
+/// Marker types are special types that are used with unsafe code to
+/// inform the compiler of special constraints. Marker types should
+/// only be needed when you are creating an abstraction that is
+/// implemented using unsafe code. In that case, you may want to embed
+/// some of the marker types below into your type.
+pub mod marker {
+
+ /// A marker type whose type parameter `T` is considered to be
+ /// covariant with respect to the type itself. This is (typically)
+ /// used to indicate that an instance of the type `T` is being stored
+ /// into memory and read from, even though that may not be apparent.
+ ///
+ /// For more information about variance, refer to this Wikipedia
+ /// article <http://en.wikipedia.org/wiki/Variance_%28computer_science%29>.
+ ///
+ /// *Note:* It is very unusual to have to add a covariant constraint.
+ /// If you are not sure, you probably want to use `InvariantType`.
+ ///
+ /// # Example
+ ///
+ /// Given a struct `S` that includes a type parameter `T`
+ /// but does not actually *reference* that type parameter:
+ ///
+ /// ```ignore
+ /// use std::cast;
+ ///
+ /// struct S<T> { x: *() }
+ /// fn get<T>(s: &S<T>) -> T {
+ /// unsafe {
+ /// let x: *T = cast::transmute(s.x);
+ /// *x
+ /// }
+ /// }
+ /// ```
+ ///
+ /// The type system would currently infer that the value of
+ /// the type parameter `T` is irrelevant, and hence a `S<int>` is
+ /// a subtype of `S<~[int]>` (or, for that matter, `S<U>` for
+ /// any `U`). But this is incorrect because `get()` converts the
+ /// `*()` into a `*T` and reads from it. Therefore, we should include the
+ /// a marker field `CovariantType<T>` to inform the type checker that
+ /// `S<T>` is a subtype of `S<U>` if `T` is a subtype of `U`
+ /// (for example, `S<&'static int>` is a subtype of `S<&'a int>`
+ /// for some lifetime `'a`, but not the other way around).
+ #[lang="covariant_type"]
+ #[deriving(Eq,Clone)]
+ pub struct CovariantType<T>;
+
+ /// A marker type whose type parameter `T` is considered to be
+ /// contravariant with respect to the type itself. This is (typically)
+ /// used to indicate that an instance of the type `T` will be consumed
+ /// (but not read from), even though that may not be apparent.
+ ///
+ /// For more information about variance, refer to this Wikipedia
+ /// article <http://en.wikipedia.org/wiki/Variance_%28computer_science%29>.
+ ///
+ /// *Note:* It is very unusual to have to add a contravariant constraint.
+ /// If you are not sure, you probably want to use `InvariantType`.
+ ///
+ /// # Example
+ ///
+ /// Given a struct `S` that includes a type parameter `T`
+ /// but does not actually *reference* that type parameter:
+ ///
+ /// ```
+ /// use std::cast;
+ ///
+ /// struct S<T> { x: *() }
+ /// fn get<T>(s: &S<T>, v: T) {
+ /// unsafe {
+ /// let x: fn(T) = cast::transmute(s.x);
+ /// x(v)
+ /// }
+ /// }
+ /// ```
+ ///
+ /// The type system would currently infer that the value of
+ /// the type parameter `T` is irrelevant, and hence a `S<int>` is
+ /// a subtype of `S<~[int]>` (or, for that matter, `S<U>` for
+ /// any `U`). But this is incorrect because `get()` converts the
+ /// `*()` into a `fn(T)` and then passes a value of type `T` to it.
+ ///
+ /// Supplying a `ContravariantType` marker would correct the
+ /// problem, because it would mark `S` so that `S<T>` is only a
+ /// subtype of `S<U>` if `U` is a subtype of `T`; given that the
+ /// function requires arguments of type `T`, it must also accept
+ /// arguments of type `U`, hence such a conversion is safe.
+ #[lang="contravariant_type"]
+ #[deriving(Eq,Clone)]
+ pub struct ContravariantType<T>;
+
+ /// A marker type whose type parameter `T` is considered to be
+ /// invariant with respect to the type itself. This is (typically)
+ /// used to indicate that instances of the type `T` may be read or
+ /// written, even though that may not be apparent.
+ ///
+ /// For more information about variance, refer to this Wikipedia
+ /// article <http://en.wikipedia.org/wiki/Variance_%28computer_science%29>.
+ ///
+ /// # Example
+ ///
+ /// The Cell type is an example which uses unsafe code to achieve
+ /// "interior" mutability:
+ ///
+ /// ```
+ /// pub struct Cell<T> { value: T }
+ /// # fn main() {}
+ /// ```
+ ///
+ /// The type system would infer that `value` is only read here and
+ /// never written, but in fact `Cell` uses unsafe code to achieve
+ /// interior mutability.
+ #[lang="invariant_type"]
+ #[deriving(Eq,Clone)]
+ pub struct InvariantType<T>;
+
+ /// As `CovariantType`, but for lifetime parameters. Using
+ /// `CovariantLifetime<'a>` indicates that it is ok to substitute
+ /// a *longer* lifetime for `'a` than the one you originally
+ /// started with (e.g., you could convert any lifetime `'foo` to
+ /// `'static`). You almost certainly want `ContravariantLifetime`
+ /// instead, or possibly `InvariantLifetime`. The only case where
+ /// it would be appropriate is that you have a (type-casted, and
+ /// hence hidden from the type system) function pointer with a
+ /// signature like `fn(&'a T)` (and no other uses of `'a`). In
+ /// this case, it is ok to substitute a larger lifetime for `'a`
+ /// (e.g., `fn(&'static T)`), because the function is only
+ /// becoming more selective in terms of what it accepts as
+ /// argument.
+ ///
+ /// For more information about variance, refer to this Wikipedia
+ /// article <http://en.wikipedia.org/wiki/Variance_%28computer_science%29>.
+ #[lang="covariant_lifetime"]
+ #[deriving(Eq,Clone)]
+ pub struct CovariantLifetime<'a>;
+
+ /// As `ContravariantType`, but for lifetime parameters. Using
+ /// `ContravariantLifetime<'a>` indicates that it is ok to
+ /// substitute a *shorter* lifetime for `'a` than the one you
+ /// originally started with (e.g., you could convert `'static` to
+ /// any lifetime `'foo`). This is appropriate for cases where you
+ /// have an unsafe pointer that is actually a pointer into some
+ /// memory with lifetime `'a`, and thus you want to limit the
+ /// lifetime of your data structure to `'a`. An example of where
+ /// this is used is the iterator for vectors.
+ ///
+ /// For more information about variance, refer to this Wikipedia
+ /// article <http://en.wikipedia.org/wiki/Variance_%28computer_science%29>.
+ #[lang="contravariant_lifetime"]
+ #[deriving(Eq,Clone)]
+ pub struct ContravariantLifetime<'a>;
+
+ /// As `InvariantType`, but for lifetime parameters. Using
+ /// `InvariantLifetime<'a>` indicates that it is not ok to
+ /// substitute any other lifetime for `'a` besides its original
+ /// value. This is appropriate for cases where you have an unsafe
+ /// pointer that is actually a pointer into memory with lifetime `'a`,
+ /// and this pointer is itself stored in an inherently mutable
+ /// location (such as a `Cell`).
+ #[lang="invariant_lifetime"]
+ #[deriving(Eq,Clone)]
+ pub struct InvariantLifetime<'a>;
+
+ /// A type which is considered "not sendable", meaning that it cannot
+ /// be safely sent between tasks, even if it is owned. This is
+ /// typically embedded in other types, such as `Gc`, to ensure that
+ /// their instances remain thread-local.
+ #[lang="no_send_bound"]
+ #[deriving(Eq,Clone)]
+ pub struct NoSend;
+
+ /// A type which is considered "not POD", meaning that it is not
+ /// implicitly copyable. This is typically embedded in other types to
+ /// ensure that they are never copied, even if they lack a destructor.
+ #[lang="no_copy_bound"]
+ #[deriving(Eq,Clone)]
+ pub struct NoCopy;
+
+ /// A type which is considered "not sharable", meaning that
+ /// its contents are not threadsafe, hence they cannot be
+ /// shared between tasks.
+ #[lang="no_share_bound"]
+ #[deriving(Eq,Clone)]
+ pub struct NoShare;
+
+ /// A type which is considered managed by the GC. This is typically
+ /// embedded in other types.
+ #[lang="managed_bound"]
+ #[deriving(Eq,Clone)]
+ pub struct Managed;
+}
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! The Rust core library
+
+#![crate_id = "core#0.11-pre"]
+#![license = "MIT/ASL2"]
+#![crate_type = "rlib"]
+#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
+ html_favicon_url = "http://www.rust-lang.org/favicon.ico",
+ html_root_url = "http://static.rust-lang.org/doc/master")]
+
+#![no_std]
+#![feature(globs, macro_rules, managed_boxes, phase)]
+#![deny(missing_doc)]
+
+#[cfg(test)] extern crate realcore = "core";
+#[cfg(test)] extern crate libc;
+#[cfg(test)] extern crate native;
+#[phase(syntax, link)] #[cfg(test)] extern crate realstd = "std";
+#[phase(syntax, link)] #[cfg(test)] extern crate log;
+
+#[cfg(test)] pub use cmp = realcore::cmp;
+#[cfg(test)] pub use kinds = realcore::kinds;
+#[cfg(test)] pub use ops = realcore::ops;
+#[cfg(test)] pub use owned = realcore::owned;
+#[cfg(test)] pub use ty = realcore::ty;
+
+#[cfg(not(test))]
+mod macros;
+
+#[path = "num/float_macros.rs"] mod float_macros;
+#[path = "num/int_macros.rs"] mod int_macros;
+#[path = "num/uint_macros.rs"] mod uint_macros;
+
+#[path = "num/int.rs"] pub mod int;
+#[path = "num/i8.rs"] pub mod i8;
+#[path = "num/i16.rs"] pub mod i16;
+#[path = "num/i32.rs"] pub mod i32;
+#[path = "num/i64.rs"] pub mod i64;
+
+#[path = "num/uint.rs"] pub mod uint;
+#[path = "num/u8.rs"] pub mod u8;
+#[path = "num/u16.rs"] pub mod u16;
+#[path = "num/u32.rs"] pub mod u32;
+#[path = "num/u64.rs"] pub mod u64;
+
+#[path = "num/f32.rs"] pub mod f32;
+#[path = "num/f64.rs"] pub mod f64;
+
+pub mod num;
+
+/* The libcore prelude, not as all-encompassing as the libstd prelude */
+
+pub mod prelude;
+
+/* Core modules for ownership management */
+
+pub mod cast;
+pub mod intrinsics;
+pub mod mem;
+pub mod ptr;
+
+/* Core language traits */
+
+#[cfg(not(test))] pub mod kinds;
+#[cfg(not(test))] pub mod ops;
+#[cfg(not(test))] pub mod ty;
+#[cfg(not(test))] pub mod cmp;
+#[cfg(not(test))] pub mod owned;
+pub mod clone;
+pub mod default;
+pub mod container;
+
+/* Core types and methods on primitives */
+
+mod unicode;
+mod unit;
+pub mod any;
+pub mod bool;
+pub mod cell;
+pub mod char;
+pub mod finally;
+pub mod iter;
+pub mod option;
+pub mod raw;
+pub mod result;
+pub mod slice;
+pub mod str;
+pub mod tuple;
+
+mod failure;
+
+// FIXME: this module should not exist. Once owned allocations are no longer a
+// language type, this module can move outside to the owned allocation
+// crate.
+mod should_not_exist;
+
+mod std {
+ pub use clone;
+ pub use cmp;
+
+ #[cfg(test)] pub use realstd::fmt; // needed for fail!()
+ #[cfg(test)] pub use realstd::rt; // needed for fail!()
+ #[cfg(test)] pub use realstd::option; // needed for assert!()
+ #[cfg(test)] pub use realstd::os; // needed for tests
+}
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![macro_escape]
+
+/// Entry point of failure, for details, see std::macros
+#[macro_export]
+macro_rules! fail(
+ () => (
+ fail!("explicit failure")
+ );
+ ($msg:expr) => (
+ ::failure::begin_unwind($msg, file!(), line!())
+ );
+)
+
+/// Runtime assertion, for details see std::macros
+#[macro_export]
+macro_rules! assert(
+ ($cond:expr) => (
+ if !$cond {
+ fail!(concat!("assertion failed: ", stringify!($cond)))
+ }
+ );
+)
+
+/// Runtime assertion, disableable at compile time
+#[macro_export]
+macro_rules! debug_assert(
+ ($($arg:tt)*) => (if cfg!(not(ndebug)) { assert!($($arg)*); })
+)
--- /dev/null
+// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Basic functions for dealing with memory
+//!
+//! This module contains functions for querying the size and alignment of
+//! types, initializing and manipulating memory.
+
+use cast;
+use ptr;
+use intrinsics;
+use intrinsics::{bswap16, bswap32, bswap64};
+
+/// Returns the size of a type in bytes.
+#[inline]
+pub fn size_of<T>() -> uint {
+ unsafe { intrinsics::size_of::<T>() }
+}
+
+/// Returns the size of the type that `_val` points to in bytes.
+#[inline]
+pub fn size_of_val<T>(_val: &T) -> uint {
+ size_of::<T>()
+}
+
+/// Returns the size of a type in bytes, or 1 if the actual size is zero.
+///
+/// Useful for building structures containing variable-length arrays.
+#[inline]
+pub fn nonzero_size_of<T>() -> uint {
+ match size_of::<T>() {
+ 0 => 1,
+ x => x
+ }
+}
+
+/// Returns the size in bytes of the type of the value that `_val` points to.
+#[inline]
+pub fn nonzero_size_of_val<T>(_val: &T) -> uint {
+ nonzero_size_of::<T>()
+}
+
+/// Returns the ABI-required minimum alignment of a type
+///
+/// This is the alignment used for struct fields. It may be smaller
+/// than the preferred alignment.
+#[inline]
+pub fn min_align_of<T>() -> uint {
+ unsafe { intrinsics::min_align_of::<T>() }
+}
+
+/// Returns the ABI-required minimum alignment of the type of the value that
+/// `_val` points to
+#[inline]
+pub fn min_align_of_val<T>(_val: &T) -> uint {
+ min_align_of::<T>()
+}
+
+/// Returns the preferred alignment of a type
+#[inline]
+pub fn pref_align_of<T>() -> uint {
+ unsafe { intrinsics::pref_align_of::<T>() }
+}
+
+/// Returns the preferred alignment of the type of the value that
+/// `_val` points to
+#[inline]
+pub fn pref_align_of_val<T>(_val: &T) -> uint {
+ pref_align_of::<T>()
+}
+
+/// Create a value initialized to zero.
+///
+/// `init` is unsafe because it returns a zeroed-out datum,
+/// which is unsafe unless T is Copy.
+#[inline]
+pub unsafe fn init<T>() -> T {
+ intrinsics::init()
+}
+
+/// Create an uninitialized value.
+#[inline]
+pub unsafe fn uninit<T>() -> T {
+ intrinsics::uninit()
+}
+
+/// Move a value to an uninitialized memory location.
+///
+/// Drop glue is not run on the destination.
+#[inline]
+pub unsafe fn move_val_init<T>(dst: &mut T, src: T) {
+ intrinsics::move_val_init(dst, src)
+}
+
+/// Convert an u16 to little endian from the target's endianness.
+///
+/// On little endian, this is a no-op. On big endian, the bytes are swapped.
+#[cfg(target_endian = "little")] #[inline] pub fn to_le16(x: u16) -> u16 { x }
+
+/// Convert an u16 to little endian from the target's endianness.
+///
+/// On little endian, this is a no-op. On big endian, the bytes are swapped.
+#[cfg(target_endian = "big")] #[inline] pub fn to_le16(x: u16) -> u16 { unsafe { bswap16(x) } }
+
+/// Convert an u32 to little endian from the target's endianness.
+///
+/// On little endian, this is a no-op. On big endian, the bytes are swapped.
+#[cfg(target_endian = "little")] #[inline] pub fn to_le32(x: u32) -> u32 { x }
+
+/// Convert an u32 to little endian from the target's endianness.
+///
+/// On little endian, this is a no-op. On big endian, the bytes are swapped.
+#[cfg(target_endian = "big")] #[inline] pub fn to_le32(x: u32) -> u32 { unsafe { bswap32(x) } }
+
+/// Convert an u64 to little endian from the target's endianness.
+///
+/// On little endian, this is a no-op. On big endian, the bytes are swapped.
+#[cfg(target_endian = "little")] #[inline] pub fn to_le64(x: u64) -> u64 { x }
+
+/// Convert an u64 to little endian from the target's endianness.
+///
+/// On little endian, this is a no-op. On big endian, the bytes are swapped.
+#[cfg(target_endian = "big")] #[inline] pub fn to_le64(x: u64) -> u64 { unsafe { bswap64(x) } }
+
+
+/// Convert an u16 to big endian from the target's endianness.
+///
+/// On big endian, this is a no-op. On little endian, the bytes are swapped.
+#[cfg(target_endian = "little")] #[inline] pub fn to_be16(x: u16) -> u16 { unsafe { bswap16(x) } }
+
+/// Convert an u16 to big endian from the target's endianness.
+///
+/// On big endian, this is a no-op. On little endian, the bytes are swapped.
+#[cfg(target_endian = "big")] #[inline] pub fn to_be16(x: u16) -> u16 { x }
+
+/// Convert an u32 to big endian from the target's endianness.
+///
+/// On big endian, this is a no-op. On little endian, the bytes are swapped.
+#[cfg(target_endian = "little")] #[inline] pub fn to_be32(x: u32) -> u32 { unsafe { bswap32(x) } }
+
+/// Convert an u32 to big endian from the target's endianness.
+///
+/// On big endian, this is a no-op. On little endian, the bytes are swapped.
+#[cfg(target_endian = "big")] #[inline] pub fn to_be32(x: u32) -> u32 { x }
+
+/// Convert an u64 to big endian from the target's endianness.
+///
+/// On big endian, this is a no-op. On little endian, the bytes are swapped.
+#[cfg(target_endian = "little")] #[inline] pub fn to_be64(x: u64) -> u64 { unsafe { bswap64(x) } }
+
+/// Convert an u64 to big endian from the target's endianness.
+///
+/// On big endian, this is a no-op. On little endian, the bytes are swapped.
+#[cfg(target_endian = "big")] #[inline] pub fn to_be64(x: u64) -> u64 { x }
+
+
+/// Convert an u16 from little endian to the target's endianness.
+///
+/// On little endian, this is a no-op. On big endian, the bytes are swapped.
+#[cfg(target_endian = "little")] #[inline] pub fn from_le16(x: u16) -> u16 { x }
+
+/// Convert an u16 from little endian to the target's endianness.
+///
+/// On little endian, this is a no-op. On big endian, the bytes are swapped.
+#[cfg(target_endian = "big")] #[inline] pub fn from_le16(x: u16) -> u16 { unsafe { bswap16(x) } }
+
+/// Convert an u32 from little endian to the target's endianness.
+///
+/// On little endian, this is a no-op. On big endian, the bytes are swapped.
+#[cfg(target_endian = "little")] #[inline] pub fn from_le32(x: u32) -> u32 { x }
+
+/// Convert an u32 from little endian to the target's endianness.
+///
+/// On little endian, this is a no-op. On big endian, the bytes are swapped.
+#[cfg(target_endian = "big")] #[inline] pub fn from_le32(x: u32) -> u32 { unsafe { bswap32(x) } }
+
+/// Convert an u64 from little endian to the target's endianness.
+///
+/// On little endian, this is a no-op. On big endian, the bytes are swapped.
+#[cfg(target_endian = "little")] #[inline] pub fn from_le64(x: u64) -> u64 { x }
+
+/// Convert an u64 from little endian to the target's endianness.
+///
+/// On little endian, this is a no-op. On big endian, the bytes are swapped.
+#[cfg(target_endian = "big")] #[inline] pub fn from_le64(x: u64) -> u64 { unsafe { bswap64(x) } }
+
+
+/// Convert an u16 from big endian to the target's endianness.
+///
+/// On big endian, this is a no-op. On little endian, the bytes are swapped.
+#[cfg(target_endian = "little")] #[inline] pub fn from_be16(x: u16) -> u16 { unsafe { bswap16(x) } }
+
+/// Convert an u16 from big endian to the target's endianness.
+///
+/// On big endian, this is a no-op. On little endian, the bytes are swapped.
+#[cfg(target_endian = "big")] #[inline] pub fn from_be16(x: u16) -> u16 { x }
+
+/// Convert an u32 from big endian to the target's endianness.
+///
+/// On big endian, this is a no-op. On little endian, the bytes are swapped.
+#[cfg(target_endian = "little")] #[inline] pub fn from_be32(x: u32) -> u32 { unsafe { bswap32(x) } }
+
+/// Convert an u32 from big endian to the target's endianness.
+///
+/// On big endian, this is a no-op. On little endian, the bytes are swapped.
+#[cfg(target_endian = "big")] #[inline] pub fn from_be32(x: u32) -> u32 { x }
+
+/// Convert an u64 from big endian to the target's endianness.
+///
+/// On big endian, this is a no-op. On little endian, the bytes are swapped.
+#[cfg(target_endian = "little")] #[inline] pub fn from_be64(x: u64) -> u64 { unsafe { bswap64(x) } }
+
+/// Convert an u64 from big endian to the target's endianness.
+///
+/// On big endian, this is a no-op. On little endian, the bytes are swapped.
+#[cfg(target_endian = "big")] #[inline] pub fn from_be64(x: u64) -> u64 { x }
+
+/**
+ * Swap the values at two mutable locations of the same type, without
+ * deinitialising or copying either one.
+ */
+#[inline]
+pub fn swap<T>(x: &mut T, y: &mut T) {
+ unsafe {
+ // Give ourselves some scratch space to work with
+ let mut t: T = uninit();
+
+ // Perform the swap, `&mut` pointers never alias
+ ptr::copy_nonoverlapping_memory(&mut t, &*x, 1);
+ ptr::copy_nonoverlapping_memory(x, &*y, 1);
+ ptr::copy_nonoverlapping_memory(y, &t, 1);
+
+ // y and t now point to the same thing, but we need to completely forget `t`
+ // because it's no longer relevant.
+ cast::forget(t);
+ }
+}
+
+/**
+ * Replace the value at a mutable location with a new one, returning the old
+ * value, without deinitialising or copying either one.
+ *
+ * This is primarily used for transferring and swapping ownership of a value
+ * in a mutable location. For example, this function allows consumption of
+ * one field of a struct by replacing it with another value. The normal approach
+ * doesn't always work:
+ *
+ * ```rust,ignore
+ * struct Buffer<T> { buf: Vec<T> }
+ *
+ * impl<T> Buffer<T> {
+ * fn get_and_reset(&mut self) -> Vec<T> {
+ * // error: cannot move out of dereference of `&mut`-pointer
+ * let buf = self.buf;
+ * self.buf = Vec::new();
+ * buf
+ * }
+ * }
+ * ```
+ *
+ * Note that `T` does not necessarily implement `Clone`, so it can't even
+ * clone and reset `self.buf`. But `replace` can be used to disassociate
+ * the original value of `self.buf` from `self`, allowing it to be returned:
+ *
+ * ```rust
+ * # struct Buffer<T> { buf: Vec<T> }
+ * impl<T> Buffer<T> {
+ * fn get_and_reset(&mut self) -> Vec<T> {
+ * use std::mem::replace;
+ * replace(&mut self.buf, Vec::new())
+ * }
+ * }
+ * ```
+ */
+#[inline]
+pub fn replace<T>(dest: &mut T, mut src: T) -> T {
+ swap(dest, &mut src);
+ src
+}
+
+/// Disposes of a value.
+#[inline]
+pub fn drop<T>(_x: T) { }
+
+#[cfg(test)]
+mod tests {
+ use mem::*;
+ use option::{Some,None};
+ use realstd::str::StrAllocating;
+
+ #[test]
+ fn size_of_basic() {
+ assert_eq!(size_of::<u8>(), 1u);
+ assert_eq!(size_of::<u16>(), 2u);
+ assert_eq!(size_of::<u32>(), 4u);
+ assert_eq!(size_of::<u64>(), 8u);
+ }
+
+ #[test]
+ #[cfg(target_arch = "x86")]
+ #[cfg(target_arch = "arm")]
+ #[cfg(target_arch = "mips")]
+ fn size_of_32() {
+ assert_eq!(size_of::<uint>(), 4u);
+ assert_eq!(size_of::<*uint>(), 4u);
+ }
+
+ #[test]
+ #[cfg(target_arch = "x86_64")]
+ fn size_of_64() {
+ assert_eq!(size_of::<uint>(), 8u);
+ assert_eq!(size_of::<*uint>(), 8u);
+ }
+
+ #[test]
+ fn size_of_val_basic() {
+ assert_eq!(size_of_val(&1u8), 1);
+ assert_eq!(size_of_val(&1u16), 2);
+ assert_eq!(size_of_val(&1u32), 4);
+ assert_eq!(size_of_val(&1u64), 8);
+ }
+
+ #[test]
+ fn nonzero_size_of_basic() {
+ type Z = [i8, ..0];
+ assert_eq!(size_of::<Z>(), 0u);
+ assert_eq!(nonzero_size_of::<Z>(), 1u);
+ assert_eq!(nonzero_size_of::<uint>(), size_of::<uint>());
+ }
+
+ #[test]
+ fn nonzero_size_of_val_basic() {
+ let z = [0u8, ..0];
+ assert_eq!(size_of_val(&z), 0u);
+ assert_eq!(nonzero_size_of_val(&z), 1u);
+ assert_eq!(nonzero_size_of_val(&1u), size_of_val(&1u));
+ }
+
+ #[test]
+ fn align_of_basic() {
+ assert_eq!(pref_align_of::<u8>(), 1u);
+ assert_eq!(pref_align_of::<u16>(), 2u);
+ assert_eq!(pref_align_of::<u32>(), 4u);
+ }
+
+ #[test]
+ #[cfg(target_arch = "x86")]
+ #[cfg(target_arch = "arm")]
+ #[cfg(target_arch = "mips")]
+ fn align_of_32() {
+ assert_eq!(pref_align_of::<uint>(), 4u);
+ assert_eq!(pref_align_of::<*uint>(), 4u);
+ }
+
+ #[test]
+ #[cfg(target_arch = "x86_64")]
+ fn align_of_64() {
+ assert_eq!(pref_align_of::<uint>(), 8u);
+ assert_eq!(pref_align_of::<*uint>(), 8u);
+ }
+
+ #[test]
+ fn align_of_val_basic() {
+ assert_eq!(pref_align_of_val(&1u8), 1u);
+ assert_eq!(pref_align_of_val(&1u16), 2u);
+ assert_eq!(pref_align_of_val(&1u32), 4u);
+ }
+
+ #[test]
+ fn test_swap() {
+ let mut x = 31337;
+ let mut y = 42;
+ swap(&mut x, &mut y);
+ assert_eq!(x, 42);
+ assert_eq!(y, 31337);
+ }
+
+ #[test]
+ fn test_replace() {
+ let mut x = Some("test".to_owned());
+ let y = replace(&mut x, None);
+ assert!(x.is_none());
+ assert!(y.is_some());
+ }
+}
+
+// FIXME #13642 (these benchmarks should be in another place)
+/// Completely miscellaneous language-construct benchmarks.
+#[cfg(test)]
+mod bench {
+ extern crate test;
+ use self::test::Bencher;
+ use option::{Some,None};
+
+ // Static/dynamic method dispatch
+
+ struct Struct {
+ field: int
+ }
+
+ trait Trait {
+ fn method(&self) -> int;
+ }
+
+ impl Trait for Struct {
+ fn method(&self) -> int {
+ self.field
+ }
+ }
+
+ #[bench]
+ fn trait_vtable_method_call(b: &mut Bencher) {
+ let s = Struct { field: 10 };
+ let t = &s as &Trait;
+ b.iter(|| {
+ t.method()
+ });
+ }
+
+ #[bench]
+ fn trait_static_method_call(b: &mut Bencher) {
+ let s = Struct { field: 10 };
+ b.iter(|| {
+ s.method()
+ });
+ }
+
+ // Overhead of various match forms
+
+ #[bench]
+ fn match_option_some(b: &mut Bencher) {
+ let x = Some(10);
+ b.iter(|| {
+ match x {
+ Some(y) => y,
+ None => 11
+ }
+ });
+ }
+
+ #[bench]
+ fn match_vec_pattern(b: &mut Bencher) {
+ let x = [1,2,3,4,5,6];
+ b.iter(|| {
+ match x {
+ [1,2,3,..] => 10,
+ _ => 11
+ }
+ });
+ }
+}
--- /dev/null
+// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Operations and constants for 32-bits floats (`f32` type)
+
+use default::Default;
+use intrinsics;
+use num::{Zero, One, Bounded, Signed, Num, Primitive};
+
+#[cfg(not(test))] use cmp::{Eq, Ord};
+#[cfg(not(test))] use ops::{Add, Sub, Mul, Div, Rem, Neg};
+
+pub static RADIX: uint = 2u;
+
+pub static MANTISSA_DIGITS: uint = 24u;
+pub static DIGITS: uint = 6u;
+
+pub static EPSILON: f32 = 1.19209290e-07_f32;
+
+/// Smallest finite f32 value
+pub static MIN_VALUE: f32 = -3.40282347e+38_f32;
+/// Smallest positive, normalized f32 value
+pub static MIN_POS_VALUE: f32 = 1.17549435e-38_f32;
+/// Largest finite f32 value
+pub static MAX_VALUE: f32 = 3.40282347e+38_f32;
+
+pub static MIN_EXP: int = -125;
+pub static MAX_EXP: int = 128;
+
+pub static MIN_10_EXP: int = -37;
+pub static MAX_10_EXP: int = 38;
+
+pub static NAN: f32 = 0.0_f32/0.0_f32;
+pub static INFINITY: f32 = 1.0_f32/0.0_f32;
+pub static NEG_INFINITY: f32 = -1.0_f32/0.0_f32;
+
+/// Various useful constants.
+pub mod consts {
+ // FIXME: replace with mathematical constants from cmath.
+
+ // FIXME(#5527): These constants should be deprecated once associated
+ // constants are implemented in favour of referencing the respective members
+ // of `Float`.
+
+ /// Archimedes' constant
+ pub static PI: f32 = 3.14159265358979323846264338327950288_f32;
+
+ /// pi * 2.0
+ pub static PI_2: f32 = 6.28318530717958647692528676655900576_f32;
+
+ /// pi/2.0
+ pub static FRAC_PI_2: f32 = 1.57079632679489661923132169163975144_f32;
+
+ /// pi/3.0
+ pub static FRAC_PI_3: f32 = 1.04719755119659774615421446109316763_f32;
+
+ /// pi/4.0
+ pub static FRAC_PI_4: f32 = 0.785398163397448309615660845819875721_f32;
+
+ /// pi/6.0
+ pub static FRAC_PI_6: f32 = 0.52359877559829887307710723054658381_f32;
+
+ /// pi/8.0
+ pub static FRAC_PI_8: f32 = 0.39269908169872415480783042290993786_f32;
+
+ /// 1.0/pi
+ pub static FRAC_1_PI: f32 = 0.318309886183790671537767526745028724_f32;
+
+ /// 2.0/pi
+ pub static FRAC_2_PI: f32 = 0.636619772367581343075535053490057448_f32;
+
+ /// 2.0/sqrt(pi)
+ pub static FRAC_2_SQRTPI: f32 = 1.12837916709551257389615890312154517_f32;
+
+ /// sqrt(2.0)
+ pub static SQRT2: f32 = 1.41421356237309504880168872420969808_f32;
+
+ /// 1.0/sqrt(2.0)
+ pub static FRAC_1_SQRT2: f32 = 0.707106781186547524400844362104849039_f32;
+
+ /// Euler's number
+ pub static E: f32 = 2.71828182845904523536028747135266250_f32;
+
+ /// log2(e)
+ pub static LOG2_E: f32 = 1.44269504088896340735992468100189214_f32;
+
+ /// log10(e)
+ pub static LOG10_E: f32 = 0.434294481903251827651128918916605082_f32;
+
+ /// ln(2.0)
+ pub static LN_2: f32 = 0.693147180559945309417232121458176568_f32;
+
+ /// ln(10.0)
+ pub static LN_10: f32 = 2.30258509299404568401799145468436421_f32;
+}
+
+#[cfg(not(test))]
+impl Ord for f32 {
+ #[inline]
+ fn lt(&self, other: &f32) -> bool { (*self) < (*other) }
+ #[inline]
+ fn le(&self, other: &f32) -> bool { (*self) <= (*other) }
+ #[inline]
+ fn ge(&self, other: &f32) -> bool { (*self) >= (*other) }
+ #[inline]
+ fn gt(&self, other: &f32) -> bool { (*self) > (*other) }
+}
+#[cfg(not(test))]
+impl Eq for f32 {
+ #[inline]
+ fn eq(&self, other: &f32) -> bool { (*self) == (*other) }
+}
+
+impl Num for f32 {}
+
+impl Default for f32 {
+ #[inline]
+ fn default() -> f32 { 0.0 }
+}
+
+impl Primitive for f32 {}
+
+impl Zero for f32 {
+ #[inline]
+ fn zero() -> f32 { 0.0 }
+
+ /// Returns true if the number is equal to either `0.0` or `-0.0`
+ #[inline]
+ fn is_zero(&self) -> bool { *self == 0.0 || *self == -0.0 }
+}
+
+impl One for f32 {
+ #[inline]
+ fn one() -> f32 { 1.0 }
+}
+
+#[cfg(not(test))]
+impl Add<f32,f32> for f32 {
+ #[inline]
+ fn add(&self, other: &f32) -> f32 { *self + *other }
+}
+
+#[cfg(not(test))]
+impl Sub<f32,f32> for f32 {
+ #[inline]
+ fn sub(&self, other: &f32) -> f32 { *self - *other }
+}
+
+#[cfg(not(test))]
+impl Mul<f32,f32> for f32 {
+ #[inline]
+ fn mul(&self, other: &f32) -> f32 { *self * *other }
+}
+
+#[cfg(not(test))]
+impl Div<f32,f32> for f32 {
+ #[inline]
+ fn div(&self, other: &f32) -> f32 { *self / *other }
+}
+
+#[cfg(not(test))]
+impl Rem<f32,f32> for f32 {
+ #[inline]
+ fn rem(&self, other: &f32) -> f32 {
+ extern { fn fmodf(a: f32, b: f32) -> f32; }
+ unsafe { fmodf(*self, *other) }
+ }
+}
+
+#[cfg(not(test))]
+impl Neg<f32> for f32 {
+ #[inline]
+ fn neg(&self) -> f32 { -*self }
+}
+
+impl Signed for f32 {
+ /// Computes the absolute value. Returns `NAN` if the number is `NAN`.
+ #[inline]
+ fn abs(&self) -> f32 {
+ unsafe { intrinsics::fabsf32(*self) }
+ }
+
+ /// The positive difference of two numbers. Returns `0.0` if the number is
+ /// less than or equal to `other`, otherwise the difference between`self`
+ /// and `other` is returned.
+ #[inline]
+ fn abs_sub(&self, other: &f32) -> f32 {
+ extern { fn fdimf(a: f32, b: f32) -> f32; }
+ unsafe { fdimf(*self, *other) }
+ }
+
+ /// # Returns
+ ///
+ /// - `1.0` if the number is positive, `+0.0` or `INFINITY`
+ /// - `-1.0` if the number is negative, `-0.0` or `NEG_INFINITY`
+ /// - `NAN` if the number is NaN
+ #[inline]
+ fn signum(&self) -> f32 {
+ if self != self { NAN } else {
+ unsafe { intrinsics::copysignf32(1.0, *self) }
+ }
+ }
+
+ /// Returns `true` if the number is positive, including `+0.0` and `INFINITY`
+ #[inline]
+ fn is_positive(&self) -> bool { *self > 0.0 || (1.0 / *self) == INFINITY }
+
+ /// Returns `true` if the number is negative, including `-0.0` and `NEG_INFINITY`
+ #[inline]
+ fn is_negative(&self) -> bool { *self < 0.0 || (1.0 / *self) == NEG_INFINITY }
+}
+
+impl Bounded for f32 {
+ // NOTE: this is the smallest non-infinite f32 value, *not* MIN_VALUE
+ #[inline]
+ fn min_value() -> f32 { -MAX_VALUE }
+
+ #[inline]
+ fn max_value() -> f32 { MAX_VALUE }
+}
--- /dev/null
+// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Operations and constants for 64-bits floats (`f64` type)
+
+use default::Default;
+use intrinsics;
+use num::{Zero, One, Bounded, Signed, Num, Primitive};
+
+#[cfg(not(test))] use cmp::{Eq, Ord};
+#[cfg(not(test))] use ops::{Add, Sub, Mul, Div, Rem, Neg};
+
+// FIXME(#5527): These constants should be deprecated once associated
+// constants are implemented in favour of referencing the respective
+// members of `Bounded` and `Float`.
+
+pub static RADIX: uint = 2u;
+
+pub static MANTISSA_DIGITS: uint = 53u;
+pub static DIGITS: uint = 15u;
+
+pub static EPSILON: f64 = 2.2204460492503131e-16_f64;
+
+/// Smallest finite f64 value
+pub static MIN_VALUE: f64 = -1.7976931348623157e+308_f64;
+/// Smallest positive, normalized f64 value
+pub static MIN_POS_VALUE: f64 = 2.2250738585072014e-308_f64;
+/// Largest finite f64 value
+pub static MAX_VALUE: f64 = 1.7976931348623157e+308_f64;
+
+pub static MIN_EXP: int = -1021;
+pub static MAX_EXP: int = 1024;
+
+pub static MIN_10_EXP: int = -307;
+pub static MAX_10_EXP: int = 308;
+
+pub static NAN: f64 = 0.0_f64/0.0_f64;
+
+pub static INFINITY: f64 = 1.0_f64/0.0_f64;
+
+pub static NEG_INFINITY: f64 = -1.0_f64/0.0_f64;
+
+/// Various useful constants.
+pub mod consts {
+ // FIXME: replace with mathematical constants from cmath.
+
+ // FIXME(#5527): These constants should be deprecated once associated
+ // constants are implemented in favour of referencing the respective members
+ // of `Float`.
+
+ /// Archimedes' constant
+ pub static PI: f64 = 3.14159265358979323846264338327950288_f64;
+
+ /// pi * 2.0
+ pub static PI_2: f64 = 6.28318530717958647692528676655900576_f64;
+
+ /// pi/2.0
+ pub static FRAC_PI_2: f64 = 1.57079632679489661923132169163975144_f64;
+
+ /// pi/3.0
+ pub static FRAC_PI_3: f64 = 1.04719755119659774615421446109316763_f64;
+
+ /// pi/4.0
+ pub static FRAC_PI_4: f64 = 0.785398163397448309615660845819875721_f64;
+
+ /// pi/6.0
+ pub static FRAC_PI_6: f64 = 0.52359877559829887307710723054658381_f64;
+
+ /// pi/8.0
+ pub static FRAC_PI_8: f64 = 0.39269908169872415480783042290993786_f64;
+
+ /// 1.0/pi
+ pub static FRAC_1_PI: f64 = 0.318309886183790671537767526745028724_f64;
+
+ /// 2.0/pi
+ pub static FRAC_2_PI: f64 = 0.636619772367581343075535053490057448_f64;
+
+ /// 2.0/sqrt(pi)
+ pub static FRAC_2_SQRTPI: f64 = 1.12837916709551257389615890312154517_f64;
+
+ /// sqrt(2.0)
+ pub static SQRT2: f64 = 1.41421356237309504880168872420969808_f64;
+
+ /// 1.0/sqrt(2.0)
+ pub static FRAC_1_SQRT2: f64 = 0.707106781186547524400844362104849039_f64;
+
+ /// Euler's number
+ pub static E: f64 = 2.71828182845904523536028747135266250_f64;
+
+ /// log2(e)
+ pub static LOG2_E: f64 = 1.44269504088896340735992468100189214_f64;
+
+ /// log10(e)
+ pub static LOG10_E: f64 = 0.434294481903251827651128918916605082_f64;
+
+ /// ln(2.0)
+ pub static LN_2: f64 = 0.693147180559945309417232121458176568_f64;
+
+ /// ln(10.0)
+ pub static LN_10: f64 = 2.30258509299404568401799145468436421_f64;
+}
+
+#[cfg(not(test))]
+impl Ord for f64 {
+ #[inline]
+ fn lt(&self, other: &f64) -> bool { (*self) < (*other) }
+ #[inline]
+ fn le(&self, other: &f64) -> bool { (*self) <= (*other) }
+ #[inline]
+ fn ge(&self, other: &f64) -> bool { (*self) >= (*other) }
+ #[inline]
+ fn gt(&self, other: &f64) -> bool { (*self) > (*other) }
+}
+#[cfg(not(test))]
+impl Eq for f64 {
+ #[inline]
+ fn eq(&self, other: &f64) -> bool { (*self) == (*other) }
+}
+
+impl Default for f64 {
+ #[inline]
+ fn default() -> f64 { 0.0 }
+}
+
+impl Primitive for f64 {}
+
+impl Num for f64 {}
+
+impl Zero for f64 {
+ #[inline]
+ fn zero() -> f64 { 0.0 }
+
+ /// Returns true if the number is equal to either `0.0` or `-0.0`
+ #[inline]
+ fn is_zero(&self) -> bool { *self == 0.0 || *self == -0.0 }
+}
+
+impl One for f64 {
+ #[inline]
+ fn one() -> f64 { 1.0 }
+}
+
+#[cfg(not(test))]
+impl Add<f64,f64> for f64 {
+ #[inline]
+ fn add(&self, other: &f64) -> f64 { *self + *other }
+}
+#[cfg(not(test))]
+impl Sub<f64,f64> for f64 {
+ #[inline]
+ fn sub(&self, other: &f64) -> f64 { *self - *other }
+}
+#[cfg(not(test))]
+impl Mul<f64,f64> for f64 {
+ #[inline]
+ fn mul(&self, other: &f64) -> f64 { *self * *other }
+}
+#[cfg(not(test))]
+impl Div<f64,f64> for f64 {
+ #[inline]
+ fn div(&self, other: &f64) -> f64 { *self / *other }
+}
+#[cfg(not(test))]
+impl Rem<f64,f64> for f64 {
+ #[inline]
+ fn rem(&self, other: &f64) -> f64 {
+ extern { fn fmod(a: f64, b: f64) -> f64; }
+ unsafe { fmod(*self, *other) }
+ }
+}
+#[cfg(not(test))]
+impl Neg<f64> for f64 {
+ #[inline]
+ fn neg(&self) -> f64 { -*self }
+}
+
+impl Signed for f64 {
+ /// Computes the absolute value. Returns `NAN` if the number is `NAN`.
+ #[inline]
+ fn abs(&self) -> f64 {
+ unsafe { intrinsics::fabsf64(*self) }
+ }
+
+ /// The positive difference of two numbers. Returns `0.0` if the number is less than or
+ /// equal to `other`, otherwise the difference between`self` and `other` is returned.
+ #[inline]
+ fn abs_sub(&self, other: &f64) -> f64 {
+ extern { fn fdim(a: f64, b: f64) -> f64; }
+ unsafe { fdim(*self, *other) }
+ }
+
+ /// # Returns
+ ///
+ /// - `1.0` if the number is positive, `+0.0` or `INFINITY`
+ /// - `-1.0` if the number is negative, `-0.0` or `NEG_INFINITY`
+ /// - `NAN` if the number is NaN
+ #[inline]
+ fn signum(&self) -> f64 {
+ if self != self { NAN } else {
+ unsafe { intrinsics::copysignf64(1.0, *self) }
+ }
+ }
+
+ /// Returns `true` if the number is positive, including `+0.0` and `INFINITY`
+ #[inline]
+ fn is_positive(&self) -> bool { *self > 0.0 || (1.0 / *self) == INFINITY }
+
+ /// Returns `true` if the number is negative, including `-0.0` and `NEG_INFINITY`
+ #[inline]
+ fn is_negative(&self) -> bool { *self < 0.0 || (1.0 / *self) == NEG_INFINITY }
+}
+
+impl Bounded for f64 {
+ // NOTE: this is the smallest non-infinite f32 value, *not* MIN_VALUE
+ #[inline]
+ fn min_value() -> f64 { -MAX_VALUE }
+
+ #[inline]
+ fn max_value() -> f64 { MAX_VALUE }
+}
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![macro_escape]
+#![doc(hidden)]
+
+macro_rules! assert_approx_eq(
+ ($a:expr, $b:expr) => ({
+ let (a, b) = (&$a, &$b);
+ assert!((*a - *b).abs() < 1.0e-6,
+ "{} is not approximately equal to {}", *a, *b);
+ })
+)
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Operations and constants for signed 16-bits integers (`i16` type)
+
+use default::Default;
+use intrinsics;
+use num::{Bitwise, Bounded, Zero, One, Signed, Num, Primitive, Int};
+use num::{CheckedDiv, CheckedAdd, CheckedSub, CheckedMul};
+use option::{Option, Some, None};
+
+#[cfg(not(test))]
+use cmp::{Eq, Ord, TotalEq, TotalOrd, Less, Greater, Equal, Ordering};
+#[cfg(not(test))]
+use ops::{Add, Sub, Mul, Div, Rem, Neg, BitOr, BitAnd, BitXor};
+#[cfg(not(test))]
+use ops::{Shl, Shr, Not};
+
+int_module!(i16, 16)
+
+impl Bitwise for i16 {
+ /// Returns the number of ones in the binary representation of the number.
+ #[inline]
+ fn count_ones(&self) -> i16 { unsafe { intrinsics::ctpop16(*self as u16) as i16 } }
+
+ /// Returns the number of leading zeros in the in the binary representation
+ /// of the number.
+ #[inline]
+ fn leading_zeros(&self) -> i16 { unsafe { intrinsics::ctlz16(*self as u16) as i16 } }
+
+ /// Returns the number of trailing zeros in the in the binary representation
+ /// of the number.
+ #[inline]
+ fn trailing_zeros(&self) -> i16 { unsafe { intrinsics::cttz16(*self as u16) as i16 } }
+}
+
+impl CheckedAdd for i16 {
+ #[inline]
+ fn checked_add(&self, v: &i16) -> Option<i16> {
+ unsafe {
+ let (x, y) = intrinsics::i16_add_with_overflow(*self, *v);
+ if y { None } else { Some(x) }
+ }
+ }
+}
+
+impl CheckedSub for i16 {
+ #[inline]
+ fn checked_sub(&self, v: &i16) -> Option<i16> {
+ unsafe {
+ let (x, y) = intrinsics::i16_sub_with_overflow(*self, *v);
+ if y { None } else { Some(x) }
+ }
+ }
+}
+
+impl CheckedMul for i16 {
+ #[inline]
+ fn checked_mul(&self, v: &i16) -> Option<i16> {
+ unsafe {
+ let (x, y) = intrinsics::i16_mul_with_overflow(*self, *v);
+ if y { None } else { Some(x) }
+ }
+ }
+}
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Operations and constants for signed 32-bits integers (`i32` type)
+
+use default::Default;
+use intrinsics;
+use num::{Bitwise, Bounded, Zero, One, Signed, Num, Primitive, Int};
+use num::{CheckedDiv, CheckedAdd, CheckedSub, CheckedMul};
+use option::{Option, Some, None};
+
+#[cfg(not(test))]
+use cmp::{Eq, Ord, TotalEq, TotalOrd, Less, Greater, Equal, Ordering};
+#[cfg(not(test))]
+use ops::{Add, Sub, Mul, Div, Rem, Neg, BitOr, BitAnd, BitXor};
+#[cfg(not(test))]
+use ops::{Shl, Shr, Not};
+
+int_module!(i32, 32)
+
+impl Bitwise for i32 {
+ /// Returns the number of ones in the binary representation of the number.
+ #[inline]
+ fn count_ones(&self) -> i32 { unsafe { intrinsics::ctpop32(*self as u32) as i32 } }
+
+ /// Returns the number of leading zeros in the in the binary representation
+ /// of the number.
+ #[inline]
+ fn leading_zeros(&self) -> i32 { unsafe { intrinsics::ctlz32(*self as u32) as i32 } }
+
+ /// Returns the number of trailing zeros in the in the binary representation
+ /// of the number.
+ #[inline]
+ fn trailing_zeros(&self) -> i32 { unsafe { intrinsics::cttz32(*self as u32) as i32 } }
+}
+
+impl CheckedAdd for i32 {
+ #[inline]
+ fn checked_add(&self, v: &i32) -> Option<i32> {
+ unsafe {
+ let (x, y) = intrinsics::i32_add_with_overflow(*self, *v);
+ if y { None } else { Some(x) }
+ }
+ }
+}
+
+impl CheckedSub for i32 {
+ #[inline]
+ fn checked_sub(&self, v: &i32) -> Option<i32> {
+ unsafe {
+ let (x, y) = intrinsics::i32_sub_with_overflow(*self, *v);
+ if y { None } else { Some(x) }
+ }
+ }
+}
+
+impl CheckedMul for i32 {
+ #[inline]
+ fn checked_mul(&self, v: &i32) -> Option<i32> {
+ unsafe {
+ let (x, y) = intrinsics::i32_mul_with_overflow(*self, *v);
+ if y { None } else { Some(x) }
+ }
+ }
+}
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Operations and constants for signed 64-bits integers (`i64` type)
+
+use default::Default;
+use intrinsics;
+use num::{Bitwise, Bounded, Zero, One, Signed, Num, Primitive, Int};
+use num::{CheckedDiv, CheckedAdd, CheckedSub, CheckedMul};
+use option::{Option, Some, None};
+
+#[cfg(not(test))]
+use cmp::{Eq, Ord, TotalEq, TotalOrd, Less, Greater, Equal, Ordering};
+#[cfg(not(test))]
+use ops::{Add, Sub, Mul, Div, Rem, Neg, BitOr, BitAnd, BitXor};
+#[cfg(not(test))]
+use ops::{Shl, Shr, Not};
+
+int_module!(i64, 64)
+
+impl Bitwise for i64 {
+ /// Returns the number of ones in the binary representation of the number.
+ #[inline]
+ fn count_ones(&self) -> i64 { unsafe { intrinsics::ctpop64(*self as u64) as i64 } }
+
+ /// Returns the number of leading zeros in the in the binary representation
+ /// of the number.
+ #[inline]
+ fn leading_zeros(&self) -> i64 { unsafe { intrinsics::ctlz64(*self as u64) as i64 } }
+
+ /// Counts the number of trailing zeros.
+ #[inline]
+ fn trailing_zeros(&self) -> i64 { unsafe { intrinsics::cttz64(*self as u64) as i64 } }
+}
+
+impl CheckedAdd for i64 {
+ #[inline]
+ fn checked_add(&self, v: &i64) -> Option<i64> {
+ unsafe {
+ let (x, y) = intrinsics::i64_add_with_overflow(*self, *v);
+ if y { None } else { Some(x) }
+ }
+ }
+}
+
+impl CheckedSub for i64 {
+ #[inline]
+ fn checked_sub(&self, v: &i64) -> Option<i64> {
+ unsafe {
+ let (x, y) = intrinsics::i64_sub_with_overflow(*self, *v);
+ if y { None } else { Some(x) }
+ }
+ }
+}
+
+impl CheckedMul for i64 {
+ #[inline]
+ fn checked_mul(&self, v: &i64) -> Option<i64> {
+ unsafe {
+ let (x, y) = intrinsics::i64_mul_with_overflow(*self, *v);
+ if y { None } else { Some(x) }
+ }
+ }
+}
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Operations and constants for signed 8-bits integers (`i8` type)
+
+use default::Default;
+use intrinsics;
+use num::{Bitwise, Bounded, Zero, One, Signed, Num, Primitive, Int};
+use num::{CheckedDiv, CheckedAdd, CheckedSub, CheckedMul};
+use option::{Option, Some, None};
+
+#[cfg(not(test))]
+use cmp::{Eq, Ord, TotalEq, TotalOrd, Less, Greater, Equal, Ordering};
+#[cfg(not(test))]
+use ops::{Add, Sub, Mul, Div, Rem, Neg, BitOr, BitAnd, BitXor};
+#[cfg(not(test))]
+use ops::{Shl, Shr, Not};
+
+int_module!(i8, 8)
+
+impl Bitwise for i8 {
+ /// Returns the number of ones in the binary representation of the number.
+ #[inline]
+ fn count_ones(&self) -> i8 { unsafe { intrinsics::ctpop8(*self as u8) as i8 } }
+
+ /// Returns the number of leading zeros in the in the binary representation
+ /// of the number.
+ #[inline]
+ fn leading_zeros(&self) -> i8 { unsafe { intrinsics::ctlz8(*self as u8) as i8 } }
+
+ /// Returns the number of trailing zeros in the in the binary representation
+ /// of the number.
+ #[inline]
+ fn trailing_zeros(&self) -> i8 { unsafe { intrinsics::cttz8(*self as u8) as i8 } }
+}
+
+impl CheckedAdd for i8 {
+ #[inline]
+ fn checked_add(&self, v: &i8) -> Option<i8> {
+ unsafe {
+ let (x, y) = intrinsics::i8_add_with_overflow(*self, *v);
+ if y { None } else { Some(x) }
+ }
+ }
+}
+
+impl CheckedSub for i8 {
+ #[inline]
+ fn checked_sub(&self, v: &i8) -> Option<i8> {
+ unsafe {
+ let (x, y) = intrinsics::i8_sub_with_overflow(*self, *v);
+ if y { None } else { Some(x) }
+ }
+ }
+}
+
+impl CheckedMul for i8 {
+ #[inline]
+ fn checked_mul(&self, v: &i8) -> Option<i8> {
+ unsafe {
+ let (x, y) = intrinsics::i8_mul_with_overflow(*self, *v);
+ if y { None } else { Some(x) }
+ }
+ }
+}
--- /dev/null
+// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Operations and constants for architecture-sized signed integers (`int` type)
+
+use default::Default;
+use intrinsics;
+use num::{Bitwise, Bounded, Zero, One, Signed, Num, Primitive, Int};
+use num::{CheckedDiv, CheckedAdd, CheckedSub, CheckedMul};
+use option::{Option, Some, None};
+
+#[cfg(not(test))]
+use cmp::{Eq, Ord, TotalEq, TotalOrd, Less, Greater, Equal, Ordering};
+#[cfg(not(test))]
+use ops::{Add, Sub, Mul, Div, Rem, Neg, BitOr, BitAnd, BitXor};
+#[cfg(not(test))]
+use ops::{Shl, Shr, Not};
+
+#[cfg(target_word_size = "32")] int_module!(int, 32)
+#[cfg(target_word_size = "64")] int_module!(int, 64)
+
+#[cfg(target_word_size = "32")]
+impl Bitwise for int {
+ /// Returns the number of ones in the binary representation of the number.
+ #[inline]
+ fn count_ones(&self) -> int { (*self as i32).count_ones() as int }
+
+ /// Returns the number of leading zeros in the in the binary representation
+ /// of the number.
+ #[inline]
+ fn leading_zeros(&self) -> int { (*self as i32).leading_zeros() as int }
+
+ /// Returns the number of trailing zeros in the in the binary representation
+ /// of the number.
+ #[inline]
+ fn trailing_zeros(&self) -> int { (*self as i32).trailing_zeros() as int }
+}
+
+#[cfg(target_word_size = "64")]
+impl Bitwise for int {
+ /// Returns the number of ones in the binary representation of the number.
+ #[inline]
+ fn count_ones(&self) -> int { (*self as i64).count_ones() as int }
+
+ /// Returns the number of leading zeros in the in the binary representation
+ /// of the number.
+ #[inline]
+ fn leading_zeros(&self) -> int { (*self as i64).leading_zeros() as int }
+
+ /// Returns the number of trailing zeros in the in the binary representation
+ /// of the number.
+ #[inline]
+ fn trailing_zeros(&self) -> int { (*self as i64).trailing_zeros() as int }
+}
+
+#[cfg(target_word_size = "32")]
+impl CheckedAdd for int {
+ #[inline]
+ fn checked_add(&self, v: &int) -> Option<int> {
+ unsafe {
+ let (x, y) = intrinsics::i32_add_with_overflow(*self as i32, *v as i32);
+ if y { None } else { Some(x as int) }
+ }
+ }
+}
+
+#[cfg(target_word_size = "64")]
+impl CheckedAdd for int {
+ #[inline]
+ fn checked_add(&self, v: &int) -> Option<int> {
+ unsafe {
+ let (x, y) = intrinsics::i64_add_with_overflow(*self as i64, *v as i64);
+ if y { None } else { Some(x as int) }
+ }
+ }
+}
+
+#[cfg(target_word_size = "32")]
+impl CheckedSub for int {
+ #[inline]
+ fn checked_sub(&self, v: &int) -> Option<int> {
+ unsafe {
+ let (x, y) = intrinsics::i32_sub_with_overflow(*self as i32, *v as i32);
+ if y { None } else { Some(x as int) }
+ }
+ }
+}
+
+#[cfg(target_word_size = "64")]
+impl CheckedSub for int {
+ #[inline]
+ fn checked_sub(&self, v: &int) -> Option<int> {
+ unsafe {
+ let (x, y) = intrinsics::i64_sub_with_overflow(*self as i64, *v as i64);
+ if y { None } else { Some(x as int) }
+ }
+ }
+}
+
+#[cfg(target_word_size = "32")]
+impl CheckedMul for int {
+ #[inline]
+ fn checked_mul(&self, v: &int) -> Option<int> {
+ unsafe {
+ let (x, y) = intrinsics::i32_mul_with_overflow(*self as i32, *v as i32);
+ if y { None } else { Some(x as int) }
+ }
+ }
+}
+
+#[cfg(target_word_size = "64")]
+impl CheckedMul for int {
+ #[inline]
+ fn checked_mul(&self, v: &int) -> Option<int> {
+ unsafe {
+ let (x, y) = intrinsics::i64_mul_with_overflow(*self as i64, *v as i64);
+ if y { None } else { Some(x as int) }
+ }
+ }
+}
--- /dev/null
+// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![macro_escape]
+#![doc(hidden)]
+
+macro_rules! int_module (($T:ty, $bits:expr) => (
+
+// FIXME(#11621): Should be deprecated once CTFE is implemented in favour of
+// calling the `mem::size_of` function.
+pub static BITS : uint = $bits;
+// FIXME(#11621): Should be deprecated once CTFE is implemented in favour of
+// calling the `mem::size_of` function.
+pub static BYTES : uint = ($bits / 8);
+
+// FIXME(#11621): Should be deprecated once CTFE is implemented in favour of
+// calling the `Bounded::min_value` function.
+pub static MIN: $T = (-1 as $T) << (BITS - 1);
+// FIXME(#9837): Compute MIN like this so the high bits that shouldn't exist are 0.
+// FIXME(#11621): Should be deprecated once CTFE is implemented in favour of
+// calling the `Bounded::max_value` function.
+pub static MAX: $T = !MIN;
+
+#[cfg(not(test))]
+impl Ord for $T {
+ #[inline]
+ fn lt(&self, other: &$T) -> bool { *self < *other }
+}
+#[cfg(not(test))]
+impl TotalEq for $T {}
+#[cfg(not(test))]
+impl Eq for $T {
+ #[inline]
+ fn eq(&self, other: &$T) -> bool { *self == *other }
+}
+#[cfg(not(test))]
+impl TotalOrd for $T {
+ #[inline]
+ fn cmp(&self, other: &$T) -> Ordering {
+ if *self < *other { Less }
+ else if *self > *other { Greater }
+ else { Equal }
+ }
+}
+
+impl Num for $T {}
+
+impl Zero for $T {
+ #[inline]
+ fn zero() -> $T { 0 }
+
+ #[inline]
+ fn is_zero(&self) -> bool { *self == 0 }
+}
+
+impl One for $T {
+ #[inline]
+ fn one() -> $T { 1 }
+}
+
+#[cfg(not(test))]
+impl Add<$T,$T> for $T {
+ #[inline]
+ fn add(&self, other: &$T) -> $T { *self + *other }
+}
+
+#[cfg(not(test))]
+impl Sub<$T,$T> for $T {
+ #[inline]
+ fn sub(&self, other: &$T) -> $T { *self - *other }
+}
+
+#[cfg(not(test))]
+impl Mul<$T,$T> for $T {
+ #[inline]
+ fn mul(&self, other: &$T) -> $T { *self * *other }
+}
+
+#[cfg(not(test))]
+impl Div<$T,$T> for $T {
+ /// Integer division, truncated towards 0.
+ ///
+ /// # Examples
+ ///
+ /// ~~~
+ /// assert!( 8 / 3 == 2);
+ /// assert!( 8 / -3 == -2);
+ /// assert!(-8 / 3 == -2);
+ /// assert!(-8 / -3 == 2);
+ ///
+ /// assert!( 1 / 2 == 0);
+ /// assert!( 1 / -2 == 0);
+ /// assert!(-1 / 2 == 0);
+ /// assert!(-1 / -2 == 0);
+ /// ~~~
+ #[inline]
+ fn div(&self, other: &$T) -> $T { *self / *other }
+}
+
+#[cfg(not(test))]
+impl Rem<$T,$T> for $T {
+ /// Returns the integer remainder after division, satisfying:
+ ///
+ /// ~~~
+ /// # let n = 1;
+ /// # let d = 2;
+ /// assert!((n / d) * d + (n % d) == n)
+ /// ~~~
+ ///
+ /// # Examples
+ ///
+ /// ~~~
+ /// assert!( 8 % 3 == 2);
+ /// assert!( 8 % -3 == 2);
+ /// assert!(-8 % 3 == -2);
+ /// assert!(-8 % -3 == -2);
+ ///
+ /// assert!( 1 % 2 == 1);
+ /// assert!( 1 % -2 == 1);
+ /// assert!(-1 % 2 == -1);
+ /// assert!(-1 % -2 == -1);
+ /// ~~~
+ #[inline]
+ fn rem(&self, other: &$T) -> $T { *self % *other }
+}
+
+#[cfg(not(test))]
+impl Neg<$T> for $T {
+ #[inline]
+ fn neg(&self) -> $T { -*self }
+}
+
+impl Signed for $T {
+ /// Computes the absolute value
+ #[inline]
+ fn abs(&self) -> $T {
+ if self.is_negative() { -*self } else { *self }
+ }
+
+ ///
+ /// The positive difference of two numbers. Returns `0` if the number is less than or
+ /// equal to `other`, otherwise the difference between`self` and `other` is returned.
+ ///
+ #[inline]
+ fn abs_sub(&self, other: &$T) -> $T {
+ if *self <= *other { 0 } else { *self - *other }
+ }
+
+ ///
+ /// # Returns
+ ///
+ /// - `0` if the number is zero
+ /// - `1` if the number is positive
+ /// - `-1` if the number is negative
+ ///
+ #[inline]
+ fn signum(&self) -> $T {
+ match *self {
+ n if n > 0 => 1,
+ 0 => 0,
+ _ => -1,
+ }
+ }
+
+ /// Returns true if the number is positive
+ #[inline]
+ fn is_positive(&self) -> bool { *self > 0 }
+
+ /// Returns true if the number is negative
+ #[inline]
+ fn is_negative(&self) -> bool { *self < 0 }
+}
+
+#[cfg(not(test))]
+impl BitOr<$T,$T> for $T {
+ #[inline]
+ fn bitor(&self, other: &$T) -> $T { *self | *other }
+}
+
+#[cfg(not(test))]
+impl BitAnd<$T,$T> for $T {
+ #[inline]
+ fn bitand(&self, other: &$T) -> $T { *self & *other }
+}
+
+#[cfg(not(test))]
+impl BitXor<$T,$T> for $T {
+ #[inline]
+ fn bitxor(&self, other: &$T) -> $T { *self ^ *other }
+}
+
+#[cfg(not(test))]
+impl Shl<$T,$T> for $T {
+ #[inline]
+ fn shl(&self, other: &$T) -> $T { *self << *other }
+}
+
+#[cfg(not(test))]
+impl Shr<$T,$T> for $T {
+ #[inline]
+ fn shr(&self, other: &$T) -> $T { *self >> *other }
+}
+
+#[cfg(not(test))]
+impl Not<$T> for $T {
+ #[inline]
+ fn not(&self) -> $T { !*self }
+}
+
+impl Bounded for $T {
+ #[inline]
+ fn min_value() -> $T { MIN }
+
+ #[inline]
+ fn max_value() -> $T { MAX }
+}
+
+impl CheckedDiv for $T {
+ #[inline]
+ fn checked_div(&self, v: &$T) -> Option<$T> {
+ if *v == 0 || (*self == MIN && *v == -1) {
+ None
+ } else {
+ Some(self / *v)
+ }
+ }
+}
+
+impl Default for $T {
+ #[inline]
+ fn default() -> $T { 0 }
+}
+
+impl Int for $T {}
+
+impl Primitive for $T {}
+
+#[cfg(test)]
+mod tests {
+ use prelude::*;
+ use super::*;
+
+ use int;
+ use num;
+ use num::Bitwise;
+ use num::CheckedDiv;
+
+ #[test]
+ fn test_overflows() {
+ assert!(MAX > 0);
+ assert!(MIN <= 0);
+ assert!(MIN + MAX + 1 == 0);
+ }
+
+ #[test]
+ fn test_num() {
+ num::test_num(10 as $T, 2 as $T);
+ }
+
+ #[test]
+ pub fn test_abs() {
+ assert!((1 as $T).abs() == 1 as $T);
+ assert!((0 as $T).abs() == 0 as $T);
+ assert!((-1 as $T).abs() == 1 as $T);
+ }
+
+ #[test]
+ fn test_abs_sub() {
+ assert!((-1 as $T).abs_sub(&(1 as $T)) == 0 as $T);
+ assert!((1 as $T).abs_sub(&(1 as $T)) == 0 as $T);
+ assert!((1 as $T).abs_sub(&(0 as $T)) == 1 as $T);
+ assert!((1 as $T).abs_sub(&(-1 as $T)) == 2 as $T);
+ }
+
+ #[test]
+ fn test_signum() {
+ assert!((1 as $T).signum() == 1 as $T);
+ assert!((0 as $T).signum() == 0 as $T);
+ assert!((-0 as $T).signum() == 0 as $T);
+ assert!((-1 as $T).signum() == -1 as $T);
+ }
+
+ #[test]
+ fn test_is_positive() {
+ assert!((1 as $T).is_positive());
+ assert!(!(0 as $T).is_positive());
+ assert!(!(-0 as $T).is_positive());
+ assert!(!(-1 as $T).is_positive());
+ }
+
+ #[test]
+ fn test_is_negative() {
+ assert!(!(1 as $T).is_negative());
+ assert!(!(0 as $T).is_negative());
+ assert!(!(-0 as $T).is_negative());
+ assert!((-1 as $T).is_negative());
+ }
+
+ #[test]
+ fn test_bitwise() {
+ assert!(0b1110 as $T == (0b1100 as $T).bitor(&(0b1010 as $T)));
+ assert!(0b1000 as $T == (0b1100 as $T).bitand(&(0b1010 as $T)));
+ assert!(0b0110 as $T == (0b1100 as $T).bitxor(&(0b1010 as $T)));
+ assert!(0b1110 as $T == (0b0111 as $T).shl(&(1 as $T)));
+ assert!(0b0111 as $T == (0b1110 as $T).shr(&(1 as $T)));
+ assert!(-(0b11 as $T) - (1 as $T) == (0b11 as $T).not());
+ }
+
+ #[test]
+ fn test_count_ones() {
+ assert!((0b0101100 as $T).count_ones() == 3);
+ assert!((0b0100001 as $T).count_ones() == 2);
+ assert!((0b1111001 as $T).count_ones() == 5);
+ }
+
+ #[test]
+ fn test_count_zeros() {
+ assert!((0b0101100 as $T).count_zeros() == BITS as $T - 3);
+ assert!((0b0100001 as $T).count_zeros() == BITS as $T - 2);
+ assert!((0b1111001 as $T).count_zeros() == BITS as $T - 5);
+ }
+
+ #[test]
+ fn test_signed_checked_div() {
+ assert!(10i.checked_div(&2) == Some(5));
+ assert!(5i.checked_div(&0) == None);
+ assert!(int::MIN.checked_div(&-1) == None);
+ }
+}
+
+))
--- /dev/null
+// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Numeric traits and functions for generic mathematics
+//!
+//! These are implemented for the primitive numeric types in `std::{u8, u16,
+//! u32, u64, uint, i8, i16, i32, i64, int, f32, f64, float}`.
+
+#![allow(missing_doc)]
+
+use clone::Clone;
+use cmp::{Eq, Ord};
+use kinds::Copy;
+use mem::size_of;
+use ops::{Add, Sub, Mul, Div, Rem, Neg};
+use ops::{Not, BitAnd, BitOr, BitXor, Shl, Shr};
+use option::{Option, Some, None};
+
+/// The base trait for numeric types
+pub trait Num: Eq + Zero + One
+ + Neg<Self>
+ + Add<Self,Self>
+ + Sub<Self,Self>
+ + Mul<Self,Self>
+ + Div<Self,Self>
+ + Rem<Self,Self> {}
+
+/// Simultaneous division and remainder
+#[inline]
+pub fn div_rem<T: Div<T, T> + Rem<T, T>>(x: T, y: T) -> (T, T) {
+ (x / y, x % y)
+}
+
+/// Defines an additive identity element for `Self`.
+///
+/// # Deriving
+///
+/// This trait can be automatically be derived using `#[deriving(Zero)]`
+/// attribute. If you choose to use this, make sure that the laws outlined in
+/// the documentation for `Zero::zero` still hold.
+pub trait Zero: Add<Self, Self> {
+ /// Returns the additive identity element of `Self`, `0`.
+ ///
+ /// # Laws
+ ///
+ /// ~~~notrust
+ /// a + 0 = a ∀ a ∈ Self
+ /// 0 + a = a ∀ a ∈ Self
+ /// ~~~
+ ///
+ /// # Purity
+ ///
+ /// This function should return the same result at all times regardless of
+ /// external mutable state, for example values stored in TLS or in
+ /// `static mut`s.
+ // FIXME (#5527): This should be an associated constant
+ fn zero() -> Self;
+
+ /// Returns `true` if `self` is equal to the additive identity.
+ fn is_zero(&self) -> bool;
+}
+
+/// Returns the additive identity, `0`.
+#[inline(always)] pub fn zero<T: Zero>() -> T { Zero::zero() }
+
+/// Defines a multiplicative identity element for `Self`.
+pub trait One: Mul<Self, Self> {
+ /// Returns the multiplicative identity element of `Self`, `1`.
+ ///
+ /// # Laws
+ ///
+ /// ~~~notrust
+ /// a * 1 = a ∀ a ∈ Self
+ /// 1 * a = a ∀ a ∈ Self
+ /// ~~~
+ ///
+ /// # Purity
+ ///
+ /// This function should return the same result at all times regardless of
+ /// external mutable state, for example values stored in TLS or in
+ /// `static mut`s.
+ // FIXME (#5527): This should be an associated constant
+ fn one() -> Self;
+}
+
+/// Returns the multiplicative identity, `1`.
+#[inline(always)] pub fn one<T: One>() -> T { One::one() }
+
+/// Useful functions for signed numbers (i.e. numbers that can be negative).
+pub trait Signed: Num + Neg<Self> {
+ /// Computes the absolute value.
+ ///
+ /// For float, f32, and f64, `NaN` will be returned if the number is `NaN`.
+ fn abs(&self) -> Self;
+
+ /// The positive difference of two numbers.
+ ///
+ /// Returns `zero` if the number is less than or equal to `other`, otherwise the difference
+ /// between `self` and `other` is returned.
+ fn abs_sub(&self, other: &Self) -> Self;
+
+ /// Returns the sign of the number.
+ ///
+ /// For `float`, `f32`, `f64`:
+ /// * `1.0` if the number is positive, `+0.0` or `INFINITY`
+ /// * `-1.0` if the number is negative, `-0.0` or `NEG_INFINITY`
+ /// * `NaN` if the number is `NaN`
+ ///
+ /// For `int`:
+ /// * `0` if the number is zero
+ /// * `1` if the number is positive
+ /// * `-1` if the number is negative
+ fn signum(&self) -> Self;
+
+ /// Returns true if the number is positive and false if the number is zero or negative.
+ fn is_positive(&self) -> bool;
+
+ /// Returns true if the number is negative and false if the number is zero or positive.
+ fn is_negative(&self) -> bool;
+}
+
+/// Computes the absolute value.
+///
+/// For float, f32, and f64, `NaN` will be returned if the number is `NaN`
+#[inline(always)]
+pub fn abs<T: Signed>(value: T) -> T {
+ value.abs()
+}
+
+/// The positive difference of two numbers.
+///
+/// Returns `zero` if the number is less than or equal to `other`,
+/// otherwise the difference between `self` and `other` is returned.
+#[inline(always)]
+pub fn abs_sub<T: Signed>(x: T, y: T) -> T {
+ x.abs_sub(&y)
+}
+
+/// Returns the sign of the number.
+///
+/// For float, f32, f64:
+/// - `1.0` if the number is positive, `+0.0` or `INFINITY`
+/// - `-1.0` if the number is negative, `-0.0` or `NEG_INFINITY`
+/// - `NAN` if the number is `NAN`
+///
+/// For int:
+/// - `0` if the number is zero
+/// - `1` if the number is positive
+/// - `-1` if the number is negative
+#[inline(always)] pub fn signum<T: Signed>(value: T) -> T { value.signum() }
+
+/// A trait for values which cannot be negative
+pub trait Unsigned: Num {}
+
+/// Raises a value to the power of exp, using exponentiation by squaring.
+///
+/// # Example
+///
+/// ```rust
+/// use std::num;
+///
+/// assert_eq!(num::pow(2, 4), 16);
+/// ```
+#[inline]
+pub fn pow<T: One + Mul<T, T>>(mut base: T, mut exp: uint) -> T {
+ if exp == 1 { base }
+ else {
+ let mut acc = one::<T>();
+ while exp > 0 {
+ if (exp & 1) == 1 {
+ acc = acc * base;
+ }
+ base = base * base;
+ exp = exp >> 1;
+ }
+ acc
+ }
+}
+
+/// Numbers which have upper and lower bounds
+pub trait Bounded {
+ // FIXME (#5527): These should be associated constants
+ /// returns the smallest finite number this type can represent
+ fn min_value() -> Self;
+ /// returns the largest finite number this type can represent
+ fn max_value() -> Self;
+}
+
+/// Numbers with a fixed binary representation.
+pub trait Bitwise: Bounded
+ + Not<Self>
+ + BitAnd<Self,Self>
+ + BitOr<Self,Self>
+ + BitXor<Self,Self>
+ + Shl<Self,Self>
+ + Shr<Self,Self> {
+ /// Returns the number of ones in the binary representation of the number.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// use std::num::Bitwise;
+ ///
+ /// let n = 0b01001100u8;
+ /// assert_eq!(n.count_ones(), 3);
+ /// ```
+ fn count_ones(&self) -> Self;
+
+ /// Returns the number of zeros in the binary representation of the number.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// use std::num::Bitwise;
+ ///
+ /// let n = 0b01001100u8;
+ /// assert_eq!(n.count_zeros(), 5);
+ /// ```
+ #[inline]
+ fn count_zeros(&self) -> Self {
+ (!*self).count_ones()
+ }
+
+ /// Returns the number of leading zeros in the in the binary representation
+ /// of the number.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// use std::num::Bitwise;
+ ///
+ /// let n = 0b0101000u16;
+ /// assert_eq!(n.leading_zeros(), 10);
+ /// ```
+ fn leading_zeros(&self) -> Self;
+
+ /// Returns the number of trailing zeros in the in the binary representation
+ /// of the number.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// use std::num::Bitwise;
+ ///
+ /// let n = 0b0101000u16;
+ /// assert_eq!(n.trailing_zeros(), 3);
+ /// ```
+ fn trailing_zeros(&self) -> Self;
+}
+
+/// Specifies the available operations common to all of Rust's core numeric primitives.
+/// These may not always make sense from a purely mathematical point of view, but
+/// may be useful for systems programming.
+pub trait Primitive: Copy
+ + Clone
+ + Num
+ + NumCast
+ + Ord
+ + Bounded {}
+
+/// A collection of traits relevant to primitive signed and unsigned integers
+pub trait Int: Primitive
+ + Bitwise
+ + CheckedAdd
+ + CheckedSub
+ + CheckedMul
+ + CheckedDiv {}
+
+/// Returns the smallest power of 2 greater than or equal to `n`.
+#[inline]
+pub fn next_power_of_two<T: Unsigned + Int>(n: T) -> T {
+ let halfbits: T = cast(size_of::<T>() * 4).unwrap();
+ let mut tmp: T = n - one();
+ let mut shift: T = one();
+ while shift <= halfbits {
+ tmp = tmp | (tmp >> shift);
+ shift = shift << one();
+ }
+ tmp + one()
+}
+
+// Returns `true` iff `n == 2^k` for some k.
+#[inline]
+pub fn is_power_of_two<T: Unsigned + Int>(n: T) -> bool {
+ (n - one()) & n == zero()
+}
+
+/// Returns the smallest power of 2 greater than or equal to `n`. If the next
+/// power of two is greater than the type's maximum value, `None` is returned,
+/// otherwise the power of 2 is wrapped in `Some`.
+#[inline]
+pub fn checked_next_power_of_two<T: Unsigned + Int>(n: T) -> Option<T> {
+ let halfbits: T = cast(size_of::<T>() * 4).unwrap();
+ let mut tmp: T = n - one();
+ let mut shift: T = one();
+ while shift <= halfbits {
+ tmp = tmp | (tmp >> shift);
+ shift = shift << one();
+ }
+ tmp.checked_add(&one())
+}
+
+/// A generic trait for converting a value to a number.
+pub trait ToPrimitive {
+ /// Converts the value of `self` to an `int`.
+ #[inline]
+ fn to_int(&self) -> Option<int> {
+ self.to_i64().and_then(|x| x.to_int())
+ }
+
+ /// Converts the value of `self` to an `i8`.
+ #[inline]
+ fn to_i8(&self) -> Option<i8> {
+ self.to_i64().and_then(|x| x.to_i8())
+ }
+
+ /// Converts the value of `self` to an `i16`.
+ #[inline]
+ fn to_i16(&self) -> Option<i16> {
+ self.to_i64().and_then(|x| x.to_i16())
+ }
+
+ /// Converts the value of `self` to an `i32`.
+ #[inline]
+ fn to_i32(&self) -> Option<i32> {
+ self.to_i64().and_then(|x| x.to_i32())
+ }
+
+ /// Converts the value of `self` to an `i64`.
+ fn to_i64(&self) -> Option<i64>;
+
+ /// Converts the value of `self` to an `uint`.
+ #[inline]
+ fn to_uint(&self) -> Option<uint> {
+ self.to_u64().and_then(|x| x.to_uint())
+ }
+
+ /// Converts the value of `self` to an `u8`.
+ #[inline]
+ fn to_u8(&self) -> Option<u8> {
+ self.to_u64().and_then(|x| x.to_u8())
+ }
+
+ /// Converts the value of `self` to an `u16`.
+ #[inline]
+ fn to_u16(&self) -> Option<u16> {
+ self.to_u64().and_then(|x| x.to_u16())
+ }
+
+ /// Converts the value of `self` to an `u32`.
+ #[inline]
+ fn to_u32(&self) -> Option<u32> {
+ self.to_u64().and_then(|x| x.to_u32())
+ }
+
+ /// Converts the value of `self` to an `u64`.
+ #[inline]
+ fn to_u64(&self) -> Option<u64>;
+
+ /// Converts the value of `self` to an `f32`.
+ #[inline]
+ fn to_f32(&self) -> Option<f32> {
+ self.to_f64().and_then(|x| x.to_f32())
+ }
+
+ /// Converts the value of `self` to an `f64`.
+ #[inline]
+ fn to_f64(&self) -> Option<f64> {
+ self.to_i64().and_then(|x| x.to_f64())
+ }
+}
+
+macro_rules! impl_to_primitive_int_to_int(
+ ($SrcT:ty, $DstT:ty) => (
+ {
+ if size_of::<$SrcT>() <= size_of::<$DstT>() {
+ Some(*self as $DstT)
+ } else {
+ let n = *self as i64;
+ let min_value: $DstT = Bounded::min_value();
+ let max_value: $DstT = Bounded::max_value();
+ if min_value as i64 <= n && n <= max_value as i64 {
+ Some(*self as $DstT)
+ } else {
+ None
+ }
+ }
+ }
+ )
+)
+
+macro_rules! impl_to_primitive_int_to_uint(
+ ($SrcT:ty, $DstT:ty) => (
+ {
+ let zero: $SrcT = Zero::zero();
+ let max_value: $DstT = Bounded::max_value();
+ if zero <= *self && *self as u64 <= max_value as u64 {
+ Some(*self as $DstT)
+ } else {
+ None
+ }
+ }
+ )
+)
+
+macro_rules! impl_to_primitive_int(
+ ($T:ty) => (
+ impl ToPrimitive for $T {
+ #[inline]
+ fn to_int(&self) -> Option<int> { impl_to_primitive_int_to_int!($T, int) }
+ #[inline]
+ fn to_i8(&self) -> Option<i8> { impl_to_primitive_int_to_int!($T, i8) }
+ #[inline]
+ fn to_i16(&self) -> Option<i16> { impl_to_primitive_int_to_int!($T, i16) }
+ #[inline]
+ fn to_i32(&self) -> Option<i32> { impl_to_primitive_int_to_int!($T, i32) }
+ #[inline]
+ fn to_i64(&self) -> Option<i64> { impl_to_primitive_int_to_int!($T, i64) }
+
+ #[inline]
+ fn to_uint(&self) -> Option<uint> { impl_to_primitive_int_to_uint!($T, uint) }
+ #[inline]
+ fn to_u8(&self) -> Option<u8> { impl_to_primitive_int_to_uint!($T, u8) }
+ #[inline]
+ fn to_u16(&self) -> Option<u16> { impl_to_primitive_int_to_uint!($T, u16) }
+ #[inline]
+ fn to_u32(&self) -> Option<u32> { impl_to_primitive_int_to_uint!($T, u32) }
+ #[inline]
+ fn to_u64(&self) -> Option<u64> { impl_to_primitive_int_to_uint!($T, u64) }
+
+ #[inline]
+ fn to_f32(&self) -> Option<f32> { Some(*self as f32) }
+ #[inline]
+ fn to_f64(&self) -> Option<f64> { Some(*self as f64) }
+ }
+ )
+)
+
+impl_to_primitive_int!(int)
+impl_to_primitive_int!(i8)
+impl_to_primitive_int!(i16)
+impl_to_primitive_int!(i32)
+impl_to_primitive_int!(i64)
+
+macro_rules! impl_to_primitive_uint_to_int(
+ ($DstT:ty) => (
+ {
+ let max_value: $DstT = Bounded::max_value();
+ if *self as u64 <= max_value as u64 {
+ Some(*self as $DstT)
+ } else {
+ None
+ }
+ }
+ )
+)
+
+macro_rules! impl_to_primitive_uint_to_uint(
+ ($SrcT:ty, $DstT:ty) => (
+ {
+ if size_of::<$SrcT>() <= size_of::<$DstT>() {
+ Some(*self as $DstT)
+ } else {
+ let zero: $SrcT = Zero::zero();
+ let max_value: $DstT = Bounded::max_value();
+ if zero <= *self && *self as u64 <= max_value as u64 {
+ Some(*self as $DstT)
+ } else {
+ None
+ }
+ }
+ }
+ )
+)
+
+macro_rules! impl_to_primitive_uint(
+ ($T:ty) => (
+ impl ToPrimitive for $T {
+ #[inline]
+ fn to_int(&self) -> Option<int> { impl_to_primitive_uint_to_int!(int) }
+ #[inline]
+ fn to_i8(&self) -> Option<i8> { impl_to_primitive_uint_to_int!(i8) }
+ #[inline]
+ fn to_i16(&self) -> Option<i16> { impl_to_primitive_uint_to_int!(i16) }
+ #[inline]
+ fn to_i32(&self) -> Option<i32> { impl_to_primitive_uint_to_int!(i32) }
+ #[inline]
+ fn to_i64(&self) -> Option<i64> { impl_to_primitive_uint_to_int!(i64) }
+
+ #[inline]
+ fn to_uint(&self) -> Option<uint> { impl_to_primitive_uint_to_uint!($T, uint) }
+ #[inline]
+ fn to_u8(&self) -> Option<u8> { impl_to_primitive_uint_to_uint!($T, u8) }
+ #[inline]
+ fn to_u16(&self) -> Option<u16> { impl_to_primitive_uint_to_uint!($T, u16) }
+ #[inline]
+ fn to_u32(&self) -> Option<u32> { impl_to_primitive_uint_to_uint!($T, u32) }
+ #[inline]
+ fn to_u64(&self) -> Option<u64> { impl_to_primitive_uint_to_uint!($T, u64) }
+
+ #[inline]
+ fn to_f32(&self) -> Option<f32> { Some(*self as f32) }
+ #[inline]
+ fn to_f64(&self) -> Option<f64> { Some(*self as f64) }
+ }
+ )
+)
+
+impl_to_primitive_uint!(uint)
+impl_to_primitive_uint!(u8)
+impl_to_primitive_uint!(u16)
+impl_to_primitive_uint!(u32)
+impl_to_primitive_uint!(u64)
+
+macro_rules! impl_to_primitive_float_to_float(
+ ($SrcT:ty, $DstT:ty) => (
+ if size_of::<$SrcT>() <= size_of::<$DstT>() {
+ Some(*self as $DstT)
+ } else {
+ let n = *self as f64;
+ let max_value: $SrcT = Bounded::max_value();
+ if -max_value as f64 <= n && n <= max_value as f64 {
+ Some(*self as $DstT)
+ } else {
+ None
+ }
+ }
+ )
+)
+
+macro_rules! impl_to_primitive_float(
+ ($T:ty) => (
+ impl ToPrimitive for $T {
+ #[inline]
+ fn to_int(&self) -> Option<int> { Some(*self as int) }
+ #[inline]
+ fn to_i8(&self) -> Option<i8> { Some(*self as i8) }
+ #[inline]
+ fn to_i16(&self) -> Option<i16> { Some(*self as i16) }
+ #[inline]
+ fn to_i32(&self) -> Option<i32> { Some(*self as i32) }
+ #[inline]
+ fn to_i64(&self) -> Option<i64> { Some(*self as i64) }
+
+ #[inline]
+ fn to_uint(&self) -> Option<uint> { Some(*self as uint) }
+ #[inline]
+ fn to_u8(&self) -> Option<u8> { Some(*self as u8) }
+ #[inline]
+ fn to_u16(&self) -> Option<u16> { Some(*self as u16) }
+ #[inline]
+ fn to_u32(&self) -> Option<u32> { Some(*self as u32) }
+ #[inline]
+ fn to_u64(&self) -> Option<u64> { Some(*self as u64) }
+
+ #[inline]
+ fn to_f32(&self) -> Option<f32> { impl_to_primitive_float_to_float!($T, f32) }
+ #[inline]
+ fn to_f64(&self) -> Option<f64> { impl_to_primitive_float_to_float!($T, f64) }
+ }
+ )
+)
+
+impl_to_primitive_float!(f32)
+impl_to_primitive_float!(f64)
+
+/// A generic trait for converting a number to a value.
+pub trait FromPrimitive {
+ /// Convert an `int` to return an optional value of this type. If the
+ /// value cannot be represented by this value, the `None` is returned.
+ #[inline]
+ fn from_int(n: int) -> Option<Self> {
+ FromPrimitive::from_i64(n as i64)
+ }
+
+ /// Convert an `i8` to return an optional value of this type. If the
+ /// type cannot be represented by this value, the `None` is returned.
+ #[inline]
+ fn from_i8(n: i8) -> Option<Self> {
+ FromPrimitive::from_i64(n as i64)
+ }
+
+ /// Convert an `i16` to return an optional value of this type. If the
+ /// type cannot be represented by this value, the `None` is returned.
+ #[inline]
+ fn from_i16(n: i16) -> Option<Self> {
+ FromPrimitive::from_i64(n as i64)
+ }
+
+ /// Convert an `i32` to return an optional value of this type. If the
+ /// type cannot be represented by this value, the `None` is returned.
+ #[inline]
+ fn from_i32(n: i32) -> Option<Self> {
+ FromPrimitive::from_i64(n as i64)
+ }
+
+ /// Convert an `i64` to return an optional value of this type. If the
+ /// type cannot be represented by this value, the `None` is returned.
+ fn from_i64(n: i64) -> Option<Self>;
+
+ /// Convert an `uint` to return an optional value of this type. If the
+ /// type cannot be represented by this value, the `None` is returned.
+ #[inline]
+ fn from_uint(n: uint) -> Option<Self> {
+ FromPrimitive::from_u64(n as u64)
+ }
+
+ /// Convert an `u8` to return an optional value of this type. If the
+ /// type cannot be represented by this value, the `None` is returned.
+ #[inline]
+ fn from_u8(n: u8) -> Option<Self> {
+ FromPrimitive::from_u64(n as u64)
+ }
+
+ /// Convert an `u16` to return an optional value of this type. If the
+ /// type cannot be represented by this value, the `None` is returned.
+ #[inline]
+ fn from_u16(n: u16) -> Option<Self> {
+ FromPrimitive::from_u64(n as u64)
+ }
+
+ /// Convert an `u32` to return an optional value of this type. If the
+ /// type cannot be represented by this value, the `None` is returned.
+ #[inline]
+ fn from_u32(n: u32) -> Option<Self> {
+ FromPrimitive::from_u64(n as u64)
+ }
+
+ /// Convert an `u64` to return an optional value of this type. If the
+ /// type cannot be represented by this value, the `None` is returned.
+ fn from_u64(n: u64) -> Option<Self>;
+
+ /// Convert a `f32` to return an optional value of this type. If the
+ /// type cannot be represented by this value, the `None` is returned.
+ #[inline]
+ fn from_f32(n: f32) -> Option<Self> {
+ FromPrimitive::from_f64(n as f64)
+ }
+
+ /// Convert a `f64` to return an optional value of this type. If the
+ /// type cannot be represented by this value, the `None` is returned.
+ #[inline]
+ fn from_f64(n: f64) -> Option<Self> {
+ FromPrimitive::from_i64(n as i64)
+ }
+}
+
+/// A utility function that just calls `FromPrimitive::from_int`.
+pub fn from_int<A: FromPrimitive>(n: int) -> Option<A> {
+ FromPrimitive::from_int(n)
+}
+
+/// A utility function that just calls `FromPrimitive::from_i8`.
+pub fn from_i8<A: FromPrimitive>(n: i8) -> Option<A> {
+ FromPrimitive::from_i8(n)
+}
+
+/// A utility function that just calls `FromPrimitive::from_i16`.
+pub fn from_i16<A: FromPrimitive>(n: i16) -> Option<A> {
+ FromPrimitive::from_i16(n)
+}
+
+/// A utility function that just calls `FromPrimitive::from_i32`.
+pub fn from_i32<A: FromPrimitive>(n: i32) -> Option<A> {
+ FromPrimitive::from_i32(n)
+}
+
+/// A utility function that just calls `FromPrimitive::from_i64`.
+pub fn from_i64<A: FromPrimitive>(n: i64) -> Option<A> {
+ FromPrimitive::from_i64(n)
+}
+
+/// A utility function that just calls `FromPrimitive::from_uint`.
+pub fn from_uint<A: FromPrimitive>(n: uint) -> Option<A> {
+ FromPrimitive::from_uint(n)
+}
+
+/// A utility function that just calls `FromPrimitive::from_u8`.
+pub fn from_u8<A: FromPrimitive>(n: u8) -> Option<A> {
+ FromPrimitive::from_u8(n)
+}
+
+/// A utility function that just calls `FromPrimitive::from_u16`.
+pub fn from_u16<A: FromPrimitive>(n: u16) -> Option<A> {
+ FromPrimitive::from_u16(n)
+}
+
+/// A utility function that just calls `FromPrimitive::from_u32`.
+pub fn from_u32<A: FromPrimitive>(n: u32) -> Option<A> {
+ FromPrimitive::from_u32(n)
+}
+
+/// A utility function that just calls `FromPrimitive::from_u64`.
+pub fn from_u64<A: FromPrimitive>(n: u64) -> Option<A> {
+ FromPrimitive::from_u64(n)
+}
+
+/// A utility function that just calls `FromPrimitive::from_f32`.
+pub fn from_f32<A: FromPrimitive>(n: f32) -> Option<A> {
+ FromPrimitive::from_f32(n)
+}
+
+/// A utility function that just calls `FromPrimitive::from_f64`.
+pub fn from_f64<A: FromPrimitive>(n: f64) -> Option<A> {
+ FromPrimitive::from_f64(n)
+}
+
+macro_rules! impl_from_primitive(
+ ($T:ty, $to_ty:expr) => (
+ impl FromPrimitive for $T {
+ #[inline] fn from_int(n: int) -> Option<$T> { $to_ty }
+ #[inline] fn from_i8(n: i8) -> Option<$T> { $to_ty }
+ #[inline] fn from_i16(n: i16) -> Option<$T> { $to_ty }
+ #[inline] fn from_i32(n: i32) -> Option<$T> { $to_ty }
+ #[inline] fn from_i64(n: i64) -> Option<$T> { $to_ty }
+
+ #[inline] fn from_uint(n: uint) -> Option<$T> { $to_ty }
+ #[inline] fn from_u8(n: u8) -> Option<$T> { $to_ty }
+ #[inline] fn from_u16(n: u16) -> Option<$T> { $to_ty }
+ #[inline] fn from_u32(n: u32) -> Option<$T> { $to_ty }
+ #[inline] fn from_u64(n: u64) -> Option<$T> { $to_ty }
+
+ #[inline] fn from_f32(n: f32) -> Option<$T> { $to_ty }
+ #[inline] fn from_f64(n: f64) -> Option<$T> { $to_ty }
+ }
+ )
+)
+
+impl_from_primitive!(int, n.to_int())
+impl_from_primitive!(i8, n.to_i8())
+impl_from_primitive!(i16, n.to_i16())
+impl_from_primitive!(i32, n.to_i32())
+impl_from_primitive!(i64, n.to_i64())
+impl_from_primitive!(uint, n.to_uint())
+impl_from_primitive!(u8, n.to_u8())
+impl_from_primitive!(u16, n.to_u16())
+impl_from_primitive!(u32, n.to_u32())
+impl_from_primitive!(u64, n.to_u64())
+impl_from_primitive!(f32, n.to_f32())
+impl_from_primitive!(f64, n.to_f64())
+
+/// Cast from one machine scalar to another.
+///
+/// # Example
+///
+/// ```
+/// use std::num;
+///
+/// let twenty: f32 = num::cast(0x14).unwrap();
+/// assert_eq!(twenty, 20f32);
+/// ```
+///
+#[inline]
+pub fn cast<T: NumCast,U: NumCast>(n: T) -> Option<U> {
+ NumCast::from(n)
+}
+
+/// An interface for casting between machine scalars.
+pub trait NumCast: ToPrimitive {
+ /// Creates a number from another value that can be converted into a primitive via the
+ /// `ToPrimitive` trait.
+ fn from<T: ToPrimitive>(n: T) -> Option<Self>;
+}
+
+macro_rules! impl_num_cast(
+ ($T:ty, $conv:ident) => (
+ impl NumCast for $T {
+ #[inline]
+ fn from<N: ToPrimitive>(n: N) -> Option<$T> {
+ // `$conv` could be generated using `concat_idents!`, but that
+ // macro seems to be broken at the moment
+ n.$conv()
+ }
+ }
+ )
+)
+
+impl_num_cast!(u8, to_u8)
+impl_num_cast!(u16, to_u16)
+impl_num_cast!(u32, to_u32)
+impl_num_cast!(u64, to_u64)
+impl_num_cast!(uint, to_uint)
+impl_num_cast!(i8, to_i8)
+impl_num_cast!(i16, to_i16)
+impl_num_cast!(i32, to_i32)
+impl_num_cast!(i64, to_i64)
+impl_num_cast!(int, to_int)
+impl_num_cast!(f32, to_f32)
+impl_num_cast!(f64, to_f64)
+
+/// Saturating math operations
+pub trait Saturating {
+ /// Saturating addition operator.
+ /// Returns a+b, saturating at the numeric bounds instead of overflowing.
+ fn saturating_add(self, v: Self) -> Self;
+
+ /// Saturating subtraction operator.
+ /// Returns a-b, saturating at the numeric bounds instead of overflowing.
+ fn saturating_sub(self, v: Self) -> Self;
+}
+
+impl<T: CheckedAdd + CheckedSub + Zero + Ord + Bounded> Saturating for T {
+ #[inline]
+ fn saturating_add(self, v: T) -> T {
+ match self.checked_add(&v) {
+ Some(x) => x,
+ None => if v >= Zero::zero() {
+ Bounded::max_value()
+ } else {
+ Bounded::min_value()
+ }
+ }
+ }
+
+ #[inline]
+ fn saturating_sub(self, v: T) -> T {
+ match self.checked_sub(&v) {
+ Some(x) => x,
+ None => if v >= Zero::zero() {
+ Bounded::min_value()
+ } else {
+ Bounded::max_value()
+ }
+ }
+ }
+}
+
+/// Performs addition that returns `None` instead of wrapping around on overflow.
+pub trait CheckedAdd: Add<Self, Self> {
+ /// Adds two numbers, checking for overflow. If overflow happens, `None` is returned.
+ fn checked_add(&self, v: &Self) -> Option<Self>;
+}
+
+/// Performs subtraction that returns `None` instead of wrapping around on underflow.
+pub trait CheckedSub: Sub<Self, Self> {
+ /// Subtracts two numbers, checking for underflow. If underflow happens, `None` is returned.
+ fn checked_sub(&self, v: &Self) -> Option<Self>;
+}
+
+/// Performs multiplication that returns `None` instead of wrapping around on underflow or
+/// overflow.
+pub trait CheckedMul: Mul<Self, Self> {
+ /// Multiplies two numbers, checking for underflow or overflow. If underflow or overflow
+ /// happens, `None` is returned.
+ fn checked_mul(&self, v: &Self) -> Option<Self>;
+}
+
+/// Performs division that returns `None` instead of wrapping around on underflow or overflow.
+pub trait CheckedDiv: Div<Self, Self> {
+ /// Divides two numbers, checking for underflow or overflow. If underflow or overflow happens,
+ /// `None` is returned.
+ fn checked_div(&self, v: &Self) -> Option<Self>;
+}
+
+/// Helper function for testing numeric operations
+#[cfg(test)]
+pub fn test_num<T:Num + NumCast + ::std::fmt::Show>(ten: T, two: T) {
+ assert_eq!(ten.add(&two), cast(12).unwrap());
+ assert_eq!(ten.sub(&two), cast(8).unwrap());
+ assert_eq!(ten.mul(&two), cast(20).unwrap());
+ assert_eq!(ten.div(&two), cast(5).unwrap());
+ assert_eq!(ten.rem(&two), cast(0).unwrap());
+
+ assert_eq!(ten.add(&two), ten + two);
+ assert_eq!(ten.sub(&two), ten - two);
+ assert_eq!(ten.mul(&two), ten * two);
+ assert_eq!(ten.div(&two), ten / two);
+ assert_eq!(ten.rem(&two), ten % two);
+}
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Operations and constants for unsigned 16-bits integers (`u16` type)
+
+use default::Default;
+use intrinsics;
+use num::{Bitwise, Bounded, Zero, One, Unsigned, Num, Int, Primitive};
+use num::{CheckedAdd, CheckedSub, CheckedMul, CheckedDiv};
+use option::{Some, None, Option};
+
+#[cfg(not(test))]
+use cmp::{Eq, Ord, TotalEq, TotalOrd, Less, Greater, Equal, Ordering};
+#[cfg(not(test))]
+use ops::{Add, Sub, Mul, Div, Rem, Neg, BitAnd, BitOr, BitXor};
+#[cfg(not(test))]
+use ops::{Shl, Shr, Not};
+
+uint_module!(u16, i16, 16)
+
+impl CheckedAdd for u16 {
+ #[inline]
+ fn checked_add(&self, v: &u16) -> Option<u16> {
+ unsafe {
+ let (x, y) = intrinsics::u16_add_with_overflow(*self, *v);
+ if y { None } else { Some(x) }
+ }
+ }
+}
+
+impl CheckedSub for u16 {
+ #[inline]
+ fn checked_sub(&self, v: &u16) -> Option<u16> {
+ unsafe {
+ let (x, y) = intrinsics::u16_sub_with_overflow(*self, *v);
+ if y { None } else { Some(x) }
+ }
+ }
+}
+
+impl CheckedMul for u16 {
+ #[inline]
+ fn checked_mul(&self, v: &u16) -> Option<u16> {
+ unsafe {
+ let (x, y) = intrinsics::u16_mul_with_overflow(*self, *v);
+ if y { None } else { Some(x) }
+ }
+ }
+}
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Operations and constants for unsigned 32-bits integers (`u32` type)
+
+use default::Default;
+use intrinsics;
+use num::{Bitwise, Bounded, Zero, One, Unsigned, Num, Int, Primitive};
+use num::{CheckedAdd, CheckedSub, CheckedMul, CheckedDiv};
+use option::{Some, None, Option};
+
+#[cfg(not(test))]
+use cmp::{Eq, Ord, TotalEq, TotalOrd, Less, Greater, Equal, Ordering};
+#[cfg(not(test))]
+use ops::{Add, Sub, Mul, Div, Rem, Neg, BitAnd, BitOr, BitXor};
+#[cfg(not(test))]
+use ops::{Shl, Shr, Not};
+
+uint_module!(u32, i32, 32)
+
+impl CheckedAdd for u32 {
+ #[inline]
+ fn checked_add(&self, v: &u32) -> Option<u32> {
+ unsafe {
+ let (x, y) = intrinsics::u32_add_with_overflow(*self, *v);
+ if y { None } else { Some(x) }
+ }
+ }
+}
+
+impl CheckedSub for u32 {
+ #[inline]
+ fn checked_sub(&self, v: &u32) -> Option<u32> {
+ unsafe {
+ let (x, y) = intrinsics::u32_sub_with_overflow(*self, *v);
+ if y { None } else { Some(x) }
+ }
+ }
+}
+
+impl CheckedMul for u32 {
+ #[inline]
+ fn checked_mul(&self, v: &u32) -> Option<u32> {
+ unsafe {
+ let (x, y) = intrinsics::u32_mul_with_overflow(*self, *v);
+ if y { None } else { Some(x) }
+ }
+ }
+}
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Operations and constants for unsigned 64-bits integer (`u64` type)
+
+use default::Default;
+use intrinsics;
+use num::{Bitwise, Bounded, Zero, One, Unsigned, Num, Int, Primitive};
+use num::{CheckedAdd, CheckedSub, CheckedMul, CheckedDiv};
+use option::{Some, None, Option};
+
+#[cfg(not(test))]
+use cmp::{Eq, Ord, TotalEq, TotalOrd, Less, Greater, Equal, Ordering};
+#[cfg(not(test))]
+use ops::{Add, Sub, Mul, Div, Rem, Neg, BitAnd, BitOr, BitXor};
+#[cfg(not(test))]
+use ops::{Shl, Shr, Not};
+
+uint_module!(u64, i64, 64)
+
+impl CheckedAdd for u64 {
+ #[inline]
+ fn checked_add(&self, v: &u64) -> Option<u64> {
+ unsafe {
+ let (x, y) = intrinsics::u64_add_with_overflow(*self, *v);
+ if y { None } else { Some(x) }
+ }
+ }
+}
+
+impl CheckedSub for u64 {
+ #[inline]
+ fn checked_sub(&self, v: &u64) -> Option<u64> {
+ unsafe {
+ let (x, y) = intrinsics::u64_sub_with_overflow(*self, *v);
+ if y { None } else { Some(x) }
+ }
+ }
+}
+
+impl CheckedMul for u64 {
+ #[inline]
+ fn checked_mul(&self, v: &u64) -> Option<u64> {
+ unsafe {
+ let (x, y) = intrinsics::u64_mul_with_overflow(*self, *v);
+ if y { None } else { Some(x) }
+ }
+ }
+}
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Operations and constants for unsigned 8-bits integers (`u8` type)
+
+use default::Default;
+use intrinsics;
+use num::{Bitwise, Bounded, Zero, One, Unsigned, Num, Int, Primitive};
+use num::{CheckedAdd, CheckedSub, CheckedMul, CheckedDiv};
+use option::{Some, None, Option};
+
+#[cfg(not(test))]
+use cmp::{Eq, Ord, TotalEq, TotalOrd, Less, Greater, Equal, Ordering};
+#[cfg(not(test))]
+use ops::{Add, Sub, Mul, Div, Rem, Neg, BitAnd, BitOr, BitXor};
+#[cfg(not(test))]
+use ops::{Shl, Shr, Not};
+
+uint_module!(u8, i8, 8)
+
+impl CheckedAdd for u8 {
+ #[inline]
+ fn checked_add(&self, v: &u8) -> Option<u8> {
+ unsafe {
+ let (x, y) = intrinsics::u8_add_with_overflow(*self, *v);
+ if y { None } else { Some(x) }
+ }
+ }
+}
+
+impl CheckedSub for u8 {
+ #[inline]
+ fn checked_sub(&self, v: &u8) -> Option<u8> {
+ unsafe {
+ let (x, y) = intrinsics::u8_sub_with_overflow(*self, *v);
+ if y { None } else { Some(x) }
+ }
+ }
+}
+
+impl CheckedMul for u8 {
+ #[inline]
+ fn checked_mul(&self, v: &u8) -> Option<u8> {
+ unsafe {
+ let (x, y) = intrinsics::u8_mul_with_overflow(*self, *v);
+ if y { None } else { Some(x) }
+ }
+ }
+}
--- /dev/null
+// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Operations and constants for architecture-sized unsigned integers (`uint` type)
+
+use default::Default;
+use intrinsics;
+use num::{Bitwise, Bounded, Zero, One, Unsigned, Num, Int, Primitive};
+use num::{CheckedAdd, CheckedSub, CheckedMul, CheckedDiv};
+use option::{Some, None, Option};
+
+#[cfg(not(test))]
+use cmp::{Eq, Ord, TotalEq, TotalOrd, Less, Greater, Equal, Ordering};
+#[cfg(not(test))]
+use ops::{Add, Sub, Mul, Div, Rem, Neg, BitAnd, BitOr, BitXor};
+#[cfg(not(test))]
+use ops::{Shl, Shr, Not};
+
+uint_module!(uint, int, ::int::BITS)
+
+#[cfg(target_word_size = "32")]
+impl CheckedAdd for uint {
+ #[inline]
+ fn checked_add(&self, v: &uint) -> Option<uint> {
+ unsafe {
+ let (x, y) = intrinsics::u32_add_with_overflow(*self as u32, *v as u32);
+ if y { None } else { Some(x as uint) }
+ }
+ }
+}
+
+#[cfg(target_word_size = "64")]
+impl CheckedAdd for uint {
+ #[inline]
+ fn checked_add(&self, v: &uint) -> Option<uint> {
+ unsafe {
+ let (x, y) = intrinsics::u64_add_with_overflow(*self as u64, *v as u64);
+ if y { None } else { Some(x as uint) }
+ }
+ }
+}
+
+#[cfg(target_word_size = "32")]
+impl CheckedSub for uint {
+ #[inline]
+ fn checked_sub(&self, v: &uint) -> Option<uint> {
+ unsafe {
+ let (x, y) = intrinsics::u32_sub_with_overflow(*self as u32, *v as u32);
+ if y { None } else { Some(x as uint) }
+ }
+ }
+}
+
+#[cfg(target_word_size = "64")]
+impl CheckedSub for uint {
+ #[inline]
+ fn checked_sub(&self, v: &uint) -> Option<uint> {
+ unsafe {
+ let (x, y) = intrinsics::u64_sub_with_overflow(*self as u64, *v as u64);
+ if y { None } else { Some(x as uint) }
+ }
+ }
+}
+
+#[cfg(target_word_size = "32")]
+impl CheckedMul for uint {
+ #[inline]
+ fn checked_mul(&self, v: &uint) -> Option<uint> {
+ unsafe {
+ let (x, y) = intrinsics::u32_mul_with_overflow(*self as u32, *v as u32);
+ if y { None } else { Some(x as uint) }
+ }
+ }
+}
+
+#[cfg(target_word_size = "64")]
+impl CheckedMul for uint {
+ #[inline]
+ fn checked_mul(&self, v: &uint) -> Option<uint> {
+ unsafe {
+ let (x, y) = intrinsics::u64_mul_with_overflow(*self as u64, *v as u64);
+ if y { None } else { Some(x as uint) }
+ }
+ }
+}
--- /dev/null
+// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![macro_escape]
+#![doc(hidden)]
+
+macro_rules! uint_module (($T:ty, $T_SIGNED:ty, $bits:expr) => (
+
+pub static BITS : uint = $bits;
+pub static BYTES : uint = ($bits / 8);
+
+pub static MIN: $T = 0 as $T;
+pub static MAX: $T = 0 as $T - 1 as $T;
+
+#[cfg(not(test))]
+impl Ord for $T {
+ #[inline]
+ fn lt(&self, other: &$T) -> bool { *self < *other }
+}
+#[cfg(not(test))]
+impl TotalEq for $T {}
+#[cfg(not(test))]
+impl Eq for $T {
+ #[inline]
+ fn eq(&self, other: &$T) -> bool { *self == *other }
+}
+#[cfg(not(test))]
+impl TotalOrd for $T {
+ #[inline]
+ fn cmp(&self, other: &$T) -> Ordering {
+ if *self < *other { Less }
+ else if *self > *other { Greater }
+ else { Equal }
+ }
+}
+
+impl Num for $T {}
+
+impl Zero for $T {
+ #[inline]
+ fn zero() -> $T { 0 }
+
+ #[inline]
+ fn is_zero(&self) -> bool { *self == 0 }
+}
+
+impl One for $T {
+ #[inline]
+ fn one() -> $T { 1 }
+}
+
+#[cfg(not(test))]
+impl Add<$T,$T> for $T {
+ #[inline]
+ fn add(&self, other: &$T) -> $T { *self + *other }
+}
+
+#[cfg(not(test))]
+impl Sub<$T,$T> for $T {
+ #[inline]
+ fn sub(&self, other: &$T) -> $T { *self - *other }
+}
+
+#[cfg(not(test))]
+impl Mul<$T,$T> for $T {
+ #[inline]
+ fn mul(&self, other: &$T) -> $T { *self * *other }
+}
+
+#[cfg(not(test))]
+impl Div<$T,$T> for $T {
+ #[inline]
+ fn div(&self, other: &$T) -> $T { *self / *other }
+}
+
+#[cfg(not(test))]
+impl Rem<$T,$T> for $T {
+ #[inline]
+ fn rem(&self, other: &$T) -> $T { *self % *other }
+}
+
+#[cfg(not(test))]
+impl Neg<$T> for $T {
+ #[inline]
+ fn neg(&self) -> $T { -(*self as $T_SIGNED) as $T }
+}
+
+impl Unsigned for $T {}
+
+#[cfg(not(test))]
+impl BitOr<$T,$T> for $T {
+ #[inline]
+ fn bitor(&self, other: &$T) -> $T { *self | *other }
+}
+
+#[cfg(not(test))]
+impl BitAnd<$T,$T> for $T {
+ #[inline]
+ fn bitand(&self, other: &$T) -> $T { *self & *other }
+}
+
+#[cfg(not(test))]
+impl BitXor<$T,$T> for $T {
+ #[inline]
+ fn bitxor(&self, other: &$T) -> $T { *self ^ *other }
+}
+
+#[cfg(not(test))]
+impl Shl<$T,$T> for $T {
+ #[inline]
+ fn shl(&self, other: &$T) -> $T { *self << *other }
+}
+
+#[cfg(not(test))]
+impl Shr<$T,$T> for $T {
+ #[inline]
+ fn shr(&self, other: &$T) -> $T { *self >> *other }
+}
+
+#[cfg(not(test))]
+impl Not<$T> for $T {
+ #[inline]
+ fn not(&self) -> $T { !*self }
+}
+
+impl Bounded for $T {
+ #[inline]
+ fn min_value() -> $T { MIN }
+
+ #[inline]
+ fn max_value() -> $T { MAX }
+}
+
+impl Bitwise for $T {
+ /// Returns the number of ones in the binary representation of the number.
+ #[inline]
+ fn count_ones(&self) -> $T {
+ (*self as $T_SIGNED).count_ones() as $T
+ }
+
+ /// Returns the number of leading zeros in the in the binary representation
+ /// of the number.
+ #[inline]
+ fn leading_zeros(&self) -> $T {
+ (*self as $T_SIGNED).leading_zeros() as $T
+ }
+
+ /// Returns the number of trailing zeros in the in the binary representation
+ /// of the number.
+ #[inline]
+ fn trailing_zeros(&self) -> $T {
+ (*self as $T_SIGNED).trailing_zeros() as $T
+ }
+}
+
+impl CheckedDiv for $T {
+ #[inline]
+ fn checked_div(&self, v: &$T) -> Option<$T> {
+ if *v == 0 {
+ None
+ } else {
+ Some(self / *v)
+ }
+ }
+}
+
+impl Int for $T {}
+
+impl Primitive for $T {}
+
+impl Default for $T {
+ #[inline]
+ fn default() -> $T { 0 }
+}
+
+#[cfg(test)]
+mod tests {
+ use prelude::*;
+ use super::*;
+
+ use num;
+ use num::CheckedDiv;
+ use num::Bitwise;
+
+ #[test]
+ fn test_overflows() {
+ assert!(MAX > 0);
+ assert!(MIN <= 0);
+ assert!(MIN + MAX + 1 == 0);
+ }
+
+ #[test]
+ fn test_num() {
+ num::test_num(10 as $T, 2 as $T);
+ }
+
+ #[test]
+ fn test_bitwise() {
+ assert!(0b1110 as $T == (0b1100 as $T).bitor(&(0b1010 as $T)));
+ assert!(0b1000 as $T == (0b1100 as $T).bitand(&(0b1010 as $T)));
+ assert!(0b0110 as $T == (0b1100 as $T).bitxor(&(0b1010 as $T)));
+ assert!(0b1110 as $T == (0b0111 as $T).shl(&(1 as $T)));
+ assert!(0b0111 as $T == (0b1110 as $T).shr(&(1 as $T)));
+ assert!(MAX - (0b1011 as $T) == (0b1011 as $T).not());
+ }
+
+ #[test]
+ fn test_count_ones() {
+ assert!((0b0101100 as $T).count_ones() == 3);
+ assert!((0b0100001 as $T).count_ones() == 2);
+ assert!((0b1111001 as $T).count_ones() == 5);
+ }
+
+ #[test]
+ fn test_count_zeros() {
+ assert!((0b0101100 as $T).count_zeros() == BITS as $T - 3);
+ assert!((0b0100001 as $T).count_zeros() == BITS as $T - 2);
+ assert!((0b1111001 as $T).count_zeros() == BITS as $T - 5);
+ }
+
+ #[test]
+ fn test_unsigned_checked_div() {
+ assert!(10u.checked_div(&2) == Some(5));
+ assert!(5u.checked_div(&0) == None);
+ }
+}
+
+))
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+/*!
+ *
+ * Traits representing built-in operators, useful for overloading
+ *
+ * Implementing these traits allows you to get an effect similar to
+ * overloading operators.
+ *
+ * The values for the right hand side of an operator are automatically
+ * borrowed, so `a + b` is sugar for `a.add(&b)`.
+ *
+ * All of these traits are imported by the prelude, so they are available in
+ * every Rust program.
+ *
+ * # Example
+ *
+ * This example creates a `Point` struct that implements `Add` and `Sub`, and then
+ * demonstrates adding and subtracting two `Point`s.
+ *
+ * ```rust
+ * struct Point {
+ * x: int,
+ * y: int
+ * }
+ *
+ * impl Add<Point, Point> for Point {
+ * fn add(&self, other: &Point) -> Point {
+ * Point {x: self.x + other.x, y: self.y + other.y}
+ * }
+ * }
+ *
+ * impl Sub<Point, Point> for Point {
+ * fn sub(&self, other: &Point) -> Point {
+ * Point {x: self.x - other.x, y: self.y - other.y}
+ * }
+ * }
+ * fn main() {
+ * println!("{:?}", Point {x: 1, y: 0} + Point {x: 2, y: 3});
+ * println!("{:?}", Point {x: 1, y: 0} - Point {x: 2, y: 3});
+ * }
+ * ```
+ *
+ * See the documentation for each trait for a minimum implementation that prints
+ * something to the screen.
+ *
+ */
+
+/**
+ *
+ * The `Drop` trait is used to run some code when a value goes out of scope. This
+ * is sometimes called a 'destructor'.
+ *
+ * # Example
+ *
+ * A trivial implementation of `Drop`. The `drop` method is called when `_x` goes
+ * out of scope, and therefore `main` prints `Dropping!`.
+ *
+ * ```rust
+ * struct HasDrop;
+ *
+ * impl Drop for HasDrop {
+ * fn drop(&mut self) {
+ * println!("Dropping!");
+ * }
+ * }
+ *
+ * fn main() {
+ * let _x = HasDrop;
+ * }
+ * ```
+ */
+#[lang="drop"]
+pub trait Drop {
+ /// The `drop` method, called when the value goes out of scope.
+ fn drop(&mut self);
+}
+
+/**
+ *
+ * The `Add` trait is used to specify the functionality of `+`.
+ *
+ * # Example
+ *
+ * A trivial implementation of `Add`. When `Foo + Foo` happens, it ends up
+ * calling `add`, and therefore, `main` prints `Adding!`.
+ *
+ * ```rust
+ * struct Foo;
+ *
+ * impl Add<Foo, Foo> for Foo {
+ * fn add(&self, _rhs: &Foo) -> Foo {
+ * println!("Adding!");
+ * *self
+ * }
+ * }
+ *
+ * fn main() {
+ * Foo + Foo;
+ * }
+ * ```
+ */
+#[lang="add"]
+pub trait Add<RHS,Result> {
+ /// The method for the `+` operator
+ fn add(&self, rhs: &RHS) -> Result;
+}
+
+/**
+ *
+ * The `Sub` trait is used to specify the functionality of `-`.
+ *
+ * # Example
+ *
+ * A trivial implementation of `Sub`. When `Foo - Foo` happens, it ends up
+ * calling `sub`, and therefore, `main` prints `Subtracting!`.
+ *
+ * ```rust
+ * struct Foo;
+ *
+ * impl Sub<Foo, Foo> for Foo {
+ * fn sub(&self, _rhs: &Foo) -> Foo {
+ * println!("Subtracting!");
+ * *self
+ * }
+ * }
+ *
+ * fn main() {
+ * Foo - Foo;
+ * }
+ * ```
+ */
+#[lang="sub"]
+pub trait Sub<RHS,Result> {
+ /// The method for the `-` operator
+ fn sub(&self, rhs: &RHS) -> Result;
+}
+
+/**
+ *
+ * The `Mul` trait is used to specify the functionality of `*`.
+ *
+ * # Example
+ *
+ * A trivial implementation of `Mul`. When `Foo * Foo` happens, it ends up
+ * calling `mul`, and therefore, `main` prints `Multiplying!`.
+ *
+ * ```rust
+ * struct Foo;
+ *
+ * impl Mul<Foo, Foo> for Foo {
+ * fn mul(&self, _rhs: &Foo) -> Foo {
+ * println!("Multiplying!");
+ * *self
+ * }
+ * }
+ *
+ * fn main() {
+ * Foo * Foo;
+ * }
+ * ```
+ */
+#[lang="mul"]
+pub trait Mul<RHS,Result> {
+ /// The method for the `*` operator
+ fn mul(&self, rhs: &RHS) -> Result;
+}
+
+/**
+ *
+ * The `Div` trait is used to specify the functionality of `/`.
+ *
+ * # Example
+ *
+ * A trivial implementation of `Div`. When `Foo / Foo` happens, it ends up
+ * calling `div`, and therefore, `main` prints `Dividing!`.
+ *
+ * ```
+ * struct Foo;
+ *
+ * impl Div<Foo, Foo> for Foo {
+ * fn div(&self, _rhs: &Foo) -> Foo {
+ * println!("Dividing!");
+ * *self
+ * }
+ * }
+ *
+ * fn main() {
+ * Foo / Foo;
+ * }
+ * ```
+ */
+#[lang="div"]
+pub trait Div<RHS,Result> {
+ /// The method for the `/` operator
+ fn div(&self, rhs: &RHS) -> Result;
+}
+
+/**
+ *
+ * The `Rem` trait is used to specify the functionality of `%`.
+ *
+ * # Example
+ *
+ * A trivial implementation of `Rem`. When `Foo % Foo` happens, it ends up
+ * calling `rem`, and therefore, `main` prints `Remainder-ing!`.
+ *
+ * ```
+ * struct Foo;
+ *
+ * impl Rem<Foo, Foo> for Foo {
+ * fn rem(&self, _rhs: &Foo) -> Foo {
+ * println!("Remainder-ing!");
+ * *self
+ * }
+ * }
+ *
+ * fn main() {
+ * Foo % Foo;
+ * }
+ * ```
+ */
+#[lang="rem"]
+pub trait Rem<RHS,Result> {
+ /// The method for the `%` operator
+ fn rem(&self, rhs: &RHS) -> Result;
+}
+
+/**
+ *
+ * The `Neg` trait is used to specify the functionality of unary `-`.
+ *
+ * # Example
+ *
+ * A trivial implementation of `Neg`. When `-Foo` happens, it ends up calling
+ * `neg`, and therefore, `main` prints `Negating!`.
+ *
+ * ```
+ * struct Foo;
+ *
+ * impl Neg<Foo> for Foo {
+ * fn neg(&self) -> Foo {
+ * println!("Negating!");
+ * *self
+ * }
+ * }
+ *
+ * fn main() {
+ * -Foo;
+ * }
+ * ```
+ */
+#[lang="neg"]
+pub trait Neg<Result> {
+ /// The method for the unary `-` operator
+ fn neg(&self) -> Result;
+}
+
+/**
+ *
+ * The `Not` trait is used to specify the functionality of unary `!`.
+ *
+ * # Example
+ *
+ * A trivial implementation of `Not`. When `!Foo` happens, it ends up calling
+ * `not`, and therefore, `main` prints `Not-ing!`.
+ *
+ * ```
+ * struct Foo;
+ *
+ * impl Not<Foo> for Foo {
+ * fn not(&self) -> Foo {
+ * println!("Not-ing!");
+ * *self
+ * }
+ * }
+ *
+ * fn main() {
+ * !Foo;
+ * }
+ * ```
+ */
+#[lang="not"]
+pub trait Not<Result> {
+ /// The method for the unary `!` operator
+ fn not(&self) -> Result;
+}
+
+/**
+ *
+ * The `BitAnd` trait is used to specify the functionality of `&`.
+ *
+ * # Example
+ *
+ * A trivial implementation of `BitAnd`. When `Foo & Foo` happens, it ends up
+ * calling `bitand`, and therefore, `main` prints `Bitwise And-ing!`.
+ *
+ * ```
+ * struct Foo;
+ *
+ * impl BitAnd<Foo, Foo> for Foo {
+ * fn bitand(&self, _rhs: &Foo) -> Foo {
+ * println!("Bitwise And-ing!");
+ * *self
+ * }
+ * }
+ *
+ * fn main() {
+ * Foo & Foo;
+ * }
+ * ```
+ */
+#[lang="bitand"]
+pub trait BitAnd<RHS,Result> {
+ /// The method for the `&` operator
+ fn bitand(&self, rhs: &RHS) -> Result;
+}
+
+/**
+ *
+ * The `BitOr` trait is used to specify the functionality of `|`.
+ *
+ * # Example
+ *
+ * A trivial implementation of `BitOr`. When `Foo | Foo` happens, it ends up
+ * calling `bitor`, and therefore, `main` prints `Bitwise Or-ing!`.
+ *
+ * ```
+ * struct Foo;
+ *
+ * impl BitOr<Foo, Foo> for Foo {
+ * fn bitor(&self, _rhs: &Foo) -> Foo {
+ * println!("Bitwise Or-ing!");
+ * *self
+ * }
+ * }
+ *
+ * fn main() {
+ * Foo | Foo;
+ * }
+ * ```
+ */
+#[lang="bitor"]
+pub trait BitOr<RHS,Result> {
+ /// The method for the `|` operator
+ fn bitor(&self, rhs: &RHS) -> Result;
+}
+
+/**
+ *
+ * The `BitXor` trait is used to specify the functionality of `^`.
+ *
+ * # Example
+ *
+ * A trivial implementation of `BitXor`. When `Foo ^ Foo` happens, it ends up
+ * calling `bitxor`, and therefore, `main` prints `Bitwise Xor-ing!`.
+ *
+ * ```
+ * struct Foo;
+ *
+ * impl BitXor<Foo, Foo> for Foo {
+ * fn bitxor(&self, _rhs: &Foo) -> Foo {
+ * println!("Bitwise Xor-ing!");
+ * *self
+ * }
+ * }
+ *
+ * fn main() {
+ * Foo ^ Foo;
+ * }
+ * ```
+ */
+#[lang="bitxor"]
+pub trait BitXor<RHS,Result> {
+ /// The method for the `^` operator
+ fn bitxor(&self, rhs: &RHS) -> Result;
+}
+
+/**
+ *
+ * The `Shl` trait is used to specify the functionality of `<<`.
+ *
+ * # Example
+ *
+ * A trivial implementation of `Shl`. When `Foo << Foo` happens, it ends up
+ * calling `shl`, and therefore, `main` prints `Shifting left!`.
+ *
+ * ```
+ * struct Foo;
+ *
+ * impl Shl<Foo, Foo> for Foo {
+ * fn shl(&self, _rhs: &Foo) -> Foo {
+ * println!("Shifting left!");
+ * *self
+ * }
+ * }
+ *
+ * fn main() {
+ * Foo << Foo;
+ * }
+ * ```
+ */
+#[lang="shl"]
+pub trait Shl<RHS,Result> {
+ /// The method for the `<<` operator
+ fn shl(&self, rhs: &RHS) -> Result;
+}
+
+/**
+ *
+ * The `Shr` trait is used to specify the functionality of `>>`.
+ *
+ * # Example
+ *
+ * A trivial implementation of `Shr`. When `Foo >> Foo` happens, it ends up
+ * calling `shr`, and therefore, `main` prints `Shifting right!`.
+ *
+ * ```
+ * struct Foo;
+ *
+ * impl Shr<Foo, Foo> for Foo {
+ * fn shr(&self, _rhs: &Foo) -> Foo {
+ * println!("Shifting right!");
+ * *self
+ * }
+ * }
+ *
+ * fn main() {
+ * Foo >> Foo;
+ * }
+ * ```
+ */
+#[lang="shr"]
+pub trait Shr<RHS,Result> {
+ /// The method for the `>>` operator
+ fn shr(&self, rhs: &RHS) -> Result;
+}
+
+/**
+ *
+ * The `Index` trait is used to specify the functionality of indexing operations
+ * like `arr[idx]`.
+ *
+ * # Example
+ *
+ * A trivial implementation of `Index`. When `Foo[Foo]` happens, it ends up
+ * calling `index`, and therefore, `main` prints `Indexing!`.
+ *
+ * ```
+ * struct Foo;
+ *
+ * impl Index<Foo, Foo> for Foo {
+ * fn index(&self, _rhs: &Foo) -> Foo {
+ * println!("Indexing!");
+ * *self
+ * }
+ * }
+ *
+ * fn main() {
+ * Foo[Foo];
+ * }
+ * ```
+ */
+#[lang="index"]
+pub trait Index<Index,Result> {
+ /// The method for the indexing (`Foo[Bar]`) operation
+ fn index(&self, index: &Index) -> Result;
+}
+
+/**
+ *
+ * The `Deref` trait is used to specify the functionality of dereferencing
+ * operations like `*v`.
+ *
+ * # Example
+ *
+ * A struct with a single field which is accessible via dereferencing the
+ * struct.
+ *
+ * ```
+ * struct DerefExample<T> {
+ * value: T
+ * }
+ *
+ * impl<T> Deref<T> for DerefExample<T> {
+ * fn deref<'a>(&'a self) -> &'a T {
+ * &self.value
+ * }
+ * }
+ *
+ * fn main() {
+ * let x = DerefExample { value: 'a' };
+ * assert_eq!('a', *x);
+ * }
+ * ```
+ */
+#[lang="deref"]
+pub trait Deref<Result> {
+ /// The method called to dereference a value
+ fn deref<'a>(&'a self) -> &'a Result;
+}
+
+/**
+ *
+ * The `DerefMut` trait is used to specify the functionality of dereferencing
+ * mutably like `*v = 1;`
+ *
+ * # Example
+ *
+ * A struct with a single field which is modifiable via dereferencing the
+ * struct.
+ *
+ * ```
+ * struct DerefMutExample<T> {
+ * value: T
+ * }
+ *
+ * impl<T> Deref<T> for DerefMutExample<T> {
+ * fn deref<'a>(&'a self) -> &'a T {
+ * &self.value
+ * }
+ * }
+ *
+ * impl<T> DerefMut<T> for DerefMutExample<T> {
+ * fn deref_mut<'a>(&'a mut self) -> &'a mut T {
+ * &mut self.value
+ * }
+ * }
+ *
+ * fn main() {
+ * let mut x = DerefMutExample { value: 'a' };
+ * *x = 'b';
+ * assert_eq!('b', *x);
+ * }
+ * ```
+ */
+#[lang="deref_mut"]
+pub trait DerefMut<Result>: Deref<Result> {
+ /// The method called to mutably dereference a value
+ fn deref_mut<'a>(&'a mut self) -> &'a mut Result;
+}
+
+#[cfg(test)]
+mod bench {
+ extern crate test;
+ use self::test::Bencher;
+ use ops::Drop;
+
+ // Overhead of dtors
+
+ struct HasDtor {
+ x: int
+ }
+
+ impl Drop for HasDtor {
+ fn drop(&mut self) {
+ }
+ }
+
+ #[bench]
+ fn alloc_obj_with_dtor(b: &mut Bencher) {
+ b.iter(|| {
+ HasDtor { x : 10 };
+ })
+ }
+}
--- /dev/null
+// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Optional values
+//!
+//! Type `Option` represents an optional value: every `Option`
+//! is either `Some` and contains a value, or `None`, and
+//! does not. `Option` types are very common in Rust code, as
+//! they have a number of uses:
+//!
+//! * Initial values
+//! * Return values for functions that are not defined
+//! over their entire input range (partial functions)
+//! * Return value for otherwise reporting simple errors, where `None` is
+//! returned on error
+//! * Optional struct fields
+//! * Struct fields that can be loaned or "taken"
+//! * Optional function arguments
+//! * Nullable pointers
+//! * Swapping things out of difficult situations
+//!
+//! Options are commonly paired with pattern matching to query the presence
+//! of a value and take action, always accounting for the `None` case.
+//!
+//! ```
+//! # // FIXME This is not the greatest first example
+//! // cow_says contains the word "moo"
+//! let cow_says = Some("moo");
+//! // dog_says does not contain a value
+//! let dog_says: Option<&str> = None;
+//!
+//! // Pattern match to retrieve the value
+//! match (cow_says, dog_says) {
+//! (Some(cow_words), Some(dog_words)) => {
+//! println!("Cow says {} and dog says {}!", cow_words, dog_words);
+//! }
+//! (Some(cow_words), None) => println!("Cow says {}", cow_words),
+//! (None, Some(dog_words)) => println!("Dog says {}", dog_words),
+//! (None, None) => println!("Cow and dog are suspiciously silent")
+//! }
+//! ```
+//!
+//
+// FIXME: Show how `Option` is used in practice, with lots of methods
+//
+//! # Options and pointers ("nullable" pointers)
+//!
+//! Rust's pointer types must always point to a valid location; there are
+//! no "null" pointers. Instead, Rust has *optional* pointers, like
+//! the optional owned box, `Option<Box<T>>`.
+//!
+//! The following example uses `Option` to create an optional box of
+//! `int`. Notice that in order to use the inner `int` value first the
+//! `check_optional` function needs to use pattern matching to
+//! determine whether the box has a value (i.e. it is `Some(...)`) or
+//! not (`None`).
+//!
+//! ```
+//! let optional: Option<Box<int>> = None;
+//! check_optional(&optional);
+//!
+//! let optional: Option<Box<int>> = Some(box 9000);
+//! check_optional(&optional);
+//!
+//! fn check_optional(optional: &Option<Box<int>>) {
+//! match *optional {
+//! Some(ref p) => println!("have value {}", p),
+//! None => println!("have no value")
+//! }
+//! }
+//! ```
+//!
+//! This usage of `Option` to create safe nullable pointers is so
+//! common that Rust does special optimizations to make the
+//! representation of `Option<Box<T>>` a single pointer. Optional pointers
+//! in Rust are stored as efficiently as any other pointer type.
+//!
+//! # Examples
+//!
+//! Basic pattern matching on `Option`:
+//!
+//! ```
+//! let msg = Some("howdy");
+//!
+//! // Take a reference to the contained string
+//! match msg {
+//! Some(ref m) => println!("{}", *m),
+//! None => ()
+//! }
+//!
+//! // Remove the contained string, destroying the Option
+//! let unwrapped_msg = match msg {
+//! Some(m) => m,
+//! None => "default message"
+//! };
+//! ```
+//!
+//! Initialize a result to `None` before a loop:
+//!
+//! ```
+//! enum Kingdom { Plant(uint, &'static str), Animal(uint, &'static str) }
+//!
+//! // A list of data to search through.
+//! let all_the_big_things = [
+//! Plant(250, "redwood"),
+//! Plant(230, "noble fir"),
+//! Plant(229, "sugar pine"),
+//! Animal(25, "blue whale"),
+//! Animal(19, "fin whale"),
+//! Animal(15, "north pacific right whale"),
+//! ];
+//!
+//! // We're going to search for the name of the biggest animal,
+//! // but to start with we've just got `None`.
+//! let mut name_of_biggest_animal = None;
+//! let mut size_of_biggest_animal = 0;
+//! for big_thing in all_the_big_things.iter() {
+//! match *big_thing {
+//! Animal(size, name) if size > size_of_biggest_animal => {
+//! // Now we've found the name of some big animal
+//! size_of_biggest_animal = size;
+//! name_of_biggest_animal = Some(name);
+//! }
+//! Animal(..) | Plant(..) => ()
+//! }
+//! }
+//!
+//! match name_of_biggest_animal {
+//! Some(name) => println!("the biggest animal is {}", name),
+//! None => println!("there are no animals :(")
+//! }
+//! ```
+
+use cmp::{Eq, TotalEq, TotalOrd};
+use default::Default;
+use iter::{Iterator, DoubleEndedIterator, FromIterator, ExactSize};
+use mem;
+use slice;
+
+/// The `Option`
+#[deriving(Clone, Eq, Ord, TotalEq, TotalOrd)]
+pub enum Option<T> {
+ /// No value
+ None,
+ /// Some value `T`
+ Some(T)
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// Type implementation
+/////////////////////////////////////////////////////////////////////////////
+
+impl<T> Option<T> {
+ /////////////////////////////////////////////////////////////////////////
+ // Querying the contained values
+ /////////////////////////////////////////////////////////////////////////
+
+ /// Returns `true` if the option is a `Some` value
+ #[inline]
+ pub fn is_some(&self) -> bool {
+ match *self {
+ Some(_) => true,
+ None => false
+ }
+ }
+
+ /// Returns `true` if the option is a `None` value
+ #[inline]
+ pub fn is_none(&self) -> bool {
+ !self.is_some()
+ }
+
+ /////////////////////////////////////////////////////////////////////////
+ // Adapter for working with references
+ /////////////////////////////////////////////////////////////////////////
+
+ /// Convert from `Option<T>` to `Option<&T>`
+ ///
+ /// # Example
+ ///
+ /// Convert an `Option<~str>` into an `Option<int>`, preserving the original.
+ /// The `map` method takes the `self` argument by value, consuming the original,
+ /// so this technique uses `as_ref` to first take an `Option` to a reference
+ /// to the value inside the original.
+ ///
+ /// ```
+ /// let num_as_str: Option<~str> = Some("10".to_owned());
+ /// // First, cast `Option<~str>` to `Option<&~str>` with `as_ref`,
+ /// // then consume *that* with `map`, leaving `num_as_str` on the stack.
+ /// let num_as_int: Option<uint> = num_as_str.as_ref().map(|n| n.len());
+ /// println!("still can print num_as_str: {}", num_as_str);
+ /// ```
+ #[inline]
+ pub fn as_ref<'r>(&'r self) -> Option<&'r T> {
+ match *self { Some(ref x) => Some(x), None => None }
+ }
+
+ /// Convert from `Option<T>` to `Option<&mut T>`
+ #[inline]
+ pub fn as_mut<'r>(&'r mut self) -> Option<&'r mut T> {
+ match *self { Some(ref mut x) => Some(x), None => None }
+ }
+
+ /// Convert from `Option<T>` to `&[T]` (without copying)
+ #[inline]
+ pub fn as_slice<'r>(&'r self) -> &'r [T] {
+ match *self {
+ Some(ref x) => slice::ref_slice(x),
+ None => &[]
+ }
+ }
+
+ /// Convert from `Option<T>` to `&mut [T]` (without copying)
+ #[inline]
+ pub fn as_mut_slice<'r>(&'r mut self) -> &'r mut [T] {
+ match *self {
+ Some(ref mut x) => slice::mut_ref_slice(x),
+ None => &mut []
+ }
+ }
+
+ /////////////////////////////////////////////////////////////////////////
+ // Getting to contained values
+ /////////////////////////////////////////////////////////////////////////
+
+ /// Moves a value out of an option type and returns it, consuming the `Option`.
+ ///
+ /// # Failure
+ ///
+ /// Fails if the self value equals `None`.
+ ///
+ /// # Safety note
+ ///
+ /// In general, because this function may fail, its use is discouraged.
+ /// Instead, prefer to use pattern matching and handle the `None`
+ /// case explicitly.
+ #[inline]
+ pub fn unwrap(self) -> T {
+ match self {
+ Some(val) => val,
+ None => fail!("called `Option::unwrap()` on a `None` value"),
+ }
+ }
+
+ /// Returns the contained value or a default.
+ #[inline]
+ pub fn unwrap_or(self, def: T) -> T {
+ match self {
+ Some(x) => x,
+ None => def
+ }
+ }
+
+ /// Returns the contained value or computes it from a closure.
+ #[inline]
+ pub fn unwrap_or_else(self, f: || -> T) -> T {
+ match self {
+ Some(x) => x,
+ None => f()
+ }
+ }
+
+ /////////////////////////////////////////////////////////////////////////
+ // Transforming contained values
+ /////////////////////////////////////////////////////////////////////////
+
+ /// Maps an `Option<T>` to `Option<U>` by applying a function to a contained value
+ ///
+ /// # Example
+ ///
+ /// Convert an `Option<~str>` into an `Option<uint>`, consuming the original:
+ ///
+ /// ```
+ /// let num_as_str: Option<~str> = Some("10".to_owned());
+ /// // `Option::map` takes self *by value*, consuming `num_as_str`
+ /// let num_as_int: Option<uint> = num_as_str.map(|n| n.len());
+ /// ```
+ #[inline]
+ pub fn map<U>(self, f: |T| -> U) -> Option<U> {
+ match self { Some(x) => Some(f(x)), None => None }
+ }
+
+ /// Applies a function to the contained value or returns a default.
+ #[inline]
+ pub fn map_or<U>(self, def: U, f: |T| -> U) -> U {
+ match self { None => def, Some(t) => f(t) }
+ }
+
+ /// Applies a function to the contained value or does nothing.
+ /// Returns true if the contained value was mutated.
+ pub fn mutate(&mut self, f: |T| -> T) -> bool {
+ if self.is_some() {
+ *self = Some(f(self.take_unwrap()));
+ true
+ } else { false }
+ }
+
+ /// Applies a function to the contained value or sets it to a default.
+ /// Returns true if the contained value was mutated, or false if set to the default.
+ pub fn mutate_or_set(&mut self, def: T, f: |T| -> T) -> bool {
+ if self.is_some() {
+ *self = Some(f(self.take_unwrap()));
+ true
+ } else {
+ *self = Some(def);
+ false
+ }
+ }
+
+ /////////////////////////////////////////////////////////////////////////
+ // Iterator constructors
+ /////////////////////////////////////////////////////////////////////////
+
+ /// Returns an iterator over the possibly contained value.
+ #[inline]
+ pub fn iter<'r>(&'r self) -> Item<&'r T> {
+ Item{opt: self.as_ref()}
+ }
+
+ /// Returns a mutable iterator over the possibly contained value.
+ #[inline]
+ pub fn mut_iter<'r>(&'r mut self) -> Item<&'r mut T> {
+ Item{opt: self.as_mut()}
+ }
+
+ /// Returns a consuming iterator over the possibly contained value.
+ #[inline]
+ pub fn move_iter(self) -> Item<T> {
+ Item{opt: self}
+ }
+
+ /////////////////////////////////////////////////////////////////////////
+ // Boolean operations on the values, eager and lazy
+ /////////////////////////////////////////////////////////////////////////
+
+ /// Returns `None` if the option is `None`, otherwise returns `optb`.
+ #[inline]
+ pub fn and<U>(self, optb: Option<U>) -> Option<U> {
+ match self {
+ Some(_) => optb,
+ None => None,
+ }
+ }
+
+ /// Returns `None` if the option is `None`, otherwise calls `f` with the
+ /// wrapped value and returns the result.
+ #[inline]
+ pub fn and_then<U>(self, f: |T| -> Option<U>) -> Option<U> {
+ match self {
+ Some(x) => f(x),
+ None => None,
+ }
+ }
+
+ /// Returns the option if it contains a value, otherwise returns `optb`.
+ #[inline]
+ pub fn or(self, optb: Option<T>) -> Option<T> {
+ match self {
+ Some(_) => self,
+ None => optb
+ }
+ }
+
+ /// Returns the option if it contains a value, otherwise calls `f` and
+ /// returns the result.
+ #[inline]
+ pub fn or_else(self, f: || -> Option<T>) -> Option<T> {
+ match self {
+ Some(_) => self,
+ None => f()
+ }
+ }
+
+ /////////////////////////////////////////////////////////////////////////
+ // Misc
+ /////////////////////////////////////////////////////////////////////////
+
+ /// Takes the value out of the option, leaving a `None` in its place.
+ #[inline]
+ pub fn take(&mut self) -> Option<T> {
+ mem::replace(self, None)
+ }
+
+ /// Filters an optional value using a given function.
+ #[inline(always)]
+ pub fn filtered(self, f: |t: &T| -> bool) -> Option<T> {
+ match self {
+ Some(x) => if f(&x) { Some(x) } else { None },
+ None => None
+ }
+ }
+
+ /// Applies a function zero or more times until the result is `None`.
+ #[inline]
+ pub fn while_some(self, f: |v: T| -> Option<T>) {
+ let mut opt = self;
+ loop {
+ match opt {
+ Some(x) => opt = f(x),
+ None => break
+ }
+ }
+ }
+
+ /////////////////////////////////////////////////////////////////////////
+ // Common special cases
+ /////////////////////////////////////////////////////////////////////////
+
+ /// The option dance. Moves a value out of an option type and returns it,
+ /// replacing the original with `None`.
+ ///
+ /// # Failure
+ ///
+ /// Fails if the value equals `None`.
+ #[inline]
+ pub fn take_unwrap(&mut self) -> T {
+ match self.take() {
+ Some(x) => x,
+ None => fail!("called `Option::take_unwrap()` on a `None` value")
+ }
+ }
+
+ /// Gets an immutable reference to the value inside an option.
+ ///
+ /// # Failure
+ ///
+ /// Fails if the value equals `None`
+ ///
+ /// # Safety note
+ ///
+ /// In general, because this function may fail, its use is discouraged
+ /// (calling `get` on `None` is akin to dereferencing a null pointer).
+ /// Instead, prefer to use pattern matching and handle the `None`
+ /// case explicitly.
+ #[inline]
+ pub fn get_ref<'a>(&'a self) -> &'a T {
+ match *self {
+ Some(ref x) => x,
+ None => fail!("called `Option::get_ref()` on a `None` value"),
+ }
+ }
+
+ /// Gets a mutable reference to the value inside an option.
+ ///
+ /// # Failure
+ ///
+ /// Fails if the value equals `None`
+ ///
+ /// # Safety note
+ ///
+ /// In general, because this function may fail, its use is discouraged
+ /// (calling `get` on `None` is akin to dereferencing a null pointer).
+ /// Instead, prefer to use pattern matching and handle the `None`
+ /// case explicitly.
+ #[inline]
+ pub fn get_mut_ref<'a>(&'a mut self) -> &'a mut T {
+ match *self {
+ Some(ref mut x) => x,
+ None => fail!("called `Option::get_mut_ref()` on a `None` value"),
+ }
+ }
+}
+
+impl<T: Default> Option<T> {
+ /// Returns the contained value or a default
+ ///
+ /// Consumes the `self` argument then, if `Some`, returns the contained
+ /// value, otherwise if `None`, returns the default value for that
+ /// type.
+ ///
+ /// # Example
+ ///
+ /// Convert a string to an integer, turning poorly-formed strings
+ /// into 0 (the default value for integers). `from_str` converts
+ /// a string to any other type that implements `FromStr`, returning
+ /// `None` on error.
+ ///
+ /// ```
+ /// let good_year_from_input = "1909";
+ /// let bad_year_from_input = "190blarg";
+ /// let good_year = from_str(good_year_from_input).unwrap_or_default();
+ /// let bad_year = from_str(bad_year_from_input).unwrap_or_default();
+ ///
+ /// assert_eq!(1909, good_year);
+ /// assert_eq!(0, bad_year);
+ /// ```
+ #[inline]
+ pub fn unwrap_or_default(self) -> T {
+ match self {
+ Some(x) => x,
+ None => Default::default()
+ }
+ }
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// Trait implementations
+/////////////////////////////////////////////////////////////////////////////
+
+impl<T> Default for Option<T> {
+ #[inline]
+ fn default() -> Option<T> { None }
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// The Option Iterator
+/////////////////////////////////////////////////////////////////////////////
+
+/// An `Option` iterator that yields either one or zero elements
+///
+/// The `Item` iterator is returned by the `iter`, `mut_iter` and `move_iter`
+/// methods on `Option`.
+#[deriving(Clone)]
+pub struct Item<A> {
+ opt: Option<A>
+}
+
+impl<A> Iterator<A> for Item<A> {
+ #[inline]
+ fn next(&mut self) -> Option<A> {
+ self.opt.take()
+ }
+
+ #[inline]
+ fn size_hint(&self) -> (uint, Option<uint>) {
+ match self.opt {
+ Some(_) => (1, Some(1)),
+ None => (0, Some(0)),
+ }
+ }
+}
+
+impl<A> DoubleEndedIterator<A> for Item<A> {
+ #[inline]
+ fn next_back(&mut self) -> Option<A> {
+ self.opt.take()
+ }
+}
+
+impl<A> ExactSize<A> for Item<A> {}
+
+/////////////////////////////////////////////////////////////////////////////
+// Free functions
+/////////////////////////////////////////////////////////////////////////////
+
+/// Takes each element in the `Iterator`: if it is `None`, no further
+/// elements are taken, and the `None` is returned. Should no `None` occur, a
+/// vector containing the values of each `Option` is returned.
+///
+/// Here is an example which increments every integer in a vector,
+/// checking for overflow:
+///
+/// fn inc_conditionally(x: uint) -> Option<uint> {
+/// if x == uint::MAX { return None; }
+/// else { return Some(x+1u); }
+/// }
+/// let v = [1u, 2, 3];
+/// let res = collect(v.iter().map(|&x| inc_conditionally(x)));
+/// assert!(res == Some(~[2u, 3, 4]));
+#[inline]
+pub fn collect<T, Iter: Iterator<Option<T>>, V: FromIterator<T>>(iter: Iter) -> Option<V> {
+ // FIXME(#11084): This should be twice as fast once this bug is closed.
+ let mut iter = iter.scan(false, |state, x| {
+ match x {
+ Some(x) => Some(x),
+ None => {
+ *state = true;
+ None
+ }
+ }
+ });
+
+ let v: V = FromIterator::from_iter(iter.by_ref());
+
+ if iter.state {
+ None
+ } else {
+ Some(v)
+ }
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// Tests
+/////////////////////////////////////////////////////////////////////////////
+
+#[cfg(test)]
+mod tests {
+ use realstd::option::collect;
+ use realstd::prelude::*;
+ use realstd::iter::range;
+
+ use str::StrSlice;
+ use kinds::marker;
+ use slice::ImmutableVector;
+
+ #[test]
+ fn test_get_ptr() {
+ unsafe {
+ let x = box 0;
+ let addr_x: *int = ::cast::transmute(&*x);
+ let opt = Some(x);
+ let y = opt.unwrap();
+ let addr_y: *int = ::cast::transmute(&*y);
+ assert_eq!(addr_x, addr_y);
+ }
+ }
+
+ #[test]
+ fn test_get_str() {
+ let x = "test".to_owned();
+ let addr_x = x.as_ptr();
+ let opt = Some(x);
+ let y = opt.unwrap();
+ let addr_y = y.as_ptr();
+ assert_eq!(addr_x, addr_y);
+ }
+
+ #[test]
+ fn test_get_resource() {
+ use realstd::rc::Rc;
+ use cell::RefCell;
+
+ struct R {
+ i: Rc<RefCell<int>>,
+ }
+
+ #[unsafe_destructor]
+ impl ::ops::Drop for R {
+ fn drop(&mut self) {
+ let ii = &*self.i;
+ let i = ii.borrow().clone();
+ *ii.borrow_mut() = i + 1;
+ }
+ }
+
+ fn R(i: Rc<RefCell<int>>) -> R {
+ R {
+ i: i
+ }
+ }
+
+ let i = Rc::new(RefCell::new(0));
+ {
+ let x = R(i.clone());
+ let opt = Some(x);
+ let _y = opt.unwrap();
+ }
+ assert_eq!(*i.borrow(), 1);
+ }
+
+ #[test]
+ fn test_option_dance() {
+ let x = Some(());
+ let mut y = Some(5);
+ let mut y2 = 0;
+ for _x in x.iter() {
+ y2 = y.take_unwrap();
+ }
+ assert_eq!(y2, 5);
+ assert!(y.is_none());
+ }
+
+ #[test] #[should_fail]
+ fn test_option_too_much_dance() {
+ let mut y = Some(marker::NoCopy);
+ let _y2 = y.take_unwrap();
+ let _y3 = y.take_unwrap();
+ }
+
+ #[test]
+ fn test_and() {
+ let x: Option<int> = Some(1);
+ assert_eq!(x.and(Some(2)), Some(2));
+ assert_eq!(x.and(None::<int>), None);
+
+ let x: Option<int> = None;
+ assert_eq!(x.and(Some(2)), None);
+ assert_eq!(x.and(None::<int>), None);
+ }
+
+ #[test]
+ fn test_and_then() {
+ let x: Option<int> = Some(1);
+ assert_eq!(x.and_then(|x| Some(x + 1)), Some(2));
+ assert_eq!(x.and_then(|_| None::<int>), None);
+
+ let x: Option<int> = None;
+ assert_eq!(x.and_then(|x| Some(x + 1)), None);
+ assert_eq!(x.and_then(|_| None::<int>), None);
+ }
+
+ #[test]
+ fn test_or() {
+ let x: Option<int> = Some(1);
+ assert_eq!(x.or(Some(2)), Some(1));
+ assert_eq!(x.or(None), Some(1));
+
+ let x: Option<int> = None;
+ assert_eq!(x.or(Some(2)), Some(2));
+ assert_eq!(x.or(None), None);
+ }
+
+ #[test]
+ fn test_or_else() {
+ let x: Option<int> = Some(1);
+ assert_eq!(x.or_else(|| Some(2)), Some(1));
+ assert_eq!(x.or_else(|| None), Some(1));
+
+ let x: Option<int> = None;
+ assert_eq!(x.or_else(|| Some(2)), Some(2));
+ assert_eq!(x.or_else(|| None), None);
+ }
+
+ #[test]
+ fn test_option_while_some() {
+ let mut i = 0;
+ Some(10).while_some(|j| {
+ i += 1;
+ if j > 0 {
+ Some(j-1)
+ } else {
+ None
+ }
+ });
+ assert_eq!(i, 11);
+ }
+
+ #[test]
+ fn test_unwrap() {
+ assert_eq!(Some(1).unwrap(), 1);
+ assert_eq!(Some("hello".to_owned()).unwrap(), "hello".to_owned());
+ }
+
+ #[test]
+ #[should_fail]
+ fn test_unwrap_fail1() {
+ let x: Option<int> = None;
+ x.unwrap();
+ }
+
+ #[test]
+ #[should_fail]
+ fn test_unwrap_fail2() {
+ let x: Option<~str> = None;
+ x.unwrap();
+ }
+
+ #[test]
+ fn test_unwrap_or() {
+ let x: Option<int> = Some(1);
+ assert_eq!(x.unwrap_or(2), 1);
+
+ let x: Option<int> = None;
+ assert_eq!(x.unwrap_or(2), 2);
+ }
+
+ #[test]
+ fn test_unwrap_or_else() {
+ let x: Option<int> = Some(1);
+ assert_eq!(x.unwrap_or_else(|| 2), 1);
+
+ let x: Option<int> = None;
+ assert_eq!(x.unwrap_or_else(|| 2), 2);
+ }
+
+ #[test]
+ fn test_filtered() {
+ let some_stuff = Some(42);
+ let modified_stuff = some_stuff.filtered(|&x| {x < 10});
+ assert_eq!(some_stuff.unwrap(), 42);
+ assert!(modified_stuff.is_none());
+ }
+
+ #[test]
+ fn test_iter() {
+ let val = 5;
+
+ let x = Some(val);
+ let mut it = x.iter();
+
+ assert_eq!(it.size_hint(), (1, Some(1)));
+ assert_eq!(it.next(), Some(&val));
+ assert_eq!(it.size_hint(), (0, Some(0)));
+ assert!(it.next().is_none());
+ }
+
+ #[test]
+ fn test_mut_iter() {
+ let val = 5;
+ let new_val = 11;
+
+ let mut x = Some(val);
+ {
+ let mut it = x.mut_iter();
+
+ assert_eq!(it.size_hint(), (1, Some(1)));
+
+ match it.next() {
+ Some(interior) => {
+ assert_eq!(*interior, val);
+ *interior = new_val;
+ }
+ None => assert!(false),
+ }
+
+ assert_eq!(it.size_hint(), (0, Some(0)));
+ assert!(it.next().is_none());
+ }
+ assert_eq!(x, Some(new_val));
+ }
+
+ #[test]
+ fn test_ord() {
+ let small = Some(1.0);
+ let big = Some(5.0);
+ let nan = Some(0.0/0.0);
+ assert!(!(nan < big));
+ assert!(!(nan > big));
+ assert!(small < big);
+ assert!(None < big);
+ assert!(big > None);
+ }
+
+ #[test]
+ fn test_mutate() {
+ let mut x = Some(3i);
+ assert!(x.mutate(|i| i+1));
+ assert_eq!(x, Some(4i));
+ assert!(x.mutate_or_set(0, |i| i+1));
+ assert_eq!(x, Some(5i));
+ x = None;
+ assert!(!x.mutate(|i| i+1));
+ assert_eq!(x, None);
+ assert!(!x.mutate_or_set(0i, |i| i+1));
+ assert_eq!(x, Some(0i));
+ }
+
+ #[test]
+ fn test_collect() {
+ let v: Option<~[int]> = collect(range(0, 0)
+ .map(|_| Some(0)));
+ assert_eq!(v, Some(box []));
+
+ let v: Option<~[int]> = collect(range(0, 3)
+ .map(|x| Some(x)));
+ assert_eq!(v, Some(box [0, 1, 2]));
+
+ let v: Option<~[int]> = collect(range(0, 3)
+ .map(|x| if x > 1 { None } else { Some(x) }));
+ assert_eq!(v, None);
+
+ // test that it does not take more elements than it needs
+ let mut functions = [|| Some(()), || None, || fail!()];
+
+ let v: Option<~[()]> = collect(functions.mut_iter().map(|f| (*f)()));
+
+ assert_eq!(v, None);
+ }
+}
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Operations on unique pointer types
+
+// FIXME: this module should not exist in libcore. It must currently because the
+// Box implementation is quite ad-hoc in the compiler. Once there is
+// proper support in the compiler this type will be able to be defined in
+// its own module.
+
+/// A value that represents the global exchange heap. This is the default
+/// place that the `box` keyword allocates into when no place is supplied.
+///
+/// The following two examples are equivalent:
+///
+/// let foo = box(HEAP) Bar::new(...);
+/// let foo = box Bar::new(...);
+#[lang="exchange_heap"]
+#[cfg(not(test))]
+pub static HEAP: () = ();
+
+#[cfg(test)]
+pub static HEAP: () = ();
+
+/// A type that represents a uniquely-owned value.
+#[lang="owned_box"]
+#[cfg(not(test))]
+pub struct Box<T>(*T);
+
+#[cfg(test)]
+pub struct Box<T>(*T);
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! The core prelude
+//!
+//! For more information, see std::prelude.
+
+// Reexported core operators
+pub use kinds::{Copy, Send, Sized, Share};
+pub use ops::{Add, Sub, Mul, Div, Rem, Neg, Not};
+pub use ops::{BitAnd, BitOr, BitXor};
+pub use ops::{Drop, Deref, DerefMut};
+pub use ops::{Shl, Shr, Index};
+pub use option::{Option, Some, None};
+pub use result::{Result, Ok, Err};
+
+// Reexported functions
+pub use iter::range;
+pub use mem::drop;
+
+// Reexported types and traits
+
+pub use char::Char;
+pub use clone::Clone;
+pub use cmp::{Eq, Ord, TotalEq, TotalOrd, Ordering, Less, Equal, Greater, Equiv};
+pub use container::{Container, Mutable, Map, MutableMap, Set, MutableSet};
+pub use iter::{FromIterator, Extendable};
+pub use iter::{Iterator, DoubleEndedIterator, RandomAccessIterator, CloneableIterator};
+pub use iter::{OrdIterator, MutableDoubleEndedIterator, ExactSize};
+pub use num::{Num, NumCast, CheckedAdd, CheckedSub, CheckedMul};
+pub use num::{Signed, Unsigned};
+pub use num::{Primitive, Int, ToPrimitive, FromPrimitive};
+pub use ptr::RawPtr;
+pub use str::{Str, StrSlice};
+pub use tuple::{Tuple1, Tuple2, Tuple3, Tuple4};
+pub use tuple::{Tuple5, Tuple6, Tuple7, Tuple8};
+pub use tuple::{Tuple9, Tuple10, Tuple11, Tuple12};
+pub use slice::{ImmutableEqVector, ImmutableTotalOrdVector};
+pub use slice::{MutableVector};
+pub use slice::{Vector, ImmutableVector};
--- /dev/null
+// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Conveniences for working with unsafe pointers, the `*T`, and `*mut T` types.
+//!
+//! Working with unsafe pointers in Rust is fairly uncommon,
+//! and often limited to some narrow use cases: holding
+//! an unsafe pointer when safe pointers are unsuitable;
+//! checking for null; and converting back to safe pointers.
+//! As a result, there is not yet an abundance of library code
+//! for working with unsafe pointers, and in particular,
+//! since pointer math is fairly uncommon in Rust, it is not
+//! all that convenient.
+//!
+//! Use the [`null` function](fn.null.html) to create null pointers,
+//! the [`is_null`](trait.RawPtr.html#tymethod.is_null)
+//! and [`is_not_null`](trait.RawPtr.html#method.is_not_null)
+//! methods of the [`RawPtr` trait](trait.RawPtr.html) to check for null.
+//! The `RawPtr` trait is imported by the prelude, so `is_null` etc.
+//! work everywhere.
+//!
+//! # Common ways to create unsafe pointers
+//!
+//! ## 1. Coerce a reference (`&T`) or mutable reference (`&mut T`).
+//!
+//! ```
+//! let my_num: int = 10;
+//! let my_num_ptr: *int = &my_num;
+//! let mut my_speed: int = 88;
+//! let my_speed_ptr: *mut int = &mut my_speed;
+//! ```
+//!
+//! This does not take ownership of the original allocation
+//! and requires no resource management later,
+//! but you must not use the pointer after its lifetime.
+//!
+//! ## 2. Transmute an owned box (`Box<T>`).
+//!
+//! The `transmute` function takes, by value, whatever it's given
+//! and returns it as whatever type is requested, as long as the
+//! types are the same size. Because `Box<T>` and `*T` have the same
+//! representation they can be trivially,
+//! though unsafely, transformed from one type to the other.
+//!
+//! ```
+//! use std::cast;
+//!
+//! unsafe {
+//! let my_num: Box<int> = box 10;
+//! let my_num: *int = cast::transmute(my_num);
+//! let my_speed: Box<int> = box 88;
+//! let my_speed: *mut int = cast::transmute(my_speed);
+//!
+//! // By taking ownership of the original `Box<T>` though
+//! // we are obligated to transmute it back later to be destroyed.
+//! drop(cast::transmute::<_, Box<int>>(my_speed));
+//! drop(cast::transmute::<_, Box<int>>(my_num));
+//! }
+//! ```
+//!
+//! Note that here the call to `drop` is for clarity - it indicates
+//! that we are done with the given value and it should be destroyed.
+//!
+//! ## 3. Get it from C.
+//!
+//! ```
+//! extern crate libc;
+//!
+//! use std::mem;
+//!
+//! fn main() {
+//! unsafe {
+//! let my_num: *mut int = libc::malloc(mem::size_of::<int>() as libc::size_t) as *mut int;
+//! if my_num.is_null() {
+//! fail!("failed to allocate memory");
+//! }
+//! libc::free(my_num as *mut libc::c_void);
+//! }
+//! }
+//! ```
+//!
+//! Usually you wouldn't literally use `malloc` and `free` from Rust,
+//! but C APIs hand out a lot of pointers generally, so are a common source
+//! of unsafe pointers in Rust.
+
+use cast;
+use clone::Clone;
+use intrinsics;
+use iter::{range, Iterator};
+use mem;
+use option::{Some, None, Option};
+
+#[cfg(not(test))] use cmp::{Eq, TotalEq, Ord, Equiv};
+
+/// Return the offset of the first null pointer in `buf`.
+#[inline]
+pub unsafe fn buf_len<T>(buf: **T) -> uint {
+ position(buf, |i| *i == null())
+}
+
+impl<T> Clone for *T {
+ #[inline]
+ fn clone(&self) -> *T {
+ *self
+ }
+}
+
+impl<T> Clone for *mut T {
+ #[inline]
+ fn clone(&self) -> *mut T {
+ *self
+ }
+}
+
+/// Return the first offset `i` such that `f(buf[i]) == true`.
+#[inline]
+pub unsafe fn position<T>(buf: *T, f: |&T| -> bool) -> uint {
+ let mut i = 0;
+ loop {
+ if f(&(*buf.offset(i as int))) { return i; }
+ else { i += 1; }
+ }
+}
+
+/// Create a null pointer.
+///
+/// # Example
+///
+/// ```
+/// use std::ptr;
+///
+/// let p: *int = ptr::null();
+/// assert!(p.is_null());
+/// ```
+#[inline]
+pub fn null<T>() -> *T { 0 as *T }
+
+/// Create an unsafe mutable null pointer.
+///
+/// # Example
+///
+/// ```
+/// use std::ptr;
+///
+/// let p: *mut int = ptr::mut_null();
+/// assert!(p.is_null());
+/// ```
+#[inline]
+pub fn mut_null<T>() -> *mut T { 0 as *mut T }
+
+/// Copies data from one location to another.
+///
+/// Copies `count` elements (not bytes) from `src` to `dst`. The source
+/// and destination may overlap.
+///
+/// `copy_memory` is semantically equivalent to C's `memmove`.
+///
+/// # Example
+///
+/// Efficiently create a Rust vector from an unsafe buffer:
+///
+/// ```
+/// use std::ptr;
+///
+/// unsafe fn from_buf_raw<T>(ptr: *T, elts: uint) -> Vec<T> {
+/// let mut dst = Vec::with_capacity(elts);
+/// dst.set_len(elts);
+/// ptr::copy_memory(dst.as_mut_ptr(), ptr, elts);
+/// dst
+/// }
+/// ```
+///
+#[inline]
+pub unsafe fn copy_memory<T>(dst: *mut T, src: *T, count: uint) {
+ intrinsics::copy_memory(dst, src, count)
+}
+
+/// Copies data from one location to another.
+///
+/// Copies `count` elements (not bytes) from `src` to `dst`. The source
+/// and destination may *not* overlap.
+///
+/// `copy_nonoverlapping_memory` is semantically equivalent to C's `memcpy`.
+///
+/// # Example
+///
+/// A safe swap function:
+///
+/// ```
+/// use std::cast;
+/// use std::mem;
+/// use std::ptr;
+///
+/// fn swap<T>(x: &mut T, y: &mut T) {
+/// unsafe {
+/// // Give ourselves some scratch space to work with
+/// let mut t: T = mem::uninit();
+///
+/// // Perform the swap, `&mut` pointers never alias
+/// ptr::copy_nonoverlapping_memory(&mut t, &*x, 1);
+/// ptr::copy_nonoverlapping_memory(x, &*y, 1);
+/// ptr::copy_nonoverlapping_memory(y, &t, 1);
+///
+/// // y and t now point to the same thing, but we need to completely forget `tmp`
+/// // because it's no longer relevant.
+/// cast::forget(t);
+/// }
+/// }
+/// ```
+///
+/// # Safety Note
+///
+/// If the source and destination overlap then the behavior of this
+/// function is undefined.
+#[inline]
+pub unsafe fn copy_nonoverlapping_memory<T>(dst: *mut T,
+ src: *T,
+ count: uint) {
+ intrinsics::copy_nonoverlapping_memory(dst, src, count)
+}
+
+/// Invokes memset on the specified pointer, setting `count * size_of::<T>()`
+/// bytes of memory starting at `dst` to `c`.
+#[inline]
+pub unsafe fn set_memory<T>(dst: *mut T, c: u8, count: uint) {
+ intrinsics::set_memory(dst, c, count)
+}
+
+/// Zeroes out `count * size_of::<T>` bytes of memory at `dst`
+#[inline]
+pub unsafe fn zero_memory<T>(dst: *mut T, count: uint) {
+ set_memory(dst, 0, count);
+}
+
+/// Swap the values at two mutable locations of the same type, without
+/// deinitialising either. They may overlap.
+#[inline]
+pub unsafe fn swap<T>(x: *mut T, y: *mut T) {
+ // Give ourselves some scratch space to work with
+ let mut tmp: T = mem::uninit();
+ let t: *mut T = &mut tmp;
+
+ // Perform the swap
+ copy_nonoverlapping_memory(t, &*x, 1);
+ copy_memory(x, &*y, 1); // `x` and `y` may overlap
+ copy_nonoverlapping_memory(y, &*t, 1);
+
+ // y and t now point to the same thing, but we need to completely forget `tmp`
+ // because it's no longer relevant.
+ cast::forget(tmp);
+}
+
+/// Replace the value at a mutable location with a new one, returning the old
+/// value, without deinitialising either.
+#[inline]
+pub unsafe fn replace<T>(dest: *mut T, mut src: T) -> T {
+ mem::swap(cast::transmute(dest), &mut src); // cannot overlap
+ src
+}
+
+/// Reads the value from `*src` and returns it.
+#[inline(always)]
+pub unsafe fn read<T>(src: *T) -> T {
+ let mut tmp: T = mem::uninit();
+ copy_nonoverlapping_memory(&mut tmp, src, 1);
+ tmp
+}
+
+/// Reads the value from `*src` and nulls it out.
+/// This currently prevents destructors from executing.
+#[inline(always)]
+pub unsafe fn read_and_zero<T>(dest: *mut T) -> T {
+ // Copy the data out from `dest`:
+ let tmp = read(&*dest);
+
+ // Now zero out `dest`:
+ zero_memory(dest, 1);
+
+ tmp
+}
+
+/// Given a **T (pointer to an array of pointers),
+/// iterate through each *T, up to the provided `len`,
+/// passing to the provided callback function
+pub unsafe fn array_each_with_len<T>(arr: **T, len: uint, cb: |*T|) {
+ if arr.is_null() {
+ fail!("ptr::array_each_with_len failure: arr input is null pointer");
+ }
+ //let start_ptr = *arr;
+ for e in range(0, len) {
+ let n = arr.offset(e as int);
+ cb(*n);
+ }
+}
+
+/// Given a null-pointer-terminated **T (pointer to
+/// an array of pointers), iterate through each *T,
+/// passing to the provided callback function
+///
+/// # Safety Note
+///
+/// This will only work with a null-terminated
+/// pointer array.
+pub unsafe fn array_each<T>(arr: **T, cb: |*T|) {
+ if arr.is_null() {
+ fail!("ptr::array_each_with_len failure: arr input is null pointer");
+ }
+ let len = buf_len(arr);
+ array_each_with_len(arr, len, cb);
+}
+
+/// Extension methods for raw pointers.
+pub trait RawPtr<T> {
+ /// Returns the null pointer.
+ fn null() -> Self;
+ /// Returns true if the pointer is equal to the null pointer.
+ fn is_null(&self) -> bool;
+ /// Returns true if the pointer is not equal to the null pointer.
+ fn is_not_null(&self) -> bool { !self.is_null() }
+ /// Returns the value of this pointer (ie, the address it points to)
+ fn to_uint(&self) -> uint;
+ /// Returns `None` if the pointer is null, or else returns the value wrapped
+ /// in `Some`.
+ ///
+ /// # Safety Notes
+ ///
+ /// While this method is useful for null-safety, it is important to note
+ /// that this is still an unsafe operation because the returned value could
+ /// be pointing to invalid memory.
+ unsafe fn to_option(&self) -> Option<&T>;
+ /// Calculates the offset from a pointer. The offset *must* be in-bounds of
+ /// the object, or one-byte-past-the-end. `count` is in units of T; e.g. a
+ /// `count` of 3 represents a pointer offset of `3 * sizeof::<T>()` bytes.
+ unsafe fn offset(self, count: int) -> Self;
+}
+
+impl<T> RawPtr<T> for *T {
+ #[inline]
+ fn null() -> *T { null() }
+
+ #[inline]
+ fn is_null(&self) -> bool { *self == RawPtr::null() }
+
+ #[inline]
+ fn to_uint(&self) -> uint { *self as uint }
+
+ #[inline]
+ unsafe fn offset(self, count: int) -> *T { intrinsics::offset(self, count) }
+
+ #[inline]
+ unsafe fn to_option(&self) -> Option<&T> {
+ if self.is_null() {
+ None
+ } else {
+ Some(cast::transmute(*self))
+ }
+ }
+}
+
+impl<T> RawPtr<T> for *mut T {
+ #[inline]
+ fn null() -> *mut T { mut_null() }
+
+ #[inline]
+ fn is_null(&self) -> bool { *self == RawPtr::null() }
+
+ #[inline]
+ fn to_uint(&self) -> uint { *self as uint }
+
+ #[inline]
+ unsafe fn offset(self, count: int) -> *mut T {
+ intrinsics::offset(self as *T, count) as *mut T
+ }
+
+ #[inline]
+ unsafe fn to_option(&self) -> Option<&T> {
+ if self.is_null() {
+ None
+ } else {
+ Some(cast::transmute(*self))
+ }
+ }
+}
+
+// Equality for pointers
+#[cfg(not(test))]
+impl<T> Eq for *T {
+ #[inline]
+ fn eq(&self, other: &*T) -> bool {
+ *self == *other
+ }
+ #[inline]
+ fn ne(&self, other: &*T) -> bool { !self.eq(other) }
+}
+
+#[cfg(not(test))]
+impl<T> TotalEq for *T {}
+
+#[cfg(not(test))]
+impl<T> Eq for *mut T {
+ #[inline]
+ fn eq(&self, other: &*mut T) -> bool {
+ *self == *other
+ }
+ #[inline]
+ fn ne(&self, other: &*mut T) -> bool { !self.eq(other) }
+}
+
+#[cfg(not(test))]
+impl<T> TotalEq for *mut T {}
+
+// Equivalence for pointers
+#[cfg(not(test))]
+impl<T> Equiv<*mut T> for *T {
+ fn equiv(&self, other: &*mut T) -> bool {
+ self.to_uint() == other.to_uint()
+ }
+}
+
+#[cfg(not(test))]
+impl<T> Equiv<*T> for *mut T {
+ fn equiv(&self, other: &*T) -> bool {
+ self.to_uint() == other.to_uint()
+ }
+}
+
+// Equality for extern "C" fn pointers
+#[cfg(not(test))]
+mod externfnpointers {
+ use cast;
+ use cmp::Eq;
+
+ impl<_R> Eq for extern "C" fn() -> _R {
+ #[inline]
+ fn eq(&self, other: &extern "C" fn() -> _R) -> bool {
+ let self_: *() = unsafe { cast::transmute(*self) };
+ let other_: *() = unsafe { cast::transmute(*other) };
+ self_ == other_
+ }
+ }
+ macro_rules! fnptreq(
+ ($($p:ident),*) => {
+ impl<_R,$($p),*> Eq for extern "C" fn($($p),*) -> _R {
+ #[inline]
+ fn eq(&self, other: &extern "C" fn($($p),*) -> _R) -> bool {
+ let self_: *() = unsafe { cast::transmute(*self) };
+ let other_: *() = unsafe { cast::transmute(*other) };
+ self_ == other_
+ }
+ }
+ }
+ )
+ fnptreq!(A)
+ fnptreq!(A,B)
+ fnptreq!(A,B,C)
+ fnptreq!(A,B,C,D)
+ fnptreq!(A,B,C,D,E)
+}
+
+// Comparison for pointers
+#[cfg(not(test))]
+impl<T> Ord for *T {
+ #[inline]
+ fn lt(&self, other: &*T) -> bool { *self < *other }
+}
+
+#[cfg(not(test))]
+impl<T> Ord for *mut T {
+ #[inline]
+ fn lt(&self, other: &*mut T) -> bool { *self < *other }
+}
+
+#[cfg(test)]
+pub mod ptr_tests {
+ use super::*;
+ use realstd::prelude::*;
+
+ use realstd::c_str::ToCStr;
+ use cast;
+ use libc;
+ use realstd::str;
+ use slice::{ImmutableVector, MutableVector};
+
+ #[test]
+ fn test() {
+ unsafe {
+ struct Pair {
+ fst: int,
+ snd: int
+ };
+ let mut p = Pair {fst: 10, snd: 20};
+ let pptr: *mut Pair = &mut p;
+ let iptr: *mut int = cast::transmute(pptr);
+ assert_eq!(*iptr, 10);
+ *iptr = 30;
+ assert_eq!(*iptr, 30);
+ assert_eq!(p.fst, 30);
+
+ *pptr = Pair {fst: 50, snd: 60};
+ assert_eq!(*iptr, 50);
+ assert_eq!(p.fst, 50);
+ assert_eq!(p.snd, 60);
+
+ let v0 = box [32000u16, 32001u16, 32002u16];
+ let mut v1 = box [0u16, 0u16, 0u16];
+
+ copy_memory(v1.as_mut_ptr().offset(1),
+ v0.as_ptr().offset(1), 1);
+ assert!((v1[0] == 0u16 && v1[1] == 32001u16 && v1[2] == 0u16));
+ copy_memory(v1.as_mut_ptr(),
+ v0.as_ptr().offset(2), 1);
+ assert!((v1[0] == 32002u16 && v1[1] == 32001u16 &&
+ v1[2] == 0u16));
+ copy_memory(v1.as_mut_ptr().offset(2),
+ v0.as_ptr(), 1u);
+ assert!((v1[0] == 32002u16 && v1[1] == 32001u16 &&
+ v1[2] == 32000u16));
+ }
+ }
+
+ #[test]
+ fn test_position() {
+ use libc::c_char;
+
+ "hello".with_c_str(|p| {
+ unsafe {
+ assert!(2u == position(p, |c| *c == 'l' as c_char));
+ assert!(4u == position(p, |c| *c == 'o' as c_char));
+ assert!(5u == position(p, |c| *c == 0 as c_char));
+ }
+ })
+ }
+
+ #[test]
+ fn test_buf_len() {
+ "hello".with_c_str(|p0| {
+ "there".with_c_str(|p1| {
+ "thing".with_c_str(|p2| {
+ let v = box [p0, p1, p2, null()];
+ unsafe {
+ assert_eq!(buf_len(v.as_ptr()), 3u);
+ }
+ })
+ })
+ })
+ }
+
+ #[test]
+ fn test_is_null() {
+ let p: *int = null();
+ assert!(p.is_null());
+ assert!(!p.is_not_null());
+
+ let q = unsafe { p.offset(1) };
+ assert!(!q.is_null());
+ assert!(q.is_not_null());
+
+ let mp: *mut int = mut_null();
+ assert!(mp.is_null());
+ assert!(!mp.is_not_null());
+
+ let mq = unsafe { mp.offset(1) };
+ assert!(!mq.is_null());
+ assert!(mq.is_not_null());
+ }
+
+ #[test]
+ fn test_to_option() {
+ unsafe {
+ let p: *int = null();
+ assert_eq!(p.to_option(), None);
+
+ let q: *int = &2;
+ assert_eq!(q.to_option().unwrap(), &2);
+
+ let p: *mut int = mut_null();
+ assert_eq!(p.to_option(), None);
+
+ let q: *mut int = &mut 2;
+ assert_eq!(q.to_option().unwrap(), &2);
+ }
+ }
+
+ #[test]
+ fn test_ptr_addition() {
+ unsafe {
+ let xs = box [5, ..16];
+ let mut ptr = xs.as_ptr();
+ let end = ptr.offset(16);
+
+ while ptr < end {
+ assert_eq!(*ptr, 5);
+ ptr = ptr.offset(1);
+ }
+
+ let mut xs_mut = xs.clone();
+ let mut m_ptr = xs_mut.as_mut_ptr();
+ let m_end = m_ptr.offset(16);
+
+ while m_ptr < m_end {
+ *m_ptr += 5;
+ m_ptr = m_ptr.offset(1);
+ }
+
+ assert_eq!(xs_mut, box [10, ..16]);
+ }
+ }
+
+ #[test]
+ fn test_ptr_subtraction() {
+ unsafe {
+ let xs = box [0,1,2,3,4,5,6,7,8,9];
+ let mut idx = 9i8;
+ let ptr = xs.as_ptr();
+
+ while idx >= 0i8 {
+ assert_eq!(*(ptr.offset(idx as int)), idx as int);
+ idx = idx - 1i8;
+ }
+
+ let mut xs_mut = xs.clone();
+ let m_start = xs_mut.as_mut_ptr();
+ let mut m_ptr = m_start.offset(9);
+
+ while m_ptr >= m_start {
+ *m_ptr += *m_ptr;
+ m_ptr = m_ptr.offset(-1);
+ }
+
+ assert_eq!(xs_mut, box [0,2,4,6,8,10,12,14,16,18]);
+ }
+ }
+
+ #[test]
+ fn test_ptr_array_each_with_len() {
+ unsafe {
+ let one = "oneOne".to_c_str();
+ let two = "twoTwo".to_c_str();
+ let three = "threeThree".to_c_str();
+ let arr = box [
+ one.with_ref(|buf| buf),
+ two.with_ref(|buf| buf),
+ three.with_ref(|buf| buf),
+ ];
+ let expected_arr = [
+ one, two, three
+ ];
+
+ let mut ctr = 0;
+ let mut iteration_count = 0;
+ array_each_with_len(arr.as_ptr(), arr.len(), |e| {
+ let actual = str::raw::from_c_str(e);
+ let expected = expected_arr[ctr].with_ref(|buf| {
+ str::raw::from_c_str(buf)
+ });
+ debug!(
+ "test_ptr_array_each_with_len e: {}, a: {}",
+ expected, actual);
+ assert_eq!(actual, expected);
+ ctr += 1;
+ iteration_count += 1;
+ });
+ assert_eq!(iteration_count, 3u);
+ }
+ }
+
+ #[test]
+ fn test_ptr_array_each() {
+ unsafe {
+ let one = "oneOne".to_c_str();
+ let two = "twoTwo".to_c_str();
+ let three = "threeThree".to_c_str();
+ let arr = box [
+ one.with_ref(|buf| buf),
+ two.with_ref(|buf| buf),
+ three.with_ref(|buf| buf),
+ // fake a null terminator
+ null(),
+ ];
+ let expected_arr = [
+ one, two, three
+ ];
+
+ let arr_ptr = arr.as_ptr();
+ let mut ctr = 0;
+ let mut iteration_count = 0;
+ array_each(arr_ptr, |e| {
+ let actual = str::raw::from_c_str(e);
+ let expected = expected_arr[ctr].with_ref(|buf| {
+ str::raw::from_c_str(buf)
+ });
+ debug!(
+ "test_ptr_array_each e: {}, a: {}",
+ expected, actual);
+ assert_eq!(actual, expected);
+ ctr += 1;
+ iteration_count += 1;
+ });
+ assert_eq!(iteration_count, 3);
+ }
+ }
+
+ #[test]
+ #[should_fail]
+ fn test_ptr_array_each_with_len_null_ptr() {
+ unsafe {
+ array_each_with_len(0 as **libc::c_char, 1, |e| {
+ str::raw::from_c_str(e);
+ });
+ }
+ }
+ #[test]
+ #[should_fail]
+ fn test_ptr_array_each_null_ptr() {
+ unsafe {
+ array_each(0 as **libc::c_char, |e| {
+ str::raw::from_c_str(e);
+ });
+ }
+ }
+
+ #[test]
+ fn test_set_memory() {
+ let mut xs = [0u8, ..20];
+ let ptr = xs.as_mut_ptr();
+ unsafe { set_memory(ptr, 5u8, xs.len()); }
+ assert!(xs == [5u8, ..20]);
+ }
+}
--- /dev/null
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![allow(missing_doc)]
+#![experimental]
+
+//! Contains struct definitions for the layout of compiler built-in types.
+//!
+//! They can be used as targets of transmutes in unsafe code for manipulating
+//! the raw representations directly.
+//!
+//! Their definition should always match the ABI defined in `rustc::back::abi`.
+
+use cast;
+
+/// The representation of a Rust managed box
+pub struct Box<T> {
+ pub ref_count: uint,
+ pub drop_glue: fn(ptr: *mut u8),
+ pub prev: *mut Box<T>,
+ pub next: *mut Box<T>,
+ pub data: T,
+}
+
+/// The representation of a Rust vector
+pub struct Vec<T> {
+ pub fill: uint,
+ pub alloc: uint,
+ pub data: T,
+}
+
+/// The representation of a Rust string
+pub type String = Vec<u8>;
+
+/// The representation of a Rust slice
+pub struct Slice<T> {
+ pub data: *T,
+ pub len: uint,
+}
+
+/// The representation of a Rust closure
+pub struct Closure {
+ pub code: *(),
+ pub env: *(),
+}
+
+/// The representation of a Rust procedure (`proc()`)
+pub struct Procedure {
+ pub code: *(),
+ pub env: *(),
+}
+
+/// The representation of a Rust trait object.
+///
+/// This struct does not have a `Repr` implementation
+/// because there is no way to refer to all trait objects generically.
+pub struct TraitObject {
+ pub vtable: *(),
+ pub data: *(),
+}
+
+/// This trait is meant to map equivalences between raw structs and their
+/// corresponding rust values.
+pub trait Repr<T> {
+ /// This function "unwraps" a rust value (without consuming it) into its raw
+ /// struct representation. This can be used to read/write different values
+ /// for the struct. This is a safe method because by default it does not
+ /// enable write-access to the fields of the return value in safe code.
+ #[inline]
+ fn repr(&self) -> T { unsafe { cast::transmute_copy(self) } }
+}
+
+impl<'a, T> Repr<Slice<T>> for &'a [T] {}
+impl<'a> Repr<Slice<u8>> for &'a str {}
+impl<T> Repr<*Box<T>> for @T {}
+impl<T> Repr<*Vec<T>> for ~[T] {}
+impl Repr<*String> for ~str {}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ use cast;
+
+ #[test]
+ fn synthesize_closure() {
+ unsafe {
+ let x = 10;
+ let f: |int| -> int = |y| x + y;
+
+ assert_eq!(f(20), 30);
+
+ let original_closure: Closure = cast::transmute(f);
+
+ let actual_function_pointer = original_closure.code;
+ let environment = original_closure.env;
+
+ let new_closure = Closure {
+ code: actual_function_pointer,
+ env: environment
+ };
+
+ let new_f: |int| -> int = cast::transmute(new_closure);
+ assert_eq!(new_f(20), 30);
+ }
+ }
+}
--- /dev/null
+// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Error handling with the `Result` type
+//!
+//! `Result<T>` is the type used for returning and propagating
+//! errors. It is an enum with the variants, `Ok(T)`, representing
+//! success and containing a value, and `Err(E)`, representing error
+//! and containing an error value.
+//!
+//! ~~~
+//! enum Result<T, E> {
+//! Ok(T),
+//! Err(E)
+//! }
+//! ~~~
+//!
+//! Functions return `Result` whenever errors are expected and
+//! recoverable. In the `std` crate `Result` is most prominently used
+//! for [I/O](../io/index.html).
+//!
+//! A simple function returning `Result` might be
+//! defined and used like so:
+//!
+//! ~~~
+//! #[deriving(Show)]
+//! enum Version { Version1, Version2 }
+//!
+//! fn parse_version(header: &[u8]) -> Result<Version, &'static str> {
+//! if header.len() < 1 {
+//! return Err("invalid header length");
+//! }
+//! match header[0] {
+//! 1 => Ok(Version1),
+//! 2 => Ok(Version2),
+//! _ => Err("invalid version")
+//! }
+//! }
+//!
+//! let version = parse_version(&[1, 2, 3, 4]);
+//! match version {
+//! Ok(v) => {
+//! println!("working with version: {}", v);
+//! }
+//! Err(e) => {
+//! println!("error parsing header: {}", e);
+//! }
+//! }
+//! ~~~
+//!
+//! Pattern matching on `Result`s is clear and straightforward for
+//! simple cases, but `Result` comes with some convenience methods
+//! that make working it more succinct.
+//!
+//! ~~~
+//! let good_result: Result<int, int> = Ok(10);
+//! let bad_result: Result<int, int> = Err(10);
+//!
+//! // The `is_ok` and `is_err` methods do what they say.
+//! assert!(good_result.is_ok() && !good_result.is_err());
+//! assert!(bad_result.is_err() && !bad_result.is_ok());
+//!
+//! // `map` consumes the `Result` and produces another.
+//! let good_result: Result<int, int> = good_result.map(|i| i + 1);
+//! let bad_result: Result<int, int> = bad_result.map(|i| i - 1);
+//!
+//! // Use `and_then` to continue the computation.
+//! let good_result: Result<bool, int> = good_result.and_then(|i| Ok(i == 11));
+//!
+//! // Use `or_else` to handle the error.
+//! let bad_result: Result<int, int> = bad_result.or_else(|i| Ok(11));
+//!
+//! // Consume the result and return the contents with `unwrap`.
+//! let final_awesome_result = good_result.ok().unwrap();
+//! ~~~
+//!
+//! # Results must be used
+//!
+//! A common problem with using return values to indicate errors is
+//! that it is easy to ignore the return value, thus failing to handle
+//! the error. Result is annotated with the #[must_use] attribute,
+//! which will cause the compiler to issue a warning when a Result
+//! value is ignored. This makes `Result` especially useful with
+//! functions that may encounter errors but don't otherwise return a
+//! useful value.
+//!
+//! Consider the `write_line` method defined for I/O types
+//! by the [`Writer`](../io/trait.Writer.html) trait:
+//!
+//! ~~~
+//! use std::io::IoError;
+//!
+//! trait Writer {
+//! fn write_line(&mut self, s: &str) -> Result<(), IoError>;
+//! }
+//! ~~~
+//!
+//! *Note: The actual definition of `Writer` uses `IoResult`, which
+//! is just a synonym for `Result<T, IoError>`.*
+//!
+//! This method doesn`t produce a value, but the write may
+//! fail. It's crucial to handle the error case, and *not* write
+//! something like this:
+//!
+//! ~~~ignore
+//! use std::io::{File, Open, Write};
+//!
+//! let mut file = File::open_mode(&Path::new("valuable_data.txt"), Open, Write);
+//! // If `write_line` errors, then we'll never know, because the return
+//! // value is ignored.
+//! file.write_line("important message");
+//! drop(file);
+//! ~~~
+//!
+//! If you *do* write that in Rust, the compiler will by give you a
+//! warning (by default, controlled by the `unused_must_use` lint).
+//!
+//! You might instead, if you don't want to handle the error, simply
+//! fail, by converting to an `Option` with `ok`, then asserting
+//! success with `expect`. This will fail if the write fails, proving
+//! a marginally useful message indicating why:
+//!
+//! ~~~no_run
+//! use std::io::{File, Open, Write};
+//!
+//! let mut file = File::open_mode(&Path::new("valuable_data.txt"), Open, Write);
+//! file.write_line("important message").ok().expect("failed to write message");
+//! drop(file);
+//! ~~~
+//!
+//! You might also simply assert success:
+//!
+//! ~~~no_run
+//! # use std::io::{File, Open, Write};
+//!
+//! # let mut file = File::open_mode(&Path::new("valuable_data.txt"), Open, Write);
+//! assert!(file.write_line("important message").is_ok());
+//! # drop(file);
+//! ~~~
+//!
+//! Or propagate the error up the call stack with `try!`:
+//!
+//! ~~~
+//! # use std::io::{File, Open, Write, IoError};
+//! fn write_message() -> Result<(), IoError> {
+//! let mut file = File::open_mode(&Path::new("valuable_data.txt"), Open, Write);
+//! try!(file.write_line("important message"));
+//! drop(file);
+//! return Ok(());
+//! }
+//! ~~~
+//!
+//! # The `try!` macro
+//!
+//! When writing code that calls many functions that return the
+//! `Result` type, the error handling can be tedious. The `try!`
+//! macro hides some of the boilerplate of propagating errors up the
+//! call stack.
+//!
+//! It replaces this:
+//!
+//! ~~~
+//! use std::io::{File, Open, Write, IoError};
+//!
+//! struct Info { name: ~str, age: int, rating: int }
+//!
+//! fn write_info(info: &Info) -> Result<(), IoError> {
+//! let mut file = File::open_mode(&Path::new("my_best_friends.txt"), Open, Write);
+//! // Early return on error
+//! match file.write_line(format!("name: {}", info.name)) {
+//! Ok(_) => (),
+//! Err(e) => return Err(e)
+//! }
+//! match file.write_line(format!("age: {}", info.age)) {
+//! Ok(_) => (),
+//! Err(e) => return Err(e)
+//! }
+//! return file.write_line(format!("rating: {}", info.rating));
+//! }
+//! ~~~
+//!
+//! With this:
+//!
+//! ~~~
+//! use std::io::{File, Open, Write, IoError};
+//!
+//! struct Info { name: ~str, age: int, rating: int }
+//!
+//! fn write_info(info: &Info) -> Result<(), IoError> {
+//! let mut file = File::open_mode(&Path::new("my_best_friends.txt"), Open, Write);
+//! // Early return on error
+//! try!(file.write_line(format!("name: {}", info.name)));
+//! try!(file.write_line(format!("age: {}", info.age)));
+//! try!(file.write_line(format!("rating: {}", info.rating)));
+//! return Ok(());
+//! }
+//! ~~~
+//!
+//! *It's much nicer!*
+//!
+//! Wrapping an expression in `try!` will result in the unwrapped
+//! success (`Ok`) value, unless the result is `Err`, in which case
+//! `Err` is returned early from the enclosing function. Its simple definition
+//! makes it clear:
+//!
+//! ~~~
+//! # #![feature(macro_rules)]
+//! macro_rules! try(
+//! ($e:expr) => (match $e { Ok(e) => e, Err(e) => return Err(e) })
+//! )
+//! # fn main() { }
+//! ~~~
+//!
+//! `try!` is imported by the prelude, and is available everywhere.
+//!
+//! # `Result` and `Option`
+//!
+//! The `Result` and [`Option`](../option/index.html) types are
+//! similar and complementary: they are often employed to indicate a
+//! lack of a return value; and they are trivially converted between
+//! each other, so `Result`s are often handled by first converting to
+//! `Option` with the [`ok`](enum.Result.html#method.ok) and
+//! [`err`](enum.Result.html#method.ok) methods.
+//!
+//! Whereas `Option` only indicates the lack of a value, `Result` is
+//! specifically for error reporting, and carries with it an error
+//! value. Sometimes `Option` is used for indicating errors, but this
+//! is only for simple cases and is generally discouraged. Even when
+//! there is no useful error value to return, prefer `Result<T, ()>`.
+//!
+//! Converting to an `Option` with `ok()` to handle an error:
+//!
+//! ~~~
+//! use std::io::Timer;
+//! let mut t = Timer::new().ok().expect("failed to create timer!");
+//! ~~~
+//!
+//! # `Result` vs. `fail!`
+//!
+//! `Result` is for recoverable errors; `fail!` is for unrecoverable
+//! errors. Callers should always be able to avoid failure if they
+//! take the proper precautions, for example, calling `is_some()`
+//! on an `Option` type before calling `unwrap`.
+//!
+//! The suitability of `fail!` as an error handling mechanism is
+//! limited by Rust's lack of any way to "catch" and resume execution
+//! from a thrown exception. Therefore using failure for error
+//! handling requires encapsulating fallable code in a task. Calling
+//! the `fail!` macro, or invoking `fail!` indirectly should be
+//! avoided as an error reporting strategy. Failure is only for
+//! unrecoverable errors and a failing task is typically the sign of
+//! a bug.
+//!
+//! A module that instead returns `Results` is alerting the caller
+//! that failure is possible, and providing precise control over how
+//! it is handled.
+//!
+//! Furthermore, failure may not be recoverable at all, depending on
+//! the context. The caller of `fail!` should assume that execution
+//! will not resume after failure, that failure is catastrophic.
+
+use clone::Clone;
+use cmp::Eq;
+use iter::{Iterator, FromIterator};
+use option::{None, Option, Some};
+
+/// `Result` is a type that represents either success (`Ok`) or failure (`Err`).
+///
+/// See the [`std::result`](index.html) module documentation for details.
+#[deriving(Clone, Eq, Ord, TotalEq, TotalOrd)]
+#[must_use]
+pub enum Result<T, E> {
+ /// Contains the success value
+ Ok(T),
+
+ /// Contains the error value
+ Err(E)
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// Type implementation
+/////////////////////////////////////////////////////////////////////////////
+
+impl<T, E> Result<T, E> {
+ /////////////////////////////////////////////////////////////////////////
+ // Querying the contained values
+ /////////////////////////////////////////////////////////////////////////
+
+ /// Returns true if the result is `Ok`
+ ///
+ /// # Example
+ ///
+ /// ~~~
+ /// use std::io::{File, Open, Write};
+ ///
+ /// # fn do_not_run_example() { // creates a file
+ /// let mut file = File::open_mode(&Path::new("secret.txt"), Open, Write);
+ /// assert!(file.write_line("it's cold in here").is_ok());
+ /// # }
+ /// ~~~
+ #[inline]
+ pub fn is_ok(&self) -> bool {
+ match *self {
+ Ok(_) => true,
+ Err(_) => false
+ }
+ }
+
+ /// Returns true if the result is `Err`
+ ///
+ /// # Example
+ ///
+ /// ~~~
+ /// use std::io::{File, Open, Read};
+ ///
+ /// // When opening with `Read` access, if the file does not exist
+ /// // then `open_mode` returns an error.
+ /// let bogus = File::open_mode(&Path::new("not_a_file.txt"), Open, Read);
+ /// assert!(bogus.is_err());
+ /// ~~~
+ #[inline]
+ pub fn is_err(&self) -> bool {
+ !self.is_ok()
+ }
+
+
+ /////////////////////////////////////////////////////////////////////////
+ // Adapter for each variant
+ /////////////////////////////////////////////////////////////////////////
+
+ /// Convert from `Result<T, E>` to `Option<T>`
+ ///
+ /// Converts `self` into an `Option<T>`, consuming `self`,
+ /// and discarding the error, if any.
+ ///
+ /// To convert to an `Option` without discarding the error value,
+ /// use `as_ref` to first convert the `Result<T, E>` into a
+ /// `Result<&T, &E>`.
+ ///
+ /// # Examples
+ ///
+ /// ~~~{.should_fail}
+ /// use std::io::{File, IoResult};
+ ///
+ /// let bdays: IoResult<File> = File::open(&Path::new("important_birthdays.txt"));
+ /// let bdays: File = bdays.ok().expect("unable to open birthday file");
+ /// ~~~
+ #[inline]
+ pub fn ok(self) -> Option<T> {
+ match self {
+ Ok(x) => Some(x),
+ Err(_) => None,
+ }
+ }
+
+ /// Convert from `Result<T, E>` to `Option<E>`
+ ///
+ /// Converts `self` into an `Option<T>`, consuming `self`,
+ /// and discarding the value, if any.
+ #[inline]
+ pub fn err(self) -> Option<E> {
+ match self {
+ Ok(_) => None,
+ Err(x) => Some(x),
+ }
+ }
+
+ /////////////////////////////////////////////////////////////////////////
+ // Adapter for working with references
+ /////////////////////////////////////////////////////////////////////////
+
+ /// Convert from `Result<T, E>` to `Result<&T, &E>`
+ ///
+ /// Produces a new `Result`, containing a reference
+ /// into the original, leaving the original in place.
+ #[inline]
+ pub fn as_ref<'r>(&'r self) -> Result<&'r T, &'r E> {
+ match *self {
+ Ok(ref x) => Ok(x),
+ Err(ref x) => Err(x),
+ }
+ }
+
+ /// Convert from `Result<T, E>` to `Result<&mut T, &mut E>`
+ #[inline]
+ pub fn as_mut<'r>(&'r mut self) -> Result<&'r mut T, &'r mut E> {
+ match *self {
+ Ok(ref mut x) => Ok(x),
+ Err(ref mut x) => Err(x),
+ }
+ }
+
+ /////////////////////////////////////////////////////////////////////////
+ // Transforming contained values
+ /////////////////////////////////////////////////////////////////////////
+
+ /// Maps a `Result<T, E>` to `Result<U, E>` by applying a function to an
+ /// contained `Ok` value, leaving an `Err` value untouched.
+ ///
+ /// This function can be used to compose the results of two functions.
+ ///
+ /// # Examples
+ ///
+ /// Sum the lines of a buffer by mapping strings to numbers,
+ /// ignoring I/O and parse errors:
+ ///
+ /// ~~~
+ /// use std::io::{BufReader, IoResult};
+ ///
+ /// let buffer = "1\n2\n3\n4\n";
+ /// let mut reader = BufReader::new(buffer.as_bytes());
+ ///
+ /// let mut sum = 0;
+ ///
+ /// while !reader.eof() {
+ /// let line: IoResult<~str> = reader.read_line();
+ /// // Convert the string line to a number using `map` and `from_str`
+ /// let val: IoResult<int> = line.map(|line| {
+ /// from_str::<int>(line).unwrap_or(0)
+ /// });
+ /// // Add the value if there were no errors, otherwise add 0
+ /// sum += val.ok().unwrap_or(0);
+ /// }
+ /// ~~~
+ #[inline]
+ pub fn map<U>(self, op: |T| -> U) -> Result<U,E> {
+ match self {
+ Ok(t) => Ok(op(t)),
+ Err(e) => Err(e)
+ }
+ }
+
+ /// Maps a `Result<T, E>` to `Result<T, F>` by applying a function to an
+ /// contained `Err` value, leaving an `Ok` value untouched.
+ ///
+ /// This function can be used to pass through a successful result while handling
+ /// an error.
+ #[inline]
+ pub fn map_err<F>(self, op: |E| -> F) -> Result<T,F> {
+ match self {
+ Ok(t) => Ok(t),
+ Err(e) => Err(op(e))
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////
+ // Boolean operations on the values, eager and lazy
+ /////////////////////////////////////////////////////////////////////////
+
+ /// Returns `res` if the result is `Ok`, otherwise returns the `Err` value of `self`.
+ #[inline]
+ pub fn and<U>(self, res: Result<U, E>) -> Result<U, E> {
+ match self {
+ Ok(_) => res,
+ Err(e) => Err(e),
+ }
+ }
+
+ /// Calls `op` if the result is `Ok`, otherwise returns the `Err` value of `self`.
+ ///
+ /// This function can be used for control flow based on result values
+ #[inline]
+ pub fn and_then<U>(self, op: |T| -> Result<U, E>) -> Result<U, E> {
+ match self {
+ Ok(t) => op(t),
+ Err(e) => Err(e),
+ }
+ }
+
+ /// Returns `res` if the result is `Err`, otherwise returns the `Ok` value of `self`.
+ #[inline]
+ pub fn or(self, res: Result<T, E>) -> Result<T, E> {
+ match self {
+ Ok(_) => self,
+ Err(_) => res,
+ }
+ }
+
+ /// Calls `op` if the result is `Err`, otherwise returns the `Ok` value of `self`.
+ ///
+ /// This function can be used for control flow based on result values
+ #[inline]
+ pub fn or_else<F>(self, op: |E| -> Result<T, F>) -> Result<T, F> {
+ match self {
+ Ok(t) => Ok(t),
+ Err(e) => op(e),
+ }
+ }
+
+ /// Unwraps a result, yielding the content of an `Ok`.
+ /// Else it returns `optb`.
+ #[inline]
+ pub fn unwrap_or(self, optb: T) -> T {
+ match self {
+ Ok(t) => t,
+ Err(_) => optb
+ }
+ }
+
+ /// Unwraps a result, yielding the content of an `Ok`.
+ /// If the value is an `Err` then it calls `op` with its value.
+ #[inline]
+ pub fn unwrap_or_handle(self, op: |E| -> T) -> T {
+ match self {
+ Ok(t) => t,
+ Err(e) => op(e)
+ }
+ }
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// Free functions
+/////////////////////////////////////////////////////////////////////////////
+
+/// Takes each element in the `Iterator`: if it is an `Err`, no further
+/// elements are taken, and the `Err` is returned. Should no `Err` occur, a
+/// vector containing the values of each `Result` is returned.
+///
+/// Here is an example which increments every integer in a vector,
+/// checking for overflow:
+///
+/// fn inc_conditionally(x: uint) -> Result<uint, &'static str> {
+/// if x == uint::MAX { return Err("overflow"); }
+/// else { return Ok(x+1u); }
+/// }
+/// let v = [1u, 2, 3];
+/// let res = collect(v.iter().map(|&x| inc_conditionally(x)));
+/// assert!(res == Ok(~[2u, 3, 4]));
+#[inline]
+pub fn collect<T, E, Iter: Iterator<Result<T, E>>, V: FromIterator<T>>(iter: Iter) -> Result<V, E> {
+ // FIXME(#11084): This should be twice as fast once this bug is closed.
+ let mut iter = iter.scan(None, |state, x| {
+ match x {
+ Ok(x) => Some(x),
+ Err(err) => {
+ *state = Some(err);
+ None
+ }
+ }
+ });
+
+ let v: V = FromIterator::from_iter(iter.by_ref());
+
+ match iter.state {
+ Some(err) => Err(err),
+ None => Ok(v),
+ }
+}
+
+/// Perform a fold operation over the result values from an iterator.
+///
+/// If an `Err` is encountered, it is immediately returned.
+/// Otherwise, the folded value is returned.
+#[inline]
+pub fn fold<T,
+ V,
+ E,
+ Iter: Iterator<Result<T, E>>>(
+ mut iterator: Iter,
+ mut init: V,
+ f: |V, T| -> V)
+ -> Result<V, E> {
+ for t in iterator {
+ match t {
+ Ok(v) => init = f(init, v),
+ Err(u) => return Err(u)
+ }
+ }
+ Ok(init)
+}
+
+/// Perform a trivial fold operation over the result values
+/// from an iterator.
+///
+/// If an `Err` is encountered, it is immediately returned.
+/// Otherwise, a simple `Ok(())` is returned.
+#[inline]
+pub fn fold_<T,E,Iter:Iterator<Result<T,E>>>(iterator: Iter) -> Result<(),E> {
+ fold(iterator, (), |_, _| ())
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// Tests
+/////////////////////////////////////////////////////////////////////////////
+
+#[cfg(test)]
+mod tests {
+ use realstd::result::{collect, fold, fold_};
+ use realstd::prelude::*;
+ use realstd::iter::range;
+
+ pub fn op1() -> Result<int, ~str> { Ok(666) }
+ pub fn op2() -> Result<int, ~str> { Err("sadface".to_owned()) }
+
+ #[test]
+ pub fn test_and() {
+ assert_eq!(op1().and(Ok(667)).unwrap(), 667);
+ assert_eq!(op1().and(Err::<(), ~str>("bad".to_owned())).unwrap_err(), "bad".to_owned());
+
+ assert_eq!(op2().and(Ok(667)).unwrap_err(), "sadface".to_owned());
+ assert_eq!(op2().and(Err::<(), ~str>("bad".to_owned())).unwrap_err(), "sadface".to_owned());
+ }
+
+ #[test]
+ pub fn test_and_then() {
+ assert_eq!(op1().and_then(|i| Ok::<int, ~str>(i + 1)).unwrap(), 667);
+ assert_eq!(op1().and_then(|_| Err::<int, ~str>("bad".to_owned())).unwrap_err(),
+ "bad".to_owned());
+
+ assert_eq!(op2().and_then(|i| Ok::<int, ~str>(i + 1)).unwrap_err(),
+ "sadface".to_owned());
+ assert_eq!(op2().and_then(|_| Err::<int, ~str>("bad".to_owned())).unwrap_err(),
+ "sadface".to_owned());
+ }
+
+ #[test]
+ pub fn test_or() {
+ assert_eq!(op1().or(Ok(667)).unwrap(), 666);
+ assert_eq!(op1().or(Err("bad".to_owned())).unwrap(), 666);
+
+ assert_eq!(op2().or(Ok(667)).unwrap(), 667);
+ assert_eq!(op2().or(Err("bad".to_owned())).unwrap_err(), "bad".to_owned());
+ }
+
+ #[test]
+ pub fn test_or_else() {
+ assert_eq!(op1().or_else(|_| Ok::<int, ~str>(667)).unwrap(), 666);
+ assert_eq!(op1().or_else(|e| Err::<int, ~str>(e + "!")).unwrap(), 666);
+
+ assert_eq!(op2().or_else(|_| Ok::<int, ~str>(667)).unwrap(), 667);
+ assert_eq!(op2().or_else(|e| Err::<int, ~str>(e + "!")).unwrap_err(),
+ "sadface!".to_owned());
+ }
+
+ #[test]
+ pub fn test_impl_map() {
+ assert_eq!(Ok::<~str, ~str>("a".to_owned()).map(|x| x + "b"), Ok("ab".to_owned()));
+ assert_eq!(Err::<~str, ~str>("a".to_owned()).map(|x| x + "b"), Err("a".to_owned()));
+ }
+
+ #[test]
+ pub fn test_impl_map_err() {
+ assert_eq!(Ok::<~str, ~str>("a".to_owned()).map_err(|x| x + "b"), Ok("a".to_owned()));
+ assert_eq!(Err::<~str, ~str>("a".to_owned()).map_err(|x| x + "b"), Err("ab".to_owned()));
+ }
+
+ #[test]
+ fn test_collect() {
+ let v: Result<~[int], ()> = collect(range(0, 0).map(|_| Ok::<int, ()>(0)));
+ assert_eq!(v, Ok(box []));
+
+ let v: Result<~[int], ()> = collect(range(0, 3).map(|x| Ok::<int, ()>(x)));
+ assert_eq!(v, Ok(box [0, 1, 2]));
+
+ let v: Result<~[int], int> = collect(range(0, 3)
+ .map(|x| if x > 1 { Err(x) } else { Ok(x) }));
+ assert_eq!(v, Err(2));
+
+ // test that it does not take more elements than it needs
+ let mut functions = [|| Ok(()), || Err(1), || fail!()];
+
+ let v: Result<~[()], int> = collect(functions.mut_iter().map(|f| (*f)()));
+ assert_eq!(v, Err(1));
+ }
+
+ #[test]
+ fn test_fold() {
+ assert_eq!(fold_(range(0, 0)
+ .map(|_| Ok::<(), ()>(()))),
+ Ok(()));
+ assert_eq!(fold(range(0, 3)
+ .map(|x| Ok::<int, ()>(x)),
+ 0, |a, b| a + b),
+ Ok(3));
+ assert_eq!(fold_(range(0, 3)
+ .map(|x| if x > 1 { Err(x) } else { Ok(()) })),
+ Err(2));
+
+ // test that it does not take more elements than it needs
+ let mut functions = [|| Ok(()), || Err(1), || fail!()];
+
+ assert_eq!(fold_(functions.mut_iter()
+ .map(|f| (*f)())),
+ Err(1));
+ }
+
+ #[test]
+ pub fn test_to_str() {
+ let ok: Result<int, ~str> = Ok(100);
+ let err: Result<int, ~str> = Err("Err".to_owned());
+
+ assert_eq!(ok.to_str(), "Ok(100)".to_owned());
+ assert_eq!(err.to_str(), "Err(Err)".to_owned());
+ }
+
+ #[test]
+ pub fn test_fmt_default() {
+ let ok: Result<int, ~str> = Ok(100);
+ let err: Result<int, ~str> = Err("Err".to_owned());
+
+ assert_eq!(format!("{}", ok), "Ok(100)".to_owned());
+ assert_eq!(format!("{}", err), "Err(Err)".to_owned());
+ }
+
+ #[test]
+ pub fn test_unwrap_or() {
+ let ok: Result<int, ~str> = Ok(100);
+ let ok_err: Result<int, ~str> = Err("Err".to_owned());
+
+ assert_eq!(ok.unwrap_or(50), 100);
+ assert_eq!(ok_err.unwrap_or(50), 50);
+ }
+
+ #[test]
+ pub fn test_unwrap_or_else() {
+ fn handler(msg: ~str) -> int {
+ if msg == "I got this.".to_owned() {
+ 50
+ } else {
+ fail!("BadBad")
+ }
+ }
+
+ let ok: Result<int, ~str> = Ok(100);
+ let ok_err: Result<int, ~str> = Err("I got this.".to_owned());
+
+ assert_eq!(ok.unwrap_or_handle(handler), 100);
+ assert_eq!(ok_err.unwrap_or_handle(handler), 50);
+ }
+
+ #[test]
+ #[should_fail]
+ pub fn test_unwrap_or_else_failure() {
+ fn handler(msg: ~str) -> int {
+ if msg == "I got this.".to_owned() {
+ 50
+ } else {
+ fail!("BadBad")
+ }
+ }
+
+ let bad_err: Result<int, ~str> = Err("Unrecoverable mess.".to_owned());
+ let _ : int = bad_err.unwrap_or_handle(handler);
+ }
+}
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use cast;
+use char::Char;
+use clone::Clone;
+use container::Container;
+use default::Default;
+use intrinsics;
+use iter::{Iterator, FromIterator};
+use mem;
+use num::{CheckedMul, CheckedAdd};
+use option::{Some, None};
+use ptr::RawPtr;
+use ptr;
+use raw::Vec;
+use slice::ImmutableVector;
+use str::StrSlice;
+
+#[cfg(not(test))] use ops::Add;
+#[cfg(not(test))] use slice::Vector;
+
+#[allow(ctypes)]
+extern {
+ fn malloc(size: uint) -> *u8;
+ fn free(ptr: *u8);
+}
+
+unsafe fn alloc(cap: uint) -> *mut Vec<()> {
+ let cap = cap.checked_add(&mem::size_of::<Vec<()>>()).unwrap();
+ let ret = malloc(cap) as *mut Vec<()>;
+ if ret.is_null() {
+ intrinsics::abort();
+ }
+ (*ret).fill = 0;
+ (*ret).alloc = cap;
+ ret
+}
+
+// Strings
+
+impl Default for ~str {
+ fn default() -> ~str {
+ unsafe {
+ // Get some memory
+ let ptr = alloc(0);
+
+ // Initialize the memory
+ (*ptr).fill = 0;
+ (*ptr).alloc = 0;
+
+ cast::transmute(ptr)
+ }
+ }
+}
+
+impl Clone for ~str {
+ fn clone(&self) -> ~str {
+ // Don't use the clone() implementation above because it'll start
+ // requiring the eh_personality lang item (no fun)
+ unsafe {
+ let bytes = self.as_bytes().as_ptr();
+ let len = self.len();
+
+ let ptr = alloc(len) as *mut Vec<u8>;
+ ptr::copy_nonoverlapping_memory(&mut (*ptr).data, bytes, len);
+ (*ptr).fill = len;
+ (*ptr).alloc = len;
+
+ cast::transmute(ptr)
+ }
+ }
+}
+
+impl FromIterator<char> for ~str {
+ #[inline]
+ fn from_iter<T: Iterator<char>>(mut iterator: T) -> ~str {
+ let (lower, _) = iterator.size_hint();
+ let mut cap = if lower == 0 {16} else {lower};
+ let mut len = 0;
+ let mut tmp = [0u8, ..4];
+
+ unsafe {
+ let mut ptr = alloc(cap) as *mut Vec<u8>;
+ let mut ret = cast::transmute(ptr);
+ for ch in iterator {
+ let amt = ch.encode_utf8(tmp);
+
+ if len + amt > cap {
+ cap = cap.checked_mul(&2).unwrap();
+ if cap < len + amt {
+ cap = len + amt;
+ }
+ let ptr2 = alloc(cap) as *mut Vec<u8>;
+ ptr::copy_nonoverlapping_memory(&mut (*ptr2).data,
+ &(*ptr).data,
+ len);
+ free(ptr as *u8);
+ cast::forget(ret);
+ ret = cast::transmute(ptr2);
+ ptr = ptr2;
+ }
+
+ let base = &mut (*ptr).data as *mut u8;
+ for byte in tmp.slice_to(amt).iter() {
+ *base.offset(len as int) = *byte;
+ len += 1;
+ }
+ (*ptr).fill = len;
+ }
+ ret
+ }
+ }
+}
+
+#[cfg(not(test))]
+impl<'a> Add<&'a str,~str> for &'a str {
+ #[inline]
+ fn add(&self, rhs: & &'a str) -> ~str {
+ let amt = self.len().checked_add(&rhs.len()).unwrap();
+ unsafe {
+ let ptr = alloc(amt) as *mut Vec<u8>;
+ let base = &mut (*ptr).data as *mut _;
+ ptr::copy_nonoverlapping_memory(base,
+ self.as_bytes().as_ptr(),
+ self.len());
+ let base = base.offset(self.len() as int);
+ ptr::copy_nonoverlapping_memory(base,
+ rhs.as_bytes().as_ptr(),
+ rhs.len());
+ (*ptr).fill = amt;
+ (*ptr).alloc = amt;
+ cast::transmute(ptr)
+ }
+ }
+}
+
+// Arrays
+
+impl<A: Clone> Clone for ~[A] {
+ #[inline]
+ fn clone(&self) -> ~[A] {
+ self.iter().map(|a| a.clone()).collect()
+ }
+}
+
+impl<A> FromIterator<A> for ~[A] {
+ fn from_iter<T: Iterator<A>>(mut iterator: T) -> ~[A] {
+ let (lower, _) = iterator.size_hint();
+ let cap = if lower == 0 {16} else {lower};
+ let mut cap = cap.checked_mul(&mem::size_of::<A>()).unwrap();
+ let mut len = 0;
+
+ unsafe {
+ let mut ptr = alloc(cap) as *mut Vec<A>;
+ let mut ret = cast::transmute(ptr);
+ for elt in iterator {
+ if len * mem::size_of::<A>() >= cap {
+ cap = cap.checked_mul(&2).unwrap();
+ let ptr2 = alloc(cap) as *mut Vec<A>;
+ ptr::copy_nonoverlapping_memory(&mut (*ptr2).data,
+ &(*ptr).data,
+ len);
+ free(ptr as *u8);
+ cast::forget(ret);
+ ret = cast::transmute(ptr2);
+ ptr = ptr2;
+ }
+
+ let base = &mut (*ptr).data as *mut A;
+ intrinsics::move_val_init(&mut *base.offset(len as int), elt);
+ len += 1;
+ (*ptr).fill = len * mem::nonzero_size_of::<A>();
+ }
+ ret
+ }
+ }
+}
+
+#[cfg(not(test))]
+impl<'a,T:Clone, V: Vector<T>> Add<V, ~[T]> for &'a [T] {
+ #[inline]
+ fn add(&self, rhs: &V) -> ~[T] {
+ let first = self.iter().map(|t| t.clone());
+ first.chain(rhs.as_slice().iter().map(|t| t.clone())).collect()
+ }
+}
+
+#[cfg(not(test))]
+impl<T:Clone, V: Vector<T>> Add<V, ~[T]> for ~[T] {
+ #[inline]
+ fn add(&self, rhs: &V) -> ~[T] {
+ self.as_slice() + rhs.as_slice()
+ }
+}
--- /dev/null
+// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Slice management and manipulation
+//!
+//! For more details `std::slice`.
+
+use cast;
+use cast::transmute;
+use clone::Clone;
+use container::Container;
+use cmp::{Eq, TotalOrd, Ordering, Less, Equal, Greater};
+use cmp;
+use default::Default;
+use iter::*;
+use num::{CheckedAdd, Saturating, div_rem};
+use option::{None, Option, Some};
+use ptr;
+use ptr::RawPtr;
+use mem;
+use mem::size_of;
+use kinds::marker;
+use raw::{Repr, Slice};
+
+/**
+ * Converts a pointer to A into a slice of length 1 (without copying).
+ */
+pub fn ref_slice<'a, A>(s: &'a A) -> &'a [A] {
+ unsafe {
+ transmute(Slice { data: s, len: 1 })
+ }
+}
+
+/**
+ * Converts a pointer to A into a slice of length 1 (without copying).
+ */
+pub fn mut_ref_slice<'a, A>(s: &'a mut A) -> &'a mut [A] {
+ unsafe {
+ let ptr: *A = transmute(s);
+ transmute(Slice { data: ptr, len: 1 })
+ }
+}
+
+/// An iterator over the slices of a vector separated by elements that
+/// match a predicate function.
+pub struct Splits<'a, T> {
+ v: &'a [T],
+ pred: |t: &T|: 'a -> bool,
+ finished: bool
+}
+
+impl<'a, T> Iterator<&'a [T]> for Splits<'a, T> {
+ #[inline]
+ fn next(&mut self) -> Option<&'a [T]> {
+ if self.finished { return None; }
+
+ match self.v.iter().position(|x| (self.pred)(x)) {
+ None => {
+ self.finished = true;
+ Some(self.v)
+ }
+ Some(idx) => {
+ let ret = Some(self.v.slice(0, idx));
+ self.v = self.v.slice(idx + 1, self.v.len());
+ ret
+ }
+ }
+ }
+
+ #[inline]
+ fn size_hint(&self) -> (uint, Option<uint>) {
+ if self.finished {
+ (0, Some(0))
+ } else {
+ (1, Some(self.v.len() + 1))
+ }
+ }
+}
+
+impl<'a, T> DoubleEndedIterator<&'a [T]> for Splits<'a, T> {
+ #[inline]
+ fn next_back(&mut self) -> Option<&'a [T]> {
+ if self.finished { return None; }
+
+ match self.v.iter().rposition(|x| (self.pred)(x)) {
+ None => {
+ self.finished = true;
+ Some(self.v)
+ }
+ Some(idx) => {
+ let ret = Some(self.v.slice(idx + 1, self.v.len()));
+ self.v = self.v.slice(0, idx);
+ ret
+ }
+ }
+ }
+}
+
+/// An iterator over the slices of a vector separated by elements that
+/// match a predicate function, splitting at most a fixed number of times.
+pub struct SplitsN<'a, T> {
+ iter: Splits<'a, T>,
+ count: uint,
+ invert: bool
+}
+
+impl<'a, T> Iterator<&'a [T]> for SplitsN<'a, T> {
+ #[inline]
+ fn next(&mut self) -> Option<&'a [T]> {
+ if self.count == 0 {
+ if self.iter.finished {
+ None
+ } else {
+ self.iter.finished = true;
+ Some(self.iter.v)
+ }
+ } else {
+ self.count -= 1;
+ if self.invert { self.iter.next_back() } else { self.iter.next() }
+ }
+ }
+
+ #[inline]
+ fn size_hint(&self) -> (uint, Option<uint>) {
+ if self.iter.finished {
+ (0, Some(0))
+ } else {
+ (1, Some(cmp::min(self.count, self.iter.v.len()) + 1))
+ }
+ }
+}
+
+// Functional utilities
+
+/// An iterator over the (overlapping) slices of length `size` within
+/// a vector.
+#[deriving(Clone)]
+pub struct Windows<'a, T> {
+ v: &'a [T],
+ size: uint
+}
+
+impl<'a, T> Iterator<&'a [T]> for Windows<'a, T> {
+ #[inline]
+ fn next(&mut self) -> Option<&'a [T]> {
+ if self.size > self.v.len() {
+ None
+ } else {
+ let ret = Some(self.v.slice(0, self.size));
+ self.v = self.v.slice(1, self.v.len());
+ ret
+ }
+ }
+
+ #[inline]
+ fn size_hint(&self) -> (uint, Option<uint>) {
+ if self.size > self.v.len() {
+ (0, Some(0))
+ } else {
+ let x = self.v.len() - self.size;
+ (x.saturating_add(1), x.checked_add(&1u))
+ }
+ }
+}
+
+/// An iterator over a vector in (non-overlapping) chunks (`size`
+/// elements at a time).
+///
+/// When the vector len is not evenly divided by the chunk size,
+/// the last slice of the iteration will be the remainder.
+#[deriving(Clone)]
+pub struct Chunks<'a, T> {
+ v: &'a [T],
+ size: uint
+}
+
+impl<'a, T> Iterator<&'a [T]> for Chunks<'a, T> {
+ #[inline]
+ fn next(&mut self) -> Option<&'a [T]> {
+ if self.v.len() == 0 {
+ None
+ } else {
+ let chunksz = cmp::min(self.v.len(), self.size);
+ let (fst, snd) = (self.v.slice_to(chunksz),
+ self.v.slice_from(chunksz));
+ self.v = snd;
+ Some(fst)
+ }
+ }
+
+ #[inline]
+ fn size_hint(&self) -> (uint, Option<uint>) {
+ if self.v.len() == 0 {
+ (0, Some(0))
+ } else {
+ let (n, rem) = div_rem(self.v.len(), self.size);
+ let n = if rem > 0 { n+1 } else { n };
+ (n, Some(n))
+ }
+ }
+}
+
+impl<'a, T> DoubleEndedIterator<&'a [T]> for Chunks<'a, T> {
+ #[inline]
+ fn next_back(&mut self) -> Option<&'a [T]> {
+ if self.v.len() == 0 {
+ None
+ } else {
+ let remainder = self.v.len() % self.size;
+ let chunksz = if remainder != 0 { remainder } else { self.size };
+ let (fst, snd) = (self.v.slice_to(self.v.len() - chunksz),
+ self.v.slice_from(self.v.len() - chunksz));
+ self.v = fst;
+ Some(snd)
+ }
+ }
+}
+
+impl<'a, T> RandomAccessIterator<&'a [T]> for Chunks<'a, T> {
+ #[inline]
+ fn indexable(&self) -> uint {
+ self.v.len()/self.size + if self.v.len() % self.size != 0 { 1 } else { 0 }
+ }
+
+ #[inline]
+ fn idx(&mut self, index: uint) -> Option<&'a [T]> {
+ if index < self.indexable() {
+ let lo = index * self.size;
+ let mut hi = lo + self.size;
+ if hi < lo || hi > self.v.len() { hi = self.v.len(); }
+
+ Some(self.v.slice(lo, hi))
+ } else {
+ None
+ }
+ }
+}
+
+// Equality
+
+#[cfg(not(test))]
+#[allow(missing_doc)]
+pub mod traits {
+ use super::*;
+
+ use cmp::{Eq, Ord, TotalEq, TotalOrd, Ordering, Equiv};
+ use iter::{order, Iterator};
+ use container::Container;
+
+ impl<'a,T:Eq> Eq for &'a [T] {
+ fn eq(&self, other: & &'a [T]) -> bool {
+ self.len() == other.len() &&
+ order::eq(self.iter(), other.iter())
+ }
+ fn ne(&self, other: & &'a [T]) -> bool {
+ self.len() != other.len() ||
+ order::ne(self.iter(), other.iter())
+ }
+ }
+
+ impl<T:Eq> Eq for ~[T] {
+ #[inline]
+ fn eq(&self, other: &~[T]) -> bool { self.as_slice() == *other }
+ #[inline]
+ fn ne(&self, other: &~[T]) -> bool { !self.eq(other) }
+ }
+
+ impl<'a,T:TotalEq> TotalEq for &'a [T] {}
+
+ impl<T:TotalEq> TotalEq for ~[T] {}
+
+ impl<'a,T:Eq, V: Vector<T>> Equiv<V> for &'a [T] {
+ #[inline]
+ fn equiv(&self, other: &V) -> bool { self.as_slice() == other.as_slice() }
+ }
+
+ impl<'a,T:Eq, V: Vector<T>> Equiv<V> for ~[T] {
+ #[inline]
+ fn equiv(&self, other: &V) -> bool { self.as_slice() == other.as_slice() }
+ }
+
+ impl<'a,T:TotalOrd> TotalOrd for &'a [T] {
+ fn cmp(&self, other: & &'a [T]) -> Ordering {
+ order::cmp(self.iter(), other.iter())
+ }
+ }
+
+ impl<T: TotalOrd> TotalOrd for ~[T] {
+ #[inline]
+ fn cmp(&self, other: &~[T]) -> Ordering { self.as_slice().cmp(&other.as_slice()) }
+ }
+
+ impl<'a, T: Ord> Ord for &'a [T] {
+ fn lt(&self, other: & &'a [T]) -> bool {
+ order::lt(self.iter(), other.iter())
+ }
+ #[inline]
+ fn le(&self, other: & &'a [T]) -> bool {
+ order::le(self.iter(), other.iter())
+ }
+ #[inline]
+ fn ge(&self, other: & &'a [T]) -> bool {
+ order::ge(self.iter(), other.iter())
+ }
+ #[inline]
+ fn gt(&self, other: & &'a [T]) -> bool {
+ order::gt(self.iter(), other.iter())
+ }
+ }
+
+ impl<T: Ord> Ord for ~[T] {
+ #[inline]
+ fn lt(&self, other: &~[T]) -> bool { self.as_slice() < other.as_slice() }
+ #[inline]
+ fn le(&self, other: &~[T]) -> bool { self.as_slice() <= other.as_slice() }
+ #[inline]
+ fn ge(&self, other: &~[T]) -> bool { self.as_slice() >= other.as_slice() }
+ #[inline]
+ fn gt(&self, other: &~[T]) -> bool { self.as_slice() > other.as_slice() }
+ }
+}
+
+#[cfg(test)]
+pub mod traits {}
+
+/// Any vector that can be represented as a slice.
+pub trait Vector<T> {
+ /// Work with `self` as a slice.
+ fn as_slice<'a>(&'a self) -> &'a [T];
+}
+
+impl<'a,T> Vector<T> for &'a [T] {
+ #[inline(always)]
+ fn as_slice<'a>(&'a self) -> &'a [T] { *self }
+}
+
+impl<T> Vector<T> for ~[T] {
+ #[inline(always)]
+ fn as_slice<'a>(&'a self) -> &'a [T] { let v: &'a [T] = *self; v }
+}
+
+impl<'a, T> Container for &'a [T] {
+ /// Returns the length of a vector
+ #[inline]
+ fn len(&self) -> uint {
+ self.repr().len
+ }
+}
+
+impl<T> Container for ~[T] {
+ /// Returns the length of a vector
+ #[inline]
+ fn len(&self) -> uint {
+ self.as_slice().len()
+ }
+}
+
+/// Extension methods for vectors
+pub trait ImmutableVector<'a, T> {
+ /**
+ * Returns a slice of self between `start` and `end`.
+ *
+ * Fails when `start` or `end` point outside the bounds of self,
+ * or when `start` > `end`.
+ */
+ fn slice(&self, start: uint, end: uint) -> &'a [T];
+
+ /**
+ * Returns a slice of self from `start` to the end of the vec.
+ *
+ * Fails when `start` points outside the bounds of self.
+ */
+ fn slice_from(&self, start: uint) -> &'a [T];
+
+ /**
+ * Returns a slice of self from the start of the vec to `end`.
+ *
+ * Fails when `end` points outside the bounds of self.
+ */
+ fn slice_to(&self, end: uint) -> &'a [T];
+ /// Returns an iterator over the vector
+ fn iter(self) -> Items<'a, T>;
+ /// Returns a reversed iterator over a vector
+ #[deprecated = "replaced by .iter().rev()"]
+ fn rev_iter(self) -> Rev<Items<'a, T>>;
+ /// Returns an iterator over the subslices of the vector which are
+ /// separated by elements that match `pred`. The matched element
+ /// is not contained in the subslices.
+ fn split(self, pred: |&T|: 'a -> bool) -> Splits<'a, T>;
+ /// Returns an iterator over the subslices of the vector which are
+ /// separated by elements that match `pred`, limited to splitting
+ /// at most `n` times. The matched element is not contained in
+ /// the subslices.
+ fn splitn(self, n: uint, pred: |&T|: 'a -> bool) -> SplitsN<'a, T>;
+ /// Returns an iterator over the subslices of the vector which are
+ /// separated by elements that match `pred`. This starts at the
+ /// end of the vector and works backwards. The matched element is
+ /// not contained in the subslices.
+ #[deprecated = "replaced by .split(pred).rev()"]
+ fn rsplit(self, pred: |&T|: 'a -> bool) -> Rev<Splits<'a, T>>;
+ /// Returns an iterator over the subslices of the vector which are
+ /// separated by elements that match `pred` limited to splitting
+ /// at most `n` times. This starts at the end of the vector and
+ /// works backwards. The matched element is not contained in the
+ /// subslices.
+ fn rsplitn(self, n: uint, pred: |&T|: 'a -> bool) -> SplitsN<'a, T>;
+
+ /**
+ * Returns an iterator over all contiguous windows of length
+ * `size`. The windows overlap. If the vector is shorter than
+ * `size`, the iterator returns no values.
+ *
+ * # Failure
+ *
+ * Fails if `size` is 0.
+ *
+ * # Example
+ *
+ * Print the adjacent pairs of a vector (i.e. `[1,2]`, `[2,3]`,
+ * `[3,4]`):
+ *
+ * ```rust
+ * let v = &[1,2,3,4];
+ * for win in v.windows(2) {
+ * println!("{:?}", win);
+ * }
+ * ```
+ *
+ */
+ fn windows(self, size: uint) -> Windows<'a, T>;
+ /**
+ *
+ * Returns an iterator over `size` elements of the vector at a
+ * time. The chunks do not overlap. If `size` does not divide the
+ * length of the vector, then the last chunk will not have length
+ * `size`.
+ *
+ * # Failure
+ *
+ * Fails if `size` is 0.
+ *
+ * # Example
+ *
+ * Print the vector two elements at a time (i.e. `[1,2]`,
+ * `[3,4]`, `[5]`):
+ *
+ * ```rust
+ * let v = &[1,2,3,4,5];
+ * for win in v.chunks(2) {
+ * println!("{:?}", win);
+ * }
+ * ```
+ *
+ */
+ fn chunks(self, size: uint) -> Chunks<'a, T>;
+
+ /// Returns the element of a vector at the given index, or `None` if the
+ /// index is out of bounds
+ fn get(&self, index: uint) -> Option<&'a T>;
+ /// Returns the first element of a vector, or `None` if it is empty
+ fn head(&self) -> Option<&'a T>;
+ /// Returns all but the first element of a vector
+ fn tail(&self) -> &'a [T];
+ /// Returns all but the first `n' elements of a vector
+ fn tailn(&self, n: uint) -> &'a [T];
+ /// Returns all but the last element of a vector
+ fn init(&self) -> &'a [T];
+ /// Returns all but the last `n' elements of a vector
+ fn initn(&self, n: uint) -> &'a [T];
+ /// Returns the last element of a vector, or `None` if it is empty.
+ fn last(&self) -> Option<&'a T>;
+
+ /// Returns a pointer to the element at the given index, without doing
+ /// bounds checking.
+ unsafe fn unsafe_ref(self, index: uint) -> &'a T;
+
+ /**
+ * Returns an unsafe pointer to the vector's buffer
+ *
+ * The caller must ensure that the vector outlives the pointer this
+ * function returns, or else it will end up pointing to garbage.
+ *
+ * Modifying the vector may cause its buffer to be reallocated, which
+ * would also make any pointers to it invalid.
+ */
+ fn as_ptr(&self) -> *T;
+
+ /**
+ * Binary search a sorted vector with a comparator function.
+ *
+ * The comparator function should implement an order consistent
+ * with the sort order of the underlying vector, returning an
+ * order code that indicates whether its argument is `Less`,
+ * `Equal` or `Greater` the desired target.
+ *
+ * Returns the index where the comparator returned `Equal`, or `None` if
+ * not found.
+ */
+ fn bsearch(&self, f: |&T| -> Ordering) -> Option<uint>;
+
+ /**
+ * Returns a mutable reference to the first element in this slice
+ * and adjusts the slice in place so that it no longer contains
+ * that element. O(1).
+ *
+ * Equivalent to:
+ *
+ * ```ignore
+ * if self.len() == 0 { return None }
+ * let head = &self[0];
+ * *self = self.slice_from(1);
+ * Some(head)
+ * ```
+ *
+ * Returns `None` if vector is empty
+ */
+ fn shift_ref(&mut self) -> Option<&'a T>;
+
+ /**
+ * Returns a mutable reference to the last element in this slice
+ * and adjusts the slice in place so that it no longer contains
+ * that element. O(1).
+ *
+ * Equivalent to:
+ *
+ * ```ignore
+ * if self.len() == 0 { return None; }
+ * let tail = &self[self.len() - 1];
+ * *self = self.slice_to(self.len() - 1);
+ * Some(tail)
+ * ```
+ *
+ * Returns `None` if slice is empty.
+ */
+ fn pop_ref(&mut self) -> Option<&'a T>;
+}
+
+impl<'a,T> ImmutableVector<'a, T> for &'a [T] {
+ #[inline]
+ fn slice(&self, start: uint, end: uint) -> &'a [T] {
+ assert!(start <= end);
+ assert!(end <= self.len());
+ unsafe {
+ transmute(Slice {
+ data: self.as_ptr().offset(start as int),
+ len: (end - start)
+ })
+ }
+ }
+
+ #[inline]
+ fn slice_from(&self, start: uint) -> &'a [T] {
+ self.slice(start, self.len())
+ }
+
+ #[inline]
+ fn slice_to(&self, end: uint) -> &'a [T] {
+ self.slice(0, end)
+ }
+
+ #[inline]
+ fn iter(self) -> Items<'a, T> {
+ unsafe {
+ let p = self.as_ptr();
+ if mem::size_of::<T>() == 0 {
+ Items{ptr: p,
+ end: (p as uint + self.len()) as *T,
+ marker: marker::ContravariantLifetime::<'a>}
+ } else {
+ Items{ptr: p,
+ end: p.offset(self.len() as int),
+ marker: marker::ContravariantLifetime::<'a>}
+ }
+ }
+ }
+
+ #[inline]
+ #[deprecated = "replaced by .iter().rev()"]
+ fn rev_iter(self) -> Rev<Items<'a, T>> {
+ self.iter().rev()
+ }
+
+ #[inline]
+ fn split(self, pred: |&T|: 'a -> bool) -> Splits<'a, T> {
+ Splits {
+ v: self,
+ pred: pred,
+ finished: false
+ }
+ }
+
+ #[inline]
+ fn splitn(self, n: uint, pred: |&T|: 'a -> bool) -> SplitsN<'a, T> {
+ SplitsN {
+ iter: self.split(pred),
+ count: n,
+ invert: false
+ }
+ }
+
+ #[inline]
+ #[deprecated = "replaced by .split(pred).rev()"]
+ fn rsplit(self, pred: |&T|: 'a -> bool) -> Rev<Splits<'a, T>> {
+ self.split(pred).rev()
+ }
+
+ #[inline]
+ fn rsplitn(self, n: uint, pred: |&T|: 'a -> bool) -> SplitsN<'a, T> {
+ SplitsN {
+ iter: self.split(pred),
+ count: n,
+ invert: true
+ }
+ }
+
+ #[inline]
+ fn windows(self, size: uint) -> Windows<'a, T> {
+ assert!(size != 0);
+ Windows { v: self, size: size }
+ }
+
+ #[inline]
+ fn chunks(self, size: uint) -> Chunks<'a, T> {
+ assert!(size != 0);
+ Chunks { v: self, size: size }
+ }
+
+ #[inline]
+ fn get(&self, index: uint) -> Option<&'a T> {
+ if index < self.len() { Some(&self[index]) } else { None }
+ }
+
+ #[inline]
+ fn head(&self) -> Option<&'a T> {
+ if self.len() == 0 { None } else { Some(&self[0]) }
+ }
+
+ #[inline]
+ fn tail(&self) -> &'a [T] { self.slice(1, self.len()) }
+
+ #[inline]
+ fn tailn(&self, n: uint) -> &'a [T] { self.slice(n, self.len()) }
+
+ #[inline]
+ fn init(&self) -> &'a [T] {
+ self.slice(0, self.len() - 1)
+ }
+
+ #[inline]
+ fn initn(&self, n: uint) -> &'a [T] {
+ self.slice(0, self.len() - n)
+ }
+
+ #[inline]
+ fn last(&self) -> Option<&'a T> {
+ if self.len() == 0 { None } else { Some(&self[self.len() - 1]) }
+ }
+
+ #[inline]
+ unsafe fn unsafe_ref(self, index: uint) -> &'a T {
+ transmute(self.repr().data.offset(index as int))
+ }
+
+ #[inline]
+ fn as_ptr(&self) -> *T {
+ self.repr().data
+ }
+
+
+ fn bsearch(&self, f: |&T| -> Ordering) -> Option<uint> {
+ let mut base : uint = 0;
+ let mut lim : uint = self.len();
+
+ while lim != 0 {
+ let ix = base + (lim >> 1);
+ match f(&self[ix]) {
+ Equal => return Some(ix),
+ Less => {
+ base = ix + 1;
+ lim -= 1;
+ }
+ Greater => ()
+ }
+ lim >>= 1;
+ }
+ return None;
+ }
+
+ fn shift_ref(&mut self) -> Option<&'a T> {
+ if self.len() == 0 { return None; }
+ unsafe {
+ let s: &mut Slice<T> = transmute(self);
+ Some(&*raw::shift_ptr(s))
+ }
+ }
+
+ fn pop_ref(&mut self) -> Option<&'a T> {
+ if self.len() == 0 { return None; }
+ unsafe {
+ let s: &mut Slice<T> = transmute(self);
+ Some(&*raw::pop_ptr(s))
+ }
+ }
+}
+
+/// Extension methods for vectors contain `Eq` elements.
+pub trait ImmutableEqVector<T:Eq> {
+ /// Find the first index containing a matching value
+ fn position_elem(&self, t: &T) -> Option<uint>;
+
+ /// Find the last index containing a matching value
+ fn rposition_elem(&self, t: &T) -> Option<uint>;
+
+ /// Return true if a vector contains an element with the given value
+ fn contains(&self, x: &T) -> bool;
+
+ /// Returns true if `needle` is a prefix of the vector.
+ fn starts_with(&self, needle: &[T]) -> bool;
+
+ /// Returns true if `needle` is a suffix of the vector.
+ fn ends_with(&self, needle: &[T]) -> bool;
+}
+
+impl<'a,T:Eq> ImmutableEqVector<T> for &'a [T] {
+ #[inline]
+ fn position_elem(&self, x: &T) -> Option<uint> {
+ self.iter().position(|y| *x == *y)
+ }
+
+ #[inline]
+ fn rposition_elem(&self, t: &T) -> Option<uint> {
+ self.iter().rposition(|x| *x == *t)
+ }
+
+ #[inline]
+ fn contains(&self, x: &T) -> bool {
+ self.iter().any(|elt| *x == *elt)
+ }
+
+ #[inline]
+ fn starts_with(&self, needle: &[T]) -> bool {
+ let n = needle.len();
+ self.len() >= n && needle == self.slice_to(n)
+ }
+
+ #[inline]
+ fn ends_with(&self, needle: &[T]) -> bool {
+ let (m, n) = (self.len(), needle.len());
+ m >= n && needle == self.slice_from(m - n)
+ }
+}
+
+/// Extension methods for vectors containing `TotalOrd` elements.
+pub trait ImmutableTotalOrdVector<T: TotalOrd> {
+ /**
+ * Binary search a sorted vector for a given element.
+ *
+ * Returns the index of the element or None if not found.
+ */
+ fn bsearch_elem(&self, x: &T) -> Option<uint>;
+}
+
+impl<'a, T: TotalOrd> ImmutableTotalOrdVector<T> for &'a [T] {
+ fn bsearch_elem(&self, x: &T) -> Option<uint> {
+ self.bsearch(|p| p.cmp(x))
+ }
+}
+
+/// Extension methods for vectors such that their elements are
+/// mutable.
+pub trait MutableVector<'a, T> {
+ /// Work with `self` as a mut slice.
+ /// Primarily intended for getting a &mut [T] from a [T, ..N].
+ fn as_mut_slice(self) -> &'a mut [T];
+
+ /// Return a slice that points into another slice.
+ fn mut_slice(self, start: uint, end: uint) -> &'a mut [T];
+
+ /**
+ * Returns a slice of self from `start` to the end of the vec.
+ *
+ * Fails when `start` points outside the bounds of self.
+ */
+ fn mut_slice_from(self, start: uint) -> &'a mut [T];
+
+ /**
+ * Returns a slice of self from the start of the vec to `end`.
+ *
+ * Fails when `end` points outside the bounds of self.
+ */
+ fn mut_slice_to(self, end: uint) -> &'a mut [T];
+
+ /// Returns an iterator that allows modifying each value
+ fn mut_iter(self) -> MutItems<'a, T>;
+
+ /// Returns a mutable pointer to the last item in the vector.
+ fn mut_last(self) -> Option<&'a mut T>;
+
+ /// Returns a reversed iterator that allows modifying each value
+ #[deprecated = "replaced by .mut_iter().rev()"]
+ fn mut_rev_iter(self) -> Rev<MutItems<'a, T>>;
+
+ /// Returns an iterator over the mutable subslices of the vector
+ /// which are separated by elements that match `pred`. The
+ /// matched element is not contained in the subslices.
+ fn mut_split(self, pred: |&T|: 'a -> bool) -> MutSplits<'a, T>;
+
+ /**
+ * Returns an iterator over `size` elements of the vector at a time.
+ * The chunks are mutable and do not overlap. If `size` does not divide the
+ * length of the vector, then the last chunk will not have length
+ * `size`.
+ *
+ * # Failure
+ *
+ * Fails if `size` is 0.
+ */
+ fn mut_chunks(self, chunk_size: uint) -> MutChunks<'a, T>;
+
+ /**
+ * Returns a mutable reference to the first element in this slice
+ * and adjusts the slice in place so that it no longer contains
+ * that element. O(1).
+ *
+ * Equivalent to:
+ *
+ * ```ignore
+ * if self.len() == 0 { return None; }
+ * let head = &mut self[0];
+ * *self = self.mut_slice_from(1);
+ * Some(head)
+ * ```
+ *
+ * Returns `None` if slice is empty
+ */
+ fn mut_shift_ref(&mut self) -> Option<&'a mut T>;
+
+ /**
+ * Returns a mutable reference to the last element in this slice
+ * and adjusts the slice in place so that it no longer contains
+ * that element. O(1).
+ *
+ * Equivalent to:
+ *
+ * ```ignore
+ * if self.len() == 0 { return None; }
+ * let tail = &mut self[self.len() - 1];
+ * *self = self.mut_slice_to(self.len() - 1);
+ * Some(tail)
+ * ```
+ *
+ * Returns `None` if slice is empty.
+ */
+ fn mut_pop_ref(&mut self) -> Option<&'a mut T>;
+
+ /// Swaps two elements in a vector.
+ ///
+ /// Fails if `a` or `b` are out of bounds.
+ ///
+ /// # Arguments
+ ///
+ /// * a - The index of the first element
+ /// * b - The index of the second element
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// let mut v = ["a", "b", "c", "d"];
+ /// v.swap(1, 3);
+ /// assert!(v == ["a", "d", "c", "b"]);
+ /// ```
+ fn swap(self, a: uint, b: uint);
+
+
+ /// Divides one `&mut` into two at an index.
+ ///
+ /// The first will contain all indices from `[0, mid)` (excluding
+ /// the index `mid` itself) and the second will contain all
+ /// indices from `[mid, len)` (excluding the index `len` itself).
+ ///
+ /// Fails if `mid > len`.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// let mut v = [1, 2, 3, 4, 5, 6];
+ ///
+ /// // scoped to restrict the lifetime of the borrows
+ /// {
+ /// let (left, right) = v.mut_split_at(0);
+ /// assert!(left == &mut []);
+ /// assert!(right == &mut [1, 2, 3, 4, 5, 6]);
+ /// }
+ ///
+ /// {
+ /// let (left, right) = v.mut_split_at(2);
+ /// assert!(left == &mut [1, 2]);
+ /// assert!(right == &mut [3, 4, 5, 6]);
+ /// }
+ ///
+ /// {
+ /// let (left, right) = v.mut_split_at(6);
+ /// assert!(left == &mut [1, 2, 3, 4, 5, 6]);
+ /// assert!(right == &mut []);
+ /// }
+ /// ```
+ fn mut_split_at(self, mid: uint) -> (&'a mut [T], &'a mut [T]);
+
+ /// Reverse the order of elements in a vector, in place.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// let mut v = [1, 2, 3];
+ /// v.reverse();
+ /// assert!(v == [3, 2, 1]);
+ /// ```
+ fn reverse(self);
+
+ /// Returns an unsafe mutable pointer to the element in index
+ unsafe fn unsafe_mut_ref(self, index: uint) -> &'a mut T;
+
+ /// Return an unsafe mutable pointer to the vector's buffer.
+ ///
+ /// The caller must ensure that the vector outlives the pointer this
+ /// function returns, or else it will end up pointing to garbage.
+ ///
+ /// Modifying the vector may cause its buffer to be reallocated, which
+ /// would also make any pointers to it invalid.
+ #[inline]
+ fn as_mut_ptr(self) -> *mut T;
+
+ /// Unsafely sets the element in index to the value.
+ ///
+ /// This performs no bounds checks, and it is undefined behaviour
+ /// if `index` is larger than the length of `self`. However, it
+ /// does run the destructor at `index`. It is equivalent to
+ /// `self[index] = val`.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// let mut v = ~["foo".to_owned(), "bar".to_owned(), "baz".to_owned()];
+ ///
+ /// unsafe {
+ /// // `"baz".to_owned()` is deallocated.
+ /// v.unsafe_set(2, "qux".to_owned());
+ ///
+ /// // Out of bounds: could cause a crash, or overwriting
+ /// // other data, or something else.
+ /// // v.unsafe_set(10, "oops".to_owned());
+ /// }
+ /// ```
+ unsafe fn unsafe_set(self, index: uint, val: T);
+
+ /// Unchecked vector index assignment. Does not drop the
+ /// old value and hence is only suitable when the vector
+ /// is newly allocated.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// let mut v = ["foo".to_owned(), "bar".to_owned()];
+ ///
+ /// // memory leak! `"bar".to_owned()` is not deallocated.
+ /// unsafe { v.init_elem(1, "baz".to_owned()); }
+ /// ```
+ unsafe fn init_elem(self, i: uint, val: T);
+
+ /// Copies raw bytes from `src` to `self`.
+ ///
+ /// This does not run destructors on the overwritten elements, and
+ /// ignores move semantics. `self` and `src` must not
+ /// overlap. Fails if `self` is shorter than `src`.
+ unsafe fn copy_memory(self, src: &[T]);
+}
+
+impl<'a,T> MutableVector<'a, T> for &'a mut [T] {
+ #[inline]
+ fn as_mut_slice(self) -> &'a mut [T] { self }
+
+ fn mut_slice(self, start: uint, end: uint) -> &'a mut [T] {
+ assert!(start <= end);
+ assert!(end <= self.len());
+ unsafe {
+ transmute(Slice {
+ data: self.as_mut_ptr().offset(start as int) as *T,
+ len: (end - start)
+ })
+ }
+ }
+
+ #[inline]
+ fn mut_slice_from(self, start: uint) -> &'a mut [T] {
+ let len = self.len();
+ self.mut_slice(start, len)
+ }
+
+ #[inline]
+ fn mut_slice_to(self, end: uint) -> &'a mut [T] {
+ self.mut_slice(0, end)
+ }
+
+ #[inline]
+ fn mut_split_at(self, mid: uint) -> (&'a mut [T], &'a mut [T]) {
+ unsafe {
+ let len = self.len();
+ let self2: &'a mut [T] = cast::transmute_copy(&self);
+ (self.mut_slice(0, mid), self2.mut_slice(mid, len))
+ }
+ }
+
+ #[inline]
+ fn mut_iter(self) -> MutItems<'a, T> {
+ unsafe {
+ let p = self.as_mut_ptr();
+ if mem::size_of::<T>() == 0 {
+ MutItems{ptr: p,
+ end: (p as uint + self.len()) as *mut T,
+ marker: marker::ContravariantLifetime::<'a>,
+ marker2: marker::NoCopy}
+ } else {
+ MutItems{ptr: p,
+ end: p.offset(self.len() as int),
+ marker: marker::ContravariantLifetime::<'a>,
+ marker2: marker::NoCopy}
+ }
+ }
+ }
+
+ #[inline]
+ fn mut_last(self) -> Option<&'a mut T> {
+ let len = self.len();
+ if len == 0 { return None; }
+ Some(&mut self[len - 1])
+ }
+
+ #[inline]
+ #[deprecated = "replaced by .mut_iter().rev()"]
+ fn mut_rev_iter(self) -> Rev<MutItems<'a, T>> {
+ self.mut_iter().rev()
+ }
+
+ #[inline]
+ fn mut_split(self, pred: |&T|: 'a -> bool) -> MutSplits<'a, T> {
+ MutSplits { v: self, pred: pred, finished: false }
+ }
+
+ #[inline]
+ fn mut_chunks(self, chunk_size: uint) -> MutChunks<'a, T> {
+ assert!(chunk_size > 0);
+ MutChunks { v: self, chunk_size: chunk_size }
+ }
+
+ fn mut_shift_ref(&mut self) -> Option<&'a mut T> {
+ if self.len() == 0 { return None; }
+ unsafe {
+ let s: &mut Slice<T> = transmute(self);
+ // FIXME #13933: this `&` -> `&mut` cast is a little
+ // dubious
+ Some(&mut *(raw::shift_ptr(s) as *mut _))
+ }
+ }
+
+ fn mut_pop_ref(&mut self) -> Option<&'a mut T> {
+ if self.len() == 0 { return None; }
+ unsafe {
+ let s: &mut Slice<T> = transmute(self);
+ // FIXME #13933: this `&` -> `&mut` cast is a little
+ // dubious
+ Some(&mut *(raw::pop_ptr(s) as *mut _))
+ }
+ }
+
+ fn swap(self, a: uint, b: uint) {
+ unsafe {
+ // Can't take two mutable loans from one vector, so instead just cast
+ // them to their raw pointers to do the swap
+ let pa: *mut T = &mut self[a];
+ let pb: *mut T = &mut self[b];
+ ptr::swap(pa, pb);
+ }
+ }
+
+ fn reverse(self) {
+ let mut i: uint = 0;
+ let ln = self.len();
+ while i < ln / 2 {
+ self.swap(i, ln - i - 1);
+ i += 1;
+ }
+ }
+
+ #[inline]
+ unsafe fn unsafe_mut_ref(self, index: uint) -> &'a mut T {
+ transmute((self.repr().data as *mut T).offset(index as int))
+ }
+
+ #[inline]
+ fn as_mut_ptr(self) -> *mut T {
+ self.repr().data as *mut T
+ }
+
+ #[inline]
+ unsafe fn unsafe_set(self, index: uint, val: T) {
+ *self.unsafe_mut_ref(index) = val;
+ }
+
+ #[inline]
+ unsafe fn init_elem(self, i: uint, val: T) {
+ mem::move_val_init(&mut (*self.as_mut_ptr().offset(i as int)), val);
+ }
+
+ #[inline]
+ unsafe fn copy_memory(self, src: &[T]) {
+ let len_src = src.len();
+ assert!(self.len() >= len_src);
+ ptr::copy_nonoverlapping_memory(self.as_mut_ptr(), src.as_ptr(), len_src)
+ }
+}
+
+/// Trait for &[T] where T is Cloneable
+pub trait MutableCloneableVector<T> {
+ /// Copies as many elements from `src` as it can into `self` (the
+ /// shorter of `self.len()` and `src.len()`). Returns the number
+ /// of elements copied.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// use std::slice::MutableCloneableVector;
+ ///
+ /// let mut dst = [0, 0, 0];
+ /// let src = [1, 2];
+ ///
+ /// assert!(dst.copy_from(src) == 2);
+ /// assert!(dst == [1, 2, 0]);
+ ///
+ /// let src2 = [3, 4, 5, 6];
+ /// assert!(dst.copy_from(src2) == 3);
+ /// assert!(dst == [3, 4, 5]);
+ /// ```
+ fn copy_from(self, &[T]) -> uint;
+}
+
+impl<'a, T:Clone> MutableCloneableVector<T> for &'a mut [T] {
+ #[inline]
+ fn copy_from(self, src: &[T]) -> uint {
+ for (a, b) in self.mut_iter().zip(src.iter()) {
+ a.clone_from(b);
+ }
+ cmp::min(self.len(), src.len())
+ }
+}
+
+/// Unsafe operations
+pub mod raw {
+ use cast::transmute;
+ use iter::Iterator;
+ use ptr::RawPtr;
+ use raw::Slice;
+
+ /**
+ * Form a slice from a pointer and length (as a number of units,
+ * not bytes).
+ */
+ #[inline]
+ pub unsafe fn buf_as_slice<T,U>(p: *T, len: uint, f: |v: &[T]| -> U)
+ -> U {
+ f(transmute(Slice {
+ data: p,
+ len: len
+ }))
+ }
+
+ /**
+ * Form a slice from a pointer and length (as a number of units,
+ * not bytes).
+ */
+ #[inline]
+ pub unsafe fn mut_buf_as_slice<T,
+ U>(
+ p: *mut T,
+ len: uint,
+ f: |v: &mut [T]| -> U)
+ -> U {
+ f(transmute(Slice {
+ data: p as *T,
+ len: len
+ }))
+ }
+
+ /**
+ * Returns a pointer to first element in slice and adjusts
+ * slice so it no longer contains that element. Fails if
+ * slice is empty. O(1).
+ */
+ pub unsafe fn shift_ptr<T>(slice: &mut Slice<T>) -> *T {
+ if slice.len == 0 { fail!("shift on empty slice"); }
+ let head: *T = slice.data;
+ slice.data = slice.data.offset(1);
+ slice.len -= 1;
+ head
+ }
+
+ /**
+ * Returns a pointer to last element in slice and adjusts
+ * slice so it no longer contains that element. Fails if
+ * slice is empty. O(1).
+ */
+ pub unsafe fn pop_ptr<T>(slice: &mut Slice<T>) -> *T {
+ if slice.len == 0 { fail!("pop on empty slice"); }
+ let tail: *T = slice.data.offset((slice.len - 1) as int);
+ slice.len -= 1;
+ tail
+ }
+}
+
+/// Operations on `[u8]`.
+pub mod bytes {
+ use container::Container;
+ use ptr;
+ use slice::MutableVector;
+
+ /// A trait for operations on mutable `[u8]`s.
+ pub trait MutableByteVector {
+ /// Sets all bytes of the receiver to the given value.
+ fn set_memory(self, value: u8);
+ }
+
+ impl<'a> MutableByteVector for &'a mut [u8] {
+ #[inline]
+ fn set_memory(self, value: u8) {
+ unsafe { ptr::set_memory(self.as_mut_ptr(), value, self.len()) };
+ }
+ }
+
+ /// Copies data from `src` to `dst`
+ ///
+ /// `src` and `dst` must not overlap. Fails if the length of `dst`
+ /// is less than the length of `src`.
+ #[inline]
+ pub fn copy_memory(dst: &mut [u8], src: &[u8]) {
+ // Bound checks are done at .copy_memory.
+ unsafe { dst.copy_memory(src) }
+ }
+}
+
+/// Immutable slice iterator
+pub struct Items<'a, T> {
+ ptr: *T,
+ end: *T,
+ marker: marker::ContravariantLifetime<'a>
+}
+
+/// Mutable slice iterator
+pub struct MutItems<'a, T> {
+ ptr: *mut T,
+ end: *mut T,
+ marker: marker::ContravariantLifetime<'a>,
+ marker2: marker::NoCopy
+}
+
+macro_rules! iterator {
+ (struct $name:ident -> $ptr:ty, $elem:ty) => {
+ impl<'a, T> Iterator<$elem> for $name<'a, T> {
+ #[inline]
+ fn next(&mut self) -> Option<$elem> {
+ // could be implemented with slices, but this avoids bounds checks
+ unsafe {
+ if self.ptr == self.end {
+ None
+ } else {
+ let old = self.ptr;
+ self.ptr = if mem::size_of::<T>() == 0 {
+ // purposefully don't use 'ptr.offset' because for
+ // vectors with 0-size elements this would return the
+ // same pointer.
+ transmute(self.ptr as uint + 1)
+ } else {
+ self.ptr.offset(1)
+ };
+
+ Some(transmute(old))
+ }
+ }
+ }
+
+ #[inline]
+ fn size_hint(&self) -> (uint, Option<uint>) {
+ let diff = (self.end as uint) - (self.ptr as uint);
+ let exact = diff / mem::nonzero_size_of::<T>();
+ (exact, Some(exact))
+ }
+ }
+
+ impl<'a, T> DoubleEndedIterator<$elem> for $name<'a, T> {
+ #[inline]
+ fn next_back(&mut self) -> Option<$elem> {
+ // could be implemented with slices, but this avoids bounds checks
+ unsafe {
+ if self.end == self.ptr {
+ None
+ } else {
+ self.end = if mem::size_of::<T>() == 0 {
+ // See above for why 'ptr.offset' isn't used
+ transmute(self.end as uint - 1)
+ } else {
+ self.end.offset(-1)
+ };
+ Some(transmute(self.end))
+ }
+ }
+ }
+ }
+ }
+}
+
+impl<'a, T> RandomAccessIterator<&'a T> for Items<'a, T> {
+ #[inline]
+ fn indexable(&self) -> uint {
+ let (exact, _) = self.size_hint();
+ exact
+ }
+
+ #[inline]
+ fn idx(&mut self, index: uint) -> Option<&'a T> {
+ unsafe {
+ if index < self.indexable() {
+ transmute(self.ptr.offset(index as int))
+ } else {
+ None
+ }
+ }
+ }
+}
+
+iterator!{struct Items -> *T, &'a T}
+#[deprecated = "replaced by Rev<Items<'a, T>>"]
+pub type RevItems<'a, T> = Rev<Items<'a, T>>;
+
+impl<'a, T> ExactSize<&'a T> for Items<'a, T> {}
+impl<'a, T> ExactSize<&'a mut T> for MutItems<'a, T> {}
+
+impl<'a, T> Clone for Items<'a, T> {
+ fn clone(&self) -> Items<'a, T> { *self }
+}
+
+iterator!{struct MutItems -> *mut T, &'a mut T}
+#[deprecated = "replaced by Rev<MutItems<'a, T>>"]
+pub type RevMutItems<'a, T> = Rev<MutItems<'a, T>>;
+
+/// An iterator over the subslices of the vector which are separated
+/// by elements that match `pred`.
+pub struct MutSplits<'a, T> {
+ v: &'a mut [T],
+ pred: |t: &T|: 'a -> bool,
+ finished: bool
+}
+
+impl<'a, T> Iterator<&'a mut [T]> for MutSplits<'a, T> {
+ #[inline]
+ fn next(&mut self) -> Option<&'a mut [T]> {
+ if self.finished { return None; }
+
+ let pred = &mut self.pred;
+ match self.v.iter().position(|x| (*pred)(x)) {
+ None => {
+ self.finished = true;
+ let tmp = mem::replace(&mut self.v, &mut []);
+ let len = tmp.len();
+ let (head, tail) = tmp.mut_split_at(len);
+ self.v = tail;
+ Some(head)
+ }
+ Some(idx) => {
+ let tmp = mem::replace(&mut self.v, &mut []);
+ let (head, tail) = tmp.mut_split_at(idx);
+ self.v = tail.mut_slice_from(1);
+ Some(head)
+ }
+ }
+ }
+
+ #[inline]
+ fn size_hint(&self) -> (uint, Option<uint>) {
+ if self.finished {
+ (0, Some(0))
+ } else {
+ // if the predicate doesn't match anything, we yield one slice
+ // if it matches every element, we yield len+1 empty slices.
+ (1, Some(self.v.len() + 1))
+ }
+ }
+}
+
+impl<'a, T> DoubleEndedIterator<&'a mut [T]> for MutSplits<'a, T> {
+ #[inline]
+ fn next_back(&mut self) -> Option<&'a mut [T]> {
+ if self.finished { return None; }
+
+ let pred = &mut self.pred;
+ match self.v.iter().rposition(|x| (*pred)(x)) {
+ None => {
+ self.finished = true;
+ let tmp = mem::replace(&mut self.v, &mut []);
+ Some(tmp)
+ }
+ Some(idx) => {
+ let tmp = mem::replace(&mut self.v, &mut []);
+ let (head, tail) = tmp.mut_split_at(idx);
+ self.v = head;
+ Some(tail.mut_slice_from(1))
+ }
+ }
+ }
+}
+
+/// An iterator over a vector in (non-overlapping) mutable chunks (`size` elements at a time). When
+/// the vector len is not evenly divided by the chunk size, the last slice of the iteration will be
+/// the remainder.
+pub struct MutChunks<'a, T> {
+ v: &'a mut [T],
+ chunk_size: uint
+}
+
+impl<'a, T> Iterator<&'a mut [T]> for MutChunks<'a, T> {
+ #[inline]
+ fn next(&mut self) -> Option<&'a mut [T]> {
+ if self.v.len() == 0 {
+ None
+ } else {
+ let sz = cmp::min(self.v.len(), self.chunk_size);
+ let tmp = mem::replace(&mut self.v, &mut []);
+ let (head, tail) = tmp.mut_split_at(sz);
+ self.v = tail;
+ Some(head)
+ }
+ }
+
+ #[inline]
+ fn size_hint(&self) -> (uint, Option<uint>) {
+ if self.v.len() == 0 {
+ (0, Some(0))
+ } else {
+ let (n, rem) = div_rem(self.v.len(), self.chunk_size);
+ let n = if rem > 0 { n + 1 } else { n };
+ (n, Some(n))
+ }
+ }
+}
+
+impl<'a, T> DoubleEndedIterator<&'a mut [T]> for MutChunks<'a, T> {
+ #[inline]
+ fn next_back(&mut self) -> Option<&'a mut [T]> {
+ if self.v.len() == 0 {
+ None
+ } else {
+ let remainder = self.v.len() % self.chunk_size;
+ let sz = if remainder != 0 { remainder } else { self.chunk_size };
+ let tmp = mem::replace(&mut self.v, &mut []);
+ let tmp_len = tmp.len();
+ let (head, tail) = tmp.mut_split_at(tmp_len - sz);
+ self.v = head;
+ Some(tail)
+ }
+ }
+}
+
+impl<'a, T> Default for &'a [T] {
+ fn default() -> &'a [T] { &[] }
+}
+
+impl<T> Default for ~[T] {
+ fn default() -> ~[T] { ~[] }
+}
--- /dev/null
+// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! String manipulation
+//!
+//! For more details, see std::str
+
+use cast::transmute;
+use cast;
+use char;
+use clone::Clone;
+use cmp::{Eq, TotalEq};
+use container::Container;
+use default::Default;
+use iter::{Filter, Map, Iterator};
+use iter::{Rev, DoubleEndedIterator, ExactSize};
+use num::Saturating;
+use option::{None, Option, Some};
+use raw::Repr;
+use slice::{ImmutableVector, Vector};
+use slice;
+
+/*
+Section: Creating a string
+*/
+
+/// Converts a vector to a string slice without performing any allocations.
+///
+/// Once the slice has been validated as utf-8, it is transmuted in-place and
+/// returned as a '&str' instead of a '&[u8]'
+///
+/// Returns None if the slice is not utf-8.
+pub fn from_utf8<'a>(v: &'a [u8]) -> Option<&'a str> {
+ if is_utf8(v) {
+ Some(unsafe { raw::from_utf8(v) })
+ } else { None }
+}
+
+/// Something that can be used to compare against a character
+pub trait CharEq {
+ /// Determine if the splitter should split at the given character
+ fn matches(&mut self, char) -> bool;
+ /// Indicate if this is only concerned about ASCII characters,
+ /// which can allow for a faster implementation.
+ fn only_ascii(&self) -> bool;
+}
+
+impl CharEq for char {
+ #[inline]
+ fn matches(&mut self, c: char) -> bool { *self == c }
+
+ #[inline]
+ fn only_ascii(&self) -> bool { (*self as uint) < 128 }
+}
+
+impl<'a> CharEq for |char|: 'a -> bool {
+ #[inline]
+ fn matches(&mut self, c: char) -> bool { (*self)(c) }
+
+ #[inline]
+ fn only_ascii(&self) -> bool { false }
+}
+
+impl CharEq for extern "Rust" fn(char) -> bool {
+ #[inline]
+ fn matches(&mut self, c: char) -> bool { (*self)(c) }
+
+ #[inline]
+ fn only_ascii(&self) -> bool { false }
+}
+
+impl<'a> CharEq for &'a [char] {
+ #[inline]
+ fn matches(&mut self, c: char) -> bool {
+ self.iter().any(|&mut m| m.matches(c))
+ }
+
+ #[inline]
+ fn only_ascii(&self) -> bool {
+ self.iter().all(|m| m.only_ascii())
+ }
+}
+
+/*
+Section: Iterators
+*/
+
+/// External iterator for a string's characters.
+/// Use with the `std::iter` module.
+#[deriving(Clone)]
+pub struct Chars<'a> {
+ /// The slice remaining to be iterated
+ string: &'a str,
+}
+
+impl<'a> Iterator<char> for Chars<'a> {
+ #[inline]
+ fn next(&mut self) -> Option<char> {
+ // Decode the next codepoint, then update
+ // the slice to be just the remaining part
+ if self.string.len() != 0 {
+ let CharRange {ch, next} = self.string.char_range_at(0);
+ unsafe {
+ self.string = raw::slice_unchecked(self.string, next, self.string.len());
+ }
+ Some(ch)
+ } else {
+ None
+ }
+ }
+
+ #[inline]
+ fn size_hint(&self) -> (uint, Option<uint>) {
+ (self.string.len().saturating_add(3)/4, Some(self.string.len()))
+ }
+}
+
+impl<'a> DoubleEndedIterator<char> for Chars<'a> {
+ #[inline]
+ fn next_back(&mut self) -> Option<char> {
+ if self.string.len() != 0 {
+ let CharRange {ch, next} = self.string.char_range_at_reverse(self.string.len());
+ unsafe {
+ self.string = raw::slice_unchecked(self.string, 0, next);
+ }
+ Some(ch)
+ } else {
+ None
+ }
+ }
+}
+
+/// External iterator for a string's characters and their byte offsets.
+/// Use with the `std::iter` module.
+#[deriving(Clone)]
+pub struct CharOffsets<'a> {
+ /// The original string to be iterated
+ string: &'a str,
+ iter: Chars<'a>,
+}
+
+impl<'a> Iterator<(uint, char)> for CharOffsets<'a> {
+ #[inline]
+ fn next(&mut self) -> Option<(uint, char)> {
+ // Compute the byte offset by using the pointer offset between
+ // the original string slice and the iterator's remaining part
+ let offset = self.iter.string.as_ptr() as uint - self.string.as_ptr() as uint;
+ self.iter.next().map(|ch| (offset, ch))
+ }
+
+ #[inline]
+ fn size_hint(&self) -> (uint, Option<uint>) {
+ self.iter.size_hint()
+ }
+}
+
+impl<'a> DoubleEndedIterator<(uint, char)> for CharOffsets<'a> {
+ #[inline]
+ fn next_back(&mut self) -> Option<(uint, char)> {
+ self.iter.next_back().map(|ch| {
+ let offset = self.iter.string.len() +
+ self.iter.string.as_ptr() as uint - self.string.as_ptr() as uint;
+ (offset, ch)
+ })
+ }
+}
+
+#[deprecated = "replaced by Rev<Chars<'a>>"]
+pub type RevChars<'a> = Rev<Chars<'a>>;
+
+#[deprecated = "replaced by Rev<CharOffsets<'a>>"]
+pub type RevCharOffsets<'a> = Rev<CharOffsets<'a>>;
+
+/// External iterator for a string's bytes.
+/// Use with the `std::iter` module.
+pub type Bytes<'a> =
+ Map<'a, &'a u8, u8, slice::Items<'a, u8>>;
+
+#[deprecated = "replaced by Rev<Bytes<'a>>"]
+pub type RevBytes<'a> = Rev<Bytes<'a>>;
+
+/// An iterator over the substrings of a string, separated by `sep`.
+#[deriving(Clone)]
+pub struct CharSplits<'a, Sep> {
+ /// The slice remaining to be iterated
+ string: &'a str,
+ sep: Sep,
+ /// Whether an empty string at the end is allowed
+ allow_trailing_empty: bool,
+ only_ascii: bool,
+ finished: bool,
+}
+
+#[deprecated = "replaced by Rev<CharSplits<'a, Sep>>"]
+pub type RevCharSplits<'a, Sep> = Rev<CharSplits<'a, Sep>>;
+
+/// An iterator over the substrings of a string, separated by `sep`,
+/// splitting at most `count` times.
+#[deriving(Clone)]
+pub struct CharSplitsN<'a, Sep> {
+ iter: CharSplits<'a, Sep>,
+ /// The number of splits remaining
+ count: uint,
+ invert: bool,
+}
+
+/// An iterator over the words of a string, separated by a sequence of whitespace
+pub type Words<'a> =
+ Filter<'a, &'a str, CharSplits<'a, extern "Rust" fn(char) -> bool>>;
+
+/// An iterator over the lines of a string, separated by either `\n` or (`\r\n`).
+pub type AnyLines<'a> =
+ Map<'a, &'a str, &'a str, CharSplits<'a, char>>;
+
+impl<'a, Sep> CharSplits<'a, Sep> {
+ #[inline]
+ fn get_end(&mut self) -> Option<&'a str> {
+ if !self.finished && (self.allow_trailing_empty || self.string.len() > 0) {
+ self.finished = true;
+ Some(self.string)
+ } else {
+ None
+ }
+ }
+}
+
+impl<'a, Sep: CharEq> Iterator<&'a str> for CharSplits<'a, Sep> {
+ #[inline]
+ fn next(&mut self) -> Option<&'a str> {
+ if self.finished { return None }
+
+ let mut next_split = None;
+ if self.only_ascii {
+ for (idx, byte) in self.string.bytes().enumerate() {
+ if self.sep.matches(byte as char) && byte < 128u8 {
+ next_split = Some((idx, idx + 1));
+ break;
+ }
+ }
+ } else {
+ for (idx, ch) in self.string.char_indices() {
+ if self.sep.matches(ch) {
+ next_split = Some((idx, self.string.char_range_at(idx).next));
+ break;
+ }
+ }
+ }
+ match next_split {
+ Some((a, b)) => unsafe {
+ let elt = raw::slice_unchecked(self.string, 0, a);
+ self.string = raw::slice_unchecked(self.string, b, self.string.len());
+ Some(elt)
+ },
+ None => self.get_end(),
+ }
+ }
+}
+
+impl<'a, Sep: CharEq> DoubleEndedIterator<&'a str>
+for CharSplits<'a, Sep> {
+ #[inline]
+ fn next_back(&mut self) -> Option<&'a str> {
+ if self.finished { return None }
+
+ if !self.allow_trailing_empty {
+ self.allow_trailing_empty = true;
+ match self.next_back() {
+ Some(elt) if !elt.is_empty() => return Some(elt),
+ _ => if self.finished { return None }
+ }
+ }
+ let len = self.string.len();
+ let mut next_split = None;
+
+ if self.only_ascii {
+ for (idx, byte) in self.string.bytes().enumerate().rev() {
+ if self.sep.matches(byte as char) && byte < 128u8 {
+ next_split = Some((idx, idx + 1));
+ break;
+ }
+ }
+ } else {
+ for (idx, ch) in self.string.char_indices().rev() {
+ if self.sep.matches(ch) {
+ next_split = Some((idx, self.string.char_range_at(idx).next));
+ break;
+ }
+ }
+ }
+ match next_split {
+ Some((a, b)) => unsafe {
+ let elt = raw::slice_unchecked(self.string, b, len);
+ self.string = raw::slice_unchecked(self.string, 0, a);
+ Some(elt)
+ },
+ None => { self.finished = true; Some(self.string) }
+ }
+ }
+}
+
+impl<'a, Sep: CharEq> Iterator<&'a str> for CharSplitsN<'a, Sep> {
+ #[inline]
+ fn next(&mut self) -> Option<&'a str> {
+ if self.count != 0 {
+ self.count -= 1;
+ if self.invert { self.iter.next_back() } else { self.iter.next() }
+ } else {
+ self.iter.get_end()
+ }
+ }
+}
+
+/// An iterator over the start and end indices of the matches of a
+/// substring within a larger string
+#[deriving(Clone)]
+pub struct MatchIndices<'a> {
+ haystack: &'a str,
+ needle: &'a str,
+ position: uint,
+}
+
+/// An iterator over the substrings of a string separated by a given
+/// search string
+#[deriving(Clone)]
+pub struct StrSplits<'a> {
+ it: MatchIndices<'a>,
+ last_end: uint,
+ finished: bool
+}
+
+impl<'a> Iterator<(uint, uint)> for MatchIndices<'a> {
+ #[inline]
+ fn next(&mut self) -> Option<(uint, uint)> {
+ // See Issue #1932 for why this is a naive search
+ let (h_len, n_len) = (self.haystack.len(), self.needle.len());
+ let mut match_start = 0;
+ let mut match_i = 0;
+
+ while self.position < h_len {
+ if self.haystack[self.position] == self.needle[match_i] {
+ if match_i == 0 { match_start = self.position; }
+ match_i += 1;
+ self.position += 1;
+
+ if match_i == n_len {
+ // found a match!
+ return Some((match_start, self.position));
+ }
+ } else {
+ // failed match, backtrack
+ if match_i > 0 {
+ match_i = 0;
+ self.position = match_start;
+ }
+ self.position += 1;
+ }
+ }
+ None
+ }
+}
+
+impl<'a> Iterator<&'a str> for StrSplits<'a> {
+ #[inline]
+ fn next(&mut self) -> Option<&'a str> {
+ if self.finished { return None; }
+
+ match self.it.next() {
+ Some((from, to)) => {
+ let ret = Some(self.it.haystack.slice(self.last_end, from));
+ self.last_end = to;
+ ret
+ }
+ None => {
+ self.finished = true;
+ Some(self.it.haystack.slice(self.last_end, self.it.haystack.len()))
+ }
+ }
+ }
+}
+
+/*
+Section: Comparing strings
+*/
+
+// share the implementation of the lang-item vs. non-lang-item
+// eq_slice.
+#[inline]
+fn eq_slice_(a: &str, b: &str) -> bool {
+ #[allow(ctypes)]
+ extern { fn memcmp(s1: *i8, s2: *i8, n: uint) -> i32; }
+ a.len() == b.len() && unsafe {
+ memcmp(a.as_ptr() as *i8,
+ b.as_ptr() as *i8,
+ a.len()) == 0
+ }
+}
+
+/// Bytewise slice equality
+#[cfg(not(test))]
+#[lang="str_eq"]
+#[inline]
+pub fn eq_slice(a: &str, b: &str) -> bool {
+ eq_slice_(a, b)
+}
+
+/// Bytewise slice equality
+#[cfg(test)]
+#[inline]
+pub fn eq_slice(a: &str, b: &str) -> bool {
+ eq_slice_(a, b)
+}
+
+/// Bytewise string equality
+#[cfg(not(test))]
+#[lang="uniq_str_eq"]
+#[inline]
+pub fn eq(a: &~str, b: &~str) -> bool {
+ eq_slice(*a, *b)
+}
+
+#[cfg(test)]
+#[inline]
+pub fn eq(a: &~str, b: &~str) -> bool {
+ eq_slice(*a, *b)
+}
+
+/*
+Section: Misc
+*/
+
+/// Walk through `iter` checking that it's a valid UTF-8 sequence,
+/// returning `true` in that case, or, if it is invalid, `false` with
+/// `iter` reset such that it is pointing at the first byte in the
+/// invalid sequence.
+#[inline(always)]
+fn run_utf8_validation_iterator(iter: &mut slice::Items<u8>) -> bool {
+ loop {
+ // save the current thing we're pointing at.
+ let old = *iter;
+
+ // restore the iterator we had at the start of this codepoint.
+ macro_rules! err ( () => { {*iter = old; return false} });
+ macro_rules! next ( () => {
+ match iter.next() {
+ Some(a) => *a,
+ // we needed data, but there was none: error!
+ None => err!()
+ }
+ });
+
+ let first = match iter.next() {
+ Some(&b) => b,
+ // we're at the end of the iterator and a codepoint
+ // boundary at the same time, so this string is valid.
+ None => return true
+ };
+
+ // ASCII characters are always valid, so only large
+ // bytes need more examination.
+ if first >= 128 {
+ let w = utf8_char_width(first);
+ let second = next!();
+ // 2-byte encoding is for codepoints \u0080 to \u07ff
+ // first C2 80 last DF BF
+ // 3-byte encoding is for codepoints \u0800 to \uffff
+ // first E0 A0 80 last EF BF BF
+ // excluding surrogates codepoints \ud800 to \udfff
+ // ED A0 80 to ED BF BF
+ // 4-byte encoding is for codepoints \u10000 to \u10ffff
+ // first F0 90 80 80 last F4 8F BF BF
+ //
+ // Use the UTF-8 syntax from the RFC
+ //
+ // https://tools.ietf.org/html/rfc3629
+ // UTF8-1 = %x00-7F
+ // UTF8-2 = %xC2-DF UTF8-tail
+ // UTF8-3 = %xE0 %xA0-BF UTF8-tail / %xE1-EC 2( UTF8-tail ) /
+ // %xED %x80-9F UTF8-tail / %xEE-EF 2( UTF8-tail )
+ // UTF8-4 = %xF0 %x90-BF 2( UTF8-tail ) / %xF1-F3 3( UTF8-tail ) /
+ // %xF4 %x80-8F 2( UTF8-tail )
+ match w {
+ 2 => if second & 192 != TAG_CONT_U8 {err!()},
+ 3 => {
+ match (first, second, next!() & 192) {
+ (0xE0 , 0xA0 .. 0xBF, TAG_CONT_U8) |
+ (0xE1 .. 0xEC, 0x80 .. 0xBF, TAG_CONT_U8) |
+ (0xED , 0x80 .. 0x9F, TAG_CONT_U8) |
+ (0xEE .. 0xEF, 0x80 .. 0xBF, TAG_CONT_U8) => {}
+ _ => err!()
+ }
+ }
+ 4 => {
+ match (first, second, next!() & 192, next!() & 192) {
+ (0xF0 , 0x90 .. 0xBF, TAG_CONT_U8, TAG_CONT_U8) |
+ (0xF1 .. 0xF3, 0x80 .. 0xBF, TAG_CONT_U8, TAG_CONT_U8) |
+ (0xF4 , 0x80 .. 0x8F, TAG_CONT_U8, TAG_CONT_U8) => {}
+ _ => err!()
+ }
+ }
+ _ => err!()
+ }
+ }
+ }
+}
+
+/// Determines if a vector of bytes contains valid UTF-8.
+pub fn is_utf8(v: &[u8]) -> bool {
+ run_utf8_validation_iterator(&mut v.iter())
+}
+
+/// Determines if a vector of `u16` contains valid UTF-16
+pub fn is_utf16(v: &[u16]) -> bool {
+ let mut it = v.iter();
+ macro_rules! next ( ($ret:expr) => {
+ match it.next() { Some(u) => *u, None => return $ret }
+ }
+ )
+ loop {
+ let u = next!(true);
+
+ match char::from_u32(u as u32) {
+ Some(_) => {}
+ None => {
+ let u2 = next!(false);
+ if u < 0xD7FF || u > 0xDBFF ||
+ u2 < 0xDC00 || u2 > 0xDFFF { return false; }
+ }
+ }
+ }
+}
+
+/// An iterator that decodes UTF-16 encoded codepoints from a vector
+/// of `u16`s.
+#[deriving(Clone)]
+pub struct UTF16Items<'a> {
+ iter: slice::Items<'a, u16>
+}
+/// The possibilities for values decoded from a `u16` stream.
+#[deriving(Eq, TotalEq, Clone)]
+pub enum UTF16Item {
+ /// A valid codepoint.
+ ScalarValue(char),
+ /// An invalid surrogate without its pair.
+ LoneSurrogate(u16)
+}
+
+impl UTF16Item {
+ /// Convert `self` to a `char`, taking `LoneSurrogate`s to the
+ /// replacement character (U+FFFD).
+ #[inline]
+ pub fn to_char_lossy(&self) -> char {
+ match *self {
+ ScalarValue(c) => c,
+ LoneSurrogate(_) => '\uFFFD'
+ }
+ }
+}
+
+impl<'a> Iterator<UTF16Item> for UTF16Items<'a> {
+ fn next(&mut self) -> Option<UTF16Item> {
+ let u = match self.iter.next() {
+ Some(u) => *u,
+ None => return None
+ };
+
+ if u < 0xD800 || 0xDFFF < u {
+ // not a surrogate
+ Some(ScalarValue(unsafe {cast::transmute(u as u32)}))
+ } else if u >= 0xDC00 {
+ // a trailing surrogate
+ Some(LoneSurrogate(u))
+ } else {
+ // preserve state for rewinding.
+ let old = self.iter;
+
+ let u2 = match self.iter.next() {
+ Some(u2) => *u2,
+ // eof
+ None => return Some(LoneSurrogate(u))
+ };
+ if u2 < 0xDC00 || u2 > 0xDFFF {
+ // not a trailing surrogate so we're not a valid
+ // surrogate pair, so rewind to redecode u2 next time.
+ self.iter = old;
+ return Some(LoneSurrogate(u))
+ }
+
+ // all ok, so lets decode it.
+ let c = ((u - 0xD800) as u32 << 10 | (u2 - 0xDC00) as u32) + 0x1_0000;
+ Some(ScalarValue(unsafe {cast::transmute(c)}))
+ }
+ }
+
+ #[inline]
+ fn size_hint(&self) -> (uint, Option<uint>) {
+ let (low, high) = self.iter.size_hint();
+ // we could be entirely valid surrogates (2 elements per
+ // char), or entirely non-surrogates (1 element per char)
+ (low / 2, high)
+ }
+}
+
+/// Create an iterator over the UTF-16 encoded codepoints in `v`,
+/// returning invalid surrogates as `LoneSurrogate`s.
+///
+/// # Example
+///
+/// ```rust
+/// use std::str;
+/// use std::str::{ScalarValue, LoneSurrogate};
+///
+/// // 𝄞mus<invalid>ic<invalid>
+/// let v = [0xD834, 0xDD1E, 0x006d, 0x0075,
+/// 0x0073, 0xDD1E, 0x0069, 0x0063,
+/// 0xD834];
+///
+/// assert_eq!(str::utf16_items(v).collect::<~[_]>(),
+/// ~[ScalarValue('𝄞'),
+/// ScalarValue('m'), ScalarValue('u'), ScalarValue('s'),
+/// LoneSurrogate(0xDD1E),
+/// ScalarValue('i'), ScalarValue('c'),
+/// LoneSurrogate(0xD834)]);
+/// ```
+pub fn utf16_items<'a>(v: &'a [u16]) -> UTF16Items<'a> {
+ UTF16Items { iter : v.iter() }
+}
+
+/// Return a slice of `v` ending at (and not including) the first NUL
+/// (0).
+///
+/// # Example
+///
+/// ```rust
+/// use std::str;
+///
+/// // "abcd"
+/// let mut v = ['a' as u16, 'b' as u16, 'c' as u16, 'd' as u16];
+/// // no NULs so no change
+/// assert_eq!(str::truncate_utf16_at_nul(v), v.as_slice());
+///
+/// // "ab\0d"
+/// v[2] = 0;
+/// assert_eq!(str::truncate_utf16_at_nul(v),
+/// &['a' as u16, 'b' as u16]);
+/// ```
+pub fn truncate_utf16_at_nul<'a>(v: &'a [u16]) -> &'a [u16] {
+ match v.iter().position(|c| *c == 0) {
+ // don't include the 0
+ Some(i) => v.slice_to(i),
+ None => v
+ }
+}
+
+// https://tools.ietf.org/html/rfc3629
+static UTF8_CHAR_WIDTH: [u8, ..256] = [
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x1F
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x3F
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x5F
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x7F
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0x9F
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0xBF
+0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
+2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, // 0xDF
+3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, // 0xEF
+4,4,4,4,4,0,0,0,0,0,0,0,0,0,0,0, // 0xFF
+];
+
+/// Given a first byte, determine how many bytes are in this UTF-8 character
+#[inline]
+pub fn utf8_char_width(b: u8) -> uint {
+ return UTF8_CHAR_WIDTH[b as uint] as uint;
+}
+
+/// Struct that contains a `char` and the index of the first byte of
+/// the next `char` in a string. This can be used as a data structure
+/// for iterating over the UTF-8 bytes of a string.
+pub struct CharRange {
+ /// Current `char`
+ pub ch: char,
+ /// Index of the first byte of the next `char`
+ pub next: uint,
+}
+
+// Return the initial codepoint accumulator for the first byte.
+// The first byte is special, only want bottom 5 bits for width 2, 4 bits
+// for width 3, and 3 bits for width 4
+macro_rules! utf8_first_byte(
+ ($byte:expr, $width:expr) => (($byte & (0x7F >> $width)) as u32)
+)
+
+// return the value of $ch updated with continuation byte $byte
+macro_rules! utf8_acc_cont_byte(
+ ($ch:expr, $byte:expr) => (($ch << 6) | ($byte & 63u8) as u32)
+)
+
+static TAG_CONT_U8: u8 = 128u8;
+
+/// Unsafe operations
+pub mod raw {
+ use cast;
+ use container::Container;
+ use iter::Iterator;
+ use ptr::RawPtr;
+ use raw::Slice;
+ use slice::{ImmutableVector};
+ use str::{is_utf8, StrSlice};
+
+ /// Converts a slice of bytes to a string slice without checking
+ /// that the string contains valid UTF-8.
+ pub unsafe fn from_utf8<'a>(v: &'a [u8]) -> &'a str {
+ cast::transmute(v)
+ }
+
+ /// Form a slice from a C string. Unsafe because the caller must ensure the
+ /// C string has the static lifetime, or else the return value may be
+ /// invalidated later.
+ pub unsafe fn c_str_to_static_slice(s: *i8) -> &'static str {
+ let s = s as *u8;
+ let mut curr = s;
+ let mut len = 0u;
+ while *curr != 0u8 {
+ len += 1u;
+ curr = s.offset(len as int);
+ }
+ let v = Slice { data: s, len: len };
+ assert!(is_utf8(::cast::transmute(v)));
+ ::cast::transmute(v)
+ }
+
+ /// Takes a bytewise (not UTF-8) slice from a string.
+ ///
+ /// Returns the substring from [`begin`..`end`).
+ ///
+ /// # Failure
+ ///
+ /// If begin is greater than end.
+ /// If end is greater than the length of the string.
+ #[inline]
+ pub unsafe fn slice_bytes<'a>(s: &'a str, begin: uint, end: uint) -> &'a str {
+ assert!(begin <= end);
+ assert!(end <= s.len());
+ slice_unchecked(s, begin, end)
+ }
+
+ /// Takes a bytewise (not UTF-8) slice from a string.
+ ///
+ /// Returns the substring from [`begin`..`end`).
+ ///
+ /// Caller must check slice boundaries!
+ #[inline]
+ pub unsafe fn slice_unchecked<'a>(s: &'a str, begin: uint, end: uint) -> &'a str {
+ cast::transmute(Slice {
+ data: s.as_ptr().offset(begin as int),
+ len: end - begin,
+ })
+ }
+}
+
+/*
+Section: Trait implementations
+*/
+
+#[cfg(not(test))]
+#[allow(missing_doc)]
+pub mod traits {
+ use container::Container;
+ use cmp::{TotalOrd, Ordering, Less, Equal, Greater, Eq, Ord, Equiv, TotalEq};
+ use iter::Iterator;
+ use option::{Some, None};
+ use str::{Str, StrSlice, eq_slice};
+
+ impl<'a> TotalOrd for &'a str {
+ #[inline]
+ fn cmp(&self, other: & &'a str) -> Ordering {
+ for (s_b, o_b) in self.bytes().zip(other.bytes()) {
+ match s_b.cmp(&o_b) {
+ Greater => return Greater,
+ Less => return Less,
+ Equal => ()
+ }
+ }
+
+ self.len().cmp(&other.len())
+ }
+ }
+
+ impl TotalOrd for ~str {
+ #[inline]
+ fn cmp(&self, other: &~str) -> Ordering { self.as_slice().cmp(&other.as_slice()) }
+ }
+
+ impl<'a> Eq for &'a str {
+ #[inline]
+ fn eq(&self, other: & &'a str) -> bool {
+ eq_slice((*self), (*other))
+ }
+ #[inline]
+ fn ne(&self, other: & &'a str) -> bool { !(*self).eq(other) }
+ }
+
+ impl Eq for ~str {
+ #[inline]
+ fn eq(&self, other: &~str) -> bool {
+ eq_slice((*self), (*other))
+ }
+ }
+
+ impl<'a> TotalEq for &'a str {}
+
+ impl TotalEq for ~str {}
+
+ impl<'a> Ord for &'a str {
+ #[inline]
+ fn lt(&self, other: & &'a str) -> bool { self.cmp(other) == Less }
+ }
+
+ impl Ord for ~str {
+ #[inline]
+ fn lt(&self, other: &~str) -> bool { self.cmp(other) == Less }
+ }
+
+ impl<'a, S: Str> Equiv<S> for &'a str {
+ #[inline]
+ fn equiv(&self, other: &S) -> bool { eq_slice(*self, other.as_slice()) }
+ }
+
+ impl<'a, S: Str> Equiv<S> for ~str {
+ #[inline]
+ fn equiv(&self, other: &S) -> bool { eq_slice(*self, other.as_slice()) }
+ }
+}
+
+#[cfg(test)]
+pub mod traits {}
+
+/// Any string that can be represented as a slice
+pub trait Str {
+ /// Work with `self` as a slice.
+ fn as_slice<'a>(&'a self) -> &'a str;
+}
+
+impl<'a> Str for &'a str {
+ #[inline]
+ fn as_slice<'a>(&'a self) -> &'a str { *self }
+}
+
+impl<'a> Str for ~str {
+ #[inline]
+ fn as_slice<'a>(&'a self) -> &'a str { let s: &'a str = *self; s }
+}
+
+impl<'a> Container for &'a str {
+ #[inline]
+ fn len(&self) -> uint {
+ self.repr().len
+ }
+}
+
+impl Container for ~str {
+ #[inline]
+ fn len(&self) -> uint { self.as_slice().len() }
+}
+
+/// Methods for string slices
+pub trait StrSlice<'a> {
+ /// Returns true if one string contains another
+ ///
+ /// # Arguments
+ ///
+ /// - needle - The string to look for
+ fn contains<'a>(&self, needle: &'a str) -> bool;
+
+ /// Returns true if a string contains a char.
+ ///
+ /// # Arguments
+ ///
+ /// - needle - The char to look for
+ fn contains_char(&self, needle: char) -> bool;
+
+ /// An iterator over the characters of `self`. Note, this iterates
+ /// over unicode code-points, not unicode graphemes.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// let v: ~[char] = "abc åäö".chars().collect();
+ /// assert_eq!(v, ~['a', 'b', 'c', ' ', 'å', 'ä', 'ö']);
+ /// ```
+ fn chars(&self) -> Chars<'a>;
+
+ /// Do not use this - it is deprecated.
+ #[deprecated = "replaced by .chars().rev()"]
+ fn chars_rev(&self) -> Rev<Chars<'a>>;
+
+ /// An iterator over the bytes of `self`
+ fn bytes(&self) -> Bytes<'a>;
+
+ /// Do not use this - it is deprecated.
+ #[deprecated = "replaced by .bytes().rev()"]
+ fn bytes_rev(&self) -> Rev<Bytes<'a>>;
+
+ /// An iterator over the characters of `self` and their byte offsets.
+ fn char_indices(&self) -> CharOffsets<'a>;
+
+ /// Do not use this - it is deprecated.
+ #[deprecated = "replaced by .char_indices().rev()"]
+ fn char_indices_rev(&self) -> Rev<CharOffsets<'a>>;
+
+ /// An iterator over substrings of `self`, separated by characters
+ /// matched by `sep`.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// let v: ~[&str] = "Mary had a little lamb".split(' ').collect();
+ /// assert_eq!(v, ~["Mary", "had", "a", "little", "lamb"]);
+ ///
+ /// let v: ~[&str] = "abc1def2ghi".split(|c: char| c.is_digit()).collect();
+ /// assert_eq!(v, ~["abc", "def", "ghi"]);
+ ///
+ /// let v: ~[&str] = "lionXXtigerXleopard".split('X').collect();
+ /// assert_eq!(v, ~["lion", "", "tiger", "leopard"]);
+ /// ```
+ fn split<Sep: CharEq>(&self, sep: Sep) -> CharSplits<'a, Sep>;
+
+ /// An iterator over substrings of `self`, separated by characters
+ /// matched by `sep`, restricted to splitting at most `count`
+ /// times.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// let v: ~[&str] = "Mary had a little lambda".splitn(' ', 2).collect();
+ /// assert_eq!(v, ~["Mary", "had", "a little lambda"]);
+ ///
+ /// let v: ~[&str] = "abc1def2ghi".splitn(|c: char| c.is_digit(), 1).collect();
+ /// assert_eq!(v, ~["abc", "def2ghi"]);
+ ///
+ /// let v: ~[&str] = "lionXXtigerXleopard".splitn('X', 2).collect();
+ /// assert_eq!(v, ~["lion", "", "tigerXleopard"]);
+ /// ```
+ fn splitn<Sep: CharEq>(&self, sep: Sep, count: uint) -> CharSplitsN<'a, Sep>;
+
+ /// An iterator over substrings of `self`, separated by characters
+ /// matched by `sep`.
+ ///
+ /// Equivalent to `split`, except that the trailing substring
+ /// is skipped if empty (terminator semantics).
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// let v: ~[&str] = "A.B.".split_terminator('.').collect();
+ /// assert_eq!(v, ~["A", "B"]);
+ ///
+ /// let v: ~[&str] = "A..B..".split_terminator('.').collect();
+ /// assert_eq!(v, ~["A", "", "B", ""]);
+ ///
+ /// let v: ~[&str] = "Mary had a little lamb".split(' ').rev().collect();
+ /// assert_eq!(v, ~["lamb", "little", "a", "had", "Mary"]);
+ ///
+ /// let v: ~[&str] = "abc1def2ghi".split(|c: char| c.is_digit()).rev().collect();
+ /// assert_eq!(v, ~["ghi", "def", "abc"]);
+ ///
+ /// let v: ~[&str] = "lionXXtigerXleopard".split('X').rev().collect();
+ /// assert_eq!(v, ~["leopard", "tiger", "", "lion"]);
+ /// ```
+ fn split_terminator<Sep: CharEq>(&self, sep: Sep) -> CharSplits<'a, Sep>;
+
+ /// Do not use this - it is deprecated.
+ #[deprecated = "replaced by .split(sep).rev()"]
+ fn rsplit<Sep: CharEq>(&self, sep: Sep) -> Rev<CharSplits<'a, Sep>>;
+
+ /// An iterator over substrings of `self`, separated by characters
+ /// matched by `sep`, starting from the end of the string.
+ /// Restricted to splitting at most `count` times.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// let v: ~[&str] = "Mary had a little lamb".rsplitn(' ', 2).collect();
+ /// assert_eq!(v, ~["lamb", "little", "Mary had a"]);
+ ///
+ /// let v: ~[&str] = "abc1def2ghi".rsplitn(|c: char| c.is_digit(), 1).collect();
+ /// assert_eq!(v, ~["ghi", "abc1def"]);
+ ///
+ /// let v: ~[&str] = "lionXXtigerXleopard".rsplitn('X', 2).collect();
+ /// assert_eq!(v, ~["leopard", "tiger", "lionX"]);
+ /// ```
+ fn rsplitn<Sep: CharEq>(&self, sep: Sep, count: uint) -> CharSplitsN<'a, Sep>;
+
+ /// An iterator over the start and end indices of the disjoint
+ /// matches of `sep` within `self`.
+ ///
+ /// That is, each returned value `(start, end)` satisfies
+ /// `self.slice(start, end) == sep`. For matches of `sep` within
+ /// `self` that overlap, only the indicies corresponding to the
+ /// first match are returned.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// let v: ~[(uint, uint)] = "abcXXXabcYYYabc".match_indices("abc").collect();
+ /// assert_eq!(v, ~[(0,3), (6,9), (12,15)]);
+ ///
+ /// let v: ~[(uint, uint)] = "1abcabc2".match_indices("abc").collect();
+ /// assert_eq!(v, ~[(1,4), (4,7)]);
+ ///
+ /// let v: ~[(uint, uint)] = "ababa".match_indices("aba").collect();
+ /// assert_eq!(v, ~[(0, 3)]); // only the first `aba`
+ /// ```
+ fn match_indices(&self, sep: &'a str) -> MatchIndices<'a>;
+
+ /// An iterator over the substrings of `self` separated by `sep`.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// let v: ~[&str] = "abcXXXabcYYYabc".split_str("abc").collect();
+ /// assert_eq!(v, ~["", "XXX", "YYY", ""]);
+ ///
+ /// let v: ~[&str] = "1abcabc2".split_str("abc").collect();
+ /// assert_eq!(v, ~["1", "", "2"]);
+ /// ```
+ fn split_str(&self, &'a str) -> StrSplits<'a>;
+
+ /// An iterator over the lines of a string (subsequences separated
+ /// by `\n`). This does not include the empty string after a
+ /// trailing `\n`.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// let four_lines = "foo\nbar\n\nbaz\n";
+ /// let v: ~[&str] = four_lines.lines().collect();
+ /// assert_eq!(v, ~["foo", "bar", "", "baz"]);
+ /// ```
+ fn lines(&self) -> CharSplits<'a, char>;
+
+ /// An iterator over the lines of a string, separated by either
+ /// `\n` or `\r\n`. As with `.lines()`, this does not include an
+ /// empty trailing line.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// let four_lines = "foo\r\nbar\n\r\nbaz\n";
+ /// let v: ~[&str] = four_lines.lines_any().collect();
+ /// assert_eq!(v, ~["foo", "bar", "", "baz"]);
+ /// ```
+ fn lines_any(&self) -> AnyLines<'a>;
+
+ /// An iterator over the words of a string (subsequences separated
+ /// by any sequence of whitespace). Sequences of whitespace are
+ /// collapsed, so empty "words" are not included.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// let some_words = " Mary had\ta little \n\t lamb";
+ /// let v: ~[&str] = some_words.words().collect();
+ /// assert_eq!(v, ~["Mary", "had", "a", "little", "lamb"]);
+ /// ```
+ fn words(&self) -> Words<'a>;
+
+ /// Returns true if the string contains only whitespace.
+ ///
+ /// Whitespace characters are determined by `char::is_whitespace`.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// assert!(" \t\n".is_whitespace());
+ /// assert!("".is_whitespace());
+ ///
+ /// assert!( !"abc".is_whitespace());
+ /// ```
+ fn is_whitespace(&self) -> bool;
+
+ /// Returns true if the string contains only alphanumeric code
+ /// points.
+ ///
+ /// Alphanumeric characters are determined by `char::is_alphanumeric`.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// assert!("Löwe老虎Léopard123".is_alphanumeric());
+ /// assert!("".is_alphanumeric());
+ ///
+ /// assert!( !" &*~".is_alphanumeric());
+ /// ```
+ fn is_alphanumeric(&self) -> bool;
+
+ /// Returns the number of Unicode code points (`char`) that a
+ /// string holds.
+ ///
+ /// This does not perform any normalization, and is `O(n)`, since
+ /// UTF-8 is a variable width encoding of code points.
+ ///
+ /// *Warning*: The number of code points in a string does not directly
+ /// correspond to the number of visible characters or width of the
+ /// visible text due to composing characters, and double- and
+ /// zero-width ones.
+ ///
+ /// See also `.len()` for the byte length.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// // composed forms of `ö` and `é`
+ /// let c = "Löwe 老虎 Léopard"; // German, Simplified Chinese, French
+ /// // decomposed forms of `ö` and `é`
+ /// let d = "Lo\u0308we 老虎 Le\u0301opard";
+ ///
+ /// assert_eq!(c.char_len(), 15);
+ /// assert_eq!(d.char_len(), 17);
+ ///
+ /// assert_eq!(c.len(), 21);
+ /// assert_eq!(d.len(), 23);
+ ///
+ /// // the two strings *look* the same
+ /// println!("{}", c);
+ /// println!("{}", d);
+ /// ```
+ fn char_len(&self) -> uint;
+
+ /// Returns a slice of the given string from the byte range
+ /// [`begin`..`end`).
+ ///
+ /// This operation is `O(1)`.
+ ///
+ /// Fails when `begin` and `end` do not point to valid characters
+ /// or point beyond the last character of the string.
+ ///
+ /// See also `slice_to` and `slice_from` for slicing prefixes and
+ /// suffixes of strings, and `slice_chars` for slicing based on
+ /// code point counts.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// let s = "Löwe 老虎 Léopard";
+ /// assert_eq!(s.slice(0, 1), "L");
+ ///
+ /// assert_eq!(s.slice(1, 9), "öwe 老");
+ ///
+ /// // these will fail:
+ /// // byte 2 lies within `ö`:
+ /// // s.slice(2, 3);
+ ///
+ /// // byte 8 lies within `老`
+ /// // s.slice(1, 8);
+ ///
+ /// // byte 100 is outside the string
+ /// // s.slice(3, 100);
+ /// ```
+ fn slice(&self, begin: uint, end: uint) -> &'a str;
+
+ /// Returns a slice of the string from `begin` to its end.
+ ///
+ /// Equivalent to `self.slice(begin, self.len())`.
+ ///
+ /// Fails when `begin` does not point to a valid character, or is
+ /// out of bounds.
+ ///
+ /// See also `slice`, `slice_to` and `slice_chars`.
+ fn slice_from(&self, begin: uint) -> &'a str;
+
+ /// Returns a slice of the string from the beginning to byte
+ /// `end`.
+ ///
+ /// Equivalent to `self.slice(0, end)`.
+ ///
+ /// Fails when `end` does not point to a valid character, or is
+ /// out of bounds.
+ ///
+ /// See also `slice`, `slice_from` and `slice_chars`.
+ fn slice_to(&self, end: uint) -> &'a str;
+
+ /// Returns a slice of the string from the character range
+ /// [`begin`..`end`).
+ ///
+ /// That is, start at the `begin`-th code point of the string and
+ /// continue to the `end`-th code point. This does not detect or
+ /// handle edge cases such as leaving a combining character as the
+ /// first code point of the string.
+ ///
+ /// Due to the design of UTF-8, this operation is `O(end)`.
+ /// See `slice`, `slice_to` and `slice_from` for `O(1)`
+ /// variants that use byte indices rather than code point
+ /// indices.
+ ///
+ /// Fails if `begin` > `end` or the either `begin` or `end` are
+ /// beyond the last character of the string.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// let s = "Löwe 老虎 Léopard";
+ /// assert_eq!(s.slice_chars(0, 4), "Löwe");
+ /// assert_eq!(s.slice_chars(5, 7), "老虎");
+ /// ```
+ fn slice_chars(&self, begin: uint, end: uint) -> &'a str;
+
+ /// Returns true if `needle` is a prefix of the string.
+ fn starts_with(&self, needle: &str) -> bool;
+
+ /// Returns true if `needle` is a suffix of the string.
+ fn ends_with(&self, needle: &str) -> bool;
+
+ /// Returns a string with leading and trailing whitespace removed.
+ fn trim(&self) -> &'a str;
+
+ /// Returns a string with leading whitespace removed.
+ fn trim_left(&self) -> &'a str;
+
+ /// Returns a string with trailing whitespace removed.
+ fn trim_right(&self) -> &'a str;
+
+ /// Returns a string with characters that match `to_trim` removed.
+ ///
+ /// # Arguments
+ ///
+ /// * to_trim - a character matcher
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// assert_eq!("11foo1bar11".trim_chars('1'), "foo1bar")
+ /// assert_eq!("12foo1bar12".trim_chars(&['1', '2']), "foo1bar")
+ /// assert_eq!("123foo1bar123".trim_chars(|c: char| c.is_digit()), "foo1bar")
+ /// ```
+ fn trim_chars<C: CharEq>(&self, to_trim: C) -> &'a str;
+
+ /// Returns a string with leading `chars_to_trim` removed.
+ ///
+ /// # Arguments
+ ///
+ /// * to_trim - a character matcher
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// assert_eq!("11foo1bar11".trim_left_chars('1'), "foo1bar11")
+ /// assert_eq!("12foo1bar12".trim_left_chars(&['1', '2']), "foo1bar12")
+ /// assert_eq!("123foo1bar123".trim_left_chars(|c: char| c.is_digit()), "foo1bar123")
+ /// ```
+ fn trim_left_chars<C: CharEq>(&self, to_trim: C) -> &'a str;
+
+ /// Returns a string with trailing `chars_to_trim` removed.
+ ///
+ /// # Arguments
+ ///
+ /// * to_trim - a character matcher
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// assert_eq!("11foo1bar11".trim_right_chars('1'), "11foo1bar")
+ /// assert_eq!("12foo1bar12".trim_right_chars(&['1', '2']), "12foo1bar")
+ /// assert_eq!("123foo1bar123".trim_right_chars(|c: char| c.is_digit()), "123foo1bar")
+ /// ```
+ fn trim_right_chars<C: CharEq>(&self, to_trim: C) -> &'a str;
+
+ /// Check that `index`-th byte lies at the start and/or end of a
+ /// UTF-8 code point sequence.
+ ///
+ /// The start and end of the string (when `index == self.len()`)
+ /// are considered to be boundaries.
+ ///
+ /// Fails if `index` is greater than `self.len()`.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// let s = "Löwe 老虎 Léopard";
+ /// assert!(s.is_char_boundary(0));
+ /// // start of `老`
+ /// assert!(s.is_char_boundary(6));
+ /// assert!(s.is_char_boundary(s.len()));
+ ///
+ /// // second byte of `ö`
+ /// assert!(!s.is_char_boundary(2));
+ ///
+ /// // third byte of `老`
+ /// assert!(!s.is_char_boundary(8));
+ /// ```
+ fn is_char_boundary(&self, index: uint) -> bool;
+
+ /// Pluck a character out of a string and return the index of the next
+ /// character.
+ ///
+ /// This function can be used to iterate over the unicode characters of a
+ /// string.
+ ///
+ /// # Example
+ ///
+ /// This example manually iterate through the characters of a
+ /// string; this should normally by done by `.chars()` or
+ /// `.char_indices`.
+ ///
+ /// ```rust
+ /// use std::str::CharRange;
+ ///
+ /// let s = "中华Việt Nam";
+ /// let mut i = 0u;
+ /// while i < s.len() {
+ /// let CharRange {ch, next} = s.char_range_at(i);
+ /// println!("{}: {}", i, ch);
+ /// i = next;
+ /// }
+ /// ```
+ ///
+ /// ## Output
+ ///
+ /// ```ignore
+ /// 0: 中
+ /// 3: 华
+ /// 6: V
+ /// 7: i
+ /// 8: ệ
+ /// 11: t
+ /// 12:
+ /// 13: N
+ /// 14: a
+ /// 15: m
+ /// ```
+ ///
+ /// # Arguments
+ ///
+ /// * s - The string
+ /// * i - The byte offset of the char to extract
+ ///
+ /// # Return value
+ ///
+ /// A record {ch: char, next: uint} containing the char value and the byte
+ /// index of the next unicode character.
+ ///
+ /// # Failure
+ ///
+ /// If `i` is greater than or equal to the length of the string.
+ /// If `i` is not the index of the beginning of a valid UTF-8 character.
+ fn char_range_at(&self, start: uint) -> CharRange;
+
+ /// Given a byte position and a str, return the previous char and its position.
+ ///
+ /// This function can be used to iterate over a unicode string in reverse.
+ ///
+ /// Returns 0 for next index if called on start index 0.
+ fn char_range_at_reverse(&self, start: uint) -> CharRange;
+
+ /// Plucks the character starting at the `i`th byte of a string
+ fn char_at(&self, i: uint) -> char;
+
+ /// Plucks the character ending at the `i`th byte of a string
+ fn char_at_reverse(&self, i: uint) -> char;
+
+ /// Work with the byte buffer of a string as a byte slice.
+ fn as_bytes(&self) -> &'a [u8];
+
+ /// Returns the byte index of the first character of `self` that
+ /// matches `search`.
+ ///
+ /// # Return value
+ ///
+ /// `Some` containing the byte index of the last matching character
+ /// or `None` if there is no match
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// let s = "Löwe 老虎 Léopard";
+ ///
+ /// assert_eq!(s.find('L'), Some(0));
+ /// assert_eq!(s.find('é'), Some(14));
+ ///
+ /// // the first space
+ /// assert_eq!(s.find(|c: char| c.is_whitespace()), Some(5));
+ ///
+ /// // neither are found
+ /// assert_eq!(s.find(&['1', '2']), None);
+ /// ```
+ fn find<C: CharEq>(&self, search: C) -> Option<uint>;
+
+ /// Returns the byte index of the last character of `self` that
+ /// matches `search`.
+ ///
+ /// # Return value
+ ///
+ /// `Some` containing the byte index of the last matching character
+ /// or `None` if there is no match.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// let s = "Löwe 老虎 Léopard";
+ ///
+ /// assert_eq!(s.rfind('L'), Some(13));
+ /// assert_eq!(s.rfind('é'), Some(14));
+ ///
+ /// // the second space
+ /// assert_eq!(s.rfind(|c: char| c.is_whitespace()), Some(12));
+ ///
+ /// // searches for an occurrence of either `1` or `2`, but neither are found
+ /// assert_eq!(s.rfind(&['1', '2']), None);
+ /// ```
+ fn rfind<C: CharEq>(&self, search: C) -> Option<uint>;
+
+ /// Returns the byte index of the first matching substring
+ ///
+ /// # Arguments
+ ///
+ /// * `needle` - The string to search for
+ ///
+ /// # Return value
+ ///
+ /// `Some` containing the byte index of the first matching substring
+ /// or `None` if there is no match.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// let s = "Löwe 老虎 Léopard";
+ ///
+ /// assert_eq!(s.find_str("老虎 L"), Some(6));
+ /// assert_eq!(s.find_str("muffin man"), None);
+ /// ```
+ fn find_str(&self, &str) -> Option<uint>;
+
+ /// Retrieves the first character from a string slice and returns
+ /// it. This does not allocate a new string; instead, it returns a
+ /// slice that point one character beyond the character that was
+ /// shifted. If the string does not contain any characters,
+ /// a tuple of None and an empty string is returned instead.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// let s = "Löwe 老虎 Léopard";
+ /// let (c, s1) = s.slice_shift_char();
+ /// assert_eq!(c, Some('L'));
+ /// assert_eq!(s1, "öwe 老虎 Léopard");
+ ///
+ /// let (c, s2) = s1.slice_shift_char();
+ /// assert_eq!(c, Some('ö'));
+ /// assert_eq!(s2, "we 老虎 Léopard");
+ /// ```
+ fn slice_shift_char(&self) -> (Option<char>, &'a str);
+
+ /// Returns the byte offset of an inner slice relative to an enclosing outer slice.
+ ///
+ /// Fails if `inner` is not a direct slice contained within self.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// let string = "a\nb\nc";
+ /// let lines: ~[&str] = string.lines().collect();
+ ///
+ /// assert!(string.subslice_offset(lines[0]) == 0); // &"a"
+ /// assert!(string.subslice_offset(lines[1]) == 2); // &"b"
+ /// assert!(string.subslice_offset(lines[2]) == 4); // &"c"
+ /// ```
+ fn subslice_offset(&self, inner: &str) -> uint;
+
+ /// Return an unsafe pointer to the strings buffer.
+ ///
+ /// The caller must ensure that the string outlives this pointer,
+ /// and that it is not reallocated (e.g. by pushing to the
+ /// string).
+ fn as_ptr(&self) -> *u8;
+}
+
+impl<'a> StrSlice<'a> for &'a str {
+ #[inline]
+ fn contains<'a>(&self, needle: &'a str) -> bool {
+ self.find_str(needle).is_some()
+ }
+
+ #[inline]
+ fn contains_char(&self, needle: char) -> bool {
+ self.find(needle).is_some()
+ }
+
+ #[inline]
+ fn chars(&self) -> Chars<'a> {
+ Chars{string: *self}
+ }
+
+ #[inline]
+ #[deprecated = "replaced by .chars().rev()"]
+ fn chars_rev(&self) -> RevChars<'a> {
+ self.chars().rev()
+ }
+
+ #[inline]
+ fn bytes(&self) -> Bytes<'a> {
+ self.as_bytes().iter().map(|&b| b)
+ }
+
+ #[inline]
+ #[deprecated = "replaced by .bytes().rev()"]
+ fn bytes_rev(&self) -> RevBytes<'a> {
+ self.bytes().rev()
+ }
+
+ #[inline]
+ fn char_indices(&self) -> CharOffsets<'a> {
+ CharOffsets{string: *self, iter: self.chars()}
+ }
+
+ #[inline]
+ #[deprecated = "replaced by .char_indices().rev()"]
+ fn char_indices_rev(&self) -> RevCharOffsets<'a> {
+ self.char_indices().rev()
+ }
+
+ #[inline]
+ fn split<Sep: CharEq>(&self, sep: Sep) -> CharSplits<'a, Sep> {
+ CharSplits {
+ string: *self,
+ only_ascii: sep.only_ascii(),
+ sep: sep,
+ allow_trailing_empty: true,
+ finished: false,
+ }
+ }
+
+ #[inline]
+ fn splitn<Sep: CharEq>(&self, sep: Sep, count: uint)
+ -> CharSplitsN<'a, Sep> {
+ CharSplitsN {
+ iter: self.split(sep),
+ count: count,
+ invert: false,
+ }
+ }
+
+ #[inline]
+ fn split_terminator<Sep: CharEq>(&self, sep: Sep)
+ -> CharSplits<'a, Sep> {
+ CharSplits {
+ allow_trailing_empty: false,
+ ..self.split(sep)
+ }
+ }
+
+ #[inline]
+ #[deprecated = "replaced by .split(sep).rev()"]
+ fn rsplit<Sep: CharEq>(&self, sep: Sep) -> RevCharSplits<'a, Sep> {
+ self.split(sep).rev()
+ }
+
+ #[inline]
+ fn rsplitn<Sep: CharEq>(&self, sep: Sep, count: uint)
+ -> CharSplitsN<'a, Sep> {
+ CharSplitsN {
+ iter: self.split(sep),
+ count: count,
+ invert: true,
+ }
+ }
+
+ #[inline]
+ fn match_indices(&self, sep: &'a str) -> MatchIndices<'a> {
+ assert!(!sep.is_empty())
+ MatchIndices {
+ haystack: *self,
+ needle: sep,
+ position: 0
+ }
+ }
+
+ #[inline]
+ fn split_str(&self, sep: &'a str) -> StrSplits<'a> {
+ StrSplits {
+ it: self.match_indices(sep),
+ last_end: 0,
+ finished: false
+ }
+ }
+
+ #[inline]
+ fn lines(&self) -> CharSplits<'a, char> {
+ self.split_terminator('\n')
+ }
+
+ fn lines_any(&self) -> AnyLines<'a> {
+ self.lines().map(|line| {
+ let l = line.len();
+ if l > 0 && line[l - 1] == '\r' as u8 { line.slice(0, l - 1) }
+ else { line }
+ })
+ }
+
+ #[inline]
+ fn words(&self) -> Words<'a> {
+ self.split(char::is_whitespace).filter(|s| !s.is_empty())
+ }
+
+ #[inline]
+ fn is_whitespace(&self) -> bool { self.chars().all(char::is_whitespace) }
+
+ #[inline]
+ fn is_alphanumeric(&self) -> bool { self.chars().all(char::is_alphanumeric) }
+
+ #[inline]
+ fn char_len(&self) -> uint { self.chars().len() }
+
+ #[inline]
+ fn slice(&self, begin: uint, end: uint) -> &'a str {
+ assert!(self.is_char_boundary(begin) && self.is_char_boundary(end));
+ unsafe { raw::slice_bytes(*self, begin, end) }
+ }
+
+ #[inline]
+ fn slice_from(&self, begin: uint) -> &'a str {
+ self.slice(begin, self.len())
+ }
+
+ #[inline]
+ fn slice_to(&self, end: uint) -> &'a str {
+ assert!(self.is_char_boundary(end));
+ unsafe { raw::slice_bytes(*self, 0, end) }
+ }
+
+ fn slice_chars(&self, begin: uint, end: uint) -> &'a str {
+ assert!(begin <= end);
+ let mut count = 0;
+ let mut begin_byte = None;
+ let mut end_byte = None;
+
+ // This could be even more efficient by not decoding,
+ // only finding the char boundaries
+ for (idx, _) in self.char_indices() {
+ if count == begin { begin_byte = Some(idx); }
+ if count == end { end_byte = Some(idx); break; }
+ count += 1;
+ }
+ if begin_byte.is_none() && count == begin { begin_byte = Some(self.len()) }
+ if end_byte.is_none() && count == end { end_byte = Some(self.len()) }
+
+ match (begin_byte, end_byte) {
+ (None, _) => fail!("slice_chars: `begin` is beyond end of string"),
+ (_, None) => fail!("slice_chars: `end` is beyond end of string"),
+ (Some(a), Some(b)) => unsafe { raw::slice_bytes(*self, a, b) }
+ }
+ }
+
+ #[inline]
+ fn starts_with<'a>(&self, needle: &'a str) -> bool {
+ let n = needle.len();
+ self.len() >= n && needle.as_bytes() == self.as_bytes().slice_to(n)
+ }
+
+ #[inline]
+ fn ends_with(&self, needle: &str) -> bool {
+ let (m, n) = (self.len(), needle.len());
+ m >= n && needle.as_bytes() == self.as_bytes().slice_from(m - n)
+ }
+
+ #[inline]
+ fn trim(&self) -> &'a str {
+ self.trim_left().trim_right()
+ }
+
+ #[inline]
+ fn trim_left(&self) -> &'a str {
+ self.trim_left_chars(char::is_whitespace)
+ }
+
+ #[inline]
+ fn trim_right(&self) -> &'a str {
+ self.trim_right_chars(char::is_whitespace)
+ }
+
+ #[inline]
+ fn trim_chars<C: CharEq>(&self, mut to_trim: C) -> &'a str {
+ let cur = match self.find(|c: char| !to_trim.matches(c)) {
+ None => "",
+ Some(i) => unsafe { raw::slice_bytes(*self, i, self.len()) }
+ };
+ match cur.rfind(|c: char| !to_trim.matches(c)) {
+ None => "",
+ Some(i) => {
+ let right = cur.char_range_at(i).next;
+ unsafe { raw::slice_bytes(cur, 0, right) }
+ }
+ }
+ }
+
+ #[inline]
+ fn trim_left_chars<C: CharEq>(&self, mut to_trim: C) -> &'a str {
+ match self.find(|c: char| !to_trim.matches(c)) {
+ None => "",
+ Some(first) => unsafe { raw::slice_bytes(*self, first, self.len()) }
+ }
+ }
+
+ #[inline]
+ fn trim_right_chars<C: CharEq>(&self, mut to_trim: C) -> &'a str {
+ match self.rfind(|c: char| !to_trim.matches(c)) {
+ None => "",
+ Some(last) => {
+ let next = self.char_range_at(last).next;
+ unsafe { raw::slice_bytes(*self, 0u, next) }
+ }
+ }
+ }
+
+ #[inline]
+ fn is_char_boundary(&self, index: uint) -> bool {
+ if index == self.len() { return true; }
+ let b = self[index];
+ return b < 128u8 || b >= 192u8;
+ }
+
+ #[inline]
+ fn char_range_at(&self, i: uint) -> CharRange {
+ if self[i] < 128u8 {
+ return CharRange {ch: self[i] as char, next: i + 1 };
+ }
+
+ // Multibyte case is a fn to allow char_range_at to inline cleanly
+ fn multibyte_char_range_at(s: &str, i: uint) -> CharRange {
+ let mut val = s[i] as u32;
+ let w = UTF8_CHAR_WIDTH[val as uint] as uint;
+ assert!((w != 0));
+
+ val = utf8_first_byte!(val, w);
+ val = utf8_acc_cont_byte!(val, s[i + 1]);
+ if w > 2 { val = utf8_acc_cont_byte!(val, s[i + 2]); }
+ if w > 3 { val = utf8_acc_cont_byte!(val, s[i + 3]); }
+
+ return CharRange {ch: unsafe { transmute(val) }, next: i + w};
+ }
+
+ return multibyte_char_range_at(*self, i);
+ }
+
+ #[inline]
+ fn char_range_at_reverse(&self, start: uint) -> CharRange {
+ let mut prev = start;
+
+ prev = prev.saturating_sub(1);
+ if self[prev] < 128 { return CharRange{ch: self[prev] as char, next: prev} }
+
+ // Multibyte case is a fn to allow char_range_at_reverse to inline cleanly
+ fn multibyte_char_range_at_reverse(s: &str, mut i: uint) -> CharRange {
+ // while there is a previous byte == 10......
+ while i > 0 && s[i] & 192u8 == TAG_CONT_U8 {
+ i -= 1u;
+ }
+
+ let mut val = s[i] as u32;
+ let w = UTF8_CHAR_WIDTH[val as uint] as uint;
+ assert!((w != 0));
+
+ val = utf8_first_byte!(val, w);
+ val = utf8_acc_cont_byte!(val, s[i + 1]);
+ if w > 2 { val = utf8_acc_cont_byte!(val, s[i + 2]); }
+ if w > 3 { val = utf8_acc_cont_byte!(val, s[i + 3]); }
+
+ return CharRange {ch: unsafe { transmute(val) }, next: i};
+ }
+
+ return multibyte_char_range_at_reverse(*self, prev);
+ }
+
+ #[inline]
+ fn char_at(&self, i: uint) -> char {
+ self.char_range_at(i).ch
+ }
+
+ #[inline]
+ fn char_at_reverse(&self, i: uint) -> char {
+ self.char_range_at_reverse(i).ch
+ }
+
+ #[inline]
+ fn as_bytes(&self) -> &'a [u8] {
+ unsafe { cast::transmute(*self) }
+ }
+
+ fn find<C: CharEq>(&self, mut search: C) -> Option<uint> {
+ if search.only_ascii() {
+ self.bytes().position(|b| search.matches(b as char))
+ } else {
+ for (index, c) in self.char_indices() {
+ if search.matches(c) { return Some(index); }
+ }
+ None
+ }
+ }
+
+ fn rfind<C: CharEq>(&self, mut search: C) -> Option<uint> {
+ if search.only_ascii() {
+ self.bytes().rposition(|b| search.matches(b as char))
+ } else {
+ for (index, c) in self.char_indices().rev() {
+ if search.matches(c) { return Some(index); }
+ }
+ None
+ }
+ }
+
+ fn find_str(&self, needle: &str) -> Option<uint> {
+ if needle.is_empty() {
+ Some(0)
+ } else {
+ self.match_indices(needle)
+ .next()
+ .map(|(start, _end)| start)
+ }
+ }
+
+ #[inline]
+ fn slice_shift_char(&self) -> (Option<char>, &'a str) {
+ if self.is_empty() {
+ return (None, *self);
+ } else {
+ let CharRange {ch, next} = self.char_range_at(0u);
+ let next_s = unsafe { raw::slice_bytes(*self, next, self.len()) };
+ return (Some(ch), next_s);
+ }
+ }
+
+ fn subslice_offset(&self, inner: &str) -> uint {
+ let a_start = self.as_ptr() as uint;
+ let a_end = a_start + self.len();
+ let b_start = inner.as_ptr() as uint;
+ let b_end = b_start + inner.len();
+
+ assert!(a_start <= b_start);
+ assert!(b_end <= a_end);
+ b_start - a_start
+ }
+
+ #[inline]
+ fn as_ptr(&self) -> *u8 {
+ self.repr().data
+ }
+}
+
+impl<'a> Default for &'a str {
+ fn default() -> &'a str { "" }
+}
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Operations on tuples
+
+#![allow(missing_doc)]
+
+use clone::Clone;
+#[cfg(not(test))] use cmp::*;
+#[cfg(not(test))] use default::Default;
+
+// macro for implementing n-ary tuple functions and operations
+macro_rules! tuple_impls {
+ ($(
+ $Tuple:ident {
+ $(($valN:ident, $refN:ident, $mutN:ident) -> $T:ident {
+ ($($x:ident),+) => $ret:expr
+ })+
+ }
+ )+) => {
+ $(
+ pub trait $Tuple<$($T),+> {
+ $(fn $valN(self) -> $T;)+
+ $(fn $refN<'a>(&'a self) -> &'a $T;)+
+ $(fn $mutN<'a>(&'a mut self) -> &'a mut $T;)+
+ }
+
+ impl<$($T),+> $Tuple<$($T),+> for ($($T,)+) {
+ $(
+ #[inline]
+ #[allow(unused_variable)]
+ fn $valN(self) -> $T {
+ let ($($x,)+) = self; $ret
+ }
+
+ #[inline]
+ #[allow(unused_variable)]
+ fn $refN<'a>(&'a self) -> &'a $T {
+ let ($(ref $x,)+) = *self; $ret
+ }
+
+ #[inline]
+ #[allow(unused_variable)]
+ fn $mutN<'a>(&'a mut self) -> &'a mut $T {
+ let ($(ref mut $x,)+) = *self; $ret
+ }
+ )+
+ }
+
+ impl<$($T:Clone),+> Clone for ($($T,)+) {
+ fn clone(&self) -> ($($T,)+) {
+ ($(self.$refN().clone(),)+)
+ }
+ }
+
+ #[cfg(not(test))]
+ impl<$($T:Eq),+> Eq for ($($T,)+) {
+ #[inline]
+ fn eq(&self, other: &($($T,)+)) -> bool {
+ $(*self.$refN() == *other.$refN())&&+
+ }
+ #[inline]
+ fn ne(&self, other: &($($T,)+)) -> bool {
+ $(*self.$refN() != *other.$refN())||+
+ }
+ }
+
+ #[cfg(not(test))]
+ impl<$($T:TotalEq),+> TotalEq for ($($T,)+) {}
+
+ #[cfg(not(test))]
+ impl<$($T:Ord + Eq),+> Ord for ($($T,)+) {
+ #[inline]
+ fn lt(&self, other: &($($T,)+)) -> bool {
+ lexical_ord!(lt, $(self.$refN(), other.$refN()),+)
+ }
+ #[inline]
+ fn le(&self, other: &($($T,)+)) -> bool {
+ lexical_ord!(le, $(self.$refN(), other.$refN()),+)
+ }
+ #[inline]
+ fn ge(&self, other: &($($T,)+)) -> bool {
+ lexical_ord!(ge, $(self.$refN(), other.$refN()),+)
+ }
+ #[inline]
+ fn gt(&self, other: &($($T,)+)) -> bool {
+ lexical_ord!(gt, $(self.$refN(), other.$refN()),+)
+ }
+ }
+
+ #[cfg(not(test))]
+ impl<$($T:TotalOrd),+> TotalOrd for ($($T,)+) {
+ #[inline]
+ fn cmp(&self, other: &($($T,)+)) -> Ordering {
+ lexical_cmp!($(self.$refN(), other.$refN()),+)
+ }
+ }
+
+ #[cfg(not(test))]
+ impl<$($T:Default),+> Default for ($($T,)+) {
+ #[inline]
+ fn default() -> ($($T,)+) {
+ ($({ let x: $T = Default::default(); x},)+)
+ }
+ }
+ )+
+ }
+}
+
+// Constructs an expression that performs a lexical ordering using method $rel.
+// The values are interleaved, so the macro invocation for
+// `(a1, a2, a3) < (b1, b2, b3)` would be `lexical_ord!(lt, a1, b1, a2, b2,
+// a3, b3)` (and similarly for `lexical_cmp`)
+macro_rules! lexical_ord {
+ ($rel: ident, $a:expr, $b:expr, $($rest_a:expr, $rest_b:expr),+) => {
+ if *$a != *$b { lexical_ord!($rel, $a, $b) }
+ else { lexical_ord!($rel, $($rest_a, $rest_b),+) }
+ };
+ ($rel: ident, $a:expr, $b:expr) => { (*$a) . $rel ($b) };
+}
+
+macro_rules! lexical_cmp {
+ ($a:expr, $b:expr, $($rest_a:expr, $rest_b:expr),+) => {
+ match ($a).cmp($b) {
+ Equal => lexical_cmp!($($rest_a, $rest_b),+),
+ ordering => ordering
+ }
+ };
+ ($a:expr, $b:expr) => { ($a).cmp($b) };
+}
+
+tuple_impls! {
+ Tuple1 {
+ (val0, ref0, mut0) -> A { (a) => a }
+ }
+ Tuple2 {
+ (val0, ref0, mut0) -> A { (a, b) => a }
+ (val1, ref1, mut1) -> B { (a, b) => b }
+ }
+ Tuple3 {
+ (val0, ref0, mut0) -> A { (a, b, c) => a }
+ (val1, ref1, mut1) -> B { (a, b, c) => b }
+ (val2, ref2, mut2) -> C { (a, b, c) => c }
+ }
+ Tuple4 {
+ (val0, ref0, mut0) -> A { (a, b, c, d) => a }
+ (val1, ref1, mut1) -> B { (a, b, c, d) => b }
+ (val2, ref2, mut2) -> C { (a, b, c, d) => c }
+ (val3, ref3, mut3) -> D { (a, b, c, d) => d }
+ }
+ Tuple5 {
+ (val0, ref0, mut0) -> A { (a, b, c, d, e) => a }
+ (val1, ref1, mut1) -> B { (a, b, c, d, e) => b }
+ (val2, ref2, mut2) -> C { (a, b, c, d, e) => c }
+ (val3, ref3, mut3) -> D { (a, b, c, d, e) => d }
+ (val4, ref4, mut4) -> E { (a, b, c, d, e) => e }
+ }
+ Tuple6 {
+ (val0, ref0, mut0) -> A { (a, b, c, d, e, f) => a }
+ (val1, ref1, mut1) -> B { (a, b, c, d, e, f) => b }
+ (val2, ref2, mut2) -> C { (a, b, c, d, e, f) => c }
+ (val3, ref3, mut3) -> D { (a, b, c, d, e, f) => d }
+ (val4, ref4, mut4) -> E { (a, b, c, d, e, f) => e }
+ (val5, ref5, mut5) -> F { (a, b, c, d, e, f) => f }
+ }
+ Tuple7 {
+ (val0, ref0, mut0) -> A { (a, b, c, d, e, f, g) => a }
+ (val1, ref1, mut1) -> B { (a, b, c, d, e, f, g) => b }
+ (val2, ref2, mut2) -> C { (a, b, c, d, e, f, g) => c }
+ (val3, ref3, mut3) -> D { (a, b, c, d, e, f, g) => d }
+ (val4, ref4, mut4) -> E { (a, b, c, d, e, f, g) => e }
+ (val5, ref5, mut5) -> F { (a, b, c, d, e, f, g) => f }
+ (val6, ref6, mut6) -> G { (a, b, c, d, e, f, g) => g }
+ }
+ Tuple8 {
+ (val0, ref0, mut0) -> A { (a, b, c, d, e, f, g, h) => a }
+ (val1, ref1, mut1) -> B { (a, b, c, d, e, f, g, h) => b }
+ (val2, ref2, mut2) -> C { (a, b, c, d, e, f, g, h) => c }
+ (val3, ref3, mut3) -> D { (a, b, c, d, e, f, g, h) => d }
+ (val4, ref4, mut4) -> E { (a, b, c, d, e, f, g, h) => e }
+ (val5, ref5, mut5) -> F { (a, b, c, d, e, f, g, h) => f }
+ (val6, ref6, mut6) -> G { (a, b, c, d, e, f, g, h) => g }
+ (val7, ref7, mut7) -> H { (a, b, c, d, e, f, g, h) => h }
+ }
+ Tuple9 {
+ (val0, ref0, mut0) -> A { (a, b, c, d, e, f, g, h, i) => a }
+ (val1, ref1, mut1) -> B { (a, b, c, d, e, f, g, h, i) => b }
+ (val2, ref2, mut2) -> C { (a, b, c, d, e, f, g, h, i) => c }
+ (val3, ref3, mut3) -> D { (a, b, c, d, e, f, g, h, i) => d }
+ (val4, ref4, mut4) -> E { (a, b, c, d, e, f, g, h, i) => e }
+ (val5, ref5, mut5) -> F { (a, b, c, d, e, f, g, h, i) => f }
+ (val6, ref6, mut6) -> G { (a, b, c, d, e, f, g, h, i) => g }
+ (val7, ref7, mut7) -> H { (a, b, c, d, e, f, g, h, i) => h }
+ (val8, ref8, mut8) -> I { (a, b, c, d, e, f, g, h, i) => i }
+ }
+ Tuple10 {
+ (val0, ref0, mut0) -> A { (a, b, c, d, e, f, g, h, i, j) => a }
+ (val1, ref1, mut1) -> B { (a, b, c, d, e, f, g, h, i, j) => b }
+ (val2, ref2, mut2) -> C { (a, b, c, d, e, f, g, h, i, j) => c }
+ (val3, ref3, mut3) -> D { (a, b, c, d, e, f, g, h, i, j) => d }
+ (val4, ref4, mut4) -> E { (a, b, c, d, e, f, g, h, i, j) => e }
+ (val5, ref5, mut5) -> F { (a, b, c, d, e, f, g, h, i, j) => f }
+ (val6, ref6, mut6) -> G { (a, b, c, d, e, f, g, h, i, j) => g }
+ (val7, ref7, mut7) -> H { (a, b, c, d, e, f, g, h, i, j) => h }
+ (val8, ref8, mut8) -> I { (a, b, c, d, e, f, g, h, i, j) => i }
+ (val9, ref9, mut9) -> J { (a, b, c, d, e, f, g, h, i, j) => j }
+ }
+ Tuple11 {
+ (val0, ref0, mut0) -> A { (a, b, c, d, e, f, g, h, i, j, k) => a }
+ (val1, ref1, mut1) -> B { (a, b, c, d, e, f, g, h, i, j, k) => b }
+ (val2, ref2, mut2) -> C { (a, b, c, d, e, f, g, h, i, j, k) => c }
+ (val3, ref3, mut3) -> D { (a, b, c, d, e, f, g, h, i, j, k) => d }
+ (val4, ref4, mut4) -> E { (a, b, c, d, e, f, g, h, i, j, k) => e }
+ (val5, ref5, mut5) -> F { (a, b, c, d, e, f, g, h, i, j, k) => f }
+ (val6, ref6, mut6) -> G { (a, b, c, d, e, f, g, h, i, j, k) => g }
+ (val7, ref7, mut7) -> H { (a, b, c, d, e, f, g, h, i, j, k) => h }
+ (val8, ref8, mut8) -> I { (a, b, c, d, e, f, g, h, i, j, k) => i }
+ (val9, ref9, mut9) -> J { (a, b, c, d, e, f, g, h, i, j, k) => j }
+ (val10, ref10, mut10) -> K { (a, b, c, d, e, f, g, h, i, j, k) => k }
+ }
+ Tuple12 {
+ (val0, ref0, mut0) -> A { (a, b, c, d, e, f, g, h, i, j, k, l) => a }
+ (val1, ref1, mut1) -> B { (a, b, c, d, e, f, g, h, i, j, k, l) => b }
+ (val2, ref2, mut2) -> C { (a, b, c, d, e, f, g, h, i, j, k, l) => c }
+ (val3, ref3, mut3) -> D { (a, b, c, d, e, f, g, h, i, j, k, l) => d }
+ (val4, ref4, mut4) -> E { (a, b, c, d, e, f, g, h, i, j, k, l) => e }
+ (val5, ref5, mut5) -> F { (a, b, c, d, e, f, g, h, i, j, k, l) => f }
+ (val6, ref6, mut6) -> G { (a, b, c, d, e, f, g, h, i, j, k, l) => g }
+ (val7, ref7, mut7) -> H { (a, b, c, d, e, f, g, h, i, j, k, l) => h }
+ (val8, ref8, mut8) -> I { (a, b, c, d, e, f, g, h, i, j, k, l) => i }
+ (val9, ref9, mut9) -> J { (a, b, c, d, e, f, g, h, i, j, k, l) => j }
+ (val10, ref10, mut10) -> K { (a, b, c, d, e, f, g, h, i, j, k, l) => k }
+ (val11, ref11, mut11) -> L { (a, b, c, d, e, f, g, h, i, j, k, l) => l }
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ use clone::Clone;
+ use cmp::*;
+ use realstd::str::StrAllocating;
+
+ #[test]
+ fn test_clone() {
+ let a = (1, "2".to_owned());
+ let b = a.clone();
+ assert_eq!(a, b);
+ }
+
+ #[test]
+ fn test_getters() {
+ macro_rules! test_getter(
+ ($x:expr, $valN:ident, $refN:ident, $mutN:ident,
+ $init:expr, $incr:expr, $result:expr) => ({
+ assert_eq!($x.$valN(), $init);
+ assert_eq!(*$x.$refN(), $init);
+ *$x.$mutN() += $incr;
+ assert_eq!(*$x.$refN(), $result);
+ })
+ )
+ let mut x = (0u8, 1u16, 2u32, 3u64, 4u, 5i8, 6i16, 7i32, 8i64, 9i, 10f32, 11f64);
+ test_getter!(x, val0, ref0, mut0, 0, 1, 1);
+ test_getter!(x, val1, ref1, mut1, 1, 1, 2);
+ test_getter!(x, val2, ref2, mut2, 2, 1, 3);
+ test_getter!(x, val3, ref3, mut3, 3, 1, 4);
+ test_getter!(x, val4, ref4, mut4, 4, 1, 5);
+ test_getter!(x, val5, ref5, mut5, 5, 1, 6);
+ test_getter!(x, val6, ref6, mut6, 6, 1, 7);
+ test_getter!(x, val7, ref7, mut7, 7, 1, 8);
+ test_getter!(x, val8, ref8, mut8, 8, 1, 9);
+ test_getter!(x, val9, ref9, mut9, 9, 1, 10);
+ test_getter!(x, val10, ref10, mut10, 10.0, 1.0, 11.0);
+ test_getter!(x, val11, ref11, mut11, 11.0, 1.0, 12.0);
+ }
+
+ #[test]
+ fn test_tuple_cmp() {
+ let (small, big) = ((1u, 2u, 3u), (3u, 2u, 1u));
+
+ let nan = 0.0/0.0;
+
+ // Eq
+ assert_eq!(small, small);
+ assert_eq!(big, big);
+ assert!(small != big);
+ assert!(big != small);
+
+ // Ord
+ assert!(small < big);
+ assert!(!(small < small));
+ assert!(!(big < small));
+ assert!(!(big < big));
+
+ assert!(small <= small);
+ assert!(big <= big);
+
+ assert!(big > small);
+ assert!(small >= small);
+ assert!(big >= small);
+ assert!(big >= big);
+
+ assert!(!((1.0, 2.0) < (nan, 3.0)));
+ assert!(!((1.0, 2.0) <= (nan, 3.0)));
+ assert!(!((1.0, 2.0) > (nan, 3.0)));
+ assert!(!((1.0, 2.0) >= (nan, 3.0)));
+ assert!(((1.0, 2.0) < (2.0, nan)));
+ assert!(!((2.0, 2.0) < (2.0, nan)));
+
+ // TotalOrd
+ assert!(small.cmp(&small) == Equal);
+ assert!(big.cmp(&big) == Equal);
+ assert!(small.cmp(&big) == Less);
+ assert!(big.cmp(&small) == Greater);
+ }
+
+ #[test]
+ fn test_show() {
+ assert_eq!(format!("{}", (1,)), "(1,)".to_owned());
+ assert_eq!(format!("{}", (1, true)), "(1, true)".to_owned());
+ assert_eq!(format!("{}", (1, "hi".to_owned(), true)), "(1, hi, true)".to_owned());
+ }
+}
--- /dev/null
+// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Types dealing with unsafe actions.
+
+use cast;
+use kinds::marker;
+
+/// Unsafe type that wraps a type T and indicates unsafe interior operations on the
+/// wrapped type. Types with an `Unsafe<T>` field are considered to have an *unsafe
+/// interior*. The Unsafe type is the only legal way to obtain aliasable data that is
+/// considered mutable. In general, transmuting an &T type into an &mut T is considered
+/// undefined behavior.
+///
+/// Although it is possible to put an Unsafe<T> into static item, it is not permitted to
+/// take the address of the static item if the item is not declared as mutable. This rule
+/// exists because immutable static items are stored in read-only memory, and thus any
+/// attempt to mutate their interior can cause segfaults. Immutable static items containing
+/// Unsafe<T> instances are still useful as read-only initializers, however, so we do not
+/// forbid them altogether.
+///
+/// Types like `Cell` and `RefCell` use this type to wrap their internal data.
+///
+/// Unsafe doesn't opt-out from any kind, instead, types with an `Unsafe` interior
+/// are expected to opt-out from kinds themselves.
+///
+/// # Example:
+///
+/// ```rust
+/// use std::ty::Unsafe;
+/// use std::kinds::marker;
+///
+/// struct NotThreadSafe<T> {
+/// value: Unsafe<T>,
+/// marker1: marker::NoShare
+/// }
+/// ```
+///
+/// **NOTE:** Unsafe<T> fields are public to allow static initializers. It is not recommended
+/// to access its fields directly, `get` should be used instead.
+#[lang="unsafe"]
+pub struct Unsafe<T> {
+ /// Wrapped value
+ pub value: T,
+
+ /// Invariance marker
+ pub marker1: marker::InvariantType<T>
+}
+
+impl<T> Unsafe<T> {
+
+ /// Static constructor
+ pub fn new(value: T) -> Unsafe<T> {
+ Unsafe{value: value, marker1: marker::InvariantType}
+ }
+
+ /// Gets a mutable pointer to the wrapped value
+ #[inline]
+ pub unsafe fn get(&self) -> *mut T { cast::transmute_mut_unsafe(&self.value) }
+
+ /// Unwraps the value
+ #[inline]
+ pub unsafe fn unwrap(self) -> T { self.value }
+}
--- /dev/null
+// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// The following code was generated by "src/etc/unicode.py"
+
+#![allow(missing_doc, non_uppercase_statics)]
+
+fn bsearch_range_table(c: char, r: &'static [(char,char)]) -> bool {
+ use cmp::{Equal, Less, Greater};
+ use slice::ImmutableVector;
+ use option::None;
+ r.bsearch(|&(lo,hi)| {
+ if lo <= c && c <= hi { Equal }
+ else if hi < c { Less }
+ else { Greater }
+ }) != None
+}
+
+pub mod general_category {
+ static Cc_table : &'static [(char,char)] = &[
+ ('\x00', '\x1f'), ('\x7f', '\x9f')
+ ];
+
+ pub fn Cc(c: char) -> bool {
+ super::bsearch_range_table(c, Cc_table)
+ }
+
+ static Nd_table : &'static [(char,char)] = &[
+ ('\x30', '\x39'), ('\u0660', '\u0669'),
+ ('\u06f0', '\u06f9'), ('\u07c0', '\u07c9'),
+ ('\u0966', '\u096f'), ('\u09e6', '\u09ef'),
+ ('\u0a66', '\u0a6f'), ('\u0ae6', '\u0aef'),
+ ('\u0b66', '\u0b6f'), ('\u0be6', '\u0bef'),
+ ('\u0c66', '\u0c6f'), ('\u0ce6', '\u0cef'),
+ ('\u0d66', '\u0d6f'), ('\u0e50', '\u0e59'),
+ ('\u0ed0', '\u0ed9'), ('\u0f20', '\u0f29'),
+ ('\u1040', '\u1049'), ('\u1090', '\u1099'),
+ ('\u17e0', '\u17e9'), ('\u1810', '\u1819'),
+ ('\u1946', '\u194f'), ('\u19d0', '\u19d9'),
+ ('\u1a80', '\u1a99'), ('\u1b50', '\u1b59'),
+ ('\u1bb0', '\u1bb9'), ('\u1c40', '\u1c49'),
+ ('\u1c50', '\u1c59'), ('\ua620', '\ua629'),
+ ('\ua8d0', '\ua8d9'), ('\ua900', '\ua909'),
+ ('\ua9d0', '\ua9d9'), ('\uaa50', '\uaa59'),
+ ('\uabf0', '\uabf9'), ('\uff10', '\uff19'),
+ ('\U000104a0', '\U000104a9'), ('\U00011066', '\U0001106f'),
+ ('\U000110f0', '\U000110f9'), ('\U00011136', '\U0001113f'),
+ ('\U000111d0', '\U000111d9'), ('\U000116c0', '\U000116c9'),
+ ('\U0001d7ce', '\U0001d7ff')
+ ];
+
+ pub fn Nd(c: char) -> bool {
+ super::bsearch_range_table(c, Nd_table)
+ }
+
+ static Nl_table : &'static [(char,char)] = &[
+ ('\u16ee', '\u16f0'), ('\u2160', '\u2182'),
+ ('\u2185', '\u2188'), ('\u3007', '\u3007'),
+ ('\u3021', '\u3029'), ('\u3038', '\u303a'),
+ ('\ua6e6', '\ua6ef'), ('\U00010140', '\U00010174'),
+ ('\U00010341', '\U00010341'), ('\U0001034a', '\U0001034a'),
+ ('\U000103d1', '\U000103d5'), ('\U00012400', '\U00012462')
+ ];
+
+ pub fn Nl(c: char) -> bool {
+ super::bsearch_range_table(c, Nl_table)
+ }
+
+ static No_table : &'static [(char,char)] = &[
+ ('\xb2', '\xb3'), ('\xb9', '\xb9'),
+ ('\xbc', '\xbe'), ('\u09f4', '\u09f9'),
+ ('\u0b72', '\u0b77'), ('\u0bf0', '\u0bf2'),
+ ('\u0c78', '\u0c7e'), ('\u0d70', '\u0d75'),
+ ('\u0f2a', '\u0f33'), ('\u1369', '\u137c'),
+ ('\u17f0', '\u17f9'), ('\u19da', '\u19da'),
+ ('\u2070', '\u2070'), ('\u2074', '\u2079'),
+ ('\u2080', '\u2089'), ('\u2150', '\u215f'),
+ ('\u2189', '\u2189'), ('\u2460', '\u249b'),
+ ('\u24ea', '\u24ff'), ('\u2776', '\u2793'),
+ ('\u2cfd', '\u2cfd'), ('\u3192', '\u3195'),
+ ('\u3220', '\u3229'), ('\u3248', '\u324f'),
+ ('\u3251', '\u325f'), ('\u3280', '\u3289'),
+ ('\u32b1', '\u32bf'), ('\ua830', '\ua835'),
+ ('\U00010107', '\U00010133'), ('\U00010175', '\U00010178'),
+ ('\U0001018a', '\U0001018a'), ('\U00010320', '\U00010323'),
+ ('\U00010858', '\U0001085f'), ('\U00010916', '\U0001091b'),
+ ('\U00010a40', '\U00010a47'), ('\U00010a7d', '\U00010a7e'),
+ ('\U00010b58', '\U00010b5f'), ('\U00010b78', '\U00010b7f'),
+ ('\U00010e60', '\U00010e7e'), ('\U00011052', '\U00011065'),
+ ('\U0001d360', '\U0001d371'), ('\U0001f100', '\U0001f10a')
+ ];
+
+ pub fn No(c: char) -> bool {
+ super::bsearch_range_table(c, No_table)
+ }
+
+}
+pub mod decompose {
+ use option::Option;
+ use option::{Some, None};
+ use slice::ImmutableVector;
+
+ fn bsearch_table(c: char, r: &'static [(char, &'static [char])]) -> Option<&'static [char]> {
+ use cmp::{Equal, Less, Greater};
+ match r.bsearch(|&(val, _)| {
+ if c == val { Equal }
+ else if val < c { Less }
+ else { Greater }
+ }) {
+ Some(idx) => {
+ let (_, result) = r[idx];
+ Some(result)
+ }
+ None => None
+ }
+ }
+
+
+
+ // Canonical decompositions
+ static canonical_table : &'static [(char, &'static [char])] = &[
+ ('\xc0', &['\x41', '\u0300']), ('\xc1', &['\x41', '\u0301']), ('\xc2', &['\x41', '\u0302']),
+ ('\xc3', &['\x41', '\u0303']), ('\xc4', &['\x41', '\u0308']), ('\xc5', &['\x41', '\u030a']),
+ ('\xc7', &['\x43', '\u0327']), ('\xc8', &['\x45', '\u0300']), ('\xc9', &['\x45', '\u0301']),
+ ('\xca', &['\x45', '\u0302']), ('\xcb', &['\x45', '\u0308']), ('\xcc', &['\x49', '\u0300']),
+ ('\xcd', &['\x49', '\u0301']), ('\xce', &['\x49', '\u0302']), ('\xcf', &['\x49', '\u0308']),
+ ('\xd1', &['\x4e', '\u0303']), ('\xd2', &['\x4f', '\u0300']), ('\xd3', &['\x4f', '\u0301']),
+ ('\xd4', &['\x4f', '\u0302']), ('\xd5', &['\x4f', '\u0303']), ('\xd6', &['\x4f', '\u0308']),
+ ('\xd9', &['\x55', '\u0300']), ('\xda', &['\x55', '\u0301']), ('\xdb', &['\x55', '\u0302']),
+ ('\xdc', &['\x55', '\u0308']), ('\xdd', &['\x59', '\u0301']), ('\xe0', &['\x61', '\u0300']),
+ ('\xe1', &['\x61', '\u0301']), ('\xe2', &['\x61', '\u0302']), ('\xe3', &['\x61', '\u0303']),
+ ('\xe4', &['\x61', '\u0308']), ('\xe5', &['\x61', '\u030a']), ('\xe7', &['\x63', '\u0327']),
+ ('\xe8', &['\x65', '\u0300']), ('\xe9', &['\x65', '\u0301']), ('\xea', &['\x65', '\u0302']),
+ ('\xeb', &['\x65', '\u0308']), ('\xec', &['\x69', '\u0300']), ('\xed', &['\x69', '\u0301']),
+ ('\xee', &['\x69', '\u0302']), ('\xef', &['\x69', '\u0308']), ('\xf1', &['\x6e', '\u0303']),
+ ('\xf2', &['\x6f', '\u0300']), ('\xf3', &['\x6f', '\u0301']), ('\xf4', &['\x6f', '\u0302']),
+ ('\xf5', &['\x6f', '\u0303']), ('\xf6', &['\x6f', '\u0308']), ('\xf9', &['\x75', '\u0300']),
+ ('\xfa', &['\x75', '\u0301']), ('\xfb', &['\x75', '\u0302']), ('\xfc', &['\x75', '\u0308']),
+ ('\xfd', &['\x79', '\u0301']), ('\xff', &['\x79', '\u0308']), ('\u0100', &['\x41',
+ '\u0304']), ('\u0101', &['\x61', '\u0304']), ('\u0102', &['\x41', '\u0306']), ('\u0103',
+ &['\x61', '\u0306']), ('\u0104', &['\x41', '\u0328']), ('\u0105', &['\x61', '\u0328']),
+ ('\u0106', &['\x43', '\u0301']), ('\u0107', &['\x63', '\u0301']), ('\u0108', &['\x43',
+ '\u0302']), ('\u0109', &['\x63', '\u0302']), ('\u010a', &['\x43', '\u0307']), ('\u010b',
+ &['\x63', '\u0307']), ('\u010c', &['\x43', '\u030c']), ('\u010d', &['\x63', '\u030c']),
+ ('\u010e', &['\x44', '\u030c']), ('\u010f', &['\x64', '\u030c']), ('\u0112', &['\x45',
+ '\u0304']), ('\u0113', &['\x65', '\u0304']), ('\u0114', &['\x45', '\u0306']), ('\u0115',
+ &['\x65', '\u0306']), ('\u0116', &['\x45', '\u0307']), ('\u0117', &['\x65', '\u0307']),
+ ('\u0118', &['\x45', '\u0328']), ('\u0119', &['\x65', '\u0328']), ('\u011a', &['\x45',
+ '\u030c']), ('\u011b', &['\x65', '\u030c']), ('\u011c', &['\x47', '\u0302']), ('\u011d',
+ &['\x67', '\u0302']), ('\u011e', &['\x47', '\u0306']), ('\u011f', &['\x67', '\u0306']),
+ ('\u0120', &['\x47', '\u0307']), ('\u0121', &['\x67', '\u0307']), ('\u0122', &['\x47',
+ '\u0327']), ('\u0123', &['\x67', '\u0327']), ('\u0124', &['\x48', '\u0302']), ('\u0125',
+ &['\x68', '\u0302']), ('\u0128', &['\x49', '\u0303']), ('\u0129', &['\x69', '\u0303']),
+ ('\u012a', &['\x49', '\u0304']), ('\u012b', &['\x69', '\u0304']), ('\u012c', &['\x49',
+ '\u0306']), ('\u012d', &['\x69', '\u0306']), ('\u012e', &['\x49', '\u0328']), ('\u012f',
+ &['\x69', '\u0328']), ('\u0130', &['\x49', '\u0307']), ('\u0134', &['\x4a', '\u0302']),
+ ('\u0135', &['\x6a', '\u0302']), ('\u0136', &['\x4b', '\u0327']), ('\u0137', &['\x6b',
+ '\u0327']), ('\u0139', &['\x4c', '\u0301']), ('\u013a', &['\x6c', '\u0301']), ('\u013b',
+ &['\x4c', '\u0327']), ('\u013c', &['\x6c', '\u0327']), ('\u013d', &['\x4c', '\u030c']),
+ ('\u013e', &['\x6c', '\u030c']), ('\u0143', &['\x4e', '\u0301']), ('\u0144', &['\x6e',
+ '\u0301']), ('\u0145', &['\x4e', '\u0327']), ('\u0146', &['\x6e', '\u0327']), ('\u0147',
+ &['\x4e', '\u030c']), ('\u0148', &['\x6e', '\u030c']), ('\u014c', &['\x4f', '\u0304']),
+ ('\u014d', &['\x6f', '\u0304']), ('\u014e', &['\x4f', '\u0306']), ('\u014f', &['\x6f',
+ '\u0306']), ('\u0150', &['\x4f', '\u030b']), ('\u0151', &['\x6f', '\u030b']), ('\u0154',
+ &['\x52', '\u0301']), ('\u0155', &['\x72', '\u0301']), ('\u0156', &['\x52', '\u0327']),
+ ('\u0157', &['\x72', '\u0327']), ('\u0158', &['\x52', '\u030c']), ('\u0159', &['\x72',
+ '\u030c']), ('\u015a', &['\x53', '\u0301']), ('\u015b', &['\x73', '\u0301']), ('\u015c',
+ &['\x53', '\u0302']), ('\u015d', &['\x73', '\u0302']), ('\u015e', &['\x53', '\u0327']),
+ ('\u015f', &['\x73', '\u0327']), ('\u0160', &['\x53', '\u030c']), ('\u0161', &['\x73',
+ '\u030c']), ('\u0162', &['\x54', '\u0327']), ('\u0163', &['\x74', '\u0327']), ('\u0164',
+ &['\x54', '\u030c']), ('\u0165', &['\x74', '\u030c']), ('\u0168', &['\x55', '\u0303']),
+ ('\u0169', &['\x75', '\u0303']), ('\u016a', &['\x55', '\u0304']), ('\u016b', &['\x75',
+ '\u0304']), ('\u016c', &['\x55', '\u0306']), ('\u016d', &['\x75', '\u0306']), ('\u016e',
+ &['\x55', '\u030a']), ('\u016f', &['\x75', '\u030a']), ('\u0170', &['\x55', '\u030b']),
+ ('\u0171', &['\x75', '\u030b']), ('\u0172', &['\x55', '\u0328']), ('\u0173', &['\x75',
+ '\u0328']), ('\u0174', &['\x57', '\u0302']), ('\u0175', &['\x77', '\u0302']), ('\u0176',
+ &['\x59', '\u0302']), ('\u0177', &['\x79', '\u0302']), ('\u0178', &['\x59', '\u0308']),
+ ('\u0179', &['\x5a', '\u0301']), ('\u017a', &['\x7a', '\u0301']), ('\u017b', &['\x5a',
+ '\u0307']), ('\u017c', &['\x7a', '\u0307']), ('\u017d', &['\x5a', '\u030c']), ('\u017e',
+ &['\x7a', '\u030c']), ('\u01a0', &['\x4f', '\u031b']), ('\u01a1', &['\x6f', '\u031b']),
+ ('\u01af', &['\x55', '\u031b']), ('\u01b0', &['\x75', '\u031b']), ('\u01cd', &['\x41',
+ '\u030c']), ('\u01ce', &['\x61', '\u030c']), ('\u01cf', &['\x49', '\u030c']), ('\u01d0',
+ &['\x69', '\u030c']), ('\u01d1', &['\x4f', '\u030c']), ('\u01d2', &['\x6f', '\u030c']),
+ ('\u01d3', &['\x55', '\u030c']), ('\u01d4', &['\x75', '\u030c']), ('\u01d5', &['\xdc',
+ '\u0304']), ('\u01d6', &['\xfc', '\u0304']), ('\u01d7', &['\xdc', '\u0301']), ('\u01d8',
+ &['\xfc', '\u0301']), ('\u01d9', &['\xdc', '\u030c']), ('\u01da', &['\xfc', '\u030c']),
+ ('\u01db', &['\xdc', '\u0300']), ('\u01dc', &['\xfc', '\u0300']), ('\u01de', &['\xc4',
+ '\u0304']), ('\u01df', &['\xe4', '\u0304']), ('\u01e0', &['\u0226', '\u0304']), ('\u01e1',
+ &['\u0227', '\u0304']), ('\u01e2', &['\xc6', '\u0304']), ('\u01e3', &['\xe6', '\u0304']),
+ ('\u01e6', &['\x47', '\u030c']), ('\u01e7', &['\x67', '\u030c']), ('\u01e8', &['\x4b',
+ '\u030c']), ('\u01e9', &['\x6b', '\u030c']), ('\u01ea', &['\x4f', '\u0328']), ('\u01eb',
+ &['\x6f', '\u0328']), ('\u01ec', &['\u01ea', '\u0304']), ('\u01ed', &['\u01eb', '\u0304']),
+ ('\u01ee', &['\u01b7', '\u030c']), ('\u01ef', &['\u0292', '\u030c']), ('\u01f0', &['\x6a',
+ '\u030c']), ('\u01f4', &['\x47', '\u0301']), ('\u01f5', &['\x67', '\u0301']), ('\u01f8',
+ &['\x4e', '\u0300']), ('\u01f9', &['\x6e', '\u0300']), ('\u01fa', &['\xc5', '\u0301']),
+ ('\u01fb', &['\xe5', '\u0301']), ('\u01fc', &['\xc6', '\u0301']), ('\u01fd', &['\xe6',
+ '\u0301']), ('\u01fe', &['\xd8', '\u0301']), ('\u01ff', &['\xf8', '\u0301']), ('\u0200',
+ &['\x41', '\u030f']), ('\u0201', &['\x61', '\u030f']), ('\u0202', &['\x41', '\u0311']),
+ ('\u0203', &['\x61', '\u0311']), ('\u0204', &['\x45', '\u030f']), ('\u0205', &['\x65',
+ '\u030f']), ('\u0206', &['\x45', '\u0311']), ('\u0207', &['\x65', '\u0311']), ('\u0208',
+ &['\x49', '\u030f']), ('\u0209', &['\x69', '\u030f']), ('\u020a', &['\x49', '\u0311']),
+ ('\u020b', &['\x69', '\u0311']), ('\u020c', &['\x4f', '\u030f']), ('\u020d', &['\x6f',
+ '\u030f']), ('\u020e', &['\x4f', '\u0311']), ('\u020f', &['\x6f', '\u0311']), ('\u0210',
+ &['\x52', '\u030f']), ('\u0211', &['\x72', '\u030f']), ('\u0212', &['\x52', '\u0311']),
+ ('\u0213', &['\x72', '\u0311']), ('\u0214', &['\x55', '\u030f']), ('\u0215', &['\x75',
+ '\u030f']), ('\u0216', &['\x55', '\u0311']), ('\u0217', &['\x75', '\u0311']), ('\u0218',
+ &['\x53', '\u0326']), ('\u0219', &['\x73', '\u0326']), ('\u021a', &['\x54', '\u0326']),
+ ('\u021b', &['\x74', '\u0326']), ('\u021e', &['\x48', '\u030c']), ('\u021f', &['\x68',
+ '\u030c']), ('\u0226', &['\x41', '\u0307']), ('\u0227', &['\x61', '\u0307']), ('\u0228',
+ &['\x45', '\u0327']), ('\u0229', &['\x65', '\u0327']), ('\u022a', &['\xd6', '\u0304']),
+ ('\u022b', &['\xf6', '\u0304']), ('\u022c', &['\xd5', '\u0304']), ('\u022d', &['\xf5',
+ '\u0304']), ('\u022e', &['\x4f', '\u0307']), ('\u022f', &['\x6f', '\u0307']), ('\u0230',
+ &['\u022e', '\u0304']), ('\u0231', &['\u022f', '\u0304']), ('\u0232', &['\x59', '\u0304']),
+ ('\u0233', &['\x79', '\u0304']), ('\u0340', &['\u0300']), ('\u0341', &['\u0301']),
+ ('\u0343', &['\u0313']), ('\u0344', &['\u0308', '\u0301']), ('\u0374', &['\u02b9']),
+ ('\u037e', &['\x3b']), ('\u0385', &['\xa8', '\u0301']), ('\u0386', &['\u0391', '\u0301']),
+ ('\u0387', &['\xb7']), ('\u0388', &['\u0395', '\u0301']), ('\u0389', &['\u0397', '\u0301']),
+ ('\u038a', &['\u0399', '\u0301']), ('\u038c', &['\u039f', '\u0301']), ('\u038e', &['\u03a5',
+ '\u0301']), ('\u038f', &['\u03a9', '\u0301']), ('\u0390', &['\u03ca', '\u0301']), ('\u03aa',
+ &['\u0399', '\u0308']), ('\u03ab', &['\u03a5', '\u0308']), ('\u03ac', &['\u03b1',
+ '\u0301']), ('\u03ad', &['\u03b5', '\u0301']), ('\u03ae', &['\u03b7', '\u0301']), ('\u03af',
+ &['\u03b9', '\u0301']), ('\u03b0', &['\u03cb', '\u0301']), ('\u03ca', &['\u03b9',
+ '\u0308']), ('\u03cb', &['\u03c5', '\u0308']), ('\u03cc', &['\u03bf', '\u0301']), ('\u03cd',
+ &['\u03c5', '\u0301']), ('\u03ce', &['\u03c9', '\u0301']), ('\u03d3', &['\u03d2',
+ '\u0301']), ('\u03d4', &['\u03d2', '\u0308']), ('\u0400', &['\u0415', '\u0300']), ('\u0401',
+ &['\u0415', '\u0308']), ('\u0403', &['\u0413', '\u0301']), ('\u0407', &['\u0406',
+ '\u0308']), ('\u040c', &['\u041a', '\u0301']), ('\u040d', &['\u0418', '\u0300']), ('\u040e',
+ &['\u0423', '\u0306']), ('\u0419', &['\u0418', '\u0306']), ('\u0439', &['\u0438',
+ '\u0306']), ('\u0450', &['\u0435', '\u0300']), ('\u0451', &['\u0435', '\u0308']), ('\u0453',
+ &['\u0433', '\u0301']), ('\u0457', &['\u0456', '\u0308']), ('\u045c', &['\u043a',
+ '\u0301']), ('\u045d', &['\u0438', '\u0300']), ('\u045e', &['\u0443', '\u0306']), ('\u0476',
+ &['\u0474', '\u030f']), ('\u0477', &['\u0475', '\u030f']), ('\u04c1', &['\u0416',
+ '\u0306']), ('\u04c2', &['\u0436', '\u0306']), ('\u04d0', &['\u0410', '\u0306']), ('\u04d1',
+ &['\u0430', '\u0306']), ('\u04d2', &['\u0410', '\u0308']), ('\u04d3', &['\u0430',
+ '\u0308']), ('\u04d6', &['\u0415', '\u0306']), ('\u04d7', &['\u0435', '\u0306']), ('\u04da',
+ &['\u04d8', '\u0308']), ('\u04db', &['\u04d9', '\u0308']), ('\u04dc', &['\u0416',
+ '\u0308']), ('\u04dd', &['\u0436', '\u0308']), ('\u04de', &['\u0417', '\u0308']), ('\u04df',
+ &['\u0437', '\u0308']), ('\u04e2', &['\u0418', '\u0304']), ('\u04e3', &['\u0438',
+ '\u0304']), ('\u04e4', &['\u0418', '\u0308']), ('\u04e5', &['\u0438', '\u0308']), ('\u04e6',
+ &['\u041e', '\u0308']), ('\u04e7', &['\u043e', '\u0308']), ('\u04ea', &['\u04e8',
+ '\u0308']), ('\u04eb', &['\u04e9', '\u0308']), ('\u04ec', &['\u042d', '\u0308']), ('\u04ed',
+ &['\u044d', '\u0308']), ('\u04ee', &['\u0423', '\u0304']), ('\u04ef', &['\u0443',
+ '\u0304']), ('\u04f0', &['\u0423', '\u0308']), ('\u04f1', &['\u0443', '\u0308']), ('\u04f2',
+ &['\u0423', '\u030b']), ('\u04f3', &['\u0443', '\u030b']), ('\u04f4', &['\u0427',
+ '\u0308']), ('\u04f5', &['\u0447', '\u0308']), ('\u04f8', &['\u042b', '\u0308']), ('\u04f9',
+ &['\u044b', '\u0308']), ('\u0622', &['\u0627', '\u0653']), ('\u0623', &['\u0627',
+ '\u0654']), ('\u0624', &['\u0648', '\u0654']), ('\u0625', &['\u0627', '\u0655']), ('\u0626',
+ &['\u064a', '\u0654']), ('\u06c0', &['\u06d5', '\u0654']), ('\u06c2', &['\u06c1',
+ '\u0654']), ('\u06d3', &['\u06d2', '\u0654']), ('\u0929', &['\u0928', '\u093c']), ('\u0931',
+ &['\u0930', '\u093c']), ('\u0934', &['\u0933', '\u093c']), ('\u0958', &['\u0915',
+ '\u093c']), ('\u0959', &['\u0916', '\u093c']), ('\u095a', &['\u0917', '\u093c']), ('\u095b',
+ &['\u091c', '\u093c']), ('\u095c', &['\u0921', '\u093c']), ('\u095d', &['\u0922',
+ '\u093c']), ('\u095e', &['\u092b', '\u093c']), ('\u095f', &['\u092f', '\u093c']), ('\u09cb',
+ &['\u09c7', '\u09be']), ('\u09cc', &['\u09c7', '\u09d7']), ('\u09dc', &['\u09a1',
+ '\u09bc']), ('\u09dd', &['\u09a2', '\u09bc']), ('\u09df', &['\u09af', '\u09bc']), ('\u0a33',
+ &['\u0a32', '\u0a3c']), ('\u0a36', &['\u0a38', '\u0a3c']), ('\u0a59', &['\u0a16',
+ '\u0a3c']), ('\u0a5a', &['\u0a17', '\u0a3c']), ('\u0a5b', &['\u0a1c', '\u0a3c']), ('\u0a5e',
+ &['\u0a2b', '\u0a3c']), ('\u0b48', &['\u0b47', '\u0b56']), ('\u0b4b', &['\u0b47',
+ '\u0b3e']), ('\u0b4c', &['\u0b47', '\u0b57']), ('\u0b5c', &['\u0b21', '\u0b3c']), ('\u0b5d',
+ &['\u0b22', '\u0b3c']), ('\u0b94', &['\u0b92', '\u0bd7']), ('\u0bca', &['\u0bc6',
+ '\u0bbe']), ('\u0bcb', &['\u0bc7', '\u0bbe']), ('\u0bcc', &['\u0bc6', '\u0bd7']), ('\u0c48',
+ &['\u0c46', '\u0c56']), ('\u0cc0', &['\u0cbf', '\u0cd5']), ('\u0cc7', &['\u0cc6',
+ '\u0cd5']), ('\u0cc8', &['\u0cc6', '\u0cd6']), ('\u0cca', &['\u0cc6', '\u0cc2']), ('\u0ccb',
+ &['\u0cca', '\u0cd5']), ('\u0d4a', &['\u0d46', '\u0d3e']), ('\u0d4b', &['\u0d47',
+ '\u0d3e']), ('\u0d4c', &['\u0d46', '\u0d57']), ('\u0dda', &['\u0dd9', '\u0dca']), ('\u0ddc',
+ &['\u0dd9', '\u0dcf']), ('\u0ddd', &['\u0ddc', '\u0dca']), ('\u0dde', &['\u0dd9',
+ '\u0ddf']), ('\u0f43', &['\u0f42', '\u0fb7']), ('\u0f4d', &['\u0f4c', '\u0fb7']), ('\u0f52',
+ &['\u0f51', '\u0fb7']), ('\u0f57', &['\u0f56', '\u0fb7']), ('\u0f5c', &['\u0f5b',
+ '\u0fb7']), ('\u0f69', &['\u0f40', '\u0fb5']), ('\u0f73', &['\u0f71', '\u0f72']), ('\u0f75',
+ &['\u0f71', '\u0f74']), ('\u0f76', &['\u0fb2', '\u0f80']), ('\u0f78', &['\u0fb3',
+ '\u0f80']), ('\u0f81', &['\u0f71', '\u0f80']), ('\u0f93', &['\u0f92', '\u0fb7']), ('\u0f9d',
+ &['\u0f9c', '\u0fb7']), ('\u0fa2', &['\u0fa1', '\u0fb7']), ('\u0fa7', &['\u0fa6',
+ '\u0fb7']), ('\u0fac', &['\u0fab', '\u0fb7']), ('\u0fb9', &['\u0f90', '\u0fb5']), ('\u1026',
+ &['\u1025', '\u102e']), ('\u1b06', &['\u1b05', '\u1b35']), ('\u1b08', &['\u1b07',
+ '\u1b35']), ('\u1b0a', &['\u1b09', '\u1b35']), ('\u1b0c', &['\u1b0b', '\u1b35']), ('\u1b0e',
+ &['\u1b0d', '\u1b35']), ('\u1b12', &['\u1b11', '\u1b35']), ('\u1b3b', &['\u1b3a',
+ '\u1b35']), ('\u1b3d', &['\u1b3c', '\u1b35']), ('\u1b40', &['\u1b3e', '\u1b35']), ('\u1b41',
+ &['\u1b3f', '\u1b35']), ('\u1b43', &['\u1b42', '\u1b35']), ('\u1e00', &['\x41', '\u0325']),
+ ('\u1e01', &['\x61', '\u0325']), ('\u1e02', &['\x42', '\u0307']), ('\u1e03', &['\x62',
+ '\u0307']), ('\u1e04', &['\x42', '\u0323']), ('\u1e05', &['\x62', '\u0323']), ('\u1e06',
+ &['\x42', '\u0331']), ('\u1e07', &['\x62', '\u0331']), ('\u1e08', &['\xc7', '\u0301']),
+ ('\u1e09', &['\xe7', '\u0301']), ('\u1e0a', &['\x44', '\u0307']), ('\u1e0b', &['\x64',
+ '\u0307']), ('\u1e0c', &['\x44', '\u0323']), ('\u1e0d', &['\x64', '\u0323']), ('\u1e0e',
+ &['\x44', '\u0331']), ('\u1e0f', &['\x64', '\u0331']), ('\u1e10', &['\x44', '\u0327']),
+ ('\u1e11', &['\x64', '\u0327']), ('\u1e12', &['\x44', '\u032d']), ('\u1e13', &['\x64',
+ '\u032d']), ('\u1e14', &['\u0112', '\u0300']), ('\u1e15', &['\u0113', '\u0300']), ('\u1e16',
+ &['\u0112', '\u0301']), ('\u1e17', &['\u0113', '\u0301']), ('\u1e18', &['\x45', '\u032d']),
+ ('\u1e19', &['\x65', '\u032d']), ('\u1e1a', &['\x45', '\u0330']), ('\u1e1b', &['\x65',
+ '\u0330']), ('\u1e1c', &['\u0228', '\u0306']), ('\u1e1d', &['\u0229', '\u0306']), ('\u1e1e',
+ &['\x46', '\u0307']), ('\u1e1f', &['\x66', '\u0307']), ('\u1e20', &['\x47', '\u0304']),
+ ('\u1e21', &['\x67', '\u0304']), ('\u1e22', &['\x48', '\u0307']), ('\u1e23', &['\x68',
+ '\u0307']), ('\u1e24', &['\x48', '\u0323']), ('\u1e25', &['\x68', '\u0323']), ('\u1e26',
+ &['\x48', '\u0308']), ('\u1e27', &['\x68', '\u0308']), ('\u1e28', &['\x48', '\u0327']),
+ ('\u1e29', &['\x68', '\u0327']), ('\u1e2a', &['\x48', '\u032e']), ('\u1e2b', &['\x68',
+ '\u032e']), ('\u1e2c', &['\x49', '\u0330']), ('\u1e2d', &['\x69', '\u0330']), ('\u1e2e',
+ &['\xcf', '\u0301']), ('\u1e2f', &['\xef', '\u0301']), ('\u1e30', &['\x4b', '\u0301']),
+ ('\u1e31', &['\x6b', '\u0301']), ('\u1e32', &['\x4b', '\u0323']), ('\u1e33', &['\x6b',
+ '\u0323']), ('\u1e34', &['\x4b', '\u0331']), ('\u1e35', &['\x6b', '\u0331']), ('\u1e36',
+ &['\x4c', '\u0323']), ('\u1e37', &['\x6c', '\u0323']), ('\u1e38', &['\u1e36', '\u0304']),
+ ('\u1e39', &['\u1e37', '\u0304']), ('\u1e3a', &['\x4c', '\u0331']), ('\u1e3b', &['\x6c',
+ '\u0331']), ('\u1e3c', &['\x4c', '\u032d']), ('\u1e3d', &['\x6c', '\u032d']), ('\u1e3e',
+ &['\x4d', '\u0301']), ('\u1e3f', &['\x6d', '\u0301']), ('\u1e40', &['\x4d', '\u0307']),
+ ('\u1e41', &['\x6d', '\u0307']), ('\u1e42', &['\x4d', '\u0323']), ('\u1e43', &['\x6d',
+ '\u0323']), ('\u1e44', &['\x4e', '\u0307']), ('\u1e45', &['\x6e', '\u0307']), ('\u1e46',
+ &['\x4e', '\u0323']), ('\u1e47', &['\x6e', '\u0323']), ('\u1e48', &['\x4e', '\u0331']),
+ ('\u1e49', &['\x6e', '\u0331']), ('\u1e4a', &['\x4e', '\u032d']), ('\u1e4b', &['\x6e',
+ '\u032d']), ('\u1e4c', &['\xd5', '\u0301']), ('\u1e4d', &['\xf5', '\u0301']), ('\u1e4e',
+ &['\xd5', '\u0308']), ('\u1e4f', &['\xf5', '\u0308']), ('\u1e50', &['\u014c', '\u0300']),
+ ('\u1e51', &['\u014d', '\u0300']), ('\u1e52', &['\u014c', '\u0301']), ('\u1e53', &['\u014d',
+ '\u0301']), ('\u1e54', &['\x50', '\u0301']), ('\u1e55', &['\x70', '\u0301']), ('\u1e56',
+ &['\x50', '\u0307']), ('\u1e57', &['\x70', '\u0307']), ('\u1e58', &['\x52', '\u0307']),
+ ('\u1e59', &['\x72', '\u0307']), ('\u1e5a', &['\x52', '\u0323']), ('\u1e5b', &['\x72',
+ '\u0323']), ('\u1e5c', &['\u1e5a', '\u0304']), ('\u1e5d', &['\u1e5b', '\u0304']), ('\u1e5e',
+ &['\x52', '\u0331']), ('\u1e5f', &['\x72', '\u0331']), ('\u1e60', &['\x53', '\u0307']),
+ ('\u1e61', &['\x73', '\u0307']), ('\u1e62', &['\x53', '\u0323']), ('\u1e63', &['\x73',
+ '\u0323']), ('\u1e64', &['\u015a', '\u0307']), ('\u1e65', &['\u015b', '\u0307']), ('\u1e66',
+ &['\u0160', '\u0307']), ('\u1e67', &['\u0161', '\u0307']), ('\u1e68', &['\u1e62',
+ '\u0307']), ('\u1e69', &['\u1e63', '\u0307']), ('\u1e6a', &['\x54', '\u0307']), ('\u1e6b',
+ &['\x74', '\u0307']), ('\u1e6c', &['\x54', '\u0323']), ('\u1e6d', &['\x74', '\u0323']),
+ ('\u1e6e', &['\x54', '\u0331']), ('\u1e6f', &['\x74', '\u0331']), ('\u1e70', &['\x54',
+ '\u032d']), ('\u1e71', &['\x74', '\u032d']), ('\u1e72', &['\x55', '\u0324']), ('\u1e73',
+ &['\x75', '\u0324']), ('\u1e74', &['\x55', '\u0330']), ('\u1e75', &['\x75', '\u0330']),
+ ('\u1e76', &['\x55', '\u032d']), ('\u1e77', &['\x75', '\u032d']), ('\u1e78', &['\u0168',
+ '\u0301']), ('\u1e79', &['\u0169', '\u0301']), ('\u1e7a', &['\u016a', '\u0308']), ('\u1e7b',
+ &['\u016b', '\u0308']), ('\u1e7c', &['\x56', '\u0303']), ('\u1e7d', &['\x76', '\u0303']),
+ ('\u1e7e', &['\x56', '\u0323']), ('\u1e7f', &['\x76', '\u0323']), ('\u1e80', &['\x57',
+ '\u0300']), ('\u1e81', &['\x77', '\u0300']), ('\u1e82', &['\x57', '\u0301']), ('\u1e83',
+ &['\x77', '\u0301']), ('\u1e84', &['\x57', '\u0308']), ('\u1e85', &['\x77', '\u0308']),
+ ('\u1e86', &['\x57', '\u0307']), ('\u1e87', &['\x77', '\u0307']), ('\u1e88', &['\x57',
+ '\u0323']), ('\u1e89', &['\x77', '\u0323']), ('\u1e8a', &['\x58', '\u0307']), ('\u1e8b',
+ &['\x78', '\u0307']), ('\u1e8c', &['\x58', '\u0308']), ('\u1e8d', &['\x78', '\u0308']),
+ ('\u1e8e', &['\x59', '\u0307']), ('\u1e8f', &['\x79', '\u0307']), ('\u1e90', &['\x5a',
+ '\u0302']), ('\u1e91', &['\x7a', '\u0302']), ('\u1e92', &['\x5a', '\u0323']), ('\u1e93',
+ &['\x7a', '\u0323']), ('\u1e94', &['\x5a', '\u0331']), ('\u1e95', &['\x7a', '\u0331']),
+ ('\u1e96', &['\x68', '\u0331']), ('\u1e97', &['\x74', '\u0308']), ('\u1e98', &['\x77',
+ '\u030a']), ('\u1e99', &['\x79', '\u030a']), ('\u1e9b', &['\u017f', '\u0307']), ('\u1ea0',
+ &['\x41', '\u0323']), ('\u1ea1', &['\x61', '\u0323']), ('\u1ea2', &['\x41', '\u0309']),
+ ('\u1ea3', &['\x61', '\u0309']), ('\u1ea4', &['\xc2', '\u0301']), ('\u1ea5', &['\xe2',
+ '\u0301']), ('\u1ea6', &['\xc2', '\u0300']), ('\u1ea7', &['\xe2', '\u0300']), ('\u1ea8',
+ &['\xc2', '\u0309']), ('\u1ea9', &['\xe2', '\u0309']), ('\u1eaa', &['\xc2', '\u0303']),
+ ('\u1eab', &['\xe2', '\u0303']), ('\u1eac', &['\u1ea0', '\u0302']), ('\u1ead', &['\u1ea1',
+ '\u0302']), ('\u1eae', &['\u0102', '\u0301']), ('\u1eaf', &['\u0103', '\u0301']), ('\u1eb0',
+ &['\u0102', '\u0300']), ('\u1eb1', &['\u0103', '\u0300']), ('\u1eb2', &['\u0102',
+ '\u0309']), ('\u1eb3', &['\u0103', '\u0309']), ('\u1eb4', &['\u0102', '\u0303']), ('\u1eb5',
+ &['\u0103', '\u0303']), ('\u1eb6', &['\u1ea0', '\u0306']), ('\u1eb7', &['\u1ea1',
+ '\u0306']), ('\u1eb8', &['\x45', '\u0323']), ('\u1eb9', &['\x65', '\u0323']), ('\u1eba',
+ &['\x45', '\u0309']), ('\u1ebb', &['\x65', '\u0309']), ('\u1ebc', &['\x45', '\u0303']),
+ ('\u1ebd', &['\x65', '\u0303']), ('\u1ebe', &['\xca', '\u0301']), ('\u1ebf', &['\xea',
+ '\u0301']), ('\u1ec0', &['\xca', '\u0300']), ('\u1ec1', &['\xea', '\u0300']), ('\u1ec2',
+ &['\xca', '\u0309']), ('\u1ec3', &['\xea', '\u0309']), ('\u1ec4', &['\xca', '\u0303']),
+ ('\u1ec5', &['\xea', '\u0303']), ('\u1ec6', &['\u1eb8', '\u0302']), ('\u1ec7', &['\u1eb9',
+ '\u0302']), ('\u1ec8', &['\x49', '\u0309']), ('\u1ec9', &['\x69', '\u0309']), ('\u1eca',
+ &['\x49', '\u0323']), ('\u1ecb', &['\x69', '\u0323']), ('\u1ecc', &['\x4f', '\u0323']),
+ ('\u1ecd', &['\x6f', '\u0323']), ('\u1ece', &['\x4f', '\u0309']), ('\u1ecf', &['\x6f',
+ '\u0309']), ('\u1ed0', &['\xd4', '\u0301']), ('\u1ed1', &['\xf4', '\u0301']), ('\u1ed2',
+ &['\xd4', '\u0300']), ('\u1ed3', &['\xf4', '\u0300']), ('\u1ed4', &['\xd4', '\u0309']),
+ ('\u1ed5', &['\xf4', '\u0309']), ('\u1ed6', &['\xd4', '\u0303']), ('\u1ed7', &['\xf4',
+ '\u0303']), ('\u1ed8', &['\u1ecc', '\u0302']), ('\u1ed9', &['\u1ecd', '\u0302']), ('\u1eda',
+ &['\u01a0', '\u0301']), ('\u1edb', &['\u01a1', '\u0301']), ('\u1edc', &['\u01a0',
+ '\u0300']), ('\u1edd', &['\u01a1', '\u0300']), ('\u1ede', &['\u01a0', '\u0309']), ('\u1edf',
+ &['\u01a1', '\u0309']), ('\u1ee0', &['\u01a0', '\u0303']), ('\u1ee1', &['\u01a1',
+ '\u0303']), ('\u1ee2', &['\u01a0', '\u0323']), ('\u1ee3', &['\u01a1', '\u0323']), ('\u1ee4',
+ &['\x55', '\u0323']), ('\u1ee5', &['\x75', '\u0323']), ('\u1ee6', &['\x55', '\u0309']),
+ ('\u1ee7', &['\x75', '\u0309']), ('\u1ee8', &['\u01af', '\u0301']), ('\u1ee9', &['\u01b0',
+ '\u0301']), ('\u1eea', &['\u01af', '\u0300']), ('\u1eeb', &['\u01b0', '\u0300']), ('\u1eec',
+ &['\u01af', '\u0309']), ('\u1eed', &['\u01b0', '\u0309']), ('\u1eee', &['\u01af',
+ '\u0303']), ('\u1eef', &['\u01b0', '\u0303']), ('\u1ef0', &['\u01af', '\u0323']), ('\u1ef1',
+ &['\u01b0', '\u0323']), ('\u1ef2', &['\x59', '\u0300']), ('\u1ef3', &['\x79', '\u0300']),
+ ('\u1ef4', &['\x59', '\u0323']), ('\u1ef5', &['\x79', '\u0323']), ('\u1ef6', &['\x59',
+ '\u0309']), ('\u1ef7', &['\x79', '\u0309']), ('\u1ef8', &['\x59', '\u0303']), ('\u1ef9',
+ &['\x79', '\u0303']), ('\u1f00', &['\u03b1', '\u0313']), ('\u1f01', &['\u03b1', '\u0314']),
+ ('\u1f02', &['\u1f00', '\u0300']), ('\u1f03', &['\u1f01', '\u0300']), ('\u1f04', &['\u1f00',
+ '\u0301']), ('\u1f05', &['\u1f01', '\u0301']), ('\u1f06', &['\u1f00', '\u0342']), ('\u1f07',
+ &['\u1f01', '\u0342']), ('\u1f08', &['\u0391', '\u0313']), ('\u1f09', &['\u0391',
+ '\u0314']), ('\u1f0a', &['\u1f08', '\u0300']), ('\u1f0b', &['\u1f09', '\u0300']), ('\u1f0c',
+ &['\u1f08', '\u0301']), ('\u1f0d', &['\u1f09', '\u0301']), ('\u1f0e', &['\u1f08',
+ '\u0342']), ('\u1f0f', &['\u1f09', '\u0342']), ('\u1f10', &['\u03b5', '\u0313']), ('\u1f11',
+ &['\u03b5', '\u0314']), ('\u1f12', &['\u1f10', '\u0300']), ('\u1f13', &['\u1f11',
+ '\u0300']), ('\u1f14', &['\u1f10', '\u0301']), ('\u1f15', &['\u1f11', '\u0301']), ('\u1f18',
+ &['\u0395', '\u0313']), ('\u1f19', &['\u0395', '\u0314']), ('\u1f1a', &['\u1f18',
+ '\u0300']), ('\u1f1b', &['\u1f19', '\u0300']), ('\u1f1c', &['\u1f18', '\u0301']), ('\u1f1d',
+ &['\u1f19', '\u0301']), ('\u1f20', &['\u03b7', '\u0313']), ('\u1f21', &['\u03b7',
+ '\u0314']), ('\u1f22', &['\u1f20', '\u0300']), ('\u1f23', &['\u1f21', '\u0300']), ('\u1f24',
+ &['\u1f20', '\u0301']), ('\u1f25', &['\u1f21', '\u0301']), ('\u1f26', &['\u1f20',
+ '\u0342']), ('\u1f27', &['\u1f21', '\u0342']), ('\u1f28', &['\u0397', '\u0313']), ('\u1f29',
+ &['\u0397', '\u0314']), ('\u1f2a', &['\u1f28', '\u0300']), ('\u1f2b', &['\u1f29',
+ '\u0300']), ('\u1f2c', &['\u1f28', '\u0301']), ('\u1f2d', &['\u1f29', '\u0301']), ('\u1f2e',
+ &['\u1f28', '\u0342']), ('\u1f2f', &['\u1f29', '\u0342']), ('\u1f30', &['\u03b9',
+ '\u0313']), ('\u1f31', &['\u03b9', '\u0314']), ('\u1f32', &['\u1f30', '\u0300']), ('\u1f33',
+ &['\u1f31', '\u0300']), ('\u1f34', &['\u1f30', '\u0301']), ('\u1f35', &['\u1f31',
+ '\u0301']), ('\u1f36', &['\u1f30', '\u0342']), ('\u1f37', &['\u1f31', '\u0342']), ('\u1f38',
+ &['\u0399', '\u0313']), ('\u1f39', &['\u0399', '\u0314']), ('\u1f3a', &['\u1f38',
+ '\u0300']), ('\u1f3b', &['\u1f39', '\u0300']), ('\u1f3c', &['\u1f38', '\u0301']), ('\u1f3d',
+ &['\u1f39', '\u0301']), ('\u1f3e', &['\u1f38', '\u0342']), ('\u1f3f', &['\u1f39',
+ '\u0342']), ('\u1f40', &['\u03bf', '\u0313']), ('\u1f41', &['\u03bf', '\u0314']), ('\u1f42',
+ &['\u1f40', '\u0300']), ('\u1f43', &['\u1f41', '\u0300']), ('\u1f44', &['\u1f40',
+ '\u0301']), ('\u1f45', &['\u1f41', '\u0301']), ('\u1f48', &['\u039f', '\u0313']), ('\u1f49',
+ &['\u039f', '\u0314']), ('\u1f4a', &['\u1f48', '\u0300']), ('\u1f4b', &['\u1f49',
+ '\u0300']), ('\u1f4c', &['\u1f48', '\u0301']), ('\u1f4d', &['\u1f49', '\u0301']), ('\u1f50',
+ &['\u03c5', '\u0313']), ('\u1f51', &['\u03c5', '\u0314']), ('\u1f52', &['\u1f50',
+ '\u0300']), ('\u1f53', &['\u1f51', '\u0300']), ('\u1f54', &['\u1f50', '\u0301']), ('\u1f55',
+ &['\u1f51', '\u0301']), ('\u1f56', &['\u1f50', '\u0342']), ('\u1f57', &['\u1f51',
+ '\u0342']), ('\u1f59', &['\u03a5', '\u0314']), ('\u1f5b', &['\u1f59', '\u0300']), ('\u1f5d',
+ &['\u1f59', '\u0301']), ('\u1f5f', &['\u1f59', '\u0342']), ('\u1f60', &['\u03c9',
+ '\u0313']), ('\u1f61', &['\u03c9', '\u0314']), ('\u1f62', &['\u1f60', '\u0300']), ('\u1f63',
+ &['\u1f61', '\u0300']), ('\u1f64', &['\u1f60', '\u0301']), ('\u1f65', &['\u1f61',
+ '\u0301']), ('\u1f66', &['\u1f60', '\u0342']), ('\u1f67', &['\u1f61', '\u0342']), ('\u1f68',
+ &['\u03a9', '\u0313']), ('\u1f69', &['\u03a9', '\u0314']), ('\u1f6a', &['\u1f68',
+ '\u0300']), ('\u1f6b', &['\u1f69', '\u0300']), ('\u1f6c', &['\u1f68', '\u0301']), ('\u1f6d',
+ &['\u1f69', '\u0301']), ('\u1f6e', &['\u1f68', '\u0342']), ('\u1f6f', &['\u1f69',
+ '\u0342']), ('\u1f70', &['\u03b1', '\u0300']), ('\u1f71', &['\u03ac']), ('\u1f72',
+ &['\u03b5', '\u0300']), ('\u1f73', &['\u03ad']), ('\u1f74', &['\u03b7', '\u0300']),
+ ('\u1f75', &['\u03ae']), ('\u1f76', &['\u03b9', '\u0300']), ('\u1f77', &['\u03af']),
+ ('\u1f78', &['\u03bf', '\u0300']), ('\u1f79', &['\u03cc']), ('\u1f7a', &['\u03c5',
+ '\u0300']), ('\u1f7b', &['\u03cd']), ('\u1f7c', &['\u03c9', '\u0300']), ('\u1f7d',
+ &['\u03ce']), ('\u1f80', &['\u1f00', '\u0345']), ('\u1f81', &['\u1f01', '\u0345']),
+ ('\u1f82', &['\u1f02', '\u0345']), ('\u1f83', &['\u1f03', '\u0345']), ('\u1f84', &['\u1f04',
+ '\u0345']), ('\u1f85', &['\u1f05', '\u0345']), ('\u1f86', &['\u1f06', '\u0345']), ('\u1f87',
+ &['\u1f07', '\u0345']), ('\u1f88', &['\u1f08', '\u0345']), ('\u1f89', &['\u1f09',
+ '\u0345']), ('\u1f8a', &['\u1f0a', '\u0345']), ('\u1f8b', &['\u1f0b', '\u0345']), ('\u1f8c',
+ &['\u1f0c', '\u0345']), ('\u1f8d', &['\u1f0d', '\u0345']), ('\u1f8e', &['\u1f0e',
+ '\u0345']), ('\u1f8f', &['\u1f0f', '\u0345']), ('\u1f90', &['\u1f20', '\u0345']), ('\u1f91',
+ &['\u1f21', '\u0345']), ('\u1f92', &['\u1f22', '\u0345']), ('\u1f93', &['\u1f23',
+ '\u0345']), ('\u1f94', &['\u1f24', '\u0345']), ('\u1f95', &['\u1f25', '\u0345']), ('\u1f96',
+ &['\u1f26', '\u0345']), ('\u1f97', &['\u1f27', '\u0345']), ('\u1f98', &['\u1f28',
+ '\u0345']), ('\u1f99', &['\u1f29', '\u0345']), ('\u1f9a', &['\u1f2a', '\u0345']), ('\u1f9b',
+ &['\u1f2b', '\u0345']), ('\u1f9c', &['\u1f2c', '\u0345']), ('\u1f9d', &['\u1f2d',
+ '\u0345']), ('\u1f9e', &['\u1f2e', '\u0345']), ('\u1f9f', &['\u1f2f', '\u0345']), ('\u1fa0',
+ &['\u1f60', '\u0345']), ('\u1fa1', &['\u1f61', '\u0345']), ('\u1fa2', &['\u1f62',
+ '\u0345']), ('\u1fa3', &['\u1f63', '\u0345']), ('\u1fa4', &['\u1f64', '\u0345']), ('\u1fa5',
+ &['\u1f65', '\u0345']), ('\u1fa6', &['\u1f66', '\u0345']), ('\u1fa7', &['\u1f67',
+ '\u0345']), ('\u1fa8', &['\u1f68', '\u0345']), ('\u1fa9', &['\u1f69', '\u0345']), ('\u1faa',
+ &['\u1f6a', '\u0345']), ('\u1fab', &['\u1f6b', '\u0345']), ('\u1fac', &['\u1f6c',
+ '\u0345']), ('\u1fad', &['\u1f6d', '\u0345']), ('\u1fae', &['\u1f6e', '\u0345']), ('\u1faf',
+ &['\u1f6f', '\u0345']), ('\u1fb0', &['\u03b1', '\u0306']), ('\u1fb1', &['\u03b1',
+ '\u0304']), ('\u1fb2', &['\u1f70', '\u0345']), ('\u1fb3', &['\u03b1', '\u0345']), ('\u1fb4',
+ &['\u03ac', '\u0345']), ('\u1fb6', &['\u03b1', '\u0342']), ('\u1fb7', &['\u1fb6',
+ '\u0345']), ('\u1fb8', &['\u0391', '\u0306']), ('\u1fb9', &['\u0391', '\u0304']), ('\u1fba',
+ &['\u0391', '\u0300']), ('\u1fbb', &['\u0386']), ('\u1fbc', &['\u0391', '\u0345']),
+ ('\u1fbe', &['\u03b9']), ('\u1fc1', &['\xa8', '\u0342']), ('\u1fc2', &['\u1f74', '\u0345']),
+ ('\u1fc3', &['\u03b7', '\u0345']), ('\u1fc4', &['\u03ae', '\u0345']), ('\u1fc6', &['\u03b7',
+ '\u0342']), ('\u1fc7', &['\u1fc6', '\u0345']), ('\u1fc8', &['\u0395', '\u0300']), ('\u1fc9',
+ &['\u0388']), ('\u1fca', &['\u0397', '\u0300']), ('\u1fcb', &['\u0389']), ('\u1fcc',
+ &['\u0397', '\u0345']), ('\u1fcd', &['\u1fbf', '\u0300']), ('\u1fce', &['\u1fbf',
+ '\u0301']), ('\u1fcf', &['\u1fbf', '\u0342']), ('\u1fd0', &['\u03b9', '\u0306']), ('\u1fd1',
+ &['\u03b9', '\u0304']), ('\u1fd2', &['\u03ca', '\u0300']), ('\u1fd3', &['\u0390']),
+ ('\u1fd6', &['\u03b9', '\u0342']), ('\u1fd7', &['\u03ca', '\u0342']), ('\u1fd8', &['\u0399',
+ '\u0306']), ('\u1fd9', &['\u0399', '\u0304']), ('\u1fda', &['\u0399', '\u0300']), ('\u1fdb',
+ &['\u038a']), ('\u1fdd', &['\u1ffe', '\u0300']), ('\u1fde', &['\u1ffe', '\u0301']),
+ ('\u1fdf', &['\u1ffe', '\u0342']), ('\u1fe0', &['\u03c5', '\u0306']), ('\u1fe1', &['\u03c5',
+ '\u0304']), ('\u1fe2', &['\u03cb', '\u0300']), ('\u1fe3', &['\u03b0']), ('\u1fe4',
+ &['\u03c1', '\u0313']), ('\u1fe5', &['\u03c1', '\u0314']), ('\u1fe6', &['\u03c5',
+ '\u0342']), ('\u1fe7', &['\u03cb', '\u0342']), ('\u1fe8', &['\u03a5', '\u0306']), ('\u1fe9',
+ &['\u03a5', '\u0304']), ('\u1fea', &['\u03a5', '\u0300']), ('\u1feb', &['\u038e']),
+ ('\u1fec', &['\u03a1', '\u0314']), ('\u1fed', &['\xa8', '\u0300']), ('\u1fee', &['\u0385']),
+ ('\u1fef', &['\x60']), ('\u1ff2', &['\u1f7c', '\u0345']), ('\u1ff3', &['\u03c9', '\u0345']),
+ ('\u1ff4', &['\u03ce', '\u0345']), ('\u1ff6', &['\u03c9', '\u0342']), ('\u1ff7', &['\u1ff6',
+ '\u0345']), ('\u1ff8', &['\u039f', '\u0300']), ('\u1ff9', &['\u038c']), ('\u1ffa',
+ &['\u03a9', '\u0300']), ('\u1ffb', &['\u038f']), ('\u1ffc', &['\u03a9', '\u0345']),
+ ('\u1ffd', &['\xb4']), ('\u2000', &['\u2002']), ('\u2001', &['\u2003']), ('\u2126',
+ &['\u03a9']), ('\u212a', &['\x4b']), ('\u212b', &['\xc5']), ('\u219a', &['\u2190',
+ '\u0338']), ('\u219b', &['\u2192', '\u0338']), ('\u21ae', &['\u2194', '\u0338']), ('\u21cd',
+ &['\u21d0', '\u0338']), ('\u21ce', &['\u21d4', '\u0338']), ('\u21cf', &['\u21d2',
+ '\u0338']), ('\u2204', &['\u2203', '\u0338']), ('\u2209', &['\u2208', '\u0338']), ('\u220c',
+ &['\u220b', '\u0338']), ('\u2224', &['\u2223', '\u0338']), ('\u2226', &['\u2225',
+ '\u0338']), ('\u2241', &['\u223c', '\u0338']), ('\u2244', &['\u2243', '\u0338']), ('\u2247',
+ &['\u2245', '\u0338']), ('\u2249', &['\u2248', '\u0338']), ('\u2260', &['\x3d', '\u0338']),
+ ('\u2262', &['\u2261', '\u0338']), ('\u226d', &['\u224d', '\u0338']), ('\u226e', &['\x3c',
+ '\u0338']), ('\u226f', &['\x3e', '\u0338']), ('\u2270', &['\u2264', '\u0338']), ('\u2271',
+ &['\u2265', '\u0338']), ('\u2274', &['\u2272', '\u0338']), ('\u2275', &['\u2273',
+ '\u0338']), ('\u2278', &['\u2276', '\u0338']), ('\u2279', &['\u2277', '\u0338']), ('\u2280',
+ &['\u227a', '\u0338']), ('\u2281', &['\u227b', '\u0338']), ('\u2284', &['\u2282',
+ '\u0338']), ('\u2285', &['\u2283', '\u0338']), ('\u2288', &['\u2286', '\u0338']), ('\u2289',
+ &['\u2287', '\u0338']), ('\u22ac', &['\u22a2', '\u0338']), ('\u22ad', &['\u22a8',
+ '\u0338']), ('\u22ae', &['\u22a9', '\u0338']), ('\u22af', &['\u22ab', '\u0338']), ('\u22e0',
+ &['\u227c', '\u0338']), ('\u22e1', &['\u227d', '\u0338']), ('\u22e2', &['\u2291',
+ '\u0338']), ('\u22e3', &['\u2292', '\u0338']), ('\u22ea', &['\u22b2', '\u0338']), ('\u22eb',
+ &['\u22b3', '\u0338']), ('\u22ec', &['\u22b4', '\u0338']), ('\u22ed', &['\u22b5',
+ '\u0338']), ('\u2329', &['\u3008']), ('\u232a', &['\u3009']), ('\u2adc', &['\u2add',
+ '\u0338']), ('\u304c', &['\u304b', '\u3099']), ('\u304e', &['\u304d', '\u3099']), ('\u3050',
+ &['\u304f', '\u3099']), ('\u3052', &['\u3051', '\u3099']), ('\u3054', &['\u3053',
+ '\u3099']), ('\u3056', &['\u3055', '\u3099']), ('\u3058', &['\u3057', '\u3099']), ('\u305a',
+ &['\u3059', '\u3099']), ('\u305c', &['\u305b', '\u3099']), ('\u305e', &['\u305d',
+ '\u3099']), ('\u3060', &['\u305f', '\u3099']), ('\u3062', &['\u3061', '\u3099']), ('\u3065',
+ &['\u3064', '\u3099']), ('\u3067', &['\u3066', '\u3099']), ('\u3069', &['\u3068',
+ '\u3099']), ('\u3070', &['\u306f', '\u3099']), ('\u3071', &['\u306f', '\u309a']), ('\u3073',
+ &['\u3072', '\u3099']), ('\u3074', &['\u3072', '\u309a']), ('\u3076', &['\u3075',
+ '\u3099']), ('\u3077', &['\u3075', '\u309a']), ('\u3079', &['\u3078', '\u3099']), ('\u307a',
+ &['\u3078', '\u309a']), ('\u307c', &['\u307b', '\u3099']), ('\u307d', &['\u307b',
+ '\u309a']), ('\u3094', &['\u3046', '\u3099']), ('\u309e', &['\u309d', '\u3099']), ('\u30ac',
+ &['\u30ab', '\u3099']), ('\u30ae', &['\u30ad', '\u3099']), ('\u30b0', &['\u30af',
+ '\u3099']), ('\u30b2', &['\u30b1', '\u3099']), ('\u30b4', &['\u30b3', '\u3099']), ('\u30b6',
+ &['\u30b5', '\u3099']), ('\u30b8', &['\u30b7', '\u3099']), ('\u30ba', &['\u30b9',
+ '\u3099']), ('\u30bc', &['\u30bb', '\u3099']), ('\u30be', &['\u30bd', '\u3099']), ('\u30c0',
+ &['\u30bf', '\u3099']), ('\u30c2', &['\u30c1', '\u3099']), ('\u30c5', &['\u30c4',
+ '\u3099']), ('\u30c7', &['\u30c6', '\u3099']), ('\u30c9', &['\u30c8', '\u3099']), ('\u30d0',
+ &['\u30cf', '\u3099']), ('\u30d1', &['\u30cf', '\u309a']), ('\u30d3', &['\u30d2',
+ '\u3099']), ('\u30d4', &['\u30d2', '\u309a']), ('\u30d6', &['\u30d5', '\u3099']), ('\u30d7',
+ &['\u30d5', '\u309a']), ('\u30d9', &['\u30d8', '\u3099']), ('\u30da', &['\u30d8',
+ '\u309a']), ('\u30dc', &['\u30db', '\u3099']), ('\u30dd', &['\u30db', '\u309a']), ('\u30f4',
+ &['\u30a6', '\u3099']), ('\u30f7', &['\u30ef', '\u3099']), ('\u30f8', &['\u30f0',
+ '\u3099']), ('\u30f9', &['\u30f1', '\u3099']), ('\u30fa', &['\u30f2', '\u3099']), ('\u30fe',
+ &['\u30fd', '\u3099']), ('\uf900', &['\u8c48']), ('\uf901', &['\u66f4']), ('\uf902',
+ &['\u8eca']), ('\uf903', &['\u8cc8']), ('\uf904', &['\u6ed1']), ('\uf905', &['\u4e32']),
+ ('\uf906', &['\u53e5']), ('\uf907', &['\u9f9c']), ('\uf908', &['\u9f9c']), ('\uf909',
+ &['\u5951']), ('\uf90a', &['\u91d1']), ('\uf90b', &['\u5587']), ('\uf90c', &['\u5948']),
+ ('\uf90d', &['\u61f6']), ('\uf90e', &['\u7669']), ('\uf90f', &['\u7f85']), ('\uf910',
+ &['\u863f']), ('\uf911', &['\u87ba']), ('\uf912', &['\u88f8']), ('\uf913', &['\u908f']),
+ ('\uf914', &['\u6a02']), ('\uf915', &['\u6d1b']), ('\uf916', &['\u70d9']), ('\uf917',
+ &['\u73de']), ('\uf918', &['\u843d']), ('\uf919', &['\u916a']), ('\uf91a', &['\u99f1']),
+ ('\uf91b', &['\u4e82']), ('\uf91c', &['\u5375']), ('\uf91d', &['\u6b04']), ('\uf91e',
+ &['\u721b']), ('\uf91f', &['\u862d']), ('\uf920', &['\u9e1e']), ('\uf921', &['\u5d50']),
+ ('\uf922', &['\u6feb']), ('\uf923', &['\u85cd']), ('\uf924', &['\u8964']), ('\uf925',
+ &['\u62c9']), ('\uf926', &['\u81d8']), ('\uf927', &['\u881f']), ('\uf928', &['\u5eca']),
+ ('\uf929', &['\u6717']), ('\uf92a', &['\u6d6a']), ('\uf92b', &['\u72fc']), ('\uf92c',
+ &['\u90ce']), ('\uf92d', &['\u4f86']), ('\uf92e', &['\u51b7']), ('\uf92f', &['\u52de']),
+ ('\uf930', &['\u64c4']), ('\uf931', &['\u6ad3']), ('\uf932', &['\u7210']), ('\uf933',
+ &['\u76e7']), ('\uf934', &['\u8001']), ('\uf935', &['\u8606']), ('\uf936', &['\u865c']),
+ ('\uf937', &['\u8def']), ('\uf938', &['\u9732']), ('\uf939', &['\u9b6f']), ('\uf93a',
+ &['\u9dfa']), ('\uf93b', &['\u788c']), ('\uf93c', &['\u797f']), ('\uf93d', &['\u7da0']),
+ ('\uf93e', &['\u83c9']), ('\uf93f', &['\u9304']), ('\uf940', &['\u9e7f']), ('\uf941',
+ &['\u8ad6']), ('\uf942', &['\u58df']), ('\uf943', &['\u5f04']), ('\uf944', &['\u7c60']),
+ ('\uf945', &['\u807e']), ('\uf946', &['\u7262']), ('\uf947', &['\u78ca']), ('\uf948',
+ &['\u8cc2']), ('\uf949', &['\u96f7']), ('\uf94a', &['\u58d8']), ('\uf94b', &['\u5c62']),
+ ('\uf94c', &['\u6a13']), ('\uf94d', &['\u6dda']), ('\uf94e', &['\u6f0f']), ('\uf94f',
+ &['\u7d2f']), ('\uf950', &['\u7e37']), ('\uf951', &['\u964b']), ('\uf952', &['\u52d2']),
+ ('\uf953', &['\u808b']), ('\uf954', &['\u51dc']), ('\uf955', &['\u51cc']), ('\uf956',
+ &['\u7a1c']), ('\uf957', &['\u7dbe']), ('\uf958', &['\u83f1']), ('\uf959', &['\u9675']),
+ ('\uf95a', &['\u8b80']), ('\uf95b', &['\u62cf']), ('\uf95c', &['\u6a02']), ('\uf95d',
+ &['\u8afe']), ('\uf95e', &['\u4e39']), ('\uf95f', &['\u5be7']), ('\uf960', &['\u6012']),
+ ('\uf961', &['\u7387']), ('\uf962', &['\u7570']), ('\uf963', &['\u5317']), ('\uf964',
+ &['\u78fb']), ('\uf965', &['\u4fbf']), ('\uf966', &['\u5fa9']), ('\uf967', &['\u4e0d']),
+ ('\uf968', &['\u6ccc']), ('\uf969', &['\u6578']), ('\uf96a', &['\u7d22']), ('\uf96b',
+ &['\u53c3']), ('\uf96c', &['\u585e']), ('\uf96d', &['\u7701']), ('\uf96e', &['\u8449']),
+ ('\uf96f', &['\u8aaa']), ('\uf970', &['\u6bba']), ('\uf971', &['\u8fb0']), ('\uf972',
+ &['\u6c88']), ('\uf973', &['\u62fe']), ('\uf974', &['\u82e5']), ('\uf975', &['\u63a0']),
+ ('\uf976', &['\u7565']), ('\uf977', &['\u4eae']), ('\uf978', &['\u5169']), ('\uf979',
+ &['\u51c9']), ('\uf97a', &['\u6881']), ('\uf97b', &['\u7ce7']), ('\uf97c', &['\u826f']),
+ ('\uf97d', &['\u8ad2']), ('\uf97e', &['\u91cf']), ('\uf97f', &['\u52f5']), ('\uf980',
+ &['\u5442']), ('\uf981', &['\u5973']), ('\uf982', &['\u5eec']), ('\uf983', &['\u65c5']),
+ ('\uf984', &['\u6ffe']), ('\uf985', &['\u792a']), ('\uf986', &['\u95ad']), ('\uf987',
+ &['\u9a6a']), ('\uf988', &['\u9e97']), ('\uf989', &['\u9ece']), ('\uf98a', &['\u529b']),
+ ('\uf98b', &['\u66c6']), ('\uf98c', &['\u6b77']), ('\uf98d', &['\u8f62']), ('\uf98e',
+ &['\u5e74']), ('\uf98f', &['\u6190']), ('\uf990', &['\u6200']), ('\uf991', &['\u649a']),
+ ('\uf992', &['\u6f23']), ('\uf993', &['\u7149']), ('\uf994', &['\u7489']), ('\uf995',
+ &['\u79ca']), ('\uf996', &['\u7df4']), ('\uf997', &['\u806f']), ('\uf998', &['\u8f26']),
+ ('\uf999', &['\u84ee']), ('\uf99a', &['\u9023']), ('\uf99b', &['\u934a']), ('\uf99c',
+ &['\u5217']), ('\uf99d', &['\u52a3']), ('\uf99e', &['\u54bd']), ('\uf99f', &['\u70c8']),
+ ('\uf9a0', &['\u88c2']), ('\uf9a1', &['\u8aaa']), ('\uf9a2', &['\u5ec9']), ('\uf9a3',
+ &['\u5ff5']), ('\uf9a4', &['\u637b']), ('\uf9a5', &['\u6bae']), ('\uf9a6', &['\u7c3e']),
+ ('\uf9a7', &['\u7375']), ('\uf9a8', &['\u4ee4']), ('\uf9a9', &['\u56f9']), ('\uf9aa',
+ &['\u5be7']), ('\uf9ab', &['\u5dba']), ('\uf9ac', &['\u601c']), ('\uf9ad', &['\u73b2']),
+ ('\uf9ae', &['\u7469']), ('\uf9af', &['\u7f9a']), ('\uf9b0', &['\u8046']), ('\uf9b1',
+ &['\u9234']), ('\uf9b2', &['\u96f6']), ('\uf9b3', &['\u9748']), ('\uf9b4', &['\u9818']),
+ ('\uf9b5', &['\u4f8b']), ('\uf9b6', &['\u79ae']), ('\uf9b7', &['\u91b4']), ('\uf9b8',
+ &['\u96b8']), ('\uf9b9', &['\u60e1']), ('\uf9ba', &['\u4e86']), ('\uf9bb', &['\u50da']),
+ ('\uf9bc', &['\u5bee']), ('\uf9bd', &['\u5c3f']), ('\uf9be', &['\u6599']), ('\uf9bf',
+ &['\u6a02']), ('\uf9c0', &['\u71ce']), ('\uf9c1', &['\u7642']), ('\uf9c2', &['\u84fc']),
+ ('\uf9c3', &['\u907c']), ('\uf9c4', &['\u9f8d']), ('\uf9c5', &['\u6688']), ('\uf9c6',
+ &['\u962e']), ('\uf9c7', &['\u5289']), ('\uf9c8', &['\u677b']), ('\uf9c9', &['\u67f3']),
+ ('\uf9ca', &['\u6d41']), ('\uf9cb', &['\u6e9c']), ('\uf9cc', &['\u7409']), ('\uf9cd',
+ &['\u7559']), ('\uf9ce', &['\u786b']), ('\uf9cf', &['\u7d10']), ('\uf9d0', &['\u985e']),
+ ('\uf9d1', &['\u516d']), ('\uf9d2', &['\u622e']), ('\uf9d3', &['\u9678']), ('\uf9d4',
+ &['\u502b']), ('\uf9d5', &['\u5d19']), ('\uf9d6', &['\u6dea']), ('\uf9d7', &['\u8f2a']),
+ ('\uf9d8', &['\u5f8b']), ('\uf9d9', &['\u6144']), ('\uf9da', &['\u6817']), ('\uf9db',
+ &['\u7387']), ('\uf9dc', &['\u9686']), ('\uf9dd', &['\u5229']), ('\uf9de', &['\u540f']),
+ ('\uf9df', &['\u5c65']), ('\uf9e0', &['\u6613']), ('\uf9e1', &['\u674e']), ('\uf9e2',
+ &['\u68a8']), ('\uf9e3', &['\u6ce5']), ('\uf9e4', &['\u7406']), ('\uf9e5', &['\u75e2']),
+ ('\uf9e6', &['\u7f79']), ('\uf9e7', &['\u88cf']), ('\uf9e8', &['\u88e1']), ('\uf9e9',
+ &['\u91cc']), ('\uf9ea', &['\u96e2']), ('\uf9eb', &['\u533f']), ('\uf9ec', &['\u6eba']),
+ ('\uf9ed', &['\u541d']), ('\uf9ee', &['\u71d0']), ('\uf9ef', &['\u7498']), ('\uf9f0',
+ &['\u85fa']), ('\uf9f1', &['\u96a3']), ('\uf9f2', &['\u9c57']), ('\uf9f3', &['\u9e9f']),
+ ('\uf9f4', &['\u6797']), ('\uf9f5', &['\u6dcb']), ('\uf9f6', &['\u81e8']), ('\uf9f7',
+ &['\u7acb']), ('\uf9f8', &['\u7b20']), ('\uf9f9', &['\u7c92']), ('\uf9fa', &['\u72c0']),
+ ('\uf9fb', &['\u7099']), ('\uf9fc', &['\u8b58']), ('\uf9fd', &['\u4ec0']), ('\uf9fe',
+ &['\u8336']), ('\uf9ff', &['\u523a']), ('\ufa00', &['\u5207']), ('\ufa01', &['\u5ea6']),
+ ('\ufa02', &['\u62d3']), ('\ufa03', &['\u7cd6']), ('\ufa04', &['\u5b85']), ('\ufa05',
+ &['\u6d1e']), ('\ufa06', &['\u66b4']), ('\ufa07', &['\u8f3b']), ('\ufa08', &['\u884c']),
+ ('\ufa09', &['\u964d']), ('\ufa0a', &['\u898b']), ('\ufa0b', &['\u5ed3']), ('\ufa0c',
+ &['\u5140']), ('\ufa0d', &['\u55c0']), ('\ufa10', &['\u585a']), ('\ufa12', &['\u6674']),
+ ('\ufa15', &['\u51de']), ('\ufa16', &['\u732a']), ('\ufa17', &['\u76ca']), ('\ufa18',
+ &['\u793c']), ('\ufa19', &['\u795e']), ('\ufa1a', &['\u7965']), ('\ufa1b', &['\u798f']),
+ ('\ufa1c', &['\u9756']), ('\ufa1d', &['\u7cbe']), ('\ufa1e', &['\u7fbd']), ('\ufa20',
+ &['\u8612']), ('\ufa22', &['\u8af8']), ('\ufa25', &['\u9038']), ('\ufa26', &['\u90fd']),
+ ('\ufa2a', &['\u98ef']), ('\ufa2b', &['\u98fc']), ('\ufa2c', &['\u9928']), ('\ufa2d',
+ &['\u9db4']), ('\ufa2e', &['\u90de']), ('\ufa2f', &['\u96b7']), ('\ufa30', &['\u4fae']),
+ ('\ufa31', &['\u50e7']), ('\ufa32', &['\u514d']), ('\ufa33', &['\u52c9']), ('\ufa34',
+ &['\u52e4']), ('\ufa35', &['\u5351']), ('\ufa36', &['\u559d']), ('\ufa37', &['\u5606']),
+ ('\ufa38', &['\u5668']), ('\ufa39', &['\u5840']), ('\ufa3a', &['\u58a8']), ('\ufa3b',
+ &['\u5c64']), ('\ufa3c', &['\u5c6e']), ('\ufa3d', &['\u6094']), ('\ufa3e', &['\u6168']),
+ ('\ufa3f', &['\u618e']), ('\ufa40', &['\u61f2']), ('\ufa41', &['\u654f']), ('\ufa42',
+ &['\u65e2']), ('\ufa43', &['\u6691']), ('\ufa44', &['\u6885']), ('\ufa45', &['\u6d77']),
+ ('\ufa46', &['\u6e1a']), ('\ufa47', &['\u6f22']), ('\ufa48', &['\u716e']), ('\ufa49',
+ &['\u722b']), ('\ufa4a', &['\u7422']), ('\ufa4b', &['\u7891']), ('\ufa4c', &['\u793e']),
+ ('\ufa4d', &['\u7949']), ('\ufa4e', &['\u7948']), ('\ufa4f', &['\u7950']), ('\ufa50',
+ &['\u7956']), ('\ufa51', &['\u795d']), ('\ufa52', &['\u798d']), ('\ufa53', &['\u798e']),
+ ('\ufa54', &['\u7a40']), ('\ufa55', &['\u7a81']), ('\ufa56', &['\u7bc0']), ('\ufa57',
+ &['\u7df4']), ('\ufa58', &['\u7e09']), ('\ufa59', &['\u7e41']), ('\ufa5a', &['\u7f72']),
+ ('\ufa5b', &['\u8005']), ('\ufa5c', &['\u81ed']), ('\ufa5d', &['\u8279']), ('\ufa5e',
+ &['\u8279']), ('\ufa5f', &['\u8457']), ('\ufa60', &['\u8910']), ('\ufa61', &['\u8996']),
+ ('\ufa62', &['\u8b01']), ('\ufa63', &['\u8b39']), ('\ufa64', &['\u8cd3']), ('\ufa65',
+ &['\u8d08']), ('\ufa66', &['\u8fb6']), ('\ufa67', &['\u9038']), ('\ufa68', &['\u96e3']),
+ ('\ufa69', &['\u97ff']), ('\ufa6a', &['\u983b']), ('\ufa6b', &['\u6075']), ('\ufa6c',
+ &['\U000242ee']), ('\ufa6d', &['\u8218']), ('\ufa70', &['\u4e26']), ('\ufa71', &['\u51b5']),
+ ('\ufa72', &['\u5168']), ('\ufa73', &['\u4f80']), ('\ufa74', &['\u5145']), ('\ufa75',
+ &['\u5180']), ('\ufa76', &['\u52c7']), ('\ufa77', &['\u52fa']), ('\ufa78', &['\u559d']),
+ ('\ufa79', &['\u5555']), ('\ufa7a', &['\u5599']), ('\ufa7b', &['\u55e2']), ('\ufa7c',
+ &['\u585a']), ('\ufa7d', &['\u58b3']), ('\ufa7e', &['\u5944']), ('\ufa7f', &['\u5954']),
+ ('\ufa80', &['\u5a62']), ('\ufa81', &['\u5b28']), ('\ufa82', &['\u5ed2']), ('\ufa83',
+ &['\u5ed9']), ('\ufa84', &['\u5f69']), ('\ufa85', &['\u5fad']), ('\ufa86', &['\u60d8']),
+ ('\ufa87', &['\u614e']), ('\ufa88', &['\u6108']), ('\ufa89', &['\u618e']), ('\ufa8a',
+ &['\u6160']), ('\ufa8b', &['\u61f2']), ('\ufa8c', &['\u6234']), ('\ufa8d', &['\u63c4']),
+ ('\ufa8e', &['\u641c']), ('\ufa8f', &['\u6452']), ('\ufa90', &['\u6556']), ('\ufa91',
+ &['\u6674']), ('\ufa92', &['\u6717']), ('\ufa93', &['\u671b']), ('\ufa94', &['\u6756']),
+ ('\ufa95', &['\u6b79']), ('\ufa96', &['\u6bba']), ('\ufa97', &['\u6d41']), ('\ufa98',
+ &['\u6edb']), ('\ufa99', &['\u6ecb']), ('\ufa9a', &['\u6f22']), ('\ufa9b', &['\u701e']),
+ ('\ufa9c', &['\u716e']), ('\ufa9d', &['\u77a7']), ('\ufa9e', &['\u7235']), ('\ufa9f',
+ &['\u72af']), ('\ufaa0', &['\u732a']), ('\ufaa1', &['\u7471']), ('\ufaa2', &['\u7506']),
+ ('\ufaa3', &['\u753b']), ('\ufaa4', &['\u761d']), ('\ufaa5', &['\u761f']), ('\ufaa6',
+ &['\u76ca']), ('\ufaa7', &['\u76db']), ('\ufaa8', &['\u76f4']), ('\ufaa9', &['\u774a']),
+ ('\ufaaa', &['\u7740']), ('\ufaab', &['\u78cc']), ('\ufaac', &['\u7ab1']), ('\ufaad',
+ &['\u7bc0']), ('\ufaae', &['\u7c7b']), ('\ufaaf', &['\u7d5b']), ('\ufab0', &['\u7df4']),
+ ('\ufab1', &['\u7f3e']), ('\ufab2', &['\u8005']), ('\ufab3', &['\u8352']), ('\ufab4',
+ &['\u83ef']), ('\ufab5', &['\u8779']), ('\ufab6', &['\u8941']), ('\ufab7', &['\u8986']),
+ ('\ufab8', &['\u8996']), ('\ufab9', &['\u8abf']), ('\ufaba', &['\u8af8']), ('\ufabb',
+ &['\u8acb']), ('\ufabc', &['\u8b01']), ('\ufabd', &['\u8afe']), ('\ufabe', &['\u8aed']),
+ ('\ufabf', &['\u8b39']), ('\ufac0', &['\u8b8a']), ('\ufac1', &['\u8d08']), ('\ufac2',
+ &['\u8f38']), ('\ufac3', &['\u9072']), ('\ufac4', &['\u9199']), ('\ufac5', &['\u9276']),
+ ('\ufac6', &['\u967c']), ('\ufac7', &['\u96e3']), ('\ufac8', &['\u9756']), ('\ufac9',
+ &['\u97db']), ('\ufaca', &['\u97ff']), ('\ufacb', &['\u980b']), ('\ufacc', &['\u983b']),
+ ('\ufacd', &['\u9b12']), ('\uface', &['\u9f9c']), ('\ufacf', &['\U0002284a']), ('\ufad0',
+ &['\U00022844']), ('\ufad1', &['\U000233d5']), ('\ufad2', &['\u3b9d']), ('\ufad3',
+ &['\u4018']), ('\ufad4', &['\u4039']), ('\ufad5', &['\U00025249']), ('\ufad6',
+ &['\U00025cd0']), ('\ufad7', &['\U00027ed3']), ('\ufad8', &['\u9f43']), ('\ufad9',
+ &['\u9f8e']), ('\ufb1d', &['\u05d9', '\u05b4']), ('\ufb1f', &['\u05f2', '\u05b7']),
+ ('\ufb2a', &['\u05e9', '\u05c1']), ('\ufb2b', &['\u05e9', '\u05c2']), ('\ufb2c', &['\ufb49',
+ '\u05c1']), ('\ufb2d', &['\ufb49', '\u05c2']), ('\ufb2e', &['\u05d0', '\u05b7']), ('\ufb2f',
+ &['\u05d0', '\u05b8']), ('\ufb30', &['\u05d0', '\u05bc']), ('\ufb31', &['\u05d1',
+ '\u05bc']), ('\ufb32', &['\u05d2', '\u05bc']), ('\ufb33', &['\u05d3', '\u05bc']), ('\ufb34',
+ &['\u05d4', '\u05bc']), ('\ufb35', &['\u05d5', '\u05bc']), ('\ufb36', &['\u05d6',
+ '\u05bc']), ('\ufb38', &['\u05d8', '\u05bc']), ('\ufb39', &['\u05d9', '\u05bc']), ('\ufb3a',
+ &['\u05da', '\u05bc']), ('\ufb3b', &['\u05db', '\u05bc']), ('\ufb3c', &['\u05dc',
+ '\u05bc']), ('\ufb3e', &['\u05de', '\u05bc']), ('\ufb40', &['\u05e0', '\u05bc']), ('\ufb41',
+ &['\u05e1', '\u05bc']), ('\ufb43', &['\u05e3', '\u05bc']), ('\ufb44', &['\u05e4',
+ '\u05bc']), ('\ufb46', &['\u05e6', '\u05bc']), ('\ufb47', &['\u05e7', '\u05bc']), ('\ufb48',
+ &['\u05e8', '\u05bc']), ('\ufb49', &['\u05e9', '\u05bc']), ('\ufb4a', &['\u05ea',
+ '\u05bc']), ('\ufb4b', &['\u05d5', '\u05b9']), ('\ufb4c', &['\u05d1', '\u05bf']), ('\ufb4d',
+ &['\u05db', '\u05bf']), ('\ufb4e', &['\u05e4', '\u05bf']), ('\U0001109a', &['\U00011099',
+ '\U000110ba']), ('\U0001109c', &['\U0001109b', '\U000110ba']), ('\U000110ab',
+ &['\U000110a5', '\U000110ba']), ('\U0001112e', &['\U00011131', '\U00011127']),
+ ('\U0001112f', &['\U00011132', '\U00011127']), ('\U0001d15e', &['\U0001d157',
+ '\U0001d165']), ('\U0001d15f', &['\U0001d158', '\U0001d165']), ('\U0001d160',
+ &['\U0001d15f', '\U0001d16e']), ('\U0001d161', &['\U0001d15f', '\U0001d16f']),
+ ('\U0001d162', &['\U0001d15f', '\U0001d170']), ('\U0001d163', &['\U0001d15f',
+ '\U0001d171']), ('\U0001d164', &['\U0001d15f', '\U0001d172']), ('\U0001d1bb',
+ &['\U0001d1b9', '\U0001d165']), ('\U0001d1bc', &['\U0001d1ba', '\U0001d165']),
+ ('\U0001d1bd', &['\U0001d1bb', '\U0001d16e']), ('\U0001d1be', &['\U0001d1bc',
+ '\U0001d16e']), ('\U0001d1bf', &['\U0001d1bb', '\U0001d16f']), ('\U0001d1c0',
+ &['\U0001d1bc', '\U0001d16f']), ('\U0002f800', &['\u4e3d']), ('\U0002f801', &['\u4e38']),
+ ('\U0002f802', &['\u4e41']), ('\U0002f803', &['\U00020122']), ('\U0002f804', &['\u4f60']),
+ ('\U0002f805', &['\u4fae']), ('\U0002f806', &['\u4fbb']), ('\U0002f807', &['\u5002']),
+ ('\U0002f808', &['\u507a']), ('\U0002f809', &['\u5099']), ('\U0002f80a', &['\u50e7']),
+ ('\U0002f80b', &['\u50cf']), ('\U0002f80c', &['\u349e']), ('\U0002f80d', &['\U0002063a']),
+ ('\U0002f80e', &['\u514d']), ('\U0002f80f', &['\u5154']), ('\U0002f810', &['\u5164']),
+ ('\U0002f811', &['\u5177']), ('\U0002f812', &['\U0002051c']), ('\U0002f813', &['\u34b9']),
+ ('\U0002f814', &['\u5167']), ('\U0002f815', &['\u518d']), ('\U0002f816', &['\U0002054b']),
+ ('\U0002f817', &['\u5197']), ('\U0002f818', &['\u51a4']), ('\U0002f819', &['\u4ecc']),
+ ('\U0002f81a', &['\u51ac']), ('\U0002f81b', &['\u51b5']), ('\U0002f81c', &['\U000291df']),
+ ('\U0002f81d', &['\u51f5']), ('\U0002f81e', &['\u5203']), ('\U0002f81f', &['\u34df']),
+ ('\U0002f820', &['\u523b']), ('\U0002f821', &['\u5246']), ('\U0002f822', &['\u5272']),
+ ('\U0002f823', &['\u5277']), ('\U0002f824', &['\u3515']), ('\U0002f825', &['\u52c7']),
+ ('\U0002f826', &['\u52c9']), ('\U0002f827', &['\u52e4']), ('\U0002f828', &['\u52fa']),
+ ('\U0002f829', &['\u5305']), ('\U0002f82a', &['\u5306']), ('\U0002f82b', &['\u5317']),
+ ('\U0002f82c', &['\u5349']), ('\U0002f82d', &['\u5351']), ('\U0002f82e', &['\u535a']),
+ ('\U0002f82f', &['\u5373']), ('\U0002f830', &['\u537d']), ('\U0002f831', &['\u537f']),
+ ('\U0002f832', &['\u537f']), ('\U0002f833', &['\u537f']), ('\U0002f834', &['\U00020a2c']),
+ ('\U0002f835', &['\u7070']), ('\U0002f836', &['\u53ca']), ('\U0002f837', &['\u53df']),
+ ('\U0002f838', &['\U00020b63']), ('\U0002f839', &['\u53eb']), ('\U0002f83a', &['\u53f1']),
+ ('\U0002f83b', &['\u5406']), ('\U0002f83c', &['\u549e']), ('\U0002f83d', &['\u5438']),
+ ('\U0002f83e', &['\u5448']), ('\U0002f83f', &['\u5468']), ('\U0002f840', &['\u54a2']),
+ ('\U0002f841', &['\u54f6']), ('\U0002f842', &['\u5510']), ('\U0002f843', &['\u5553']),
+ ('\U0002f844', &['\u5563']), ('\U0002f845', &['\u5584']), ('\U0002f846', &['\u5584']),
+ ('\U0002f847', &['\u5599']), ('\U0002f848', &['\u55ab']), ('\U0002f849', &['\u55b3']),
+ ('\U0002f84a', &['\u55c2']), ('\U0002f84b', &['\u5716']), ('\U0002f84c', &['\u5606']),
+ ('\U0002f84d', &['\u5717']), ('\U0002f84e', &['\u5651']), ('\U0002f84f', &['\u5674']),
+ ('\U0002f850', &['\u5207']), ('\U0002f851', &['\u58ee']), ('\U0002f852', &['\u57ce']),
+ ('\U0002f853', &['\u57f4']), ('\U0002f854', &['\u580d']), ('\U0002f855', &['\u578b']),
+ ('\U0002f856', &['\u5832']), ('\U0002f857', &['\u5831']), ('\U0002f858', &['\u58ac']),
+ ('\U0002f859', &['\U000214e4']), ('\U0002f85a', &['\u58f2']), ('\U0002f85b', &['\u58f7']),
+ ('\U0002f85c', &['\u5906']), ('\U0002f85d', &['\u591a']), ('\U0002f85e', &['\u5922']),
+ ('\U0002f85f', &['\u5962']), ('\U0002f860', &['\U000216a8']), ('\U0002f861',
+ &['\U000216ea']), ('\U0002f862', &['\u59ec']), ('\U0002f863', &['\u5a1b']), ('\U0002f864',
+ &['\u5a27']), ('\U0002f865', &['\u59d8']), ('\U0002f866', &['\u5a66']), ('\U0002f867',
+ &['\u36ee']), ('\U0002f868', &['\u36fc']), ('\U0002f869', &['\u5b08']), ('\U0002f86a',
+ &['\u5b3e']), ('\U0002f86b', &['\u5b3e']), ('\U0002f86c', &['\U000219c8']), ('\U0002f86d',
+ &['\u5bc3']), ('\U0002f86e', &['\u5bd8']), ('\U0002f86f', &['\u5be7']), ('\U0002f870',
+ &['\u5bf3']), ('\U0002f871', &['\U00021b18']), ('\U0002f872', &['\u5bff']), ('\U0002f873',
+ &['\u5c06']), ('\U0002f874', &['\u5f53']), ('\U0002f875', &['\u5c22']), ('\U0002f876',
+ &['\u3781']), ('\U0002f877', &['\u5c60']), ('\U0002f878', &['\u5c6e']), ('\U0002f879',
+ &['\u5cc0']), ('\U0002f87a', &['\u5c8d']), ('\U0002f87b', &['\U00021de4']), ('\U0002f87c',
+ &['\u5d43']), ('\U0002f87d', &['\U00021de6']), ('\U0002f87e', &['\u5d6e']), ('\U0002f87f',
+ &['\u5d6b']), ('\U0002f880', &['\u5d7c']), ('\U0002f881', &['\u5de1']), ('\U0002f882',
+ &['\u5de2']), ('\U0002f883', &['\u382f']), ('\U0002f884', &['\u5dfd']), ('\U0002f885',
+ &['\u5e28']), ('\U0002f886', &['\u5e3d']), ('\U0002f887', &['\u5e69']), ('\U0002f888',
+ &['\u3862']), ('\U0002f889', &['\U00022183']), ('\U0002f88a', &['\u387c']), ('\U0002f88b',
+ &['\u5eb0']), ('\U0002f88c', &['\u5eb3']), ('\U0002f88d', &['\u5eb6']), ('\U0002f88e',
+ &['\u5eca']), ('\U0002f88f', &['\U0002a392']), ('\U0002f890', &['\u5efe']), ('\U0002f891',
+ &['\U00022331']), ('\U0002f892', &['\U00022331']), ('\U0002f893', &['\u8201']),
+ ('\U0002f894', &['\u5f22']), ('\U0002f895', &['\u5f22']), ('\U0002f896', &['\u38c7']),
+ ('\U0002f897', &['\U000232b8']), ('\U0002f898', &['\U000261da']), ('\U0002f899',
+ &['\u5f62']), ('\U0002f89a', &['\u5f6b']), ('\U0002f89b', &['\u38e3']), ('\U0002f89c',
+ &['\u5f9a']), ('\U0002f89d', &['\u5fcd']), ('\U0002f89e', &['\u5fd7']), ('\U0002f89f',
+ &['\u5ff9']), ('\U0002f8a0', &['\u6081']), ('\U0002f8a1', &['\u393a']), ('\U0002f8a2',
+ &['\u391c']), ('\U0002f8a3', &['\u6094']), ('\U0002f8a4', &['\U000226d4']), ('\U0002f8a5',
+ &['\u60c7']), ('\U0002f8a6', &['\u6148']), ('\U0002f8a7', &['\u614c']), ('\U0002f8a8',
+ &['\u614e']), ('\U0002f8a9', &['\u614c']), ('\U0002f8aa', &['\u617a']), ('\U0002f8ab',
+ &['\u618e']), ('\U0002f8ac', &['\u61b2']), ('\U0002f8ad', &['\u61a4']), ('\U0002f8ae',
+ &['\u61af']), ('\U0002f8af', &['\u61de']), ('\U0002f8b0', &['\u61f2']), ('\U0002f8b1',
+ &['\u61f6']), ('\U0002f8b2', &['\u6210']), ('\U0002f8b3', &['\u621b']), ('\U0002f8b4',
+ &['\u625d']), ('\U0002f8b5', &['\u62b1']), ('\U0002f8b6', &['\u62d4']), ('\U0002f8b7',
+ &['\u6350']), ('\U0002f8b8', &['\U00022b0c']), ('\U0002f8b9', &['\u633d']), ('\U0002f8ba',
+ &['\u62fc']), ('\U0002f8bb', &['\u6368']), ('\U0002f8bc', &['\u6383']), ('\U0002f8bd',
+ &['\u63e4']), ('\U0002f8be', &['\U00022bf1']), ('\U0002f8bf', &['\u6422']), ('\U0002f8c0',
+ &['\u63c5']), ('\U0002f8c1', &['\u63a9']), ('\U0002f8c2', &['\u3a2e']), ('\U0002f8c3',
+ &['\u6469']), ('\U0002f8c4', &['\u647e']), ('\U0002f8c5', &['\u649d']), ('\U0002f8c6',
+ &['\u6477']), ('\U0002f8c7', &['\u3a6c']), ('\U0002f8c8', &['\u654f']), ('\U0002f8c9',
+ &['\u656c']), ('\U0002f8ca', &['\U0002300a']), ('\U0002f8cb', &['\u65e3']), ('\U0002f8cc',
+ &['\u66f8']), ('\U0002f8cd', &['\u6649']), ('\U0002f8ce', &['\u3b19']), ('\U0002f8cf',
+ &['\u6691']), ('\U0002f8d0', &['\u3b08']), ('\U0002f8d1', &['\u3ae4']), ('\U0002f8d2',
+ &['\u5192']), ('\U0002f8d3', &['\u5195']), ('\U0002f8d4', &['\u6700']), ('\U0002f8d5',
+ &['\u669c']), ('\U0002f8d6', &['\u80ad']), ('\U0002f8d7', &['\u43d9']), ('\U0002f8d8',
+ &['\u6717']), ('\U0002f8d9', &['\u671b']), ('\U0002f8da', &['\u6721']), ('\U0002f8db',
+ &['\u675e']), ('\U0002f8dc', &['\u6753']), ('\U0002f8dd', &['\U000233c3']), ('\U0002f8de',
+ &['\u3b49']), ('\U0002f8df', &['\u67fa']), ('\U0002f8e0', &['\u6785']), ('\U0002f8e1',
+ &['\u6852']), ('\U0002f8e2', &['\u6885']), ('\U0002f8e3', &['\U0002346d']), ('\U0002f8e4',
+ &['\u688e']), ('\U0002f8e5', &['\u681f']), ('\U0002f8e6', &['\u6914']), ('\U0002f8e7',
+ &['\u3b9d']), ('\U0002f8e8', &['\u6942']), ('\U0002f8e9', &['\u69a3']), ('\U0002f8ea',
+ &['\u69ea']), ('\U0002f8eb', &['\u6aa8']), ('\U0002f8ec', &['\U000236a3']), ('\U0002f8ed',
+ &['\u6adb']), ('\U0002f8ee', &['\u3c18']), ('\U0002f8ef', &['\u6b21']), ('\U0002f8f0',
+ &['\U000238a7']), ('\U0002f8f1', &['\u6b54']), ('\U0002f8f2', &['\u3c4e']), ('\U0002f8f3',
+ &['\u6b72']), ('\U0002f8f4', &['\u6b9f']), ('\U0002f8f5', &['\u6bba']), ('\U0002f8f6',
+ &['\u6bbb']), ('\U0002f8f7', &['\U00023a8d']), ('\U0002f8f8', &['\U00021d0b']),
+ ('\U0002f8f9', &['\U00023afa']), ('\U0002f8fa', &['\u6c4e']), ('\U0002f8fb',
+ &['\U00023cbc']), ('\U0002f8fc', &['\u6cbf']), ('\U0002f8fd', &['\u6ccd']), ('\U0002f8fe',
+ &['\u6c67']), ('\U0002f8ff', &['\u6d16']), ('\U0002f900', &['\u6d3e']), ('\U0002f901',
+ &['\u6d77']), ('\U0002f902', &['\u6d41']), ('\U0002f903', &['\u6d69']), ('\U0002f904',
+ &['\u6d78']), ('\U0002f905', &['\u6d85']), ('\U0002f906', &['\U00023d1e']), ('\U0002f907',
+ &['\u6d34']), ('\U0002f908', &['\u6e2f']), ('\U0002f909', &['\u6e6e']), ('\U0002f90a',
+ &['\u3d33']), ('\U0002f90b', &['\u6ecb']), ('\U0002f90c', &['\u6ec7']), ('\U0002f90d',
+ &['\U00023ed1']), ('\U0002f90e', &['\u6df9']), ('\U0002f90f', &['\u6f6e']), ('\U0002f910',
+ &['\U00023f5e']), ('\U0002f911', &['\U00023f8e']), ('\U0002f912', &['\u6fc6']),
+ ('\U0002f913', &['\u7039']), ('\U0002f914', &['\u701e']), ('\U0002f915', &['\u701b']),
+ ('\U0002f916', &['\u3d96']), ('\U0002f917', &['\u704a']), ('\U0002f918', &['\u707d']),
+ ('\U0002f919', &['\u7077']), ('\U0002f91a', &['\u70ad']), ('\U0002f91b', &['\U00020525']),
+ ('\U0002f91c', &['\u7145']), ('\U0002f91d', &['\U00024263']), ('\U0002f91e', &['\u719c']),
+ ('\U0002f91f', &['\U000243ab']), ('\U0002f920', &['\u7228']), ('\U0002f921', &['\u7235']),
+ ('\U0002f922', &['\u7250']), ('\U0002f923', &['\U00024608']), ('\U0002f924', &['\u7280']),
+ ('\U0002f925', &['\u7295']), ('\U0002f926', &['\U00024735']), ('\U0002f927',
+ &['\U00024814']), ('\U0002f928', &['\u737a']), ('\U0002f929', &['\u738b']), ('\U0002f92a',
+ &['\u3eac']), ('\U0002f92b', &['\u73a5']), ('\U0002f92c', &['\u3eb8']), ('\U0002f92d',
+ &['\u3eb8']), ('\U0002f92e', &['\u7447']), ('\U0002f92f', &['\u745c']), ('\U0002f930',
+ &['\u7471']), ('\U0002f931', &['\u7485']), ('\U0002f932', &['\u74ca']), ('\U0002f933',
+ &['\u3f1b']), ('\U0002f934', &['\u7524']), ('\U0002f935', &['\U00024c36']), ('\U0002f936',
+ &['\u753e']), ('\U0002f937', &['\U00024c92']), ('\U0002f938', &['\u7570']), ('\U0002f939',
+ &['\U0002219f']), ('\U0002f93a', &['\u7610']), ('\U0002f93b', &['\U00024fa1']),
+ ('\U0002f93c', &['\U00024fb8']), ('\U0002f93d', &['\U00025044']), ('\U0002f93e',
+ &['\u3ffc']), ('\U0002f93f', &['\u4008']), ('\U0002f940', &['\u76f4']), ('\U0002f941',
+ &['\U000250f3']), ('\U0002f942', &['\U000250f2']), ('\U0002f943', &['\U00025119']),
+ ('\U0002f944', &['\U00025133']), ('\U0002f945', &['\u771e']), ('\U0002f946', &['\u771f']),
+ ('\U0002f947', &['\u771f']), ('\U0002f948', &['\u774a']), ('\U0002f949', &['\u4039']),
+ ('\U0002f94a', &['\u778b']), ('\U0002f94b', &['\u4046']), ('\U0002f94c', &['\u4096']),
+ ('\U0002f94d', &['\U0002541d']), ('\U0002f94e', &['\u784e']), ('\U0002f94f', &['\u788c']),
+ ('\U0002f950', &['\u78cc']), ('\U0002f951', &['\u40e3']), ('\U0002f952', &['\U00025626']),
+ ('\U0002f953', &['\u7956']), ('\U0002f954', &['\U0002569a']), ('\U0002f955',
+ &['\U000256c5']), ('\U0002f956', &['\u798f']), ('\U0002f957', &['\u79eb']), ('\U0002f958',
+ &['\u412f']), ('\U0002f959', &['\u7a40']), ('\U0002f95a', &['\u7a4a']), ('\U0002f95b',
+ &['\u7a4f']), ('\U0002f95c', &['\U0002597c']), ('\U0002f95d', &['\U00025aa7']),
+ ('\U0002f95e', &['\U00025aa7']), ('\U0002f95f', &['\u7aee']), ('\U0002f960', &['\u4202']),
+ ('\U0002f961', &['\U00025bab']), ('\U0002f962', &['\u7bc6']), ('\U0002f963', &['\u7bc9']),
+ ('\U0002f964', &['\u4227']), ('\U0002f965', &['\U00025c80']), ('\U0002f966', &['\u7cd2']),
+ ('\U0002f967', &['\u42a0']), ('\U0002f968', &['\u7ce8']), ('\U0002f969', &['\u7ce3']),
+ ('\U0002f96a', &['\u7d00']), ('\U0002f96b', &['\U00025f86']), ('\U0002f96c', &['\u7d63']),
+ ('\U0002f96d', &['\u4301']), ('\U0002f96e', &['\u7dc7']), ('\U0002f96f', &['\u7e02']),
+ ('\U0002f970', &['\u7e45']), ('\U0002f971', &['\u4334']), ('\U0002f972', &['\U00026228']),
+ ('\U0002f973', &['\U00026247']), ('\U0002f974', &['\u4359']), ('\U0002f975',
+ &['\U000262d9']), ('\U0002f976', &['\u7f7a']), ('\U0002f977', &['\U0002633e']),
+ ('\U0002f978', &['\u7f95']), ('\U0002f979', &['\u7ffa']), ('\U0002f97a', &['\u8005']),
+ ('\U0002f97b', &['\U000264da']), ('\U0002f97c', &['\U00026523']), ('\U0002f97d',
+ &['\u8060']), ('\U0002f97e', &['\U000265a8']), ('\U0002f97f', &['\u8070']), ('\U0002f980',
+ &['\U0002335f']), ('\U0002f981', &['\u43d5']), ('\U0002f982', &['\u80b2']), ('\U0002f983',
+ &['\u8103']), ('\U0002f984', &['\u440b']), ('\U0002f985', &['\u813e']), ('\U0002f986',
+ &['\u5ab5']), ('\U0002f987', &['\U000267a7']), ('\U0002f988', &['\U000267b5']),
+ ('\U0002f989', &['\U00023393']), ('\U0002f98a', &['\U0002339c']), ('\U0002f98b',
+ &['\u8201']), ('\U0002f98c', &['\u8204']), ('\U0002f98d', &['\u8f9e']), ('\U0002f98e',
+ &['\u446b']), ('\U0002f98f', &['\u8291']), ('\U0002f990', &['\u828b']), ('\U0002f991',
+ &['\u829d']), ('\U0002f992', &['\u52b3']), ('\U0002f993', &['\u82b1']), ('\U0002f994',
+ &['\u82b3']), ('\U0002f995', &['\u82bd']), ('\U0002f996', &['\u82e6']), ('\U0002f997',
+ &['\U00026b3c']), ('\U0002f998', &['\u82e5']), ('\U0002f999', &['\u831d']), ('\U0002f99a',
+ &['\u8363']), ('\U0002f99b', &['\u83ad']), ('\U0002f99c', &['\u8323']), ('\U0002f99d',
+ &['\u83bd']), ('\U0002f99e', &['\u83e7']), ('\U0002f99f', &['\u8457']), ('\U0002f9a0',
+ &['\u8353']), ('\U0002f9a1', &['\u83ca']), ('\U0002f9a2', &['\u83cc']), ('\U0002f9a3',
+ &['\u83dc']), ('\U0002f9a4', &['\U00026c36']), ('\U0002f9a5', &['\U00026d6b']),
+ ('\U0002f9a6', &['\U00026cd5']), ('\U0002f9a7', &['\u452b']), ('\U0002f9a8', &['\u84f1']),
+ ('\U0002f9a9', &['\u84f3']), ('\U0002f9aa', &['\u8516']), ('\U0002f9ab', &['\U000273ca']),
+ ('\U0002f9ac', &['\u8564']), ('\U0002f9ad', &['\U00026f2c']), ('\U0002f9ae', &['\u455d']),
+ ('\U0002f9af', &['\u4561']), ('\U0002f9b0', &['\U00026fb1']), ('\U0002f9b1',
+ &['\U000270d2']), ('\U0002f9b2', &['\u456b']), ('\U0002f9b3', &['\u8650']), ('\U0002f9b4',
+ &['\u865c']), ('\U0002f9b5', &['\u8667']), ('\U0002f9b6', &['\u8669']), ('\U0002f9b7',
+ &['\u86a9']), ('\U0002f9b8', &['\u8688']), ('\U0002f9b9', &['\u870e']), ('\U0002f9ba',
+ &['\u86e2']), ('\U0002f9bb', &['\u8779']), ('\U0002f9bc', &['\u8728']), ('\U0002f9bd',
+ &['\u876b']), ('\U0002f9be', &['\u8786']), ('\U0002f9bf', &['\u45d7']), ('\U0002f9c0',
+ &['\u87e1']), ('\U0002f9c1', &['\u8801']), ('\U0002f9c2', &['\u45f9']), ('\U0002f9c3',
+ &['\u8860']), ('\U0002f9c4', &['\u8863']), ('\U0002f9c5', &['\U00027667']), ('\U0002f9c6',
+ &['\u88d7']), ('\U0002f9c7', &['\u88de']), ('\U0002f9c8', &['\u4635']), ('\U0002f9c9',
+ &['\u88fa']), ('\U0002f9ca', &['\u34bb']), ('\U0002f9cb', &['\U000278ae']), ('\U0002f9cc',
+ &['\U00027966']), ('\U0002f9cd', &['\u46be']), ('\U0002f9ce', &['\u46c7']), ('\U0002f9cf',
+ &['\u8aa0']), ('\U0002f9d0', &['\u8aed']), ('\U0002f9d1', &['\u8b8a']), ('\U0002f9d2',
+ &['\u8c55']), ('\U0002f9d3', &['\U00027ca8']), ('\U0002f9d4', &['\u8cab']), ('\U0002f9d5',
+ &['\u8cc1']), ('\U0002f9d6', &['\u8d1b']), ('\U0002f9d7', &['\u8d77']), ('\U0002f9d8',
+ &['\U00027f2f']), ('\U0002f9d9', &['\U00020804']), ('\U0002f9da', &['\u8dcb']),
+ ('\U0002f9db', &['\u8dbc']), ('\U0002f9dc', &['\u8df0']), ('\U0002f9dd', &['\U000208de']),
+ ('\U0002f9de', &['\u8ed4']), ('\U0002f9df', &['\u8f38']), ('\U0002f9e0', &['\U000285d2']),
+ ('\U0002f9e1', &['\U000285ed']), ('\U0002f9e2', &['\u9094']), ('\U0002f9e3', &['\u90f1']),
+ ('\U0002f9e4', &['\u9111']), ('\U0002f9e5', &['\U0002872e']), ('\U0002f9e6', &['\u911b']),
+ ('\U0002f9e7', &['\u9238']), ('\U0002f9e8', &['\u92d7']), ('\U0002f9e9', &['\u92d8']),
+ ('\U0002f9ea', &['\u927c']), ('\U0002f9eb', &['\u93f9']), ('\U0002f9ec', &['\u9415']),
+ ('\U0002f9ed', &['\U00028bfa']), ('\U0002f9ee', &['\u958b']), ('\U0002f9ef', &['\u4995']),
+ ('\U0002f9f0', &['\u95b7']), ('\U0002f9f1', &['\U00028d77']), ('\U0002f9f2', &['\u49e6']),
+ ('\U0002f9f3', &['\u96c3']), ('\U0002f9f4', &['\u5db2']), ('\U0002f9f5', &['\u9723']),
+ ('\U0002f9f6', &['\U00029145']), ('\U0002f9f7', &['\U0002921a']), ('\U0002f9f8',
+ &['\u4a6e']), ('\U0002f9f9', &['\u4a76']), ('\U0002f9fa', &['\u97e0']), ('\U0002f9fb',
+ &['\U0002940a']), ('\U0002f9fc', &['\u4ab2']), ('\U0002f9fd', &['\U00029496']),
+ ('\U0002f9fe', &['\u980b']), ('\U0002f9ff', &['\u980b']), ('\U0002fa00', &['\u9829']),
+ ('\U0002fa01', &['\U000295b6']), ('\U0002fa02', &['\u98e2']), ('\U0002fa03', &['\u4b33']),
+ ('\U0002fa04', &['\u9929']), ('\U0002fa05', &['\u99a7']), ('\U0002fa06', &['\u99c2']),
+ ('\U0002fa07', &['\u99fe']), ('\U0002fa08', &['\u4bce']), ('\U0002fa09', &['\U00029b30']),
+ ('\U0002fa0a', &['\u9b12']), ('\U0002fa0b', &['\u9c40']), ('\U0002fa0c', &['\u9cfd']),
+ ('\U0002fa0d', &['\u4cce']), ('\U0002fa0e', &['\u4ced']), ('\U0002fa0f', &['\u9d67']),
+ ('\U0002fa10', &['\U0002a0ce']), ('\U0002fa11', &['\u4cf8']), ('\U0002fa12',
+ &['\U0002a105']), ('\U0002fa13', &['\U0002a20e']), ('\U0002fa14', &['\U0002a291']),
+ ('\U0002fa15', &['\u9ebb']), ('\U0002fa16', &['\u4d56']), ('\U0002fa17', &['\u9ef9']),
+ ('\U0002fa18', &['\u9efe']), ('\U0002fa19', &['\u9f05']), ('\U0002fa1a', &['\u9f0f']),
+ ('\U0002fa1b', &['\u9f16']), ('\U0002fa1c', &['\u9f3b']), ('\U0002fa1d', &['\U0002a600'])
+ ];
+
+ // Compatibility decompositions
+ static compatibility_table : &'static [(char, &'static [char])] = &[
+ ('\xa0', &['\x20']), ('\xa8', &['\x20', '\u0308']), ('\xaa', &['\x61']), ('\xaf', &['\x20',
+ '\u0304']), ('\xb2', &['\x32']), ('\xb3', &['\x33']), ('\xb4', &['\x20', '\u0301']),
+ ('\xb5', &['\u03bc']), ('\xb8', &['\x20', '\u0327']), ('\xb9', &['\x31']), ('\xba',
+ &['\x6f']), ('\xbc', &['\x31', '\u2044', '\x34']), ('\xbd', &['\x31', '\u2044', '\x32']),
+ ('\xbe', &['\x33', '\u2044', '\x34']), ('\u0132', &['\x49', '\x4a']), ('\u0133', &['\x69',
+ '\x6a']), ('\u013f', &['\x4c', '\xb7']), ('\u0140', &['\x6c', '\xb7']), ('\u0149',
+ &['\u02bc', '\x6e']), ('\u017f', &['\x73']), ('\u01c4', &['\x44', '\u017d']), ('\u01c5',
+ &['\x44', '\u017e']), ('\u01c6', &['\x64', '\u017e']), ('\u01c7', &['\x4c', '\x4a']),
+ ('\u01c8', &['\x4c', '\x6a']), ('\u01c9', &['\x6c', '\x6a']), ('\u01ca', &['\x4e', '\x4a']),
+ ('\u01cb', &['\x4e', '\x6a']), ('\u01cc', &['\x6e', '\x6a']), ('\u01f1', &['\x44', '\x5a']),
+ ('\u01f2', &['\x44', '\x7a']), ('\u01f3', &['\x64', '\x7a']), ('\u02b0', &['\x68']),
+ ('\u02b1', &['\u0266']), ('\u02b2', &['\x6a']), ('\u02b3', &['\x72']), ('\u02b4',
+ &['\u0279']), ('\u02b5', &['\u027b']), ('\u02b6', &['\u0281']), ('\u02b7', &['\x77']),
+ ('\u02b8', &['\x79']), ('\u02d8', &['\x20', '\u0306']), ('\u02d9', &['\x20', '\u0307']),
+ ('\u02da', &['\x20', '\u030a']), ('\u02db', &['\x20', '\u0328']), ('\u02dc', &['\x20',
+ '\u0303']), ('\u02dd', &['\x20', '\u030b']), ('\u02e0', &['\u0263']), ('\u02e1', &['\x6c']),
+ ('\u02e2', &['\x73']), ('\u02e3', &['\x78']), ('\u02e4', &['\u0295']), ('\u037a', &['\x20',
+ '\u0345']), ('\u0384', &['\x20', '\u0301']), ('\u03d0', &['\u03b2']), ('\u03d1',
+ &['\u03b8']), ('\u03d2', &['\u03a5']), ('\u03d5', &['\u03c6']), ('\u03d6', &['\u03c0']),
+ ('\u03f0', &['\u03ba']), ('\u03f1', &['\u03c1']), ('\u03f2', &['\u03c2']), ('\u03f4',
+ &['\u0398']), ('\u03f5', &['\u03b5']), ('\u03f9', &['\u03a3']), ('\u0587', &['\u0565',
+ '\u0582']), ('\u0675', &['\u0627', '\u0674']), ('\u0676', &['\u0648', '\u0674']), ('\u0677',
+ &['\u06c7', '\u0674']), ('\u0678', &['\u064a', '\u0674']), ('\u0e33', &['\u0e4d',
+ '\u0e32']), ('\u0eb3', &['\u0ecd', '\u0eb2']), ('\u0edc', &['\u0eab', '\u0e99']), ('\u0edd',
+ &['\u0eab', '\u0ea1']), ('\u0f0c', &['\u0f0b']), ('\u0f77', &['\u0fb2', '\u0f81']),
+ ('\u0f79', &['\u0fb3', '\u0f81']), ('\u10fc', &['\u10dc']), ('\u1d2c', &['\x41']),
+ ('\u1d2d', &['\xc6']), ('\u1d2e', &['\x42']), ('\u1d30', &['\x44']), ('\u1d31', &['\x45']),
+ ('\u1d32', &['\u018e']), ('\u1d33', &['\x47']), ('\u1d34', &['\x48']), ('\u1d35',
+ &['\x49']), ('\u1d36', &['\x4a']), ('\u1d37', &['\x4b']), ('\u1d38', &['\x4c']), ('\u1d39',
+ &['\x4d']), ('\u1d3a', &['\x4e']), ('\u1d3c', &['\x4f']), ('\u1d3d', &['\u0222']),
+ ('\u1d3e', &['\x50']), ('\u1d3f', &['\x52']), ('\u1d40', &['\x54']), ('\u1d41', &['\x55']),
+ ('\u1d42', &['\x57']), ('\u1d43', &['\x61']), ('\u1d44', &['\u0250']), ('\u1d45',
+ &['\u0251']), ('\u1d46', &['\u1d02']), ('\u1d47', &['\x62']), ('\u1d48', &['\x64']),
+ ('\u1d49', &['\x65']), ('\u1d4a', &['\u0259']), ('\u1d4b', &['\u025b']), ('\u1d4c',
+ &['\u025c']), ('\u1d4d', &['\x67']), ('\u1d4f', &['\x6b']), ('\u1d50', &['\x6d']),
+ ('\u1d51', &['\u014b']), ('\u1d52', &['\x6f']), ('\u1d53', &['\u0254']), ('\u1d54',
+ &['\u1d16']), ('\u1d55', &['\u1d17']), ('\u1d56', &['\x70']), ('\u1d57', &['\x74']),
+ ('\u1d58', &['\x75']), ('\u1d59', &['\u1d1d']), ('\u1d5a', &['\u026f']), ('\u1d5b',
+ &['\x76']), ('\u1d5c', &['\u1d25']), ('\u1d5d', &['\u03b2']), ('\u1d5e', &['\u03b3']),
+ ('\u1d5f', &['\u03b4']), ('\u1d60', &['\u03c6']), ('\u1d61', &['\u03c7']), ('\u1d62',
+ &['\x69']), ('\u1d63', &['\x72']), ('\u1d64', &['\x75']), ('\u1d65', &['\x76']), ('\u1d66',
+ &['\u03b2']), ('\u1d67', &['\u03b3']), ('\u1d68', &['\u03c1']), ('\u1d69', &['\u03c6']),
+ ('\u1d6a', &['\u03c7']), ('\u1d78', &['\u043d']), ('\u1d9b', &['\u0252']), ('\u1d9c',
+ &['\x63']), ('\u1d9d', &['\u0255']), ('\u1d9e', &['\xf0']), ('\u1d9f', &['\u025c']),
+ ('\u1da0', &['\x66']), ('\u1da1', &['\u025f']), ('\u1da2', &['\u0261']), ('\u1da3',
+ &['\u0265']), ('\u1da4', &['\u0268']), ('\u1da5', &['\u0269']), ('\u1da6', &['\u026a']),
+ ('\u1da7', &['\u1d7b']), ('\u1da8', &['\u029d']), ('\u1da9', &['\u026d']), ('\u1daa',
+ &['\u1d85']), ('\u1dab', &['\u029f']), ('\u1dac', &['\u0271']), ('\u1dad', &['\u0270']),
+ ('\u1dae', &['\u0272']), ('\u1daf', &['\u0273']), ('\u1db0', &['\u0274']), ('\u1db1',
+ &['\u0275']), ('\u1db2', &['\u0278']), ('\u1db3', &['\u0282']), ('\u1db4', &['\u0283']),
+ ('\u1db5', &['\u01ab']), ('\u1db6', &['\u0289']), ('\u1db7', &['\u028a']), ('\u1db8',
+ &['\u1d1c']), ('\u1db9', &['\u028b']), ('\u1dba', &['\u028c']), ('\u1dbb', &['\x7a']),
+ ('\u1dbc', &['\u0290']), ('\u1dbd', &['\u0291']), ('\u1dbe', &['\u0292']), ('\u1dbf',
+ &['\u03b8']), ('\u1e9a', &['\x61', '\u02be']), ('\u1fbd', &['\x20', '\u0313']), ('\u1fbf',
+ &['\x20', '\u0313']), ('\u1fc0', &['\x20', '\u0342']), ('\u1ffe', &['\x20', '\u0314']),
+ ('\u2002', &['\x20']), ('\u2003', &['\x20']), ('\u2004', &['\x20']), ('\u2005', &['\x20']),
+ ('\u2006', &['\x20']), ('\u2007', &['\x20']), ('\u2008', &['\x20']), ('\u2009', &['\x20']),
+ ('\u200a', &['\x20']), ('\u2011', &['\u2010']), ('\u2017', &['\x20', '\u0333']), ('\u2024',
+ &['\x2e']), ('\u2025', &['\x2e', '\x2e']), ('\u2026', &['\x2e', '\x2e', '\x2e']), ('\u202f',
+ &['\x20']), ('\u2033', &['\u2032', '\u2032']), ('\u2034', &['\u2032', '\u2032', '\u2032']),
+ ('\u2036', &['\u2035', '\u2035']), ('\u2037', &['\u2035', '\u2035', '\u2035']), ('\u203c',
+ &['\x21', '\x21']), ('\u203e', &['\x20', '\u0305']), ('\u2047', &['\x3f', '\x3f']),
+ ('\u2048', &['\x3f', '\x21']), ('\u2049', &['\x21', '\x3f']), ('\u2057', &['\u2032',
+ '\u2032', '\u2032', '\u2032']), ('\u205f', &['\x20']), ('\u2070', &['\x30']), ('\u2071',
+ &['\x69']), ('\u2074', &['\x34']), ('\u2075', &['\x35']), ('\u2076', &['\x36']), ('\u2077',
+ &['\x37']), ('\u2078', &['\x38']), ('\u2079', &['\x39']), ('\u207a', &['\x2b']), ('\u207b',
+ &['\u2212']), ('\u207c', &['\x3d']), ('\u207d', &['\x28']), ('\u207e', &['\x29']),
+ ('\u207f', &['\x6e']), ('\u2080', &['\x30']), ('\u2081', &['\x31']), ('\u2082', &['\x32']),
+ ('\u2083', &['\x33']), ('\u2084', &['\x34']), ('\u2085', &['\x35']), ('\u2086', &['\x36']),
+ ('\u2087', &['\x37']), ('\u2088', &['\x38']), ('\u2089', &['\x39']), ('\u208a', &['\x2b']),
+ ('\u208b', &['\u2212']), ('\u208c', &['\x3d']), ('\u208d', &['\x28']), ('\u208e',
+ &['\x29']), ('\u2090', &['\x61']), ('\u2091', &['\x65']), ('\u2092', &['\x6f']), ('\u2093',
+ &['\x78']), ('\u2094', &['\u0259']), ('\u2095', &['\x68']), ('\u2096', &['\x6b']),
+ ('\u2097', &['\x6c']), ('\u2098', &['\x6d']), ('\u2099', &['\x6e']), ('\u209a', &['\x70']),
+ ('\u209b', &['\x73']), ('\u209c', &['\x74']), ('\u20a8', &['\x52', '\x73']), ('\u2100',
+ &['\x61', '\x2f', '\x63']), ('\u2101', &['\x61', '\x2f', '\x73']), ('\u2102', &['\x43']),
+ ('\u2103', &['\xb0', '\x43']), ('\u2105', &['\x63', '\x2f', '\x6f']), ('\u2106', &['\x63',
+ '\x2f', '\x75']), ('\u2107', &['\u0190']), ('\u2109', &['\xb0', '\x46']), ('\u210a',
+ &['\x67']), ('\u210b', &['\x48']), ('\u210c', &['\x48']), ('\u210d', &['\x48']), ('\u210e',
+ &['\x68']), ('\u210f', &['\u0127']), ('\u2110', &['\x49']), ('\u2111', &['\x49']),
+ ('\u2112', &['\x4c']), ('\u2113', &['\x6c']), ('\u2115', &['\x4e']), ('\u2116', &['\x4e',
+ '\x6f']), ('\u2119', &['\x50']), ('\u211a', &['\x51']), ('\u211b', &['\x52']), ('\u211c',
+ &['\x52']), ('\u211d', &['\x52']), ('\u2120', &['\x53', '\x4d']), ('\u2121', &['\x54',
+ '\x45', '\x4c']), ('\u2122', &['\x54', '\x4d']), ('\u2124', &['\x5a']), ('\u2128',
+ &['\x5a']), ('\u212c', &['\x42']), ('\u212d', &['\x43']), ('\u212f', &['\x65']), ('\u2130',
+ &['\x45']), ('\u2131', &['\x46']), ('\u2133', &['\x4d']), ('\u2134', &['\x6f']), ('\u2135',
+ &['\u05d0']), ('\u2136', &['\u05d1']), ('\u2137', &['\u05d2']), ('\u2138', &['\u05d3']),
+ ('\u2139', &['\x69']), ('\u213b', &['\x46', '\x41', '\x58']), ('\u213c', &['\u03c0']),
+ ('\u213d', &['\u03b3']), ('\u213e', &['\u0393']), ('\u213f', &['\u03a0']), ('\u2140',
+ &['\u2211']), ('\u2145', &['\x44']), ('\u2146', &['\x64']), ('\u2147', &['\x65']),
+ ('\u2148', &['\x69']), ('\u2149', &['\x6a']), ('\u2150', &['\x31', '\u2044', '\x37']),
+ ('\u2151', &['\x31', '\u2044', '\x39']), ('\u2152', &['\x31', '\u2044', '\x31', '\x30']),
+ ('\u2153', &['\x31', '\u2044', '\x33']), ('\u2154', &['\x32', '\u2044', '\x33']), ('\u2155',
+ &['\x31', '\u2044', '\x35']), ('\u2156', &['\x32', '\u2044', '\x35']), ('\u2157', &['\x33',
+ '\u2044', '\x35']), ('\u2158', &['\x34', '\u2044', '\x35']), ('\u2159', &['\x31', '\u2044',
+ '\x36']), ('\u215a', &['\x35', '\u2044', '\x36']), ('\u215b', &['\x31', '\u2044', '\x38']),
+ ('\u215c', &['\x33', '\u2044', '\x38']), ('\u215d', &['\x35', '\u2044', '\x38']), ('\u215e',
+ &['\x37', '\u2044', '\x38']), ('\u215f', &['\x31', '\u2044']), ('\u2160', &['\x49']),
+ ('\u2161', &['\x49', '\x49']), ('\u2162', &['\x49', '\x49', '\x49']), ('\u2163', &['\x49',
+ '\x56']), ('\u2164', &['\x56']), ('\u2165', &['\x56', '\x49']), ('\u2166', &['\x56', '\x49',
+ '\x49']), ('\u2167', &['\x56', '\x49', '\x49', '\x49']), ('\u2168', &['\x49', '\x58']),
+ ('\u2169', &['\x58']), ('\u216a', &['\x58', '\x49']), ('\u216b', &['\x58', '\x49', '\x49']),
+ ('\u216c', &['\x4c']), ('\u216d', &['\x43']), ('\u216e', &['\x44']), ('\u216f', &['\x4d']),
+ ('\u2170', &['\x69']), ('\u2171', &['\x69', '\x69']), ('\u2172', &['\x69', '\x69', '\x69']),
+ ('\u2173', &['\x69', '\x76']), ('\u2174', &['\x76']), ('\u2175', &['\x76', '\x69']),
+ ('\u2176', &['\x76', '\x69', '\x69']), ('\u2177', &['\x76', '\x69', '\x69', '\x69']),
+ ('\u2178', &['\x69', '\x78']), ('\u2179', &['\x78']), ('\u217a', &['\x78', '\x69']),
+ ('\u217b', &['\x78', '\x69', '\x69']), ('\u217c', &['\x6c']), ('\u217d', &['\x63']),
+ ('\u217e', &['\x64']), ('\u217f', &['\x6d']), ('\u2189', &['\x30', '\u2044', '\x33']),
+ ('\u222c', &['\u222b', '\u222b']), ('\u222d', &['\u222b', '\u222b', '\u222b']), ('\u222f',
+ &['\u222e', '\u222e']), ('\u2230', &['\u222e', '\u222e', '\u222e']), ('\u2460', &['\x31']),
+ ('\u2461', &['\x32']), ('\u2462', &['\x33']), ('\u2463', &['\x34']), ('\u2464', &['\x35']),
+ ('\u2465', &['\x36']), ('\u2466', &['\x37']), ('\u2467', &['\x38']), ('\u2468', &['\x39']),
+ ('\u2469', &['\x31', '\x30']), ('\u246a', &['\x31', '\x31']), ('\u246b', &['\x31', '\x32']),
+ ('\u246c', &['\x31', '\x33']), ('\u246d', &['\x31', '\x34']), ('\u246e', &['\x31', '\x35']),
+ ('\u246f', &['\x31', '\x36']), ('\u2470', &['\x31', '\x37']), ('\u2471', &['\x31', '\x38']),
+ ('\u2472', &['\x31', '\x39']), ('\u2473', &['\x32', '\x30']), ('\u2474', &['\x28', '\x31',
+ '\x29']), ('\u2475', &['\x28', '\x32', '\x29']), ('\u2476', &['\x28', '\x33', '\x29']),
+ ('\u2477', &['\x28', '\x34', '\x29']), ('\u2478', &['\x28', '\x35', '\x29']), ('\u2479',
+ &['\x28', '\x36', '\x29']), ('\u247a', &['\x28', '\x37', '\x29']), ('\u247b', &['\x28',
+ '\x38', '\x29']), ('\u247c', &['\x28', '\x39', '\x29']), ('\u247d', &['\x28', '\x31',
+ '\x30', '\x29']), ('\u247e', &['\x28', '\x31', '\x31', '\x29']), ('\u247f', &['\x28',
+ '\x31', '\x32', '\x29']), ('\u2480', &['\x28', '\x31', '\x33', '\x29']), ('\u2481',
+ &['\x28', '\x31', '\x34', '\x29']), ('\u2482', &['\x28', '\x31', '\x35', '\x29']),
+ ('\u2483', &['\x28', '\x31', '\x36', '\x29']), ('\u2484', &['\x28', '\x31', '\x37',
+ '\x29']), ('\u2485', &['\x28', '\x31', '\x38', '\x29']), ('\u2486', &['\x28', '\x31',
+ '\x39', '\x29']), ('\u2487', &['\x28', '\x32', '\x30', '\x29']), ('\u2488', &['\x31',
+ '\x2e']), ('\u2489', &['\x32', '\x2e']), ('\u248a', &['\x33', '\x2e']), ('\u248b', &['\x34',
+ '\x2e']), ('\u248c', &['\x35', '\x2e']), ('\u248d', &['\x36', '\x2e']), ('\u248e', &['\x37',
+ '\x2e']), ('\u248f', &['\x38', '\x2e']), ('\u2490', &['\x39', '\x2e']), ('\u2491', &['\x31',
+ '\x30', '\x2e']), ('\u2492', &['\x31', '\x31', '\x2e']), ('\u2493', &['\x31', '\x32',
+ '\x2e']), ('\u2494', &['\x31', '\x33', '\x2e']), ('\u2495', &['\x31', '\x34', '\x2e']),
+ ('\u2496', &['\x31', '\x35', '\x2e']), ('\u2497', &['\x31', '\x36', '\x2e']), ('\u2498',
+ &['\x31', '\x37', '\x2e']), ('\u2499', &['\x31', '\x38', '\x2e']), ('\u249a', &['\x31',
+ '\x39', '\x2e']), ('\u249b', &['\x32', '\x30', '\x2e']), ('\u249c', &['\x28', '\x61',
+ '\x29']), ('\u249d', &['\x28', '\x62', '\x29']), ('\u249e', &['\x28', '\x63', '\x29']),
+ ('\u249f', &['\x28', '\x64', '\x29']), ('\u24a0', &['\x28', '\x65', '\x29']), ('\u24a1',
+ &['\x28', '\x66', '\x29']), ('\u24a2', &['\x28', '\x67', '\x29']), ('\u24a3', &['\x28',
+ '\x68', '\x29']), ('\u24a4', &['\x28', '\x69', '\x29']), ('\u24a5', &['\x28', '\x6a',
+ '\x29']), ('\u24a6', &['\x28', '\x6b', '\x29']), ('\u24a7', &['\x28', '\x6c', '\x29']),
+ ('\u24a8', &['\x28', '\x6d', '\x29']), ('\u24a9', &['\x28', '\x6e', '\x29']), ('\u24aa',
+ &['\x28', '\x6f', '\x29']), ('\u24ab', &['\x28', '\x70', '\x29']), ('\u24ac', &['\x28',
+ '\x71', '\x29']), ('\u24ad', &['\x28', '\x72', '\x29']), ('\u24ae', &['\x28', '\x73',
+ '\x29']), ('\u24af', &['\x28', '\x74', '\x29']), ('\u24b0', &['\x28', '\x75', '\x29']),
+ ('\u24b1', &['\x28', '\x76', '\x29']), ('\u24b2', &['\x28', '\x77', '\x29']), ('\u24b3',
+ &['\x28', '\x78', '\x29']), ('\u24b4', &['\x28', '\x79', '\x29']), ('\u24b5', &['\x28',
+ '\x7a', '\x29']), ('\u24b6', &['\x41']), ('\u24b7', &['\x42']), ('\u24b8', &['\x43']),
+ ('\u24b9', &['\x44']), ('\u24ba', &['\x45']), ('\u24bb', &['\x46']), ('\u24bc', &['\x47']),
+ ('\u24bd', &['\x48']), ('\u24be', &['\x49']), ('\u24bf', &['\x4a']), ('\u24c0', &['\x4b']),
+ ('\u24c1', &['\x4c']), ('\u24c2', &['\x4d']), ('\u24c3', &['\x4e']), ('\u24c4', &['\x4f']),
+ ('\u24c5', &['\x50']), ('\u24c6', &['\x51']), ('\u24c7', &['\x52']), ('\u24c8', &['\x53']),
+ ('\u24c9', &['\x54']), ('\u24ca', &['\x55']), ('\u24cb', &['\x56']), ('\u24cc', &['\x57']),
+ ('\u24cd', &['\x58']), ('\u24ce', &['\x59']), ('\u24cf', &['\x5a']), ('\u24d0', &['\x61']),
+ ('\u24d1', &['\x62']), ('\u24d2', &['\x63']), ('\u24d3', &['\x64']), ('\u24d4', &['\x65']),
+ ('\u24d5', &['\x66']), ('\u24d6', &['\x67']), ('\u24d7', &['\x68']), ('\u24d8', &['\x69']),
+ ('\u24d9', &['\x6a']), ('\u24da', &['\x6b']), ('\u24db', &['\x6c']), ('\u24dc', &['\x6d']),
+ ('\u24dd', &['\x6e']), ('\u24de', &['\x6f']), ('\u24df', &['\x70']), ('\u24e0', &['\x71']),
+ ('\u24e1', &['\x72']), ('\u24e2', &['\x73']), ('\u24e3', &['\x74']), ('\u24e4', &['\x75']),
+ ('\u24e5', &['\x76']), ('\u24e6', &['\x77']), ('\u24e7', &['\x78']), ('\u24e8', &['\x79']),
+ ('\u24e9', &['\x7a']), ('\u24ea', &['\x30']), ('\u2a0c', &['\u222b', '\u222b', '\u222b',
+ '\u222b']), ('\u2a74', &['\x3a', '\x3a', '\x3d']), ('\u2a75', &['\x3d', '\x3d']), ('\u2a76',
+ &['\x3d', '\x3d', '\x3d']), ('\u2c7c', &['\x6a']), ('\u2c7d', &['\x56']), ('\u2d6f',
+ &['\u2d61']), ('\u2e9f', &['\u6bcd']), ('\u2ef3', &['\u9f9f']), ('\u2f00', &['\u4e00']),
+ ('\u2f01', &['\u4e28']), ('\u2f02', &['\u4e36']), ('\u2f03', &['\u4e3f']), ('\u2f04',
+ &['\u4e59']), ('\u2f05', &['\u4e85']), ('\u2f06', &['\u4e8c']), ('\u2f07', &['\u4ea0']),
+ ('\u2f08', &['\u4eba']), ('\u2f09', &['\u513f']), ('\u2f0a', &['\u5165']), ('\u2f0b',
+ &['\u516b']), ('\u2f0c', &['\u5182']), ('\u2f0d', &['\u5196']), ('\u2f0e', &['\u51ab']),
+ ('\u2f0f', &['\u51e0']), ('\u2f10', &['\u51f5']), ('\u2f11', &['\u5200']), ('\u2f12',
+ &['\u529b']), ('\u2f13', &['\u52f9']), ('\u2f14', &['\u5315']), ('\u2f15', &['\u531a']),
+ ('\u2f16', &['\u5338']), ('\u2f17', &['\u5341']), ('\u2f18', &['\u535c']), ('\u2f19',
+ &['\u5369']), ('\u2f1a', &['\u5382']), ('\u2f1b', &['\u53b6']), ('\u2f1c', &['\u53c8']),
+ ('\u2f1d', &['\u53e3']), ('\u2f1e', &['\u56d7']), ('\u2f1f', &['\u571f']), ('\u2f20',
+ &['\u58eb']), ('\u2f21', &['\u5902']), ('\u2f22', &['\u590a']), ('\u2f23', &['\u5915']),
+ ('\u2f24', &['\u5927']), ('\u2f25', &['\u5973']), ('\u2f26', &['\u5b50']), ('\u2f27',
+ &['\u5b80']), ('\u2f28', &['\u5bf8']), ('\u2f29', &['\u5c0f']), ('\u2f2a', &['\u5c22']),
+ ('\u2f2b', &['\u5c38']), ('\u2f2c', &['\u5c6e']), ('\u2f2d', &['\u5c71']), ('\u2f2e',
+ &['\u5ddb']), ('\u2f2f', &['\u5de5']), ('\u2f30', &['\u5df1']), ('\u2f31', &['\u5dfe']),
+ ('\u2f32', &['\u5e72']), ('\u2f33', &['\u5e7a']), ('\u2f34', &['\u5e7f']), ('\u2f35',
+ &['\u5ef4']), ('\u2f36', &['\u5efe']), ('\u2f37', &['\u5f0b']), ('\u2f38', &['\u5f13']),
+ ('\u2f39', &['\u5f50']), ('\u2f3a', &['\u5f61']), ('\u2f3b', &['\u5f73']), ('\u2f3c',
+ &['\u5fc3']), ('\u2f3d', &['\u6208']), ('\u2f3e', &['\u6236']), ('\u2f3f', &['\u624b']),
+ ('\u2f40', &['\u652f']), ('\u2f41', &['\u6534']), ('\u2f42', &['\u6587']), ('\u2f43',
+ &['\u6597']), ('\u2f44', &['\u65a4']), ('\u2f45', &['\u65b9']), ('\u2f46', &['\u65e0']),
+ ('\u2f47', &['\u65e5']), ('\u2f48', &['\u66f0']), ('\u2f49', &['\u6708']), ('\u2f4a',
+ &['\u6728']), ('\u2f4b', &['\u6b20']), ('\u2f4c', &['\u6b62']), ('\u2f4d', &['\u6b79']),
+ ('\u2f4e', &['\u6bb3']), ('\u2f4f', &['\u6bcb']), ('\u2f50', &['\u6bd4']), ('\u2f51',
+ &['\u6bdb']), ('\u2f52', &['\u6c0f']), ('\u2f53', &['\u6c14']), ('\u2f54', &['\u6c34']),
+ ('\u2f55', &['\u706b']), ('\u2f56', &['\u722a']), ('\u2f57', &['\u7236']), ('\u2f58',
+ &['\u723b']), ('\u2f59', &['\u723f']), ('\u2f5a', &['\u7247']), ('\u2f5b', &['\u7259']),
+ ('\u2f5c', &['\u725b']), ('\u2f5d', &['\u72ac']), ('\u2f5e', &['\u7384']), ('\u2f5f',
+ &['\u7389']), ('\u2f60', &['\u74dc']), ('\u2f61', &['\u74e6']), ('\u2f62', &['\u7518']),
+ ('\u2f63', &['\u751f']), ('\u2f64', &['\u7528']), ('\u2f65', &['\u7530']), ('\u2f66',
+ &['\u758b']), ('\u2f67', &['\u7592']), ('\u2f68', &['\u7676']), ('\u2f69', &['\u767d']),
+ ('\u2f6a', &['\u76ae']), ('\u2f6b', &['\u76bf']), ('\u2f6c', &['\u76ee']), ('\u2f6d',
+ &['\u77db']), ('\u2f6e', &['\u77e2']), ('\u2f6f', &['\u77f3']), ('\u2f70', &['\u793a']),
+ ('\u2f71', &['\u79b8']), ('\u2f72', &['\u79be']), ('\u2f73', &['\u7a74']), ('\u2f74',
+ &['\u7acb']), ('\u2f75', &['\u7af9']), ('\u2f76', &['\u7c73']), ('\u2f77', &['\u7cf8']),
+ ('\u2f78', &['\u7f36']), ('\u2f79', &['\u7f51']), ('\u2f7a', &['\u7f8a']), ('\u2f7b',
+ &['\u7fbd']), ('\u2f7c', &['\u8001']), ('\u2f7d', &['\u800c']), ('\u2f7e', &['\u8012']),
+ ('\u2f7f', &['\u8033']), ('\u2f80', &['\u807f']), ('\u2f81', &['\u8089']), ('\u2f82',
+ &['\u81e3']), ('\u2f83', &['\u81ea']), ('\u2f84', &['\u81f3']), ('\u2f85', &['\u81fc']),
+ ('\u2f86', &['\u820c']), ('\u2f87', &['\u821b']), ('\u2f88', &['\u821f']), ('\u2f89',
+ &['\u826e']), ('\u2f8a', &['\u8272']), ('\u2f8b', &['\u8278']), ('\u2f8c', &['\u864d']),
+ ('\u2f8d', &['\u866b']), ('\u2f8e', &['\u8840']), ('\u2f8f', &['\u884c']), ('\u2f90',
+ &['\u8863']), ('\u2f91', &['\u897e']), ('\u2f92', &['\u898b']), ('\u2f93', &['\u89d2']),
+ ('\u2f94', &['\u8a00']), ('\u2f95', &['\u8c37']), ('\u2f96', &['\u8c46']), ('\u2f97',
+ &['\u8c55']), ('\u2f98', &['\u8c78']), ('\u2f99', &['\u8c9d']), ('\u2f9a', &['\u8d64']),
+ ('\u2f9b', &['\u8d70']), ('\u2f9c', &['\u8db3']), ('\u2f9d', &['\u8eab']), ('\u2f9e',
+ &['\u8eca']), ('\u2f9f', &['\u8f9b']), ('\u2fa0', &['\u8fb0']), ('\u2fa1', &['\u8fb5']),
+ ('\u2fa2', &['\u9091']), ('\u2fa3', &['\u9149']), ('\u2fa4', &['\u91c6']), ('\u2fa5',
+ &['\u91cc']), ('\u2fa6', &['\u91d1']), ('\u2fa7', &['\u9577']), ('\u2fa8', &['\u9580']),
+ ('\u2fa9', &['\u961c']), ('\u2faa', &['\u96b6']), ('\u2fab', &['\u96b9']), ('\u2fac',
+ &['\u96e8']), ('\u2fad', &['\u9751']), ('\u2fae', &['\u975e']), ('\u2faf', &['\u9762']),
+ ('\u2fb0', &['\u9769']), ('\u2fb1', &['\u97cb']), ('\u2fb2', &['\u97ed']), ('\u2fb3',
+ &['\u97f3']), ('\u2fb4', &['\u9801']), ('\u2fb5', &['\u98a8']), ('\u2fb6', &['\u98db']),
+ ('\u2fb7', &['\u98df']), ('\u2fb8', &['\u9996']), ('\u2fb9', &['\u9999']), ('\u2fba',
+ &['\u99ac']), ('\u2fbb', &['\u9aa8']), ('\u2fbc', &['\u9ad8']), ('\u2fbd', &['\u9adf']),
+ ('\u2fbe', &['\u9b25']), ('\u2fbf', &['\u9b2f']), ('\u2fc0', &['\u9b32']), ('\u2fc1',
+ &['\u9b3c']), ('\u2fc2', &['\u9b5a']), ('\u2fc3', &['\u9ce5']), ('\u2fc4', &['\u9e75']),
+ ('\u2fc5', &['\u9e7f']), ('\u2fc6', &['\u9ea5']), ('\u2fc7', &['\u9ebb']), ('\u2fc8',
+ &['\u9ec3']), ('\u2fc9', &['\u9ecd']), ('\u2fca', &['\u9ed1']), ('\u2fcb', &['\u9ef9']),
+ ('\u2fcc', &['\u9efd']), ('\u2fcd', &['\u9f0e']), ('\u2fce', &['\u9f13']), ('\u2fcf',
+ &['\u9f20']), ('\u2fd0', &['\u9f3b']), ('\u2fd1', &['\u9f4a']), ('\u2fd2', &['\u9f52']),
+ ('\u2fd3', &['\u9f8d']), ('\u2fd4', &['\u9f9c']), ('\u2fd5', &['\u9fa0']), ('\u3000',
+ &['\x20']), ('\u3036', &['\u3012']), ('\u3038', &['\u5341']), ('\u3039', &['\u5344']),
+ ('\u303a', &['\u5345']), ('\u309b', &['\x20', '\u3099']), ('\u309c', &['\x20', '\u309a']),
+ ('\u309f', &['\u3088', '\u308a']), ('\u30ff', &['\u30b3', '\u30c8']), ('\u3131',
+ &['\u1100']), ('\u3132', &['\u1101']), ('\u3133', &['\u11aa']), ('\u3134', &['\u1102']),
+ ('\u3135', &['\u11ac']), ('\u3136', &['\u11ad']), ('\u3137', &['\u1103']), ('\u3138',
+ &['\u1104']), ('\u3139', &['\u1105']), ('\u313a', &['\u11b0']), ('\u313b', &['\u11b1']),
+ ('\u313c', &['\u11b2']), ('\u313d', &['\u11b3']), ('\u313e', &['\u11b4']), ('\u313f',
+ &['\u11b5']), ('\u3140', &['\u111a']), ('\u3141', &['\u1106']), ('\u3142', &['\u1107']),
+ ('\u3143', &['\u1108']), ('\u3144', &['\u1121']), ('\u3145', &['\u1109']), ('\u3146',
+ &['\u110a']), ('\u3147', &['\u110b']), ('\u3148', &['\u110c']), ('\u3149', &['\u110d']),
+ ('\u314a', &['\u110e']), ('\u314b', &['\u110f']), ('\u314c', &['\u1110']), ('\u314d',
+ &['\u1111']), ('\u314e', &['\u1112']), ('\u314f', &['\u1161']), ('\u3150', &['\u1162']),
+ ('\u3151', &['\u1163']), ('\u3152', &['\u1164']), ('\u3153', &['\u1165']), ('\u3154',
+ &['\u1166']), ('\u3155', &['\u1167']), ('\u3156', &['\u1168']), ('\u3157', &['\u1169']),
+ ('\u3158', &['\u116a']), ('\u3159', &['\u116b']), ('\u315a', &['\u116c']), ('\u315b',
+ &['\u116d']), ('\u315c', &['\u116e']), ('\u315d', &['\u116f']), ('\u315e', &['\u1170']),
+ ('\u315f', &['\u1171']), ('\u3160', &['\u1172']), ('\u3161', &['\u1173']), ('\u3162',
+ &['\u1174']), ('\u3163', &['\u1175']), ('\u3164', &['\u1160']), ('\u3165', &['\u1114']),
+ ('\u3166', &['\u1115']), ('\u3167', &['\u11c7']), ('\u3168', &['\u11c8']), ('\u3169',
+ &['\u11cc']), ('\u316a', &['\u11ce']), ('\u316b', &['\u11d3']), ('\u316c', &['\u11d7']),
+ ('\u316d', &['\u11d9']), ('\u316e', &['\u111c']), ('\u316f', &['\u11dd']), ('\u3170',
+ &['\u11df']), ('\u3171', &['\u111d']), ('\u3172', &['\u111e']), ('\u3173', &['\u1120']),
+ ('\u3174', &['\u1122']), ('\u3175', &['\u1123']), ('\u3176', &['\u1127']), ('\u3177',
+ &['\u1129']), ('\u3178', &['\u112b']), ('\u3179', &['\u112c']), ('\u317a', &['\u112d']),
+ ('\u317b', &['\u112e']), ('\u317c', &['\u112f']), ('\u317d', &['\u1132']), ('\u317e',
+ &['\u1136']), ('\u317f', &['\u1140']), ('\u3180', &['\u1147']), ('\u3181', &['\u114c']),
+ ('\u3182', &['\u11f1']), ('\u3183', &['\u11f2']), ('\u3184', &['\u1157']), ('\u3185',
+ &['\u1158']), ('\u3186', &['\u1159']), ('\u3187', &['\u1184']), ('\u3188', &['\u1185']),
+ ('\u3189', &['\u1188']), ('\u318a', &['\u1191']), ('\u318b', &['\u1192']), ('\u318c',
+ &['\u1194']), ('\u318d', &['\u119e']), ('\u318e', &['\u11a1']), ('\u3192', &['\u4e00']),
+ ('\u3193', &['\u4e8c']), ('\u3194', &['\u4e09']), ('\u3195', &['\u56db']), ('\u3196',
+ &['\u4e0a']), ('\u3197', &['\u4e2d']), ('\u3198', &['\u4e0b']), ('\u3199', &['\u7532']),
+ ('\u319a', &['\u4e59']), ('\u319b', &['\u4e19']), ('\u319c', &['\u4e01']), ('\u319d',
+ &['\u5929']), ('\u319e', &['\u5730']), ('\u319f', &['\u4eba']), ('\u3200', &['\x28',
+ '\u1100', '\x29']), ('\u3201', &['\x28', '\u1102', '\x29']), ('\u3202', &['\x28', '\u1103',
+ '\x29']), ('\u3203', &['\x28', '\u1105', '\x29']), ('\u3204', &['\x28', '\u1106', '\x29']),
+ ('\u3205', &['\x28', '\u1107', '\x29']), ('\u3206', &['\x28', '\u1109', '\x29']), ('\u3207',
+ &['\x28', '\u110b', '\x29']), ('\u3208', &['\x28', '\u110c', '\x29']), ('\u3209', &['\x28',
+ '\u110e', '\x29']), ('\u320a', &['\x28', '\u110f', '\x29']), ('\u320b', &['\x28', '\u1110',
+ '\x29']), ('\u320c', &['\x28', '\u1111', '\x29']), ('\u320d', &['\x28', '\u1112', '\x29']),
+ ('\u320e', &['\x28', '\u1100', '\u1161', '\x29']), ('\u320f', &['\x28', '\u1102', '\u1161',
+ '\x29']), ('\u3210', &['\x28', '\u1103', '\u1161', '\x29']), ('\u3211', &['\x28', '\u1105',
+ '\u1161', '\x29']), ('\u3212', &['\x28', '\u1106', '\u1161', '\x29']), ('\u3213', &['\x28',
+ '\u1107', '\u1161', '\x29']), ('\u3214', &['\x28', '\u1109', '\u1161', '\x29']), ('\u3215',
+ &['\x28', '\u110b', '\u1161', '\x29']), ('\u3216', &['\x28', '\u110c', '\u1161', '\x29']),
+ ('\u3217', &['\x28', '\u110e', '\u1161', '\x29']), ('\u3218', &['\x28', '\u110f', '\u1161',
+ '\x29']), ('\u3219', &['\x28', '\u1110', '\u1161', '\x29']), ('\u321a', &['\x28', '\u1111',
+ '\u1161', '\x29']), ('\u321b', &['\x28', '\u1112', '\u1161', '\x29']), ('\u321c', &['\x28',
+ '\u110c', '\u116e', '\x29']), ('\u321d', &['\x28', '\u110b', '\u1169', '\u110c', '\u1165',
+ '\u11ab', '\x29']), ('\u321e', &['\x28', '\u110b', '\u1169', '\u1112', '\u116e', '\x29']),
+ ('\u3220', &['\x28', '\u4e00', '\x29']), ('\u3221', &['\x28', '\u4e8c', '\x29']), ('\u3222',
+ &['\x28', '\u4e09', '\x29']), ('\u3223', &['\x28', '\u56db', '\x29']), ('\u3224', &['\x28',
+ '\u4e94', '\x29']), ('\u3225', &['\x28', '\u516d', '\x29']), ('\u3226', &['\x28', '\u4e03',
+ '\x29']), ('\u3227', &['\x28', '\u516b', '\x29']), ('\u3228', &['\x28', '\u4e5d', '\x29']),
+ ('\u3229', &['\x28', '\u5341', '\x29']), ('\u322a', &['\x28', '\u6708', '\x29']), ('\u322b',
+ &['\x28', '\u706b', '\x29']), ('\u322c', &['\x28', '\u6c34', '\x29']), ('\u322d', &['\x28',
+ '\u6728', '\x29']), ('\u322e', &['\x28', '\u91d1', '\x29']), ('\u322f', &['\x28', '\u571f',
+ '\x29']), ('\u3230', &['\x28', '\u65e5', '\x29']), ('\u3231', &['\x28', '\u682a', '\x29']),
+ ('\u3232', &['\x28', '\u6709', '\x29']), ('\u3233', &['\x28', '\u793e', '\x29']), ('\u3234',
+ &['\x28', '\u540d', '\x29']), ('\u3235', &['\x28', '\u7279', '\x29']), ('\u3236', &['\x28',
+ '\u8ca1', '\x29']), ('\u3237', &['\x28', '\u795d', '\x29']), ('\u3238', &['\x28', '\u52b4',
+ '\x29']), ('\u3239', &['\x28', '\u4ee3', '\x29']), ('\u323a', &['\x28', '\u547c', '\x29']),
+ ('\u323b', &['\x28', '\u5b66', '\x29']), ('\u323c', &['\x28', '\u76e3', '\x29']), ('\u323d',
+ &['\x28', '\u4f01', '\x29']), ('\u323e', &['\x28', '\u8cc7', '\x29']), ('\u323f', &['\x28',
+ '\u5354', '\x29']), ('\u3240', &['\x28', '\u796d', '\x29']), ('\u3241', &['\x28', '\u4f11',
+ '\x29']), ('\u3242', &['\x28', '\u81ea', '\x29']), ('\u3243', &['\x28', '\u81f3', '\x29']),
+ ('\u3244', &['\u554f']), ('\u3245', &['\u5e7c']), ('\u3246', &['\u6587']), ('\u3247',
+ &['\u7b8f']), ('\u3250', &['\x50', '\x54', '\x45']), ('\u3251', &['\x32', '\x31']),
+ ('\u3252', &['\x32', '\x32']), ('\u3253', &['\x32', '\x33']), ('\u3254', &['\x32', '\x34']),
+ ('\u3255', &['\x32', '\x35']), ('\u3256', &['\x32', '\x36']), ('\u3257', &['\x32', '\x37']),
+ ('\u3258', &['\x32', '\x38']), ('\u3259', &['\x32', '\x39']), ('\u325a', &['\x33', '\x30']),
+ ('\u325b', &['\x33', '\x31']), ('\u325c', &['\x33', '\x32']), ('\u325d', &['\x33', '\x33']),
+ ('\u325e', &['\x33', '\x34']), ('\u325f', &['\x33', '\x35']), ('\u3260', &['\u1100']),
+ ('\u3261', &['\u1102']), ('\u3262', &['\u1103']), ('\u3263', &['\u1105']), ('\u3264',
+ &['\u1106']), ('\u3265', &['\u1107']), ('\u3266', &['\u1109']), ('\u3267', &['\u110b']),
+ ('\u3268', &['\u110c']), ('\u3269', &['\u110e']), ('\u326a', &['\u110f']), ('\u326b',
+ &['\u1110']), ('\u326c', &['\u1111']), ('\u326d', &['\u1112']), ('\u326e', &['\u1100',
+ '\u1161']), ('\u326f', &['\u1102', '\u1161']), ('\u3270', &['\u1103', '\u1161']), ('\u3271',
+ &['\u1105', '\u1161']), ('\u3272', &['\u1106', '\u1161']), ('\u3273', &['\u1107',
+ '\u1161']), ('\u3274', &['\u1109', '\u1161']), ('\u3275', &['\u110b', '\u1161']), ('\u3276',
+ &['\u110c', '\u1161']), ('\u3277', &['\u110e', '\u1161']), ('\u3278', &['\u110f',
+ '\u1161']), ('\u3279', &['\u1110', '\u1161']), ('\u327a', &['\u1111', '\u1161']), ('\u327b',
+ &['\u1112', '\u1161']), ('\u327c', &['\u110e', '\u1161', '\u11b7', '\u1100', '\u1169']),
+ ('\u327d', &['\u110c', '\u116e', '\u110b', '\u1174']), ('\u327e', &['\u110b', '\u116e']),
+ ('\u3280', &['\u4e00']), ('\u3281', &['\u4e8c']), ('\u3282', &['\u4e09']), ('\u3283',
+ &['\u56db']), ('\u3284', &['\u4e94']), ('\u3285', &['\u516d']), ('\u3286', &['\u4e03']),
+ ('\u3287', &['\u516b']), ('\u3288', &['\u4e5d']), ('\u3289', &['\u5341']), ('\u328a',
+ &['\u6708']), ('\u328b', &['\u706b']), ('\u328c', &['\u6c34']), ('\u328d', &['\u6728']),
+ ('\u328e', &['\u91d1']), ('\u328f', &['\u571f']), ('\u3290', &['\u65e5']), ('\u3291',
+ &['\u682a']), ('\u3292', &['\u6709']), ('\u3293', &['\u793e']), ('\u3294', &['\u540d']),
+ ('\u3295', &['\u7279']), ('\u3296', &['\u8ca1']), ('\u3297', &['\u795d']), ('\u3298',
+ &['\u52b4']), ('\u3299', &['\u79d8']), ('\u329a', &['\u7537']), ('\u329b', &['\u5973']),
+ ('\u329c', &['\u9069']), ('\u329d', &['\u512a']), ('\u329e', &['\u5370']), ('\u329f',
+ &['\u6ce8']), ('\u32a0', &['\u9805']), ('\u32a1', &['\u4f11']), ('\u32a2', &['\u5199']),
+ ('\u32a3', &['\u6b63']), ('\u32a4', &['\u4e0a']), ('\u32a5', &['\u4e2d']), ('\u32a6',
+ &['\u4e0b']), ('\u32a7', &['\u5de6']), ('\u32a8', &['\u53f3']), ('\u32a9', &['\u533b']),
+ ('\u32aa', &['\u5b97']), ('\u32ab', &['\u5b66']), ('\u32ac', &['\u76e3']), ('\u32ad',
+ &['\u4f01']), ('\u32ae', &['\u8cc7']), ('\u32af', &['\u5354']), ('\u32b0', &['\u591c']),
+ ('\u32b1', &['\x33', '\x36']), ('\u32b2', &['\x33', '\x37']), ('\u32b3', &['\x33', '\x38']),
+ ('\u32b4', &['\x33', '\x39']), ('\u32b5', &['\x34', '\x30']), ('\u32b6', &['\x34', '\x31']),
+ ('\u32b7', &['\x34', '\x32']), ('\u32b8', &['\x34', '\x33']), ('\u32b9', &['\x34', '\x34']),
+ ('\u32ba', &['\x34', '\x35']), ('\u32bb', &['\x34', '\x36']), ('\u32bc', &['\x34', '\x37']),
+ ('\u32bd', &['\x34', '\x38']), ('\u32be', &['\x34', '\x39']), ('\u32bf', &['\x35', '\x30']),
+ ('\u32c0', &['\x31', '\u6708']), ('\u32c1', &['\x32', '\u6708']), ('\u32c2', &['\x33',
+ '\u6708']), ('\u32c3', &['\x34', '\u6708']), ('\u32c4', &['\x35', '\u6708']), ('\u32c5',
+ &['\x36', '\u6708']), ('\u32c6', &['\x37', '\u6708']), ('\u32c7', &['\x38', '\u6708']),
+ ('\u32c8', &['\x39', '\u6708']), ('\u32c9', &['\x31', '\x30', '\u6708']), ('\u32ca',
+ &['\x31', '\x31', '\u6708']), ('\u32cb', &['\x31', '\x32', '\u6708']), ('\u32cc', &['\x48',
+ '\x67']), ('\u32cd', &['\x65', '\x72', '\x67']), ('\u32ce', &['\x65', '\x56']), ('\u32cf',
+ &['\x4c', '\x54', '\x44']), ('\u32d0', &['\u30a2']), ('\u32d1', &['\u30a4']), ('\u32d2',
+ &['\u30a6']), ('\u32d3', &['\u30a8']), ('\u32d4', &['\u30aa']), ('\u32d5', &['\u30ab']),
+ ('\u32d6', &['\u30ad']), ('\u32d7', &['\u30af']), ('\u32d8', &['\u30b1']), ('\u32d9',
+ &['\u30b3']), ('\u32da', &['\u30b5']), ('\u32db', &['\u30b7']), ('\u32dc', &['\u30b9']),
+ ('\u32dd', &['\u30bb']), ('\u32de', &['\u30bd']), ('\u32df', &['\u30bf']), ('\u32e0',
+ &['\u30c1']), ('\u32e1', &['\u30c4']), ('\u32e2', &['\u30c6']), ('\u32e3', &['\u30c8']),
+ ('\u32e4', &['\u30ca']), ('\u32e5', &['\u30cb']), ('\u32e6', &['\u30cc']), ('\u32e7',
+ &['\u30cd']), ('\u32e8', &['\u30ce']), ('\u32e9', &['\u30cf']), ('\u32ea', &['\u30d2']),
+ ('\u32eb', &['\u30d5']), ('\u32ec', &['\u30d8']), ('\u32ed', &['\u30db']), ('\u32ee',
+ &['\u30de']), ('\u32ef', &['\u30df']), ('\u32f0', &['\u30e0']), ('\u32f1', &['\u30e1']),
+ ('\u32f2', &['\u30e2']), ('\u32f3', &['\u30e4']), ('\u32f4', &['\u30e6']), ('\u32f5',
+ &['\u30e8']), ('\u32f6', &['\u30e9']), ('\u32f7', &['\u30ea']), ('\u32f8', &['\u30eb']),
+ ('\u32f9', &['\u30ec']), ('\u32fa', &['\u30ed']), ('\u32fb', &['\u30ef']), ('\u32fc',
+ &['\u30f0']), ('\u32fd', &['\u30f1']), ('\u32fe', &['\u30f2']), ('\u3300', &['\u30a2',
+ '\u30d1', '\u30fc', '\u30c8']), ('\u3301', &['\u30a2', '\u30eb', '\u30d5', '\u30a1']),
+ ('\u3302', &['\u30a2', '\u30f3', '\u30da', '\u30a2']), ('\u3303', &['\u30a2', '\u30fc',
+ '\u30eb']), ('\u3304', &['\u30a4', '\u30cb', '\u30f3', '\u30b0']), ('\u3305', &['\u30a4',
+ '\u30f3', '\u30c1']), ('\u3306', &['\u30a6', '\u30a9', '\u30f3']), ('\u3307', &['\u30a8',
+ '\u30b9', '\u30af', '\u30fc', '\u30c9']), ('\u3308', &['\u30a8', '\u30fc', '\u30ab',
+ '\u30fc']), ('\u3309', &['\u30aa', '\u30f3', '\u30b9']), ('\u330a', &['\u30aa', '\u30fc',
+ '\u30e0']), ('\u330b', &['\u30ab', '\u30a4', '\u30ea']), ('\u330c', &['\u30ab', '\u30e9',
+ '\u30c3', '\u30c8']), ('\u330d', &['\u30ab', '\u30ed', '\u30ea', '\u30fc']), ('\u330e',
+ &['\u30ac', '\u30ed', '\u30f3']), ('\u330f', &['\u30ac', '\u30f3', '\u30de']), ('\u3310',
+ &['\u30ae', '\u30ac']), ('\u3311', &['\u30ae', '\u30cb', '\u30fc']), ('\u3312', &['\u30ad',
+ '\u30e5', '\u30ea', '\u30fc']), ('\u3313', &['\u30ae', '\u30eb', '\u30c0', '\u30fc']),
+ ('\u3314', &['\u30ad', '\u30ed']), ('\u3315', &['\u30ad', '\u30ed', '\u30b0', '\u30e9',
+ '\u30e0']), ('\u3316', &['\u30ad', '\u30ed', '\u30e1', '\u30fc', '\u30c8', '\u30eb']),
+ ('\u3317', &['\u30ad', '\u30ed', '\u30ef', '\u30c3', '\u30c8']), ('\u3318', &['\u30b0',
+ '\u30e9', '\u30e0']), ('\u3319', &['\u30b0', '\u30e9', '\u30e0', '\u30c8', '\u30f3']),
+ ('\u331a', &['\u30af', '\u30eb', '\u30bc', '\u30a4', '\u30ed']), ('\u331b', &['\u30af',
+ '\u30ed', '\u30fc', '\u30cd']), ('\u331c', &['\u30b1', '\u30fc', '\u30b9']), ('\u331d',
+ &['\u30b3', '\u30eb', '\u30ca']), ('\u331e', &['\u30b3', '\u30fc', '\u30dd']), ('\u331f',
+ &['\u30b5', '\u30a4', '\u30af', '\u30eb']), ('\u3320', &['\u30b5', '\u30f3', '\u30c1',
+ '\u30fc', '\u30e0']), ('\u3321', &['\u30b7', '\u30ea', '\u30f3', '\u30b0']), ('\u3322',
+ &['\u30bb', '\u30f3', '\u30c1']), ('\u3323', &['\u30bb', '\u30f3', '\u30c8']), ('\u3324',
+ &['\u30c0', '\u30fc', '\u30b9']), ('\u3325', &['\u30c7', '\u30b7']), ('\u3326', &['\u30c9',
+ '\u30eb']), ('\u3327', &['\u30c8', '\u30f3']), ('\u3328', &['\u30ca', '\u30ce']), ('\u3329',
+ &['\u30ce', '\u30c3', '\u30c8']), ('\u332a', &['\u30cf', '\u30a4', '\u30c4']), ('\u332b',
+ &['\u30d1', '\u30fc', '\u30bb', '\u30f3', '\u30c8']), ('\u332c', &['\u30d1', '\u30fc',
+ '\u30c4']), ('\u332d', &['\u30d0', '\u30fc', '\u30ec', '\u30eb']), ('\u332e', &['\u30d4',
+ '\u30a2', '\u30b9', '\u30c8', '\u30eb']), ('\u332f', &['\u30d4', '\u30af', '\u30eb']),
+ ('\u3330', &['\u30d4', '\u30b3']), ('\u3331', &['\u30d3', '\u30eb']), ('\u3332', &['\u30d5',
+ '\u30a1', '\u30e9', '\u30c3', '\u30c9']), ('\u3333', &['\u30d5', '\u30a3', '\u30fc',
+ '\u30c8']), ('\u3334', &['\u30d6', '\u30c3', '\u30b7', '\u30a7', '\u30eb']), ('\u3335',
+ &['\u30d5', '\u30e9', '\u30f3']), ('\u3336', &['\u30d8', '\u30af', '\u30bf', '\u30fc',
+ '\u30eb']), ('\u3337', &['\u30da', '\u30bd']), ('\u3338', &['\u30da', '\u30cb', '\u30d2']),
+ ('\u3339', &['\u30d8', '\u30eb', '\u30c4']), ('\u333a', &['\u30da', '\u30f3', '\u30b9']),
+ ('\u333b', &['\u30da', '\u30fc', '\u30b8']), ('\u333c', &['\u30d9', '\u30fc', '\u30bf']),
+ ('\u333d', &['\u30dd', '\u30a4', '\u30f3', '\u30c8']), ('\u333e', &['\u30dc', '\u30eb',
+ '\u30c8']), ('\u333f', &['\u30db', '\u30f3']), ('\u3340', &['\u30dd', '\u30f3', '\u30c9']),
+ ('\u3341', &['\u30db', '\u30fc', '\u30eb']), ('\u3342', &['\u30db', '\u30fc', '\u30f3']),
+ ('\u3343', &['\u30de', '\u30a4', '\u30af', '\u30ed']), ('\u3344', &['\u30de', '\u30a4',
+ '\u30eb']), ('\u3345', &['\u30de', '\u30c3', '\u30cf']), ('\u3346', &['\u30de', '\u30eb',
+ '\u30af']), ('\u3347', &['\u30de', '\u30f3', '\u30b7', '\u30e7', '\u30f3']), ('\u3348',
+ &['\u30df', '\u30af', '\u30ed', '\u30f3']), ('\u3349', &['\u30df', '\u30ea']), ('\u334a',
+ &['\u30df', '\u30ea', '\u30d0', '\u30fc', '\u30eb']), ('\u334b', &['\u30e1', '\u30ac']),
+ ('\u334c', &['\u30e1', '\u30ac', '\u30c8', '\u30f3']), ('\u334d', &['\u30e1', '\u30fc',
+ '\u30c8', '\u30eb']), ('\u334e', &['\u30e4', '\u30fc', '\u30c9']), ('\u334f', &['\u30e4',
+ '\u30fc', '\u30eb']), ('\u3350', &['\u30e6', '\u30a2', '\u30f3']), ('\u3351', &['\u30ea',
+ '\u30c3', '\u30c8', '\u30eb']), ('\u3352', &['\u30ea', '\u30e9']), ('\u3353', &['\u30eb',
+ '\u30d4', '\u30fc']), ('\u3354', &['\u30eb', '\u30fc', '\u30d6', '\u30eb']), ('\u3355',
+ &['\u30ec', '\u30e0']), ('\u3356', &['\u30ec', '\u30f3', '\u30c8', '\u30b2', '\u30f3']),
+ ('\u3357', &['\u30ef', '\u30c3', '\u30c8']), ('\u3358', &['\x30', '\u70b9']), ('\u3359',
+ &['\x31', '\u70b9']), ('\u335a', &['\x32', '\u70b9']), ('\u335b', &['\x33', '\u70b9']),
+ ('\u335c', &['\x34', '\u70b9']), ('\u335d', &['\x35', '\u70b9']), ('\u335e', &['\x36',
+ '\u70b9']), ('\u335f', &['\x37', '\u70b9']), ('\u3360', &['\x38', '\u70b9']), ('\u3361',
+ &['\x39', '\u70b9']), ('\u3362', &['\x31', '\x30', '\u70b9']), ('\u3363', &['\x31', '\x31',
+ '\u70b9']), ('\u3364', &['\x31', '\x32', '\u70b9']), ('\u3365', &['\x31', '\x33',
+ '\u70b9']), ('\u3366', &['\x31', '\x34', '\u70b9']), ('\u3367', &['\x31', '\x35',
+ '\u70b9']), ('\u3368', &['\x31', '\x36', '\u70b9']), ('\u3369', &['\x31', '\x37',
+ '\u70b9']), ('\u336a', &['\x31', '\x38', '\u70b9']), ('\u336b', &['\x31', '\x39',
+ '\u70b9']), ('\u336c', &['\x32', '\x30', '\u70b9']), ('\u336d', &['\x32', '\x31',
+ '\u70b9']), ('\u336e', &['\x32', '\x32', '\u70b9']), ('\u336f', &['\x32', '\x33',
+ '\u70b9']), ('\u3370', &['\x32', '\x34', '\u70b9']), ('\u3371', &['\x68', '\x50', '\x61']),
+ ('\u3372', &['\x64', '\x61']), ('\u3373', &['\x41', '\x55']), ('\u3374', &['\x62', '\x61',
+ '\x72']), ('\u3375', &['\x6f', '\x56']), ('\u3376', &['\x70', '\x63']), ('\u3377', &['\x64',
+ '\x6d']), ('\u3378', &['\x64', '\x6d', '\xb2']), ('\u3379', &['\x64', '\x6d', '\xb3']),
+ ('\u337a', &['\x49', '\x55']), ('\u337b', &['\u5e73', '\u6210']), ('\u337c', &['\u662d',
+ '\u548c']), ('\u337d', &['\u5927', '\u6b63']), ('\u337e', &['\u660e', '\u6cbb']), ('\u337f',
+ &['\u682a', '\u5f0f', '\u4f1a', '\u793e']), ('\u3380', &['\x70', '\x41']), ('\u3381',
+ &['\x6e', '\x41']), ('\u3382', &['\u03bc', '\x41']), ('\u3383', &['\x6d', '\x41']),
+ ('\u3384', &['\x6b', '\x41']), ('\u3385', &['\x4b', '\x42']), ('\u3386', &['\x4d', '\x42']),
+ ('\u3387', &['\x47', '\x42']), ('\u3388', &['\x63', '\x61', '\x6c']), ('\u3389', &['\x6b',
+ '\x63', '\x61', '\x6c']), ('\u338a', &['\x70', '\x46']), ('\u338b', &['\x6e', '\x46']),
+ ('\u338c', &['\u03bc', '\x46']), ('\u338d', &['\u03bc', '\x67']), ('\u338e', &['\x6d',
+ '\x67']), ('\u338f', &['\x6b', '\x67']), ('\u3390', &['\x48', '\x7a']), ('\u3391', &['\x6b',
+ '\x48', '\x7a']), ('\u3392', &['\x4d', '\x48', '\x7a']), ('\u3393', &['\x47', '\x48',
+ '\x7a']), ('\u3394', &['\x54', '\x48', '\x7a']), ('\u3395', &['\u03bc', '\u2113']),
+ ('\u3396', &['\x6d', '\u2113']), ('\u3397', &['\x64', '\u2113']), ('\u3398', &['\x6b',
+ '\u2113']), ('\u3399', &['\x66', '\x6d']), ('\u339a', &['\x6e', '\x6d']), ('\u339b',
+ &['\u03bc', '\x6d']), ('\u339c', &['\x6d', '\x6d']), ('\u339d', &['\x63', '\x6d']),
+ ('\u339e', &['\x6b', '\x6d']), ('\u339f', &['\x6d', '\x6d', '\xb2']), ('\u33a0', &['\x63',
+ '\x6d', '\xb2']), ('\u33a1', &['\x6d', '\xb2']), ('\u33a2', &['\x6b', '\x6d', '\xb2']),
+ ('\u33a3', &['\x6d', '\x6d', '\xb3']), ('\u33a4', &['\x63', '\x6d', '\xb3']), ('\u33a5',
+ &['\x6d', '\xb3']), ('\u33a6', &['\x6b', '\x6d', '\xb3']), ('\u33a7', &['\x6d', '\u2215',
+ '\x73']), ('\u33a8', &['\x6d', '\u2215', '\x73', '\xb2']), ('\u33a9', &['\x50', '\x61']),
+ ('\u33aa', &['\x6b', '\x50', '\x61']), ('\u33ab', &['\x4d', '\x50', '\x61']), ('\u33ac',
+ &['\x47', '\x50', '\x61']), ('\u33ad', &['\x72', '\x61', '\x64']), ('\u33ae', &['\x72',
+ '\x61', '\x64', '\u2215', '\x73']), ('\u33af', &['\x72', '\x61', '\x64', '\u2215', '\x73',
+ '\xb2']), ('\u33b0', &['\x70', '\x73']), ('\u33b1', &['\x6e', '\x73']), ('\u33b2',
+ &['\u03bc', '\x73']), ('\u33b3', &['\x6d', '\x73']), ('\u33b4', &['\x70', '\x56']),
+ ('\u33b5', &['\x6e', '\x56']), ('\u33b6', &['\u03bc', '\x56']), ('\u33b7', &['\x6d',
+ '\x56']), ('\u33b8', &['\x6b', '\x56']), ('\u33b9', &['\x4d', '\x56']), ('\u33ba', &['\x70',
+ '\x57']), ('\u33bb', &['\x6e', '\x57']), ('\u33bc', &['\u03bc', '\x57']), ('\u33bd',
+ &['\x6d', '\x57']), ('\u33be', &['\x6b', '\x57']), ('\u33bf', &['\x4d', '\x57']), ('\u33c0',
+ &['\x6b', '\u03a9']), ('\u33c1', &['\x4d', '\u03a9']), ('\u33c2', &['\x61', '\x2e', '\x6d',
+ '\x2e']), ('\u33c3', &['\x42', '\x71']), ('\u33c4', &['\x63', '\x63']), ('\u33c5', &['\x63',
+ '\x64']), ('\u33c6', &['\x43', '\u2215', '\x6b', '\x67']), ('\u33c7', &['\x43', '\x6f',
+ '\x2e']), ('\u33c8', &['\x64', '\x42']), ('\u33c9', &['\x47', '\x79']), ('\u33ca', &['\x68',
+ '\x61']), ('\u33cb', &['\x48', '\x50']), ('\u33cc', &['\x69', '\x6e']), ('\u33cd', &['\x4b',
+ '\x4b']), ('\u33ce', &['\x4b', '\x4d']), ('\u33cf', &['\x6b', '\x74']), ('\u33d0', &['\x6c',
+ '\x6d']), ('\u33d1', &['\x6c', '\x6e']), ('\u33d2', &['\x6c', '\x6f', '\x67']), ('\u33d3',
+ &['\x6c', '\x78']), ('\u33d4', &['\x6d', '\x62']), ('\u33d5', &['\x6d', '\x69', '\x6c']),
+ ('\u33d6', &['\x6d', '\x6f', '\x6c']), ('\u33d7', &['\x50', '\x48']), ('\u33d8', &['\x70',
+ '\x2e', '\x6d', '\x2e']), ('\u33d9', &['\x50', '\x50', '\x4d']), ('\u33da', &['\x50',
+ '\x52']), ('\u33db', &['\x73', '\x72']), ('\u33dc', &['\x53', '\x76']), ('\u33dd', &['\x57',
+ '\x62']), ('\u33de', &['\x56', '\u2215', '\x6d']), ('\u33df', &['\x41', '\u2215', '\x6d']),
+ ('\u33e0', &['\x31', '\u65e5']), ('\u33e1', &['\x32', '\u65e5']), ('\u33e2', &['\x33',
+ '\u65e5']), ('\u33e3', &['\x34', '\u65e5']), ('\u33e4', &['\x35', '\u65e5']), ('\u33e5',
+ &['\x36', '\u65e5']), ('\u33e6', &['\x37', '\u65e5']), ('\u33e7', &['\x38', '\u65e5']),
+ ('\u33e8', &['\x39', '\u65e5']), ('\u33e9', &['\x31', '\x30', '\u65e5']), ('\u33ea',
+ &['\x31', '\x31', '\u65e5']), ('\u33eb', &['\x31', '\x32', '\u65e5']), ('\u33ec', &['\x31',
+ '\x33', '\u65e5']), ('\u33ed', &['\x31', '\x34', '\u65e5']), ('\u33ee', &['\x31', '\x35',
+ '\u65e5']), ('\u33ef', &['\x31', '\x36', '\u65e5']), ('\u33f0', &['\x31', '\x37',
+ '\u65e5']), ('\u33f1', &['\x31', '\x38', '\u65e5']), ('\u33f2', &['\x31', '\x39',
+ '\u65e5']), ('\u33f3', &['\x32', '\x30', '\u65e5']), ('\u33f4', &['\x32', '\x31',
+ '\u65e5']), ('\u33f5', &['\x32', '\x32', '\u65e5']), ('\u33f6', &['\x32', '\x33',
+ '\u65e5']), ('\u33f7', &['\x32', '\x34', '\u65e5']), ('\u33f8', &['\x32', '\x35',
+ '\u65e5']), ('\u33f9', &['\x32', '\x36', '\u65e5']), ('\u33fa', &['\x32', '\x37',
+ '\u65e5']), ('\u33fb', &['\x32', '\x38', '\u65e5']), ('\u33fc', &['\x32', '\x39',
+ '\u65e5']), ('\u33fd', &['\x33', '\x30', '\u65e5']), ('\u33fe', &['\x33', '\x31',
+ '\u65e5']), ('\u33ff', &['\x67', '\x61', '\x6c']), ('\ua770', &['\ua76f']), ('\ua7f8',
+ &['\u0126']), ('\ua7f9', &['\u0153']), ('\ufb00', &['\x66', '\x66']), ('\ufb01', &['\x66',
+ '\x69']), ('\ufb02', &['\x66', '\x6c']), ('\ufb03', &['\x66', '\x66', '\x69']), ('\ufb04',
+ &['\x66', '\x66', '\x6c']), ('\ufb05', &['\u017f', '\x74']), ('\ufb06', &['\x73', '\x74']),
+ ('\ufb13', &['\u0574', '\u0576']), ('\ufb14', &['\u0574', '\u0565']), ('\ufb15', &['\u0574',
+ '\u056b']), ('\ufb16', &['\u057e', '\u0576']), ('\ufb17', &['\u0574', '\u056d']), ('\ufb20',
+ &['\u05e2']), ('\ufb21', &['\u05d0']), ('\ufb22', &['\u05d3']), ('\ufb23', &['\u05d4']),
+ ('\ufb24', &['\u05db']), ('\ufb25', &['\u05dc']), ('\ufb26', &['\u05dd']), ('\ufb27',
+ &['\u05e8']), ('\ufb28', &['\u05ea']), ('\ufb29', &['\x2b']), ('\ufb4f', &['\u05d0',
+ '\u05dc']), ('\ufb50', &['\u0671']), ('\ufb51', &['\u0671']), ('\ufb52', &['\u067b']),
+ ('\ufb53', &['\u067b']), ('\ufb54', &['\u067b']), ('\ufb55', &['\u067b']), ('\ufb56',
+ &['\u067e']), ('\ufb57', &['\u067e']), ('\ufb58', &['\u067e']), ('\ufb59', &['\u067e']),
+ ('\ufb5a', &['\u0680']), ('\ufb5b', &['\u0680']), ('\ufb5c', &['\u0680']), ('\ufb5d',
+ &['\u0680']), ('\ufb5e', &['\u067a']), ('\ufb5f', &['\u067a']), ('\ufb60', &['\u067a']),
+ ('\ufb61', &['\u067a']), ('\ufb62', &['\u067f']), ('\ufb63', &['\u067f']), ('\ufb64',
+ &['\u067f']), ('\ufb65', &['\u067f']), ('\ufb66', &['\u0679']), ('\ufb67', &['\u0679']),
+ ('\ufb68', &['\u0679']), ('\ufb69', &['\u0679']), ('\ufb6a', &['\u06a4']), ('\ufb6b',
+ &['\u06a4']), ('\ufb6c', &['\u06a4']), ('\ufb6d', &['\u06a4']), ('\ufb6e', &['\u06a6']),
+ ('\ufb6f', &['\u06a6']), ('\ufb70', &['\u06a6']), ('\ufb71', &['\u06a6']), ('\ufb72',
+ &['\u0684']), ('\ufb73', &['\u0684']), ('\ufb74', &['\u0684']), ('\ufb75', &['\u0684']),
+ ('\ufb76', &['\u0683']), ('\ufb77', &['\u0683']), ('\ufb78', &['\u0683']), ('\ufb79',
+ &['\u0683']), ('\ufb7a', &['\u0686']), ('\ufb7b', &['\u0686']), ('\ufb7c', &['\u0686']),
+ ('\ufb7d', &['\u0686']), ('\ufb7e', &['\u0687']), ('\ufb7f', &['\u0687']), ('\ufb80',
+ &['\u0687']), ('\ufb81', &['\u0687']), ('\ufb82', &['\u068d']), ('\ufb83', &['\u068d']),
+ ('\ufb84', &['\u068c']), ('\ufb85', &['\u068c']), ('\ufb86', &['\u068e']), ('\ufb87',
+ &['\u068e']), ('\ufb88', &['\u0688']), ('\ufb89', &['\u0688']), ('\ufb8a', &['\u0698']),
+ ('\ufb8b', &['\u0698']), ('\ufb8c', &['\u0691']), ('\ufb8d', &['\u0691']), ('\ufb8e',
+ &['\u06a9']), ('\ufb8f', &['\u06a9']), ('\ufb90', &['\u06a9']), ('\ufb91', &['\u06a9']),
+ ('\ufb92', &['\u06af']), ('\ufb93', &['\u06af']), ('\ufb94', &['\u06af']), ('\ufb95',
+ &['\u06af']), ('\ufb96', &['\u06b3']), ('\ufb97', &['\u06b3']), ('\ufb98', &['\u06b3']),
+ ('\ufb99', &['\u06b3']), ('\ufb9a', &['\u06b1']), ('\ufb9b', &['\u06b1']), ('\ufb9c',
+ &['\u06b1']), ('\ufb9d', &['\u06b1']), ('\ufb9e', &['\u06ba']), ('\ufb9f', &['\u06ba']),
+ ('\ufba0', &['\u06bb']), ('\ufba1', &['\u06bb']), ('\ufba2', &['\u06bb']), ('\ufba3',
+ &['\u06bb']), ('\ufba4', &['\u06c0']), ('\ufba5', &['\u06c0']), ('\ufba6', &['\u06c1']),
+ ('\ufba7', &['\u06c1']), ('\ufba8', &['\u06c1']), ('\ufba9', &['\u06c1']), ('\ufbaa',
+ &['\u06be']), ('\ufbab', &['\u06be']), ('\ufbac', &['\u06be']), ('\ufbad', &['\u06be']),
+ ('\ufbae', &['\u06d2']), ('\ufbaf', &['\u06d2']), ('\ufbb0', &['\u06d3']), ('\ufbb1',
+ &['\u06d3']), ('\ufbd3', &['\u06ad']), ('\ufbd4', &['\u06ad']), ('\ufbd5', &['\u06ad']),
+ ('\ufbd6', &['\u06ad']), ('\ufbd7', &['\u06c7']), ('\ufbd8', &['\u06c7']), ('\ufbd9',
+ &['\u06c6']), ('\ufbda', &['\u06c6']), ('\ufbdb', &['\u06c8']), ('\ufbdc', &['\u06c8']),
+ ('\ufbdd', &['\u0677']), ('\ufbde', &['\u06cb']), ('\ufbdf', &['\u06cb']), ('\ufbe0',
+ &['\u06c5']), ('\ufbe1', &['\u06c5']), ('\ufbe2', &['\u06c9']), ('\ufbe3', &['\u06c9']),
+ ('\ufbe4', &['\u06d0']), ('\ufbe5', &['\u06d0']), ('\ufbe6', &['\u06d0']), ('\ufbe7',
+ &['\u06d0']), ('\ufbe8', &['\u0649']), ('\ufbe9', &['\u0649']), ('\ufbea', &['\u0626',
+ '\u0627']), ('\ufbeb', &['\u0626', '\u0627']), ('\ufbec', &['\u0626', '\u06d5']), ('\ufbed',
+ &['\u0626', '\u06d5']), ('\ufbee', &['\u0626', '\u0648']), ('\ufbef', &['\u0626',
+ '\u0648']), ('\ufbf0', &['\u0626', '\u06c7']), ('\ufbf1', &['\u0626', '\u06c7']), ('\ufbf2',
+ &['\u0626', '\u06c6']), ('\ufbf3', &['\u0626', '\u06c6']), ('\ufbf4', &['\u0626',
+ '\u06c8']), ('\ufbf5', &['\u0626', '\u06c8']), ('\ufbf6', &['\u0626', '\u06d0']), ('\ufbf7',
+ &['\u0626', '\u06d0']), ('\ufbf8', &['\u0626', '\u06d0']), ('\ufbf9', &['\u0626',
+ '\u0649']), ('\ufbfa', &['\u0626', '\u0649']), ('\ufbfb', &['\u0626', '\u0649']), ('\ufbfc',
+ &['\u06cc']), ('\ufbfd', &['\u06cc']), ('\ufbfe', &['\u06cc']), ('\ufbff', &['\u06cc']),
+ ('\ufc00', &['\u0626', '\u062c']), ('\ufc01', &['\u0626', '\u062d']), ('\ufc02', &['\u0626',
+ '\u0645']), ('\ufc03', &['\u0626', '\u0649']), ('\ufc04', &['\u0626', '\u064a']), ('\ufc05',
+ &['\u0628', '\u062c']), ('\ufc06', &['\u0628', '\u062d']), ('\ufc07', &['\u0628',
+ '\u062e']), ('\ufc08', &['\u0628', '\u0645']), ('\ufc09', &['\u0628', '\u0649']), ('\ufc0a',
+ &['\u0628', '\u064a']), ('\ufc0b', &['\u062a', '\u062c']), ('\ufc0c', &['\u062a',
+ '\u062d']), ('\ufc0d', &['\u062a', '\u062e']), ('\ufc0e', &['\u062a', '\u0645']), ('\ufc0f',
+ &['\u062a', '\u0649']), ('\ufc10', &['\u062a', '\u064a']), ('\ufc11', &['\u062b',
+ '\u062c']), ('\ufc12', &['\u062b', '\u0645']), ('\ufc13', &['\u062b', '\u0649']), ('\ufc14',
+ &['\u062b', '\u064a']), ('\ufc15', &['\u062c', '\u062d']), ('\ufc16', &['\u062c',
+ '\u0645']), ('\ufc17', &['\u062d', '\u062c']), ('\ufc18', &['\u062d', '\u0645']), ('\ufc19',
+ &['\u062e', '\u062c']), ('\ufc1a', &['\u062e', '\u062d']), ('\ufc1b', &['\u062e',
+ '\u0645']), ('\ufc1c', &['\u0633', '\u062c']), ('\ufc1d', &['\u0633', '\u062d']), ('\ufc1e',
+ &['\u0633', '\u062e']), ('\ufc1f', &['\u0633', '\u0645']), ('\ufc20', &['\u0635',
+ '\u062d']), ('\ufc21', &['\u0635', '\u0645']), ('\ufc22', &['\u0636', '\u062c']), ('\ufc23',
+ &['\u0636', '\u062d']), ('\ufc24', &['\u0636', '\u062e']), ('\ufc25', &['\u0636',
+ '\u0645']), ('\ufc26', &['\u0637', '\u062d']), ('\ufc27', &['\u0637', '\u0645']), ('\ufc28',
+ &['\u0638', '\u0645']), ('\ufc29', &['\u0639', '\u062c']), ('\ufc2a', &['\u0639',
+ '\u0645']), ('\ufc2b', &['\u063a', '\u062c']), ('\ufc2c', &['\u063a', '\u0645']), ('\ufc2d',
+ &['\u0641', '\u062c']), ('\ufc2e', &['\u0641', '\u062d']), ('\ufc2f', &['\u0641',
+ '\u062e']), ('\ufc30', &['\u0641', '\u0645']), ('\ufc31', &['\u0641', '\u0649']), ('\ufc32',
+ &['\u0641', '\u064a']), ('\ufc33', &['\u0642', '\u062d']), ('\ufc34', &['\u0642',
+ '\u0645']), ('\ufc35', &['\u0642', '\u0649']), ('\ufc36', &['\u0642', '\u064a']), ('\ufc37',
+ &['\u0643', '\u0627']), ('\ufc38', &['\u0643', '\u062c']), ('\ufc39', &['\u0643',
+ '\u062d']), ('\ufc3a', &['\u0643', '\u062e']), ('\ufc3b', &['\u0643', '\u0644']), ('\ufc3c',
+ &['\u0643', '\u0645']), ('\ufc3d', &['\u0643', '\u0649']), ('\ufc3e', &['\u0643',
+ '\u064a']), ('\ufc3f', &['\u0644', '\u062c']), ('\ufc40', &['\u0644', '\u062d']), ('\ufc41',
+ &['\u0644', '\u062e']), ('\ufc42', &['\u0644', '\u0645']), ('\ufc43', &['\u0644',
+ '\u0649']), ('\ufc44', &['\u0644', '\u064a']), ('\ufc45', &['\u0645', '\u062c']), ('\ufc46',
+ &['\u0645', '\u062d']), ('\ufc47', &['\u0645', '\u062e']), ('\ufc48', &['\u0645',
+ '\u0645']), ('\ufc49', &['\u0645', '\u0649']), ('\ufc4a', &['\u0645', '\u064a']), ('\ufc4b',
+ &['\u0646', '\u062c']), ('\ufc4c', &['\u0646', '\u062d']), ('\ufc4d', &['\u0646',
+ '\u062e']), ('\ufc4e', &['\u0646', '\u0645']), ('\ufc4f', &['\u0646', '\u0649']), ('\ufc50',
+ &['\u0646', '\u064a']), ('\ufc51', &['\u0647', '\u062c']), ('\ufc52', &['\u0647',
+ '\u0645']), ('\ufc53', &['\u0647', '\u0649']), ('\ufc54', &['\u0647', '\u064a']), ('\ufc55',
+ &['\u064a', '\u062c']), ('\ufc56', &['\u064a', '\u062d']), ('\ufc57', &['\u064a',
+ '\u062e']), ('\ufc58', &['\u064a', '\u0645']), ('\ufc59', &['\u064a', '\u0649']), ('\ufc5a',
+ &['\u064a', '\u064a']), ('\ufc5b', &['\u0630', '\u0670']), ('\ufc5c', &['\u0631',
+ '\u0670']), ('\ufc5d', &['\u0649', '\u0670']), ('\ufc5e', &['\x20', '\u064c', '\u0651']),
+ ('\ufc5f', &['\x20', '\u064d', '\u0651']), ('\ufc60', &['\x20', '\u064e', '\u0651']),
+ ('\ufc61', &['\x20', '\u064f', '\u0651']), ('\ufc62', &['\x20', '\u0650', '\u0651']),
+ ('\ufc63', &['\x20', '\u0651', '\u0670']), ('\ufc64', &['\u0626', '\u0631']), ('\ufc65',
+ &['\u0626', '\u0632']), ('\ufc66', &['\u0626', '\u0645']), ('\ufc67', &['\u0626',
+ '\u0646']), ('\ufc68', &['\u0626', '\u0649']), ('\ufc69', &['\u0626', '\u064a']), ('\ufc6a',
+ &['\u0628', '\u0631']), ('\ufc6b', &['\u0628', '\u0632']), ('\ufc6c', &['\u0628',
+ '\u0645']), ('\ufc6d', &['\u0628', '\u0646']), ('\ufc6e', &['\u0628', '\u0649']), ('\ufc6f',
+ &['\u0628', '\u064a']), ('\ufc70', &['\u062a', '\u0631']), ('\ufc71', &['\u062a',
+ '\u0632']), ('\ufc72', &['\u062a', '\u0645']), ('\ufc73', &['\u062a', '\u0646']), ('\ufc74',
+ &['\u062a', '\u0649']), ('\ufc75', &['\u062a', '\u064a']), ('\ufc76', &['\u062b',
+ '\u0631']), ('\ufc77', &['\u062b', '\u0632']), ('\ufc78', &['\u062b', '\u0645']), ('\ufc79',
+ &['\u062b', '\u0646']), ('\ufc7a', &['\u062b', '\u0649']), ('\ufc7b', &['\u062b',
+ '\u064a']), ('\ufc7c', &['\u0641', '\u0649']), ('\ufc7d', &['\u0641', '\u064a']), ('\ufc7e',
+ &['\u0642', '\u0649']), ('\ufc7f', &['\u0642', '\u064a']), ('\ufc80', &['\u0643',
+ '\u0627']), ('\ufc81', &['\u0643', '\u0644']), ('\ufc82', &['\u0643', '\u0645']), ('\ufc83',
+ &['\u0643', '\u0649']), ('\ufc84', &['\u0643', '\u064a']), ('\ufc85', &['\u0644',
+ '\u0645']), ('\ufc86', &['\u0644', '\u0649']), ('\ufc87', &['\u0644', '\u064a']), ('\ufc88',
+ &['\u0645', '\u0627']), ('\ufc89', &['\u0645', '\u0645']), ('\ufc8a', &['\u0646',
+ '\u0631']), ('\ufc8b', &['\u0646', '\u0632']), ('\ufc8c', &['\u0646', '\u0645']), ('\ufc8d',
+ &['\u0646', '\u0646']), ('\ufc8e', &['\u0646', '\u0649']), ('\ufc8f', &['\u0646',
+ '\u064a']), ('\ufc90', &['\u0649', '\u0670']), ('\ufc91', &['\u064a', '\u0631']), ('\ufc92',
+ &['\u064a', '\u0632']), ('\ufc93', &['\u064a', '\u0645']), ('\ufc94', &['\u064a',
+ '\u0646']), ('\ufc95', &['\u064a', '\u0649']), ('\ufc96', &['\u064a', '\u064a']), ('\ufc97',
+ &['\u0626', '\u062c']), ('\ufc98', &['\u0626', '\u062d']), ('\ufc99', &['\u0626',
+ '\u062e']), ('\ufc9a', &['\u0626', '\u0645']), ('\ufc9b', &['\u0626', '\u0647']), ('\ufc9c',
+ &['\u0628', '\u062c']), ('\ufc9d', &['\u0628', '\u062d']), ('\ufc9e', &['\u0628',
+ '\u062e']), ('\ufc9f', &['\u0628', '\u0645']), ('\ufca0', &['\u0628', '\u0647']), ('\ufca1',
+ &['\u062a', '\u062c']), ('\ufca2', &['\u062a', '\u062d']), ('\ufca3', &['\u062a',
+ '\u062e']), ('\ufca4', &['\u062a', '\u0645']), ('\ufca5', &['\u062a', '\u0647']), ('\ufca6',
+ &['\u062b', '\u0645']), ('\ufca7', &['\u062c', '\u062d']), ('\ufca8', &['\u062c',
+ '\u0645']), ('\ufca9', &['\u062d', '\u062c']), ('\ufcaa', &['\u062d', '\u0645']), ('\ufcab',
+ &['\u062e', '\u062c']), ('\ufcac', &['\u062e', '\u0645']), ('\ufcad', &['\u0633',
+ '\u062c']), ('\ufcae', &['\u0633', '\u062d']), ('\ufcaf', &['\u0633', '\u062e']), ('\ufcb0',
+ &['\u0633', '\u0645']), ('\ufcb1', &['\u0635', '\u062d']), ('\ufcb2', &['\u0635',
+ '\u062e']), ('\ufcb3', &['\u0635', '\u0645']), ('\ufcb4', &['\u0636', '\u062c']), ('\ufcb5',
+ &['\u0636', '\u062d']), ('\ufcb6', &['\u0636', '\u062e']), ('\ufcb7', &['\u0636',
+ '\u0645']), ('\ufcb8', &['\u0637', '\u062d']), ('\ufcb9', &['\u0638', '\u0645']), ('\ufcba',
+ &['\u0639', '\u062c']), ('\ufcbb', &['\u0639', '\u0645']), ('\ufcbc', &['\u063a',
+ '\u062c']), ('\ufcbd', &['\u063a', '\u0645']), ('\ufcbe', &['\u0641', '\u062c']), ('\ufcbf',
+ &['\u0641', '\u062d']), ('\ufcc0', &['\u0641', '\u062e']), ('\ufcc1', &['\u0641',
+ '\u0645']), ('\ufcc2', &['\u0642', '\u062d']), ('\ufcc3', &['\u0642', '\u0645']), ('\ufcc4',
+ &['\u0643', '\u062c']), ('\ufcc5', &['\u0643', '\u062d']), ('\ufcc6', &['\u0643',
+ '\u062e']), ('\ufcc7', &['\u0643', '\u0644']), ('\ufcc8', &['\u0643', '\u0645']), ('\ufcc9',
+ &['\u0644', '\u062c']), ('\ufcca', &['\u0644', '\u062d']), ('\ufccb', &['\u0644',
+ '\u062e']), ('\ufccc', &['\u0644', '\u0645']), ('\ufccd', &['\u0644', '\u0647']), ('\ufcce',
+ &['\u0645', '\u062c']), ('\ufccf', &['\u0645', '\u062d']), ('\ufcd0', &['\u0645',
+ '\u062e']), ('\ufcd1', &['\u0645', '\u0645']), ('\ufcd2', &['\u0646', '\u062c']), ('\ufcd3',
+ &['\u0646', '\u062d']), ('\ufcd4', &['\u0646', '\u062e']), ('\ufcd5', &['\u0646',
+ '\u0645']), ('\ufcd6', &['\u0646', '\u0647']), ('\ufcd7', &['\u0647', '\u062c']), ('\ufcd8',
+ &['\u0647', '\u0645']), ('\ufcd9', &['\u0647', '\u0670']), ('\ufcda', &['\u064a',
+ '\u062c']), ('\ufcdb', &['\u064a', '\u062d']), ('\ufcdc', &['\u064a', '\u062e']), ('\ufcdd',
+ &['\u064a', '\u0645']), ('\ufcde', &['\u064a', '\u0647']), ('\ufcdf', &['\u0626',
+ '\u0645']), ('\ufce0', &['\u0626', '\u0647']), ('\ufce1', &['\u0628', '\u0645']), ('\ufce2',
+ &['\u0628', '\u0647']), ('\ufce3', &['\u062a', '\u0645']), ('\ufce4', &['\u062a',
+ '\u0647']), ('\ufce5', &['\u062b', '\u0645']), ('\ufce6', &['\u062b', '\u0647']), ('\ufce7',
+ &['\u0633', '\u0645']), ('\ufce8', &['\u0633', '\u0647']), ('\ufce9', &['\u0634',
+ '\u0645']), ('\ufcea', &['\u0634', '\u0647']), ('\ufceb', &['\u0643', '\u0644']), ('\ufcec',
+ &['\u0643', '\u0645']), ('\ufced', &['\u0644', '\u0645']), ('\ufcee', &['\u0646',
+ '\u0645']), ('\ufcef', &['\u0646', '\u0647']), ('\ufcf0', &['\u064a', '\u0645']), ('\ufcf1',
+ &['\u064a', '\u0647']), ('\ufcf2', &['\u0640', '\u064e', '\u0651']), ('\ufcf3', &['\u0640',
+ '\u064f', '\u0651']), ('\ufcf4', &['\u0640', '\u0650', '\u0651']), ('\ufcf5', &['\u0637',
+ '\u0649']), ('\ufcf6', &['\u0637', '\u064a']), ('\ufcf7', &['\u0639', '\u0649']), ('\ufcf8',
+ &['\u0639', '\u064a']), ('\ufcf9', &['\u063a', '\u0649']), ('\ufcfa', &['\u063a',
+ '\u064a']), ('\ufcfb', &['\u0633', '\u0649']), ('\ufcfc', &['\u0633', '\u064a']), ('\ufcfd',
+ &['\u0634', '\u0649']), ('\ufcfe', &['\u0634', '\u064a']), ('\ufcff', &['\u062d',
+ '\u0649']), ('\ufd00', &['\u062d', '\u064a']), ('\ufd01', &['\u062c', '\u0649']), ('\ufd02',
+ &['\u062c', '\u064a']), ('\ufd03', &['\u062e', '\u0649']), ('\ufd04', &['\u062e',
+ '\u064a']), ('\ufd05', &['\u0635', '\u0649']), ('\ufd06', &['\u0635', '\u064a']), ('\ufd07',
+ &['\u0636', '\u0649']), ('\ufd08', &['\u0636', '\u064a']), ('\ufd09', &['\u0634',
+ '\u062c']), ('\ufd0a', &['\u0634', '\u062d']), ('\ufd0b', &['\u0634', '\u062e']), ('\ufd0c',
+ &['\u0634', '\u0645']), ('\ufd0d', &['\u0634', '\u0631']), ('\ufd0e', &['\u0633',
+ '\u0631']), ('\ufd0f', &['\u0635', '\u0631']), ('\ufd10', &['\u0636', '\u0631']), ('\ufd11',
+ &['\u0637', '\u0649']), ('\ufd12', &['\u0637', '\u064a']), ('\ufd13', &['\u0639',
+ '\u0649']), ('\ufd14', &['\u0639', '\u064a']), ('\ufd15', &['\u063a', '\u0649']), ('\ufd16',
+ &['\u063a', '\u064a']), ('\ufd17', &['\u0633', '\u0649']), ('\ufd18', &['\u0633',
+ '\u064a']), ('\ufd19', &['\u0634', '\u0649']), ('\ufd1a', &['\u0634', '\u064a']), ('\ufd1b',
+ &['\u062d', '\u0649']), ('\ufd1c', &['\u062d', '\u064a']), ('\ufd1d', &['\u062c',
+ '\u0649']), ('\ufd1e', &['\u062c', '\u064a']), ('\ufd1f', &['\u062e', '\u0649']), ('\ufd20',
+ &['\u062e', '\u064a']), ('\ufd21', &['\u0635', '\u0649']), ('\ufd22', &['\u0635',
+ '\u064a']), ('\ufd23', &['\u0636', '\u0649']), ('\ufd24', &['\u0636', '\u064a']), ('\ufd25',
+ &['\u0634', '\u062c']), ('\ufd26', &['\u0634', '\u062d']), ('\ufd27', &['\u0634',
+ '\u062e']), ('\ufd28', &['\u0634', '\u0645']), ('\ufd29', &['\u0634', '\u0631']), ('\ufd2a',
+ &['\u0633', '\u0631']), ('\ufd2b', &['\u0635', '\u0631']), ('\ufd2c', &['\u0636',
+ '\u0631']), ('\ufd2d', &['\u0634', '\u062c']), ('\ufd2e', &['\u0634', '\u062d']), ('\ufd2f',
+ &['\u0634', '\u062e']), ('\ufd30', &['\u0634', '\u0645']), ('\ufd31', &['\u0633',
+ '\u0647']), ('\ufd32', &['\u0634', '\u0647']), ('\ufd33', &['\u0637', '\u0645']), ('\ufd34',
+ &['\u0633', '\u062c']), ('\ufd35', &['\u0633', '\u062d']), ('\ufd36', &['\u0633',
+ '\u062e']), ('\ufd37', &['\u0634', '\u062c']), ('\ufd38', &['\u0634', '\u062d']), ('\ufd39',
+ &['\u0634', '\u062e']), ('\ufd3a', &['\u0637', '\u0645']), ('\ufd3b', &['\u0638',
+ '\u0645']), ('\ufd3c', &['\u0627', '\u064b']), ('\ufd3d', &['\u0627', '\u064b']), ('\ufd50',
+ &['\u062a', '\u062c', '\u0645']), ('\ufd51', &['\u062a', '\u062d', '\u062c']), ('\ufd52',
+ &['\u062a', '\u062d', '\u062c']), ('\ufd53', &['\u062a', '\u062d', '\u0645']), ('\ufd54',
+ &['\u062a', '\u062e', '\u0645']), ('\ufd55', &['\u062a', '\u0645', '\u062c']), ('\ufd56',
+ &['\u062a', '\u0645', '\u062d']), ('\ufd57', &['\u062a', '\u0645', '\u062e']), ('\ufd58',
+ &['\u062c', '\u0645', '\u062d']), ('\ufd59', &['\u062c', '\u0645', '\u062d']), ('\ufd5a',
+ &['\u062d', '\u0645', '\u064a']), ('\ufd5b', &['\u062d', '\u0645', '\u0649']), ('\ufd5c',
+ &['\u0633', '\u062d', '\u062c']), ('\ufd5d', &['\u0633', '\u062c', '\u062d']), ('\ufd5e',
+ &['\u0633', '\u062c', '\u0649']), ('\ufd5f', &['\u0633', '\u0645', '\u062d']), ('\ufd60',
+ &['\u0633', '\u0645', '\u062d']), ('\ufd61', &['\u0633', '\u0645', '\u062c']), ('\ufd62',
+ &['\u0633', '\u0645', '\u0645']), ('\ufd63', &['\u0633', '\u0645', '\u0645']), ('\ufd64',
+ &['\u0635', '\u062d', '\u062d']), ('\ufd65', &['\u0635', '\u062d', '\u062d']), ('\ufd66',
+ &['\u0635', '\u0645', '\u0645']), ('\ufd67', &['\u0634', '\u062d', '\u0645']), ('\ufd68',
+ &['\u0634', '\u062d', '\u0645']), ('\ufd69', &['\u0634', '\u062c', '\u064a']), ('\ufd6a',
+ &['\u0634', '\u0645', '\u062e']), ('\ufd6b', &['\u0634', '\u0645', '\u062e']), ('\ufd6c',
+ &['\u0634', '\u0645', '\u0645']), ('\ufd6d', &['\u0634', '\u0645', '\u0645']), ('\ufd6e',
+ &['\u0636', '\u062d', '\u0649']), ('\ufd6f', &['\u0636', '\u062e', '\u0645']), ('\ufd70',
+ &['\u0636', '\u062e', '\u0645']), ('\ufd71', &['\u0637', '\u0645', '\u062d']), ('\ufd72',
+ &['\u0637', '\u0645', '\u062d']), ('\ufd73', &['\u0637', '\u0645', '\u0645']), ('\ufd74',
+ &['\u0637', '\u0645', '\u064a']), ('\ufd75', &['\u0639', '\u062c', '\u0645']), ('\ufd76',
+ &['\u0639', '\u0645', '\u0645']), ('\ufd77', &['\u0639', '\u0645', '\u0645']), ('\ufd78',
+ &['\u0639', '\u0645', '\u0649']), ('\ufd79', &['\u063a', '\u0645', '\u0645']), ('\ufd7a',
+ &['\u063a', '\u0645', '\u064a']), ('\ufd7b', &['\u063a', '\u0645', '\u0649']), ('\ufd7c',
+ &['\u0641', '\u062e', '\u0645']), ('\ufd7d', &['\u0641', '\u062e', '\u0645']), ('\ufd7e',
+ &['\u0642', '\u0645', '\u062d']), ('\ufd7f', &['\u0642', '\u0645', '\u0645']), ('\ufd80',
+ &['\u0644', '\u062d', '\u0645']), ('\ufd81', &['\u0644', '\u062d', '\u064a']), ('\ufd82',
+ &['\u0644', '\u062d', '\u0649']), ('\ufd83', &['\u0644', '\u062c', '\u062c']), ('\ufd84',
+ &['\u0644', '\u062c', '\u062c']), ('\ufd85', &['\u0644', '\u062e', '\u0645']), ('\ufd86',
+ &['\u0644', '\u062e', '\u0645']), ('\ufd87', &['\u0644', '\u0645', '\u062d']), ('\ufd88',
+ &['\u0644', '\u0645', '\u062d']), ('\ufd89', &['\u0645', '\u062d', '\u062c']), ('\ufd8a',
+ &['\u0645', '\u062d', '\u0645']), ('\ufd8b', &['\u0645', '\u062d', '\u064a']), ('\ufd8c',
+ &['\u0645', '\u062c', '\u062d']), ('\ufd8d', &['\u0645', '\u062c', '\u0645']), ('\ufd8e',
+ &['\u0645', '\u062e', '\u062c']), ('\ufd8f', &['\u0645', '\u062e', '\u0645']), ('\ufd92',
+ &['\u0645', '\u062c', '\u062e']), ('\ufd93', &['\u0647', '\u0645', '\u062c']), ('\ufd94',
+ &['\u0647', '\u0645', '\u0645']), ('\ufd95', &['\u0646', '\u062d', '\u0645']), ('\ufd96',
+ &['\u0646', '\u062d', '\u0649']), ('\ufd97', &['\u0646', '\u062c', '\u0645']), ('\ufd98',
+ &['\u0646', '\u062c', '\u0645']), ('\ufd99', &['\u0646', '\u062c', '\u0649']), ('\ufd9a',
+ &['\u0646', '\u0645', '\u064a']), ('\ufd9b', &['\u0646', '\u0645', '\u0649']), ('\ufd9c',
+ &['\u064a', '\u0645', '\u0645']), ('\ufd9d', &['\u064a', '\u0645', '\u0645']), ('\ufd9e',
+ &['\u0628', '\u062e', '\u064a']), ('\ufd9f', &['\u062a', '\u062c', '\u064a']), ('\ufda0',
+ &['\u062a', '\u062c', '\u0649']), ('\ufda1', &['\u062a', '\u062e', '\u064a']), ('\ufda2',
+ &['\u062a', '\u062e', '\u0649']), ('\ufda3', &['\u062a', '\u0645', '\u064a']), ('\ufda4',
+ &['\u062a', '\u0645', '\u0649']), ('\ufda5', &['\u062c', '\u0645', '\u064a']), ('\ufda6',
+ &['\u062c', '\u062d', '\u0649']), ('\ufda7', &['\u062c', '\u0645', '\u0649']), ('\ufda8',
+ &['\u0633', '\u062e', '\u0649']), ('\ufda9', &['\u0635', '\u062d', '\u064a']), ('\ufdaa',
+ &['\u0634', '\u062d', '\u064a']), ('\ufdab', &['\u0636', '\u062d', '\u064a']), ('\ufdac',
+ &['\u0644', '\u062c', '\u064a']), ('\ufdad', &['\u0644', '\u0645', '\u064a']), ('\ufdae',
+ &['\u064a', '\u062d', '\u064a']), ('\ufdaf', &['\u064a', '\u062c', '\u064a']), ('\ufdb0',
+ &['\u064a', '\u0645', '\u064a']), ('\ufdb1', &['\u0645', '\u0645', '\u064a']), ('\ufdb2',
+ &['\u0642', '\u0645', '\u064a']), ('\ufdb3', &['\u0646', '\u062d', '\u064a']), ('\ufdb4',
+ &['\u0642', '\u0645', '\u062d']), ('\ufdb5', &['\u0644', '\u062d', '\u0645']), ('\ufdb6',
+ &['\u0639', '\u0645', '\u064a']), ('\ufdb7', &['\u0643', '\u0645', '\u064a']), ('\ufdb8',
+ &['\u0646', '\u062c', '\u062d']), ('\ufdb9', &['\u0645', '\u062e', '\u064a']), ('\ufdba',
+ &['\u0644', '\u062c', '\u0645']), ('\ufdbb', &['\u0643', '\u0645', '\u0645']), ('\ufdbc',
+ &['\u0644', '\u062c', '\u0645']), ('\ufdbd', &['\u0646', '\u062c', '\u062d']), ('\ufdbe',
+ &['\u062c', '\u062d', '\u064a']), ('\ufdbf', &['\u062d', '\u062c', '\u064a']), ('\ufdc0',
+ &['\u0645', '\u062c', '\u064a']), ('\ufdc1', &['\u0641', '\u0645', '\u064a']), ('\ufdc2',
+ &['\u0628', '\u062d', '\u064a']), ('\ufdc3', &['\u0643', '\u0645', '\u0645']), ('\ufdc4',
+ &['\u0639', '\u062c', '\u0645']), ('\ufdc5', &['\u0635', '\u0645', '\u0645']), ('\ufdc6',
+ &['\u0633', '\u062e', '\u064a']), ('\ufdc7', &['\u0646', '\u062c', '\u064a']), ('\ufdf0',
+ &['\u0635', '\u0644', '\u06d2']), ('\ufdf1', &['\u0642', '\u0644', '\u06d2']), ('\ufdf2',
+ &['\u0627', '\u0644', '\u0644', '\u0647']), ('\ufdf3', &['\u0627', '\u0643', '\u0628',
+ '\u0631']), ('\ufdf4', &['\u0645', '\u062d', '\u0645', '\u062f']), ('\ufdf5', &['\u0635',
+ '\u0644', '\u0639', '\u0645']), ('\ufdf6', &['\u0631', '\u0633', '\u0648', '\u0644']),
+ ('\ufdf7', &['\u0639', '\u0644', '\u064a', '\u0647']), ('\ufdf8', &['\u0648', '\u0633',
+ '\u0644', '\u0645']), ('\ufdf9', &['\u0635', '\u0644', '\u0649']), ('\ufdfa', &['\u0635',
+ '\u0644', '\u0649', '\x20', '\u0627', '\u0644', '\u0644', '\u0647', '\x20', '\u0639',
+ '\u0644', '\u064a', '\u0647', '\x20', '\u0648', '\u0633', '\u0644', '\u0645']), ('\ufdfb',
+ &['\u062c', '\u0644', '\x20', '\u062c', '\u0644', '\u0627', '\u0644', '\u0647']), ('\ufdfc',
+ &['\u0631', '\u06cc', '\u0627', '\u0644']), ('\ufe10', &['\x2c']), ('\ufe11', &['\u3001']),
+ ('\ufe12', &['\u3002']), ('\ufe13', &['\x3a']), ('\ufe14', &['\x3b']), ('\ufe15',
+ &['\x21']), ('\ufe16', &['\x3f']), ('\ufe17', &['\u3016']), ('\ufe18', &['\u3017']),
+ ('\ufe19', &['\u2026']), ('\ufe30', &['\u2025']), ('\ufe31', &['\u2014']), ('\ufe32',
+ &['\u2013']), ('\ufe33', &['\x5f']), ('\ufe34', &['\x5f']), ('\ufe35', &['\x28']),
+ ('\ufe36', &['\x29']), ('\ufe37', &['\x7b']), ('\ufe38', &['\x7d']), ('\ufe39',
+ &['\u3014']), ('\ufe3a', &['\u3015']), ('\ufe3b', &['\u3010']), ('\ufe3c', &['\u3011']),
+ ('\ufe3d', &['\u300a']), ('\ufe3e', &['\u300b']), ('\ufe3f', &['\u3008']), ('\ufe40',
+ &['\u3009']), ('\ufe41', &['\u300c']), ('\ufe42', &['\u300d']), ('\ufe43', &['\u300e']),
+ ('\ufe44', &['\u300f']), ('\ufe47', &['\x5b']), ('\ufe48', &['\x5d']), ('\ufe49',
+ &['\u203e']), ('\ufe4a', &['\u203e']), ('\ufe4b', &['\u203e']), ('\ufe4c', &['\u203e']),
+ ('\ufe4d', &['\x5f']), ('\ufe4e', &['\x5f']), ('\ufe4f', &['\x5f']), ('\ufe50', &['\x2c']),
+ ('\ufe51', &['\u3001']), ('\ufe52', &['\x2e']), ('\ufe54', &['\x3b']), ('\ufe55',
+ &['\x3a']), ('\ufe56', &['\x3f']), ('\ufe57', &['\x21']), ('\ufe58', &['\u2014']),
+ ('\ufe59', &['\x28']), ('\ufe5a', &['\x29']), ('\ufe5b', &['\x7b']), ('\ufe5c', &['\x7d']),
+ ('\ufe5d', &['\u3014']), ('\ufe5e', &['\u3015']), ('\ufe5f', &['\x23']), ('\ufe60',
+ &['\x26']), ('\ufe61', &['\x2a']), ('\ufe62', &['\x2b']), ('\ufe63', &['\x2d']), ('\ufe64',
+ &['\x3c']), ('\ufe65', &['\x3e']), ('\ufe66', &['\x3d']), ('\ufe68', &['\x5c']), ('\ufe69',
+ &['\x24']), ('\ufe6a', &['\x25']), ('\ufe6b', &['\x40']), ('\ufe70', &['\x20', '\u064b']),
+ ('\ufe71', &['\u0640', '\u064b']), ('\ufe72', &['\x20', '\u064c']), ('\ufe74', &['\x20',
+ '\u064d']), ('\ufe76', &['\x20', '\u064e']), ('\ufe77', &['\u0640', '\u064e']), ('\ufe78',
+ &['\x20', '\u064f']), ('\ufe79', &['\u0640', '\u064f']), ('\ufe7a', &['\x20', '\u0650']),
+ ('\ufe7b', &['\u0640', '\u0650']), ('\ufe7c', &['\x20', '\u0651']), ('\ufe7d', &['\u0640',
+ '\u0651']), ('\ufe7e', &['\x20', '\u0652']), ('\ufe7f', &['\u0640', '\u0652']), ('\ufe80',
+ &['\u0621']), ('\ufe81', &['\u0622']), ('\ufe82', &['\u0622']), ('\ufe83', &['\u0623']),
+ ('\ufe84', &['\u0623']), ('\ufe85', &['\u0624']), ('\ufe86', &['\u0624']), ('\ufe87',
+ &['\u0625']), ('\ufe88', &['\u0625']), ('\ufe89', &['\u0626']), ('\ufe8a', &['\u0626']),
+ ('\ufe8b', &['\u0626']), ('\ufe8c', &['\u0626']), ('\ufe8d', &['\u0627']), ('\ufe8e',
+ &['\u0627']), ('\ufe8f', &['\u0628']), ('\ufe90', &['\u0628']), ('\ufe91', &['\u0628']),
+ ('\ufe92', &['\u0628']), ('\ufe93', &['\u0629']), ('\ufe94', &['\u0629']), ('\ufe95',
+ &['\u062a']), ('\ufe96', &['\u062a']), ('\ufe97', &['\u062a']), ('\ufe98', &['\u062a']),
+ ('\ufe99', &['\u062b']), ('\ufe9a', &['\u062b']), ('\ufe9b', &['\u062b']), ('\ufe9c',
+ &['\u062b']), ('\ufe9d', &['\u062c']), ('\ufe9e', &['\u062c']), ('\ufe9f', &['\u062c']),
+ ('\ufea0', &['\u062c']), ('\ufea1', &['\u062d']), ('\ufea2', &['\u062d']), ('\ufea3',
+ &['\u062d']), ('\ufea4', &['\u062d']), ('\ufea5', &['\u062e']), ('\ufea6', &['\u062e']),
+ ('\ufea7', &['\u062e']), ('\ufea8', &['\u062e']), ('\ufea9', &['\u062f']), ('\ufeaa',
+ &['\u062f']), ('\ufeab', &['\u0630']), ('\ufeac', &['\u0630']), ('\ufead', &['\u0631']),
+ ('\ufeae', &['\u0631']), ('\ufeaf', &['\u0632']), ('\ufeb0', &['\u0632']), ('\ufeb1',
+ &['\u0633']), ('\ufeb2', &['\u0633']), ('\ufeb3', &['\u0633']), ('\ufeb4', &['\u0633']),
+ ('\ufeb5', &['\u0634']), ('\ufeb6', &['\u0634']), ('\ufeb7', &['\u0634']), ('\ufeb8',
+ &['\u0634']), ('\ufeb9', &['\u0635']), ('\ufeba', &['\u0635']), ('\ufebb', &['\u0635']),
+ ('\ufebc', &['\u0635']), ('\ufebd', &['\u0636']), ('\ufebe', &['\u0636']), ('\ufebf',
+ &['\u0636']), ('\ufec0', &['\u0636']), ('\ufec1', &['\u0637']), ('\ufec2', &['\u0637']),
+ ('\ufec3', &['\u0637']), ('\ufec4', &['\u0637']), ('\ufec5', &['\u0638']), ('\ufec6',
+ &['\u0638']), ('\ufec7', &['\u0638']), ('\ufec8', &['\u0638']), ('\ufec9', &['\u0639']),
+ ('\ufeca', &['\u0639']), ('\ufecb', &['\u0639']), ('\ufecc', &['\u0639']), ('\ufecd',
+ &['\u063a']), ('\ufece', &['\u063a']), ('\ufecf', &['\u063a']), ('\ufed0', &['\u063a']),
+ ('\ufed1', &['\u0641']), ('\ufed2', &['\u0641']), ('\ufed3', &['\u0641']), ('\ufed4',
+ &['\u0641']), ('\ufed5', &['\u0642']), ('\ufed6', &['\u0642']), ('\ufed7', &['\u0642']),
+ ('\ufed8', &['\u0642']), ('\ufed9', &['\u0643']), ('\ufeda', &['\u0643']), ('\ufedb',
+ &['\u0643']), ('\ufedc', &['\u0643']), ('\ufedd', &['\u0644']), ('\ufede', &['\u0644']),
+ ('\ufedf', &['\u0644']), ('\ufee0', &['\u0644']), ('\ufee1', &['\u0645']), ('\ufee2',
+ &['\u0645']), ('\ufee3', &['\u0645']), ('\ufee4', &['\u0645']), ('\ufee5', &['\u0646']),
+ ('\ufee6', &['\u0646']), ('\ufee7', &['\u0646']), ('\ufee8', &['\u0646']), ('\ufee9',
+ &['\u0647']), ('\ufeea', &['\u0647']), ('\ufeeb', &['\u0647']), ('\ufeec', &['\u0647']),
+ ('\ufeed', &['\u0648']), ('\ufeee', &['\u0648']), ('\ufeef', &['\u0649']), ('\ufef0',
+ &['\u0649']), ('\ufef1', &['\u064a']), ('\ufef2', &['\u064a']), ('\ufef3', &['\u064a']),
+ ('\ufef4', &['\u064a']), ('\ufef5', &['\u0644', '\u0622']), ('\ufef6', &['\u0644',
+ '\u0622']), ('\ufef7', &['\u0644', '\u0623']), ('\ufef8', &['\u0644', '\u0623']), ('\ufef9',
+ &['\u0644', '\u0625']), ('\ufefa', &['\u0644', '\u0625']), ('\ufefb', &['\u0644',
+ '\u0627']), ('\ufefc', &['\u0644', '\u0627']), ('\uff01', &['\x21']), ('\uff02', &['\x22']),
+ ('\uff03', &['\x23']), ('\uff04', &['\x24']), ('\uff05', &['\x25']), ('\uff06', &['\x26']),
+ ('\uff07', &['\x27']), ('\uff08', &['\x28']), ('\uff09', &['\x29']), ('\uff0a', &['\x2a']),
+ ('\uff0b', &['\x2b']), ('\uff0c', &['\x2c']), ('\uff0d', &['\x2d']), ('\uff0e', &['\x2e']),
+ ('\uff0f', &['\x2f']), ('\uff10', &['\x30']), ('\uff11', &['\x31']), ('\uff12', &['\x32']),
+ ('\uff13', &['\x33']), ('\uff14', &['\x34']), ('\uff15', &['\x35']), ('\uff16', &['\x36']),
+ ('\uff17', &['\x37']), ('\uff18', &['\x38']), ('\uff19', &['\x39']), ('\uff1a', &['\x3a']),
+ ('\uff1b', &['\x3b']), ('\uff1c', &['\x3c']), ('\uff1d', &['\x3d']), ('\uff1e', &['\x3e']),
+ ('\uff1f', &['\x3f']), ('\uff20', &['\x40']), ('\uff21', &['\x41']), ('\uff22', &['\x42']),
+ ('\uff23', &['\x43']), ('\uff24', &['\x44']), ('\uff25', &['\x45']), ('\uff26', &['\x46']),
+ ('\uff27', &['\x47']), ('\uff28', &['\x48']), ('\uff29', &['\x49']), ('\uff2a', &['\x4a']),
+ ('\uff2b', &['\x4b']), ('\uff2c', &['\x4c']), ('\uff2d', &['\x4d']), ('\uff2e', &['\x4e']),
+ ('\uff2f', &['\x4f']), ('\uff30', &['\x50']), ('\uff31', &['\x51']), ('\uff32', &['\x52']),
+ ('\uff33', &['\x53']), ('\uff34', &['\x54']), ('\uff35', &['\x55']), ('\uff36', &['\x56']),
+ ('\uff37', &['\x57']), ('\uff38', &['\x58']), ('\uff39', &['\x59']), ('\uff3a', &['\x5a']),
+ ('\uff3b', &['\x5b']), ('\uff3c', &['\x5c']), ('\uff3d', &['\x5d']), ('\uff3e', &['\x5e']),
+ ('\uff3f', &['\x5f']), ('\uff40', &['\x60']), ('\uff41', &['\x61']), ('\uff42', &['\x62']),
+ ('\uff43', &['\x63']), ('\uff44', &['\x64']), ('\uff45', &['\x65']), ('\uff46', &['\x66']),
+ ('\uff47', &['\x67']), ('\uff48', &['\x68']), ('\uff49', &['\x69']), ('\uff4a', &['\x6a']),
+ ('\uff4b', &['\x6b']), ('\uff4c', &['\x6c']), ('\uff4d', &['\x6d']), ('\uff4e', &['\x6e']),
+ ('\uff4f', &['\x6f']), ('\uff50', &['\x70']), ('\uff51', &['\x71']), ('\uff52', &['\x72']),
+ ('\uff53', &['\x73']), ('\uff54', &['\x74']), ('\uff55', &['\x75']), ('\uff56', &['\x76']),
+ ('\uff57', &['\x77']), ('\uff58', &['\x78']), ('\uff59', &['\x79']), ('\uff5a', &['\x7a']),
+ ('\uff5b', &['\x7b']), ('\uff5c', &['\x7c']), ('\uff5d', &['\x7d']), ('\uff5e', &['\x7e']),
+ ('\uff5f', &['\u2985']), ('\uff60', &['\u2986']), ('\uff61', &['\u3002']), ('\uff62',
+ &['\u300c']), ('\uff63', &['\u300d']), ('\uff64', &['\u3001']), ('\uff65', &['\u30fb']),
+ ('\uff66', &['\u30f2']), ('\uff67', &['\u30a1']), ('\uff68', &['\u30a3']), ('\uff69',
+ &['\u30a5']), ('\uff6a', &['\u30a7']), ('\uff6b', &['\u30a9']), ('\uff6c', &['\u30e3']),
+ ('\uff6d', &['\u30e5']), ('\uff6e', &['\u30e7']), ('\uff6f', &['\u30c3']), ('\uff70',
+ &['\u30fc']), ('\uff71', &['\u30a2']), ('\uff72', &['\u30a4']), ('\uff73', &['\u30a6']),
+ ('\uff74', &['\u30a8']), ('\uff75', &['\u30aa']), ('\uff76', &['\u30ab']), ('\uff77',
+ &['\u30ad']), ('\uff78', &['\u30af']), ('\uff79', &['\u30b1']), ('\uff7a', &['\u30b3']),
+ ('\uff7b', &['\u30b5']), ('\uff7c', &['\u30b7']), ('\uff7d', &['\u30b9']), ('\uff7e',
+ &['\u30bb']), ('\uff7f', &['\u30bd']), ('\uff80', &['\u30bf']), ('\uff81', &['\u30c1']),
+ ('\uff82', &['\u30c4']), ('\uff83', &['\u30c6']), ('\uff84', &['\u30c8']), ('\uff85',
+ &['\u30ca']), ('\uff86', &['\u30cb']), ('\uff87', &['\u30cc']), ('\uff88', &['\u30cd']),
+ ('\uff89', &['\u30ce']), ('\uff8a', &['\u30cf']), ('\uff8b', &['\u30d2']), ('\uff8c',
+ &['\u30d5']), ('\uff8d', &['\u30d8']), ('\uff8e', &['\u30db']), ('\uff8f', &['\u30de']),
+ ('\uff90', &['\u30df']), ('\uff91', &['\u30e0']), ('\uff92', &['\u30e1']), ('\uff93',
+ &['\u30e2']), ('\uff94', &['\u30e4']), ('\uff95', &['\u30e6']), ('\uff96', &['\u30e8']),
+ ('\uff97', &['\u30e9']), ('\uff98', &['\u30ea']), ('\uff99', &['\u30eb']), ('\uff9a',
+ &['\u30ec']), ('\uff9b', &['\u30ed']), ('\uff9c', &['\u30ef']), ('\uff9d', &['\u30f3']),
+ ('\uff9e', &['\u3099']), ('\uff9f', &['\u309a']), ('\uffa0', &['\u3164']), ('\uffa1',
+ &['\u3131']), ('\uffa2', &['\u3132']), ('\uffa3', &['\u3133']), ('\uffa4', &['\u3134']),
+ ('\uffa5', &['\u3135']), ('\uffa6', &['\u3136']), ('\uffa7', &['\u3137']), ('\uffa8',
+ &['\u3138']), ('\uffa9', &['\u3139']), ('\uffaa', &['\u313a']), ('\uffab', &['\u313b']),
+ ('\uffac', &['\u313c']), ('\uffad', &['\u313d']), ('\uffae', &['\u313e']), ('\uffaf',
+ &['\u313f']), ('\uffb0', &['\u3140']), ('\uffb1', &['\u3141']), ('\uffb2', &['\u3142']),
+ ('\uffb3', &['\u3143']), ('\uffb4', &['\u3144']), ('\uffb5', &['\u3145']), ('\uffb6',
+ &['\u3146']), ('\uffb7', &['\u3147']), ('\uffb8', &['\u3148']), ('\uffb9', &['\u3149']),
+ ('\uffba', &['\u314a']), ('\uffbb', &['\u314b']), ('\uffbc', &['\u314c']), ('\uffbd',
+ &['\u314d']), ('\uffbe', &['\u314e']), ('\uffc2', &['\u314f']), ('\uffc3', &['\u3150']),
+ ('\uffc4', &['\u3151']), ('\uffc5', &['\u3152']), ('\uffc6', &['\u3153']), ('\uffc7',
+ &['\u3154']), ('\uffca', &['\u3155']), ('\uffcb', &['\u3156']), ('\uffcc', &['\u3157']),
+ ('\uffcd', &['\u3158']), ('\uffce', &['\u3159']), ('\uffcf', &['\u315a']), ('\uffd2',
+ &['\u315b']), ('\uffd3', &['\u315c']), ('\uffd4', &['\u315d']), ('\uffd5', &['\u315e']),
+ ('\uffd6', &['\u315f']), ('\uffd7', &['\u3160']), ('\uffda', &['\u3161']), ('\uffdb',
+ &['\u3162']), ('\uffdc', &['\u3163']), ('\uffe0', &['\xa2']), ('\uffe1', &['\xa3']),
+ ('\uffe2', &['\xac']), ('\uffe3', &['\xaf']), ('\uffe4', &['\xa6']), ('\uffe5', &['\xa5']),
+ ('\uffe6', &['\u20a9']), ('\uffe8', &['\u2502']), ('\uffe9', &['\u2190']), ('\uffea',
+ &['\u2191']), ('\uffeb', &['\u2192']), ('\uffec', &['\u2193']), ('\uffed', &['\u25a0']),
+ ('\uffee', &['\u25cb']), ('\U0001d400', &['\x41']), ('\U0001d401', &['\x42']),
+ ('\U0001d402', &['\x43']), ('\U0001d403', &['\x44']), ('\U0001d404', &['\x45']),
+ ('\U0001d405', &['\x46']), ('\U0001d406', &['\x47']), ('\U0001d407', &['\x48']),
+ ('\U0001d408', &['\x49']), ('\U0001d409', &['\x4a']), ('\U0001d40a', &['\x4b']),
+ ('\U0001d40b', &['\x4c']), ('\U0001d40c', &['\x4d']), ('\U0001d40d', &['\x4e']),
+ ('\U0001d40e', &['\x4f']), ('\U0001d40f', &['\x50']), ('\U0001d410', &['\x51']),
+ ('\U0001d411', &['\x52']), ('\U0001d412', &['\x53']), ('\U0001d413', &['\x54']),
+ ('\U0001d414', &['\x55']), ('\U0001d415', &['\x56']), ('\U0001d416', &['\x57']),
+ ('\U0001d417', &['\x58']), ('\U0001d418', &['\x59']), ('\U0001d419', &['\x5a']),
+ ('\U0001d41a', &['\x61']), ('\U0001d41b', &['\x62']), ('\U0001d41c', &['\x63']),
+ ('\U0001d41d', &['\x64']), ('\U0001d41e', &['\x65']), ('\U0001d41f', &['\x66']),
+ ('\U0001d420', &['\x67']), ('\U0001d421', &['\x68']), ('\U0001d422', &['\x69']),
+ ('\U0001d423', &['\x6a']), ('\U0001d424', &['\x6b']), ('\U0001d425', &['\x6c']),
+ ('\U0001d426', &['\x6d']), ('\U0001d427', &['\x6e']), ('\U0001d428', &['\x6f']),
+ ('\U0001d429', &['\x70']), ('\U0001d42a', &['\x71']), ('\U0001d42b', &['\x72']),
+ ('\U0001d42c', &['\x73']), ('\U0001d42d', &['\x74']), ('\U0001d42e', &['\x75']),
+ ('\U0001d42f', &['\x76']), ('\U0001d430', &['\x77']), ('\U0001d431', &['\x78']),
+ ('\U0001d432', &['\x79']), ('\U0001d433', &['\x7a']), ('\U0001d434', &['\x41']),
+ ('\U0001d435', &['\x42']), ('\U0001d436', &['\x43']), ('\U0001d437', &['\x44']),
+ ('\U0001d438', &['\x45']), ('\U0001d439', &['\x46']), ('\U0001d43a', &['\x47']),
+ ('\U0001d43b', &['\x48']), ('\U0001d43c', &['\x49']), ('\U0001d43d', &['\x4a']),
+ ('\U0001d43e', &['\x4b']), ('\U0001d43f', &['\x4c']), ('\U0001d440', &['\x4d']),
+ ('\U0001d441', &['\x4e']), ('\U0001d442', &['\x4f']), ('\U0001d443', &['\x50']),
+ ('\U0001d444', &['\x51']), ('\U0001d445', &['\x52']), ('\U0001d446', &['\x53']),
+ ('\U0001d447', &['\x54']), ('\U0001d448', &['\x55']), ('\U0001d449', &['\x56']),
+ ('\U0001d44a', &['\x57']), ('\U0001d44b', &['\x58']), ('\U0001d44c', &['\x59']),
+ ('\U0001d44d', &['\x5a']), ('\U0001d44e', &['\x61']), ('\U0001d44f', &['\x62']),
+ ('\U0001d450', &['\x63']), ('\U0001d451', &['\x64']), ('\U0001d452', &['\x65']),
+ ('\U0001d453', &['\x66']), ('\U0001d454', &['\x67']), ('\U0001d456', &['\x69']),
+ ('\U0001d457', &['\x6a']), ('\U0001d458', &['\x6b']), ('\U0001d459', &['\x6c']),
+ ('\U0001d45a', &['\x6d']), ('\U0001d45b', &['\x6e']), ('\U0001d45c', &['\x6f']),
+ ('\U0001d45d', &['\x70']), ('\U0001d45e', &['\x71']), ('\U0001d45f', &['\x72']),
+ ('\U0001d460', &['\x73']), ('\U0001d461', &['\x74']), ('\U0001d462', &['\x75']),
+ ('\U0001d463', &['\x76']), ('\U0001d464', &['\x77']), ('\U0001d465', &['\x78']),
+ ('\U0001d466', &['\x79']), ('\U0001d467', &['\x7a']), ('\U0001d468', &['\x41']),
+ ('\U0001d469', &['\x42']), ('\U0001d46a', &['\x43']), ('\U0001d46b', &['\x44']),
+ ('\U0001d46c', &['\x45']), ('\U0001d46d', &['\x46']), ('\U0001d46e', &['\x47']),
+ ('\U0001d46f', &['\x48']), ('\U0001d470', &['\x49']), ('\U0001d471', &['\x4a']),
+ ('\U0001d472', &['\x4b']), ('\U0001d473', &['\x4c']), ('\U0001d474', &['\x4d']),
+ ('\U0001d475', &['\x4e']), ('\U0001d476', &['\x4f']), ('\U0001d477', &['\x50']),
+ ('\U0001d478', &['\x51']), ('\U0001d479', &['\x52']), ('\U0001d47a', &['\x53']),
+ ('\U0001d47b', &['\x54']), ('\U0001d47c', &['\x55']), ('\U0001d47d', &['\x56']),
+ ('\U0001d47e', &['\x57']), ('\U0001d47f', &['\x58']), ('\U0001d480', &['\x59']),
+ ('\U0001d481', &['\x5a']), ('\U0001d482', &['\x61']), ('\U0001d483', &['\x62']),
+ ('\U0001d484', &['\x63']), ('\U0001d485', &['\x64']), ('\U0001d486', &['\x65']),
+ ('\U0001d487', &['\x66']), ('\U0001d488', &['\x67']), ('\U0001d489', &['\x68']),
+ ('\U0001d48a', &['\x69']), ('\U0001d48b', &['\x6a']), ('\U0001d48c', &['\x6b']),
+ ('\U0001d48d', &['\x6c']), ('\U0001d48e', &['\x6d']), ('\U0001d48f', &['\x6e']),
+ ('\U0001d490', &['\x6f']), ('\U0001d491', &['\x70']), ('\U0001d492', &['\x71']),
+ ('\U0001d493', &['\x72']), ('\U0001d494', &['\x73']), ('\U0001d495', &['\x74']),
+ ('\U0001d496', &['\x75']), ('\U0001d497', &['\x76']), ('\U0001d498', &['\x77']),
+ ('\U0001d499', &['\x78']), ('\U0001d49a', &['\x79']), ('\U0001d49b', &['\x7a']),
+ ('\U0001d49c', &['\x41']), ('\U0001d49e', &['\x43']), ('\U0001d49f', &['\x44']),
+ ('\U0001d4a2', &['\x47']), ('\U0001d4a5', &['\x4a']), ('\U0001d4a6', &['\x4b']),
+ ('\U0001d4a9', &['\x4e']), ('\U0001d4aa', &['\x4f']), ('\U0001d4ab', &['\x50']),
+ ('\U0001d4ac', &['\x51']), ('\U0001d4ae', &['\x53']), ('\U0001d4af', &['\x54']),
+ ('\U0001d4b0', &['\x55']), ('\U0001d4b1', &['\x56']), ('\U0001d4b2', &['\x57']),
+ ('\U0001d4b3', &['\x58']), ('\U0001d4b4', &['\x59']), ('\U0001d4b5', &['\x5a']),
+ ('\U0001d4b6', &['\x61']), ('\U0001d4b7', &['\x62']), ('\U0001d4b8', &['\x63']),
+ ('\U0001d4b9', &['\x64']), ('\U0001d4bb', &['\x66']), ('\U0001d4bd', &['\x68']),
+ ('\U0001d4be', &['\x69']), ('\U0001d4bf', &['\x6a']), ('\U0001d4c0', &['\x6b']),
+ ('\U0001d4c1', &['\x6c']), ('\U0001d4c2', &['\x6d']), ('\U0001d4c3', &['\x6e']),
+ ('\U0001d4c5', &['\x70']), ('\U0001d4c6', &['\x71']), ('\U0001d4c7', &['\x72']),
+ ('\U0001d4c8', &['\x73']), ('\U0001d4c9', &['\x74']), ('\U0001d4ca', &['\x75']),
+ ('\U0001d4cb', &['\x76']), ('\U0001d4cc', &['\x77']), ('\U0001d4cd', &['\x78']),
+ ('\U0001d4ce', &['\x79']), ('\U0001d4cf', &['\x7a']), ('\U0001d4d0', &['\x41']),
+ ('\U0001d4d1', &['\x42']), ('\U0001d4d2', &['\x43']), ('\U0001d4d3', &['\x44']),
+ ('\U0001d4d4', &['\x45']), ('\U0001d4d5', &['\x46']), ('\U0001d4d6', &['\x47']),
+ ('\U0001d4d7', &['\x48']), ('\U0001d4d8', &['\x49']), ('\U0001d4d9', &['\x4a']),
+ ('\U0001d4da', &['\x4b']), ('\U0001d4db', &['\x4c']), ('\U0001d4dc', &['\x4d']),
+ ('\U0001d4dd', &['\x4e']), ('\U0001d4de', &['\x4f']), ('\U0001d4df', &['\x50']),
+ ('\U0001d4e0', &['\x51']), ('\U0001d4e1', &['\x52']), ('\U0001d4e2', &['\x53']),
+ ('\U0001d4e3', &['\x54']), ('\U0001d4e4', &['\x55']), ('\U0001d4e5', &['\x56']),
+ ('\U0001d4e6', &['\x57']), ('\U0001d4e7', &['\x58']), ('\U0001d4e8', &['\x59']),
+ ('\U0001d4e9', &['\x5a']), ('\U0001d4ea', &['\x61']), ('\U0001d4eb', &['\x62']),
+ ('\U0001d4ec', &['\x63']), ('\U0001d4ed', &['\x64']), ('\U0001d4ee', &['\x65']),
+ ('\U0001d4ef', &['\x66']), ('\U0001d4f0', &['\x67']), ('\U0001d4f1', &['\x68']),
+ ('\U0001d4f2', &['\x69']), ('\U0001d4f3', &['\x6a']), ('\U0001d4f4', &['\x6b']),
+ ('\U0001d4f5', &['\x6c']), ('\U0001d4f6', &['\x6d']), ('\U0001d4f7', &['\x6e']),
+ ('\U0001d4f8', &['\x6f']), ('\U0001d4f9', &['\x70']), ('\U0001d4fa', &['\x71']),
+ ('\U0001d4fb', &['\x72']), ('\U0001d4fc', &['\x73']), ('\U0001d4fd', &['\x74']),
+ ('\U0001d4fe', &['\x75']), ('\U0001d4ff', &['\x76']), ('\U0001d500', &['\x77']),
+ ('\U0001d501', &['\x78']), ('\U0001d502', &['\x79']), ('\U0001d503', &['\x7a']),
+ ('\U0001d504', &['\x41']), ('\U0001d505', &['\x42']), ('\U0001d507', &['\x44']),
+ ('\U0001d508', &['\x45']), ('\U0001d509', &['\x46']), ('\U0001d50a', &['\x47']),
+ ('\U0001d50d', &['\x4a']), ('\U0001d50e', &['\x4b']), ('\U0001d50f', &['\x4c']),
+ ('\U0001d510', &['\x4d']), ('\U0001d511', &['\x4e']), ('\U0001d512', &['\x4f']),
+ ('\U0001d513', &['\x50']), ('\U0001d514', &['\x51']), ('\U0001d516', &['\x53']),
+ ('\U0001d517', &['\x54']), ('\U0001d518', &['\x55']), ('\U0001d519', &['\x56']),
+ ('\U0001d51a', &['\x57']), ('\U0001d51b', &['\x58']), ('\U0001d51c', &['\x59']),
+ ('\U0001d51e', &['\x61']), ('\U0001d51f', &['\x62']), ('\U0001d520', &['\x63']),
+ ('\U0001d521', &['\x64']), ('\U0001d522', &['\x65']), ('\U0001d523', &['\x66']),
+ ('\U0001d524', &['\x67']), ('\U0001d525', &['\x68']), ('\U0001d526', &['\x69']),
+ ('\U0001d527', &['\x6a']), ('\U0001d528', &['\x6b']), ('\U0001d529', &['\x6c']),
+ ('\U0001d52a', &['\x6d']), ('\U0001d52b', &['\x6e']), ('\U0001d52c', &['\x6f']),
+ ('\U0001d52d', &['\x70']), ('\U0001d52e', &['\x71']), ('\U0001d52f', &['\x72']),
+ ('\U0001d530', &['\x73']), ('\U0001d531', &['\x74']), ('\U0001d532', &['\x75']),
+ ('\U0001d533', &['\x76']), ('\U0001d534', &['\x77']), ('\U0001d535', &['\x78']),
+ ('\U0001d536', &['\x79']), ('\U0001d537', &['\x7a']), ('\U0001d538', &['\x41']),
+ ('\U0001d539', &['\x42']), ('\U0001d53b', &['\x44']), ('\U0001d53c', &['\x45']),
+ ('\U0001d53d', &['\x46']), ('\U0001d53e', &['\x47']), ('\U0001d540', &['\x49']),
+ ('\U0001d541', &['\x4a']), ('\U0001d542', &['\x4b']), ('\U0001d543', &['\x4c']),
+ ('\U0001d544', &['\x4d']), ('\U0001d546', &['\x4f']), ('\U0001d54a', &['\x53']),
+ ('\U0001d54b', &['\x54']), ('\U0001d54c', &['\x55']), ('\U0001d54d', &['\x56']),
+ ('\U0001d54e', &['\x57']), ('\U0001d54f', &['\x58']), ('\U0001d550', &['\x59']),
+ ('\U0001d552', &['\x61']), ('\U0001d553', &['\x62']), ('\U0001d554', &['\x63']),
+ ('\U0001d555', &['\x64']), ('\U0001d556', &['\x65']), ('\U0001d557', &['\x66']),
+ ('\U0001d558', &['\x67']), ('\U0001d559', &['\x68']), ('\U0001d55a', &['\x69']),
+ ('\U0001d55b', &['\x6a']), ('\U0001d55c', &['\x6b']), ('\U0001d55d', &['\x6c']),
+ ('\U0001d55e', &['\x6d']), ('\U0001d55f', &['\x6e']), ('\U0001d560', &['\x6f']),
+ ('\U0001d561', &['\x70']), ('\U0001d562', &['\x71']), ('\U0001d563', &['\x72']),
+ ('\U0001d564', &['\x73']), ('\U0001d565', &['\x74']), ('\U0001d566', &['\x75']),
+ ('\U0001d567', &['\x76']), ('\U0001d568', &['\x77']), ('\U0001d569', &['\x78']),
+ ('\U0001d56a', &['\x79']), ('\U0001d56b', &['\x7a']), ('\U0001d56c', &['\x41']),
+ ('\U0001d56d', &['\x42']), ('\U0001d56e', &['\x43']), ('\U0001d56f', &['\x44']),
+ ('\U0001d570', &['\x45']), ('\U0001d571', &['\x46']), ('\U0001d572', &['\x47']),
+ ('\U0001d573', &['\x48']), ('\U0001d574', &['\x49']), ('\U0001d575', &['\x4a']),
+ ('\U0001d576', &['\x4b']), ('\U0001d577', &['\x4c']), ('\U0001d578', &['\x4d']),
+ ('\U0001d579', &['\x4e']), ('\U0001d57a', &['\x4f']), ('\U0001d57b', &['\x50']),
+ ('\U0001d57c', &['\x51']), ('\U0001d57d', &['\x52']), ('\U0001d57e', &['\x53']),
+ ('\U0001d57f', &['\x54']), ('\U0001d580', &['\x55']), ('\U0001d581', &['\x56']),
+ ('\U0001d582', &['\x57']), ('\U0001d583', &['\x58']), ('\U0001d584', &['\x59']),
+ ('\U0001d585', &['\x5a']), ('\U0001d586', &['\x61']), ('\U0001d587', &['\x62']),
+ ('\U0001d588', &['\x63']), ('\U0001d589', &['\x64']), ('\U0001d58a', &['\x65']),
+ ('\U0001d58b', &['\x66']), ('\U0001d58c', &['\x67']), ('\U0001d58d', &['\x68']),
+ ('\U0001d58e', &['\x69']), ('\U0001d58f', &['\x6a']), ('\U0001d590', &['\x6b']),
+ ('\U0001d591', &['\x6c']), ('\U0001d592', &['\x6d']), ('\U0001d593', &['\x6e']),
+ ('\U0001d594', &['\x6f']), ('\U0001d595', &['\x70']), ('\U0001d596', &['\x71']),
+ ('\U0001d597', &['\x72']), ('\U0001d598', &['\x73']), ('\U0001d599', &['\x74']),
+ ('\U0001d59a', &['\x75']), ('\U0001d59b', &['\x76']), ('\U0001d59c', &['\x77']),
+ ('\U0001d59d', &['\x78']), ('\U0001d59e', &['\x79']), ('\U0001d59f', &['\x7a']),
+ ('\U0001d5a0', &['\x41']), ('\U0001d5a1', &['\x42']), ('\U0001d5a2', &['\x43']),
+ ('\U0001d5a3', &['\x44']), ('\U0001d5a4', &['\x45']), ('\U0001d5a5', &['\x46']),
+ ('\U0001d5a6', &['\x47']), ('\U0001d5a7', &['\x48']), ('\U0001d5a8', &['\x49']),
+ ('\U0001d5a9', &['\x4a']), ('\U0001d5aa', &['\x4b']), ('\U0001d5ab', &['\x4c']),
+ ('\U0001d5ac', &['\x4d']), ('\U0001d5ad', &['\x4e']), ('\U0001d5ae', &['\x4f']),
+ ('\U0001d5af', &['\x50']), ('\U0001d5b0', &['\x51']), ('\U0001d5b1', &['\x52']),
+ ('\U0001d5b2', &['\x53']), ('\U0001d5b3', &['\x54']), ('\U0001d5b4', &['\x55']),
+ ('\U0001d5b5', &['\x56']), ('\U0001d5b6', &['\x57']), ('\U0001d5b7', &['\x58']),
+ ('\U0001d5b8', &['\x59']), ('\U0001d5b9', &['\x5a']), ('\U0001d5ba', &['\x61']),
+ ('\U0001d5bb', &['\x62']), ('\U0001d5bc', &['\x63']), ('\U0001d5bd', &['\x64']),
+ ('\U0001d5be', &['\x65']), ('\U0001d5bf', &['\x66']), ('\U0001d5c0', &['\x67']),
+ ('\U0001d5c1', &['\x68']), ('\U0001d5c2', &['\x69']), ('\U0001d5c3', &['\x6a']),
+ ('\U0001d5c4', &['\x6b']), ('\U0001d5c5', &['\x6c']), ('\U0001d5c6', &['\x6d']),
+ ('\U0001d5c7', &['\x6e']), ('\U0001d5c8', &['\x6f']), ('\U0001d5c9', &['\x70']),
+ ('\U0001d5ca', &['\x71']), ('\U0001d5cb', &['\x72']), ('\U0001d5cc', &['\x73']),
+ ('\U0001d5cd', &['\x74']), ('\U0001d5ce', &['\x75']), ('\U0001d5cf', &['\x76']),
+ ('\U0001d5d0', &['\x77']), ('\U0001d5d1', &['\x78']), ('\U0001d5d2', &['\x79']),
+ ('\U0001d5d3', &['\x7a']), ('\U0001d5d4', &['\x41']), ('\U0001d5d5', &['\x42']),
+ ('\U0001d5d6', &['\x43']), ('\U0001d5d7', &['\x44']), ('\U0001d5d8', &['\x45']),
+ ('\U0001d5d9', &['\x46']), ('\U0001d5da', &['\x47']), ('\U0001d5db', &['\x48']),
+ ('\U0001d5dc', &['\x49']), ('\U0001d5dd', &['\x4a']), ('\U0001d5de', &['\x4b']),
+ ('\U0001d5df', &['\x4c']), ('\U0001d5e0', &['\x4d']), ('\U0001d5e1', &['\x4e']),
+ ('\U0001d5e2', &['\x4f']), ('\U0001d5e3', &['\x50']), ('\U0001d5e4', &['\x51']),
+ ('\U0001d5e5', &['\x52']), ('\U0001d5e6', &['\x53']), ('\U0001d5e7', &['\x54']),
+ ('\U0001d5e8', &['\x55']), ('\U0001d5e9', &['\x56']), ('\U0001d5ea', &['\x57']),
+ ('\U0001d5eb', &['\x58']), ('\U0001d5ec', &['\x59']), ('\U0001d5ed', &['\x5a']),
+ ('\U0001d5ee', &['\x61']), ('\U0001d5ef', &['\x62']), ('\U0001d5f0', &['\x63']),
+ ('\U0001d5f1', &['\x64']), ('\U0001d5f2', &['\x65']), ('\U0001d5f3', &['\x66']),
+ ('\U0001d5f4', &['\x67']), ('\U0001d5f5', &['\x68']), ('\U0001d5f6', &['\x69']),
+ ('\U0001d5f7', &['\x6a']), ('\U0001d5f8', &['\x6b']), ('\U0001d5f9', &['\x6c']),
+ ('\U0001d5fa', &['\x6d']), ('\U0001d5fb', &['\x6e']), ('\U0001d5fc', &['\x6f']),
+ ('\U0001d5fd', &['\x70']), ('\U0001d5fe', &['\x71']), ('\U0001d5ff', &['\x72']),
+ ('\U0001d600', &['\x73']), ('\U0001d601', &['\x74']), ('\U0001d602', &['\x75']),
+ ('\U0001d603', &['\x76']), ('\U0001d604', &['\x77']), ('\U0001d605', &['\x78']),
+ ('\U0001d606', &['\x79']), ('\U0001d607', &['\x7a']), ('\U0001d608', &['\x41']),
+ ('\U0001d609', &['\x42']), ('\U0001d60a', &['\x43']), ('\U0001d60b', &['\x44']),
+ ('\U0001d60c', &['\x45']), ('\U0001d60d', &['\x46']), ('\U0001d60e', &['\x47']),
+ ('\U0001d60f', &['\x48']), ('\U0001d610', &['\x49']), ('\U0001d611', &['\x4a']),
+ ('\U0001d612', &['\x4b']), ('\U0001d613', &['\x4c']), ('\U0001d614', &['\x4d']),
+ ('\U0001d615', &['\x4e']), ('\U0001d616', &['\x4f']), ('\U0001d617', &['\x50']),
+ ('\U0001d618', &['\x51']), ('\U0001d619', &['\x52']), ('\U0001d61a', &['\x53']),
+ ('\U0001d61b', &['\x54']), ('\U0001d61c', &['\x55']), ('\U0001d61d', &['\x56']),
+ ('\U0001d61e', &['\x57']), ('\U0001d61f', &['\x58']), ('\U0001d620', &['\x59']),
+ ('\U0001d621', &['\x5a']), ('\U0001d622', &['\x61']), ('\U0001d623', &['\x62']),
+ ('\U0001d624', &['\x63']), ('\U0001d625', &['\x64']), ('\U0001d626', &['\x65']),
+ ('\U0001d627', &['\x66']), ('\U0001d628', &['\x67']), ('\U0001d629', &['\x68']),
+ ('\U0001d62a', &['\x69']), ('\U0001d62b', &['\x6a']), ('\U0001d62c', &['\x6b']),
+ ('\U0001d62d', &['\x6c']), ('\U0001d62e', &['\x6d']), ('\U0001d62f', &['\x6e']),
+ ('\U0001d630', &['\x6f']), ('\U0001d631', &['\x70']), ('\U0001d632', &['\x71']),
+ ('\U0001d633', &['\x72']), ('\U0001d634', &['\x73']), ('\U0001d635', &['\x74']),
+ ('\U0001d636', &['\x75']), ('\U0001d637', &['\x76']), ('\U0001d638', &['\x77']),
+ ('\U0001d639', &['\x78']), ('\U0001d63a', &['\x79']), ('\U0001d63b', &['\x7a']),
+ ('\U0001d63c', &['\x41']), ('\U0001d63d', &['\x42']), ('\U0001d63e', &['\x43']),
+ ('\U0001d63f', &['\x44']), ('\U0001d640', &['\x45']), ('\U0001d641', &['\x46']),
+ ('\U0001d642', &['\x47']), ('\U0001d643', &['\x48']), ('\U0001d644', &['\x49']),
+ ('\U0001d645', &['\x4a']), ('\U0001d646', &['\x4b']), ('\U0001d647', &['\x4c']),
+ ('\U0001d648', &['\x4d']), ('\U0001d649', &['\x4e']), ('\U0001d64a', &['\x4f']),
+ ('\U0001d64b', &['\x50']), ('\U0001d64c', &['\x51']), ('\U0001d64d', &['\x52']),
+ ('\U0001d64e', &['\x53']), ('\U0001d64f', &['\x54']), ('\U0001d650', &['\x55']),
+ ('\U0001d651', &['\x56']), ('\U0001d652', &['\x57']), ('\U0001d653', &['\x58']),
+ ('\U0001d654', &['\x59']), ('\U0001d655', &['\x5a']), ('\U0001d656', &['\x61']),
+ ('\U0001d657', &['\x62']), ('\U0001d658', &['\x63']), ('\U0001d659', &['\x64']),
+ ('\U0001d65a', &['\x65']), ('\U0001d65b', &['\x66']), ('\U0001d65c', &['\x67']),
+ ('\U0001d65d', &['\x68']), ('\U0001d65e', &['\x69']), ('\U0001d65f', &['\x6a']),
+ ('\U0001d660', &['\x6b']), ('\U0001d661', &['\x6c']), ('\U0001d662', &['\x6d']),
+ ('\U0001d663', &['\x6e']), ('\U0001d664', &['\x6f']), ('\U0001d665', &['\x70']),
+ ('\U0001d666', &['\x71']), ('\U0001d667', &['\x72']), ('\U0001d668', &['\x73']),
+ ('\U0001d669', &['\x74']), ('\U0001d66a', &['\x75']), ('\U0001d66b', &['\x76']),
+ ('\U0001d66c', &['\x77']), ('\U0001d66d', &['\x78']), ('\U0001d66e', &['\x79']),
+ ('\U0001d66f', &['\x7a']), ('\U0001d670', &['\x41']), ('\U0001d671', &['\x42']),
+ ('\U0001d672', &['\x43']), ('\U0001d673', &['\x44']), ('\U0001d674', &['\x45']),
+ ('\U0001d675', &['\x46']), ('\U0001d676', &['\x47']), ('\U0001d677', &['\x48']),
+ ('\U0001d678', &['\x49']), ('\U0001d679', &['\x4a']), ('\U0001d67a', &['\x4b']),
+ ('\U0001d67b', &['\x4c']), ('\U0001d67c', &['\x4d']), ('\U0001d67d', &['\x4e']),
+ ('\U0001d67e', &['\x4f']), ('\U0001d67f', &['\x50']), ('\U0001d680', &['\x51']),
+ ('\U0001d681', &['\x52']), ('\U0001d682', &['\x53']), ('\U0001d683', &['\x54']),
+ ('\U0001d684', &['\x55']), ('\U0001d685', &['\x56']), ('\U0001d686', &['\x57']),
+ ('\U0001d687', &['\x58']), ('\U0001d688', &['\x59']), ('\U0001d689', &['\x5a']),
+ ('\U0001d68a', &['\x61']), ('\U0001d68b', &['\x62']), ('\U0001d68c', &['\x63']),
+ ('\U0001d68d', &['\x64']), ('\U0001d68e', &['\x65']), ('\U0001d68f', &['\x66']),
+ ('\U0001d690', &['\x67']), ('\U0001d691', &['\x68']), ('\U0001d692', &['\x69']),
+ ('\U0001d693', &['\x6a']), ('\U0001d694', &['\x6b']), ('\U0001d695', &['\x6c']),
+ ('\U0001d696', &['\x6d']), ('\U0001d697', &['\x6e']), ('\U0001d698', &['\x6f']),
+ ('\U0001d699', &['\x70']), ('\U0001d69a', &['\x71']), ('\U0001d69b', &['\x72']),
+ ('\U0001d69c', &['\x73']), ('\U0001d69d', &['\x74']), ('\U0001d69e', &['\x75']),
+ ('\U0001d69f', &['\x76']), ('\U0001d6a0', &['\x77']), ('\U0001d6a1', &['\x78']),
+ ('\U0001d6a2', &['\x79']), ('\U0001d6a3', &['\x7a']), ('\U0001d6a4', &['\u0131']),
+ ('\U0001d6a5', &['\u0237']), ('\U0001d6a8', &['\u0391']), ('\U0001d6a9', &['\u0392']),
+ ('\U0001d6aa', &['\u0393']), ('\U0001d6ab', &['\u0394']), ('\U0001d6ac', &['\u0395']),
+ ('\U0001d6ad', &['\u0396']), ('\U0001d6ae', &['\u0397']), ('\U0001d6af', &['\u0398']),
+ ('\U0001d6b0', &['\u0399']), ('\U0001d6b1', &['\u039a']), ('\U0001d6b2', &['\u039b']),
+ ('\U0001d6b3', &['\u039c']), ('\U0001d6b4', &['\u039d']), ('\U0001d6b5', &['\u039e']),
+ ('\U0001d6b6', &['\u039f']), ('\U0001d6b7', &['\u03a0']), ('\U0001d6b8', &['\u03a1']),
+ ('\U0001d6b9', &['\u03f4']), ('\U0001d6ba', &['\u03a3']), ('\U0001d6bb', &['\u03a4']),
+ ('\U0001d6bc', &['\u03a5']), ('\U0001d6bd', &['\u03a6']), ('\U0001d6be', &['\u03a7']),
+ ('\U0001d6bf', &['\u03a8']), ('\U0001d6c0', &['\u03a9']), ('\U0001d6c1', &['\u2207']),
+ ('\U0001d6c2', &['\u03b1']), ('\U0001d6c3', &['\u03b2']), ('\U0001d6c4', &['\u03b3']),
+ ('\U0001d6c5', &['\u03b4']), ('\U0001d6c6', &['\u03b5']), ('\U0001d6c7', &['\u03b6']),
+ ('\U0001d6c8', &['\u03b7']), ('\U0001d6c9', &['\u03b8']), ('\U0001d6ca', &['\u03b9']),
+ ('\U0001d6cb', &['\u03ba']), ('\U0001d6cc', &['\u03bb']), ('\U0001d6cd', &['\u03bc']),
+ ('\U0001d6ce', &['\u03bd']), ('\U0001d6cf', &['\u03be']), ('\U0001d6d0', &['\u03bf']),
+ ('\U0001d6d1', &['\u03c0']), ('\U0001d6d2', &['\u03c1']), ('\U0001d6d3', &['\u03c2']),
+ ('\U0001d6d4', &['\u03c3']), ('\U0001d6d5', &['\u03c4']), ('\U0001d6d6', &['\u03c5']),
+ ('\U0001d6d7', &['\u03c6']), ('\U0001d6d8', &['\u03c7']), ('\U0001d6d9', &['\u03c8']),
+ ('\U0001d6da', &['\u03c9']), ('\U0001d6db', &['\u2202']), ('\U0001d6dc', &['\u03f5']),
+ ('\U0001d6dd', &['\u03d1']), ('\U0001d6de', &['\u03f0']), ('\U0001d6df', &['\u03d5']),
+ ('\U0001d6e0', &['\u03f1']), ('\U0001d6e1', &['\u03d6']), ('\U0001d6e2', &['\u0391']),
+ ('\U0001d6e3', &['\u0392']), ('\U0001d6e4', &['\u0393']), ('\U0001d6e5', &['\u0394']),
+ ('\U0001d6e6', &['\u0395']), ('\U0001d6e7', &['\u0396']), ('\U0001d6e8', &['\u0397']),
+ ('\U0001d6e9', &['\u0398']), ('\U0001d6ea', &['\u0399']), ('\U0001d6eb', &['\u039a']),
+ ('\U0001d6ec', &['\u039b']), ('\U0001d6ed', &['\u039c']), ('\U0001d6ee', &['\u039d']),
+ ('\U0001d6ef', &['\u039e']), ('\U0001d6f0', &['\u039f']), ('\U0001d6f1', &['\u03a0']),
+ ('\U0001d6f2', &['\u03a1']), ('\U0001d6f3', &['\u03f4']), ('\U0001d6f4', &['\u03a3']),
+ ('\U0001d6f5', &['\u03a4']), ('\U0001d6f6', &['\u03a5']), ('\U0001d6f7', &['\u03a6']),
+ ('\U0001d6f8', &['\u03a7']), ('\U0001d6f9', &['\u03a8']), ('\U0001d6fa', &['\u03a9']),
+ ('\U0001d6fb', &['\u2207']), ('\U0001d6fc', &['\u03b1']), ('\U0001d6fd', &['\u03b2']),
+ ('\U0001d6fe', &['\u03b3']), ('\U0001d6ff', &['\u03b4']), ('\U0001d700', &['\u03b5']),
+ ('\U0001d701', &['\u03b6']), ('\U0001d702', &['\u03b7']), ('\U0001d703', &['\u03b8']),
+ ('\U0001d704', &['\u03b9']), ('\U0001d705', &['\u03ba']), ('\U0001d706', &['\u03bb']),
+ ('\U0001d707', &['\u03bc']), ('\U0001d708', &['\u03bd']), ('\U0001d709', &['\u03be']),
+ ('\U0001d70a', &['\u03bf']), ('\U0001d70b', &['\u03c0']), ('\U0001d70c', &['\u03c1']),
+ ('\U0001d70d', &['\u03c2']), ('\U0001d70e', &['\u03c3']), ('\U0001d70f', &['\u03c4']),
+ ('\U0001d710', &['\u03c5']), ('\U0001d711', &['\u03c6']), ('\U0001d712', &['\u03c7']),
+ ('\U0001d713', &['\u03c8']), ('\U0001d714', &['\u03c9']), ('\U0001d715', &['\u2202']),
+ ('\U0001d716', &['\u03f5']), ('\U0001d717', &['\u03d1']), ('\U0001d718', &['\u03f0']),
+ ('\U0001d719', &['\u03d5']), ('\U0001d71a', &['\u03f1']), ('\U0001d71b', &['\u03d6']),
+ ('\U0001d71c', &['\u0391']), ('\U0001d71d', &['\u0392']), ('\U0001d71e', &['\u0393']),
+ ('\U0001d71f', &['\u0394']), ('\U0001d720', &['\u0395']), ('\U0001d721', &['\u0396']),
+ ('\U0001d722', &['\u0397']), ('\U0001d723', &['\u0398']), ('\U0001d724', &['\u0399']),
+ ('\U0001d725', &['\u039a']), ('\U0001d726', &['\u039b']), ('\U0001d727', &['\u039c']),
+ ('\U0001d728', &['\u039d']), ('\U0001d729', &['\u039e']), ('\U0001d72a', &['\u039f']),
+ ('\U0001d72b', &['\u03a0']), ('\U0001d72c', &['\u03a1']), ('\U0001d72d', &['\u03f4']),
+ ('\U0001d72e', &['\u03a3']), ('\U0001d72f', &['\u03a4']), ('\U0001d730', &['\u03a5']),
+ ('\U0001d731', &['\u03a6']), ('\U0001d732', &['\u03a7']), ('\U0001d733', &['\u03a8']),
+ ('\U0001d734', &['\u03a9']), ('\U0001d735', &['\u2207']), ('\U0001d736', &['\u03b1']),
+ ('\U0001d737', &['\u03b2']), ('\U0001d738', &['\u03b3']), ('\U0001d739', &['\u03b4']),
+ ('\U0001d73a', &['\u03b5']), ('\U0001d73b', &['\u03b6']), ('\U0001d73c', &['\u03b7']),
+ ('\U0001d73d', &['\u03b8']), ('\U0001d73e', &['\u03b9']), ('\U0001d73f', &['\u03ba']),
+ ('\U0001d740', &['\u03bb']), ('\U0001d741', &['\u03bc']), ('\U0001d742', &['\u03bd']),
+ ('\U0001d743', &['\u03be']), ('\U0001d744', &['\u03bf']), ('\U0001d745', &['\u03c0']),
+ ('\U0001d746', &['\u03c1']), ('\U0001d747', &['\u03c2']), ('\U0001d748', &['\u03c3']),
+ ('\U0001d749', &['\u03c4']), ('\U0001d74a', &['\u03c5']), ('\U0001d74b', &['\u03c6']),
+ ('\U0001d74c', &['\u03c7']), ('\U0001d74d', &['\u03c8']), ('\U0001d74e', &['\u03c9']),
+ ('\U0001d74f', &['\u2202']), ('\U0001d750', &['\u03f5']), ('\U0001d751', &['\u03d1']),
+ ('\U0001d752', &['\u03f0']), ('\U0001d753', &['\u03d5']), ('\U0001d754', &['\u03f1']),
+ ('\U0001d755', &['\u03d6']), ('\U0001d756', &['\u0391']), ('\U0001d757', &['\u0392']),
+ ('\U0001d758', &['\u0393']), ('\U0001d759', &['\u0394']), ('\U0001d75a', &['\u0395']),
+ ('\U0001d75b', &['\u0396']), ('\U0001d75c', &['\u0397']), ('\U0001d75d', &['\u0398']),
+ ('\U0001d75e', &['\u0399']), ('\U0001d75f', &['\u039a']), ('\U0001d760', &['\u039b']),
+ ('\U0001d761', &['\u039c']), ('\U0001d762', &['\u039d']), ('\U0001d763', &['\u039e']),
+ ('\U0001d764', &['\u039f']), ('\U0001d765', &['\u03a0']), ('\U0001d766', &['\u03a1']),
+ ('\U0001d767', &['\u03f4']), ('\U0001d768', &['\u03a3']), ('\U0001d769', &['\u03a4']),
+ ('\U0001d76a', &['\u03a5']), ('\U0001d76b', &['\u03a6']), ('\U0001d76c', &['\u03a7']),
+ ('\U0001d76d', &['\u03a8']), ('\U0001d76e', &['\u03a9']), ('\U0001d76f', &['\u2207']),
+ ('\U0001d770', &['\u03b1']), ('\U0001d771', &['\u03b2']), ('\U0001d772', &['\u03b3']),
+ ('\U0001d773', &['\u03b4']), ('\U0001d774', &['\u03b5']), ('\U0001d775', &['\u03b6']),
+ ('\U0001d776', &['\u03b7']), ('\U0001d777', &['\u03b8']), ('\U0001d778', &['\u03b9']),
+ ('\U0001d779', &['\u03ba']), ('\U0001d77a', &['\u03bb']), ('\U0001d77b', &['\u03bc']),
+ ('\U0001d77c', &['\u03bd']), ('\U0001d77d', &['\u03be']), ('\U0001d77e', &['\u03bf']),
+ ('\U0001d77f', &['\u03c0']), ('\U0001d780', &['\u03c1']), ('\U0001d781', &['\u03c2']),
+ ('\U0001d782', &['\u03c3']), ('\U0001d783', &['\u03c4']), ('\U0001d784', &['\u03c5']),
+ ('\U0001d785', &['\u03c6']), ('\U0001d786', &['\u03c7']), ('\U0001d787', &['\u03c8']),
+ ('\U0001d788', &['\u03c9']), ('\U0001d789', &['\u2202']), ('\U0001d78a', &['\u03f5']),
+ ('\U0001d78b', &['\u03d1']), ('\U0001d78c', &['\u03f0']), ('\U0001d78d', &['\u03d5']),
+ ('\U0001d78e', &['\u03f1']), ('\U0001d78f', &['\u03d6']), ('\U0001d790', &['\u0391']),
+ ('\U0001d791', &['\u0392']), ('\U0001d792', &['\u0393']), ('\U0001d793', &['\u0394']),
+ ('\U0001d794', &['\u0395']), ('\U0001d795', &['\u0396']), ('\U0001d796', &['\u0397']),
+ ('\U0001d797', &['\u0398']), ('\U0001d798', &['\u0399']), ('\U0001d799', &['\u039a']),
+ ('\U0001d79a', &['\u039b']), ('\U0001d79b', &['\u039c']), ('\U0001d79c', &['\u039d']),
+ ('\U0001d79d', &['\u039e']), ('\U0001d79e', &['\u039f']), ('\U0001d79f', &['\u03a0']),
+ ('\U0001d7a0', &['\u03a1']), ('\U0001d7a1', &['\u03f4']), ('\U0001d7a2', &['\u03a3']),
+ ('\U0001d7a3', &['\u03a4']), ('\U0001d7a4', &['\u03a5']), ('\U0001d7a5', &['\u03a6']),
+ ('\U0001d7a6', &['\u03a7']), ('\U0001d7a7', &['\u03a8']), ('\U0001d7a8', &['\u03a9']),
+ ('\U0001d7a9', &['\u2207']), ('\U0001d7aa', &['\u03b1']), ('\U0001d7ab', &['\u03b2']),
+ ('\U0001d7ac', &['\u03b3']), ('\U0001d7ad', &['\u03b4']), ('\U0001d7ae', &['\u03b5']),
+ ('\U0001d7af', &['\u03b6']), ('\U0001d7b0', &['\u03b7']), ('\U0001d7b1', &['\u03b8']),
+ ('\U0001d7b2', &['\u03b9']), ('\U0001d7b3', &['\u03ba']), ('\U0001d7b4', &['\u03bb']),
+ ('\U0001d7b5', &['\u03bc']), ('\U0001d7b6', &['\u03bd']), ('\U0001d7b7', &['\u03be']),
+ ('\U0001d7b8', &['\u03bf']), ('\U0001d7b9', &['\u03c0']), ('\U0001d7ba', &['\u03c1']),
+ ('\U0001d7bb', &['\u03c2']), ('\U0001d7bc', &['\u03c3']), ('\U0001d7bd', &['\u03c4']),
+ ('\U0001d7be', &['\u03c5']), ('\U0001d7bf', &['\u03c6']), ('\U0001d7c0', &['\u03c7']),
+ ('\U0001d7c1', &['\u03c8']), ('\U0001d7c2', &['\u03c9']), ('\U0001d7c3', &['\u2202']),
+ ('\U0001d7c4', &['\u03f5']), ('\U0001d7c5', &['\u03d1']), ('\U0001d7c6', &['\u03f0']),
+ ('\U0001d7c7', &['\u03d5']), ('\U0001d7c8', &['\u03f1']), ('\U0001d7c9', &['\u03d6']),
+ ('\U0001d7ca', &['\u03dc']), ('\U0001d7cb', &['\u03dd']), ('\U0001d7ce', &['\x30']),
+ ('\U0001d7cf', &['\x31']), ('\U0001d7d0', &['\x32']), ('\U0001d7d1', &['\x33']),
+ ('\U0001d7d2', &['\x34']), ('\U0001d7d3', &['\x35']), ('\U0001d7d4', &['\x36']),
+ ('\U0001d7d5', &['\x37']), ('\U0001d7d6', &['\x38']), ('\U0001d7d7', &['\x39']),
+ ('\U0001d7d8', &['\x30']), ('\U0001d7d9', &['\x31']), ('\U0001d7da', &['\x32']),
+ ('\U0001d7db', &['\x33']), ('\U0001d7dc', &['\x34']), ('\U0001d7dd', &['\x35']),
+ ('\U0001d7de', &['\x36']), ('\U0001d7df', &['\x37']), ('\U0001d7e0', &['\x38']),
+ ('\U0001d7e1', &['\x39']), ('\U0001d7e2', &['\x30']), ('\U0001d7e3', &['\x31']),
+ ('\U0001d7e4', &['\x32']), ('\U0001d7e5', &['\x33']), ('\U0001d7e6', &['\x34']),
+ ('\U0001d7e7', &['\x35']), ('\U0001d7e8', &['\x36']), ('\U0001d7e9', &['\x37']),
+ ('\U0001d7ea', &['\x38']), ('\U0001d7eb', &['\x39']), ('\U0001d7ec', &['\x30']),
+ ('\U0001d7ed', &['\x31']), ('\U0001d7ee', &['\x32']), ('\U0001d7ef', &['\x33']),
+ ('\U0001d7f0', &['\x34']), ('\U0001d7f1', &['\x35']), ('\U0001d7f2', &['\x36']),
+ ('\U0001d7f3', &['\x37']), ('\U0001d7f4', &['\x38']), ('\U0001d7f5', &['\x39']),
+ ('\U0001d7f6', &['\x30']), ('\U0001d7f7', &['\x31']), ('\U0001d7f8', &['\x32']),
+ ('\U0001d7f9', &['\x33']), ('\U0001d7fa', &['\x34']), ('\U0001d7fb', &['\x35']),
+ ('\U0001d7fc', &['\x36']), ('\U0001d7fd', &['\x37']), ('\U0001d7fe', &['\x38']),
+ ('\U0001d7ff', &['\x39']), ('\U0001ee00', &['\u0627']), ('\U0001ee01', &['\u0628']),
+ ('\U0001ee02', &['\u062c']), ('\U0001ee03', &['\u062f']), ('\U0001ee05', &['\u0648']),
+ ('\U0001ee06', &['\u0632']), ('\U0001ee07', &['\u062d']), ('\U0001ee08', &['\u0637']),
+ ('\U0001ee09', &['\u064a']), ('\U0001ee0a', &['\u0643']), ('\U0001ee0b', &['\u0644']),
+ ('\U0001ee0c', &['\u0645']), ('\U0001ee0d', &['\u0646']), ('\U0001ee0e', &['\u0633']),
+ ('\U0001ee0f', &['\u0639']), ('\U0001ee10', &['\u0641']), ('\U0001ee11', &['\u0635']),
+ ('\U0001ee12', &['\u0642']), ('\U0001ee13', &['\u0631']), ('\U0001ee14', &['\u0634']),
+ ('\U0001ee15', &['\u062a']), ('\U0001ee16', &['\u062b']), ('\U0001ee17', &['\u062e']),
+ ('\U0001ee18', &['\u0630']), ('\U0001ee19', &['\u0636']), ('\U0001ee1a', &['\u0638']),
+ ('\U0001ee1b', &['\u063a']), ('\U0001ee1c', &['\u066e']), ('\U0001ee1d', &['\u06ba']),
+ ('\U0001ee1e', &['\u06a1']), ('\U0001ee1f', &['\u066f']), ('\U0001ee21', &['\u0628']),
+ ('\U0001ee22', &['\u062c']), ('\U0001ee24', &['\u0647']), ('\U0001ee27', &['\u062d']),
+ ('\U0001ee29', &['\u064a']), ('\U0001ee2a', &['\u0643']), ('\U0001ee2b', &['\u0644']),
+ ('\U0001ee2c', &['\u0645']), ('\U0001ee2d', &['\u0646']), ('\U0001ee2e', &['\u0633']),
+ ('\U0001ee2f', &['\u0639']), ('\U0001ee30', &['\u0641']), ('\U0001ee31', &['\u0635']),
+ ('\U0001ee32', &['\u0642']), ('\U0001ee34', &['\u0634']), ('\U0001ee35', &['\u062a']),
+ ('\U0001ee36', &['\u062b']), ('\U0001ee37', &['\u062e']), ('\U0001ee39', &['\u0636']),
+ ('\U0001ee3b', &['\u063a']), ('\U0001ee42', &['\u062c']), ('\U0001ee47', &['\u062d']),
+ ('\U0001ee49', &['\u064a']), ('\U0001ee4b', &['\u0644']), ('\U0001ee4d', &['\u0646']),
+ ('\U0001ee4e', &['\u0633']), ('\U0001ee4f', &['\u0639']), ('\U0001ee51', &['\u0635']),
+ ('\U0001ee52', &['\u0642']), ('\U0001ee54', &['\u0634']), ('\U0001ee57', &['\u062e']),
+ ('\U0001ee59', &['\u0636']), ('\U0001ee5b', &['\u063a']), ('\U0001ee5d', &['\u06ba']),
+ ('\U0001ee5f', &['\u066f']), ('\U0001ee61', &['\u0628']), ('\U0001ee62', &['\u062c']),
+ ('\U0001ee64', &['\u0647']), ('\U0001ee67', &['\u062d']), ('\U0001ee68', &['\u0637']),
+ ('\U0001ee69', &['\u064a']), ('\U0001ee6a', &['\u0643']), ('\U0001ee6c', &['\u0645']),
+ ('\U0001ee6d', &['\u0646']), ('\U0001ee6e', &['\u0633']), ('\U0001ee6f', &['\u0639']),
+ ('\U0001ee70', &['\u0641']), ('\U0001ee71', &['\u0635']), ('\U0001ee72', &['\u0642']),
+ ('\U0001ee74', &['\u0634']), ('\U0001ee75', &['\u062a']), ('\U0001ee76', &['\u062b']),
+ ('\U0001ee77', &['\u062e']), ('\U0001ee79', &['\u0636']), ('\U0001ee7a', &['\u0638']),
+ ('\U0001ee7b', &['\u063a']), ('\U0001ee7c', &['\u066e']), ('\U0001ee7e', &['\u06a1']),
+ ('\U0001ee80', &['\u0627']), ('\U0001ee81', &['\u0628']), ('\U0001ee82', &['\u062c']),
+ ('\U0001ee83', &['\u062f']), ('\U0001ee84', &['\u0647']), ('\U0001ee85', &['\u0648']),
+ ('\U0001ee86', &['\u0632']), ('\U0001ee87', &['\u062d']), ('\U0001ee88', &['\u0637']),
+ ('\U0001ee89', &['\u064a']), ('\U0001ee8b', &['\u0644']), ('\U0001ee8c', &['\u0645']),
+ ('\U0001ee8d', &['\u0646']), ('\U0001ee8e', &['\u0633']), ('\U0001ee8f', &['\u0639']),
+ ('\U0001ee90', &['\u0641']), ('\U0001ee91', &['\u0635']), ('\U0001ee92', &['\u0642']),
+ ('\U0001ee93', &['\u0631']), ('\U0001ee94', &['\u0634']), ('\U0001ee95', &['\u062a']),
+ ('\U0001ee96', &['\u062b']), ('\U0001ee97', &['\u062e']), ('\U0001ee98', &['\u0630']),
+ ('\U0001ee99', &['\u0636']), ('\U0001ee9a', &['\u0638']), ('\U0001ee9b', &['\u063a']),
+ ('\U0001eea1', &['\u0628']), ('\U0001eea2', &['\u062c']), ('\U0001eea3', &['\u062f']),
+ ('\U0001eea5', &['\u0648']), ('\U0001eea6', &['\u0632']), ('\U0001eea7', &['\u062d']),
+ ('\U0001eea8', &['\u0637']), ('\U0001eea9', &['\u064a']), ('\U0001eeab', &['\u0644']),
+ ('\U0001eeac', &['\u0645']), ('\U0001eead', &['\u0646']), ('\U0001eeae', &['\u0633']),
+ ('\U0001eeaf', &['\u0639']), ('\U0001eeb0', &['\u0641']), ('\U0001eeb1', &['\u0635']),
+ ('\U0001eeb2', &['\u0642']), ('\U0001eeb3', &['\u0631']), ('\U0001eeb4', &['\u0634']),
+ ('\U0001eeb5', &['\u062a']), ('\U0001eeb6', &['\u062b']), ('\U0001eeb7', &['\u062e']),
+ ('\U0001eeb8', &['\u0630']), ('\U0001eeb9', &['\u0636']), ('\U0001eeba', &['\u0638']),
+ ('\U0001eebb', &['\u063a']), ('\U0001f100', &['\x30', '\x2e']), ('\U0001f101', &['\x30',
+ '\x2c']), ('\U0001f102', &['\x31', '\x2c']), ('\U0001f103', &['\x32', '\x2c']),
+ ('\U0001f104', &['\x33', '\x2c']), ('\U0001f105', &['\x34', '\x2c']), ('\U0001f106',
+ &['\x35', '\x2c']), ('\U0001f107', &['\x36', '\x2c']), ('\U0001f108', &['\x37', '\x2c']),
+ ('\U0001f109', &['\x38', '\x2c']), ('\U0001f10a', &['\x39', '\x2c']), ('\U0001f110',
+ &['\x28', '\x41', '\x29']), ('\U0001f111', &['\x28', '\x42', '\x29']), ('\U0001f112',
+ &['\x28', '\x43', '\x29']), ('\U0001f113', &['\x28', '\x44', '\x29']), ('\U0001f114',
+ &['\x28', '\x45', '\x29']), ('\U0001f115', &['\x28', '\x46', '\x29']), ('\U0001f116',
+ &['\x28', '\x47', '\x29']), ('\U0001f117', &['\x28', '\x48', '\x29']), ('\U0001f118',
+ &['\x28', '\x49', '\x29']), ('\U0001f119', &['\x28', '\x4a', '\x29']), ('\U0001f11a',
+ &['\x28', '\x4b', '\x29']), ('\U0001f11b', &['\x28', '\x4c', '\x29']), ('\U0001f11c',
+ &['\x28', '\x4d', '\x29']), ('\U0001f11d', &['\x28', '\x4e', '\x29']), ('\U0001f11e',
+ &['\x28', '\x4f', '\x29']), ('\U0001f11f', &['\x28', '\x50', '\x29']), ('\U0001f120',
+ &['\x28', '\x51', '\x29']), ('\U0001f121', &['\x28', '\x52', '\x29']), ('\U0001f122',
+ &['\x28', '\x53', '\x29']), ('\U0001f123', &['\x28', '\x54', '\x29']), ('\U0001f124',
+ &['\x28', '\x55', '\x29']), ('\U0001f125', &['\x28', '\x56', '\x29']), ('\U0001f126',
+ &['\x28', '\x57', '\x29']), ('\U0001f127', &['\x28', '\x58', '\x29']), ('\U0001f128',
+ &['\x28', '\x59', '\x29']), ('\U0001f129', &['\x28', '\x5a', '\x29']), ('\U0001f12a',
+ &['\u3014', '\x53', '\u3015']), ('\U0001f12b', &['\x43']), ('\U0001f12c', &['\x52']),
+ ('\U0001f12d', &['\x43', '\x44']), ('\U0001f12e', &['\x57', '\x5a']), ('\U0001f130',
+ &['\x41']), ('\U0001f131', &['\x42']), ('\U0001f132', &['\x43']), ('\U0001f133', &['\x44']),
+ ('\U0001f134', &['\x45']), ('\U0001f135', &['\x46']), ('\U0001f136', &['\x47']),
+ ('\U0001f137', &['\x48']), ('\U0001f138', &['\x49']), ('\U0001f139', &['\x4a']),
+ ('\U0001f13a', &['\x4b']), ('\U0001f13b', &['\x4c']), ('\U0001f13c', &['\x4d']),
+ ('\U0001f13d', &['\x4e']), ('\U0001f13e', &['\x4f']), ('\U0001f13f', &['\x50']),
+ ('\U0001f140', &['\x51']), ('\U0001f141', &['\x52']), ('\U0001f142', &['\x53']),
+ ('\U0001f143', &['\x54']), ('\U0001f144', &['\x55']), ('\U0001f145', &['\x56']),
+ ('\U0001f146', &['\x57']), ('\U0001f147', &['\x58']), ('\U0001f148', &['\x59']),
+ ('\U0001f149', &['\x5a']), ('\U0001f14a', &['\x48', '\x56']), ('\U0001f14b', &['\x4d',
+ '\x56']), ('\U0001f14c', &['\x53', '\x44']), ('\U0001f14d', &['\x53', '\x53']),
+ ('\U0001f14e', &['\x50', '\x50', '\x56']), ('\U0001f14f', &['\x57', '\x43']), ('\U0001f16a',
+ &['\x4d', '\x43']), ('\U0001f16b', &['\x4d', '\x44']), ('\U0001f190', &['\x44', '\x4a']),
+ ('\U0001f200', &['\u307b', '\u304b']), ('\U0001f201', &['\u30b3', '\u30b3']), ('\U0001f202',
+ &['\u30b5']), ('\U0001f210', &['\u624b']), ('\U0001f211', &['\u5b57']), ('\U0001f212',
+ &['\u53cc']), ('\U0001f213', &['\u30c7']), ('\U0001f214', &['\u4e8c']), ('\U0001f215',
+ &['\u591a']), ('\U0001f216', &['\u89e3']), ('\U0001f217', &['\u5929']), ('\U0001f218',
+ &['\u4ea4']), ('\U0001f219', &['\u6620']), ('\U0001f21a', &['\u7121']), ('\U0001f21b',
+ &['\u6599']), ('\U0001f21c', &['\u524d']), ('\U0001f21d', &['\u5f8c']), ('\U0001f21e',
+ &['\u518d']), ('\U0001f21f', &['\u65b0']), ('\U0001f220', &['\u521d']), ('\U0001f221',
+ &['\u7d42']), ('\U0001f222', &['\u751f']), ('\U0001f223', &['\u8ca9']), ('\U0001f224',
+ &['\u58f0']), ('\U0001f225', &['\u5439']), ('\U0001f226', &['\u6f14']), ('\U0001f227',
+ &['\u6295']), ('\U0001f228', &['\u6355']), ('\U0001f229', &['\u4e00']), ('\U0001f22a',
+ &['\u4e09']), ('\U0001f22b', &['\u904a']), ('\U0001f22c', &['\u5de6']), ('\U0001f22d',
+ &['\u4e2d']), ('\U0001f22e', &['\u53f3']), ('\U0001f22f', &['\u6307']), ('\U0001f230',
+ &['\u8d70']), ('\U0001f231', &['\u6253']), ('\U0001f232', &['\u7981']), ('\U0001f233',
+ &['\u7a7a']), ('\U0001f234', &['\u5408']), ('\U0001f235', &['\u6e80']), ('\U0001f236',
+ &['\u6709']), ('\U0001f237', &['\u6708']), ('\U0001f238', &['\u7533']), ('\U0001f239',
+ &['\u5272']), ('\U0001f23a', &['\u55b6']), ('\U0001f240', &['\u3014', '\u672c', '\u3015']),
+ ('\U0001f241', &['\u3014', '\u4e09', '\u3015']), ('\U0001f242', &['\u3014', '\u4e8c',
+ '\u3015']), ('\U0001f243', &['\u3014', '\u5b89', '\u3015']), ('\U0001f244', &['\u3014',
+ '\u70b9', '\u3015']), ('\U0001f245', &['\u3014', '\u6253', '\u3015']), ('\U0001f246',
+ &['\u3014', '\u76d7', '\u3015']), ('\U0001f247', &['\u3014', '\u52dd', '\u3015']),
+ ('\U0001f248', &['\u3014', '\u6557', '\u3015']), ('\U0001f250', &['\u5f97']), ('\U0001f251',
+ &['\u53ef'])
+ ];
+
+ pub fn canonical(c: char, i: |char|) { d(c, i, false); }
+
+ pub fn compatibility(c: char, i: |char|) { d(c, i, true); }
+
+ fn d(c: char, i: |char|, k: bool) {
+ use iter::Iterator;
+ if c <= '\x7f' { i(c); return; }
+
+ match bsearch_table(c, canonical_table) {
+ Some(canon) => {
+ for x in canon.iter() {
+ d(*x, |b| i(b), k);
+ }
+ return;
+ }
+ None => ()
+ }
+
+ if !k { i(c); return; }
+
+ match bsearch_table(c, compatibility_table) {
+ Some(compat) => {
+ for x in compat.iter() {
+ d(*x, |b| i(b), k);
+ }
+ return;
+ }
+ None => ()
+ }
+
+ i(c);
+ }
+}
+
+pub mod derived_property {
+ static Alphabetic_table : &'static [(char,char)] = &[
+ ('\x41', '\x5a'), ('\x61', '\x7a'),
+ ('\xaa', '\xaa'), ('\xb5', '\xb5'),
+ ('\xba', '\xba'), ('\xc0', '\xd6'),
+ ('\xd8', '\xf6'), ('\xf8', '\u01ba'),
+ ('\u01bb', '\u01bb'), ('\u01bc', '\u01bf'),
+ ('\u01c0', '\u01c3'), ('\u01c4', '\u0293'),
+ ('\u0294', '\u0294'), ('\u0295', '\u02af'),
+ ('\u02b0', '\u02c1'), ('\u02c6', '\u02d1'),
+ ('\u02e0', '\u02e4'), ('\u02ec', '\u02ec'),
+ ('\u02ee', '\u02ee'), ('\u0345', '\u0345'),
+ ('\u0370', '\u0373'), ('\u0374', '\u0374'),
+ ('\u0376', '\u0377'), ('\u037a', '\u037a'),
+ ('\u037b', '\u037d'), ('\u0386', '\u0386'),
+ ('\u0388', '\u038a'), ('\u038c', '\u038c'),
+ ('\u038e', '\u03a1'), ('\u03a3', '\u03f5'),
+ ('\u03f7', '\u0481'), ('\u048a', '\u0527'),
+ ('\u0531', '\u0556'), ('\u0559', '\u0559'),
+ ('\u0561', '\u0587'), ('\u05b0', '\u05bd'),
+ ('\u05bf', '\u05bf'), ('\u05c1', '\u05c2'),
+ ('\u05c4', '\u05c5'), ('\u05c7', '\u05c7'),
+ ('\u05d0', '\u05ea'), ('\u05f0', '\u05f2'),
+ ('\u0610', '\u061a'), ('\u0620', '\u063f'),
+ ('\u0640', '\u0640'), ('\u0641', '\u064a'),
+ ('\u064b', '\u0657'), ('\u0659', '\u065f'),
+ ('\u066e', '\u066f'), ('\u0670', '\u0670'),
+ ('\u0671', '\u06d3'), ('\u06d5', '\u06d5'),
+ ('\u06d6', '\u06dc'), ('\u06e1', '\u06e4'),
+ ('\u06e5', '\u06e6'), ('\u06e7', '\u06e8'),
+ ('\u06ed', '\u06ed'), ('\u06ee', '\u06ef'),
+ ('\u06fa', '\u06fc'), ('\u06ff', '\u06ff'),
+ ('\u0710', '\u0710'), ('\u0711', '\u0711'),
+ ('\u0712', '\u072f'), ('\u0730', '\u073f'),
+ ('\u074d', '\u07a5'), ('\u07a6', '\u07b0'),
+ ('\u07b1', '\u07b1'), ('\u07ca', '\u07ea'),
+ ('\u07f4', '\u07f5'), ('\u07fa', '\u07fa'),
+ ('\u0800', '\u0815'), ('\u0816', '\u0817'),
+ ('\u081a', '\u081a'), ('\u081b', '\u0823'),
+ ('\u0824', '\u0824'), ('\u0825', '\u0827'),
+ ('\u0828', '\u0828'), ('\u0829', '\u082c'),
+ ('\u0840', '\u0858'), ('\u08a0', '\u08a0'),
+ ('\u08a2', '\u08ac'), ('\u08e4', '\u08e9'),
+ ('\u08f0', '\u08fe'), ('\u0900', '\u0902'),
+ ('\u0903', '\u0903'), ('\u0904', '\u0939'),
+ ('\u093a', '\u093a'), ('\u093b', '\u093b'),
+ ('\u093d', '\u093d'), ('\u093e', '\u0940'),
+ ('\u0941', '\u0948'), ('\u0949', '\u094c'),
+ ('\u094e', '\u094f'), ('\u0950', '\u0950'),
+ ('\u0955', '\u0957'), ('\u0958', '\u0961'),
+ ('\u0962', '\u0963'), ('\u0971', '\u0971'),
+ ('\u0972', '\u0977'), ('\u0979', '\u097f'),
+ ('\u0981', '\u0981'), ('\u0982', '\u0983'),
+ ('\u0985', '\u098c'), ('\u098f', '\u0990'),
+ ('\u0993', '\u09a8'), ('\u09aa', '\u09b0'),
+ ('\u09b2', '\u09b2'), ('\u09b6', '\u09b9'),
+ ('\u09bd', '\u09bd'), ('\u09be', '\u09c0'),
+ ('\u09c1', '\u09c4'), ('\u09c7', '\u09c8'),
+ ('\u09cb', '\u09cc'), ('\u09ce', '\u09ce'),
+ ('\u09d7', '\u09d7'), ('\u09dc', '\u09dd'),
+ ('\u09df', '\u09e1'), ('\u09e2', '\u09e3'),
+ ('\u09f0', '\u09f1'), ('\u0a01', '\u0a02'),
+ ('\u0a03', '\u0a03'), ('\u0a05', '\u0a0a'),
+ ('\u0a0f', '\u0a10'), ('\u0a13', '\u0a28'),
+ ('\u0a2a', '\u0a30'), ('\u0a32', '\u0a33'),
+ ('\u0a35', '\u0a36'), ('\u0a38', '\u0a39'),
+ ('\u0a3e', '\u0a40'), ('\u0a41', '\u0a42'),
+ ('\u0a47', '\u0a48'), ('\u0a4b', '\u0a4c'),
+ ('\u0a51', '\u0a51'), ('\u0a59', '\u0a5c'),
+ ('\u0a5e', '\u0a5e'), ('\u0a70', '\u0a71'),
+ ('\u0a72', '\u0a74'), ('\u0a75', '\u0a75'),
+ ('\u0a81', '\u0a82'), ('\u0a83', '\u0a83'),
+ ('\u0a85', '\u0a8d'), ('\u0a8f', '\u0a91'),
+ ('\u0a93', '\u0aa8'), ('\u0aaa', '\u0ab0'),
+ ('\u0ab2', '\u0ab3'), ('\u0ab5', '\u0ab9'),
+ ('\u0abd', '\u0abd'), ('\u0abe', '\u0ac0'),
+ ('\u0ac1', '\u0ac5'), ('\u0ac7', '\u0ac8'),
+ ('\u0ac9', '\u0ac9'), ('\u0acb', '\u0acc'),
+ ('\u0ad0', '\u0ad0'), ('\u0ae0', '\u0ae1'),
+ ('\u0ae2', '\u0ae3'), ('\u0b01', '\u0b01'),
+ ('\u0b02', '\u0b03'), ('\u0b05', '\u0b0c'),
+ ('\u0b0f', '\u0b10'), ('\u0b13', '\u0b28'),
+ ('\u0b2a', '\u0b30'), ('\u0b32', '\u0b33'),
+ ('\u0b35', '\u0b39'), ('\u0b3d', '\u0b3d'),
+ ('\u0b3e', '\u0b3e'), ('\u0b3f', '\u0b3f'),
+ ('\u0b40', '\u0b40'), ('\u0b41', '\u0b44'),
+ ('\u0b47', '\u0b48'), ('\u0b4b', '\u0b4c'),
+ ('\u0b56', '\u0b56'), ('\u0b57', '\u0b57'),
+ ('\u0b5c', '\u0b5d'), ('\u0b5f', '\u0b61'),
+ ('\u0b62', '\u0b63'), ('\u0b71', '\u0b71'),
+ ('\u0b82', '\u0b82'), ('\u0b83', '\u0b83'),
+ ('\u0b85', '\u0b8a'), ('\u0b8e', '\u0b90'),
+ ('\u0b92', '\u0b95'), ('\u0b99', '\u0b9a'),
+ ('\u0b9c', '\u0b9c'), ('\u0b9e', '\u0b9f'),
+ ('\u0ba3', '\u0ba4'), ('\u0ba8', '\u0baa'),
+ ('\u0bae', '\u0bb9'), ('\u0bbe', '\u0bbf'),
+ ('\u0bc0', '\u0bc0'), ('\u0bc1', '\u0bc2'),
+ ('\u0bc6', '\u0bc8'), ('\u0bca', '\u0bcc'),
+ ('\u0bd0', '\u0bd0'), ('\u0bd7', '\u0bd7'),
+ ('\u0c01', '\u0c03'), ('\u0c05', '\u0c0c'),
+ ('\u0c0e', '\u0c10'), ('\u0c12', '\u0c28'),
+ ('\u0c2a', '\u0c33'), ('\u0c35', '\u0c39'),
+ ('\u0c3d', '\u0c3d'), ('\u0c3e', '\u0c40'),
+ ('\u0c41', '\u0c44'), ('\u0c46', '\u0c48'),
+ ('\u0c4a', '\u0c4c'), ('\u0c55', '\u0c56'),
+ ('\u0c58', '\u0c59'), ('\u0c60', '\u0c61'),
+ ('\u0c62', '\u0c63'), ('\u0c82', '\u0c83'),
+ ('\u0c85', '\u0c8c'), ('\u0c8e', '\u0c90'),
+ ('\u0c92', '\u0ca8'), ('\u0caa', '\u0cb3'),
+ ('\u0cb5', '\u0cb9'), ('\u0cbd', '\u0cbd'),
+ ('\u0cbe', '\u0cbe'), ('\u0cbf', '\u0cbf'),
+ ('\u0cc0', '\u0cc4'), ('\u0cc6', '\u0cc6'),
+ ('\u0cc7', '\u0cc8'), ('\u0cca', '\u0ccb'),
+ ('\u0ccc', '\u0ccc'), ('\u0cd5', '\u0cd6'),
+ ('\u0cde', '\u0cde'), ('\u0ce0', '\u0ce1'),
+ ('\u0ce2', '\u0ce3'), ('\u0cf1', '\u0cf2'),
+ ('\u0d02', '\u0d03'), ('\u0d05', '\u0d0c'),
+ ('\u0d0e', '\u0d10'), ('\u0d12', '\u0d3a'),
+ ('\u0d3d', '\u0d3d'), ('\u0d3e', '\u0d40'),
+ ('\u0d41', '\u0d44'), ('\u0d46', '\u0d48'),
+ ('\u0d4a', '\u0d4c'), ('\u0d4e', '\u0d4e'),
+ ('\u0d57', '\u0d57'), ('\u0d60', '\u0d61'),
+ ('\u0d62', '\u0d63'), ('\u0d7a', '\u0d7f'),
+ ('\u0d82', '\u0d83'), ('\u0d85', '\u0d96'),
+ ('\u0d9a', '\u0db1'), ('\u0db3', '\u0dbb'),
+ ('\u0dbd', '\u0dbd'), ('\u0dc0', '\u0dc6'),
+ ('\u0dcf', '\u0dd1'), ('\u0dd2', '\u0dd4'),
+ ('\u0dd6', '\u0dd6'), ('\u0dd8', '\u0ddf'),
+ ('\u0df2', '\u0df3'), ('\u0e01', '\u0e30'),
+ ('\u0e31', '\u0e31'), ('\u0e32', '\u0e33'),
+ ('\u0e34', '\u0e3a'), ('\u0e40', '\u0e45'),
+ ('\u0e46', '\u0e46'), ('\u0e4d', '\u0e4d'),
+ ('\u0e81', '\u0e82'), ('\u0e84', '\u0e84'),
+ ('\u0e87', '\u0e88'), ('\u0e8a', '\u0e8a'),
+ ('\u0e8d', '\u0e8d'), ('\u0e94', '\u0e97'),
+ ('\u0e99', '\u0e9f'), ('\u0ea1', '\u0ea3'),
+ ('\u0ea5', '\u0ea5'), ('\u0ea7', '\u0ea7'),
+ ('\u0eaa', '\u0eab'), ('\u0ead', '\u0eb0'),
+ ('\u0eb1', '\u0eb1'), ('\u0eb2', '\u0eb3'),
+ ('\u0eb4', '\u0eb9'), ('\u0ebb', '\u0ebc'),
+ ('\u0ebd', '\u0ebd'), ('\u0ec0', '\u0ec4'),
+ ('\u0ec6', '\u0ec6'), ('\u0ecd', '\u0ecd'),
+ ('\u0edc', '\u0edf'), ('\u0f00', '\u0f00'),
+ ('\u0f40', '\u0f47'), ('\u0f49', '\u0f6c'),
+ ('\u0f71', '\u0f7e'), ('\u0f7f', '\u0f7f'),
+ ('\u0f80', '\u0f81'), ('\u0f88', '\u0f8c'),
+ ('\u0f8d', '\u0f97'), ('\u0f99', '\u0fbc'),
+ ('\u1000', '\u102a'), ('\u102b', '\u102c'),
+ ('\u102d', '\u1030'), ('\u1031', '\u1031'),
+ ('\u1032', '\u1036'), ('\u1038', '\u1038'),
+ ('\u103b', '\u103c'), ('\u103d', '\u103e'),
+ ('\u103f', '\u103f'), ('\u1050', '\u1055'),
+ ('\u1056', '\u1057'), ('\u1058', '\u1059'),
+ ('\u105a', '\u105d'), ('\u105e', '\u1060'),
+ ('\u1061', '\u1061'), ('\u1062', '\u1062'),
+ ('\u1065', '\u1066'), ('\u1067', '\u1068'),
+ ('\u106e', '\u1070'), ('\u1071', '\u1074'),
+ ('\u1075', '\u1081'), ('\u1082', '\u1082'),
+ ('\u1083', '\u1084'), ('\u1085', '\u1086'),
+ ('\u108e', '\u108e'), ('\u109c', '\u109c'),
+ ('\u109d', '\u109d'), ('\u10a0', '\u10c5'),
+ ('\u10c7', '\u10c7'), ('\u10cd', '\u10cd'),
+ ('\u10d0', '\u10fa'), ('\u10fc', '\u10fc'),
+ ('\u10fd', '\u1248'), ('\u124a', '\u124d'),
+ ('\u1250', '\u1256'), ('\u1258', '\u1258'),
+ ('\u125a', '\u125d'), ('\u1260', '\u1288'),
+ ('\u128a', '\u128d'), ('\u1290', '\u12b0'),
+ ('\u12b2', '\u12b5'), ('\u12b8', '\u12be'),
+ ('\u12c0', '\u12c0'), ('\u12c2', '\u12c5'),
+ ('\u12c8', '\u12d6'), ('\u12d8', '\u1310'),
+ ('\u1312', '\u1315'), ('\u1318', '\u135a'),
+ ('\u135f', '\u135f'), ('\u1380', '\u138f'),
+ ('\u13a0', '\u13f4'), ('\u1401', '\u166c'),
+ ('\u166f', '\u167f'), ('\u1681', '\u169a'),
+ ('\u16a0', '\u16ea'), ('\u16ee', '\u16f0'),
+ ('\u1700', '\u170c'), ('\u170e', '\u1711'),
+ ('\u1712', '\u1713'), ('\u1720', '\u1731'),
+ ('\u1732', '\u1733'), ('\u1740', '\u1751'),
+ ('\u1752', '\u1753'), ('\u1760', '\u176c'),
+ ('\u176e', '\u1770'), ('\u1772', '\u1773'),
+ ('\u1780', '\u17b3'), ('\u17b6', '\u17b6'),
+ ('\u17b7', '\u17bd'), ('\u17be', '\u17c5'),
+ ('\u17c6', '\u17c6'), ('\u17c7', '\u17c8'),
+ ('\u17d7', '\u17d7'), ('\u17dc', '\u17dc'),
+ ('\u1820', '\u1842'), ('\u1843', '\u1843'),
+ ('\u1844', '\u1877'), ('\u1880', '\u18a8'),
+ ('\u18a9', '\u18a9'), ('\u18aa', '\u18aa'),
+ ('\u18b0', '\u18f5'), ('\u1900', '\u191c'),
+ ('\u1920', '\u1922'), ('\u1923', '\u1926'),
+ ('\u1927', '\u1928'), ('\u1929', '\u192b'),
+ ('\u1930', '\u1931'), ('\u1932', '\u1932'),
+ ('\u1933', '\u1938'), ('\u1950', '\u196d'),
+ ('\u1970', '\u1974'), ('\u1980', '\u19ab'),
+ ('\u19b0', '\u19c0'), ('\u19c1', '\u19c7'),
+ ('\u19c8', '\u19c9'), ('\u1a00', '\u1a16'),
+ ('\u1a17', '\u1a18'), ('\u1a19', '\u1a1a'),
+ ('\u1a1b', '\u1a1b'), ('\u1a20', '\u1a54'),
+ ('\u1a55', '\u1a55'), ('\u1a56', '\u1a56'),
+ ('\u1a57', '\u1a57'), ('\u1a58', '\u1a5e'),
+ ('\u1a61', '\u1a61'), ('\u1a62', '\u1a62'),
+ ('\u1a63', '\u1a64'), ('\u1a65', '\u1a6c'),
+ ('\u1a6d', '\u1a72'), ('\u1a73', '\u1a74'),
+ ('\u1aa7', '\u1aa7'), ('\u1b00', '\u1b03'),
+ ('\u1b04', '\u1b04'), ('\u1b05', '\u1b33'),
+ ('\u1b35', '\u1b35'), ('\u1b36', '\u1b3a'),
+ ('\u1b3b', '\u1b3b'), ('\u1b3c', '\u1b3c'),
+ ('\u1b3d', '\u1b41'), ('\u1b42', '\u1b42'),
+ ('\u1b43', '\u1b43'), ('\u1b45', '\u1b4b'),
+ ('\u1b80', '\u1b81'), ('\u1b82', '\u1b82'),
+ ('\u1b83', '\u1ba0'), ('\u1ba1', '\u1ba1'),
+ ('\u1ba2', '\u1ba5'), ('\u1ba6', '\u1ba7'),
+ ('\u1ba8', '\u1ba9'), ('\u1bac', '\u1bad'),
+ ('\u1bae', '\u1baf'), ('\u1bba', '\u1be5'),
+ ('\u1be7', '\u1be7'), ('\u1be8', '\u1be9'),
+ ('\u1bea', '\u1bec'), ('\u1bed', '\u1bed'),
+ ('\u1bee', '\u1bee'), ('\u1bef', '\u1bf1'),
+ ('\u1c00', '\u1c23'), ('\u1c24', '\u1c2b'),
+ ('\u1c2c', '\u1c33'), ('\u1c34', '\u1c35'),
+ ('\u1c4d', '\u1c4f'), ('\u1c5a', '\u1c77'),
+ ('\u1c78', '\u1c7d'), ('\u1ce9', '\u1cec'),
+ ('\u1cee', '\u1cf1'), ('\u1cf2', '\u1cf3'),
+ ('\u1cf5', '\u1cf6'), ('\u1d00', '\u1d2b'),
+ ('\u1d2c', '\u1d6a'), ('\u1d6b', '\u1d77'),
+ ('\u1d78', '\u1d78'), ('\u1d79', '\u1d9a'),
+ ('\u1d9b', '\u1dbf'), ('\u1e00', '\u1f15'),
+ ('\u1f18', '\u1f1d'), ('\u1f20', '\u1f45'),
+ ('\u1f48', '\u1f4d'), ('\u1f50', '\u1f57'),
+ ('\u1f59', '\u1f59'), ('\u1f5b', '\u1f5b'),
+ ('\u1f5d', '\u1f5d'), ('\u1f5f', '\u1f7d'),
+ ('\u1f80', '\u1fb4'), ('\u1fb6', '\u1fbc'),
+ ('\u1fbe', '\u1fbe'), ('\u1fc2', '\u1fc4'),
+ ('\u1fc6', '\u1fcc'), ('\u1fd0', '\u1fd3'),
+ ('\u1fd6', '\u1fdb'), ('\u1fe0', '\u1fec'),
+ ('\u1ff2', '\u1ff4'), ('\u1ff6', '\u1ffc'),
+ ('\u2071', '\u2071'), ('\u207f', '\u207f'),
+ ('\u2090', '\u209c'), ('\u2102', '\u2102'),
+ ('\u2107', '\u2107'), ('\u210a', '\u2113'),
+ ('\u2115', '\u2115'), ('\u2119', '\u211d'),
+ ('\u2124', '\u2124'), ('\u2126', '\u2126'),
+ ('\u2128', '\u2128'), ('\u212a', '\u212d'),
+ ('\u212f', '\u2134'), ('\u2135', '\u2138'),
+ ('\u2139', '\u2139'), ('\u213c', '\u213f'),
+ ('\u2145', '\u2149'), ('\u214e', '\u214e'),
+ ('\u2160', '\u2182'), ('\u2183', '\u2184'),
+ ('\u2185', '\u2188'), ('\u24b6', '\u24e9'),
+ ('\u2c00', '\u2c2e'), ('\u2c30', '\u2c5e'),
+ ('\u2c60', '\u2c7b'), ('\u2c7c', '\u2c7d'),
+ ('\u2c7e', '\u2ce4'), ('\u2ceb', '\u2cee'),
+ ('\u2cf2', '\u2cf3'), ('\u2d00', '\u2d25'),
+ ('\u2d27', '\u2d27'), ('\u2d2d', '\u2d2d'),
+ ('\u2d30', '\u2d67'), ('\u2d6f', '\u2d6f'),
+ ('\u2d80', '\u2d96'), ('\u2da0', '\u2da6'),
+ ('\u2da8', '\u2dae'), ('\u2db0', '\u2db6'),
+ ('\u2db8', '\u2dbe'), ('\u2dc0', '\u2dc6'),
+ ('\u2dc8', '\u2dce'), ('\u2dd0', '\u2dd6'),
+ ('\u2dd8', '\u2dde'), ('\u2de0', '\u2dff'),
+ ('\u2e2f', '\u2e2f'), ('\u3005', '\u3005'),
+ ('\u3006', '\u3006'), ('\u3007', '\u3007'),
+ ('\u3021', '\u3029'), ('\u3031', '\u3035'),
+ ('\u3038', '\u303a'), ('\u303b', '\u303b'),
+ ('\u303c', '\u303c'), ('\u3041', '\u3096'),
+ ('\u309d', '\u309e'), ('\u309f', '\u309f'),
+ ('\u30a1', '\u30fa'), ('\u30fc', '\u30fe'),
+ ('\u30ff', '\u30ff'), ('\u3105', '\u312d'),
+ ('\u3131', '\u318e'), ('\u31a0', '\u31ba'),
+ ('\u31f0', '\u31ff'), ('\u3400', '\u4db5'),
+ ('\u4e00', '\u9fcc'), ('\ua000', '\ua014'),
+ ('\ua015', '\ua015'), ('\ua016', '\ua48c'),
+ ('\ua4d0', '\ua4f7'), ('\ua4f8', '\ua4fd'),
+ ('\ua500', '\ua60b'), ('\ua60c', '\ua60c'),
+ ('\ua610', '\ua61f'), ('\ua62a', '\ua62b'),
+ ('\ua640', '\ua66d'), ('\ua66e', '\ua66e'),
+ ('\ua674', '\ua67b'), ('\ua67f', '\ua67f'),
+ ('\ua680', '\ua697'), ('\ua69f', '\ua69f'),
+ ('\ua6a0', '\ua6e5'), ('\ua6e6', '\ua6ef'),
+ ('\ua717', '\ua71f'), ('\ua722', '\ua76f'),
+ ('\ua770', '\ua770'), ('\ua771', '\ua787'),
+ ('\ua788', '\ua788'), ('\ua78b', '\ua78e'),
+ ('\ua790', '\ua793'), ('\ua7a0', '\ua7aa'),
+ ('\ua7f8', '\ua7f9'), ('\ua7fa', '\ua7fa'),
+ ('\ua7fb', '\ua801'), ('\ua803', '\ua805'),
+ ('\ua807', '\ua80a'), ('\ua80c', '\ua822'),
+ ('\ua823', '\ua824'), ('\ua825', '\ua826'),
+ ('\ua827', '\ua827'), ('\ua840', '\ua873'),
+ ('\ua880', '\ua881'), ('\ua882', '\ua8b3'),
+ ('\ua8b4', '\ua8c3'), ('\ua8f2', '\ua8f7'),
+ ('\ua8fb', '\ua8fb'), ('\ua90a', '\ua925'),
+ ('\ua926', '\ua92a'), ('\ua930', '\ua946'),
+ ('\ua947', '\ua951'), ('\ua952', '\ua952'),
+ ('\ua960', '\ua97c'), ('\ua980', '\ua982'),
+ ('\ua983', '\ua983'), ('\ua984', '\ua9b2'),
+ ('\ua9b4', '\ua9b5'), ('\ua9b6', '\ua9b9'),
+ ('\ua9ba', '\ua9bb'), ('\ua9bc', '\ua9bc'),
+ ('\ua9bd', '\ua9bf'), ('\ua9cf', '\ua9cf'),
+ ('\uaa00', '\uaa28'), ('\uaa29', '\uaa2e'),
+ ('\uaa2f', '\uaa30'), ('\uaa31', '\uaa32'),
+ ('\uaa33', '\uaa34'), ('\uaa35', '\uaa36'),
+ ('\uaa40', '\uaa42'), ('\uaa43', '\uaa43'),
+ ('\uaa44', '\uaa4b'), ('\uaa4c', '\uaa4c'),
+ ('\uaa4d', '\uaa4d'), ('\uaa60', '\uaa6f'),
+ ('\uaa70', '\uaa70'), ('\uaa71', '\uaa76'),
+ ('\uaa7a', '\uaa7a'), ('\uaa80', '\uaaaf'),
+ ('\uaab0', '\uaab0'), ('\uaab1', '\uaab1'),
+ ('\uaab2', '\uaab4'), ('\uaab5', '\uaab6'),
+ ('\uaab7', '\uaab8'), ('\uaab9', '\uaabd'),
+ ('\uaabe', '\uaabe'), ('\uaac0', '\uaac0'),
+ ('\uaac2', '\uaac2'), ('\uaadb', '\uaadc'),
+ ('\uaadd', '\uaadd'), ('\uaae0', '\uaaea'),
+ ('\uaaeb', '\uaaeb'), ('\uaaec', '\uaaed'),
+ ('\uaaee', '\uaaef'), ('\uaaf2', '\uaaf2'),
+ ('\uaaf3', '\uaaf4'), ('\uaaf5', '\uaaf5'),
+ ('\uab01', '\uab06'), ('\uab09', '\uab0e'),
+ ('\uab11', '\uab16'), ('\uab20', '\uab26'),
+ ('\uab28', '\uab2e'), ('\uabc0', '\uabe2'),
+ ('\uabe3', '\uabe4'), ('\uabe5', '\uabe5'),
+ ('\uabe6', '\uabe7'), ('\uabe8', '\uabe8'),
+ ('\uabe9', '\uabea'), ('\uac00', '\ud7a3'),
+ ('\ud7b0', '\ud7c6'), ('\ud7cb', '\ud7fb'),
+ ('\uf900', '\ufa6d'), ('\ufa70', '\ufad9'),
+ ('\ufb00', '\ufb06'), ('\ufb13', '\ufb17'),
+ ('\ufb1d', '\ufb1d'), ('\ufb1e', '\ufb1e'),
+ ('\ufb1f', '\ufb28'), ('\ufb2a', '\ufb36'),
+ ('\ufb38', '\ufb3c'), ('\ufb3e', '\ufb3e'),
+ ('\ufb40', '\ufb41'), ('\ufb43', '\ufb44'),
+ ('\ufb46', '\ufbb1'), ('\ufbd3', '\ufd3d'),
+ ('\ufd50', '\ufd8f'), ('\ufd92', '\ufdc7'),
+ ('\ufdf0', '\ufdfb'), ('\ufe70', '\ufe74'),
+ ('\ufe76', '\ufefc'), ('\uff21', '\uff3a'),
+ ('\uff41', '\uff5a'), ('\uff66', '\uff6f'),
+ ('\uff70', '\uff70'), ('\uff71', '\uff9d'),
+ ('\uff9e', '\uff9f'), ('\uffa0', '\uffbe'),
+ ('\uffc2', '\uffc7'), ('\uffca', '\uffcf'),
+ ('\uffd2', '\uffd7'), ('\uffda', '\uffdc'),
+ ('\U00010000', '\U0001000b'), ('\U0001000d', '\U00010026'),
+ ('\U00010028', '\U0001003a'), ('\U0001003c', '\U0001003d'),
+ ('\U0001003f', '\U0001004d'), ('\U00010050', '\U0001005d'),
+ ('\U00010080', '\U000100fa'), ('\U00010140', '\U00010174'),
+ ('\U00010280', '\U0001029c'), ('\U000102a0', '\U000102d0'),
+ ('\U00010300', '\U0001031e'), ('\U00010330', '\U00010340'),
+ ('\U00010341', '\U00010341'), ('\U00010342', '\U00010349'),
+ ('\U0001034a', '\U0001034a'), ('\U00010380', '\U0001039d'),
+ ('\U000103a0', '\U000103c3'), ('\U000103c8', '\U000103cf'),
+ ('\U000103d1', '\U000103d5'), ('\U00010400', '\U0001044f'),
+ ('\U00010450', '\U0001049d'), ('\U00010800', '\U00010805'),
+ ('\U00010808', '\U00010808'), ('\U0001080a', '\U00010835'),
+ ('\U00010837', '\U00010838'), ('\U0001083c', '\U0001083c'),
+ ('\U0001083f', '\U00010855'), ('\U00010900', '\U00010915'),
+ ('\U00010920', '\U00010939'), ('\U00010980', '\U000109b7'),
+ ('\U000109be', '\U000109bf'), ('\U00010a00', '\U00010a00'),
+ ('\U00010a01', '\U00010a03'), ('\U00010a05', '\U00010a06'),
+ ('\U00010a0c', '\U00010a0f'), ('\U00010a10', '\U00010a13'),
+ ('\U00010a15', '\U00010a17'), ('\U00010a19', '\U00010a33'),
+ ('\U00010a60', '\U00010a7c'), ('\U00010b00', '\U00010b35'),
+ ('\U00010b40', '\U00010b55'), ('\U00010b60', '\U00010b72'),
+ ('\U00010c00', '\U00010c48'), ('\U00011000', '\U00011000'),
+ ('\U00011001', '\U00011001'), ('\U00011002', '\U00011002'),
+ ('\U00011003', '\U00011037'), ('\U00011038', '\U00011045'),
+ ('\U00011082', '\U00011082'), ('\U00011083', '\U000110af'),
+ ('\U000110b0', '\U000110b2'), ('\U000110b3', '\U000110b6'),
+ ('\U000110b7', '\U000110b8'), ('\U000110d0', '\U000110e8'),
+ ('\U00011100', '\U00011102'), ('\U00011103', '\U00011126'),
+ ('\U00011127', '\U0001112b'), ('\U0001112c', '\U0001112c'),
+ ('\U0001112d', '\U00011132'), ('\U00011180', '\U00011181'),
+ ('\U00011182', '\U00011182'), ('\U00011183', '\U000111b2'),
+ ('\U000111b3', '\U000111b5'), ('\U000111b6', '\U000111be'),
+ ('\U000111bf', '\U000111bf'), ('\U000111c1', '\U000111c4'),
+ ('\U00011680', '\U000116aa'), ('\U000116ab', '\U000116ab'),
+ ('\U000116ac', '\U000116ac'), ('\U000116ad', '\U000116ad'),
+ ('\U000116ae', '\U000116af'), ('\U000116b0', '\U000116b5'),
+ ('\U00012000', '\U0001236e'), ('\U00012400', '\U00012462'),
+ ('\U00013000', '\U0001342e'), ('\U00016800', '\U00016a38'),
+ ('\U00016f00', '\U00016f44'), ('\U00016f50', '\U00016f50'),
+ ('\U00016f51', '\U00016f7e'), ('\U00016f93', '\U00016f9f'),
+ ('\U0001b000', '\U0001b001'), ('\U0001d400', '\U0001d454'),
+ ('\U0001d456', '\U0001d49c'), ('\U0001d49e', '\U0001d49f'),
+ ('\U0001d4a2', '\U0001d4a2'), ('\U0001d4a5', '\U0001d4a6'),
+ ('\U0001d4a9', '\U0001d4ac'), ('\U0001d4ae', '\U0001d4b9'),
+ ('\U0001d4bb', '\U0001d4bb'), ('\U0001d4bd', '\U0001d4c3'),
+ ('\U0001d4c5', '\U0001d505'), ('\U0001d507', '\U0001d50a'),
+ ('\U0001d50d', '\U0001d514'), ('\U0001d516', '\U0001d51c'),
+ ('\U0001d51e', '\U0001d539'), ('\U0001d53b', '\U0001d53e'),
+ ('\U0001d540', '\U0001d544'), ('\U0001d546', '\U0001d546'),
+ ('\U0001d54a', '\U0001d550'), ('\U0001d552', '\U0001d6a5'),
+ ('\U0001d6a8', '\U0001d6c0'), ('\U0001d6c2', '\U0001d6da'),
+ ('\U0001d6dc', '\U0001d6fa'), ('\U0001d6fc', '\U0001d714'),
+ ('\U0001d716', '\U0001d734'), ('\U0001d736', '\U0001d74e'),
+ ('\U0001d750', '\U0001d76e'), ('\U0001d770', '\U0001d788'),
+ ('\U0001d78a', '\U0001d7a8'), ('\U0001d7aa', '\U0001d7c2'),
+ ('\U0001d7c4', '\U0001d7cb'), ('\U0001ee00', '\U0001ee03'),
+ ('\U0001ee05', '\U0001ee1f'), ('\U0001ee21', '\U0001ee22'),
+ ('\U0001ee24', '\U0001ee24'), ('\U0001ee27', '\U0001ee27'),
+ ('\U0001ee29', '\U0001ee32'), ('\U0001ee34', '\U0001ee37'),
+ ('\U0001ee39', '\U0001ee39'), ('\U0001ee3b', '\U0001ee3b'),
+ ('\U0001ee42', '\U0001ee42'), ('\U0001ee47', '\U0001ee47'),
+ ('\U0001ee49', '\U0001ee49'), ('\U0001ee4b', '\U0001ee4b'),
+ ('\U0001ee4d', '\U0001ee4f'), ('\U0001ee51', '\U0001ee52'),
+ ('\U0001ee54', '\U0001ee54'), ('\U0001ee57', '\U0001ee57'),
+ ('\U0001ee59', '\U0001ee59'), ('\U0001ee5b', '\U0001ee5b'),
+ ('\U0001ee5d', '\U0001ee5d'), ('\U0001ee5f', '\U0001ee5f'),
+ ('\U0001ee61', '\U0001ee62'), ('\U0001ee64', '\U0001ee64'),
+ ('\U0001ee67', '\U0001ee6a'), ('\U0001ee6c', '\U0001ee72'),
+ ('\U0001ee74', '\U0001ee77'), ('\U0001ee79', '\U0001ee7c'),
+ ('\U0001ee7e', '\U0001ee7e'), ('\U0001ee80', '\U0001ee89'),
+ ('\U0001ee8b', '\U0001ee9b'), ('\U0001eea1', '\U0001eea3'),
+ ('\U0001eea5', '\U0001eea9'), ('\U0001eeab', '\U0001eebb'),
+ ('\U00020000', '\U0002a6d6'), ('\U0002a700', '\U0002b734'),
+ ('\U0002b740', '\U0002b81d'), ('\U0002f800', '\U0002fa1d')
+ ];
+
+ pub fn Alphabetic(c: char) -> bool {
+ super::bsearch_range_table(c, Alphabetic_table)
+ }
+
+ static Lowercase_table : &'static [(char,char)] = &[
+ ('\x61', '\x7a'), ('\xaa', '\xaa'),
+ ('\xb5', '\xb5'), ('\xba', '\xba'),
+ ('\xdf', '\xf6'), ('\xf8', '\xff'),
+ ('\u0101', '\u0101'), ('\u0103', '\u0103'),
+ ('\u0105', '\u0105'), ('\u0107', '\u0107'),
+ ('\u0109', '\u0109'), ('\u010b', '\u010b'),
+ ('\u010d', '\u010d'), ('\u010f', '\u010f'),
+ ('\u0111', '\u0111'), ('\u0113', '\u0113'),
+ ('\u0115', '\u0115'), ('\u0117', '\u0117'),
+ ('\u0119', '\u0119'), ('\u011b', '\u011b'),
+ ('\u011d', '\u011d'), ('\u011f', '\u011f'),
+ ('\u0121', '\u0121'), ('\u0123', '\u0123'),
+ ('\u0125', '\u0125'), ('\u0127', '\u0127'),
+ ('\u0129', '\u0129'), ('\u012b', '\u012b'),
+ ('\u012d', '\u012d'), ('\u012f', '\u012f'),
+ ('\u0131', '\u0131'), ('\u0133', '\u0133'),
+ ('\u0135', '\u0135'), ('\u0137', '\u0138'),
+ ('\u013a', '\u013a'), ('\u013c', '\u013c'),
+ ('\u013e', '\u013e'), ('\u0140', '\u0140'),
+ ('\u0142', '\u0142'), ('\u0144', '\u0144'),
+ ('\u0146', '\u0146'), ('\u0148', '\u0149'),
+ ('\u014b', '\u014b'), ('\u014d', '\u014d'),
+ ('\u014f', '\u014f'), ('\u0151', '\u0151'),
+ ('\u0153', '\u0153'), ('\u0155', '\u0155'),
+ ('\u0157', '\u0157'), ('\u0159', '\u0159'),
+ ('\u015b', '\u015b'), ('\u015d', '\u015d'),
+ ('\u015f', '\u015f'), ('\u0161', '\u0161'),
+ ('\u0163', '\u0163'), ('\u0165', '\u0165'),
+ ('\u0167', '\u0167'), ('\u0169', '\u0169'),
+ ('\u016b', '\u016b'), ('\u016d', '\u016d'),
+ ('\u016f', '\u016f'), ('\u0171', '\u0171'),
+ ('\u0173', '\u0173'), ('\u0175', '\u0175'),
+ ('\u0177', '\u0177'), ('\u017a', '\u017a'),
+ ('\u017c', '\u017c'), ('\u017e', '\u0180'),
+ ('\u0183', '\u0183'), ('\u0185', '\u0185'),
+ ('\u0188', '\u0188'), ('\u018c', '\u018d'),
+ ('\u0192', '\u0192'), ('\u0195', '\u0195'),
+ ('\u0199', '\u019b'), ('\u019e', '\u019e'),
+ ('\u01a1', '\u01a1'), ('\u01a3', '\u01a3'),
+ ('\u01a5', '\u01a5'), ('\u01a8', '\u01a8'),
+ ('\u01aa', '\u01ab'), ('\u01ad', '\u01ad'),
+ ('\u01b0', '\u01b0'), ('\u01b4', '\u01b4'),
+ ('\u01b6', '\u01b6'), ('\u01b9', '\u01ba'),
+ ('\u01bd', '\u01bf'), ('\u01c6', '\u01c6'),
+ ('\u01c9', '\u01c9'), ('\u01cc', '\u01cc'),
+ ('\u01ce', '\u01ce'), ('\u01d0', '\u01d0'),
+ ('\u01d2', '\u01d2'), ('\u01d4', '\u01d4'),
+ ('\u01d6', '\u01d6'), ('\u01d8', '\u01d8'),
+ ('\u01da', '\u01da'), ('\u01dc', '\u01dd'),
+ ('\u01df', '\u01df'), ('\u01e1', '\u01e1'),
+ ('\u01e3', '\u01e3'), ('\u01e5', '\u01e5'),
+ ('\u01e7', '\u01e7'), ('\u01e9', '\u01e9'),
+ ('\u01eb', '\u01eb'), ('\u01ed', '\u01ed'),
+ ('\u01ef', '\u01f0'), ('\u01f3', '\u01f3'),
+ ('\u01f5', '\u01f5'), ('\u01f9', '\u01f9'),
+ ('\u01fb', '\u01fb'), ('\u01fd', '\u01fd'),
+ ('\u01ff', '\u01ff'), ('\u0201', '\u0201'),
+ ('\u0203', '\u0203'), ('\u0205', '\u0205'),
+ ('\u0207', '\u0207'), ('\u0209', '\u0209'),
+ ('\u020b', '\u020b'), ('\u020d', '\u020d'),
+ ('\u020f', '\u020f'), ('\u0211', '\u0211'),
+ ('\u0213', '\u0213'), ('\u0215', '\u0215'),
+ ('\u0217', '\u0217'), ('\u0219', '\u0219'),
+ ('\u021b', '\u021b'), ('\u021d', '\u021d'),
+ ('\u021f', '\u021f'), ('\u0221', '\u0221'),
+ ('\u0223', '\u0223'), ('\u0225', '\u0225'),
+ ('\u0227', '\u0227'), ('\u0229', '\u0229'),
+ ('\u022b', '\u022b'), ('\u022d', '\u022d'),
+ ('\u022f', '\u022f'), ('\u0231', '\u0231'),
+ ('\u0233', '\u0239'), ('\u023c', '\u023c'),
+ ('\u023f', '\u0240'), ('\u0242', '\u0242'),
+ ('\u0247', '\u0247'), ('\u0249', '\u0249'),
+ ('\u024b', '\u024b'), ('\u024d', '\u024d'),
+ ('\u024f', '\u0293'), ('\u0295', '\u02af'),
+ ('\u02b0', '\u02b8'), ('\u02c0', '\u02c1'),
+ ('\u02e0', '\u02e4'), ('\u0345', '\u0345'),
+ ('\u0371', '\u0371'), ('\u0373', '\u0373'),
+ ('\u0377', '\u0377'), ('\u037a', '\u037a'),
+ ('\u037b', '\u037d'), ('\u0390', '\u0390'),
+ ('\u03ac', '\u03ce'), ('\u03d0', '\u03d1'),
+ ('\u03d5', '\u03d7'), ('\u03d9', '\u03d9'),
+ ('\u03db', '\u03db'), ('\u03dd', '\u03dd'),
+ ('\u03df', '\u03df'), ('\u03e1', '\u03e1'),
+ ('\u03e3', '\u03e3'), ('\u03e5', '\u03e5'),
+ ('\u03e7', '\u03e7'), ('\u03e9', '\u03e9'),
+ ('\u03eb', '\u03eb'), ('\u03ed', '\u03ed'),
+ ('\u03ef', '\u03f3'), ('\u03f5', '\u03f5'),
+ ('\u03f8', '\u03f8'), ('\u03fb', '\u03fc'),
+ ('\u0430', '\u045f'), ('\u0461', '\u0461'),
+ ('\u0463', '\u0463'), ('\u0465', '\u0465'),
+ ('\u0467', '\u0467'), ('\u0469', '\u0469'),
+ ('\u046b', '\u046b'), ('\u046d', '\u046d'),
+ ('\u046f', '\u046f'), ('\u0471', '\u0471'),
+ ('\u0473', '\u0473'), ('\u0475', '\u0475'),
+ ('\u0477', '\u0477'), ('\u0479', '\u0479'),
+ ('\u047b', '\u047b'), ('\u047d', '\u047d'),
+ ('\u047f', '\u047f'), ('\u0481', '\u0481'),
+ ('\u048b', '\u048b'), ('\u048d', '\u048d'),
+ ('\u048f', '\u048f'), ('\u0491', '\u0491'),
+ ('\u0493', '\u0493'), ('\u0495', '\u0495'),
+ ('\u0497', '\u0497'), ('\u0499', '\u0499'),
+ ('\u049b', '\u049b'), ('\u049d', '\u049d'),
+ ('\u049f', '\u049f'), ('\u04a1', '\u04a1'),
+ ('\u04a3', '\u04a3'), ('\u04a5', '\u04a5'),
+ ('\u04a7', '\u04a7'), ('\u04a9', '\u04a9'),
+ ('\u04ab', '\u04ab'), ('\u04ad', '\u04ad'),
+ ('\u04af', '\u04af'), ('\u04b1', '\u04b1'),
+ ('\u04b3', '\u04b3'), ('\u04b5', '\u04b5'),
+ ('\u04b7', '\u04b7'), ('\u04b9', '\u04b9'),
+ ('\u04bb', '\u04bb'), ('\u04bd', '\u04bd'),
+ ('\u04bf', '\u04bf'), ('\u04c2', '\u04c2'),
+ ('\u04c4', '\u04c4'), ('\u04c6', '\u04c6'),
+ ('\u04c8', '\u04c8'), ('\u04ca', '\u04ca'),
+ ('\u04cc', '\u04cc'), ('\u04ce', '\u04cf'),
+ ('\u04d1', '\u04d1'), ('\u04d3', '\u04d3'),
+ ('\u04d5', '\u04d5'), ('\u04d7', '\u04d7'),
+ ('\u04d9', '\u04d9'), ('\u04db', '\u04db'),
+ ('\u04dd', '\u04dd'), ('\u04df', '\u04df'),
+ ('\u04e1', '\u04e1'), ('\u04e3', '\u04e3'),
+ ('\u04e5', '\u04e5'), ('\u04e7', '\u04e7'),
+ ('\u04e9', '\u04e9'), ('\u04eb', '\u04eb'),
+ ('\u04ed', '\u04ed'), ('\u04ef', '\u04ef'),
+ ('\u04f1', '\u04f1'), ('\u04f3', '\u04f3'),
+ ('\u04f5', '\u04f5'), ('\u04f7', '\u04f7'),
+ ('\u04f9', '\u04f9'), ('\u04fb', '\u04fb'),
+ ('\u04fd', '\u04fd'), ('\u04ff', '\u04ff'),
+ ('\u0501', '\u0501'), ('\u0503', '\u0503'),
+ ('\u0505', '\u0505'), ('\u0507', '\u0507'),
+ ('\u0509', '\u0509'), ('\u050b', '\u050b'),
+ ('\u050d', '\u050d'), ('\u050f', '\u050f'),
+ ('\u0511', '\u0511'), ('\u0513', '\u0513'),
+ ('\u0515', '\u0515'), ('\u0517', '\u0517'),
+ ('\u0519', '\u0519'), ('\u051b', '\u051b'),
+ ('\u051d', '\u051d'), ('\u051f', '\u051f'),
+ ('\u0521', '\u0521'), ('\u0523', '\u0523'),
+ ('\u0525', '\u0525'), ('\u0527', '\u0527'),
+ ('\u0561', '\u0587'), ('\u1d00', '\u1d2b'),
+ ('\u1d2c', '\u1d6a'), ('\u1d6b', '\u1d77'),
+ ('\u1d78', '\u1d78'), ('\u1d79', '\u1d9a'),
+ ('\u1d9b', '\u1dbf'), ('\u1e01', '\u1e01'),
+ ('\u1e03', '\u1e03'), ('\u1e05', '\u1e05'),
+ ('\u1e07', '\u1e07'), ('\u1e09', '\u1e09'),
+ ('\u1e0b', '\u1e0b'), ('\u1e0d', '\u1e0d'),
+ ('\u1e0f', '\u1e0f'), ('\u1e11', '\u1e11'),
+ ('\u1e13', '\u1e13'), ('\u1e15', '\u1e15'),
+ ('\u1e17', '\u1e17'), ('\u1e19', '\u1e19'),
+ ('\u1e1b', '\u1e1b'), ('\u1e1d', '\u1e1d'),
+ ('\u1e1f', '\u1e1f'), ('\u1e21', '\u1e21'),
+ ('\u1e23', '\u1e23'), ('\u1e25', '\u1e25'),
+ ('\u1e27', '\u1e27'), ('\u1e29', '\u1e29'),
+ ('\u1e2b', '\u1e2b'), ('\u1e2d', '\u1e2d'),
+ ('\u1e2f', '\u1e2f'), ('\u1e31', '\u1e31'),
+ ('\u1e33', '\u1e33'), ('\u1e35', '\u1e35'),
+ ('\u1e37', '\u1e37'), ('\u1e39', '\u1e39'),
+ ('\u1e3b', '\u1e3b'), ('\u1e3d', '\u1e3d'),
+ ('\u1e3f', '\u1e3f'), ('\u1e41', '\u1e41'),
+ ('\u1e43', '\u1e43'), ('\u1e45', '\u1e45'),
+ ('\u1e47', '\u1e47'), ('\u1e49', '\u1e49'),
+ ('\u1e4b', '\u1e4b'), ('\u1e4d', '\u1e4d'),
+ ('\u1e4f', '\u1e4f'), ('\u1e51', '\u1e51'),
+ ('\u1e53', '\u1e53'), ('\u1e55', '\u1e55'),
+ ('\u1e57', '\u1e57'), ('\u1e59', '\u1e59'),
+ ('\u1e5b', '\u1e5b'), ('\u1e5d', '\u1e5d'),
+ ('\u1e5f', '\u1e5f'), ('\u1e61', '\u1e61'),
+ ('\u1e63', '\u1e63'), ('\u1e65', '\u1e65'),
+ ('\u1e67', '\u1e67'), ('\u1e69', '\u1e69'),
+ ('\u1e6b', '\u1e6b'), ('\u1e6d', '\u1e6d'),
+ ('\u1e6f', '\u1e6f'), ('\u1e71', '\u1e71'),
+ ('\u1e73', '\u1e73'), ('\u1e75', '\u1e75'),
+ ('\u1e77', '\u1e77'), ('\u1e79', '\u1e79'),
+ ('\u1e7b', '\u1e7b'), ('\u1e7d', '\u1e7d'),
+ ('\u1e7f', '\u1e7f'), ('\u1e81', '\u1e81'),
+ ('\u1e83', '\u1e83'), ('\u1e85', '\u1e85'),
+ ('\u1e87', '\u1e87'), ('\u1e89', '\u1e89'),
+ ('\u1e8b', '\u1e8b'), ('\u1e8d', '\u1e8d'),
+ ('\u1e8f', '\u1e8f'), ('\u1e91', '\u1e91'),
+ ('\u1e93', '\u1e93'), ('\u1e95', '\u1e9d'),
+ ('\u1e9f', '\u1e9f'), ('\u1ea1', '\u1ea1'),
+ ('\u1ea3', '\u1ea3'), ('\u1ea5', '\u1ea5'),
+ ('\u1ea7', '\u1ea7'), ('\u1ea9', '\u1ea9'),
+ ('\u1eab', '\u1eab'), ('\u1ead', '\u1ead'),
+ ('\u1eaf', '\u1eaf'), ('\u1eb1', '\u1eb1'),
+ ('\u1eb3', '\u1eb3'), ('\u1eb5', '\u1eb5'),
+ ('\u1eb7', '\u1eb7'), ('\u1eb9', '\u1eb9'),
+ ('\u1ebb', '\u1ebb'), ('\u1ebd', '\u1ebd'),
+ ('\u1ebf', '\u1ebf'), ('\u1ec1', '\u1ec1'),
+ ('\u1ec3', '\u1ec3'), ('\u1ec5', '\u1ec5'),
+ ('\u1ec7', '\u1ec7'), ('\u1ec9', '\u1ec9'),
+ ('\u1ecb', '\u1ecb'), ('\u1ecd', '\u1ecd'),
+ ('\u1ecf', '\u1ecf'), ('\u1ed1', '\u1ed1'),
+ ('\u1ed3', '\u1ed3'), ('\u1ed5', '\u1ed5'),
+ ('\u1ed7', '\u1ed7'), ('\u1ed9', '\u1ed9'),
+ ('\u1edb', '\u1edb'), ('\u1edd', '\u1edd'),
+ ('\u1edf', '\u1edf'), ('\u1ee1', '\u1ee1'),
+ ('\u1ee3', '\u1ee3'), ('\u1ee5', '\u1ee5'),
+ ('\u1ee7', '\u1ee7'), ('\u1ee9', '\u1ee9'),
+ ('\u1eeb', '\u1eeb'), ('\u1eed', '\u1eed'),
+ ('\u1eef', '\u1eef'), ('\u1ef1', '\u1ef1'),
+ ('\u1ef3', '\u1ef3'), ('\u1ef5', '\u1ef5'),
+ ('\u1ef7', '\u1ef7'), ('\u1ef9', '\u1ef9'),
+ ('\u1efb', '\u1efb'), ('\u1efd', '\u1efd'),
+ ('\u1eff', '\u1f07'), ('\u1f10', '\u1f15'),
+ ('\u1f20', '\u1f27'), ('\u1f30', '\u1f37'),
+ ('\u1f40', '\u1f45'), ('\u1f50', '\u1f57'),
+ ('\u1f60', '\u1f67'), ('\u1f70', '\u1f7d'),
+ ('\u1f80', '\u1f87'), ('\u1f90', '\u1f97'),
+ ('\u1fa0', '\u1fa7'), ('\u1fb0', '\u1fb4'),
+ ('\u1fb6', '\u1fb7'), ('\u1fbe', '\u1fbe'),
+ ('\u1fc2', '\u1fc4'), ('\u1fc6', '\u1fc7'),
+ ('\u1fd0', '\u1fd3'), ('\u1fd6', '\u1fd7'),
+ ('\u1fe0', '\u1fe7'), ('\u1ff2', '\u1ff4'),
+ ('\u1ff6', '\u1ff7'), ('\u2071', '\u2071'),
+ ('\u207f', '\u207f'), ('\u2090', '\u209c'),
+ ('\u210a', '\u210a'), ('\u210e', '\u210f'),
+ ('\u2113', '\u2113'), ('\u212f', '\u212f'),
+ ('\u2134', '\u2134'), ('\u2139', '\u2139'),
+ ('\u213c', '\u213d'), ('\u2146', '\u2149'),
+ ('\u214e', '\u214e'), ('\u2170', '\u217f'),
+ ('\u2184', '\u2184'), ('\u24d0', '\u24e9'),
+ ('\u2c30', '\u2c5e'), ('\u2c61', '\u2c61'),
+ ('\u2c65', '\u2c66'), ('\u2c68', '\u2c68'),
+ ('\u2c6a', '\u2c6a'), ('\u2c6c', '\u2c6c'),
+ ('\u2c71', '\u2c71'), ('\u2c73', '\u2c74'),
+ ('\u2c76', '\u2c7b'), ('\u2c7c', '\u2c7d'),
+ ('\u2c81', '\u2c81'), ('\u2c83', '\u2c83'),
+ ('\u2c85', '\u2c85'), ('\u2c87', '\u2c87'),
+ ('\u2c89', '\u2c89'), ('\u2c8b', '\u2c8b'),
+ ('\u2c8d', '\u2c8d'), ('\u2c8f', '\u2c8f'),
+ ('\u2c91', '\u2c91'), ('\u2c93', '\u2c93'),
+ ('\u2c95', '\u2c95'), ('\u2c97', '\u2c97'),
+ ('\u2c99', '\u2c99'), ('\u2c9b', '\u2c9b'),
+ ('\u2c9d', '\u2c9d'), ('\u2c9f', '\u2c9f'),
+ ('\u2ca1', '\u2ca1'), ('\u2ca3', '\u2ca3'),
+ ('\u2ca5', '\u2ca5'), ('\u2ca7', '\u2ca7'),
+ ('\u2ca9', '\u2ca9'), ('\u2cab', '\u2cab'),
+ ('\u2cad', '\u2cad'), ('\u2caf', '\u2caf'),
+ ('\u2cb1', '\u2cb1'), ('\u2cb3', '\u2cb3'),
+ ('\u2cb5', '\u2cb5'), ('\u2cb7', '\u2cb7'),
+ ('\u2cb9', '\u2cb9'), ('\u2cbb', '\u2cbb'),
+ ('\u2cbd', '\u2cbd'), ('\u2cbf', '\u2cbf'),
+ ('\u2cc1', '\u2cc1'), ('\u2cc3', '\u2cc3'),
+ ('\u2cc5', '\u2cc5'), ('\u2cc7', '\u2cc7'),
+ ('\u2cc9', '\u2cc9'), ('\u2ccb', '\u2ccb'),
+ ('\u2ccd', '\u2ccd'), ('\u2ccf', '\u2ccf'),
+ ('\u2cd1', '\u2cd1'), ('\u2cd3', '\u2cd3'),
+ ('\u2cd5', '\u2cd5'), ('\u2cd7', '\u2cd7'),
+ ('\u2cd9', '\u2cd9'), ('\u2cdb', '\u2cdb'),
+ ('\u2cdd', '\u2cdd'), ('\u2cdf', '\u2cdf'),
+ ('\u2ce1', '\u2ce1'), ('\u2ce3', '\u2ce4'),
+ ('\u2cec', '\u2cec'), ('\u2cee', '\u2cee'),
+ ('\u2cf3', '\u2cf3'), ('\u2d00', '\u2d25'),
+ ('\u2d27', '\u2d27'), ('\u2d2d', '\u2d2d'),
+ ('\ua641', '\ua641'), ('\ua643', '\ua643'),
+ ('\ua645', '\ua645'), ('\ua647', '\ua647'),
+ ('\ua649', '\ua649'), ('\ua64b', '\ua64b'),
+ ('\ua64d', '\ua64d'), ('\ua64f', '\ua64f'),
+ ('\ua651', '\ua651'), ('\ua653', '\ua653'),
+ ('\ua655', '\ua655'), ('\ua657', '\ua657'),
+ ('\ua659', '\ua659'), ('\ua65b', '\ua65b'),
+ ('\ua65d', '\ua65d'), ('\ua65f', '\ua65f'),
+ ('\ua661', '\ua661'), ('\ua663', '\ua663'),
+ ('\ua665', '\ua665'), ('\ua667', '\ua667'),
+ ('\ua669', '\ua669'), ('\ua66b', '\ua66b'),
+ ('\ua66d', '\ua66d'), ('\ua681', '\ua681'),
+ ('\ua683', '\ua683'), ('\ua685', '\ua685'),
+ ('\ua687', '\ua687'), ('\ua689', '\ua689'),
+ ('\ua68b', '\ua68b'), ('\ua68d', '\ua68d'),
+ ('\ua68f', '\ua68f'), ('\ua691', '\ua691'),
+ ('\ua693', '\ua693'), ('\ua695', '\ua695'),
+ ('\ua697', '\ua697'), ('\ua723', '\ua723'),
+ ('\ua725', '\ua725'), ('\ua727', '\ua727'),
+ ('\ua729', '\ua729'), ('\ua72b', '\ua72b'),
+ ('\ua72d', '\ua72d'), ('\ua72f', '\ua731'),
+ ('\ua733', '\ua733'), ('\ua735', '\ua735'),
+ ('\ua737', '\ua737'), ('\ua739', '\ua739'),
+ ('\ua73b', '\ua73b'), ('\ua73d', '\ua73d'),
+ ('\ua73f', '\ua73f'), ('\ua741', '\ua741'),
+ ('\ua743', '\ua743'), ('\ua745', '\ua745'),
+ ('\ua747', '\ua747'), ('\ua749', '\ua749'),
+ ('\ua74b', '\ua74b'), ('\ua74d', '\ua74d'),
+ ('\ua74f', '\ua74f'), ('\ua751', '\ua751'),
+ ('\ua753', '\ua753'), ('\ua755', '\ua755'),
+ ('\ua757', '\ua757'), ('\ua759', '\ua759'),
+ ('\ua75b', '\ua75b'), ('\ua75d', '\ua75d'),
+ ('\ua75f', '\ua75f'), ('\ua761', '\ua761'),
+ ('\ua763', '\ua763'), ('\ua765', '\ua765'),
+ ('\ua767', '\ua767'), ('\ua769', '\ua769'),
+ ('\ua76b', '\ua76b'), ('\ua76d', '\ua76d'),
+ ('\ua76f', '\ua76f'), ('\ua770', '\ua770'),
+ ('\ua771', '\ua778'), ('\ua77a', '\ua77a'),
+ ('\ua77c', '\ua77c'), ('\ua77f', '\ua77f'),
+ ('\ua781', '\ua781'), ('\ua783', '\ua783'),
+ ('\ua785', '\ua785'), ('\ua787', '\ua787'),
+ ('\ua78c', '\ua78c'), ('\ua78e', '\ua78e'),
+ ('\ua791', '\ua791'), ('\ua793', '\ua793'),
+ ('\ua7a1', '\ua7a1'), ('\ua7a3', '\ua7a3'),
+ ('\ua7a5', '\ua7a5'), ('\ua7a7', '\ua7a7'),
+ ('\ua7a9', '\ua7a9'), ('\ua7f8', '\ua7f9'),
+ ('\ua7fa', '\ua7fa'), ('\ufb00', '\ufb06'),
+ ('\ufb13', '\ufb17'), ('\uff41', '\uff5a'),
+ ('\U00010428', '\U0001044f'), ('\U0001d41a', '\U0001d433'),
+ ('\U0001d44e', '\U0001d454'), ('\U0001d456', '\U0001d467'),
+ ('\U0001d482', '\U0001d49b'), ('\U0001d4b6', '\U0001d4b9'),
+ ('\U0001d4bb', '\U0001d4bb'), ('\U0001d4bd', '\U0001d4c3'),
+ ('\U0001d4c5', '\U0001d4cf'), ('\U0001d4ea', '\U0001d503'),
+ ('\U0001d51e', '\U0001d537'), ('\U0001d552', '\U0001d56b'),
+ ('\U0001d586', '\U0001d59f'), ('\U0001d5ba', '\U0001d5d3'),
+ ('\U0001d5ee', '\U0001d607'), ('\U0001d622', '\U0001d63b'),
+ ('\U0001d656', '\U0001d66f'), ('\U0001d68a', '\U0001d6a5'),
+ ('\U0001d6c2', '\U0001d6da'), ('\U0001d6dc', '\U0001d6e1'),
+ ('\U0001d6fc', '\U0001d714'), ('\U0001d716', '\U0001d71b'),
+ ('\U0001d736', '\U0001d74e'), ('\U0001d750', '\U0001d755'),
+ ('\U0001d770', '\U0001d788'), ('\U0001d78a', '\U0001d78f'),
+ ('\U0001d7aa', '\U0001d7c2'), ('\U0001d7c4', '\U0001d7c9'),
+ ('\U0001d7cb', '\U0001d7cb')
+ ];
+
+ pub fn Lowercase(c: char) -> bool {
+ super::bsearch_range_table(c, Lowercase_table)
+ }
+
+ static Uppercase_table : &'static [(char,char)] = &[
+ ('\x41', '\x5a'), ('\xc0', '\xd6'),
+ ('\xd8', '\xde'), ('\u0100', '\u0100'),
+ ('\u0102', '\u0102'), ('\u0104', '\u0104'),
+ ('\u0106', '\u0106'), ('\u0108', '\u0108'),
+ ('\u010a', '\u010a'), ('\u010c', '\u010c'),
+ ('\u010e', '\u010e'), ('\u0110', '\u0110'),
+ ('\u0112', '\u0112'), ('\u0114', '\u0114'),
+ ('\u0116', '\u0116'), ('\u0118', '\u0118'),
+ ('\u011a', '\u011a'), ('\u011c', '\u011c'),
+ ('\u011e', '\u011e'), ('\u0120', '\u0120'),
+ ('\u0122', '\u0122'), ('\u0124', '\u0124'),
+ ('\u0126', '\u0126'), ('\u0128', '\u0128'),
+ ('\u012a', '\u012a'), ('\u012c', '\u012c'),
+ ('\u012e', '\u012e'), ('\u0130', '\u0130'),
+ ('\u0132', '\u0132'), ('\u0134', '\u0134'),
+ ('\u0136', '\u0136'), ('\u0139', '\u0139'),
+ ('\u013b', '\u013b'), ('\u013d', '\u013d'),
+ ('\u013f', '\u013f'), ('\u0141', '\u0141'),
+ ('\u0143', '\u0143'), ('\u0145', '\u0145'),
+ ('\u0147', '\u0147'), ('\u014a', '\u014a'),
+ ('\u014c', '\u014c'), ('\u014e', '\u014e'),
+ ('\u0150', '\u0150'), ('\u0152', '\u0152'),
+ ('\u0154', '\u0154'), ('\u0156', '\u0156'),
+ ('\u0158', '\u0158'), ('\u015a', '\u015a'),
+ ('\u015c', '\u015c'), ('\u015e', '\u015e'),
+ ('\u0160', '\u0160'), ('\u0162', '\u0162'),
+ ('\u0164', '\u0164'), ('\u0166', '\u0166'),
+ ('\u0168', '\u0168'), ('\u016a', '\u016a'),
+ ('\u016c', '\u016c'), ('\u016e', '\u016e'),
+ ('\u0170', '\u0170'), ('\u0172', '\u0172'),
+ ('\u0174', '\u0174'), ('\u0176', '\u0176'),
+ ('\u0178', '\u0179'), ('\u017b', '\u017b'),
+ ('\u017d', '\u017d'), ('\u0181', '\u0182'),
+ ('\u0184', '\u0184'), ('\u0186', '\u0187'),
+ ('\u0189', '\u018b'), ('\u018e', '\u0191'),
+ ('\u0193', '\u0194'), ('\u0196', '\u0198'),
+ ('\u019c', '\u019d'), ('\u019f', '\u01a0'),
+ ('\u01a2', '\u01a2'), ('\u01a4', '\u01a4'),
+ ('\u01a6', '\u01a7'), ('\u01a9', '\u01a9'),
+ ('\u01ac', '\u01ac'), ('\u01ae', '\u01af'),
+ ('\u01b1', '\u01b3'), ('\u01b5', '\u01b5'),
+ ('\u01b7', '\u01b8'), ('\u01bc', '\u01bc'),
+ ('\u01c4', '\u01c4'), ('\u01c7', '\u01c7'),
+ ('\u01ca', '\u01ca'), ('\u01cd', '\u01cd'),
+ ('\u01cf', '\u01cf'), ('\u01d1', '\u01d1'),
+ ('\u01d3', '\u01d3'), ('\u01d5', '\u01d5'),
+ ('\u01d7', '\u01d7'), ('\u01d9', '\u01d9'),
+ ('\u01db', '\u01db'), ('\u01de', '\u01de'),
+ ('\u01e0', '\u01e0'), ('\u01e2', '\u01e2'),
+ ('\u01e4', '\u01e4'), ('\u01e6', '\u01e6'),
+ ('\u01e8', '\u01e8'), ('\u01ea', '\u01ea'),
+ ('\u01ec', '\u01ec'), ('\u01ee', '\u01ee'),
+ ('\u01f1', '\u01f1'), ('\u01f4', '\u01f4'),
+ ('\u01f6', '\u01f8'), ('\u01fa', '\u01fa'),
+ ('\u01fc', '\u01fc'), ('\u01fe', '\u01fe'),
+ ('\u0200', '\u0200'), ('\u0202', '\u0202'),
+ ('\u0204', '\u0204'), ('\u0206', '\u0206'),
+ ('\u0208', '\u0208'), ('\u020a', '\u020a'),
+ ('\u020c', '\u020c'), ('\u020e', '\u020e'),
+ ('\u0210', '\u0210'), ('\u0212', '\u0212'),
+ ('\u0214', '\u0214'), ('\u0216', '\u0216'),
+ ('\u0218', '\u0218'), ('\u021a', '\u021a'),
+ ('\u021c', '\u021c'), ('\u021e', '\u021e'),
+ ('\u0220', '\u0220'), ('\u0222', '\u0222'),
+ ('\u0224', '\u0224'), ('\u0226', '\u0226'),
+ ('\u0228', '\u0228'), ('\u022a', '\u022a'),
+ ('\u022c', '\u022c'), ('\u022e', '\u022e'),
+ ('\u0230', '\u0230'), ('\u0232', '\u0232'),
+ ('\u023a', '\u023b'), ('\u023d', '\u023e'),
+ ('\u0241', '\u0241'), ('\u0243', '\u0246'),
+ ('\u0248', '\u0248'), ('\u024a', '\u024a'),
+ ('\u024c', '\u024c'), ('\u024e', '\u024e'),
+ ('\u0370', '\u0370'), ('\u0372', '\u0372'),
+ ('\u0376', '\u0376'), ('\u0386', '\u0386'),
+ ('\u0388', '\u038a'), ('\u038c', '\u038c'),
+ ('\u038e', '\u038f'), ('\u0391', '\u03a1'),
+ ('\u03a3', '\u03ab'), ('\u03cf', '\u03cf'),
+ ('\u03d2', '\u03d4'), ('\u03d8', '\u03d8'),
+ ('\u03da', '\u03da'), ('\u03dc', '\u03dc'),
+ ('\u03de', '\u03de'), ('\u03e0', '\u03e0'),
+ ('\u03e2', '\u03e2'), ('\u03e4', '\u03e4'),
+ ('\u03e6', '\u03e6'), ('\u03e8', '\u03e8'),
+ ('\u03ea', '\u03ea'), ('\u03ec', '\u03ec'),
+ ('\u03ee', '\u03ee'), ('\u03f4', '\u03f4'),
+ ('\u03f7', '\u03f7'), ('\u03f9', '\u03fa'),
+ ('\u03fd', '\u042f'), ('\u0460', '\u0460'),
+ ('\u0462', '\u0462'), ('\u0464', '\u0464'),
+ ('\u0466', '\u0466'), ('\u0468', '\u0468'),
+ ('\u046a', '\u046a'), ('\u046c', '\u046c'),
+ ('\u046e', '\u046e'), ('\u0470', '\u0470'),
+ ('\u0472', '\u0472'), ('\u0474', '\u0474'),
+ ('\u0476', '\u0476'), ('\u0478', '\u0478'),
+ ('\u047a', '\u047a'), ('\u047c', '\u047c'),
+ ('\u047e', '\u047e'), ('\u0480', '\u0480'),
+ ('\u048a', '\u048a'), ('\u048c', '\u048c'),
+ ('\u048e', '\u048e'), ('\u0490', '\u0490'),
+ ('\u0492', '\u0492'), ('\u0494', '\u0494'),
+ ('\u0496', '\u0496'), ('\u0498', '\u0498'),
+ ('\u049a', '\u049a'), ('\u049c', '\u049c'),
+ ('\u049e', '\u049e'), ('\u04a0', '\u04a0'),
+ ('\u04a2', '\u04a2'), ('\u04a4', '\u04a4'),
+ ('\u04a6', '\u04a6'), ('\u04a8', '\u04a8'),
+ ('\u04aa', '\u04aa'), ('\u04ac', '\u04ac'),
+ ('\u04ae', '\u04ae'), ('\u04b0', '\u04b0'),
+ ('\u04b2', '\u04b2'), ('\u04b4', '\u04b4'),
+ ('\u04b6', '\u04b6'), ('\u04b8', '\u04b8'),
+ ('\u04ba', '\u04ba'), ('\u04bc', '\u04bc'),
+ ('\u04be', '\u04be'), ('\u04c0', '\u04c1'),
+ ('\u04c3', '\u04c3'), ('\u04c5', '\u04c5'),
+ ('\u04c7', '\u04c7'), ('\u04c9', '\u04c9'),
+ ('\u04cb', '\u04cb'), ('\u04cd', '\u04cd'),
+ ('\u04d0', '\u04d0'), ('\u04d2', '\u04d2'),
+ ('\u04d4', '\u04d4'), ('\u04d6', '\u04d6'),
+ ('\u04d8', '\u04d8'), ('\u04da', '\u04da'),
+ ('\u04dc', '\u04dc'), ('\u04de', '\u04de'),
+ ('\u04e0', '\u04e0'), ('\u04e2', '\u04e2'),
+ ('\u04e4', '\u04e4'), ('\u04e6', '\u04e6'),
+ ('\u04e8', '\u04e8'), ('\u04ea', '\u04ea'),
+ ('\u04ec', '\u04ec'), ('\u04ee', '\u04ee'),
+ ('\u04f0', '\u04f0'), ('\u04f2', '\u04f2'),
+ ('\u04f4', '\u04f4'), ('\u04f6', '\u04f6'),
+ ('\u04f8', '\u04f8'), ('\u04fa', '\u04fa'),
+ ('\u04fc', '\u04fc'), ('\u04fe', '\u04fe'),
+ ('\u0500', '\u0500'), ('\u0502', '\u0502'),
+ ('\u0504', '\u0504'), ('\u0506', '\u0506'),
+ ('\u0508', '\u0508'), ('\u050a', '\u050a'),
+ ('\u050c', '\u050c'), ('\u050e', '\u050e'),
+ ('\u0510', '\u0510'), ('\u0512', '\u0512'),
+ ('\u0514', '\u0514'), ('\u0516', '\u0516'),
+ ('\u0518', '\u0518'), ('\u051a', '\u051a'),
+ ('\u051c', '\u051c'), ('\u051e', '\u051e'),
+ ('\u0520', '\u0520'), ('\u0522', '\u0522'),
+ ('\u0524', '\u0524'), ('\u0526', '\u0526'),
+ ('\u0531', '\u0556'), ('\u10a0', '\u10c5'),
+ ('\u10c7', '\u10c7'), ('\u10cd', '\u10cd'),
+ ('\u1e00', '\u1e00'), ('\u1e02', '\u1e02'),
+ ('\u1e04', '\u1e04'), ('\u1e06', '\u1e06'),
+ ('\u1e08', '\u1e08'), ('\u1e0a', '\u1e0a'),
+ ('\u1e0c', '\u1e0c'), ('\u1e0e', '\u1e0e'),
+ ('\u1e10', '\u1e10'), ('\u1e12', '\u1e12'),
+ ('\u1e14', '\u1e14'), ('\u1e16', '\u1e16'),
+ ('\u1e18', '\u1e18'), ('\u1e1a', '\u1e1a'),
+ ('\u1e1c', '\u1e1c'), ('\u1e1e', '\u1e1e'),
+ ('\u1e20', '\u1e20'), ('\u1e22', '\u1e22'),
+ ('\u1e24', '\u1e24'), ('\u1e26', '\u1e26'),
+ ('\u1e28', '\u1e28'), ('\u1e2a', '\u1e2a'),
+ ('\u1e2c', '\u1e2c'), ('\u1e2e', '\u1e2e'),
+ ('\u1e30', '\u1e30'), ('\u1e32', '\u1e32'),
+ ('\u1e34', '\u1e34'), ('\u1e36', '\u1e36'),
+ ('\u1e38', '\u1e38'), ('\u1e3a', '\u1e3a'),
+ ('\u1e3c', '\u1e3c'), ('\u1e3e', '\u1e3e'),
+ ('\u1e40', '\u1e40'), ('\u1e42', '\u1e42'),
+ ('\u1e44', '\u1e44'), ('\u1e46', '\u1e46'),
+ ('\u1e48', '\u1e48'), ('\u1e4a', '\u1e4a'),
+ ('\u1e4c', '\u1e4c'), ('\u1e4e', '\u1e4e'),
+ ('\u1e50', '\u1e50'), ('\u1e52', '\u1e52'),
+ ('\u1e54', '\u1e54'), ('\u1e56', '\u1e56'),
+ ('\u1e58', '\u1e58'), ('\u1e5a', '\u1e5a'),
+ ('\u1e5c', '\u1e5c'), ('\u1e5e', '\u1e5e'),
+ ('\u1e60', '\u1e60'), ('\u1e62', '\u1e62'),
+ ('\u1e64', '\u1e64'), ('\u1e66', '\u1e66'),
+ ('\u1e68', '\u1e68'), ('\u1e6a', '\u1e6a'),
+ ('\u1e6c', '\u1e6c'), ('\u1e6e', '\u1e6e'),
+ ('\u1e70', '\u1e70'), ('\u1e72', '\u1e72'),
+ ('\u1e74', '\u1e74'), ('\u1e76', '\u1e76'),
+ ('\u1e78', '\u1e78'), ('\u1e7a', '\u1e7a'),
+ ('\u1e7c', '\u1e7c'), ('\u1e7e', '\u1e7e'),
+ ('\u1e80', '\u1e80'), ('\u1e82', '\u1e82'),
+ ('\u1e84', '\u1e84'), ('\u1e86', '\u1e86'),
+ ('\u1e88', '\u1e88'), ('\u1e8a', '\u1e8a'),
+ ('\u1e8c', '\u1e8c'), ('\u1e8e', '\u1e8e'),
+ ('\u1e90', '\u1e90'), ('\u1e92', '\u1e92'),
+ ('\u1e94', '\u1e94'), ('\u1e9e', '\u1e9e'),
+ ('\u1ea0', '\u1ea0'), ('\u1ea2', '\u1ea2'),
+ ('\u1ea4', '\u1ea4'), ('\u1ea6', '\u1ea6'),
+ ('\u1ea8', '\u1ea8'), ('\u1eaa', '\u1eaa'),
+ ('\u1eac', '\u1eac'), ('\u1eae', '\u1eae'),
+ ('\u1eb0', '\u1eb0'), ('\u1eb2', '\u1eb2'),
+ ('\u1eb4', '\u1eb4'), ('\u1eb6', '\u1eb6'),
+ ('\u1eb8', '\u1eb8'), ('\u1eba', '\u1eba'),
+ ('\u1ebc', '\u1ebc'), ('\u1ebe', '\u1ebe'),
+ ('\u1ec0', '\u1ec0'), ('\u1ec2', '\u1ec2'),
+ ('\u1ec4', '\u1ec4'), ('\u1ec6', '\u1ec6'),
+ ('\u1ec8', '\u1ec8'), ('\u1eca', '\u1eca'),
+ ('\u1ecc', '\u1ecc'), ('\u1ece', '\u1ece'),
+ ('\u1ed0', '\u1ed0'), ('\u1ed2', '\u1ed2'),
+ ('\u1ed4', '\u1ed4'), ('\u1ed6', '\u1ed6'),
+ ('\u1ed8', '\u1ed8'), ('\u1eda', '\u1eda'),
+ ('\u1edc', '\u1edc'), ('\u1ede', '\u1ede'),
+ ('\u1ee0', '\u1ee0'), ('\u1ee2', '\u1ee2'),
+ ('\u1ee4', '\u1ee4'), ('\u1ee6', '\u1ee6'),
+ ('\u1ee8', '\u1ee8'), ('\u1eea', '\u1eea'),
+ ('\u1eec', '\u1eec'), ('\u1eee', '\u1eee'),
+ ('\u1ef0', '\u1ef0'), ('\u1ef2', '\u1ef2'),
+ ('\u1ef4', '\u1ef4'), ('\u1ef6', '\u1ef6'),
+ ('\u1ef8', '\u1ef8'), ('\u1efa', '\u1efa'),
+ ('\u1efc', '\u1efc'), ('\u1efe', '\u1efe'),
+ ('\u1f08', '\u1f0f'), ('\u1f18', '\u1f1d'),
+ ('\u1f28', '\u1f2f'), ('\u1f38', '\u1f3f'),
+ ('\u1f48', '\u1f4d'), ('\u1f59', '\u1f59'),
+ ('\u1f5b', '\u1f5b'), ('\u1f5d', '\u1f5d'),
+ ('\u1f5f', '\u1f5f'), ('\u1f68', '\u1f6f'),
+ ('\u1fb8', '\u1fbb'), ('\u1fc8', '\u1fcb'),
+ ('\u1fd8', '\u1fdb'), ('\u1fe8', '\u1fec'),
+ ('\u1ff8', '\u1ffb'), ('\u2102', '\u2102'),
+ ('\u2107', '\u2107'), ('\u210b', '\u210d'),
+ ('\u2110', '\u2112'), ('\u2115', '\u2115'),
+ ('\u2119', '\u211d'), ('\u2124', '\u2124'),
+ ('\u2126', '\u2126'), ('\u2128', '\u2128'),
+ ('\u212a', '\u212d'), ('\u2130', '\u2133'),
+ ('\u213e', '\u213f'), ('\u2145', '\u2145'),
+ ('\u2160', '\u216f'), ('\u2183', '\u2183'),
+ ('\u24b6', '\u24cf'), ('\u2c00', '\u2c2e'),
+ ('\u2c60', '\u2c60'), ('\u2c62', '\u2c64'),
+ ('\u2c67', '\u2c67'), ('\u2c69', '\u2c69'),
+ ('\u2c6b', '\u2c6b'), ('\u2c6d', '\u2c70'),
+ ('\u2c72', '\u2c72'), ('\u2c75', '\u2c75'),
+ ('\u2c7e', '\u2c80'), ('\u2c82', '\u2c82'),
+ ('\u2c84', '\u2c84'), ('\u2c86', '\u2c86'),
+ ('\u2c88', '\u2c88'), ('\u2c8a', '\u2c8a'),
+ ('\u2c8c', '\u2c8c'), ('\u2c8e', '\u2c8e'),
+ ('\u2c90', '\u2c90'), ('\u2c92', '\u2c92'),
+ ('\u2c94', '\u2c94'), ('\u2c96', '\u2c96'),
+ ('\u2c98', '\u2c98'), ('\u2c9a', '\u2c9a'),
+ ('\u2c9c', '\u2c9c'), ('\u2c9e', '\u2c9e'),
+ ('\u2ca0', '\u2ca0'), ('\u2ca2', '\u2ca2'),
+ ('\u2ca4', '\u2ca4'), ('\u2ca6', '\u2ca6'),
+ ('\u2ca8', '\u2ca8'), ('\u2caa', '\u2caa'),
+ ('\u2cac', '\u2cac'), ('\u2cae', '\u2cae'),
+ ('\u2cb0', '\u2cb0'), ('\u2cb2', '\u2cb2'),
+ ('\u2cb4', '\u2cb4'), ('\u2cb6', '\u2cb6'),
+ ('\u2cb8', '\u2cb8'), ('\u2cba', '\u2cba'),
+ ('\u2cbc', '\u2cbc'), ('\u2cbe', '\u2cbe'),
+ ('\u2cc0', '\u2cc0'), ('\u2cc2', '\u2cc2'),
+ ('\u2cc4', '\u2cc4'), ('\u2cc6', '\u2cc6'),
+ ('\u2cc8', '\u2cc8'), ('\u2cca', '\u2cca'),
+ ('\u2ccc', '\u2ccc'), ('\u2cce', '\u2cce'),
+ ('\u2cd0', '\u2cd0'), ('\u2cd2', '\u2cd2'),
+ ('\u2cd4', '\u2cd4'), ('\u2cd6', '\u2cd6'),
+ ('\u2cd8', '\u2cd8'), ('\u2cda', '\u2cda'),
+ ('\u2cdc', '\u2cdc'), ('\u2cde', '\u2cde'),
+ ('\u2ce0', '\u2ce0'), ('\u2ce2', '\u2ce2'),
+ ('\u2ceb', '\u2ceb'), ('\u2ced', '\u2ced'),
+ ('\u2cf2', '\u2cf2'), ('\ua640', '\ua640'),
+ ('\ua642', '\ua642'), ('\ua644', '\ua644'),
+ ('\ua646', '\ua646'), ('\ua648', '\ua648'),
+ ('\ua64a', '\ua64a'), ('\ua64c', '\ua64c'),
+ ('\ua64e', '\ua64e'), ('\ua650', '\ua650'),
+ ('\ua652', '\ua652'), ('\ua654', '\ua654'),
+ ('\ua656', '\ua656'), ('\ua658', '\ua658'),
+ ('\ua65a', '\ua65a'), ('\ua65c', '\ua65c'),
+ ('\ua65e', '\ua65e'), ('\ua660', '\ua660'),
+ ('\ua662', '\ua662'), ('\ua664', '\ua664'),
+ ('\ua666', '\ua666'), ('\ua668', '\ua668'),
+ ('\ua66a', '\ua66a'), ('\ua66c', '\ua66c'),
+ ('\ua680', '\ua680'), ('\ua682', '\ua682'),
+ ('\ua684', '\ua684'), ('\ua686', '\ua686'),
+ ('\ua688', '\ua688'), ('\ua68a', '\ua68a'),
+ ('\ua68c', '\ua68c'), ('\ua68e', '\ua68e'),
+ ('\ua690', '\ua690'), ('\ua692', '\ua692'),
+ ('\ua694', '\ua694'), ('\ua696', '\ua696'),
+ ('\ua722', '\ua722'), ('\ua724', '\ua724'),
+ ('\ua726', '\ua726'), ('\ua728', '\ua728'),
+ ('\ua72a', '\ua72a'), ('\ua72c', '\ua72c'),
+ ('\ua72e', '\ua72e'), ('\ua732', '\ua732'),
+ ('\ua734', '\ua734'), ('\ua736', '\ua736'),
+ ('\ua738', '\ua738'), ('\ua73a', '\ua73a'),
+ ('\ua73c', '\ua73c'), ('\ua73e', '\ua73e'),
+ ('\ua740', '\ua740'), ('\ua742', '\ua742'),
+ ('\ua744', '\ua744'), ('\ua746', '\ua746'),
+ ('\ua748', '\ua748'), ('\ua74a', '\ua74a'),
+ ('\ua74c', '\ua74c'), ('\ua74e', '\ua74e'),
+ ('\ua750', '\ua750'), ('\ua752', '\ua752'),
+ ('\ua754', '\ua754'), ('\ua756', '\ua756'),
+ ('\ua758', '\ua758'), ('\ua75a', '\ua75a'),
+ ('\ua75c', '\ua75c'), ('\ua75e', '\ua75e'),
+ ('\ua760', '\ua760'), ('\ua762', '\ua762'),
+ ('\ua764', '\ua764'), ('\ua766', '\ua766'),
+ ('\ua768', '\ua768'), ('\ua76a', '\ua76a'),
+ ('\ua76c', '\ua76c'), ('\ua76e', '\ua76e'),
+ ('\ua779', '\ua779'), ('\ua77b', '\ua77b'),
+ ('\ua77d', '\ua77e'), ('\ua780', '\ua780'),
+ ('\ua782', '\ua782'), ('\ua784', '\ua784'),
+ ('\ua786', '\ua786'), ('\ua78b', '\ua78b'),
+ ('\ua78d', '\ua78d'), ('\ua790', '\ua790'),
+ ('\ua792', '\ua792'), ('\ua7a0', '\ua7a0'),
+ ('\ua7a2', '\ua7a2'), ('\ua7a4', '\ua7a4'),
+ ('\ua7a6', '\ua7a6'), ('\ua7a8', '\ua7a8'),
+ ('\ua7aa', '\ua7aa'), ('\uff21', '\uff3a'),
+ ('\U00010400', '\U00010427'), ('\U0001d400', '\U0001d419'),
+ ('\U0001d434', '\U0001d44d'), ('\U0001d468', '\U0001d481'),
+ ('\U0001d49c', '\U0001d49c'), ('\U0001d49e', '\U0001d49f'),
+ ('\U0001d4a2', '\U0001d4a2'), ('\U0001d4a5', '\U0001d4a6'),
+ ('\U0001d4a9', '\U0001d4ac'), ('\U0001d4ae', '\U0001d4b5'),
+ ('\U0001d4d0', '\U0001d4e9'), ('\U0001d504', '\U0001d505'),
+ ('\U0001d507', '\U0001d50a'), ('\U0001d50d', '\U0001d514'),
+ ('\U0001d516', '\U0001d51c'), ('\U0001d538', '\U0001d539'),
+ ('\U0001d53b', '\U0001d53e'), ('\U0001d540', '\U0001d544'),
+ ('\U0001d546', '\U0001d546'), ('\U0001d54a', '\U0001d550'),
+ ('\U0001d56c', '\U0001d585'), ('\U0001d5a0', '\U0001d5b9'),
+ ('\U0001d5d4', '\U0001d5ed'), ('\U0001d608', '\U0001d621'),
+ ('\U0001d63c', '\U0001d655'), ('\U0001d670', '\U0001d689'),
+ ('\U0001d6a8', '\U0001d6c0'), ('\U0001d6e2', '\U0001d6fa'),
+ ('\U0001d71c', '\U0001d734'), ('\U0001d756', '\U0001d76e'),
+ ('\U0001d790', '\U0001d7a8'), ('\U0001d7ca', '\U0001d7ca')
+ ];
+
+ pub fn Uppercase(c: char) -> bool {
+ super::bsearch_range_table(c, Uppercase_table)
+ }
+
+ static XID_Continue_table : &'static [(char,char)] = &[
+ ('\x30', '\x39'), ('\x41', '\x5a'),
+ ('\x5f', '\x5f'), ('\x61', '\x7a'),
+ ('\xaa', '\xaa'), ('\xb5', '\xb5'),
+ ('\xb7', '\xb7'), ('\xba', '\xba'),
+ ('\xc0', '\xd6'), ('\xd8', '\xf6'),
+ ('\xf8', '\u01ba'), ('\u01bb', '\u01bb'),
+ ('\u01bc', '\u01bf'), ('\u01c0', '\u01c3'),
+ ('\u01c4', '\u0293'), ('\u0294', '\u0294'),
+ ('\u0295', '\u02af'), ('\u02b0', '\u02c1'),
+ ('\u02c6', '\u02d1'), ('\u02e0', '\u02e4'),
+ ('\u02ec', '\u02ec'), ('\u02ee', '\u02ee'),
+ ('\u0300', '\u036f'), ('\u0370', '\u0373'),
+ ('\u0374', '\u0374'), ('\u0376', '\u0377'),
+ ('\u037b', '\u037d'), ('\u0386', '\u0386'),
+ ('\u0387', '\u0387'), ('\u0388', '\u038a'),
+ ('\u038c', '\u038c'), ('\u038e', '\u03a1'),
+ ('\u03a3', '\u03f5'), ('\u03f7', '\u0481'),
+ ('\u0483', '\u0487'), ('\u048a', '\u0527'),
+ ('\u0531', '\u0556'), ('\u0559', '\u0559'),
+ ('\u0561', '\u0587'), ('\u0591', '\u05bd'),
+ ('\u05bf', '\u05bf'), ('\u05c1', '\u05c2'),
+ ('\u05c4', '\u05c5'), ('\u05c7', '\u05c7'),
+ ('\u05d0', '\u05ea'), ('\u05f0', '\u05f2'),
+ ('\u0610', '\u061a'), ('\u0620', '\u063f'),
+ ('\u0640', '\u0640'), ('\u0641', '\u064a'),
+ ('\u064b', '\u065f'), ('\u0660', '\u0669'),
+ ('\u066e', '\u066f'), ('\u0670', '\u0670'),
+ ('\u0671', '\u06d3'), ('\u06d5', '\u06d5'),
+ ('\u06d6', '\u06dc'), ('\u06df', '\u06e4'),
+ ('\u06e5', '\u06e6'), ('\u06e7', '\u06e8'),
+ ('\u06ea', '\u06ed'), ('\u06ee', '\u06ef'),
+ ('\u06f0', '\u06f9'), ('\u06fa', '\u06fc'),
+ ('\u06ff', '\u06ff'), ('\u0710', '\u0710'),
+ ('\u0711', '\u0711'), ('\u0712', '\u072f'),
+ ('\u0730', '\u074a'), ('\u074d', '\u07a5'),
+ ('\u07a6', '\u07b0'), ('\u07b1', '\u07b1'),
+ ('\u07c0', '\u07c9'), ('\u07ca', '\u07ea'),
+ ('\u07eb', '\u07f3'), ('\u07f4', '\u07f5'),
+ ('\u07fa', '\u07fa'), ('\u0800', '\u0815'),
+ ('\u0816', '\u0819'), ('\u081a', '\u081a'),
+ ('\u081b', '\u0823'), ('\u0824', '\u0824'),
+ ('\u0825', '\u0827'), ('\u0828', '\u0828'),
+ ('\u0829', '\u082d'), ('\u0840', '\u0858'),
+ ('\u0859', '\u085b'), ('\u08a0', '\u08a0'),
+ ('\u08a2', '\u08ac'), ('\u08e4', '\u08fe'),
+ ('\u0900', '\u0902'), ('\u0903', '\u0903'),
+ ('\u0904', '\u0939'), ('\u093a', '\u093a'),
+ ('\u093b', '\u093b'), ('\u093c', '\u093c'),
+ ('\u093d', '\u093d'), ('\u093e', '\u0940'),
+ ('\u0941', '\u0948'), ('\u0949', '\u094c'),
+ ('\u094d', '\u094d'), ('\u094e', '\u094f'),
+ ('\u0950', '\u0950'), ('\u0951', '\u0957'),
+ ('\u0958', '\u0961'), ('\u0962', '\u0963'),
+ ('\u0966', '\u096f'), ('\u0971', '\u0971'),
+ ('\u0972', '\u0977'), ('\u0979', '\u097f'),
+ ('\u0981', '\u0981'), ('\u0982', '\u0983'),
+ ('\u0985', '\u098c'), ('\u098f', '\u0990'),
+ ('\u0993', '\u09a8'), ('\u09aa', '\u09b0'),
+ ('\u09b2', '\u09b2'), ('\u09b6', '\u09b9'),
+ ('\u09bc', '\u09bc'), ('\u09bd', '\u09bd'),
+ ('\u09be', '\u09c0'), ('\u09c1', '\u09c4'),
+ ('\u09c7', '\u09c8'), ('\u09cb', '\u09cc'),
+ ('\u09cd', '\u09cd'), ('\u09ce', '\u09ce'),
+ ('\u09d7', '\u09d7'), ('\u09dc', '\u09dd'),
+ ('\u09df', '\u09e1'), ('\u09e2', '\u09e3'),
+ ('\u09e6', '\u09ef'), ('\u09f0', '\u09f1'),
+ ('\u0a01', '\u0a02'), ('\u0a03', '\u0a03'),
+ ('\u0a05', '\u0a0a'), ('\u0a0f', '\u0a10'),
+ ('\u0a13', '\u0a28'), ('\u0a2a', '\u0a30'),
+ ('\u0a32', '\u0a33'), ('\u0a35', '\u0a36'),
+ ('\u0a38', '\u0a39'), ('\u0a3c', '\u0a3c'),
+ ('\u0a3e', '\u0a40'), ('\u0a41', '\u0a42'),
+ ('\u0a47', '\u0a48'), ('\u0a4b', '\u0a4d'),
+ ('\u0a51', '\u0a51'), ('\u0a59', '\u0a5c'),
+ ('\u0a5e', '\u0a5e'), ('\u0a66', '\u0a6f'),
+ ('\u0a70', '\u0a71'), ('\u0a72', '\u0a74'),
+ ('\u0a75', '\u0a75'), ('\u0a81', '\u0a82'),
+ ('\u0a83', '\u0a83'), ('\u0a85', '\u0a8d'),
+ ('\u0a8f', '\u0a91'), ('\u0a93', '\u0aa8'),
+ ('\u0aaa', '\u0ab0'), ('\u0ab2', '\u0ab3'),
+ ('\u0ab5', '\u0ab9'), ('\u0abc', '\u0abc'),
+ ('\u0abd', '\u0abd'), ('\u0abe', '\u0ac0'),
+ ('\u0ac1', '\u0ac5'), ('\u0ac7', '\u0ac8'),
+ ('\u0ac9', '\u0ac9'), ('\u0acb', '\u0acc'),
+ ('\u0acd', '\u0acd'), ('\u0ad0', '\u0ad0'),
+ ('\u0ae0', '\u0ae1'), ('\u0ae2', '\u0ae3'),
+ ('\u0ae6', '\u0aef'), ('\u0b01', '\u0b01'),
+ ('\u0b02', '\u0b03'), ('\u0b05', '\u0b0c'),
+ ('\u0b0f', '\u0b10'), ('\u0b13', '\u0b28'),
+ ('\u0b2a', '\u0b30'), ('\u0b32', '\u0b33'),
+ ('\u0b35', '\u0b39'), ('\u0b3c', '\u0b3c'),
+ ('\u0b3d', '\u0b3d'), ('\u0b3e', '\u0b3e'),
+ ('\u0b3f', '\u0b3f'), ('\u0b40', '\u0b40'),
+ ('\u0b41', '\u0b44'), ('\u0b47', '\u0b48'),
+ ('\u0b4b', '\u0b4c'), ('\u0b4d', '\u0b4d'),
+ ('\u0b56', '\u0b56'), ('\u0b57', '\u0b57'),
+ ('\u0b5c', '\u0b5d'), ('\u0b5f', '\u0b61'),
+ ('\u0b62', '\u0b63'), ('\u0b66', '\u0b6f'),
+ ('\u0b71', '\u0b71'), ('\u0b82', '\u0b82'),
+ ('\u0b83', '\u0b83'), ('\u0b85', '\u0b8a'),
+ ('\u0b8e', '\u0b90'), ('\u0b92', '\u0b95'),
+ ('\u0b99', '\u0b9a'), ('\u0b9c', '\u0b9c'),
+ ('\u0b9e', '\u0b9f'), ('\u0ba3', '\u0ba4'),
+ ('\u0ba8', '\u0baa'), ('\u0bae', '\u0bb9'),
+ ('\u0bbe', '\u0bbf'), ('\u0bc0', '\u0bc0'),
+ ('\u0bc1', '\u0bc2'), ('\u0bc6', '\u0bc8'),
+ ('\u0bca', '\u0bcc'), ('\u0bcd', '\u0bcd'),
+ ('\u0bd0', '\u0bd0'), ('\u0bd7', '\u0bd7'),
+ ('\u0be6', '\u0bef'), ('\u0c01', '\u0c03'),
+ ('\u0c05', '\u0c0c'), ('\u0c0e', '\u0c10'),
+ ('\u0c12', '\u0c28'), ('\u0c2a', '\u0c33'),
+ ('\u0c35', '\u0c39'), ('\u0c3d', '\u0c3d'),
+ ('\u0c3e', '\u0c40'), ('\u0c41', '\u0c44'),
+ ('\u0c46', '\u0c48'), ('\u0c4a', '\u0c4d'),
+ ('\u0c55', '\u0c56'), ('\u0c58', '\u0c59'),
+ ('\u0c60', '\u0c61'), ('\u0c62', '\u0c63'),
+ ('\u0c66', '\u0c6f'), ('\u0c82', '\u0c83'),
+ ('\u0c85', '\u0c8c'), ('\u0c8e', '\u0c90'),
+ ('\u0c92', '\u0ca8'), ('\u0caa', '\u0cb3'),
+ ('\u0cb5', '\u0cb9'), ('\u0cbc', '\u0cbc'),
+ ('\u0cbd', '\u0cbd'), ('\u0cbe', '\u0cbe'),
+ ('\u0cbf', '\u0cbf'), ('\u0cc0', '\u0cc4'),
+ ('\u0cc6', '\u0cc6'), ('\u0cc7', '\u0cc8'),
+ ('\u0cca', '\u0ccb'), ('\u0ccc', '\u0ccd'),
+ ('\u0cd5', '\u0cd6'), ('\u0cde', '\u0cde'),
+ ('\u0ce0', '\u0ce1'), ('\u0ce2', '\u0ce3'),
+ ('\u0ce6', '\u0cef'), ('\u0cf1', '\u0cf2'),
+ ('\u0d02', '\u0d03'), ('\u0d05', '\u0d0c'),
+ ('\u0d0e', '\u0d10'), ('\u0d12', '\u0d3a'),
+ ('\u0d3d', '\u0d3d'), ('\u0d3e', '\u0d40'),
+ ('\u0d41', '\u0d44'), ('\u0d46', '\u0d48'),
+ ('\u0d4a', '\u0d4c'), ('\u0d4d', '\u0d4d'),
+ ('\u0d4e', '\u0d4e'), ('\u0d57', '\u0d57'),
+ ('\u0d60', '\u0d61'), ('\u0d62', '\u0d63'),
+ ('\u0d66', '\u0d6f'), ('\u0d7a', '\u0d7f'),
+ ('\u0d82', '\u0d83'), ('\u0d85', '\u0d96'),
+ ('\u0d9a', '\u0db1'), ('\u0db3', '\u0dbb'),
+ ('\u0dbd', '\u0dbd'), ('\u0dc0', '\u0dc6'),
+ ('\u0dca', '\u0dca'), ('\u0dcf', '\u0dd1'),
+ ('\u0dd2', '\u0dd4'), ('\u0dd6', '\u0dd6'),
+ ('\u0dd8', '\u0ddf'), ('\u0df2', '\u0df3'),
+ ('\u0e01', '\u0e30'), ('\u0e31', '\u0e31'),
+ ('\u0e32', '\u0e33'), ('\u0e34', '\u0e3a'),
+ ('\u0e40', '\u0e45'), ('\u0e46', '\u0e46'),
+ ('\u0e47', '\u0e4e'), ('\u0e50', '\u0e59'),
+ ('\u0e81', '\u0e82'), ('\u0e84', '\u0e84'),
+ ('\u0e87', '\u0e88'), ('\u0e8a', '\u0e8a'),
+ ('\u0e8d', '\u0e8d'), ('\u0e94', '\u0e97'),
+ ('\u0e99', '\u0e9f'), ('\u0ea1', '\u0ea3'),
+ ('\u0ea5', '\u0ea5'), ('\u0ea7', '\u0ea7'),
+ ('\u0eaa', '\u0eab'), ('\u0ead', '\u0eb0'),
+ ('\u0eb1', '\u0eb1'), ('\u0eb2', '\u0eb3'),
+ ('\u0eb4', '\u0eb9'), ('\u0ebb', '\u0ebc'),
+ ('\u0ebd', '\u0ebd'), ('\u0ec0', '\u0ec4'),
+ ('\u0ec6', '\u0ec6'), ('\u0ec8', '\u0ecd'),
+ ('\u0ed0', '\u0ed9'), ('\u0edc', '\u0edf'),
+ ('\u0f00', '\u0f00'), ('\u0f18', '\u0f19'),
+ ('\u0f20', '\u0f29'), ('\u0f35', '\u0f35'),
+ ('\u0f37', '\u0f37'), ('\u0f39', '\u0f39'),
+ ('\u0f3e', '\u0f3f'), ('\u0f40', '\u0f47'),
+ ('\u0f49', '\u0f6c'), ('\u0f71', '\u0f7e'),
+ ('\u0f7f', '\u0f7f'), ('\u0f80', '\u0f84'),
+ ('\u0f86', '\u0f87'), ('\u0f88', '\u0f8c'),
+ ('\u0f8d', '\u0f97'), ('\u0f99', '\u0fbc'),
+ ('\u0fc6', '\u0fc6'), ('\u1000', '\u102a'),
+ ('\u102b', '\u102c'), ('\u102d', '\u1030'),
+ ('\u1031', '\u1031'), ('\u1032', '\u1037'),
+ ('\u1038', '\u1038'), ('\u1039', '\u103a'),
+ ('\u103b', '\u103c'), ('\u103d', '\u103e'),
+ ('\u103f', '\u103f'), ('\u1040', '\u1049'),
+ ('\u1050', '\u1055'), ('\u1056', '\u1057'),
+ ('\u1058', '\u1059'), ('\u105a', '\u105d'),
+ ('\u105e', '\u1060'), ('\u1061', '\u1061'),
+ ('\u1062', '\u1064'), ('\u1065', '\u1066'),
+ ('\u1067', '\u106d'), ('\u106e', '\u1070'),
+ ('\u1071', '\u1074'), ('\u1075', '\u1081'),
+ ('\u1082', '\u1082'), ('\u1083', '\u1084'),
+ ('\u1085', '\u1086'), ('\u1087', '\u108c'),
+ ('\u108d', '\u108d'), ('\u108e', '\u108e'),
+ ('\u108f', '\u108f'), ('\u1090', '\u1099'),
+ ('\u109a', '\u109c'), ('\u109d', '\u109d'),
+ ('\u10a0', '\u10c5'), ('\u10c7', '\u10c7'),
+ ('\u10cd', '\u10cd'), ('\u10d0', '\u10fa'),
+ ('\u10fc', '\u10fc'), ('\u10fd', '\u1248'),
+ ('\u124a', '\u124d'), ('\u1250', '\u1256'),
+ ('\u1258', '\u1258'), ('\u125a', '\u125d'),
+ ('\u1260', '\u1288'), ('\u128a', '\u128d'),
+ ('\u1290', '\u12b0'), ('\u12b2', '\u12b5'),
+ ('\u12b8', '\u12be'), ('\u12c0', '\u12c0'),
+ ('\u12c2', '\u12c5'), ('\u12c8', '\u12d6'),
+ ('\u12d8', '\u1310'), ('\u1312', '\u1315'),
+ ('\u1318', '\u135a'), ('\u135d', '\u135f'),
+ ('\u1369', '\u1371'), ('\u1380', '\u138f'),
+ ('\u13a0', '\u13f4'), ('\u1401', '\u166c'),
+ ('\u166f', '\u167f'), ('\u1681', '\u169a'),
+ ('\u16a0', '\u16ea'), ('\u16ee', '\u16f0'),
+ ('\u1700', '\u170c'), ('\u170e', '\u1711'),
+ ('\u1712', '\u1714'), ('\u1720', '\u1731'),
+ ('\u1732', '\u1734'), ('\u1740', '\u1751'),
+ ('\u1752', '\u1753'), ('\u1760', '\u176c'),
+ ('\u176e', '\u1770'), ('\u1772', '\u1773'),
+ ('\u1780', '\u17b3'), ('\u17b4', '\u17b5'),
+ ('\u17b6', '\u17b6'), ('\u17b7', '\u17bd'),
+ ('\u17be', '\u17c5'), ('\u17c6', '\u17c6'),
+ ('\u17c7', '\u17c8'), ('\u17c9', '\u17d3'),
+ ('\u17d7', '\u17d7'), ('\u17dc', '\u17dc'),
+ ('\u17dd', '\u17dd'), ('\u17e0', '\u17e9'),
+ ('\u180b', '\u180d'), ('\u1810', '\u1819'),
+ ('\u1820', '\u1842'), ('\u1843', '\u1843'),
+ ('\u1844', '\u1877'), ('\u1880', '\u18a8'),
+ ('\u18a9', '\u18a9'), ('\u18aa', '\u18aa'),
+ ('\u18b0', '\u18f5'), ('\u1900', '\u191c'),
+ ('\u1920', '\u1922'), ('\u1923', '\u1926'),
+ ('\u1927', '\u1928'), ('\u1929', '\u192b'),
+ ('\u1930', '\u1931'), ('\u1932', '\u1932'),
+ ('\u1933', '\u1938'), ('\u1939', '\u193b'),
+ ('\u1946', '\u194f'), ('\u1950', '\u196d'),
+ ('\u1970', '\u1974'), ('\u1980', '\u19ab'),
+ ('\u19b0', '\u19c0'), ('\u19c1', '\u19c7'),
+ ('\u19c8', '\u19c9'), ('\u19d0', '\u19d9'),
+ ('\u19da', '\u19da'), ('\u1a00', '\u1a16'),
+ ('\u1a17', '\u1a18'), ('\u1a19', '\u1a1a'),
+ ('\u1a1b', '\u1a1b'), ('\u1a20', '\u1a54'),
+ ('\u1a55', '\u1a55'), ('\u1a56', '\u1a56'),
+ ('\u1a57', '\u1a57'), ('\u1a58', '\u1a5e'),
+ ('\u1a60', '\u1a60'), ('\u1a61', '\u1a61'),
+ ('\u1a62', '\u1a62'), ('\u1a63', '\u1a64'),
+ ('\u1a65', '\u1a6c'), ('\u1a6d', '\u1a72'),
+ ('\u1a73', '\u1a7c'), ('\u1a7f', '\u1a7f'),
+ ('\u1a80', '\u1a89'), ('\u1a90', '\u1a99'),
+ ('\u1aa7', '\u1aa7'), ('\u1b00', '\u1b03'),
+ ('\u1b04', '\u1b04'), ('\u1b05', '\u1b33'),
+ ('\u1b34', '\u1b34'), ('\u1b35', '\u1b35'),
+ ('\u1b36', '\u1b3a'), ('\u1b3b', '\u1b3b'),
+ ('\u1b3c', '\u1b3c'), ('\u1b3d', '\u1b41'),
+ ('\u1b42', '\u1b42'), ('\u1b43', '\u1b44'),
+ ('\u1b45', '\u1b4b'), ('\u1b50', '\u1b59'),
+ ('\u1b6b', '\u1b73'), ('\u1b80', '\u1b81'),
+ ('\u1b82', '\u1b82'), ('\u1b83', '\u1ba0'),
+ ('\u1ba1', '\u1ba1'), ('\u1ba2', '\u1ba5'),
+ ('\u1ba6', '\u1ba7'), ('\u1ba8', '\u1ba9'),
+ ('\u1baa', '\u1baa'), ('\u1bab', '\u1bab'),
+ ('\u1bac', '\u1bad'), ('\u1bae', '\u1baf'),
+ ('\u1bb0', '\u1bb9'), ('\u1bba', '\u1be5'),
+ ('\u1be6', '\u1be6'), ('\u1be7', '\u1be7'),
+ ('\u1be8', '\u1be9'), ('\u1bea', '\u1bec'),
+ ('\u1bed', '\u1bed'), ('\u1bee', '\u1bee'),
+ ('\u1bef', '\u1bf1'), ('\u1bf2', '\u1bf3'),
+ ('\u1c00', '\u1c23'), ('\u1c24', '\u1c2b'),
+ ('\u1c2c', '\u1c33'), ('\u1c34', '\u1c35'),
+ ('\u1c36', '\u1c37'), ('\u1c40', '\u1c49'),
+ ('\u1c4d', '\u1c4f'), ('\u1c50', '\u1c59'),
+ ('\u1c5a', '\u1c77'), ('\u1c78', '\u1c7d'),
+ ('\u1cd0', '\u1cd2'), ('\u1cd4', '\u1ce0'),
+ ('\u1ce1', '\u1ce1'), ('\u1ce2', '\u1ce8'),
+ ('\u1ce9', '\u1cec'), ('\u1ced', '\u1ced'),
+ ('\u1cee', '\u1cf1'), ('\u1cf2', '\u1cf3'),
+ ('\u1cf4', '\u1cf4'), ('\u1cf5', '\u1cf6'),
+ ('\u1d00', '\u1d2b'), ('\u1d2c', '\u1d6a'),
+ ('\u1d6b', '\u1d77'), ('\u1d78', '\u1d78'),
+ ('\u1d79', '\u1d9a'), ('\u1d9b', '\u1dbf'),
+ ('\u1dc0', '\u1de6'), ('\u1dfc', '\u1dff'),
+ ('\u1e00', '\u1f15'), ('\u1f18', '\u1f1d'),
+ ('\u1f20', '\u1f45'), ('\u1f48', '\u1f4d'),
+ ('\u1f50', '\u1f57'), ('\u1f59', '\u1f59'),
+ ('\u1f5b', '\u1f5b'), ('\u1f5d', '\u1f5d'),
+ ('\u1f5f', '\u1f7d'), ('\u1f80', '\u1fb4'),
+ ('\u1fb6', '\u1fbc'), ('\u1fbe', '\u1fbe'),
+ ('\u1fc2', '\u1fc4'), ('\u1fc6', '\u1fcc'),
+ ('\u1fd0', '\u1fd3'), ('\u1fd6', '\u1fdb'),
+ ('\u1fe0', '\u1fec'), ('\u1ff2', '\u1ff4'),
+ ('\u1ff6', '\u1ffc'), ('\u203f', '\u2040'),
+ ('\u2054', '\u2054'), ('\u2071', '\u2071'),
+ ('\u207f', '\u207f'), ('\u2090', '\u209c'),
+ ('\u20d0', '\u20dc'), ('\u20e1', '\u20e1'),
+ ('\u20e5', '\u20f0'), ('\u2102', '\u2102'),
+ ('\u2107', '\u2107'), ('\u210a', '\u2113'),
+ ('\u2115', '\u2115'), ('\u2118', '\u2118'),
+ ('\u2119', '\u211d'), ('\u2124', '\u2124'),
+ ('\u2126', '\u2126'), ('\u2128', '\u2128'),
+ ('\u212a', '\u212d'), ('\u212e', '\u212e'),
+ ('\u212f', '\u2134'), ('\u2135', '\u2138'),
+ ('\u2139', '\u2139'), ('\u213c', '\u213f'),
+ ('\u2145', '\u2149'), ('\u214e', '\u214e'),
+ ('\u2160', '\u2182'), ('\u2183', '\u2184'),
+ ('\u2185', '\u2188'), ('\u2c00', '\u2c2e'),
+ ('\u2c30', '\u2c5e'), ('\u2c60', '\u2c7b'),
+ ('\u2c7c', '\u2c7d'), ('\u2c7e', '\u2ce4'),
+ ('\u2ceb', '\u2cee'), ('\u2cef', '\u2cf1'),
+ ('\u2cf2', '\u2cf3'), ('\u2d00', '\u2d25'),
+ ('\u2d27', '\u2d27'), ('\u2d2d', '\u2d2d'),
+ ('\u2d30', '\u2d67'), ('\u2d6f', '\u2d6f'),
+ ('\u2d7f', '\u2d7f'), ('\u2d80', '\u2d96'),
+ ('\u2da0', '\u2da6'), ('\u2da8', '\u2dae'),
+ ('\u2db0', '\u2db6'), ('\u2db8', '\u2dbe'),
+ ('\u2dc0', '\u2dc6'), ('\u2dc8', '\u2dce'),
+ ('\u2dd0', '\u2dd6'), ('\u2dd8', '\u2dde'),
+ ('\u2de0', '\u2dff'), ('\u3005', '\u3005'),
+ ('\u3006', '\u3006'), ('\u3007', '\u3007'),
+ ('\u3021', '\u3029'), ('\u302a', '\u302d'),
+ ('\u302e', '\u302f'), ('\u3031', '\u3035'),
+ ('\u3038', '\u303a'), ('\u303b', '\u303b'),
+ ('\u303c', '\u303c'), ('\u3041', '\u3096'),
+ ('\u3099', '\u309a'), ('\u309d', '\u309e'),
+ ('\u309f', '\u309f'), ('\u30a1', '\u30fa'),
+ ('\u30fc', '\u30fe'), ('\u30ff', '\u30ff'),
+ ('\u3105', '\u312d'), ('\u3131', '\u318e'),
+ ('\u31a0', '\u31ba'), ('\u31f0', '\u31ff'),
+ ('\u3400', '\u4db5'), ('\u4e00', '\u9fcc'),
+ ('\ua000', '\ua014'), ('\ua015', '\ua015'),
+ ('\ua016', '\ua48c'), ('\ua4d0', '\ua4f7'),
+ ('\ua4f8', '\ua4fd'), ('\ua500', '\ua60b'),
+ ('\ua60c', '\ua60c'), ('\ua610', '\ua61f'),
+ ('\ua620', '\ua629'), ('\ua62a', '\ua62b'),
+ ('\ua640', '\ua66d'), ('\ua66e', '\ua66e'),
+ ('\ua66f', '\ua66f'), ('\ua674', '\ua67d'),
+ ('\ua67f', '\ua67f'), ('\ua680', '\ua697'),
+ ('\ua69f', '\ua69f'), ('\ua6a0', '\ua6e5'),
+ ('\ua6e6', '\ua6ef'), ('\ua6f0', '\ua6f1'),
+ ('\ua717', '\ua71f'), ('\ua722', '\ua76f'),
+ ('\ua770', '\ua770'), ('\ua771', '\ua787'),
+ ('\ua788', '\ua788'), ('\ua78b', '\ua78e'),
+ ('\ua790', '\ua793'), ('\ua7a0', '\ua7aa'),
+ ('\ua7f8', '\ua7f9'), ('\ua7fa', '\ua7fa'),
+ ('\ua7fb', '\ua801'), ('\ua802', '\ua802'),
+ ('\ua803', '\ua805'), ('\ua806', '\ua806'),
+ ('\ua807', '\ua80a'), ('\ua80b', '\ua80b'),
+ ('\ua80c', '\ua822'), ('\ua823', '\ua824'),
+ ('\ua825', '\ua826'), ('\ua827', '\ua827'),
+ ('\ua840', '\ua873'), ('\ua880', '\ua881'),
+ ('\ua882', '\ua8b3'), ('\ua8b4', '\ua8c3'),
+ ('\ua8c4', '\ua8c4'), ('\ua8d0', '\ua8d9'),
+ ('\ua8e0', '\ua8f1'), ('\ua8f2', '\ua8f7'),
+ ('\ua8fb', '\ua8fb'), ('\ua900', '\ua909'),
+ ('\ua90a', '\ua925'), ('\ua926', '\ua92d'),
+ ('\ua930', '\ua946'), ('\ua947', '\ua951'),
+ ('\ua952', '\ua953'), ('\ua960', '\ua97c'),
+ ('\ua980', '\ua982'), ('\ua983', '\ua983'),
+ ('\ua984', '\ua9b2'), ('\ua9b3', '\ua9b3'),
+ ('\ua9b4', '\ua9b5'), ('\ua9b6', '\ua9b9'),
+ ('\ua9ba', '\ua9bb'), ('\ua9bc', '\ua9bc'),
+ ('\ua9bd', '\ua9c0'), ('\ua9cf', '\ua9cf'),
+ ('\ua9d0', '\ua9d9'), ('\uaa00', '\uaa28'),
+ ('\uaa29', '\uaa2e'), ('\uaa2f', '\uaa30'),
+ ('\uaa31', '\uaa32'), ('\uaa33', '\uaa34'),
+ ('\uaa35', '\uaa36'), ('\uaa40', '\uaa42'),
+ ('\uaa43', '\uaa43'), ('\uaa44', '\uaa4b'),
+ ('\uaa4c', '\uaa4c'), ('\uaa4d', '\uaa4d'),
+ ('\uaa50', '\uaa59'), ('\uaa60', '\uaa6f'),
+ ('\uaa70', '\uaa70'), ('\uaa71', '\uaa76'),
+ ('\uaa7a', '\uaa7a'), ('\uaa7b', '\uaa7b'),
+ ('\uaa80', '\uaaaf'), ('\uaab0', '\uaab0'),
+ ('\uaab1', '\uaab1'), ('\uaab2', '\uaab4'),
+ ('\uaab5', '\uaab6'), ('\uaab7', '\uaab8'),
+ ('\uaab9', '\uaabd'), ('\uaabe', '\uaabf'),
+ ('\uaac0', '\uaac0'), ('\uaac1', '\uaac1'),
+ ('\uaac2', '\uaac2'), ('\uaadb', '\uaadc'),
+ ('\uaadd', '\uaadd'), ('\uaae0', '\uaaea'),
+ ('\uaaeb', '\uaaeb'), ('\uaaec', '\uaaed'),
+ ('\uaaee', '\uaaef'), ('\uaaf2', '\uaaf2'),
+ ('\uaaf3', '\uaaf4'), ('\uaaf5', '\uaaf5'),
+ ('\uaaf6', '\uaaf6'), ('\uab01', '\uab06'),
+ ('\uab09', '\uab0e'), ('\uab11', '\uab16'),
+ ('\uab20', '\uab26'), ('\uab28', '\uab2e'),
+ ('\uabc0', '\uabe2'), ('\uabe3', '\uabe4'),
+ ('\uabe5', '\uabe5'), ('\uabe6', '\uabe7'),
+ ('\uabe8', '\uabe8'), ('\uabe9', '\uabea'),
+ ('\uabec', '\uabec'), ('\uabed', '\uabed'),
+ ('\uabf0', '\uabf9'), ('\uac00', '\ud7a3'),
+ ('\ud7b0', '\ud7c6'), ('\ud7cb', '\ud7fb'),
+ ('\uf900', '\ufa6d'), ('\ufa70', '\ufad9'),
+ ('\ufb00', '\ufb06'), ('\ufb13', '\ufb17'),
+ ('\ufb1d', '\ufb1d'), ('\ufb1e', '\ufb1e'),
+ ('\ufb1f', '\ufb28'), ('\ufb2a', '\ufb36'),
+ ('\ufb38', '\ufb3c'), ('\ufb3e', '\ufb3e'),
+ ('\ufb40', '\ufb41'), ('\ufb43', '\ufb44'),
+ ('\ufb46', '\ufbb1'), ('\ufbd3', '\ufc5d'),
+ ('\ufc64', '\ufd3d'), ('\ufd50', '\ufd8f'),
+ ('\ufd92', '\ufdc7'), ('\ufdf0', '\ufdf9'),
+ ('\ufe00', '\ufe0f'), ('\ufe20', '\ufe26'),
+ ('\ufe33', '\ufe34'), ('\ufe4d', '\ufe4f'),
+ ('\ufe71', '\ufe71'), ('\ufe73', '\ufe73'),
+ ('\ufe77', '\ufe77'), ('\ufe79', '\ufe79'),
+ ('\ufe7b', '\ufe7b'), ('\ufe7d', '\ufe7d'),
+ ('\ufe7f', '\ufefc'), ('\uff10', '\uff19'),
+ ('\uff21', '\uff3a'), ('\uff3f', '\uff3f'),
+ ('\uff41', '\uff5a'), ('\uff66', '\uff6f'),
+ ('\uff70', '\uff70'), ('\uff71', '\uff9d'),
+ ('\uff9e', '\uff9f'), ('\uffa0', '\uffbe'),
+ ('\uffc2', '\uffc7'), ('\uffca', '\uffcf'),
+ ('\uffd2', '\uffd7'), ('\uffda', '\uffdc'),
+ ('\U00010000', '\U0001000b'), ('\U0001000d', '\U00010026'),
+ ('\U00010028', '\U0001003a'), ('\U0001003c', '\U0001003d'),
+ ('\U0001003f', '\U0001004d'), ('\U00010050', '\U0001005d'),
+ ('\U00010080', '\U000100fa'), ('\U00010140', '\U00010174'),
+ ('\U000101fd', '\U000101fd'), ('\U00010280', '\U0001029c'),
+ ('\U000102a0', '\U000102d0'), ('\U00010300', '\U0001031e'),
+ ('\U00010330', '\U00010340'), ('\U00010341', '\U00010341'),
+ ('\U00010342', '\U00010349'), ('\U0001034a', '\U0001034a'),
+ ('\U00010380', '\U0001039d'), ('\U000103a0', '\U000103c3'),
+ ('\U000103c8', '\U000103cf'), ('\U000103d1', '\U000103d5'),
+ ('\U00010400', '\U0001044f'), ('\U00010450', '\U0001049d'),
+ ('\U000104a0', '\U000104a9'), ('\U00010800', '\U00010805'),
+ ('\U00010808', '\U00010808'), ('\U0001080a', '\U00010835'),
+ ('\U00010837', '\U00010838'), ('\U0001083c', '\U0001083c'),
+ ('\U0001083f', '\U00010855'), ('\U00010900', '\U00010915'),
+ ('\U00010920', '\U00010939'), ('\U00010980', '\U000109b7'),
+ ('\U000109be', '\U000109bf'), ('\U00010a00', '\U00010a00'),
+ ('\U00010a01', '\U00010a03'), ('\U00010a05', '\U00010a06'),
+ ('\U00010a0c', '\U00010a0f'), ('\U00010a10', '\U00010a13'),
+ ('\U00010a15', '\U00010a17'), ('\U00010a19', '\U00010a33'),
+ ('\U00010a38', '\U00010a3a'), ('\U00010a3f', '\U00010a3f'),
+ ('\U00010a60', '\U00010a7c'), ('\U00010b00', '\U00010b35'),
+ ('\U00010b40', '\U00010b55'), ('\U00010b60', '\U00010b72'),
+ ('\U00010c00', '\U00010c48'), ('\U00011000', '\U00011000'),
+ ('\U00011001', '\U00011001'), ('\U00011002', '\U00011002'),
+ ('\U00011003', '\U00011037'), ('\U00011038', '\U00011046'),
+ ('\U00011066', '\U0001106f'), ('\U00011080', '\U00011081'),
+ ('\U00011082', '\U00011082'), ('\U00011083', '\U000110af'),
+ ('\U000110b0', '\U000110b2'), ('\U000110b3', '\U000110b6'),
+ ('\U000110b7', '\U000110b8'), ('\U000110b9', '\U000110ba'),
+ ('\U000110d0', '\U000110e8'), ('\U000110f0', '\U000110f9'),
+ ('\U00011100', '\U00011102'), ('\U00011103', '\U00011126'),
+ ('\U00011127', '\U0001112b'), ('\U0001112c', '\U0001112c'),
+ ('\U0001112d', '\U00011134'), ('\U00011136', '\U0001113f'),
+ ('\U00011180', '\U00011181'), ('\U00011182', '\U00011182'),
+ ('\U00011183', '\U000111b2'), ('\U000111b3', '\U000111b5'),
+ ('\U000111b6', '\U000111be'), ('\U000111bf', '\U000111c0'),
+ ('\U000111c1', '\U000111c4'), ('\U000111d0', '\U000111d9'),
+ ('\U00011680', '\U000116aa'), ('\U000116ab', '\U000116ab'),
+ ('\U000116ac', '\U000116ac'), ('\U000116ad', '\U000116ad'),
+ ('\U000116ae', '\U000116af'), ('\U000116b0', '\U000116b5'),
+ ('\U000116b6', '\U000116b6'), ('\U000116b7', '\U000116b7'),
+ ('\U000116c0', '\U000116c9'), ('\U00012000', '\U0001236e'),
+ ('\U00012400', '\U00012462'), ('\U00013000', '\U0001342e'),
+ ('\U00016800', '\U00016a38'), ('\U00016f00', '\U00016f44'),
+ ('\U00016f50', '\U00016f50'), ('\U00016f51', '\U00016f7e'),
+ ('\U00016f8f', '\U00016f92'), ('\U00016f93', '\U00016f9f'),
+ ('\U0001b000', '\U0001b001'), ('\U0001d165', '\U0001d166'),
+ ('\U0001d167', '\U0001d169'), ('\U0001d16d', '\U0001d172'),
+ ('\U0001d17b', '\U0001d182'), ('\U0001d185', '\U0001d18b'),
+ ('\U0001d1aa', '\U0001d1ad'), ('\U0001d242', '\U0001d244'),
+ ('\U0001d400', '\U0001d454'), ('\U0001d456', '\U0001d49c'),
+ ('\U0001d49e', '\U0001d49f'), ('\U0001d4a2', '\U0001d4a2'),
+ ('\U0001d4a5', '\U0001d4a6'), ('\U0001d4a9', '\U0001d4ac'),
+ ('\U0001d4ae', '\U0001d4b9'), ('\U0001d4bb', '\U0001d4bb'),
+ ('\U0001d4bd', '\U0001d4c3'), ('\U0001d4c5', '\U0001d505'),
+ ('\U0001d507', '\U0001d50a'), ('\U0001d50d', '\U0001d514'),
+ ('\U0001d516', '\U0001d51c'), ('\U0001d51e', '\U0001d539'),
+ ('\U0001d53b', '\U0001d53e'), ('\U0001d540', '\U0001d544'),
+ ('\U0001d546', '\U0001d546'), ('\U0001d54a', '\U0001d550'),
+ ('\U0001d552', '\U0001d6a5'), ('\U0001d6a8', '\U0001d6c0'),
+ ('\U0001d6c2', '\U0001d6da'), ('\U0001d6dc', '\U0001d6fa'),
+ ('\U0001d6fc', '\U0001d714'), ('\U0001d716', '\U0001d734'),
+ ('\U0001d736', '\U0001d74e'), ('\U0001d750', '\U0001d76e'),
+ ('\U0001d770', '\U0001d788'), ('\U0001d78a', '\U0001d7a8'),
+ ('\U0001d7aa', '\U0001d7c2'), ('\U0001d7c4', '\U0001d7cb'),
+ ('\U0001d7ce', '\U0001d7ff'), ('\U0001ee00', '\U0001ee03'),
+ ('\U0001ee05', '\U0001ee1f'), ('\U0001ee21', '\U0001ee22'),
+ ('\U0001ee24', '\U0001ee24'), ('\U0001ee27', '\U0001ee27'),
+ ('\U0001ee29', '\U0001ee32'), ('\U0001ee34', '\U0001ee37'),
+ ('\U0001ee39', '\U0001ee39'), ('\U0001ee3b', '\U0001ee3b'),
+ ('\U0001ee42', '\U0001ee42'), ('\U0001ee47', '\U0001ee47'),
+ ('\U0001ee49', '\U0001ee49'), ('\U0001ee4b', '\U0001ee4b'),
+ ('\U0001ee4d', '\U0001ee4f'), ('\U0001ee51', '\U0001ee52'),
+ ('\U0001ee54', '\U0001ee54'), ('\U0001ee57', '\U0001ee57'),
+ ('\U0001ee59', '\U0001ee59'), ('\U0001ee5b', '\U0001ee5b'),
+ ('\U0001ee5d', '\U0001ee5d'), ('\U0001ee5f', '\U0001ee5f'),
+ ('\U0001ee61', '\U0001ee62'), ('\U0001ee64', '\U0001ee64'),
+ ('\U0001ee67', '\U0001ee6a'), ('\U0001ee6c', '\U0001ee72'),
+ ('\U0001ee74', '\U0001ee77'), ('\U0001ee79', '\U0001ee7c'),
+ ('\U0001ee7e', '\U0001ee7e'), ('\U0001ee80', '\U0001ee89'),
+ ('\U0001ee8b', '\U0001ee9b'), ('\U0001eea1', '\U0001eea3'),
+ ('\U0001eea5', '\U0001eea9'), ('\U0001eeab', '\U0001eebb'),
+ ('\U00020000', '\U0002a6d6'), ('\U0002a700', '\U0002b734'),
+ ('\U0002b740', '\U0002b81d'), ('\U0002f800', '\U0002fa1d'),
+ ('\U000e0100', '\U000e01ef')
+ ];
+
+ pub fn XID_Continue(c: char) -> bool {
+ super::bsearch_range_table(c, XID_Continue_table)
+ }
+
+ static XID_Start_table : &'static [(char,char)] = &[
+ ('\x41', '\x5a'), ('\x61', '\x7a'),
+ ('\xaa', '\xaa'), ('\xb5', '\xb5'),
+ ('\xba', '\xba'), ('\xc0', '\xd6'),
+ ('\xd8', '\xf6'), ('\xf8', '\u01ba'),
+ ('\u01bb', '\u01bb'), ('\u01bc', '\u01bf'),
+ ('\u01c0', '\u01c3'), ('\u01c4', '\u0293'),
+ ('\u0294', '\u0294'), ('\u0295', '\u02af'),
+ ('\u02b0', '\u02c1'), ('\u02c6', '\u02d1'),
+ ('\u02e0', '\u02e4'), ('\u02ec', '\u02ec'),
+ ('\u02ee', '\u02ee'), ('\u0370', '\u0373'),
+ ('\u0374', '\u0374'), ('\u0376', '\u0377'),
+ ('\u037b', '\u037d'), ('\u0386', '\u0386'),
+ ('\u0388', '\u038a'), ('\u038c', '\u038c'),
+ ('\u038e', '\u03a1'), ('\u03a3', '\u03f5'),
+ ('\u03f7', '\u0481'), ('\u048a', '\u0527'),
+ ('\u0531', '\u0556'), ('\u0559', '\u0559'),
+ ('\u0561', '\u0587'), ('\u05d0', '\u05ea'),
+ ('\u05f0', '\u05f2'), ('\u0620', '\u063f'),
+ ('\u0640', '\u0640'), ('\u0641', '\u064a'),
+ ('\u066e', '\u066f'), ('\u0671', '\u06d3'),
+ ('\u06d5', '\u06d5'), ('\u06e5', '\u06e6'),
+ ('\u06ee', '\u06ef'), ('\u06fa', '\u06fc'),
+ ('\u06ff', '\u06ff'), ('\u0710', '\u0710'),
+ ('\u0712', '\u072f'), ('\u074d', '\u07a5'),
+ ('\u07b1', '\u07b1'), ('\u07ca', '\u07ea'),
+ ('\u07f4', '\u07f5'), ('\u07fa', '\u07fa'),
+ ('\u0800', '\u0815'), ('\u081a', '\u081a'),
+ ('\u0824', '\u0824'), ('\u0828', '\u0828'),
+ ('\u0840', '\u0858'), ('\u08a0', '\u08a0'),
+ ('\u08a2', '\u08ac'), ('\u0904', '\u0939'),
+ ('\u093d', '\u093d'), ('\u0950', '\u0950'),
+ ('\u0958', '\u0961'), ('\u0971', '\u0971'),
+ ('\u0972', '\u0977'), ('\u0979', '\u097f'),
+ ('\u0985', '\u098c'), ('\u098f', '\u0990'),
+ ('\u0993', '\u09a8'), ('\u09aa', '\u09b0'),
+ ('\u09b2', '\u09b2'), ('\u09b6', '\u09b9'),
+ ('\u09bd', '\u09bd'), ('\u09ce', '\u09ce'),
+ ('\u09dc', '\u09dd'), ('\u09df', '\u09e1'),
+ ('\u09f0', '\u09f1'), ('\u0a05', '\u0a0a'),
+ ('\u0a0f', '\u0a10'), ('\u0a13', '\u0a28'),
+ ('\u0a2a', '\u0a30'), ('\u0a32', '\u0a33'),
+ ('\u0a35', '\u0a36'), ('\u0a38', '\u0a39'),
+ ('\u0a59', '\u0a5c'), ('\u0a5e', '\u0a5e'),
+ ('\u0a72', '\u0a74'), ('\u0a85', '\u0a8d'),
+ ('\u0a8f', '\u0a91'), ('\u0a93', '\u0aa8'),
+ ('\u0aaa', '\u0ab0'), ('\u0ab2', '\u0ab3'),
+ ('\u0ab5', '\u0ab9'), ('\u0abd', '\u0abd'),
+ ('\u0ad0', '\u0ad0'), ('\u0ae0', '\u0ae1'),
+ ('\u0b05', '\u0b0c'), ('\u0b0f', '\u0b10'),
+ ('\u0b13', '\u0b28'), ('\u0b2a', '\u0b30'),
+ ('\u0b32', '\u0b33'), ('\u0b35', '\u0b39'),
+ ('\u0b3d', '\u0b3d'), ('\u0b5c', '\u0b5d'),
+ ('\u0b5f', '\u0b61'), ('\u0b71', '\u0b71'),
+ ('\u0b83', '\u0b83'), ('\u0b85', '\u0b8a'),
+ ('\u0b8e', '\u0b90'), ('\u0b92', '\u0b95'),
+ ('\u0b99', '\u0b9a'), ('\u0b9c', '\u0b9c'),
+ ('\u0b9e', '\u0b9f'), ('\u0ba3', '\u0ba4'),
+ ('\u0ba8', '\u0baa'), ('\u0bae', '\u0bb9'),
+ ('\u0bd0', '\u0bd0'), ('\u0c05', '\u0c0c'),
+ ('\u0c0e', '\u0c10'), ('\u0c12', '\u0c28'),
+ ('\u0c2a', '\u0c33'), ('\u0c35', '\u0c39'),
+ ('\u0c3d', '\u0c3d'), ('\u0c58', '\u0c59'),
+ ('\u0c60', '\u0c61'), ('\u0c85', '\u0c8c'),
+ ('\u0c8e', '\u0c90'), ('\u0c92', '\u0ca8'),
+ ('\u0caa', '\u0cb3'), ('\u0cb5', '\u0cb9'),
+ ('\u0cbd', '\u0cbd'), ('\u0cde', '\u0cde'),
+ ('\u0ce0', '\u0ce1'), ('\u0cf1', '\u0cf2'),
+ ('\u0d05', '\u0d0c'), ('\u0d0e', '\u0d10'),
+ ('\u0d12', '\u0d3a'), ('\u0d3d', '\u0d3d'),
+ ('\u0d4e', '\u0d4e'), ('\u0d60', '\u0d61'),
+ ('\u0d7a', '\u0d7f'), ('\u0d85', '\u0d96'),
+ ('\u0d9a', '\u0db1'), ('\u0db3', '\u0dbb'),
+ ('\u0dbd', '\u0dbd'), ('\u0dc0', '\u0dc6'),
+ ('\u0e01', '\u0e30'), ('\u0e32', '\u0e32'),
+ ('\u0e40', '\u0e45'), ('\u0e46', '\u0e46'),
+ ('\u0e81', '\u0e82'), ('\u0e84', '\u0e84'),
+ ('\u0e87', '\u0e88'), ('\u0e8a', '\u0e8a'),
+ ('\u0e8d', '\u0e8d'), ('\u0e94', '\u0e97'),
+ ('\u0e99', '\u0e9f'), ('\u0ea1', '\u0ea3'),
+ ('\u0ea5', '\u0ea5'), ('\u0ea7', '\u0ea7'),
+ ('\u0eaa', '\u0eab'), ('\u0ead', '\u0eb0'),
+ ('\u0eb2', '\u0eb2'), ('\u0ebd', '\u0ebd'),
+ ('\u0ec0', '\u0ec4'), ('\u0ec6', '\u0ec6'),
+ ('\u0edc', '\u0edf'), ('\u0f00', '\u0f00'),
+ ('\u0f40', '\u0f47'), ('\u0f49', '\u0f6c'),
+ ('\u0f88', '\u0f8c'), ('\u1000', '\u102a'),
+ ('\u103f', '\u103f'), ('\u1050', '\u1055'),
+ ('\u105a', '\u105d'), ('\u1061', '\u1061'),
+ ('\u1065', '\u1066'), ('\u106e', '\u1070'),
+ ('\u1075', '\u1081'), ('\u108e', '\u108e'),
+ ('\u10a0', '\u10c5'), ('\u10c7', '\u10c7'),
+ ('\u10cd', '\u10cd'), ('\u10d0', '\u10fa'),
+ ('\u10fc', '\u10fc'), ('\u10fd', '\u1248'),
+ ('\u124a', '\u124d'), ('\u1250', '\u1256'),
+ ('\u1258', '\u1258'), ('\u125a', '\u125d'),
+ ('\u1260', '\u1288'), ('\u128a', '\u128d'),
+ ('\u1290', '\u12b0'), ('\u12b2', '\u12b5'),
+ ('\u12b8', '\u12be'), ('\u12c0', '\u12c0'),
+ ('\u12c2', '\u12c5'), ('\u12c8', '\u12d6'),
+ ('\u12d8', '\u1310'), ('\u1312', '\u1315'),
+ ('\u1318', '\u135a'), ('\u1380', '\u138f'),
+ ('\u13a0', '\u13f4'), ('\u1401', '\u166c'),
+ ('\u166f', '\u167f'), ('\u1681', '\u169a'),
+ ('\u16a0', '\u16ea'), ('\u16ee', '\u16f0'),
+ ('\u1700', '\u170c'), ('\u170e', '\u1711'),
+ ('\u1720', '\u1731'), ('\u1740', '\u1751'),
+ ('\u1760', '\u176c'), ('\u176e', '\u1770'),
+ ('\u1780', '\u17b3'), ('\u17d7', '\u17d7'),
+ ('\u17dc', '\u17dc'), ('\u1820', '\u1842'),
+ ('\u1843', '\u1843'), ('\u1844', '\u1877'),
+ ('\u1880', '\u18a8'), ('\u18aa', '\u18aa'),
+ ('\u18b0', '\u18f5'), ('\u1900', '\u191c'),
+ ('\u1950', '\u196d'), ('\u1970', '\u1974'),
+ ('\u1980', '\u19ab'), ('\u19c1', '\u19c7'),
+ ('\u1a00', '\u1a16'), ('\u1a20', '\u1a54'),
+ ('\u1aa7', '\u1aa7'), ('\u1b05', '\u1b33'),
+ ('\u1b45', '\u1b4b'), ('\u1b83', '\u1ba0'),
+ ('\u1bae', '\u1baf'), ('\u1bba', '\u1be5'),
+ ('\u1c00', '\u1c23'), ('\u1c4d', '\u1c4f'),
+ ('\u1c5a', '\u1c77'), ('\u1c78', '\u1c7d'),
+ ('\u1ce9', '\u1cec'), ('\u1cee', '\u1cf1'),
+ ('\u1cf5', '\u1cf6'), ('\u1d00', '\u1d2b'),
+ ('\u1d2c', '\u1d6a'), ('\u1d6b', '\u1d77'),
+ ('\u1d78', '\u1d78'), ('\u1d79', '\u1d9a'),
+ ('\u1d9b', '\u1dbf'), ('\u1e00', '\u1f15'),
+ ('\u1f18', '\u1f1d'), ('\u1f20', '\u1f45'),
+ ('\u1f48', '\u1f4d'), ('\u1f50', '\u1f57'),
+ ('\u1f59', '\u1f59'), ('\u1f5b', '\u1f5b'),
+ ('\u1f5d', '\u1f5d'), ('\u1f5f', '\u1f7d'),
+ ('\u1f80', '\u1fb4'), ('\u1fb6', '\u1fbc'),
+ ('\u1fbe', '\u1fbe'), ('\u1fc2', '\u1fc4'),
+ ('\u1fc6', '\u1fcc'), ('\u1fd0', '\u1fd3'),
+ ('\u1fd6', '\u1fdb'), ('\u1fe0', '\u1fec'),
+ ('\u1ff2', '\u1ff4'), ('\u1ff6', '\u1ffc'),
+ ('\u2071', '\u2071'), ('\u207f', '\u207f'),
+ ('\u2090', '\u209c'), ('\u2102', '\u2102'),
+ ('\u2107', '\u2107'), ('\u210a', '\u2113'),
+ ('\u2115', '\u2115'), ('\u2118', '\u2118'),
+ ('\u2119', '\u211d'), ('\u2124', '\u2124'),
+ ('\u2126', '\u2126'), ('\u2128', '\u2128'),
+ ('\u212a', '\u212d'), ('\u212e', '\u212e'),
+ ('\u212f', '\u2134'), ('\u2135', '\u2138'),
+ ('\u2139', '\u2139'), ('\u213c', '\u213f'),
+ ('\u2145', '\u2149'), ('\u214e', '\u214e'),
+ ('\u2160', '\u2182'), ('\u2183', '\u2184'),
+ ('\u2185', '\u2188'), ('\u2c00', '\u2c2e'),
+ ('\u2c30', '\u2c5e'), ('\u2c60', '\u2c7b'),
+ ('\u2c7c', '\u2c7d'), ('\u2c7e', '\u2ce4'),
+ ('\u2ceb', '\u2cee'), ('\u2cf2', '\u2cf3'),
+ ('\u2d00', '\u2d25'), ('\u2d27', '\u2d27'),
+ ('\u2d2d', '\u2d2d'), ('\u2d30', '\u2d67'),
+ ('\u2d6f', '\u2d6f'), ('\u2d80', '\u2d96'),
+ ('\u2da0', '\u2da6'), ('\u2da8', '\u2dae'),
+ ('\u2db0', '\u2db6'), ('\u2db8', '\u2dbe'),
+ ('\u2dc0', '\u2dc6'), ('\u2dc8', '\u2dce'),
+ ('\u2dd0', '\u2dd6'), ('\u2dd8', '\u2dde'),
+ ('\u3005', '\u3005'), ('\u3006', '\u3006'),
+ ('\u3007', '\u3007'), ('\u3021', '\u3029'),
+ ('\u3031', '\u3035'), ('\u3038', '\u303a'),
+ ('\u303b', '\u303b'), ('\u303c', '\u303c'),
+ ('\u3041', '\u3096'), ('\u309d', '\u309e'),
+ ('\u309f', '\u309f'), ('\u30a1', '\u30fa'),
+ ('\u30fc', '\u30fe'), ('\u30ff', '\u30ff'),
+ ('\u3105', '\u312d'), ('\u3131', '\u318e'),
+ ('\u31a0', '\u31ba'), ('\u31f0', '\u31ff'),
+ ('\u3400', '\u4db5'), ('\u4e00', '\u9fcc'),
+ ('\ua000', '\ua014'), ('\ua015', '\ua015'),
+ ('\ua016', '\ua48c'), ('\ua4d0', '\ua4f7'),
+ ('\ua4f8', '\ua4fd'), ('\ua500', '\ua60b'),
+ ('\ua60c', '\ua60c'), ('\ua610', '\ua61f'),
+ ('\ua62a', '\ua62b'), ('\ua640', '\ua66d'),
+ ('\ua66e', '\ua66e'), ('\ua67f', '\ua67f'),
+ ('\ua680', '\ua697'), ('\ua6a0', '\ua6e5'),
+ ('\ua6e6', '\ua6ef'), ('\ua717', '\ua71f'),
+ ('\ua722', '\ua76f'), ('\ua770', '\ua770'),
+ ('\ua771', '\ua787'), ('\ua788', '\ua788'),
+ ('\ua78b', '\ua78e'), ('\ua790', '\ua793'),
+ ('\ua7a0', '\ua7aa'), ('\ua7f8', '\ua7f9'),
+ ('\ua7fa', '\ua7fa'), ('\ua7fb', '\ua801'),
+ ('\ua803', '\ua805'), ('\ua807', '\ua80a'),
+ ('\ua80c', '\ua822'), ('\ua840', '\ua873'),
+ ('\ua882', '\ua8b3'), ('\ua8f2', '\ua8f7'),
+ ('\ua8fb', '\ua8fb'), ('\ua90a', '\ua925'),
+ ('\ua930', '\ua946'), ('\ua960', '\ua97c'),
+ ('\ua984', '\ua9b2'), ('\ua9cf', '\ua9cf'),
+ ('\uaa00', '\uaa28'), ('\uaa40', '\uaa42'),
+ ('\uaa44', '\uaa4b'), ('\uaa60', '\uaa6f'),
+ ('\uaa70', '\uaa70'), ('\uaa71', '\uaa76'),
+ ('\uaa7a', '\uaa7a'), ('\uaa80', '\uaaaf'),
+ ('\uaab1', '\uaab1'), ('\uaab5', '\uaab6'),
+ ('\uaab9', '\uaabd'), ('\uaac0', '\uaac0'),
+ ('\uaac2', '\uaac2'), ('\uaadb', '\uaadc'),
+ ('\uaadd', '\uaadd'), ('\uaae0', '\uaaea'),
+ ('\uaaf2', '\uaaf2'), ('\uaaf3', '\uaaf4'),
+ ('\uab01', '\uab06'), ('\uab09', '\uab0e'),
+ ('\uab11', '\uab16'), ('\uab20', '\uab26'),
+ ('\uab28', '\uab2e'), ('\uabc0', '\uabe2'),
+ ('\uac00', '\ud7a3'), ('\ud7b0', '\ud7c6'),
+ ('\ud7cb', '\ud7fb'), ('\uf900', '\ufa6d'),
+ ('\ufa70', '\ufad9'), ('\ufb00', '\ufb06'),
+ ('\ufb13', '\ufb17'), ('\ufb1d', '\ufb1d'),
+ ('\ufb1f', '\ufb28'), ('\ufb2a', '\ufb36'),
+ ('\ufb38', '\ufb3c'), ('\ufb3e', '\ufb3e'),
+ ('\ufb40', '\ufb41'), ('\ufb43', '\ufb44'),
+ ('\ufb46', '\ufbb1'), ('\ufbd3', '\ufc5d'),
+ ('\ufc64', '\ufd3d'), ('\ufd50', '\ufd8f'),
+ ('\ufd92', '\ufdc7'), ('\ufdf0', '\ufdf9'),
+ ('\ufe71', '\ufe71'), ('\ufe73', '\ufe73'),
+ ('\ufe77', '\ufe77'), ('\ufe79', '\ufe79'),
+ ('\ufe7b', '\ufe7b'), ('\ufe7d', '\ufe7d'),
+ ('\ufe7f', '\ufefc'), ('\uff21', '\uff3a'),
+ ('\uff41', '\uff5a'), ('\uff66', '\uff6f'),
+ ('\uff70', '\uff70'), ('\uff71', '\uff9d'),
+ ('\uffa0', '\uffbe'), ('\uffc2', '\uffc7'),
+ ('\uffca', '\uffcf'), ('\uffd2', '\uffd7'),
+ ('\uffda', '\uffdc'), ('\U00010000', '\U0001000b'),
+ ('\U0001000d', '\U00010026'), ('\U00010028', '\U0001003a'),
+ ('\U0001003c', '\U0001003d'), ('\U0001003f', '\U0001004d'),
+ ('\U00010050', '\U0001005d'), ('\U00010080', '\U000100fa'),
+ ('\U00010140', '\U00010174'), ('\U00010280', '\U0001029c'),
+ ('\U000102a0', '\U000102d0'), ('\U00010300', '\U0001031e'),
+ ('\U00010330', '\U00010340'), ('\U00010341', '\U00010341'),
+ ('\U00010342', '\U00010349'), ('\U0001034a', '\U0001034a'),
+ ('\U00010380', '\U0001039d'), ('\U000103a0', '\U000103c3'),
+ ('\U000103c8', '\U000103cf'), ('\U000103d1', '\U000103d5'),
+ ('\U00010400', '\U0001044f'), ('\U00010450', '\U0001049d'),
+ ('\U00010800', '\U00010805'), ('\U00010808', '\U00010808'),
+ ('\U0001080a', '\U00010835'), ('\U00010837', '\U00010838'),
+ ('\U0001083c', '\U0001083c'), ('\U0001083f', '\U00010855'),
+ ('\U00010900', '\U00010915'), ('\U00010920', '\U00010939'),
+ ('\U00010980', '\U000109b7'), ('\U000109be', '\U000109bf'),
+ ('\U00010a00', '\U00010a00'), ('\U00010a10', '\U00010a13'),
+ ('\U00010a15', '\U00010a17'), ('\U00010a19', '\U00010a33'),
+ ('\U00010a60', '\U00010a7c'), ('\U00010b00', '\U00010b35'),
+ ('\U00010b40', '\U00010b55'), ('\U00010b60', '\U00010b72'),
+ ('\U00010c00', '\U00010c48'), ('\U00011003', '\U00011037'),
+ ('\U00011083', '\U000110af'), ('\U000110d0', '\U000110e8'),
+ ('\U00011103', '\U00011126'), ('\U00011183', '\U000111b2'),
+ ('\U000111c1', '\U000111c4'), ('\U00011680', '\U000116aa'),
+ ('\U00012000', '\U0001236e'), ('\U00012400', '\U00012462'),
+ ('\U00013000', '\U0001342e'), ('\U00016800', '\U00016a38'),
+ ('\U00016f00', '\U00016f44'), ('\U00016f50', '\U00016f50'),
+ ('\U00016f93', '\U00016f9f'), ('\U0001b000', '\U0001b001'),
+ ('\U0001d400', '\U0001d454'), ('\U0001d456', '\U0001d49c'),
+ ('\U0001d49e', '\U0001d49f'), ('\U0001d4a2', '\U0001d4a2'),
+ ('\U0001d4a5', '\U0001d4a6'), ('\U0001d4a9', '\U0001d4ac'),
+ ('\U0001d4ae', '\U0001d4b9'), ('\U0001d4bb', '\U0001d4bb'),
+ ('\U0001d4bd', '\U0001d4c3'), ('\U0001d4c5', '\U0001d505'),
+ ('\U0001d507', '\U0001d50a'), ('\U0001d50d', '\U0001d514'),
+ ('\U0001d516', '\U0001d51c'), ('\U0001d51e', '\U0001d539'),
+ ('\U0001d53b', '\U0001d53e'), ('\U0001d540', '\U0001d544'),
+ ('\U0001d546', '\U0001d546'), ('\U0001d54a', '\U0001d550'),
+ ('\U0001d552', '\U0001d6a5'), ('\U0001d6a8', '\U0001d6c0'),
+ ('\U0001d6c2', '\U0001d6da'), ('\U0001d6dc', '\U0001d6fa'),
+ ('\U0001d6fc', '\U0001d714'), ('\U0001d716', '\U0001d734'),
+ ('\U0001d736', '\U0001d74e'), ('\U0001d750', '\U0001d76e'),
+ ('\U0001d770', '\U0001d788'), ('\U0001d78a', '\U0001d7a8'),
+ ('\U0001d7aa', '\U0001d7c2'), ('\U0001d7c4', '\U0001d7cb'),
+ ('\U0001ee00', '\U0001ee03'), ('\U0001ee05', '\U0001ee1f'),
+ ('\U0001ee21', '\U0001ee22'), ('\U0001ee24', '\U0001ee24'),
+ ('\U0001ee27', '\U0001ee27'), ('\U0001ee29', '\U0001ee32'),
+ ('\U0001ee34', '\U0001ee37'), ('\U0001ee39', '\U0001ee39'),
+ ('\U0001ee3b', '\U0001ee3b'), ('\U0001ee42', '\U0001ee42'),
+ ('\U0001ee47', '\U0001ee47'), ('\U0001ee49', '\U0001ee49'),
+ ('\U0001ee4b', '\U0001ee4b'), ('\U0001ee4d', '\U0001ee4f'),
+ ('\U0001ee51', '\U0001ee52'), ('\U0001ee54', '\U0001ee54'),
+ ('\U0001ee57', '\U0001ee57'), ('\U0001ee59', '\U0001ee59'),
+ ('\U0001ee5b', '\U0001ee5b'), ('\U0001ee5d', '\U0001ee5d'),
+ ('\U0001ee5f', '\U0001ee5f'), ('\U0001ee61', '\U0001ee62'),
+ ('\U0001ee64', '\U0001ee64'), ('\U0001ee67', '\U0001ee6a'),
+ ('\U0001ee6c', '\U0001ee72'), ('\U0001ee74', '\U0001ee77'),
+ ('\U0001ee79', '\U0001ee7c'), ('\U0001ee7e', '\U0001ee7e'),
+ ('\U0001ee80', '\U0001ee89'), ('\U0001ee8b', '\U0001ee9b'),
+ ('\U0001eea1', '\U0001eea3'), ('\U0001eea5', '\U0001eea9'),
+ ('\U0001eeab', '\U0001eebb'), ('\U00020000', '\U0002a6d6'),
+ ('\U0002a700', '\U0002b734'), ('\U0002b740', '\U0002b81d'),
+ ('\U0002f800', '\U0002fa1d')
+ ];
+
+ pub fn XID_Start(c: char) -> bool {
+ super::bsearch_range_table(c, XID_Start_table)
+ }
+}
+
+pub mod property {
+ static White_Space_table : &'static [(char,char)] = &[
+ ('\x09', '\x0d'), ('\x20', '\x20'),
+ ('\x85', '\x85'), ('\xa0', '\xa0'),
+ ('\u1680', '\u1680'), ('\u2000', '\u200a'),
+ ('\u2028', '\u2028'), ('\u2029', '\u2029'),
+ ('\u202f', '\u202f'), ('\u205f', '\u205f'),
+ ('\u3000', '\u3000')
+ ];
+
+ pub fn White_Space(c: char) -> bool {
+ super::bsearch_range_table(c, White_Space_table)
+ }
+}
+
+pub mod conversions {
+ use cmp::{Equal, Less, Greater};
+ use slice::ImmutableVector;
+ use tuple::Tuple2;
+ use option::{Option, Some, None};
+
+ pub fn to_lower(c: char) -> char {
+ match bsearch_case_table(c, LuLl_table) {
+ None => c,
+ Some(index) => LuLl_table[index].val1()
+ }
+ }
+
+ pub fn to_upper(c: char) -> char {
+ match bsearch_case_table(c, LlLu_table) {
+ None => c,
+ Some(index) => LlLu_table[index].val1()
+ }
+ }
+
+ fn bsearch_case_table(c: char, table: &'static [(char, char)]) -> Option<uint> {
+ table.bsearch(|&(key, _)| {
+ if c == key { Equal }
+ else if key < c { Less }
+ else { Greater }
+ })
+ }
+
+ static LuLl_table : &'static [(char, char)] = &[
+ ('\x41', '\x61'), ('\x42', '\x62'),
+ ('\x43', '\x63'), ('\x44', '\x64'),
+ ('\x45', '\x65'), ('\x46', '\x66'),
+ ('\x47', '\x67'), ('\x48', '\x68'),
+ ('\x49', '\x69'), ('\x4a', '\x6a'),
+ ('\x4b', '\x6b'), ('\x4c', '\x6c'),
+ ('\x4d', '\x6d'), ('\x4e', '\x6e'),
+ ('\x4f', '\x6f'), ('\x50', '\x70'),
+ ('\x51', '\x71'), ('\x52', '\x72'),
+ ('\x53', '\x73'), ('\x54', '\x74'),
+ ('\x55', '\x75'), ('\x56', '\x76'),
+ ('\x57', '\x77'), ('\x58', '\x78'),
+ ('\x59', '\x79'), ('\x5a', '\x7a'),
+ ('\xc0', '\xe0'), ('\xc1', '\xe1'),
+ ('\xc2', '\xe2'), ('\xc3', '\xe3'),
+ ('\xc4', '\xe4'), ('\xc5', '\xe5'),
+ ('\xc6', '\xe6'), ('\xc7', '\xe7'),
+ ('\xc8', '\xe8'), ('\xc9', '\xe9'),
+ ('\xca', '\xea'), ('\xcb', '\xeb'),
+ ('\xcc', '\xec'), ('\xcd', '\xed'),
+ ('\xce', '\xee'), ('\xcf', '\xef'),
+ ('\xd0', '\xf0'), ('\xd1', '\xf1'),
+ ('\xd2', '\xf2'), ('\xd3', '\xf3'),
+ ('\xd4', '\xf4'), ('\xd5', '\xf5'),
+ ('\xd6', '\xf6'), ('\xd8', '\xf8'),
+ ('\xd9', '\xf9'), ('\xda', '\xfa'),
+ ('\xdb', '\xfb'), ('\xdc', '\xfc'),
+ ('\xdd', '\xfd'), ('\xde', '\xfe'),
+ ('\u0100', '\u0101'), ('\u0102', '\u0103'),
+ ('\u0104', '\u0105'), ('\u0106', '\u0107'),
+ ('\u0108', '\u0109'), ('\u010a', '\u010b'),
+ ('\u010c', '\u010d'), ('\u010e', '\u010f'),
+ ('\u0110', '\u0111'), ('\u0112', '\u0113'),
+ ('\u0114', '\u0115'), ('\u0116', '\u0117'),
+ ('\u0118', '\u0119'), ('\u011a', '\u011b'),
+ ('\u011c', '\u011d'), ('\u011e', '\u011f'),
+ ('\u0120', '\u0121'), ('\u0122', '\u0123'),
+ ('\u0124', '\u0125'), ('\u0126', '\u0127'),
+ ('\u0128', '\u0129'), ('\u012a', '\u012b'),
+ ('\u012c', '\u012d'), ('\u012e', '\u012f'),
+ ('\u0130', '\x69'), ('\u0132', '\u0133'),
+ ('\u0134', '\u0135'), ('\u0136', '\u0137'),
+ ('\u0139', '\u013a'), ('\u013b', '\u013c'),
+ ('\u013d', '\u013e'), ('\u013f', '\u0140'),
+ ('\u0141', '\u0142'), ('\u0143', '\u0144'),
+ ('\u0145', '\u0146'), ('\u0147', '\u0148'),
+ ('\u014a', '\u014b'), ('\u014c', '\u014d'),
+ ('\u014e', '\u014f'), ('\u0150', '\u0151'),
+ ('\u0152', '\u0153'), ('\u0154', '\u0155'),
+ ('\u0156', '\u0157'), ('\u0158', '\u0159'),
+ ('\u015a', '\u015b'), ('\u015c', '\u015d'),
+ ('\u015e', '\u015f'), ('\u0160', '\u0161'),
+ ('\u0162', '\u0163'), ('\u0164', '\u0165'),
+ ('\u0166', '\u0167'), ('\u0168', '\u0169'),
+ ('\u016a', '\u016b'), ('\u016c', '\u016d'),
+ ('\u016e', '\u016f'), ('\u0170', '\u0171'),
+ ('\u0172', '\u0173'), ('\u0174', '\u0175'),
+ ('\u0176', '\u0177'), ('\u0178', '\xff'),
+ ('\u0179', '\u017a'), ('\u017b', '\u017c'),
+ ('\u017d', '\u017e'), ('\u0181', '\u0253'),
+ ('\u0182', '\u0183'), ('\u0184', '\u0185'),
+ ('\u0186', '\u0254'), ('\u0187', '\u0188'),
+ ('\u0189', '\u0256'), ('\u018a', '\u0257'),
+ ('\u018b', '\u018c'), ('\u018e', '\u01dd'),
+ ('\u018f', '\u0259'), ('\u0190', '\u025b'),
+ ('\u0191', '\u0192'), ('\u0193', '\u0260'),
+ ('\u0194', '\u0263'), ('\u0196', '\u0269'),
+ ('\u0197', '\u0268'), ('\u0198', '\u0199'),
+ ('\u019c', '\u026f'), ('\u019d', '\u0272'),
+ ('\u019f', '\u0275'), ('\u01a0', '\u01a1'),
+ ('\u01a2', '\u01a3'), ('\u01a4', '\u01a5'),
+ ('\u01a6', '\u0280'), ('\u01a7', '\u01a8'),
+ ('\u01a9', '\u0283'), ('\u01ac', '\u01ad'),
+ ('\u01ae', '\u0288'), ('\u01af', '\u01b0'),
+ ('\u01b1', '\u028a'), ('\u01b2', '\u028b'),
+ ('\u01b3', '\u01b4'), ('\u01b5', '\u01b6'),
+ ('\u01b7', '\u0292'), ('\u01b8', '\u01b9'),
+ ('\u01bc', '\u01bd'), ('\u01c4', '\u01c6'),
+ ('\u01c7', '\u01c9'), ('\u01ca', '\u01cc'),
+ ('\u01cd', '\u01ce'), ('\u01cf', '\u01d0'),
+ ('\u01d1', '\u01d2'), ('\u01d3', '\u01d4'),
+ ('\u01d5', '\u01d6'), ('\u01d7', '\u01d8'),
+ ('\u01d9', '\u01da'), ('\u01db', '\u01dc'),
+ ('\u01de', '\u01df'), ('\u01e0', '\u01e1'),
+ ('\u01e2', '\u01e3'), ('\u01e4', '\u01e5'),
+ ('\u01e6', '\u01e7'), ('\u01e8', '\u01e9'),
+ ('\u01ea', '\u01eb'), ('\u01ec', '\u01ed'),
+ ('\u01ee', '\u01ef'), ('\u01f1', '\u01f3'),
+ ('\u01f4', '\u01f5'), ('\u01f6', '\u0195'),
+ ('\u01f7', '\u01bf'), ('\u01f8', '\u01f9'),
+ ('\u01fa', '\u01fb'), ('\u01fc', '\u01fd'),
+ ('\u01fe', '\u01ff'), ('\u0200', '\u0201'),
+ ('\u0202', '\u0203'), ('\u0204', '\u0205'),
+ ('\u0206', '\u0207'), ('\u0208', '\u0209'),
+ ('\u020a', '\u020b'), ('\u020c', '\u020d'),
+ ('\u020e', '\u020f'), ('\u0210', '\u0211'),
+ ('\u0212', '\u0213'), ('\u0214', '\u0215'),
+ ('\u0216', '\u0217'), ('\u0218', '\u0219'),
+ ('\u021a', '\u021b'), ('\u021c', '\u021d'),
+ ('\u021e', '\u021f'), ('\u0220', '\u019e'),
+ ('\u0222', '\u0223'), ('\u0224', '\u0225'),
+ ('\u0226', '\u0227'), ('\u0228', '\u0229'),
+ ('\u022a', '\u022b'), ('\u022c', '\u022d'),
+ ('\u022e', '\u022f'), ('\u0230', '\u0231'),
+ ('\u0232', '\u0233'), ('\u023a', '\u2c65'),
+ ('\u023b', '\u023c'), ('\u023d', '\u019a'),
+ ('\u023e', '\u2c66'), ('\u0241', '\u0242'),
+ ('\u0243', '\u0180'), ('\u0244', '\u0289'),
+ ('\u0245', '\u028c'), ('\u0246', '\u0247'),
+ ('\u0248', '\u0249'), ('\u024a', '\u024b'),
+ ('\u024c', '\u024d'), ('\u024e', '\u024f'),
+ ('\u0370', '\u0371'), ('\u0372', '\u0373'),
+ ('\u0376', '\u0377'), ('\u0386', '\u03ac'),
+ ('\u0388', '\u03ad'), ('\u0389', '\u03ae'),
+ ('\u038a', '\u03af'), ('\u038c', '\u03cc'),
+ ('\u038e', '\u03cd'), ('\u038f', '\u03ce'),
+ ('\u0391', '\u03b1'), ('\u0392', '\u03b2'),
+ ('\u0393', '\u03b3'), ('\u0394', '\u03b4'),
+ ('\u0395', '\u03b5'), ('\u0396', '\u03b6'),
+ ('\u0397', '\u03b7'), ('\u0398', '\u03b8'),
+ ('\u0399', '\u03b9'), ('\u039a', '\u03ba'),
+ ('\u039b', '\u03bb'), ('\u039c', '\u03bc'),
+ ('\u039d', '\u03bd'), ('\u039e', '\u03be'),
+ ('\u039f', '\u03bf'), ('\u03a0', '\u03c0'),
+ ('\u03a1', '\u03c1'), ('\u03a3', '\u03c3'),
+ ('\u03a4', '\u03c4'), ('\u03a5', '\u03c5'),
+ ('\u03a6', '\u03c6'), ('\u03a7', '\u03c7'),
+ ('\u03a8', '\u03c8'), ('\u03a9', '\u03c9'),
+ ('\u03aa', '\u03ca'), ('\u03ab', '\u03cb'),
+ ('\u03cf', '\u03d7'), ('\u03d8', '\u03d9'),
+ ('\u03da', '\u03db'), ('\u03dc', '\u03dd'),
+ ('\u03de', '\u03df'), ('\u03e0', '\u03e1'),
+ ('\u03e2', '\u03e3'), ('\u03e4', '\u03e5'),
+ ('\u03e6', '\u03e7'), ('\u03e8', '\u03e9'),
+ ('\u03ea', '\u03eb'), ('\u03ec', '\u03ed'),
+ ('\u03ee', '\u03ef'), ('\u03f4', '\u03b8'),
+ ('\u03f7', '\u03f8'), ('\u03f9', '\u03f2'),
+ ('\u03fa', '\u03fb'), ('\u03fd', '\u037b'),
+ ('\u03fe', '\u037c'), ('\u03ff', '\u037d'),
+ ('\u0400', '\u0450'), ('\u0401', '\u0451'),
+ ('\u0402', '\u0452'), ('\u0403', '\u0453'),
+ ('\u0404', '\u0454'), ('\u0405', '\u0455'),
+ ('\u0406', '\u0456'), ('\u0407', '\u0457'),
+ ('\u0408', '\u0458'), ('\u0409', '\u0459'),
+ ('\u040a', '\u045a'), ('\u040b', '\u045b'),
+ ('\u040c', '\u045c'), ('\u040d', '\u045d'),
+ ('\u040e', '\u045e'), ('\u040f', '\u045f'),
+ ('\u0410', '\u0430'), ('\u0411', '\u0431'),
+ ('\u0412', '\u0432'), ('\u0413', '\u0433'),
+ ('\u0414', '\u0434'), ('\u0415', '\u0435'),
+ ('\u0416', '\u0436'), ('\u0417', '\u0437'),
+ ('\u0418', '\u0438'), ('\u0419', '\u0439'),
+ ('\u041a', '\u043a'), ('\u041b', '\u043b'),
+ ('\u041c', '\u043c'), ('\u041d', '\u043d'),
+ ('\u041e', '\u043e'), ('\u041f', '\u043f'),
+ ('\u0420', '\u0440'), ('\u0421', '\u0441'),
+ ('\u0422', '\u0442'), ('\u0423', '\u0443'),
+ ('\u0424', '\u0444'), ('\u0425', '\u0445'),
+ ('\u0426', '\u0446'), ('\u0427', '\u0447'),
+ ('\u0428', '\u0448'), ('\u0429', '\u0449'),
+ ('\u042a', '\u044a'), ('\u042b', '\u044b'),
+ ('\u042c', '\u044c'), ('\u042d', '\u044d'),
+ ('\u042e', '\u044e'), ('\u042f', '\u044f'),
+ ('\u0460', '\u0461'), ('\u0462', '\u0463'),
+ ('\u0464', '\u0465'), ('\u0466', '\u0467'),
+ ('\u0468', '\u0469'), ('\u046a', '\u046b'),
+ ('\u046c', '\u046d'), ('\u046e', '\u046f'),
+ ('\u0470', '\u0471'), ('\u0472', '\u0473'),
+ ('\u0474', '\u0475'), ('\u0476', '\u0477'),
+ ('\u0478', '\u0479'), ('\u047a', '\u047b'),
+ ('\u047c', '\u047d'), ('\u047e', '\u047f'),
+ ('\u0480', '\u0481'), ('\u048a', '\u048b'),
+ ('\u048c', '\u048d'), ('\u048e', '\u048f'),
+ ('\u0490', '\u0491'), ('\u0492', '\u0493'),
+ ('\u0494', '\u0495'), ('\u0496', '\u0497'),
+ ('\u0498', '\u0499'), ('\u049a', '\u049b'),
+ ('\u049c', '\u049d'), ('\u049e', '\u049f'),
+ ('\u04a0', '\u04a1'), ('\u04a2', '\u04a3'),
+ ('\u04a4', '\u04a5'), ('\u04a6', '\u04a7'),
+ ('\u04a8', '\u04a9'), ('\u04aa', '\u04ab'),
+ ('\u04ac', '\u04ad'), ('\u04ae', '\u04af'),
+ ('\u04b0', '\u04b1'), ('\u04b2', '\u04b3'),
+ ('\u04b4', '\u04b5'), ('\u04b6', '\u04b7'),
+ ('\u04b8', '\u04b9'), ('\u04ba', '\u04bb'),
+ ('\u04bc', '\u04bd'), ('\u04be', '\u04bf'),
+ ('\u04c0', '\u04cf'), ('\u04c1', '\u04c2'),
+ ('\u04c3', '\u04c4'), ('\u04c5', '\u04c6'),
+ ('\u04c7', '\u04c8'), ('\u04c9', '\u04ca'),
+ ('\u04cb', '\u04cc'), ('\u04cd', '\u04ce'),
+ ('\u04d0', '\u04d1'), ('\u04d2', '\u04d3'),
+ ('\u04d4', '\u04d5'), ('\u04d6', '\u04d7'),
+ ('\u04d8', '\u04d9'), ('\u04da', '\u04db'),
+ ('\u04dc', '\u04dd'), ('\u04de', '\u04df'),
+ ('\u04e0', '\u04e1'), ('\u04e2', '\u04e3'),
+ ('\u04e4', '\u04e5'), ('\u04e6', '\u04e7'),
+ ('\u04e8', '\u04e9'), ('\u04ea', '\u04eb'),
+ ('\u04ec', '\u04ed'), ('\u04ee', '\u04ef'),
+ ('\u04f0', '\u04f1'), ('\u04f2', '\u04f3'),
+ ('\u04f4', '\u04f5'), ('\u04f6', '\u04f7'),
+ ('\u04f8', '\u04f9'), ('\u04fa', '\u04fb'),
+ ('\u04fc', '\u04fd'), ('\u04fe', '\u04ff'),
+ ('\u0500', '\u0501'), ('\u0502', '\u0503'),
+ ('\u0504', '\u0505'), ('\u0506', '\u0507'),
+ ('\u0508', '\u0509'), ('\u050a', '\u050b'),
+ ('\u050c', '\u050d'), ('\u050e', '\u050f'),
+ ('\u0510', '\u0511'), ('\u0512', '\u0513'),
+ ('\u0514', '\u0515'), ('\u0516', '\u0517'),
+ ('\u0518', '\u0519'), ('\u051a', '\u051b'),
+ ('\u051c', '\u051d'), ('\u051e', '\u051f'),
+ ('\u0520', '\u0521'), ('\u0522', '\u0523'),
+ ('\u0524', '\u0525'), ('\u0526', '\u0527'),
+ ('\u0531', '\u0561'), ('\u0532', '\u0562'),
+ ('\u0533', '\u0563'), ('\u0534', '\u0564'),
+ ('\u0535', '\u0565'), ('\u0536', '\u0566'),
+ ('\u0537', '\u0567'), ('\u0538', '\u0568'),
+ ('\u0539', '\u0569'), ('\u053a', '\u056a'),
+ ('\u053b', '\u056b'), ('\u053c', '\u056c'),
+ ('\u053d', '\u056d'), ('\u053e', '\u056e'),
+ ('\u053f', '\u056f'), ('\u0540', '\u0570'),
+ ('\u0541', '\u0571'), ('\u0542', '\u0572'),
+ ('\u0543', '\u0573'), ('\u0544', '\u0574'),
+ ('\u0545', '\u0575'), ('\u0546', '\u0576'),
+ ('\u0547', '\u0577'), ('\u0548', '\u0578'),
+ ('\u0549', '\u0579'), ('\u054a', '\u057a'),
+ ('\u054b', '\u057b'), ('\u054c', '\u057c'),
+ ('\u054d', '\u057d'), ('\u054e', '\u057e'),
+ ('\u054f', '\u057f'), ('\u0550', '\u0580'),
+ ('\u0551', '\u0581'), ('\u0552', '\u0582'),
+ ('\u0553', '\u0583'), ('\u0554', '\u0584'),
+ ('\u0555', '\u0585'), ('\u0556', '\u0586'),
+ ('\u10a0', '\u2d00'), ('\u10a1', '\u2d01'),
+ ('\u10a2', '\u2d02'), ('\u10a3', '\u2d03'),
+ ('\u10a4', '\u2d04'), ('\u10a5', '\u2d05'),
+ ('\u10a6', '\u2d06'), ('\u10a7', '\u2d07'),
+ ('\u10a8', '\u2d08'), ('\u10a9', '\u2d09'),
+ ('\u10aa', '\u2d0a'), ('\u10ab', '\u2d0b'),
+ ('\u10ac', '\u2d0c'), ('\u10ad', '\u2d0d'),
+ ('\u10ae', '\u2d0e'), ('\u10af', '\u2d0f'),
+ ('\u10b0', '\u2d10'), ('\u10b1', '\u2d11'),
+ ('\u10b2', '\u2d12'), ('\u10b3', '\u2d13'),
+ ('\u10b4', '\u2d14'), ('\u10b5', '\u2d15'),
+ ('\u10b6', '\u2d16'), ('\u10b7', '\u2d17'),
+ ('\u10b8', '\u2d18'), ('\u10b9', '\u2d19'),
+ ('\u10ba', '\u2d1a'), ('\u10bb', '\u2d1b'),
+ ('\u10bc', '\u2d1c'), ('\u10bd', '\u2d1d'),
+ ('\u10be', '\u2d1e'), ('\u10bf', '\u2d1f'),
+ ('\u10c0', '\u2d20'), ('\u10c1', '\u2d21'),
+ ('\u10c2', '\u2d22'), ('\u10c3', '\u2d23'),
+ ('\u10c4', '\u2d24'), ('\u10c5', '\u2d25'),
+ ('\u10c7', '\u2d27'), ('\u10cd', '\u2d2d'),
+ ('\u1e00', '\u1e01'), ('\u1e02', '\u1e03'),
+ ('\u1e04', '\u1e05'), ('\u1e06', '\u1e07'),
+ ('\u1e08', '\u1e09'), ('\u1e0a', '\u1e0b'),
+ ('\u1e0c', '\u1e0d'), ('\u1e0e', '\u1e0f'),
+ ('\u1e10', '\u1e11'), ('\u1e12', '\u1e13'),
+ ('\u1e14', '\u1e15'), ('\u1e16', '\u1e17'),
+ ('\u1e18', '\u1e19'), ('\u1e1a', '\u1e1b'),
+ ('\u1e1c', '\u1e1d'), ('\u1e1e', '\u1e1f'),
+ ('\u1e20', '\u1e21'), ('\u1e22', '\u1e23'),
+ ('\u1e24', '\u1e25'), ('\u1e26', '\u1e27'),
+ ('\u1e28', '\u1e29'), ('\u1e2a', '\u1e2b'),
+ ('\u1e2c', '\u1e2d'), ('\u1e2e', '\u1e2f'),
+ ('\u1e30', '\u1e31'), ('\u1e32', '\u1e33'),
+ ('\u1e34', '\u1e35'), ('\u1e36', '\u1e37'),
+ ('\u1e38', '\u1e39'), ('\u1e3a', '\u1e3b'),
+ ('\u1e3c', '\u1e3d'), ('\u1e3e', '\u1e3f'),
+ ('\u1e40', '\u1e41'), ('\u1e42', '\u1e43'),
+ ('\u1e44', '\u1e45'), ('\u1e46', '\u1e47'),
+ ('\u1e48', '\u1e49'), ('\u1e4a', '\u1e4b'),
+ ('\u1e4c', '\u1e4d'), ('\u1e4e', '\u1e4f'),
+ ('\u1e50', '\u1e51'), ('\u1e52', '\u1e53'),
+ ('\u1e54', '\u1e55'), ('\u1e56', '\u1e57'),
+ ('\u1e58', '\u1e59'), ('\u1e5a', '\u1e5b'),
+ ('\u1e5c', '\u1e5d'), ('\u1e5e', '\u1e5f'),
+ ('\u1e60', '\u1e61'), ('\u1e62', '\u1e63'),
+ ('\u1e64', '\u1e65'), ('\u1e66', '\u1e67'),
+ ('\u1e68', '\u1e69'), ('\u1e6a', '\u1e6b'),
+ ('\u1e6c', '\u1e6d'), ('\u1e6e', '\u1e6f'),
+ ('\u1e70', '\u1e71'), ('\u1e72', '\u1e73'),
+ ('\u1e74', '\u1e75'), ('\u1e76', '\u1e77'),
+ ('\u1e78', '\u1e79'), ('\u1e7a', '\u1e7b'),
+ ('\u1e7c', '\u1e7d'), ('\u1e7e', '\u1e7f'),
+ ('\u1e80', '\u1e81'), ('\u1e82', '\u1e83'),
+ ('\u1e84', '\u1e85'), ('\u1e86', '\u1e87'),
+ ('\u1e88', '\u1e89'), ('\u1e8a', '\u1e8b'),
+ ('\u1e8c', '\u1e8d'), ('\u1e8e', '\u1e8f'),
+ ('\u1e90', '\u1e91'), ('\u1e92', '\u1e93'),
+ ('\u1e94', '\u1e95'), ('\u1e9e', '\xdf'),
+ ('\u1ea0', '\u1ea1'), ('\u1ea2', '\u1ea3'),
+ ('\u1ea4', '\u1ea5'), ('\u1ea6', '\u1ea7'),
+ ('\u1ea8', '\u1ea9'), ('\u1eaa', '\u1eab'),
+ ('\u1eac', '\u1ead'), ('\u1eae', '\u1eaf'),
+ ('\u1eb0', '\u1eb1'), ('\u1eb2', '\u1eb3'),
+ ('\u1eb4', '\u1eb5'), ('\u1eb6', '\u1eb7'),
+ ('\u1eb8', '\u1eb9'), ('\u1eba', '\u1ebb'),
+ ('\u1ebc', '\u1ebd'), ('\u1ebe', '\u1ebf'),
+ ('\u1ec0', '\u1ec1'), ('\u1ec2', '\u1ec3'),
+ ('\u1ec4', '\u1ec5'), ('\u1ec6', '\u1ec7'),
+ ('\u1ec8', '\u1ec9'), ('\u1eca', '\u1ecb'),
+ ('\u1ecc', '\u1ecd'), ('\u1ece', '\u1ecf'),
+ ('\u1ed0', '\u1ed1'), ('\u1ed2', '\u1ed3'),
+ ('\u1ed4', '\u1ed5'), ('\u1ed6', '\u1ed7'),
+ ('\u1ed8', '\u1ed9'), ('\u1eda', '\u1edb'),
+ ('\u1edc', '\u1edd'), ('\u1ede', '\u1edf'),
+ ('\u1ee0', '\u1ee1'), ('\u1ee2', '\u1ee3'),
+ ('\u1ee4', '\u1ee5'), ('\u1ee6', '\u1ee7'),
+ ('\u1ee8', '\u1ee9'), ('\u1eea', '\u1eeb'),
+ ('\u1eec', '\u1eed'), ('\u1eee', '\u1eef'),
+ ('\u1ef0', '\u1ef1'), ('\u1ef2', '\u1ef3'),
+ ('\u1ef4', '\u1ef5'), ('\u1ef6', '\u1ef7'),
+ ('\u1ef8', '\u1ef9'), ('\u1efa', '\u1efb'),
+ ('\u1efc', '\u1efd'), ('\u1efe', '\u1eff'),
+ ('\u1f08', '\u1f00'), ('\u1f09', '\u1f01'),
+ ('\u1f0a', '\u1f02'), ('\u1f0b', '\u1f03'),
+ ('\u1f0c', '\u1f04'), ('\u1f0d', '\u1f05'),
+ ('\u1f0e', '\u1f06'), ('\u1f0f', '\u1f07'),
+ ('\u1f18', '\u1f10'), ('\u1f19', '\u1f11'),
+ ('\u1f1a', '\u1f12'), ('\u1f1b', '\u1f13'),
+ ('\u1f1c', '\u1f14'), ('\u1f1d', '\u1f15'),
+ ('\u1f28', '\u1f20'), ('\u1f29', '\u1f21'),
+ ('\u1f2a', '\u1f22'), ('\u1f2b', '\u1f23'),
+ ('\u1f2c', '\u1f24'), ('\u1f2d', '\u1f25'),
+ ('\u1f2e', '\u1f26'), ('\u1f2f', '\u1f27'),
+ ('\u1f38', '\u1f30'), ('\u1f39', '\u1f31'),
+ ('\u1f3a', '\u1f32'), ('\u1f3b', '\u1f33'),
+ ('\u1f3c', '\u1f34'), ('\u1f3d', '\u1f35'),
+ ('\u1f3e', '\u1f36'), ('\u1f3f', '\u1f37'),
+ ('\u1f48', '\u1f40'), ('\u1f49', '\u1f41'),
+ ('\u1f4a', '\u1f42'), ('\u1f4b', '\u1f43'),
+ ('\u1f4c', '\u1f44'), ('\u1f4d', '\u1f45'),
+ ('\u1f59', '\u1f51'), ('\u1f5b', '\u1f53'),
+ ('\u1f5d', '\u1f55'), ('\u1f5f', '\u1f57'),
+ ('\u1f68', '\u1f60'), ('\u1f69', '\u1f61'),
+ ('\u1f6a', '\u1f62'), ('\u1f6b', '\u1f63'),
+ ('\u1f6c', '\u1f64'), ('\u1f6d', '\u1f65'),
+ ('\u1f6e', '\u1f66'), ('\u1f6f', '\u1f67'),
+ ('\u1fb8', '\u1fb0'), ('\u1fb9', '\u1fb1'),
+ ('\u1fba', '\u1f70'), ('\u1fbb', '\u1f71'),
+ ('\u1fc8', '\u1f72'), ('\u1fc9', '\u1f73'),
+ ('\u1fca', '\u1f74'), ('\u1fcb', '\u1f75'),
+ ('\u1fd8', '\u1fd0'), ('\u1fd9', '\u1fd1'),
+ ('\u1fda', '\u1f76'), ('\u1fdb', '\u1f77'),
+ ('\u1fe8', '\u1fe0'), ('\u1fe9', '\u1fe1'),
+ ('\u1fea', '\u1f7a'), ('\u1feb', '\u1f7b'),
+ ('\u1fec', '\u1fe5'), ('\u1ff8', '\u1f78'),
+ ('\u1ff9', '\u1f79'), ('\u1ffa', '\u1f7c'),
+ ('\u1ffb', '\u1f7d'), ('\u2126', '\u03c9'),
+ ('\u212a', '\x6b'), ('\u212b', '\xe5'),
+ ('\u2132', '\u214e'), ('\u2183', '\u2184'),
+ ('\u2c00', '\u2c30'), ('\u2c01', '\u2c31'),
+ ('\u2c02', '\u2c32'), ('\u2c03', '\u2c33'),
+ ('\u2c04', '\u2c34'), ('\u2c05', '\u2c35'),
+ ('\u2c06', '\u2c36'), ('\u2c07', '\u2c37'),
+ ('\u2c08', '\u2c38'), ('\u2c09', '\u2c39'),
+ ('\u2c0a', '\u2c3a'), ('\u2c0b', '\u2c3b'),
+ ('\u2c0c', '\u2c3c'), ('\u2c0d', '\u2c3d'),
+ ('\u2c0e', '\u2c3e'), ('\u2c0f', '\u2c3f'),
+ ('\u2c10', '\u2c40'), ('\u2c11', '\u2c41'),
+ ('\u2c12', '\u2c42'), ('\u2c13', '\u2c43'),
+ ('\u2c14', '\u2c44'), ('\u2c15', '\u2c45'),
+ ('\u2c16', '\u2c46'), ('\u2c17', '\u2c47'),
+ ('\u2c18', '\u2c48'), ('\u2c19', '\u2c49'),
+ ('\u2c1a', '\u2c4a'), ('\u2c1b', '\u2c4b'),
+ ('\u2c1c', '\u2c4c'), ('\u2c1d', '\u2c4d'),
+ ('\u2c1e', '\u2c4e'), ('\u2c1f', '\u2c4f'),
+ ('\u2c20', '\u2c50'), ('\u2c21', '\u2c51'),
+ ('\u2c22', '\u2c52'), ('\u2c23', '\u2c53'),
+ ('\u2c24', '\u2c54'), ('\u2c25', '\u2c55'),
+ ('\u2c26', '\u2c56'), ('\u2c27', '\u2c57'),
+ ('\u2c28', '\u2c58'), ('\u2c29', '\u2c59'),
+ ('\u2c2a', '\u2c5a'), ('\u2c2b', '\u2c5b'),
+ ('\u2c2c', '\u2c5c'), ('\u2c2d', '\u2c5d'),
+ ('\u2c2e', '\u2c5e'), ('\u2c60', '\u2c61'),
+ ('\u2c62', '\u026b'), ('\u2c63', '\u1d7d'),
+ ('\u2c64', '\u027d'), ('\u2c67', '\u2c68'),
+ ('\u2c69', '\u2c6a'), ('\u2c6b', '\u2c6c'),
+ ('\u2c6d', '\u0251'), ('\u2c6e', '\u0271'),
+ ('\u2c6f', '\u0250'), ('\u2c70', '\u0252'),
+ ('\u2c72', '\u2c73'), ('\u2c75', '\u2c76'),
+ ('\u2c7e', '\u023f'), ('\u2c7f', '\u0240'),
+ ('\u2c80', '\u2c81'), ('\u2c82', '\u2c83'),
+ ('\u2c84', '\u2c85'), ('\u2c86', '\u2c87'),
+ ('\u2c88', '\u2c89'), ('\u2c8a', '\u2c8b'),
+ ('\u2c8c', '\u2c8d'), ('\u2c8e', '\u2c8f'),
+ ('\u2c90', '\u2c91'), ('\u2c92', '\u2c93'),
+ ('\u2c94', '\u2c95'), ('\u2c96', '\u2c97'),
+ ('\u2c98', '\u2c99'), ('\u2c9a', '\u2c9b'),
+ ('\u2c9c', '\u2c9d'), ('\u2c9e', '\u2c9f'),
+ ('\u2ca0', '\u2ca1'), ('\u2ca2', '\u2ca3'),
+ ('\u2ca4', '\u2ca5'), ('\u2ca6', '\u2ca7'),
+ ('\u2ca8', '\u2ca9'), ('\u2caa', '\u2cab'),
+ ('\u2cac', '\u2cad'), ('\u2cae', '\u2caf'),
+ ('\u2cb0', '\u2cb1'), ('\u2cb2', '\u2cb3'),
+ ('\u2cb4', '\u2cb5'), ('\u2cb6', '\u2cb7'),
+ ('\u2cb8', '\u2cb9'), ('\u2cba', '\u2cbb'),
+ ('\u2cbc', '\u2cbd'), ('\u2cbe', '\u2cbf'),
+ ('\u2cc0', '\u2cc1'), ('\u2cc2', '\u2cc3'),
+ ('\u2cc4', '\u2cc5'), ('\u2cc6', '\u2cc7'),
+ ('\u2cc8', '\u2cc9'), ('\u2cca', '\u2ccb'),
+ ('\u2ccc', '\u2ccd'), ('\u2cce', '\u2ccf'),
+ ('\u2cd0', '\u2cd1'), ('\u2cd2', '\u2cd3'),
+ ('\u2cd4', '\u2cd5'), ('\u2cd6', '\u2cd7'),
+ ('\u2cd8', '\u2cd9'), ('\u2cda', '\u2cdb'),
+ ('\u2cdc', '\u2cdd'), ('\u2cde', '\u2cdf'),
+ ('\u2ce0', '\u2ce1'), ('\u2ce2', '\u2ce3'),
+ ('\u2ceb', '\u2cec'), ('\u2ced', '\u2cee'),
+ ('\u2cf2', '\u2cf3'), ('\ua640', '\ua641'),
+ ('\ua642', '\ua643'), ('\ua644', '\ua645'),
+ ('\ua646', '\ua647'), ('\ua648', '\ua649'),
+ ('\ua64a', '\ua64b'), ('\ua64c', '\ua64d'),
+ ('\ua64e', '\ua64f'), ('\ua650', '\ua651'),
+ ('\ua652', '\ua653'), ('\ua654', '\ua655'),
+ ('\ua656', '\ua657'), ('\ua658', '\ua659'),
+ ('\ua65a', '\ua65b'), ('\ua65c', '\ua65d'),
+ ('\ua65e', '\ua65f'), ('\ua660', '\ua661'),
+ ('\ua662', '\ua663'), ('\ua664', '\ua665'),
+ ('\ua666', '\ua667'), ('\ua668', '\ua669'),
+ ('\ua66a', '\ua66b'), ('\ua66c', '\ua66d'),
+ ('\ua680', '\ua681'), ('\ua682', '\ua683'),
+ ('\ua684', '\ua685'), ('\ua686', '\ua687'),
+ ('\ua688', '\ua689'), ('\ua68a', '\ua68b'),
+ ('\ua68c', '\ua68d'), ('\ua68e', '\ua68f'),
+ ('\ua690', '\ua691'), ('\ua692', '\ua693'),
+ ('\ua694', '\ua695'), ('\ua696', '\ua697'),
+ ('\ua722', '\ua723'), ('\ua724', '\ua725'),
+ ('\ua726', '\ua727'), ('\ua728', '\ua729'),
+ ('\ua72a', '\ua72b'), ('\ua72c', '\ua72d'),
+ ('\ua72e', '\ua72f'), ('\ua732', '\ua733'),
+ ('\ua734', '\ua735'), ('\ua736', '\ua737'),
+ ('\ua738', '\ua739'), ('\ua73a', '\ua73b'),
+ ('\ua73c', '\ua73d'), ('\ua73e', '\ua73f'),
+ ('\ua740', '\ua741'), ('\ua742', '\ua743'),
+ ('\ua744', '\ua745'), ('\ua746', '\ua747'),
+ ('\ua748', '\ua749'), ('\ua74a', '\ua74b'),
+ ('\ua74c', '\ua74d'), ('\ua74e', '\ua74f'),
+ ('\ua750', '\ua751'), ('\ua752', '\ua753'),
+ ('\ua754', '\ua755'), ('\ua756', '\ua757'),
+ ('\ua758', '\ua759'), ('\ua75a', '\ua75b'),
+ ('\ua75c', '\ua75d'), ('\ua75e', '\ua75f'),
+ ('\ua760', '\ua761'), ('\ua762', '\ua763'),
+ ('\ua764', '\ua765'), ('\ua766', '\ua767'),
+ ('\ua768', '\ua769'), ('\ua76a', '\ua76b'),
+ ('\ua76c', '\ua76d'), ('\ua76e', '\ua76f'),
+ ('\ua779', '\ua77a'), ('\ua77b', '\ua77c'),
+ ('\ua77d', '\u1d79'), ('\ua77e', '\ua77f'),
+ ('\ua780', '\ua781'), ('\ua782', '\ua783'),
+ ('\ua784', '\ua785'), ('\ua786', '\ua787'),
+ ('\ua78b', '\ua78c'), ('\ua78d', '\u0265'),
+ ('\ua790', '\ua791'), ('\ua792', '\ua793'),
+ ('\ua7a0', '\ua7a1'), ('\ua7a2', '\ua7a3'),
+ ('\ua7a4', '\ua7a5'), ('\ua7a6', '\ua7a7'),
+ ('\ua7a8', '\ua7a9'), ('\ua7aa', '\u0266'),
+ ('\uff21', '\uff41'), ('\uff22', '\uff42'),
+ ('\uff23', '\uff43'), ('\uff24', '\uff44'),
+ ('\uff25', '\uff45'), ('\uff26', '\uff46'),
+ ('\uff27', '\uff47'), ('\uff28', '\uff48'),
+ ('\uff29', '\uff49'), ('\uff2a', '\uff4a'),
+ ('\uff2b', '\uff4b'), ('\uff2c', '\uff4c'),
+ ('\uff2d', '\uff4d'), ('\uff2e', '\uff4e'),
+ ('\uff2f', '\uff4f'), ('\uff30', '\uff50'),
+ ('\uff31', '\uff51'), ('\uff32', '\uff52'),
+ ('\uff33', '\uff53'), ('\uff34', '\uff54'),
+ ('\uff35', '\uff55'), ('\uff36', '\uff56'),
+ ('\uff37', '\uff57'), ('\uff38', '\uff58'),
+ ('\uff39', '\uff59'), ('\uff3a', '\uff5a'),
+ ('\U00010400', '\U00010428'), ('\U00010401', '\U00010429'),
+ ('\U00010402', '\U0001042a'), ('\U00010403', '\U0001042b'),
+ ('\U00010404', '\U0001042c'), ('\U00010405', '\U0001042d'),
+ ('\U00010406', '\U0001042e'), ('\U00010407', '\U0001042f'),
+ ('\U00010408', '\U00010430'), ('\U00010409', '\U00010431'),
+ ('\U0001040a', '\U00010432'), ('\U0001040b', '\U00010433'),
+ ('\U0001040c', '\U00010434'), ('\U0001040d', '\U00010435'),
+ ('\U0001040e', '\U00010436'), ('\U0001040f', '\U00010437'),
+ ('\U00010410', '\U00010438'), ('\U00010411', '\U00010439'),
+ ('\U00010412', '\U0001043a'), ('\U00010413', '\U0001043b'),
+ ('\U00010414', '\U0001043c'), ('\U00010415', '\U0001043d'),
+ ('\U00010416', '\U0001043e'), ('\U00010417', '\U0001043f'),
+ ('\U00010418', '\U00010440'), ('\U00010419', '\U00010441'),
+ ('\U0001041a', '\U00010442'), ('\U0001041b', '\U00010443'),
+ ('\U0001041c', '\U00010444'), ('\U0001041d', '\U00010445'),
+ ('\U0001041e', '\U00010446'), ('\U0001041f', '\U00010447'),
+ ('\U00010420', '\U00010448'), ('\U00010421', '\U00010449'),
+ ('\U00010422', '\U0001044a'), ('\U00010423', '\U0001044b'),
+ ('\U00010424', '\U0001044c'), ('\U00010425', '\U0001044d'),
+ ('\U00010426', '\U0001044e'), ('\U00010427', '\U0001044f')
+ ];
+
+ static LlLu_table : &'static [(char, char)] = &[
+ ('\x61', '\x41'), ('\x62', '\x42'),
+ ('\x63', '\x43'), ('\x64', '\x44'),
+ ('\x65', '\x45'), ('\x66', '\x46'),
+ ('\x67', '\x47'), ('\x68', '\x48'),
+ ('\x69', '\x49'), ('\x6a', '\x4a'),
+ ('\x6b', '\x4b'), ('\x6c', '\x4c'),
+ ('\x6d', '\x4d'), ('\x6e', '\x4e'),
+ ('\x6f', '\x4f'), ('\x70', '\x50'),
+ ('\x71', '\x51'), ('\x72', '\x52'),
+ ('\x73', '\x53'), ('\x74', '\x54'),
+ ('\x75', '\x55'), ('\x76', '\x56'),
+ ('\x77', '\x57'), ('\x78', '\x58'),
+ ('\x79', '\x59'), ('\x7a', '\x5a'),
+ ('\xb5', '\u039c'), ('\xe0', '\xc0'),
+ ('\xe1', '\xc1'), ('\xe2', '\xc2'),
+ ('\xe3', '\xc3'), ('\xe4', '\xc4'),
+ ('\xe5', '\xc5'), ('\xe6', '\xc6'),
+ ('\xe7', '\xc7'), ('\xe8', '\xc8'),
+ ('\xe9', '\xc9'), ('\xea', '\xca'),
+ ('\xeb', '\xcb'), ('\xec', '\xcc'),
+ ('\xed', '\xcd'), ('\xee', '\xce'),
+ ('\xef', '\xcf'), ('\xf0', '\xd0'),
+ ('\xf1', '\xd1'), ('\xf2', '\xd2'),
+ ('\xf3', '\xd3'), ('\xf4', '\xd4'),
+ ('\xf5', '\xd5'), ('\xf6', '\xd6'),
+ ('\xf8', '\xd8'), ('\xf9', '\xd9'),
+ ('\xfa', '\xda'), ('\xfb', '\xdb'),
+ ('\xfc', '\xdc'), ('\xfd', '\xdd'),
+ ('\xfe', '\xde'), ('\xff', '\u0178'),
+ ('\u0101', '\u0100'), ('\u0103', '\u0102'),
+ ('\u0105', '\u0104'), ('\u0107', '\u0106'),
+ ('\u0109', '\u0108'), ('\u010b', '\u010a'),
+ ('\u010d', '\u010c'), ('\u010f', '\u010e'),
+ ('\u0111', '\u0110'), ('\u0113', '\u0112'),
+ ('\u0115', '\u0114'), ('\u0117', '\u0116'),
+ ('\u0119', '\u0118'), ('\u011b', '\u011a'),
+ ('\u011d', '\u011c'), ('\u011f', '\u011e'),
+ ('\u0121', '\u0120'), ('\u0123', '\u0122'),
+ ('\u0125', '\u0124'), ('\u0127', '\u0126'),
+ ('\u0129', '\u0128'), ('\u012b', '\u012a'),
+ ('\u012d', '\u012c'), ('\u012f', '\u012e'),
+ ('\u0131', '\x49'), ('\u0133', '\u0132'),
+ ('\u0135', '\u0134'), ('\u0137', '\u0136'),
+ ('\u013a', '\u0139'), ('\u013c', '\u013b'),
+ ('\u013e', '\u013d'), ('\u0140', '\u013f'),
+ ('\u0142', '\u0141'), ('\u0144', '\u0143'),
+ ('\u0146', '\u0145'), ('\u0148', '\u0147'),
+ ('\u014b', '\u014a'), ('\u014d', '\u014c'),
+ ('\u014f', '\u014e'), ('\u0151', '\u0150'),
+ ('\u0153', '\u0152'), ('\u0155', '\u0154'),
+ ('\u0157', '\u0156'), ('\u0159', '\u0158'),
+ ('\u015b', '\u015a'), ('\u015d', '\u015c'),
+ ('\u015f', '\u015e'), ('\u0161', '\u0160'),
+ ('\u0163', '\u0162'), ('\u0165', '\u0164'),
+ ('\u0167', '\u0166'), ('\u0169', '\u0168'),
+ ('\u016b', '\u016a'), ('\u016d', '\u016c'),
+ ('\u016f', '\u016e'), ('\u0171', '\u0170'),
+ ('\u0173', '\u0172'), ('\u0175', '\u0174'),
+ ('\u0177', '\u0176'), ('\u017a', '\u0179'),
+ ('\u017c', '\u017b'), ('\u017e', '\u017d'),
+ ('\u017f', '\x53'), ('\u0180', '\u0243'),
+ ('\u0183', '\u0182'), ('\u0185', '\u0184'),
+ ('\u0188', '\u0187'), ('\u018c', '\u018b'),
+ ('\u0192', '\u0191'), ('\u0195', '\u01f6'),
+ ('\u0199', '\u0198'), ('\u019a', '\u023d'),
+ ('\u019e', '\u0220'), ('\u01a1', '\u01a0'),
+ ('\u01a3', '\u01a2'), ('\u01a5', '\u01a4'),
+ ('\u01a8', '\u01a7'), ('\u01ad', '\u01ac'),
+ ('\u01b0', '\u01af'), ('\u01b4', '\u01b3'),
+ ('\u01b6', '\u01b5'), ('\u01b9', '\u01b8'),
+ ('\u01bd', '\u01bc'), ('\u01bf', '\u01f7'),
+ ('\u01c6', '\u01c4'), ('\u01c9', '\u01c7'),
+ ('\u01cc', '\u01ca'), ('\u01ce', '\u01cd'),
+ ('\u01d0', '\u01cf'), ('\u01d2', '\u01d1'),
+ ('\u01d4', '\u01d3'), ('\u01d6', '\u01d5'),
+ ('\u01d8', '\u01d7'), ('\u01da', '\u01d9'),
+ ('\u01dc', '\u01db'), ('\u01dd', '\u018e'),
+ ('\u01df', '\u01de'), ('\u01e1', '\u01e0'),
+ ('\u01e3', '\u01e2'), ('\u01e5', '\u01e4'),
+ ('\u01e7', '\u01e6'), ('\u01e9', '\u01e8'),
+ ('\u01eb', '\u01ea'), ('\u01ed', '\u01ec'),
+ ('\u01ef', '\u01ee'), ('\u01f3', '\u01f1'),
+ ('\u01f5', '\u01f4'), ('\u01f9', '\u01f8'),
+ ('\u01fb', '\u01fa'), ('\u01fd', '\u01fc'),
+ ('\u01ff', '\u01fe'), ('\u0201', '\u0200'),
+ ('\u0203', '\u0202'), ('\u0205', '\u0204'),
+ ('\u0207', '\u0206'), ('\u0209', '\u0208'),
+ ('\u020b', '\u020a'), ('\u020d', '\u020c'),
+ ('\u020f', '\u020e'), ('\u0211', '\u0210'),
+ ('\u0213', '\u0212'), ('\u0215', '\u0214'),
+ ('\u0217', '\u0216'), ('\u0219', '\u0218'),
+ ('\u021b', '\u021a'), ('\u021d', '\u021c'),
+ ('\u021f', '\u021e'), ('\u0223', '\u0222'),
+ ('\u0225', '\u0224'), ('\u0227', '\u0226'),
+ ('\u0229', '\u0228'), ('\u022b', '\u022a'),
+ ('\u022d', '\u022c'), ('\u022f', '\u022e'),
+ ('\u0231', '\u0230'), ('\u0233', '\u0232'),
+ ('\u023c', '\u023b'), ('\u023f', '\u2c7e'),
+ ('\u0240', '\u2c7f'), ('\u0242', '\u0241'),
+ ('\u0247', '\u0246'), ('\u0249', '\u0248'),
+ ('\u024b', '\u024a'), ('\u024d', '\u024c'),
+ ('\u024f', '\u024e'), ('\u0250', '\u2c6f'),
+ ('\u0251', '\u2c6d'), ('\u0252', '\u2c70'),
+ ('\u0253', '\u0181'), ('\u0254', '\u0186'),
+ ('\u0256', '\u0189'), ('\u0257', '\u018a'),
+ ('\u0259', '\u018f'), ('\u025b', '\u0190'),
+ ('\u0260', '\u0193'), ('\u0263', '\u0194'),
+ ('\u0265', '\ua78d'), ('\u0266', '\ua7aa'),
+ ('\u0268', '\u0197'), ('\u0269', '\u0196'),
+ ('\u026b', '\u2c62'), ('\u026f', '\u019c'),
+ ('\u0271', '\u2c6e'), ('\u0272', '\u019d'),
+ ('\u0275', '\u019f'), ('\u027d', '\u2c64'),
+ ('\u0280', '\u01a6'), ('\u0283', '\u01a9'),
+ ('\u0288', '\u01ae'), ('\u0289', '\u0244'),
+ ('\u028a', '\u01b1'), ('\u028b', '\u01b2'),
+ ('\u028c', '\u0245'), ('\u0292', '\u01b7'),
+ ('\u0371', '\u0370'), ('\u0373', '\u0372'),
+ ('\u0377', '\u0376'), ('\u037b', '\u03fd'),
+ ('\u037c', '\u03fe'), ('\u037d', '\u03ff'),
+ ('\u03ac', '\u0386'), ('\u03ad', '\u0388'),
+ ('\u03ae', '\u0389'), ('\u03af', '\u038a'),
+ ('\u03b1', '\u0391'), ('\u03b2', '\u0392'),
+ ('\u03b3', '\u0393'), ('\u03b4', '\u0394'),
+ ('\u03b5', '\u0395'), ('\u03b6', '\u0396'),
+ ('\u03b7', '\u0397'), ('\u03b8', '\u0398'),
+ ('\u03b9', '\u0399'), ('\u03ba', '\u039a'),
+ ('\u03bb', '\u039b'), ('\u03bc', '\u039c'),
+ ('\u03bd', '\u039d'), ('\u03be', '\u039e'),
+ ('\u03bf', '\u039f'), ('\u03c0', '\u03a0'),
+ ('\u03c1', '\u03a1'), ('\u03c2', '\u03a3'),
+ ('\u03c3', '\u03a3'), ('\u03c4', '\u03a4'),
+ ('\u03c5', '\u03a5'), ('\u03c6', '\u03a6'),
+ ('\u03c7', '\u03a7'), ('\u03c8', '\u03a8'),
+ ('\u03c9', '\u03a9'), ('\u03ca', '\u03aa'),
+ ('\u03cb', '\u03ab'), ('\u03cc', '\u038c'),
+ ('\u03cd', '\u038e'), ('\u03ce', '\u038f'),
+ ('\u03d0', '\u0392'), ('\u03d1', '\u0398'),
+ ('\u03d5', '\u03a6'), ('\u03d6', '\u03a0'),
+ ('\u03d7', '\u03cf'), ('\u03d9', '\u03d8'),
+ ('\u03db', '\u03da'), ('\u03dd', '\u03dc'),
+ ('\u03df', '\u03de'), ('\u03e1', '\u03e0'),
+ ('\u03e3', '\u03e2'), ('\u03e5', '\u03e4'),
+ ('\u03e7', '\u03e6'), ('\u03e9', '\u03e8'),
+ ('\u03eb', '\u03ea'), ('\u03ed', '\u03ec'),
+ ('\u03ef', '\u03ee'), ('\u03f0', '\u039a'),
+ ('\u03f1', '\u03a1'), ('\u03f2', '\u03f9'),
+ ('\u03f5', '\u0395'), ('\u03f8', '\u03f7'),
+ ('\u03fb', '\u03fa'), ('\u0430', '\u0410'),
+ ('\u0431', '\u0411'), ('\u0432', '\u0412'),
+ ('\u0433', '\u0413'), ('\u0434', '\u0414'),
+ ('\u0435', '\u0415'), ('\u0436', '\u0416'),
+ ('\u0437', '\u0417'), ('\u0438', '\u0418'),
+ ('\u0439', '\u0419'), ('\u043a', '\u041a'),
+ ('\u043b', '\u041b'), ('\u043c', '\u041c'),
+ ('\u043d', '\u041d'), ('\u043e', '\u041e'),
+ ('\u043f', '\u041f'), ('\u0440', '\u0420'),
+ ('\u0441', '\u0421'), ('\u0442', '\u0422'),
+ ('\u0443', '\u0423'), ('\u0444', '\u0424'),
+ ('\u0445', '\u0425'), ('\u0446', '\u0426'),
+ ('\u0447', '\u0427'), ('\u0448', '\u0428'),
+ ('\u0449', '\u0429'), ('\u044a', '\u042a'),
+ ('\u044b', '\u042b'), ('\u044c', '\u042c'),
+ ('\u044d', '\u042d'), ('\u044e', '\u042e'),
+ ('\u044f', '\u042f'), ('\u0450', '\u0400'),
+ ('\u0451', '\u0401'), ('\u0452', '\u0402'),
+ ('\u0453', '\u0403'), ('\u0454', '\u0404'),
+ ('\u0455', '\u0405'), ('\u0456', '\u0406'),
+ ('\u0457', '\u0407'), ('\u0458', '\u0408'),
+ ('\u0459', '\u0409'), ('\u045a', '\u040a'),
+ ('\u045b', '\u040b'), ('\u045c', '\u040c'),
+ ('\u045d', '\u040d'), ('\u045e', '\u040e'),
+ ('\u045f', '\u040f'), ('\u0461', '\u0460'),
+ ('\u0463', '\u0462'), ('\u0465', '\u0464'),
+ ('\u0467', '\u0466'), ('\u0469', '\u0468'),
+ ('\u046b', '\u046a'), ('\u046d', '\u046c'),
+ ('\u046f', '\u046e'), ('\u0471', '\u0470'),
+ ('\u0473', '\u0472'), ('\u0475', '\u0474'),
+ ('\u0477', '\u0476'), ('\u0479', '\u0478'),
+ ('\u047b', '\u047a'), ('\u047d', '\u047c'),
+ ('\u047f', '\u047e'), ('\u0481', '\u0480'),
+ ('\u048b', '\u048a'), ('\u048d', '\u048c'),
+ ('\u048f', '\u048e'), ('\u0491', '\u0490'),
+ ('\u0493', '\u0492'), ('\u0495', '\u0494'),
+ ('\u0497', '\u0496'), ('\u0499', '\u0498'),
+ ('\u049b', '\u049a'), ('\u049d', '\u049c'),
+ ('\u049f', '\u049e'), ('\u04a1', '\u04a0'),
+ ('\u04a3', '\u04a2'), ('\u04a5', '\u04a4'),
+ ('\u04a7', '\u04a6'), ('\u04a9', '\u04a8'),
+ ('\u04ab', '\u04aa'), ('\u04ad', '\u04ac'),
+ ('\u04af', '\u04ae'), ('\u04b1', '\u04b0'),
+ ('\u04b3', '\u04b2'), ('\u04b5', '\u04b4'),
+ ('\u04b7', '\u04b6'), ('\u04b9', '\u04b8'),
+ ('\u04bb', '\u04ba'), ('\u04bd', '\u04bc'),
+ ('\u04bf', '\u04be'), ('\u04c2', '\u04c1'),
+ ('\u04c4', '\u04c3'), ('\u04c6', '\u04c5'),
+ ('\u04c8', '\u04c7'), ('\u04ca', '\u04c9'),
+ ('\u04cc', '\u04cb'), ('\u04ce', '\u04cd'),
+ ('\u04cf', '\u04c0'), ('\u04d1', '\u04d0'),
+ ('\u04d3', '\u04d2'), ('\u04d5', '\u04d4'),
+ ('\u04d7', '\u04d6'), ('\u04d9', '\u04d8'),
+ ('\u04db', '\u04da'), ('\u04dd', '\u04dc'),
+ ('\u04df', '\u04de'), ('\u04e1', '\u04e0'),
+ ('\u04e3', '\u04e2'), ('\u04e5', '\u04e4'),
+ ('\u04e7', '\u04e6'), ('\u04e9', '\u04e8'),
+ ('\u04eb', '\u04ea'), ('\u04ed', '\u04ec'),
+ ('\u04ef', '\u04ee'), ('\u04f1', '\u04f0'),
+ ('\u04f3', '\u04f2'), ('\u04f5', '\u04f4'),
+ ('\u04f7', '\u04f6'), ('\u04f9', '\u04f8'),
+ ('\u04fb', '\u04fa'), ('\u04fd', '\u04fc'),
+ ('\u04ff', '\u04fe'), ('\u0501', '\u0500'),
+ ('\u0503', '\u0502'), ('\u0505', '\u0504'),
+ ('\u0507', '\u0506'), ('\u0509', '\u0508'),
+ ('\u050b', '\u050a'), ('\u050d', '\u050c'),
+ ('\u050f', '\u050e'), ('\u0511', '\u0510'),
+ ('\u0513', '\u0512'), ('\u0515', '\u0514'),
+ ('\u0517', '\u0516'), ('\u0519', '\u0518'),
+ ('\u051b', '\u051a'), ('\u051d', '\u051c'),
+ ('\u051f', '\u051e'), ('\u0521', '\u0520'),
+ ('\u0523', '\u0522'), ('\u0525', '\u0524'),
+ ('\u0527', '\u0526'), ('\u0561', '\u0531'),
+ ('\u0562', '\u0532'), ('\u0563', '\u0533'),
+ ('\u0564', '\u0534'), ('\u0565', '\u0535'),
+ ('\u0566', '\u0536'), ('\u0567', '\u0537'),
+ ('\u0568', '\u0538'), ('\u0569', '\u0539'),
+ ('\u056a', '\u053a'), ('\u056b', '\u053b'),
+ ('\u056c', '\u053c'), ('\u056d', '\u053d'),
+ ('\u056e', '\u053e'), ('\u056f', '\u053f'),
+ ('\u0570', '\u0540'), ('\u0571', '\u0541'),
+ ('\u0572', '\u0542'), ('\u0573', '\u0543'),
+ ('\u0574', '\u0544'), ('\u0575', '\u0545'),
+ ('\u0576', '\u0546'), ('\u0577', '\u0547'),
+ ('\u0578', '\u0548'), ('\u0579', '\u0549'),
+ ('\u057a', '\u054a'), ('\u057b', '\u054b'),
+ ('\u057c', '\u054c'), ('\u057d', '\u054d'),
+ ('\u057e', '\u054e'), ('\u057f', '\u054f'),
+ ('\u0580', '\u0550'), ('\u0581', '\u0551'),
+ ('\u0582', '\u0552'), ('\u0583', '\u0553'),
+ ('\u0584', '\u0554'), ('\u0585', '\u0555'),
+ ('\u0586', '\u0556'), ('\u1d79', '\ua77d'),
+ ('\u1d7d', '\u2c63'), ('\u1e01', '\u1e00'),
+ ('\u1e03', '\u1e02'), ('\u1e05', '\u1e04'),
+ ('\u1e07', '\u1e06'), ('\u1e09', '\u1e08'),
+ ('\u1e0b', '\u1e0a'), ('\u1e0d', '\u1e0c'),
+ ('\u1e0f', '\u1e0e'), ('\u1e11', '\u1e10'),
+ ('\u1e13', '\u1e12'), ('\u1e15', '\u1e14'),
+ ('\u1e17', '\u1e16'), ('\u1e19', '\u1e18'),
+ ('\u1e1b', '\u1e1a'), ('\u1e1d', '\u1e1c'),
+ ('\u1e1f', '\u1e1e'), ('\u1e21', '\u1e20'),
+ ('\u1e23', '\u1e22'), ('\u1e25', '\u1e24'),
+ ('\u1e27', '\u1e26'), ('\u1e29', '\u1e28'),
+ ('\u1e2b', '\u1e2a'), ('\u1e2d', '\u1e2c'),
+ ('\u1e2f', '\u1e2e'), ('\u1e31', '\u1e30'),
+ ('\u1e33', '\u1e32'), ('\u1e35', '\u1e34'),
+ ('\u1e37', '\u1e36'), ('\u1e39', '\u1e38'),
+ ('\u1e3b', '\u1e3a'), ('\u1e3d', '\u1e3c'),
+ ('\u1e3f', '\u1e3e'), ('\u1e41', '\u1e40'),
+ ('\u1e43', '\u1e42'), ('\u1e45', '\u1e44'),
+ ('\u1e47', '\u1e46'), ('\u1e49', '\u1e48'),
+ ('\u1e4b', '\u1e4a'), ('\u1e4d', '\u1e4c'),
+ ('\u1e4f', '\u1e4e'), ('\u1e51', '\u1e50'),
+ ('\u1e53', '\u1e52'), ('\u1e55', '\u1e54'),
+ ('\u1e57', '\u1e56'), ('\u1e59', '\u1e58'),
+ ('\u1e5b', '\u1e5a'), ('\u1e5d', '\u1e5c'),
+ ('\u1e5f', '\u1e5e'), ('\u1e61', '\u1e60'),
+ ('\u1e63', '\u1e62'), ('\u1e65', '\u1e64'),
+ ('\u1e67', '\u1e66'), ('\u1e69', '\u1e68'),
+ ('\u1e6b', '\u1e6a'), ('\u1e6d', '\u1e6c'),
+ ('\u1e6f', '\u1e6e'), ('\u1e71', '\u1e70'),
+ ('\u1e73', '\u1e72'), ('\u1e75', '\u1e74'),
+ ('\u1e77', '\u1e76'), ('\u1e79', '\u1e78'),
+ ('\u1e7b', '\u1e7a'), ('\u1e7d', '\u1e7c'),
+ ('\u1e7f', '\u1e7e'), ('\u1e81', '\u1e80'),
+ ('\u1e83', '\u1e82'), ('\u1e85', '\u1e84'),
+ ('\u1e87', '\u1e86'), ('\u1e89', '\u1e88'),
+ ('\u1e8b', '\u1e8a'), ('\u1e8d', '\u1e8c'),
+ ('\u1e8f', '\u1e8e'), ('\u1e91', '\u1e90'),
+ ('\u1e93', '\u1e92'), ('\u1e95', '\u1e94'),
+ ('\u1e9b', '\u1e60'), ('\u1ea1', '\u1ea0'),
+ ('\u1ea3', '\u1ea2'), ('\u1ea5', '\u1ea4'),
+ ('\u1ea7', '\u1ea6'), ('\u1ea9', '\u1ea8'),
+ ('\u1eab', '\u1eaa'), ('\u1ead', '\u1eac'),
+ ('\u1eaf', '\u1eae'), ('\u1eb1', '\u1eb0'),
+ ('\u1eb3', '\u1eb2'), ('\u1eb5', '\u1eb4'),
+ ('\u1eb7', '\u1eb6'), ('\u1eb9', '\u1eb8'),
+ ('\u1ebb', '\u1eba'), ('\u1ebd', '\u1ebc'),
+ ('\u1ebf', '\u1ebe'), ('\u1ec1', '\u1ec0'),
+ ('\u1ec3', '\u1ec2'), ('\u1ec5', '\u1ec4'),
+ ('\u1ec7', '\u1ec6'), ('\u1ec9', '\u1ec8'),
+ ('\u1ecb', '\u1eca'), ('\u1ecd', '\u1ecc'),
+ ('\u1ecf', '\u1ece'), ('\u1ed1', '\u1ed0'),
+ ('\u1ed3', '\u1ed2'), ('\u1ed5', '\u1ed4'),
+ ('\u1ed7', '\u1ed6'), ('\u1ed9', '\u1ed8'),
+ ('\u1edb', '\u1eda'), ('\u1edd', '\u1edc'),
+ ('\u1edf', '\u1ede'), ('\u1ee1', '\u1ee0'),
+ ('\u1ee3', '\u1ee2'), ('\u1ee5', '\u1ee4'),
+ ('\u1ee7', '\u1ee6'), ('\u1ee9', '\u1ee8'),
+ ('\u1eeb', '\u1eea'), ('\u1eed', '\u1eec'),
+ ('\u1eef', '\u1eee'), ('\u1ef1', '\u1ef0'),
+ ('\u1ef3', '\u1ef2'), ('\u1ef5', '\u1ef4'),
+ ('\u1ef7', '\u1ef6'), ('\u1ef9', '\u1ef8'),
+ ('\u1efb', '\u1efa'), ('\u1efd', '\u1efc'),
+ ('\u1eff', '\u1efe'), ('\u1f00', '\u1f08'),
+ ('\u1f01', '\u1f09'), ('\u1f02', '\u1f0a'),
+ ('\u1f03', '\u1f0b'), ('\u1f04', '\u1f0c'),
+ ('\u1f05', '\u1f0d'), ('\u1f06', '\u1f0e'),
+ ('\u1f07', '\u1f0f'), ('\u1f10', '\u1f18'),
+ ('\u1f11', '\u1f19'), ('\u1f12', '\u1f1a'),
+ ('\u1f13', '\u1f1b'), ('\u1f14', '\u1f1c'),
+ ('\u1f15', '\u1f1d'), ('\u1f20', '\u1f28'),
+ ('\u1f21', '\u1f29'), ('\u1f22', '\u1f2a'),
+ ('\u1f23', '\u1f2b'), ('\u1f24', '\u1f2c'),
+ ('\u1f25', '\u1f2d'), ('\u1f26', '\u1f2e'),
+ ('\u1f27', '\u1f2f'), ('\u1f30', '\u1f38'),
+ ('\u1f31', '\u1f39'), ('\u1f32', '\u1f3a'),
+ ('\u1f33', '\u1f3b'), ('\u1f34', '\u1f3c'),
+ ('\u1f35', '\u1f3d'), ('\u1f36', '\u1f3e'),
+ ('\u1f37', '\u1f3f'), ('\u1f40', '\u1f48'),
+ ('\u1f41', '\u1f49'), ('\u1f42', '\u1f4a'),
+ ('\u1f43', '\u1f4b'), ('\u1f44', '\u1f4c'),
+ ('\u1f45', '\u1f4d'), ('\u1f51', '\u1f59'),
+ ('\u1f53', '\u1f5b'), ('\u1f55', '\u1f5d'),
+ ('\u1f57', '\u1f5f'), ('\u1f60', '\u1f68'),
+ ('\u1f61', '\u1f69'), ('\u1f62', '\u1f6a'),
+ ('\u1f63', '\u1f6b'), ('\u1f64', '\u1f6c'),
+ ('\u1f65', '\u1f6d'), ('\u1f66', '\u1f6e'),
+ ('\u1f67', '\u1f6f'), ('\u1f70', '\u1fba'),
+ ('\u1f71', '\u1fbb'), ('\u1f72', '\u1fc8'),
+ ('\u1f73', '\u1fc9'), ('\u1f74', '\u1fca'),
+ ('\u1f75', '\u1fcb'), ('\u1f76', '\u1fda'),
+ ('\u1f77', '\u1fdb'), ('\u1f78', '\u1ff8'),
+ ('\u1f79', '\u1ff9'), ('\u1f7a', '\u1fea'),
+ ('\u1f7b', '\u1feb'), ('\u1f7c', '\u1ffa'),
+ ('\u1f7d', '\u1ffb'), ('\u1f80', '\u1f88'),
+ ('\u1f81', '\u1f89'), ('\u1f82', '\u1f8a'),
+ ('\u1f83', '\u1f8b'), ('\u1f84', '\u1f8c'),
+ ('\u1f85', '\u1f8d'), ('\u1f86', '\u1f8e'),
+ ('\u1f87', '\u1f8f'), ('\u1f90', '\u1f98'),
+ ('\u1f91', '\u1f99'), ('\u1f92', '\u1f9a'),
+ ('\u1f93', '\u1f9b'), ('\u1f94', '\u1f9c'),
+ ('\u1f95', '\u1f9d'), ('\u1f96', '\u1f9e'),
+ ('\u1f97', '\u1f9f'), ('\u1fa0', '\u1fa8'),
+ ('\u1fa1', '\u1fa9'), ('\u1fa2', '\u1faa'),
+ ('\u1fa3', '\u1fab'), ('\u1fa4', '\u1fac'),
+ ('\u1fa5', '\u1fad'), ('\u1fa6', '\u1fae'),
+ ('\u1fa7', '\u1faf'), ('\u1fb0', '\u1fb8'),
+ ('\u1fb1', '\u1fb9'), ('\u1fb3', '\u1fbc'),
+ ('\u1fbe', '\u0399'), ('\u1fc3', '\u1fcc'),
+ ('\u1fd0', '\u1fd8'), ('\u1fd1', '\u1fd9'),
+ ('\u1fe0', '\u1fe8'), ('\u1fe1', '\u1fe9'),
+ ('\u1fe5', '\u1fec'), ('\u1ff3', '\u1ffc'),
+ ('\u214e', '\u2132'), ('\u2184', '\u2183'),
+ ('\u2c30', '\u2c00'), ('\u2c31', '\u2c01'),
+ ('\u2c32', '\u2c02'), ('\u2c33', '\u2c03'),
+ ('\u2c34', '\u2c04'), ('\u2c35', '\u2c05'),
+ ('\u2c36', '\u2c06'), ('\u2c37', '\u2c07'),
+ ('\u2c38', '\u2c08'), ('\u2c39', '\u2c09'),
+ ('\u2c3a', '\u2c0a'), ('\u2c3b', '\u2c0b'),
+ ('\u2c3c', '\u2c0c'), ('\u2c3d', '\u2c0d'),
+ ('\u2c3e', '\u2c0e'), ('\u2c3f', '\u2c0f'),
+ ('\u2c40', '\u2c10'), ('\u2c41', '\u2c11'),
+ ('\u2c42', '\u2c12'), ('\u2c43', '\u2c13'),
+ ('\u2c44', '\u2c14'), ('\u2c45', '\u2c15'),
+ ('\u2c46', '\u2c16'), ('\u2c47', '\u2c17'),
+ ('\u2c48', '\u2c18'), ('\u2c49', '\u2c19'),
+ ('\u2c4a', '\u2c1a'), ('\u2c4b', '\u2c1b'),
+ ('\u2c4c', '\u2c1c'), ('\u2c4d', '\u2c1d'),
+ ('\u2c4e', '\u2c1e'), ('\u2c4f', '\u2c1f'),
+ ('\u2c50', '\u2c20'), ('\u2c51', '\u2c21'),
+ ('\u2c52', '\u2c22'), ('\u2c53', '\u2c23'),
+ ('\u2c54', '\u2c24'), ('\u2c55', '\u2c25'),
+ ('\u2c56', '\u2c26'), ('\u2c57', '\u2c27'),
+ ('\u2c58', '\u2c28'), ('\u2c59', '\u2c29'),
+ ('\u2c5a', '\u2c2a'), ('\u2c5b', '\u2c2b'),
+ ('\u2c5c', '\u2c2c'), ('\u2c5d', '\u2c2d'),
+ ('\u2c5e', '\u2c2e'), ('\u2c61', '\u2c60'),
+ ('\u2c65', '\u023a'), ('\u2c66', '\u023e'),
+ ('\u2c68', '\u2c67'), ('\u2c6a', '\u2c69'),
+ ('\u2c6c', '\u2c6b'), ('\u2c73', '\u2c72'),
+ ('\u2c76', '\u2c75'), ('\u2c81', '\u2c80'),
+ ('\u2c83', '\u2c82'), ('\u2c85', '\u2c84'),
+ ('\u2c87', '\u2c86'), ('\u2c89', '\u2c88'),
+ ('\u2c8b', '\u2c8a'), ('\u2c8d', '\u2c8c'),
+ ('\u2c8f', '\u2c8e'), ('\u2c91', '\u2c90'),
+ ('\u2c93', '\u2c92'), ('\u2c95', '\u2c94'),
+ ('\u2c97', '\u2c96'), ('\u2c99', '\u2c98'),
+ ('\u2c9b', '\u2c9a'), ('\u2c9d', '\u2c9c'),
+ ('\u2c9f', '\u2c9e'), ('\u2ca1', '\u2ca0'),
+ ('\u2ca3', '\u2ca2'), ('\u2ca5', '\u2ca4'),
+ ('\u2ca7', '\u2ca6'), ('\u2ca9', '\u2ca8'),
+ ('\u2cab', '\u2caa'), ('\u2cad', '\u2cac'),
+ ('\u2caf', '\u2cae'), ('\u2cb1', '\u2cb0'),
+ ('\u2cb3', '\u2cb2'), ('\u2cb5', '\u2cb4'),
+ ('\u2cb7', '\u2cb6'), ('\u2cb9', '\u2cb8'),
+ ('\u2cbb', '\u2cba'), ('\u2cbd', '\u2cbc'),
+ ('\u2cbf', '\u2cbe'), ('\u2cc1', '\u2cc0'),
+ ('\u2cc3', '\u2cc2'), ('\u2cc5', '\u2cc4'),
+ ('\u2cc7', '\u2cc6'), ('\u2cc9', '\u2cc8'),
+ ('\u2ccb', '\u2cca'), ('\u2ccd', '\u2ccc'),
+ ('\u2ccf', '\u2cce'), ('\u2cd1', '\u2cd0'),
+ ('\u2cd3', '\u2cd2'), ('\u2cd5', '\u2cd4'),
+ ('\u2cd7', '\u2cd6'), ('\u2cd9', '\u2cd8'),
+ ('\u2cdb', '\u2cda'), ('\u2cdd', '\u2cdc'),
+ ('\u2cdf', '\u2cde'), ('\u2ce1', '\u2ce0'),
+ ('\u2ce3', '\u2ce2'), ('\u2cec', '\u2ceb'),
+ ('\u2cee', '\u2ced'), ('\u2cf3', '\u2cf2'),
+ ('\u2d00', '\u10a0'), ('\u2d01', '\u10a1'),
+ ('\u2d02', '\u10a2'), ('\u2d03', '\u10a3'),
+ ('\u2d04', '\u10a4'), ('\u2d05', '\u10a5'),
+ ('\u2d06', '\u10a6'), ('\u2d07', '\u10a7'),
+ ('\u2d08', '\u10a8'), ('\u2d09', '\u10a9'),
+ ('\u2d0a', '\u10aa'), ('\u2d0b', '\u10ab'),
+ ('\u2d0c', '\u10ac'), ('\u2d0d', '\u10ad'),
+ ('\u2d0e', '\u10ae'), ('\u2d0f', '\u10af'),
+ ('\u2d10', '\u10b0'), ('\u2d11', '\u10b1'),
+ ('\u2d12', '\u10b2'), ('\u2d13', '\u10b3'),
+ ('\u2d14', '\u10b4'), ('\u2d15', '\u10b5'),
+ ('\u2d16', '\u10b6'), ('\u2d17', '\u10b7'),
+ ('\u2d18', '\u10b8'), ('\u2d19', '\u10b9'),
+ ('\u2d1a', '\u10ba'), ('\u2d1b', '\u10bb'),
+ ('\u2d1c', '\u10bc'), ('\u2d1d', '\u10bd'),
+ ('\u2d1e', '\u10be'), ('\u2d1f', '\u10bf'),
+ ('\u2d20', '\u10c0'), ('\u2d21', '\u10c1'),
+ ('\u2d22', '\u10c2'), ('\u2d23', '\u10c3'),
+ ('\u2d24', '\u10c4'), ('\u2d25', '\u10c5'),
+ ('\u2d27', '\u10c7'), ('\u2d2d', '\u10cd'),
+ ('\ua641', '\ua640'), ('\ua643', '\ua642'),
+ ('\ua645', '\ua644'), ('\ua647', '\ua646'),
+ ('\ua649', '\ua648'), ('\ua64b', '\ua64a'),
+ ('\ua64d', '\ua64c'), ('\ua64f', '\ua64e'),
+ ('\ua651', '\ua650'), ('\ua653', '\ua652'),
+ ('\ua655', '\ua654'), ('\ua657', '\ua656'),
+ ('\ua659', '\ua658'), ('\ua65b', '\ua65a'),
+ ('\ua65d', '\ua65c'), ('\ua65f', '\ua65e'),
+ ('\ua661', '\ua660'), ('\ua663', '\ua662'),
+ ('\ua665', '\ua664'), ('\ua667', '\ua666'),
+ ('\ua669', '\ua668'), ('\ua66b', '\ua66a'),
+ ('\ua66d', '\ua66c'), ('\ua681', '\ua680'),
+ ('\ua683', '\ua682'), ('\ua685', '\ua684'),
+ ('\ua687', '\ua686'), ('\ua689', '\ua688'),
+ ('\ua68b', '\ua68a'), ('\ua68d', '\ua68c'),
+ ('\ua68f', '\ua68e'), ('\ua691', '\ua690'),
+ ('\ua693', '\ua692'), ('\ua695', '\ua694'),
+ ('\ua697', '\ua696'), ('\ua723', '\ua722'),
+ ('\ua725', '\ua724'), ('\ua727', '\ua726'),
+ ('\ua729', '\ua728'), ('\ua72b', '\ua72a'),
+ ('\ua72d', '\ua72c'), ('\ua72f', '\ua72e'),
+ ('\ua733', '\ua732'), ('\ua735', '\ua734'),
+ ('\ua737', '\ua736'), ('\ua739', '\ua738'),
+ ('\ua73b', '\ua73a'), ('\ua73d', '\ua73c'),
+ ('\ua73f', '\ua73e'), ('\ua741', '\ua740'),
+ ('\ua743', '\ua742'), ('\ua745', '\ua744'),
+ ('\ua747', '\ua746'), ('\ua749', '\ua748'),
+ ('\ua74b', '\ua74a'), ('\ua74d', '\ua74c'),
+ ('\ua74f', '\ua74e'), ('\ua751', '\ua750'),
+ ('\ua753', '\ua752'), ('\ua755', '\ua754'),
+ ('\ua757', '\ua756'), ('\ua759', '\ua758'),
+ ('\ua75b', '\ua75a'), ('\ua75d', '\ua75c'),
+ ('\ua75f', '\ua75e'), ('\ua761', '\ua760'),
+ ('\ua763', '\ua762'), ('\ua765', '\ua764'),
+ ('\ua767', '\ua766'), ('\ua769', '\ua768'),
+ ('\ua76b', '\ua76a'), ('\ua76d', '\ua76c'),
+ ('\ua76f', '\ua76e'), ('\ua77a', '\ua779'),
+ ('\ua77c', '\ua77b'), ('\ua77f', '\ua77e'),
+ ('\ua781', '\ua780'), ('\ua783', '\ua782'),
+ ('\ua785', '\ua784'), ('\ua787', '\ua786'),
+ ('\ua78c', '\ua78b'), ('\ua791', '\ua790'),
+ ('\ua793', '\ua792'), ('\ua7a1', '\ua7a0'),
+ ('\ua7a3', '\ua7a2'), ('\ua7a5', '\ua7a4'),
+ ('\ua7a7', '\ua7a6'), ('\ua7a9', '\ua7a8'),
+ ('\uff41', '\uff21'), ('\uff42', '\uff22'),
+ ('\uff43', '\uff23'), ('\uff44', '\uff24'),
+ ('\uff45', '\uff25'), ('\uff46', '\uff26'),
+ ('\uff47', '\uff27'), ('\uff48', '\uff28'),
+ ('\uff49', '\uff29'), ('\uff4a', '\uff2a'),
+ ('\uff4b', '\uff2b'), ('\uff4c', '\uff2c'),
+ ('\uff4d', '\uff2d'), ('\uff4e', '\uff2e'),
+ ('\uff4f', '\uff2f'), ('\uff50', '\uff30'),
+ ('\uff51', '\uff31'), ('\uff52', '\uff32'),
+ ('\uff53', '\uff33'), ('\uff54', '\uff34'),
+ ('\uff55', '\uff35'), ('\uff56', '\uff36'),
+ ('\uff57', '\uff37'), ('\uff58', '\uff38'),
+ ('\uff59', '\uff39'), ('\uff5a', '\uff3a'),
+ ('\U00010428', '\U00010400'), ('\U00010429', '\U00010401'),
+ ('\U0001042a', '\U00010402'), ('\U0001042b', '\U00010403'),
+ ('\U0001042c', '\U00010404'), ('\U0001042d', '\U00010405'),
+ ('\U0001042e', '\U00010406'), ('\U0001042f', '\U00010407'),
+ ('\U00010430', '\U00010408'), ('\U00010431', '\U00010409'),
+ ('\U00010432', '\U0001040a'), ('\U00010433', '\U0001040b'),
+ ('\U00010434', '\U0001040c'), ('\U00010435', '\U0001040d'),
+ ('\U00010436', '\U0001040e'), ('\U00010437', '\U0001040f'),
+ ('\U00010438', '\U00010410'), ('\U00010439', '\U00010411'),
+ ('\U0001043a', '\U00010412'), ('\U0001043b', '\U00010413'),
+ ('\U0001043c', '\U00010414'), ('\U0001043d', '\U00010415'),
+ ('\U0001043e', '\U00010416'), ('\U0001043f', '\U00010417'),
+ ('\U00010440', '\U00010418'), ('\U00010441', '\U00010419'),
+ ('\U00010442', '\U0001041a'), ('\U00010443', '\U0001041b'),
+ ('\U00010444', '\U0001041c'), ('\U00010445', '\U0001041d'),
+ ('\U00010446', '\U0001041e'), ('\U00010447', '\U0001041f'),
+ ('\U00010448', '\U00010420'), ('\U00010449', '\U00010421'),
+ ('\U0001044a', '\U00010422'), ('\U0001044b', '\U00010423'),
+ ('\U0001044c', '\U00010424'), ('\U0001044d', '\U00010425'),
+ ('\U0001044e', '\U00010426'), ('\U0001044f', '\U00010427')
+ ];
+
+}
--- /dev/null
+// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Functions for the unit type.
+
+#[cfg(not(test))]
+use default::Default;
+#[cfg(not(test))]
+use cmp::{Eq, Equal, Ord, Ordering, TotalEq, TotalOrd};
+
+#[cfg(not(test))]
+impl Eq for () {
+ #[inline]
+ fn eq(&self, _other: &()) -> bool { true }
+ #[inline]
+ fn ne(&self, _other: &()) -> bool { false }
+}
+
+#[cfg(not(test))]
+impl Ord for () {
+ #[inline]
+ fn lt(&self, _other: &()) -> bool { false }
+}
+
+#[cfg(not(test))]
+impl TotalOrd for () {
+ #[inline]
+ fn cmp(&self, _other: &()) -> Ordering { Equal }
+}
+
+#[cfg(not(test))]
+impl TotalEq for () {}
+
+#[cfg(not(test))]
+impl Default for () {
+ #[inline]
+ fn default() -> () { () }
+}
pub use consts::os::bsd44::{SO_REUSEADDR, SO_BROADCAST, SHUT_WR, IP_MULTICAST_LOOP};
pub use consts::os::bsd44::{IP_ADD_MEMBERSHIP, IP_DROP_MEMBERSHIP};
pub use consts::os::bsd44::{IPV6_ADD_MEMBERSHIP, IPV6_DROP_MEMBERSHIP};
-pub use consts::os::bsd44::{IP_MULTICAST_TTL, IP_TTL};
+pub use consts::os::bsd44::{IP_MULTICAST_TTL, IP_TTL, SHUT_RD};
pub use funcs::c95::ctype::{isalnum, isalpha, iscntrl, isdigit};
pub use funcs::c95::ctype::{islower, isprint, ispunct, isspace};
#[cfg(windows)] pub use consts::os::extra::{FILE_WRITE_ATTRIBUTES, FILE_READ_ATTRIBUTES};
#[cfg(windows)] pub use consts::os::extra::{ERROR_PIPE_BUSY, ERROR_IO_PENDING};
#[cfg(windows)] pub use consts::os::extra::{ERROR_PIPE_CONNECTED, WAIT_OBJECT_0};
+#[cfg(windows)] pub use consts::os::extra::{ERROR_NOT_FOUND};
+#[cfg(windows)] pub use consts::os::extra::{ERROR_OPERATION_ABORTED};
#[cfg(windows)] pub use types::os::common::bsd44::{SOCKET};
#[cfg(windows)] pub use types::os::common::posix01::{stat, utimbuf};
#[cfg(windows)] pub use types::os::arch::extra::{HANDLE, BOOL, LPSECURITY_ATTRIBUTES};
pub static ERROR_NO_DATA: c_int = 232;
pub static ERROR_INVALID_ADDRESS : c_int = 487;
pub static ERROR_PIPE_CONNECTED: c_int = 535;
+ pub static ERROR_OPERATION_ABORTED: c_int = 995;
pub static ERROR_IO_PENDING: c_int = 997;
pub static ERROR_FILE_INVALID : c_int = 1006;
+ pub static ERROR_NOT_FOUND: c_int = 1168;
pub static INVALID_HANDLE_VALUE : c_int = -1;
pub static DELETE : DWORD = 0x00010000;
optlen: *mut libc::c_int) -> libc::c_int;
pub fn CancelIo(hFile: libc::HANDLE) -> libc::BOOL;
+ pub fn CancelIoEx(hFile: libc::HANDLE,
+ lpOverlapped: libc::LPOVERLAPPED) -> libc::BOOL;
}
use libc::{c_int, c_void};
use libc;
-use std::sync::arc::UnsafeArc;
use std::c_str::CString;
use std::io::IoError;
use std::io;
use std::mem;
use std::rt::rtio;
+use std::sync::arc::UnsafeArc;
use io::{IoResult, retry, keep_going};
fn clone(&self) -> Box<rtio::RtioPipe:Send> {
box FileDesc { inner: self.inner.clone() } as Box<rtio::RtioPipe:Send>
}
+
+ // Only supported on named pipes currently. Note that this doesn't have an
+ // impact on the std::io primitives, this is never called via
+ // std::io::PipeStream. If the functionality is exposed in the future, then
+ // these methods will need to be implemented.
+ fn close_read(&mut self) -> Result<(), IoError> {
+ Err(io::standard_error(io::InvalidInput))
+ }
+ fn close_write(&mut self) -> Result<(), IoError> {
+ Err(io::standard_error(io::InvalidInput))
+ }
}
impl rtio::RtioTTY for FileDesc {
fn clone(&self) -> Box<rtio::RtioPipe:Send> {
box FileDesc { inner: self.inner.clone() } as Box<rtio::RtioPipe:Send>
}
+
+ // Only supported on named pipes currently. Note that this doesn't have an
+ // impact on the std::io primitives, this is never called via
+ // std::io::PipeStream. If the functionality is exposed in the future, then
+ // these methods will need to be implemented.
+ fn close_read(&mut self) -> IoResult<()> {
+ Err(io::standard_error(io::InvalidInput))
+ }
+ fn close_write(&mut self) -> IoResult<()> {
+ Err(io::standard_error(io::InvalidInput))
+ }
}
impl rtio::RtioTTY for FileDesc {
} as Box<rtio::RtioTcpStream:Send>
}
fn close_write(&mut self) -> IoResult<()> {
- super::mkerr_libc(unsafe {
- libc::shutdown(self.fd(), libc::SHUT_WR)
- })
+ super::mkerr_libc(unsafe { libc::shutdown(self.fd(), libc::SHUT_WR) })
+ }
+ fn close_read(&mut self) -> IoResult<()> {
+ super::mkerr_libc(unsafe { libc::shutdown(self.fd(), libc::SHUT_RD) })
}
}
inner: self.inner.clone(),
} as Box<rtio::RtioPipe:Send>
}
+
+ fn close_write(&mut self) -> IoResult<()> {
+ super::mkerr_libc(unsafe { libc::shutdown(self.fd(), libc::SHUT_WR) })
+ }
+ fn close_read(&mut self) -> IoResult<()> {
+ super::mkerr_libc(unsafe { libc::shutdown(self.fd(), libc::SHUT_RD) })
+ }
}
////////////////////////////////////////////////////////////////////////////////
//! the test suite passing (the suite is in libstd), and that's good enough for
//! me!
-use std::c_str::CString;
use libc;
+use std::c_str::CString;
+use std::intrinsics;
+use std::io;
use std::os::win32::as_utf16_p;
+use std::os;
use std::ptr;
use std::rt::rtio;
use std::sync::arc::UnsafeArc;
-use std::intrinsics;
+use std::sync::atomics;
+use std::unstable::mutex;
use super::IoResult;
use super::c;
struct Inner {
handle: libc::HANDLE,
+ lock: mutex::NativeMutex,
+ read_closed: atomics::AtomicBool,
+ write_closed: atomics::AtomicBool,
+}
+
+impl Inner {
+ fn new(handle: libc::HANDLE) -> Inner {
+ Inner {
+ handle: handle,
+ lock: unsafe { mutex::NativeMutex::new() },
+ read_closed: atomics::AtomicBool::new(false),
+ write_closed: atomics::AtomicBool::new(false),
+ }
+ }
}
impl Drop for Inner {
loop {
match UnixStream::try_connect(p) {
Some(handle) => {
- let inner = Inner { handle: handle };
+ let inner = Inner::new(handle);
let mut mode = libc::PIPE_TYPE_BYTE |
libc::PIPE_READMODE_BYTE |
libc::PIPE_WAIT;
}
fn handle(&self) -> libc::HANDLE { unsafe { (*self.inner.get()).handle } }
+
+ fn read_closed(&self) -> bool {
+ unsafe { (*self.inner.get()).read_closed.load(atomics::SeqCst) }
+ }
+
+ fn write_closed(&self) -> bool {
+ unsafe { (*self.inner.get()).write_closed.load(atomics::SeqCst) }
+ }
+
+ fn cancel_io(&self) -> IoResult<()> {
+ match unsafe { c::CancelIoEx(self.handle(), ptr::mut_null()) } {
+ 0 if os::errno() == libc::ERROR_NOT_FOUND as uint => {
+ Ok(())
+ }
+ 0 => Err(super::last_error()),
+ _ => Ok(())
+ }
+ }
}
impl rtio::RtioPipe for UnixStream {
let mut overlapped: libc::OVERLAPPED = unsafe { intrinsics::init() };
overlapped.hEvent = self.read.get_ref().handle();
+ // Pre-flight check to see if the reading half has been closed. This
+ // must be done before issuing the ReadFile request, but after we
+ // acquire the lock.
+ //
+ // See comments in close_read() about why this lock is necessary.
+ let guard = unsafe { (*self.inner.get()).lock.lock() };
+ if self.read_closed() {
+ return Err(io::standard_error(io::EndOfFile))
+ }
+
+ // Issue a nonblocking requests, succeeding quickly if it happened to
+ // succeed.
let ret = unsafe {
libc::ReadFile(self.handle(),
buf.as_ptr() as libc::LPVOID,
&mut bytes_read,
&mut overlapped)
};
- if ret == 0 {
- let err = unsafe { libc::GetLastError() };
- if err == libc::ERROR_IO_PENDING as libc::DWORD {
- let ret = unsafe {
- libc::GetOverlappedResult(self.handle(),
- &mut overlapped,
- &mut bytes_read,
- libc::TRUE)
- };
- if ret == 0 {
- return Err(super::last_error())
- }
- } else {
+ if ret != 0 { return Ok(bytes_read as uint) }
+
+ // If our errno doesn't say that the I/O is pending, then we hit some
+ // legitimate error and reeturn immediately.
+ if os::errno() != libc::ERROR_IO_PENDING as uint {
+ return Err(super::last_error())
+ }
+
+ // Now that we've issued a successful nonblocking request, we need to
+ // wait for it to finish. This can all be done outside the lock because
+ // we'll see any invocation of CancelIoEx. We also call this in a loop
+ // because we're woken up if the writing half is closed, we just need to
+ // realize that the reading half wasn't closed and we go right back to
+ // sleep.
+ drop(guard);
+ loop {
+ let ret = unsafe {
+ libc::GetOverlappedResult(self.handle(),
+ &mut overlapped,
+ &mut bytes_read,
+ libc::TRUE)
+ };
+ // If we succeeded, or we failed for some reason other than
+ // CancelIoEx, return immediately
+ if ret != 0 { return Ok(bytes_read as uint) }
+ if os::errno() != libc::ERROR_OPERATION_ABORTED as uint {
return Err(super::last_error())
}
- }
- Ok(bytes_read as uint)
+ // If the reading half is now closed, then we're done. If we woke up
+ // because the writing half was closed, keep trying.
+ if self.read_closed() {
+ return Err(io::standard_error(io::EndOfFile))
+ }
+ }
}
fn write(&mut self, buf: &[u8]) -> IoResult<()> {
while offset < buf.len() {
let mut bytes_written = 0;
+
+ // This sequence below is quite similar to the one found in read().
+ // Some careful looping is done to ensure that if close_write() is
+ // invoked we bail out early, and if close_read() is invoked we keep
+ // going after we woke up.
+ //
+ // See comments in close_read() about why this lock is necessary.
+ let guard = unsafe { (*self.inner.get()).lock.lock() };
+ if self.write_closed() {
+ return Err(io::standard_error(io::BrokenPipe))
+ }
let ret = unsafe {
libc::WriteFile(self.handle(),
buf.slice_from(offset).as_ptr() as libc::LPVOID,
&mut bytes_written,
&mut overlapped)
};
+ drop(guard);
+
if ret == 0 {
- let err = unsafe { libc::GetLastError() };
- if err == libc::ERROR_IO_PENDING as libc::DWORD {
- let ret = unsafe {
- libc::GetOverlappedResult(self.handle(),
- &mut overlapped,
- &mut bytes_written,
- libc::TRUE)
- };
- if ret == 0 {
+ if os::errno() != libc::ERROR_IO_PENDING as uint {
+ return Err(super::last_error())
+ }
+ let ret = unsafe {
+ libc::GetOverlappedResult(self.handle(),
+ &mut overlapped,
+ &mut bytes_written,
+ libc::TRUE)
+ };
+ // If we weren't aborted, this was a legit error, if we were
+ // aborted, then check to see if the write half was actually
+ // closed or whether we woke up from the read half closing.
+ if ret == 0 {
+ if os::errno() != libc::ERROR_OPERATION_ABORTED as uint {
return Err(super::last_error())
}
- } else {
- return Err(super::last_error())
+ if self.write_closed() {
+ return Err(io::standard_error(io::BrokenPipe))
+ }
+ continue; // retry
}
}
offset += bytes_written as uint;
write: None,
} as Box<rtio::RtioPipe:Send>
}
+
+ fn close_read(&mut self) -> IoResult<()> {
+ // On windows, there's no actual shutdown() method for pipes, so we're
+ // forced to emulate the behavior manually at the application level. To
+ // do this, we need to both cancel any pending requests, as well as
+ // prevent all future requests from succeeding. These two operations are
+ // not atomic with respect to one another, so we must use a lock to do
+ // so.
+ //
+ // The read() code looks like:
+ //
+ // 1. Make sure the pipe is still open
+ // 2. Submit a read request
+ // 3. Wait for the read request to finish
+ //
+ // The race this lock is preventing is if another thread invokes
+ // close_read() between steps 1 and 2. By atomically executing steps 1
+ // and 2 with a lock with respect to close_read(), we're guaranteed that
+ // no thread will erroneously sit in a read forever.
+ let _guard = unsafe { (*self.inner.get()).lock.lock() };
+ unsafe { (*self.inner.get()).read_closed.store(true, atomics::SeqCst) }
+ self.cancel_io()
+ }
+
+ fn close_write(&mut self) -> IoResult<()> {
+ // see comments in close_read() for why this lock is necessary
+ let _guard = unsafe { (*self.inner.get()).lock.lock() };
+ unsafe { (*self.inner.get()).write_closed.store(true, atomics::SeqCst) }
+ self.cancel_io()
+ }
}
////////////////////////////////////////////////////////////////////////////////
// Transfer ownership of our handle into this stream
Ok(UnixStream {
- inner: UnsafeArc::new(Inner { handle: handle }),
+ inner: UnsafeArc::new(Inner::new(handle)),
read: None,
write: None,
})
UnsafeFn, // u
StaticMethod, // F
UnsafeStaticMethod, // U
- ForeignFn, // e
Type, // y
ForeignType, // T
Mod, // m
'u' => UnsafeFn,
'F' => StaticMethod,
'U' => UnsafeStaticMethod,
- 'e' => ForeignFn,
'y' => Type,
'T' => ForeignType,
'm' => Mod,
Struct => DlDef(ast::DefStruct(did)),
UnsafeFn => DlDef(ast::DefFn(did, ast::UnsafeFn)),
Fn => DlDef(ast::DefFn(did, ast::NormalFn)),
- ForeignFn => DlDef(ast::DefFn(did, ast::ExternFn)),
StaticMethod | UnsafeStaticMethod => {
let fn_style = if fam == UnsafeStaticMethod { ast::UnsafeFn } else
{ ast::NormalFn };
match s {
UnsafeFn => 'u',
NormalFn => 'f',
- ExternFn => 'e'
}
}
match s {
UnsafeFn => 'U',
NormalFn => 'F',
- _ => fail!("extern fn can't be static")
}
}
match c {
'u' => UnsafeFn,
'n' => NormalFn,
- 'c' => ExternFn,
_ => fail!("parse_fn_style: bad fn_style {}", c)
}
}
match p {
NormalFn => mywrite!(w, "n"),
UnsafeFn => mywrite!(w, "u"),
- ExternFn => mywrite!(w, "c")
}
}
use util::nodemap::NodeSet;
use collections::HashSet;
+use syntax::abi;
use syntax::ast;
use syntax::ast_map;
use syntax::ast_util::{def_id_of_def, is_local};
match *node {
ast_map::NodeItem(item) => {
match item.node {
- ast::ItemFn(_, ast::ExternFn, _, _, _) => {
- self.reachable_symbols.insert(search_item);
+ ast::ItemFn(_, _, abi, _, _) => {
+ if abi != abi::Rust {
+ self.reachable_symbols.insert(search_item);
+ }
}
_ => {}
}
pub fn trans_item(ccx: &CrateContext, item: &ast::Item) {
let _icx = push_ctxt("trans_item");
match item.node {
- ast::ItemFn(decl, fn_style, _abi, ref generics, body) => {
- if fn_style == ast::ExternFn {
+ ast::ItemFn(decl, _fn_style, abi, ref generics, body) => {
+ if abi != Rust {
let llfndecl = get_item_val(ccx, item.id);
foreign::trans_rust_fn_with_foreign_abi(
ccx, decl, body, item.attrs.as_slice(), llfndecl, item.id);
}
}
- ast::ItemFn(_, fn_style, _, _, _) => {
- let llfn = if fn_style != ast::ExternFn {
+ ast::ItemFn(_, _, abi, _, _) => {
+ let llfn = if abi == Rust {
register_fn(ccx, i.span, sym, i.id, ty)
} else {
foreign::register_rust_fn_with_foreign_abi(ccx,
match fn_style {
ast::UnsafeFn => 1u,
ast::NormalFn => 2u,
- ast::ExternFn => 3u
}
}
use middle::typeck::infer::{TypeTrace, Subtype};
use middle::typeck::infer::fold_regions_in_sig;
use syntax::ast::{Many, Once, MutImmutable, MutMutable};
-use syntax::ast::{ExternFn, NormalFn, UnsafeFn, NodeId};
+use syntax::ast::{NormalFn, UnsafeFn, NodeId};
use syntax::ast::{Onceness, FnStyle};
use collections::HashMap;
use util::common::{indenter};
fn fn_styles(&self, a: FnStyle, b: FnStyle) -> cres<FnStyle> {
match (a, b) {
- (ExternFn, _) | (_, ExternFn) => Ok(ExternFn),
(NormalFn, _) | (_, NormalFn) => Ok(NormalFn),
(UnsafeFn, UnsafeFn) => Ok(UnsafeFn)
}
use middle::typeck::infer::{TypeTrace, Subtype};
use collections::HashMap;
use syntax::ast::{Many, Once, NodeId};
-use syntax::ast::{ExternFn, NormalFn, UnsafeFn};
+use syntax::ast::{NormalFn, UnsafeFn};
use syntax::ast::{Onceness, FnStyle};
use util::ppaux::mt_to_str;
fn fn_styles(&self, a: FnStyle, b: FnStyle) -> cres<FnStyle> {
match (a, b) {
(UnsafeFn, _) | (_, UnsafeFn) => Ok(UnsafeFn),
- (NormalFn, _) | (_, NormalFn) => Ok(NormalFn),
- (ExternFn, ExternFn) => Ok(ExternFn),
+ (NormalFn, NormalFn) => Ok(NormalFn),
}
}
ForeignFunctionItem(Function {
decl: decl.clean(),
generics: generics.clean(),
- fn_style: ast::ExternFn,
+ fn_style: ast::NormalFn,
})
}
ast::ForeignItemStatic(ref ty, mutbl) => {
clean::BareFunction(ref decl) => {
write!(f.buf, "{}{}fn{}{}",
FnStyleSpace(decl.fn_style),
- match decl.abi {
- ref x if "" == *x => "".to_owned(),
- ref x if "\"Rust\"" == *x => "".to_owned(),
- ref s => " " + *s + " ",
+ match decl.abi.as_slice() {
+ "" => " extern ".to_owned(),
+ "\"Rust\"" => "".to_owned(),
+ s => format!(" extern {} ", s)
},
decl.generics,
decl.decl)
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self.get() {
ast::UnsafeFn => write!(f.buf, "unsafe "),
- ast::ExternFn => write!(f.buf, "extern "),
ast::NormalFn => Ok(())
}
}
struct Inner {
queue: Vec<BlockedTask>,
held: bool,
+ closed: bool,
}
impl Access {
inner: UnsafeArc::new(Inner {
queue: vec![],
held: false,
+ closed: false,
})
}
}
Guard { access: self, missile: Some(missile) }
}
+
+ pub fn close(&self, _missile: &HomingMissile) {
+ // This unsafety is OK because with a homing missile we're guaranteed to
+ // be the only task looking at the `closed` flag (and are therefore
+ // allowed to modify it). Additionally, no atomics are necessary because
+ // everyone's running on the same thread and has already done the
+ // necessary synchronization to be running on this thread.
+ unsafe { (*self.inner.get()).closed = true; }
+ }
}
impl Clone for Access {
}
}
+impl<'a> Guard<'a> {
+ pub fn is_closed(&self) -> bool {
+ // See above for why this unsafety is ok, it just applies to the read
+ // instead of the write.
+ unsafe { (*self.access.inner.get()).closed }
+ }
+}
+
#[unsafe_destructor]
impl<'a> Drop for Guard<'a> {
fn drop(&mut self) {
use libc::{size_t, ssize_t, c_int, c_void, c_uint};
use libc;
use std::cast;
+use std::io;
use std::io::{IoError, IoResult};
use std::io::net::ip;
use std::mem;
impl rtio::RtioTcpStream for TcpWatcher {
fn read(&mut self, buf: &mut [u8]) -> Result<uint, IoError> {
let m = self.fire_homing_missile();
- let _g = self.read_access.grant(m);
+ let access = self.read_access.grant(m);
+
+ // see comments in close_read about this check
+ if access.is_closed() {
+ return Err(io::standard_error(io::EndOfFile))
+ }
+
self.stream.read(buf).map_err(uv_error_to_io_error)
}
} as Box<rtio::RtioTcpStream:Send>
}
- fn close_write(&mut self) -> Result<(), IoError> {
- struct Ctx {
- slot: Option<BlockedTask>,
- status: c_int,
- }
- let mut req = Request::new(uvll::UV_SHUTDOWN);
-
- return match unsafe {
- uvll::uv_shutdown(req.handle, self.handle, shutdown_cb)
- } {
- 0 => {
- req.defuse(); // uv callback now owns this request
- let mut cx = Ctx { slot: None, status: 0 };
-
- wait_until_woken_after(&mut cx.slot, &self.uv_loop(), || {
- req.set_data(&cx);
- });
-
- status_to_io_result(cx.status)
- }
- n => Err(uv_error_to_io_error(UvError(n)))
- };
+ fn close_read(&mut self) -> Result<(), IoError> {
+ // see comments in PipeWatcher::close_read
+ let m = self.fire_homing_missile();
+ self.read_access.close(&m);
+ self.stream.cancel_read(m);
+ Ok(())
+ }
- extern fn shutdown_cb(req: *uvll::uv_shutdown_t, status: libc::c_int) {
- let req = Request::wrap(req);
- assert!(status != uvll::ECANCELED);
- let cx: &mut Ctx = unsafe { req.get_data() };
- cx.status = status;
- wakeup(&mut cx.slot);
- }
+ fn close_write(&mut self) -> Result<(), IoError> {
+ let _m = self.fire_homing_missile();
+ shutdown(self.handle, &self.uv_loop())
}
}
let m = self.fire_homing_missile();
let _g = self.read_access.grant(m);
- let a = match unsafe {
+ return match unsafe {
uvll::uv_udp_recv_start(self.handle, alloc_cb, recv_cb)
} {
0 => {
}
n => Err(uv_error_to_io_error(UvError(n)))
};
- return a;
extern fn alloc_cb(handle: *uvll::uv_udp_t,
_suggested_size: size_t,
buf: *mut Buf) {
unsafe {
- let cx: &mut Ctx =
- cast::transmute(uvll::get_data_for_uv_handle(handle));
+ let cx = &mut *(uvll::get_data_for_uv_handle(handle) as *mut Ctx);
*buf = cx.buf.take().expect("recv alloc_cb called more than once")
}
}
extern fn recv_cb(handle: *uvll::uv_udp_t, nread: ssize_t, buf: *Buf,
addr: *libc::sockaddr, _flags: c_uint) {
assert!(nread != uvll::ECANCELED as ssize_t);
- let cx: &mut Ctx = unsafe {
- cast::transmute(uvll::get_data_for_uv_handle(handle))
+ let cx = unsafe {
+ &mut *(uvll::get_data_for_uv_handle(handle) as *mut Ctx)
};
// When there's no data to read the recv callback can be a no-op.
return
}
- unsafe {
- assert_eq!(uvll::uv_udp_recv_stop(handle), 0)
- }
-
- let cx: &mut Ctx = unsafe {
- cast::transmute(uvll::get_data_for_uv_handle(handle))
- };
+ unsafe { assert_eq!(uvll::uv_udp_recv_stop(handle), 0) }
let addr = if addr == ptr::null() {
None
} else {
}
}
+////////////////////////////////////////////////////////////////////////////////
+// Shutdown helper
+////////////////////////////////////////////////////////////////////////////////
+
+pub fn shutdown(handle: *uvll::uv_stream_t, loop_: &Loop) -> Result<(), IoError> {
+ struct Ctx {
+ slot: Option<BlockedTask>,
+ status: c_int,
+ }
+ let mut req = Request::new(uvll::UV_SHUTDOWN);
+
+ return match unsafe { uvll::uv_shutdown(req.handle, handle, shutdown_cb) } {
+ 0 => {
+ req.defuse(); // uv callback now owns this request
+ let mut cx = Ctx { slot: None, status: 0 };
+
+ wait_until_woken_after(&mut cx.slot, loop_, || {
+ req.set_data(&cx);
+ });
+
+ status_to_io_result(cx.status)
+ }
+ n => Err(uv_error_to_io_error(UvError(n)))
+ };
+
+ extern fn shutdown_cb(req: *uvll::uv_shutdown_t, status: libc::c_int) {
+ let req = Request::wrap(req);
+ assert!(status != uvll::ECANCELED);
+ let cx: &mut Ctx = unsafe { req.get_data() };
+ cx.status = status;
+ wakeup(&mut cx.slot);
+ }
+}
+
#[cfg(test)]
mod test {
use std::rt::rtio::{RtioTcpStream, RtioTcpListener, RtioTcpAcceptor,
use libc;
use std::c_str::CString;
use std::io::IoError;
+use std::io;
use std::rt::rtio::{RtioPipe, RtioUnixListener, RtioUnixAcceptor};
use access::Access;
impl RtioPipe for PipeWatcher {
fn read(&mut self, buf: &mut [u8]) -> Result<uint, IoError> {
let m = self.fire_homing_missile();
- let _g = self.read_access.grant(m);
+ let access = self.read_access.grant(m);
+
+ // see comments in close_read about this check
+ if access.is_closed() {
+ return Err(io::standard_error(io::EndOfFile))
+ }
+
self.stream.read(buf).map_err(uv_error_to_io_error)
}
write_access: self.write_access.clone(),
} as Box<RtioPipe:Send>
}
+
+ fn close_read(&mut self) -> Result<(), IoError> {
+ // The current uv_shutdown method only shuts the writing half of the
+ // connection, and no method is provided to shut down the reading half
+ // of the connection. With a lack of method, we emulate shutting down
+ // the reading half of the connection by manually returning early from
+ // all future calls to `read`.
+ //
+ // Note that we must be careful to ensure that *all* cloned handles see
+ // the closing of the read half, so we stored the "is closed" bit in the
+ // Access struct, not in our own personal watcher. Additionally, the
+ // homing missile is used as a locking mechanism to ensure there is no
+ // contention over this bit.
+ //
+ // To shutdown the read half, we must first flag the access as being
+ // closed, and then afterwards we cease any pending read. Note that this
+ // ordering is crucial because we could in theory be rescheduled during
+ // the uv_read_stop which means that another read invocation could leak
+ // in before we set the flag.
+ let m = self.fire_homing_missile();
+ self.read_access.close(&m);
+ self.stream.cancel_read(m);
+ Ok(())
+ }
+
+ fn close_write(&mut self) -> Result<(), IoError> {
+ let _m = self.fire_homing_missile();
+ net::shutdown(self.stream.handle, &self.uv_loop())
+ }
}
impl HomingIO for PipeWatcher {
use std::rt::task::BlockedTask;
use Loop;
+use homing::HomingMissile;
use super::{UvError, Buf, slice_to_uv_buf, Request, wait_until_woken_after,
ForbidUnwind, wakeup};
use uvll;
// Wrappers should ensure to always reset the field to an appropriate value
// if they rely on the field to perform an action.
pub fn new(stream: *uvll::uv_stream_t) -> StreamWatcher {
+ unsafe { uvll::set_data_for_uv_handle(stream, 0 as *int) }
StreamWatcher {
handle: stream,
last_write_req: None,
let mut rcx = ReadContext {
buf: Some(slice_to_uv_buf(buf)),
- result: 0,
+ // if the read is canceled, we'll see eof, otherwise this will get
+ // overwritten
+ result: uvll::EOF as ssize_t,
task: None,
};
// When reading a TTY stream on windows, libuv will invoke alloc_cb
// we must be ready for this to happen (by setting the data in the uv
// handle). In theory this otherwise doesn't need to happen until after
// the read is succesfully started.
- unsafe {
- uvll::set_data_for_uv_handle(self.handle, &rcx)
- }
+ unsafe { uvll::set_data_for_uv_handle(self.handle, &rcx) }
// Send off the read request, but don't block until we're sure that the
// read request is queued.
- match unsafe {
+ let ret = match unsafe {
uvll::uv_read_start(self.handle, alloc_cb, read_cb)
} {
0 => {
}
}
n => Err(UvError(n))
+ };
+ // Make sure a read cancellation sees that there's no pending read
+ unsafe { uvll::set_data_for_uv_handle(self.handle, 0 as *int) }
+ return ret;
+ }
+
+ pub fn cancel_read(&mut self, m: HomingMissile) {
+ // When we invoke uv_read_stop, it cancels the read and alloc
+ // callbacks. We need to manually wake up a pending task (if one was
+ // present). Note that we wake up the task *outside* the homing missile
+ // to ensure that we don't switch schedulers when we're not supposed to.
+ assert_eq!(unsafe { uvll::uv_read_stop(self.handle) }, 0);
+ let data = unsafe {
+ let data = uvll::get_data_for_uv_handle(self.handle);
+ if data.is_null() { return }
+ uvll::set_data_for_uv_handle(self.handle, 0 as *int);
+ &mut *(data as *mut ReadContext)
+ };
+ let task = data.task.take();
+ drop(m);
+ match task {
+ Some(task) => { let _ = task.wake().map(|t| t.reawaken()); }
+ None => {}
}
}
'n' => res.push_char('\n'),
'r' => res.push_char('\r'),
't' => res.push_char('\t'),
-//<<<<<<< HEAD
'u' => match try!(self.decode_hex_escape()) {
0xDC00 .. 0xDFFF => return self.error(LoneLeadingSurrogateInHexEscape),
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-//! Traits for dynamic typing of any type (through runtime reflection)
-//!
-//! This module implements the `Any` trait, which enables dynamic typing
-//! of any type, through runtime reflection.
-//!
-//! `Any` itself can be used to get a `TypeId`, and has more features when used as a trait object.
-//! As `&Any` (a borrowed trait object), it has the `is` and `as_ref` methods, to test if the
-//! contained value is of a given type, and to get a reference to the inner value as a type. As
-//! `&mut Any`, there is also the `as_mut` method, for getting a mutable reference to the inner
-//! value. `Box<Any>` adds the `move` method, which will unwrap a `Box<T>` from the object. See
-//! the extension traits (`*Ext`) for the full details.
-
-use cast::{transmute, transmute_copy};
-use fmt;
-use option::{Option, Some, None};
-use owned::Box;
-use raw::TraitObject;
-use result::{Result, Ok, Err};
-use intrinsics::TypeId;
-use intrinsics;
-
-/// A type with no inhabitants
-pub enum Void { }
-
-///////////////////////////////////////////////////////////////////////////////
-// Any trait
-///////////////////////////////////////////////////////////////////////////////
-
-/// The `Any` trait is implemented by all types, and can be used as a trait object
-/// for dynamic typing
-pub trait Any {
- /// Get the `TypeId` of `self`
- fn get_type_id(&self) -> TypeId;
-}
-
-impl<T: 'static> Any for T {
- /// Get the `TypeId` of `self`
- fn get_type_id(&self) -> TypeId {
- TypeId::of::<T>()
- }
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Extension methods for Any trait objects.
-// Implemented as three extension traits so that the methods can be generic.
-///////////////////////////////////////////////////////////////////////////////
-
-/// Extension methods for a referenced `Any` trait object
-pub trait AnyRefExt<'a> {
- /// Returns true if the boxed type is the same as `T`
- fn is<T: 'static>(self) -> bool;
-
- /// Returns some reference to the boxed value if it is of type `T`, or
- /// `None` if it isn't.
- fn as_ref<T: 'static>(self) -> Option<&'a T>;
-}
-
-impl<'a> AnyRefExt<'a> for &'a Any {
- #[inline]
- fn is<T: 'static>(self) -> bool {
- // Get TypeId of the type this function is instantiated with
- let t = TypeId::of::<T>();
-
- // Get TypeId of the type in the trait object
- let boxed = self.get_type_id();
-
- // Compare both TypeIds on equality
- t == boxed
- }
-
- #[inline]
- fn as_ref<T: 'static>(self) -> Option<&'a T> {
- if self.is::<T>() {
- unsafe {
- // Get the raw representation of the trait object
- let to: TraitObject = transmute_copy(&self);
-
- // Extract the data pointer
- Some(transmute(to.data))
- }
- } else {
- None
- }
- }
-}
-
-/// Extension methods for a mutable referenced `Any` trait object
-pub trait AnyMutRefExt<'a> {
- /// Returns some mutable reference to the boxed value if it is of type `T`, or
- /// `None` if it isn't.
- fn as_mut<T: 'static>(self) -> Option<&'a mut T>;
-}
-
-impl<'a> AnyMutRefExt<'a> for &'a mut Any {
- #[inline]
- fn as_mut<T: 'static>(self) -> Option<&'a mut T> {
- if self.is::<T>() {
- unsafe {
- // Get the raw representation of the trait object
- let to: TraitObject = transmute_copy(&self);
-
- // Extract the data pointer
- Some(transmute(to.data))
- }
- } else {
- None
- }
- }
-}
-
-/// Extension methods for an owning `Any` trait object
-pub trait AnyOwnExt {
- /// Returns the boxed value if it is of type `T`, or
- /// `Err(Self)` if it isn't.
- fn move<T: 'static>(self) -> Result<Box<T>, Self>;
-}
-
-impl AnyOwnExt for Box<Any> {
- #[inline]
- fn move<T: 'static>(self) -> Result<Box<T>, Box<Any>> {
- if self.is::<T>() {
- unsafe {
- // Get the raw representation of the trait object
- let to: TraitObject = transmute_copy(&self);
-
- // Prevent destructor on self being run
- intrinsics::forget(self);
-
- // Extract the data pointer
- Ok(transmute(to.data))
- }
- } else {
- Err(self)
- }
- }
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Trait implementations
-///////////////////////////////////////////////////////////////////////////////
-
-impl fmt::Show for Box<Any> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- f.pad("Box<Any>")
- }
-}
-
-impl<'a> fmt::Show for &'a Any {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- f.pad("&Any")
- }
-}
-
-#[cfg(test)]
-mod tests {
- use prelude::*;
- use super::*;
- use owned::Box;
- use str::StrSlice;
-
- #[deriving(Eq, Show)]
- struct Test;
-
- static TEST: &'static str = "Test";
-
- #[test]
- fn any_referenced() {
- let (a, b, c) = (&5u as &Any, &TEST as &Any, &Test as &Any);
-
- assert!(a.is::<uint>());
- assert!(!b.is::<uint>());
- assert!(!c.is::<uint>());
-
- assert!(!a.is::<&'static str>());
- assert!(b.is::<&'static str>());
- assert!(!c.is::<&'static str>());
-
- assert!(!a.is::<Test>());
- assert!(!b.is::<Test>());
- assert!(c.is::<Test>());
- }
-
- #[test]
- fn any_owning() {
- let (a, b, c) = (box 5u as Box<Any>, box TEST as Box<Any>, box Test as Box<Any>);
-
- assert!(a.is::<uint>());
- assert!(!b.is::<uint>());
- assert!(!c.is::<uint>());
-
- assert!(!a.is::<&'static str>());
- assert!(b.is::<&'static str>());
- assert!(!c.is::<&'static str>());
-
- assert!(!a.is::<Test>());
- assert!(!b.is::<Test>());
- assert!(c.is::<Test>());
- }
-
- #[test]
- fn any_as_ref() {
- let a = &5u as &Any;
-
- match a.as_ref::<uint>() {
- Some(&5) => {}
- x => fail!("Unexpected value {:?}", x)
- }
-
- match a.as_ref::<Test>() {
- None => {}
- x => fail!("Unexpected value {:?}", x)
- }
- }
-
- #[test]
- fn any_as_mut() {
- let mut a = 5u;
- let mut b = box 7u;
-
- let a_r = &mut a as &mut Any;
- let tmp: &mut uint = b;
- let b_r = tmp as &mut Any;
-
- match a_r.as_mut::<uint>() {
- Some(x) => {
- assert_eq!(*x, 5u);
- *x = 612;
- }
- x => fail!("Unexpected value {:?}", x)
- }
-
- match b_r.as_mut::<uint>() {
- Some(x) => {
- assert_eq!(*x, 7u);
- *x = 413;
- }
- x => fail!("Unexpected value {:?}", x)
- }
-
- match a_r.as_mut::<Test>() {
- None => (),
- x => fail!("Unexpected value {:?}", x)
- }
-
- match b_r.as_mut::<Test>() {
- None => (),
- x => fail!("Unexpected value {:?}", x)
- }
-
- match a_r.as_mut::<uint>() {
- Some(&612) => {}
- x => fail!("Unexpected value {:?}", x)
- }
-
- match b_r.as_mut::<uint>() {
- Some(&413) => {}
- x => fail!("Unexpected value {:?}", x)
- }
- }
-
- #[test]
- fn any_move() {
- let a = box 8u as Box<Any>;
- let b = box Test as Box<Any>;
-
- match a.move::<uint>() {
- Ok(a) => { assert_eq!(a, box 8u); }
- Err(..) => fail!()
- }
- match b.move::<Test>() {
- Ok(a) => { assert_eq!(a, box Test); }
- Err(..) => fail!()
- }
-
- let a = box 8u as Box<Any>;
- let b = box Test as Box<Any>;
-
- assert!(a.move::<Box<Test>>().is_err());
- assert!(b.move::<Box<uint>>().is_err());
- }
-
- #[test]
- fn test_show() {
- let a = box 8u as Box<Any>;
- let b = box Test as Box<Any>;
- assert_eq!(format!("{}", a), "Box<Any>".to_owned());
- assert_eq!(format!("{}", b), "Box<Any>".to_owned());
-
- let a = &8u as &Any;
- let b = &Test as &Any;
- assert_eq!(format!("{}", a), "&Any".to_owned());
- assert_eq!(format!("{}", b), "&Any".to_owned());
- }
-}
-
-#[cfg(test)]
-mod bench {
- extern crate test;
-
- use any::{Any, AnyRefExt};
- use option::Some;
- use self::test::Bencher;
-
- #[bench]
- fn bench_as_ref(b: &mut Bencher) {
- b.iter(|| {
- let mut x = 0; let mut y = &mut x as &mut Any;
- test::black_box(&mut y);
- test::black_box(y.as_ref::<int>() == Some(&0));
- });
- }
-}
+++ /dev/null
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-//! Operations on boolean values (`bool` type)
-//!
-//! A quick summary:
-//!
-//! Implementations of the following traits:
-//!
-//! * `FromStr`
-//! * `Not`
-//! * `Ord`
-//! * `TotalOrd`
-//! * `Eq`
-//! * `Default`
-//! * `Zero`
-//!
-//! A `to_bit` conversion function.
-
-use from_str::FromStr;
-use num::{Int, one, zero};
-use option::{None, Option, Some};
-
-#[cfg(not(test))] use cmp::{Eq, Ord, TotalOrd, Ordering};
-#[cfg(not(test))] use ops::{Not, BitAnd, BitOr, BitXor};
-#[cfg(not(test))] use default::Default;
-
-/////////////////////////////////////////////////////////////////////////////
-// Freestanding functions
-/////////////////////////////////////////////////////////////////////////////
-
-/// Convert a `bool` to an integer.
-///
-/// # Examples
-///
-/// ```rust
-/// use std::bool;
-///
-/// assert_eq!(bool::to_bit::<u8>(true), 1u8);
-/// assert_eq!(bool::to_bit::<u8>(false), 0u8);
-/// ```
-#[inline]
-pub fn to_bit<N: Int>(p: bool) -> N {
- if p { one() } else { zero() }
-}
-
-/////////////////////////////////////////////////////////////////////////////
-// Trait impls on `bool`
-/////////////////////////////////////////////////////////////////////////////
-
-impl FromStr for bool {
- /// Parse a `bool` from a string.
- ///
- /// Yields an `Option<bool>`, because `s` may or may not actually be parseable.
- ///
- /// # Examples
- ///
- /// ```rust
- /// assert_eq!(from_str::<bool>("true"), Some(true));
- /// assert_eq!(from_str::<bool>("false"), Some(false));
- /// assert_eq!(from_str::<bool>("not even a boolean"), None);
- /// ```
- #[inline]
- fn from_str(s: &str) -> Option<bool> {
- match s {
- "true" => Some(true),
- "false" => Some(false),
- _ => None,
- }
- }
-}
-
-#[cfg(not(test))]
-impl Not<bool> for bool {
- /// The logical complement of a boolean value.
- ///
- /// # Examples
- ///
- /// ```rust
- /// assert_eq!(!true, false);
- /// assert_eq!(!false, true);
- /// ```
- #[inline]
- fn not(&self) -> bool { !*self }
-}
-
-#[cfg(not(test))]
-impl BitAnd<bool, bool> for bool {
- /// Conjunction of two boolean values.
- ///
- /// # Examples
- ///
- /// ```rust
- /// assert_eq!(false.bitand(&false), false);
- /// assert_eq!(true.bitand(&false), false);
- /// assert_eq!(false.bitand(&true), false);
- /// assert_eq!(true.bitand(&true), true);
- ///
- /// assert_eq!(false & false, false);
- /// assert_eq!(true & false, false);
- /// assert_eq!(false & true, false);
- /// assert_eq!(true & true, true);
- /// ```
- #[inline]
- fn bitand(&self, b: &bool) -> bool { *self & *b }
-}
-
-#[cfg(not(test))]
-impl BitOr<bool, bool> for bool {
- /// Disjunction of two boolean values.
- ///
- /// # Examples
- ///
- /// ```rust
- /// assert_eq!(false.bitor(&false), false);
- /// assert_eq!(true.bitor(&false), true);
- /// assert_eq!(false.bitor(&true), true);
- /// assert_eq!(true.bitor(&true), true);
- ///
- /// assert_eq!(false | false, false);
- /// assert_eq!(true | false, true);
- /// assert_eq!(false | true, true);
- /// assert_eq!(true | true, true);
- /// ```
- #[inline]
- fn bitor(&self, b: &bool) -> bool { *self | *b }
-}
-
-#[cfg(not(test))]
-impl BitXor<bool, bool> for bool {
- /// An 'exclusive or' of two boolean values.
- ///
- /// 'exclusive or' is identical to `or(and(a, not(b)), and(not(a), b))`.
- ///
- /// # Examples
- ///
- /// ```rust
- /// assert_eq!(false.bitxor(&false), false);
- /// assert_eq!(true.bitxor(&false), true);
- /// assert_eq!(false.bitxor(&true), true);
- /// assert_eq!(true.bitxor(&true), false);
- ///
- /// assert_eq!(false ^ false, false);
- /// assert_eq!(true ^ false, true);
- /// assert_eq!(false ^ true, true);
- /// assert_eq!(true ^ true, false);
- /// ```
- #[inline]
- fn bitxor(&self, b: &bool) -> bool { *self ^ *b }
-}
-
-#[cfg(not(test))]
-impl Ord for bool {
- #[inline]
- fn lt(&self, other: &bool) -> bool {
- to_bit::<u8>(*self) < to_bit(*other)
- }
-}
-
-#[cfg(not(test))]
-impl TotalOrd for bool {
- #[inline]
- fn cmp(&self, other: &bool) -> Ordering {
- to_bit::<u8>(*self).cmp(&to_bit(*other))
- }
-}
-
-/// Equality between two boolean values.
-///
-/// Two booleans are equal if they have the same value.
-///
-/// # Examples
-///
-/// ```rust
-/// assert_eq!(false.eq(&true), false);
-/// assert_eq!(false == false, true);
-/// assert_eq!(false != true, true);
-/// assert_eq!(false.ne(&false), false);
-/// ```
-#[cfg(not(test))]
-impl Eq for bool {
- #[inline]
- fn eq(&self, other: &bool) -> bool { (*self) == (*other) }
-}
-
-#[cfg(not(test))]
-impl Default for bool {
- fn default() -> bool { false }
-}
-
-#[cfg(test)]
-mod tests {
- use prelude::*;
- use super::to_bit;
- use str::StrSlice;
-
- #[test]
- fn test_to_bit() {
- assert_eq!(to_bit::<u8>(true), 1u8);
- assert_eq!(to_bit::<u8>(false), 0u8);
- }
-
- #[test]
- fn test_eq() {
- assert_eq!(false.eq(&true), false);
- assert_eq!(false == false, true);
- assert_eq!(false != true, true);
- assert_eq!(false.ne(&false), false);
- }
-
- #[test]
- fn test_bitand() {
- assert_eq!(false.bitand(&false), false);
- assert_eq!(true.bitand(&false), false);
- assert_eq!(false.bitand(&true), false);
- assert_eq!(true.bitand(&true), true);
-
- assert_eq!(false & false, false);
- assert_eq!(true & false, false);
- assert_eq!(false & true, false);
- assert_eq!(true & true, true);
- }
-
- #[test]
- fn test_bitor() {
- assert_eq!(false.bitor(&false), false);
- assert_eq!(true.bitor(&false), true);
- assert_eq!(false.bitor(&true), true);
- assert_eq!(true.bitor(&true), true);
-
- assert_eq!(false | false, false);
- assert_eq!(true | false, true);
- assert_eq!(false | true, true);
- assert_eq!(true | true, true);
- }
-
- #[test]
- fn test_bitxor() {
- assert_eq!(false.bitxor(&false), false);
- assert_eq!(true.bitxor(&false), true);
- assert_eq!(false.bitxor(&true), true);
- assert_eq!(true.bitxor(&true), false);
-
- assert_eq!(false ^ false, false);
- assert_eq!(true ^ false, true);
- assert_eq!(false ^ true, true);
- assert_eq!(true ^ true, false);
- }
-
- #[test]
- fn test_not() {
- assert_eq!(!true, false);
- assert_eq!(!false, true);
- }
-
- #[test]
- fn test_from_str() {
- assert_eq!(from_str::<bool>("true"), Some(true));
- assert_eq!(from_str::<bool>("false"), Some(false));
- assert_eq!(from_str::<bool>("not even a boolean"), None);
- }
-
- #[test]
- fn test_to_str() {
- assert_eq!(false.to_str(), "false".to_owned());
- assert_eq!(true.to_str(), "true".to_owned());
- }
-
- #[test]
- fn test_ord() {
- assert!(true > false);
- assert!(!(false > true));
-
- assert!(false < true);
- assert!(!(true < false));
-
- assert!(false <= false);
- assert!(false >= false);
- assert!(true <= true);
- assert!(true >= true);
-
- assert!(false <= true);
- assert!(!(false >= true));
- assert!(true >= false);
- assert!(!(true <= false));
- }
-
- #[test]
- fn test_totalord() {
- assert!(true.cmp(&true) == Equal);
- assert!(false.cmp(&false) == Equal);
- assert!(true.cmp(&false) == Greater);
- assert!(false.cmp(&true) == Less);
- }
-}
+++ /dev/null
-// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-//! Unsafe casting functions
-
-use mem;
-use intrinsics;
-use ptr::copy_nonoverlapping_memory;
-
-/// Casts the value at `src` to U. The two types must have the same length.
-#[inline]
-pub unsafe fn transmute_copy<T, U>(src: &T) -> U {
- let mut dest: U = mem::uninit();
- let dest_ptr: *mut u8 = transmute(&mut dest);
- let src_ptr: *u8 = transmute(src);
- copy_nonoverlapping_memory(dest_ptr, src_ptr, mem::size_of::<U>());
- dest
-}
-
-/**
- * Move a thing into the void
- *
- * The forget function will take ownership of the provided value but neglect
- * to run any required cleanup or memory-management operations on it.
- */
-#[inline]
-pub unsafe fn forget<T>(thing: T) { intrinsics::forget(thing); }
-
-/**
- * Force-increment the reference count on a shared box. If used
- * carelessly, this can leak the box.
- */
-#[inline]
-pub unsafe fn bump_box_refcount<T>(t: @T) { forget(t); }
-
-/**
- * Transform a value of one type into a value of another type.
- * Both types must have the same size and alignment.
- *
- * # Example
- *
- * ```rust
- * use std::cast;
- *
- * let v: &[u8] = unsafe { cast::transmute("L") };
- * assert!(v == [76u8]);
- * ```
- */
-#[inline]
-pub unsafe fn transmute<L, G>(thing: L) -> G {
- intrinsics::transmute(thing)
-}
-
-/// Coerce an immutable reference to be mutable.
-#[inline]
-#[deprecated="casting &T to &mut T is undefined behaviour: use Cell<T>, RefCell<T> or Unsafe<T>"]
-pub unsafe fn transmute_mut<'a,T>(ptr: &'a T) -> &'a mut T { transmute(ptr) }
-
-/// Coerce a reference to have an arbitrary associated lifetime.
-#[inline]
-pub unsafe fn transmute_lifetime<'a,'b,T>(ptr: &'a T) -> &'b T {
- transmute(ptr)
-}
-
-/// Coerce an immutable reference to be mutable.
-#[inline]
-pub unsafe fn transmute_mut_unsafe<T>(ptr: *T) -> *mut T {
- transmute(ptr)
-}
-
-/// Coerce a mutable reference to have an arbitrary associated lifetime.
-#[inline]
-pub unsafe fn transmute_mut_lifetime<'a,'b,T>(ptr: &'a mut T) -> &'b mut T {
- transmute(ptr)
-}
-
-/// Transforms lifetime of the second pointer to match the first.
-#[inline]
-pub unsafe fn copy_lifetime<'a,S,T>(_ptr: &'a S, ptr: &T) -> &'a T {
- transmute_lifetime(ptr)
-}
-
-/// Transforms lifetime of the second pointer to match the first.
-#[inline]
-pub unsafe fn copy_mut_lifetime<'a,S,T>(_ptr: &'a mut S, ptr: &mut T) -> &'a mut T {
- transmute_mut_lifetime(ptr)
-}
-
-/// Transforms lifetime of the second pointer to match the first.
-#[inline]
-pub unsafe fn copy_lifetime_vec<'a,S,T>(_ptr: &'a [S], ptr: &T) -> &'a T {
- transmute_lifetime(ptr)
-}
-
-
-/****************************************************************************
- * Tests
- ****************************************************************************/
-
-#[cfg(test)]
-mod tests {
- use cast::{bump_box_refcount, transmute};
- use raw;
- use str::StrSlice;
-
- #[test]
- fn test_transmute_copy() {
- assert_eq!(1u, unsafe { ::cast::transmute_copy(&1) });
- }
-
- #[test]
- fn test_bump_managed_refcount() {
- unsafe {
- let managed = @"box box box".to_owned(); // refcount 1
- bump_box_refcount(managed); // refcount 2
- let ptr: *int = transmute(managed); // refcount 2
- let _box1: @~str = ::cast::transmute_copy(&ptr);
- let _box2: @~str = ::cast::transmute_copy(&ptr);
- assert!(*_box1 == "box box box".to_owned());
- assert!(*_box2 == "box box box".to_owned());
- // Will destroy _box1 and _box2. Without the bump, this would
- // use-after-free. With too many bumps, it would leak.
- }
- }
-
- #[test]
- fn test_transmute() {
- unsafe {
- let x = @100u8;
- let x: *raw::Box<u8> = transmute(x);
- assert!((*x).data == 100);
- let _x: @int = transmute(x);
- }
- }
-
- #[test]
- fn test_transmute2() {
- unsafe {
- assert_eq!(box [76u8], transmute("L".to_owned()));
- }
- }
-}
+++ /dev/null
-// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-//! Types dealing with dynamic mutability
-
-use clone::Clone;
-use cmp::Eq;
-use fmt;
-use kinds::{marker, Copy};
-use ops::{Deref, DerefMut, Drop};
-use option::{None, Option, Some};
-use ty::Unsafe;
-
-/// A mutable memory location that admits only `Copy` data.
-pub struct Cell<T> {
- value: Unsafe<T>,
- noshare: marker::NoShare,
-}
-
-impl<T:Copy> Cell<T> {
- /// Creates a new `Cell` containing the given value.
- pub fn new(value: T) -> Cell<T> {
- Cell {
- value: Unsafe::new(value),
- noshare: marker::NoShare,
- }
- }
-
- /// Returns a copy of the contained value.
- #[inline]
- pub fn get(&self) -> T {
- unsafe{ *self.value.get() }
- }
-
- /// Sets the contained value.
- #[inline]
- pub fn set(&self, value: T) {
- unsafe {
- *self.value.get() = value;
- }
- }
-}
-
-impl<T:Copy> Clone for Cell<T> {
- fn clone(&self) -> Cell<T> {
- Cell::new(self.get())
- }
-}
-
-impl<T:Eq + Copy> Eq for Cell<T> {
- fn eq(&self, other: &Cell<T>) -> bool {
- self.get() == other.get()
- }
-}
-
-impl<T: Copy + fmt::Show> fmt::Show for Cell<T> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- write!(f.buf, r"Cell \{ value: {} \}", self.get())
- }
-}
-
-/// A mutable memory location with dynamically checked borrow rules
-pub struct RefCell<T> {
- value: Unsafe<T>,
- borrow: Cell<BorrowFlag>,
- nocopy: marker::NoCopy,
- noshare: marker::NoShare,
-}
-
-// Values [1, MAX-1] represent the number of `Ref` active
-// (will not outgrow its range since `uint` is the size of the address space)
-type BorrowFlag = uint;
-static UNUSED: BorrowFlag = 0;
-static WRITING: BorrowFlag = -1;
-
-impl<T> RefCell<T> {
- /// Create a new `RefCell` containing `value`
- pub fn new(value: T) -> RefCell<T> {
- RefCell {
- value: Unsafe::new(value),
- borrow: Cell::new(UNUSED),
- nocopy: marker::NoCopy,
- noshare: marker::NoShare,
- }
- }
-
- /// Consumes the `RefCell`, returning the wrapped value.
- pub fn unwrap(self) -> T {
- debug_assert!(self.borrow.get() == UNUSED);
- unsafe{self.value.unwrap()}
- }
-
- /// Attempts to immutably borrow the wrapped value.
- ///
- /// The borrow lasts until the returned `Ref` exits scope. Multiple
- /// immutable borrows can be taken out at the same time.
- ///
- /// Returns `None` if the value is currently mutably borrowed.
- pub fn try_borrow<'a>(&'a self) -> Option<Ref<'a, T>> {
- match self.borrow.get() {
- WRITING => None,
- borrow => {
- self.borrow.set(borrow + 1);
- Some(Ref { parent: self })
- }
- }
- }
-
- /// Immutably borrows the wrapped value.
- ///
- /// The borrow lasts until the returned `Ref` exits scope. Multiple
- /// immutable borrows can be taken out at the same time.
- ///
- /// # Failure
- ///
- /// Fails if the value is currently mutably borrowed.
- pub fn borrow<'a>(&'a self) -> Ref<'a, T> {
- match self.try_borrow() {
- Some(ptr) => ptr,
- None => fail!("RefCell<T> already mutably borrowed")
- }
- }
-
- /// Mutably borrows the wrapped value.
- ///
- /// The borrow lasts until the returned `RefMut` exits scope. The value
- /// cannot be borrowed while this borrow is active.
- ///
- /// Returns `None` if the value is currently borrowed.
- pub fn try_borrow_mut<'a>(&'a self) -> Option<RefMut<'a, T>> {
- match self.borrow.get() {
- UNUSED => {
- self.borrow.set(WRITING);
- Some(RefMut { parent: self })
- },
- _ => None
- }
- }
-
- /// Mutably borrows the wrapped value.
- ///
- /// The borrow lasts until the returned `RefMut` exits scope. The value
- /// cannot be borrowed while this borrow is active.
- ///
- /// # Failure
- ///
- /// Fails if the value is currently borrowed.
- pub fn borrow_mut<'a>(&'a self) -> RefMut<'a, T> {
- match self.try_borrow_mut() {
- Some(ptr) => ptr,
- None => fail!("RefCell<T> already borrowed")
- }
- }
-}
-
-impl<T: Clone> Clone for RefCell<T> {
- fn clone(&self) -> RefCell<T> {
- RefCell::new(self.borrow().clone())
- }
-}
-
-impl<T: Eq> Eq for RefCell<T> {
- fn eq(&self, other: &RefCell<T>) -> bool {
- *self.borrow() == *other.borrow()
- }
-}
-
-/// Wraps a borrowed reference to a value in a `RefCell` box.
-pub struct Ref<'b, T> {
- parent: &'b RefCell<T>
-}
-
-#[unsafe_destructor]
-impl<'b, T> Drop for Ref<'b, T> {
- fn drop(&mut self) {
- let borrow = self.parent.borrow.get();
- debug_assert!(borrow != WRITING && borrow != UNUSED);
- self.parent.borrow.set(borrow - 1);
- }
-}
-
-impl<'b, T> Deref<T> for Ref<'b, T> {
- #[inline]
- fn deref<'a>(&'a self) -> &'a T {
- unsafe { &*self.parent.value.get() }
- }
-}
-
-/// Wraps a mutable borrowed reference to a value in a `RefCell` box.
-pub struct RefMut<'b, T> {
- parent: &'b RefCell<T>
-}
-
-#[unsafe_destructor]
-impl<'b, T> Drop for RefMut<'b, T> {
- fn drop(&mut self) {
- let borrow = self.parent.borrow.get();
- debug_assert!(borrow == WRITING);
- self.parent.borrow.set(UNUSED);
- }
-}
-
-impl<'b, T> Deref<T> for RefMut<'b, T> {
- #[inline]
- fn deref<'a>(&'a self) -> &'a T {
- unsafe { &*self.parent.value.get() }
- }
-}
-
-impl<'b, T> DerefMut<T> for RefMut<'b, T> {
- #[inline]
- fn deref_mut<'a>(&'a mut self) -> &'a mut T {
- unsafe { &mut *self.parent.value.get() }
- }
-}
-
-#[cfg(test)]
-mod test {
- use super::*;
-
- #[test]
- fn smoketest_cell() {
- let x = Cell::new(10);
- assert_eq!(x, Cell::new(10));
- assert_eq!(x.get(), 10);
- x.set(20);
- assert_eq!(x, Cell::new(20));
- assert_eq!(x.get(), 20);
-
- let y = Cell::new((30, 40));
- assert_eq!(y, Cell::new((30, 40)));
- assert_eq!(y.get(), (30, 40));
- }
-
- #[test]
- fn cell_has_sensible_show() {
- use str::StrSlice;
-
- let x = Cell::new("foo bar");
- assert!(format!("{}", x).contains(x.get()));
-
- x.set("baz qux");
- assert!(format!("{}", x).contains(x.get()));
- }
-
- #[test]
- fn double_imm_borrow() {
- let x = RefCell::new(0);
- let _b1 = x.borrow();
- x.borrow();
- }
-
- #[test]
- fn no_mut_then_imm_borrow() {
- let x = RefCell::new(0);
- let _b1 = x.borrow_mut();
- assert!(x.try_borrow().is_none());
- }
-
- #[test]
- fn no_imm_then_borrow_mut() {
- let x = RefCell::new(0);
- let _b1 = x.borrow();
- assert!(x.try_borrow_mut().is_none());
- }
-
- #[test]
- fn no_double_borrow_mut() {
- let x = RefCell::new(0);
- let _b1 = x.borrow_mut();
- assert!(x.try_borrow_mut().is_none());
- }
-
- #[test]
- fn imm_release_borrow_mut() {
- let x = RefCell::new(0);
- {
- let _b1 = x.borrow();
- }
- x.borrow_mut();
- }
-
- #[test]
- fn mut_release_borrow_mut() {
- let x = RefCell::new(0);
- {
- let _b1 = x.borrow_mut();
- }
- x.borrow();
- }
-
- #[test]
- fn double_borrow_single_release_no_borrow_mut() {
- let x = RefCell::new(0);
- let _b1 = x.borrow();
- {
- let _b2 = x.borrow();
- }
- assert!(x.try_borrow_mut().is_none());
- }
-
- #[test]
- #[should_fail]
- fn discard_doesnt_unborrow() {
- let x = RefCell::new(0);
- let _b = x.borrow();
- let _ = _b;
- let _b = x.borrow_mut();
- }
-}
+++ /dev/null
-// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-//! Character manipulation (`char` type, Unicode Scalar Value)
-//!
-//! This module provides the `Char` trait, as well as its implementation
-//! for the primitive `char` type, in order to allow basic character manipulation.
-//!
-//! A `char` actually represents a
-//! *[Unicode Scalar Value](http://www.unicode.org/glossary/#unicode_scalar_value)*,
-//! as it can contain any Unicode code point except high-surrogate and
-//! low-surrogate code points.
-//!
-//! As such, only values in the ranges \[0x0,0xD7FF\] and \[0xE000,0x10FFFF\]
-//! (inclusive) are allowed. A `char` can always be safely cast to a `u32`;
-//! however the converse is not always true due to the above range limits
-//! and, as such, should be performed via the `from_u32` function..
-
-
-use cast::transmute;
-use option::{None, Option, Some};
-use iter::{Iterator, range_step};
-use str::StrSlice;
-use unicode::{derived_property, property, general_category, decompose, conversions};
-
-#[cfg(test)] use str::Str;
-#[cfg(test)] use strbuf::StrBuf;
-#[cfg(test)] use slice::ImmutableVector;
-
-#[cfg(not(test))] use cmp::{Eq, Ord};
-#[cfg(not(test))] use default::Default;
-
-// UTF-8 ranges and tags for encoding characters
-static TAG_CONT: uint = 128u;
-static MAX_ONE_B: uint = 128u;
-static TAG_TWO_B: uint = 192u;
-static MAX_TWO_B: uint = 2048u;
-static TAG_THREE_B: uint = 224u;
-static MAX_THREE_B: uint = 65536u;
-static TAG_FOUR_B: uint = 240u;
-
-/*
- Lu Uppercase_Letter an uppercase letter
- Ll Lowercase_Letter a lowercase letter
- Lt Titlecase_Letter a digraphic character, with first part uppercase
- Lm Modifier_Letter a modifier letter
- Lo Other_Letter other letters, including syllables and ideographs
- Mn Nonspacing_Mark a nonspacing combining mark (zero advance width)
- Mc Spacing_Mark a spacing combining mark (positive advance width)
- Me Enclosing_Mark an enclosing combining mark
- Nd Decimal_Number a decimal digit
- Nl Letter_Number a letterlike numeric character
- No Other_Number a numeric character of other type
- Pc Connector_Punctuation a connecting punctuation mark, like a tie
- Pd Dash_Punctuation a dash or hyphen punctuation mark
- Ps Open_Punctuation an opening punctuation mark (of a pair)
- Pe Close_Punctuation a closing punctuation mark (of a pair)
- Pi Initial_Punctuation an initial quotation mark
- Pf Final_Punctuation a final quotation mark
- Po Other_Punctuation a punctuation mark of other type
- Sm Math_Symbol a symbol of primarily mathematical use
- Sc Currency_Symbol a currency sign
- Sk Modifier_Symbol a non-letterlike modifier symbol
- So Other_Symbol a symbol of other type
- Zs Space_Separator a space character (of various non-zero widths)
- Zl Line_Separator U+2028 LINE SEPARATOR only
- Zp Paragraph_Separator U+2029 PARAGRAPH SEPARATOR only
- Cc Control a C0 or C1 control code
- Cf Format a format control character
- Cs Surrogate a surrogate code point
- Co Private_Use a private-use character
- Cn Unassigned a reserved unassigned code point or a noncharacter
-*/
-
-/// The highest valid code point
-pub static MAX: char = '\U0010ffff';
-
-/// Converts from `u32` to a `char`
-#[inline]
-pub fn from_u32(i: u32) -> Option<char> {
- // catch out-of-bounds and surrogates
- if (i > MAX as u32) || (i >= 0xD800 && i <= 0xDFFF) {
- None
- } else {
- Some(unsafe { transmute(i) })
- }
-}
-
-/// Returns whether the specified `char` is considered a Unicode alphabetic
-/// code point
-pub fn is_alphabetic(c: char) -> bool { derived_property::Alphabetic(c) }
-
-/// Returns whether the specified `char` satisfies the 'XID_Start' Unicode property
-///
-/// 'XID_Start' is a Unicode Derived Property specified in
-/// [UAX #31](http://unicode.org/reports/tr31/#NFKC_Modifications),
-/// mostly similar to ID_Start but modified for closure under NFKx.
-pub fn is_XID_start(c: char) -> bool { derived_property::XID_Start(c) }
-
-/// Returns whether the specified `char` satisfies the 'XID_Continue' Unicode property
-///
-/// 'XID_Continue' is a Unicode Derived Property specified in
-/// [UAX #31](http://unicode.org/reports/tr31/#NFKC_Modifications),
-/// mostly similar to 'ID_Continue' but modified for closure under NFKx.
-pub fn is_XID_continue(c: char) -> bool { derived_property::XID_Continue(c) }
-
-///
-/// Indicates whether a `char` is in lower case
-///
-/// This is defined according to the terms of the Unicode Derived Core Property 'Lowercase'.
-///
-#[inline]
-pub fn is_lowercase(c: char) -> bool { derived_property::Lowercase(c) }
-
-///
-/// Indicates whether a `char` is in upper case
-///
-/// This is defined according to the terms of the Unicode Derived Core Property 'Uppercase'.
-///
-#[inline]
-pub fn is_uppercase(c: char) -> bool { derived_property::Uppercase(c) }
-
-///
-/// Indicates whether a `char` is whitespace
-///
-/// Whitespace is defined in terms of the Unicode Property 'White_Space'.
-///
-#[inline]
-pub fn is_whitespace(c: char) -> bool {
- // As an optimization ASCII whitespace characters are checked separately
- c == ' '
- || ('\x09' <= c && c <= '\x0d')
- || property::White_Space(c)
-}
-
-///
-/// Indicates whether a `char` is alphanumeric
-///
-/// Alphanumericness is defined in terms of the Unicode General Categories
-/// 'Nd', 'Nl', 'No' and the Derived Core Property 'Alphabetic'.
-///
-#[inline]
-pub fn is_alphanumeric(c: char) -> bool {
- derived_property::Alphabetic(c)
- || general_category::Nd(c)
- || general_category::Nl(c)
- || general_category::No(c)
-}
-
-///
-/// Indicates whether a `char` is a control code point
-///
-/// Control code points are defined in terms of the Unicode General Category
-/// 'Cc'.
-///
-#[inline]
-pub fn is_control(c: char) -> bool { general_category::Cc(c) }
-
-/// Indicates whether the `char` is numeric (Nd, Nl, or No)
-#[inline]
-pub fn is_digit(c: char) -> bool {
- general_category::Nd(c)
- || general_category::Nl(c)
- || general_category::No(c)
-}
-
-///
-/// Checks if a `char` parses as a numeric digit in the given radix
-///
-/// Compared to `is_digit()`, this function only recognizes the
-/// characters `0-9`, `a-z` and `A-Z`.
-///
-/// # Return value
-///
-/// Returns `true` if `c` is a valid digit under `radix`, and `false`
-/// otherwise.
-///
-/// # Failure
-///
-/// Fails if given a `radix` > 36.
-///
-/// # Note
-///
-/// This just wraps `to_digit()`.
-///
-#[inline]
-pub fn is_digit_radix(c: char, radix: uint) -> bool {
- match to_digit(c, radix) {
- Some(_) => true,
- None => false,
- }
-}
-
-///
-/// Converts a `char` to the corresponding digit
-///
-/// # Return value
-///
-/// If `c` is between '0' and '9', the corresponding value
-/// between 0 and 9. If `c` is 'a' or 'A', 10. If `c` is
-/// 'b' or 'B', 11, etc. Returns none if the `char` does not
-/// refer to a digit in the given radix.
-///
-/// # Failure
-///
-/// Fails if given a `radix` outside the range `[0..36]`.
-///
-#[inline]
-pub fn to_digit(c: char, radix: uint) -> Option<uint> {
- if radix > 36 {
- fail!("to_digit: radix {} is too high (maximum 36)", radix);
- }
- let val = match c {
- '0' .. '9' => c as uint - ('0' as uint),
- 'a' .. 'z' => c as uint + 10u - ('a' as uint),
- 'A' .. 'Z' => c as uint + 10u - ('A' as uint),
- _ => return None,
- };
- if val < radix { Some(val) }
- else { None }
-}
-
-/// Convert a char to its uppercase equivalent
-///
-/// The case-folding performed is the common or simple mapping:
-/// it maps one unicode codepoint (one char in Rust) to its uppercase equivalent according
-/// to the Unicode database at ftp://ftp.unicode.org/Public/UNIDATA/UnicodeData.txt
-/// The additional SpecialCasing.txt is not considered here, as it expands to multiple
-/// codepoints in some cases.
-///
-/// A full reference can be found here
-/// http://www.unicode.org/versions/Unicode4.0.0/ch03.pdf#G33992
-///
-/// # Return value
-///
-/// Returns the char itself if no conversion was made
-#[inline]
-pub fn to_uppercase(c: char) -> char {
- conversions::to_upper(c)
-}
-
-/// Convert a char to its lowercase equivalent
-///
-/// The case-folding performed is the common or simple mapping
-/// see `to_uppercase` for references and more information
-///
-/// # Return value
-///
-/// Returns the char itself if no conversion if possible
-#[inline]
-pub fn to_lowercase(c: char) -> char {
- conversions::to_lower(c)
-}
-
-///
-/// Converts a number to the character representing it
-///
-/// # Return value
-///
-/// Returns `Some(char)` if `num` represents one digit under `radix`,
-/// using one character of `0-9` or `a-z`, or `None` if it doesn't.
-///
-/// # Failure
-///
-/// Fails if given an `radix` > 36.
-///
-#[inline]
-pub fn from_digit(num: uint, radix: uint) -> Option<char> {
- if radix > 36 {
- fail!("from_digit: radix {} is to high (maximum 36)", num);
- }
- if num < radix {
- unsafe {
- if num < 10 {
- Some(transmute(('0' as uint + num) as u32))
- } else {
- Some(transmute(('a' as uint + num - 10u) as u32))
- }
- }
- } else {
- None
- }
-}
-
-// Constants from Unicode 6.2.0 Section 3.12 Conjoining Jamo Behavior
-static S_BASE: uint = 0xAC00;
-static L_BASE: uint = 0x1100;
-static V_BASE: uint = 0x1161;
-static T_BASE: uint = 0x11A7;
-static L_COUNT: uint = 19;
-static V_COUNT: uint = 21;
-static T_COUNT: uint = 28;
-static N_COUNT: uint = (V_COUNT * T_COUNT);
-static S_COUNT: uint = (L_COUNT * N_COUNT);
-
-// Decompose a precomposed Hangul syllable
-fn decompose_hangul(s: char, f: |char|) {
- let si = s as uint - S_BASE;
-
- let li = si / N_COUNT;
- unsafe {
- f(transmute((L_BASE + li) as u32));
-
- let vi = (si % N_COUNT) / T_COUNT;
- f(transmute((V_BASE + vi) as u32));
-
- let ti = si % T_COUNT;
- if ti > 0 {
- f(transmute((T_BASE + ti) as u32));
- }
- }
-}
-
-/// Returns the canonical decomposition of a character
-pub fn decompose_canonical(c: char, f: |char|) {
- if (c as uint) < S_BASE || (c as uint) >= (S_BASE + S_COUNT) {
- decompose::canonical(c, f);
- } else {
- decompose_hangul(c, f);
- }
-}
-
-/// Returns the compatibility decomposition of a character
-pub fn decompose_compatible(c: char, f: |char|) {
- if (c as uint) < S_BASE || (c as uint) >= (S_BASE + S_COUNT) {
- decompose::compatibility(c, f);
- } else {
- decompose_hangul(c, f);
- }
-}
-
-///
-/// Returns the hexadecimal Unicode escape of a `char`
-///
-/// The rules are as follows:
-///
-/// - chars in [0,0xff] get 2-digit escapes: `\\xNN`
-/// - chars in [0x100,0xffff] get 4-digit escapes: `\\uNNNN`
-/// - chars above 0x10000 get 8-digit escapes: `\\UNNNNNNNN`
-///
-pub fn escape_unicode(c: char, f: |char|) {
- // avoid calling str::to_str_radix because we don't really need to allocate
- // here.
- f('\\');
- let pad = match () {
- _ if c <= '\xff' => { f('x'); 2 }
- _ if c <= '\uffff' => { f('u'); 4 }
- _ => { f('U'); 8 }
- };
- for offset in range_step::<i32>(4 * (pad - 1), -1, -4) {
- unsafe {
- match ((c as i32) >> offset) & 0xf {
- i @ 0 .. 9 => { f(transmute('0' as i32 + i)); }
- i => { f(transmute('a' as i32 + (i - 10))); }
- }
- }
- }
-}
-
-///
-/// Returns a 'default' ASCII and C++11-like literal escape of a `char`
-///
-/// The default is chosen with a bias toward producing literals that are
-/// legal in a variety of languages, including C++11 and similar C-family
-/// languages. The exact rules are:
-///
-/// - Tab, CR and LF are escaped as '\t', '\r' and '\n' respectively.
-/// - Single-quote, double-quote and backslash chars are backslash-escaped.
-/// - Any other chars in the range [0x20,0x7e] are not escaped.
-/// - Any other chars are given hex unicode escapes; see `escape_unicode`.
-///
-pub fn escape_default(c: char, f: |char|) {
- match c {
- '\t' => { f('\\'); f('t'); }
- '\r' => { f('\\'); f('r'); }
- '\n' => { f('\\'); f('n'); }
- '\\' => { f('\\'); f('\\'); }
- '\'' => { f('\\'); f('\''); }
- '"' => { f('\\'); f('"'); }
- '\x20' .. '\x7e' => { f(c); }
- _ => c.escape_unicode(f),
- }
-}
-
-/// Returns the amount of bytes this `char` would need if encoded in UTF-8
-pub fn len_utf8_bytes(c: char) -> uint {
- static MAX_ONE_B: uint = 128u;
- static MAX_TWO_B: uint = 2048u;
- static MAX_THREE_B: uint = 65536u;
- static MAX_FOUR_B: uint = 2097152u;
-
- let code = c as uint;
- match () {
- _ if code < MAX_ONE_B => 1u,
- _ if code < MAX_TWO_B => 2u,
- _ if code < MAX_THREE_B => 3u,
- _ if code < MAX_FOUR_B => 4u,
- _ => fail!("invalid character!"),
- }
-}
-
-/// Useful functions for Unicode characters.
-pub trait Char {
- /// Returns whether the specified character is considered a Unicode
- /// alphabetic code point.
- fn is_alphabetic(&self) -> bool;
-
- /// Returns whether the specified character satisfies the 'XID_Start'
- /// Unicode property.
- ///
- /// 'XID_Start' is a Unicode Derived Property specified in
- /// [UAX #31](http://unicode.org/reports/tr31/#NFKC_Modifications),
- /// mostly similar to ID_Start but modified for closure under NFKx.
- fn is_XID_start(&self) -> bool;
-
- /// Returns whether the specified `char` satisfies the 'XID_Continue'
- /// Unicode property.
- ///
- /// 'XID_Continue' is a Unicode Derived Property specified in
- /// [UAX #31](http://unicode.org/reports/tr31/#NFKC_Modifications),
- /// mostly similar to 'ID_Continue' but modified for closure under NFKx.
- fn is_XID_continue(&self) -> bool;
-
-
- /// Indicates whether a character is in lowercase.
- ///
- /// This is defined according to the terms of the Unicode Derived Core
- /// Property `Lowercase`.
- fn is_lowercase(&self) -> bool;
-
- /// Indicates whether a character is in uppercase.
- ///
- /// This is defined according to the terms of the Unicode Derived Core
- /// Property `Uppercase`.
- fn is_uppercase(&self) -> bool;
-
- /// Indicates whether a character is whitespace.
- ///
- /// Whitespace is defined in terms of the Unicode Property `White_Space`.
- fn is_whitespace(&self) -> bool;
-
- /// Indicates whether a character is alphanumeric.
- ///
- /// Alphanumericness is defined in terms of the Unicode General Categories
- /// 'Nd', 'Nl', 'No' and the Derived Core Property 'Alphabetic'.
- fn is_alphanumeric(&self) -> bool;
-
- /// Indicates whether a character is a control code point.
- ///
- /// Control code points are defined in terms of the Unicode General
- /// Category `Cc`.
- fn is_control(&self) -> bool;
-
- /// Indicates whether the character is numeric (Nd, Nl, or No).
- fn is_digit(&self) -> bool;
-
- /// Checks if a `char` parses as a numeric digit in the given radix.
- ///
- /// Compared to `is_digit()`, this function only recognizes the characters
- /// `0-9`, `a-z` and `A-Z`.
- ///
- /// # Return value
- ///
- /// Returns `true` if `c` is a valid digit under `radix`, and `false`
- /// otherwise.
- ///
- /// # Failure
- ///
- /// Fails if given a radix > 36.
- fn is_digit_radix(&self, radix: uint) -> bool;
-
- /// Converts a character to the corresponding digit.
- ///
- /// # Return value
- ///
- /// If `c` is between '0' and '9', the corresponding value between 0 and
- /// 9. If `c` is 'a' or 'A', 10. If `c` is 'b' or 'B', 11, etc. Returns
- /// none if the character does not refer to a digit in the given radix.
- ///
- /// # Failure
- ///
- /// Fails if given a radix outside the range [0..36].
- fn to_digit(&self, radix: uint) -> Option<uint>;
-
- /// Converts a character to its lowercase equivalent.
- ///
- /// The case-folding performed is the common or simple mapping. See
- /// `to_uppercase()` for references and more information.
- ///
- /// # Return value
- ///
- /// Returns the lowercase equivalent of the character, or the character
- /// itself if no conversion is possible.
- fn to_lowercase(&self) -> char;
-
- /// Converts a character to its uppercase equivalent.
- ///
- /// The case-folding performed is the common or simple mapping: it maps
- /// one unicode codepoint (one character in Rust) to its uppercase
- /// equivalent according to the Unicode database [1]. The additional
- /// `SpecialCasing.txt` is not considered here, as it expands to multiple
- /// codepoints in some cases.
- ///
- /// A full reference can be found here [2].
- ///
- /// # Return value
- ///
- /// Returns the uppercase equivalent of the character, or the character
- /// itself if no conversion was made.
- ///
- /// [1]: ftp://ftp.unicode.org/Public/UNIDATA/UnicodeData.txt
- ///
- /// [2]: http://www.unicode.org/versions/Unicode4.0.0/ch03.pdf#G33992
- fn to_uppercase(&self) -> char;
-
- /// Converts a number to the character representing it.
- ///
- /// # Return value
- ///
- /// Returns `Some(char)` if `num` represents one digit under `radix`,
- /// using one character of `0-9` or `a-z`, or `None` if it doesn't.
- ///
- /// # Failure
- ///
- /// Fails if given a radix > 36.
- fn from_digit(num: uint, radix: uint) -> Option<char>;
-
- /// Returns the hexadecimal Unicode escape of a character.
- ///
- /// The rules are as follows:
- ///
- /// * Characters in [0,0xff] get 2-digit escapes: `\\xNN`
- /// * Characters in [0x100,0xffff] get 4-digit escapes: `\\uNNNN`.
- /// * Characters above 0x10000 get 8-digit escapes: `\\UNNNNNNNN`.
- fn escape_unicode(&self, f: |char|);
-
- /// Returns a 'default' ASCII and C++11-like literal escape of a
- /// character.
- ///
- /// The default is chosen with a bias toward producing literals that are
- /// legal in a variety of languages, including C++11 and similar C-family
- /// languages. The exact rules are:
- ///
- /// * Tab, CR and LF are escaped as '\t', '\r' and '\n' respectively.
- /// * Single-quote, double-quote and backslash chars are backslash-
- /// escaped.
- /// * Any other chars in the range [0x20,0x7e] are not escaped.
- /// * Any other chars are given hex unicode escapes; see `escape_unicode`.
- fn escape_default(&self, f: |char|);
-
- /// Returns the amount of bytes this character would need if encoded in
- /// UTF-8.
- fn len_utf8_bytes(&self) -> uint;
-
- /// Encodes this character as UTF-8 into the provided byte buffer.
- ///
- /// The buffer must be at least 4 bytes long or a runtime failure may
- /// occur.
- ///
- /// This will then return the number of bytes written to the slice.
- fn encode_utf8(&self, dst: &mut [u8]) -> uint;
-
- /// Encodes this character as UTF-16 into the provided `u16` buffer.
- ///
- /// The buffer must be at least 2 elements long or a runtime failure may
- /// occur.
- ///
- /// This will then return the number of `u16`s written to the slice.
- fn encode_utf16(&self, dst: &mut [u16]) -> uint;
-}
-
-impl Char for char {
- fn is_alphabetic(&self) -> bool { is_alphabetic(*self) }
-
- fn is_XID_start(&self) -> bool { is_XID_start(*self) }
-
- fn is_XID_continue(&self) -> bool { is_XID_continue(*self) }
-
- fn is_lowercase(&self) -> bool { is_lowercase(*self) }
-
- fn is_uppercase(&self) -> bool { is_uppercase(*self) }
-
- fn is_whitespace(&self) -> bool { is_whitespace(*self) }
-
- fn is_alphanumeric(&self) -> bool { is_alphanumeric(*self) }
-
- fn is_control(&self) -> bool { is_control(*self) }
-
- fn is_digit(&self) -> bool { is_digit(*self) }
-
- fn is_digit_radix(&self, radix: uint) -> bool { is_digit_radix(*self, radix) }
-
- fn to_digit(&self, radix: uint) -> Option<uint> { to_digit(*self, radix) }
-
- fn to_lowercase(&self) -> char { to_lowercase(*self) }
-
- fn to_uppercase(&self) -> char { to_uppercase(*self) }
-
- fn from_digit(num: uint, radix: uint) -> Option<char> { from_digit(num, radix) }
-
- fn escape_unicode(&self, f: |char|) { escape_unicode(*self, f) }
-
- fn escape_default(&self, f: |char|) { escape_default(*self, f) }
-
- fn len_utf8_bytes(&self) -> uint { len_utf8_bytes(*self) }
-
- fn encode_utf8(&self, dst: &mut [u8]) -> uint {
- let code = *self as uint;
- if code < MAX_ONE_B {
- dst[0] = code as u8;
- return 1;
- } else if code < MAX_TWO_B {
- dst[0] = (code >> 6u & 31u | TAG_TWO_B) as u8;
- dst[1] = (code & 63u | TAG_CONT) as u8;
- return 2;
- } else if code < MAX_THREE_B {
- dst[0] = (code >> 12u & 15u | TAG_THREE_B) as u8;
- dst[1] = (code >> 6u & 63u | TAG_CONT) as u8;
- dst[2] = (code & 63u | TAG_CONT) as u8;
- return 3;
- } else {
- dst[0] = (code >> 18u & 7u | TAG_FOUR_B) as u8;
- dst[1] = (code >> 12u & 63u | TAG_CONT) as u8;
- dst[2] = (code >> 6u & 63u | TAG_CONT) as u8;
- dst[3] = (code & 63u | TAG_CONT) as u8;
- return 4;
- }
- }
-
- fn encode_utf16(&self, dst: &mut [u16]) -> uint {
- let mut ch = *self as uint;
- if (ch & 0xFFFF_u) == ch {
- // The BMP falls through (assuming non-surrogate, as it
- // should)
- assert!(ch <= 0xD7FF_u || ch >= 0xE000_u);
- dst[0] = ch as u16;
- 1
- } else {
- // Supplementary planes break into surrogates.
- assert!(ch >= 0x1_0000_u && ch <= 0x10_FFFF_u);
- ch -= 0x1_0000_u;
- dst[0] = 0xD800_u16 | ((ch >> 10) as u16);
- dst[1] = 0xDC00_u16 | ((ch as u16) & 0x3FF_u16);
- 2
- }
- }
-}
-
-#[cfg(not(test))]
-impl Eq for char {
- #[inline]
- fn eq(&self, other: &char) -> bool { (*self) == (*other) }
-}
-
-#[cfg(not(test))]
-impl Ord for char {
- #[inline]
- fn lt(&self, other: &char) -> bool { *self < *other }
-}
-
-#[cfg(not(test))]
-impl Default for char {
- #[inline]
- fn default() -> char { '\x00' }
-}
-
-#[test]
-fn test_is_lowercase() {
- assert!('a'.is_lowercase());
- assert!('ö'.is_lowercase());
- assert!('ß'.is_lowercase());
- assert!(!'Ü'.is_lowercase());
- assert!(!'P'.is_lowercase());
-}
-
-#[test]
-fn test_is_uppercase() {
- assert!(!'h'.is_uppercase());
- assert!(!'ä'.is_uppercase());
- assert!(!'ß'.is_uppercase());
- assert!('Ö'.is_uppercase());
- assert!('T'.is_uppercase());
-}
-
-#[test]
-fn test_is_whitespace() {
- assert!(' '.is_whitespace());
- assert!('\u2007'.is_whitespace());
- assert!('\t'.is_whitespace());
- assert!('\n'.is_whitespace());
- assert!(!'a'.is_whitespace());
- assert!(!'_'.is_whitespace());
- assert!(!'\u0000'.is_whitespace());
-}
-
-#[test]
-fn test_to_digit() {
- assert_eq!('0'.to_digit(10u), Some(0u));
- assert_eq!('1'.to_digit(2u), Some(1u));
- assert_eq!('2'.to_digit(3u), Some(2u));
- assert_eq!('9'.to_digit(10u), Some(9u));
- assert_eq!('a'.to_digit(16u), Some(10u));
- assert_eq!('A'.to_digit(16u), Some(10u));
- assert_eq!('b'.to_digit(16u), Some(11u));
- assert_eq!('B'.to_digit(16u), Some(11u));
- assert_eq!('z'.to_digit(36u), Some(35u));
- assert_eq!('Z'.to_digit(36u), Some(35u));
- assert_eq!(' '.to_digit(10u), None);
- assert_eq!('$'.to_digit(36u), None);
-}
-
-#[test]
-fn test_to_lowercase() {
- assert_eq!('A'.to_lowercase(), 'a');
- assert_eq!('Ö'.to_lowercase(), 'ö');
- assert_eq!('ß'.to_lowercase(), 'ß');
- assert_eq!('Ü'.to_lowercase(), 'ü');
- assert_eq!('💩'.to_lowercase(), '💩');
- assert_eq!('Σ'.to_lowercase(), 'σ');
- assert_eq!('Τ'.to_lowercase(), 'τ');
- assert_eq!('Ι'.to_lowercase(), 'ι');
- assert_eq!('Γ'.to_lowercase(), 'γ');
- assert_eq!('Μ'.to_lowercase(), 'μ');
- assert_eq!('Α'.to_lowercase(), 'α');
- assert_eq!('Σ'.to_lowercase(), 'σ');
-}
-
-#[test]
-fn test_to_uppercase() {
- assert_eq!('a'.to_uppercase(), 'A');
- assert_eq!('ö'.to_uppercase(), 'Ö');
- assert_eq!('ß'.to_uppercase(), 'ß'); // not ẞ: Latin capital letter sharp s
- assert_eq!('ü'.to_uppercase(), 'Ü');
- assert_eq!('💩'.to_uppercase(), '💩');
-
- assert_eq!('σ'.to_uppercase(), 'Σ');
- assert_eq!('τ'.to_uppercase(), 'Τ');
- assert_eq!('ι'.to_uppercase(), 'Ι');
- assert_eq!('γ'.to_uppercase(), 'Γ');
- assert_eq!('μ'.to_uppercase(), 'Μ');
- assert_eq!('α'.to_uppercase(), 'Α');
- assert_eq!('ς'.to_uppercase(), 'Σ');
-}
-
-#[test]
-fn test_is_control() {
- assert!('\u0000'.is_control());
- assert!('\u0003'.is_control());
- assert!('\u0006'.is_control());
- assert!('\u0009'.is_control());
- assert!('\u007f'.is_control());
- assert!('\u0092'.is_control());
- assert!(!'\u0020'.is_control());
- assert!(!'\u0055'.is_control());
- assert!(!'\u0068'.is_control());
-}
-
-#[test]
-fn test_is_digit() {
- assert!('2'.is_digit());
- assert!('7'.is_digit());
- assert!(!'c'.is_digit());
- assert!(!'i'.is_digit());
- assert!(!'z'.is_digit());
- assert!(!'Q'.is_digit());
-}
-
-#[test]
-fn test_escape_default() {
- fn string(c: char) -> ~str {
- let mut result = StrBuf::new();
- escape_default(c, |c| { result.push_char(c); });
- return result.into_owned();
- }
- assert_eq!(string('\n'), "\\n".to_owned());
- assert_eq!(string('\r'), "\\r".to_owned());
- assert_eq!(string('\''), "\\'".to_owned());
- assert_eq!(string('"'), "\\\"".to_owned());
- assert_eq!(string(' '), " ".to_owned());
- assert_eq!(string('a'), "a".to_owned());
- assert_eq!(string('~'), "~".to_owned());
- assert_eq!(string('\x00'), "\\x00".to_owned());
- assert_eq!(string('\x1f'), "\\x1f".to_owned());
- assert_eq!(string('\x7f'), "\\x7f".to_owned());
- assert_eq!(string('\xff'), "\\xff".to_owned());
- assert_eq!(string('\u011b'), "\\u011b".to_owned());
- assert_eq!(string('\U0001d4b6'), "\\U0001d4b6".to_owned());
-}
-
-#[test]
-fn test_escape_unicode() {
- fn string(c: char) -> ~str {
- let mut result = StrBuf::new();
- escape_unicode(c, |c| { result.push_char(c); });
- return result.into_owned();
- }
- assert_eq!(string('\x00'), "\\x00".to_owned());
- assert_eq!(string('\n'), "\\x0a".to_owned());
- assert_eq!(string(' '), "\\x20".to_owned());
- assert_eq!(string('a'), "\\x61".to_owned());
- assert_eq!(string('\u011b'), "\\u011b".to_owned());
- assert_eq!(string('\U0001d4b6'), "\\U0001d4b6".to_owned());
-}
-
-#[test]
-fn test_to_str() {
- use to_str::ToStr;
- let s = 't'.to_str();
- assert_eq!(s, "t".to_owned());
-}
-
-#[test]
-fn test_encode_utf8() {
- fn check(input: char, expect: &[u8]) {
- let mut buf = [0u8, ..4];
- let n = input.encode_utf8(buf /* as mut slice! */);
- assert_eq!(buf.slice_to(n), expect);
- }
-
- check('x', [0x78]);
- check('\u00e9', [0xc3, 0xa9]);
- check('\ua66e', [0xea, 0x99, 0xae]);
- check('\U0001f4a9', [0xf0, 0x9f, 0x92, 0xa9]);
-}
-
-#[test]
-fn test_encode_utf16() {
- fn check(input: char, expect: &[u16]) {
- let mut buf = [0u16, ..2];
- let n = input.encode_utf16(buf /* as mut slice! */);
- assert_eq!(buf.slice_to(n), expect);
- }
-
- check('x', [0x0078]);
- check('\u00e9', [0x00e9]);
- check('\ua66e', [0xa66e]);
- check('\U0001f4a9', [0xd83d, 0xdca9]);
-}
+++ /dev/null
-// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-/*! The `Clone` trait for types that cannot be 'implicitly copied'
-
-In Rust, some simple types are "implicitly copyable" and when you
-assign them or pass them as arguments, the receiver will get a copy,
-leaving the original value in place. These types do not require
-allocation to copy and do not have finalizers (i.e. they do not
-contain owned boxes or implement `Drop`), so the compiler considers
-them cheap and safe to copy. For other types copies must be made
-explicitly, by convention implementing the `Clone` trait and calling
-the `clone` method.
-
-*/
-
-use owned::Box;
-
-/// A common trait for cloning an object.
-pub trait Clone {
- /// Returns a copy of the value. The contents of owned pointers
- /// are copied to maintain uniqueness, while the contents of
- /// managed pointers are not copied.
- fn clone(&self) -> Self;
-
- /// Perform copy-assignment from `source`.
- ///
- /// `a.clone_from(&b)` is equivalent to `a = b.clone()` in functionality,
- /// but can be overridden to reuse the resources of `a` to avoid unnecessary
- /// allocations.
- #[inline(always)]
- fn clone_from(&mut self, source: &Self) {
- *self = source.clone()
- }
-}
-
-impl<T: Clone> Clone for Box<T> {
- /// Return a copy of the owned box.
- #[inline]
- fn clone(&self) -> Box<T> { box {(**self).clone()} }
-
- /// Perform copy-assignment from `source` by reusing the existing allocation.
- #[inline]
- fn clone_from(&mut self, source: &Box<T>) {
- (**self).clone_from(&(**source));
- }
-}
-
-impl<T> Clone for @T {
- /// Return a shallow copy of the managed box.
- #[inline]
- fn clone(&self) -> @T { *self }
-}
-
-impl<'a, T> Clone for &'a T {
- /// Return a shallow copy of the reference.
- #[inline]
- fn clone(&self) -> &'a T { *self }
-}
-
-impl<'a, T> Clone for &'a [T] {
- /// Return a shallow copy of the slice.
- #[inline]
- fn clone(&self) -> &'a [T] { *self }
-}
-
-impl<'a> Clone for &'a str {
- /// Return a shallow copy of the slice.
- #[inline]
- fn clone(&self) -> &'a str { *self }
-}
-
-macro_rules! clone_impl(
- ($t:ty) => {
- impl Clone for $t {
- /// Return a deep copy of the value.
- #[inline]
- fn clone(&self) -> $t { *self }
- }
- }
-)
-
-clone_impl!(int)
-clone_impl!(i8)
-clone_impl!(i16)
-clone_impl!(i32)
-clone_impl!(i64)
-
-clone_impl!(uint)
-clone_impl!(u8)
-clone_impl!(u16)
-clone_impl!(u32)
-clone_impl!(u64)
-
-clone_impl!(f32)
-clone_impl!(f64)
-
-clone_impl!(())
-clone_impl!(bool)
-clone_impl!(char)
-
-macro_rules! extern_fn_clone(
- ($($A:ident),*) => (
- impl<$($A,)* ReturnType> Clone for extern "Rust" fn($($A),*) -> ReturnType {
- /// Return a copy of a function pointer
- #[inline]
- fn clone(&self) -> extern "Rust" fn($($A),*) -> ReturnType { *self }
- }
- )
-)
-
-extern_fn_clone!()
-extern_fn_clone!(A)
-extern_fn_clone!(A, B)
-extern_fn_clone!(A, B, C)
-extern_fn_clone!(A, B, C, D)
-extern_fn_clone!(A, B, C, D, E)
-extern_fn_clone!(A, B, C, D, E, F)
-extern_fn_clone!(A, B, C, D, E, F, G)
-extern_fn_clone!(A, B, C, D, E, F, G, H)
-
-#[test]
-fn test_owned_clone() {
- let a = box 5i;
- let b: Box<int> = a.clone();
- assert_eq!(a, b);
-}
-
-#[test]
-fn test_managed_clone() {
- let a = @5i;
- let b: @int = a.clone();
- assert_eq!(a, b);
-}
-
-#[test]
-fn test_borrowed_clone() {
- let x = 5i;
- let y: &int = &x;
- let z: &int = (&y).clone();
- assert_eq!(*z, 5);
-}
-
-#[test]
-fn test_clone_from() {
- let a = box 5;
- let mut b = box 10;
- b.clone_from(&a);
- assert_eq!(*b, 5);
-}
-
-#[test]
-fn test_extern_fn_clone() {
- trait Empty {}
- impl Empty for int {}
-
- fn test_fn_a() -> f64 { 1.0 }
- fn test_fn_b<T: Empty>(x: T) -> T { x }
- fn test_fn_c(_: int, _: f64, _: ~[int], _: int, _: int, _: int) {}
-
- let _ = test_fn_a.clone();
- let _ = test_fn_b::<int>.clone();
- let _ = test_fn_c.clone();
-}
+++ /dev/null
-// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-//! Defines the `Ord` and `Eq` comparison traits.
-//!
-//! This module defines both `Ord` and `Eq` traits which are used by the
-//! compiler to implement comparison operators. Rust programs may implement
-//!`Ord` to overload the `<`, `<=`, `>`, and `>=` operators, and may implement
-//! `Eq` to overload the `==` and `!=` operators.
-//!
-//! For example, to define a type with a customized definition for the Eq
-//! operators, you could do the following:
-//!
-//! ```rust
-//! // Our type.
-//! struct SketchyNum {
-//! num : int
-//! }
-//!
-//! // Our implementation of `Eq` to support `==` and `!=`.
-//! impl Eq for SketchyNum {
-//! // Our custom eq allows numbers which are near each other to be equal! :D
-//! fn eq(&self, other: &SketchyNum) -> bool {
-//! (self.num - other.num).abs() < 5
-//! }
-//! }
-//!
-//! // Now these binary operators will work when applied!
-//! assert!(SketchyNum {num: 37} == SketchyNum {num: 34});
-//! assert!(SketchyNum {num: 25} != SketchyNum {num: 57});
-//! ```
-
-/// Trait for values that can be compared for equality and inequality.
-///
-/// This trait allows partial equality, where types can be unordered instead of
-/// strictly equal or unequal. For example, with the built-in floating-point
-/// types `a == b` and `a != b` will both evaluate to false if either `a` or
-/// `b` is NaN (cf. IEEE 754-2008 section 5.11).
-///
-/// Eq only requires the `eq` method to be implemented; `ne` is its negation by
-/// default.
-///
-/// Eventually, this will be implemented by default for types that implement
-/// `TotalEq`.
-#[lang="eq"]
-pub trait Eq {
- /// This method tests for `self` and `other` values to be equal, and is used by `==`.
- fn eq(&self, other: &Self) -> bool;
-
- /// This method tests for `!=`.
- #[inline]
- fn ne(&self, other: &Self) -> bool { !self.eq(other) }
-}
-
-/// Trait for equality comparisons which are [equivalence relations](
-/// https://en.wikipedia.org/wiki/Equivalence_relation).
-///
-/// This means, that in addition to `a == b` and `a != b` being strict
-/// inverses, the equality must be (for all `a`, `b` and `c`):
-///
-/// - reflexive: `a == a`;
-/// - symmetric: `a == b` implies `b == a`; and
-/// - transitive: `a == b` and `b == c` implies `a == c`.
-pub trait TotalEq: Eq {
- // FIXME #13101: this method is used solely by #[deriving] to
- // assert that every component of a type implements #[deriving]
- // itself, the current deriving infrastructure means doing this
- // assertion without using a method on this trait is nearly
- // impossible.
- //
- // This should never be implemented by hand.
- #[doc(hidden)]
- #[inline(always)]
- fn assert_receiver_is_total_eq(&self) {}
-}
-
-/// A macro which defines an implementation of TotalEq for a given type.
-macro_rules! totaleq_impl(
- ($t:ty) => {
- impl TotalEq for $t {}
- }
-)
-
-totaleq_impl!(bool)
-
-totaleq_impl!(u8)
-totaleq_impl!(u16)
-totaleq_impl!(u32)
-totaleq_impl!(u64)
-
-totaleq_impl!(i8)
-totaleq_impl!(i16)
-totaleq_impl!(i32)
-totaleq_impl!(i64)
-
-totaleq_impl!(int)
-totaleq_impl!(uint)
-
-totaleq_impl!(char)
-
-/// An ordering is, e.g, a result of a comparison between two values.
-#[deriving(Clone, Eq, Show)]
-pub enum Ordering {
- /// An ordering where a compared value is less [than another].
- Less = -1,
- /// An ordering where a compared value is equal [to another].
- Equal = 0,
- /// An ordering where a compared value is greater [than another].
- Greater = 1
-}
-
-/// Trait for types that form a [total order](
-/// https://en.wikipedia.org/wiki/Total_order).
-///
-/// An order is a total order if it is (for all `a`, `b` and `c`):
-///
-/// - total and antisymmetric: exactly one of `a < b`, `a == b` or `a > b` is
-/// true; and
-/// - transitive, `a < b` and `b < c` implies `a < c`. The same must hold for
-/// both `==` and `>`.
-pub trait TotalOrd: TotalEq + Ord {
- /// This method returns an ordering between `self` and `other` values.
- ///
- /// By convention, `self.cmp(&other)` returns the ordering matching
- /// the expression `self <operator> other` if true. For example:
- ///
- /// ```
- /// assert_eq!( 5u.cmp(&10), Less); // because 5 < 10
- /// assert_eq!(10u.cmp(&5), Greater); // because 10 > 5
- /// assert_eq!( 5u.cmp(&5), Equal); // because 5 == 5
- /// ```
- fn cmp(&self, other: &Self) -> Ordering;
-}
-
-impl TotalEq for Ordering {}
-impl TotalOrd for Ordering {
- #[inline]
- fn cmp(&self, other: &Ordering) -> Ordering {
- (*self as int).cmp(&(*other as int))
- }
-}
-
-impl Ord for Ordering {
- #[inline]
- fn lt(&self, other: &Ordering) -> bool { (*self as int) < (*other as int) }
-}
-
-/// A macro which defines an implementation of TotalOrd for a given type.
-macro_rules! totalord_impl(
- ($t:ty) => {
- impl TotalOrd for $t {
- #[inline]
- fn cmp(&self, other: &$t) -> Ordering {
- if *self < *other { Less }
- else if *self > *other { Greater }
- else { Equal }
- }
- }
- }
-)
-
-totalord_impl!(u8)
-totalord_impl!(u16)
-totalord_impl!(u32)
-totalord_impl!(u64)
-
-totalord_impl!(i8)
-totalord_impl!(i16)
-totalord_impl!(i32)
-totalord_impl!(i64)
-
-totalord_impl!(int)
-totalord_impl!(uint)
-
-totalord_impl!(char)
-
-/// Combine orderings, lexically.
-///
-/// For example for a type `(int, int)`, two comparisons could be done.
-/// If the first ordering is different, the first ordering is all that must be returned.
-/// If the first ordering is equal, then second ordering is returned.
-#[inline]
-pub fn lexical_ordering(o1: Ordering, o2: Ordering) -> Ordering {
- match o1 {
- Equal => o2,
- _ => o1
- }
-}
-
-/// Trait for values that can be compared for a sort-order.
-///
-/// Ord only requires implementation of the `lt` method,
-/// with the others generated from default implementations.
-///
-/// However it remains possible to implement the others separately,
-/// for compatibility with floating-point NaN semantics
-/// (cf. IEEE 754-2008 section 5.11).
-#[lang="ord"]
-pub trait Ord: Eq {
- /// This method tests less than (for `self` and `other`) and is used by the `<` operator.
- fn lt(&self, other: &Self) -> bool;
-
- /// This method tests less than or equal to (`<=`).
- #[inline]
- fn le(&self, other: &Self) -> bool { !other.lt(self) }
-
- /// This method tests greater than (`>`).
- #[inline]
- fn gt(&self, other: &Self) -> bool { other.lt(self) }
-
- /// This method tests greater than or equal to (`>=`).
- #[inline]
- fn ge(&self, other: &Self) -> bool { !self.lt(other) }
-}
-
-/// The equivalence relation. Two values may be equivalent even if they are
-/// of different types. The most common use case for this relation is
-/// container types; e.g. it is often desirable to be able to use `&str`
-/// values to look up entries in a container with `~str` keys.
-pub trait Equiv<T> {
- /// Implement this function to decide equivalent values.
- fn equiv(&self, other: &T) -> bool;
-}
-
-/// Compare and return the minimum of two values.
-#[inline]
-pub fn min<T: TotalOrd>(v1: T, v2: T) -> T {
- if v1 < v2 { v1 } else { v2 }
-}
-
-/// Compare and return the maximum of two values.
-#[inline]
-pub fn max<T: TotalOrd>(v1: T, v2: T) -> T {
- if v1 > v2 { v1 } else { v2 }
-}
-
-#[cfg(test)]
-mod test {
- use super::lexical_ordering;
-
- #[test]
- fn test_int_totalord() {
- assert_eq!(5u.cmp(&10), Less);
- assert_eq!(10u.cmp(&5), Greater);
- assert_eq!(5u.cmp(&5), Equal);
- assert_eq!((-5u).cmp(&12), Less);
- assert_eq!(12u.cmp(-5), Greater);
- }
-
- #[test]
- fn test_ordering_order() {
- assert!(Less < Equal);
- assert_eq!(Greater.cmp(&Less), Greater);
- }
-
- #[test]
- fn test_lexical_ordering() {
- fn t(o1: Ordering, o2: Ordering, e: Ordering) {
- assert_eq!(lexical_ordering(o1, o2), e);
- }
-
- let xs = [Less, Equal, Greater];
- for &o in xs.iter() {
- t(Less, o, Less);
- t(Equal, o, o);
- t(Greater, o, Greater);
- }
- }
-
- #[test]
- fn test_user_defined_eq() {
- // Our type.
- struct SketchyNum {
- num : int
- }
-
- // Our implementation of `Eq` to support `==` and `!=`.
- impl Eq for SketchyNum {
- // Our custom eq allows numbers which are near each other to be equal! :D
- fn eq(&self, other: &SketchyNum) -> bool {
- (self.num - other.num).abs() < 5
- }
- }
-
- // Now these binary operators will work when applied!
- assert!(SketchyNum {num: 37} == SketchyNum {num: 34});
- assert!(SketchyNum {num: 25} != SketchyNum {num: 57});
- }
-}
use native;
use os;
- use owned::Box;
use super::*;
pub fn stress_factor() -> uint {
mod sync_tests {
use prelude::*;
use os;
- use owned::Box;
pub fn stress_factor() -> uint {
match os::getenv("RUST_TEST_STRESS") {
+++ /dev/null
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-//! Traits for generic containers (including `Map` and `Set`)
-
-use option::Option;
-
-/// A trait to represent the abstract idea of a container. The only concrete
-/// knowledge known is the number of elements contained within.
-pub trait Container {
- /// Return the number of elements in the container
- fn len(&self) -> uint;
-
- /// Return true if the container contains no elements
- #[inline]
- fn is_empty(&self) -> bool {
- self.len() == 0
- }
-}
-
-/// A trait to represent mutable containers
-pub trait Mutable: Container {
- /// Clear the container, removing all values.
- fn clear(&mut self);
-}
-
-/// A map is a key-value store where values may be looked up by their keys. This
-/// trait provides basic operations to operate on these stores.
-pub trait Map<K, V>: Container {
- /// Return a reference to the value corresponding to the key
- fn find<'a>(&'a self, key: &K) -> Option<&'a V>;
-
- /// Return true if the map contains a value for the specified key
- #[inline]
- fn contains_key(&self, key: &K) -> bool {
- self.find(key).is_some()
- }
-}
-
-/// This trait provides basic operations to modify the contents of a map.
-pub trait MutableMap<K, V>: Map<K, V> + Mutable {
- /// Insert a key-value pair into the map. An existing value for a
- /// key is replaced by the new value. Return true if the key did
- /// not already exist in the map.
- #[inline]
- fn insert(&mut self, key: K, value: V) -> bool {
- self.swap(key, value).is_none()
- }
-
- /// Remove a key-value pair from the map. Return true if the key
- /// was present in the map, otherwise false.
- #[inline]
- fn remove(&mut self, key: &K) -> bool {
- self.pop(key).is_some()
- }
-
- /// Insert a key-value pair from the map. If the key already had a value
- /// present in the map, that value is returned. Otherwise None is returned.
- fn swap(&mut self, k: K, v: V) -> Option<V>;
-
- /// Removes a key from the map, returning the value at the key if the key
- /// was previously in the map.
- fn pop(&mut self, k: &K) -> Option<V>;
-
- /// Return a mutable reference to the value corresponding to the key
- fn find_mut<'a>(&'a mut self, key: &K) -> Option<&'a mut V>;
-}
-
-/// A set is a group of objects which are each distinct from one another. This
-/// trait represents actions which can be performed on sets to iterate over
-/// them.
-pub trait Set<T>: Container {
- /// Return true if the set contains a value
- fn contains(&self, value: &T) -> bool;
-
- /// Return true if the set has no elements in common with `other`.
- /// This is equivalent to checking for an empty intersection.
- fn is_disjoint(&self, other: &Self) -> bool;
-
- /// Return true if the set is a subset of another
- fn is_subset(&self, other: &Self) -> bool;
-
- /// Return true if the set is a superset of another
- fn is_superset(&self, other: &Self) -> bool {
- other.is_subset(self)
- }
-
- // FIXME #8154: Add difference, sym. difference, intersection and union iterators
-}
-
-/// This trait represents actions which can be performed on sets to mutate
-/// them.
-pub trait MutableSet<T>: Set<T> + Mutable {
- /// Add a value to the set. Return true if the value was not already
- /// present in the set.
- fn insert(&mut self, value: T) -> bool;
-
- /// Remove a value from the set. Return true if the value was
- /// present in the set.
- fn remove(&mut self, value: &T) -> bool;
-}
+++ /dev/null
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-//! The `Default` trait for types which may have meaningful default values
-
-use owned::Box;
-
-/// A trait that types which have a useful default value should implement.
-pub trait Default {
- /// Return the "default value" for a type.
- fn default() -> Self;
-}
-
-impl<T: Default + 'static> Default for @T {
- fn default() -> @T { @Default::default() }
-}
-
-impl<T: Default> Default for Box<T> {
- fn default() -> Box<T> { box Default::default() }
-}
use any;
use cast;
+use cell::Cell;
use char::Char;
+use cmp;
use container::Container;
use io::MemWriter;
use io;
+use iter;
use iter::{Iterator, range};
+use kinds::Copy;
use num::Signed;
-use option::{Option,Some,None};
+use option::{Option, Some, None};
use owned::Box;
use repr;
-use result::{Ok, Err};
-use str::StrSlice;
+use result::{Ok, Err, ResultUnwrap};
+use str::{StrSlice, StrAllocating, UTF16Item, ScalarValue, LoneSurrogate};
use str;
use slice::{Vector, ImmutableVector};
use slice;
+use intrinsics::TypeId;
pub use self::num::radix;
pub use self::num::Radix;
fn fmt(&self, f: &mut Formatter) -> Result { secret_pointer(self, f) }
}
+macro_rules! peel(($name:ident, $($other:ident,)*) => (tuple!($($other,)*)))
+
+macro_rules! tuple (
+ () => ();
+ ( $($name:ident,)+ ) => (
+ impl<$($name:Show),*> Show for ($($name,)*) {
+ #[allow(uppercase_variables, dead_assignment)]
+ fn fmt(&self, f: &mut Formatter) -> Result {
+ try!(write!(f.buf, "("));
+ let ($(ref $name,)*) = *self;
+ let mut n = 0;
+ $(
+ if n > 0 {
+ try!(write!(f.buf, ", "));
+ }
+ try!(write!(f.buf, "{}", *$name));
+ n += 1;
+ )*
+ if n == 1 {
+ try!(write!(f.buf, ","));
+ }
+ write!(f.buf, ")")
+ }
+ }
+ peel!($($name,)*)
+ )
+)
+
+tuple! { T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, }
+
+impl Show for Box<any::Any> {
+ fn fmt(&self, f: &mut Formatter) -> Result { f.pad("Box<Any>") }
+}
+
+impl<'a> Show for &'a any::Any {
+ fn fmt(&self, f: &mut Formatter) -> Result { f.pad("&Any") }
+}
+
+impl<T: Show> Show for Option<T> {
+ fn fmt(&self, f: &mut Formatter) -> Result {
+ match *self {
+ Some(ref t) => write!(f.buf, "Some({})", *t),
+ None => write!(f.buf, "None"),
+ }
+ }
+}
+
+impl<T: Show, U: Show> Show for ::result::Result<T, U> {
+ fn fmt(&self, f: &mut Formatter) -> Result {
+ match *self {
+ Ok(ref t) => write!(f.buf, "Ok({})", *t),
+ Err(ref t) => write!(f.buf, "Err({})", *t),
+ }
+ }
+}
+
+impl<'a, T: Show> Show for &'a [T] {
+ fn fmt(&self, f: &mut Formatter) -> Result {
+ if f.flags & (1 << (parse::FlagAlternate as uint)) == 0 {
+ try!(write!(f.buf, "["));
+ }
+ let mut is_first = true;
+ for x in self.iter() {
+ if is_first {
+ is_first = false;
+ } else {
+ try!(write!(f.buf, ", "));
+ }
+ try!(write!(f.buf, "{}", *x))
+ }
+ if f.flags & (1 << (parse::FlagAlternate as uint)) == 0 {
+ try!(write!(f.buf, "]"));
+ }
+ Ok(())
+ }
+}
+
+impl<'a, T: Show> Show for &'a mut [T] {
+ fn fmt(&self, f: &mut Formatter) -> Result {
+ secret_show(&self.as_slice(), f)
+ }
+}
+
+impl<T: Show> Show for ~[T] {
+ fn fmt(&self, f: &mut Formatter) -> Result {
+ secret_show(&self.as_slice(), f)
+ }
+}
+
+impl Show for () {
+ fn fmt(&self, f: &mut Formatter) -> Result {
+ f.pad("()")
+ }
+}
+
+impl Show for TypeId {
+ fn fmt(&self, f: &mut Formatter) -> Result {
+ write!(f.buf, "TypeId \\{ {} \\}", self.hash())
+ }
+}
+
+impl<T: Show> Show for iter::MinMaxResult<T> {
+ fn fmt(&self, f: &mut Formatter) -> Result {
+ match *self {
+ iter::NoElements =>
+ write!(f.buf, "NoElements"),
+ iter::OneElement(ref t) =>
+ write!(f.buf, "OneElement({})", *t),
+ iter::MinMax(ref t1, ref t2) =>
+ write!(f.buf, "MinMax({}, {})", *t1, *t2),
+ }
+ }
+}
+
+impl Show for cmp::Ordering {
+ fn fmt(&self, f: &mut Formatter) -> Result {
+ match *self {
+ cmp::Less => write!(f.buf, "Less"),
+ cmp::Greater => write!(f.buf, "Greater"),
+ cmp::Equal => write!(f.buf, "Equal"),
+ }
+ }
+}
+
+impl<T: Copy + Show> Show for Cell<T> {
+ fn fmt(&self, f: &mut Formatter) -> Result {
+ write!(f.buf, r"Cell \{ value: {} \}", self.get())
+ }
+}
+
+impl Show for UTF16Item {
+ fn fmt(&self, f: &mut Formatter) -> Result {
+ match *self {
+ ScalarValue(c) => write!(f.buf, "ScalarValue({})", c),
+ LoneSurrogate(u) => write!(f.buf, "LoneSurrogate({})", u),
+ }
+ }
+}
+
// If you expected tests to be here, look instead at the run-pass/ifmt.rs test,
// it's a lot easier than creating all of the rt::Piece structures here.
use fmt::radix;
use super::{Binary, Octal, Decimal, LowerHex, UpperHex};
use super::{GenericRadix, Radix};
- use str::StrSlice;
+ use str::StrAllocating;
#[test]
fn test_radix_base() {
use super::test::Bencher;
use fmt::radix;
use rand::{XorShiftRng, Rng};
+ use realstd::result::ResultUnwrap;
#[bench]
fn format_bin(b: &mut Bencher) {
use super::test::Bencher;
use fmt::radix;
use rand::{XorShiftRng, Rng};
+ use realstd::result::ResultUnwrap;
#[bench]
fn format_bin(b: &mut Bencher) {
//! The `FromStr` trait for types that can be created from strings
-use option::Option;
+use option::{Option, Some, None};
/// A trait to abstract the idea of creating a new instance of a type from a
/// string.
pub fn from_str<A: FromStr>(s: &str) -> Option<A> {
FromStr::from_str(s)
}
+
+impl FromStr for bool {
+ /// Parse a `bool` from a string.
+ ///
+ /// Yields an `Option<bool>`, because `s` may or may not actually be parseable.
+ ///
+ /// # Examples
+ ///
+ /// ```rust
+ /// assert_eq!(from_str::<bool>("true"), Some(true));
+ /// assert_eq!(from_str::<bool>("false"), Some(false));
+ /// assert_eq!(from_str::<bool>("not even a boolean"), None);
+ /// ```
+ #[inline]
+ fn from_str(s: &str) -> Option<bool> {
+ match s {
+ "true" => Some(true),
+ "false" => Some(false),
+ _ => None,
+ }
+ }
+}
+
+#[cfg(test)]
+mod test {
+ use prelude::*;
+
+ #[test]
+ fn test_bool_from_str() {
+ assert_eq!(from_str::<bool>("true"), Some(true));
+ assert_eq!(from_str::<bool>("false"), Some(false));
+ assert_eq!(from_str::<bool>("not even a boolean"), None);
+ }
+}
use kinds::marker;
use clone::Clone;
-use managed;
/// Immutable garbage-collected pointer type
#[lang="gc"]
/// Determine if two garbage-collected boxes point to the same object
#[inline]
pub fn ptr_eq(&self, other: &Gc<T>) -> bool {
- managed::ptr_eq(self.ptr, other.ptr)
+ self.borrow() as *T == other.borrow() as *T
}
}
#![allow(unused_must_use)]
use container::Container;
+use intrinsics::TypeId;
use io::Writer;
use iter::Iterator;
use option::{Option, Some, None};
use owned::Box;
use rc::Rc;
-use str::{Str, StrSlice};
+use result::{Result, Ok, Err};
use slice::{Vector, ImmutableVector};
+use str::{Str, StrSlice};
use vec::Vec;
/// Reexport the `sip::hash` function as our default hasher.
}
}
+impl<S: Writer> Hash<S> for TypeId {
+ #[inline]
+ fn hash(&self, state: &mut S) {
+ self.hash().hash(state)
+ }
+}
+
+impl<S: Writer, T: Hash<S>, U: Hash<S>> Hash<S> for Result<T, U> {
+ #[inline]
+ fn hash(&self, state: &mut S) {
+ match *self {
+ Ok(ref t) => { 1u.hash(state); t.hash(state); }
+ Err(ref t) => { 2u.hash(state); t.hash(state); }
+ }
+ }
+}
+
//////////////////////////////////////////////////////////////////////////////
#[cfg(test)]
use prelude::*;
use num::ToStrRadix;
use option::{Some, None};
- use str::{Str,StrSlice};
+ use str::Str;
use strbuf::StrBuf;
use slice::{Vector, ImmutableVector};
use self::test::Bencher;
+++ /dev/null
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-/*! rustc compiler intrinsics.
-
-The corresponding definitions are in librustc/middle/trans/foreign.rs.
-
-# Volatiles
-
-The volatile intrinsics provide operations intended to act on I/O
-memory, which are guaranteed to not be reordered by the compiler
-across other volatile intrinsics. See the LLVM documentation on
-[[volatile]].
-
-[volatile]: http://llvm.org/docs/LangRef.html#volatile-memory-accesses
-
-# Atomics
-
-The atomic intrinsics provide common atomic operations on machine
-words, with multiple possible memory orderings. They obey the same
-semantics as C++11. See the LLVM documentation on [[atomics]].
-
-[atomics]: http://llvm.org/docs/Atomics.html
-
-A quick refresher on memory ordering:
-
-* Acquire - a barrier for acquiring a lock. Subsequent reads and writes
- take place after the barrier.
-* Release - a barrier for releasing a lock. Preceding reads and writes
- take place before the barrier.
-* Sequentially consistent - sequentially consistent operations are
- guaranteed to happen in order. This is the standard mode for working
- with atomic types and is equivalent to Java's `volatile`.
-
-*/
-
-#![allow(missing_doc)]
-
-// This is needed to prevent duplicate lang item definitions.
-#[cfg(test)]
-pub use realstd::intrinsics::{TyDesc, Opaque, TyVisitor, TypeId};
-
-pub type GlueFn = extern "Rust" fn(*i8);
-
-#[lang="ty_desc"]
-#[cfg(not(test))]
-pub struct TyDesc {
- // sizeof(T)
- pub size: uint,
-
- // alignof(T)
- pub align: uint,
-
- // Called when a value of type `T` is no longer needed
- pub drop_glue: GlueFn,
-
- // Called by reflection visitor to visit a value of type `T`
- pub visit_glue: GlueFn,
-
- // Name corresponding to the type
- pub name: &'static str,
-}
-
-#[lang="opaque"]
-#[cfg(not(test))]
-pub enum Opaque { }
-
-pub type Disr = u64;
-
-#[lang="ty_visitor"]
-#[cfg(not(test))]
-pub trait TyVisitor {
- fn visit_bot(&mut self) -> bool;
- fn visit_nil(&mut self) -> bool;
- fn visit_bool(&mut self) -> bool;
-
- fn visit_int(&mut self) -> bool;
- fn visit_i8(&mut self) -> bool;
- fn visit_i16(&mut self) -> bool;
- fn visit_i32(&mut self) -> bool;
- fn visit_i64(&mut self) -> bool;
-
- fn visit_uint(&mut self) -> bool;
- fn visit_u8(&mut self) -> bool;
- fn visit_u16(&mut self) -> bool;
- fn visit_u32(&mut self) -> bool;
- fn visit_u64(&mut self) -> bool;
-
- fn visit_f32(&mut self) -> bool;
- fn visit_f64(&mut self) -> bool;
- fn visit_f128(&mut self) -> bool;
-
- fn visit_char(&mut self) -> bool;
-
- fn visit_estr_box(&mut self) -> bool;
- fn visit_estr_uniq(&mut self) -> bool;
- fn visit_estr_slice(&mut self) -> bool;
- fn visit_estr_fixed(&mut self, n: uint, sz: uint, align: uint) -> bool;
-
- fn visit_box(&mut self, mtbl: uint, inner: *TyDesc) -> bool;
- fn visit_uniq(&mut self, mtbl: uint, inner: *TyDesc) -> bool;
- fn visit_ptr(&mut self, mtbl: uint, inner: *TyDesc) -> bool;
- fn visit_rptr(&mut self, mtbl: uint, inner: *TyDesc) -> bool;
-
- fn visit_evec_box(&mut self, mtbl: uint, inner: *TyDesc) -> bool;
- fn visit_evec_uniq(&mut self, mtbl: uint, inner: *TyDesc) -> bool;
- fn visit_evec_slice(&mut self, mtbl: uint, inner: *TyDesc) -> bool;
- fn visit_evec_fixed(&mut self, n: uint, sz: uint, align: uint,
- mtbl: uint, inner: *TyDesc) -> bool;
-
- fn visit_enter_rec(&mut self, n_fields: uint,
- sz: uint, align: uint) -> bool;
- fn visit_rec_field(&mut self, i: uint, name: &str,
- mtbl: uint, inner: *TyDesc) -> bool;
- fn visit_leave_rec(&mut self, n_fields: uint,
- sz: uint, align: uint) -> bool;
-
- fn visit_enter_class(&mut self, name: &str, named_fields: bool, n_fields: uint,
- sz: uint, align: uint) -> bool;
- fn visit_class_field(&mut self, i: uint, name: &str, named: bool,
- mtbl: uint, inner: *TyDesc) -> bool;
- fn visit_leave_class(&mut self, name: &str, named_fields: bool, n_fields: uint,
- sz: uint, align: uint) -> bool;
-
- fn visit_enter_tup(&mut self, n_fields: uint,
- sz: uint, align: uint) -> bool;
- fn visit_tup_field(&mut self, i: uint, inner: *TyDesc) -> bool;
- fn visit_leave_tup(&mut self, n_fields: uint,
- sz: uint, align: uint) -> bool;
-
- fn visit_enter_enum(&mut self, n_variants: uint,
- get_disr: extern unsafe fn(ptr: *Opaque) -> Disr,
- sz: uint, align: uint) -> bool;
- fn visit_enter_enum_variant(&mut self, variant: uint,
- disr_val: Disr,
- n_fields: uint,
- name: &str) -> bool;
- fn visit_enum_variant_field(&mut self, i: uint, offset: uint, inner: *TyDesc) -> bool;
- fn visit_leave_enum_variant(&mut self, variant: uint,
- disr_val: Disr,
- n_fields: uint,
- name: &str) -> bool;
- fn visit_leave_enum(&mut self, n_variants: uint,
- get_disr: extern unsafe fn(ptr: *Opaque) -> Disr,
- sz: uint, align: uint) -> bool;
-
- fn visit_enter_fn(&mut self, purity: uint, proto: uint,
- n_inputs: uint, retstyle: uint) -> bool;
- fn visit_fn_input(&mut self, i: uint, mode: uint, inner: *TyDesc) -> bool;
- fn visit_fn_output(&mut self, retstyle: uint, variadic: bool, inner: *TyDesc) -> bool;
- fn visit_leave_fn(&mut self, purity: uint, proto: uint,
- n_inputs: uint, retstyle: uint) -> bool;
-
- fn visit_trait(&mut self, name: &str) -> bool;
- fn visit_param(&mut self, i: uint) -> bool;
- fn visit_self(&mut self) -> bool;
-}
-
-extern "rust-intrinsic" {
-
- // NB: These intrinsics take unsafe pointers because they mutate aliased
- // memory, which is not valid for either `&` or `&mut`.
-
- pub fn atomic_cxchg<T>(dst: *mut T, old: T, src: T) -> T;
- pub fn atomic_cxchg_acq<T>(dst: *mut T, old: T, src: T) -> T;
- pub fn atomic_cxchg_rel<T>(dst: *mut T, old: T, src: T) -> T;
- pub fn atomic_cxchg_acqrel<T>(dst: *mut T, old: T, src: T) -> T;
- pub fn atomic_cxchg_relaxed<T>(dst: *mut T, old: T, src: T) -> T;
-
- pub fn atomic_load<T>(src: *T) -> T;
- pub fn atomic_load_acq<T>(src: *T) -> T;
- pub fn atomic_load_relaxed<T>(src: *T) -> T;
-
- pub fn atomic_store<T>(dst: *mut T, val: T);
- pub fn atomic_store_rel<T>(dst: *mut T, val: T);
- pub fn atomic_store_relaxed<T>(dst: *mut T, val: T);
-
- pub fn atomic_xchg<T>(dst: *mut T, src: T) -> T;
- pub fn atomic_xchg_acq<T>(dst: *mut T, src: T) -> T;
- pub fn atomic_xchg_rel<T>(dst: *mut T, src: T) -> T;
- pub fn atomic_xchg_acqrel<T>(dst: *mut T, src: T) -> T;
- pub fn atomic_xchg_relaxed<T>(dst: *mut T, src: T) -> T;
-
- pub fn atomic_xadd<T>(dst: *mut T, src: T) -> T;
- pub fn atomic_xadd_acq<T>(dst: *mut T, src: T) -> T;
- pub fn atomic_xadd_rel<T>(dst: *mut T, src: T) -> T;
- pub fn atomic_xadd_acqrel<T>(dst: *mut T, src: T) -> T;
- pub fn atomic_xadd_relaxed<T>(dst: *mut T, src: T) -> T;
-
- pub fn atomic_xsub<T>(dst: *mut T, src: T) -> T;
- pub fn atomic_xsub_acq<T>(dst: *mut T, src: T) -> T;
- pub fn atomic_xsub_rel<T>(dst: *mut T, src: T) -> T;
- pub fn atomic_xsub_acqrel<T>(dst: *mut T, src: T) -> T;
- pub fn atomic_xsub_relaxed<T>(dst: *mut T, src: T) -> T;
-
- pub fn atomic_and<T>(dst: *mut T, src: T) -> T;
- pub fn atomic_and_acq<T>(dst: *mut T, src: T) -> T;
- pub fn atomic_and_rel<T>(dst: *mut T, src: T) -> T;
- pub fn atomic_and_acqrel<T>(dst: *mut T, src: T) -> T;
- pub fn atomic_and_relaxed<T>(dst: *mut T, src: T) -> T;
-
- pub fn atomic_nand<T>(dst: *mut T, src: T) -> T;
- pub fn atomic_nand_acq<T>(dst: *mut T, src: T) -> T;
- pub fn atomic_nand_rel<T>(dst: *mut T, src: T) -> T;
- pub fn atomic_nand_acqrel<T>(dst: *mut T, src: T) -> T;
- pub fn atomic_nand_relaxed<T>(dst: *mut T, src: T) -> T;
-
- pub fn atomic_or<T>(dst: *mut T, src: T) -> T;
- pub fn atomic_or_acq<T>(dst: *mut T, src: T) -> T;
- pub fn atomic_or_rel<T>(dst: *mut T, src: T) -> T;
- pub fn atomic_or_acqrel<T>(dst: *mut T, src: T) -> T;
- pub fn atomic_or_relaxed<T>(dst: *mut T, src: T) -> T;
-
- pub fn atomic_xor<T>(dst: *mut T, src: T) -> T;
- pub fn atomic_xor_acq<T>(dst: *mut T, src: T) -> T;
- pub fn atomic_xor_rel<T>(dst: *mut T, src: T) -> T;
- pub fn atomic_xor_acqrel<T>(dst: *mut T, src: T) -> T;
- pub fn atomic_xor_relaxed<T>(dst: *mut T, src: T) -> T;
-
- pub fn atomic_max<T>(dst: *mut T, src: T) -> T;
- pub fn atomic_max_acq<T>(dst: *mut T, src: T) -> T;
- pub fn atomic_max_rel<T>(dst: *mut T, src: T) -> T;
- pub fn atomic_max_acqrel<T>(dst: *mut T, src: T) -> T;
- pub fn atomic_max_relaxed<T>(dst: *mut T, src: T) -> T;
-
- pub fn atomic_min<T>(dst: *mut T, src: T) -> T;
- pub fn atomic_min_acq<T>(dst: *mut T, src: T) -> T;
- pub fn atomic_min_rel<T>(dst: *mut T, src: T) -> T;
- pub fn atomic_min_acqrel<T>(dst: *mut T, src: T) -> T;
- pub fn atomic_min_relaxed<T>(dst: *mut T, src: T) -> T;
-
- pub fn atomic_umin<T>(dst: *mut T, src: T) -> T;
- pub fn atomic_umin_acq<T>(dst: *mut T, src: T) -> T;
- pub fn atomic_umin_rel<T>(dst: *mut T, src: T) -> T;
- pub fn atomic_umin_acqrel<T>(dst: *mut T, src: T) -> T;
- pub fn atomic_umin_relaxed<T>(dst: *mut T, src: T) -> T;
-
- pub fn atomic_umax<T>(dst: *mut T, src: T) -> T;
- pub fn atomic_umax_acq<T>(dst: *mut T, src: T) -> T;
- pub fn atomic_umax_rel<T>(dst: *mut T, src: T) -> T;
- pub fn atomic_umax_acqrel<T>(dst: *mut T, src: T) -> T;
- pub fn atomic_umax_relaxed<T>(dst: *mut T, src: T) -> T;
-}
-
-extern "rust-intrinsic" {
-
- pub fn atomic_fence();
- pub fn atomic_fence_acq();
- pub fn atomic_fence_rel();
- pub fn atomic_fence_acqrel();
-
- /// Abort the execution of the process.
- pub fn abort() -> !;
-
- /// Execute a breakpoint trap, for inspection by a debugger.
- pub fn breakpoint();
-
- /// The size of a type in bytes.
- ///
- /// This is the exact number of bytes in memory taken up by a
- /// value of the given type. In other words, a memset of this size
- /// would *exactly* overwrite a value. When laid out in vectors
- /// and structures there may be additional padding between
- /// elements.
- pub fn size_of<T>() -> uint;
-
- /// Move a value to an uninitialized memory location.
- ///
- /// Drop glue is not run on the destination.
- pub fn move_val_init<T>(dst: &mut T, src: T);
-
- pub fn min_align_of<T>() -> uint;
- pub fn pref_align_of<T>() -> uint;
-
- /// Get a static pointer to a type descriptor.
- pub fn get_tydesc<T>() -> *TyDesc;
-
- /// Gets an identifier which is globally unique to the specified type. This
- /// function will return the same value for a type regardless of whichever
- /// crate it is invoked in.
- pub fn type_id<T: 'static>() -> TypeId;
-
-
- /// Create a value initialized to zero.
- ///
- /// `init` is unsafe because it returns a zeroed-out datum,
- /// which is unsafe unless T is Copy.
- pub fn init<T>() -> T;
-
- /// Create an uninitialized value.
- pub fn uninit<T>() -> T;
-
- /// Move a value out of scope without running drop glue.
- ///
- /// `forget` is unsafe because the caller is responsible for
- /// ensuring the argument is deallocated already.
- pub fn forget<T>(_: T) -> ();
- pub fn transmute<T,U>(e: T) -> U;
-
- /// Returns `true` if a type requires drop glue.
- pub fn needs_drop<T>() -> bool;
-
- /// Returns `true` if a type is managed (will be allocated on the local heap)
- pub fn owns_managed<T>() -> bool;
-
- pub fn visit_tydesc(td: *TyDesc, tv: &mut TyVisitor);
-
- /// Calculates the offset from a pointer. The offset *must* be in-bounds of
- /// the object, or one-byte-past-the-end. An arithmetic overflow is also
- /// undefined behaviour.
- ///
- /// This is implemented as an intrinsic to avoid converting to and from an
- /// integer, since the conversion would throw away aliasing information.
- pub fn offset<T>(dst: *T, offset: int) -> *T;
-
- /// Equivalent to the appropriate `llvm.memcpy.p0i8.0i8.*` intrinsic, with
- /// a size of `count` * `size_of::<T>()` and an alignment of
- /// `min_align_of::<T>()`
- pub fn copy_nonoverlapping_memory<T>(dst: *mut T, src: *T, count: uint);
-
- /// Equivalent to the appropriate `llvm.memmove.p0i8.0i8.*` intrinsic, with
- /// a size of `count` * `size_of::<T>()` and an alignment of
- /// `min_align_of::<T>()`
- pub fn copy_memory<T>(dst: *mut T, src: *T, count: uint);
-
- /// Equivalent to the appropriate `llvm.memset.p0i8.*` intrinsic, with a
- /// size of `count` * `size_of::<T>()` and an alignment of
- /// `min_align_of::<T>()`
- pub fn set_memory<T>(dst: *mut T, val: u8, count: uint);
-
- /// Equivalent to the appropriate `llvm.memcpy.p0i8.0i8.*` intrinsic, with
- /// a size of `count` * `size_of::<T>()` and an alignment of
- /// `min_align_of::<T>()`
- ///
- /// The volatile parameter parameter is set to `true`, so it will not be optimized out.
- pub fn volatile_copy_nonoverlapping_memory<T>(dst: *mut T, src: *T, count: uint);
- /// Equivalent to the appropriate `llvm.memmove.p0i8.0i8.*` intrinsic, with
- /// a size of `count` * `size_of::<T>()` and an alignment of
- /// `min_align_of::<T>()`
- ///
- /// The volatile parameter parameter is set to `true`, so it will not be optimized out.
- pub fn volatile_copy_memory<T>(dst: *mut T, src: *T, count: uint);
- /// Equivalent to the appropriate `llvm.memset.p0i8.*` intrinsic, with a
- /// size of `count` * `size_of::<T>()` and an alignment of
- /// `min_align_of::<T>()`.
- ///
- /// The volatile parameter parameter is set to `true`, so it will not be optimized out.
- pub fn volatile_set_memory<T>(dst: *mut T, val: u8, count: uint);
-
- /// Perform a volatile load from the `src` pointer.
- pub fn volatile_load<T>(src: *T) -> T;
- /// Perform a volatile store to the `dst` pointer.
- pub fn volatile_store<T>(dst: *mut T, val: T);
-
- pub fn sqrtf32(x: f32) -> f32;
- pub fn sqrtf64(x: f64) -> f64;
-
- pub fn powif32(a: f32, x: i32) -> f32;
- pub fn powif64(a: f64, x: i32) -> f64;
-
- pub fn sinf32(x: f32) -> f32;
- pub fn sinf64(x: f64) -> f64;
-
- pub fn cosf32(x: f32) -> f32;
- pub fn cosf64(x: f64) -> f64;
-
- pub fn powf32(a: f32, x: f32) -> f32;
- pub fn powf64(a: f64, x: f64) -> f64;
-
- pub fn expf32(x: f32) -> f32;
- pub fn expf64(x: f64) -> f64;
-
- pub fn exp2f32(x: f32) -> f32;
- pub fn exp2f64(x: f64) -> f64;
-
- pub fn logf32(x: f32) -> f32;
- pub fn logf64(x: f64) -> f64;
-
- pub fn log10f32(x: f32) -> f32;
- pub fn log10f64(x: f64) -> f64;
-
- pub fn log2f32(x: f32) -> f32;
- pub fn log2f64(x: f64) -> f64;
-
- pub fn fmaf32(a: f32, b: f32, c: f32) -> f32;
- pub fn fmaf64(a: f64, b: f64, c: f64) -> f64;
-
- pub fn fabsf32(x: f32) -> f32;
- pub fn fabsf64(x: f64) -> f64;
-
- pub fn copysignf32(x: f32, y: f32) -> f32;
- pub fn copysignf64(x: f64, y: f64) -> f64;
-
- pub fn floorf32(x: f32) -> f32;
- pub fn floorf64(x: f64) -> f64;
-
- pub fn ceilf32(x: f32) -> f32;
- pub fn ceilf64(x: f64) -> f64;
-
- pub fn truncf32(x: f32) -> f32;
- pub fn truncf64(x: f64) -> f64;
-
- pub fn rintf32(x: f32) -> f32;
- pub fn rintf64(x: f64) -> f64;
-
- pub fn nearbyintf32(x: f32) -> f32;
- pub fn nearbyintf64(x: f64) -> f64;
-
- pub fn roundf32(x: f32) -> f32;
- pub fn roundf64(x: f64) -> f64;
-
- pub fn ctpop8(x: u8) -> u8;
- pub fn ctpop16(x: u16) -> u16;
- pub fn ctpop32(x: u32) -> u32;
- pub fn ctpop64(x: u64) -> u64;
-
- pub fn ctlz8(x: u8) -> u8;
- pub fn ctlz16(x: u16) -> u16;
- pub fn ctlz32(x: u32) -> u32;
- pub fn ctlz64(x: u64) -> u64;
-
- pub fn cttz8(x: u8) -> u8;
- pub fn cttz16(x: u16) -> u16;
- pub fn cttz32(x: u32) -> u32;
- pub fn cttz64(x: u64) -> u64;
-
- pub fn bswap16(x: u16) -> u16;
- pub fn bswap32(x: u32) -> u32;
- pub fn bswap64(x: u64) -> u64;
-
- pub fn i8_add_with_overflow(x: i8, y: i8) -> (i8, bool);
- pub fn i16_add_with_overflow(x: i16, y: i16) -> (i16, bool);
- pub fn i32_add_with_overflow(x: i32, y: i32) -> (i32, bool);
- pub fn i64_add_with_overflow(x: i64, y: i64) -> (i64, bool);
-
- pub fn u8_add_with_overflow(x: u8, y: u8) -> (u8, bool);
- pub fn u16_add_with_overflow(x: u16, y: u16) -> (u16, bool);
- pub fn u32_add_with_overflow(x: u32, y: u32) -> (u32, bool);
- pub fn u64_add_with_overflow(x: u64, y: u64) -> (u64, bool);
-
- pub fn i8_sub_with_overflow(x: i8, y: i8) -> (i8, bool);
- pub fn i16_sub_with_overflow(x: i16, y: i16) -> (i16, bool);
- pub fn i32_sub_with_overflow(x: i32, y: i32) -> (i32, bool);
- pub fn i64_sub_with_overflow(x: i64, y: i64) -> (i64, bool);
-
- pub fn u8_sub_with_overflow(x: u8, y: u8) -> (u8, bool);
- pub fn u16_sub_with_overflow(x: u16, y: u16) -> (u16, bool);
- pub fn u32_sub_with_overflow(x: u32, y: u32) -> (u32, bool);
- pub fn u64_sub_with_overflow(x: u64, y: u64) -> (u64, bool);
-
- pub fn i8_mul_with_overflow(x: i8, y: i8) -> (i8, bool);
- pub fn i16_mul_with_overflow(x: i16, y: i16) -> (i16, bool);
- pub fn i32_mul_with_overflow(x: i32, y: i32) -> (i32, bool);
- pub fn i64_mul_with_overflow(x: i64, y: i64) -> (i64, bool);
-
- pub fn u8_mul_with_overflow(x: u8, y: u8) -> (u8, bool);
- pub fn u16_mul_with_overflow(x: u16, y: u16) -> (u16, bool);
- pub fn u32_mul_with_overflow(x: u32, y: u32) -> (u32, bool);
- pub fn u64_mul_with_overflow(x: u64, y: u64) -> (u64, bool);
-}
-
-
-/// `TypeId` represents a globally unique identifier for a type
-#[lang="type_id"] // This needs to be kept in lockstep with the code in trans/intrinsic.rs and
- // middle/lang_items.rs
-#[deriving(Eq, Hash, Show, TotalEq)]
-#[cfg(not(test))]
-pub struct TypeId {
- t: u64,
-}
-
-#[cfg(not(test))]
-impl TypeId {
- /// Returns the `TypeId` of the type this generic function has been instantiated with
- pub fn of<T: 'static>() -> TypeId {
- unsafe { type_id::<T>() }
- }
-}
use iter::ExactSize;
use ops::Drop;
use option::{Some, None, Option};
-use result::{Ok, Err};
+use result::{Ok, Err, ResultUnwrap};
use slice::{ImmutableVector, MutableVector};
use slice;
use vec::Vec;
use rand::{StdRng, Rng};
let mut bytes = [0, ..1024];
- StdRng::new().unwrap().fill_bytes(bytes);
+ StdRng::new().ok().unwrap().fill_bytes(bytes);
let tmpdir = tmpdir();
use owned::Box;
use path::Path;
use result::{Ok, Err, Result};
-use str::StrSlice;
+use str::{StrSlice, StrAllocating};
use str;
use uint;
use unstable::finally::try_finally;
///
/// # Example
///
-/// ```rust
+/// ```no_run
/// # #![allow(unused_must_use)]
/// use std::io::net::tcp::TcpStream;
/// use std::io::net::ip::{Ipv4Addr, SocketAddr};
None => self.obj.letdie(),
}
}
+
+ /// Closes the reading half of this connection.
+ ///
+ /// This method will close the reading portion of this connection, causing
+ /// all pending and future reads to immediately return with an error.
+ ///
+ /// # Example
+ ///
+ /// ```no_run
+ /// # #![allow(unused_must_use)]
+ /// use std::io::timer;
+ /// use std::io::net::tcp::TcpStream;
+ /// use std::io::net::ip::{Ipv4Addr, SocketAddr};
+ ///
+ /// let addr = SocketAddr { ip: Ipv4Addr(127, 0, 0, 1), port: 34254 };
+ /// let mut stream = TcpStream::connect(addr).unwrap();
+ /// let stream2 = stream.clone();
+ ///
+ /// spawn(proc() {
+ /// // close this stream after one second
+ /// timer::sleep(1000);
+ /// let mut stream = stream2;
+ /// stream.close_read();
+ /// });
+ ///
+ /// // wait for some data, will get canceled after one second
+ /// let mut buf = [0];
+ /// stream.read(buf);
+ /// ```
+ ///
+ /// Note that this method affects all cloned handles associated with this
+ /// stream, not just this one handle.
+ pub fn close_read(&mut self) -> IoResult<()> { self.obj.close_read() }
+
+ /// Closes the writing half of this connection.
+ ///
+ /// This method will close the writing portion of this connection, causing
+ /// all future writes to immediately return with an error.
+ ///
+ /// Note that this method affects all cloned handles associated with this
+ /// stream, not just this one handle.
+ pub fn close_write(&mut self) -> IoResult<()> { self.obj.close_write() }
}
impl Clone for TcpStream {
// Also make sure that even though the timeout is expired that we will
// continue to receive any pending connections.
- let l = TcpStream::connect(addr).unwrap();
+ let (tx, rx) = channel();
+ spawn(proc() {
+ tx.send(TcpStream::connect(addr).unwrap());
+ });
+ let l = rx.recv();
for i in range(0, 1001) {
match a.accept() {
Ok(..) => break,
// Unset the timeout and make sure that this always blocks.
a.set_timeout(None);
spawn(proc() {
- drop(TcpStream::connect(addr));
+ drop(TcpStream::connect(addr).unwrap());
});
a.accept().unwrap();
})
+
+ iotest!(fn close_readwrite_smoke() {
+ let addr = next_test_ip4();
+ let a = TcpListener::bind(addr).listen().unwrap();
+ let (_tx, rx) = channel::<()>();
+ spawn(proc() {
+ let mut a = a;
+ let _s = a.accept().unwrap();
+ let _ = rx.recv_opt();
+ });
+
+ let mut b = [0];
+ let mut s = TcpStream::connect(addr).unwrap();
+ let mut s2 = s.clone();
+
+ // closing should prevent reads/writes
+ s.close_write().unwrap();
+ assert!(s.write([0]).is_err());
+ s.close_read().unwrap();
+ assert!(s.read(b).is_err());
+
+ // closing should affect previous handles
+ assert!(s2.write([0]).is_err());
+ assert!(s2.read(b).is_err());
+
+ // closing should affect new handles
+ let mut s3 = s.clone();
+ assert!(s3.write([0]).is_err());
+ assert!(s3.read(b).is_err());
+
+ // make sure these don't die
+ let _ = s2.close_read();
+ let _ = s2.close_write();
+ let _ = s3.close_read();
+ let _ = s3.close_write();
+ })
+
+ iotest!(fn close_read_wakes_up() {
+ let addr = next_test_ip4();
+ let a = TcpListener::bind(addr).listen().unwrap();
+ let (_tx, rx) = channel::<()>();
+ spawn(proc() {
+ let mut a = a;
+ let _s = a.accept().unwrap();
+ let _ = rx.recv_opt();
+ });
+
+ let mut s = TcpStream::connect(addr).unwrap();
+ let s2 = s.clone();
+ let (tx, rx) = channel();
+ spawn(proc() {
+ let mut s2 = s2;
+ assert!(s2.read([0]).is_err());
+ tx.send(());
+ });
+ // this should wake up the child task
+ s.close_read().unwrap();
+
+ // this test will never finish if the child doesn't wake up
+ rx.recv();
+ })
}
})
pub fn socket_name(addr: SocketAddr) {
+ use result::ResultUnwrap;
+
let server = UdpSocket::bind(addr);
assert!(server.is_ok());
use c_str::ToCStr;
use clone::Clone;
-use io::pipe::PipeStream;
use io::{Listener, Acceptor, Reader, Writer, IoResult};
use kinds::Send;
use owned::Box;
/// A stream which communicates over a named pipe.
pub struct UnixStream {
- obj: PipeStream,
+ obj: Box<RtioPipe:Send>,
}
impl UnixStream {
- fn new(obj: Box<RtioPipe:Send>) -> UnixStream {
- UnixStream { obj: PipeStream::new(obj) }
- }
-
/// Connect to a pipe named by `path`. This will attempt to open a
/// connection to the underlying socket.
///
/// ```
pub fn connect<P: ToCStr>(path: &P) -> IoResult<UnixStream> {
LocalIo::maybe_raise(|io| {
- io.unix_connect(&path.to_c_str(), None).map(UnixStream::new)
+ io.unix_connect(&path.to_c_str(), None).map(|p| UnixStream { obj: p })
})
}
timeout_ms: u64) -> IoResult<UnixStream> {
LocalIo::maybe_raise(|io| {
let s = io.unix_connect(&path.to_c_str(), Some(timeout_ms));
- s.map(UnixStream::new)
+ s.map(|p| UnixStream { obj: p })
})
}
+
+
+ /// Closes the reading half of this connection.
+ ///
+ /// This method will close the reading portion of this connection, causing
+ /// all pending and future reads to immediately return with an error.
+ ///
+ /// Note that this method affects all cloned handles associated with this
+ /// stream, not just this one handle.
+ pub fn close_read(&mut self) -> IoResult<()> { self.obj.close_read() }
+
+ /// Closes the writing half of this connection.
+ ///
+ /// This method will close the writing portion of this connection, causing
+ /// all pending and future writes to immediately return with an error.
+ ///
+ /// Note that this method affects all cloned handles associated with this
+ /// stream, not just this one handle.
+ pub fn close_write(&mut self) -> IoResult<()> { self.obj.close_write() }
}
impl Clone for UnixStream {
impl Acceptor<UnixStream> for UnixAcceptor {
fn accept(&mut self) -> IoResult<UnixStream> {
- self.obj.accept().map(UnixStream::new)
+ self.obj.accept().map(|s| UnixStream { obj: s })
}
}
// Also make sure that even though the timeout is expired that we will
// continue to receive any pending connections.
- let l = UnixStream::connect(&addr).unwrap();
+ let (tx, rx) = channel();
+ let addr2 = addr.clone();
+ spawn(proc() {
+ tx.send(UnixStream::connect(&addr2).unwrap());
+ });
+ let l = rx.recv();
for i in range(0, 1001) {
match a.accept() {
Ok(..) => break,
a.set_timeout(None);
let addr2 = addr.clone();
spawn(proc() {
- drop(UnixStream::connect(&addr2));
+ drop(UnixStream::connect(&addr2).unwrap());
});
a.accept().unwrap();
})
let _a = UnixListener::bind(&addr).unwrap().listen().unwrap();
assert!(UnixStream::connect_timeout(&addr, 100).is_ok());
})
+
+ iotest!(fn close_readwrite_smoke() {
+ let addr = next_test_unix();
+ let a = UnixListener::bind(&addr).listen().unwrap();
+ let (_tx, rx) = channel::<()>();
+ spawn(proc() {
+ let mut a = a;
+ let _s = a.accept().unwrap();
+ let _ = rx.recv_opt();
+ });
+
+ let mut b = [0];
+ let mut s = UnixStream::connect(&addr).unwrap();
+ let mut s2 = s.clone();
+
+ // closing should prevent reads/writes
+ s.close_write().unwrap();
+ assert!(s.write([0]).is_err());
+ s.close_read().unwrap();
+ assert!(s.read(b).is_err());
+
+ // closing should affect previous handles
+ assert!(s2.write([0]).is_err());
+ assert!(s2.read(b).is_err());
+
+ // closing should affect new handles
+ let mut s3 = s.clone();
+ assert!(s3.write([0]).is_err());
+ assert!(s3.read(b).is_err());
+
+ // make sure these don't die
+ let _ = s2.close_read();
+ let _ = s2.close_write();
+ let _ = s3.close_read();
+ let _ = s3.close_write();
+ })
+
+ iotest!(fn close_read_wakes_up() {
+ let addr = next_test_unix();
+ let a = UnixListener::bind(&addr).listen().unwrap();
+ let (_tx, rx) = channel::<()>();
+ spawn(proc() {
+ let mut a = a;
+ let _s = a.accept().unwrap();
+ let _ = rx.recv_opt();
+ });
+
+ let mut s = UnixStream::connect(&addr).unwrap();
+ let s2 = s.clone();
+ let (tx, rx) = channel();
+ spawn(proc() {
+ let mut s2 = s2;
+ assert!(s2.read([0]).is_err());
+ tx.send(());
+ });
+ // this should wake up the child task
+ s.close_read().unwrap();
+
+ // this test will never finish if the child doesn't wake up
+ rx.recv();
+ })
}
mod tests {
use io::process::{ProcessConfig, Process};
use prelude::*;
- use str::StrSlice;
// FIXME(#10380) these tests should not all be ignored on android.
use option::{Option, Some, None};
use owned::Box;
use prelude::drop;
-use result::{Ok, Err};
+use result::{Ok, Err, ResultUnwrap};
use rt;
use rt::local::Local;
use rt::rtio::{DontClose, IoFactory, LocalIo, RtioFileStream, RtioTTY};
use option::{Option, None, Some};
use os;
use path::{Path, GenericPath};
-use result::{Ok, Err};
+use result::{Ok, Err, ResultUnwrap};
use sync::atomics;
/// A wrapper for a path to temporary directory implementing automatic
use io::IoResult;
use kinds::Send;
use owned::Box;
+use option::Expect;
use rt::rtio::{IoFactory, LocalIo, RtioTimer};
/// A synchronous timer object
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-/*!
-
-Composable external iterators
-
-# The `Iterator` trait
-
-This module defines Rust's core iteration trait. The `Iterator` trait has one
-unimplemented method, `next`. All other methods are derived through default
-methods to perform operations such as `zip`, `chain`, `enumerate`, and `fold`.
-
-The goal of this module is to unify iteration across all containers in Rust.
-An iterator can be considered as a state machine which is used to track which
-element will be yielded next.
-
-There are various extensions also defined in this module to assist with various
-types of iteration, such as the `DoubleEndedIterator` for iterating in reverse,
-the `FromIterator` trait for creating a container from an iterator, and much
-more.
-
-## Rust's `for` loop
-
-The special syntax used by rust's `for` loop is based around the `Iterator`
-trait defined in this module. For loops can be viewed as a syntactical expansion
-into a `loop`, for example, the `for` loop in this example is essentially
-translated to the `loop` below.
-
-```rust
-let values = ~[1, 2, 3];
-
-// "Syntactical sugar" taking advantage of an iterator
-for &x in values.iter() {
- println!("{}", x);
-}
-
-// Rough translation of the iteration without a `for` iterator.
-let mut it = values.iter();
-loop {
- match it.next() {
- Some(&x) => {
- println!("{}", x);
- }
- None => { break }
- }
-}
-```
-
-This `for` loop syntax can be applied to any iterator over any type.
-
-## Iteration protocol and more
-
-More detailed information about iterators can be found in the [container
-guide](http://static.rust-lang.org/doc/master/guide-container.html) with
-the rest of the rust manuals.
-
-*/
-
-use cmp;
-use num::{Zero, One, CheckedAdd, CheckedSub, Saturating, ToPrimitive, Int};
-use option::{Option, Some, None};
-use ops::{Add, Mul, Sub};
-use cmp::{Eq, Ord, TotalOrd};
-use clone::Clone;
-use uint;
-use mem;
-
-/// Conversion from an `Iterator`
-pub trait FromIterator<A> {
- /// Build a container with elements from an external iterator.
- fn from_iter<T: Iterator<A>>(iterator: T) -> Self;
-}
-
-/// A type growable from an `Iterator` implementation
-pub trait Extendable<A>: FromIterator<A> {
- /// Extend a container with the elements yielded by an iterator
- fn extend<T: Iterator<A>>(&mut self, iterator: T);
-}
-
-/// An interface for dealing with "external iterators". These types of iterators
-/// can be resumed at any time as all state is stored internally as opposed to
-/// being located on the call stack.
-///
-/// The Iterator protocol states that an iterator yields a (potentially-empty,
-/// potentially-infinite) sequence of values, and returns `None` to signal that
-/// it's finished. The Iterator protocol does not define behavior after `None`
-/// is returned. A concrete Iterator implementation may choose to behave however
-/// it wishes, either by returning `None` infinitely, or by doing something
-/// else.
-pub trait Iterator<A> {
- /// Advance the iterator and return the next value. Return `None` when the end is reached.
- fn next(&mut self) -> Option<A>;
-
- /// Return a lower bound and upper bound on the remaining length of the iterator.
- ///
- /// The common use case for the estimate is pre-allocating space to store the results.
- #[inline]
- fn size_hint(&self) -> (uint, Option<uint>) { (0, None) }
-
- /// Chain this iterator with another, returning a new iterator which will
- /// finish iterating over the current iterator, and then it will iterate
- /// over the other specified iterator.
- ///
- /// # Example
- ///
- /// ```rust
- /// let a = [0];
- /// let b = [1];
- /// let mut it = a.iter().chain(b.iter());
- /// assert_eq!(it.next().unwrap(), &0);
- /// assert_eq!(it.next().unwrap(), &1);
- /// assert!(it.next().is_none());
- /// ```
- #[inline]
- fn chain<U: Iterator<A>>(self, other: U) -> Chain<Self, U> {
- Chain{a: self, b: other, flag: false}
- }
-
- /// Creates an iterator which iterates over both this and the specified
- /// iterators simultaneously, yielding the two elements as pairs. When
- /// either iterator returns None, all further invocations of next() will
- /// return None.
- ///
- /// # Example
- ///
- /// ```rust
- /// let a = [0];
- /// let b = [1];
- /// let mut it = a.iter().zip(b.iter());
- /// assert_eq!(it.next().unwrap(), (&0, &1));
- /// assert!(it.next().is_none());
- /// ```
- #[inline]
- fn zip<B, U: Iterator<B>>(self, other: U) -> Zip<Self, U> {
- Zip{a: self, b: other}
- }
-
- /// Creates a new iterator which will apply the specified function to each
- /// element returned by the first, yielding the mapped element instead.
- ///
- /// # Example
- ///
- /// ```rust
- /// let a = [1, 2];
- /// let mut it = a.iter().map(|&x| 2 * x);
- /// assert_eq!(it.next().unwrap(), 2);
- /// assert_eq!(it.next().unwrap(), 4);
- /// assert!(it.next().is_none());
- /// ```
- #[inline]
- fn map<'r, B>(self, f: |A|: 'r -> B) -> Map<'r, A, B, Self> {
- Map{iter: self, f: f}
- }
-
- /// Creates an iterator which applies the predicate to each element returned
- /// by this iterator. Only elements which have the predicate evaluate to
- /// `true` will be yielded.
- ///
- /// # Example
- ///
- /// ```rust
- /// let a = [1, 2];
- /// let mut it = a.iter().filter(|&x| *x > 1);
- /// assert_eq!(it.next().unwrap(), &2);
- /// assert!(it.next().is_none());
- /// ```
- #[inline]
- fn filter<'r>(self, predicate: |&A|: 'r -> bool) -> Filter<'r, A, Self> {
- Filter{iter: self, predicate: predicate}
- }
-
- /// Creates an iterator which both filters and maps elements.
- /// If the specified function returns None, the element is skipped.
- /// Otherwise the option is unwrapped and the new value is yielded.
- ///
- /// # Example
- ///
- /// ```rust
- /// let a = [1, 2];
- /// let mut it = a.iter().filter_map(|&x| if x > 1 {Some(2 * x)} else {None});
- /// assert_eq!(it.next().unwrap(), 4);
- /// assert!(it.next().is_none());
- /// ```
- #[inline]
- fn filter_map<'r, B>(self, f: |A|: 'r -> Option<B>) -> FilterMap<'r, A, B, Self> {
- FilterMap { iter: self, f: f }
- }
-
- /// Creates an iterator which yields a pair of the value returned by this
- /// iterator plus the current index of iteration.
- ///
- /// # Example
- ///
- /// ```rust
- /// let a = [100, 200];
- /// let mut it = a.iter().enumerate();
- /// assert_eq!(it.next().unwrap(), (0, &100));
- /// assert_eq!(it.next().unwrap(), (1, &200));
- /// assert!(it.next().is_none());
- /// ```
- #[inline]
- fn enumerate(self) -> Enumerate<Self> {
- Enumerate{iter: self, count: 0}
- }
-
-
- /// Creates an iterator that has a `.peek()` method
- /// that returns an optional reference to the next element.
- ///
- /// # Example
- ///
- /// ```rust
- /// let xs = [100, 200, 300];
- /// let mut it = xs.iter().map(|x| *x).peekable();
- /// assert_eq!(it.peek().unwrap(), &100);
- /// assert_eq!(it.next().unwrap(), 100);
- /// assert_eq!(it.next().unwrap(), 200);
- /// assert_eq!(it.peek().unwrap(), &300);
- /// assert_eq!(it.peek().unwrap(), &300);
- /// assert_eq!(it.next().unwrap(), 300);
- /// assert!(it.peek().is_none());
- /// assert!(it.next().is_none());
- /// ```
- #[inline]
- fn peekable(self) -> Peekable<A, Self> {
- Peekable{iter: self, peeked: None}
- }
-
- /// Creates an iterator which invokes the predicate on elements until it
- /// returns false. Once the predicate returns false, all further elements are
- /// yielded.
- ///
- /// # Example
- ///
- /// ```rust
- /// let a = [1, 2, 3, 2, 1];
- /// let mut it = a.iter().skip_while(|&a| *a < 3);
- /// assert_eq!(it.next().unwrap(), &3);
- /// assert_eq!(it.next().unwrap(), &2);
- /// assert_eq!(it.next().unwrap(), &1);
- /// assert!(it.next().is_none());
- /// ```
- #[inline]
- fn skip_while<'r>(self, predicate: |&A|: 'r -> bool) -> SkipWhile<'r, A, Self> {
- SkipWhile{iter: self, flag: false, predicate: predicate}
- }
-
- /// Creates an iterator which yields elements so long as the predicate
- /// returns true. After the predicate returns false for the first time, no
- /// further elements will be yielded.
- ///
- /// # Example
- ///
- /// ```rust
- /// let a = [1, 2, 3, 2, 1];
- /// let mut it = a.iter().take_while(|&a| *a < 3);
- /// assert_eq!(it.next().unwrap(), &1);
- /// assert_eq!(it.next().unwrap(), &2);
- /// assert!(it.next().is_none());
- /// ```
- #[inline]
- fn take_while<'r>(self, predicate: |&A|: 'r -> bool) -> TakeWhile<'r, A, Self> {
- TakeWhile{iter: self, flag: false, predicate: predicate}
- }
-
- /// Creates an iterator which skips the first `n` elements of this iterator,
- /// and then it yields all further items.
- ///
- /// # Example
- ///
- /// ```rust
- /// let a = [1, 2, 3, 4, 5];
- /// let mut it = a.iter().skip(3);
- /// assert_eq!(it.next().unwrap(), &4);
- /// assert_eq!(it.next().unwrap(), &5);
- /// assert!(it.next().is_none());
- /// ```
- #[inline]
- fn skip(self, n: uint) -> Skip<Self> {
- Skip{iter: self, n: n}
- }
-
- /// Creates an iterator which yields the first `n` elements of this
- /// iterator, and then it will always return None.
- ///
- /// # Example
- ///
- /// ```rust
- /// let a = [1, 2, 3, 4, 5];
- /// let mut it = a.iter().take(3);
- /// assert_eq!(it.next().unwrap(), &1);
- /// assert_eq!(it.next().unwrap(), &2);
- /// assert_eq!(it.next().unwrap(), &3);
- /// assert!(it.next().is_none());
- /// ```
- #[inline]
- fn take(self, n: uint) -> Take<Self> {
- Take{iter: self, n: n}
- }
-
- /// Creates a new iterator which behaves in a similar fashion to fold.
- /// There is a state which is passed between each iteration and can be
- /// mutated as necessary. The yielded values from the closure are yielded
- /// from the Scan instance when not None.
- ///
- /// # Example
- ///
- /// ```rust
- /// let a = [1, 2, 3, 4, 5];
- /// let mut it = a.iter().scan(1, |fac, &x| {
- /// *fac = *fac * x;
- /// Some(*fac)
- /// });
- /// assert_eq!(it.next().unwrap(), 1);
- /// assert_eq!(it.next().unwrap(), 2);
- /// assert_eq!(it.next().unwrap(), 6);
- /// assert_eq!(it.next().unwrap(), 24);
- /// assert_eq!(it.next().unwrap(), 120);
- /// assert!(it.next().is_none());
- /// ```
- #[inline]
- fn scan<'r, St, B>(self, initial_state: St, f: |&mut St, A|: 'r -> Option<B>)
- -> Scan<'r, A, B, Self, St> {
- Scan{iter: self, f: f, state: initial_state}
- }
-
- /// Creates an iterator that maps each element to an iterator,
- /// and yields the elements of the produced iterators
- ///
- /// # Example
- ///
- /// ```rust
- /// use std::iter::count;
- ///
- /// let xs = [2u, 3];
- /// let ys = [0u, 1, 0, 1, 2];
- /// let mut it = xs.iter().flat_map(|&x| count(0u, 1).take(x));
- /// // Check that `it` has the same elements as `ys`
- /// let mut i = 0;
- /// for x in it {
- /// assert_eq!(x, ys[i]);
- /// i += 1;
- /// }
- /// ```
- #[inline]
- fn flat_map<'r, B, U: Iterator<B>>(self, f: |A|: 'r -> U)
- -> FlatMap<'r, A, Self, U> {
- FlatMap{iter: self, f: f, frontiter: None, backiter: None }
- }
-
- /// Creates an iterator that yields `None` forever after the underlying
- /// iterator yields `None`. Random-access iterator behavior is not
- /// affected, only single and double-ended iterator behavior.
- ///
- /// # Example
- ///
- /// ```rust
- /// fn process<U: Iterator<int>>(it: U) -> int {
- /// let mut it = it.fuse();
- /// let mut sum = 0;
- /// for x in it {
- /// if x > 5 {
- /// continue;
- /// }
- /// sum += x;
- /// }
- /// // did we exhaust the iterator?
- /// if it.next().is_none() {
- /// sum += 1000;
- /// }
- /// sum
- /// }
- /// let x = ~[1,2,3,7,8,9];
- /// assert_eq!(process(x.move_iter()), 1006);
- /// ```
- #[inline]
- fn fuse(self) -> Fuse<Self> {
- Fuse{iter: self, done: false}
- }
-
- /// Creates an iterator that calls a function with a reference to each
- /// element before yielding it. This is often useful for debugging an
- /// iterator pipeline.
- ///
- /// # Example
- ///
- /// ```rust
- /// use std::iter::AdditiveIterator;
- ///
- /// let xs = [1u, 4, 2, 3, 8, 9, 6];
- /// let sum = xs.iter()
- /// .map(|&x| x)
- /// .inspect(|&x| println!("filtering {}", x))
- /// .filter(|&x| x % 2 == 0)
- /// .inspect(|&x| println!("{} made it through", x))
- /// .sum();
- /// println!("{}", sum);
- /// ```
- #[inline]
- fn inspect<'r>(self, f: |&A|: 'r) -> Inspect<'r, A, Self> {
- Inspect{iter: self, f: f}
- }
-
- /// Creates a wrapper around a mutable reference to the iterator.
- ///
- /// This is useful to allow applying iterator adaptors while still
- /// retaining ownership of the original iterator value.
- ///
- /// # Example
- ///
- /// ```rust
- /// let mut xs = range(0, 10);
- /// // sum the first five values
- /// let partial_sum = xs.by_ref().take(5).fold(0, |a, b| a + b);
- /// assert!(partial_sum == 10);
- /// // xs.next() is now `5`
- /// assert!(xs.next() == Some(5));
- /// ```
- fn by_ref<'r>(&'r mut self) -> ByRef<'r, Self> {
- ByRef{iter: self}
- }
-
- /// Apply a function to each element, or stop iterating if the
- /// function returns `false`.
- ///
- /// # Example
- ///
- /// ```rust
- /// range(0, 5).advance(|x| {print!("{} ", x); true});
- /// ```
- #[inline]
- fn advance(&mut self, f: |A| -> bool) -> bool {
- loop {
- match self.next() {
- Some(x) => {
- if !f(x) { return false; }
- }
- None => { return true; }
- }
- }
- }
-
- /// Loops through the entire iterator, collecting all of the elements into
- /// a container implementing `FromIterator`.
- ///
- /// # Example
- ///
- /// ```rust
- /// let a = [1, 2, 3, 4, 5];
- /// let b: ~[int] = a.iter().map(|&x| x).collect();
- /// assert!(a == b);
- /// ```
- #[inline]
- fn collect<B: FromIterator<A>>(&mut self) -> B {
- FromIterator::from_iter(self.by_ref())
- }
-
- /// Loops through `n` iterations, returning the `n`th element of the
- /// iterator.
- ///
- /// # Example
- ///
- /// ```rust
- /// let a = [1, 2, 3, 4, 5];
- /// let mut it = a.iter();
- /// assert!(it.nth(2).unwrap() == &3);
- /// assert!(it.nth(2) == None);
- /// ```
- #[inline]
- fn nth(&mut self, mut n: uint) -> Option<A> {
- loop {
- match self.next() {
- Some(x) => if n == 0 { return Some(x) },
- None => return None
- }
- n -= 1;
- }
- }
-
- /// Loops through the entire iterator, returning the last element of the
- /// iterator.
- ///
- /// # Example
- ///
- /// ```rust
- /// let a = [1, 2, 3, 4, 5];
- /// assert!(a.iter().last().unwrap() == &5);
- /// ```
- #[inline]
- fn last(&mut self) -> Option<A> {
- let mut last = None;
- for x in *self { last = Some(x); }
- last
- }
-
- /// Performs a fold operation over the entire iterator, returning the
- /// eventual state at the end of the iteration.
- ///
- /// # Example
- ///
- /// ```rust
- /// let a = [1, 2, 3, 4, 5];
- /// assert!(a.iter().fold(0, |a, &b| a + b) == 15);
- /// ```
- #[inline]
- fn fold<B>(&mut self, init: B, f: |B, A| -> B) -> B {
- let mut accum = init;
- loop {
- match self.next() {
- Some(x) => { accum = f(accum, x); }
- None => { break; }
- }
- }
- accum
- }
-
- /// Counts the number of elements in this iterator.
- ///
- /// # Example
- ///
- /// ```rust
- /// let a = [1, 2, 3, 4, 5];
- /// let mut it = a.iter();
- /// assert!(it.len() == 5);
- /// assert!(it.len() == 0);
- /// ```
- #[inline]
- fn len(&mut self) -> uint {
- self.fold(0, |cnt, _x| cnt + 1)
- }
-
- /// Tests whether the predicate holds true for all elements in the iterator.
- ///
- /// # Example
- ///
- /// ```rust
- /// let a = [1, 2, 3, 4, 5];
- /// assert!(a.iter().all(|x| *x > 0));
- /// assert!(!a.iter().all(|x| *x > 2));
- /// ```
- #[inline]
- fn all(&mut self, f: |A| -> bool) -> bool {
- for x in *self { if !f(x) { return false; } }
- true
- }
-
- /// Tests whether any element of an iterator satisfies the specified
- /// predicate.
- ///
- /// # Example
- ///
- /// ```rust
- /// let a = [1, 2, 3, 4, 5];
- /// let mut it = a.iter();
- /// assert!(it.any(|x| *x == 3));
- /// assert!(!it.any(|x| *x == 3));
- /// ```
- #[inline]
- fn any(&mut self, f: |A| -> bool) -> bool {
- for x in *self { if f(x) { return true; } }
- false
- }
-
- /// Return the first element satisfying the specified predicate
- #[inline]
- fn find(&mut self, predicate: |&A| -> bool) -> Option<A> {
- for x in *self {
- if predicate(&x) { return Some(x) }
- }
- None
- }
-
- /// Return the index of the first element satisfying the specified predicate
- #[inline]
- fn position(&mut self, predicate: |A| -> bool) -> Option<uint> {
- let mut i = 0;
- for x in *self {
- if predicate(x) {
- return Some(i);
- }
- i += 1;
- }
- None
- }
-
- /// Count the number of elements satisfying the specified predicate
- #[inline]
- fn count(&mut self, predicate: |A| -> bool) -> uint {
- let mut i = 0;
- for x in *self {
- if predicate(x) { i += 1 }
- }
- i
- }
-
- /// Return the element that gives the maximum value from the
- /// specified function.
- ///
- /// # Example
- ///
- /// ```rust
- /// let xs = [-3i, 0, 1, 5, -10];
- /// assert_eq!(*xs.iter().max_by(|x| x.abs()).unwrap(), -10);
- /// ```
- #[inline]
- fn max_by<B: TotalOrd>(&mut self, f: |&A| -> B) -> Option<A> {
- self.fold(None, |max: Option<(A, B)>, x| {
- let x_val = f(&x);
- match max {
- None => Some((x, x_val)),
- Some((y, y_val)) => if x_val > y_val {
- Some((x, x_val))
- } else {
- Some((y, y_val))
- }
- }
- }).map(|(x, _)| x)
- }
-
- /// Return the element that gives the minimum value from the
- /// specified function.
- ///
- /// # Example
- ///
- /// ```rust
- /// let xs = [-3i, 0, 1, 5, -10];
- /// assert_eq!(*xs.iter().min_by(|x| x.abs()).unwrap(), 0);
- /// ```
- #[inline]
- fn min_by<B: TotalOrd>(&mut self, f: |&A| -> B) -> Option<A> {
- self.fold(None, |min: Option<(A, B)>, x| {
- let x_val = f(&x);
- match min {
- None => Some((x, x_val)),
- Some((y, y_val)) => if x_val < y_val {
- Some((x, x_val))
- } else {
- Some((y, y_val))
- }
- }
- }).map(|(x, _)| x)
- }
-}
-
-/// A range iterator able to yield elements from both ends
-pub trait DoubleEndedIterator<A>: Iterator<A> {
- /// Yield an element from the end of the range, returning `None` if the range is empty.
- fn next_back(&mut self) -> Option<A>;
-
- /// Change the direction of the iterator
- ///
- /// The flipped iterator swaps the ends on an iterator that can already
- /// be iterated from the front and from the back.
- ///
- ///
- /// If the iterator also implements RandomAccessIterator, the flipped
- /// iterator is also random access, with the indices starting at the back
- /// of the original iterator.
- ///
- /// Note: Random access with flipped indices still only applies to the first
- /// `uint::MAX` elements of the original iterator.
- #[inline]
- fn rev(self) -> Rev<Self> {
- Rev{iter: self}
- }
-}
-
-/// A double-ended iterator yielding mutable references
-pub trait MutableDoubleEndedIterator {
- // FIXME: #5898: should be called `reverse`
- /// Use an iterator to reverse a container in-place
- fn reverse_(&mut self);
-}
-
-impl<'a, A, T: DoubleEndedIterator<&'a mut A>> MutableDoubleEndedIterator for T {
- // FIXME: #5898: should be called `reverse`
- /// Use an iterator to reverse a container in-place
- fn reverse_(&mut self) {
- loop {
- match (self.next(), self.next_back()) {
- (Some(x), Some(y)) => mem::swap(x, y),
- _ => break
- }
- }
- }
-}
-
-
-/// An object implementing random access indexing by `uint`
-///
-/// A `RandomAccessIterator` should be either infinite or a `DoubleEndedIterator`.
-pub trait RandomAccessIterator<A>: Iterator<A> {
- /// Return the number of indexable elements. At most `std::uint::MAX`
- /// elements are indexable, even if the iterator represents a longer range.
- fn indexable(&self) -> uint;
-
- /// Return an element at an index
- fn idx(&mut self, index: uint) -> Option<A>;
-}
-
-/// An iterator that knows its exact length
-///
-/// This trait is a helper for iterators like the vector iterator, so that
-/// it can support double-ended enumeration.
-///
-/// `Iterator::size_hint` *must* return the exact size of the iterator.
-/// Note that the size must fit in `uint`.
-pub trait ExactSize<A> : DoubleEndedIterator<A> {
- /// Return the index of the last element satisfying the specified predicate
- ///
- /// If no element matches, None is returned.
- #[inline]
- fn rposition(&mut self, predicate: |A| -> bool) -> Option<uint> {
- let (lower, upper) = self.size_hint();
- assert!(upper == Some(lower));
- let mut i = lower;
- loop {
- match self.next_back() {
- None => break,
- Some(x) => {
- i = match i.checked_sub(&1) {
- Some(x) => x,
- None => fail!("rposition: incorrect ExactSize")
- };
- if predicate(x) {
- return Some(i)
- }
- }
- }
- }
- None
- }
-}
-
-// All adaptors that preserve the size of the wrapped iterator are fine
-// Adaptors that may overflow in `size_hint` are not, i.e. `Chain`.
-impl<A, T: ExactSize<A>> ExactSize<(uint, A)> for Enumerate<T> {}
-impl<'a, A, T: ExactSize<A>> ExactSize<A> for Inspect<'a, A, T> {}
-impl<A, T: ExactSize<A>> ExactSize<A> for Rev<T> {}
-impl<'a, A, B, T: ExactSize<A>> ExactSize<B> for Map<'a, A, B, T> {}
-impl<A, B, T: ExactSize<A>, U: ExactSize<B>> ExactSize<(A, B)> for Zip<T, U> {}
-
-/// An double-ended iterator with the direction inverted
-#[deriving(Clone)]
-pub struct Rev<T> {
- iter: T
-}
-
-impl<A, T: DoubleEndedIterator<A>> Iterator<A> for Rev<T> {
- #[inline]
- fn next(&mut self) -> Option<A> { self.iter.next_back() }
- #[inline]
- fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() }
-}
-
-impl<A, T: DoubleEndedIterator<A>> DoubleEndedIterator<A> for Rev<T> {
- #[inline]
- fn next_back(&mut self) -> Option<A> { self.iter.next() }
-}
-
-impl<A, T: DoubleEndedIterator<A> + RandomAccessIterator<A>> RandomAccessIterator<A>
- for Rev<T> {
- #[inline]
- fn indexable(&self) -> uint { self.iter.indexable() }
- #[inline]
- fn idx(&mut self, index: uint) -> Option<A> {
- let amt = self.indexable();
- self.iter.idx(amt - index - 1)
- }
-}
-
-/// A mutable reference to an iterator
-pub struct ByRef<'a, T> {
- iter: &'a mut T
-}
-
-impl<'a, A, T: Iterator<A>> Iterator<A> for ByRef<'a, T> {
- #[inline]
- fn next(&mut self) -> Option<A> { self.iter.next() }
- #[inline]
- fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() }
-}
-
-impl<'a, A, T: DoubleEndedIterator<A>> DoubleEndedIterator<A> for ByRef<'a, T> {
- #[inline]
- fn next_back(&mut self) -> Option<A> { self.iter.next_back() }
-}
-
-/// A trait for iterators over elements which can be added together
-pub trait AdditiveIterator<A> {
- /// Iterates over the entire iterator, summing up all the elements
- ///
- /// # Example
- ///
- /// ```rust
- /// use std::iter::AdditiveIterator;
- ///
- /// let a = [1, 2, 3, 4, 5];
- /// let mut it = a.iter().map(|&x| x);
- /// assert!(it.sum() == 15);
- /// ```
- fn sum(&mut self) -> A;
-}
-
-impl<A: Add<A, A> + Zero, T: Iterator<A>> AdditiveIterator<A> for T {
- #[inline]
- fn sum(&mut self) -> A {
- let zero: A = Zero::zero();
- self.fold(zero, |s, x| s + x)
- }
-}
-
-/// A trait for iterators over elements whose elements can be multiplied
-/// together.
-pub trait MultiplicativeIterator<A> {
- /// Iterates over the entire iterator, multiplying all the elements
- ///
- /// # Example
- ///
- /// ```rust
- /// use std::iter::{count, MultiplicativeIterator};
- ///
- /// fn factorial(n: uint) -> uint {
- /// count(1u, 1).take_while(|&i| i <= n).product()
- /// }
- /// assert!(factorial(0) == 1);
- /// assert!(factorial(1) == 1);
- /// assert!(factorial(5) == 120);
- /// ```
- fn product(&mut self) -> A;
-}
-
-impl<A: Mul<A, A> + One, T: Iterator<A>> MultiplicativeIterator<A> for T {
- #[inline]
- fn product(&mut self) -> A {
- let one: A = One::one();
- self.fold(one, |p, x| p * x)
- }
-}
-
-/// A trait for iterators over elements which can be compared to one another.
-/// The type of each element must ascribe to the `Ord` trait.
-pub trait OrdIterator<A> {
- /// Consumes the entire iterator to return the maximum element.
- ///
- /// # Example
- ///
- /// ```rust
- /// let a = [1, 2, 3, 4, 5];
- /// assert!(a.iter().max().unwrap() == &5);
- /// ```
- fn max(&mut self) -> Option<A>;
-
- /// Consumes the entire iterator to return the minimum element.
- ///
- /// # Example
- ///
- /// ```rust
- /// let a = [1, 2, 3, 4, 5];
- /// assert!(a.iter().min().unwrap() == &1);
- /// ```
- fn min(&mut self) -> Option<A>;
-
- /// `min_max` finds the minimum and maximum elements in the iterator.
- ///
- /// The return type `MinMaxResult` is an enum of three variants:
- /// - `NoElements` if the iterator is empty.
- /// - `OneElement(x)` if the iterator has exactly one element.
- /// - `MinMax(x, y)` is returned otherwise, where `x <= y`. Two values are equal if and only if
- /// there is more than one element in the iterator and all elements are equal.
- ///
- /// On an iterator of length `n`, `min_max` does `1.5 * n` comparisons,
- /// and so faster than calling `min` and `max separately which does `2 * n` comparisons.
- ///
- /// # Example
- ///
- /// ```rust
- /// use std::iter::{NoElements, OneElement, MinMax};
- ///
- /// let v: [int, ..0] = [];
- /// assert_eq!(v.iter().min_max(), NoElements);
- ///
- /// let v = [1i];
- /// assert!(v.iter().min_max() == OneElement(&1));
- ///
- /// let v = [1i, 2, 3, 4, 5];
- /// assert!(v.iter().min_max() == MinMax(&1, &5));
- ///
- /// let v = [1i, 2, 3, 4, 5, 6];
- /// assert!(v.iter().min_max() == MinMax(&1, &6));
- ///
- /// let v = [1i, 1, 1, 1];
- /// assert!(v.iter().min_max() == MinMax(&1, &1));
- /// ```
- fn min_max(&mut self) -> MinMaxResult<A>;
-}
-
-impl<A: TotalOrd, T: Iterator<A>> OrdIterator<A> for T {
- #[inline]
- fn max(&mut self) -> Option<A> {
- self.fold(None, |max, x| {
- match max {
- None => Some(x),
- Some(y) => Some(cmp::max(x, y))
- }
- })
- }
-
- #[inline]
- fn min(&mut self) -> Option<A> {
- self.fold(None, |min, x| {
- match min {
- None => Some(x),
- Some(y) => Some(cmp::min(x, y))
- }
- })
- }
-
- fn min_max(&mut self) -> MinMaxResult<A> {
- let (mut min, mut max) = match self.next() {
- None => return NoElements,
- Some(x) => {
- match self.next() {
- None => return OneElement(x),
- Some(y) => if x < y {(x, y)} else {(y,x)}
- }
- }
- };
-
- loop {
- // `first` and `second` are the two next elements we want to look at.
- // We first compare `first` and `second` (#1). The smaller one is then compared to
- // current minimum (#2). The larger one is compared to current maximum (#3). This
- // way we do 3 comparisons for 2 elements.
- let first = match self.next() {
- None => break,
- Some(x) => x
- };
- let second = match self.next() {
- None => {
- if first < min {
- min = first;
- } else if first > max {
- max = first;
- }
- break;
- }
- Some(x) => x
- };
- if first < second {
- if first < min {min = first;}
- if max < second {max = second;}
- } else {
- if second < min {min = second;}
- if max < first {max = first;}
- }
- }
-
- MinMax(min, max)
- }
-}
-
-/// `MinMaxResult` is an enum returned by `min_max`. See `OrdIterator::min_max` for more detail.
-#[deriving(Clone, Eq, Show)]
-pub enum MinMaxResult<T> {
- /// Empty iterator
- NoElements,
-
- /// Iterator with one element, so the minimum and maximum are the same
- OneElement(T),
-
- /// More than one element in the iterator, the first element is not larger than the second
- MinMax(T, T)
-}
-
-impl<T: Clone> MinMaxResult<T> {
- /// `into_option` creates an `Option` of type `(T,T)`. The returned `Option` has variant
- /// `None` if and only if the `MinMaxResult` has variant `NoElements`. Otherwise variant
- /// `Some(x,y)` is returned where `x <= y`. If `MinMaxResult` has variant `OneElement(x)`,
- /// performing this operation will make one clone of `x`.
- ///
- /// # Example
- ///
- /// ```rust
- /// use std::iter::{NoElements, OneElement, MinMax, MinMaxResult};
- ///
- /// let r: MinMaxResult<int> = NoElements;
- /// assert_eq!(r.into_option(), None)
- ///
- /// let r = OneElement(1);
- /// assert_eq!(r.into_option(), Some((1,1)));
- ///
- /// let r = MinMax(1,2);
- /// assert_eq!(r.into_option(), Some((1,2)));
- /// ```
- pub fn into_option(self) -> Option<(T,T)> {
- match self {
- NoElements => None,
- OneElement(x) => Some((x.clone(), x)),
- MinMax(x, y) => Some((x, y))
- }
- }
-}
-
-/// A trait for iterators that are cloneable.
-pub trait CloneableIterator {
- /// Repeats an iterator endlessly
- ///
- /// # Example
- ///
- /// ```rust
- /// use std::iter::{CloneableIterator, count};
- ///
- /// let a = count(1,1).take(1);
- /// let mut cy = a.cycle();
- /// assert_eq!(cy.next(), Some(1));
- /// assert_eq!(cy.next(), Some(1));
- /// ```
- fn cycle(self) -> Cycle<Self>;
-}
-
-impl<A, T: Clone + Iterator<A>> CloneableIterator for T {
- #[inline]
- fn cycle(self) -> Cycle<T> {
- Cycle{orig: self.clone(), iter: self}
- }
-}
-
-/// An iterator that repeats endlessly
-#[deriving(Clone)]
-pub struct Cycle<T> {
- orig: T,
- iter: T,
-}
-
-impl<A, T: Clone + Iterator<A>> Iterator<A> for Cycle<T> {
- #[inline]
- fn next(&mut self) -> Option<A> {
- match self.iter.next() {
- None => { self.iter = self.orig.clone(); self.iter.next() }
- y => y
- }
- }
-
- #[inline]
- fn size_hint(&self) -> (uint, Option<uint>) {
- // the cycle iterator is either empty or infinite
- match self.orig.size_hint() {
- sz @ (0, Some(0)) => sz,
- (0, _) => (0, None),
- _ => (uint::MAX, None)
- }
- }
-}
-
-impl<A, T: Clone + RandomAccessIterator<A>> RandomAccessIterator<A> for Cycle<T> {
- #[inline]
- fn indexable(&self) -> uint {
- if self.orig.indexable() > 0 {
- uint::MAX
- } else {
- 0
- }
- }
-
- #[inline]
- fn idx(&mut self, index: uint) -> Option<A> {
- let liter = self.iter.indexable();
- let lorig = self.orig.indexable();
- if lorig == 0 {
- None
- } else if index < liter {
- self.iter.idx(index)
- } else {
- self.orig.idx((index - liter) % lorig)
- }
- }
-}
-
-/// An iterator which strings two iterators together
-#[deriving(Clone)]
-pub struct Chain<T, U> {
- a: T,
- b: U,
- flag: bool
-}
-
-impl<A, T: Iterator<A>, U: Iterator<A>> Iterator<A> for Chain<T, U> {
- #[inline]
- fn next(&mut self) -> Option<A> {
- if self.flag {
- self.b.next()
- } else {
- match self.a.next() {
- Some(x) => return Some(x),
- _ => ()
- }
- self.flag = true;
- self.b.next()
- }
- }
-
- #[inline]
- fn size_hint(&self) -> (uint, Option<uint>) {
- let (a_lower, a_upper) = self.a.size_hint();
- let (b_lower, b_upper) = self.b.size_hint();
-
- let lower = a_lower.saturating_add(b_lower);
-
- let upper = match (a_upper, b_upper) {
- (Some(x), Some(y)) => x.checked_add(&y),
- _ => None
- };
-
- (lower, upper)
- }
-}
-
-impl<A, T: DoubleEndedIterator<A>, U: DoubleEndedIterator<A>> DoubleEndedIterator<A>
-for Chain<T, U> {
- #[inline]
- fn next_back(&mut self) -> Option<A> {
- match self.b.next_back() {
- Some(x) => Some(x),
- None => self.a.next_back()
- }
- }
-}
-
-impl<A, T: RandomAccessIterator<A>, U: RandomAccessIterator<A>> RandomAccessIterator<A>
-for Chain<T, U> {
- #[inline]
- fn indexable(&self) -> uint {
- let (a, b) = (self.a.indexable(), self.b.indexable());
- a.saturating_add(b)
- }
-
- #[inline]
- fn idx(&mut self, index: uint) -> Option<A> {
- let len = self.a.indexable();
- if index < len {
- self.a.idx(index)
- } else {
- self.b.idx(index - len)
- }
- }
-}
-
-/// An iterator which iterates two other iterators simultaneously
-#[deriving(Clone)]
-pub struct Zip<T, U> {
- a: T,
- b: U
-}
-
-impl<A, B, T: Iterator<A>, U: Iterator<B>> Iterator<(A, B)> for Zip<T, U> {
- #[inline]
- fn next(&mut self) -> Option<(A, B)> {
- match self.a.next() {
- None => None,
- Some(x) => match self.b.next() {
- None => None,
- Some(y) => Some((x, y))
- }
- }
- }
-
- #[inline]
- fn size_hint(&self) -> (uint, Option<uint>) {
- let (a_lower, a_upper) = self.a.size_hint();
- let (b_lower, b_upper) = self.b.size_hint();
-
- let lower = cmp::min(a_lower, b_lower);
-
- let upper = match (a_upper, b_upper) {
- (Some(x), Some(y)) => Some(cmp::min(x,y)),
- (Some(x), None) => Some(x),
- (None, Some(y)) => Some(y),
- (None, None) => None
- };
-
- (lower, upper)
- }
-}
-
-impl<A, B, T: ExactSize<A>, U: ExactSize<B>> DoubleEndedIterator<(A, B)>
-for Zip<T, U> {
- #[inline]
- fn next_back(&mut self) -> Option<(A, B)> {
- let (a_sz, a_upper) = self.a.size_hint();
- let (b_sz, b_upper) = self.b.size_hint();
- assert!(a_upper == Some(a_sz));
- assert!(b_upper == Some(b_sz));
- if a_sz < b_sz {
- for _ in range(0, b_sz - a_sz) { self.b.next_back(); }
- } else if a_sz > b_sz {
- for _ in range(0, a_sz - b_sz) { self.a.next_back(); }
- }
- let (a_sz, _) = self.a.size_hint();
- let (b_sz, _) = self.b.size_hint();
- assert!(a_sz == b_sz);
- match (self.a.next_back(), self.b.next_back()) {
- (Some(x), Some(y)) => Some((x, y)),
- _ => None
- }
- }
-}
-
-impl<A, B, T: RandomAccessIterator<A>, U: RandomAccessIterator<B>>
-RandomAccessIterator<(A, B)> for Zip<T, U> {
- #[inline]
- fn indexable(&self) -> uint {
- cmp::min(self.a.indexable(), self.b.indexable())
- }
-
- #[inline]
- fn idx(&mut self, index: uint) -> Option<(A, B)> {
- match self.a.idx(index) {
- None => None,
- Some(x) => match self.b.idx(index) {
- None => None,
- Some(y) => Some((x, y))
- }
- }
- }
-}
-
-/// An iterator which maps the values of `iter` with `f`
-pub struct Map<'a, A, B, T> {
- iter: T,
- f: |A|: 'a -> B
-}
-
-impl<'a, A, B, T> Map<'a, A, B, T> {
- #[inline]
- fn do_map(&mut self, elt: Option<A>) -> Option<B> {
- match elt {
- Some(a) => Some((self.f)(a)),
- _ => None
- }
- }
-}
-
-impl<'a, A, B, T: Iterator<A>> Iterator<B> for Map<'a, A, B, T> {
- #[inline]
- fn next(&mut self) -> Option<B> {
- let next = self.iter.next();
- self.do_map(next)
- }
-
- #[inline]
- fn size_hint(&self) -> (uint, Option<uint>) {
- self.iter.size_hint()
- }
-}
-
-impl<'a, A, B, T: DoubleEndedIterator<A>> DoubleEndedIterator<B> for Map<'a, A, B, T> {
- #[inline]
- fn next_back(&mut self) -> Option<B> {
- let next = self.iter.next_back();
- self.do_map(next)
- }
-}
-
-impl<'a, A, B, T: RandomAccessIterator<A>> RandomAccessIterator<B> for Map<'a, A, B, T> {
- #[inline]
- fn indexable(&self) -> uint {
- self.iter.indexable()
- }
-
- #[inline]
- fn idx(&mut self, index: uint) -> Option<B> {
- let elt = self.iter.idx(index);
- self.do_map(elt)
- }
-}
-
-/// An iterator which filters the elements of `iter` with `predicate`
-pub struct Filter<'a, A, T> {
- iter: T,
- predicate: |&A|: 'a -> bool
-}
-
-impl<'a, A, T: Iterator<A>> Iterator<A> for Filter<'a, A, T> {
- #[inline]
- fn next(&mut self) -> Option<A> {
- for x in self.iter {
- if (self.predicate)(&x) {
- return Some(x);
- } else {
- continue
- }
- }
- None
- }
-
- #[inline]
- fn size_hint(&self) -> (uint, Option<uint>) {
- let (_, upper) = self.iter.size_hint();
- (0, upper) // can't know a lower bound, due to the predicate
- }
-}
-
-impl<'a, A, T: DoubleEndedIterator<A>> DoubleEndedIterator<A> for Filter<'a, A, T> {
- #[inline]
- fn next_back(&mut self) -> Option<A> {
- loop {
- match self.iter.next_back() {
- None => return None,
- Some(x) => {
- if (self.predicate)(&x) {
- return Some(x);
- } else {
- continue
- }
- }
- }
- }
- }
-}
-
-/// An iterator which uses `f` to both filter and map elements from `iter`
-pub struct FilterMap<'a, A, B, T> {
- iter: T,
- f: |A|: 'a -> Option<B>
-}
-
-impl<'a, A, B, T: Iterator<A>> Iterator<B> for FilterMap<'a, A, B, T> {
- #[inline]
- fn next(&mut self) -> Option<B> {
- for x in self.iter {
- match (self.f)(x) {
- Some(y) => return Some(y),
- None => ()
- }
- }
- None
- }
-
- #[inline]
- fn size_hint(&self) -> (uint, Option<uint>) {
- let (_, upper) = self.iter.size_hint();
- (0, upper) // can't know a lower bound, due to the predicate
- }
-}
-
-impl<'a, A, B, T: DoubleEndedIterator<A>> DoubleEndedIterator<B>
-for FilterMap<'a, A, B, T> {
- #[inline]
- fn next_back(&mut self) -> Option<B> {
- loop {
- match self.iter.next_back() {
- None => return None,
- Some(x) => {
- match (self.f)(x) {
- Some(y) => return Some(y),
- None => ()
- }
- }
- }
- }
- }
-}
-
-/// An iterator which yields the current count and the element during iteration
-#[deriving(Clone)]
-pub struct Enumerate<T> {
- iter: T,
- count: uint
-}
-
-impl<A, T: Iterator<A>> Iterator<(uint, A)> for Enumerate<T> {
- #[inline]
- fn next(&mut self) -> Option<(uint, A)> {
- match self.iter.next() {
- Some(a) => {
- let ret = Some((self.count, a));
- self.count += 1;
- ret
- }
- _ => None
- }
- }
-
- #[inline]
- fn size_hint(&self) -> (uint, Option<uint>) {
- self.iter.size_hint()
- }
-}
-
-impl<A, T: ExactSize<A>> DoubleEndedIterator<(uint, A)> for Enumerate<T> {
- #[inline]
- fn next_back(&mut self) -> Option<(uint, A)> {
- match self.iter.next_back() {
- Some(a) => {
- let (lower, upper) = self.iter.size_hint();
- assert!(upper == Some(lower));
- Some((self.count + lower, a))
- }
- _ => None
- }
- }
-}
-
-impl<A, T: RandomAccessIterator<A>> RandomAccessIterator<(uint, A)> for Enumerate<T> {
- #[inline]
- fn indexable(&self) -> uint {
- self.iter.indexable()
- }
-
- #[inline]
- fn idx(&mut self, index: uint) -> Option<(uint, A)> {
- match self.iter.idx(index) {
- Some(a) => Some((self.count + index, a)),
- _ => None,
- }
- }
-}
-
-/// An iterator with a `peek()` that returns an optional reference to the next element.
-pub struct Peekable<A, T> {
- iter: T,
- peeked: Option<A>,
-}
-
-impl<A, T: Iterator<A>> Iterator<A> for Peekable<A, T> {
- #[inline]
- fn next(&mut self) -> Option<A> {
- if self.peeked.is_some() { self.peeked.take() }
- else { self.iter.next() }
- }
-
- #[inline]
- fn size_hint(&self) -> (uint, Option<uint>) {
- let (lo, hi) = self.iter.size_hint();
- if self.peeked.is_some() {
- let lo = lo.saturating_add(1);
- let hi = match hi {
- Some(x) => x.checked_add(&1),
- None => None
- };
- (lo, hi)
- } else {
- (lo, hi)
- }
- }
-}
-
-impl<'a, A, T: Iterator<A>> Peekable<A, T> {
- /// Return a reference to the next element of the iterator with out advancing it,
- /// or None if the iterator is exhausted.
- #[inline]
- pub fn peek(&'a mut self) -> Option<&'a A> {
- if self.peeked.is_none() {
- self.peeked = self.iter.next();
- }
- match self.peeked {
- Some(ref value) => Some(value),
- None => None,
- }
- }
-
- /// Check whether peekable iterator is empty or not.
- #[inline]
- pub fn is_empty(&mut self) -> bool {
- self.peek().is_none()
- }
-}
-
-/// An iterator which rejects elements while `predicate` is true
-pub struct SkipWhile<'a, A, T> {
- iter: T,
- flag: bool,
- predicate: |&A|: 'a -> bool
-}
-
-impl<'a, A, T: Iterator<A>> Iterator<A> for SkipWhile<'a, A, T> {
- #[inline]
- fn next(&mut self) -> Option<A> {
- let mut next = self.iter.next();
- if self.flag {
- next
- } else {
- loop {
- match next {
- Some(x) => {
- if (self.predicate)(&x) {
- next = self.iter.next();
- continue
- } else {
- self.flag = true;
- return Some(x)
- }
- }
- None => return None
- }
- }
- }
- }
-
- #[inline]
- fn size_hint(&self) -> (uint, Option<uint>) {
- let (_, upper) = self.iter.size_hint();
- (0, upper) // can't know a lower bound, due to the predicate
- }
-}
-
-/// An iterator which only accepts elements while `predicate` is true
-pub struct TakeWhile<'a, A, T> {
- iter: T,
- flag: bool,
- predicate: |&A|: 'a -> bool
-}
-
-impl<'a, A, T: Iterator<A>> Iterator<A> for TakeWhile<'a, A, T> {
- #[inline]
- fn next(&mut self) -> Option<A> {
- if self.flag {
- None
- } else {
- match self.iter.next() {
- Some(x) => {
- if (self.predicate)(&x) {
- Some(x)
- } else {
- self.flag = true;
- None
- }
- }
- None => None
- }
- }
- }
-
- #[inline]
- fn size_hint(&self) -> (uint, Option<uint>) {
- let (_, upper) = self.iter.size_hint();
- (0, upper) // can't know a lower bound, due to the predicate
- }
-}
-
-/// An iterator which skips over `n` elements of `iter`.
-#[deriving(Clone)]
-pub struct Skip<T> {
- iter: T,
- n: uint
-}
-
-impl<A, T: Iterator<A>> Iterator<A> for Skip<T> {
- #[inline]
- fn next(&mut self) -> Option<A> {
- let mut next = self.iter.next();
- if self.n == 0 {
- next
- } else {
- let mut n = self.n;
- while n > 0 {
- n -= 1;
- match next {
- Some(_) => {
- next = self.iter.next();
- continue
- }
- None => {
- self.n = 0;
- return None
- }
- }
- }
- self.n = 0;
- next
- }
- }
-
- #[inline]
- fn size_hint(&self) -> (uint, Option<uint>) {
- let (lower, upper) = self.iter.size_hint();
-
- let lower = lower.saturating_sub(self.n);
-
- let upper = match upper {
- Some(x) => Some(x.saturating_sub(self.n)),
- None => None
- };
-
- (lower, upper)
- }
-}
-
-impl<A, T: RandomAccessIterator<A>> RandomAccessIterator<A> for Skip<T> {
- #[inline]
- fn indexable(&self) -> uint {
- self.iter.indexable().saturating_sub(self.n)
- }
-
- #[inline]
- fn idx(&mut self, index: uint) -> Option<A> {
- if index >= self.indexable() {
- None
- } else {
- self.iter.idx(index + self.n)
- }
- }
-}
-
-/// An iterator which only iterates over the first `n` iterations of `iter`.
-#[deriving(Clone)]
-pub struct Take<T> {
- iter: T,
- n: uint
-}
-
-impl<A, T: Iterator<A>> Iterator<A> for Take<T> {
- #[inline]
- fn next(&mut self) -> Option<A> {
- if self.n != 0 {
- self.n -= 1;
- self.iter.next()
- } else {
- None
- }
- }
-
- #[inline]
- fn size_hint(&self) -> (uint, Option<uint>) {
- let (lower, upper) = self.iter.size_hint();
-
- let lower = cmp::min(lower, self.n);
-
- let upper = match upper {
- Some(x) if x < self.n => Some(x),
- _ => Some(self.n)
- };
-
- (lower, upper)
- }
-}
-
-impl<A, T: RandomAccessIterator<A>> RandomAccessIterator<A> for Take<T> {
- #[inline]
- fn indexable(&self) -> uint {
- cmp::min(self.iter.indexable(), self.n)
- }
-
- #[inline]
- fn idx(&mut self, index: uint) -> Option<A> {
- if index >= self.n {
- None
- } else {
- self.iter.idx(index)
- }
- }
-}
-
-
-/// An iterator to maintain state while iterating another iterator
-pub struct Scan<'a, A, B, T, St> {
- iter: T,
- f: |&mut St, A|: 'a -> Option<B>,
-
- /// The current internal state to be passed to the closure next.
- pub state: St,
-}
-
-impl<'a, A, B, T: Iterator<A>, St> Iterator<B> for Scan<'a, A, B, T, St> {
- #[inline]
- fn next(&mut self) -> Option<B> {
- self.iter.next().and_then(|a| (self.f)(&mut self.state, a))
- }
-
- #[inline]
- fn size_hint(&self) -> (uint, Option<uint>) {
- let (_, upper) = self.iter.size_hint();
- (0, upper) // can't know a lower bound, due to the scan function
- }
-}
-
-/// An iterator that maps each element to an iterator,
-/// and yields the elements of the produced iterators
-///
-pub struct FlatMap<'a, A, T, U> {
- iter: T,
- f: |A|: 'a -> U,
- frontiter: Option<U>,
- backiter: Option<U>,
-}
-
-impl<'a, A, T: Iterator<A>, B, U: Iterator<B>> Iterator<B> for FlatMap<'a, A, T, U> {
- #[inline]
- fn next(&mut self) -> Option<B> {
- loop {
- for inner in self.frontiter.mut_iter() {
- for x in *inner {
- return Some(x)
- }
- }
- match self.iter.next().map(|x| (self.f)(x)) {
- None => return self.backiter.as_mut().and_then(|it| it.next()),
- next => self.frontiter = next,
- }
- }
- }
-
- #[inline]
- fn size_hint(&self) -> (uint, Option<uint>) {
- let (flo, fhi) = self.frontiter.as_ref().map_or((0, Some(0)), |it| it.size_hint());
- let (blo, bhi) = self.backiter.as_ref().map_or((0, Some(0)), |it| it.size_hint());
- let lo = flo.saturating_add(blo);
- match (self.iter.size_hint(), fhi, bhi) {
- ((0, Some(0)), Some(a), Some(b)) => (lo, a.checked_add(&b)),
- _ => (lo, None)
- }
- }
-}
-
-impl<'a,
- A, T: DoubleEndedIterator<A>,
- B, U: DoubleEndedIterator<B>> DoubleEndedIterator<B>
- for FlatMap<'a, A, T, U> {
- #[inline]
- fn next_back(&mut self) -> Option<B> {
- loop {
- for inner in self.backiter.mut_iter() {
- match inner.next_back() {
- None => (),
- y => return y
- }
- }
- match self.iter.next_back().map(|x| (self.f)(x)) {
- None => return self.frontiter.as_mut().and_then(|it| it.next_back()),
- next => self.backiter = next,
- }
- }
- }
-}
-
-/// An iterator that yields `None` forever after the underlying iterator
-/// yields `None` once.
-#[deriving(Clone)]
-pub struct Fuse<T> {
- iter: T,
- done: bool
-}
-
-impl<A, T: Iterator<A>> Iterator<A> for Fuse<T> {
- #[inline]
- fn next(&mut self) -> Option<A> {
- if self.done {
- None
- } else {
- match self.iter.next() {
- None => {
- self.done = true;
- None
- }
- x => x
- }
- }
- }
-
- #[inline]
- fn size_hint(&self) -> (uint, Option<uint>) {
- if self.done {
- (0, Some(0))
- } else {
- self.iter.size_hint()
- }
- }
-}
-
-impl<A, T: DoubleEndedIterator<A>> DoubleEndedIterator<A> for Fuse<T> {
- #[inline]
- fn next_back(&mut self) -> Option<A> {
- if self.done {
- None
- } else {
- match self.iter.next_back() {
- None => {
- self.done = true;
- None
- }
- x => x
- }
- }
- }
-}
-
-// Allow RandomAccessIterators to be fused without affecting random-access behavior
-impl<A, T: RandomAccessIterator<A>> RandomAccessIterator<A> for Fuse<T> {
- #[inline]
- fn indexable(&self) -> uint {
- self.iter.indexable()
- }
-
- #[inline]
- fn idx(&mut self, index: uint) -> Option<A> {
- self.iter.idx(index)
- }
-}
-
-impl<T> Fuse<T> {
- /// Resets the fuse such that the next call to .next() or .next_back() will
- /// call the underlying iterator again even if it previously returned None.
- #[inline]
- pub fn reset_fuse(&mut self) {
- self.done = false
- }
-}
-
-/// An iterator that calls a function with a reference to each
-/// element before yielding it.
-pub struct Inspect<'a, A, T> {
- iter: T,
- f: |&A|: 'a
-}
-
-impl<'a, A, T> Inspect<'a, A, T> {
- #[inline]
- fn do_inspect(&mut self, elt: Option<A>) -> Option<A> {
- match elt {
- Some(ref a) => (self.f)(a),
- None => ()
- }
-
- elt
- }
-}
-
-impl<'a, A, T: Iterator<A>> Iterator<A> for Inspect<'a, A, T> {
- #[inline]
- fn next(&mut self) -> Option<A> {
- let next = self.iter.next();
- self.do_inspect(next)
- }
-
- #[inline]
- fn size_hint(&self) -> (uint, Option<uint>) {
- self.iter.size_hint()
- }
-}
-
-impl<'a, A, T: DoubleEndedIterator<A>> DoubleEndedIterator<A>
-for Inspect<'a, A, T> {
- #[inline]
- fn next_back(&mut self) -> Option<A> {
- let next = self.iter.next_back();
- self.do_inspect(next)
- }
-}
-
-impl<'a, A, T: RandomAccessIterator<A>> RandomAccessIterator<A>
-for Inspect<'a, A, T> {
- #[inline]
- fn indexable(&self) -> uint {
- self.iter.indexable()
- }
-
- #[inline]
- fn idx(&mut self, index: uint) -> Option<A> {
- let element = self.iter.idx(index);
- self.do_inspect(element)
- }
-}
-
-/// An iterator which just modifies the contained state throughout iteration.
-pub struct Unfold<'a, A, St> {
- f: |&mut St|: 'a -> Option<A>,
- /// Internal state that will be yielded on the next iteration
- pub state: St,
-}
-
-impl<'a, A, St> Unfold<'a, A, St> {
- /// Creates a new iterator with the specified closure as the "iterator
- /// function" and an initial state to eventually pass to the iterator
- #[inline]
- pub fn new<'a>(initial_state: St, f: |&mut St|: 'a -> Option<A>)
- -> Unfold<'a, A, St> {
- Unfold {
- f: f,
- state: initial_state
- }
- }
-}
-
-impl<'a, A, St> Iterator<A> for Unfold<'a, A, St> {
- #[inline]
- fn next(&mut self) -> Option<A> {
- (self.f)(&mut self.state)
- }
-
- #[inline]
- fn size_hint(&self) -> (uint, Option<uint>) {
- // no possible known bounds at this point
- (0, None)
- }
-}
-
-/// An infinite iterator starting at `start` and advancing by `step` with each
-/// iteration
-#[deriving(Clone)]
-pub struct Counter<A> {
- /// The current state the counter is at (next value to be yielded)
- state: A,
- /// The amount that this iterator is stepping by
- step: A,
-}
-
-/// Creates a new counter with the specified start/step
-#[inline]
-pub fn count<A>(start: A, step: A) -> Counter<A> {
- Counter{state: start, step: step}
-}
-
-impl<A: Add<A, A> + Clone> Iterator<A> for Counter<A> {
- #[inline]
- fn next(&mut self) -> Option<A> {
- let result = self.state.clone();
- self.state = self.state + self.step;
- Some(result)
- }
-
- #[inline]
- fn size_hint(&self) -> (uint, Option<uint>) {
- (uint::MAX, None) // Too bad we can't specify an infinite lower bound
- }
-}
-
-/// An iterator over the range [start, stop)
-#[deriving(Clone)]
-pub struct Range<A> {
- state: A,
- stop: A,
- one: A
-}
-
-/// Return an iterator over the range [start, stop)
-#[inline]
-pub fn range<A: Add<A, A> + Ord + Clone + One>(start: A, stop: A) -> Range<A> {
- Range{state: start, stop: stop, one: One::one()}
-}
-
-// FIXME: #10414: Unfortunate type bound
-impl<A: Add<A, A> + Ord + Clone + ToPrimitive> Iterator<A> for Range<A> {
- #[inline]
- fn next(&mut self) -> Option<A> {
- if self.state < self.stop {
- let result = self.state.clone();
- self.state = self.state + self.one;
- Some(result)
- } else {
- None
- }
- }
-
- #[inline]
- fn size_hint(&self) -> (uint, Option<uint>) {
- // This first checks if the elements are representable as i64. If they aren't, try u64 (to
- // handle cases like range(huge, huger)). We don't use uint/int because the difference of
- // the i64/u64 might lie within their range.
- let bound = match self.state.to_i64() {
- Some(a) => {
- let sz = self.stop.to_i64().map(|b| b.checked_sub(&a));
- match sz {
- Some(Some(bound)) => bound.to_uint(),
- _ => None,
- }
- },
- None => match self.state.to_u64() {
- Some(a) => {
- let sz = self.stop.to_u64().map(|b| b.checked_sub(&a));
- match sz {
- Some(Some(bound)) => bound.to_uint(),
- _ => None
- }
- },
- None => None
- }
- };
-
- match bound {
- Some(b) => (b, Some(b)),
- // Standard fallback for unbounded/unrepresentable bounds
- None => (0, None)
- }
- }
-}
-
-/// `Int` is required to ensure the range will be the same regardless of
-/// the direction it is consumed.
-impl<A: Int + Ord + Clone + ToPrimitive> DoubleEndedIterator<A> for Range<A> {
- #[inline]
- fn next_back(&mut self) -> Option<A> {
- if self.stop > self.state {
- self.stop = self.stop - self.one;
- Some(self.stop.clone())
- } else {
- None
- }
- }
-}
-
-/// An iterator over the range [start, stop]
-#[deriving(Clone)]
-pub struct RangeInclusive<A> {
- range: Range<A>,
- done: bool,
-}
-
-/// Return an iterator over the range [start, stop]
-#[inline]
-pub fn range_inclusive<A: Add<A, A> + Ord + Clone + One + ToPrimitive>(start: A, stop: A)
- -> RangeInclusive<A> {
- RangeInclusive{range: range(start, stop), done: false}
-}
-
-impl<A: Add<A, A> + Ord + Clone + ToPrimitive> Iterator<A> for RangeInclusive<A> {
- #[inline]
- fn next(&mut self) -> Option<A> {
- match self.range.next() {
- Some(x) => Some(x),
- None => {
- if !self.done && self.range.state == self.range.stop {
- self.done = true;
- Some(self.range.stop.clone())
- } else {
- None
- }
- }
- }
- }
-
- #[inline]
- fn size_hint(&self) -> (uint, Option<uint>) {
- let (lo, hi) = self.range.size_hint();
- if self.done {
- (lo, hi)
- } else {
- let lo = lo.saturating_add(1);
- let hi = match hi {
- Some(x) => x.checked_add(&1),
- None => None
- };
- (lo, hi)
- }
- }
-}
-
-impl<A: Sub<A, A> + Int + Ord + Clone + ToPrimitive> DoubleEndedIterator<A>
- for RangeInclusive<A> {
- #[inline]
- fn next_back(&mut self) -> Option<A> {
- if self.range.stop > self.range.state {
- let result = self.range.stop.clone();
- self.range.stop = self.range.stop - self.range.one;
- Some(result)
- } else if !self.done && self.range.state == self.range.stop {
- self.done = true;
- Some(self.range.stop.clone())
- } else {
- None
- }
- }
-}
-
-/// An iterator over the range [start, stop) by `step`. It handles overflow by stopping.
-#[deriving(Clone)]
-pub struct RangeStep<A> {
- state: A,
- stop: A,
- step: A,
- rev: bool,
-}
-
-/// Return an iterator over the range [start, stop) by `step`. It handles overflow by stopping.
-#[inline]
-pub fn range_step<A: CheckedAdd + Ord + Clone + Zero>(start: A, stop: A, step: A) -> RangeStep<A> {
- let rev = step < Zero::zero();
- RangeStep{state: start, stop: stop, step: step, rev: rev}
-}
-
-impl<A: CheckedAdd + Ord + Clone> Iterator<A> for RangeStep<A> {
- #[inline]
- fn next(&mut self) -> Option<A> {
- if (self.rev && self.state > self.stop) || (!self.rev && self.state < self.stop) {
- let result = self.state.clone();
- match self.state.checked_add(&self.step) {
- Some(x) => self.state = x,
- None => self.state = self.stop.clone()
- }
- Some(result)
- } else {
- None
- }
- }
-}
-
-/// An iterator over the range [start, stop] by `step`. It handles overflow by stopping.
-#[deriving(Clone)]
-pub struct RangeStepInclusive<A> {
- state: A,
- stop: A,
- step: A,
- rev: bool,
- done: bool,
-}
-
-/// Return an iterator over the range [start, stop] by `step`. It handles overflow by stopping.
-#[inline]
-pub fn range_step_inclusive<A: CheckedAdd + Ord + Clone + Zero>(start: A, stop: A,
- step: A) -> RangeStepInclusive<A> {
- let rev = step < Zero::zero();
- RangeStepInclusive{state: start, stop: stop, step: step, rev: rev, done: false}
-}
-
-impl<A: CheckedAdd + Ord + Clone + Eq> Iterator<A> for RangeStepInclusive<A> {
- #[inline]
- fn next(&mut self) -> Option<A> {
- if !self.done && ((self.rev && self.state >= self.stop) ||
- (!self.rev && self.state <= self.stop)) {
- let result = self.state.clone();
- match self.state.checked_add(&self.step) {
- Some(x) => self.state = x,
- None => self.done = true
- }
- Some(result)
- } else {
- None
- }
- }
-}
-
-/// An iterator that repeats an element endlessly
-#[deriving(Clone)]
-pub struct Repeat<A> {
- element: A
-}
-
-impl<A: Clone> Repeat<A> {
- /// Create a new `Repeat` that endlessly repeats the element `elt`.
- #[inline]
- pub fn new(elt: A) -> Repeat<A> {
- Repeat{element: elt}
- }
-}
-
-impl<A: Clone> Iterator<A> for Repeat<A> {
- #[inline]
- fn next(&mut self) -> Option<A> { self.idx(0) }
- #[inline]
- fn size_hint(&self) -> (uint, Option<uint>) { (uint::MAX, None) }
-}
-
-impl<A: Clone> DoubleEndedIterator<A> for Repeat<A> {
- #[inline]
- fn next_back(&mut self) -> Option<A> { self.idx(0) }
-}
-
-impl<A: Clone> RandomAccessIterator<A> for Repeat<A> {
- #[inline]
- fn indexable(&self) -> uint { uint::MAX }
- #[inline]
- fn idx(&mut self, _: uint) -> Option<A> { Some(self.element.clone()) }
-}
-
-/// Functions for lexicographical ordering of sequences.
-///
-/// Lexicographical ordering through `<`, `<=`, `>=`, `>` requires
-/// that the elements implement both `Eq` and `Ord`.
-///
-/// If two sequences are equal up until the point where one ends,
-/// the shorter sequence compares less.
-pub mod order {
- use cmp;
- use cmp::{TotalEq, TotalOrd, Ord, Eq};
- use option::{Some, None};
- use super::Iterator;
-
- /// Compare `a` and `b` for equality using `TotalEq`
- pub fn equals<A: TotalEq, T: Iterator<A>>(mut a: T, mut b: T) -> bool {
- loop {
- match (a.next(), b.next()) {
- (None, None) => return true,
- (None, _) | (_, None) => return false,
- (Some(x), Some(y)) => if x != y { return false },
- }
- }
- }
-
- /// Order `a` and `b` lexicographically using `TotalOrd`
- pub fn cmp<A: TotalOrd, T: Iterator<A>>(mut a: T, mut b: T) -> cmp::Ordering {
- loop {
- match (a.next(), b.next()) {
- (None, None) => return cmp::Equal,
- (None, _ ) => return cmp::Less,
- (_ , None) => return cmp::Greater,
- (Some(x), Some(y)) => match x.cmp(&y) {
- cmp::Equal => (),
- non_eq => return non_eq,
- },
- }
- }
- }
-
- /// Compare `a` and `b` for equality (Using partial equality, `Eq`)
- pub fn eq<A: Eq, T: Iterator<A>>(mut a: T, mut b: T) -> bool {
- loop {
- match (a.next(), b.next()) {
- (None, None) => return true,
- (None, _) | (_, None) => return false,
- (Some(x), Some(y)) => if !x.eq(&y) { return false },
- }
- }
- }
-
- /// Compare `a` and `b` for nonequality (Using partial equality, `Eq`)
- pub fn ne<A: Eq, T: Iterator<A>>(mut a: T, mut b: T) -> bool {
- loop {
- match (a.next(), b.next()) {
- (None, None) => return false,
- (None, _) | (_, None) => return true,
- (Some(x), Some(y)) => if x.ne(&y) { return true },
- }
- }
- }
-
- /// Return `a` < `b` lexicographically (Using partial order, `Ord`)
- pub fn lt<A: Ord, T: Iterator<A>>(mut a: T, mut b: T) -> bool {
- loop {
- match (a.next(), b.next()) {
- (None, None) => return false,
- (None, _ ) => return true,
- (_ , None) => return false,
- (Some(x), Some(y)) => if x.ne(&y) { return x.lt(&y) },
- }
- }
- }
-
- /// Return `a` <= `b` lexicographically (Using partial order, `Ord`)
- pub fn le<A: Ord, T: Iterator<A>>(mut a: T, mut b: T) -> bool {
- loop {
- match (a.next(), b.next()) {
- (None, None) => return true,
- (None, _ ) => return true,
- (_ , None) => return false,
- (Some(x), Some(y)) => if x.ne(&y) { return x.le(&y) },
- }
- }
- }
-
- /// Return `a` > `b` lexicographically (Using partial order, `Ord`)
- pub fn gt<A: Ord, T: Iterator<A>>(mut a: T, mut b: T) -> bool {
- loop {
- match (a.next(), b.next()) {
- (None, None) => return false,
- (None, _ ) => return false,
- (_ , None) => return true,
- (Some(x), Some(y)) => if x.ne(&y) { return x.gt(&y) },
- }
- }
- }
-
- /// Return `a` >= `b` lexicographically (Using partial order, `Ord`)
- pub fn ge<A: Ord, T: Iterator<A>>(mut a: T, mut b: T) -> bool {
- loop {
- match (a.next(), b.next()) {
- (None, None) => return true,
- (None, _ ) => return false,
- (_ , None) => return true,
- (Some(x), Some(y)) => if x.ne(&y) { return x.ge(&y) },
- }
- }
- }
-
- #[test]
- fn test_lt() {
- use slice::ImmutableVector;
-
- let empty: [int, ..0] = [];
- let xs = [1,2,3];
- let ys = [1,2,0];
-
- assert!(!lt(xs.iter(), ys.iter()));
- assert!(!le(xs.iter(), ys.iter()));
- assert!( gt(xs.iter(), ys.iter()));
- assert!( ge(xs.iter(), ys.iter()));
-
- assert!( lt(ys.iter(), xs.iter()));
- assert!( le(ys.iter(), xs.iter()));
- assert!(!gt(ys.iter(), xs.iter()));
- assert!(!ge(ys.iter(), xs.iter()));
-
- assert!( lt(empty.iter(), xs.iter()));
- assert!( le(empty.iter(), xs.iter()));
- assert!(!gt(empty.iter(), xs.iter()));
- assert!(!ge(empty.iter(), xs.iter()));
-
- // Sequence with NaN
- let u = [1.0, 2.0];
- let v = [0.0/0.0, 3.0];
-
- assert!(!lt(u.iter(), v.iter()));
- assert!(!le(u.iter(), v.iter()));
- assert!(!gt(u.iter(), v.iter()));
- assert!(!ge(u.iter(), v.iter()));
-
- let a = [0.0/0.0];
- let b = [1.0];
- let c = [2.0];
-
- assert!(lt(a.iter(), b.iter()) == (a[0] < b[0]));
- assert!(le(a.iter(), b.iter()) == (a[0] <= b[0]));
- assert!(gt(a.iter(), b.iter()) == (a[0] > b[0]));
- assert!(ge(a.iter(), b.iter()) == (a[0] >= b[0]));
-
- assert!(lt(c.iter(), b.iter()) == (c[0] < b[0]));
- assert!(le(c.iter(), b.iter()) == (c[0] <= b[0]));
- assert!(gt(c.iter(), b.iter()) == (c[0] > b[0]));
- assert!(ge(c.iter(), b.iter()) == (c[0] >= b[0]));
- }
-}
-
-#[cfg(test)]
-mod tests {
- use super::*;
- use prelude::*;
-
- use cmp;
- use owned::Box;
- use uint;
- use num;
-
- #[test]
- fn test_counter_from_iter() {
- let it = count(0, 5).take(10);
- let xs: ~[int] = FromIterator::from_iter(it);
- assert_eq!(xs, box [0, 5, 10, 15, 20, 25, 30, 35, 40, 45]);
- }
-
- #[test]
- fn test_iterator_chain() {
- let xs = [0u, 1, 2, 3, 4, 5];
- let ys = [30u, 40, 50, 60];
- let expected = [0, 1, 2, 3, 4, 5, 30, 40, 50, 60];
- let mut it = xs.iter().chain(ys.iter());
- let mut i = 0;
- for &x in it {
- assert_eq!(x, expected[i]);
- i += 1;
- }
- assert_eq!(i, expected.len());
-
- let ys = count(30u, 10).take(4);
- let mut it = xs.iter().map(|&x| x).chain(ys);
- let mut i = 0;
- for x in it {
- assert_eq!(x, expected[i]);
- i += 1;
- }
- assert_eq!(i, expected.len());
- }
-
- #[test]
- fn test_filter_map() {
- let mut it = count(0u, 1u).take(10)
- .filter_map(|x| if x % 2 == 0 { Some(x*x) } else { None });
- assert_eq!(it.collect::<~[uint]>(), box [0*0, 2*2, 4*4, 6*6, 8*8]);
- }
-
- #[test]
- fn test_iterator_enumerate() {
- let xs = [0u, 1, 2, 3, 4, 5];
- let mut it = xs.iter().enumerate();
- for (i, &x) in it {
- assert_eq!(i, x);
- }
- }
-
- #[test]
- fn test_iterator_peekable() {
- let xs = box [0u, 1, 2, 3, 4, 5];
- let mut it = xs.iter().map(|&x|x).peekable();
- assert_eq!(it.peek().unwrap(), &0);
- assert_eq!(it.next().unwrap(), 0);
- assert_eq!(it.next().unwrap(), 1);
- assert_eq!(it.next().unwrap(), 2);
- assert_eq!(it.peek().unwrap(), &3);
- assert_eq!(it.peek().unwrap(), &3);
- assert_eq!(it.next().unwrap(), 3);
- assert_eq!(it.next().unwrap(), 4);
- assert_eq!(it.peek().unwrap(), &5);
- assert_eq!(it.next().unwrap(), 5);
- assert!(it.peek().is_none());
- assert!(it.next().is_none());
- }
-
- #[test]
- fn test_iterator_take_while() {
- let xs = [0u, 1, 2, 3, 5, 13, 15, 16, 17, 19];
- let ys = [0u, 1, 2, 3, 5, 13];
- let mut it = xs.iter().take_while(|&x| *x < 15u);
- let mut i = 0;
- for &x in it {
- assert_eq!(x, ys[i]);
- i += 1;
- }
- assert_eq!(i, ys.len());
- }
-
- #[test]
- fn test_iterator_skip_while() {
- let xs = [0u, 1, 2, 3, 5, 13, 15, 16, 17, 19];
- let ys = [15, 16, 17, 19];
- let mut it = xs.iter().skip_while(|&x| *x < 15u);
- let mut i = 0;
- for &x in it {
- assert_eq!(x, ys[i]);
- i += 1;
- }
- assert_eq!(i, ys.len());
- }
-
- #[test]
- fn test_iterator_skip() {
- let xs = [0u, 1, 2, 3, 5, 13, 15, 16, 17, 19, 20, 30];
- let ys = [13, 15, 16, 17, 19, 20, 30];
- let mut it = xs.iter().skip(5);
- let mut i = 0;
- for &x in it {
- assert_eq!(x, ys[i]);
- i += 1;
- }
- assert_eq!(i, ys.len());
- }
-
- #[test]
- fn test_iterator_take() {
- let xs = [0u, 1, 2, 3, 5, 13, 15, 16, 17, 19];
- let ys = [0u, 1, 2, 3, 5];
- let mut it = xs.iter().take(5);
- let mut i = 0;
- for &x in it {
- assert_eq!(x, ys[i]);
- i += 1;
- }
- assert_eq!(i, ys.len());
- }
-
- #[test]
- fn test_iterator_scan() {
- // test the type inference
- fn add(old: &mut int, new: &uint) -> Option<f64> {
- *old += *new as int;
- Some(*old as f64)
- }
- let xs = [0u, 1, 2, 3, 4];
- let ys = [0f64, 1.0, 3.0, 6.0, 10.0];
-
- let mut it = xs.iter().scan(0, add);
- let mut i = 0;
- for x in it {
- assert_eq!(x, ys[i]);
- i += 1;
- }
- assert_eq!(i, ys.len());
- }
-
- #[test]
- fn test_iterator_flat_map() {
- let xs = [0u, 3, 6];
- let ys = [0u, 1, 2, 3, 4, 5, 6, 7, 8];
- let mut it = xs.iter().flat_map(|&x| count(x, 1).take(3));
- let mut i = 0;
- for x in it {
- assert_eq!(x, ys[i]);
- i += 1;
- }
- assert_eq!(i, ys.len());
- }
-
- #[test]
- fn test_inspect() {
- let xs = [1u, 2, 3, 4];
- let mut n = 0;
-
- let ys = xs.iter()
- .map(|&x| x)
- .inspect(|_| n += 1)
- .collect::<~[uint]>();
-
- assert_eq!(n, xs.len());
- assert_eq!(xs.as_slice(), ys.as_slice());
- }
-
- #[test]
- fn test_unfoldr() {
- fn count(st: &mut uint) -> Option<uint> {
- if *st < 10 {
- let ret = Some(*st);
- *st += 1;
- ret
- } else {
- None
- }
- }
-
- let mut it = Unfold::new(0, count);
- let mut i = 0;
- for counted in it {
- assert_eq!(counted, i);
- i += 1;
- }
- assert_eq!(i, 10);
- }
-
- #[test]
- fn test_cycle() {
- let cycle_len = 3;
- let it = count(0u, 1).take(cycle_len).cycle();
- assert_eq!(it.size_hint(), (uint::MAX, None));
- for (i, x) in it.take(100).enumerate() {
- assert_eq!(i % cycle_len, x);
- }
-
- let mut it = count(0u, 1).take(0).cycle();
- assert_eq!(it.size_hint(), (0, Some(0)));
- assert_eq!(it.next(), None);
- }
-
- #[test]
- fn test_iterator_nth() {
- let v = &[0, 1, 2, 3, 4];
- for i in range(0u, v.len()) {
- assert_eq!(v.iter().nth(i).unwrap(), &v[i]);
- }
- }
-
- #[test]
- fn test_iterator_last() {
- let v = &[0, 1, 2, 3, 4];
- assert_eq!(v.iter().last().unwrap(), &4);
- assert_eq!(v.slice(0, 1).iter().last().unwrap(), &0);
- }
-
- #[test]
- fn test_iterator_len() {
- let v = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
- assert_eq!(v.slice(0, 4).iter().len(), 4);
- assert_eq!(v.slice(0, 10).iter().len(), 10);
- assert_eq!(v.slice(0, 0).iter().len(), 0);
- }
-
- #[test]
- fn test_iterator_sum() {
- let v = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
- assert_eq!(v.slice(0, 4).iter().map(|&x| x).sum(), 6);
- assert_eq!(v.iter().map(|&x| x).sum(), 55);
- assert_eq!(v.slice(0, 0).iter().map(|&x| x).sum(), 0);
- }
-
- #[test]
- fn test_iterator_product() {
- let v = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
- assert_eq!(v.slice(0, 4).iter().map(|&x| x).product(), 0);
- assert_eq!(v.slice(1, 5).iter().map(|&x| x).product(), 24);
- assert_eq!(v.slice(0, 0).iter().map(|&x| x).product(), 1);
- }
-
- #[test]
- fn test_iterator_max() {
- let v = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
- assert_eq!(v.slice(0, 4).iter().map(|&x| x).max(), Some(3));
- assert_eq!(v.iter().map(|&x| x).max(), Some(10));
- assert_eq!(v.slice(0, 0).iter().map(|&x| x).max(), None);
- }
-
- #[test]
- fn test_iterator_min() {
- let v = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
- assert_eq!(v.slice(0, 4).iter().map(|&x| x).min(), Some(0));
- assert_eq!(v.iter().map(|&x| x).min(), Some(0));
- assert_eq!(v.slice(0, 0).iter().map(|&x| x).min(), None);
- }
-
- #[test]
- fn test_iterator_size_hint() {
- let c = count(0, 1);
- let v = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
- let v2 = &[10, 11, 12];
- let vi = v.iter();
-
- assert_eq!(c.size_hint(), (uint::MAX, None));
- assert_eq!(vi.size_hint(), (10, Some(10)));
-
- assert_eq!(c.take(5).size_hint(), (5, Some(5)));
- assert_eq!(c.skip(5).size_hint().val1(), None);
- assert_eq!(c.take_while(|_| false).size_hint(), (0, None));
- assert_eq!(c.skip_while(|_| false).size_hint(), (0, None));
- assert_eq!(c.enumerate().size_hint(), (uint::MAX, None));
- assert_eq!(c.chain(vi.map(|&i| i)).size_hint(), (uint::MAX, None));
- assert_eq!(c.zip(vi).size_hint(), (10, Some(10)));
- assert_eq!(c.scan(0, |_,_| Some(0)).size_hint(), (0, None));
- assert_eq!(c.filter(|_| false).size_hint(), (0, None));
- assert_eq!(c.map(|_| 0).size_hint(), (uint::MAX, None));
- assert_eq!(c.filter_map(|_| Some(0)).size_hint(), (0, None));
-
- assert_eq!(vi.take(5).size_hint(), (5, Some(5)));
- assert_eq!(vi.take(12).size_hint(), (10, Some(10)));
- assert_eq!(vi.skip(3).size_hint(), (7, Some(7)));
- assert_eq!(vi.skip(12).size_hint(), (0, Some(0)));
- assert_eq!(vi.take_while(|_| false).size_hint(), (0, Some(10)));
- assert_eq!(vi.skip_while(|_| false).size_hint(), (0, Some(10)));
- assert_eq!(vi.enumerate().size_hint(), (10, Some(10)));
- assert_eq!(vi.chain(v2.iter()).size_hint(), (13, Some(13)));
- assert_eq!(vi.zip(v2.iter()).size_hint(), (3, Some(3)));
- assert_eq!(vi.scan(0, |_,_| Some(0)).size_hint(), (0, Some(10)));
- assert_eq!(vi.filter(|_| false).size_hint(), (0, Some(10)));
- assert_eq!(vi.map(|i| i+1).size_hint(), (10, Some(10)));
- assert_eq!(vi.filter_map(|_| Some(0)).size_hint(), (0, Some(10)));
- }
-
- #[test]
- fn test_collect() {
- let a = box [1, 2, 3, 4, 5];
- let b: ~[int] = a.iter().map(|&x| x).collect();
- assert_eq!(a, b);
- }
-
- #[test]
- fn test_all() {
- let v: Box<&[int]> = box &[1, 2, 3, 4, 5];
- assert!(v.iter().all(|&x| x < 10));
- assert!(!v.iter().all(|&x| x % 2 == 0));
- assert!(!v.iter().all(|&x| x > 100));
- assert!(v.slice(0, 0).iter().all(|_| fail!()));
- }
-
- #[test]
- fn test_any() {
- let v: Box<&[int]> = box &[1, 2, 3, 4, 5];
- assert!(v.iter().any(|&x| x < 10));
- assert!(v.iter().any(|&x| x % 2 == 0));
- assert!(!v.iter().any(|&x| x > 100));
- assert!(!v.slice(0, 0).iter().any(|_| fail!()));
- }
-
- #[test]
- fn test_find() {
- let v: &[int] = &[1, 3, 9, 27, 103, 14, 11];
- assert_eq!(*v.iter().find(|x| *x & 1 == 0).unwrap(), 14);
- assert_eq!(*v.iter().find(|x| *x % 3 == 0).unwrap(), 3);
- assert!(v.iter().find(|x| *x % 12 == 0).is_none());
- }
-
- #[test]
- fn test_position() {
- let v = &[1, 3, 9, 27, 103, 14, 11];
- assert_eq!(v.iter().position(|x| *x & 1 == 0).unwrap(), 5);
- assert_eq!(v.iter().position(|x| *x % 3 == 0).unwrap(), 1);
- assert!(v.iter().position(|x| *x % 12 == 0).is_none());
- }
-
- #[test]
- fn test_count() {
- let xs = &[1, 2, 2, 1, 5, 9, 0, 2];
- assert_eq!(xs.iter().count(|x| *x == 2), 3);
- assert_eq!(xs.iter().count(|x| *x == 5), 1);
- assert_eq!(xs.iter().count(|x| *x == 95), 0);
- }
-
- #[test]
- fn test_max_by() {
- let xs: &[int] = &[-3, 0, 1, 5, -10];
- assert_eq!(*xs.iter().max_by(|x| x.abs()).unwrap(), -10);
- }
-
- #[test]
- fn test_min_by() {
- let xs: &[int] = &[-3, 0, 1, 5, -10];
- assert_eq!(*xs.iter().min_by(|x| x.abs()).unwrap(), 0);
- }
-
- #[test]
- fn test_by_ref() {
- let mut xs = range(0, 10);
- // sum the first five values
- let partial_sum = xs.by_ref().take(5).fold(0, |a, b| a + b);
- assert_eq!(partial_sum, 10);
- assert_eq!(xs.next(), Some(5));
- }
-
- #[test]
- fn test_rev() {
- let xs = [2, 4, 6, 8, 10, 12, 14, 16];
- let mut it = xs.iter();
- it.next();
- it.next();
- assert_eq!(it.rev().map(|&x| x).collect::<~[int]>(), box [16, 14, 12, 10, 8, 6]);
- }
-
- #[test]
- fn test_double_ended_map() {
- let xs = [1, 2, 3, 4, 5, 6];
- let mut it = xs.iter().map(|&x| x * -1);
- assert_eq!(it.next(), Some(-1));
- assert_eq!(it.next(), Some(-2));
- assert_eq!(it.next_back(), Some(-6));
- assert_eq!(it.next_back(), Some(-5));
- assert_eq!(it.next(), Some(-3));
- assert_eq!(it.next_back(), Some(-4));
- assert_eq!(it.next(), None);
- }
-
- #[test]
- fn test_double_ended_enumerate() {
- let xs = [1, 2, 3, 4, 5, 6];
- let mut it = xs.iter().map(|&x| x).enumerate();
- assert_eq!(it.next(), Some((0, 1)));
- assert_eq!(it.next(), Some((1, 2)));
- assert_eq!(it.next_back(), Some((5, 6)));
- assert_eq!(it.next_back(), Some((4, 5)));
- assert_eq!(it.next_back(), Some((3, 4)));
- assert_eq!(it.next_back(), Some((2, 3)));
- assert_eq!(it.next(), None);
- }
-
- #[test]
- fn test_double_ended_zip() {
- let xs = [1, 2, 3, 4, 5, 6];
- let ys = [1, 2, 3, 7];
- let a = xs.iter().map(|&x| x);
- let b = ys.iter().map(|&x| x);
- let mut it = a.zip(b);
- assert_eq!(it.next(), Some((1, 1)));
- assert_eq!(it.next(), Some((2, 2)));
- assert_eq!(it.next_back(), Some((4, 7)));
- assert_eq!(it.next_back(), Some((3, 3)));
- assert_eq!(it.next(), None);
- }
-
- #[test]
- fn test_double_ended_filter() {
- let xs = [1, 2, 3, 4, 5, 6];
- let mut it = xs.iter().filter(|&x| *x & 1 == 0);
- assert_eq!(it.next_back().unwrap(), &6);
- assert_eq!(it.next_back().unwrap(), &4);
- assert_eq!(it.next().unwrap(), &2);
- assert_eq!(it.next_back(), None);
- }
-
- #[test]
- fn test_double_ended_filter_map() {
- let xs = [1, 2, 3, 4, 5, 6];
- let mut it = xs.iter().filter_map(|&x| if x & 1 == 0 { Some(x * 2) } else { None });
- assert_eq!(it.next_back().unwrap(), 12);
- assert_eq!(it.next_back().unwrap(), 8);
- assert_eq!(it.next().unwrap(), 4);
- assert_eq!(it.next_back(), None);
- }
-
- #[test]
- fn test_double_ended_chain() {
- let xs = [1, 2, 3, 4, 5];
- let ys = box [7, 9, 11];
- let mut it = xs.iter().chain(ys.iter()).rev();
- assert_eq!(it.next().unwrap(), &11)
- assert_eq!(it.next().unwrap(), &9)
- assert_eq!(it.next_back().unwrap(), &1)
- assert_eq!(it.next_back().unwrap(), &2)
- assert_eq!(it.next_back().unwrap(), &3)
- assert_eq!(it.next_back().unwrap(), &4)
- assert_eq!(it.next_back().unwrap(), &5)
- assert_eq!(it.next_back().unwrap(), &7)
- assert_eq!(it.next_back(), None)
- }
-
- #[test]
- fn test_rposition() {
- fn f(xy: &(int, char)) -> bool { let (_x, y) = *xy; y == 'b' }
- fn g(xy: &(int, char)) -> bool { let (_x, y) = *xy; y == 'd' }
- let v = box [(0, 'a'), (1, 'b'), (2, 'c'), (3, 'b')];
-
- assert_eq!(v.iter().rposition(f), Some(3u));
- assert!(v.iter().rposition(g).is_none());
- }
-
- #[test]
- #[should_fail]
- fn test_rposition_fail() {
- let v = [(box 0, @0), (box 0, @0), (box 0, @0), (box 0, @0)];
- let mut i = 0;
- v.iter().rposition(|_elt| {
- if i == 2 {
- fail!()
- }
- i += 1;
- false
- });
- }
-
-
- #[cfg(test)]
- fn check_randacc_iter<A: Eq, T: Clone + RandomAccessIterator<A>>(a: T, len: uint)
- {
- let mut b = a.clone();
- assert_eq!(len, b.indexable());
- let mut n = 0;
- for (i, elt) in a.enumerate() {
- assert!(Some(elt) == b.idx(i));
- n += 1;
- }
- assert_eq!(n, len);
- assert!(None == b.idx(n));
- // call recursively to check after picking off an element
- if len > 0 {
- b.next();
- check_randacc_iter(b, len-1);
- }
- }
-
-
- #[test]
- fn test_double_ended_flat_map() {
- let u = [0u,1];
- let v = [5,6,7,8];
- let mut it = u.iter().flat_map(|x| v.slice(*x, v.len()).iter());
- assert_eq!(it.next_back().unwrap(), &8);
- assert_eq!(it.next().unwrap(), &5);
- assert_eq!(it.next_back().unwrap(), &7);
- assert_eq!(it.next_back().unwrap(), &6);
- assert_eq!(it.next_back().unwrap(), &8);
- assert_eq!(it.next().unwrap(), &6);
- assert_eq!(it.next_back().unwrap(), &7);
- assert_eq!(it.next_back(), None);
- assert_eq!(it.next(), None);
- assert_eq!(it.next_back(), None);
- }
-
- #[test]
- fn test_random_access_chain() {
- let xs = [1, 2, 3, 4, 5];
- let ys = box [7, 9, 11];
- let mut it = xs.iter().chain(ys.iter());
- assert_eq!(it.idx(0).unwrap(), &1);
- assert_eq!(it.idx(5).unwrap(), &7);
- assert_eq!(it.idx(7).unwrap(), &11);
- assert!(it.idx(8).is_none());
-
- it.next();
- it.next();
- it.next_back();
-
- assert_eq!(it.idx(0).unwrap(), &3);
- assert_eq!(it.idx(4).unwrap(), &9);
- assert!(it.idx(6).is_none());
-
- check_randacc_iter(it, xs.len() + ys.len() - 3);
- }
-
- #[test]
- fn test_random_access_enumerate() {
- let xs = [1, 2, 3, 4, 5];
- check_randacc_iter(xs.iter().enumerate(), xs.len());
- }
-
- #[test]
- fn test_random_access_rev() {
- let xs = [1, 2, 3, 4, 5];
- check_randacc_iter(xs.iter().rev(), xs.len());
- let mut it = xs.iter().rev();
- it.next();
- it.next_back();
- it.next();
- check_randacc_iter(it, xs.len() - 3);
- }
-
- #[test]
- fn test_random_access_zip() {
- let xs = [1, 2, 3, 4, 5];
- let ys = [7, 9, 11];
- check_randacc_iter(xs.iter().zip(ys.iter()), cmp::min(xs.len(), ys.len()));
- }
-
- #[test]
- fn test_random_access_take() {
- let xs = [1, 2, 3, 4, 5];
- let empty: &[int] = [];
- check_randacc_iter(xs.iter().take(3), 3);
- check_randacc_iter(xs.iter().take(20), xs.len());
- check_randacc_iter(xs.iter().take(0), 0);
- check_randacc_iter(empty.iter().take(2), 0);
- }
-
- #[test]
- fn test_random_access_skip() {
- let xs = [1, 2, 3, 4, 5];
- let empty: &[int] = [];
- check_randacc_iter(xs.iter().skip(2), xs.len() - 2);
- check_randacc_iter(empty.iter().skip(2), 0);
- }
-
- #[test]
- fn test_random_access_inspect() {
- let xs = [1, 2, 3, 4, 5];
-
- // test .map and .inspect that don't implement Clone
- let mut it = xs.iter().inspect(|_| {});
- assert_eq!(xs.len(), it.indexable());
- for (i, elt) in xs.iter().enumerate() {
- assert_eq!(Some(elt), it.idx(i));
- }
-
- }
-
- #[test]
- fn test_random_access_map() {
- let xs = [1, 2, 3, 4, 5];
-
- let mut it = xs.iter().map(|x| *x);
- assert_eq!(xs.len(), it.indexable());
- for (i, elt) in xs.iter().enumerate() {
- assert_eq!(Some(*elt), it.idx(i));
- }
- }
-
- #[test]
- fn test_random_access_cycle() {
- let xs = [1, 2, 3, 4, 5];
- let empty: &[int] = [];
- check_randacc_iter(xs.iter().cycle().take(27), 27);
- check_randacc_iter(empty.iter().cycle(), 0);
- }
-
- #[test]
- fn test_double_ended_range() {
- assert_eq!(range(11i, 14).rev().collect::<~[int]>(), box [13i, 12, 11]);
- for _ in range(10i, 0).rev() {
- fail!("unreachable");
- }
-
- assert_eq!(range(11u, 14).rev().collect::<~[uint]>(), box [13u, 12, 11]);
- for _ in range(10u, 0).rev() {
- fail!("unreachable");
- }
- }
-
- #[test]
- fn test_range() {
- /// A mock type to check Range when ToPrimitive returns None
- struct Foo;
-
- impl ToPrimitive for Foo {
- fn to_i64(&self) -> Option<i64> { None }
- fn to_u64(&self) -> Option<u64> { None }
- }
-
- impl Add<Foo, Foo> for Foo {
- fn add(&self, _: &Foo) -> Foo {
- Foo
- }
- }
-
- impl Eq for Foo {
- fn eq(&self, _: &Foo) -> bool {
- true
- }
- }
-
- impl Ord for Foo {
- fn lt(&self, _: &Foo) -> bool {
- false
- }
- }
-
- impl Clone for Foo {
- fn clone(&self) -> Foo {
- Foo
- }
- }
-
- impl Mul<Foo, Foo> for Foo {
- fn mul(&self, _: &Foo) -> Foo {
- Foo
- }
- }
-
- impl num::One for Foo {
- fn one() -> Foo {
- Foo
- }
- }
-
- assert_eq!(range(0i, 5).collect::<~[int]>(), box [0i, 1, 2, 3, 4]);
- assert_eq!(range(-10i, -1).collect::<~[int]>(), box [-10, -9, -8, -7, -6, -5, -4, -3, -2]);
- assert_eq!(range(0i, 5).rev().collect::<~[int]>(), box [4, 3, 2, 1, 0]);
- assert_eq!(range(200, -5).collect::<~[int]>(), box []);
- assert_eq!(range(200, -5).rev().collect::<~[int]>(), box []);
- assert_eq!(range(200, 200).collect::<~[int]>(), box []);
- assert_eq!(range(200, 200).rev().collect::<~[int]>(), box []);
-
- assert_eq!(range(0i, 100).size_hint(), (100, Some(100)));
- // this test is only meaningful when sizeof uint < sizeof u64
- assert_eq!(range(uint::MAX - 1, uint::MAX).size_hint(), (1, Some(1)));
- assert_eq!(range(-10i, -1).size_hint(), (9, Some(9)));
- assert_eq!(range(Foo, Foo).size_hint(), (0, None));
- }
-
- #[test]
- fn test_range_inclusive() {
- assert_eq!(range_inclusive(0i, 5).collect::<~[int]>(), box [0i, 1, 2, 3, 4, 5]);
- assert_eq!(range_inclusive(0i, 5).rev().collect::<~[int]>(), box [5i, 4, 3, 2, 1, 0]);
- assert_eq!(range_inclusive(200, -5).collect::<~[int]>(), box []);
- assert_eq!(range_inclusive(200, -5).rev().collect::<~[int]>(), box []);
- assert_eq!(range_inclusive(200, 200).collect::<~[int]>(), box [200]);
- assert_eq!(range_inclusive(200, 200).rev().collect::<~[int]>(), box [200]);
- }
-
- #[test]
- fn test_range_step() {
- assert_eq!(range_step(0i, 20, 5).collect::<~[int]>(), box [0, 5, 10, 15]);
- assert_eq!(range_step(20i, 0, -5).collect::<~[int]>(), box [20, 15, 10, 5]);
- assert_eq!(range_step(20i, 0, -6).collect::<~[int]>(), box [20, 14, 8, 2]);
- assert_eq!(range_step(200u8, 255, 50).collect::<~[u8]>(), box [200u8, 250]);
- assert_eq!(range_step(200, -5, 1).collect::<~[int]>(), box []);
- assert_eq!(range_step(200, 200, 1).collect::<~[int]>(), box []);
- }
-
- #[test]
- fn test_range_step_inclusive() {
- assert_eq!(range_step_inclusive(0i, 20, 5).collect::<~[int]>(), box [0, 5, 10, 15, 20]);
- assert_eq!(range_step_inclusive(20i, 0, -5).collect::<~[int]>(), box [20, 15, 10, 5, 0]);
- assert_eq!(range_step_inclusive(20i, 0, -6).collect::<~[int]>(), box [20, 14, 8, 2]);
- assert_eq!(range_step_inclusive(200u8, 255, 50).collect::<~[u8]>(), box [200u8, 250]);
- assert_eq!(range_step_inclusive(200, -5, 1).collect::<~[int]>(), box []);
- assert_eq!(range_step_inclusive(200, 200, 1).collect::<~[int]>(), box [200]);
- }
-
- #[test]
- fn test_reverse() {
- let mut ys = [1, 2, 3, 4, 5];
- ys.mut_iter().reverse_();
- assert!(ys == [5, 4, 3, 2, 1]);
- }
-
- #[test]
- fn test_peekable_is_empty() {
- let a = [1];
- let mut it = a.iter().peekable();
- assert!( !it.is_empty() );
- it.next();
- assert!( it.is_empty() );
- }
-
- #[test]
- fn test_min_max() {
- let v: [int, ..0] = [];
- assert_eq!(v.iter().min_max(), NoElements);
-
- let v = [1i];
- assert!(v.iter().min_max() == OneElement(&1));
-
- let v = [1i, 2, 3, 4, 5];
- assert!(v.iter().min_max() == MinMax(&1, &5));
-
- let v = [1i, 2, 3, 4, 5, 6];
- assert!(v.iter().min_max() == MinMax(&1, &6));
-
- let v = [1i, 1, 1, 1];
- assert!(v.iter().min_max() == MinMax(&1, &1));
- }
-
- #[test]
- fn test_MinMaxResult() {
- let r: MinMaxResult<int> = NoElements;
- assert_eq!(r.into_option(), None)
-
- let r = OneElement(1);
- assert_eq!(r.into_option(), Some((1,1)));
-
- let r = MinMax(1,2);
- assert_eq!(r.into_option(), Some((1,2)));
- }
-}
+++ /dev/null
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-/*!
-Primitive traits representing basic 'kinds' of types
-
-Rust types can be classified in various useful ways according to
-intrinsic properties of the type. These classifications, often called
-'kinds', are represented as traits.
-
-They cannot be implemented by user code, but are instead implemented
-by the compiler automatically for the types to which they apply.
-
-*/
-
-/// Types able to be transferred across task boundaries.
-#[lang="send"]
-pub trait Send {
- // empty.
-}
-
-/// Types with a constant size known at compile-time.
-#[lang="sized"]
-pub trait Sized {
- // Empty.
-}
-
-/// Types that can be copied by simply copying bits (i.e. `memcpy`).
-#[lang="copy"]
-pub trait Copy {
- // Empty.
-}
-
-/// Types that can be safely shared between tasks when aliased.
-///
-/// The precise definition is: a type `T` is `Share` if `&T` is
-/// thread-safe. In other words, there is no possibility of data races
-/// when passing `&T` references between tasks.
-///
-/// As one would expect, primitive types like `u8` and `f64` are all
-/// `Share`, and so are simple aggregate types containing them (like
-/// tuples, structs and enums). More instances of basic `Share` types
-/// include "immutable" types like `&T` and those with simple
-/// inherited mutability, such as `Box<T>`, `Vec<T>` and most other
-/// collection types. (Generic parameters need to be `Share` for their
-/// container to be `Share`.)
-///
-/// A somewhat surprising consequence of the definition is `&mut T` is
-/// `Share` (if `T` is `Share`) even though it seems that it might
-/// provide unsynchronised mutation. The trick is a mutable reference
-/// stored in an aliasable reference (that is, `& &mut T`) becomes
-/// read-only, as if it were a `& &T`, hence there is no risk of a data
-/// race.
-///
-/// Types that are not `Share` are those that have "interior
-/// mutability" in a non-thread-safe way, such as `Cell` and `RefCell`
-/// in `std::cell`. These types allow for mutation of their contents
-/// even when in an immutable, aliasable slot, e.g. the contents of
-/// `&Cell<T>` can be `.set`, and do not ensure data races are
-/// impossible, hence they cannot be `Share`. A higher level example
-/// of a non-`Share` type is the reference counted pointer
-/// `std::rc::Rc`, because any reference `&Rc<T>` can clone a new
-/// reference, which modifies the reference counts in a non-atomic
-/// way.
-///
-/// For cases when one does need thread-safe interior mutability,
-/// types like the atomics in `std::sync` and `Mutex` & `RWLock` in
-/// the `sync` crate do ensure that any mutation cannot cause data
-/// races. Hence these types are `Share`.
-///
-/// Users writing their own types with interior mutability (or anything
-/// else that is not thread-safe) should use the `NoShare` marker type
-/// (from `std::kinds::marker`) to ensure that the compiler doesn't
-/// consider the user-defined type to be `Share`. Any types with
-/// interior mutability must also use the `std::ty::Unsafe` wrapper
-/// around the value(s) which can be mutated when behind a `&`
-/// reference; not doing this is undefined behaviour (for example,
-/// `transmute`-ing from `&T` to `&mut T` is illegal).
-#[lang="share"]
-pub trait Share {
- // Empty
-}
-
-/// Marker types are special types that are used with unsafe code to
-/// inform the compiler of special constraints. Marker types should
-/// only be needed when you are creating an abstraction that is
-/// implemented using unsafe code. In that case, you may want to embed
-/// some of the marker types below into your type.
-pub mod marker {
-
- /// A marker type whose type parameter `T` is considered to be
- /// covariant with respect to the type itself. This is (typically)
- /// used to indicate that an instance of the type `T` is being stored
- /// into memory and read from, even though that may not be apparent.
- ///
- /// For more information about variance, refer to this Wikipedia
- /// article <http://en.wikipedia.org/wiki/Variance_%28computer_science%29>.
- ///
- /// *Note:* It is very unusual to have to add a covariant constraint.
- /// If you are not sure, you probably want to use `InvariantType`.
- ///
- /// # Example
- ///
- /// Given a struct `S` that includes a type parameter `T`
- /// but does not actually *reference* that type parameter:
- ///
- /// ```ignore
- /// use std::cast;
- ///
- /// struct S<T> { x: *() }
- /// fn get<T>(s: &S<T>) -> T {
- /// unsafe {
- /// let x: *T = cast::transmute(s.x);
- /// *x
- /// }
- /// }
- /// ```
- ///
- /// The type system would currently infer that the value of
- /// the type parameter `T` is irrelevant, and hence a `S<int>` is
- /// a subtype of `S<~[int]>` (or, for that matter, `S<U>` for
- /// any `U`). But this is incorrect because `get()` converts the
- /// `*()` into a `*T` and reads from it. Therefore, we should include the
- /// a marker field `CovariantType<T>` to inform the type checker that
- /// `S<T>` is a subtype of `S<U>` if `T` is a subtype of `U`
- /// (for example, `S<&'static int>` is a subtype of `S<&'a int>`
- /// for some lifetime `'a`, but not the other way around).
- #[lang="covariant_type"]
- #[deriving(Eq,Clone)]
- pub struct CovariantType<T>;
-
- /// A marker type whose type parameter `T` is considered to be
- /// contravariant with respect to the type itself. This is (typically)
- /// used to indicate that an instance of the type `T` will be consumed
- /// (but not read from), even though that may not be apparent.
- ///
- /// For more information about variance, refer to this Wikipedia
- /// article <http://en.wikipedia.org/wiki/Variance_%28computer_science%29>.
- ///
- /// *Note:* It is very unusual to have to add a contravariant constraint.
- /// If you are not sure, you probably want to use `InvariantType`.
- ///
- /// # Example
- ///
- /// Given a struct `S` that includes a type parameter `T`
- /// but does not actually *reference* that type parameter:
- ///
- /// ```
- /// use std::cast;
- ///
- /// struct S<T> { x: *() }
- /// fn get<T>(s: &S<T>, v: T) {
- /// unsafe {
- /// let x: fn(T) = cast::transmute(s.x);
- /// x(v)
- /// }
- /// }
- /// ```
- ///
- /// The type system would currently infer that the value of
- /// the type parameter `T` is irrelevant, and hence a `S<int>` is
- /// a subtype of `S<~[int]>` (or, for that matter, `S<U>` for
- /// any `U`). But this is incorrect because `get()` converts the
- /// `*()` into a `fn(T)` and then passes a value of type `T` to it.
- ///
- /// Supplying a `ContravariantType` marker would correct the
- /// problem, because it would mark `S` so that `S<T>` is only a
- /// subtype of `S<U>` if `U` is a subtype of `T`; given that the
- /// function requires arguments of type `T`, it must also accept
- /// arguments of type `U`, hence such a conversion is safe.
- #[lang="contravariant_type"]
- #[deriving(Eq,Clone)]
- pub struct ContravariantType<T>;
-
- /// A marker type whose type parameter `T` is considered to be
- /// invariant with respect to the type itself. This is (typically)
- /// used to indicate that instances of the type `T` may be read or
- /// written, even though that may not be apparent.
- ///
- /// For more information about variance, refer to this Wikipedia
- /// article <http://en.wikipedia.org/wiki/Variance_%28computer_science%29>.
- ///
- /// # Example
- ///
- /// The Cell type is an example which uses unsafe code to achieve
- /// "interior" mutability:
- ///
- /// ```
- /// pub struct Cell<T> { value: T }
- /// # fn main() {}
- /// ```
- ///
- /// The type system would infer that `value` is only read here and
- /// never written, but in fact `Cell` uses unsafe code to achieve
- /// interior mutability.
- #[lang="invariant_type"]
- #[deriving(Eq,Clone)]
- pub struct InvariantType<T>;
-
- /// As `CovariantType`, but for lifetime parameters. Using
- /// `CovariantLifetime<'a>` indicates that it is ok to substitute
- /// a *longer* lifetime for `'a` than the one you originally
- /// started with (e.g., you could convert any lifetime `'foo` to
- /// `'static`). You almost certainly want `ContravariantLifetime`
- /// instead, or possibly `InvariantLifetime`. The only case where
- /// it would be appropriate is that you have a (type-casted, and
- /// hence hidden from the type system) function pointer with a
- /// signature like `fn(&'a T)` (and no other uses of `'a`). In
- /// this case, it is ok to substitute a larger lifetime for `'a`
- /// (e.g., `fn(&'static T)`), because the function is only
- /// becoming more selective in terms of what it accepts as
- /// argument.
- ///
- /// For more information about variance, refer to this Wikipedia
- /// article <http://en.wikipedia.org/wiki/Variance_%28computer_science%29>.
- #[lang="covariant_lifetime"]
- #[deriving(Eq,Clone)]
- pub struct CovariantLifetime<'a>;
-
- /// As `ContravariantType`, but for lifetime parameters. Using
- /// `ContravariantLifetime<'a>` indicates that it is ok to
- /// substitute a *shorter* lifetime for `'a` than the one you
- /// originally started with (e.g., you could convert `'static` to
- /// any lifetime `'foo`). This is appropriate for cases where you
- /// have an unsafe pointer that is actually a pointer into some
- /// memory with lifetime `'a`, and thus you want to limit the
- /// lifetime of your data structure to `'a`. An example of where
- /// this is used is the iterator for vectors.
- ///
- /// For more information about variance, refer to this Wikipedia
- /// article <http://en.wikipedia.org/wiki/Variance_%28computer_science%29>.
- #[lang="contravariant_lifetime"]
- #[deriving(Eq,Clone)]
- pub struct ContravariantLifetime<'a>;
-
- /// As `InvariantType`, but for lifetime parameters. Using
- /// `InvariantLifetime<'a>` indicates that it is not ok to
- /// substitute any other lifetime for `'a` besides its original
- /// value. This is appropriate for cases where you have an unsafe
- /// pointer that is actually a pointer into memory with lifetime `'a`,
- /// and this pointer is itself stored in an inherently mutable
- /// location (such as a `Cell`).
- #[lang="invariant_lifetime"]
- #[deriving(Eq,Clone)]
- pub struct InvariantLifetime<'a>;
-
- /// A type which is considered "not sendable", meaning that it cannot
- /// be safely sent between tasks, even if it is owned. This is
- /// typically embedded in other types, such as `Gc`, to ensure that
- /// their instances remain thread-local.
- #[lang="no_send_bound"]
- #[deriving(Eq,Clone)]
- pub struct NoSend;
-
- /// A type which is considered "not POD", meaning that it is not
- /// implicitly copyable. This is typically embedded in other types to
- /// ensure that they are never copied, even if they lack a destructor.
- #[lang="no_copy_bound"]
- #[deriving(Eq,Clone)]
- pub struct NoCopy;
-
- /// A type which is considered "not sharable", meaning that
- /// its contents are not threadsafe, hence they cannot be
- /// shared between tasks.
- #[lang="no_share_bound"]
- #[deriving(Eq,Clone)]
- pub struct NoShare;
-
- /// A type which is considered managed by the GC. This is typically
- /// embedded in other types.
- #[lang="managed_bound"]
- #[deriving(Eq,Clone)]
- pub struct Managed;
-}
// Make and rand accessible for benchmarking/testcases
#[cfg(test)] extern crate rand;
-// we wrap some libc stuff
extern crate libc;
+extern crate core;
// Make std testable by not duplicating lang items. See #2912
#[cfg(test)] extern crate realstd = "std";
#[cfg(test)] pub use ty = realstd::ty;
#[cfg(test)] pub use owned = realstd::owned;
+#[cfg(not(test))] pub use cmp = core::cmp;
+#[cfg(not(test))] pub use kinds = core::kinds;
+#[cfg(not(test))] pub use ops = core::ops;
+#[cfg(not(test))] pub use owned = core::owned;
+#[cfg(not(test))] pub use ty = core::ty;
+
+pub use core::any;
+pub use core::bool;
+pub use core::cast;
+pub use core::cell;
+pub use core::char;
+pub use core::clone;
+pub use core::container;
+pub use core::default;
+pub use core::intrinsics;
+pub use core::iter;
+pub use core::mem;
+pub use core::ptr;
+pub use core::raw;
+pub use core::tuple;
+
// Run tests with libgreen instead of libnative.
//
// FIXME: This egregiously hacks around starting the test runner in a different
#[path = "num/f32.rs"] pub mod f32;
#[path = "num/f64.rs"] pub mod f64;
-pub mod unit;
-pub mod bool;
-pub mod char;
-pub mod tuple;
-
pub mod slice;
pub mod vec;
pub mod str;
pub mod ascii;
-pub mod ptr;
-mod managed;
-mod reference;
pub mod rc;
pub mod gc;
-
-/* Core language traits */
-
-#[cfg(not(test))] pub mod kinds;
-#[cfg(not(test))] pub mod ops;
-#[cfg(not(test))] pub mod cmp;
-#[cfg(not(test))] pub mod ty;
-#[cfg(not(test))] pub mod owned;
-
-
/* Common traits */
pub mod from_str;
pub mod num;
-pub mod iter;
pub mod to_str;
-pub mod clone;
pub mod hash;
-pub mod container;
-pub mod default;
-pub mod any;
/* Common data structures */
-pub mod option;
pub mod result;
-pub mod cell;
-
+pub mod option;
/* Tasks and communication */
pub mod os;
pub mod io;
pub mod path;
-pub mod cast;
pub mod fmt;
pub mod cleanup;
-pub mod mem;
-
/* Unsupported interfaces */
// Private APIs
#[unstable]
pub mod unstable;
-#[experimental]
-pub mod intrinsics;
-#[experimental]
-pub mod raw;
/* For internal use, not exported */
use super::*;
use owned::Box;
use task;
- use str::StrSlice;
#[test]
fn test_tls_multitask() {
+++ /dev/null
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-//! Operations on managed box types
-
-#[cfg(not(test))] use cmp::*;
-
-/// Determine if two shared boxes point to the same object
-#[inline]
-pub fn ptr_eq<T>(a: @T, b: @T) -> bool {
- &*a as *T == &*b as *T
-}
-
-#[cfg(not(test))]
-impl<T:Eq> Eq for @T {
- #[inline]
- fn eq(&self, other: &@T) -> bool { *(*self) == *(*other) }
- #[inline]
- fn ne(&self, other: &@T) -> bool { *(*self) != *(*other) }
-}
-
-#[cfg(not(test))]
-impl<T:Ord> Ord for @T {
- #[inline]
- fn lt(&self, other: &@T) -> bool { *(*self) < *(*other) }
- #[inline]
- fn le(&self, other: &@T) -> bool { *(*self) <= *(*other) }
- #[inline]
- fn ge(&self, other: &@T) -> bool { *(*self) >= *(*other) }
- #[inline]
- fn gt(&self, other: &@T) -> bool { *(*self) > *(*other) }
-}
-
-#[cfg(not(test))]
-impl<T: TotalOrd> TotalOrd for @T {
- #[inline]
- fn cmp(&self, other: &@T) -> Ordering { (**self).cmp(*other) }
-}
-
-#[cfg(not(test))]
-impl<T: TotalEq> TotalEq for @T {}
-
-#[test]
-fn test() {
- let x = @3;
- let y = @3;
- assert!((ptr_eq::<int>(x, x)));
- assert!((ptr_eq::<int>(y, y)));
- assert!((!ptr_eq::<int>(x, y)));
- assert!((!ptr_eq::<int>(y, x)));
-}
+++ /dev/null
-// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-//! Basic functions for dealing with memory
-//!
-//! This module contains functions for querying the size and alignment of
-//! types, initializing and manipulating memory.
-
-#![allow(missing_doc)] // FIXME
-
-use cast;
-use ptr;
-use intrinsics;
-use intrinsics::{bswap16, bswap32, bswap64};
-
-/// Returns the size of a type in bytes.
-#[inline]
-pub fn size_of<T>() -> uint {
- unsafe { intrinsics::size_of::<T>() }
-}
-
-/// Returns the size of the type that `_val` points to in bytes.
-#[inline]
-pub fn size_of_val<T>(_val: &T) -> uint {
- size_of::<T>()
-}
-
-/// Returns the size of a type in bytes, or 1 if the actual size is zero.
-///
-/// Useful for building structures containing variable-length arrays.
-#[inline]
-pub fn nonzero_size_of<T>() -> uint {
- match size_of::<T>() {
- 0 => 1,
- x => x
- }
-}
-
-/// Returns the size in bytes of the type of the value that `_val` points to.
-#[inline]
-pub fn nonzero_size_of_val<T>(_val: &T) -> uint {
- nonzero_size_of::<T>()
-}
-
-/// Returns the ABI-required minimum alignment of a type
-///
-/// This is the alignment used for struct fields. It may be smaller
-/// than the preferred alignment.
-#[inline]
-pub fn min_align_of<T>() -> uint {
- unsafe { intrinsics::min_align_of::<T>() }
-}
-
-/// Returns the ABI-required minimum alignment of the type of the value that
-/// `_val` points to
-#[inline]
-pub fn min_align_of_val<T>(_val: &T) -> uint {
- min_align_of::<T>()
-}
-
-/// Returns the preferred alignment of a type
-#[inline]
-pub fn pref_align_of<T>() -> uint {
- unsafe { intrinsics::pref_align_of::<T>() }
-}
-
-/// Returns the preferred alignment of the type of the value that
-/// `_val` points to
-#[inline]
-pub fn pref_align_of_val<T>(_val: &T) -> uint {
- pref_align_of::<T>()
-}
-
-/// Create a value initialized to zero.
-///
-/// `init` is unsafe because it returns a zeroed-out datum,
-/// which is unsafe unless T is Copy.
-#[inline]
-pub unsafe fn init<T>() -> T {
- intrinsics::init()
-}
-
-/// Create an uninitialized value.
-#[inline]
-pub unsafe fn uninit<T>() -> T {
- intrinsics::uninit()
-}
-
-/// Move a value to an uninitialized memory location.
-///
-/// Drop glue is not run on the destination.
-#[inline]
-pub unsafe fn move_val_init<T>(dst: &mut T, src: T) {
- intrinsics::move_val_init(dst, src)
-}
-
-/// Convert an u16 to little endian from the target's endianness.
-///
-/// On little endian, this is a no-op. On big endian, the bytes are swapped.
-#[cfg(target_endian = "little")] #[inline] pub fn to_le16(x: u16) -> u16 { x }
-
-/// Convert an u16 to little endian from the target's endianness.
-///
-/// On little endian, this is a no-op. On big endian, the bytes are swapped.
-#[cfg(target_endian = "big")] #[inline] pub fn to_le16(x: u16) -> u16 { unsafe { bswap16(x) } }
-
-/// Convert an u32 to little endian from the target's endianness.
-///
-/// On little endian, this is a no-op. On big endian, the bytes are swapped.
-#[cfg(target_endian = "little")] #[inline] pub fn to_le32(x: u32) -> u32 { x }
-
-/// Convert an u32 to little endian from the target's endianness.
-///
-/// On little endian, this is a no-op. On big endian, the bytes are swapped.
-#[cfg(target_endian = "big")] #[inline] pub fn to_le32(x: u32) -> u32 { unsafe { bswap32(x) } }
-
-/// Convert an u64 to little endian from the target's endianness.
-///
-/// On little endian, this is a no-op. On big endian, the bytes are swapped.
-#[cfg(target_endian = "little")] #[inline] pub fn to_le64(x: u64) -> u64 { x }
-
-/// Convert an u64 to little endian from the target's endianness.
-///
-/// On little endian, this is a no-op. On big endian, the bytes are swapped.
-#[cfg(target_endian = "big")] #[inline] pub fn to_le64(x: u64) -> u64 { unsafe { bswap64(x) } }
-
-
-/// Convert an u16 to big endian from the target's endianness.
-///
-/// On big endian, this is a no-op. On little endian, the bytes are swapped.
-#[cfg(target_endian = "little")] #[inline] pub fn to_be16(x: u16) -> u16 { unsafe { bswap16(x) } }
-
-/// Convert an u16 to big endian from the target's endianness.
-///
-/// On big endian, this is a no-op. On little endian, the bytes are swapped.
-#[cfg(target_endian = "big")] #[inline] pub fn to_be16(x: u16) -> u16 { x }
-
-/// Convert an u32 to big endian from the target's endianness.
-///
-/// On big endian, this is a no-op. On little endian, the bytes are swapped.
-#[cfg(target_endian = "little")] #[inline] pub fn to_be32(x: u32) -> u32 { unsafe { bswap32(x) } }
-
-/// Convert an u32 to big endian from the target's endianness.
-///
-/// On big endian, this is a no-op. On little endian, the bytes are swapped.
-#[cfg(target_endian = "big")] #[inline] pub fn to_be32(x: u32) -> u32 { x }
-
-/// Convert an u64 to big endian from the target's endianness.
-///
-/// On big endian, this is a no-op. On little endian, the bytes are swapped.
-#[cfg(target_endian = "little")] #[inline] pub fn to_be64(x: u64) -> u64 { unsafe { bswap64(x) } }
-
-/// Convert an u64 to big endian from the target's endianness.
-///
-/// On big endian, this is a no-op. On little endian, the bytes are swapped.
-#[cfg(target_endian = "big")] #[inline] pub fn to_be64(x: u64) -> u64 { x }
-
-
-/// Convert an u16 from little endian to the target's endianness.
-///
-/// On little endian, this is a no-op. On big endian, the bytes are swapped.
-#[cfg(target_endian = "little")] #[inline] pub fn from_le16(x: u16) -> u16 { x }
-
-/// Convert an u16 from little endian to the target's endianness.
-///
-/// On little endian, this is a no-op. On big endian, the bytes are swapped.
-#[cfg(target_endian = "big")] #[inline] pub fn from_le16(x: u16) -> u16 { unsafe { bswap16(x) } }
-
-/// Convert an u32 from little endian to the target's endianness.
-///
-/// On little endian, this is a no-op. On big endian, the bytes are swapped.
-#[cfg(target_endian = "little")] #[inline] pub fn from_le32(x: u32) -> u32 { x }
-
-/// Convert an u32 from little endian to the target's endianness.
-///
-/// On little endian, this is a no-op. On big endian, the bytes are swapped.
-#[cfg(target_endian = "big")] #[inline] pub fn from_le32(x: u32) -> u32 { unsafe { bswap32(x) } }
-
-/// Convert an u64 from little endian to the target's endianness.
-///
-/// On little endian, this is a no-op. On big endian, the bytes are swapped.
-#[cfg(target_endian = "little")] #[inline] pub fn from_le64(x: u64) -> u64 { x }
-
-/// Convert an u64 from little endian to the target's endianness.
-///
-/// On little endian, this is a no-op. On big endian, the bytes are swapped.
-#[cfg(target_endian = "big")] #[inline] pub fn from_le64(x: u64) -> u64 { unsafe { bswap64(x) } }
-
-
-/// Convert an u16 from big endian to the target's endianness.
-///
-/// On big endian, this is a no-op. On little endian, the bytes are swapped.
-#[cfg(target_endian = "little")] #[inline] pub fn from_be16(x: u16) -> u16 { unsafe { bswap16(x) } }
-
-/// Convert an u16 from big endian to the target's endianness.
-///
-/// On big endian, this is a no-op. On little endian, the bytes are swapped.
-#[cfg(target_endian = "big")] #[inline] pub fn from_be16(x: u16) -> u16 { x }
-
-/// Convert an u32 from big endian to the target's endianness.
-///
-/// On big endian, this is a no-op. On little endian, the bytes are swapped.
-#[cfg(target_endian = "little")] #[inline] pub fn from_be32(x: u32) -> u32 { unsafe { bswap32(x) } }
-
-/// Convert an u32 from big endian to the target's endianness.
-///
-/// On big endian, this is a no-op. On little endian, the bytes are swapped.
-#[cfg(target_endian = "big")] #[inline] pub fn from_be32(x: u32) -> u32 { x }
-
-/// Convert an u64 from big endian to the target's endianness.
-///
-/// On big endian, this is a no-op. On little endian, the bytes are swapped.
-#[cfg(target_endian = "little")] #[inline] pub fn from_be64(x: u64) -> u64 { unsafe { bswap64(x) } }
-
-/// Convert an u64 from big endian to the target's endianness.
-///
-/// On big endian, this is a no-op. On little endian, the bytes are swapped.
-#[cfg(target_endian = "big")] #[inline] pub fn from_be64(x: u64) -> u64 { x }
-
-/**
- * Swap the values at two mutable locations of the same type, without
- * deinitialising or copying either one.
- */
-#[inline]
-pub fn swap<T>(x: &mut T, y: &mut T) {
- unsafe {
- // Give ourselves some scratch space to work with
- let mut t: T = uninit();
-
- // Perform the swap, `&mut` pointers never alias
- ptr::copy_nonoverlapping_memory(&mut t, &*x, 1);
- ptr::copy_nonoverlapping_memory(x, &*y, 1);
- ptr::copy_nonoverlapping_memory(y, &t, 1);
-
- // y and t now point to the same thing, but we need to completely forget `t`
- // because it's no longer relevant.
- cast::forget(t);
- }
-}
-
-/**
- * Replace the value at a mutable location with a new one, returning the old
- * value, without deinitialising or copying either one.
- *
- * This is primarily used for transferring and swapping ownership of a value
- * in a mutable location. For example, this function allows consumption of
- * one field of a struct by replacing it with another value. The normal approach
- * doesn't always work:
- *
- * ```rust,ignore
- * struct Buffer<T> { buf: Vec<T> }
- *
- * impl<T> Buffer<T> {
- * fn get_and_reset(&mut self) -> Vec<T> {
- * // error: cannot move out of dereference of `&mut`-pointer
- * let buf = self.buf;
- * self.buf = Vec::new();
- * buf
- * }
- * }
- * ```
- *
- * Note that `T` does not necessarily implement `Clone`, so it can't even
- * clone and reset `self.buf`. But `replace` can be used to disassociate
- * the original value of `self.buf` from `self`, allowing it to be returned:
- *
- * ```rust
- * # struct Buffer<T> { buf: Vec<T> }
- * impl<T> Buffer<T> {
- * fn get_and_reset(&mut self) -> Vec<T> {
- * use std::mem::replace;
- * replace(&mut self.buf, Vec::new())
- * }
- * }
- * ```
- */
-#[inline]
-pub fn replace<T>(dest: &mut T, mut src: T) -> T {
- swap(dest, &mut src);
- src
-}
-
-/// Disposes of a value.
-#[inline]
-pub fn drop<T>(_x: T) { }
-
-#[cfg(test)]
-mod tests {
- use mem::*;
- use option::{Some,None};
- use str::StrSlice;
-
- #[test]
- fn size_of_basic() {
- assert_eq!(size_of::<u8>(), 1u);
- assert_eq!(size_of::<u16>(), 2u);
- assert_eq!(size_of::<u32>(), 4u);
- assert_eq!(size_of::<u64>(), 8u);
- }
-
- #[test]
- #[cfg(target_arch = "x86")]
- #[cfg(target_arch = "arm")]
- #[cfg(target_arch = "mips")]
- fn size_of_32() {
- assert_eq!(size_of::<uint>(), 4u);
- assert_eq!(size_of::<*uint>(), 4u);
- }
-
- #[test]
- #[cfg(target_arch = "x86_64")]
- fn size_of_64() {
- assert_eq!(size_of::<uint>(), 8u);
- assert_eq!(size_of::<*uint>(), 8u);
- }
-
- #[test]
- fn size_of_val_basic() {
- assert_eq!(size_of_val(&1u8), 1);
- assert_eq!(size_of_val(&1u16), 2);
- assert_eq!(size_of_val(&1u32), 4);
- assert_eq!(size_of_val(&1u64), 8);
- }
-
- #[test]
- fn nonzero_size_of_basic() {
- type Z = [i8, ..0];
- assert_eq!(size_of::<Z>(), 0u);
- assert_eq!(nonzero_size_of::<Z>(), 1u);
- assert_eq!(nonzero_size_of::<uint>(), size_of::<uint>());
- }
-
- #[test]
- fn nonzero_size_of_val_basic() {
- let z = [0u8, ..0];
- assert_eq!(size_of_val(&z), 0u);
- assert_eq!(nonzero_size_of_val(&z), 1u);
- assert_eq!(nonzero_size_of_val(&1u), size_of_val(&1u));
- }
-
- #[test]
- fn align_of_basic() {
- assert_eq!(pref_align_of::<u8>(), 1u);
- assert_eq!(pref_align_of::<u16>(), 2u);
- assert_eq!(pref_align_of::<u32>(), 4u);
- }
-
- #[test]
- #[cfg(target_arch = "x86")]
- #[cfg(target_arch = "arm")]
- #[cfg(target_arch = "mips")]
- fn align_of_32() {
- assert_eq!(pref_align_of::<uint>(), 4u);
- assert_eq!(pref_align_of::<*uint>(), 4u);
- }
-
- #[test]
- #[cfg(target_arch = "x86_64")]
- fn align_of_64() {
- assert_eq!(pref_align_of::<uint>(), 8u);
- assert_eq!(pref_align_of::<*uint>(), 8u);
- }
-
- #[test]
- fn align_of_val_basic() {
- assert_eq!(pref_align_of_val(&1u8), 1u);
- assert_eq!(pref_align_of_val(&1u16), 2u);
- assert_eq!(pref_align_of_val(&1u32), 4u);
- }
-
- #[test]
- fn test_swap() {
- let mut x = 31337;
- let mut y = 42;
- swap(&mut x, &mut y);
- assert_eq!(x, 42);
- assert_eq!(y, 31337);
- }
-
- #[test]
- fn test_replace() {
- let mut x = Some("test".to_owned());
- let y = replace(&mut x, None);
- assert!(x.is_none());
- assert!(y.is_some());
- }
-}
-
-// FIXME #13642 (these benchmarks should be in another place)
-/// Completely miscellaneous language-construct benchmarks.
-#[cfg(test)]
-mod bench {
- extern crate test;
- use self::test::Bencher;
- use option::{Some,None};
-
- // Static/dynamic method dispatch
-
- struct Struct {
- field: int
- }
-
- trait Trait {
- fn method(&self) -> int;
- }
-
- impl Trait for Struct {
- fn method(&self) -> int {
- self.field
- }
- }
-
- #[bench]
- fn trait_vtable_method_call(b: &mut Bencher) {
- let s = Struct { field: 10 };
- let t = &s as &Trait;
- b.iter(|| {
- t.method()
- });
- }
-
- #[bench]
- fn trait_static_method_call(b: &mut Bencher) {
- let s = Struct { field: 10 };
- b.iter(|| {
- s.method()
- });
- }
-
- // Overhead of various match forms
-
- #[bench]
- fn match_option_some(b: &mut Bencher) {
- let x = Some(10);
- b.iter(|| {
- match x {
- Some(y) => y,
- None => 11
- }
- });
- }
-
- #[bench]
- fn match_vec_pattern(b: &mut Bencher) {
- let x = [1,2,3,4,5,6];
- b.iter(|| {
- match x {
- [1,2,3,..] => 10,
- _ => 11
- }
- });
- }
-}
use prelude::*;
use cast;
-use default::Default;
use from_str::FromStr;
-use libc::{c_int};
+use libc::c_int;
use num::{FPCategory, FPNaN, FPInfinite , FPZero, FPSubnormal, FPNormal};
-use num::{Zero, One, Bounded, strconv};
+use num::strconv;
use num;
use intrinsics;
+pub use core::f32::{RADIX, MANTISSA_DIGITS, DIGITS, EPSILON, MIN_VALUE};
+pub use core::f32::{MIN_POS_VALUE, MAX_VALUE, MIN_EXP, MAX_EXP, MIN_10_EXP};
+pub use core::f32::{MAX_10_EXP, NAN, INFINITY, NEG_INFINITY};
+pub use core::f32::consts;
+
#[allow(dead_code)]
mod cmath {
use libc::{c_float, c_int};
}
}
-pub static RADIX: uint = 2u;
-
-pub static MANTISSA_DIGITS: uint = 24u;
-pub static DIGITS: uint = 6u;
-
-pub static EPSILON: f32 = 1.19209290e-07_f32;
-
-/// Smallest finite f32 value
-pub static MIN_VALUE: f32 = -3.40282347e+38_f32;
-/// Smallest positive, normalized f32 value
-pub static MIN_POS_VALUE: f32 = 1.17549435e-38_f32;
-/// Largest finite f32 value
-pub static MAX_VALUE: f32 = 3.40282347e+38_f32;
-
-pub static MIN_EXP: int = -125;
-pub static MAX_EXP: int = 128;
-
-pub static MIN_10_EXP: int = -37;
-pub static MAX_10_EXP: int = 38;
-
-pub static NAN: f32 = 0.0_f32/0.0_f32;
-pub static INFINITY: f32 = 1.0_f32/0.0_f32;
-pub static NEG_INFINITY: f32 = -1.0_f32/0.0_f32;
-
-/// Various useful constants.
-pub mod consts {
- // FIXME: replace with mathematical constants from cmath.
-
- // FIXME(#5527): These constants should be deprecated once associated
- // constants are implemented in favour of referencing the respective members
- // of `Float`.
-
- /// Archimedes' constant
- pub static PI: f32 = 3.14159265358979323846264338327950288_f32;
-
- /// pi * 2.0
- pub static PI_2: f32 = 6.28318530717958647692528676655900576_f32;
-
- /// pi/2.0
- pub static FRAC_PI_2: f32 = 1.57079632679489661923132169163975144_f32;
-
- /// pi/3.0
- pub static FRAC_PI_3: f32 = 1.04719755119659774615421446109316763_f32;
-
- /// pi/4.0
- pub static FRAC_PI_4: f32 = 0.785398163397448309615660845819875721_f32;
-
- /// pi/6.0
- pub static FRAC_PI_6: f32 = 0.52359877559829887307710723054658381_f32;
-
- /// pi/8.0
- pub static FRAC_PI_8: f32 = 0.39269908169872415480783042290993786_f32;
-
- /// 1.0/pi
- pub static FRAC_1_PI: f32 = 0.318309886183790671537767526745028724_f32;
-
- /// 2.0/pi
- pub static FRAC_2_PI: f32 = 0.636619772367581343075535053490057448_f32;
-
- /// 2.0/sqrt(pi)
- pub static FRAC_2_SQRTPI: f32 = 1.12837916709551257389615890312154517_f32;
-
- /// sqrt(2.0)
- pub static SQRT2: f32 = 1.41421356237309504880168872420969808_f32;
-
- /// 1.0/sqrt(2.0)
- pub static FRAC_1_SQRT2: f32 = 0.707106781186547524400844362104849039_f32;
-
- /// Euler's number
- pub static E: f32 = 2.71828182845904523536028747135266250_f32;
-
- /// log2(e)
- pub static LOG2_E: f32 = 1.44269504088896340735992468100189214_f32;
-
- /// log10(e)
- pub static LOG10_E: f32 = 0.434294481903251827651128918916605082_f32;
-
- /// ln(2.0)
- pub static LN_2: f32 = 0.693147180559945309417232121458176568_f32;
-
- /// ln(10.0)
- pub static LN_10: f32 = 2.30258509299404568401799145468436421_f32;
-}
-
-impl Num for f32 {}
-
-#[cfg(not(test))]
-impl Eq for f32 {
- #[inline]
- fn eq(&self, other: &f32) -> bool { (*self) == (*other) }
-}
-
-#[cfg(not(test))]
-impl Ord for f32 {
- #[inline]
- fn lt(&self, other: &f32) -> bool { (*self) < (*other) }
- #[inline]
- fn le(&self, other: &f32) -> bool { (*self) <= (*other) }
- #[inline]
- fn ge(&self, other: &f32) -> bool { (*self) >= (*other) }
- #[inline]
- fn gt(&self, other: &f32) -> bool { (*self) > (*other) }
-}
-
-impl Default for f32 {
- #[inline]
- fn default() -> f32 { 0.0 }
-}
-
-impl Zero for f32 {
- #[inline]
- fn zero() -> f32 { 0.0 }
-
- /// Returns true if the number is equal to either `0.0` or `-0.0`
- #[inline]
- fn is_zero(&self) -> bool { *self == 0.0 || *self == -0.0 }
-}
-
-impl One for f32 {
- #[inline]
- fn one() -> f32 { 1.0 }
-}
-
-#[cfg(not(test))]
-impl Add<f32,f32> for f32 {
- #[inline]
- fn add(&self, other: &f32) -> f32 { *self + *other }
-}
-
-#[cfg(not(test))]
-impl Sub<f32,f32> for f32 {
- #[inline]
- fn sub(&self, other: &f32) -> f32 { *self - *other }
-}
-
-#[cfg(not(test))]
-impl Mul<f32,f32> for f32 {
- #[inline]
- fn mul(&self, other: &f32) -> f32 { *self * *other }
-}
-
-#[cfg(not(test))]
-impl Div<f32,f32> for f32 {
- #[inline]
- fn div(&self, other: &f32) -> f32 { *self / *other }
-}
-
-#[cfg(not(test))]
-impl Rem<f32,f32> for f32 {
- #[inline]
- fn rem(&self, other: &f32) -> f32 {
- unsafe { cmath::fmodf(*self, *other) }
- }
-}
-
-#[cfg(not(test))]
-impl Neg<f32> for f32 {
- #[inline]
- fn neg(&self) -> f32 { -*self }
-}
-
-impl Signed for f32 {
- /// Computes the absolute value. Returns `NAN` if the number is `NAN`.
- #[inline]
- fn abs(&self) -> f32 {
- unsafe { intrinsics::fabsf32(*self) }
- }
-
- /// The positive difference of two numbers. Returns `0.0` if the number is
- /// less than or equal to `other`, otherwise the difference between`self`
- /// and `other` is returned.
- #[inline]
- fn abs_sub(&self, other: &f32) -> f32 {
- unsafe { cmath::fdimf(*self, *other) }
- }
-
- /// # Returns
- ///
- /// - `1.0` if the number is positive, `+0.0` or `INFINITY`
- /// - `-1.0` if the number is negative, `-0.0` or `NEG_INFINITY`
- /// - `NAN` if the number is NaN
- #[inline]
- fn signum(&self) -> f32 {
- if self.is_nan() { NAN } else {
- unsafe { intrinsics::copysignf32(1.0, *self) }
- }
- }
-
- /// Returns `true` if the number is positive, including `+0.0` and `INFINITY`
- #[inline]
- fn is_positive(&self) -> bool { *self > 0.0 || (1.0 / *self) == INFINITY }
-
- /// Returns `true` if the number is negative, including `-0.0` and `NEG_INFINITY`
- #[inline]
- fn is_negative(&self) -> bool { *self < 0.0 || (1.0 / *self) == NEG_INFINITY }
-}
-
-impl Bounded for f32 {
- // NOTE: this is the smallest non-infinite f32 value, *not* MIN_VALUE
- #[inline]
- fn min_value() -> f32 { -MAX_VALUE }
-
- #[inline]
- fn max_value() -> f32 { MAX_VALUE }
-}
-
-impl Primitive for f32 {}
-
impl Float for f32 {
#[inline]
fn nan() -> f32 { NAN }
use prelude::*;
use cast;
-use default::Default;
use from_str::FromStr;
use libc::{c_int};
use num::{FPCategory, FPNaN, FPInfinite , FPZero, FPSubnormal, FPNormal};
-use num::{Zero, One, Bounded, strconv};
+use num::{strconv};
use num;
use intrinsics;
+pub use core::f64::{RADIX, MANTISSA_DIGITS, DIGITS, EPSILON, MIN_VALUE};
+pub use core::f64::{MIN_POS_VALUE, MAX_VALUE, MIN_EXP, MAX_EXP, MIN_10_EXP};
+pub use core::f64::{MAX_10_EXP, NAN, INFINITY, NEG_INFINITY};
+pub use core::f64::consts;
+
#[allow(dead_code)]
mod cmath {
use libc::{c_double, c_int};
}
}
-// FIXME(#5527): These constants should be deprecated once associated
-// constants are implemented in favour of referencing the respective
-// members of `Bounded` and `Float`.
-
-pub static RADIX: uint = 2u;
-
-pub static MANTISSA_DIGITS: uint = 53u;
-pub static DIGITS: uint = 15u;
-
-pub static EPSILON: f64 = 2.2204460492503131e-16_f64;
-
-/// Smallest finite f64 value
-pub static MIN_VALUE: f64 = -1.7976931348623157e+308_f64;
-/// Smallest positive, normalized f64 value
-pub static MIN_POS_VALUE: f64 = 2.2250738585072014e-308_f64;
-/// Largest finite f64 value
-pub static MAX_VALUE: f64 = 1.7976931348623157e+308_f64;
-
-pub static MIN_EXP: int = -1021;
-pub static MAX_EXP: int = 1024;
-
-pub static MIN_10_EXP: int = -307;
-pub static MAX_10_EXP: int = 308;
-
-pub static NAN: f64 = 0.0_f64/0.0_f64;
-
-pub static INFINITY: f64 = 1.0_f64/0.0_f64;
-
-pub static NEG_INFINITY: f64 = -1.0_f64/0.0_f64;
-
-/// Various useful constants.
-pub mod consts {
- // FIXME: replace with mathematical constants from cmath.
-
- // FIXME(#5527): These constants should be deprecated once associated
- // constants are implemented in favour of referencing the respective members
- // of `Float`.
-
- /// Archimedes' constant
- pub static PI: f64 = 3.14159265358979323846264338327950288_f64;
-
- /// pi * 2.0
- pub static PI_2: f64 = 6.28318530717958647692528676655900576_f64;
-
- /// pi/2.0
- pub static FRAC_PI_2: f64 = 1.57079632679489661923132169163975144_f64;
-
- /// pi/3.0
- pub static FRAC_PI_3: f64 = 1.04719755119659774615421446109316763_f64;
-
- /// pi/4.0
- pub static FRAC_PI_4: f64 = 0.785398163397448309615660845819875721_f64;
-
- /// pi/6.0
- pub static FRAC_PI_6: f64 = 0.52359877559829887307710723054658381_f64;
-
- /// pi/8.0
- pub static FRAC_PI_8: f64 = 0.39269908169872415480783042290993786_f64;
-
- /// 1.0/pi
- pub static FRAC_1_PI: f64 = 0.318309886183790671537767526745028724_f64;
-
- /// 2.0/pi
- pub static FRAC_2_PI: f64 = 0.636619772367581343075535053490057448_f64;
-
- /// 2.0/sqrt(pi)
- pub static FRAC_2_SQRTPI: f64 = 1.12837916709551257389615890312154517_f64;
-
- /// sqrt(2.0)
- pub static SQRT2: f64 = 1.41421356237309504880168872420969808_f64;
-
- /// 1.0/sqrt(2.0)
- pub static FRAC_1_SQRT2: f64 = 0.707106781186547524400844362104849039_f64;
-
- /// Euler's number
- pub static E: f64 = 2.71828182845904523536028747135266250_f64;
-
- /// log2(e)
- pub static LOG2_E: f64 = 1.44269504088896340735992468100189214_f64;
-
- /// log10(e)
- pub static LOG10_E: f64 = 0.434294481903251827651128918916605082_f64;
-
- /// ln(2.0)
- pub static LN_2: f64 = 0.693147180559945309417232121458176568_f64;
-
- /// ln(10.0)
- pub static LN_10: f64 = 2.30258509299404568401799145468436421_f64;
-}
-
-impl Num for f64 {}
-
-#[cfg(not(test))]
-impl Eq for f64 {
- #[inline]
- fn eq(&self, other: &f64) -> bool { (*self) == (*other) }
-}
-
-#[cfg(not(test))]
-impl Ord for f64 {
- #[inline]
- fn lt(&self, other: &f64) -> bool { (*self) < (*other) }
- #[inline]
- fn le(&self, other: &f64) -> bool { (*self) <= (*other) }
- #[inline]
- fn ge(&self, other: &f64) -> bool { (*self) >= (*other) }
- #[inline]
- fn gt(&self, other: &f64) -> bool { (*self) > (*other) }
-}
-
-impl Default for f64 {
- #[inline]
- fn default() -> f64 { 0.0 }
-}
-
-impl Zero for f64 {
- #[inline]
- fn zero() -> f64 { 0.0 }
-
- /// Returns true if the number is equal to either `0.0` or `-0.0`
- #[inline]
- fn is_zero(&self) -> bool { *self == 0.0 || *self == -0.0 }
-}
-
-impl One for f64 {
- #[inline]
- fn one() -> f64 { 1.0 }
-}
-
-#[cfg(not(test))]
-impl Add<f64,f64> for f64 {
- #[inline]
- fn add(&self, other: &f64) -> f64 { *self + *other }
-}
-#[cfg(not(test))]
-impl Sub<f64,f64> for f64 {
- #[inline]
- fn sub(&self, other: &f64) -> f64 { *self - *other }
-}
-#[cfg(not(test))]
-impl Mul<f64,f64> for f64 {
- #[inline]
- fn mul(&self, other: &f64) -> f64 { *self * *other }
-}
-#[cfg(not(test))]
-impl Div<f64,f64> for f64 {
- #[inline]
- fn div(&self, other: &f64) -> f64 { *self / *other }
-}
-#[cfg(not(test))]
-impl Rem<f64,f64> for f64 {
- #[inline]
- fn rem(&self, other: &f64) -> f64 {
- unsafe { cmath::fmod(*self, *other) }
- }
-}
-#[cfg(not(test))]
-impl Neg<f64> for f64 {
- #[inline]
- fn neg(&self) -> f64 { -*self }
-}
-
-impl Signed for f64 {
- /// Computes the absolute value. Returns `NAN` if the number is `NAN`.
- #[inline]
- fn abs(&self) -> f64 {
- unsafe { intrinsics::fabsf64(*self) }
- }
-
- /// The positive difference of two numbers. Returns `0.0` if the number is less than or
- /// equal to `other`, otherwise the difference between`self` and `other` is returned.
- #[inline]
- fn abs_sub(&self, other: &f64) -> f64 {
- unsafe { cmath::fdim(*self, *other) }
- }
-
- /// # Returns
- ///
- /// - `1.0` if the number is positive, `+0.0` or `INFINITY`
- /// - `-1.0` if the number is negative, `-0.0` or `NEG_INFINITY`
- /// - `NAN` if the number is NaN
- #[inline]
- fn signum(&self) -> f64 {
- if self.is_nan() { NAN } else {
- unsafe { intrinsics::copysignf64(1.0, *self) }
- }
- }
-
- /// Returns `true` if the number is positive, including `+0.0` and `INFINITY`
- #[inline]
- fn is_positive(&self) -> bool { *self > 0.0 || (1.0 / *self) == INFINITY }
-
- /// Returns `true` if the number is negative, including `-0.0` and `NEG_INFINITY`
- #[inline]
- fn is_negative(&self) -> bool { *self < 0.0 || (1.0 / *self) == NEG_INFINITY }
-}
-
-impl Bounded for f64 {
- // NOTE: this is the smallest non-infinite f32 value, *not* MIN_VALUE
- #[inline]
- fn min_value() -> f64 { -MAX_VALUE }
-
- #[inline]
- fn max_value() -> f64 { MAX_VALUE }
-}
-
-impl Primitive for f64 {}
-
impl Float for f64 {
#[inline]
fn nan() -> f64 { NAN }
//! Operations and constants for signed 16-bits integers (`i16` type)
-#![allow(non_uppercase_statics)]
-
-use prelude::*;
-
-use default::Default;
use from_str::FromStr;
-use num::{Bitwise, Bounded, CheckedAdd, CheckedSub, CheckedMul};
-use num::{CheckedDiv, Zero, One, strconv};
+use iter::Iterator;
use num::{ToStrRadix, FromStrRadix};
-use option::{Option, Some, None};
+use num::strconv;
+use option::Option;
+use slice::{ImmutableVector, OwnedVector};
use str;
-use intrinsics;
-
-int_module!(i16, 16)
-
-impl Bitwise for i16 {
- /// Returns the number of ones in the binary representation of the number.
- #[inline]
- fn count_ones(&self) -> i16 { unsafe { intrinsics::ctpop16(*self as u16) as i16 } }
-
- /// Returns the number of leading zeros in the in the binary representation
- /// of the number.
- #[inline]
- fn leading_zeros(&self) -> i16 { unsafe { intrinsics::ctlz16(*self as u16) as i16 } }
-
- /// Returns the number of trailing zeros in the in the binary representation
- /// of the number.
- #[inline]
- fn trailing_zeros(&self) -> i16 { unsafe { intrinsics::cttz16(*self as u16) as i16 } }
-}
-
-impl CheckedAdd for i16 {
- #[inline]
- fn checked_add(&self, v: &i16) -> Option<i16> {
- unsafe {
- let (x, y) = intrinsics::i16_add_with_overflow(*self, *v);
- if y { None } else { Some(x) }
- }
- }
-}
-impl CheckedSub for i16 {
- #[inline]
- fn checked_sub(&self, v: &i16) -> Option<i16> {
- unsafe {
- let (x, y) = intrinsics::i16_sub_with_overflow(*self, *v);
- if y { None } else { Some(x) }
- }
- }
-}
+pub use core::i16::{BITS, BYTES, MIN, MAX};
-impl CheckedMul for i16 {
- #[inline]
- fn checked_mul(&self, v: &i16) -> Option<i16> {
- unsafe {
- let (x, y) = intrinsics::i16_mul_with_overflow(*self, *v);
- if y { None } else { Some(x) }
- }
- }
-}
+int_module!(i16)
//! Operations and constants for signed 32-bits integers (`i32` type)
-#![allow(non_uppercase_statics)]
-
-use prelude::*;
-
-use default::Default;
use from_str::FromStr;
-use num::{Bitwise, Bounded, CheckedAdd, CheckedSub, CheckedMul};
-use num::{CheckedDiv, Zero, One, strconv};
+use iter::Iterator;
use num::{ToStrRadix, FromStrRadix};
-use option::{Option, Some, None};
+use num::strconv;
+use option::Option;
+use slice::{ImmutableVector, OwnedVector};
use str;
-use intrinsics;
-
-int_module!(i32, 32)
-
-impl Bitwise for i32 {
- /// Returns the number of ones in the binary representation of the number.
- #[inline]
- fn count_ones(&self) -> i32 { unsafe { intrinsics::ctpop32(*self as u32) as i32 } }
-
- /// Returns the number of leading zeros in the in the binary representation
- /// of the number.
- #[inline]
- fn leading_zeros(&self) -> i32 { unsafe { intrinsics::ctlz32(*self as u32) as i32 } }
-
- /// Returns the number of trailing zeros in the in the binary representation
- /// of the number.
- #[inline]
- fn trailing_zeros(&self) -> i32 { unsafe { intrinsics::cttz32(*self as u32) as i32 } }
-}
-
-impl CheckedAdd for i32 {
- #[inline]
- fn checked_add(&self, v: &i32) -> Option<i32> {
- unsafe {
- let (x, y) = intrinsics::i32_add_with_overflow(*self, *v);
- if y { None } else { Some(x) }
- }
- }
-}
-impl CheckedSub for i32 {
- #[inline]
- fn checked_sub(&self, v: &i32) -> Option<i32> {
- unsafe {
- let (x, y) = intrinsics::i32_sub_with_overflow(*self, *v);
- if y { None } else { Some(x) }
- }
- }
-}
+pub use core::i32::{BITS, BYTES, MIN, MAX};
-impl CheckedMul for i32 {
- #[inline]
- fn checked_mul(&self, v: &i32) -> Option<i32> {
- unsafe {
- let (x, y) = intrinsics::i32_mul_with_overflow(*self, *v);
- if y { None } else { Some(x) }
- }
- }
-}
+int_module!(i32)
//! Operations and constants for signed 64-bits integers (`i64` type)
-#![allow(non_uppercase_statics)]
-
-use prelude::*;
-
-use default::Default;
use from_str::FromStr;
-#[cfg(target_word_size = "64")]
-use num::CheckedMul;
-use num::{Bitwise, Bounded, CheckedAdd, CheckedSub};
-use num::{CheckedDiv, Zero, One, strconv};
+use iter::Iterator;
use num::{ToStrRadix, FromStrRadix};
-use option::{Option, Some, None};
+use num::strconv;
+use option::Option;
+use slice::{ImmutableVector, OwnedVector};
use str;
-use intrinsics;
-
-int_module!(i64, 64)
-
-impl Bitwise for i64 {
- /// Returns the number of ones in the binary representation of the number.
- #[inline]
- fn count_ones(&self) -> i64 { unsafe { intrinsics::ctpop64(*self as u64) as i64 } }
-
- /// Returns the number of leading zeros in the in the binary representation
- /// of the number.
- #[inline]
- fn leading_zeros(&self) -> i64 { unsafe { intrinsics::ctlz64(*self as u64) as i64 } }
-
- /// Counts the number of trailing zeros.
- #[inline]
- fn trailing_zeros(&self) -> i64 { unsafe { intrinsics::cttz64(*self as u64) as i64 } }
-}
-
-impl CheckedAdd for i64 {
- #[inline]
- fn checked_add(&self, v: &i64) -> Option<i64> {
- unsafe {
- let (x, y) = intrinsics::i64_add_with_overflow(*self, *v);
- if y { None } else { Some(x) }
- }
- }
-}
-impl CheckedSub for i64 {
- #[inline]
- fn checked_sub(&self, v: &i64) -> Option<i64> {
- unsafe {
- let (x, y) = intrinsics::i64_sub_with_overflow(*self, *v);
- if y { None } else { Some(x) }
- }
- }
-}
+pub use core::i64::{BITS, BYTES, MIN, MAX};
-impl CheckedMul for i64 {
- #[inline]
- fn checked_mul(&self, v: &i64) -> Option<i64> {
- unsafe {
- let (x, y) = intrinsics::i64_mul_with_overflow(*self, *v);
- if y { None } else { Some(x) }
- }
- }
-}
+int_module!(i64)
//! Operations and constants for signed 8-bits integers (`i8` type)
-#![allow(non_uppercase_statics)]
-
-use prelude::*;
-
-use default::Default;
use from_str::FromStr;
-use num::{Bitwise, Bounded, CheckedAdd, CheckedSub, CheckedMul};
-use num::{CheckedDiv, Zero, One, strconv};
+use iter::Iterator;
use num::{ToStrRadix, FromStrRadix};
-use option::{Option, Some, None};
+use num::strconv;
+use option::Option;
+use slice::{ImmutableVector, OwnedVector};
use str;
-use intrinsics;
-
-int_module!(i8, 8)
-
-impl Bitwise for i8 {
- /// Returns the number of ones in the binary representation of the number.
- #[inline]
- fn count_ones(&self) -> i8 { unsafe { intrinsics::ctpop8(*self as u8) as i8 } }
-
- /// Returns the number of leading zeros in the in the binary representation
- /// of the number.
- #[inline]
- fn leading_zeros(&self) -> i8 { unsafe { intrinsics::ctlz8(*self as u8) as i8 } }
-
- /// Returns the number of trailing zeros in the in the binary representation
- /// of the number.
- #[inline]
- fn trailing_zeros(&self) -> i8 { unsafe { intrinsics::cttz8(*self as u8) as i8 } }
-}
-
-impl CheckedAdd for i8 {
- #[inline]
- fn checked_add(&self, v: &i8) -> Option<i8> {
- unsafe {
- let (x, y) = intrinsics::i8_add_with_overflow(*self, *v);
- if y { None } else { Some(x) }
- }
- }
-}
-impl CheckedSub for i8 {
- #[inline]
- fn checked_sub(&self, v: &i8) -> Option<i8> {
- unsafe {
- let (x, y) = intrinsics::i8_sub_with_overflow(*self, *v);
- if y { None } else { Some(x) }
- }
- }
-}
+pub use core::i8::{BITS, BYTES, MIN, MAX};
-impl CheckedMul for i8 {
- #[inline]
- fn checked_mul(&self, v: &i8) -> Option<i8> {
- unsafe {
- let (x, y) = intrinsics::i8_mul_with_overflow(*self, *v);
- if y { None } else { Some(x) }
- }
- }
-}
+int_module!(i8)
//! Operations and constants for architecture-sized signed integers (`int` type)
-#![allow(non_uppercase_statics)]
-
-use prelude::*;
-
-use default::Default;
use from_str::FromStr;
-use num::{Bitwise, Bounded, CheckedAdd, CheckedSub, CheckedMul};
-use num::{CheckedDiv, Zero, One, strconv};
+use iter::Iterator;
use num::{ToStrRadix, FromStrRadix};
-use option::{Option, Some, None};
+use num::strconv;
+use option::Option;
+use slice::{ImmutableVector, OwnedVector};
use str;
-use intrinsics;
-
-#[cfg(target_word_size = "32")] int_module!(int, 32)
-#[cfg(target_word_size = "64")] int_module!(int, 64)
-
-#[cfg(target_word_size = "32")]
-impl Bitwise for int {
- /// Returns the number of ones in the binary representation of the number.
- #[inline]
- fn count_ones(&self) -> int { (*self as i32).count_ones() as int }
-
- /// Returns the number of leading zeros in the in the binary representation
- /// of the number.
- #[inline]
- fn leading_zeros(&self) -> int { (*self as i32).leading_zeros() as int }
-
- /// Returns the number of trailing zeros in the in the binary representation
- /// of the number.
- #[inline]
- fn trailing_zeros(&self) -> int { (*self as i32).trailing_zeros() as int }
-}
-
-#[cfg(target_word_size = "64")]
-impl Bitwise for int {
- /// Returns the number of ones in the binary representation of the number.
- #[inline]
- fn count_ones(&self) -> int { (*self as i64).count_ones() as int }
-
- /// Returns the number of leading zeros in the in the binary representation
- /// of the number.
- #[inline]
- fn leading_zeros(&self) -> int { (*self as i64).leading_zeros() as int }
-
- /// Returns the number of trailing zeros in the in the binary representation
- /// of the number.
- #[inline]
- fn trailing_zeros(&self) -> int { (*self as i64).trailing_zeros() as int }
-}
-
-#[cfg(target_word_size = "32")]
-impl CheckedAdd for int {
- #[inline]
- fn checked_add(&self, v: &int) -> Option<int> {
- unsafe {
- let (x, y) = intrinsics::i32_add_with_overflow(*self as i32, *v as i32);
- if y { None } else { Some(x as int) }
- }
- }
-}
-
-#[cfg(target_word_size = "64")]
-impl CheckedAdd for int {
- #[inline]
- fn checked_add(&self, v: &int) -> Option<int> {
- unsafe {
- let (x, y) = intrinsics::i64_add_with_overflow(*self as i64, *v as i64);
- if y { None } else { Some(x as int) }
- }
- }
-}
-
-#[cfg(target_word_size = "32")]
-impl CheckedSub for int {
- #[inline]
- fn checked_sub(&self, v: &int) -> Option<int> {
- unsafe {
- let (x, y) = intrinsics::i32_sub_with_overflow(*self as i32, *v as i32);
- if y { None } else { Some(x as int) }
- }
- }
-}
-
-#[cfg(target_word_size = "64")]
-impl CheckedSub for int {
- #[inline]
- fn checked_sub(&self, v: &int) -> Option<int> {
- unsafe {
- let (x, y) = intrinsics::i64_sub_with_overflow(*self as i64, *v as i64);
- if y { None } else { Some(x as int) }
- }
- }
-}
-#[cfg(target_word_size = "32")]
-impl CheckedMul for int {
- #[inline]
- fn checked_mul(&self, v: &int) -> Option<int> {
- unsafe {
- let (x, y) = intrinsics::i32_mul_with_overflow(*self as i32, *v as i32);
- if y { None } else { Some(x as int) }
- }
- }
-}
+pub use core::int::{BITS, BYTES, MIN, MAX};
-#[cfg(target_word_size = "64")]
-impl CheckedMul for int {
- #[inline]
- fn checked_mul(&self, v: &int) -> Option<int> {
- unsafe {
- let (x, y) = intrinsics::i64_mul_with_overflow(*self as i64, *v as i64);
- if y { None } else { Some(x as int) }
- }
- }
-}
+int_module!(int)
#![macro_escape]
#![doc(hidden)]
-macro_rules! int_module (($T:ty, $bits:expr) => (
-
-// FIXME(#11621): Should be deprecated once CTFE is implemented in favour of
-// calling the `mem::size_of` function.
-pub static BITS : uint = $bits;
-// FIXME(#11621): Should be deprecated once CTFE is implemented in favour of
-// calling the `mem::size_of` function.
-pub static BYTES : uint = ($bits / 8);
-
-// FIXME(#11621): Should be deprecated once CTFE is implemented in favour of
-// calling the `Bounded::min_value` function.
-pub static MIN: $T = (-1 as $T) << (BITS - 1);
-// FIXME(#9837): Compute MIN like this so the high bits that shouldn't exist are 0.
-// FIXME(#11621): Should be deprecated once CTFE is implemented in favour of
-// calling the `Bounded::max_value` function.
-pub static MAX: $T = !MIN;
-
-impl CheckedDiv for $T {
- #[inline]
- fn checked_div(&self, v: &$T) -> Option<$T> {
- if *v == 0 || (*self == MIN && *v == -1) {
- None
- } else {
- Some(self / *v)
- }
- }
-}
-
-impl Num for $T {}
-
-#[cfg(not(test))]
-impl Ord for $T {
- #[inline]
- fn lt(&self, other: &$T) -> bool { return (*self) < (*other); }
-}
-
-#[cfg(not(test))]
-impl Eq for $T {
- #[inline]
- fn eq(&self, other: &$T) -> bool { return (*self) == (*other); }
-}
-
-impl Default for $T {
- #[inline]
- fn default() -> $T { 0 }
-}
-
-impl Zero for $T {
- #[inline]
- fn zero() -> $T { 0 }
-
- #[inline]
- fn is_zero(&self) -> bool { *self == 0 }
-}
-
-impl One for $T {
- #[inline]
- fn one() -> $T { 1 }
-}
-
-#[cfg(not(test))]
-impl Add<$T,$T> for $T {
- #[inline]
- fn add(&self, other: &$T) -> $T { *self + *other }
-}
-
-#[cfg(not(test))]
-impl Sub<$T,$T> for $T {
- #[inline]
- fn sub(&self, other: &$T) -> $T { *self - *other }
-}
-
-#[cfg(not(test))]
-impl Mul<$T,$T> for $T {
- #[inline]
- fn mul(&self, other: &$T) -> $T { *self * *other }
-}
-
-#[cfg(not(test))]
-impl Div<$T,$T> for $T {
- /// Integer division, truncated towards 0.
- ///
- /// # Examples
- ///
- /// ~~~
- /// assert!( 8 / 3 == 2);
- /// assert!( 8 / -3 == -2);
- /// assert!(-8 / 3 == -2);
- /// assert!(-8 / -3 == 2);
- ///
- /// assert!( 1 / 2 == 0);
- /// assert!( 1 / -2 == 0);
- /// assert!(-1 / 2 == 0);
- /// assert!(-1 / -2 == 0);
- /// ~~~
- #[inline]
- fn div(&self, other: &$T) -> $T { *self / *other }
-}
-
-#[cfg(not(test))]
-impl Rem<$T,$T> for $T {
- /// Returns the integer remainder after division, satisfying:
- ///
- /// ~~~
- /// # let n = 1;
- /// # let d = 2;
- /// assert!((n / d) * d + (n % d) == n)
- /// ~~~
- ///
- /// # Examples
- ///
- /// ~~~
- /// assert!( 8 % 3 == 2);
- /// assert!( 8 % -3 == 2);
- /// assert!(-8 % 3 == -2);
- /// assert!(-8 % -3 == -2);
- ///
- /// assert!( 1 % 2 == 1);
- /// assert!( 1 % -2 == 1);
- /// assert!(-1 % 2 == -1);
- /// assert!(-1 % -2 == -1);
- /// ~~~
- #[inline]
- fn rem(&self, other: &$T) -> $T { *self % *other }
-}
-
-#[cfg(not(test))]
-impl Neg<$T> for $T {
- #[inline]
- fn neg(&self) -> $T { -*self }
-}
-
-impl Signed for $T {
- /// Computes the absolute value
- #[inline]
- fn abs(&self) -> $T {
- if self.is_negative() { -*self } else { *self }
- }
-
- ///
- /// The positive difference of two numbers. Returns `0` if the number is less than or
- /// equal to `other`, otherwise the difference between`self` and `other` is returned.
- ///
- #[inline]
- fn abs_sub(&self, other: &$T) -> $T {
- if *self <= *other { 0 } else { *self - *other }
- }
-
- ///
- /// # Returns
- ///
- /// - `0` if the number is zero
- /// - `1` if the number is positive
- /// - `-1` if the number is negative
- ///
- #[inline]
- fn signum(&self) -> $T {
- match *self {
- n if n > 0 => 1,
- 0 => 0,
- _ => -1,
- }
- }
-
- /// Returns true if the number is positive
- #[inline]
- fn is_positive(&self) -> bool { *self > 0 }
-
- /// Returns true if the number is negative
- #[inline]
- fn is_negative(&self) -> bool { *self < 0 }
-}
-
-#[cfg(not(test))]
-impl BitOr<$T,$T> for $T {
- #[inline]
- fn bitor(&self, other: &$T) -> $T { *self | *other }
-}
-
-#[cfg(not(test))]
-impl BitAnd<$T,$T> for $T {
- #[inline]
- fn bitand(&self, other: &$T) -> $T { *self & *other }
-}
-
-#[cfg(not(test))]
-impl BitXor<$T,$T> for $T {
- #[inline]
- fn bitxor(&self, other: &$T) -> $T { *self ^ *other }
-}
-
-#[cfg(not(test))]
-impl Shl<$T,$T> for $T {
- #[inline]
- fn shl(&self, other: &$T) -> $T { *self << *other }
-}
-
-#[cfg(not(test))]
-impl Shr<$T,$T> for $T {
- #[inline]
- fn shr(&self, other: &$T) -> $T { *self >> *other }
-}
-
-#[cfg(not(test))]
-impl Not<$T> for $T {
- #[inline]
- fn not(&self) -> $T { !*self }
-}
-
-impl Bounded for $T {
- #[inline]
- fn min_value() -> $T { MIN }
-
- #[inline]
- fn max_value() -> $T { MAX }
-}
-
-impl Int for $T {}
-
-impl Primitive for $T {}
+macro_rules! int_module (($T:ty) => (
// String conversion functions and impl str -> num
/// Convert to a string in a given base.
#[inline]
fn to_str_radix(&self, radix: uint) -> ~str {
- let mut buf = Vec::new();
+ let mut buf = ::vec::Vec::new();
strconv::int_to_str_bytes_common(*self, radix, strconv::SignNeg, |i| {
buf.push(i);
});
use prelude::*;
use super::*;
- use int;
use i32;
- use num;
- use num::Bitwise;
- use num::CheckedDiv;
use num::ToStrRadix;
use str::StrSlice;
- #[test]
- fn test_overflows() {
- assert!(MAX > 0);
- assert!(MIN <= 0);
- assert_eq!(MIN + MAX + 1, 0);
- }
-
- #[test]
- fn test_num() {
- num::test_num(10 as $T, 2 as $T);
- }
-
- #[test]
- pub fn test_abs() {
- assert_eq!((1 as $T).abs(), 1 as $T);
- assert_eq!((0 as $T).abs(), 0 as $T);
- assert_eq!((-1 as $T).abs(), 1 as $T);
- }
-
- #[test]
- fn test_abs_sub() {
- assert_eq!((-1 as $T).abs_sub(&(1 as $T)), 0 as $T);
- assert_eq!((1 as $T).abs_sub(&(1 as $T)), 0 as $T);
- assert_eq!((1 as $T).abs_sub(&(0 as $T)), 1 as $T);
- assert_eq!((1 as $T).abs_sub(&(-1 as $T)), 2 as $T);
- }
-
- #[test]
- fn test_signum() {
- assert_eq!((1 as $T).signum(), 1 as $T);
- assert_eq!((0 as $T).signum(), 0 as $T);
- assert_eq!((-0 as $T).signum(), 0 as $T);
- assert_eq!((-1 as $T).signum(), -1 as $T);
- }
-
- #[test]
- fn test_is_positive() {
- assert!((1 as $T).is_positive());
- assert!(!(0 as $T).is_positive());
- assert!(!(-0 as $T).is_positive());
- assert!(!(-1 as $T).is_positive());
- }
-
- #[test]
- fn test_is_negative() {
- assert!(!(1 as $T).is_negative());
- assert!(!(0 as $T).is_negative());
- assert!(!(-0 as $T).is_negative());
- assert!((-1 as $T).is_negative());
- }
-
- #[test]
- fn test_bitwise() {
- assert_eq!(0b1110 as $T, (0b1100 as $T).bitor(&(0b1010 as $T)));
- assert_eq!(0b1000 as $T, (0b1100 as $T).bitand(&(0b1010 as $T)));
- assert_eq!(0b0110 as $T, (0b1100 as $T).bitxor(&(0b1010 as $T)));
- assert_eq!(0b1110 as $T, (0b0111 as $T).shl(&(1 as $T)));
- assert_eq!(0b0111 as $T, (0b1110 as $T).shr(&(1 as $T)));
- assert_eq!(-(0b11 as $T) - (1 as $T), (0b11 as $T).not());
- }
-
- #[test]
- fn test_count_ones() {
- assert_eq!((0b0101100 as $T).count_ones(), 3);
- assert_eq!((0b0100001 as $T).count_ones(), 2);
- assert_eq!((0b1111001 as $T).count_ones(), 5);
- }
-
- #[test]
- fn test_count_zeros() {
- assert_eq!((0b0101100 as $T).count_zeros(), BITS as $T - 3);
- assert_eq!((0b0100001 as $T).count_zeros(), BITS as $T - 2);
- assert_eq!((0b1111001 as $T).count_zeros(), BITS as $T - 5);
- }
-
#[test]
fn test_from_str() {
assert_eq!(from_str::<$T>("0"), Some(0 as $T));
assert_eq!(from_str::<i64>("-9223372036854775808"), Some(i64_val));
assert!(from_str::<i64>("-9223372036854775809").is_none());
}
-
- #[test]
- fn test_signed_checked_div() {
- assert_eq!(10i.checked_div(&2), Some(5));
- assert_eq!(5i.checked_div(&0), None);
- assert_eq!(int::MIN.checked_div(&-1), None);
- }
}
))
#![allow(missing_doc)]
-use clone::Clone;
-use cmp::{Eq, Ord};
-use kinds::Copy;
-use mem::size_of;
-use ops::{Add, Sub, Mul, Div, Rem, Neg};
-use ops::{Not, BitAnd, BitOr, BitXor, Shl, Shr};
-use option::{Option, Some, None};
-use fmt::{Show, Binary, Octal, LowerHex, UpperHex};
+use option::{Option};
+
+#[cfg(test)] use fmt::Show;
+
+pub use core::num::{Num, div_rem, Zero, zero, One, one};
+pub use core::num::{Signed, abs, abs_sub, signum};
+pub use core::num::{Unsigned, pow, Bounded, Bitwise};
+pub use core::num::{Primitive, Int, Saturating};
+pub use core::num::{CheckedAdd, CheckedSub, CheckedMul, CheckedDiv};
+pub use core::num::{cast, FromPrimitive, NumCast, ToPrimitive};
+pub use core::num::{next_power_of_two, is_power_of_two};
+pub use core::num::{checked_next_power_of_two};
+pub use core::num::{from_int, from_i8, from_i16, from_i32, from_i64};
+pub use core::num::{from_uint, from_u8, from_u16, from_u32, from_u64};
+pub use core::num::{from_f32, from_f64};
pub mod strconv;
-/// The base trait for numeric types
-pub trait Num: Eq + Zero + One
- + Neg<Self>
- + Add<Self,Self>
- + Sub<Self,Self>
- + Mul<Self,Self>
- + Div<Self,Self>
- + Rem<Self,Self> {}
-
-/// Simultaneous division and remainder
-#[inline]
-pub fn div_rem<T: Div<T, T> + Rem<T, T>>(x: T, y: T) -> (T, T) {
- (x / y, x % y)
-}
-
-/// Defines an additive identity element for `Self`.
-///
-/// # Deriving
-///
-/// This trait can be automatically be derived using `#[deriving(Zero)]`
-/// attribute. If you choose to use this, make sure that the laws outlined in
-/// the documentation for `Zero::zero` still hold.
-pub trait Zero: Add<Self, Self> {
- /// Returns the additive identity element of `Self`, `0`.
- ///
- /// # Laws
- ///
- /// ~~~notrust
- /// a + 0 = a ∀ a ∈ Self
- /// 0 + a = a ∀ a ∈ Self
- /// ~~~
- ///
- /// # Purity
- ///
- /// This function should return the same result at all times regardless of
- /// external mutable state, for example values stored in TLS or in
- /// `static mut`s.
- // FIXME (#5527): This should be an associated constant
- fn zero() -> Self;
-
- /// Returns `true` if `self` is equal to the additive identity.
- fn is_zero(&self) -> bool;
-}
-
-/// Returns the additive identity, `0`.
-#[inline(always)] pub fn zero<T: Zero>() -> T { Zero::zero() }
-
-/// Defines a multiplicative identity element for `Self`.
-pub trait One: Mul<Self, Self> {
- /// Returns the multiplicative identity element of `Self`, `1`.
- ///
- /// # Laws
- ///
- /// ~~~notrust
- /// a * 1 = a ∀ a ∈ Self
- /// 1 * a = a ∀ a ∈ Self
- /// ~~~
- ///
- /// # Purity
- ///
- /// This function should return the same result at all times regardless of
- /// external mutable state, for example values stored in TLS or in
- /// `static mut`s.
- // FIXME (#5527): This should be an associated constant
- fn one() -> Self;
-}
-
-/// Returns the multiplicative identity, `1`.
-#[inline(always)] pub fn one<T: One>() -> T { One::one() }
-
-/// Useful functions for signed numbers (i.e. numbers that can be negative).
-pub trait Signed: Num + Neg<Self> {
- /// Computes the absolute value.
- ///
- /// For float, f32, and f64, `NaN` will be returned if the number is `NaN`.
- fn abs(&self) -> Self;
-
- /// The positive difference of two numbers.
- ///
- /// Returns `zero` if the number is less than or equal to `other`, otherwise the difference
- /// between `self` and `other` is returned.
- fn abs_sub(&self, other: &Self) -> Self;
-
- /// Returns the sign of the number.
- ///
- /// For `float`, `f32`, `f64`:
- /// * `1.0` if the number is positive, `+0.0` or `INFINITY`
- /// * `-1.0` if the number is negative, `-0.0` or `NEG_INFINITY`
- /// * `NaN` if the number is `NaN`
- ///
- /// For `int`:
- /// * `0` if the number is zero
- /// * `1` if the number is positive
- /// * `-1` if the number is negative
- fn signum(&self) -> Self;
-
- /// Returns true if the number is positive and false if the number is zero or negative.
- fn is_positive(&self) -> bool;
-
- /// Returns true if the number is negative and false if the number is zero or positive.
- fn is_negative(&self) -> bool;
-}
-
-/// Computes the absolute value.
-///
-/// For float, f32, and f64, `NaN` will be returned if the number is `NaN`
-#[inline(always)]
-pub fn abs<T: Signed>(value: T) -> T {
- value.abs()
-}
-
-/// The positive difference of two numbers.
-///
-/// Returns `zero` if the number is less than or equal to `other`,
-/// otherwise the difference between `self` and `other` is returned.
-#[inline(always)]
-pub fn abs_sub<T: Signed>(x: T, y: T) -> T {
- x.abs_sub(&y)
-}
-
-/// Returns the sign of the number.
-///
-/// For float, f32, f64:
-/// - `1.0` if the number is positive, `+0.0` or `INFINITY`
-/// - `-1.0` if the number is negative, `-0.0` or `NEG_INFINITY`
-/// - `NAN` if the number is `NAN`
-///
-/// For int:
-/// - `0` if the number is zero
-/// - `1` if the number is positive
-/// - `-1` if the number is negative
-#[inline(always)] pub fn signum<T: Signed>(value: T) -> T { value.signum() }
-
-/// A trait for values which cannot be negative
-pub trait Unsigned: Num {}
-
-/// Raises a value to the power of exp, using exponentiation by squaring.
-///
-/// # Example
-///
-/// ```rust
-/// use std::num;
-///
-/// assert_eq!(num::pow(2, 4), 16);
-/// ```
-#[inline]
-pub fn pow<T: One + Mul<T, T>>(mut base: T, mut exp: uint) -> T {
- if exp == 1 { base }
- else {
- let mut acc = one::<T>();
- while exp > 0 {
- if (exp & 1) == 1 {
- acc = acc * base;
- }
- base = base * base;
- exp = exp >> 1;
- }
- acc
- }
-}
-
-/// Numbers which have upper and lower bounds
-pub trait Bounded {
- // FIXME (#5527): These should be associated constants
- /// returns the smallest finite number this type can represent
- fn min_value() -> Self;
- /// returns the largest finite number this type can represent
- fn max_value() -> Self;
-}
-
-/// Numbers with a fixed binary representation.
-pub trait Bitwise: Bounded
- + Not<Self>
- + BitAnd<Self,Self>
- + BitOr<Self,Self>
- + BitXor<Self,Self>
- + Shl<Self,Self>
- + Shr<Self,Self> {
- /// Returns the number of ones in the binary representation of the number.
- ///
- /// # Example
- ///
- /// ```rust
- /// use std::num::Bitwise;
- ///
- /// let n = 0b01001100u8;
- /// assert_eq!(n.count_ones(), 3);
- /// ```
- fn count_ones(&self) -> Self;
-
- /// Returns the number of zeros in the binary representation of the number.
- ///
- /// # Example
- ///
- /// ```rust
- /// use std::num::Bitwise;
- ///
- /// let n = 0b01001100u8;
- /// assert_eq!(n.count_zeros(), 5);
- /// ```
- #[inline]
- fn count_zeros(&self) -> Self {
- (!*self).count_ones()
- }
-
- /// Returns the number of leading zeros in the in the binary representation
- /// of the number.
- ///
- /// # Example
- ///
- /// ```rust
- /// use std::num::Bitwise;
- ///
- /// let n = 0b0101000u16;
- /// assert_eq!(n.leading_zeros(), 10);
- /// ```
- fn leading_zeros(&self) -> Self;
-
- /// Returns the number of trailing zeros in the in the binary representation
- /// of the number.
- ///
- /// # Example
- ///
- /// ```rust
- /// use std::num::Bitwise;
- ///
- /// let n = 0b0101000u16;
- /// assert_eq!(n.trailing_zeros(), 3);
- /// ```
- fn trailing_zeros(&self) -> Self;
-}
-
-/// Specifies the available operations common to all of Rust's core numeric primitives.
-/// These may not always make sense from a purely mathematical point of view, but
-/// may be useful for systems programming.
-pub trait Primitive: Copy
- + Clone
- + Num
- + NumCast
- + Ord
- + Bounded {}
-
-/// A collection of traits relevant to primitive signed and unsigned integers
-pub trait Int: Primitive
- + Bitwise
- + CheckedAdd
- + CheckedSub
- + CheckedMul
- + CheckedDiv
- + Show
- + Binary
- + Octal
- + LowerHex
- + UpperHex {}
-
-/// Returns the smallest power of 2 greater than or equal to `n`.
-#[inline]
-pub fn next_power_of_two<T: Unsigned + Int>(n: T) -> T {
- let halfbits: T = cast(size_of::<T>() * 4).unwrap();
- let mut tmp: T = n - one();
- let mut shift: T = one();
- while shift <= halfbits {
- tmp = tmp | (tmp >> shift);
- shift = shift << one();
- }
- tmp + one()
-}
-
-// Returns `true` iff `n == 2^k` for some k.
-#[inline]
-pub fn is_power_of_two<T: Unsigned + Int>(n: T) -> bool {
- (n - one()) & n == zero()
-}
-
-/// Returns the smallest power of 2 greater than or equal to `n`. If the next
-/// power of two is greater than the type's maximum value, `None` is returned,
-/// otherwise the power of 2 is wrapped in `Some`.
-#[inline]
-pub fn checked_next_power_of_two<T: Unsigned + Int>(n: T) -> Option<T> {
- let halfbits: T = cast(size_of::<T>() * 4).unwrap();
- let mut tmp: T = n - one();
- let mut shift: T = one();
- while shift <= halfbits {
- tmp = tmp | (tmp >> shift);
- shift = shift << one();
- }
- tmp.checked_add(&one())
-}
-
/// Used for representing the classification of floating point numbers
#[deriving(Eq, Show)]
pub enum FPCategory {
fn to_radians(self) -> Self;
}
-/// A generic trait for converting a value to a number.
-pub trait ToPrimitive {
- /// Converts the value of `self` to an `int`.
- #[inline]
- fn to_int(&self) -> Option<int> {
- self.to_i64().and_then(|x| x.to_int())
- }
-
- /// Converts the value of `self` to an `i8`.
- #[inline]
- fn to_i8(&self) -> Option<i8> {
- self.to_i64().and_then(|x| x.to_i8())
- }
-
- /// Converts the value of `self` to an `i16`.
- #[inline]
- fn to_i16(&self) -> Option<i16> {
- self.to_i64().and_then(|x| x.to_i16())
- }
-
- /// Converts the value of `self` to an `i32`.
- #[inline]
- fn to_i32(&self) -> Option<i32> {
- self.to_i64().and_then(|x| x.to_i32())
- }
-
- /// Converts the value of `self` to an `i64`.
- fn to_i64(&self) -> Option<i64>;
-
- /// Converts the value of `self` to an `uint`.
- #[inline]
- fn to_uint(&self) -> Option<uint> {
- self.to_u64().and_then(|x| x.to_uint())
- }
-
- /// Converts the value of `self` to an `u8`.
- #[inline]
- fn to_u8(&self) -> Option<u8> {
- self.to_u64().and_then(|x| x.to_u8())
- }
-
- /// Converts the value of `self` to an `u16`.
- #[inline]
- fn to_u16(&self) -> Option<u16> {
- self.to_u64().and_then(|x| x.to_u16())
- }
-
- /// Converts the value of `self` to an `u32`.
- #[inline]
- fn to_u32(&self) -> Option<u32> {
- self.to_u64().and_then(|x| x.to_u32())
- }
-
- /// Converts the value of `self` to an `u64`.
- #[inline]
- fn to_u64(&self) -> Option<u64>;
-
- /// Converts the value of `self` to an `f32`.
- #[inline]
- fn to_f32(&self) -> Option<f32> {
- self.to_f64().and_then(|x| x.to_f32())
- }
-
- /// Converts the value of `self` to an `f64`.
- #[inline]
- fn to_f64(&self) -> Option<f64> {
- self.to_i64().and_then(|x| x.to_f64())
- }
-}
-
-macro_rules! impl_to_primitive_int_to_int(
- ($SrcT:ty, $DstT:ty) => (
- {
- if size_of::<$SrcT>() <= size_of::<$DstT>() {
- Some(*self as $DstT)
- } else {
- let n = *self as i64;
- let min_value: $DstT = Bounded::min_value();
- let max_value: $DstT = Bounded::max_value();
- if min_value as i64 <= n && n <= max_value as i64 {
- Some(*self as $DstT)
- } else {
- None
- }
- }
- }
- )
-)
-
-macro_rules! impl_to_primitive_int_to_uint(
- ($SrcT:ty, $DstT:ty) => (
- {
- let zero: $SrcT = Zero::zero();
- let max_value: $DstT = Bounded::max_value();
- if zero <= *self && *self as u64 <= max_value as u64 {
- Some(*self as $DstT)
- } else {
- None
- }
- }
- )
-)
-
-macro_rules! impl_to_primitive_int(
- ($T:ty) => (
- impl ToPrimitive for $T {
- #[inline]
- fn to_int(&self) -> Option<int> { impl_to_primitive_int_to_int!($T, int) }
- #[inline]
- fn to_i8(&self) -> Option<i8> { impl_to_primitive_int_to_int!($T, i8) }
- #[inline]
- fn to_i16(&self) -> Option<i16> { impl_to_primitive_int_to_int!($T, i16) }
- #[inline]
- fn to_i32(&self) -> Option<i32> { impl_to_primitive_int_to_int!($T, i32) }
- #[inline]
- fn to_i64(&self) -> Option<i64> { impl_to_primitive_int_to_int!($T, i64) }
-
- #[inline]
- fn to_uint(&self) -> Option<uint> { impl_to_primitive_int_to_uint!($T, uint) }
- #[inline]
- fn to_u8(&self) -> Option<u8> { impl_to_primitive_int_to_uint!($T, u8) }
- #[inline]
- fn to_u16(&self) -> Option<u16> { impl_to_primitive_int_to_uint!($T, u16) }
- #[inline]
- fn to_u32(&self) -> Option<u32> { impl_to_primitive_int_to_uint!($T, u32) }
- #[inline]
- fn to_u64(&self) -> Option<u64> { impl_to_primitive_int_to_uint!($T, u64) }
-
- #[inline]
- fn to_f32(&self) -> Option<f32> { Some(*self as f32) }
- #[inline]
- fn to_f64(&self) -> Option<f64> { Some(*self as f64) }
- }
- )
-)
-
-impl_to_primitive_int!(int)
-impl_to_primitive_int!(i8)
-impl_to_primitive_int!(i16)
-impl_to_primitive_int!(i32)
-impl_to_primitive_int!(i64)
-
-macro_rules! impl_to_primitive_uint_to_int(
- ($DstT:ty) => (
- {
- let max_value: $DstT = Bounded::max_value();
- if *self as u64 <= max_value as u64 {
- Some(*self as $DstT)
- } else {
- None
- }
- }
- )
-)
-
-macro_rules! impl_to_primitive_uint_to_uint(
- ($SrcT:ty, $DstT:ty) => (
- {
- if size_of::<$SrcT>() <= size_of::<$DstT>() {
- Some(*self as $DstT)
- } else {
- let zero: $SrcT = Zero::zero();
- let max_value: $DstT = Bounded::max_value();
- if zero <= *self && *self as u64 <= max_value as u64 {
- Some(*self as $DstT)
- } else {
- None
- }
- }
- }
- )
-)
-
-macro_rules! impl_to_primitive_uint(
- ($T:ty) => (
- impl ToPrimitive for $T {
- #[inline]
- fn to_int(&self) -> Option<int> { impl_to_primitive_uint_to_int!(int) }
- #[inline]
- fn to_i8(&self) -> Option<i8> { impl_to_primitive_uint_to_int!(i8) }
- #[inline]
- fn to_i16(&self) -> Option<i16> { impl_to_primitive_uint_to_int!(i16) }
- #[inline]
- fn to_i32(&self) -> Option<i32> { impl_to_primitive_uint_to_int!(i32) }
- #[inline]
- fn to_i64(&self) -> Option<i64> { impl_to_primitive_uint_to_int!(i64) }
-
- #[inline]
- fn to_uint(&self) -> Option<uint> { impl_to_primitive_uint_to_uint!($T, uint) }
- #[inline]
- fn to_u8(&self) -> Option<u8> { impl_to_primitive_uint_to_uint!($T, u8) }
- #[inline]
- fn to_u16(&self) -> Option<u16> { impl_to_primitive_uint_to_uint!($T, u16) }
- #[inline]
- fn to_u32(&self) -> Option<u32> { impl_to_primitive_uint_to_uint!($T, u32) }
- #[inline]
- fn to_u64(&self) -> Option<u64> { impl_to_primitive_uint_to_uint!($T, u64) }
-
- #[inline]
- fn to_f32(&self) -> Option<f32> { Some(*self as f32) }
- #[inline]
- fn to_f64(&self) -> Option<f64> { Some(*self as f64) }
- }
- )
-)
-
-impl_to_primitive_uint!(uint)
-impl_to_primitive_uint!(u8)
-impl_to_primitive_uint!(u16)
-impl_to_primitive_uint!(u32)
-impl_to_primitive_uint!(u64)
-
-macro_rules! impl_to_primitive_float_to_float(
- ($SrcT:ty, $DstT:ty) => (
- if size_of::<$SrcT>() <= size_of::<$DstT>() {
- Some(*self as $DstT)
- } else {
- let n = *self as f64;
- let max_value: $SrcT = Bounded::max_value();
- if -max_value as f64 <= n && n <= max_value as f64 {
- Some(*self as $DstT)
- } else {
- None
- }
- }
- )
-)
-
-macro_rules! impl_to_primitive_float(
- ($T:ty) => (
- impl ToPrimitive for $T {
- #[inline]
- fn to_int(&self) -> Option<int> { Some(*self as int) }
- #[inline]
- fn to_i8(&self) -> Option<i8> { Some(*self as i8) }
- #[inline]
- fn to_i16(&self) -> Option<i16> { Some(*self as i16) }
- #[inline]
- fn to_i32(&self) -> Option<i32> { Some(*self as i32) }
- #[inline]
- fn to_i64(&self) -> Option<i64> { Some(*self as i64) }
-
- #[inline]
- fn to_uint(&self) -> Option<uint> { Some(*self as uint) }
- #[inline]
- fn to_u8(&self) -> Option<u8> { Some(*self as u8) }
- #[inline]
- fn to_u16(&self) -> Option<u16> { Some(*self as u16) }
- #[inline]
- fn to_u32(&self) -> Option<u32> { Some(*self as u32) }
- #[inline]
- fn to_u64(&self) -> Option<u64> { Some(*self as u64) }
-
- #[inline]
- fn to_f32(&self) -> Option<f32> { impl_to_primitive_float_to_float!($T, f32) }
- #[inline]
- fn to_f64(&self) -> Option<f64> { impl_to_primitive_float_to_float!($T, f64) }
- }
- )
-)
-
-impl_to_primitive_float!(f32)
-impl_to_primitive_float!(f64)
-
-/// A generic trait for converting a number to a value.
-pub trait FromPrimitive {
- /// Convert an `int` to return an optional value of this type. If the
- /// value cannot be represented by this value, the `None` is returned.
- #[inline]
- fn from_int(n: int) -> Option<Self> {
- FromPrimitive::from_i64(n as i64)
- }
-
- /// Convert an `i8` to return an optional value of this type. If the
- /// type cannot be represented by this value, the `None` is returned.
- #[inline]
- fn from_i8(n: i8) -> Option<Self> {
- FromPrimitive::from_i64(n as i64)
- }
-
- /// Convert an `i16` to return an optional value of this type. If the
- /// type cannot be represented by this value, the `None` is returned.
- #[inline]
- fn from_i16(n: i16) -> Option<Self> {
- FromPrimitive::from_i64(n as i64)
- }
-
- /// Convert an `i32` to return an optional value of this type. If the
- /// type cannot be represented by this value, the `None` is returned.
- #[inline]
- fn from_i32(n: i32) -> Option<Self> {
- FromPrimitive::from_i64(n as i64)
- }
-
- /// Convert an `i64` to return an optional value of this type. If the
- /// type cannot be represented by this value, the `None` is returned.
- fn from_i64(n: i64) -> Option<Self>;
-
- /// Convert an `uint` to return an optional value of this type. If the
- /// type cannot be represented by this value, the `None` is returned.
- #[inline]
- fn from_uint(n: uint) -> Option<Self> {
- FromPrimitive::from_u64(n as u64)
- }
-
- /// Convert an `u8` to return an optional value of this type. If the
- /// type cannot be represented by this value, the `None` is returned.
- #[inline]
- fn from_u8(n: u8) -> Option<Self> {
- FromPrimitive::from_u64(n as u64)
- }
-
- /// Convert an `u16` to return an optional value of this type. If the
- /// type cannot be represented by this value, the `None` is returned.
- #[inline]
- fn from_u16(n: u16) -> Option<Self> {
- FromPrimitive::from_u64(n as u64)
- }
-
- /// Convert an `u32` to return an optional value of this type. If the
- /// type cannot be represented by this value, the `None` is returned.
- #[inline]
- fn from_u32(n: u32) -> Option<Self> {
- FromPrimitive::from_u64(n as u64)
- }
-
- /// Convert an `u64` to return an optional value of this type. If the
- /// type cannot be represented by this value, the `None` is returned.
- fn from_u64(n: u64) -> Option<Self>;
-
- /// Convert a `f32` to return an optional value of this type. If the
- /// type cannot be represented by this value, the `None` is returned.
- #[inline]
- fn from_f32(n: f32) -> Option<Self> {
- FromPrimitive::from_f64(n as f64)
- }
-
- /// Convert a `f64` to return an optional value of this type. If the
- /// type cannot be represented by this value, the `None` is returned.
- #[inline]
- fn from_f64(n: f64) -> Option<Self> {
- FromPrimitive::from_i64(n as i64)
- }
-}
-
-/// A utility function that just calls `FromPrimitive::from_int`.
-pub fn from_int<A: FromPrimitive>(n: int) -> Option<A> {
- FromPrimitive::from_int(n)
-}
-
-/// A utility function that just calls `FromPrimitive::from_i8`.
-pub fn from_i8<A: FromPrimitive>(n: i8) -> Option<A> {
- FromPrimitive::from_i8(n)
-}
-
-/// A utility function that just calls `FromPrimitive::from_i16`.
-pub fn from_i16<A: FromPrimitive>(n: i16) -> Option<A> {
- FromPrimitive::from_i16(n)
-}
-
-/// A utility function that just calls `FromPrimitive::from_i32`.
-pub fn from_i32<A: FromPrimitive>(n: i32) -> Option<A> {
- FromPrimitive::from_i32(n)
-}
-
-/// A utility function that just calls `FromPrimitive::from_i64`.
-pub fn from_i64<A: FromPrimitive>(n: i64) -> Option<A> {
- FromPrimitive::from_i64(n)
-}
-
-/// A utility function that just calls `FromPrimitive::from_uint`.
-pub fn from_uint<A: FromPrimitive>(n: uint) -> Option<A> {
- FromPrimitive::from_uint(n)
-}
-
-/// A utility function that just calls `FromPrimitive::from_u8`.
-pub fn from_u8<A: FromPrimitive>(n: u8) -> Option<A> {
- FromPrimitive::from_u8(n)
-}
-
-/// A utility function that just calls `FromPrimitive::from_u16`.
-pub fn from_u16<A: FromPrimitive>(n: u16) -> Option<A> {
- FromPrimitive::from_u16(n)
-}
-
-/// A utility function that just calls `FromPrimitive::from_u32`.
-pub fn from_u32<A: FromPrimitive>(n: u32) -> Option<A> {
- FromPrimitive::from_u32(n)
-}
-
-/// A utility function that just calls `FromPrimitive::from_u64`.
-pub fn from_u64<A: FromPrimitive>(n: u64) -> Option<A> {
- FromPrimitive::from_u64(n)
-}
-
-/// A utility function that just calls `FromPrimitive::from_f32`.
-pub fn from_f32<A: FromPrimitive>(n: f32) -> Option<A> {
- FromPrimitive::from_f32(n)
-}
-
-/// A utility function that just calls `FromPrimitive::from_f64`.
-pub fn from_f64<A: FromPrimitive>(n: f64) -> Option<A> {
- FromPrimitive::from_f64(n)
-}
-
-macro_rules! impl_from_primitive(
- ($T:ty, $to_ty:expr) => (
- impl FromPrimitive for $T {
- #[inline] fn from_int(n: int) -> Option<$T> { $to_ty }
- #[inline] fn from_i8(n: i8) -> Option<$T> { $to_ty }
- #[inline] fn from_i16(n: i16) -> Option<$T> { $to_ty }
- #[inline] fn from_i32(n: i32) -> Option<$T> { $to_ty }
- #[inline] fn from_i64(n: i64) -> Option<$T> { $to_ty }
-
- #[inline] fn from_uint(n: uint) -> Option<$T> { $to_ty }
- #[inline] fn from_u8(n: u8) -> Option<$T> { $to_ty }
- #[inline] fn from_u16(n: u16) -> Option<$T> { $to_ty }
- #[inline] fn from_u32(n: u32) -> Option<$T> { $to_ty }
- #[inline] fn from_u64(n: u64) -> Option<$T> { $to_ty }
-
- #[inline] fn from_f32(n: f32) -> Option<$T> { $to_ty }
- #[inline] fn from_f64(n: f64) -> Option<$T> { $to_ty }
- }
- )
-)
-
-impl_from_primitive!(int, n.to_int())
-impl_from_primitive!(i8, n.to_i8())
-impl_from_primitive!(i16, n.to_i16())
-impl_from_primitive!(i32, n.to_i32())
-impl_from_primitive!(i64, n.to_i64())
-impl_from_primitive!(uint, n.to_uint())
-impl_from_primitive!(u8, n.to_u8())
-impl_from_primitive!(u16, n.to_u16())
-impl_from_primitive!(u32, n.to_u32())
-impl_from_primitive!(u64, n.to_u64())
-impl_from_primitive!(f32, n.to_f32())
-impl_from_primitive!(f64, n.to_f64())
-
-/// Cast from one machine scalar to another.
-///
-/// # Example
-///
-/// ```
-/// use std::num;
-///
-/// let twenty: f32 = num::cast(0x14).unwrap();
-/// assert_eq!(twenty, 20f32);
-/// ```
-///
-#[inline]
-pub fn cast<T: NumCast,U: NumCast>(n: T) -> Option<U> {
- NumCast::from(n)
-}
-
-/// An interface for casting between machine scalars.
-pub trait NumCast: ToPrimitive {
- /// Creates a number from another value that can be converted into a primitive via the
- /// `ToPrimitive` trait.
- fn from<T: ToPrimitive>(n: T) -> Option<Self>;
-}
-
-macro_rules! impl_num_cast(
- ($T:ty, $conv:ident) => (
- impl NumCast for $T {
- #[inline]
- fn from<N: ToPrimitive>(n: N) -> Option<$T> {
- // `$conv` could be generated using `concat_idents!`, but that
- // macro seems to be broken at the moment
- n.$conv()
- }
- }
- )
-)
-
-impl_num_cast!(u8, to_u8)
-impl_num_cast!(u16, to_u16)
-impl_num_cast!(u32, to_u32)
-impl_num_cast!(u64, to_u64)
-impl_num_cast!(uint, to_uint)
-impl_num_cast!(i8, to_i8)
-impl_num_cast!(i16, to_i16)
-impl_num_cast!(i32, to_i32)
-impl_num_cast!(i64, to_i64)
-impl_num_cast!(int, to_int)
-impl_num_cast!(f32, to_f32)
-impl_num_cast!(f64, to_f64)
-
/// A generic trait for converting a value to a string with a radix (base)
pub trait ToStrRadix {
fn to_str_radix(&self, radix: uint) -> ~str;
FromStrRadix::from_str_radix(str, radix)
}
-/// Saturating math operations
-pub trait Saturating {
- /// Saturating addition operator.
- /// Returns a+b, saturating at the numeric bounds instead of overflowing.
- fn saturating_add(self, v: Self) -> Self;
-
- /// Saturating subtraction operator.
- /// Returns a-b, saturating at the numeric bounds instead of overflowing.
- fn saturating_sub(self, v: Self) -> Self;
-}
-
-impl<T: CheckedAdd + CheckedSub + Zero + Ord + Bounded> Saturating for T {
- #[inline]
- fn saturating_add(self, v: T) -> T {
- match self.checked_add(&v) {
- Some(x) => x,
- None => if v >= Zero::zero() {
- Bounded::max_value()
- } else {
- Bounded::min_value()
- }
- }
- }
-
- #[inline]
- fn saturating_sub(self, v: T) -> T {
- match self.checked_sub(&v) {
- Some(x) => x,
- None => if v >= Zero::zero() {
- Bounded::min_value()
- } else {
- Bounded::max_value()
- }
- }
- }
-}
-
-/// Performs addition that returns `None` instead of wrapping around on overflow.
-pub trait CheckedAdd: Add<Self, Self> {
- /// Adds two numbers, checking for overflow. If overflow happens, `None` is returned.
- fn checked_add(&self, v: &Self) -> Option<Self>;
-}
-
-/// Performs subtraction that returns `None` instead of wrapping around on underflow.
-pub trait CheckedSub: Sub<Self, Self> {
- /// Subtracts two numbers, checking for underflow. If underflow happens, `None` is returned.
- fn checked_sub(&self, v: &Self) -> Option<Self>;
-}
-
-/// Performs multiplication that returns `None` instead of wrapping around on underflow or
-/// overflow.
-pub trait CheckedMul: Mul<Self, Self> {
- /// Multiplies two numbers, checking for underflow or overflow. If underflow or overflow
- /// happens, `None` is returned.
- fn checked_mul(&self, v: &Self) -> Option<Self>;
-}
-
-/// Performs division that returns `None` instead of wrapping around on underflow or overflow.
-pub trait CheckedDiv: Div<Self, Self> {
- /// Divides two numbers, checking for underflow or overflow. If underflow or overflow happens,
- /// `None` is returned.
- fn checked_div(&self, v: &Self) -> Option<Self>;
-}
-
/// Helper function for testing numeric operations
#[cfg(test)]
pub fn test_num<T:Num + NumCast + Show>(ten: T, two: T) {
use super::test::Bencher;
use rand::{XorShiftRng, Rng};
use num::ToStrRadix;
+ use realstd::result::ResultUnwrap;
#[bench]
fn to_str_bin(b: &mut Bencher) {
use super::test::Bencher;
use rand::{XorShiftRng, Rng};
use num::ToStrRadix;
+ use realstd::result::ResultUnwrap;
#[bench]
fn to_str_bin(b: &mut Bencher) {
use super::test::Bencher;
use rand::{XorShiftRng, Rng};
use f64;
+ use realstd::result::ResultUnwrap;
#[bench]
fn float_to_str(b: &mut Bencher) {
//! Operations and constants for unsigned 16-bits integers (`u16` type)
-#![allow(non_uppercase_statics)]
-#![allow(unsigned_negate)]
-
-use prelude::*;
-
-use default::Default;
use from_str::FromStr;
-use num::{Bitwise, Bounded};
-use num::{CheckedAdd, CheckedSub, CheckedMul};
-use num::{CheckedDiv, Zero, One, strconv};
+use iter::Iterator;
use num::{ToStrRadix, FromStrRadix};
-use option::{Option, Some, None};
+use num::strconv;
+use option::Option;
+use slice::{ImmutableVector, OwnedVector};
use str;
-use intrinsics;
-
-uint_module!(u16, i16, 16)
-
-impl CheckedAdd for u16 {
- #[inline]
- fn checked_add(&self, v: &u16) -> Option<u16> {
- unsafe {
- let (x, y) = intrinsics::u16_add_with_overflow(*self, *v);
- if y { None } else { Some(x) }
- }
- }
-}
-impl CheckedSub for u16 {
- #[inline]
- fn checked_sub(&self, v: &u16) -> Option<u16> {
- unsafe {
- let (x, y) = intrinsics::u16_sub_with_overflow(*self, *v);
- if y { None } else { Some(x) }
- }
- }
-}
+pub use core::u16::{BITS, BYTES, MIN, MAX};
-impl CheckedMul for u16 {
- #[inline]
- fn checked_mul(&self, v: &u16) -> Option<u16> {
- unsafe {
- let (x, y) = intrinsics::u16_mul_with_overflow(*self, *v);
- if y { None } else { Some(x) }
- }
- }
-}
+uint_module!(u16)
//! Operations and constants for unsigned 32-bits integers (`u32` type)
-#![allow(non_uppercase_statics)]
-#![allow(unsigned_negate)]
-
-use prelude::*;
-
-use default::Default;
use from_str::FromStr;
-use num::{Bitwise, Bounded};
-use num::{CheckedAdd, CheckedSub, CheckedMul};
-use num::{CheckedDiv, Zero, One, strconv};
+use iter::Iterator;
use num::{ToStrRadix, FromStrRadix};
-use option::{Option, Some, None};
+use num::strconv;
+use option::Option;
+use slice::{ImmutableVector, OwnedVector};
use str;
-use intrinsics;
-
-uint_module!(u32, i32, 32)
-
-impl CheckedAdd for u32 {
- #[inline]
- fn checked_add(&self, v: &u32) -> Option<u32> {
- unsafe {
- let (x, y) = intrinsics::u32_add_with_overflow(*self, *v);
- if y { None } else { Some(x) }
- }
- }
-}
-impl CheckedSub for u32 {
- #[inline]
- fn checked_sub(&self, v: &u32) -> Option<u32> {
- unsafe {
- let (x, y) = intrinsics::u32_sub_with_overflow(*self, *v);
- if y { None } else { Some(x) }
- }
- }
-}
+pub use core::u32::{BITS, BYTES, MIN, MAX};
-impl CheckedMul for u32 {
- #[inline]
- fn checked_mul(&self, v: &u32) -> Option<u32> {
- unsafe {
- let (x, y) = intrinsics::u32_mul_with_overflow(*self, *v);
- if y { None } else { Some(x) }
- }
- }
-}
+uint_module!(u32)
//! Operations and constants for unsigned 64-bits integer (`u64` type)
-#![allow(non_uppercase_statics)]
-#![allow(unsigned_negate)]
-
-use prelude::*;
-
-use default::Default;
use from_str::FromStr;
-use num::{Bitwise, Bounded};
-#[cfg(target_word_size = "64")]
-use num::CheckedMul;
-use num::{CheckedAdd, CheckedSub};
-use num::{CheckedDiv, Zero, One, strconv};
+use iter::Iterator;
use num::{ToStrRadix, FromStrRadix};
-use option::{Option, Some, None};
+use num::strconv;
+use option::Option;
+use slice::{ImmutableVector, OwnedVector};
use str;
-use intrinsics;
-
-uint_module!(u64, i64, 64)
-
-impl CheckedAdd for u64 {
- #[inline]
- fn checked_add(&self, v: &u64) -> Option<u64> {
- unsafe {
- let (x, y) = intrinsics::u64_add_with_overflow(*self, *v);
- if y { None } else { Some(x) }
- }
- }
-}
-impl CheckedSub for u64 {
- #[inline]
- fn checked_sub(&self, v: &u64) -> Option<u64> {
- unsafe {
- let (x, y) = intrinsics::u64_sub_with_overflow(*self, *v);
- if y { None } else { Some(x) }
- }
- }
-}
+pub use core::u64::{BITS, BYTES, MIN, MAX};
-impl CheckedMul for u64 {
- #[inline]
- fn checked_mul(&self, v: &u64) -> Option<u64> {
- unsafe {
- let (x, y) = intrinsics::u64_mul_with_overflow(*self, *v);
- if y { None } else { Some(x) }
- }
- }
-}
+uint_module!(u64)
//! Operations and constants for unsigned 8-bits integers (`u8` type)
-#![allow(non_uppercase_statics)]
-#![allow(unsigned_negate)]
-
-use prelude::*;
-
-use default::Default;
use from_str::FromStr;
-use num::{Bitwise, Bounded};
-use num::{CheckedAdd, CheckedSub, CheckedMul};
-use num::{CheckedDiv, Zero, One, strconv};
+use iter::Iterator;
use num::{ToStrRadix, FromStrRadix};
-use option::{Option, Some, None};
+use num::strconv;
+use option::Option;
+use slice::{ImmutableVector, OwnedVector};
use str;
-use intrinsics;
-
-uint_module!(u8, i8, 8)
-
-impl CheckedAdd for u8 {
- #[inline]
- fn checked_add(&self, v: &u8) -> Option<u8> {
- unsafe {
- let (x, y) = intrinsics::u8_add_with_overflow(*self, *v);
- if y { None } else { Some(x) }
- }
- }
-}
-impl CheckedSub for u8 {
- #[inline]
- fn checked_sub(&self, v: &u8) -> Option<u8> {
- unsafe {
- let (x, y) = intrinsics::u8_sub_with_overflow(*self, *v);
- if y { None } else { Some(x) }
- }
- }
-}
+pub use core::u8::{BITS, BYTES, MIN, MAX};
-impl CheckedMul for u8 {
- #[inline]
- fn checked_mul(&self, v: &u8) -> Option<u8> {
- unsafe {
- let (x, y) = intrinsics::u8_mul_with_overflow(*self, *v);
- if y { None } else { Some(x) }
- }
- }
-}
+uint_module!(u8)
//! Operations and constants for architecture-sized unsigned integers (`uint` type)
-#![allow(non_uppercase_statics)]
-#![allow(unsigned_negate)]
-
-use prelude::*;
-
-use default::Default;
use from_str::FromStr;
-use num::{Bitwise, Bounded};
-use num::{CheckedAdd, CheckedSub, CheckedMul};
-use num::{CheckedDiv, Zero, One, strconv};
+use iter::Iterator;
use num::{ToStrRadix, FromStrRadix};
-use option::{Option, Some, None};
+use num::strconv;
+use option::Option;
+use slice::{ImmutableVector, OwnedVector};
use str;
-use intrinsics;
-
-uint_module!(uint, int, ::int::BITS)
-
-#[cfg(target_word_size = "32")]
-impl CheckedAdd for uint {
- #[inline]
- fn checked_add(&self, v: &uint) -> Option<uint> {
- unsafe {
- let (x, y) = intrinsics::u32_add_with_overflow(*self as u32, *v as u32);
- if y { None } else { Some(x as uint) }
- }
- }
-}
-
-#[cfg(target_word_size = "64")]
-impl CheckedAdd for uint {
- #[inline]
- fn checked_add(&self, v: &uint) -> Option<uint> {
- unsafe {
- let (x, y) = intrinsics::u64_add_with_overflow(*self as u64, *v as u64);
- if y { None } else { Some(x as uint) }
- }
- }
-}
-
-#[cfg(target_word_size = "32")]
-impl CheckedSub for uint {
- #[inline]
- fn checked_sub(&self, v: &uint) -> Option<uint> {
- unsafe {
- let (x, y) = intrinsics::u32_sub_with_overflow(*self as u32, *v as u32);
- if y { None } else { Some(x as uint) }
- }
- }
-}
-
-#[cfg(target_word_size = "64")]
-impl CheckedSub for uint {
- #[inline]
- fn checked_sub(&self, v: &uint) -> Option<uint> {
- unsafe {
- let (x, y) = intrinsics::u64_sub_with_overflow(*self as u64, *v as u64);
- if y { None } else { Some(x as uint) }
- }
- }
-}
-#[cfg(target_word_size = "32")]
-impl CheckedMul for uint {
- #[inline]
- fn checked_mul(&self, v: &uint) -> Option<uint> {
- unsafe {
- let (x, y) = intrinsics::u32_mul_with_overflow(*self as u32, *v as u32);
- if y { None } else { Some(x as uint) }
- }
- }
-}
+pub use core::uint::{BITS, BYTES, MIN, MAX};
-#[cfg(target_word_size = "64")]
-impl CheckedMul for uint {
- #[inline]
- fn checked_mul(&self, v: &uint) -> Option<uint> {
- unsafe {
- let (x, y) = intrinsics::u64_mul_with_overflow(*self as u64, *v as u64);
- if y { None } else { Some(x as uint) }
- }
- }
-}
+uint_module!(uint)
#![doc(hidden)]
#![allow(unsigned_negate)]
-macro_rules! uint_module (($T:ty, $T_SIGNED:ty, $bits:expr) => (
-
-pub static BITS : uint = $bits;
-pub static BYTES : uint = ($bits / 8);
-
-pub static MIN: $T = 0 as $T;
-pub static MAX: $T = 0 as $T - 1 as $T;
-
-impl CheckedDiv for $T {
- #[inline]
- fn checked_div(&self, v: &$T) -> Option<$T> {
- if *v == 0 {
- None
- } else {
- Some(self / *v)
- }
- }
-}
-
-impl Num for $T {}
-
-#[cfg(not(test))]
-impl Ord for $T {
- #[inline]
- fn lt(&self, other: &$T) -> bool { (*self) < (*other) }
-}
-
-#[cfg(not(test))]
-impl Eq for $T {
- #[inline]
- fn eq(&self, other: &$T) -> bool { return (*self) == (*other); }
-}
-
-impl Default for $T {
- #[inline]
- fn default() -> $T { 0 }
-}
-
-impl Zero for $T {
- #[inline]
- fn zero() -> $T { 0 }
-
- #[inline]
- fn is_zero(&self) -> bool { *self == 0 }
-}
-
-impl One for $T {
- #[inline]
- fn one() -> $T { 1 }
-}
-
-#[cfg(not(test))]
-impl Add<$T,$T> for $T {
- #[inline]
- fn add(&self, other: &$T) -> $T { *self + *other }
-}
-
-#[cfg(not(test))]
-impl Sub<$T,$T> for $T {
- #[inline]
- fn sub(&self, other: &$T) -> $T { *self - *other }
-}
-
-#[cfg(not(test))]
-impl Mul<$T,$T> for $T {
- #[inline]
- fn mul(&self, other: &$T) -> $T { *self * *other }
-}
-
-#[cfg(not(test))]
-impl Div<$T,$T> for $T {
- #[inline]
- fn div(&self, other: &$T) -> $T { *self / *other }
-}
-
-#[cfg(not(test))]
-impl Rem<$T,$T> for $T {
- #[inline]
- fn rem(&self, other: &$T) -> $T { *self % *other }
-}
-
-#[cfg(not(test))]
-impl Neg<$T> for $T {
- #[inline]
- fn neg(&self) -> $T { -*self }
-}
-
-impl Unsigned for $T {}
-
-#[cfg(not(test))]
-impl BitOr<$T,$T> for $T {
- #[inline]
- fn bitor(&self, other: &$T) -> $T { *self | *other }
-}
-
-#[cfg(not(test))]
-impl BitAnd<$T,$T> for $T {
- #[inline]
- fn bitand(&self, other: &$T) -> $T { *self & *other }
-}
-
-#[cfg(not(test))]
-impl BitXor<$T,$T> for $T {
- #[inline]
- fn bitxor(&self, other: &$T) -> $T { *self ^ *other }
-}
-
-#[cfg(not(test))]
-impl Shl<$T,$T> for $T {
- #[inline]
- fn shl(&self, other: &$T) -> $T { *self << *other }
-}
-
-#[cfg(not(test))]
-impl Shr<$T,$T> for $T {
- #[inline]
- fn shr(&self, other: &$T) -> $T { *self >> *other }
-}
-
-#[cfg(not(test))]
-impl Not<$T> for $T {
- #[inline]
- fn not(&self) -> $T { !*self }
-}
-
-impl Bounded for $T {
- #[inline]
- fn min_value() -> $T { MIN }
-
- #[inline]
- fn max_value() -> $T { MAX }
-}
-
-impl Int for $T {}
+macro_rules! uint_module (($T:ty) => (
// String conversion functions and impl str -> num
/// Convert to a string in a given base.
#[inline]
fn to_str_radix(&self, radix: uint) -> ~str {
- let mut buf = Vec::new();
+ let mut buf = ::vec::Vec::new();
strconv::int_to_str_bytes_common(*self, radix, strconv::SignNone, |i| {
buf.push(i);
});
}
}
-impl Primitive for $T {}
-
-impl Bitwise for $T {
- /// Returns the number of ones in the binary representation of the number.
- #[inline]
- fn count_ones(&self) -> $T {
- (*self as $T_SIGNED).count_ones() as $T
- }
-
- /// Returns the number of leading zeros in the in the binary representation
- /// of the number.
- #[inline]
- fn leading_zeros(&self) -> $T {
- (*self as $T_SIGNED).leading_zeros() as $T
- }
-
- /// Returns the number of trailing zeros in the in the binary representation
- /// of the number.
- #[inline]
- fn trailing_zeros(&self) -> $T {
- (*self as $T_SIGNED).trailing_zeros() as $T
- }
-}
-
#[cfg(test)]
mod tests {
use prelude::*;
use super::*;
- use num;
- use num::CheckedDiv;
- use num::Bitwise;
use num::ToStrRadix;
use str::StrSlice;
use u16;
- #[test]
- fn test_overflows() {
- assert!(MAX > 0);
- assert!(MIN <= 0);
- assert_eq!(MIN + MAX + 1, 0);
- }
-
- #[test]
- fn test_num() {
- num::test_num(10 as $T, 2 as $T);
- }
-
- #[test]
- fn test_bitwise() {
- assert_eq!(0b1110 as $T, (0b1100 as $T).bitor(&(0b1010 as $T)));
- assert_eq!(0b1000 as $T, (0b1100 as $T).bitand(&(0b1010 as $T)));
- assert_eq!(0b0110 as $T, (0b1100 as $T).bitxor(&(0b1010 as $T)));
- assert_eq!(0b1110 as $T, (0b0111 as $T).shl(&(1 as $T)));
- assert_eq!(0b0111 as $T, (0b1110 as $T).shr(&(1 as $T)));
- assert_eq!(MAX - (0b1011 as $T), (0b1011 as $T).not());
- }
-
- #[test]
- fn test_count_ones() {
- assert_eq!((0b0101100 as $T).count_ones(), 3);
- assert_eq!((0b0100001 as $T).count_ones(), 2);
- assert_eq!((0b1111001 as $T).count_ones(), 5);
- }
-
- #[test]
- fn test_count_zeros() {
- assert_eq!((0b0101100 as $T).count_zeros(), BITS as $T - 3);
- assert_eq!((0b0100001 as $T).count_zeros(), BITS as $T - 2);
- assert_eq!((0b1111001 as $T).count_zeros(), BITS as $T - 5);
- }
-
#[test]
pub fn test_to_str() {
assert_eq!((0 as $T).to_str_radix(10u), "0".to_owned());
pub fn to_str_radix37() {
100u.to_str_radix(37u);
}
-
- #[test]
- fn test_unsigned_checked_div() {
- assert_eq!(10u.checked_div(&2), Some(5));
- assert_eq!(5u.checked_div(&0), None);
- }
}
))
+++ /dev/null
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-/*!
- *
- * Traits representing built-in operators, useful for overloading
- *
- * Implementing these traits allows you to get an effect similar to
- * overloading operators.
- *
- * The values for the right hand side of an operator are automatically
- * borrowed, so `a + b` is sugar for `a.add(&b)`.
- *
- * All of these traits are imported by the prelude, so they are available in
- * every Rust program.
- *
- * # Example
- *
- * This example creates a `Point` struct that implements `Add` and `Sub`, and then
- * demonstrates adding and subtracting two `Point`s.
- *
- * ```rust
- * struct Point {
- * x: int,
- * y: int
- * }
- *
- * impl Add<Point, Point> for Point {
- * fn add(&self, other: &Point) -> Point {
- * Point {x: self.x + other.x, y: self.y + other.y}
- * }
- * }
- *
- * impl Sub<Point, Point> for Point {
- * fn sub(&self, other: &Point) -> Point {
- * Point {x: self.x - other.x, y: self.y - other.y}
- * }
- * }
- * fn main() {
- * println!("{:?}", Point {x: 1, y: 0} + Point {x: 2, y: 3});
- * println!("{:?}", Point {x: 1, y: 0} - Point {x: 2, y: 3});
- * }
- * ```
- *
- * See the documentation for each trait for a minimum implementation that prints
- * something to the screen.
- *
- */
-
-/**
- *
- * The `Drop` trait is used to run some code when a value goes out of scope. This
- * is sometimes called a 'destructor'.
- *
- * # Example
- *
- * A trivial implementation of `Drop`. The `drop` method is called when `_x` goes
- * out of scope, and therefore `main` prints `Dropping!`.
- *
- * ```rust
- * struct HasDrop;
- *
- * impl Drop for HasDrop {
- * fn drop(&mut self) {
- * println!("Dropping!");
- * }
- * }
- *
- * fn main() {
- * let _x = HasDrop;
- * }
- * ```
- */
-#[lang="drop"]
-pub trait Drop {
- /// The `drop` method, called when the value goes out of scope.
- fn drop(&mut self);
-}
-
-/**
- *
- * The `Add` trait is used to specify the functionality of `+`.
- *
- * # Example
- *
- * A trivial implementation of `Add`. When `Foo + Foo` happens, it ends up
- * calling `add`, and therefore, `main` prints `Adding!`.
- *
- * ```rust
- * struct Foo;
- *
- * impl Add<Foo, Foo> for Foo {
- * fn add(&self, _rhs: &Foo) -> Foo {
- * println!("Adding!");
- * *self
- * }
- * }
- *
- * fn main() {
- * Foo + Foo;
- * }
- * ```
- */
-#[lang="add"]
-pub trait Add<RHS,Result> {
- /// The method for the `+` operator
- fn add(&self, rhs: &RHS) -> Result;
-}
-
-/**
- *
- * The `Sub` trait is used to specify the functionality of `-`.
- *
- * # Example
- *
- * A trivial implementation of `Sub`. When `Foo - Foo` happens, it ends up
- * calling `sub`, and therefore, `main` prints `Subtracting!`.
- *
- * ```rust
- * struct Foo;
- *
- * impl Sub<Foo, Foo> for Foo {
- * fn sub(&self, _rhs: &Foo) -> Foo {
- * println!("Subtracting!");
- * *self
- * }
- * }
- *
- * fn main() {
- * Foo - Foo;
- * }
- * ```
- */
-#[lang="sub"]
-pub trait Sub<RHS,Result> {
- /// The method for the `-` operator
- fn sub(&self, rhs: &RHS) -> Result;
-}
-
-/**
- *
- * The `Mul` trait is used to specify the functionality of `*`.
- *
- * # Example
- *
- * A trivial implementation of `Mul`. When `Foo * Foo` happens, it ends up
- * calling `mul`, and therefore, `main` prints `Multiplying!`.
- *
- * ```rust
- * struct Foo;
- *
- * impl Mul<Foo, Foo> for Foo {
- * fn mul(&self, _rhs: &Foo) -> Foo {
- * println!("Multiplying!");
- * *self
- * }
- * }
- *
- * fn main() {
- * Foo * Foo;
- * }
- * ```
- */
-#[lang="mul"]
-pub trait Mul<RHS,Result> {
- /// The method for the `*` operator
- fn mul(&self, rhs: &RHS) -> Result;
-}
-
-/**
- *
- * The `Div` trait is used to specify the functionality of `/`.
- *
- * # Example
- *
- * A trivial implementation of `Div`. When `Foo / Foo` happens, it ends up
- * calling `div`, and therefore, `main` prints `Dividing!`.
- *
- * ```
- * struct Foo;
- *
- * impl Div<Foo, Foo> for Foo {
- * fn div(&self, _rhs: &Foo) -> Foo {
- * println!("Dividing!");
- * *self
- * }
- * }
- *
- * fn main() {
- * Foo / Foo;
- * }
- * ```
- */
-#[lang="div"]
-pub trait Div<RHS,Result> {
- /// The method for the `/` operator
- fn div(&self, rhs: &RHS) -> Result;
-}
-
-/**
- *
- * The `Rem` trait is used to specify the functionality of `%`.
- *
- * # Example
- *
- * A trivial implementation of `Rem`. When `Foo % Foo` happens, it ends up
- * calling `rem`, and therefore, `main` prints `Remainder-ing!`.
- *
- * ```
- * struct Foo;
- *
- * impl Rem<Foo, Foo> for Foo {
- * fn rem(&self, _rhs: &Foo) -> Foo {
- * println!("Remainder-ing!");
- * *self
- * }
- * }
- *
- * fn main() {
- * Foo % Foo;
- * }
- * ```
- */
-#[lang="rem"]
-pub trait Rem<RHS,Result> {
- /// The method for the `%` operator
- fn rem(&self, rhs: &RHS) -> Result;
-}
-
-/**
- *
- * The `Neg` trait is used to specify the functionality of unary `-`.
- *
- * # Example
- *
- * A trivial implementation of `Neg`. When `-Foo` happens, it ends up calling
- * `neg`, and therefore, `main` prints `Negating!`.
- *
- * ```
- * struct Foo;
- *
- * impl Neg<Foo> for Foo {
- * fn neg(&self) -> Foo {
- * println!("Negating!");
- * *self
- * }
- * }
- *
- * fn main() {
- * -Foo;
- * }
- * ```
- */
-#[lang="neg"]
-pub trait Neg<Result> {
- /// The method for the unary `-` operator
- fn neg(&self) -> Result;
-}
-
-/**
- *
- * The `Not` trait is used to specify the functionality of unary `!`.
- *
- * # Example
- *
- * A trivial implementation of `Not`. When `!Foo` happens, it ends up calling
- * `not`, and therefore, `main` prints `Not-ing!`.
- *
- * ```
- * struct Foo;
- *
- * impl Not<Foo> for Foo {
- * fn not(&self) -> Foo {
- * println!("Not-ing!");
- * *self
- * }
- * }
- *
- * fn main() {
- * !Foo;
- * }
- * ```
- */
-#[lang="not"]
-pub trait Not<Result> {
- /// The method for the unary `!` operator
- fn not(&self) -> Result;
-}
-
-/**
- *
- * The `BitAnd` trait is used to specify the functionality of `&`.
- *
- * # Example
- *
- * A trivial implementation of `BitAnd`. When `Foo & Foo` happens, it ends up
- * calling `bitand`, and therefore, `main` prints `Bitwise And-ing!`.
- *
- * ```
- * struct Foo;
- *
- * impl BitAnd<Foo, Foo> for Foo {
- * fn bitand(&self, _rhs: &Foo) -> Foo {
- * println!("Bitwise And-ing!");
- * *self
- * }
- * }
- *
- * fn main() {
- * Foo & Foo;
- * }
- * ```
- */
-#[lang="bitand"]
-pub trait BitAnd<RHS,Result> {
- /// The method for the `&` operator
- fn bitand(&self, rhs: &RHS) -> Result;
-}
-
-/**
- *
- * The `BitOr` trait is used to specify the functionality of `|`.
- *
- * # Example
- *
- * A trivial implementation of `BitOr`. When `Foo | Foo` happens, it ends up
- * calling `bitor`, and therefore, `main` prints `Bitwise Or-ing!`.
- *
- * ```
- * struct Foo;
- *
- * impl BitOr<Foo, Foo> for Foo {
- * fn bitor(&self, _rhs: &Foo) -> Foo {
- * println!("Bitwise Or-ing!");
- * *self
- * }
- * }
- *
- * fn main() {
- * Foo | Foo;
- * }
- * ```
- */
-#[lang="bitor"]
-pub trait BitOr<RHS,Result> {
- /// The method for the `|` operator
- fn bitor(&self, rhs: &RHS) -> Result;
-}
-
-/**
- *
- * The `BitXor` trait is used to specify the functionality of `^`.
- *
- * # Example
- *
- * A trivial implementation of `BitXor`. When `Foo ^ Foo` happens, it ends up
- * calling `bitxor`, and therefore, `main` prints `Bitwise Xor-ing!`.
- *
- * ```
- * struct Foo;
- *
- * impl BitXor<Foo, Foo> for Foo {
- * fn bitxor(&self, _rhs: &Foo) -> Foo {
- * println!("Bitwise Xor-ing!");
- * *self
- * }
- * }
- *
- * fn main() {
- * Foo ^ Foo;
- * }
- * ```
- */
-#[lang="bitxor"]
-pub trait BitXor<RHS,Result> {
- /// The method for the `^` operator
- fn bitxor(&self, rhs: &RHS) -> Result;
-}
-
-/**
- *
- * The `Shl` trait is used to specify the functionality of `<<`.
- *
- * # Example
- *
- * A trivial implementation of `Shl`. When `Foo << Foo` happens, it ends up
- * calling `shl`, and therefore, `main` prints `Shifting left!`.
- *
- * ```
- * struct Foo;
- *
- * impl Shl<Foo, Foo> for Foo {
- * fn shl(&self, _rhs: &Foo) -> Foo {
- * println!("Shifting left!");
- * *self
- * }
- * }
- *
- * fn main() {
- * Foo << Foo;
- * }
- * ```
- */
-#[lang="shl"]
-pub trait Shl<RHS,Result> {
- /// The method for the `<<` operator
- fn shl(&self, rhs: &RHS) -> Result;
-}
-
-/**
- *
- * The `Shr` trait is used to specify the functionality of `>>`.
- *
- * # Example
- *
- * A trivial implementation of `Shr`. When `Foo >> Foo` happens, it ends up
- * calling `shr`, and therefore, `main` prints `Shifting right!`.
- *
- * ```
- * struct Foo;
- *
- * impl Shr<Foo, Foo> for Foo {
- * fn shr(&self, _rhs: &Foo) -> Foo {
- * println!("Shifting right!");
- * *self
- * }
- * }
- *
- * fn main() {
- * Foo >> Foo;
- * }
- * ```
- */
-#[lang="shr"]
-pub trait Shr<RHS,Result> {
- /// The method for the `>>` operator
- fn shr(&self, rhs: &RHS) -> Result;
-}
-
-/**
- *
- * The `Index` trait is used to specify the functionality of indexing operations
- * like `arr[idx]`.
- *
- * # Example
- *
- * A trivial implementation of `Index`. When `Foo[Foo]` happens, it ends up
- * calling `index`, and therefore, `main` prints `Indexing!`.
- *
- * ```
- * struct Foo;
- *
- * impl Index<Foo, Foo> for Foo {
- * fn index(&self, _rhs: &Foo) -> Foo {
- * println!("Indexing!");
- * *self
- * }
- * }
- *
- * fn main() {
- * Foo[Foo];
- * }
- * ```
- */
-#[lang="index"]
-pub trait Index<Index,Result> {
- /// The method for the indexing (`Foo[Bar]`) operation
- fn index(&self, index: &Index) -> Result;
-}
-
-/**
- *
- * The `Deref` trait is used to specify the functionality of dereferencing
- * operations like `*v`.
- *
- * # Example
- *
- * A struct with a single field which is accessible via dereferencing the
- * struct.
- *
- * ```
- * struct DerefExample<T> {
- * value: T
- * }
- *
- * impl<T> Deref<T> for DerefExample<T> {
- * fn deref<'a>(&'a self) -> &'a T {
- * &self.value
- * }
- * }
- *
- * fn main() {
- * let x = DerefExample { value: 'a' };
- * assert_eq!('a', *x);
- * }
- * ```
- */
-#[lang="deref"]
-pub trait Deref<Result> {
- /// The method called to dereference a value
- fn deref<'a>(&'a self) -> &'a Result;
-}
-
-/**
- *
- * The `DerefMut` trait is used to specify the functionality of dereferencing
- * mutably like `*v = 1;`
- *
- * # Example
- *
- * A struct with a single field which is modifiable via dereferencing the
- * struct.
- *
- * ```
- * struct DerefMutExample<T> {
- * value: T
- * }
- *
- * impl<T> Deref<T> for DerefMutExample<T> {
- * fn deref<'a>(&'a self) -> &'a T {
- * &self.value
- * }
- * }
- *
- * impl<T> DerefMut<T> for DerefMutExample<T> {
- * fn deref_mut<'a>(&'a mut self) -> &'a mut T {
- * &mut self.value
- * }
- * }
- *
- * fn main() {
- * let mut x = DerefMutExample { value: 'a' };
- * *x = 'b';
- * assert_eq!('b', *x);
- * }
- * ```
- */
-#[lang="deref_mut"]
-pub trait DerefMut<Result>: Deref<Result> {
- /// The method called to mutably dereference a value
- fn deref_mut<'a>(&'a mut self) -> &'a mut Result;
-}
-
-#[cfg(test)]
-mod bench {
- extern crate test;
- use self::test::Bencher;
- use ops::Drop;
-
- // Overhead of dtors
-
- struct HasDtor {
- x: int
- }
-
- impl Drop for HasDtor {
- fn drop(&mut self) {
- }
- }
-
- #[bench]
- fn alloc_obj_with_dtor(b: &mut Bencher) {
- b.iter(|| {
- HasDtor { x : 10 };
- })
- }
-}
-// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
//! ```
use any::Any;
-use clone::Clone;
-use cmp::{Eq, TotalEq, TotalOrd};
-use default::Default;
-use iter::{Iterator, DoubleEndedIterator, FromIterator, ExactSize};
use kinds::Send;
-use mem;
-use slice;
-/// The `Option`
-#[deriving(Clone, Eq, Ord, TotalEq, TotalOrd, Show)]
-pub enum Option<T> {
- /// No value
- None,
- /// Some value `T`
- Some(T)
-}
-
-/////////////////////////////////////////////////////////////////////////////
-// Type implementation
-/////////////////////////////////////////////////////////////////////////////
-
-impl<T> Option<T> {
- /////////////////////////////////////////////////////////////////////////
- // Querying the contained values
- /////////////////////////////////////////////////////////////////////////
-
- /// Returns `true` if the option is a `Some` value
- #[inline]
- pub fn is_some(&self) -> bool {
- match *self {
- Some(_) => true,
- None => false
- }
- }
-
- /// Returns `true` if the option is a `None` value
- #[inline]
- pub fn is_none(&self) -> bool {
- !self.is_some()
- }
+pub use core::option::{Option, Some, None, Item, collect};
- /////////////////////////////////////////////////////////////////////////
- // Adapter for working with references
- /////////////////////////////////////////////////////////////////////////
-
- /// Convert from `Option<T>` to `Option<&T>`
- ///
- /// # Example
- ///
- /// Convert an `Option<~str>` into an `Option<int>`, preserving the original.
- /// The `map` method takes the `self` argument by value, consuming the original,
- /// so this technique uses `as_ref` to first take an `Option` to a reference
- /// to the value inside the original.
- ///
- /// ```
- /// let num_as_str: Option<~str> = Some("10".to_owned());
- /// // First, cast `Option<~str>` to `Option<&~str>` with `as_ref`,
- /// // then consume *that* with `map`, leaving `num_as_str` on the stack.
- /// let num_as_int: Option<uint> = num_as_str.as_ref().map(|n| n.len());
- /// println!("still can print num_as_str: {}", num_as_str);
- /// ```
- #[inline]
- pub fn as_ref<'r>(&'r self) -> Option<&'r T> {
- match *self { Some(ref x) => Some(x), None => None }
- }
-
- /// Convert from `Option<T>` to `Option<&mut T>`
- #[inline]
- pub fn as_mut<'r>(&'r mut self) -> Option<&'r mut T> {
- match *self { Some(ref mut x) => Some(x), None => None }
- }
-
- /// Convert from `Option<T>` to `&[T]` (without copying)
- #[inline]
- pub fn as_slice<'r>(&'r self) -> &'r [T] {
- match *self {
- Some(ref x) => slice::ref_slice(x),
- None => &[]
- }
- }
-
- /// Convert from `Option<T>` to `&mut [T]` (without copying)
- #[inline]
- pub fn as_mut_slice<'r>(&'r mut self) -> &'r mut [T] {
- match *self {
- Some(ref mut x) => slice::mut_ref_slice(x),
- None => &mut []
- }
- }
-
- /////////////////////////////////////////////////////////////////////////
- // Getting to contained values
- /////////////////////////////////////////////////////////////////////////
+/// Extension trait for the `Option` type to add an `expect` method
+// FIXME(#14008) should this trait even exist?
+pub trait Expect<T> {
/// Unwraps an option, yielding the content of a `Some`
///
/// # Failure
///
- /// Fails if the value is a `None` with a custom failure message provided by `msg`.
- #[inline]
- pub fn expect<M: Any + Send>(self, msg: M) -> T {
- match self {
- Some(val) => val,
- None => fail!(msg),
- }
- }
-
- /// Moves a value out of an option type and returns it, consuming the `Option`.
- ///
- /// # Failure
- ///
- /// Fails if the self value equals `None`.
- ///
- /// # Safety note
- ///
- /// In general, because this function may fail, its use is discouraged.
- /// Instead, prefer to use pattern matching and handle the `None`
- /// case explicitly.
- #[inline]
- pub fn unwrap(self) -> T {
- match self {
- Some(val) => val,
- None => fail!("called `Option::unwrap()` on a `None` value"),
- }
- }
-
- /// Returns the contained value or a default.
- #[inline]
- pub fn unwrap_or(self, def: T) -> T {
- match self {
- Some(x) => x,
- None => def
- }
- }
-
- /// Returns the contained value or computes it from a closure.
- #[inline]
- pub fn unwrap_or_else(self, f: || -> T) -> T {
- match self {
- Some(x) => x,
- None => f()
- }
- }
-
- /////////////////////////////////////////////////////////////////////////
- // Transforming contained values
- /////////////////////////////////////////////////////////////////////////
-
- /// Maps an `Option<T>` to `Option<U>` by applying a function to a contained value
- ///
- /// # Example
- ///
- /// Convert an `Option<~str>` into an `Option<uint>`, consuming the original:
- ///
- /// ```
- /// let num_as_str: Option<~str> = Some("10".to_owned());
- /// // `Option::map` takes self *by value*, consuming `num_as_str`
- /// let num_as_int: Option<uint> = num_as_str.map(|n| n.len());
- /// ```
- #[inline]
- pub fn map<U>(self, f: |T| -> U) -> Option<U> {
- match self { Some(x) => Some(f(x)), None => None }
- }
-
- /// Applies a function to the contained value or returns a default.
- #[inline]
- pub fn map_or<U>(self, def: U, f: |T| -> U) -> U {
- match self { None => def, Some(t) => f(t) }
- }
-
- /// Applies a function to the contained value or does nothing.
- /// Returns true if the contained value was mutated.
- pub fn mutate(&mut self, f: |T| -> T) -> bool {
- if self.is_some() {
- *self = Some(f(self.take_unwrap()));
- true
- } else { false }
- }
-
- /// Applies a function to the contained value or sets it to a default.
- /// Returns true if the contained value was mutated, or false if set to the default.
- pub fn mutate_or_set(&mut self, def: T, f: |T| -> T) -> bool {
- if self.is_some() {
- *self = Some(f(self.take_unwrap()));
- true
- } else {
- *self = Some(def);
- false
- }
- }
-
- /////////////////////////////////////////////////////////////////////////
- // Iterator constructors
- /////////////////////////////////////////////////////////////////////////
-
- /// Returns an iterator over the possibly contained value.
- #[inline]
- pub fn iter<'r>(&'r self) -> Item<&'r T> {
- Item{opt: self.as_ref()}
- }
-
- /// Returns a mutable iterator over the possibly contained value.
- #[inline]
- pub fn mut_iter<'r>(&'r mut self) -> Item<&'r mut T> {
- Item{opt: self.as_mut()}
- }
-
- /// Returns a consuming iterator over the possibly contained value.
- #[inline]
- pub fn move_iter(self) -> Item<T> {
- Item{opt: self}
- }
-
- /////////////////////////////////////////////////////////////////////////
- // Boolean operations on the values, eager and lazy
- /////////////////////////////////////////////////////////////////////////
-
- /// Returns `None` if the option is `None`, otherwise returns `optb`.
- #[inline]
- pub fn and<U>(self, optb: Option<U>) -> Option<U> {
- match self {
- Some(_) => optb,
- None => None,
- }
- }
-
- /// Returns `None` if the option is `None`, otherwise calls `f` with the
- /// wrapped value and returns the result.
- #[inline]
- pub fn and_then<U>(self, f: |T| -> Option<U>) -> Option<U> {
- match self {
- Some(x) => f(x),
- None => None,
- }
- }
-
- /// Returns the option if it contains a value, otherwise returns `optb`.
- #[inline]
- pub fn or(self, optb: Option<T>) -> Option<T> {
- match self {
- Some(_) => self,
- None => optb
- }
- }
-
- /// Returns the option if it contains a value, otherwise calls `f` and
- /// returns the result.
- #[inline]
- pub fn or_else(self, f: || -> Option<T>) -> Option<T> {
- match self {
- Some(_) => self,
- None => f()
- }
- }
-
- /////////////////////////////////////////////////////////////////////////
- // Misc
- /////////////////////////////////////////////////////////////////////////
-
- /// Takes the value out of the option, leaving a `None` in its place.
- #[inline]
- pub fn take(&mut self) -> Option<T> {
- mem::replace(self, None)
- }
-
- /// Filters an optional value using a given function.
- #[inline(always)]
- pub fn filtered(self, f: |t: &T| -> bool) -> Option<T> {
- match self {
- Some(x) => if f(&x) { Some(x) } else { None },
- None => None
- }
- }
-
- /// Applies a function zero or more times until the result is `None`.
- #[inline]
- pub fn while_some(self, f: |v: T| -> Option<T>) {
- let mut opt = self;
- loop {
- match opt {
- Some(x) => opt = f(x),
- None => break
- }
- }
- }
-
- /////////////////////////////////////////////////////////////////////////
- // Common special cases
- /////////////////////////////////////////////////////////////////////////
-
- /// The option dance. Moves a value out of an option type and returns it,
- /// replacing the original with `None`.
- ///
- /// # Failure
- ///
- /// Fails if the value equals `None`.
- #[inline]
- pub fn take_unwrap(&mut self) -> T {
- match self.take() {
- Some(x) => x,
- None => fail!("called `Option::take_unwrap()` on a `None` value")
- }
- }
-
- /// Gets an immutable reference to the value inside an option.
- ///
- /// # Failure
- ///
- /// Fails if the value equals `None`
- ///
- /// # Safety note
- ///
- /// In general, because this function may fail, its use is discouraged
- /// (calling `get` on `None` is akin to dereferencing a null pointer).
- /// Instead, prefer to use pattern matching and handle the `None`
- /// case explicitly.
- #[inline]
- pub fn get_ref<'a>(&'a self) -> &'a T {
- match *self {
- Some(ref x) => x,
- None => fail!("called `Option::get_ref()` on a `None` value"),
- }
- }
-
- /// Gets a mutable reference to the value inside an option.
- ///
- /// # Failure
- ///
- /// Fails if the value equals `None`
- ///
- /// # Safety note
- ///
- /// In general, because this function may fail, its use is discouraged
- /// (calling `get` on `None` is akin to dereferencing a null pointer).
- /// Instead, prefer to use pattern matching and handle the `None`
- /// case explicitly.
- #[inline]
- pub fn get_mut_ref<'a>(&'a mut self) -> &'a mut T {
- match *self {
- Some(ref mut x) => x,
- None => fail!("called `Option::get_mut_ref()` on a `None` value"),
- }
- }
+ /// Fails if the value is a `None` with a custom failure message provided by
+ /// `msg`.
+ fn expect<M: Any + Send>(self, m: M) -> T;
}
-impl<T: Default> Option<T> {
- /// Returns the contained value or a default
- ///
- /// Consumes the `self` argument then, if `Some`, returns the contained
- /// value, otherwise if `None`, returns the default value for that
- /// type.
- ///
- /// # Example
- ///
- /// Convert a string to an integer, turning poorly-formed strings
- /// into 0 (the default value for integers). `from_str` converts
- /// a string to any other type that implements `FromStr`, returning
- /// `None` on error.
- ///
- /// ```
- /// let good_year_from_input = "1909";
- /// let bad_year_from_input = "190blarg";
- /// let good_year = from_str(good_year_from_input).unwrap_or_default();
- /// let bad_year = from_str(bad_year_from_input).unwrap_or_default();
- ///
- /// assert_eq!(1909, good_year);
- /// assert_eq!(0, bad_year);
- /// ```
+impl<T> Expect<T> for Option<T> {
#[inline]
- pub fn unwrap_or_default(self) -> T {
+ fn expect<M: Any + Send>(self, msg: M) -> T {
match self {
- Some(x) => x,
- None => Default::default()
- }
- }
-}
-
-/////////////////////////////////////////////////////////////////////////////
-// Trait implementations
-/////////////////////////////////////////////////////////////////////////////
-
-impl<T> Default for Option<T> {
- #[inline]
- fn default() -> Option<T> { None }
-}
-
-/////////////////////////////////////////////////////////////////////////////
-// The Option Iterator
-/////////////////////////////////////////////////////////////////////////////
-
-/// An `Option` iterator that yields either one or zero elements
-///
-/// The `Item` iterator is returned by the `iter`, `mut_iter` and `move_iter`
-/// methods on `Option`.
-#[deriving(Clone)]
-pub struct Item<A> {
- opt: Option<A>
-}
-
-impl<A> Iterator<A> for Item<A> {
- #[inline]
- fn next(&mut self) -> Option<A> {
- self.opt.take()
- }
-
- #[inline]
- fn size_hint(&self) -> (uint, Option<uint>) {
- match self.opt {
- Some(_) => (1, Some(1)),
- None => (0, Some(0)),
- }
- }
-}
-
-impl<A> DoubleEndedIterator<A> for Item<A> {
- #[inline]
- fn next_back(&mut self) -> Option<A> {
- self.opt.take()
- }
-}
-
-impl<A> ExactSize<A> for Item<A> {}
-
-/////////////////////////////////////////////////////////////////////////////
-// Free functions
-/////////////////////////////////////////////////////////////////////////////
-
-/// Takes each element in the `Iterator`: if it is `None`, no further
-/// elements are taken, and the `None` is returned. Should no `None` occur, a
-/// vector containing the values of each `Option` is returned.
-///
-/// Here is an example which increments every integer in a vector,
-/// checking for overflow:
-///
-/// fn inc_conditionally(x: uint) -> Option<uint> {
-/// if x == uint::MAX { return None; }
-/// else { return Some(x+1u); }
-/// }
-/// let v = [1u, 2, 3];
-/// let res = collect(v.iter().map(|&x| inc_conditionally(x)));
-/// assert!(res == Some(~[2u, 3, 4]));
-#[inline]
-pub fn collect<T, Iter: Iterator<Option<T>>, V: FromIterator<T>>(iter: Iter) -> Option<V> {
- // FIXME(#11084): This should be twice as fast once this bug is closed.
- let mut iter = iter.scan(false, |state, x| {
- match x {
- Some(x) => Some(x),
- None => {
- *state = true;
- None
- }
- }
- });
-
- let v: V = FromIterator::from_iter(iter.by_ref());
-
- if iter.state {
- None
- } else {
- Some(v)
- }
-}
-
-/////////////////////////////////////////////////////////////////////////////
-// Tests
-/////////////////////////////////////////////////////////////////////////////
-
-#[cfg(test)]
-mod tests {
- use super::*;
- use prelude::*;
-
- use iter::range;
- use str::StrSlice;
- use kinds::marker;
- use slice::ImmutableVector;
-
- #[test]
- fn test_get_ptr() {
- unsafe {
- let x = box 0;
- let addr_x: *int = ::cast::transmute(&*x);
- let opt = Some(x);
- let y = opt.unwrap();
- let addr_y: *int = ::cast::transmute(&*y);
- assert_eq!(addr_x, addr_y);
- }
- }
-
- #[test]
- fn test_get_str() {
- let x = "test".to_owned();
- let addr_x = x.as_ptr();
- let opt = Some(x);
- let y = opt.unwrap();
- let addr_y = y.as_ptr();
- assert_eq!(addr_x, addr_y);
- }
-
- #[test]
- fn test_get_resource() {
- use rc::Rc;
- use cell::RefCell;
-
- struct R {
- i: Rc<RefCell<int>>,
- }
-
- #[unsafe_destructor]
- impl ::ops::Drop for R {
- fn drop(&mut self) {
- let ii = &*self.i;
- let i = ii.borrow().clone();
- *ii.borrow_mut() = i + 1;
- }
- }
-
- fn R(i: Rc<RefCell<int>>) -> R {
- R {
- i: i
- }
- }
-
- let i = Rc::new(RefCell::new(0));
- {
- let x = R(i.clone());
- let opt = Some(x);
- let _y = opt.unwrap();
- }
- assert_eq!(*i.borrow(), 1);
- }
-
- #[test]
- fn test_option_dance() {
- let x = Some(());
- let mut y = Some(5);
- let mut y2 = 0;
- for _x in x.iter() {
- y2 = y.take_unwrap();
- }
- assert_eq!(y2, 5);
- assert!(y.is_none());
- }
-
- #[test] #[should_fail]
- fn test_option_too_much_dance() {
- let mut y = Some(marker::NoCopy);
- let _y2 = y.take_unwrap();
- let _y3 = y.take_unwrap();
- }
-
- #[test]
- fn test_and() {
- let x: Option<int> = Some(1);
- assert_eq!(x.and(Some(2)), Some(2));
- assert_eq!(x.and(None::<int>), None);
-
- let x: Option<int> = None;
- assert_eq!(x.and(Some(2)), None);
- assert_eq!(x.and(None::<int>), None);
- }
-
- #[test]
- fn test_and_then() {
- let x: Option<int> = Some(1);
- assert_eq!(x.and_then(|x| Some(x + 1)), Some(2));
- assert_eq!(x.and_then(|_| None::<int>), None);
-
- let x: Option<int> = None;
- assert_eq!(x.and_then(|x| Some(x + 1)), None);
- assert_eq!(x.and_then(|_| None::<int>), None);
- }
-
- #[test]
- fn test_or() {
- let x: Option<int> = Some(1);
- assert_eq!(x.or(Some(2)), Some(1));
- assert_eq!(x.or(None), Some(1));
-
- let x: Option<int> = None;
- assert_eq!(x.or(Some(2)), Some(2));
- assert_eq!(x.or(None), None);
- }
-
- #[test]
- fn test_or_else() {
- let x: Option<int> = Some(1);
- assert_eq!(x.or_else(|| Some(2)), Some(1));
- assert_eq!(x.or_else(|| None), Some(1));
-
- let x: Option<int> = None;
- assert_eq!(x.or_else(|| Some(2)), Some(2));
- assert_eq!(x.or_else(|| None), None);
- }
-
- #[test]
- fn test_option_while_some() {
- let mut i = 0;
- Some(10).while_some(|j| {
- i += 1;
- if j > 0 {
- Some(j-1)
- } else {
- None
- }
- });
- assert_eq!(i, 11);
- }
-
- #[test]
- fn test_unwrap() {
- assert_eq!(Some(1).unwrap(), 1);
- assert_eq!(Some("hello".to_owned()).unwrap(), "hello".to_owned());
- }
-
- #[test]
- #[should_fail]
- fn test_unwrap_fail1() {
- let x: Option<int> = None;
- x.unwrap();
- }
-
- #[test]
- #[should_fail]
- fn test_unwrap_fail2() {
- let x: Option<~str> = None;
- x.unwrap();
- }
-
- #[test]
- fn test_unwrap_or() {
- let x: Option<int> = Some(1);
- assert_eq!(x.unwrap_or(2), 1);
-
- let x: Option<int> = None;
- assert_eq!(x.unwrap_or(2), 2);
- }
-
- #[test]
- fn test_unwrap_or_else() {
- let x: Option<int> = Some(1);
- assert_eq!(x.unwrap_or_else(|| 2), 1);
-
- let x: Option<int> = None;
- assert_eq!(x.unwrap_or_else(|| 2), 2);
- }
-
- #[test]
- fn test_filtered() {
- let some_stuff = Some(42);
- let modified_stuff = some_stuff.filtered(|&x| {x < 10});
- assert_eq!(some_stuff.unwrap(), 42);
- assert!(modified_stuff.is_none());
- }
-
- #[test]
- fn test_iter() {
- let val = 5;
-
- let x = Some(val);
- let mut it = x.iter();
-
- assert_eq!(it.size_hint(), (1, Some(1)));
- assert_eq!(it.next(), Some(&val));
- assert_eq!(it.size_hint(), (0, Some(0)));
- assert!(it.next().is_none());
- }
-
- #[test]
- fn test_mut_iter() {
- let val = 5;
- let new_val = 11;
-
- let mut x = Some(val);
- {
- let mut it = x.mut_iter();
-
- assert_eq!(it.size_hint(), (1, Some(1)));
-
- match it.next() {
- Some(interior) => {
- assert_eq!(*interior, val);
- *interior = new_val;
- }
- None => assert!(false),
- }
-
- assert_eq!(it.size_hint(), (0, Some(0)));
- assert!(it.next().is_none());
+ Some(val) => val,
+ None => fail!(msg),
}
- assert_eq!(x, Some(new_val));
- }
-
- #[test]
- fn test_ord() {
- let small = Some(1.0);
- let big = Some(5.0);
- let nan = Some(0.0/0.0);
- assert!(!(nan < big));
- assert!(!(nan > big));
- assert!(small < big);
- assert!(None < big);
- assert!(big > None);
- }
-
- #[test]
- fn test_mutate() {
- let mut x = Some(3i);
- assert!(x.mutate(|i| i+1));
- assert_eq!(x, Some(4i));
- assert!(x.mutate_or_set(0, |i| i+1));
- assert_eq!(x, Some(5i));
- x = None;
- assert!(!x.mutate(|i| i+1));
- assert_eq!(x, None);
- assert!(!x.mutate_or_set(0i, |i| i+1));
- assert_eq!(x, Some(0i));
- }
-
- #[test]
- fn test_collect() {
- let v: Option<~[int]> = collect(range(0, 0)
- .map(|_| Some(0)));
- assert_eq!(v, Some(box []));
-
- let v: Option<~[int]> = collect(range(0, 3)
- .map(|x| Some(x)));
- assert_eq!(v, Some(box [0, 1, 2]));
-
- let v: Option<~[int]> = collect(range(0, 3)
- .map(|x| if x > 1 { None } else { Some(x) }));
- assert_eq!(v, None);
-
- // test that it does not take more elements than it needs
- let mut functions = [|| Some(()), || None, || fail!()];
-
- let v: Option<~[()]> = collect(functions.mut_iter().map(|f| (*f)()));
-
- assert_eq!(v, None);
}
}
use result::{Err, Ok, Result};
use ptr;
use str;
-use str::{Str, StrSlice};
+use str::{Str, StrSlice, StrAllocating};
use fmt;
use sync::atomics::{AtomicInt, INIT_ATOMIC_INT, SeqCst};
use path::{Path, GenericPath};
pub fn getcwd() -> Path {
use libc::DWORD;
use libc::GetCurrentDirectoryW;
+ use option::Expect;
+
let mut buf = [0 as u16, ..BUF_BYTES];
unsafe {
if libc::GetCurrentDirectoryW(buf.len() as DWORD, buf.as_mut_ptr()) == 0 as DWORD {
use iter::Iterator;
use libc::types::os::arch::extra::DWORD;
use libc;
- use option::{None, Option};
+ use option::{None, Option, Expect};
use option;
use os::TMPBUF_SZ;
use slice::{MutableVector, ImmutableVector, OwnedVector};
- use str::StrSlice;
+ use str::{StrSlice, StrAllocating};
use str;
use vec::Vec;
#[cfg(windows)]
unsafe fn get_env_pairs() -> Vec<~[u8]> {
use c_str;
- use str::StrSlice;
use libc::funcs::extra::kernel32::{
GetEnvironmentStringsA,
#[cfg(windows)]
fn real_args() -> ~[~str] {
use slice;
+ use option::Expect;
let mut nArgs: c_int = 0;
let lpArgCount: *mut c_int = &mut nArgs;
+++ /dev/null
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-//! Operations on unique pointer types
-
-#[cfg(not(test))] use cmp::*;
-
-/// A value that represents the global exchange heap. This is the default
-/// place that the `box` keyword allocates into when no place is supplied.
-///
-/// The following two examples are equivalent:
-///
-/// let foo = box(HEAP) Bar::new(...);
-/// let foo = box Bar::new(...);
-#[lang="exchange_heap"]
-#[cfg(not(test))]
-pub static HEAP: () = ();
-
-#[cfg(test)]
-pub static HEAP: () = ();
-
-/// A type that represents a uniquely-owned value.
-#[lang="owned_box"]
-#[cfg(not(test))]
-pub struct Box<T>(*T);
-
-#[cfg(test)]
-pub struct Box<T>(*T);
-
-#[cfg(not(test))]
-impl<T:Eq> Eq for Box<T> {
- #[inline]
- fn eq(&self, other: &Box<T>) -> bool { *(*self) == *(*other) }
- #[inline]
- fn ne(&self, other: &Box<T>) -> bool { *(*self) != *(*other) }
-}
-
-#[cfg(not(test))]
-impl<T:Ord> Ord for Box<T> {
- #[inline]
- fn lt(&self, other: &Box<T>) -> bool { *(*self) < *(*other) }
- #[inline]
- fn le(&self, other: &Box<T>) -> bool { *(*self) <= *(*other) }
- #[inline]
- fn ge(&self, other: &Box<T>) -> bool { *(*self) >= *(*other) }
- #[inline]
- fn gt(&self, other: &Box<T>) -> bool { *(*self) > *(*other) }
-}
-
-#[cfg(not(test))]
-impl<T: TotalOrd> TotalOrd for Box<T> {
- #[inline]
- fn cmp(&self, other: &Box<T>) -> Ordering { (**self).cmp(*other) }
-}
-
-#[cfg(not(test))]
-impl<T: TotalEq> TotalEq for Box<T> {}
use iter::{AdditiveIterator, DoubleEndedIterator, Extendable, Rev, Iterator, Map};
use option::{Option, Some, None};
use slice::{Vector, OwnedVector, ImmutableVector};
-use str::{CharSplits, Str, StrVector, StrSlice};
+use str::{CharSplits, Str, StrAllocating, StrVector, StrSlice};
use strbuf::StrBuf;
use vec::Vec;
}
}
- fn normalize_<S: Str>(s: S) -> (Option<PathPrefix>, StrBuf) {
+ fn normalize_<S: StrAllocating>(s: S) -> (Option<PathPrefix>, StrBuf) {
// make borrowck happy
let (prefix, val) = {
let prefix = parse_prefix(s.as_slice());
}
fn update_normalized<S: Str>(&mut self, s: S) {
- let (prefix, path) = Path::normalize_(s);
+ let (prefix, path) = Path::normalize_(s.as_slice());
self.repr = path;
self.prefix = prefix;
self.update_sepidx();
pub use num::{Num, NumCast, CheckedAdd, CheckedSub, CheckedMul};
pub use num::{Signed, Unsigned};
pub use num::{Primitive, Int, Float, ToPrimitive, FromPrimitive};
+pub use option::Expect;
pub use owned::Box;
pub use path::{GenericPath, Path, PosixPath, WindowsPath};
pub use ptr::RawPtr;
pub use io::{Buffer, Writer, Reader, Seek};
+pub use result::{ResultUnwrap, ResultUnwrapErr};
pub use str::{Str, StrVector, StrSlice, OwnedStr, IntoMaybeOwned};
+pub use str::{StrAllocating};
pub use to_str::{ToStr, IntoStr};
pub use tuple::{Tuple1, Tuple2, Tuple3, Tuple4};
pub use tuple::{Tuple5, Tuple6, Tuple7, Tuple8};
pub use tuple::{Tuple9, Tuple10, Tuple11, Tuple12};
pub use slice::{ImmutableEqVector, ImmutableTotalOrdVector, ImmutableCloneableVector};
pub use slice::{OwnedVector};
-pub use slice::{MutableVector, MutableTotalOrdVector};
+pub use slice::{MutableVector, MutableTotalOrdVector, MutableVectorAllocating};
pub use slice::{Vector, VectorVector, CloneableVector, ImmutableVector};
pub use strbuf::StrBuf;
pub use vec::Vec;
+++ /dev/null
-// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-//! Conveniences for working with unsafe pointers, the `*T`, and `*mut T` types.
-//!
-//! Working with unsafe pointers in Rust is fairly uncommon,
-//! and often limited to some narrow use cases: holding
-//! an unsafe pointer when safe pointers are unsuitable;
-//! checking for null; and converting back to safe pointers.
-//! As a result, there is not yet an abundance of library code
-//! for working with unsafe pointers, and in particular,
-//! since pointer math is fairly uncommon in Rust, it is not
-//! all that convenient.
-//!
-//! Use the [`null` function](fn.null.html) to create null pointers,
-//! the [`is_null`](trait.RawPtr.html#tymethod.is_null)
-//! and [`is_not_null`](trait.RawPtr.html#method.is_not_null)
-//! methods of the [`RawPtr` trait](trait.RawPtr.html) to check for null.
-//! The `RawPtr` trait is imported by the prelude, so `is_null` etc.
-//! work everywhere.
-//!
-//! # Common ways to create unsafe pointers
-//!
-//! ## 1. Coerce a reference (`&T`) or mutable reference (`&mut T`).
-//!
-//! ```
-//! let my_num: int = 10;
-//! let my_num_ptr: *int = &my_num;
-//! let mut my_speed: int = 88;
-//! let my_speed_ptr: *mut int = &mut my_speed;
-//! ```
-//!
-//! This does not take ownership of the original allocation
-//! and requires no resource management later,
-//! but you must not use the pointer after its lifetime.
-//!
-//! ## 2. Transmute an owned box (`Box<T>`).
-//!
-//! The `transmute` function takes, by value, whatever it's given
-//! and returns it as whatever type is requested, as long as the
-//! types are the same size. Because `Box<T>` and `*T` have the same
-//! representation they can be trivially,
-//! though unsafely, transformed from one type to the other.
-//!
-//! ```
-//! use std::cast;
-//!
-//! unsafe {
-//! let my_num: Box<int> = box 10;
-//! let my_num: *int = cast::transmute(my_num);
-//! let my_speed: Box<int> = box 88;
-//! let my_speed: *mut int = cast::transmute(my_speed);
-//!
-//! // By taking ownership of the original `Box<T>` though
-//! // we are obligated to transmute it back later to be destroyed.
-//! drop(cast::transmute::<_, Box<int>>(my_speed));
-//! drop(cast::transmute::<_, Box<int>>(my_num));
-//! }
-//! ```
-//!
-//! Note that here the call to `drop` is for clarity - it indicates
-//! that we are done with the given value and it should be destroyed.
-//!
-//! ## 3. Get it from C.
-//!
-//! ```
-//! extern crate libc;
-//!
-//! use std::mem;
-//!
-//! fn main() {
-//! unsafe {
-//! let my_num: *mut int = libc::malloc(mem::size_of::<int>() as libc::size_t) as *mut int;
-//! if my_num.is_null() {
-//! fail!("failed to allocate memory");
-//! }
-//! libc::free(my_num as *mut libc::c_void);
-//! }
-//! }
-//! ```
-//!
-//! Usually you wouldn't literally use `malloc` and `free` from Rust,
-//! but C APIs hand out a lot of pointers generally, so are a common source
-//! of unsafe pointers in Rust.
-
-use cast;
-use clone::Clone;
-#[cfg(not(test))]
-use cmp::Equiv;
-use iter::{range, Iterator};
-use mem;
-use option::{Option, Some, None};
-use intrinsics;
-
-#[cfg(not(test))] use cmp::{Eq, TotalEq, Ord};
-
-/// Return the offset of the first null pointer in `buf`.
-#[inline]
-pub unsafe fn buf_len<T>(buf: **T) -> uint {
- position(buf, |i| *i == null())
-}
-
-impl<T> Clone for *T {
- #[inline]
- fn clone(&self) -> *T {
- *self
- }
-}
-
-impl<T> Clone for *mut T {
- #[inline]
- fn clone(&self) -> *mut T {
- *self
- }
-}
-
-/// Return the first offset `i` such that `f(buf[i]) == true`.
-#[inline]
-pub unsafe fn position<T>(buf: *T, f: |&T| -> bool) -> uint {
- let mut i = 0;
- loop {
- if f(&(*buf.offset(i as int))) { return i; }
- else { i += 1; }
- }
-}
-
-/// Create a null pointer.
-///
-/// # Example
-///
-/// ```
-/// use std::ptr;
-///
-/// let p: *int = ptr::null();
-/// assert!(p.is_null());
-/// ```
-#[inline]
-pub fn null<T>() -> *T { 0 as *T }
-
-/// Create an unsafe mutable null pointer.
-///
-/// # Example
-///
-/// ```
-/// use std::ptr;
-///
-/// let p: *mut int = ptr::mut_null();
-/// assert!(p.is_null());
-/// ```
-#[inline]
-pub fn mut_null<T>() -> *mut T { 0 as *mut T }
-
-/// Copies data from one location to another.
-///
-/// Copies `count` elements (not bytes) from `src` to `dst`. The source
-/// and destination may overlap.
-///
-/// `copy_memory` is semantically equivalent to C's `memmove`.
-///
-/// # Example
-///
-/// Efficiently create a Rust vector from an unsafe buffer:
-///
-/// ```
-/// use std::ptr;
-///
-/// unsafe fn from_buf_raw<T>(ptr: *T, elts: uint) -> Vec<T> {
-/// let mut dst = Vec::with_capacity(elts);
-/// dst.set_len(elts);
-/// ptr::copy_memory(dst.as_mut_ptr(), ptr, elts);
-/// dst
-/// }
-/// ```
-///
-#[inline]
-pub unsafe fn copy_memory<T>(dst: *mut T, src: *T, count: uint) {
- intrinsics::copy_memory(dst, src, count)
-}
-
-/// Copies data from one location to another.
-///
-/// Copies `count` elements (not bytes) from `src` to `dst`. The source
-/// and destination may *not* overlap.
-///
-/// `copy_nonoverlapping_memory` is semantically equivalent to C's `memcpy`.
-///
-/// # Example
-///
-/// A safe swap function:
-///
-/// ```
-/// use std::cast;
-/// use std::mem;
-/// use std::ptr;
-///
-/// fn swap<T>(x: &mut T, y: &mut T) {
-/// unsafe {
-/// // Give ourselves some scratch space to work with
-/// let mut t: T = mem::uninit();
-///
-/// // Perform the swap, `&mut` pointers never alias
-/// ptr::copy_nonoverlapping_memory(&mut t, &*x, 1);
-/// ptr::copy_nonoverlapping_memory(x, &*y, 1);
-/// ptr::copy_nonoverlapping_memory(y, &t, 1);
-///
-/// // y and t now point to the same thing, but we need to completely forget `tmp`
-/// // because it's no longer relevant.
-/// cast::forget(t);
-/// }
-/// }
-/// ```
-///
-/// # Safety Note
-///
-/// If the source and destination overlap then the behavior of this
-/// function is undefined.
-#[inline]
-pub unsafe fn copy_nonoverlapping_memory<T>(dst: *mut T,
- src: *T,
- count: uint) {
- intrinsics::copy_nonoverlapping_memory(dst, src, count)
-}
-
-/// Invokes memset on the specified pointer, setting `count * size_of::<T>()`
-/// bytes of memory starting at `dst` to `c`.
-#[inline]
-pub unsafe fn set_memory<T>(dst: *mut T, c: u8, count: uint) {
- intrinsics::set_memory(dst, c, count)
-}
-
-/// Zeroes out `count * size_of::<T>` bytes of memory at `dst`
-#[inline]
-pub unsafe fn zero_memory<T>(dst: *mut T, count: uint) {
- set_memory(dst, 0, count);
-}
-
-/// Swap the values at two mutable locations of the same type, without
-/// deinitialising either. They may overlap.
-#[inline]
-pub unsafe fn swap<T>(x: *mut T, y: *mut T) {
- // Give ourselves some scratch space to work with
- let mut tmp: T = mem::uninit();
- let t: *mut T = &mut tmp;
-
- // Perform the swap
- copy_nonoverlapping_memory(t, &*x, 1);
- copy_memory(x, &*y, 1); // `x` and `y` may overlap
- copy_nonoverlapping_memory(y, &*t, 1);
-
- // y and t now point to the same thing, but we need to completely forget `tmp`
- // because it's no longer relevant.
- cast::forget(tmp);
-}
-
-/// Replace the value at a mutable location with a new one, returning the old
-/// value, without deinitialising either.
-#[inline]
-pub unsafe fn replace<T>(dest: *mut T, mut src: T) -> T {
- mem::swap(cast::transmute(dest), &mut src); // cannot overlap
- src
-}
-
-/// Reads the value from `*src` and returns it.
-#[inline(always)]
-pub unsafe fn read<T>(src: *T) -> T {
- let mut tmp: T = mem::uninit();
- copy_nonoverlapping_memory(&mut tmp, src, 1);
- tmp
-}
-
-/// Reads the value from `*src` and nulls it out.
-/// This currently prevents destructors from executing.
-#[inline(always)]
-pub unsafe fn read_and_zero<T>(dest: *mut T) -> T {
- // Copy the data out from `dest`:
- let tmp = read(&*dest);
-
- // Now zero out `dest`:
- zero_memory(dest, 1);
-
- tmp
-}
-
-/// Given a **T (pointer to an array of pointers),
-/// iterate through each *T, up to the provided `len`,
-/// passing to the provided callback function
-pub unsafe fn array_each_with_len<T>(arr: **T, len: uint, cb: |*T|) {
- if arr.is_null() {
- fail!("ptr::array_each_with_len failure: arr input is null pointer");
- }
- //let start_ptr = *arr;
- for e in range(0, len) {
- let n = arr.offset(e as int);
- cb(*n);
- }
-}
-
-/// Given a null-pointer-terminated **T (pointer to
-/// an array of pointers), iterate through each *T,
-/// passing to the provided callback function
-///
-/// # Safety Note
-///
-/// This will only work with a null-terminated
-/// pointer array.
-pub unsafe fn array_each<T>(arr: **T, cb: |*T|) {
- if arr.is_null() {
- fail!("ptr::array_each_with_len failure: arr input is null pointer");
- }
- let len = buf_len(arr);
- array_each_with_len(arr, len, cb);
-}
-
-/// Extension methods for raw pointers.
-pub trait RawPtr<T> {
- /// Returns the null pointer.
- fn null() -> Self;
- /// Returns true if the pointer is equal to the null pointer.
- fn is_null(&self) -> bool;
- /// Returns true if the pointer is not equal to the null pointer.
- fn is_not_null(&self) -> bool { !self.is_null() }
- /// Returns the value of this pointer (ie, the address it points to)
- fn to_uint(&self) -> uint;
- /// Returns `None` if the pointer is null, or else returns the value wrapped
- /// in `Some`.
- ///
- /// # Safety Notes
- ///
- /// While this method is useful for null-safety, it is important to note
- /// that this is still an unsafe operation because the returned value could
- /// be pointing to invalid memory.
- unsafe fn to_option(&self) -> Option<&T>;
- /// Calculates the offset from a pointer. The offset *must* be in-bounds of
- /// the object, or one-byte-past-the-end. `count` is in units of T; e.g. a
- /// `count` of 3 represents a pointer offset of `3 * sizeof::<T>()` bytes.
- unsafe fn offset(self, count: int) -> Self;
-}
-
-impl<T> RawPtr<T> for *T {
- #[inline]
- fn null() -> *T { null() }
-
- #[inline]
- fn is_null(&self) -> bool { *self == RawPtr::null() }
-
- #[inline]
- fn to_uint(&self) -> uint { *self as uint }
-
- #[inline]
- unsafe fn offset(self, count: int) -> *T { intrinsics::offset(self, count) }
-
- #[inline]
- unsafe fn to_option(&self) -> Option<&T> {
- if self.is_null() {
- None
- } else {
- Some(cast::transmute(*self))
- }
- }
-}
-
-impl<T> RawPtr<T> for *mut T {
- #[inline]
- fn null() -> *mut T { mut_null() }
-
- #[inline]
- fn is_null(&self) -> bool { *self == RawPtr::null() }
-
- #[inline]
- fn to_uint(&self) -> uint { *self as uint }
-
- #[inline]
- unsafe fn offset(self, count: int) -> *mut T { intrinsics::offset(self as *T, count) as *mut T }
-
- #[inline]
- unsafe fn to_option(&self) -> Option<&T> {
- if self.is_null() {
- None
- } else {
- Some(cast::transmute(*self))
- }
- }
-}
-
-// Equality for pointers
-#[cfg(not(test))]
-impl<T> Eq for *T {
- #[inline]
- fn eq(&self, other: &*T) -> bool {
- *self == *other
- }
- #[inline]
- fn ne(&self, other: &*T) -> bool { !self.eq(other) }
-}
-
-#[cfg(not(test))]
-impl<T> TotalEq for *T {}
-
-#[cfg(not(test))]
-impl<T> Eq for *mut T {
- #[inline]
- fn eq(&self, other: &*mut T) -> bool {
- *self == *other
- }
- #[inline]
- fn ne(&self, other: &*mut T) -> bool { !self.eq(other) }
-}
-
-#[cfg(not(test))]
-impl<T> TotalEq for *mut T {}
-
-// Equivalence for pointers
-#[cfg(not(test))]
-impl<T> Equiv<*mut T> for *T {
- fn equiv(&self, other: &*mut T) -> bool {
- self.to_uint() == other.to_uint()
- }
-}
-
-#[cfg(not(test))]
-impl<T> Equiv<*T> for *mut T {
- fn equiv(&self, other: &*T) -> bool {
- self.to_uint() == other.to_uint()
- }
-}
-
-// Equality for extern "C" fn pointers
-#[cfg(not(test))]
-mod externfnpointers {
- use cast;
- use cmp::Eq;
-
- impl<_R> Eq for extern "C" fn() -> _R {
- #[inline]
- fn eq(&self, other: &extern "C" fn() -> _R) -> bool {
- let self_: *() = unsafe { cast::transmute(*self) };
- let other_: *() = unsafe { cast::transmute(*other) };
- self_ == other_
- }
- #[inline]
- fn ne(&self, other: &extern "C" fn() -> _R) -> bool {
- !self.eq(other)
- }
- }
- macro_rules! fnptreq(
- ($($p:ident),*) => {
- impl<_R,$($p),*> Eq for extern "C" fn($($p),*) -> _R {
- #[inline]
- fn eq(&self, other: &extern "C" fn($($p),*) -> _R) -> bool {
- let self_: *() = unsafe { cast::transmute(*self) };
- let other_: *() = unsafe { cast::transmute(*other) };
- self_ == other_
- }
- #[inline]
- fn ne(&self, other: &extern "C" fn($($p),*) -> _R) -> bool {
- !self.eq(other)
- }
- }
- }
- )
- fnptreq!(A)
- fnptreq!(A,B)
- fnptreq!(A,B,C)
- fnptreq!(A,B,C,D)
- fnptreq!(A,B,C,D,E)
-}
-
-// Comparison for pointers
-#[cfg(not(test))]
-impl<T> Ord for *T {
- #[inline]
- fn lt(&self, other: &*T) -> bool {
- *self < *other
- }
- #[inline]
- fn le(&self, other: &*T) -> bool {
- *self <= *other
- }
- #[inline]
- fn ge(&self, other: &*T) -> bool {
- *self >= *other
- }
- #[inline]
- fn gt(&self, other: &*T) -> bool {
- *self > *other
- }
-}
-
-#[cfg(not(test))]
-impl<T> Ord for *mut T {
- #[inline]
- fn lt(&self, other: &*mut T) -> bool {
- *self < *other
- }
- #[inline]
- fn le(&self, other: &*mut T) -> bool {
- *self <= *other
- }
- #[inline]
- fn ge(&self, other: &*mut T) -> bool {
- *self >= *other
- }
- #[inline]
- fn gt(&self, other: &*mut T) -> bool {
- *self > *other
- }
-}
-
-#[cfg(test)]
-pub mod ptr_tests {
- use super::*;
- use prelude::*;
-
- use c_str::ToCStr;
- use cast;
- use libc;
- use str;
- use slice::{ImmutableVector, MutableVector};
-
- #[test]
- fn test() {
- unsafe {
- struct Pair {
- fst: int,
- snd: int
- };
- let mut p = Pair {fst: 10, snd: 20};
- let pptr: *mut Pair = &mut p;
- let iptr: *mut int = cast::transmute(pptr);
- assert_eq!(*iptr, 10);
- *iptr = 30;
- assert_eq!(*iptr, 30);
- assert_eq!(p.fst, 30);
-
- *pptr = Pair {fst: 50, snd: 60};
- assert_eq!(*iptr, 50);
- assert_eq!(p.fst, 50);
- assert_eq!(p.snd, 60);
-
- let v0 = box [32000u16, 32001u16, 32002u16];
- let mut v1 = box [0u16, 0u16, 0u16];
-
- copy_memory(v1.as_mut_ptr().offset(1),
- v0.as_ptr().offset(1), 1);
- assert!((v1[0] == 0u16 && v1[1] == 32001u16 && v1[2] == 0u16));
- copy_memory(v1.as_mut_ptr(),
- v0.as_ptr().offset(2), 1);
- assert!((v1[0] == 32002u16 && v1[1] == 32001u16 &&
- v1[2] == 0u16));
- copy_memory(v1.as_mut_ptr().offset(2),
- v0.as_ptr(), 1u);
- assert!((v1[0] == 32002u16 && v1[1] == 32001u16 &&
- v1[2] == 32000u16));
- }
- }
-
- #[test]
- fn test_position() {
- use libc::c_char;
-
- "hello".with_c_str(|p| {
- unsafe {
- assert!(2u == position(p, |c| *c == 'l' as c_char));
- assert!(4u == position(p, |c| *c == 'o' as c_char));
- assert!(5u == position(p, |c| *c == 0 as c_char));
- }
- })
- }
-
- #[test]
- fn test_buf_len() {
- "hello".with_c_str(|p0| {
- "there".with_c_str(|p1| {
- "thing".with_c_str(|p2| {
- let v = box [p0, p1, p2, null()];
- unsafe {
- assert_eq!(buf_len(v.as_ptr()), 3u);
- }
- })
- })
- })
- }
-
- #[test]
- fn test_is_null() {
- let p: *int = null();
- assert!(p.is_null());
- assert!(!p.is_not_null());
-
- let q = unsafe { p.offset(1) };
- assert!(!q.is_null());
- assert!(q.is_not_null());
-
- let mp: *mut int = mut_null();
- assert!(mp.is_null());
- assert!(!mp.is_not_null());
-
- let mq = unsafe { mp.offset(1) };
- assert!(!mq.is_null());
- assert!(mq.is_not_null());
- }
-
- #[test]
- fn test_to_option() {
- unsafe {
- let p: *int = null();
- assert_eq!(p.to_option(), None);
-
- let q: *int = &2;
- assert_eq!(q.to_option().unwrap(), &2);
-
- let p: *mut int = mut_null();
- assert_eq!(p.to_option(), None);
-
- let q: *mut int = &mut 2;
- assert_eq!(q.to_option().unwrap(), &2);
- }
- }
-
- #[test]
- fn test_ptr_addition() {
- unsafe {
- let xs = box [5, ..16];
- let mut ptr = xs.as_ptr();
- let end = ptr.offset(16);
-
- while ptr < end {
- assert_eq!(*ptr, 5);
- ptr = ptr.offset(1);
- }
-
- let mut xs_mut = xs.clone();
- let mut m_ptr = xs_mut.as_mut_ptr();
- let m_end = m_ptr.offset(16);
-
- while m_ptr < m_end {
- *m_ptr += 5;
- m_ptr = m_ptr.offset(1);
- }
-
- assert_eq!(xs_mut, box [10, ..16]);
- }
- }
-
- #[test]
- fn test_ptr_subtraction() {
- unsafe {
- let xs = box [0,1,2,3,4,5,6,7,8,9];
- let mut idx = 9i8;
- let ptr = xs.as_ptr();
-
- while idx >= 0i8 {
- assert_eq!(*(ptr.offset(idx as int)), idx as int);
- idx = idx - 1i8;
- }
-
- let mut xs_mut = xs.clone();
- let m_start = xs_mut.as_mut_ptr();
- let mut m_ptr = m_start.offset(9);
-
- while m_ptr >= m_start {
- *m_ptr += *m_ptr;
- m_ptr = m_ptr.offset(-1);
- }
-
- assert_eq!(xs_mut, box [0,2,4,6,8,10,12,14,16,18]);
- }
- }
-
- #[test]
- fn test_ptr_array_each_with_len() {
- unsafe {
- let one = "oneOne".to_c_str();
- let two = "twoTwo".to_c_str();
- let three = "threeThree".to_c_str();
- let arr = box [
- one.with_ref(|buf| buf),
- two.with_ref(|buf| buf),
- three.with_ref(|buf| buf),
- ];
- let expected_arr = [
- one, two, three
- ];
-
- let mut ctr = 0;
- let mut iteration_count = 0;
- array_each_with_len(arr.as_ptr(), arr.len(), |e| {
- let actual = str::raw::from_c_str(e);
- let expected = expected_arr[ctr].with_ref(|buf| {
- str::raw::from_c_str(buf)
- });
- debug!(
- "test_ptr_array_each_with_len e: {}, a: {}",
- expected, actual);
- assert_eq!(actual, expected);
- ctr += 1;
- iteration_count += 1;
- });
- assert_eq!(iteration_count, 3u);
- }
- }
-
- #[test]
- fn test_ptr_array_each() {
- unsafe {
- let one = "oneOne".to_c_str();
- let two = "twoTwo".to_c_str();
- let three = "threeThree".to_c_str();
- let arr = box [
- one.with_ref(|buf| buf),
- two.with_ref(|buf| buf),
- three.with_ref(|buf| buf),
- // fake a null terminator
- null(),
- ];
- let expected_arr = [
- one, two, three
- ];
-
- let arr_ptr = arr.as_ptr();
- let mut ctr = 0;
- let mut iteration_count = 0;
- array_each(arr_ptr, |e| {
- let actual = str::raw::from_c_str(e);
- let expected = expected_arr[ctr].with_ref(|buf| {
- str::raw::from_c_str(buf)
- });
- debug!(
- "test_ptr_array_each e: {}, a: {}",
- expected, actual);
- assert_eq!(actual, expected);
- ctr += 1;
- iteration_count += 1;
- });
- assert_eq!(iteration_count, 3);
- }
- }
-
- #[test]
- #[should_fail]
- fn test_ptr_array_each_with_len_null_ptr() {
- unsafe {
- array_each_with_len(0 as **libc::c_char, 1, |e| {
- str::raw::from_c_str(e);
- });
- }
- }
- #[test]
- #[should_fail]
- fn test_ptr_array_each_null_ptr() {
- unsafe {
- array_each(0 as **libc::c_char, |e| {
- str::raw::from_c_str(e);
- });
- }
- }
-
- #[test]
- fn test_set_memory() {
- let mut xs = [0u8, ..20];
- let ptr = xs.as_mut_ptr();
- unsafe { set_memory(ptr, 5u8, xs.len()); }
- assert!(xs == [5u8, ..20]);
- }
-}
+++ /dev/null
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![allow(missing_doc)]
-
-//! Contains struct definitions for the layout of compiler built-in types.
-//!
-//! They can be used as targets of transmutes in unsafe code for manipulating
-//! the raw representations directly.
-//!
-//! Their definition should always match the ABI defined in `rustc::back::abi`.
-
-use cast;
-
-/// The representation of a Rust managed box
-pub struct Box<T> {
- pub ref_count: uint,
- pub drop_glue: fn(ptr: *mut u8),
- pub prev: *mut Box<T>,
- pub next: *mut Box<T>,
- pub data: T,
-}
-
-/// The representation of a Rust vector
-pub struct Vec<T> {
- pub fill: uint,
- pub alloc: uint,
- pub data: T,
-}
-
-/// The representation of a Rust string
-pub type String = Vec<u8>;
-
-/// The representation of a Rust slice
-pub struct Slice<T> {
- pub data: *T,
- pub len: uint,
-}
-
-/// The representation of a Rust closure
-pub struct Closure {
- pub code: *(),
- pub env: *(),
-}
-
-/// The representation of a Rust procedure (`proc()`)
-pub struct Procedure {
- pub code: *(),
- pub env: *(),
-}
-
-/// The representation of a Rust trait object.
-///
-/// This struct does not have a `Repr` implementation
-/// because there is no way to refer to all trait objects generically.
-pub struct TraitObject {
- pub vtable: *(),
- pub data: *(),
-}
-
-/// This trait is meant to map equivalences between raw structs and their
-/// corresponding rust values.
-pub trait Repr<T> {
- /// This function "unwraps" a rust value (without consuming it) into its raw
- /// struct representation. This can be used to read/write different values
- /// for the struct. This is a safe method because by default it does not
- /// enable write-access to the fields of the return value in safe code.
- #[inline]
- fn repr(&self) -> T { unsafe { cast::transmute_copy(self) } }
-}
-
-impl<'a, T> Repr<Slice<T>> for &'a [T] {}
-impl<'a> Repr<Slice<u8>> for &'a str {}
-impl<T> Repr<*Box<T>> for @T {}
-impl<T> Repr<*Vec<T>> for ~[T] {}
-impl Repr<*String> for ~str {}
-
-#[cfg(test)]
-mod tests {
- use super::*;
-
- use cast;
-
- #[test]
- fn synthesize_closure() {
- unsafe {
- let x = 10;
- let f: |int| -> int = |y| x + y;
-
- assert_eq!(f(20), 30);
-
- let original_closure: Closure = cast::transmute(f);
-
- let actual_function_pointer = original_closure.code;
- let environment = original_closure.env;
-
- let new_closure = Closure {
- code: actual_function_pointer,
- env: environment
- };
-
- let new_f: |int| -> int = cast::transmute(new_closure);
- assert_eq!(new_f(20), 30);
- }
- }
-}
+++ /dev/null
-// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-//! Utilities for references
-
-#[cfg(not(test))]
-use cmp::{Eq, Ord, Ordering, TotalEq, TotalOrd};
-
-// Equality for region pointers
-#[cfg(not(test))]
-impl<'a, T: Eq> Eq for &'a T {
- #[inline]
- fn eq(&self, other: & &'a T) -> bool {
- *(*self) == *(*other)
- }
- #[inline]
- fn ne(&self, other: & &'a T) -> bool {
- *(*self) != *(*other)
- }
-}
-
-// Comparison for region pointers
-#[cfg(not(test))]
-impl<'a, T: Ord> Ord for &'a T {
- #[inline]
- fn lt(&self, other: & &'a T) -> bool {
- *(*self) < *(*other)
- }
- #[inline]
- fn le(&self, other: & &'a T) -> bool {
- *(*self) <= *(*other)
- }
- #[inline]
- fn ge(&self, other: & &'a T) -> bool {
- *(*self) >= *(*other)
- }
- #[inline]
- fn gt(&self, other: & &'a T) -> bool {
- *(*self) > *(*other)
- }
-}
-
-#[cfg(not(test))]
-impl<'a, T: TotalOrd> TotalOrd for &'a T {
- #[inline]
- fn cmp(&self, other: & &'a T) -> Ordering { (**self).cmp(*other) }
-}
-
-#[cfg(not(test))]
-impl<'a, T: TotalEq> TotalEq for &'a T {}
use ptr::RawPtr;
use reflect;
use reflect::{MovePtr, align};
-use result::{Ok, Err};
+use result::{Ok, Err, ResultUnwrap};
use str::StrSlice;
use to_str::ToStr;
use slice::Vector;
pub fn repr_to_str<T>(t: &T) -> ~str {
use str;
+ use str::StrAllocating;
use io;
let mut result = io::MemWriter::new();
use io::stdio::println;
use char::is_alphabetic;
use mem::swap;
- use owned::Box;
fn exact_test<T>(t: &T, e:&str) {
let mut m = io::MemWriter::new();
//! the context. The caller of `fail!` should assume that execution
//! will not resume after failure, that failure is catastrophic.
-use clone::Clone;
-use cmp::Eq;
-use std::fmt::Show;
-use iter::{Iterator, FromIterator};
-use option::{None, Option, Some};
+use fmt::Show;
-/// `Result` is a type that represents either success (`Ok`) or failure (`Err`).
-///
-/// See the [`std::result`](index.html) module documentation for details.
-#[deriving(Clone, Eq, Ord, TotalEq, TotalOrd, Show, Hash)]
-#[must_use]
-pub enum Result<T, E> {
- /// Contains the success value
- Ok(T),
-
- /// Contains the error value
- Err(E)
-}
-
-/////////////////////////////////////////////////////////////////////////////
-// Type implementation
-/////////////////////////////////////////////////////////////////////////////
-
-impl<T, E> Result<T, E> {
- /////////////////////////////////////////////////////////////////////////
- // Querying the contained values
- /////////////////////////////////////////////////////////////////////////
-
- /// Returns true if the result is `Ok`
- ///
- /// # Example
- ///
- /// ~~~
- /// use std::io::{File, Open, Write};
- ///
- /// # fn do_not_run_example() { // creates a file
- /// let mut file = File::open_mode(&Path::new("secret.txt"), Open, Write);
- /// assert!(file.write_line("it's cold in here").is_ok());
- /// # }
- /// ~~~
- #[inline]
- pub fn is_ok(&self) -> bool {
- match *self {
- Ok(_) => true,
- Err(_) => false
- }
- }
-
- /// Returns true if the result is `Err`
- ///
- /// # Example
- ///
- /// ~~~
- /// use std::io::{File, Open, Read};
- ///
- /// // When opening with `Read` access, if the file does not exist
- /// // then `open_mode` returns an error.
- /// let bogus = File::open_mode(&Path::new("not_a_file.txt"), Open, Read);
- /// assert!(bogus.is_err());
- /// ~~~
- #[inline]
- pub fn is_err(&self) -> bool {
- !self.is_ok()
- }
+pub use core::result::{Result, Ok, Err, collect, fold, fold_};
+// FIXME: These traits should not exist. Once std::fmt is moved to libcore,
+// these can once again become inherent methods on Result.
- /////////////////////////////////////////////////////////////////////////
- // Adapter for each variant
- /////////////////////////////////////////////////////////////////////////
-
- /// Convert from `Result<T, E>` to `Option<T>`
- ///
- /// Converts `self` into an `Option<T>`, consuming `self`,
- /// and discarding the error, if any.
- ///
- /// To convert to an `Option` without discarding the error value,
- /// use `as_ref` to first convert the `Result<T, E>` into a
- /// `Result<&T, &E>`.
- ///
- /// # Examples
- ///
- /// ~~~{.should_fail}
- /// use std::io::{File, IoResult};
- ///
- /// let bdays: IoResult<File> = File::open(&Path::new("important_birthdays.txt"));
- /// let bdays: File = bdays.ok().expect("unable to open birthday file");
- /// ~~~
- #[inline]
- pub fn ok(self) -> Option<T> {
- match self {
- Ok(x) => Some(x),
- Err(_) => None,
- }
- }
-
- /// Convert from `Result<T, E>` to `Option<E>`
- ///
- /// Converts `self` into an `Option<T>`, consuming `self`,
- /// and discarding the value, if any.
- #[inline]
- pub fn err(self) -> Option<E> {
- match self {
- Ok(_) => None,
- Err(x) => Some(x),
- }
- }
-
- /////////////////////////////////////////////////////////////////////////
- // Adapter for working with references
- /////////////////////////////////////////////////////////////////////////
-
- /// Convert from `Result<T, E>` to `Result<&T, &E>`
- ///
- /// Produces a new `Result`, containing a reference
- /// into the original, leaving the original in place.
- #[inline]
- pub fn as_ref<'r>(&'r self) -> Result<&'r T, &'r E> {
- match *self {
- Ok(ref x) => Ok(x),
- Err(ref x) => Err(x),
- }
- }
-
- /// Convert from `Result<T, E>` to `Result<&mut T, &mut E>`
- #[inline]
- pub fn as_mut<'r>(&'r mut self) -> Result<&'r mut T, &'r mut E> {
- match *self {
- Ok(ref mut x) => Ok(x),
- Err(ref mut x) => Err(x),
- }
- }
-
- /////////////////////////////////////////////////////////////////////////
- // Transforming contained values
- /////////////////////////////////////////////////////////////////////////
-
- /// Maps a `Result<T, E>` to `Result<U, E>` by applying a function to an
- /// contained `Ok` value, leaving an `Err` value untouched.
- ///
- /// This function can be used to compose the results of two functions.
- ///
- /// # Examples
- ///
- /// Sum the lines of a buffer by mapping strings to numbers,
- /// ignoring I/O and parse errors:
- ///
- /// ~~~
- /// use std::io::{BufReader, IoResult};
- ///
- /// let buffer = "1\n2\n3\n4\n";
- /// let mut reader = BufReader::new(buffer.as_bytes());
- ///
- /// let mut sum = 0;
- ///
- /// while !reader.eof() {
- /// let line: IoResult<~str> = reader.read_line();
- /// // Convert the string line to a number using `map` and `from_str`
- /// let val: IoResult<int> = line.map(|line| {
- /// from_str::<int>(line).unwrap_or(0)
- /// });
- /// // Add the value if there were no errors, otherwise add 0
- /// sum += val.ok().unwrap_or(0);
- /// }
- /// ~~~
- #[inline]
- pub fn map<U>(self, op: |T| -> U) -> Result<U,E> {
- match self {
- Ok(t) => Ok(op(t)),
- Err(e) => Err(e)
- }
- }
-
- /// Maps a `Result<T, E>` to `Result<T, F>` by applying a function to an
- /// contained `Err` value, leaving an `Ok` value untouched.
- ///
- /// This function can be used to pass through a successful result while handling
- /// an error.
- #[inline]
- pub fn map_err<F>(self, op: |E| -> F) -> Result<T,F> {
- match self {
- Ok(t) => Ok(t),
- Err(e) => Err(op(e))
- }
- }
-
- ////////////////////////////////////////////////////////////////////////
- // Boolean operations on the values, eager and lazy
- /////////////////////////////////////////////////////////////////////////
-
- /// Returns `res` if the result is `Ok`, otherwise returns the `Err` value of `self`.
- #[inline]
- pub fn and<U>(self, res: Result<U, E>) -> Result<U, E> {
- match self {
- Ok(_) => res,
- Err(e) => Err(e),
- }
- }
-
- /// Calls `op` if the result is `Ok`, otherwise returns the `Err` value of `self`.
+/// Temporary trait for unwrapping a result
+pub trait ResultUnwrap<T, E> {
+ /// Unwraps a result, yielding the content of an `Ok`.
///
- /// This function can be used for control flow based on result values
- #[inline]
- pub fn and_then<U>(self, op: |T| -> Result<U, E>) -> Result<U, E> {
- match self {
- Ok(t) => op(t),
- Err(e) => Err(e),
- }
- }
-
- /// Returns `res` if the result is `Err`, otherwise returns the `Ok` value of `self`.
- #[inline]
- pub fn or(self, res: Result<T, E>) -> Result<T, E> {
- match self {
- Ok(_) => self,
- Err(_) => res,
- }
- }
+ /// Fails if the value is an `Err`.
+ fn unwrap(self) -> T;
+}
- /// Calls `op` if the result is `Err`, otherwise returns the `Ok` value of `self`.
+/// Temporary trait for unwrapping the error of a result
+pub trait ResultUnwrapErr<T, E> {
+ /// Unwraps a result, yielding the content of an `Err`.
///
- /// This function can be used for control flow based on result values
- #[inline]
- pub fn or_else<F>(self, op: |E| -> Result<T, F>) -> Result<T, F> {
- match self {
- Ok(t) => Ok(t),
- Err(e) => op(e),
- }
- }
-
- /// Unwraps a result, yielding the content of an `Ok`.
- /// Else it returns `optb`.
- #[inline]
- pub fn unwrap_or(self, optb: T) -> T {
- match self {
- Ok(t) => t,
- Err(_) => optb
- }
- }
-
- /// Unwraps a result, yielding the content of an `Ok`.
- /// If the value is an `Err` then it calls `op` with its value.
- #[inline]
- pub fn unwrap_or_handle(self, op: |E| -> T) -> T {
- match self {
- Ok(t) => t,
- Err(e) => op(e)
- }
- }
+ /// Fails if the value is an `Ok`.
+ fn unwrap_err(self) -> E;
}
-impl<T, E: Show> Result<T, E> {
- /// Unwraps a result, yielding the content of an `Ok`.
- ///
- /// Fails if the value is an `Err`.
+impl<T, E: Show> ResultUnwrap<T, E> for Result<T, E> {
#[inline]
- pub fn unwrap(self) -> T {
+ fn unwrap(self) -> T {
match self {
Ok(t) => t,
Err(e) =>
}
}
-impl<T: Show, E> Result<T, E> {
- /// Unwraps a result, yielding the content of an `Err`.
- ///
- /// Fails if the value is an `Ok`.
+impl<T: Show, E> ResultUnwrapErr<T, E> for Result<T, E> {
#[inline]
- pub fn unwrap_err(self) -> E {
+ fn unwrap_err(self) -> E {
match self {
Ok(t) =>
fail!("called `Result::unwrap_err()` on an `Ok` value: {}", t),
}
}
}
-
-/////////////////////////////////////////////////////////////////////////////
-// Free functions
-/////////////////////////////////////////////////////////////////////////////
-
-/// Takes each element in the `Iterator`: if it is an `Err`, no further
-/// elements are taken, and the `Err` is returned. Should no `Err` occur, a
-/// vector containing the values of each `Result` is returned.
-///
-/// Here is an example which increments every integer in a vector,
-/// checking for overflow:
-///
-/// fn inc_conditionally(x: uint) -> Result<uint, &'static str> {
-/// if x == uint::MAX { return Err("overflow"); }
-/// else { return Ok(x+1u); }
-/// }
-/// let v = [1u, 2, 3];
-/// let res = collect(v.iter().map(|&x| inc_conditionally(x)));
-/// assert!(res == Ok(~[2u, 3, 4]));
-#[inline]
-pub fn collect<T, E, Iter: Iterator<Result<T, E>>, V: FromIterator<T>>(iter: Iter) -> Result<V, E> {
- // FIXME(#11084): This should be twice as fast once this bug is closed.
- let mut iter = iter.scan(None, |state, x| {
- match x {
- Ok(x) => Some(x),
- Err(err) => {
- *state = Some(err);
- None
- }
- }
- });
-
- let v: V = FromIterator::from_iter(iter.by_ref());
-
- match iter.state {
- Some(err) => Err(err),
- None => Ok(v),
- }
-}
-
-/// Perform a fold operation over the result values from an iterator.
-///
-/// If an `Err` is encountered, it is immediately returned.
-/// Otherwise, the folded value is returned.
-#[inline]
-pub fn fold<T,
- V,
- E,
- Iter: Iterator<Result<T, E>>>(
- mut iterator: Iter,
- mut init: V,
- f: |V, T| -> V)
- -> Result<V, E> {
- for t in iterator {
- match t {
- Ok(v) => init = f(init, v),
- Err(u) => return Err(u)
- }
- }
- Ok(init)
-}
-
-/// Perform a trivial fold operation over the result values
-/// from an iterator.
-///
-/// If an `Err` is encountered, it is immediately returned.
-/// Otherwise, a simple `Ok(())` is returned.
-#[inline]
-pub fn fold_<T,E,Iter:Iterator<Result<T,E>>>(iterator: Iter) -> Result<(),E> {
- fold(iterator, (), |_, _| ())
-}
-
-/////////////////////////////////////////////////////////////////////////////
-// Tests
-/////////////////////////////////////////////////////////////////////////////
-
-#[cfg(test)]
-mod tests {
- use super::*;
- use prelude::*;
- use str::StrSlice;
-
- use iter::range;
-
- pub fn op1() -> Result<int, ~str> { Ok(666) }
- pub fn op2() -> Result<int, ~str> { Err("sadface".to_owned()) }
-
- #[test]
- pub fn test_and() {
- assert_eq!(op1().and(Ok(667)).unwrap(), 667);
- assert_eq!(op1().and(Err::<(), ~str>("bad".to_owned())).unwrap_err(), "bad".to_owned());
-
- assert_eq!(op2().and(Ok(667)).unwrap_err(), "sadface".to_owned());
- assert_eq!(op2().and(Err::<(), ~str>("bad".to_owned())).unwrap_err(), "sadface".to_owned());
- }
-
- #[test]
- pub fn test_and_then() {
- assert_eq!(op1().and_then(|i| Ok::<int, ~str>(i + 1)).unwrap(), 667);
- assert_eq!(op1().and_then(|_| Err::<int, ~str>("bad".to_owned())).unwrap_err(),
- "bad".to_owned());
-
- assert_eq!(op2().and_then(|i| Ok::<int, ~str>(i + 1)).unwrap_err(),
- "sadface".to_owned());
- assert_eq!(op2().and_then(|_| Err::<int, ~str>("bad".to_owned())).unwrap_err(),
- "sadface".to_owned());
- }
-
- #[test]
- pub fn test_or() {
- assert_eq!(op1().or(Ok(667)).unwrap(), 666);
- assert_eq!(op1().or(Err("bad".to_owned())).unwrap(), 666);
-
- assert_eq!(op2().or(Ok(667)).unwrap(), 667);
- assert_eq!(op2().or(Err("bad".to_owned())).unwrap_err(), "bad".to_owned());
- }
-
- #[test]
- pub fn test_or_else() {
- assert_eq!(op1().or_else(|_| Ok::<int, ~str>(667)).unwrap(), 666);
- assert_eq!(op1().or_else(|e| Err::<int, ~str>(e + "!")).unwrap(), 666);
-
- assert_eq!(op2().or_else(|_| Ok::<int, ~str>(667)).unwrap(), 667);
- assert_eq!(op2().or_else(|e| Err::<int, ~str>(e + "!")).unwrap_err(),
- "sadface!".to_owned());
- }
-
- #[test]
- pub fn test_impl_map() {
- assert_eq!(Ok::<~str, ~str>("a".to_owned()).map(|x| x + "b"), Ok("ab".to_owned()));
- assert_eq!(Err::<~str, ~str>("a".to_owned()).map(|x| x + "b"), Err("a".to_owned()));
- }
-
- #[test]
- pub fn test_impl_map_err() {
- assert_eq!(Ok::<~str, ~str>("a".to_owned()).map_err(|x| x + "b"), Ok("a".to_owned()));
- assert_eq!(Err::<~str, ~str>("a".to_owned()).map_err(|x| x + "b"), Err("ab".to_owned()));
- }
-
- #[test]
- fn test_collect() {
- let v: Result<~[int], ()> = collect(range(0, 0).map(|_| Ok::<int, ()>(0)));
- assert_eq!(v, Ok(box []));
-
- let v: Result<~[int], ()> = collect(range(0, 3).map(|x| Ok::<int, ()>(x)));
- assert_eq!(v, Ok(box [0, 1, 2]));
-
- let v: Result<~[int], int> = collect(range(0, 3)
- .map(|x| if x > 1 { Err(x) } else { Ok(x) }));
- assert_eq!(v, Err(2));
-
- // test that it does not take more elements than it needs
- let mut functions = [|| Ok(()), || Err(1), || fail!()];
-
- let v: Result<~[()], int> = collect(functions.mut_iter().map(|f| (*f)()));
- assert_eq!(v, Err(1));
- }
-
- #[test]
- fn test_fold() {
- assert_eq!(fold_(range(0, 0)
- .map(|_| Ok::<(), ()>(()))),
- Ok(()));
- assert_eq!(fold(range(0, 3)
- .map(|x| Ok::<int, ()>(x)),
- 0, |a, b| a + b),
- Ok(3));
- assert_eq!(fold_(range(0, 3)
- .map(|x| if x > 1 { Err(x) } else { Ok(()) })),
- Err(2));
-
- // test that it does not take more elements than it needs
- let mut functions = [|| Ok(()), || Err(1), || fail!()];
-
- assert_eq!(fold_(functions.mut_iter()
- .map(|f| (*f)())),
- Err(1));
- }
-
- #[test]
- pub fn test_to_str() {
- let ok: Result<int, ~str> = Ok(100);
- let err: Result<int, ~str> = Err("Err".to_owned());
-
- assert_eq!(ok.to_str(), "Ok(100)".to_owned());
- assert_eq!(err.to_str(), "Err(Err)".to_owned());
- }
-
- #[test]
- pub fn test_fmt_default() {
- let ok: Result<int, ~str> = Ok(100);
- let err: Result<int, ~str> = Err("Err".to_owned());
-
- assert_eq!(format!("{}", ok), "Ok(100)".to_owned());
- assert_eq!(format!("{}", err), "Err(Err)".to_owned());
- }
-
- #[test]
- pub fn test_unwrap_or() {
- let ok: Result<int, ~str> = Ok(100);
- let ok_err: Result<int, ~str> = Err("Err".to_owned());
-
- assert_eq!(ok.unwrap_or(50), 100);
- assert_eq!(ok_err.unwrap_or(50), 50);
- }
-
- #[test]
- pub fn test_unwrap_or_else() {
- fn handler(msg: ~str) -> int {
- if msg == "I got this.".to_owned() {
- 50
- } else {
- fail!("BadBad")
- }
- }
-
- let ok: Result<int, ~str> = Ok(100);
- let ok_err: Result<int, ~str> = Err("I got this.".to_owned());
-
- assert_eq!(ok.unwrap_or_handle(handler), 100);
- assert_eq!(ok_err.unwrap_or_handle(handler), 50);
- }
-
- #[test]
- #[should_fail]
- pub fn test_unwrap_or_else_failure() {
- fn handler(msg: ~str) -> int {
- if msg == "I got this.".to_owned() {
- 50
- } else {
- fail!("BadBad")
- }
- }
-
- let bad_err: Result<int, ~str> = Err("Unrecoverable mess.".to_owned());
- let _ : int = bad_err.unwrap_or_handle(handler);
- }
-}
use owned::Box;
use unstable::mutex::{StaticNativeMutex, NATIVE_MUTEX_INIT};
use mem;
- #[cfg(not(test))] use str::StrSlice;
#[cfg(not(test))] use ptr::RawPtr;
static mut global_args_ptr: uint = 0;
//! Runtime environment settings
use from_str::from_str;
-use option::{Some, None};
+use option::{Some, None, Expect};
use os;
// Note that these are all accessed without any synchronization.
pub use self::util::default_sched_threads;
// Export unwinding facilities used by the failure macros
-pub use self::unwind::{begin_unwind, begin_unwind_raw, begin_unwind_fmt};
+pub use self::unwind::{begin_unwind, begin_unwind_fmt};
pub use self::util::{Stdio, Stdout, Stderr};
fn letdie(&mut self) -> IoResult<()>;
fn clone(&self) -> Box<RtioTcpStream:Send>;
fn close_write(&mut self) -> IoResult<()>;
+ fn close_read(&mut self) -> IoResult<()>;
}
pub trait RtioSocket {
fn read(&mut self, buf: &mut [u8]) -> IoResult<uint>;
fn write(&mut self, buf: &[u8]) -> IoResult<()>;
fn clone(&self) -> Box<RtioPipe:Send>;
+
+ fn close_write(&mut self) -> IoResult<()>;
+ fn close_read(&mut self) -> IoResult<()>;
}
pub trait RtioUnixListener {
#[test]
fn rng() {
use rand::{StdRng, Rng};
- let mut r = StdRng::new().unwrap();
+ let mut r = StdRng::new().ok().unwrap();
let _ = r.next_u32();
}
// Currently Rust uses unwind runtime provided by libgcc.
use any::{Any, AnyRefExt};
-use c_str::CString;
use cast;
use fmt;
use kinds::Send;
}
#[cold]
-#[lang="fail_"]
+#[no_mangle]
#[cfg(not(test))]
-pub fn fail_(expr: *u8, file: *u8, line: uint) -> ! {
- begin_unwind_raw(expr, file, line);
-}
-
-#[cold]
-#[lang="fail_bounds_check"]
-#[cfg(not(test))]
-pub fn fail_bounds_check(file: *u8, line: uint, index: uint, len: uint) -> ! {
- use c_str::ToCStr;
+pub extern fn rust_fail_bounds_check(file: *u8, line: uint,
+ index: uint, len: uint) -> ! {
+ use str::raw::c_str_to_static_slice;
let msg = format!("index out of bounds: the len is {} but the index is {}",
len as uint, index as uint);
- msg.with_c_str(|buf| fail_(buf as *u8, file, line))
+ begin_unwind(msg, unsafe { c_str_to_static_slice(file as *i8) }, line)
}
-/// This is the entry point of unwinding for things like lang items and such.
-/// The arguments are normally generated by the compiler, and need to
-/// have static lifetimes.
-#[inline(never)] #[cold] // this is the slow path, please never inline this
-pub fn begin_unwind_raw(msg: *u8, file: *u8, line: uint) -> ! {
- use libc::c_char;
- #[inline]
- fn static_char_ptr(p: *u8) -> &'static str {
- let s = unsafe { CString::new(p as *c_char, false) };
- match s.as_str() {
- Some(s) => unsafe { cast::transmute::<&str, &'static str>(s) },
- None => rtabort!("message wasn't utf8?")
- }
- }
-
- let msg = static_char_ptr(msg);
- let file = static_char_ptr(file);
-
- begin_unwind(msg, file, line as uint)
+// Entry point of failure from the libcore crate
+#[no_mangle]
+#[cfg(not(test))]
+pub extern fn rust_begin_unwind(msg: &str, file: &'static str, line: uint) -> ! {
+ use str::StrAllocating;
+ begin_unwind(msg.to_owned(), file, line)
}
/// The entry point for unwinding with a formatted message.
*/
-use cast;
use cast::transmute;
-use ops::Drop;
+use cast;
use clone::Clone;
-use container::Container;
-use cmp::{Eq, TotalOrd, Ordering, Less, Equal, Greater};
+use cmp::{TotalOrd, Ordering, Less, Greater};
use cmp;
-use default::Default;
-use fmt;
+use container::Container;
use iter::*;
-use num::{CheckedAdd, Saturating, div_rem};
-use num::CheckedMul;
+use mem::size_of;
+use mem;
+use ops::Drop;
use option::{None, Option, Some};
-use ptr;
use ptr::RawPtr;
-use rt::global_heap::{malloc_raw, exchange_free};
-use result::{Ok, Err};
-use mem;
-use mem::size_of;
-use kinds::marker;
+use ptr;
+use rt::global_heap::{exchange_free};
use unstable::finally::try_finally;
-use raw::{Repr, Slice};
-use RawVec = raw::Vec;
use vec::Vec;
-/**
- * Converts a pointer to A into a slice of length 1 (without copying).
- */
-pub fn ref_slice<'a, A>(s: &'a A) -> &'a [A] {
- unsafe {
- transmute(Slice { data: s, len: 1 })
- }
-}
-
-/**
- * Converts a pointer to A into a slice of length 1 (without copying).
- */
-pub fn mut_ref_slice<'a, A>(s: &'a mut A) -> &'a mut [A] {
- unsafe {
- let ptr: *A = transmute(s);
- transmute(Slice { data: ptr, len: 1 })
- }
-}
-
-/// An iterator over the slices of a vector separated by elements that
-/// match a predicate function.
-pub struct Splits<'a, T> {
- v: &'a [T],
- pred: |t: &T|: 'a -> bool,
- finished: bool
-}
-
-impl<'a, T> Iterator<&'a [T]> for Splits<'a, T> {
- #[inline]
- fn next(&mut self) -> Option<&'a [T]> {
- if self.finished { return None; }
-
- match self.v.iter().position(|x| (self.pred)(x)) {
- None => {
- self.finished = true;
- Some(self.v)
- }
- Some(idx) => {
- let ret = Some(self.v.slice(0, idx));
- self.v = self.v.slice(idx + 1, self.v.len());
- ret
- }
- }
- }
-
- #[inline]
- fn size_hint(&self) -> (uint, Option<uint>) {
- if self.finished {
- (0, Some(0))
- } else {
- (1, Some(self.v.len() + 1))
- }
- }
-}
-
-impl<'a, T> DoubleEndedIterator<&'a [T]> for Splits<'a, T> {
- #[inline]
- fn next_back(&mut self) -> Option<&'a [T]> {
- if self.finished { return None; }
-
- match self.v.iter().rposition(|x| (self.pred)(x)) {
- None => {
- self.finished = true;
- Some(self.v)
- }
- Some(idx) => {
- let ret = Some(self.v.slice(idx + 1, self.v.len()));
- self.v = self.v.slice(0, idx);
- ret
- }
- }
- }
-}
-
-/// An iterator over the slices of a vector separated by elements that
-/// match a predicate function, splitting at most a fixed number of times.
-pub struct SplitsN<'a, T> {
- iter: Splits<'a, T>,
- count: uint,
- invert: bool
-}
-
-impl<'a, T> Iterator<&'a [T]> for SplitsN<'a, T> {
- #[inline]
- fn next(&mut self) -> Option<&'a [T]> {
- if self.count == 0 {
- if self.iter.finished {
- None
- } else {
- self.iter.finished = true;
- Some(self.iter.v)
- }
- } else {
- self.count -= 1;
- if self.invert { self.iter.next_back() } else { self.iter.next() }
- }
- }
-
- #[inline]
- fn size_hint(&self) -> (uint, Option<uint>) {
- if self.iter.finished {
- (0, Some(0))
- } else {
- (1, Some(cmp::min(self.count, self.iter.v.len()) + 1))
- }
- }
-}
+pub use core::slice::{ref_slice, mut_ref_slice, Splits, Windows};
+pub use core::slice::{Chunks, Vector, ImmutableVector, ImmutableEqVector};
+pub use core::slice::{ImmutableTotalOrdVector, MutableVector, Items, MutItems};
+pub use core::slice::{RevItems, RevMutItems, MutSplits, MutChunks};
+pub use core::slice::{bytes, MutableCloneableVector};
// Functional utilities
}
}
-/// An iterator over the (overlapping) slices of length `size` within
-/// a vector.
-#[deriving(Clone)]
-pub struct Windows<'a, T> {
- v: &'a [T],
- size: uint
-}
-
-impl<'a, T> Iterator<&'a [T]> for Windows<'a, T> {
- #[inline]
- fn next(&mut self) -> Option<&'a [T]> {
- if self.size > self.v.len() {
- None
- } else {
- let ret = Some(self.v.slice(0, self.size));
- self.v = self.v.slice(1, self.v.len());
- ret
- }
- }
-
- #[inline]
- fn size_hint(&self) -> (uint, Option<uint>) {
- if self.size > self.v.len() {
- (0, Some(0))
- } else {
- let x = self.v.len() - self.size;
- (x.saturating_add(1), x.checked_add(&1u))
- }
- }
-}
-
-/// An iterator over a vector in (non-overlapping) chunks (`size`
-/// elements at a time).
-///
-/// When the vector len is not evenly divided by the chunk size,
-/// the last slice of the iteration will be the remainder.
-#[deriving(Clone)]
-pub struct Chunks<'a, T> {
- v: &'a [T],
- size: uint
-}
-
-impl<'a, T> Iterator<&'a [T]> for Chunks<'a, T> {
- #[inline]
- fn next(&mut self) -> Option<&'a [T]> {
- if self.v.len() == 0 {
- None
- } else {
- let chunksz = cmp::min(self.v.len(), self.size);
- let (fst, snd) = (self.v.slice_to(chunksz),
- self.v.slice_from(chunksz));
- self.v = snd;
- Some(fst)
- }
- }
-
- #[inline]
- fn size_hint(&self) -> (uint, Option<uint>) {
- if self.v.len() == 0 {
- (0, Some(0))
- } else {
- let (n, rem) = div_rem(self.v.len(), self.size);
- let n = if rem > 0 { n+1 } else { n };
- (n, Some(n))
- }
- }
-}
-
-impl<'a, T> DoubleEndedIterator<&'a [T]> for Chunks<'a, T> {
- #[inline]
- fn next_back(&mut self) -> Option<&'a [T]> {
- if self.v.len() == 0 {
- None
- } else {
- let remainder = self.v.len() % self.size;
- let chunksz = if remainder != 0 { remainder } else { self.size };
- let (fst, snd) = (self.v.slice_to(self.v.len() - chunksz),
- self.v.slice_from(self.v.len() - chunksz));
- self.v = fst;
- Some(snd)
- }
- }
-}
-
-impl<'a, T> RandomAccessIterator<&'a [T]> for Chunks<'a, T> {
- #[inline]
- fn indexable(&self) -> uint {
- self.v.len()/self.size + if self.v.len() % self.size != 0 { 1 } else { 0 }
- }
-
- #[inline]
- fn idx(&mut self, index: uint) -> Option<&'a [T]> {
- if index < self.indexable() {
- let lo = index * self.size;
- let mut hi = lo + self.size;
- if hi < lo || hi > self.v.len() { hi = self.v.len(); }
-
- Some(self.v.slice(lo, hi))
- } else {
- None
- }
- }
-}
-
-// Equality
-
-#[cfg(not(test))]
-#[allow(missing_doc)]
-pub mod traits {
- use super::*;
-
- use container::Container;
- use clone::Clone;
- use cmp::{Eq, Ord, TotalEq, TotalOrd, Ordering, Equiv};
- use iter::{order, Iterator};
- use ops::Add;
- use vec::Vec;
-
- impl<'a,T:Eq> Eq for &'a [T] {
- fn eq(&self, other: & &'a [T]) -> bool {
- self.len() == other.len() &&
- order::eq(self.iter(), other.iter())
- }
- fn ne(&self, other: & &'a [T]) -> bool {
- self.len() != other.len() ||
- order::ne(self.iter(), other.iter())
- }
- }
-
- impl<T:Eq> Eq for ~[T] {
- #[inline]
- fn eq(&self, other: &~[T]) -> bool { self.as_slice() == *other }
- #[inline]
- fn ne(&self, other: &~[T]) -> bool { !self.eq(other) }
- }
-
- impl<'a,T:TotalEq> TotalEq for &'a [T] {}
-
- impl<T:TotalEq> TotalEq for ~[T] {}
-
- impl<'a,T:Eq, V: Vector<T>> Equiv<V> for &'a [T] {
- #[inline]
- fn equiv(&self, other: &V) -> bool { self.as_slice() == other.as_slice() }
- }
-
- impl<'a,T:Eq, V: Vector<T>> Equiv<V> for ~[T] {
- #[inline]
- fn equiv(&self, other: &V) -> bool { self.as_slice() == other.as_slice() }
- }
-
- impl<'a,T:TotalOrd> TotalOrd for &'a [T] {
- fn cmp(&self, other: & &'a [T]) -> Ordering {
- order::cmp(self.iter(), other.iter())
- }
- }
-
- impl<T: TotalOrd> TotalOrd for ~[T] {
- #[inline]
- fn cmp(&self, other: &~[T]) -> Ordering { self.as_slice().cmp(&other.as_slice()) }
- }
-
- impl<'a, T: Ord> Ord for &'a [T] {
- fn lt(&self, other: & &'a [T]) -> bool {
- order::lt(self.iter(), other.iter())
- }
- #[inline]
- fn le(&self, other: & &'a [T]) -> bool {
- order::le(self.iter(), other.iter())
- }
- #[inline]
- fn ge(&self, other: & &'a [T]) -> bool {
- order::ge(self.iter(), other.iter())
- }
- #[inline]
- fn gt(&self, other: & &'a [T]) -> bool {
- order::gt(self.iter(), other.iter())
- }
- }
-
- impl<T: Ord> Ord for ~[T] {
- #[inline]
- fn lt(&self, other: &~[T]) -> bool { self.as_slice() < other.as_slice() }
- #[inline]
- fn le(&self, other: &~[T]) -> bool { self.as_slice() <= other.as_slice() }
- #[inline]
- fn ge(&self, other: &~[T]) -> bool { self.as_slice() >= other.as_slice() }
- #[inline]
- fn gt(&self, other: &~[T]) -> bool { self.as_slice() > other.as_slice() }
- }
-
- impl<'a,T:Clone, V: Vector<T>> Add<V, ~[T]> for &'a [T] {
- #[inline]
- fn add(&self, rhs: &V) -> ~[T] {
- let mut res = Vec::with_capacity(self.len() + rhs.as_slice().len());
- res.push_all(*self);
- res.push_all(rhs.as_slice());
- res.move_iter().collect()
- }
- }
-
- impl<T:Clone, V: Vector<T>> Add<V, ~[T]> for ~[T] {
- #[inline]
- fn add(&self, rhs: &V) -> ~[T] {
- self.as_slice() + rhs.as_slice()
- }
- }
-}
-
-#[cfg(test)]
-pub mod traits {}
-
-/// Any vector that can be represented as a slice.
-pub trait Vector<T> {
- /// Work with `self` as a slice.
- fn as_slice<'a>(&'a self) -> &'a [T];
-}
-
-impl<'a,T> Vector<T> for &'a [T] {
- #[inline(always)]
- fn as_slice<'a>(&'a self) -> &'a [T] { *self }
-}
-
-impl<T> Vector<T> for ~[T] {
- #[inline(always)]
- fn as_slice<'a>(&'a self) -> &'a [T] { let v: &'a [T] = *self; v }
-}
-
-impl<'a, T> Container for &'a [T] {
- /// Returns the length of a vector
- #[inline]
- fn len(&self) -> uint {
- self.repr().len
- }
-}
-
-impl<T> Container for ~[T] {
- /// Returns the length of a vector
- #[inline]
- fn len(&self) -> uint {
- self.as_slice().len()
- }
-}
-
/// Extension methods for vector slices with cloneable elements
pub trait CloneableVector<T> {
/// Copy `self` into a new owned vector
fn into_owned(self) -> ~[T] { self }
}
-/// Extension methods for vectors
-pub trait ImmutableVector<'a, T> {
- /**
- * Returns a slice of self between `start` and `end`.
- *
- * Fails when `start` or `end` point outside the bounds of self,
- * or when `start` > `end`.
- */
- fn slice(&self, start: uint, end: uint) -> &'a [T];
+/// Extension methods for vectors containing `Clone` elements.
+pub trait ImmutableCloneableVector<T> {
+ /// Partitions the vector into two vectors `(A,B)`, where all
+ /// elements of `A` satisfy `f` and all elements of `B` do not.
+ fn partitioned(&self, f: |&T| -> bool) -> (~[T], ~[T]);
- /**
- * Returns a slice of self from `start` to the end of the vec.
- *
- * Fails when `start` points outside the bounds of self.
- */
- fn slice_from(&self, start: uint) -> &'a [T];
+ /// Create an iterator that yields every possible permutation of the
+ /// vector in succession.
+ fn permutations(self) -> Permutations<T>;
+}
- /**
- * Returns a slice of self from the start of the vec to `end`.
- *
- * Fails when `end` points outside the bounds of self.
- */
- fn slice_to(&self, end: uint) -> &'a [T];
- /// Returns an iterator over the vector
- fn iter(self) -> Items<'a, T>;
- /// Returns a reversed iterator over a vector
- #[deprecated = "replaced by .iter().rev()"]
- fn rev_iter(self) -> Rev<Items<'a, T>>;
- /// Returns an iterator over the subslices of the vector which are
- /// separated by elements that match `pred`. The matched element
- /// is not contained in the subslices.
- fn split(self, pred: |&T|: 'a -> bool) -> Splits<'a, T>;
- /// Returns an iterator over the subslices of the vector which are
- /// separated by elements that match `pred`, limited to splitting
- /// at most `n` times. The matched element is not contained in
- /// the subslices.
- fn splitn(self, n: uint, pred: |&T|: 'a -> bool) -> SplitsN<'a, T>;
- /// Returns an iterator over the subslices of the vector which are
- /// separated by elements that match `pred`. This starts at the
- /// end of the vector and works backwards. The matched element is
- /// not contained in the subslices.
- #[deprecated = "replaced by .split(pred).rev()"]
- fn rsplit(self, pred: |&T|: 'a -> bool) -> Rev<Splits<'a, T>>;
- /// Returns an iterator over the subslices of the vector which are
- /// separated by elements that match `pred` limited to splitting
- /// at most `n` times. This starts at the end of the vector and
- /// works backwards. The matched element is not contained in the
- /// subslices.
- fn rsplitn(self, n: uint, pred: |&T|: 'a -> bool) -> SplitsN<'a, T>;
+impl<'a,T:Clone> ImmutableCloneableVector<T> for &'a [T] {
+ #[inline]
+ fn partitioned(&self, f: |&T| -> bool) -> (~[T], ~[T]) {
+ let mut lefts = Vec::new();
+ let mut rights = Vec::new();
- /**
- * Returns an iterator over all contiguous windows of length
- * `size`. The windows overlap. If the vector is shorter than
- * `size`, the iterator returns no values.
- *
- * # Failure
- *
- * Fails if `size` is 0.
- *
- * # Example
- *
- * Print the adjacent pairs of a vector (i.e. `[1,2]`, `[2,3]`,
- * `[3,4]`):
- *
- * ```rust
- * let v = &[1,2,3,4];
- * for win in v.windows(2) {
- * println!("{:?}", win);
- * }
- * ```
- *
- */
- fn windows(self, size: uint) -> Windows<'a, T>;
- /**
- *
- * Returns an iterator over `size` elements of the vector at a
- * time. The chunks do not overlap. If `size` does not divide the
- * length of the vector, then the last chunk will not have length
- * `size`.
- *
- * # Failure
- *
- * Fails if `size` is 0.
- *
- * # Example
- *
- * Print the vector two elements at a time (i.e. `[1,2]`,
- * `[3,4]`, `[5]`):
- *
- * ```rust
- * let v = &[1,2,3,4,5];
- * for win in v.chunks(2) {
- * println!("{:?}", win);
- * }
- * ```
- *
- */
- fn chunks(self, size: uint) -> Chunks<'a, T>;
-
- /// Returns the element of a vector at the given index, or `None` if the
- /// index is out of bounds
- fn get(&self, index: uint) -> Option<&'a T>;
- /// Returns the first element of a vector, or `None` if it is empty
- fn head(&self) -> Option<&'a T>;
- /// Returns all but the first element of a vector
- fn tail(&self) -> &'a [T];
- /// Returns all but the first `n' elements of a vector
- fn tailn(&self, n: uint) -> &'a [T];
- /// Returns all but the last element of a vector
- fn init(&self) -> &'a [T];
- /// Returns all but the last `n' elements of a vector
- fn initn(&self, n: uint) -> &'a [T];
- /// Returns the last element of a vector, or `None` if it is empty.
- fn last(&self) -> Option<&'a T>;
-
- /// Returns a pointer to the element at the given index, without doing
- /// bounds checking.
- unsafe fn unsafe_ref(self, index: uint) -> &'a T;
+ for elt in self.iter() {
+ if f(elt) {
+ lefts.push((*elt).clone());
+ } else {
+ rights.push((*elt).clone());
+ }
+ }
- /**
- * Returns an unsafe pointer to the vector's buffer
- *
- * The caller must ensure that the vector outlives the pointer this
- * function returns, or else it will end up pointing to garbage.
- *
- * Modifying the vector may cause its buffer to be reallocated, which
- * would also make any pointers to it invalid.
- */
- fn as_ptr(&self) -> *T;
+ (lefts.move_iter().collect(), rights.move_iter().collect())
+ }
- /**
- * Binary search a sorted vector with a comparator function.
- *
- * The comparator function should implement an order consistent
- * with the sort order of the underlying vector, returning an
- * order code that indicates whether its argument is `Less`,
- * `Equal` or `Greater` the desired target.
- *
- * Returns the index where the comparator returned `Equal`, or `None` if
- * not found.
- */
- fn bsearch(&self, f: |&T| -> Ordering) -> Option<uint>;
+ fn permutations(self) -> Permutations<T> {
+ Permutations{
+ swaps: ElementSwaps::new(self.len()),
+ v: self.to_owned(),
+ }
+ }
- /**
- * Returns a mutable reference to the first element in this slice
- * and adjusts the slice in place so that it no longer contains
- * that element. O(1).
- *
- * Equivalent to:
- *
- * ```ignore
- * if self.len() == 0 { return None }
- * let head = &self[0];
- * *self = self.slice_from(1);
- * Some(head)
- * ```
- *
- * Returns `None` if vector is empty
- */
- fn shift_ref(&mut self) -> Option<&'a T>;
+}
+
+/// Extension methods for owned vectors.
+pub trait OwnedVector<T> {
+ /// Creates a consuming iterator, that is, one that moves each
+ /// value out of the vector (from start to end). The vector cannot
+ /// be used after calling this.
+ ///
+ /// # Examples
+ ///
+ /// ```rust
+ /// let v = ~["a".to_owned(), "b".to_owned()];
+ /// for s in v.move_iter() {
+ /// // s has type ~str, not &~str
+ /// println!("{}", s);
+ /// }
+ /// ```
+ fn move_iter(self) -> MoveItems<T>;
+ /// Creates a consuming iterator that moves out of the vector in
+ /// reverse order.
+ #[deprecated = "replaced by .move_iter().rev()"]
+ fn move_rev_iter(self) -> Rev<MoveItems<T>>;
/**
- * Returns a mutable reference to the last element in this slice
- * and adjusts the slice in place so that it no longer contains
- * that element. O(1).
- *
- * Equivalent to:
- *
- * ```ignore
- * if self.len() == 0 { return None; }
- * let tail = &self[self.len() - 1];
- * *self = self.slice_to(self.len() - 1);
- * Some(tail)
- * ```
- *
- * Returns `None` if slice is empty.
+ * Partitions the vector into two vectors `(A,B)`, where all
+ * elements of `A` satisfy `f` and all elements of `B` do not.
*/
- fn pop_ref(&mut self) -> Option<&'a T>;
+ fn partition(self, f: |&T| -> bool) -> (~[T], ~[T]);
}
-impl<'a,T> ImmutableVector<'a, T> for &'a [T] {
+impl<T> OwnedVector<T> for ~[T] {
#[inline]
- fn slice(&self, start: uint, end: uint) -> &'a [T] {
- assert!(start <= end);
- assert!(end <= self.len());
+ fn move_iter(self) -> MoveItems<T> {
unsafe {
- transmute(Slice {
- data: self.as_ptr().offset(start as int),
- len: (end - start)
- })
+ let iter = transmute(self.iter());
+ let ptr = transmute(self);
+ MoveItems { allocation: ptr, iter: iter }
}
}
#[inline]
- fn slice_from(&self, start: uint) -> &'a [T] {
- self.slice(start, self.len())
- }
-
- #[inline]
- fn slice_to(&self, end: uint) -> &'a [T] {
- self.slice(0, end)
- }
-
- #[inline]
- fn iter(self) -> Items<'a, T> {
- unsafe {
- let p = self.as_ptr();
- if mem::size_of::<T>() == 0 {
- Items{ptr: p,
- end: (p as uint + self.len()) as *T,
- marker: marker::ContravariantLifetime::<'a>}
- } else {
- Items{ptr: p,
- end: p.offset(self.len() as int),
- marker: marker::ContravariantLifetime::<'a>}
- }
- }
- }
-
- #[inline]
- #[deprecated = "replaced by .iter().rev()"]
- fn rev_iter(self) -> Rev<Items<'a, T>> {
- self.iter().rev()
- }
-
- #[inline]
- fn split(self, pred: |&T|: 'a -> bool) -> Splits<'a, T> {
- Splits {
- v: self,
- pred: pred,
- finished: false
- }
- }
-
- #[inline]
- fn splitn(self, n: uint, pred: |&T|: 'a -> bool) -> SplitsN<'a, T> {
- SplitsN {
- iter: self.split(pred),
- count: n,
- invert: false
- }
- }
-
- #[inline]
- #[deprecated = "replaced by .split(pred).rev()"]
- fn rsplit(self, pred: |&T|: 'a -> bool) -> Rev<Splits<'a, T>> {
- self.split(pred).rev()
- }
-
- #[inline]
- fn rsplitn(self, n: uint, pred: |&T|: 'a -> bool) -> SplitsN<'a, T> {
- SplitsN {
- iter: self.split(pred),
- count: n,
- invert: true
- }
- }
-
- #[inline]
- fn windows(self, size: uint) -> Windows<'a, T> {
- assert!(size != 0);
- Windows { v: self, size: size }
- }
-
- #[inline]
- fn chunks(self, size: uint) -> Chunks<'a, T> {
- assert!(size != 0);
- Chunks { v: self, size: size }
- }
-
- #[inline]
- fn get(&self, index: uint) -> Option<&'a T> {
- if index < self.len() { Some(&self[index]) } else { None }
- }
-
- #[inline]
- fn head(&self) -> Option<&'a T> {
- if self.len() == 0 { None } else { Some(&self[0]) }
- }
-
- #[inline]
- fn tail(&self) -> &'a [T] { self.slice(1, self.len()) }
-
- #[inline]
- fn tailn(&self, n: uint) -> &'a [T] { self.slice(n, self.len()) }
-
- #[inline]
- fn init(&self) -> &'a [T] {
- self.slice(0, self.len() - 1)
- }
-
- #[inline]
- fn initn(&self, n: uint) -> &'a [T] {
- self.slice(0, self.len() - n)
- }
-
- #[inline]
- fn last(&self) -> Option<&'a T> {
- if self.len() == 0 { None } else { Some(&self[self.len() - 1]) }
- }
-
- #[inline]
- unsafe fn unsafe_ref(self, index: uint) -> &'a T {
- transmute(self.repr().data.offset(index as int))
- }
-
- #[inline]
- fn as_ptr(&self) -> *T {
- self.repr().data
- }
-
-
- fn bsearch(&self, f: |&T| -> Ordering) -> Option<uint> {
- let mut base : uint = 0;
- let mut lim : uint = self.len();
-
- while lim != 0 {
- let ix = base + (lim >> 1);
- match f(&self[ix]) {
- Equal => return Some(ix),
- Less => {
- base = ix + 1;
- lim -= 1;
- }
- Greater => ()
- }
- lim >>= 1;
- }
- return None;
- }
-
- fn shift_ref(&mut self) -> Option<&'a T> {
- if self.len() == 0 { return None; }
- unsafe {
- let s: &mut Slice<T> = transmute(self);
- Some(&*raw::shift_ptr(s))
- }
- }
-
- fn pop_ref(&mut self) -> Option<&'a T> {
- if self.len() == 0 { return None; }
- unsafe {
- let s: &mut Slice<T> = transmute(self);
- Some(&*raw::pop_ptr(s))
- }
- }
-}
-
-/// Extension methods for vectors contain `Eq` elements.
-pub trait ImmutableEqVector<T:Eq> {
- /// Find the first index containing a matching value
- fn position_elem(&self, t: &T) -> Option<uint>;
-
- /// Find the last index containing a matching value
- fn rposition_elem(&self, t: &T) -> Option<uint>;
-
- /// Return true if a vector contains an element with the given value
- fn contains(&self, x: &T) -> bool;
-
- /// Returns true if `needle` is a prefix of the vector.
- fn starts_with(&self, needle: &[T]) -> bool;
-
- /// Returns true if `needle` is a suffix of the vector.
- fn ends_with(&self, needle: &[T]) -> bool;
-}
-
-impl<'a,T:Eq> ImmutableEqVector<T> for &'a [T] {
- #[inline]
- fn position_elem(&self, x: &T) -> Option<uint> {
- self.iter().position(|y| *x == *y)
- }
-
- #[inline]
- fn rposition_elem(&self, t: &T) -> Option<uint> {
- self.iter().rposition(|x| *x == *t)
- }
-
- #[inline]
- fn contains(&self, x: &T) -> bool {
- self.iter().any(|elt| *x == *elt)
- }
-
- #[inline]
- fn starts_with(&self, needle: &[T]) -> bool {
- let n = needle.len();
- self.len() >= n && needle == self.slice_to(n)
- }
-
- #[inline]
- fn ends_with(&self, needle: &[T]) -> bool {
- let (m, n) = (self.len(), needle.len());
- m >= n && needle == self.slice_from(m - n)
- }
-}
-
-/// Extension methods for vectors containing `TotalOrd` elements.
-pub trait ImmutableTotalOrdVector<T: TotalOrd> {
- /**
- * Binary search a sorted vector for a given element.
- *
- * Returns the index of the element or None if not found.
- */
- fn bsearch_elem(&self, x: &T) -> Option<uint>;
-}
-
-impl<'a, T: TotalOrd> ImmutableTotalOrdVector<T> for &'a [T] {
- fn bsearch_elem(&self, x: &T) -> Option<uint> {
- self.bsearch(|p| p.cmp(x))
- }
-}
-
-/// Extension methods for vectors containing `Clone` elements.
-pub trait ImmutableCloneableVector<T> {
- /// Partitions the vector into two vectors `(A,B)`, where all
- /// elements of `A` satisfy `f` and all elements of `B` do not.
- fn partitioned(&self, f: |&T| -> bool) -> (~[T], ~[T]);
-
- /// Create an iterator that yields every possible permutation of the
- /// vector in succession.
- fn permutations(self) -> Permutations<T>;
-}
-
-impl<'a,T:Clone> ImmutableCloneableVector<T> for &'a [T] {
- #[inline]
- fn partitioned(&self, f: |&T| -> bool) -> (~[T], ~[T]) {
- let mut lefts = Vec::new();
- let mut rights = Vec::new();
-
- for elt in self.iter() {
- if f(elt) {
- lefts.push((*elt).clone());
- } else {
- rights.push((*elt).clone());
- }
- }
-
- (lefts.move_iter().collect(), rights.move_iter().collect())
- }
-
- fn permutations(self) -> Permutations<T> {
- Permutations{
- swaps: ElementSwaps::new(self.len()),
- v: self.to_owned(),
- }
- }
-
-}
-
-/// Extension methods for owned vectors.
-pub trait OwnedVector<T> {
- /// Creates a consuming iterator, that is, one that moves each
- /// value out of the vector (from start to end). The vector cannot
- /// be used after calling this.
- ///
- /// # Examples
- ///
- /// ```rust
- /// let v = ~["a".to_owned(), "b".to_owned()];
- /// for s in v.move_iter() {
- /// // s has type ~str, not &~str
- /// println!("{}", s);
- /// }
- /// ```
- fn move_iter(self) -> MoveItems<T>;
- /// Creates a consuming iterator that moves out of the vector in
- /// reverse order.
- #[deprecated = "replaced by .move_iter().rev()"]
- fn move_rev_iter(self) -> Rev<MoveItems<T>>;
-
- /**
- * Partitions the vector into two vectors `(A,B)`, where all
- * elements of `A` satisfy `f` and all elements of `B` do not.
- */
- fn partition(self, f: |&T| -> bool) -> (~[T], ~[T]);
-}
-
-impl<T> OwnedVector<T> for ~[T] {
- #[inline]
- fn move_iter(self) -> MoveItems<T> {
- unsafe {
- let iter = transmute(self.iter());
- let ptr = transmute(self);
- MoveItems { allocation: ptr, iter: iter }
- }
- }
-
- #[inline]
- #[deprecated = "replaced by .move_iter().rev()"]
- fn move_rev_iter(self) -> Rev<MoveItems<T>> {
- self.move_iter().rev()
+ #[deprecated = "replaced by .move_iter().rev()"]
+ fn move_rev_iter(self) -> Rev<MoveItems<T>> {
+ self.move_iter().rev()
}
#[inline]
/// Extension methods for vectors such that their elements are
/// mutable.
-pub trait MutableVector<'a, T> {
- /// Work with `self` as a mut slice.
- /// Primarily intended for getting a &mut [T] from a [T, ..N].
- fn as_mut_slice(self) -> &'a mut [T];
-
- /// Return a slice that points into another slice.
- fn mut_slice(self, start: uint, end: uint) -> &'a mut [T];
-
- /**
- * Returns a slice of self from `start` to the end of the vec.
- *
- * Fails when `start` points outside the bounds of self.
- */
- fn mut_slice_from(self, start: uint) -> &'a mut [T];
-
- /**
- * Returns a slice of self from the start of the vec to `end`.
- *
- * Fails when `end` points outside the bounds of self.
- */
- fn mut_slice_to(self, end: uint) -> &'a mut [T];
-
- /// Returns an iterator that allows modifying each value
- fn mut_iter(self) -> MutItems<'a, T>;
-
- /// Returns a mutable pointer to the last item in the vector.
- fn mut_last(self) -> Option<&'a mut T>;
-
- /// Returns a reversed iterator that allows modifying each value
- #[deprecated = "replaced by .mut_iter().rev()"]
- fn mut_rev_iter(self) -> Rev<MutItems<'a, T>>;
-
- /// Returns an iterator over the mutable subslices of the vector
- /// which are separated by elements that match `pred`. The
- /// matched element is not contained in the subslices.
- fn mut_split(self, pred: |&T|: 'a -> bool) -> MutSplits<'a, T>;
-
- /**
- * Returns an iterator over `size` elements of the vector at a time.
- * The chunks are mutable and do not overlap. If `size` does not divide the
- * length of the vector, then the last chunk will not have length
- * `size`.
- *
- * # Failure
- *
- * Fails if `size` is 0.
- */
- fn mut_chunks(self, chunk_size: uint) -> MutChunks<'a, T>;
-
- /**
- * Returns a mutable reference to the first element in this slice
- * and adjusts the slice in place so that it no longer contains
- * that element. O(1).
- *
- * Equivalent to:
- *
- * ```ignore
- * if self.len() == 0 { return None; }
- * let head = &mut self[0];
- * *self = self.mut_slice_from(1);
- * Some(head)
- * ```
- *
- * Returns `None` if slice is empty
- */
- fn mut_shift_ref(&mut self) -> Option<&'a mut T>;
-
- /**
- * Returns a mutable reference to the last element in this slice
- * and adjusts the slice in place so that it no longer contains
- * that element. O(1).
- *
- * Equivalent to:
- *
- * ```ignore
- * if self.len() == 0 { return None; }
- * let tail = &mut self[self.len() - 1];
- * *self = self.mut_slice_to(self.len() - 1);
- * Some(tail)
- * ```
- *
- * Returns `None` if slice is empty.
- */
- fn mut_pop_ref(&mut self) -> Option<&'a mut T>;
-
- /// Swaps two elements in a vector.
- ///
- /// Fails if `a` or `b` are out of bounds.
- ///
- /// # Arguments
- ///
- /// * a - The index of the first element
- /// * b - The index of the second element
- ///
- /// # Example
- ///
- /// ```rust
- /// let mut v = ["a", "b", "c", "d"];
- /// v.swap(1, 3);
- /// assert!(v == ["a", "d", "c", "b"]);
- /// ```
- fn swap(self, a: uint, b: uint);
-
-
- /// Divides one `&mut` into two at an index.
- ///
- /// The first will contain all indices from `[0, mid)` (excluding
- /// the index `mid` itself) and the second will contain all
- /// indices from `[mid, len)` (excluding the index `len` itself).
- ///
- /// Fails if `mid > len`.
- ///
- /// # Example
- ///
- /// ```rust
- /// let mut v = [1, 2, 3, 4, 5, 6];
- ///
- /// // scoped to restrict the lifetime of the borrows
- /// {
- /// let (left, right) = v.mut_split_at(0);
- /// assert!(left == &mut []);
- /// assert!(right == &mut [1, 2, 3, 4, 5, 6]);
- /// }
- ///
- /// {
- /// let (left, right) = v.mut_split_at(2);
- /// assert!(left == &mut [1, 2]);
- /// assert!(right == &mut [3, 4, 5, 6]);
- /// }
- ///
- /// {
- /// let (left, right) = v.mut_split_at(6);
- /// assert!(left == &mut [1, 2, 3, 4, 5, 6]);
- /// assert!(right == &mut []);
- /// }
- /// ```
- fn mut_split_at(self, mid: uint) -> (&'a mut [T], &'a mut [T]);
-
- /// Reverse the order of elements in a vector, in place.
- ///
- /// # Example
- ///
- /// ```rust
- /// let mut v = [1, 2, 3];
- /// v.reverse();
- /// assert!(v == [3, 2, 1]);
- /// ```
- fn reverse(self);
-
+pub trait MutableVectorAllocating<'a, T> {
/// Sort the vector, in place, using `compare` to compare
/// elements.
///
* * end - The index into `str` to stop copying from
*/
fn move_from(self, src: ~[T], start: uint, end: uint) -> uint;
-
- /// Returns an unsafe mutable pointer to the element in index
- unsafe fn unsafe_mut_ref(self, index: uint) -> &'a mut T;
-
- /// Return an unsafe mutable pointer to the vector's buffer.
- ///
- /// The caller must ensure that the vector outlives the pointer this
- /// function returns, or else it will end up pointing to garbage.
- ///
- /// Modifying the vector may cause its buffer to be reallocated, which
- /// would also make any pointers to it invalid.
- #[inline]
- fn as_mut_ptr(self) -> *mut T;
-
- /// Unsafely sets the element in index to the value.
- ///
- /// This performs no bounds checks, and it is undefined behaviour
- /// if `index` is larger than the length of `self`. However, it
- /// does run the destructor at `index`. It is equivalent to
- /// `self[index] = val`.
- ///
- /// # Example
- ///
- /// ```rust
- /// let mut v = ~["foo".to_owned(), "bar".to_owned(), "baz".to_owned()];
- ///
- /// unsafe {
- /// // `"baz".to_owned()` is deallocated.
- /// v.unsafe_set(2, "qux".to_owned());
- ///
- /// // Out of bounds: could cause a crash, or overwriting
- /// // other data, or something else.
- /// // v.unsafe_set(10, "oops".to_owned());
- /// }
- /// ```
- unsafe fn unsafe_set(self, index: uint, val: T);
-
- /// Unchecked vector index assignment. Does not drop the
- /// old value and hence is only suitable when the vector
- /// is newly allocated.
- ///
- /// # Example
- ///
- /// ```rust
- /// let mut v = ["foo".to_owned(), "bar".to_owned()];
- ///
- /// // memory leak! `"bar".to_owned()` is not deallocated.
- /// unsafe { v.init_elem(1, "baz".to_owned()); }
- /// ```
- unsafe fn init_elem(self, i: uint, val: T);
-
- /// Copies raw bytes from `src` to `self`.
- ///
- /// This does not run destructors on the overwritten elements, and
- /// ignores move semantics. `self` and `src` must not
- /// overlap. Fails if `self` is shorter than `src`.
- unsafe fn copy_memory(self, src: &[T]);
}
-impl<'a,T> MutableVector<'a, T> for &'a mut [T] {
- #[inline]
- fn as_mut_slice(self) -> &'a mut [T] { self }
-
- fn mut_slice(self, start: uint, end: uint) -> &'a mut [T] {
- assert!(start <= end);
- assert!(end <= self.len());
- unsafe {
- transmute(Slice {
- data: self.as_mut_ptr().offset(start as int) as *T,
- len: (end - start)
- })
- }
- }
-
- #[inline]
- fn mut_slice_from(self, start: uint) -> &'a mut [T] {
- let len = self.len();
- self.mut_slice(start, len)
- }
-
- #[inline]
- fn mut_slice_to(self, end: uint) -> &'a mut [T] {
- self.mut_slice(0, end)
- }
-
- #[inline]
- fn mut_split_at(self, mid: uint) -> (&'a mut [T], &'a mut [T]) {
- unsafe {
- let len = self.len();
- let self2: &'a mut [T] = cast::transmute_copy(&self);
- (self.mut_slice(0, mid), self2.mut_slice(mid, len))
- }
- }
-
- #[inline]
- fn mut_iter(self) -> MutItems<'a, T> {
- unsafe {
- let p = self.as_mut_ptr();
- if mem::size_of::<T>() == 0 {
- MutItems{ptr: p,
- end: (p as uint + self.len()) as *mut T,
- marker: marker::ContravariantLifetime::<'a>,
- marker2: marker::NoCopy}
- } else {
- MutItems{ptr: p,
- end: p.offset(self.len() as int),
- marker: marker::ContravariantLifetime::<'a>,
- marker2: marker::NoCopy}
- }
- }
- }
-
- #[inline]
- fn mut_last(self) -> Option<&'a mut T> {
- let len = self.len();
- if len == 0 { return None; }
- Some(&mut self[len - 1])
- }
-
- #[inline]
- #[deprecated = "replaced by .mut_iter().rev()"]
- fn mut_rev_iter(self) -> Rev<MutItems<'a, T>> {
- self.mut_iter().rev()
- }
-
- #[inline]
- fn mut_split(self, pred: |&T|: 'a -> bool) -> MutSplits<'a, T> {
- MutSplits { v: self, pred: pred, finished: false }
- }
-
- #[inline]
- fn mut_chunks(self, chunk_size: uint) -> MutChunks<'a, T> {
- assert!(chunk_size > 0);
- MutChunks { v: self, chunk_size: chunk_size }
- }
-
- fn mut_shift_ref(&mut self) -> Option<&'a mut T> {
- if self.len() == 0 { return None; }
- unsafe {
- let s: &mut Slice<T> = transmute(self);
- // FIXME #13933: this `&` -> `&mut` cast is a little
- // dubious
- Some(&mut *(raw::shift_ptr(s) as *mut _))
- }
- }
-
- fn mut_pop_ref(&mut self) -> Option<&'a mut T> {
- if self.len() == 0 { return None; }
- unsafe {
- let s: &mut Slice<T> = transmute(self);
- // FIXME #13933: this `&` -> `&mut` cast is a little
- // dubious
- Some(&mut *(raw::pop_ptr(s) as *mut _))
- }
- }
-
- fn swap(self, a: uint, b: uint) {
- unsafe {
- // Can't take two mutable loans from one vector, so instead just cast
- // them to their raw pointers to do the swap
- let pa: *mut T = &mut self[a];
- let pb: *mut T = &mut self[b];
- ptr::swap(pa, pb);
- }
- }
-
- fn reverse(self) {
- let mut i: uint = 0;
- let ln = self.len();
- while i < ln / 2 {
- self.swap(i, ln - i - 1);
- i += 1;
- }
- }
-
+impl<'a,T> MutableVectorAllocating<'a, T> for &'a mut [T] {
#[inline]
fn sort_by(self, compare: |&T, &T| -> Ordering) {
merge_sort(self, compare)
}
cmp::min(self.len(), end-start)
}
-
- #[inline]
- unsafe fn unsafe_mut_ref(self, index: uint) -> &'a mut T {
- transmute((self.repr().data as *mut T).offset(index as int))
- }
-
- #[inline]
- fn as_mut_ptr(self) -> *mut T {
- self.repr().data as *mut T
- }
-
- #[inline]
- unsafe fn unsafe_set(self, index: uint, val: T) {
- *self.unsafe_mut_ref(index) = val;
- }
-
- #[inline]
- unsafe fn init_elem(self, i: uint, val: T) {
- mem::move_val_init(&mut (*self.as_mut_ptr().offset(i as int)), val);
- }
-
- #[inline]
- unsafe fn copy_memory(self, src: &[T]) {
- let len_src = src.len();
- assert!(self.len() >= len_src);
- ptr::copy_nonoverlapping_memory(self.as_mut_ptr(), src.as_ptr(), len_src)
- }
-}
-
-/// Trait for &[T] where T is Cloneable
-pub trait MutableCloneableVector<T> {
- /// Copies as many elements from `src` as it can into `self` (the
- /// shorter of `self.len()` and `src.len()`). Returns the number
- /// of elements copied.
- ///
- /// # Example
- ///
- /// ```rust
- /// use std::slice::MutableCloneableVector;
- ///
- /// let mut dst = [0, 0, 0];
- /// let src = [1, 2];
- ///
- /// assert!(dst.copy_from(src) == 2);
- /// assert!(dst == [1, 2, 0]);
- ///
- /// let src2 = [3, 4, 5, 6];
- /// assert!(dst.copy_from(src2) == 3);
- /// assert!(dst == [3, 4, 5]);
- /// ```
- fn copy_from(self, &[T]) -> uint;
-}
-
-impl<'a, T:Clone> MutableCloneableVector<T> for &'a mut [T] {
- #[inline]
- fn copy_from(self, src: &[T]) -> uint {
- for (a, b) in self.mut_iter().zip(src.iter()) {
- a.clone_from(b);
- }
- cmp::min(self.len(), src.len())
- }
}
/// Methods for mutable vectors with orderable elements, such as
/// ```
fn sort(self);
}
+
impl<'a, T: TotalOrd> MutableTotalOrdVector<T> for &'a mut [T] {
#[inline]
fn sort(self) {
/// Unsafe operations
pub mod raw {
- use cast::transmute;
use iter::Iterator;
- use ptr::RawPtr;
use ptr;
- use raw::Slice;
use slice::{MutableVector, OwnedVector};
use vec::Vec;
- /**
- * Form a slice from a pointer and length (as a number of units,
- * not bytes).
- */
- #[inline]
- pub unsafe fn buf_as_slice<T,U>(p: *T, len: uint, f: |v: &[T]| -> U)
- -> U {
- f(transmute(Slice {
- data: p,
- len: len
- }))
- }
-
- /**
- * Form a slice from a pointer and length (as a number of units,
- * not bytes).
- */
- #[inline]
- pub unsafe fn mut_buf_as_slice<T,
- U>(
- p: *mut T,
- len: uint,
- f: |v: &mut [T]| -> U)
- -> U {
- f(transmute(Slice {
- data: p as *T,
- len: len
- }))
- }
+ pub use core::slice::raw::{buf_as_slice, mut_buf_as_slice};
+ pub use core::slice::raw::{shift_ptr, pop_ptr};
/**
* Constructs a vector from an unsafe pointer to a buffer
ptr::copy_memory(dst.as_mut_ptr(), ptr, elts);
dst.move_iter().collect()
}
-
- /**
- * Returns a pointer to first element in slice and adjusts
- * slice so it no longer contains that element. Fails if
- * slice is empty. O(1).
- */
- pub unsafe fn shift_ptr<T>(slice: &mut Slice<T>) -> *T {
- if slice.len == 0 { fail!("shift on empty slice"); }
- let head: *T = slice.data;
- slice.data = slice.data.offset(1);
- slice.len -= 1;
- head
- }
-
- /**
- * Returns a pointer to last element in slice and adjusts
- * slice so it no longer contains that element. Fails if
- * slice is empty. O(1).
- */
- pub unsafe fn pop_ptr<T>(slice: &mut Slice<T>) -> *T {
- if slice.len == 0 { fail!("pop on empty slice"); }
- let tail: *T = slice.data.offset((slice.len - 1) as int);
- slice.len -= 1;
- tail
- }
-}
-
-/// Operations on `[u8]`.
-pub mod bytes {
- use container::Container;
- use slice::MutableVector;
- use ptr;
-
- /// A trait for operations on mutable `[u8]`s.
- pub trait MutableByteVector {
- /// Sets all bytes of the receiver to the given value.
- fn set_memory(self, value: u8);
- }
-
- impl<'a> MutableByteVector for &'a mut [u8] {
- #[inline]
- fn set_memory(self, value: u8) {
- unsafe { ptr::set_memory(self.as_mut_ptr(), value, self.len()) };
- }
- }
-
- /// Copies data from `src` to `dst`
- ///
- /// `src` and `dst` must not overlap. Fails if the length of `dst`
- /// is less than the length of `src`.
- #[inline]
- pub fn copy_memory(dst: &mut [u8], src: &[u8]) {
- // Bound checks are done at .copy_memory.
- unsafe { dst.copy_memory(src) }
- }
-}
-
-impl<A: Clone> Clone for ~[A] {
- #[inline]
- fn clone(&self) -> ~[A] {
- // Use the fast to_owned on &[A] for cloning
- self.as_slice().to_owned()
- }
-}
-
-impl<'a, T: fmt::Show> fmt::Show for &'a [T] {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- if f.flags & (1 << (fmt::parse::FlagAlternate as uint)) == 0 {
- try!(write!(f.buf, "["));
- }
- let mut is_first = true;
- for x in self.iter() {
- if is_first {
- is_first = false;
- } else {
- try!(write!(f.buf, ", "));
- }
- try!(write!(f.buf, "{}", *x))
- }
- if f.flags & (1 << (fmt::parse::FlagAlternate as uint)) == 0 {
- try!(write!(f.buf, "]"));
- }
- Ok(())
- }
-}
-
-impl<'a, T: fmt::Show> fmt::Show for &'a mut [T] {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- self.as_slice().fmt(f)
- }
-}
-
-impl<T: fmt::Show> fmt::Show for ~[T] {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- self.as_slice().fmt(f)
- }
-}
-
-// This works because every lifetime is a sub-lifetime of 'static
-impl<'a, A> Default for &'a [A] {
- fn default() -> &'a [A] { &'a [] }
-}
-
-impl<A> Default for ~[A] {
- fn default() -> ~[A] { box [] }
-}
-
-/// Immutable slice iterator
-pub struct Items<'a, T> {
- ptr: *T,
- end: *T,
- marker: marker::ContravariantLifetime<'a>
-}
-
-/// Mutable slice iterator
-pub struct MutItems<'a, T> {
- ptr: *mut T,
- end: *mut T,
- marker: marker::ContravariantLifetime<'a>,
- marker2: marker::NoCopy
-}
-
-macro_rules! iterator {
- (struct $name:ident -> $ptr:ty, $elem:ty) => {
- impl<'a, T> Iterator<$elem> for $name<'a, T> {
- #[inline]
- fn next(&mut self) -> Option<$elem> {
- // could be implemented with slices, but this avoids bounds checks
- unsafe {
- if self.ptr == self.end {
- None
- } else {
- let old = self.ptr;
- self.ptr = if mem::size_of::<T>() == 0 {
- // purposefully don't use 'ptr.offset' because for
- // vectors with 0-size elements this would return the
- // same pointer.
- transmute(self.ptr as uint + 1)
- } else {
- self.ptr.offset(1)
- };
-
- Some(transmute(old))
- }
- }
- }
-
- #[inline]
- fn size_hint(&self) -> (uint, Option<uint>) {
- let diff = (self.end as uint) - (self.ptr as uint);
- let exact = diff / mem::nonzero_size_of::<T>();
- (exact, Some(exact))
- }
- }
-
- impl<'a, T> DoubleEndedIterator<$elem> for $name<'a, T> {
- #[inline]
- fn next_back(&mut self) -> Option<$elem> {
- // could be implemented with slices, but this avoids bounds checks
- unsafe {
- if self.end == self.ptr {
- None
- } else {
- self.end = if mem::size_of::<T>() == 0 {
- // See above for why 'ptr.offset' isn't used
- transmute(self.end as uint - 1)
- } else {
- self.end.offset(-1)
- };
- Some(transmute(self.end))
- }
- }
- }
- }
- }
-}
-
-impl<'a, T> RandomAccessIterator<&'a T> for Items<'a, T> {
- #[inline]
- fn indexable(&self) -> uint {
- let (exact, _) = self.size_hint();
- exact
- }
-
- #[inline]
- fn idx(&mut self, index: uint) -> Option<&'a T> {
- unsafe {
- if index < self.indexable() {
- transmute(self.ptr.offset(index as int))
- } else {
- None
- }
- }
- }
-}
-
-iterator!{struct Items -> *T, &'a T}
-#[deprecated = "replaced by Rev<Items<'a, T>>"]
-pub type RevItems<'a, T> = Rev<Items<'a, T>>;
-
-impl<'a, T> ExactSize<&'a T> for Items<'a, T> {}
-impl<'a, T> ExactSize<&'a mut T> for MutItems<'a, T> {}
-
-impl<'a, T> Clone for Items<'a, T> {
- fn clone(&self) -> Items<'a, T> { *self }
-}
-
-iterator!{struct MutItems -> *mut T, &'a mut T}
-#[deprecated = "replaced by Rev<MutItems<'a, T>>"]
-pub type RevMutItems<'a, T> = Rev<MutItems<'a, T>>;
-
-/// An iterator over the subslices of the vector which are separated
-/// by elements that match `pred`.
-pub struct MutSplits<'a, T> {
- v: &'a mut [T],
- pred: |t: &T|: 'a -> bool,
- finished: bool
-}
-
-impl<'a, T> Iterator<&'a mut [T]> for MutSplits<'a, T> {
- #[inline]
- fn next(&mut self) -> Option<&'a mut [T]> {
- if self.finished { return None; }
-
- let pred = &mut self.pred;
- match self.v.iter().position(|x| (*pred)(x)) {
- None => {
- self.finished = true;
- let tmp = mem::replace(&mut self.v, &mut []);
- let len = tmp.len();
- let (head, tail) = tmp.mut_split_at(len);
- self.v = tail;
- Some(head)
- }
- Some(idx) => {
- let tmp = mem::replace(&mut self.v, &mut []);
- let (head, tail) = tmp.mut_split_at(idx);
- self.v = tail.mut_slice_from(1);
- Some(head)
- }
- }
- }
-
- #[inline]
- fn size_hint(&self) -> (uint, Option<uint>) {
- if self.finished {
- (0, Some(0))
- } else {
- // if the predicate doesn't match anything, we yield one slice
- // if it matches every element, we yield len+1 empty slices.
- (1, Some(self.v.len() + 1))
- }
- }
-}
-
-impl<'a, T> DoubleEndedIterator<&'a mut [T]> for MutSplits<'a, T> {
- #[inline]
- fn next_back(&mut self) -> Option<&'a mut [T]> {
- if self.finished { return None; }
-
- let pred = &mut self.pred;
- match self.v.iter().rposition(|x| (*pred)(x)) {
- None => {
- self.finished = true;
- let tmp = mem::replace(&mut self.v, &mut []);
- Some(tmp)
- }
- Some(idx) => {
- let tmp = mem::replace(&mut self.v, &mut []);
- let (head, tail) = tmp.mut_split_at(idx);
- self.v = head;
- Some(tail.mut_slice_from(1))
- }
- }
- }
-}
-
-/// An iterator over a vector in (non-overlapping) mutable chunks (`size` elements at a time). When
-/// the vector len is not evenly divided by the chunk size, the last slice of the iteration will be
-/// the remainder.
-pub struct MutChunks<'a, T> {
- v: &'a mut [T],
- chunk_size: uint
-}
-
-impl<'a, T> Iterator<&'a mut [T]> for MutChunks<'a, T> {
- #[inline]
- fn next(&mut self) -> Option<&'a mut [T]> {
- if self.v.len() == 0 {
- None
- } else {
- let sz = cmp::min(self.v.len(), self.chunk_size);
- let tmp = mem::replace(&mut self.v, &mut []);
- let (head, tail) = tmp.mut_split_at(sz);
- self.v = tail;
- Some(head)
- }
- }
-
- #[inline]
- fn size_hint(&self) -> (uint, Option<uint>) {
- if self.v.len() == 0 {
- (0, Some(0))
- } else {
- let (n, rem) = div_rem(self.v.len(), self.chunk_size);
- let n = if rem > 0 { n + 1 } else { n };
- (n, Some(n))
- }
- }
-}
-
-impl<'a, T> DoubleEndedIterator<&'a mut [T]> for MutChunks<'a, T> {
- #[inline]
- fn next_back(&mut self) -> Option<&'a mut [T]> {
- if self.v.len() == 0 {
- None
- } else {
- let remainder = self.v.len() % self.chunk_size;
- let sz = if remainder != 0 { remainder } else { self.chunk_size };
- let tmp = mem::replace(&mut self.v, &mut []);
- let tmp_len = tmp.len();
- let (head, tail) = tmp.mut_split_at(tmp_len - sz);
- self.v = head;
- Some(tail)
- }
- }
}
/// An iterator that moves out of a vector.
#[deprecated = "replaced by Rev<MoveItems<'a, T>>"]
pub type RevMoveItems<T> = Rev<MoveItems<T>>;
-impl<A> FromIterator<A> for ~[A] {
- fn from_iter<T: Iterator<A>>(mut iterator: T) -> ~[A] {
- let mut xs: Vec<A> = iterator.collect();
-
- // Must shrink so the capacity is the same as the length. The length of
- // the ~[T] vector must exactly match the length of the allocation.
- xs.shrink_to_fit();
-
- let len = xs.len();
- assert!(len == xs.capacity());
- let data = xs.as_mut_ptr();
-
- let data_size = len.checked_mul(&mem::size_of::<A>());
- let data_size = data_size.expect("overflow in from_iter()");
- let size = mem::size_of::<RawVec<()>>().checked_add(&data_size);
- let size = size.expect("overflow in from_iter()");
-
-
- // This is some terribly awful code. Note that all of this will go away
- // with DST because creating ~[T] from Vec<T> will just be some pointer
- // swizzling.
- unsafe {
- let ret = malloc_raw(size) as *mut RawVec<()>;
-
- (*ret).fill = len * mem::nonzero_size_of::<A>();
- (*ret).alloc = len * mem::nonzero_size_of::<A>();
- ptr::copy_nonoverlapping_memory(&mut (*ret).data as *mut _ as *mut u8,
- data as *u8,
- data_size);
- xs.set_len(0); // ownership has been transferred
- cast::transmute(ret)
- }
- }
-}
-
#[cfg(test)]
mod tests {
use prelude::*;
#[test]
#[should_fail]
fn test_from_elem_fail() {
- use cast;
use cell::Cell;
use rc::Rc;
use container::Container;
use fmt;
use io::Writer;
-use iter::{Iterator, FromIterator, Extendable, range};
-use iter::{Filter, AdditiveIterator, Map};
-use iter::{Rev, DoubleEndedIterator, ExactSize};
-use libc;
-use num::Saturating;
+use iter::{Iterator, range, AdditiveIterator};
use option::{None, Option, Some};
use ptr;
use from_str::FromStr;
-use slice;
use slice::{OwnedVector, ImmutableVector, MutableVector};
use slice::{Vector};
use vec::Vec;
use default::Default;
-use raw::Repr;
use strbuf::StrBuf;
+pub use core::str::{from_utf8, CharEq, Chars, CharOffsets, RevChars};
+pub use core::str::{RevCharOffsets, Bytes, RevBytes, CharSplits, RevCharSplits};
+pub use core::str::{CharSplitsN, Words, AnyLines, MatchIndices, StrSplits};
+pub use core::str::{eq_slice, eq, is_utf8, is_utf16, UTF16Items};
+pub use core::str::{UTF16Item, ScalarValue, LoneSurrogate, utf16_items};
+pub use core::str::{truncate_utf16_at_nul, utf8_char_width, CharRange};
+pub use core::str::{Str, StrSlice};
+
/*
Section: Creating a string
*/
}
}
-/// Converts a vector to a string slice without performing any allocations.
-///
-/// Once the slice has been validated as utf-8, it is transmuted in-place and
-/// returned as a '&str' instead of a '&[u8]'
-///
-/// Returns None if the slice is not utf-8.
-pub fn from_utf8<'a>(v: &'a [u8]) -> Option<&'a str> {
- if is_utf8(v) {
- Some(unsafe { raw::from_utf8(v) })
- } else { None }
-}
-
impl FromStr for ~str {
#[inline]
fn from_str(s: &str) -> Option<~str> { Some(s.to_owned()) }
}
}
-/// Something that can be used to compare against a character
-pub trait CharEq {
- /// Determine if the splitter should split at the given character
- fn matches(&mut self, char) -> bool;
- /// Indicate if this is only concerned about ASCII characters,
- /// which can allow for a faster implementation.
- fn only_ascii(&self) -> bool;
-}
-
-impl CharEq for char {
- #[inline]
- fn matches(&mut self, c: char) -> bool { *self == c }
-
- #[inline]
- fn only_ascii(&self) -> bool { (*self as uint) < 128 }
-}
-
-impl<'a> CharEq for |char|: 'a -> bool {
- #[inline]
- fn matches(&mut self, c: char) -> bool { (*self)(c) }
-
- #[inline]
- fn only_ascii(&self) -> bool { false }
-}
-
-impl CharEq for extern "Rust" fn(char) -> bool {
- #[inline]
- fn matches(&mut self, c: char) -> bool { (*self)(c) }
-
- #[inline]
- fn only_ascii(&self) -> bool { false }
-}
-
-impl<'a> CharEq for &'a [char] {
- #[inline]
- fn matches(&mut self, c: char) -> bool {
- self.iter().any(|&mut m| m.matches(c))
- }
-
- #[inline]
- fn only_ascii(&self) -> bool {
- self.iter().all(|m| m.only_ascii())
- }
-}
-
/*
Section: Iterators
*/
-/// External iterator for a string's characters.
-/// Use with the `std::iter` module.
-#[deriving(Clone)]
-pub struct Chars<'a> {
- /// The slice remaining to be iterated
- string: &'a str,
-}
-
-impl<'a> Iterator<char> for Chars<'a> {
- #[inline]
- fn next(&mut self) -> Option<char> {
- // Decode the next codepoint, then update
- // the slice to be just the remaining part
- if self.string.len() != 0 {
- let CharRange {ch, next} = self.string.char_range_at(0);
- unsafe {
- self.string = raw::slice_unchecked(self.string, next, self.string.len());
- }
- Some(ch)
- } else {
- None
- }
- }
-
- #[inline]
- fn size_hint(&self) -> (uint, Option<uint>) {
- (self.string.len().saturating_add(3)/4, Some(self.string.len()))
- }
-}
-
-impl<'a> DoubleEndedIterator<char> for Chars<'a> {
- #[inline]
- fn next_back(&mut self) -> Option<char> {
- if self.string.len() != 0 {
- let CharRange {ch, next} = self.string.char_range_at_reverse(self.string.len());
- unsafe {
- self.string = raw::slice_unchecked(self.string, 0, next);
- }
- Some(ch)
- } else {
- None
- }
- }
-}
-
-/// External iterator for a string's characters and their byte offsets.
-/// Use with the `std::iter` module.
-#[deriving(Clone)]
-pub struct CharOffsets<'a> {
- /// The original string to be iterated
- string: &'a str,
- iter: Chars<'a>,
-}
-
-impl<'a> Iterator<(uint, char)> for CharOffsets<'a> {
- #[inline]
- fn next(&mut self) -> Option<(uint, char)> {
- // Compute the byte offset by using the pointer offset between
- // the original string slice and the iterator's remaining part
- let offset = self.iter.string.as_ptr() as uint - self.string.as_ptr() as uint;
- self.iter.next().map(|ch| (offset, ch))
- }
-
- #[inline]
- fn size_hint(&self) -> (uint, Option<uint>) {
- self.iter.size_hint()
- }
-}
-
-impl<'a> DoubleEndedIterator<(uint, char)> for CharOffsets<'a> {
- #[inline]
- fn next_back(&mut self) -> Option<(uint, char)> {
- self.iter.next_back().map(|ch| {
- let offset = self.iter.string.len() +
- self.iter.string.as_ptr() as uint - self.string.as_ptr() as uint;
- (offset, ch)
- })
- }
-}
-
-#[deprecated = "replaced by Rev<Chars<'a>>"]
-pub type RevChars<'a> = Rev<Chars<'a>>;
-
-#[deprecated = "replaced by Rev<CharOffsets<'a>>"]
-pub type RevCharOffsets<'a> = Rev<CharOffsets<'a>>;
-
-/// External iterator for a string's bytes.
-/// Use with the `std::iter` module.
-pub type Bytes<'a> =
- Map<'a, &'a u8, u8, slice::Items<'a, u8>>;
-
-#[deprecated = "replaced by Rev<Bytes<'a>>"]
-pub type RevBytes<'a> = Rev<Bytes<'a>>;
-
-/// An iterator over the substrings of a string, separated by `sep`.
-#[deriving(Clone)]
-pub struct CharSplits<'a, Sep> {
- /// The slice remaining to be iterated
- string: &'a str,
- sep: Sep,
- /// Whether an empty string at the end is allowed
- allow_trailing_empty: bool,
- only_ascii: bool,
- finished: bool,
-}
-
-#[deprecated = "replaced by Rev<CharSplits<'a, Sep>>"]
-pub type RevCharSplits<'a, Sep> = Rev<CharSplits<'a, Sep>>;
-
-/// An iterator over the substrings of a string, separated by `sep`,
-/// splitting at most `count` times.
-#[deriving(Clone)]
-pub struct CharSplitsN<'a, Sep> {
- iter: CharSplits<'a, Sep>,
- /// The number of splits remaining
- count: uint,
- invert: bool,
-}
-
-/// An iterator over the words of a string, separated by a sequence of whitespace
-pub type Words<'a> =
- Filter<'a, &'a str, CharSplits<'a, extern "Rust" fn(char) -> bool>>;
-
-/// An iterator over the lines of a string, separated by either `\n` or (`\r\n`).
-pub type AnyLines<'a> =
- Map<'a, &'a str, &'a str, CharSplits<'a, char>>;
-
-impl<'a, Sep> CharSplits<'a, Sep> {
- #[inline]
- fn get_end(&mut self) -> Option<&'a str> {
- if !self.finished && (self.allow_trailing_empty || self.string.len() > 0) {
- self.finished = true;
- Some(self.string)
- } else {
- None
- }
- }
-}
-
-impl<'a, Sep: CharEq> Iterator<&'a str> for CharSplits<'a, Sep> {
- #[inline]
- fn next(&mut self) -> Option<&'a str> {
- if self.finished { return None }
-
- let mut next_split = None;
- if self.only_ascii {
- for (idx, byte) in self.string.bytes().enumerate() {
- if self.sep.matches(byte as char) && byte < 128u8 {
- next_split = Some((idx, idx + 1));
- break;
- }
- }
- } else {
- for (idx, ch) in self.string.char_indices() {
- if self.sep.matches(ch) {
- next_split = Some((idx, self.string.char_range_at(idx).next));
- break;
- }
- }
- }
- match next_split {
- Some((a, b)) => unsafe {
- let elt = raw::slice_unchecked(self.string, 0, a);
- self.string = raw::slice_unchecked(self.string, b, self.string.len());
- Some(elt)
- },
- None => self.get_end(),
- }
- }
-}
-
-impl<'a, Sep: CharEq> DoubleEndedIterator<&'a str>
-for CharSplits<'a, Sep> {
- #[inline]
- fn next_back(&mut self) -> Option<&'a str> {
- if self.finished { return None }
-
- if !self.allow_trailing_empty {
- self.allow_trailing_empty = true;
- match self.next_back() {
- Some(elt) if !elt.is_empty() => return Some(elt),
- _ => if self.finished { return None }
- }
- }
- let len = self.string.len();
- let mut next_split = None;
-
- if self.only_ascii {
- for (idx, byte) in self.string.bytes().enumerate().rev() {
- if self.sep.matches(byte as char) && byte < 128u8 {
- next_split = Some((idx, idx + 1));
- break;
- }
- }
- } else {
- for (idx, ch) in self.string.char_indices().rev() {
- if self.sep.matches(ch) {
- next_split = Some((idx, self.string.char_range_at(idx).next));
- break;
- }
- }
- }
- match next_split {
- Some((a, b)) => unsafe {
- let elt = raw::slice_unchecked(self.string, b, len);
- self.string = raw::slice_unchecked(self.string, 0, a);
- Some(elt)
- },
- None => { self.finished = true; Some(self.string) }
- }
- }
-}
-
-impl<'a, Sep: CharEq> Iterator<&'a str> for CharSplitsN<'a, Sep> {
- #[inline]
- fn next(&mut self) -> Option<&'a str> {
- if self.count != 0 {
- self.count -= 1;
- if self.invert { self.iter.next_back() } else { self.iter.next() }
- } else {
- self.iter.get_end()
- }
- }
-}
-
-/// An iterator over the start and end indices of the matches of a
-/// substring within a larger string
-#[deriving(Clone)]
-pub struct MatchIndices<'a> {
- haystack: &'a str,
- needle: &'a str,
- position: uint,
-}
-
-/// An iterator over the substrings of a string separated by a given
-/// search string
-#[deriving(Clone)]
-pub struct StrSplits<'a> {
- it: MatchIndices<'a>,
- last_end: uint,
- finished: bool
-}
-
-impl<'a> Iterator<(uint, uint)> for MatchIndices<'a> {
- #[inline]
- fn next(&mut self) -> Option<(uint, uint)> {
- // See Issue #1932 for why this is a naive search
- let (h_len, n_len) = (self.haystack.len(), self.needle.len());
- let mut match_start = 0;
- let mut match_i = 0;
-
- while self.position < h_len {
- if self.haystack[self.position] == self.needle[match_i] {
- if match_i == 0 { match_start = self.position; }
- match_i += 1;
- self.position += 1;
-
- if match_i == n_len {
- // found a match!
- return Some((match_start, self.position));
- }
- } else {
- // failed match, backtrack
- if match_i > 0 {
- match_i = 0;
- self.position = match_start;
- }
- self.position += 1;
- }
- }
- None
- }
-}
-
-impl<'a> Iterator<&'a str> for StrSplits<'a> {
- #[inline]
- fn next(&mut self) -> Option<&'a str> {
- if self.finished { return None; }
-
- match self.it.next() {
- Some((from, to)) => {
- let ret = Some(self.it.haystack.slice(self.last_end, from));
- self.last_end = to;
- ret
- }
- None => {
- self.finished = true;
- Some(self.it.haystack.slice(self.last_end, self.it.haystack.len()))
- }
- }
- }
-}
-
// Helper functions used for Unicode normalization
fn canonical_sort(comb: &mut [(char, u8)]) {
use iter::range;
result.into_owned()
}
-/*
-Section: Comparing strings
-*/
-
-// share the implementation of the lang-item vs. non-lang-item
-// eq_slice.
-#[inline]
-fn eq_slice_(a: &str, b: &str) -> bool {
- a.len() == b.len() && unsafe {
- libc::memcmp(a.as_ptr() as *libc::c_void,
- b.as_ptr() as *libc::c_void,
- a.len() as libc::size_t) == 0
- }
-}
-
-/// Bytewise slice equality
-#[cfg(not(test))]
-#[lang="str_eq"]
-#[inline]
-pub fn eq_slice(a: &str, b: &str) -> bool {
- eq_slice_(a, b)
-}
-
-/// Bytewise slice equality
-#[cfg(test)]
-#[inline]
-pub fn eq_slice(a: &str, b: &str) -> bool {
- eq_slice_(a, b)
-}
-
-/// Bytewise string equality
-#[cfg(not(test))]
-#[lang="uniq_str_eq"]
-#[inline]
-pub fn eq(a: &~str, b: &~str) -> bool {
- eq_slice(*a, *b)
-}
-
-#[cfg(test)]
-#[inline]
-pub fn eq(a: &~str, b: &~str) -> bool {
- eq_slice(*a, *b)
-}
-
/*
Section: Misc
*/
-/// Walk through `iter` checking that it's a valid UTF-8 sequence,
-/// returning `true` in that case, or, if it is invalid, `false` with
-/// `iter` reset such that it is pointing at the first byte in the
-/// invalid sequence.
-#[inline(always)]
-fn run_utf8_validation_iterator(iter: &mut slice::Items<u8>) -> bool {
- loop {
- // save the current thing we're pointing at.
- let old = *iter;
-
- // restore the iterator we had at the start of this codepoint.
- macro_rules! err ( () => { {*iter = old; return false} });
- macro_rules! next ( () => {
- match iter.next() {
- Some(a) => *a,
- // we needed data, but there was none: error!
- None => err!()
- }
- });
-
- let first = match iter.next() {
- Some(&b) => b,
- // we're at the end of the iterator and a codepoint
- // boundary at the same time, so this string is valid.
- None => return true
- };
-
- // ASCII characters are always valid, so only large
- // bytes need more examination.
- if first >= 128 {
- let w = utf8_char_width(first);
- let second = next!();
- // 2-byte encoding is for codepoints \u0080 to \u07ff
- // first C2 80 last DF BF
- // 3-byte encoding is for codepoints \u0800 to \uffff
- // first E0 A0 80 last EF BF BF
- // excluding surrogates codepoints \ud800 to \udfff
- // ED A0 80 to ED BF BF
- // 4-byte encoding is for codepoints \u10000 to \u10ffff
- // first F0 90 80 80 last F4 8F BF BF
- //
- // Use the UTF-8 syntax from the RFC
- //
- // https://tools.ietf.org/html/rfc3629
- // UTF8-1 = %x00-7F
- // UTF8-2 = %xC2-DF UTF8-tail
- // UTF8-3 = %xE0 %xA0-BF UTF8-tail / %xE1-EC 2( UTF8-tail ) /
- // %xED %x80-9F UTF8-tail / %xEE-EF 2( UTF8-tail )
- // UTF8-4 = %xF0 %x90-BF 2( UTF8-tail ) / %xF1-F3 3( UTF8-tail ) /
- // %xF4 %x80-8F 2( UTF8-tail )
- match w {
- 2 => if second & 192 != TAG_CONT_U8 {err!()},
- 3 => {
- match (first, second, next!() & 192) {
- (0xE0 , 0xA0 .. 0xBF, TAG_CONT_U8) |
- (0xE1 .. 0xEC, 0x80 .. 0xBF, TAG_CONT_U8) |
- (0xED , 0x80 .. 0x9F, TAG_CONT_U8) |
- (0xEE .. 0xEF, 0x80 .. 0xBF, TAG_CONT_U8) => {}
- _ => err!()
- }
- }
- 4 => {
- match (first, second, next!() & 192, next!() & 192) {
- (0xF0 , 0x90 .. 0xBF, TAG_CONT_U8, TAG_CONT_U8) |
- (0xF1 .. 0xF3, 0x80 .. 0xBF, TAG_CONT_U8, TAG_CONT_U8) |
- (0xF4 , 0x80 .. 0x8F, TAG_CONT_U8, TAG_CONT_U8) => {}
- _ => err!()
- }
- }
- _ => err!()
- }
- }
- }
-}
-
-/// Determines if a vector of bytes contains valid UTF-8.
-pub fn is_utf8(v: &[u8]) -> bool {
- run_utf8_validation_iterator(&mut v.iter())
-}
-
-#[inline(always)]
-fn first_non_utf8_index(v: &[u8]) -> Option<uint> {
- let mut it = v.iter();
-
- let ok = run_utf8_validation_iterator(&mut it);
- if ok {
- None
- } else {
- // work out how many valid bytes we've consumed
- // (run_utf8_validation_iterator resets the iterator to just
- // after the last good byte), which we can do because the
- // vector iterator size_hint is exact.
- let (remaining, _) = it.size_hint();
- Some(v.len() - remaining)
- }
-}
-
-/// Determines if a vector of `u16` contains valid UTF-16
-pub fn is_utf16(v: &[u16]) -> bool {
- let mut it = v.iter();
- macro_rules! next ( ($ret:expr) => {
- match it.next() { Some(u) => *u, None => return $ret }
- }
- )
- loop {
- let u = next!(true);
-
- match char::from_u32(u as u32) {
- Some(_) => {}
- None => {
- let u2 = next!(false);
- if u < 0xD7FF || u > 0xDBFF ||
- u2 < 0xDC00 || u2 > 0xDFFF { return false; }
- }
- }
- }
-}
-
-/// An iterator that decodes UTF-16 encoded codepoints from a vector
-/// of `u16`s.
-#[deriving(Clone)]
-pub struct UTF16Items<'a> {
- iter: slice::Items<'a, u16>
-}
-/// The possibilities for values decoded from a `u16` stream.
-#[deriving(Eq, TotalEq, Clone, Show)]
-pub enum UTF16Item {
- /// A valid codepoint.
- ScalarValue(char),
- /// An invalid surrogate without its pair.
- LoneSurrogate(u16)
-}
-
-impl UTF16Item {
- /// Convert `self` to a `char`, taking `LoneSurrogate`s to the
- /// replacement character (U+FFFD).
- #[inline]
- pub fn to_char_lossy(&self) -> char {
- match *self {
- ScalarValue(c) => c,
- LoneSurrogate(_) => '\uFFFD'
- }
- }
-}
-
-impl<'a> Iterator<UTF16Item> for UTF16Items<'a> {
- fn next(&mut self) -> Option<UTF16Item> {
- let u = match self.iter.next() {
- Some(u) => *u,
- None => return None
- };
-
- if u < 0xD800 || 0xDFFF < u {
- // not a surrogate
- Some(ScalarValue(unsafe {cast::transmute(u as u32)}))
- } else if u >= 0xDC00 {
- // a trailing surrogate
- Some(LoneSurrogate(u))
- } else {
- // preserve state for rewinding.
- let old = self.iter;
-
- let u2 = match self.iter.next() {
- Some(u2) => *u2,
- // eof
- None => return Some(LoneSurrogate(u))
- };
- if u2 < 0xDC00 || u2 > 0xDFFF {
- // not a trailing surrogate so we're not a valid
- // surrogate pair, so rewind to redecode u2 next time.
- self.iter = old;
- return Some(LoneSurrogate(u))
- }
-
- // all ok, so lets decode it.
- let c = ((u - 0xD800) as u32 << 10 | (u2 - 0xDC00) as u32) + 0x1_0000;
- Some(ScalarValue(unsafe {cast::transmute(c)}))
- }
- }
-
- #[inline]
- fn size_hint(&self) -> (uint, Option<uint>) {
- let (low, high) = self.iter.size_hint();
- // we could be entirely valid surrogates (2 elements per
- // char), or entirely non-surrogates (1 element per char)
- (low / 2, high)
- }
-}
-
-/// Create an iterator over the UTF-16 encoded codepoints in `v`,
-/// returning invalid surrogates as `LoneSurrogate`s.
-///
-/// # Example
-///
-/// ```rust
-/// use std::str;
-/// use std::str::{ScalarValue, LoneSurrogate};
-///
-/// // 𝄞mus<invalid>ic<invalid>
-/// let v = [0xD834, 0xDD1E, 0x006d, 0x0075,
-/// 0x0073, 0xDD1E, 0x0069, 0x0063,
-/// 0xD834];
-///
-/// assert_eq!(str::utf16_items(v).collect::<~[_]>(),
-/// ~[ScalarValue('𝄞'),
-/// ScalarValue('m'), ScalarValue('u'), ScalarValue('s'),
-/// LoneSurrogate(0xDD1E),
-/// ScalarValue('i'), ScalarValue('c'),
-/// LoneSurrogate(0xD834)]);
-/// ```
-pub fn utf16_items<'a>(v: &'a [u16]) -> UTF16Items<'a> {
- UTF16Items { iter : v.iter() }
-}
-
-/// Return a slice of `v` ending at (and not including) the first NUL
-/// (0).
-///
-/// # Example
-///
-/// ```rust
-/// use std::str;
-///
-/// // "abcd"
-/// let mut v = ['a' as u16, 'b' as u16, 'c' as u16, 'd' as u16];
-/// // no NULs so no change
-/// assert_eq!(str::truncate_utf16_at_nul(v), v.as_slice());
-///
-/// // "ab\0d"
-/// v[2] = 0;
-/// assert_eq!(str::truncate_utf16_at_nul(v),
-/// &['a' as u16, 'b' as u16]);
-/// ```
-pub fn truncate_utf16_at_nul<'a>(v: &'a [u16]) -> &'a [u16] {
- match v.iter().position(|c| *c == 0) {
- // don't include the 0
- Some(i) => v.slice_to(i),
- None => v
- }
-}
-
/// Decode a UTF-16 encoded vector `v` into a string, returning `None`
/// if `v` contains any invalid data.
///
utf16_items(v).map(|c| c.to_char_lossy()).collect()
}
-// https://tools.ietf.org/html/rfc3629
-static UTF8_CHAR_WIDTH: [u8, ..256] = [
-1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
-1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x1F
-1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
-1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x3F
-1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
-1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x5F
-1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
-1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x7F
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0x9F
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0xBF
-0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
-2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, // 0xDF
-3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, // 0xEF
-4,4,4,4,4,0,0,0,0,0,0,0,0,0,0,0, // 0xFF
-];
-
-/// Given a first byte, determine how many bytes are in this UTF-8 character
-#[inline]
-pub fn utf8_char_width(b: u8) -> uint {
- return UTF8_CHAR_WIDTH[b as uint] as uint;
-}
-
-/// Struct that contains a `char` and the index of the first byte of
-/// the next `char` in a string. This can be used as a data structure
-/// for iterating over the UTF-8 bytes of a string.
-pub struct CharRange {
- /// Current `char`
- pub ch: char,
- /// Index of the first byte of the next `char`
- pub next: uint,
-}
-
// Return the initial codepoint accumulator for the first byte.
// The first byte is special, only want bottom 5 bits for width 2, 4 bits
// for width 3, and 3 bits for width 4
/// assert_eq!(output.as_slice(), "Hello \uFFFDWorld");
/// ```
pub fn from_utf8_lossy<'a>(v: &'a [u8]) -> MaybeOwned<'a> {
- let firstbad = match first_non_utf8_index(v) {
- None => return Slice(unsafe { cast::transmute(v) }),
- Some(i) => i
- };
+ if is_utf8(v) {
+ return Slice(unsafe { cast::transmute(v) })
+ }
static REPLACEMENT: &'static [u8] = bytes!(0xEF, 0xBF, 0xBD); // U+FFFD in UTF-8
- let mut i = firstbad;
+ let mut i = 0;
let total = v.len();
fn unsafe_get(xs: &[u8], i: uint) -> u8 {
unsafe { *xs.unsafe_ref(i) }
// subseqidx is the index of the first byte of the subsequence we're looking at.
// It's used to copy a bunch of contiguous good codepoints at once instead of copying
// them one by one.
- let mut subseqidx = firstbad;
+ let mut subseqidx = 0;
while i < total {
let i_ = i;
Owned(ref s) => s.as_slice()
}
}
+}
+impl<'a> StrAllocating for MaybeOwned<'a> {
#[inline]
fn into_owned(self) -> ~str {
match self {
/// Unsafe operations
pub mod raw {
use cast;
- use container::Container;
use iter::Iterator;
use libc;
use ptr::RawPtr;
use ptr;
- use raw::Slice;
- use slice::{MutableVector, ImmutableVector, OwnedVector, Vector};
- use str::{is_utf8, StrSlice};
+ use slice::{MutableVector, OwnedVector, Vector};
+ use str::{is_utf8};
use vec::Vec;
+ pub use core::str::raw::{from_utf8, c_str_to_static_slice, slice_bytes};
+ pub use core::str::raw::{slice_unchecked};
+
/// Create a Rust string from a *u8 buffer of the given length
pub unsafe fn from_buf_len(buf: *u8, len: uint) -> ~str {
let mut v = Vec::with_capacity(len);
from_buf_len(buf as *u8, i as uint)
}
- /// Converts a slice of bytes to a string slice without checking
- /// that the string contains valid UTF-8.
- pub unsafe fn from_utf8<'a>(v: &'a [u8]) -> &'a str {
- cast::transmute(v)
- }
-
/// Converts an owned vector of bytes to a new owned string. This assumes
/// that the utf-8-ness of the vector has already been validated
#[inline]
/// Converts a byte to a string.
pub unsafe fn from_byte(u: u8) -> ~str { from_utf8_owned(box [u]) }
- /// Form a slice from a C string. Unsafe because the caller must ensure the
- /// C string has the static lifetime, or else the return value may be
- /// invalidated later.
- pub unsafe fn c_str_to_static_slice(s: *libc::c_char) -> &'static str {
- let s = s as *u8;
- let mut curr = s;
- let mut len = 0u;
- while *curr != 0u8 {
- len += 1u;
- curr = s.offset(len as int);
- }
- let v = Slice { data: s, len: len };
- assert!(is_utf8(::cast::transmute(v)));
- ::cast::transmute(v)
- }
-
- /// Takes a bytewise (not UTF-8) slice from a string.
- ///
- /// Returns the substring from [`begin`..`end`).
- ///
- /// # Failure
- ///
- /// If begin is greater than end.
- /// If end is greater than the length of the string.
- #[inline]
- pub unsafe fn slice_bytes<'a>(s: &'a str, begin: uint, end: uint) -> &'a str {
- assert!(begin <= end);
- assert!(end <= s.len());
- slice_unchecked(s, begin, end)
- }
-
- /// Takes a bytewise (not UTF-8) slice from a string.
- ///
- /// Returns the substring from [`begin`..`end`).
- ///
- /// Caller must check slice boundaries!
- #[inline]
- pub unsafe fn slice_unchecked<'a>(s: &'a str, begin: uint, end: uint) -> &'a str {
- cast::transmute(Slice {
- data: s.as_ptr().offset(begin as int),
- len: end - begin,
- })
- }
-
- /// Access the str in its vector representation.
- /// The caller must preserve the valid UTF-8 property when modifying.
- #[inline]
- pub unsafe fn as_owned_vec<'a>(s: &'a mut ~str) -> &'a mut ~[u8] {
- cast::transmute(s)
- }
-
- /// Sets the length of a string
- ///
- /// This will explicitly set the size of the string, without actually
- /// modifying its buffers, so it is up to the caller to ensure that
- /// the string is actually the specified size.
- #[test]
- fn test_from_buf_len() {
- unsafe {
- let a = box [65u8, 65u8, 65u8, 65u8, 65u8, 65u8, 65u8, 0u8];
- let b = a.as_ptr();
- let c = from_buf_len(b, 3u);
- assert_eq!(c, "AAA".to_owned());
- }
- }
-}
-
-/*
-Section: Trait implementations
-*/
-
-#[cfg(not(test))]
-#[allow(missing_doc)]
-pub mod traits {
- use container::Container;
- use cmp::{TotalOrd, Ordering, Less, Equal, Greater, Eq, Ord, Equiv, TotalEq};
- use iter::Iterator;
- use ops::Add;
- use option::{Some, None};
- use str::{Str, StrSlice, eq_slice};
- use strbuf::StrBuf;
-
- impl<'a> Add<&'a str,~str> for &'a str {
- #[inline]
- fn add(&self, rhs: & &'a str) -> ~str {
- let mut ret = StrBuf::from_owned_str(self.to_owned());
- ret.push_str(*rhs);
- ret.into_owned()
- }
- }
-
- impl<'a> TotalOrd for &'a str {
- #[inline]
- fn cmp(&self, other: & &'a str) -> Ordering {
- for (s_b, o_b) in self.bytes().zip(other.bytes()) {
- match s_b.cmp(&o_b) {
- Greater => return Greater,
- Less => return Less,
- Equal => ()
- }
- }
-
- self.len().cmp(&other.len())
- }
- }
-
- impl TotalOrd for ~str {
- #[inline]
- fn cmp(&self, other: &~str) -> Ordering { self.as_slice().cmp(&other.as_slice()) }
- }
-
- impl<'a> Eq for &'a str {
- #[inline]
- fn eq(&self, other: & &'a str) -> bool {
- eq_slice((*self), (*other))
- }
- #[inline]
- fn ne(&self, other: & &'a str) -> bool { !(*self).eq(other) }
- }
-
- impl Eq for ~str {
- #[inline]
- fn eq(&self, other: &~str) -> bool {
- eq_slice((*self), (*other))
- }
- }
-
- impl<'a> TotalEq for &'a str {}
-
- impl TotalEq for ~str {}
-
- impl<'a> Ord for &'a str {
- #[inline]
- fn lt(&self, other: & &'a str) -> bool { self.cmp(other) == Less }
- }
-
- impl Ord for ~str {
- #[inline]
- fn lt(&self, other: &~str) -> bool { self.cmp(other) == Less }
- }
-
- impl<'a, S: Str> Equiv<S> for &'a str {
- #[inline]
- fn equiv(&self, other: &S) -> bool { eq_slice(*self, other.as_slice()) }
- }
-
- impl<'a, S: Str> Equiv<S> for ~str {
- #[inline]
- fn equiv(&self, other: &S) -> bool { eq_slice(*self, other.as_slice()) }
- }
-}
-
-#[cfg(test)]
-pub mod traits {}
-
-/// Any string that can be represented as a slice
-pub trait Str {
- /// Work with `self` as a slice.
- fn as_slice<'a>(&'a self) -> &'a str;
-
- /// Convert `self` into a ~str, not making a copy if possible.
- fn into_owned(self) -> ~str;
-
- /// Convert `self` into a `StrBuf`.
- #[inline]
- fn to_strbuf(&self) -> StrBuf {
- StrBuf::from_str(self.as_slice())
- }
-
- /// Convert `self` into a `StrBuf`, not making a copy if possible.
- #[inline]
- fn into_strbuf(self) -> StrBuf {
- StrBuf::from_owned_str(self.into_owned())
- }
-}
-
-impl<'a> Str for &'a str {
- #[inline]
- fn as_slice<'a>(&'a self) -> &'a str { *self }
-
- #[inline]
- fn into_owned(self) -> ~str { self.to_owned() }
-}
-
-impl<'a> Str for ~str {
- #[inline]
- fn as_slice<'a>(&'a self) -> &'a str {
- let s: &'a str = *self; s
- }
-
- #[inline]
- fn into_owned(self) -> ~str { self }
-}
-
-impl<'a> Container for &'a str {
- #[inline]
- fn len(&self) -> uint {
- self.repr().len
- }
-}
-
-impl Container for ~str {
- #[inline]
- fn len(&self) -> uint { self.as_slice().len() }
-}
-
-/// Methods for string slices
-pub trait StrSlice<'a> {
- /// Returns true if one string contains another
- ///
- /// # Arguments
- ///
- /// - needle - The string to look for
- fn contains<'a>(&self, needle: &'a str) -> bool;
-
- /// Returns true if a string contains a char.
- ///
- /// # Arguments
- ///
- /// - needle - The char to look for
- fn contains_char(&self, needle: char) -> bool;
-
- /// An iterator over the characters of `self`. Note, this iterates
- /// over unicode code-points, not unicode graphemes.
- ///
- /// # Example
- ///
- /// ```rust
- /// let v: ~[char] = "abc åäö".chars().collect();
- /// assert_eq!(v, ~['a', 'b', 'c', ' ', 'å', 'ä', 'ö']);
- /// ```
- fn chars(&self) -> Chars<'a>;
-
- /// Do not use this - it is deprecated.
- #[deprecated = "replaced by .chars().rev()"]
- fn chars_rev(&self) -> Rev<Chars<'a>>;
-
- /// An iterator over the bytes of `self`
- fn bytes(&self) -> Bytes<'a>;
-
- /// Do not use this - it is deprecated.
- #[deprecated = "replaced by .bytes().rev()"]
- fn bytes_rev(&self) -> Rev<Bytes<'a>>;
-
- /// An iterator over the characters of `self` and their byte offsets.
- fn char_indices(&self) -> CharOffsets<'a>;
-
- /// Do not use this - it is deprecated.
- #[deprecated = "replaced by .char_indices().rev()"]
- fn char_indices_rev(&self) -> Rev<CharOffsets<'a>>;
-
- /// An iterator over substrings of `self`, separated by characters
- /// matched by `sep`.
- ///
- /// # Example
- ///
- /// ```rust
- /// let v: ~[&str] = "Mary had a little lamb".split(' ').collect();
- /// assert_eq!(v, ~["Mary", "had", "a", "little", "lamb"]);
- ///
- /// let v: ~[&str] = "abc1def2ghi".split(|c: char| c.is_digit()).collect();
- /// assert_eq!(v, ~["abc", "def", "ghi"]);
- ///
- /// let v: ~[&str] = "lionXXtigerXleopard".split('X').collect();
- /// assert_eq!(v, ~["lion", "", "tiger", "leopard"]);
- /// ```
- fn split<Sep: CharEq>(&self, sep: Sep) -> CharSplits<'a, Sep>;
-
- /// An iterator over substrings of `self`, separated by characters
- /// matched by `sep`, restricted to splitting at most `count`
- /// times.
- ///
- /// # Example
- ///
- /// ```rust
- /// let v: ~[&str] = "Mary had a little lambda".splitn(' ', 2).collect();
- /// assert_eq!(v, ~["Mary", "had", "a little lambda"]);
- ///
- /// let v: ~[&str] = "abc1def2ghi".splitn(|c: char| c.is_digit(), 1).collect();
- /// assert_eq!(v, ~["abc", "def2ghi"]);
- ///
- /// let v: ~[&str] = "lionXXtigerXleopard".splitn('X', 2).collect();
- /// assert_eq!(v, ~["lion", "", "tigerXleopard"]);
- /// ```
- fn splitn<Sep: CharEq>(&self, sep: Sep, count: uint) -> CharSplitsN<'a, Sep>;
-
- /// An iterator over substrings of `self`, separated by characters
- /// matched by `sep`.
- ///
- /// Equivalent to `split`, except that the trailing substring
- /// is skipped if empty (terminator semantics).
- ///
- /// # Example
- ///
- /// ```rust
- /// let v: ~[&str] = "A.B.".split_terminator('.').collect();
- /// assert_eq!(v, ~["A", "B"]);
- ///
- /// let v: ~[&str] = "A..B..".split_terminator('.').collect();
- /// assert_eq!(v, ~["A", "", "B", ""]);
- ///
- /// let v: ~[&str] = "Mary had a little lamb".split(' ').rev().collect();
- /// assert_eq!(v, ~["lamb", "little", "a", "had", "Mary"]);
- ///
- /// let v: ~[&str] = "abc1def2ghi".split(|c: char| c.is_digit()).rev().collect();
- /// assert_eq!(v, ~["ghi", "def", "abc"]);
- ///
- /// let v: ~[&str] = "lionXXtigerXleopard".split('X').rev().collect();
- /// assert_eq!(v, ~["leopard", "tiger", "", "lion"]);
- /// ```
- fn split_terminator<Sep: CharEq>(&self, sep: Sep) -> CharSplits<'a, Sep>;
-
- /// Do not use this - it is deprecated.
- #[deprecated = "replaced by .split(sep).rev()"]
- fn rsplit<Sep: CharEq>(&self, sep: Sep) -> Rev<CharSplits<'a, Sep>>;
-
- /// An iterator over substrings of `self`, separated by characters
- /// matched by `sep`, starting from the end of the string.
- /// Restricted to splitting at most `count` times.
- ///
- /// # Example
- ///
- /// ```rust
- /// let v: ~[&str] = "Mary had a little lamb".rsplitn(' ', 2).collect();
- /// assert_eq!(v, ~["lamb", "little", "Mary had a"]);
- ///
- /// let v: ~[&str] = "abc1def2ghi".rsplitn(|c: char| c.is_digit(), 1).collect();
- /// assert_eq!(v, ~["ghi", "abc1def"]);
- ///
- /// let v: ~[&str] = "lionXXtigerXleopard".rsplitn('X', 2).collect();
- /// assert_eq!(v, ~["leopard", "tiger", "lionX"]);
- /// ```
- fn rsplitn<Sep: CharEq>(&self, sep: Sep, count: uint) -> CharSplitsN<'a, Sep>;
-
- /// An iterator over the start and end indices of the disjoint
- /// matches of `sep` within `self`.
- ///
- /// That is, each returned value `(start, end)` satisfies
- /// `self.slice(start, end) == sep`. For matches of `sep` within
- /// `self` that overlap, only the indicies corresponding to the
- /// first match are returned.
- ///
- /// # Example
- ///
- /// ```rust
- /// let v: ~[(uint, uint)] = "abcXXXabcYYYabc".match_indices("abc").collect();
- /// assert_eq!(v, ~[(0,3), (6,9), (12,15)]);
- ///
- /// let v: ~[(uint, uint)] = "1abcabc2".match_indices("abc").collect();
- /// assert_eq!(v, ~[(1,4), (4,7)]);
- ///
- /// let v: ~[(uint, uint)] = "ababa".match_indices("aba").collect();
- /// assert_eq!(v, ~[(0, 3)]); // only the first `aba`
- /// ```
- fn match_indices(&self, sep: &'a str) -> MatchIndices<'a>;
-
- /// An iterator over the substrings of `self` separated by `sep`.
- ///
- /// # Example
- ///
- /// ```rust
- /// let v: ~[&str] = "abcXXXabcYYYabc".split_str("abc").collect();
- /// assert_eq!(v, ~["", "XXX", "YYY", ""]);
- ///
- /// let v: ~[&str] = "1abcabc2".split_str("abc").collect();
- /// assert_eq!(v, ~["1", "", "2"]);
- /// ```
- fn split_str(&self, &'a str) -> StrSplits<'a>;
-
- /// An iterator over the lines of a string (subsequences separated
- /// by `\n`). This does not include the empty string after a
- /// trailing `\n`.
- ///
- /// # Example
- ///
- /// ```rust
- /// let four_lines = "foo\nbar\n\nbaz\n";
- /// let v: ~[&str] = four_lines.lines().collect();
- /// assert_eq!(v, ~["foo", "bar", "", "baz"]);
- /// ```
- fn lines(&self) -> CharSplits<'a, char>;
-
- /// An iterator over the lines of a string, separated by either
- /// `\n` or `\r\n`. As with `.lines()`, this does not include an
- /// empty trailing line.
- ///
- /// # Example
- ///
- /// ```rust
- /// let four_lines = "foo\r\nbar\n\r\nbaz\n";
- /// let v: ~[&str] = four_lines.lines_any().collect();
- /// assert_eq!(v, ~["foo", "bar", "", "baz"]);
- /// ```
- fn lines_any(&self) -> AnyLines<'a>;
-
- /// An iterator over the words of a string (subsequences separated
- /// by any sequence of whitespace). Sequences of whitespace are
- /// collapsed, so empty "words" are not included.
- ///
- /// # Example
- ///
- /// ```rust
- /// let some_words = " Mary had\ta little \n\t lamb";
- /// let v: ~[&str] = some_words.words().collect();
- /// assert_eq!(v, ~["Mary", "had", "a", "little", "lamb"]);
- /// ```
- fn words(&self) -> Words<'a>;
-
- /// An Iterator over the string in Unicode Normalization Form D
- /// (canonical decomposition).
- fn nfd_chars(&self) -> Normalizations<'a>;
-
- /// An Iterator over the string in Unicode Normalization Form KD
- /// (compatibility decomposition).
- fn nfkd_chars(&self) -> Normalizations<'a>;
-
- /// Returns true if the string contains only whitespace.
- ///
- /// Whitespace characters are determined by `char::is_whitespace`.
- ///
- /// # Example
- ///
- /// ```rust
- /// assert!(" \t\n".is_whitespace());
- /// assert!("".is_whitespace());
- ///
- /// assert!( !"abc".is_whitespace());
- /// ```
- fn is_whitespace(&self) -> bool;
-
- /// Returns true if the string contains only alphanumeric code
- /// points.
- ///
- /// Alphanumeric characters are determined by `char::is_alphanumeric`.
- ///
- /// # Example
- ///
- /// ```rust
- /// assert!("Löwe老虎Léopard123".is_alphanumeric());
- /// assert!("".is_alphanumeric());
- ///
- /// assert!( !" &*~".is_alphanumeric());
- /// ```
- fn is_alphanumeric(&self) -> bool;
-
- /// Returns the number of Unicode code points (`char`) that a
- /// string holds.
- ///
- /// This does not perform any normalization, and is `O(n)`, since
- /// UTF-8 is a variable width encoding of code points.
- ///
- /// *Warning*: The number of code points in a string does not directly
- /// correspond to the number of visible characters or width of the
- /// visible text due to composing characters, and double- and
- /// zero-width ones.
- ///
- /// See also `.len()` for the byte length.
- ///
- /// # Example
- ///
- /// ```rust
- /// // composed forms of `ö` and `é`
- /// let c = "Löwe 老虎 Léopard"; // German, Simplified Chinese, French
- /// // decomposed forms of `ö` and `é`
- /// let d = "Lo\u0308we 老虎 Le\u0301opard";
- ///
- /// assert_eq!(c.char_len(), 15);
- /// assert_eq!(d.char_len(), 17);
- ///
- /// assert_eq!(c.len(), 21);
- /// assert_eq!(d.len(), 23);
- ///
- /// // the two strings *look* the same
- /// println!("{}", c);
- /// println!("{}", d);
- /// ```
- fn char_len(&self) -> uint;
-
- /// Returns a slice of the given string from the byte range
- /// [`begin`..`end`).
- ///
- /// This operation is `O(1)`.
- ///
- /// Fails when `begin` and `end` do not point to valid characters
- /// or point beyond the last character of the string.
- ///
- /// See also `slice_to` and `slice_from` for slicing prefixes and
- /// suffixes of strings, and `slice_chars` for slicing based on
- /// code point counts.
- ///
- /// # Example
- ///
- /// ```rust
- /// let s = "Löwe 老虎 Léopard";
- /// assert_eq!(s.slice(0, 1), "L");
- ///
- /// assert_eq!(s.slice(1, 9), "öwe 老");
- ///
- /// // these will fail:
- /// // byte 2 lies within `ö`:
- /// // s.slice(2, 3);
- ///
- /// // byte 8 lies within `老`
- /// // s.slice(1, 8);
- ///
- /// // byte 100 is outside the string
- /// // s.slice(3, 100);
- /// ```
- fn slice(&self, begin: uint, end: uint) -> &'a str;
-
- /// Returns a slice of the string from `begin` to its end.
- ///
- /// Equivalent to `self.slice(begin, self.len())`.
- ///
- /// Fails when `begin` does not point to a valid character, or is
- /// out of bounds.
- ///
- /// See also `slice`, `slice_to` and `slice_chars`.
- fn slice_from(&self, begin: uint) -> &'a str;
-
- /// Returns a slice of the string from the beginning to byte
- /// `end`.
- ///
- /// Equivalent to `self.slice(0, end)`.
- ///
- /// Fails when `end` does not point to a valid character, or is
- /// out of bounds.
- ///
- /// See also `slice`, `slice_from` and `slice_chars`.
- fn slice_to(&self, end: uint) -> &'a str;
-
- /// Returns a slice of the string from the character range
- /// [`begin`..`end`).
- ///
- /// That is, start at the `begin`-th code point of the string and
- /// continue to the `end`-th code point. This does not detect or
- /// handle edge cases such as leaving a combining character as the
- /// first code point of the string.
- ///
- /// Due to the design of UTF-8, this operation is `O(end)`.
- /// See `slice`, `slice_to` and `slice_from` for `O(1)`
- /// variants that use byte indices rather than code point
- /// indices.
- ///
- /// Fails if `begin` > `end` or the either `begin` or `end` are
- /// beyond the last character of the string.
- ///
- /// # Example
- ///
- /// ```rust
- /// let s = "Löwe 老虎 Léopard";
- /// assert_eq!(s.slice_chars(0, 4), "Löwe");
- /// assert_eq!(s.slice_chars(5, 7), "老虎");
- /// ```
- fn slice_chars(&self, begin: uint, end: uint) -> &'a str;
-
- /// Returns true if `needle` is a prefix of the string.
- fn starts_with(&self, needle: &str) -> bool;
-
- /// Returns true if `needle` is a suffix of the string.
- fn ends_with(&self, needle: &str) -> bool;
-
- /// Escape each char in `s` with `char::escape_default`.
- fn escape_default(&self) -> ~str;
-
- /// Escape each char in `s` with `char::escape_unicode`.
- fn escape_unicode(&self) -> ~str;
-
- /// Returns a string with leading and trailing whitespace removed.
- fn trim(&self) -> &'a str;
-
- /// Returns a string with leading whitespace removed.
- fn trim_left(&self) -> &'a str;
-
- /// Returns a string with trailing whitespace removed.
- fn trim_right(&self) -> &'a str;
-
- /// Returns a string with characters that match `to_trim` removed.
- ///
- /// # Arguments
- ///
- /// * to_trim - a character matcher
- ///
- /// # Example
- ///
- /// ```rust
- /// assert_eq!("11foo1bar11".trim_chars('1'), "foo1bar")
- /// assert_eq!("12foo1bar12".trim_chars(&['1', '2']), "foo1bar")
- /// assert_eq!("123foo1bar123".trim_chars(|c: char| c.is_digit()), "foo1bar")
- /// ```
- fn trim_chars<C: CharEq>(&self, to_trim: C) -> &'a str;
-
- /// Returns a string with leading `chars_to_trim` removed.
- ///
- /// # Arguments
- ///
- /// * to_trim - a character matcher
- ///
- /// # Example
- ///
- /// ```rust
- /// assert_eq!("11foo1bar11".trim_left_chars('1'), "foo1bar11")
- /// assert_eq!("12foo1bar12".trim_left_chars(&['1', '2']), "foo1bar12")
- /// assert_eq!("123foo1bar123".trim_left_chars(|c: char| c.is_digit()), "foo1bar123")
- /// ```
- fn trim_left_chars<C: CharEq>(&self, to_trim: C) -> &'a str;
-
- /// Returns a string with trailing `chars_to_trim` removed.
- ///
- /// # Arguments
- ///
- /// * to_trim - a character matcher
- ///
- /// # Example
- ///
- /// ```rust
- /// assert_eq!("11foo1bar11".trim_right_chars('1'), "11foo1bar")
- /// assert_eq!("12foo1bar12".trim_right_chars(&['1', '2']), "12foo1bar")
- /// assert_eq!("123foo1bar123".trim_right_chars(|c: char| c.is_digit()), "123foo1bar")
- /// ```
- fn trim_right_chars<C: CharEq>(&self, to_trim: C) -> &'a str;
-
- /// Replace all occurrences of one string with another.
- ///
- /// # Arguments
- ///
- /// * `from` - The string to replace
- /// * `to` - The replacement string
- ///
- /// # Return value
- ///
- /// The original string with all occurrences of `from` replaced with `to`.
- ///
- /// # Example
- ///
- /// ```rust
- /// let s = "Do you know the muffin man,
- /// The muffin man, the muffin man, ...".to_owned();
- ///
- /// assert_eq!(s.replace("muffin man", "little lamb"),
- /// "Do you know the little lamb,
- /// The little lamb, the little lamb, ...".to_owned());
- ///
- /// // not found, so no change.
- /// assert_eq!(s.replace("cookie monster", "little lamb"), s);
- /// ```
- fn replace(&self, from: &str, to: &str) -> ~str;
-
- /// Copy a slice into a new owned str.
- fn to_owned(&self) -> ~str;
-
- /// Converts to a vector of `u16` encoded as UTF-16.
- fn to_utf16(&self) -> ~[u16];
-
- /// Check that `index`-th byte lies at the start and/or end of a
- /// UTF-8 code point sequence.
- ///
- /// The start and end of the string (when `index == self.len()`)
- /// are considered to be boundaries.
- ///
- /// Fails if `index` is greater than `self.len()`.
- ///
- /// # Example
- ///
- /// ```rust
- /// let s = "Löwe 老虎 Léopard";
- /// assert!(s.is_char_boundary(0));
- /// // start of `老`
- /// assert!(s.is_char_boundary(6));
- /// assert!(s.is_char_boundary(s.len()));
- ///
- /// // second byte of `ö`
- /// assert!(!s.is_char_boundary(2));
- ///
- /// // third byte of `老`
- /// assert!(!s.is_char_boundary(8));
- /// ```
- fn is_char_boundary(&self, index: uint) -> bool;
-
- /// Pluck a character out of a string and return the index of the next
- /// character.
- ///
- /// This function can be used to iterate over the unicode characters of a
- /// string.
- ///
- /// # Example
- ///
- /// This example manually iterate through the characters of a
- /// string; this should normally by done by `.chars()` or
- /// `.char_indices`.
- ///
- /// ```rust
- /// use std::str::CharRange;
- ///
- /// let s = "中华Việt Nam";
- /// let mut i = 0u;
- /// while i < s.len() {
- /// let CharRange {ch, next} = s.char_range_at(i);
- /// println!("{}: {}", i, ch);
- /// i = next;
- /// }
- /// ```
- ///
- /// ## Output
- ///
- /// ```ignore
- /// 0: 中
- /// 3: 华
- /// 6: V
- /// 7: i
- /// 8: ệ
- /// 11: t
- /// 12:
- /// 13: N
- /// 14: a
- /// 15: m
- /// ```
- ///
- /// # Arguments
- ///
- /// * s - The string
- /// * i - The byte offset of the char to extract
- ///
- /// # Return value
- ///
- /// A record {ch: char, next: uint} containing the char value and the byte
- /// index of the next unicode character.
- ///
- /// # Failure
- ///
- /// If `i` is greater than or equal to the length of the string.
- /// If `i` is not the index of the beginning of a valid UTF-8 character.
- fn char_range_at(&self, start: uint) -> CharRange;
-
- /// Given a byte position and a str, return the previous char and its position.
- ///
- /// This function can be used to iterate over a unicode string in reverse.
- ///
- /// Returns 0 for next index if called on start index 0.
- fn char_range_at_reverse(&self, start: uint) -> CharRange;
-
- /// Plucks the character starting at the `i`th byte of a string
- fn char_at(&self, i: uint) -> char;
-
- /// Plucks the character ending at the `i`th byte of a string
- fn char_at_reverse(&self, i: uint) -> char;
-
- /// Work with the byte buffer of a string as a byte slice.
- fn as_bytes(&self) -> &'a [u8];
-
- /// Returns the byte index of the first character of `self` that
- /// matches `search`.
- ///
- /// # Return value
- ///
- /// `Some` containing the byte index of the last matching character
- /// or `None` if there is no match
- ///
- /// # Example
- ///
- /// ```rust
- /// let s = "Löwe 老虎 Léopard";
- ///
- /// assert_eq!(s.find('L'), Some(0));
- /// assert_eq!(s.find('é'), Some(14));
- ///
- /// // the first space
- /// assert_eq!(s.find(|c: char| c.is_whitespace()), Some(5));
- ///
- /// // neither are found
- /// assert_eq!(s.find(&['1', '2']), None);
- /// ```
- fn find<C: CharEq>(&self, search: C) -> Option<uint>;
-
- /// Returns the byte index of the last character of `self` that
- /// matches `search`.
- ///
- /// # Return value
- ///
- /// `Some` containing the byte index of the last matching character
- /// or `None` if there is no match.
- ///
- /// # Example
- ///
- /// ```rust
- /// let s = "Löwe 老虎 Léopard";
- ///
- /// assert_eq!(s.rfind('L'), Some(13));
- /// assert_eq!(s.rfind('é'), Some(14));
- ///
- /// // the second space
- /// assert_eq!(s.rfind(|c: char| c.is_whitespace()), Some(12));
- ///
- /// // searches for an occurrence of either `1` or `2`, but neither are found
- /// assert_eq!(s.rfind(&['1', '2']), None);
- /// ```
- fn rfind<C: CharEq>(&self, search: C) -> Option<uint>;
-
- /// Returns the byte index of the first matching substring
- ///
- /// # Arguments
- ///
- /// * `needle` - The string to search for
- ///
- /// # Return value
- ///
- /// `Some` containing the byte index of the first matching substring
- /// or `None` if there is no match.
- ///
- /// # Example
- ///
- /// ```rust
- /// let s = "Löwe 老虎 Léopard";
- ///
- /// assert_eq!(s.find_str("老虎 L"), Some(6));
- /// assert_eq!(s.find_str("muffin man"), None);
- /// ```
- fn find_str(&self, &str) -> Option<uint>;
-
- /// Given a string, make a new string with repeated copies of it.
- fn repeat(&self, nn: uint) -> ~str;
-
- /// Retrieves the first character from a string slice and returns
- /// it. This does not allocate a new string; instead, it returns a
- /// slice that point one character beyond the character that was
- /// shifted. If the string does not contain any characters,
- /// a tuple of None and an empty string is returned instead.
- ///
- /// # Example
- ///
- /// ```rust
- /// let s = "Löwe 老虎 Léopard";
- /// let (c, s1) = s.slice_shift_char();
- /// assert_eq!(c, Some('L'));
- /// assert_eq!(s1, "öwe 老虎 Léopard");
- ///
- /// let (c, s2) = s1.slice_shift_char();
- /// assert_eq!(c, Some('ö'));
- /// assert_eq!(s2, "we 老虎 Léopard");
- /// ```
- fn slice_shift_char(&self) -> (Option<char>, &'a str);
-
- /// Levenshtein Distance between two strings.
- fn lev_distance(&self, t: &str) -> uint;
-
- /// Returns the byte offset of an inner slice relative to an enclosing outer slice.
- ///
- /// Fails if `inner` is not a direct slice contained within self.
- ///
- /// # Example
- ///
- /// ```rust
- /// let string = "a\nb\nc";
- /// let lines: ~[&str] = string.lines().collect();
- ///
- /// assert!(string.subslice_offset(lines[0]) == 0); // &"a"
- /// assert!(string.subslice_offset(lines[1]) == 2); // &"b"
- /// assert!(string.subslice_offset(lines[2]) == 4); // &"c"
- /// ```
- fn subslice_offset(&self, inner: &str) -> uint;
-
- /// Return an unsafe pointer to the strings buffer.
- ///
- /// The caller must ensure that the string outlives this pointer,
- /// and that it is not reallocated (e.g. by pushing to the
- /// string).
- fn as_ptr(&self) -> *u8;
-}
-
-impl<'a> StrSlice<'a> for &'a str {
- #[inline]
- fn contains<'a>(&self, needle: &'a str) -> bool {
- self.find_str(needle).is_some()
- }
-
- #[inline]
- fn contains_char(&self, needle: char) -> bool {
- self.find(needle).is_some()
- }
-
- #[inline]
- fn chars(&self) -> Chars<'a> {
- Chars{string: *self}
- }
-
- #[inline]
- #[deprecated = "replaced by .chars().rev()"]
- fn chars_rev(&self) -> Rev<Chars<'a>> {
- self.chars().rev()
- }
-
- #[inline]
- fn bytes(&self) -> Bytes<'a> {
- self.as_bytes().iter().map(|&b| b)
- }
-
- #[inline]
- #[deprecated = "replaced by .bytes().rev()"]
- fn bytes_rev(&self) -> Rev<Bytes<'a>> {
- self.bytes().rev()
- }
-
- #[inline]
- fn char_indices(&self) -> CharOffsets<'a> {
- CharOffsets{string: *self, iter: self.chars()}
- }
-
- #[inline]
- #[deprecated = "replaced by .char_indices().rev()"]
- fn char_indices_rev(&self) -> Rev<CharOffsets<'a>> {
- self.char_indices().rev()
- }
-
- #[inline]
- fn split<Sep: CharEq>(&self, sep: Sep) -> CharSplits<'a, Sep> {
- CharSplits {
- string: *self,
- only_ascii: sep.only_ascii(),
- sep: sep,
- allow_trailing_empty: true,
- finished: false,
- }
- }
-
- #[inline]
- fn splitn<Sep: CharEq>(&self, sep: Sep, count: uint)
- -> CharSplitsN<'a, Sep> {
- CharSplitsN {
- iter: self.split(sep),
- count: count,
- invert: false,
- }
- }
-
- #[inline]
- fn split_terminator<Sep: CharEq>(&self, sep: Sep)
- -> CharSplits<'a, Sep> {
- CharSplits {
- allow_trailing_empty: false,
- ..self.split(sep)
- }
- }
-
- #[inline]
- #[deprecated = "replaced by .split(sep).rev()"]
- fn rsplit<Sep: CharEq>(&self, sep: Sep) -> Rev<CharSplits<'a, Sep>> {
- self.split(sep).rev()
- }
-
- #[inline]
- fn rsplitn<Sep: CharEq>(&self, sep: Sep, count: uint)
- -> CharSplitsN<'a, Sep> {
- CharSplitsN {
- iter: self.split(sep),
- count: count,
- invert: true,
- }
- }
-
- #[inline]
- fn match_indices(&self, sep: &'a str) -> MatchIndices<'a> {
- assert!(!sep.is_empty())
- MatchIndices {
- haystack: *self,
- needle: sep,
- position: 0
- }
- }
-
- #[inline]
- fn split_str(&self, sep: &'a str) -> StrSplits<'a> {
- StrSplits {
- it: self.match_indices(sep),
- last_end: 0,
- finished: false
- }
- }
-
- #[inline]
- fn lines(&self) -> CharSplits<'a, char> {
- self.split_terminator('\n')
- }
-
- fn lines_any(&self) -> AnyLines<'a> {
- self.lines().map(|line| {
- let l = line.len();
- if l > 0 && line[l - 1] == '\r' as u8 { line.slice(0, l - 1) }
- else { line }
- })
- }
-
+ /// Access the str in its vector representation.
+ /// The caller must preserve the valid UTF-8 property when modifying.
#[inline]
- fn words(&self) -> Words<'a> {
- self.split(char::is_whitespace).filter(|s| !s.is_empty())
+ pub unsafe fn as_owned_vec<'a>(s: &'a mut ~str) -> &'a mut ~[u8] {
+ cast::transmute(s)
}
- #[inline]
- fn nfd_chars(&self) -> Normalizations<'a> {
- Normalizations {
- iter: self.chars(),
- buffer: Vec::new(),
- sorted: false,
- kind: NFD
- }
- }
+ /// Sets the length of a string
+ ///
+ /// This will explicitly set the size of the string, without actually
+ /// modifying its buffers, so it is up to the caller to ensure that
+ /// the string is actually the specified size.
+ #[test]
+ fn test_from_buf_len() {
+ use slice::ImmutableVector;
+ use str::StrAllocating;
- #[inline]
- fn nfkd_chars(&self) -> Normalizations<'a> {
- Normalizations {
- iter: self.chars(),
- buffer: Vec::new(),
- sorted: false,
- kind: NFKD
+ unsafe {
+ let a = ~[65u8, 65u8, 65u8, 65u8, 65u8, 65u8, 65u8, 0u8];
+ let b = a.as_ptr();
+ let c = from_buf_len(b, 3u);
+ assert_eq!(c, "AAA".to_owned());
}
}
+}
- #[inline]
- fn is_whitespace(&self) -> bool { self.chars().all(char::is_whitespace) }
-
- #[inline]
- fn is_alphanumeric(&self) -> bool { self.chars().all(char::is_alphanumeric) }
-
- #[inline]
- fn char_len(&self) -> uint { self.chars().len() }
-
- #[inline]
- fn slice(&self, begin: uint, end: uint) -> &'a str {
- assert!(self.is_char_boundary(begin) && self.is_char_boundary(end));
- unsafe { raw::slice_bytes(*self, begin, end) }
- }
-
- #[inline]
- fn slice_from(&self, begin: uint) -> &'a str {
- self.slice(begin, self.len())
- }
-
- #[inline]
- fn slice_to(&self, end: uint) -> &'a str {
- assert!(self.is_char_boundary(end));
- unsafe { raw::slice_bytes(*self, 0, end) }
- }
-
- fn slice_chars(&self, begin: uint, end: uint) -> &'a str {
- assert!(begin <= end);
- let mut count = 0;
- let mut begin_byte = None;
- let mut end_byte = None;
-
- // This could be even more efficient by not decoding,
- // only finding the char boundaries
- for (idx, _) in self.char_indices() {
- if count == begin { begin_byte = Some(idx); }
- if count == end { end_byte = Some(idx); break; }
- count += 1;
- }
- if begin_byte.is_none() && count == begin { begin_byte = Some(self.len()) }
- if end_byte.is_none() && count == end { end_byte = Some(self.len()) }
+/*
+Section: Trait implementations
+*/
- match (begin_byte, end_byte) {
- (None, _) => fail!("slice_chars: `begin` is beyond end of string"),
- (_, None) => fail!("slice_chars: `end` is beyond end of string"),
- (Some(a), Some(b)) => unsafe { raw::slice_bytes(*self, a, b) }
- }
- }
+/// Any string that can be represented as a slice
+pub trait StrAllocating: Str {
+ /// Convert `self` into a ~str, not making a copy if possible.
+ fn into_owned(self) -> ~str;
+ /// Convert `self` into a `StrBuf`.
#[inline]
- fn starts_with<'a>(&self, needle: &'a str) -> bool {
- let n = needle.len();
- self.len() >= n && needle.as_bytes() == self.as_bytes().slice_to(n)
+ fn to_strbuf(&self) -> StrBuf {
+ StrBuf::from_str(self.as_slice())
}
+ /// Convert `self` into a `StrBuf`, not making a copy if possible.
#[inline]
- fn ends_with(&self, needle: &str) -> bool {
- let (m, n) = (self.len(), needle.len());
- m >= n && needle.as_bytes() == self.as_bytes().slice_from(m - n)
+ fn into_strbuf(self) -> StrBuf {
+ StrBuf::from_owned_str(self.into_owned())
}
+ /// Escape each char in `s` with `char::escape_default`.
fn escape_default(&self) -> ~str {
- let mut out = StrBuf::with_capacity(self.len());
- for c in self.chars() {
+ let me = self.as_slice();
+ let mut out = StrBuf::with_capacity(me.len());
+ for c in me.chars() {
c.escape_default(|c| out.push_char(c));
}
out.into_owned()
}
+ /// Escape each char in `s` with `char::escape_unicode`.
fn escape_unicode(&self) -> ~str {
- let mut out = StrBuf::with_capacity(self.len());
- for c in self.chars() {
+ let me = self.as_slice();
+ let mut out = StrBuf::with_capacity(me.len());
+ for c in me.chars() {
c.escape_unicode(|c| out.push_char(c));
}
out.into_owned()
}
- #[inline]
- fn trim(&self) -> &'a str {
- self.trim_left().trim_right()
- }
-
- #[inline]
- fn trim_left(&self) -> &'a str {
- self.trim_left_chars(char::is_whitespace)
- }
-
- #[inline]
- fn trim_right(&self) -> &'a str {
- self.trim_right_chars(char::is_whitespace)
- }
-
- #[inline]
- fn trim_chars<C: CharEq>(&self, mut to_trim: C) -> &'a str {
- let cur = match self.find(|c: char| !to_trim.matches(c)) {
- None => "",
- Some(i) => unsafe { raw::slice_bytes(*self, i, self.len()) }
- };
- match cur.rfind(|c: char| !to_trim.matches(c)) {
- None => "",
- Some(i) => {
- let right = cur.char_range_at(i).next;
- unsafe { raw::slice_bytes(cur, 0, right) }
- }
- }
- }
-
- #[inline]
- fn trim_left_chars<C: CharEq>(&self, mut to_trim: C) -> &'a str {
- match self.find(|c: char| !to_trim.matches(c)) {
- None => "",
- Some(first) => unsafe { raw::slice_bytes(*self, first, self.len()) }
- }
- }
-
- #[inline]
- fn trim_right_chars<C: CharEq>(&self, mut to_trim: C) -> &'a str {
- match self.rfind(|c: char| !to_trim.matches(c)) {
- None => "",
- Some(last) => {
- let next = self.char_range_at(last).next;
- unsafe { raw::slice_bytes(*self, 0u, next) }
- }
- }
- }
-
+ /// Replace all occurrences of one string with another.
+ ///
+ /// # Arguments
+ ///
+ /// * `from` - The string to replace
+ /// * `to` - The replacement string
+ ///
+ /// # Return value
+ ///
+ /// The original string with all occurrences of `from` replaced with `to`.
+ ///
+ /// # Example
+ ///
+ /// ```rust
+ /// let s = "Do you know the muffin man,
+ /// The muffin man, the muffin man, ...".to_owned();
+ ///
+ /// assert_eq!(s.replace("muffin man", "little lamb"),
+ /// "Do you know the little lamb,
+ /// The little lamb, the little lamb, ...".to_owned());
+ ///
+ /// // not found, so no change.
+ /// assert_eq!(s.replace("cookie monster", "little lamb"), s);
+ /// ```
fn replace(&self, from: &str, to: &str) -> ~str {
+ let me = self.as_slice();
let mut result = StrBuf::new();
let mut last_end = 0;
- for (start, end) in self.match_indices(from) {
- result.push_str(unsafe{raw::slice_bytes(*self, last_end, start)});
+ for (start, end) in me.match_indices(from) {
+ result.push_str(unsafe{raw::slice_bytes(me, last_end, start)});
result.push_str(to);
last_end = end;
}
- result.push_str(unsafe{raw::slice_bytes(*self, last_end, self.len())});
+ result.push_str(unsafe{raw::slice_bytes(me, last_end, me.len())});
result.into_owned()
}
+ /// Copy a slice into a new owned str.
#[inline]
fn to_owned(&self) -> ~str {
- let len = self.len();
+ let me = self.as_slice();
+ let len = me.len();
unsafe {
let mut v = Vec::with_capacity(len);
- ptr::copy_memory(v.as_mut_ptr(), self.as_ptr(), len);
+ ptr::copy_memory(v.as_mut_ptr(), me.as_ptr(), len);
v.set_len(len);
::cast::transmute(v.move_iter().collect::<~[u8]>())
}
}
+ /// Converts to a vector of `u16` encoded as UTF-16.
fn to_utf16(&self) -> ~[u16] {
+ let me = self.as_slice();
let mut u = Vec::new();;
- for ch in self.chars() {
+ for ch in me.chars() {
let mut buf = [0u16, ..2];
let n = ch.encode_utf16(buf /* as mut slice! */);
u.push_all(buf.slice_to(n));
u.move_iter().collect()
}
- #[inline]
- fn is_char_boundary(&self, index: uint) -> bool {
- if index == self.len() { return true; }
- let b = self[index];
- return b < 128u8 || b >= 192u8;
- }
-
- #[inline]
- fn char_range_at(&self, i: uint) -> CharRange {
- if self[i] < 128u8 {
- return CharRange {ch: self[i] as char, next: i + 1 };
- }
-
- // Multibyte case is a fn to allow char_range_at to inline cleanly
- fn multibyte_char_range_at(s: &str, i: uint) -> CharRange {
- let mut val = s[i] as u32;
- let w = UTF8_CHAR_WIDTH[val as uint] as uint;
- assert!((w != 0));
-
- val = utf8_first_byte!(val, w);
- val = utf8_acc_cont_byte!(val, s[i + 1]);
- if w > 2 { val = utf8_acc_cont_byte!(val, s[i + 2]); }
- if w > 3 { val = utf8_acc_cont_byte!(val, s[i + 3]); }
-
- return CharRange {ch: unsafe { transmute(val) }, next: i + w};
- }
-
- return multibyte_char_range_at(*self, i);
- }
-
- #[inline]
- fn char_range_at_reverse(&self, start: uint) -> CharRange {
- let mut prev = start;
-
- prev = prev.saturating_sub(1);
- if self[prev] < 128 { return CharRange{ch: self[prev] as char, next: prev} }
-
- // Multibyte case is a fn to allow char_range_at_reverse to inline cleanly
- fn multibyte_char_range_at_reverse(s: &str, mut i: uint) -> CharRange {
- // while there is a previous byte == 10......
- while i > 0 && s[i] & 192u8 == TAG_CONT_U8 {
- i -= 1u;
- }
-
- let mut val = s[i] as u32;
- let w = UTF8_CHAR_WIDTH[val as uint] as uint;
- assert!((w != 0));
-
- val = utf8_first_byte!(val, w);
- val = utf8_acc_cont_byte!(val, s[i + 1]);
- if w > 2 { val = utf8_acc_cont_byte!(val, s[i + 2]); }
- if w > 3 { val = utf8_acc_cont_byte!(val, s[i + 3]); }
-
- return CharRange {ch: unsafe { transmute(val) }, next: i};
- }
-
- return multibyte_char_range_at_reverse(*self, prev);
- }
-
- #[inline]
- fn char_at(&self, i: uint) -> char {
- self.char_range_at(i).ch
- }
-
- #[inline]
- fn char_at_reverse(&self, i: uint) -> char {
- self.char_range_at_reverse(i).ch
- }
-
- #[inline]
- fn as_bytes(&self) -> &'a [u8] {
- unsafe { cast::transmute(*self) }
- }
-
- fn find<C: CharEq>(&self, mut search: C) -> Option<uint> {
- if search.only_ascii() {
- self.bytes().position(|b| search.matches(b as char))
- } else {
- for (index, c) in self.char_indices() {
- if search.matches(c) { return Some(index); }
- }
- None
- }
- }
-
- fn rfind<C: CharEq>(&self, mut search: C) -> Option<uint> {
- if search.only_ascii() {
- self.bytes().rposition(|b| search.matches(b as char))
- } else {
- for (index, c) in self.char_indices().rev() {
- if search.matches(c) { return Some(index); }
- }
- None
- }
- }
-
- fn find_str(&self, needle: &str) -> Option<uint> {
- if needle.is_empty() {
- Some(0)
- } else {
- self.match_indices(needle)
- .next()
- .map(|(start, _end)| start)
- }
- }
-
+ /// Given a string, make a new string with repeated copies of it.
fn repeat(&self, nn: uint) -> ~str {
- let mut ret = StrBuf::with_capacity(nn * self.len());
+ let me = self.as_slice();
+ let mut ret = StrBuf::with_capacity(nn * me.len());
for _ in range(0, nn) {
- ret.push_str(*self);
+ ret.push_str(me);
}
ret.into_owned()
}
- #[inline]
- fn slice_shift_char(&self) -> (Option<char>, &'a str) {
- if self.is_empty() {
- return (None, *self);
- } else {
- let CharRange {ch, next} = self.char_range_at(0u);
- let next_s = unsafe { raw::slice_bytes(*self, next, self.len()) };
- return (Some(ch), next_s);
- }
- }
-
+ /// Levenshtein Distance between two strings.
fn lev_distance(&self, t: &str) -> uint {
- let slen = self.len();
+ let me = self.as_slice();
+ let slen = me.len();
let tlen = t.len();
if slen == 0 { return tlen; }
let mut dcol = Vec::from_fn(tlen + 1, |x| x);
- for (i, sc) in self.chars().enumerate() {
+ for (i, sc) in me.chars().enumerate() {
let mut current = i;
*dcol.get_mut(0) = current + 1;
return *dcol.get(tlen);
}
- fn subslice_offset(&self, inner: &str) -> uint {
- let a_start = self.as_ptr() as uint;
- let a_end = a_start + self.len();
- let b_start = inner.as_ptr() as uint;
- let b_end = b_start + inner.len();
-
- assert!(a_start <= b_start);
- assert!(b_end <= a_end);
- b_start - a_start
+ /// An Iterator over the string in Unicode Normalization Form D
+ /// (canonical decomposition).
+ #[inline]
+ fn nfd_chars<'a>(&'a self) -> Normalizations<'a> {
+ Normalizations {
+ iter: self.as_slice().chars(),
+ buffer: Vec::new(),
+ sorted: false,
+ kind: NFD
+ }
}
+ /// An Iterator over the string in Unicode Normalization Form KD
+ /// (compatibility decomposition).
#[inline]
- fn as_ptr(&self) -> *u8 {
- self.repr().data
+ fn nfkd_chars<'a>(&'a self) -> Normalizations<'a> {
+ Normalizations {
+ iter: self.as_slice().chars(),
+ buffer: Vec::new(),
+ sorted: false,
+ kind: NFKD
+ }
}
}
+impl<'a> StrAllocating for &'a str {
+ #[inline]
+ fn into_owned(self) -> ~str { self.to_owned() }
+}
+
+impl<'a> StrAllocating for ~str {
+ #[inline]
+ fn into_owned(self) -> ~str { self }
+}
+
/// Methods for owned strings
pub trait OwnedStr {
/// Consumes the string, returning the underlying byte buffer.
}
}
-impl Clone for ~str {
- #[inline]
- fn clone(&self) -> ~str {
- self.to_owned()
- }
-}
-
-impl FromIterator<char> for ~str {
- #[inline]
- fn from_iter<T: Iterator<char>>(iterator: T) -> ~str {
- let (lower, _) = iterator.size_hint();
- let mut buf = StrBuf::with_capacity(lower);
- buf.extend(iterator);
- buf.into_owned()
- }
-}
-
-// This works because every lifetime is a sub-lifetime of 'static
-impl<'a> Default for &'a str {
- fn default() -> &'a str { "" }
-}
-
-impl Default for ~str {
- fn default() -> ~str { "".to_owned() }
-}
-
#[cfg(test)]
mod tests {
use iter::AdditiveIterator;
use option::{None, Option, Some};
use ptr::RawPtr;
use slice::{OwnedVector, Vector};
+use str::{OwnedStr, Str, StrSlice, StrAllocating};
use str;
-use str::{OwnedStr, Str, StrSlice};
use vec::Vec;
/// A growable string stored as a UTF-8 encoded buffer.
cast::transmute(self.vec.as_slice())
}
}
+}
+impl StrAllocating for StrBuf {
#[inline]
fn into_owned(self) -> ~str {
let StrBuf {
#[cfg(test)]
mod tests {
use prelude::*;
- use option::*;
use super::Queue;
use native;
#[cfg(test)] use any::{AnyOwnExt, AnyRefExt};
#[cfg(test)] use result;
-#[cfg(test)] use str::StrSlice;
+#[cfg(test)] use str::StrAllocating;
+#[cfg(test)] use realstd::result::ResultUnwrap;
/// Indicates the manner in which a task exited.
///
#[cfg(test)]
mod tests {
use super::*;
- use str::StrSlice;
+ use str::StrAllocating;
#[test]
fn test_simple_types() {
+++ /dev/null
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-//! Operations on tuples
-
-#![allow(missing_doc)]
-
-use clone::Clone;
-#[cfg(not(test))] use cmp::*;
-#[cfg(not(test))] use default::Default;
-use fmt;
-use result::{Ok, Err};
-
-// macro for implementing n-ary tuple functions and operations
-macro_rules! tuple_impls {
- ($(
- $Tuple:ident {
- $(($valN:ident, $refN:ident, $mutN:ident) -> $T:ident {
- ($($x:ident),+) => $ret:expr
- })+
- }
- )+) => {
- $(
- pub trait $Tuple<$($T),+> {
- $(fn $valN(self) -> $T;)+
- $(fn $refN<'a>(&'a self) -> &'a $T;)+
- $(fn $mutN<'a>(&'a mut self) -> &'a mut $T;)+
- }
-
- impl<$($T),+> $Tuple<$($T),+> for ($($T,)+) {
- $(
- #[inline]
- #[allow(unused_variable)]
- fn $valN(self) -> $T {
- let ($($x,)+) = self; $ret
- }
-
- #[inline]
- #[allow(unused_variable)]
- fn $refN<'a>(&'a self) -> &'a $T {
- let ($(ref $x,)+) = *self; $ret
- }
-
- #[inline]
- #[allow(unused_variable)]
- fn $mutN<'a>(&'a mut self) -> &'a mut $T {
- let ($(ref mut $x,)+) = *self; $ret
- }
- )+
- }
-
- impl<$($T:Clone),+> Clone for ($($T,)+) {
- fn clone(&self) -> ($($T,)+) {
- ($(self.$refN().clone(),)+)
- }
- }
-
- #[cfg(not(test))]
- impl<$($T:Eq),+> Eq for ($($T,)+) {
- #[inline]
- fn eq(&self, other: &($($T,)+)) -> bool {
- $(*self.$refN() == *other.$refN())&&+
- }
- #[inline]
- fn ne(&self, other: &($($T,)+)) -> bool {
- $(*self.$refN() != *other.$refN())||+
- }
- }
-
- #[cfg(not(test))]
- impl<$($T:TotalEq),+> TotalEq for ($($T,)+) {}
-
- #[cfg(not(test))]
- impl<$($T:Ord + Eq),+> Ord for ($($T,)+) {
- #[inline]
- fn lt(&self, other: &($($T,)+)) -> bool {
- lexical_ord!(lt, $(self.$refN(), other.$refN()),+)
- }
- #[inline]
- fn le(&self, other: &($($T,)+)) -> bool {
- lexical_ord!(le, $(self.$refN(), other.$refN()),+)
- }
- #[inline]
- fn ge(&self, other: &($($T,)+)) -> bool {
- lexical_ord!(ge, $(self.$refN(), other.$refN()),+)
- }
- #[inline]
- fn gt(&self, other: &($($T,)+)) -> bool {
- lexical_ord!(gt, $(self.$refN(), other.$refN()),+)
- }
- }
-
- #[cfg(not(test))]
- impl<$($T:TotalOrd),+> TotalOrd for ($($T,)+) {
- #[inline]
- fn cmp(&self, other: &($($T,)+)) -> Ordering {
- lexical_cmp!($(self.$refN(), other.$refN()),+)
- }
- }
-
- #[cfg(not(test))]
- impl<$($T:Default),+> Default for ($($T,)+) {
- #[inline]
- fn default() -> ($($T,)+) {
- ($({ let x: $T = Default::default(); x},)+)
- }
- }
-
- impl<$($T: fmt::Show),+> fmt::Show for ($($T,)+) {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- write_tuple!(f.buf, $(self.$refN()),+)
- }
- }
- )+
- }
-}
-
-// Constructs an expression that performs a lexical ordering using method $rel.
-// The values are interleaved, so the macro invocation for
-// `(a1, a2, a3) < (b1, b2, b3)` would be `lexical_ord!(lt, a1, b1, a2, b2,
-// a3, b3)` (and similarly for `lexical_cmp`)
-macro_rules! lexical_ord {
- ($rel: ident, $a:expr, $b:expr, $($rest_a:expr, $rest_b:expr),+) => {
- if *$a != *$b { lexical_ord!($rel, $a, $b) }
- else { lexical_ord!($rel, $($rest_a, $rest_b),+) }
- };
- ($rel: ident, $a:expr, $b:expr) => { (*$a) . $rel ($b) };
-}
-
-macro_rules! lexical_cmp {
- ($a:expr, $b:expr, $($rest_a:expr, $rest_b:expr),+) => {
- match ($a).cmp($b) {
- Equal => lexical_cmp!($($rest_a, $rest_b),+),
- ordering => ordering
- }
- };
- ($a:expr, $b:expr) => { ($a).cmp($b) };
-}
-
-macro_rules! write_tuple {
- ($buf:expr, $x:expr) => (
- write!($buf, "({},)", *$x)
- );
- ($buf:expr, $hd:expr, $($tl:expr),+) => ({
- try!(write!($buf, "("));
- try!(write!($buf, "{}", *$hd));
- $(try!(write!($buf, ", {}", *$tl));)+
- write!($buf, ")")
- });
-}
-
-tuple_impls! {
- Tuple1 {
- (val0, ref0, mut0) -> A { (a) => a }
- }
- Tuple2 {
- (val0, ref0, mut0) -> A { (a, b) => a }
- (val1, ref1, mut1) -> B { (a, b) => b }
- }
- Tuple3 {
- (val0, ref0, mut0) -> A { (a, b, c) => a }
- (val1, ref1, mut1) -> B { (a, b, c) => b }
- (val2, ref2, mut2) -> C { (a, b, c) => c }
- }
- Tuple4 {
- (val0, ref0, mut0) -> A { (a, b, c, d) => a }
- (val1, ref1, mut1) -> B { (a, b, c, d) => b }
- (val2, ref2, mut2) -> C { (a, b, c, d) => c }
- (val3, ref3, mut3) -> D { (a, b, c, d) => d }
- }
- Tuple5 {
- (val0, ref0, mut0) -> A { (a, b, c, d, e) => a }
- (val1, ref1, mut1) -> B { (a, b, c, d, e) => b }
- (val2, ref2, mut2) -> C { (a, b, c, d, e) => c }
- (val3, ref3, mut3) -> D { (a, b, c, d, e) => d }
- (val4, ref4, mut4) -> E { (a, b, c, d, e) => e }
- }
- Tuple6 {
- (val0, ref0, mut0) -> A { (a, b, c, d, e, f) => a }
- (val1, ref1, mut1) -> B { (a, b, c, d, e, f) => b }
- (val2, ref2, mut2) -> C { (a, b, c, d, e, f) => c }
- (val3, ref3, mut3) -> D { (a, b, c, d, e, f) => d }
- (val4, ref4, mut4) -> E { (a, b, c, d, e, f) => e }
- (val5, ref5, mut5) -> F { (a, b, c, d, e, f) => f }
- }
- Tuple7 {
- (val0, ref0, mut0) -> A { (a, b, c, d, e, f, g) => a }
- (val1, ref1, mut1) -> B { (a, b, c, d, e, f, g) => b }
- (val2, ref2, mut2) -> C { (a, b, c, d, e, f, g) => c }
- (val3, ref3, mut3) -> D { (a, b, c, d, e, f, g) => d }
- (val4, ref4, mut4) -> E { (a, b, c, d, e, f, g) => e }
- (val5, ref5, mut5) -> F { (a, b, c, d, e, f, g) => f }
- (val6, ref6, mut6) -> G { (a, b, c, d, e, f, g) => g }
- }
- Tuple8 {
- (val0, ref0, mut0) -> A { (a, b, c, d, e, f, g, h) => a }
- (val1, ref1, mut1) -> B { (a, b, c, d, e, f, g, h) => b }
- (val2, ref2, mut2) -> C { (a, b, c, d, e, f, g, h) => c }
- (val3, ref3, mut3) -> D { (a, b, c, d, e, f, g, h) => d }
- (val4, ref4, mut4) -> E { (a, b, c, d, e, f, g, h) => e }
- (val5, ref5, mut5) -> F { (a, b, c, d, e, f, g, h) => f }
- (val6, ref6, mut6) -> G { (a, b, c, d, e, f, g, h) => g }
- (val7, ref7, mut7) -> H { (a, b, c, d, e, f, g, h) => h }
- }
- Tuple9 {
- (val0, ref0, mut0) -> A { (a, b, c, d, e, f, g, h, i) => a }
- (val1, ref1, mut1) -> B { (a, b, c, d, e, f, g, h, i) => b }
- (val2, ref2, mut2) -> C { (a, b, c, d, e, f, g, h, i) => c }
- (val3, ref3, mut3) -> D { (a, b, c, d, e, f, g, h, i) => d }
- (val4, ref4, mut4) -> E { (a, b, c, d, e, f, g, h, i) => e }
- (val5, ref5, mut5) -> F { (a, b, c, d, e, f, g, h, i) => f }
- (val6, ref6, mut6) -> G { (a, b, c, d, e, f, g, h, i) => g }
- (val7, ref7, mut7) -> H { (a, b, c, d, e, f, g, h, i) => h }
- (val8, ref8, mut8) -> I { (a, b, c, d, e, f, g, h, i) => i }
- }
- Tuple10 {
- (val0, ref0, mut0) -> A { (a, b, c, d, e, f, g, h, i, j) => a }
- (val1, ref1, mut1) -> B { (a, b, c, d, e, f, g, h, i, j) => b }
- (val2, ref2, mut2) -> C { (a, b, c, d, e, f, g, h, i, j) => c }
- (val3, ref3, mut3) -> D { (a, b, c, d, e, f, g, h, i, j) => d }
- (val4, ref4, mut4) -> E { (a, b, c, d, e, f, g, h, i, j) => e }
- (val5, ref5, mut5) -> F { (a, b, c, d, e, f, g, h, i, j) => f }
- (val6, ref6, mut6) -> G { (a, b, c, d, e, f, g, h, i, j) => g }
- (val7, ref7, mut7) -> H { (a, b, c, d, e, f, g, h, i, j) => h }
- (val8, ref8, mut8) -> I { (a, b, c, d, e, f, g, h, i, j) => i }
- (val9, ref9, mut9) -> J { (a, b, c, d, e, f, g, h, i, j) => j }
- }
- Tuple11 {
- (val0, ref0, mut0) -> A { (a, b, c, d, e, f, g, h, i, j, k) => a }
- (val1, ref1, mut1) -> B { (a, b, c, d, e, f, g, h, i, j, k) => b }
- (val2, ref2, mut2) -> C { (a, b, c, d, e, f, g, h, i, j, k) => c }
- (val3, ref3, mut3) -> D { (a, b, c, d, e, f, g, h, i, j, k) => d }
- (val4, ref4, mut4) -> E { (a, b, c, d, e, f, g, h, i, j, k) => e }
- (val5, ref5, mut5) -> F { (a, b, c, d, e, f, g, h, i, j, k) => f }
- (val6, ref6, mut6) -> G { (a, b, c, d, e, f, g, h, i, j, k) => g }
- (val7, ref7, mut7) -> H { (a, b, c, d, e, f, g, h, i, j, k) => h }
- (val8, ref8, mut8) -> I { (a, b, c, d, e, f, g, h, i, j, k) => i }
- (val9, ref9, mut9) -> J { (a, b, c, d, e, f, g, h, i, j, k) => j }
- (val10, ref10, mut10) -> K { (a, b, c, d, e, f, g, h, i, j, k) => k }
- }
- Tuple12 {
- (val0, ref0, mut0) -> A { (a, b, c, d, e, f, g, h, i, j, k, l) => a }
- (val1, ref1, mut1) -> B { (a, b, c, d, e, f, g, h, i, j, k, l) => b }
- (val2, ref2, mut2) -> C { (a, b, c, d, e, f, g, h, i, j, k, l) => c }
- (val3, ref3, mut3) -> D { (a, b, c, d, e, f, g, h, i, j, k, l) => d }
- (val4, ref4, mut4) -> E { (a, b, c, d, e, f, g, h, i, j, k, l) => e }
- (val5, ref5, mut5) -> F { (a, b, c, d, e, f, g, h, i, j, k, l) => f }
- (val6, ref6, mut6) -> G { (a, b, c, d, e, f, g, h, i, j, k, l) => g }
- (val7, ref7, mut7) -> H { (a, b, c, d, e, f, g, h, i, j, k, l) => h }
- (val8, ref8, mut8) -> I { (a, b, c, d, e, f, g, h, i, j, k, l) => i }
- (val9, ref9, mut9) -> J { (a, b, c, d, e, f, g, h, i, j, k, l) => j }
- (val10, ref10, mut10) -> K { (a, b, c, d, e, f, g, h, i, j, k, l) => k }
- (val11, ref11, mut11) -> L { (a, b, c, d, e, f, g, h, i, j, k, l) => l }
- }
-}
-
-#[cfg(test)]
-mod tests {
- use super::*;
- use clone::Clone;
- use cmp::*;
- use str::StrSlice;
-
- #[test]
- fn test_clone() {
- let a = (1, "2".to_owned());
- let b = a.clone();
- assert_eq!(a, b);
- }
-
- #[test]
- fn test_getters() {
- macro_rules! test_getter(
- ($x:expr, $valN:ident, $refN:ident, $mutN:ident,
- $init:expr, $incr:expr, $result:expr) => ({
- assert_eq!($x.$valN(), $init);
- assert_eq!(*$x.$refN(), $init);
- *$x.$mutN() += $incr;
- assert_eq!(*$x.$refN(), $result);
- })
- )
- let mut x = (0u8, 1u16, 2u32, 3u64, 4u, 5i8, 6i16, 7i32, 8i64, 9i, 10f32, 11f64);
- test_getter!(x, val0, ref0, mut0, 0, 1, 1);
- test_getter!(x, val1, ref1, mut1, 1, 1, 2);
- test_getter!(x, val2, ref2, mut2, 2, 1, 3);
- test_getter!(x, val3, ref3, mut3, 3, 1, 4);
- test_getter!(x, val4, ref4, mut4, 4, 1, 5);
- test_getter!(x, val5, ref5, mut5, 5, 1, 6);
- test_getter!(x, val6, ref6, mut6, 6, 1, 7);
- test_getter!(x, val7, ref7, mut7, 7, 1, 8);
- test_getter!(x, val8, ref8, mut8, 8, 1, 9);
- test_getter!(x, val9, ref9, mut9, 9, 1, 10);
- test_getter!(x, val10, ref10, mut10, 10.0, 1.0, 11.0);
- test_getter!(x, val11, ref11, mut11, 11.0, 1.0, 12.0);
- }
-
- #[test]
- fn test_tuple_cmp() {
- let (small, big) = ((1u, 2u, 3u), (3u, 2u, 1u));
-
- let nan = 0.0/0.0;
-
- // Eq
- assert_eq!(small, small);
- assert_eq!(big, big);
- assert!(small != big);
- assert!(big != small);
-
- // Ord
- assert!(small < big);
- assert!(!(small < small));
- assert!(!(big < small));
- assert!(!(big < big));
-
- assert!(small <= small);
- assert!(big <= big);
-
- assert!(big > small);
- assert!(small >= small);
- assert!(big >= small);
- assert!(big >= big);
-
- assert!(!((1.0, 2.0) < (nan, 3.0)));
- assert!(!((1.0, 2.0) <= (nan, 3.0)));
- assert!(!((1.0, 2.0) > (nan, 3.0)));
- assert!(!((1.0, 2.0) >= (nan, 3.0)));
- assert!(((1.0, 2.0) < (2.0, nan)));
- assert!(!((2.0, 2.0) < (2.0, nan)));
-
- // TotalOrd
- assert!(small.cmp(&small) == Equal);
- assert!(big.cmp(&big) == Equal);
- assert!(small.cmp(&big) == Less);
- assert!(big.cmp(&small) == Greater);
- }
-
- #[test]
- fn test_show() {
- assert_eq!(format!("{}", (1,)), "(1,)".to_owned());
- assert_eq!(format!("{}", (1, true)), "(1, true)".to_owned());
- assert_eq!(format!("{}", (1, "hi".to_owned(), true)), "(1, hi, true)".to_owned());
- }
-}
+++ /dev/null
-// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-//! Types dealing with unsafe actions.
-
-use cast;
-use kinds::marker;
-
-/// Unsafe type that wraps a type T and indicates unsafe interior operations on the
-/// wrapped type. Types with an `Unsafe<T>` field are considered to have an *unsafe
-/// interior*. The Unsafe type is the only legal way to obtain aliasable data that is
-/// considered mutable. In general, transmuting an &T type into an &mut T is considered
-/// undefined behavior.
-///
-/// Although it is possible to put an Unsafe<T> into static item, it is not permitted to
-/// take the address of the static item if the item is not declared as mutable. This rule
-/// exists because immutable static items are stored in read-only memory, and thus any
-/// attempt to mutate their interior can cause segfaults. Immutable static items containing
-/// Unsafe<T> instances are still useful as read-only initializers, however, so we do not
-/// forbid them altogether.
-///
-/// Types like `Cell` and `RefCell` use this type to wrap their internal data.
-///
-/// Unsafe doesn't opt-out from any kind, instead, types with an `Unsafe` interior
-/// are expected to opt-out from kinds themselves.
-///
-/// # Example:
-///
-/// ```rust
-/// use std::ty::Unsafe;
-/// use std::kinds::marker;
-///
-/// struct NotThreadSafe<T> {
-/// value: Unsafe<T>,
-/// marker1: marker::NoShare
-/// }
-/// ```
-///
-/// **NOTE:** Unsafe<T> fields are public to allow static initializers. It is not recommended
-/// to access its fields directly, `get` should be used instead.
-#[lang="unsafe"]
-pub struct Unsafe<T> {
- /// Wrapped value
- pub value: T,
-
- /// Invariance marker
- pub marker1: marker::InvariantType<T>
-}
-
-impl<T> Unsafe<T> {
-
- /// Static constructor
- pub fn new(value: T) -> Unsafe<T> {
- Unsafe{value: value, marker1: marker::InvariantType}
- }
-
- /// Gets a mutable pointer to the wrapped value
- #[inline]
- pub unsafe fn get(&self) -> *mut T { cast::transmute_mut_unsafe(&self.value) }
-
- /// Unwraps the value
- #[inline]
- pub unsafe fn unwrap(self) -> T { self.value }
-}
// The following code was generated by "src/etc/unicode.py"
-#![allow(missing_doc)]
-#![allow(non_uppercase_statics)]
+#![allow(missing_doc, non_uppercase_statics)]
-fn bsearch_range_table(c: char, r: &'static [(char,char)]) -> bool {
- use cmp::{Equal, Less, Greater};
- use slice::ImmutableVector;
- use option::None;
- r.bsearch(|&(lo,hi)| {
- if lo <= c && c <= hi { Equal }
- else if hi < c { Less }
- else { Greater }
- }) != None
-}
-
-pub mod general_category {
- static Cc_table : &'static [(char,char)] = &[
- ('\x00', '\x1f'), ('\x7f', '\x9f')
- ];
-
- pub fn Cc(c: char) -> bool {
- super::bsearch_range_table(c, Cc_table)
- }
-
- static Nd_table : &'static [(char,char)] = &[
- ('\x30', '\x39'), ('\u0660', '\u0669'),
- ('\u06f0', '\u06f9'), ('\u07c0', '\u07c9'),
- ('\u0966', '\u096f'), ('\u09e6', '\u09ef'),
- ('\u0a66', '\u0a6f'), ('\u0ae6', '\u0aef'),
- ('\u0b66', '\u0b6f'), ('\u0be6', '\u0bef'),
- ('\u0c66', '\u0c6f'), ('\u0ce6', '\u0cef'),
- ('\u0d66', '\u0d6f'), ('\u0e50', '\u0e59'),
- ('\u0ed0', '\u0ed9'), ('\u0f20', '\u0f29'),
- ('\u1040', '\u1049'), ('\u1090', '\u1099'),
- ('\u17e0', '\u17e9'), ('\u1810', '\u1819'),
- ('\u1946', '\u194f'), ('\u19d0', '\u19d9'),
- ('\u1a80', '\u1a99'), ('\u1b50', '\u1b59'),
- ('\u1bb0', '\u1bb9'), ('\u1c40', '\u1c49'),
- ('\u1c50', '\u1c59'), ('\ua620', '\ua629'),
- ('\ua8d0', '\ua8d9'), ('\ua900', '\ua909'),
- ('\ua9d0', '\ua9d9'), ('\uaa50', '\uaa59'),
- ('\uabf0', '\uabf9'), ('\uff10', '\uff19'),
- ('\U000104a0', '\U000104a9'), ('\U00011066', '\U0001106f'),
- ('\U000110f0', '\U000110f9'), ('\U00011136', '\U0001113f'),
- ('\U000111d0', '\U000111d9'), ('\U000116c0', '\U000116c9'),
- ('\U0001d7ce', '\U0001d7ff')
- ];
-
- pub fn Nd(c: char) -> bool {
- super::bsearch_range_table(c, Nd_table)
- }
-
- static Nl_table : &'static [(char,char)] = &[
- ('\u16ee', '\u16f0'), ('\u2160', '\u2182'),
- ('\u2185', '\u2188'), ('\u3007', '\u3007'),
- ('\u3021', '\u3029'), ('\u3038', '\u303a'),
- ('\ua6e6', '\ua6ef'), ('\U00010140', '\U00010174'),
- ('\U00010341', '\U00010341'), ('\U0001034a', '\U0001034a'),
- ('\U000103d1', '\U000103d5'), ('\U00012400', '\U00012462')
- ];
-
- pub fn Nl(c: char) -> bool {
- super::bsearch_range_table(c, Nl_table)
- }
-
- static No_table : &'static [(char,char)] = &[
- ('\xb2', '\xb3'), ('\xb9', '\xb9'),
- ('\xbc', '\xbe'), ('\u09f4', '\u09f9'),
- ('\u0b72', '\u0b77'), ('\u0bf0', '\u0bf2'),
- ('\u0c78', '\u0c7e'), ('\u0d70', '\u0d75'),
- ('\u0f2a', '\u0f33'), ('\u1369', '\u137c'),
- ('\u17f0', '\u17f9'), ('\u19da', '\u19da'),
- ('\u2070', '\u2070'), ('\u2074', '\u2079'),
- ('\u2080', '\u2089'), ('\u2150', '\u215f'),
- ('\u2189', '\u2189'), ('\u2460', '\u249b'),
- ('\u24ea', '\u24ff'), ('\u2776', '\u2793'),
- ('\u2cfd', '\u2cfd'), ('\u3192', '\u3195'),
- ('\u3220', '\u3229'), ('\u3248', '\u324f'),
- ('\u3251', '\u325f'), ('\u3280', '\u3289'),
- ('\u32b1', '\u32bf'), ('\ua830', '\ua835'),
- ('\U00010107', '\U00010133'), ('\U00010175', '\U00010178'),
- ('\U0001018a', '\U0001018a'), ('\U00010320', '\U00010323'),
- ('\U00010858', '\U0001085f'), ('\U00010916', '\U0001091b'),
- ('\U00010a40', '\U00010a47'), ('\U00010a7d', '\U00010a7e'),
- ('\U00010b58', '\U00010b5f'), ('\U00010b78', '\U00010b7f'),
- ('\U00010e60', '\U00010e7e'), ('\U00011052', '\U00011065'),
- ('\U0001d360', '\U0001d371'), ('\U0001f100', '\U0001f10a')
- ];
-
- pub fn No(c: char) -> bool {
- super::bsearch_range_table(c, No_table)
- }
-
-}
pub mod decompose {
- use option::Option;
use option::{Some, None};
use slice::ImmutableVector;
- fn bsearch_table(c: char, r: &'static [(char, &'static [char])]) -> Option<&'static [char]> {
- use cmp::{Equal, Less, Greater};
- match r.bsearch(|&(val, _)| {
- if c == val { Equal }
- else if val < c { Less }
- else { Greater }
- }) {
- Some(idx) => {
- let (_, result) = r[idx];
- Some(result)
- }
- None => None
- }
- }
-
-
fn bsearch_range_value_table(c: char, r: &'static [(char, char, u8)]) -> u8 {
use cmp::{Equal, Less, Greater};
match r.bsearch(|&(lo, hi, _)| {
}
- // Canonical decompositions
- static canonical_table : &'static [(char, &'static [char])] = &[
- ('\xc0', &['\x41', '\u0300']), ('\xc1', &['\x41', '\u0301']), ('\xc2', &['\x41', '\u0302']),
- ('\xc3', &['\x41', '\u0303']), ('\xc4', &['\x41', '\u0308']), ('\xc5', &['\x41', '\u030a']),
- ('\xc7', &['\x43', '\u0327']), ('\xc8', &['\x45', '\u0300']), ('\xc9', &['\x45', '\u0301']),
- ('\xca', &['\x45', '\u0302']), ('\xcb', &['\x45', '\u0308']), ('\xcc', &['\x49', '\u0300']),
- ('\xcd', &['\x49', '\u0301']), ('\xce', &['\x49', '\u0302']), ('\xcf', &['\x49', '\u0308']),
- ('\xd1', &['\x4e', '\u0303']), ('\xd2', &['\x4f', '\u0300']), ('\xd3', &['\x4f', '\u0301']),
- ('\xd4', &['\x4f', '\u0302']), ('\xd5', &['\x4f', '\u0303']), ('\xd6', &['\x4f', '\u0308']),
- ('\xd9', &['\x55', '\u0300']), ('\xda', &['\x55', '\u0301']), ('\xdb', &['\x55', '\u0302']),
- ('\xdc', &['\x55', '\u0308']), ('\xdd', &['\x59', '\u0301']), ('\xe0', &['\x61', '\u0300']),
- ('\xe1', &['\x61', '\u0301']), ('\xe2', &['\x61', '\u0302']), ('\xe3', &['\x61', '\u0303']),
- ('\xe4', &['\x61', '\u0308']), ('\xe5', &['\x61', '\u030a']), ('\xe7', &['\x63', '\u0327']),
- ('\xe8', &['\x65', '\u0300']), ('\xe9', &['\x65', '\u0301']), ('\xea', &['\x65', '\u0302']),
- ('\xeb', &['\x65', '\u0308']), ('\xec', &['\x69', '\u0300']), ('\xed', &['\x69', '\u0301']),
- ('\xee', &['\x69', '\u0302']), ('\xef', &['\x69', '\u0308']), ('\xf1', &['\x6e', '\u0303']),
- ('\xf2', &['\x6f', '\u0300']), ('\xf3', &['\x6f', '\u0301']), ('\xf4', &['\x6f', '\u0302']),
- ('\xf5', &['\x6f', '\u0303']), ('\xf6', &['\x6f', '\u0308']), ('\xf9', &['\x75', '\u0300']),
- ('\xfa', &['\x75', '\u0301']), ('\xfb', &['\x75', '\u0302']), ('\xfc', &['\x75', '\u0308']),
- ('\xfd', &['\x79', '\u0301']), ('\xff', &['\x79', '\u0308']), ('\u0100', &['\x41',
- '\u0304']), ('\u0101', &['\x61', '\u0304']), ('\u0102', &['\x41', '\u0306']), ('\u0103',
- &['\x61', '\u0306']), ('\u0104', &['\x41', '\u0328']), ('\u0105', &['\x61', '\u0328']),
- ('\u0106', &['\x43', '\u0301']), ('\u0107', &['\x63', '\u0301']), ('\u0108', &['\x43',
- '\u0302']), ('\u0109', &['\x63', '\u0302']), ('\u010a', &['\x43', '\u0307']), ('\u010b',
- &['\x63', '\u0307']), ('\u010c', &['\x43', '\u030c']), ('\u010d', &['\x63', '\u030c']),
- ('\u010e', &['\x44', '\u030c']), ('\u010f', &['\x64', '\u030c']), ('\u0112', &['\x45',
- '\u0304']), ('\u0113', &['\x65', '\u0304']), ('\u0114', &['\x45', '\u0306']), ('\u0115',
- &['\x65', '\u0306']), ('\u0116', &['\x45', '\u0307']), ('\u0117', &['\x65', '\u0307']),
- ('\u0118', &['\x45', '\u0328']), ('\u0119', &['\x65', '\u0328']), ('\u011a', &['\x45',
- '\u030c']), ('\u011b', &['\x65', '\u030c']), ('\u011c', &['\x47', '\u0302']), ('\u011d',
- &['\x67', '\u0302']), ('\u011e', &['\x47', '\u0306']), ('\u011f', &['\x67', '\u0306']),
- ('\u0120', &['\x47', '\u0307']), ('\u0121', &['\x67', '\u0307']), ('\u0122', &['\x47',
- '\u0327']), ('\u0123', &['\x67', '\u0327']), ('\u0124', &['\x48', '\u0302']), ('\u0125',
- &['\x68', '\u0302']), ('\u0128', &['\x49', '\u0303']), ('\u0129', &['\x69', '\u0303']),
- ('\u012a', &['\x49', '\u0304']), ('\u012b', &['\x69', '\u0304']), ('\u012c', &['\x49',
- '\u0306']), ('\u012d', &['\x69', '\u0306']), ('\u012e', &['\x49', '\u0328']), ('\u012f',
- &['\x69', '\u0328']), ('\u0130', &['\x49', '\u0307']), ('\u0134', &['\x4a', '\u0302']),
- ('\u0135', &['\x6a', '\u0302']), ('\u0136', &['\x4b', '\u0327']), ('\u0137', &['\x6b',
- '\u0327']), ('\u0139', &['\x4c', '\u0301']), ('\u013a', &['\x6c', '\u0301']), ('\u013b',
- &['\x4c', '\u0327']), ('\u013c', &['\x6c', '\u0327']), ('\u013d', &['\x4c', '\u030c']),
- ('\u013e', &['\x6c', '\u030c']), ('\u0143', &['\x4e', '\u0301']), ('\u0144', &['\x6e',
- '\u0301']), ('\u0145', &['\x4e', '\u0327']), ('\u0146', &['\x6e', '\u0327']), ('\u0147',
- &['\x4e', '\u030c']), ('\u0148', &['\x6e', '\u030c']), ('\u014c', &['\x4f', '\u0304']),
- ('\u014d', &['\x6f', '\u0304']), ('\u014e', &['\x4f', '\u0306']), ('\u014f', &['\x6f',
- '\u0306']), ('\u0150', &['\x4f', '\u030b']), ('\u0151', &['\x6f', '\u030b']), ('\u0154',
- &['\x52', '\u0301']), ('\u0155', &['\x72', '\u0301']), ('\u0156', &['\x52', '\u0327']),
- ('\u0157', &['\x72', '\u0327']), ('\u0158', &['\x52', '\u030c']), ('\u0159', &['\x72',
- '\u030c']), ('\u015a', &['\x53', '\u0301']), ('\u015b', &['\x73', '\u0301']), ('\u015c',
- &['\x53', '\u0302']), ('\u015d', &['\x73', '\u0302']), ('\u015e', &['\x53', '\u0327']),
- ('\u015f', &['\x73', '\u0327']), ('\u0160', &['\x53', '\u030c']), ('\u0161', &['\x73',
- '\u030c']), ('\u0162', &['\x54', '\u0327']), ('\u0163', &['\x74', '\u0327']), ('\u0164',
- &['\x54', '\u030c']), ('\u0165', &['\x74', '\u030c']), ('\u0168', &['\x55', '\u0303']),
- ('\u0169', &['\x75', '\u0303']), ('\u016a', &['\x55', '\u0304']), ('\u016b', &['\x75',
- '\u0304']), ('\u016c', &['\x55', '\u0306']), ('\u016d', &['\x75', '\u0306']), ('\u016e',
- &['\x55', '\u030a']), ('\u016f', &['\x75', '\u030a']), ('\u0170', &['\x55', '\u030b']),
- ('\u0171', &['\x75', '\u030b']), ('\u0172', &['\x55', '\u0328']), ('\u0173', &['\x75',
- '\u0328']), ('\u0174', &['\x57', '\u0302']), ('\u0175', &['\x77', '\u0302']), ('\u0176',
- &['\x59', '\u0302']), ('\u0177', &['\x79', '\u0302']), ('\u0178', &['\x59', '\u0308']),
- ('\u0179', &['\x5a', '\u0301']), ('\u017a', &['\x7a', '\u0301']), ('\u017b', &['\x5a',
- '\u0307']), ('\u017c', &['\x7a', '\u0307']), ('\u017d', &['\x5a', '\u030c']), ('\u017e',
- &['\x7a', '\u030c']), ('\u01a0', &['\x4f', '\u031b']), ('\u01a1', &['\x6f', '\u031b']),
- ('\u01af', &['\x55', '\u031b']), ('\u01b0', &['\x75', '\u031b']), ('\u01cd', &['\x41',
- '\u030c']), ('\u01ce', &['\x61', '\u030c']), ('\u01cf', &['\x49', '\u030c']), ('\u01d0',
- &['\x69', '\u030c']), ('\u01d1', &['\x4f', '\u030c']), ('\u01d2', &['\x6f', '\u030c']),
- ('\u01d3', &['\x55', '\u030c']), ('\u01d4', &['\x75', '\u030c']), ('\u01d5', &['\xdc',
- '\u0304']), ('\u01d6', &['\xfc', '\u0304']), ('\u01d7', &['\xdc', '\u0301']), ('\u01d8',
- &['\xfc', '\u0301']), ('\u01d9', &['\xdc', '\u030c']), ('\u01da', &['\xfc', '\u030c']),
- ('\u01db', &['\xdc', '\u0300']), ('\u01dc', &['\xfc', '\u0300']), ('\u01de', &['\xc4',
- '\u0304']), ('\u01df', &['\xe4', '\u0304']), ('\u01e0', &['\u0226', '\u0304']), ('\u01e1',
- &['\u0227', '\u0304']), ('\u01e2', &['\xc6', '\u0304']), ('\u01e3', &['\xe6', '\u0304']),
- ('\u01e6', &['\x47', '\u030c']), ('\u01e7', &['\x67', '\u030c']), ('\u01e8', &['\x4b',
- '\u030c']), ('\u01e9', &['\x6b', '\u030c']), ('\u01ea', &['\x4f', '\u0328']), ('\u01eb',
- &['\x6f', '\u0328']), ('\u01ec', &['\u01ea', '\u0304']), ('\u01ed', &['\u01eb', '\u0304']),
- ('\u01ee', &['\u01b7', '\u030c']), ('\u01ef', &['\u0292', '\u030c']), ('\u01f0', &['\x6a',
- '\u030c']), ('\u01f4', &['\x47', '\u0301']), ('\u01f5', &['\x67', '\u0301']), ('\u01f8',
- &['\x4e', '\u0300']), ('\u01f9', &['\x6e', '\u0300']), ('\u01fa', &['\xc5', '\u0301']),
- ('\u01fb', &['\xe5', '\u0301']), ('\u01fc', &['\xc6', '\u0301']), ('\u01fd', &['\xe6',
- '\u0301']), ('\u01fe', &['\xd8', '\u0301']), ('\u01ff', &['\xf8', '\u0301']), ('\u0200',
- &['\x41', '\u030f']), ('\u0201', &['\x61', '\u030f']), ('\u0202', &['\x41', '\u0311']),
- ('\u0203', &['\x61', '\u0311']), ('\u0204', &['\x45', '\u030f']), ('\u0205', &['\x65',
- '\u030f']), ('\u0206', &['\x45', '\u0311']), ('\u0207', &['\x65', '\u0311']), ('\u0208',
- &['\x49', '\u030f']), ('\u0209', &['\x69', '\u030f']), ('\u020a', &['\x49', '\u0311']),
- ('\u020b', &['\x69', '\u0311']), ('\u020c', &['\x4f', '\u030f']), ('\u020d', &['\x6f',
- '\u030f']), ('\u020e', &['\x4f', '\u0311']), ('\u020f', &['\x6f', '\u0311']), ('\u0210',
- &['\x52', '\u030f']), ('\u0211', &['\x72', '\u030f']), ('\u0212', &['\x52', '\u0311']),
- ('\u0213', &['\x72', '\u0311']), ('\u0214', &['\x55', '\u030f']), ('\u0215', &['\x75',
- '\u030f']), ('\u0216', &['\x55', '\u0311']), ('\u0217', &['\x75', '\u0311']), ('\u0218',
- &['\x53', '\u0326']), ('\u0219', &['\x73', '\u0326']), ('\u021a', &['\x54', '\u0326']),
- ('\u021b', &['\x74', '\u0326']), ('\u021e', &['\x48', '\u030c']), ('\u021f', &['\x68',
- '\u030c']), ('\u0226', &['\x41', '\u0307']), ('\u0227', &['\x61', '\u0307']), ('\u0228',
- &['\x45', '\u0327']), ('\u0229', &['\x65', '\u0327']), ('\u022a', &['\xd6', '\u0304']),
- ('\u022b', &['\xf6', '\u0304']), ('\u022c', &['\xd5', '\u0304']), ('\u022d', &['\xf5',
- '\u0304']), ('\u022e', &['\x4f', '\u0307']), ('\u022f', &['\x6f', '\u0307']), ('\u0230',
- &['\u022e', '\u0304']), ('\u0231', &['\u022f', '\u0304']), ('\u0232', &['\x59', '\u0304']),
- ('\u0233', &['\x79', '\u0304']), ('\u0340', &['\u0300']), ('\u0341', &['\u0301']),
- ('\u0343', &['\u0313']), ('\u0344', &['\u0308', '\u0301']), ('\u0374', &['\u02b9']),
- ('\u037e', &['\x3b']), ('\u0385', &['\xa8', '\u0301']), ('\u0386', &['\u0391', '\u0301']),
- ('\u0387', &['\xb7']), ('\u0388', &['\u0395', '\u0301']), ('\u0389', &['\u0397', '\u0301']),
- ('\u038a', &['\u0399', '\u0301']), ('\u038c', &['\u039f', '\u0301']), ('\u038e', &['\u03a5',
- '\u0301']), ('\u038f', &['\u03a9', '\u0301']), ('\u0390', &['\u03ca', '\u0301']), ('\u03aa',
- &['\u0399', '\u0308']), ('\u03ab', &['\u03a5', '\u0308']), ('\u03ac', &['\u03b1',
- '\u0301']), ('\u03ad', &['\u03b5', '\u0301']), ('\u03ae', &['\u03b7', '\u0301']), ('\u03af',
- &['\u03b9', '\u0301']), ('\u03b0', &['\u03cb', '\u0301']), ('\u03ca', &['\u03b9',
- '\u0308']), ('\u03cb', &['\u03c5', '\u0308']), ('\u03cc', &['\u03bf', '\u0301']), ('\u03cd',
- &['\u03c5', '\u0301']), ('\u03ce', &['\u03c9', '\u0301']), ('\u03d3', &['\u03d2',
- '\u0301']), ('\u03d4', &['\u03d2', '\u0308']), ('\u0400', &['\u0415', '\u0300']), ('\u0401',
- &['\u0415', '\u0308']), ('\u0403', &['\u0413', '\u0301']), ('\u0407', &['\u0406',
- '\u0308']), ('\u040c', &['\u041a', '\u0301']), ('\u040d', &['\u0418', '\u0300']), ('\u040e',
- &['\u0423', '\u0306']), ('\u0419', &['\u0418', '\u0306']), ('\u0439', &['\u0438',
- '\u0306']), ('\u0450', &['\u0435', '\u0300']), ('\u0451', &['\u0435', '\u0308']), ('\u0453',
- &['\u0433', '\u0301']), ('\u0457', &['\u0456', '\u0308']), ('\u045c', &['\u043a',
- '\u0301']), ('\u045d', &['\u0438', '\u0300']), ('\u045e', &['\u0443', '\u0306']), ('\u0476',
- &['\u0474', '\u030f']), ('\u0477', &['\u0475', '\u030f']), ('\u04c1', &['\u0416',
- '\u0306']), ('\u04c2', &['\u0436', '\u0306']), ('\u04d0', &['\u0410', '\u0306']), ('\u04d1',
- &['\u0430', '\u0306']), ('\u04d2', &['\u0410', '\u0308']), ('\u04d3', &['\u0430',
- '\u0308']), ('\u04d6', &['\u0415', '\u0306']), ('\u04d7', &['\u0435', '\u0306']), ('\u04da',
- &['\u04d8', '\u0308']), ('\u04db', &['\u04d9', '\u0308']), ('\u04dc', &['\u0416',
- '\u0308']), ('\u04dd', &['\u0436', '\u0308']), ('\u04de', &['\u0417', '\u0308']), ('\u04df',
- &['\u0437', '\u0308']), ('\u04e2', &['\u0418', '\u0304']), ('\u04e3', &['\u0438',
- '\u0304']), ('\u04e4', &['\u0418', '\u0308']), ('\u04e5', &['\u0438', '\u0308']), ('\u04e6',
- &['\u041e', '\u0308']), ('\u04e7', &['\u043e', '\u0308']), ('\u04ea', &['\u04e8',
- '\u0308']), ('\u04eb', &['\u04e9', '\u0308']), ('\u04ec', &['\u042d', '\u0308']), ('\u04ed',
- &['\u044d', '\u0308']), ('\u04ee', &['\u0423', '\u0304']), ('\u04ef', &['\u0443',
- '\u0304']), ('\u04f0', &['\u0423', '\u0308']), ('\u04f1', &['\u0443', '\u0308']), ('\u04f2',
- &['\u0423', '\u030b']), ('\u04f3', &['\u0443', '\u030b']), ('\u04f4', &['\u0427',
- '\u0308']), ('\u04f5', &['\u0447', '\u0308']), ('\u04f8', &['\u042b', '\u0308']), ('\u04f9',
- &['\u044b', '\u0308']), ('\u0622', &['\u0627', '\u0653']), ('\u0623', &['\u0627',
- '\u0654']), ('\u0624', &['\u0648', '\u0654']), ('\u0625', &['\u0627', '\u0655']), ('\u0626',
- &['\u064a', '\u0654']), ('\u06c0', &['\u06d5', '\u0654']), ('\u06c2', &['\u06c1',
- '\u0654']), ('\u06d3', &['\u06d2', '\u0654']), ('\u0929', &['\u0928', '\u093c']), ('\u0931',
- &['\u0930', '\u093c']), ('\u0934', &['\u0933', '\u093c']), ('\u0958', &['\u0915',
- '\u093c']), ('\u0959', &['\u0916', '\u093c']), ('\u095a', &['\u0917', '\u093c']), ('\u095b',
- &['\u091c', '\u093c']), ('\u095c', &['\u0921', '\u093c']), ('\u095d', &['\u0922',
- '\u093c']), ('\u095e', &['\u092b', '\u093c']), ('\u095f', &['\u092f', '\u093c']), ('\u09cb',
- &['\u09c7', '\u09be']), ('\u09cc', &['\u09c7', '\u09d7']), ('\u09dc', &['\u09a1',
- '\u09bc']), ('\u09dd', &['\u09a2', '\u09bc']), ('\u09df', &['\u09af', '\u09bc']), ('\u0a33',
- &['\u0a32', '\u0a3c']), ('\u0a36', &['\u0a38', '\u0a3c']), ('\u0a59', &['\u0a16',
- '\u0a3c']), ('\u0a5a', &['\u0a17', '\u0a3c']), ('\u0a5b', &['\u0a1c', '\u0a3c']), ('\u0a5e',
- &['\u0a2b', '\u0a3c']), ('\u0b48', &['\u0b47', '\u0b56']), ('\u0b4b', &['\u0b47',
- '\u0b3e']), ('\u0b4c', &['\u0b47', '\u0b57']), ('\u0b5c', &['\u0b21', '\u0b3c']), ('\u0b5d',
- &['\u0b22', '\u0b3c']), ('\u0b94', &['\u0b92', '\u0bd7']), ('\u0bca', &['\u0bc6',
- '\u0bbe']), ('\u0bcb', &['\u0bc7', '\u0bbe']), ('\u0bcc', &['\u0bc6', '\u0bd7']), ('\u0c48',
- &['\u0c46', '\u0c56']), ('\u0cc0', &['\u0cbf', '\u0cd5']), ('\u0cc7', &['\u0cc6',
- '\u0cd5']), ('\u0cc8', &['\u0cc6', '\u0cd6']), ('\u0cca', &['\u0cc6', '\u0cc2']), ('\u0ccb',
- &['\u0cca', '\u0cd5']), ('\u0d4a', &['\u0d46', '\u0d3e']), ('\u0d4b', &['\u0d47',
- '\u0d3e']), ('\u0d4c', &['\u0d46', '\u0d57']), ('\u0dda', &['\u0dd9', '\u0dca']), ('\u0ddc',
- &['\u0dd9', '\u0dcf']), ('\u0ddd', &['\u0ddc', '\u0dca']), ('\u0dde', &['\u0dd9',
- '\u0ddf']), ('\u0f43', &['\u0f42', '\u0fb7']), ('\u0f4d', &['\u0f4c', '\u0fb7']), ('\u0f52',
- &['\u0f51', '\u0fb7']), ('\u0f57', &['\u0f56', '\u0fb7']), ('\u0f5c', &['\u0f5b',
- '\u0fb7']), ('\u0f69', &['\u0f40', '\u0fb5']), ('\u0f73', &['\u0f71', '\u0f72']), ('\u0f75',
- &['\u0f71', '\u0f74']), ('\u0f76', &['\u0fb2', '\u0f80']), ('\u0f78', &['\u0fb3',
- '\u0f80']), ('\u0f81', &['\u0f71', '\u0f80']), ('\u0f93', &['\u0f92', '\u0fb7']), ('\u0f9d',
- &['\u0f9c', '\u0fb7']), ('\u0fa2', &['\u0fa1', '\u0fb7']), ('\u0fa7', &['\u0fa6',
- '\u0fb7']), ('\u0fac', &['\u0fab', '\u0fb7']), ('\u0fb9', &['\u0f90', '\u0fb5']), ('\u1026',
- &['\u1025', '\u102e']), ('\u1b06', &['\u1b05', '\u1b35']), ('\u1b08', &['\u1b07',
- '\u1b35']), ('\u1b0a', &['\u1b09', '\u1b35']), ('\u1b0c', &['\u1b0b', '\u1b35']), ('\u1b0e',
- &['\u1b0d', '\u1b35']), ('\u1b12', &['\u1b11', '\u1b35']), ('\u1b3b', &['\u1b3a',
- '\u1b35']), ('\u1b3d', &['\u1b3c', '\u1b35']), ('\u1b40', &['\u1b3e', '\u1b35']), ('\u1b41',
- &['\u1b3f', '\u1b35']), ('\u1b43', &['\u1b42', '\u1b35']), ('\u1e00', &['\x41', '\u0325']),
- ('\u1e01', &['\x61', '\u0325']), ('\u1e02', &['\x42', '\u0307']), ('\u1e03', &['\x62',
- '\u0307']), ('\u1e04', &['\x42', '\u0323']), ('\u1e05', &['\x62', '\u0323']), ('\u1e06',
- &['\x42', '\u0331']), ('\u1e07', &['\x62', '\u0331']), ('\u1e08', &['\xc7', '\u0301']),
- ('\u1e09', &['\xe7', '\u0301']), ('\u1e0a', &['\x44', '\u0307']), ('\u1e0b', &['\x64',
- '\u0307']), ('\u1e0c', &['\x44', '\u0323']), ('\u1e0d', &['\x64', '\u0323']), ('\u1e0e',
- &['\x44', '\u0331']), ('\u1e0f', &['\x64', '\u0331']), ('\u1e10', &['\x44', '\u0327']),
- ('\u1e11', &['\x64', '\u0327']), ('\u1e12', &['\x44', '\u032d']), ('\u1e13', &['\x64',
- '\u032d']), ('\u1e14', &['\u0112', '\u0300']), ('\u1e15', &['\u0113', '\u0300']), ('\u1e16',
- &['\u0112', '\u0301']), ('\u1e17', &['\u0113', '\u0301']), ('\u1e18', &['\x45', '\u032d']),
- ('\u1e19', &['\x65', '\u032d']), ('\u1e1a', &['\x45', '\u0330']), ('\u1e1b', &['\x65',
- '\u0330']), ('\u1e1c', &['\u0228', '\u0306']), ('\u1e1d', &['\u0229', '\u0306']), ('\u1e1e',
- &['\x46', '\u0307']), ('\u1e1f', &['\x66', '\u0307']), ('\u1e20', &['\x47', '\u0304']),
- ('\u1e21', &['\x67', '\u0304']), ('\u1e22', &['\x48', '\u0307']), ('\u1e23', &['\x68',
- '\u0307']), ('\u1e24', &['\x48', '\u0323']), ('\u1e25', &['\x68', '\u0323']), ('\u1e26',
- &['\x48', '\u0308']), ('\u1e27', &['\x68', '\u0308']), ('\u1e28', &['\x48', '\u0327']),
- ('\u1e29', &['\x68', '\u0327']), ('\u1e2a', &['\x48', '\u032e']), ('\u1e2b', &['\x68',
- '\u032e']), ('\u1e2c', &['\x49', '\u0330']), ('\u1e2d', &['\x69', '\u0330']), ('\u1e2e',
- &['\xcf', '\u0301']), ('\u1e2f', &['\xef', '\u0301']), ('\u1e30', &['\x4b', '\u0301']),
- ('\u1e31', &['\x6b', '\u0301']), ('\u1e32', &['\x4b', '\u0323']), ('\u1e33', &['\x6b',
- '\u0323']), ('\u1e34', &['\x4b', '\u0331']), ('\u1e35', &['\x6b', '\u0331']), ('\u1e36',
- &['\x4c', '\u0323']), ('\u1e37', &['\x6c', '\u0323']), ('\u1e38', &['\u1e36', '\u0304']),
- ('\u1e39', &['\u1e37', '\u0304']), ('\u1e3a', &['\x4c', '\u0331']), ('\u1e3b', &['\x6c',
- '\u0331']), ('\u1e3c', &['\x4c', '\u032d']), ('\u1e3d', &['\x6c', '\u032d']), ('\u1e3e',
- &['\x4d', '\u0301']), ('\u1e3f', &['\x6d', '\u0301']), ('\u1e40', &['\x4d', '\u0307']),
- ('\u1e41', &['\x6d', '\u0307']), ('\u1e42', &['\x4d', '\u0323']), ('\u1e43', &['\x6d',
- '\u0323']), ('\u1e44', &['\x4e', '\u0307']), ('\u1e45', &['\x6e', '\u0307']), ('\u1e46',
- &['\x4e', '\u0323']), ('\u1e47', &['\x6e', '\u0323']), ('\u1e48', &['\x4e', '\u0331']),
- ('\u1e49', &['\x6e', '\u0331']), ('\u1e4a', &['\x4e', '\u032d']), ('\u1e4b', &['\x6e',
- '\u032d']), ('\u1e4c', &['\xd5', '\u0301']), ('\u1e4d', &['\xf5', '\u0301']), ('\u1e4e',
- &['\xd5', '\u0308']), ('\u1e4f', &['\xf5', '\u0308']), ('\u1e50', &['\u014c', '\u0300']),
- ('\u1e51', &['\u014d', '\u0300']), ('\u1e52', &['\u014c', '\u0301']), ('\u1e53', &['\u014d',
- '\u0301']), ('\u1e54', &['\x50', '\u0301']), ('\u1e55', &['\x70', '\u0301']), ('\u1e56',
- &['\x50', '\u0307']), ('\u1e57', &['\x70', '\u0307']), ('\u1e58', &['\x52', '\u0307']),
- ('\u1e59', &['\x72', '\u0307']), ('\u1e5a', &['\x52', '\u0323']), ('\u1e5b', &['\x72',
- '\u0323']), ('\u1e5c', &['\u1e5a', '\u0304']), ('\u1e5d', &['\u1e5b', '\u0304']), ('\u1e5e',
- &['\x52', '\u0331']), ('\u1e5f', &['\x72', '\u0331']), ('\u1e60', &['\x53', '\u0307']),
- ('\u1e61', &['\x73', '\u0307']), ('\u1e62', &['\x53', '\u0323']), ('\u1e63', &['\x73',
- '\u0323']), ('\u1e64', &['\u015a', '\u0307']), ('\u1e65', &['\u015b', '\u0307']), ('\u1e66',
- &['\u0160', '\u0307']), ('\u1e67', &['\u0161', '\u0307']), ('\u1e68', &['\u1e62',
- '\u0307']), ('\u1e69', &['\u1e63', '\u0307']), ('\u1e6a', &['\x54', '\u0307']), ('\u1e6b',
- &['\x74', '\u0307']), ('\u1e6c', &['\x54', '\u0323']), ('\u1e6d', &['\x74', '\u0323']),
- ('\u1e6e', &['\x54', '\u0331']), ('\u1e6f', &['\x74', '\u0331']), ('\u1e70', &['\x54',
- '\u032d']), ('\u1e71', &['\x74', '\u032d']), ('\u1e72', &['\x55', '\u0324']), ('\u1e73',
- &['\x75', '\u0324']), ('\u1e74', &['\x55', '\u0330']), ('\u1e75', &['\x75', '\u0330']),
- ('\u1e76', &['\x55', '\u032d']), ('\u1e77', &['\x75', '\u032d']), ('\u1e78', &['\u0168',
- '\u0301']), ('\u1e79', &['\u0169', '\u0301']), ('\u1e7a', &['\u016a', '\u0308']), ('\u1e7b',
- &['\u016b', '\u0308']), ('\u1e7c', &['\x56', '\u0303']), ('\u1e7d', &['\x76', '\u0303']),
- ('\u1e7e', &['\x56', '\u0323']), ('\u1e7f', &['\x76', '\u0323']), ('\u1e80', &['\x57',
- '\u0300']), ('\u1e81', &['\x77', '\u0300']), ('\u1e82', &['\x57', '\u0301']), ('\u1e83',
- &['\x77', '\u0301']), ('\u1e84', &['\x57', '\u0308']), ('\u1e85', &['\x77', '\u0308']),
- ('\u1e86', &['\x57', '\u0307']), ('\u1e87', &['\x77', '\u0307']), ('\u1e88', &['\x57',
- '\u0323']), ('\u1e89', &['\x77', '\u0323']), ('\u1e8a', &['\x58', '\u0307']), ('\u1e8b',
- &['\x78', '\u0307']), ('\u1e8c', &['\x58', '\u0308']), ('\u1e8d', &['\x78', '\u0308']),
- ('\u1e8e', &['\x59', '\u0307']), ('\u1e8f', &['\x79', '\u0307']), ('\u1e90', &['\x5a',
- '\u0302']), ('\u1e91', &['\x7a', '\u0302']), ('\u1e92', &['\x5a', '\u0323']), ('\u1e93',
- &['\x7a', '\u0323']), ('\u1e94', &['\x5a', '\u0331']), ('\u1e95', &['\x7a', '\u0331']),
- ('\u1e96', &['\x68', '\u0331']), ('\u1e97', &['\x74', '\u0308']), ('\u1e98', &['\x77',
- '\u030a']), ('\u1e99', &['\x79', '\u030a']), ('\u1e9b', &['\u017f', '\u0307']), ('\u1ea0',
- &['\x41', '\u0323']), ('\u1ea1', &['\x61', '\u0323']), ('\u1ea2', &['\x41', '\u0309']),
- ('\u1ea3', &['\x61', '\u0309']), ('\u1ea4', &['\xc2', '\u0301']), ('\u1ea5', &['\xe2',
- '\u0301']), ('\u1ea6', &['\xc2', '\u0300']), ('\u1ea7', &['\xe2', '\u0300']), ('\u1ea8',
- &['\xc2', '\u0309']), ('\u1ea9', &['\xe2', '\u0309']), ('\u1eaa', &['\xc2', '\u0303']),
- ('\u1eab', &['\xe2', '\u0303']), ('\u1eac', &['\u1ea0', '\u0302']), ('\u1ead', &['\u1ea1',
- '\u0302']), ('\u1eae', &['\u0102', '\u0301']), ('\u1eaf', &['\u0103', '\u0301']), ('\u1eb0',
- &['\u0102', '\u0300']), ('\u1eb1', &['\u0103', '\u0300']), ('\u1eb2', &['\u0102',
- '\u0309']), ('\u1eb3', &['\u0103', '\u0309']), ('\u1eb4', &['\u0102', '\u0303']), ('\u1eb5',
- &['\u0103', '\u0303']), ('\u1eb6', &['\u1ea0', '\u0306']), ('\u1eb7', &['\u1ea1',
- '\u0306']), ('\u1eb8', &['\x45', '\u0323']), ('\u1eb9', &['\x65', '\u0323']), ('\u1eba',
- &['\x45', '\u0309']), ('\u1ebb', &['\x65', '\u0309']), ('\u1ebc', &['\x45', '\u0303']),
- ('\u1ebd', &['\x65', '\u0303']), ('\u1ebe', &['\xca', '\u0301']), ('\u1ebf', &['\xea',
- '\u0301']), ('\u1ec0', &['\xca', '\u0300']), ('\u1ec1', &['\xea', '\u0300']), ('\u1ec2',
- &['\xca', '\u0309']), ('\u1ec3', &['\xea', '\u0309']), ('\u1ec4', &['\xca', '\u0303']),
- ('\u1ec5', &['\xea', '\u0303']), ('\u1ec6', &['\u1eb8', '\u0302']), ('\u1ec7', &['\u1eb9',
- '\u0302']), ('\u1ec8', &['\x49', '\u0309']), ('\u1ec9', &['\x69', '\u0309']), ('\u1eca',
- &['\x49', '\u0323']), ('\u1ecb', &['\x69', '\u0323']), ('\u1ecc', &['\x4f', '\u0323']),
- ('\u1ecd', &['\x6f', '\u0323']), ('\u1ece', &['\x4f', '\u0309']), ('\u1ecf', &['\x6f',
- '\u0309']), ('\u1ed0', &['\xd4', '\u0301']), ('\u1ed1', &['\xf4', '\u0301']), ('\u1ed2',
- &['\xd4', '\u0300']), ('\u1ed3', &['\xf4', '\u0300']), ('\u1ed4', &['\xd4', '\u0309']),
- ('\u1ed5', &['\xf4', '\u0309']), ('\u1ed6', &['\xd4', '\u0303']), ('\u1ed7', &['\xf4',
- '\u0303']), ('\u1ed8', &['\u1ecc', '\u0302']), ('\u1ed9', &['\u1ecd', '\u0302']), ('\u1eda',
- &['\u01a0', '\u0301']), ('\u1edb', &['\u01a1', '\u0301']), ('\u1edc', &['\u01a0',
- '\u0300']), ('\u1edd', &['\u01a1', '\u0300']), ('\u1ede', &['\u01a0', '\u0309']), ('\u1edf',
- &['\u01a1', '\u0309']), ('\u1ee0', &['\u01a0', '\u0303']), ('\u1ee1', &['\u01a1',
- '\u0303']), ('\u1ee2', &['\u01a0', '\u0323']), ('\u1ee3', &['\u01a1', '\u0323']), ('\u1ee4',
- &['\x55', '\u0323']), ('\u1ee5', &['\x75', '\u0323']), ('\u1ee6', &['\x55', '\u0309']),
- ('\u1ee7', &['\x75', '\u0309']), ('\u1ee8', &['\u01af', '\u0301']), ('\u1ee9', &['\u01b0',
- '\u0301']), ('\u1eea', &['\u01af', '\u0300']), ('\u1eeb', &['\u01b0', '\u0300']), ('\u1eec',
- &['\u01af', '\u0309']), ('\u1eed', &['\u01b0', '\u0309']), ('\u1eee', &['\u01af',
- '\u0303']), ('\u1eef', &['\u01b0', '\u0303']), ('\u1ef0', &['\u01af', '\u0323']), ('\u1ef1',
- &['\u01b0', '\u0323']), ('\u1ef2', &['\x59', '\u0300']), ('\u1ef3', &['\x79', '\u0300']),
- ('\u1ef4', &['\x59', '\u0323']), ('\u1ef5', &['\x79', '\u0323']), ('\u1ef6', &['\x59',
- '\u0309']), ('\u1ef7', &['\x79', '\u0309']), ('\u1ef8', &['\x59', '\u0303']), ('\u1ef9',
- &['\x79', '\u0303']), ('\u1f00', &['\u03b1', '\u0313']), ('\u1f01', &['\u03b1', '\u0314']),
- ('\u1f02', &['\u1f00', '\u0300']), ('\u1f03', &['\u1f01', '\u0300']), ('\u1f04', &['\u1f00',
- '\u0301']), ('\u1f05', &['\u1f01', '\u0301']), ('\u1f06', &['\u1f00', '\u0342']), ('\u1f07',
- &['\u1f01', '\u0342']), ('\u1f08', &['\u0391', '\u0313']), ('\u1f09', &['\u0391',
- '\u0314']), ('\u1f0a', &['\u1f08', '\u0300']), ('\u1f0b', &['\u1f09', '\u0300']), ('\u1f0c',
- &['\u1f08', '\u0301']), ('\u1f0d', &['\u1f09', '\u0301']), ('\u1f0e', &['\u1f08',
- '\u0342']), ('\u1f0f', &['\u1f09', '\u0342']), ('\u1f10', &['\u03b5', '\u0313']), ('\u1f11',
- &['\u03b5', '\u0314']), ('\u1f12', &['\u1f10', '\u0300']), ('\u1f13', &['\u1f11',
- '\u0300']), ('\u1f14', &['\u1f10', '\u0301']), ('\u1f15', &['\u1f11', '\u0301']), ('\u1f18',
- &['\u0395', '\u0313']), ('\u1f19', &['\u0395', '\u0314']), ('\u1f1a', &['\u1f18',
- '\u0300']), ('\u1f1b', &['\u1f19', '\u0300']), ('\u1f1c', &['\u1f18', '\u0301']), ('\u1f1d',
- &['\u1f19', '\u0301']), ('\u1f20', &['\u03b7', '\u0313']), ('\u1f21', &['\u03b7',
- '\u0314']), ('\u1f22', &['\u1f20', '\u0300']), ('\u1f23', &['\u1f21', '\u0300']), ('\u1f24',
- &['\u1f20', '\u0301']), ('\u1f25', &['\u1f21', '\u0301']), ('\u1f26', &['\u1f20',
- '\u0342']), ('\u1f27', &['\u1f21', '\u0342']), ('\u1f28', &['\u0397', '\u0313']), ('\u1f29',
- &['\u0397', '\u0314']), ('\u1f2a', &['\u1f28', '\u0300']), ('\u1f2b', &['\u1f29',
- '\u0300']), ('\u1f2c', &['\u1f28', '\u0301']), ('\u1f2d', &['\u1f29', '\u0301']), ('\u1f2e',
- &['\u1f28', '\u0342']), ('\u1f2f', &['\u1f29', '\u0342']), ('\u1f30', &['\u03b9',
- '\u0313']), ('\u1f31', &['\u03b9', '\u0314']), ('\u1f32', &['\u1f30', '\u0300']), ('\u1f33',
- &['\u1f31', '\u0300']), ('\u1f34', &['\u1f30', '\u0301']), ('\u1f35', &['\u1f31',
- '\u0301']), ('\u1f36', &['\u1f30', '\u0342']), ('\u1f37', &['\u1f31', '\u0342']), ('\u1f38',
- &['\u0399', '\u0313']), ('\u1f39', &['\u0399', '\u0314']), ('\u1f3a', &['\u1f38',
- '\u0300']), ('\u1f3b', &['\u1f39', '\u0300']), ('\u1f3c', &['\u1f38', '\u0301']), ('\u1f3d',
- &['\u1f39', '\u0301']), ('\u1f3e', &['\u1f38', '\u0342']), ('\u1f3f', &['\u1f39',
- '\u0342']), ('\u1f40', &['\u03bf', '\u0313']), ('\u1f41', &['\u03bf', '\u0314']), ('\u1f42',
- &['\u1f40', '\u0300']), ('\u1f43', &['\u1f41', '\u0300']), ('\u1f44', &['\u1f40',
- '\u0301']), ('\u1f45', &['\u1f41', '\u0301']), ('\u1f48', &['\u039f', '\u0313']), ('\u1f49',
- &['\u039f', '\u0314']), ('\u1f4a', &['\u1f48', '\u0300']), ('\u1f4b', &['\u1f49',
- '\u0300']), ('\u1f4c', &['\u1f48', '\u0301']), ('\u1f4d', &['\u1f49', '\u0301']), ('\u1f50',
- &['\u03c5', '\u0313']), ('\u1f51', &['\u03c5', '\u0314']), ('\u1f52', &['\u1f50',
- '\u0300']), ('\u1f53', &['\u1f51', '\u0300']), ('\u1f54', &['\u1f50', '\u0301']), ('\u1f55',
- &['\u1f51', '\u0301']), ('\u1f56', &['\u1f50', '\u0342']), ('\u1f57', &['\u1f51',
- '\u0342']), ('\u1f59', &['\u03a5', '\u0314']), ('\u1f5b', &['\u1f59', '\u0300']), ('\u1f5d',
- &['\u1f59', '\u0301']), ('\u1f5f', &['\u1f59', '\u0342']), ('\u1f60', &['\u03c9',
- '\u0313']), ('\u1f61', &['\u03c9', '\u0314']), ('\u1f62', &['\u1f60', '\u0300']), ('\u1f63',
- &['\u1f61', '\u0300']), ('\u1f64', &['\u1f60', '\u0301']), ('\u1f65', &['\u1f61',
- '\u0301']), ('\u1f66', &['\u1f60', '\u0342']), ('\u1f67', &['\u1f61', '\u0342']), ('\u1f68',
- &['\u03a9', '\u0313']), ('\u1f69', &['\u03a9', '\u0314']), ('\u1f6a', &['\u1f68',
- '\u0300']), ('\u1f6b', &['\u1f69', '\u0300']), ('\u1f6c', &['\u1f68', '\u0301']), ('\u1f6d',
- &['\u1f69', '\u0301']), ('\u1f6e', &['\u1f68', '\u0342']), ('\u1f6f', &['\u1f69',
- '\u0342']), ('\u1f70', &['\u03b1', '\u0300']), ('\u1f71', &['\u03ac']), ('\u1f72',
- &['\u03b5', '\u0300']), ('\u1f73', &['\u03ad']), ('\u1f74', &['\u03b7', '\u0300']),
- ('\u1f75', &['\u03ae']), ('\u1f76', &['\u03b9', '\u0300']), ('\u1f77', &['\u03af']),
- ('\u1f78', &['\u03bf', '\u0300']), ('\u1f79', &['\u03cc']), ('\u1f7a', &['\u03c5',
- '\u0300']), ('\u1f7b', &['\u03cd']), ('\u1f7c', &['\u03c9', '\u0300']), ('\u1f7d',
- &['\u03ce']), ('\u1f80', &['\u1f00', '\u0345']), ('\u1f81', &['\u1f01', '\u0345']),
- ('\u1f82', &['\u1f02', '\u0345']), ('\u1f83', &['\u1f03', '\u0345']), ('\u1f84', &['\u1f04',
- '\u0345']), ('\u1f85', &['\u1f05', '\u0345']), ('\u1f86', &['\u1f06', '\u0345']), ('\u1f87',
- &['\u1f07', '\u0345']), ('\u1f88', &['\u1f08', '\u0345']), ('\u1f89', &['\u1f09',
- '\u0345']), ('\u1f8a', &['\u1f0a', '\u0345']), ('\u1f8b', &['\u1f0b', '\u0345']), ('\u1f8c',
- &['\u1f0c', '\u0345']), ('\u1f8d', &['\u1f0d', '\u0345']), ('\u1f8e', &['\u1f0e',
- '\u0345']), ('\u1f8f', &['\u1f0f', '\u0345']), ('\u1f90', &['\u1f20', '\u0345']), ('\u1f91',
- &['\u1f21', '\u0345']), ('\u1f92', &['\u1f22', '\u0345']), ('\u1f93', &['\u1f23',
- '\u0345']), ('\u1f94', &['\u1f24', '\u0345']), ('\u1f95', &['\u1f25', '\u0345']), ('\u1f96',
- &['\u1f26', '\u0345']), ('\u1f97', &['\u1f27', '\u0345']), ('\u1f98', &['\u1f28',
- '\u0345']), ('\u1f99', &['\u1f29', '\u0345']), ('\u1f9a', &['\u1f2a', '\u0345']), ('\u1f9b',
- &['\u1f2b', '\u0345']), ('\u1f9c', &['\u1f2c', '\u0345']), ('\u1f9d', &['\u1f2d',
- '\u0345']), ('\u1f9e', &['\u1f2e', '\u0345']), ('\u1f9f', &['\u1f2f', '\u0345']), ('\u1fa0',
- &['\u1f60', '\u0345']), ('\u1fa1', &['\u1f61', '\u0345']), ('\u1fa2', &['\u1f62',
- '\u0345']), ('\u1fa3', &['\u1f63', '\u0345']), ('\u1fa4', &['\u1f64', '\u0345']), ('\u1fa5',
- &['\u1f65', '\u0345']), ('\u1fa6', &['\u1f66', '\u0345']), ('\u1fa7', &['\u1f67',
- '\u0345']), ('\u1fa8', &['\u1f68', '\u0345']), ('\u1fa9', &['\u1f69', '\u0345']), ('\u1faa',
- &['\u1f6a', '\u0345']), ('\u1fab', &['\u1f6b', '\u0345']), ('\u1fac', &['\u1f6c',
- '\u0345']), ('\u1fad', &['\u1f6d', '\u0345']), ('\u1fae', &['\u1f6e', '\u0345']), ('\u1faf',
- &['\u1f6f', '\u0345']), ('\u1fb0', &['\u03b1', '\u0306']), ('\u1fb1', &['\u03b1',
- '\u0304']), ('\u1fb2', &['\u1f70', '\u0345']), ('\u1fb3', &['\u03b1', '\u0345']), ('\u1fb4',
- &['\u03ac', '\u0345']), ('\u1fb6', &['\u03b1', '\u0342']), ('\u1fb7', &['\u1fb6',
- '\u0345']), ('\u1fb8', &['\u0391', '\u0306']), ('\u1fb9', &['\u0391', '\u0304']), ('\u1fba',
- &['\u0391', '\u0300']), ('\u1fbb', &['\u0386']), ('\u1fbc', &['\u0391', '\u0345']),
- ('\u1fbe', &['\u03b9']), ('\u1fc1', &['\xa8', '\u0342']), ('\u1fc2', &['\u1f74', '\u0345']),
- ('\u1fc3', &['\u03b7', '\u0345']), ('\u1fc4', &['\u03ae', '\u0345']), ('\u1fc6', &['\u03b7',
- '\u0342']), ('\u1fc7', &['\u1fc6', '\u0345']), ('\u1fc8', &['\u0395', '\u0300']), ('\u1fc9',
- &['\u0388']), ('\u1fca', &['\u0397', '\u0300']), ('\u1fcb', &['\u0389']), ('\u1fcc',
- &['\u0397', '\u0345']), ('\u1fcd', &['\u1fbf', '\u0300']), ('\u1fce', &['\u1fbf',
- '\u0301']), ('\u1fcf', &['\u1fbf', '\u0342']), ('\u1fd0', &['\u03b9', '\u0306']), ('\u1fd1',
- &['\u03b9', '\u0304']), ('\u1fd2', &['\u03ca', '\u0300']), ('\u1fd3', &['\u0390']),
- ('\u1fd6', &['\u03b9', '\u0342']), ('\u1fd7', &['\u03ca', '\u0342']), ('\u1fd8', &['\u0399',
- '\u0306']), ('\u1fd9', &['\u0399', '\u0304']), ('\u1fda', &['\u0399', '\u0300']), ('\u1fdb',
- &['\u038a']), ('\u1fdd', &['\u1ffe', '\u0300']), ('\u1fde', &['\u1ffe', '\u0301']),
- ('\u1fdf', &['\u1ffe', '\u0342']), ('\u1fe0', &['\u03c5', '\u0306']), ('\u1fe1', &['\u03c5',
- '\u0304']), ('\u1fe2', &['\u03cb', '\u0300']), ('\u1fe3', &['\u03b0']), ('\u1fe4',
- &['\u03c1', '\u0313']), ('\u1fe5', &['\u03c1', '\u0314']), ('\u1fe6', &['\u03c5',
- '\u0342']), ('\u1fe7', &['\u03cb', '\u0342']), ('\u1fe8', &['\u03a5', '\u0306']), ('\u1fe9',
- &['\u03a5', '\u0304']), ('\u1fea', &['\u03a5', '\u0300']), ('\u1feb', &['\u038e']),
- ('\u1fec', &['\u03a1', '\u0314']), ('\u1fed', &['\xa8', '\u0300']), ('\u1fee', &['\u0385']),
- ('\u1fef', &['\x60']), ('\u1ff2', &['\u1f7c', '\u0345']), ('\u1ff3', &['\u03c9', '\u0345']),
- ('\u1ff4', &['\u03ce', '\u0345']), ('\u1ff6', &['\u03c9', '\u0342']), ('\u1ff7', &['\u1ff6',
- '\u0345']), ('\u1ff8', &['\u039f', '\u0300']), ('\u1ff9', &['\u038c']), ('\u1ffa',
- &['\u03a9', '\u0300']), ('\u1ffb', &['\u038f']), ('\u1ffc', &['\u03a9', '\u0345']),
- ('\u1ffd', &['\xb4']), ('\u2000', &['\u2002']), ('\u2001', &['\u2003']), ('\u2126',
- &['\u03a9']), ('\u212a', &['\x4b']), ('\u212b', &['\xc5']), ('\u219a', &['\u2190',
- '\u0338']), ('\u219b', &['\u2192', '\u0338']), ('\u21ae', &['\u2194', '\u0338']), ('\u21cd',
- &['\u21d0', '\u0338']), ('\u21ce', &['\u21d4', '\u0338']), ('\u21cf', &['\u21d2',
- '\u0338']), ('\u2204', &['\u2203', '\u0338']), ('\u2209', &['\u2208', '\u0338']), ('\u220c',
- &['\u220b', '\u0338']), ('\u2224', &['\u2223', '\u0338']), ('\u2226', &['\u2225',
- '\u0338']), ('\u2241', &['\u223c', '\u0338']), ('\u2244', &['\u2243', '\u0338']), ('\u2247',
- &['\u2245', '\u0338']), ('\u2249', &['\u2248', '\u0338']), ('\u2260', &['\x3d', '\u0338']),
- ('\u2262', &['\u2261', '\u0338']), ('\u226d', &['\u224d', '\u0338']), ('\u226e', &['\x3c',
- '\u0338']), ('\u226f', &['\x3e', '\u0338']), ('\u2270', &['\u2264', '\u0338']), ('\u2271',
- &['\u2265', '\u0338']), ('\u2274', &['\u2272', '\u0338']), ('\u2275', &['\u2273',
- '\u0338']), ('\u2278', &['\u2276', '\u0338']), ('\u2279', &['\u2277', '\u0338']), ('\u2280',
- &['\u227a', '\u0338']), ('\u2281', &['\u227b', '\u0338']), ('\u2284', &['\u2282',
- '\u0338']), ('\u2285', &['\u2283', '\u0338']), ('\u2288', &['\u2286', '\u0338']), ('\u2289',
- &['\u2287', '\u0338']), ('\u22ac', &['\u22a2', '\u0338']), ('\u22ad', &['\u22a8',
- '\u0338']), ('\u22ae', &['\u22a9', '\u0338']), ('\u22af', &['\u22ab', '\u0338']), ('\u22e0',
- &['\u227c', '\u0338']), ('\u22e1', &['\u227d', '\u0338']), ('\u22e2', &['\u2291',
- '\u0338']), ('\u22e3', &['\u2292', '\u0338']), ('\u22ea', &['\u22b2', '\u0338']), ('\u22eb',
- &['\u22b3', '\u0338']), ('\u22ec', &['\u22b4', '\u0338']), ('\u22ed', &['\u22b5',
- '\u0338']), ('\u2329', &['\u3008']), ('\u232a', &['\u3009']), ('\u2adc', &['\u2add',
- '\u0338']), ('\u304c', &['\u304b', '\u3099']), ('\u304e', &['\u304d', '\u3099']), ('\u3050',
- &['\u304f', '\u3099']), ('\u3052', &['\u3051', '\u3099']), ('\u3054', &['\u3053',
- '\u3099']), ('\u3056', &['\u3055', '\u3099']), ('\u3058', &['\u3057', '\u3099']), ('\u305a',
- &['\u3059', '\u3099']), ('\u305c', &['\u305b', '\u3099']), ('\u305e', &['\u305d',
- '\u3099']), ('\u3060', &['\u305f', '\u3099']), ('\u3062', &['\u3061', '\u3099']), ('\u3065',
- &['\u3064', '\u3099']), ('\u3067', &['\u3066', '\u3099']), ('\u3069', &['\u3068',
- '\u3099']), ('\u3070', &['\u306f', '\u3099']), ('\u3071', &['\u306f', '\u309a']), ('\u3073',
- &['\u3072', '\u3099']), ('\u3074', &['\u3072', '\u309a']), ('\u3076', &['\u3075',
- '\u3099']), ('\u3077', &['\u3075', '\u309a']), ('\u3079', &['\u3078', '\u3099']), ('\u307a',
- &['\u3078', '\u309a']), ('\u307c', &['\u307b', '\u3099']), ('\u307d', &['\u307b',
- '\u309a']), ('\u3094', &['\u3046', '\u3099']), ('\u309e', &['\u309d', '\u3099']), ('\u30ac',
- &['\u30ab', '\u3099']), ('\u30ae', &['\u30ad', '\u3099']), ('\u30b0', &['\u30af',
- '\u3099']), ('\u30b2', &['\u30b1', '\u3099']), ('\u30b4', &['\u30b3', '\u3099']), ('\u30b6',
- &['\u30b5', '\u3099']), ('\u30b8', &['\u30b7', '\u3099']), ('\u30ba', &['\u30b9',
- '\u3099']), ('\u30bc', &['\u30bb', '\u3099']), ('\u30be', &['\u30bd', '\u3099']), ('\u30c0',
- &['\u30bf', '\u3099']), ('\u30c2', &['\u30c1', '\u3099']), ('\u30c5', &['\u30c4',
- '\u3099']), ('\u30c7', &['\u30c6', '\u3099']), ('\u30c9', &['\u30c8', '\u3099']), ('\u30d0',
- &['\u30cf', '\u3099']), ('\u30d1', &['\u30cf', '\u309a']), ('\u30d3', &['\u30d2',
- '\u3099']), ('\u30d4', &['\u30d2', '\u309a']), ('\u30d6', &['\u30d5', '\u3099']), ('\u30d7',
- &['\u30d5', '\u309a']), ('\u30d9', &['\u30d8', '\u3099']), ('\u30da', &['\u30d8',
- '\u309a']), ('\u30dc', &['\u30db', '\u3099']), ('\u30dd', &['\u30db', '\u309a']), ('\u30f4',
- &['\u30a6', '\u3099']), ('\u30f7', &['\u30ef', '\u3099']), ('\u30f8', &['\u30f0',
- '\u3099']), ('\u30f9', &['\u30f1', '\u3099']), ('\u30fa', &['\u30f2', '\u3099']), ('\u30fe',
- &['\u30fd', '\u3099']), ('\uf900', &['\u8c48']), ('\uf901', &['\u66f4']), ('\uf902',
- &['\u8eca']), ('\uf903', &['\u8cc8']), ('\uf904', &['\u6ed1']), ('\uf905', &['\u4e32']),
- ('\uf906', &['\u53e5']), ('\uf907', &['\u9f9c']), ('\uf908', &['\u9f9c']), ('\uf909',
- &['\u5951']), ('\uf90a', &['\u91d1']), ('\uf90b', &['\u5587']), ('\uf90c', &['\u5948']),
- ('\uf90d', &['\u61f6']), ('\uf90e', &['\u7669']), ('\uf90f', &['\u7f85']), ('\uf910',
- &['\u863f']), ('\uf911', &['\u87ba']), ('\uf912', &['\u88f8']), ('\uf913', &['\u908f']),
- ('\uf914', &['\u6a02']), ('\uf915', &['\u6d1b']), ('\uf916', &['\u70d9']), ('\uf917',
- &['\u73de']), ('\uf918', &['\u843d']), ('\uf919', &['\u916a']), ('\uf91a', &['\u99f1']),
- ('\uf91b', &['\u4e82']), ('\uf91c', &['\u5375']), ('\uf91d', &['\u6b04']), ('\uf91e',
- &['\u721b']), ('\uf91f', &['\u862d']), ('\uf920', &['\u9e1e']), ('\uf921', &['\u5d50']),
- ('\uf922', &['\u6feb']), ('\uf923', &['\u85cd']), ('\uf924', &['\u8964']), ('\uf925',
- &['\u62c9']), ('\uf926', &['\u81d8']), ('\uf927', &['\u881f']), ('\uf928', &['\u5eca']),
- ('\uf929', &['\u6717']), ('\uf92a', &['\u6d6a']), ('\uf92b', &['\u72fc']), ('\uf92c',
- &['\u90ce']), ('\uf92d', &['\u4f86']), ('\uf92e', &['\u51b7']), ('\uf92f', &['\u52de']),
- ('\uf930', &['\u64c4']), ('\uf931', &['\u6ad3']), ('\uf932', &['\u7210']), ('\uf933',
- &['\u76e7']), ('\uf934', &['\u8001']), ('\uf935', &['\u8606']), ('\uf936', &['\u865c']),
- ('\uf937', &['\u8def']), ('\uf938', &['\u9732']), ('\uf939', &['\u9b6f']), ('\uf93a',
- &['\u9dfa']), ('\uf93b', &['\u788c']), ('\uf93c', &['\u797f']), ('\uf93d', &['\u7da0']),
- ('\uf93e', &['\u83c9']), ('\uf93f', &['\u9304']), ('\uf940', &['\u9e7f']), ('\uf941',
- &['\u8ad6']), ('\uf942', &['\u58df']), ('\uf943', &['\u5f04']), ('\uf944', &['\u7c60']),
- ('\uf945', &['\u807e']), ('\uf946', &['\u7262']), ('\uf947', &['\u78ca']), ('\uf948',
- &['\u8cc2']), ('\uf949', &['\u96f7']), ('\uf94a', &['\u58d8']), ('\uf94b', &['\u5c62']),
- ('\uf94c', &['\u6a13']), ('\uf94d', &['\u6dda']), ('\uf94e', &['\u6f0f']), ('\uf94f',
- &['\u7d2f']), ('\uf950', &['\u7e37']), ('\uf951', &['\u964b']), ('\uf952', &['\u52d2']),
- ('\uf953', &['\u808b']), ('\uf954', &['\u51dc']), ('\uf955', &['\u51cc']), ('\uf956',
- &['\u7a1c']), ('\uf957', &['\u7dbe']), ('\uf958', &['\u83f1']), ('\uf959', &['\u9675']),
- ('\uf95a', &['\u8b80']), ('\uf95b', &['\u62cf']), ('\uf95c', &['\u6a02']), ('\uf95d',
- &['\u8afe']), ('\uf95e', &['\u4e39']), ('\uf95f', &['\u5be7']), ('\uf960', &['\u6012']),
- ('\uf961', &['\u7387']), ('\uf962', &['\u7570']), ('\uf963', &['\u5317']), ('\uf964',
- &['\u78fb']), ('\uf965', &['\u4fbf']), ('\uf966', &['\u5fa9']), ('\uf967', &['\u4e0d']),
- ('\uf968', &['\u6ccc']), ('\uf969', &['\u6578']), ('\uf96a', &['\u7d22']), ('\uf96b',
- &['\u53c3']), ('\uf96c', &['\u585e']), ('\uf96d', &['\u7701']), ('\uf96e', &['\u8449']),
- ('\uf96f', &['\u8aaa']), ('\uf970', &['\u6bba']), ('\uf971', &['\u8fb0']), ('\uf972',
- &['\u6c88']), ('\uf973', &['\u62fe']), ('\uf974', &['\u82e5']), ('\uf975', &['\u63a0']),
- ('\uf976', &['\u7565']), ('\uf977', &['\u4eae']), ('\uf978', &['\u5169']), ('\uf979',
- &['\u51c9']), ('\uf97a', &['\u6881']), ('\uf97b', &['\u7ce7']), ('\uf97c', &['\u826f']),
- ('\uf97d', &['\u8ad2']), ('\uf97e', &['\u91cf']), ('\uf97f', &['\u52f5']), ('\uf980',
- &['\u5442']), ('\uf981', &['\u5973']), ('\uf982', &['\u5eec']), ('\uf983', &['\u65c5']),
- ('\uf984', &['\u6ffe']), ('\uf985', &['\u792a']), ('\uf986', &['\u95ad']), ('\uf987',
- &['\u9a6a']), ('\uf988', &['\u9e97']), ('\uf989', &['\u9ece']), ('\uf98a', &['\u529b']),
- ('\uf98b', &['\u66c6']), ('\uf98c', &['\u6b77']), ('\uf98d', &['\u8f62']), ('\uf98e',
- &['\u5e74']), ('\uf98f', &['\u6190']), ('\uf990', &['\u6200']), ('\uf991', &['\u649a']),
- ('\uf992', &['\u6f23']), ('\uf993', &['\u7149']), ('\uf994', &['\u7489']), ('\uf995',
- &['\u79ca']), ('\uf996', &['\u7df4']), ('\uf997', &['\u806f']), ('\uf998', &['\u8f26']),
- ('\uf999', &['\u84ee']), ('\uf99a', &['\u9023']), ('\uf99b', &['\u934a']), ('\uf99c',
- &['\u5217']), ('\uf99d', &['\u52a3']), ('\uf99e', &['\u54bd']), ('\uf99f', &['\u70c8']),
- ('\uf9a0', &['\u88c2']), ('\uf9a1', &['\u8aaa']), ('\uf9a2', &['\u5ec9']), ('\uf9a3',
- &['\u5ff5']), ('\uf9a4', &['\u637b']), ('\uf9a5', &['\u6bae']), ('\uf9a6', &['\u7c3e']),
- ('\uf9a7', &['\u7375']), ('\uf9a8', &['\u4ee4']), ('\uf9a9', &['\u56f9']), ('\uf9aa',
- &['\u5be7']), ('\uf9ab', &['\u5dba']), ('\uf9ac', &['\u601c']), ('\uf9ad', &['\u73b2']),
- ('\uf9ae', &['\u7469']), ('\uf9af', &['\u7f9a']), ('\uf9b0', &['\u8046']), ('\uf9b1',
- &['\u9234']), ('\uf9b2', &['\u96f6']), ('\uf9b3', &['\u9748']), ('\uf9b4', &['\u9818']),
- ('\uf9b5', &['\u4f8b']), ('\uf9b6', &['\u79ae']), ('\uf9b7', &['\u91b4']), ('\uf9b8',
- &['\u96b8']), ('\uf9b9', &['\u60e1']), ('\uf9ba', &['\u4e86']), ('\uf9bb', &['\u50da']),
- ('\uf9bc', &['\u5bee']), ('\uf9bd', &['\u5c3f']), ('\uf9be', &['\u6599']), ('\uf9bf',
- &['\u6a02']), ('\uf9c0', &['\u71ce']), ('\uf9c1', &['\u7642']), ('\uf9c2', &['\u84fc']),
- ('\uf9c3', &['\u907c']), ('\uf9c4', &['\u9f8d']), ('\uf9c5', &['\u6688']), ('\uf9c6',
- &['\u962e']), ('\uf9c7', &['\u5289']), ('\uf9c8', &['\u677b']), ('\uf9c9', &['\u67f3']),
- ('\uf9ca', &['\u6d41']), ('\uf9cb', &['\u6e9c']), ('\uf9cc', &['\u7409']), ('\uf9cd',
- &['\u7559']), ('\uf9ce', &['\u786b']), ('\uf9cf', &['\u7d10']), ('\uf9d0', &['\u985e']),
- ('\uf9d1', &['\u516d']), ('\uf9d2', &['\u622e']), ('\uf9d3', &['\u9678']), ('\uf9d4',
- &['\u502b']), ('\uf9d5', &['\u5d19']), ('\uf9d6', &['\u6dea']), ('\uf9d7', &['\u8f2a']),
- ('\uf9d8', &['\u5f8b']), ('\uf9d9', &['\u6144']), ('\uf9da', &['\u6817']), ('\uf9db',
- &['\u7387']), ('\uf9dc', &['\u9686']), ('\uf9dd', &['\u5229']), ('\uf9de', &['\u540f']),
- ('\uf9df', &['\u5c65']), ('\uf9e0', &['\u6613']), ('\uf9e1', &['\u674e']), ('\uf9e2',
- &['\u68a8']), ('\uf9e3', &['\u6ce5']), ('\uf9e4', &['\u7406']), ('\uf9e5', &['\u75e2']),
- ('\uf9e6', &['\u7f79']), ('\uf9e7', &['\u88cf']), ('\uf9e8', &['\u88e1']), ('\uf9e9',
- &['\u91cc']), ('\uf9ea', &['\u96e2']), ('\uf9eb', &['\u533f']), ('\uf9ec', &['\u6eba']),
- ('\uf9ed', &['\u541d']), ('\uf9ee', &['\u71d0']), ('\uf9ef', &['\u7498']), ('\uf9f0',
- &['\u85fa']), ('\uf9f1', &['\u96a3']), ('\uf9f2', &['\u9c57']), ('\uf9f3', &['\u9e9f']),
- ('\uf9f4', &['\u6797']), ('\uf9f5', &['\u6dcb']), ('\uf9f6', &['\u81e8']), ('\uf9f7',
- &['\u7acb']), ('\uf9f8', &['\u7b20']), ('\uf9f9', &['\u7c92']), ('\uf9fa', &['\u72c0']),
- ('\uf9fb', &['\u7099']), ('\uf9fc', &['\u8b58']), ('\uf9fd', &['\u4ec0']), ('\uf9fe',
- &['\u8336']), ('\uf9ff', &['\u523a']), ('\ufa00', &['\u5207']), ('\ufa01', &['\u5ea6']),
- ('\ufa02', &['\u62d3']), ('\ufa03', &['\u7cd6']), ('\ufa04', &['\u5b85']), ('\ufa05',
- &['\u6d1e']), ('\ufa06', &['\u66b4']), ('\ufa07', &['\u8f3b']), ('\ufa08', &['\u884c']),
- ('\ufa09', &['\u964d']), ('\ufa0a', &['\u898b']), ('\ufa0b', &['\u5ed3']), ('\ufa0c',
- &['\u5140']), ('\ufa0d', &['\u55c0']), ('\ufa10', &['\u585a']), ('\ufa12', &['\u6674']),
- ('\ufa15', &['\u51de']), ('\ufa16', &['\u732a']), ('\ufa17', &['\u76ca']), ('\ufa18',
- &['\u793c']), ('\ufa19', &['\u795e']), ('\ufa1a', &['\u7965']), ('\ufa1b', &['\u798f']),
- ('\ufa1c', &['\u9756']), ('\ufa1d', &['\u7cbe']), ('\ufa1e', &['\u7fbd']), ('\ufa20',
- &['\u8612']), ('\ufa22', &['\u8af8']), ('\ufa25', &['\u9038']), ('\ufa26', &['\u90fd']),
- ('\ufa2a', &['\u98ef']), ('\ufa2b', &['\u98fc']), ('\ufa2c', &['\u9928']), ('\ufa2d',
- &['\u9db4']), ('\ufa2e', &['\u90de']), ('\ufa2f', &['\u96b7']), ('\ufa30', &['\u4fae']),
- ('\ufa31', &['\u50e7']), ('\ufa32', &['\u514d']), ('\ufa33', &['\u52c9']), ('\ufa34',
- &['\u52e4']), ('\ufa35', &['\u5351']), ('\ufa36', &['\u559d']), ('\ufa37', &['\u5606']),
- ('\ufa38', &['\u5668']), ('\ufa39', &['\u5840']), ('\ufa3a', &['\u58a8']), ('\ufa3b',
- &['\u5c64']), ('\ufa3c', &['\u5c6e']), ('\ufa3d', &['\u6094']), ('\ufa3e', &['\u6168']),
- ('\ufa3f', &['\u618e']), ('\ufa40', &['\u61f2']), ('\ufa41', &['\u654f']), ('\ufa42',
- &['\u65e2']), ('\ufa43', &['\u6691']), ('\ufa44', &['\u6885']), ('\ufa45', &['\u6d77']),
- ('\ufa46', &['\u6e1a']), ('\ufa47', &['\u6f22']), ('\ufa48', &['\u716e']), ('\ufa49',
- &['\u722b']), ('\ufa4a', &['\u7422']), ('\ufa4b', &['\u7891']), ('\ufa4c', &['\u793e']),
- ('\ufa4d', &['\u7949']), ('\ufa4e', &['\u7948']), ('\ufa4f', &['\u7950']), ('\ufa50',
- &['\u7956']), ('\ufa51', &['\u795d']), ('\ufa52', &['\u798d']), ('\ufa53', &['\u798e']),
- ('\ufa54', &['\u7a40']), ('\ufa55', &['\u7a81']), ('\ufa56', &['\u7bc0']), ('\ufa57',
- &['\u7df4']), ('\ufa58', &['\u7e09']), ('\ufa59', &['\u7e41']), ('\ufa5a', &['\u7f72']),
- ('\ufa5b', &['\u8005']), ('\ufa5c', &['\u81ed']), ('\ufa5d', &['\u8279']), ('\ufa5e',
- &['\u8279']), ('\ufa5f', &['\u8457']), ('\ufa60', &['\u8910']), ('\ufa61', &['\u8996']),
- ('\ufa62', &['\u8b01']), ('\ufa63', &['\u8b39']), ('\ufa64', &['\u8cd3']), ('\ufa65',
- &['\u8d08']), ('\ufa66', &['\u8fb6']), ('\ufa67', &['\u9038']), ('\ufa68', &['\u96e3']),
- ('\ufa69', &['\u97ff']), ('\ufa6a', &['\u983b']), ('\ufa6b', &['\u6075']), ('\ufa6c',
- &['\U000242ee']), ('\ufa6d', &['\u8218']), ('\ufa70', &['\u4e26']), ('\ufa71', &['\u51b5']),
- ('\ufa72', &['\u5168']), ('\ufa73', &['\u4f80']), ('\ufa74', &['\u5145']), ('\ufa75',
- &['\u5180']), ('\ufa76', &['\u52c7']), ('\ufa77', &['\u52fa']), ('\ufa78', &['\u559d']),
- ('\ufa79', &['\u5555']), ('\ufa7a', &['\u5599']), ('\ufa7b', &['\u55e2']), ('\ufa7c',
- &['\u585a']), ('\ufa7d', &['\u58b3']), ('\ufa7e', &['\u5944']), ('\ufa7f', &['\u5954']),
- ('\ufa80', &['\u5a62']), ('\ufa81', &['\u5b28']), ('\ufa82', &['\u5ed2']), ('\ufa83',
- &['\u5ed9']), ('\ufa84', &['\u5f69']), ('\ufa85', &['\u5fad']), ('\ufa86', &['\u60d8']),
- ('\ufa87', &['\u614e']), ('\ufa88', &['\u6108']), ('\ufa89', &['\u618e']), ('\ufa8a',
- &['\u6160']), ('\ufa8b', &['\u61f2']), ('\ufa8c', &['\u6234']), ('\ufa8d', &['\u63c4']),
- ('\ufa8e', &['\u641c']), ('\ufa8f', &['\u6452']), ('\ufa90', &['\u6556']), ('\ufa91',
- &['\u6674']), ('\ufa92', &['\u6717']), ('\ufa93', &['\u671b']), ('\ufa94', &['\u6756']),
- ('\ufa95', &['\u6b79']), ('\ufa96', &['\u6bba']), ('\ufa97', &['\u6d41']), ('\ufa98',
- &['\u6edb']), ('\ufa99', &['\u6ecb']), ('\ufa9a', &['\u6f22']), ('\ufa9b', &['\u701e']),
- ('\ufa9c', &['\u716e']), ('\ufa9d', &['\u77a7']), ('\ufa9e', &['\u7235']), ('\ufa9f',
- &['\u72af']), ('\ufaa0', &['\u732a']), ('\ufaa1', &['\u7471']), ('\ufaa2', &['\u7506']),
- ('\ufaa3', &['\u753b']), ('\ufaa4', &['\u761d']), ('\ufaa5', &['\u761f']), ('\ufaa6',
- &['\u76ca']), ('\ufaa7', &['\u76db']), ('\ufaa8', &['\u76f4']), ('\ufaa9', &['\u774a']),
- ('\ufaaa', &['\u7740']), ('\ufaab', &['\u78cc']), ('\ufaac', &['\u7ab1']), ('\ufaad',
- &['\u7bc0']), ('\ufaae', &['\u7c7b']), ('\ufaaf', &['\u7d5b']), ('\ufab0', &['\u7df4']),
- ('\ufab1', &['\u7f3e']), ('\ufab2', &['\u8005']), ('\ufab3', &['\u8352']), ('\ufab4',
- &['\u83ef']), ('\ufab5', &['\u8779']), ('\ufab6', &['\u8941']), ('\ufab7', &['\u8986']),
- ('\ufab8', &['\u8996']), ('\ufab9', &['\u8abf']), ('\ufaba', &['\u8af8']), ('\ufabb',
- &['\u8acb']), ('\ufabc', &['\u8b01']), ('\ufabd', &['\u8afe']), ('\ufabe', &['\u8aed']),
- ('\ufabf', &['\u8b39']), ('\ufac0', &['\u8b8a']), ('\ufac1', &['\u8d08']), ('\ufac2',
- &['\u8f38']), ('\ufac3', &['\u9072']), ('\ufac4', &['\u9199']), ('\ufac5', &['\u9276']),
- ('\ufac6', &['\u967c']), ('\ufac7', &['\u96e3']), ('\ufac8', &['\u9756']), ('\ufac9',
- &['\u97db']), ('\ufaca', &['\u97ff']), ('\ufacb', &['\u980b']), ('\ufacc', &['\u983b']),
- ('\ufacd', &['\u9b12']), ('\uface', &['\u9f9c']), ('\ufacf', &['\U0002284a']), ('\ufad0',
- &['\U00022844']), ('\ufad1', &['\U000233d5']), ('\ufad2', &['\u3b9d']), ('\ufad3',
- &['\u4018']), ('\ufad4', &['\u4039']), ('\ufad5', &['\U00025249']), ('\ufad6',
- &['\U00025cd0']), ('\ufad7', &['\U00027ed3']), ('\ufad8', &['\u9f43']), ('\ufad9',
- &['\u9f8e']), ('\ufb1d', &['\u05d9', '\u05b4']), ('\ufb1f', &['\u05f2', '\u05b7']),
- ('\ufb2a', &['\u05e9', '\u05c1']), ('\ufb2b', &['\u05e9', '\u05c2']), ('\ufb2c', &['\ufb49',
- '\u05c1']), ('\ufb2d', &['\ufb49', '\u05c2']), ('\ufb2e', &['\u05d0', '\u05b7']), ('\ufb2f',
- &['\u05d0', '\u05b8']), ('\ufb30', &['\u05d0', '\u05bc']), ('\ufb31', &['\u05d1',
- '\u05bc']), ('\ufb32', &['\u05d2', '\u05bc']), ('\ufb33', &['\u05d3', '\u05bc']), ('\ufb34',
- &['\u05d4', '\u05bc']), ('\ufb35', &['\u05d5', '\u05bc']), ('\ufb36', &['\u05d6',
- '\u05bc']), ('\ufb38', &['\u05d8', '\u05bc']), ('\ufb39', &['\u05d9', '\u05bc']), ('\ufb3a',
- &['\u05da', '\u05bc']), ('\ufb3b', &['\u05db', '\u05bc']), ('\ufb3c', &['\u05dc',
- '\u05bc']), ('\ufb3e', &['\u05de', '\u05bc']), ('\ufb40', &['\u05e0', '\u05bc']), ('\ufb41',
- &['\u05e1', '\u05bc']), ('\ufb43', &['\u05e3', '\u05bc']), ('\ufb44', &['\u05e4',
- '\u05bc']), ('\ufb46', &['\u05e6', '\u05bc']), ('\ufb47', &['\u05e7', '\u05bc']), ('\ufb48',
- &['\u05e8', '\u05bc']), ('\ufb49', &['\u05e9', '\u05bc']), ('\ufb4a', &['\u05ea',
- '\u05bc']), ('\ufb4b', &['\u05d5', '\u05b9']), ('\ufb4c', &['\u05d1', '\u05bf']), ('\ufb4d',
- &['\u05db', '\u05bf']), ('\ufb4e', &['\u05e4', '\u05bf']), ('\U0001109a', &['\U00011099',
- '\U000110ba']), ('\U0001109c', &['\U0001109b', '\U000110ba']), ('\U000110ab',
- &['\U000110a5', '\U000110ba']), ('\U0001112e', &['\U00011131', '\U00011127']),
- ('\U0001112f', &['\U00011132', '\U00011127']), ('\U0001d15e', &['\U0001d157',
- '\U0001d165']), ('\U0001d15f', &['\U0001d158', '\U0001d165']), ('\U0001d160',
- &['\U0001d15f', '\U0001d16e']), ('\U0001d161', &['\U0001d15f', '\U0001d16f']),
- ('\U0001d162', &['\U0001d15f', '\U0001d170']), ('\U0001d163', &['\U0001d15f',
- '\U0001d171']), ('\U0001d164', &['\U0001d15f', '\U0001d172']), ('\U0001d1bb',
- &['\U0001d1b9', '\U0001d165']), ('\U0001d1bc', &['\U0001d1ba', '\U0001d165']),
- ('\U0001d1bd', &['\U0001d1bb', '\U0001d16e']), ('\U0001d1be', &['\U0001d1bc',
- '\U0001d16e']), ('\U0001d1bf', &['\U0001d1bb', '\U0001d16f']), ('\U0001d1c0',
- &['\U0001d1bc', '\U0001d16f']), ('\U0002f800', &['\u4e3d']), ('\U0002f801', &['\u4e38']),
- ('\U0002f802', &['\u4e41']), ('\U0002f803', &['\U00020122']), ('\U0002f804', &['\u4f60']),
- ('\U0002f805', &['\u4fae']), ('\U0002f806', &['\u4fbb']), ('\U0002f807', &['\u5002']),
- ('\U0002f808', &['\u507a']), ('\U0002f809', &['\u5099']), ('\U0002f80a', &['\u50e7']),
- ('\U0002f80b', &['\u50cf']), ('\U0002f80c', &['\u349e']), ('\U0002f80d', &['\U0002063a']),
- ('\U0002f80e', &['\u514d']), ('\U0002f80f', &['\u5154']), ('\U0002f810', &['\u5164']),
- ('\U0002f811', &['\u5177']), ('\U0002f812', &['\U0002051c']), ('\U0002f813', &['\u34b9']),
- ('\U0002f814', &['\u5167']), ('\U0002f815', &['\u518d']), ('\U0002f816', &['\U0002054b']),
- ('\U0002f817', &['\u5197']), ('\U0002f818', &['\u51a4']), ('\U0002f819', &['\u4ecc']),
- ('\U0002f81a', &['\u51ac']), ('\U0002f81b', &['\u51b5']), ('\U0002f81c', &['\U000291df']),
- ('\U0002f81d', &['\u51f5']), ('\U0002f81e', &['\u5203']), ('\U0002f81f', &['\u34df']),
- ('\U0002f820', &['\u523b']), ('\U0002f821', &['\u5246']), ('\U0002f822', &['\u5272']),
- ('\U0002f823', &['\u5277']), ('\U0002f824', &['\u3515']), ('\U0002f825', &['\u52c7']),
- ('\U0002f826', &['\u52c9']), ('\U0002f827', &['\u52e4']), ('\U0002f828', &['\u52fa']),
- ('\U0002f829', &['\u5305']), ('\U0002f82a', &['\u5306']), ('\U0002f82b', &['\u5317']),
- ('\U0002f82c', &['\u5349']), ('\U0002f82d', &['\u5351']), ('\U0002f82e', &['\u535a']),
- ('\U0002f82f', &['\u5373']), ('\U0002f830', &['\u537d']), ('\U0002f831', &['\u537f']),
- ('\U0002f832', &['\u537f']), ('\U0002f833', &['\u537f']), ('\U0002f834', &['\U00020a2c']),
- ('\U0002f835', &['\u7070']), ('\U0002f836', &['\u53ca']), ('\U0002f837', &['\u53df']),
- ('\U0002f838', &['\U00020b63']), ('\U0002f839', &['\u53eb']), ('\U0002f83a', &['\u53f1']),
- ('\U0002f83b', &['\u5406']), ('\U0002f83c', &['\u549e']), ('\U0002f83d', &['\u5438']),
- ('\U0002f83e', &['\u5448']), ('\U0002f83f', &['\u5468']), ('\U0002f840', &['\u54a2']),
- ('\U0002f841', &['\u54f6']), ('\U0002f842', &['\u5510']), ('\U0002f843', &['\u5553']),
- ('\U0002f844', &['\u5563']), ('\U0002f845', &['\u5584']), ('\U0002f846', &['\u5584']),
- ('\U0002f847', &['\u5599']), ('\U0002f848', &['\u55ab']), ('\U0002f849', &['\u55b3']),
- ('\U0002f84a', &['\u55c2']), ('\U0002f84b', &['\u5716']), ('\U0002f84c', &['\u5606']),
- ('\U0002f84d', &['\u5717']), ('\U0002f84e', &['\u5651']), ('\U0002f84f', &['\u5674']),
- ('\U0002f850', &['\u5207']), ('\U0002f851', &['\u58ee']), ('\U0002f852', &['\u57ce']),
- ('\U0002f853', &['\u57f4']), ('\U0002f854', &['\u580d']), ('\U0002f855', &['\u578b']),
- ('\U0002f856', &['\u5832']), ('\U0002f857', &['\u5831']), ('\U0002f858', &['\u58ac']),
- ('\U0002f859', &['\U000214e4']), ('\U0002f85a', &['\u58f2']), ('\U0002f85b', &['\u58f7']),
- ('\U0002f85c', &['\u5906']), ('\U0002f85d', &['\u591a']), ('\U0002f85e', &['\u5922']),
- ('\U0002f85f', &['\u5962']), ('\U0002f860', &['\U000216a8']), ('\U0002f861',
- &['\U000216ea']), ('\U0002f862', &['\u59ec']), ('\U0002f863', &['\u5a1b']), ('\U0002f864',
- &['\u5a27']), ('\U0002f865', &['\u59d8']), ('\U0002f866', &['\u5a66']), ('\U0002f867',
- &['\u36ee']), ('\U0002f868', &['\u36fc']), ('\U0002f869', &['\u5b08']), ('\U0002f86a',
- &['\u5b3e']), ('\U0002f86b', &['\u5b3e']), ('\U0002f86c', &['\U000219c8']), ('\U0002f86d',
- &['\u5bc3']), ('\U0002f86e', &['\u5bd8']), ('\U0002f86f', &['\u5be7']), ('\U0002f870',
- &['\u5bf3']), ('\U0002f871', &['\U00021b18']), ('\U0002f872', &['\u5bff']), ('\U0002f873',
- &['\u5c06']), ('\U0002f874', &['\u5f53']), ('\U0002f875', &['\u5c22']), ('\U0002f876',
- &['\u3781']), ('\U0002f877', &['\u5c60']), ('\U0002f878', &['\u5c6e']), ('\U0002f879',
- &['\u5cc0']), ('\U0002f87a', &['\u5c8d']), ('\U0002f87b', &['\U00021de4']), ('\U0002f87c',
- &['\u5d43']), ('\U0002f87d', &['\U00021de6']), ('\U0002f87e', &['\u5d6e']), ('\U0002f87f',
- &['\u5d6b']), ('\U0002f880', &['\u5d7c']), ('\U0002f881', &['\u5de1']), ('\U0002f882',
- &['\u5de2']), ('\U0002f883', &['\u382f']), ('\U0002f884', &['\u5dfd']), ('\U0002f885',
- &['\u5e28']), ('\U0002f886', &['\u5e3d']), ('\U0002f887', &['\u5e69']), ('\U0002f888',
- &['\u3862']), ('\U0002f889', &['\U00022183']), ('\U0002f88a', &['\u387c']), ('\U0002f88b',
- &['\u5eb0']), ('\U0002f88c', &['\u5eb3']), ('\U0002f88d', &['\u5eb6']), ('\U0002f88e',
- &['\u5eca']), ('\U0002f88f', &['\U0002a392']), ('\U0002f890', &['\u5efe']), ('\U0002f891',
- &['\U00022331']), ('\U0002f892', &['\U00022331']), ('\U0002f893', &['\u8201']),
- ('\U0002f894', &['\u5f22']), ('\U0002f895', &['\u5f22']), ('\U0002f896', &['\u38c7']),
- ('\U0002f897', &['\U000232b8']), ('\U0002f898', &['\U000261da']), ('\U0002f899',
- &['\u5f62']), ('\U0002f89a', &['\u5f6b']), ('\U0002f89b', &['\u38e3']), ('\U0002f89c',
- &['\u5f9a']), ('\U0002f89d', &['\u5fcd']), ('\U0002f89e', &['\u5fd7']), ('\U0002f89f',
- &['\u5ff9']), ('\U0002f8a0', &['\u6081']), ('\U0002f8a1', &['\u393a']), ('\U0002f8a2',
- &['\u391c']), ('\U0002f8a3', &['\u6094']), ('\U0002f8a4', &['\U000226d4']), ('\U0002f8a5',
- &['\u60c7']), ('\U0002f8a6', &['\u6148']), ('\U0002f8a7', &['\u614c']), ('\U0002f8a8',
- &['\u614e']), ('\U0002f8a9', &['\u614c']), ('\U0002f8aa', &['\u617a']), ('\U0002f8ab',
- &['\u618e']), ('\U0002f8ac', &['\u61b2']), ('\U0002f8ad', &['\u61a4']), ('\U0002f8ae',
- &['\u61af']), ('\U0002f8af', &['\u61de']), ('\U0002f8b0', &['\u61f2']), ('\U0002f8b1',
- &['\u61f6']), ('\U0002f8b2', &['\u6210']), ('\U0002f8b3', &['\u621b']), ('\U0002f8b4',
- &['\u625d']), ('\U0002f8b5', &['\u62b1']), ('\U0002f8b6', &['\u62d4']), ('\U0002f8b7',
- &['\u6350']), ('\U0002f8b8', &['\U00022b0c']), ('\U0002f8b9', &['\u633d']), ('\U0002f8ba',
- &['\u62fc']), ('\U0002f8bb', &['\u6368']), ('\U0002f8bc', &['\u6383']), ('\U0002f8bd',
- &['\u63e4']), ('\U0002f8be', &['\U00022bf1']), ('\U0002f8bf', &['\u6422']), ('\U0002f8c0',
- &['\u63c5']), ('\U0002f8c1', &['\u63a9']), ('\U0002f8c2', &['\u3a2e']), ('\U0002f8c3',
- &['\u6469']), ('\U0002f8c4', &['\u647e']), ('\U0002f8c5', &['\u649d']), ('\U0002f8c6',
- &['\u6477']), ('\U0002f8c7', &['\u3a6c']), ('\U0002f8c8', &['\u654f']), ('\U0002f8c9',
- &['\u656c']), ('\U0002f8ca', &['\U0002300a']), ('\U0002f8cb', &['\u65e3']), ('\U0002f8cc',
- &['\u66f8']), ('\U0002f8cd', &['\u6649']), ('\U0002f8ce', &['\u3b19']), ('\U0002f8cf',
- &['\u6691']), ('\U0002f8d0', &['\u3b08']), ('\U0002f8d1', &['\u3ae4']), ('\U0002f8d2',
- &['\u5192']), ('\U0002f8d3', &['\u5195']), ('\U0002f8d4', &['\u6700']), ('\U0002f8d5',
- &['\u669c']), ('\U0002f8d6', &['\u80ad']), ('\U0002f8d7', &['\u43d9']), ('\U0002f8d8',
- &['\u6717']), ('\U0002f8d9', &['\u671b']), ('\U0002f8da', &['\u6721']), ('\U0002f8db',
- &['\u675e']), ('\U0002f8dc', &['\u6753']), ('\U0002f8dd', &['\U000233c3']), ('\U0002f8de',
- &['\u3b49']), ('\U0002f8df', &['\u67fa']), ('\U0002f8e0', &['\u6785']), ('\U0002f8e1',
- &['\u6852']), ('\U0002f8e2', &['\u6885']), ('\U0002f8e3', &['\U0002346d']), ('\U0002f8e4',
- &['\u688e']), ('\U0002f8e5', &['\u681f']), ('\U0002f8e6', &['\u6914']), ('\U0002f8e7',
- &['\u3b9d']), ('\U0002f8e8', &['\u6942']), ('\U0002f8e9', &['\u69a3']), ('\U0002f8ea',
- &['\u69ea']), ('\U0002f8eb', &['\u6aa8']), ('\U0002f8ec', &['\U000236a3']), ('\U0002f8ed',
- &['\u6adb']), ('\U0002f8ee', &['\u3c18']), ('\U0002f8ef', &['\u6b21']), ('\U0002f8f0',
- &['\U000238a7']), ('\U0002f8f1', &['\u6b54']), ('\U0002f8f2', &['\u3c4e']), ('\U0002f8f3',
- &['\u6b72']), ('\U0002f8f4', &['\u6b9f']), ('\U0002f8f5', &['\u6bba']), ('\U0002f8f6',
- &['\u6bbb']), ('\U0002f8f7', &['\U00023a8d']), ('\U0002f8f8', &['\U00021d0b']),
- ('\U0002f8f9', &['\U00023afa']), ('\U0002f8fa', &['\u6c4e']), ('\U0002f8fb',
- &['\U00023cbc']), ('\U0002f8fc', &['\u6cbf']), ('\U0002f8fd', &['\u6ccd']), ('\U0002f8fe',
- &['\u6c67']), ('\U0002f8ff', &['\u6d16']), ('\U0002f900', &['\u6d3e']), ('\U0002f901',
- &['\u6d77']), ('\U0002f902', &['\u6d41']), ('\U0002f903', &['\u6d69']), ('\U0002f904',
- &['\u6d78']), ('\U0002f905', &['\u6d85']), ('\U0002f906', &['\U00023d1e']), ('\U0002f907',
- &['\u6d34']), ('\U0002f908', &['\u6e2f']), ('\U0002f909', &['\u6e6e']), ('\U0002f90a',
- &['\u3d33']), ('\U0002f90b', &['\u6ecb']), ('\U0002f90c', &['\u6ec7']), ('\U0002f90d',
- &['\U00023ed1']), ('\U0002f90e', &['\u6df9']), ('\U0002f90f', &['\u6f6e']), ('\U0002f910',
- &['\U00023f5e']), ('\U0002f911', &['\U00023f8e']), ('\U0002f912', &['\u6fc6']),
- ('\U0002f913', &['\u7039']), ('\U0002f914', &['\u701e']), ('\U0002f915', &['\u701b']),
- ('\U0002f916', &['\u3d96']), ('\U0002f917', &['\u704a']), ('\U0002f918', &['\u707d']),
- ('\U0002f919', &['\u7077']), ('\U0002f91a', &['\u70ad']), ('\U0002f91b', &['\U00020525']),
- ('\U0002f91c', &['\u7145']), ('\U0002f91d', &['\U00024263']), ('\U0002f91e', &['\u719c']),
- ('\U0002f91f', &['\U000243ab']), ('\U0002f920', &['\u7228']), ('\U0002f921', &['\u7235']),
- ('\U0002f922', &['\u7250']), ('\U0002f923', &['\U00024608']), ('\U0002f924', &['\u7280']),
- ('\U0002f925', &['\u7295']), ('\U0002f926', &['\U00024735']), ('\U0002f927',
- &['\U00024814']), ('\U0002f928', &['\u737a']), ('\U0002f929', &['\u738b']), ('\U0002f92a',
- &['\u3eac']), ('\U0002f92b', &['\u73a5']), ('\U0002f92c', &['\u3eb8']), ('\U0002f92d',
- &['\u3eb8']), ('\U0002f92e', &['\u7447']), ('\U0002f92f', &['\u745c']), ('\U0002f930',
- &['\u7471']), ('\U0002f931', &['\u7485']), ('\U0002f932', &['\u74ca']), ('\U0002f933',
- &['\u3f1b']), ('\U0002f934', &['\u7524']), ('\U0002f935', &['\U00024c36']), ('\U0002f936',
- &['\u753e']), ('\U0002f937', &['\U00024c92']), ('\U0002f938', &['\u7570']), ('\U0002f939',
- &['\U0002219f']), ('\U0002f93a', &['\u7610']), ('\U0002f93b', &['\U00024fa1']),
- ('\U0002f93c', &['\U00024fb8']), ('\U0002f93d', &['\U00025044']), ('\U0002f93e',
- &['\u3ffc']), ('\U0002f93f', &['\u4008']), ('\U0002f940', &['\u76f4']), ('\U0002f941',
- &['\U000250f3']), ('\U0002f942', &['\U000250f2']), ('\U0002f943', &['\U00025119']),
- ('\U0002f944', &['\U00025133']), ('\U0002f945', &['\u771e']), ('\U0002f946', &['\u771f']),
- ('\U0002f947', &['\u771f']), ('\U0002f948', &['\u774a']), ('\U0002f949', &['\u4039']),
- ('\U0002f94a', &['\u778b']), ('\U0002f94b', &['\u4046']), ('\U0002f94c', &['\u4096']),
- ('\U0002f94d', &['\U0002541d']), ('\U0002f94e', &['\u784e']), ('\U0002f94f', &['\u788c']),
- ('\U0002f950', &['\u78cc']), ('\U0002f951', &['\u40e3']), ('\U0002f952', &['\U00025626']),
- ('\U0002f953', &['\u7956']), ('\U0002f954', &['\U0002569a']), ('\U0002f955',
- &['\U000256c5']), ('\U0002f956', &['\u798f']), ('\U0002f957', &['\u79eb']), ('\U0002f958',
- &['\u412f']), ('\U0002f959', &['\u7a40']), ('\U0002f95a', &['\u7a4a']), ('\U0002f95b',
- &['\u7a4f']), ('\U0002f95c', &['\U0002597c']), ('\U0002f95d', &['\U00025aa7']),
- ('\U0002f95e', &['\U00025aa7']), ('\U0002f95f', &['\u7aee']), ('\U0002f960', &['\u4202']),
- ('\U0002f961', &['\U00025bab']), ('\U0002f962', &['\u7bc6']), ('\U0002f963', &['\u7bc9']),
- ('\U0002f964', &['\u4227']), ('\U0002f965', &['\U00025c80']), ('\U0002f966', &['\u7cd2']),
- ('\U0002f967', &['\u42a0']), ('\U0002f968', &['\u7ce8']), ('\U0002f969', &['\u7ce3']),
- ('\U0002f96a', &['\u7d00']), ('\U0002f96b', &['\U00025f86']), ('\U0002f96c', &['\u7d63']),
- ('\U0002f96d', &['\u4301']), ('\U0002f96e', &['\u7dc7']), ('\U0002f96f', &['\u7e02']),
- ('\U0002f970', &['\u7e45']), ('\U0002f971', &['\u4334']), ('\U0002f972', &['\U00026228']),
- ('\U0002f973', &['\U00026247']), ('\U0002f974', &['\u4359']), ('\U0002f975',
- &['\U000262d9']), ('\U0002f976', &['\u7f7a']), ('\U0002f977', &['\U0002633e']),
- ('\U0002f978', &['\u7f95']), ('\U0002f979', &['\u7ffa']), ('\U0002f97a', &['\u8005']),
- ('\U0002f97b', &['\U000264da']), ('\U0002f97c', &['\U00026523']), ('\U0002f97d',
- &['\u8060']), ('\U0002f97e', &['\U000265a8']), ('\U0002f97f', &['\u8070']), ('\U0002f980',
- &['\U0002335f']), ('\U0002f981', &['\u43d5']), ('\U0002f982', &['\u80b2']), ('\U0002f983',
- &['\u8103']), ('\U0002f984', &['\u440b']), ('\U0002f985', &['\u813e']), ('\U0002f986',
- &['\u5ab5']), ('\U0002f987', &['\U000267a7']), ('\U0002f988', &['\U000267b5']),
- ('\U0002f989', &['\U00023393']), ('\U0002f98a', &['\U0002339c']), ('\U0002f98b',
- &['\u8201']), ('\U0002f98c', &['\u8204']), ('\U0002f98d', &['\u8f9e']), ('\U0002f98e',
- &['\u446b']), ('\U0002f98f', &['\u8291']), ('\U0002f990', &['\u828b']), ('\U0002f991',
- &['\u829d']), ('\U0002f992', &['\u52b3']), ('\U0002f993', &['\u82b1']), ('\U0002f994',
- &['\u82b3']), ('\U0002f995', &['\u82bd']), ('\U0002f996', &['\u82e6']), ('\U0002f997',
- &['\U00026b3c']), ('\U0002f998', &['\u82e5']), ('\U0002f999', &['\u831d']), ('\U0002f99a',
- &['\u8363']), ('\U0002f99b', &['\u83ad']), ('\U0002f99c', &['\u8323']), ('\U0002f99d',
- &['\u83bd']), ('\U0002f99e', &['\u83e7']), ('\U0002f99f', &['\u8457']), ('\U0002f9a0',
- &['\u8353']), ('\U0002f9a1', &['\u83ca']), ('\U0002f9a2', &['\u83cc']), ('\U0002f9a3',
- &['\u83dc']), ('\U0002f9a4', &['\U00026c36']), ('\U0002f9a5', &['\U00026d6b']),
- ('\U0002f9a6', &['\U00026cd5']), ('\U0002f9a7', &['\u452b']), ('\U0002f9a8', &['\u84f1']),
- ('\U0002f9a9', &['\u84f3']), ('\U0002f9aa', &['\u8516']), ('\U0002f9ab', &['\U000273ca']),
- ('\U0002f9ac', &['\u8564']), ('\U0002f9ad', &['\U00026f2c']), ('\U0002f9ae', &['\u455d']),
- ('\U0002f9af', &['\u4561']), ('\U0002f9b0', &['\U00026fb1']), ('\U0002f9b1',
- &['\U000270d2']), ('\U0002f9b2', &['\u456b']), ('\U0002f9b3', &['\u8650']), ('\U0002f9b4',
- &['\u865c']), ('\U0002f9b5', &['\u8667']), ('\U0002f9b6', &['\u8669']), ('\U0002f9b7',
- &['\u86a9']), ('\U0002f9b8', &['\u8688']), ('\U0002f9b9', &['\u870e']), ('\U0002f9ba',
- &['\u86e2']), ('\U0002f9bb', &['\u8779']), ('\U0002f9bc', &['\u8728']), ('\U0002f9bd',
- &['\u876b']), ('\U0002f9be', &['\u8786']), ('\U0002f9bf', &['\u45d7']), ('\U0002f9c0',
- &['\u87e1']), ('\U0002f9c1', &['\u8801']), ('\U0002f9c2', &['\u45f9']), ('\U0002f9c3',
- &['\u8860']), ('\U0002f9c4', &['\u8863']), ('\U0002f9c5', &['\U00027667']), ('\U0002f9c6',
- &['\u88d7']), ('\U0002f9c7', &['\u88de']), ('\U0002f9c8', &['\u4635']), ('\U0002f9c9',
- &['\u88fa']), ('\U0002f9ca', &['\u34bb']), ('\U0002f9cb', &['\U000278ae']), ('\U0002f9cc',
- &['\U00027966']), ('\U0002f9cd', &['\u46be']), ('\U0002f9ce', &['\u46c7']), ('\U0002f9cf',
- &['\u8aa0']), ('\U0002f9d0', &['\u8aed']), ('\U0002f9d1', &['\u8b8a']), ('\U0002f9d2',
- &['\u8c55']), ('\U0002f9d3', &['\U00027ca8']), ('\U0002f9d4', &['\u8cab']), ('\U0002f9d5',
- &['\u8cc1']), ('\U0002f9d6', &['\u8d1b']), ('\U0002f9d7', &['\u8d77']), ('\U0002f9d8',
- &['\U00027f2f']), ('\U0002f9d9', &['\U00020804']), ('\U0002f9da', &['\u8dcb']),
- ('\U0002f9db', &['\u8dbc']), ('\U0002f9dc', &['\u8df0']), ('\U0002f9dd', &['\U000208de']),
- ('\U0002f9de', &['\u8ed4']), ('\U0002f9df', &['\u8f38']), ('\U0002f9e0', &['\U000285d2']),
- ('\U0002f9e1', &['\U000285ed']), ('\U0002f9e2', &['\u9094']), ('\U0002f9e3', &['\u90f1']),
- ('\U0002f9e4', &['\u9111']), ('\U0002f9e5', &['\U0002872e']), ('\U0002f9e6', &['\u911b']),
- ('\U0002f9e7', &['\u9238']), ('\U0002f9e8', &['\u92d7']), ('\U0002f9e9', &['\u92d8']),
- ('\U0002f9ea', &['\u927c']), ('\U0002f9eb', &['\u93f9']), ('\U0002f9ec', &['\u9415']),
- ('\U0002f9ed', &['\U00028bfa']), ('\U0002f9ee', &['\u958b']), ('\U0002f9ef', &['\u4995']),
- ('\U0002f9f0', &['\u95b7']), ('\U0002f9f1', &['\U00028d77']), ('\U0002f9f2', &['\u49e6']),
- ('\U0002f9f3', &['\u96c3']), ('\U0002f9f4', &['\u5db2']), ('\U0002f9f5', &['\u9723']),
- ('\U0002f9f6', &['\U00029145']), ('\U0002f9f7', &['\U0002921a']), ('\U0002f9f8',
- &['\u4a6e']), ('\U0002f9f9', &['\u4a76']), ('\U0002f9fa', &['\u97e0']), ('\U0002f9fb',
- &['\U0002940a']), ('\U0002f9fc', &['\u4ab2']), ('\U0002f9fd', &['\U00029496']),
- ('\U0002f9fe', &['\u980b']), ('\U0002f9ff', &['\u980b']), ('\U0002fa00', &['\u9829']),
- ('\U0002fa01', &['\U000295b6']), ('\U0002fa02', &['\u98e2']), ('\U0002fa03', &['\u4b33']),
- ('\U0002fa04', &['\u9929']), ('\U0002fa05', &['\u99a7']), ('\U0002fa06', &['\u99c2']),
- ('\U0002fa07', &['\u99fe']), ('\U0002fa08', &['\u4bce']), ('\U0002fa09', &['\U00029b30']),
- ('\U0002fa0a', &['\u9b12']), ('\U0002fa0b', &['\u9c40']), ('\U0002fa0c', &['\u9cfd']),
- ('\U0002fa0d', &['\u4cce']), ('\U0002fa0e', &['\u4ced']), ('\U0002fa0f', &['\u9d67']),
- ('\U0002fa10', &['\U0002a0ce']), ('\U0002fa11', &['\u4cf8']), ('\U0002fa12',
- &['\U0002a105']), ('\U0002fa13', &['\U0002a20e']), ('\U0002fa14', &['\U0002a291']),
- ('\U0002fa15', &['\u9ebb']), ('\U0002fa16', &['\u4d56']), ('\U0002fa17', &['\u9ef9']),
- ('\U0002fa18', &['\u9efe']), ('\U0002fa19', &['\u9f05']), ('\U0002fa1a', &['\u9f0f']),
- ('\U0002fa1b', &['\u9f16']), ('\U0002fa1c', &['\u9f3b']), ('\U0002fa1d', &['\U0002a600'])
- ];
-
- // Compatibility decompositions
- static compatibility_table : &'static [(char, &'static [char])] = &[
- ('\xa0', &['\x20']), ('\xa8', &['\x20', '\u0308']), ('\xaa', &['\x61']), ('\xaf', &['\x20',
- '\u0304']), ('\xb2', &['\x32']), ('\xb3', &['\x33']), ('\xb4', &['\x20', '\u0301']),
- ('\xb5', &['\u03bc']), ('\xb8', &['\x20', '\u0327']), ('\xb9', &['\x31']), ('\xba',
- &['\x6f']), ('\xbc', &['\x31', '\u2044', '\x34']), ('\xbd', &['\x31', '\u2044', '\x32']),
- ('\xbe', &['\x33', '\u2044', '\x34']), ('\u0132', &['\x49', '\x4a']), ('\u0133', &['\x69',
- '\x6a']), ('\u013f', &['\x4c', '\xb7']), ('\u0140', &['\x6c', '\xb7']), ('\u0149',
- &['\u02bc', '\x6e']), ('\u017f', &['\x73']), ('\u01c4', &['\x44', '\u017d']), ('\u01c5',
- &['\x44', '\u017e']), ('\u01c6', &['\x64', '\u017e']), ('\u01c7', &['\x4c', '\x4a']),
- ('\u01c8', &['\x4c', '\x6a']), ('\u01c9', &['\x6c', '\x6a']), ('\u01ca', &['\x4e', '\x4a']),
- ('\u01cb', &['\x4e', '\x6a']), ('\u01cc', &['\x6e', '\x6a']), ('\u01f1', &['\x44', '\x5a']),
- ('\u01f2', &['\x44', '\x7a']), ('\u01f3', &['\x64', '\x7a']), ('\u02b0', &['\x68']),
- ('\u02b1', &['\u0266']), ('\u02b2', &['\x6a']), ('\u02b3', &['\x72']), ('\u02b4',
- &['\u0279']), ('\u02b5', &['\u027b']), ('\u02b6', &['\u0281']), ('\u02b7', &['\x77']),
- ('\u02b8', &['\x79']), ('\u02d8', &['\x20', '\u0306']), ('\u02d9', &['\x20', '\u0307']),
- ('\u02da', &['\x20', '\u030a']), ('\u02db', &['\x20', '\u0328']), ('\u02dc', &['\x20',
- '\u0303']), ('\u02dd', &['\x20', '\u030b']), ('\u02e0', &['\u0263']), ('\u02e1', &['\x6c']),
- ('\u02e2', &['\x73']), ('\u02e3', &['\x78']), ('\u02e4', &['\u0295']), ('\u037a', &['\x20',
- '\u0345']), ('\u0384', &['\x20', '\u0301']), ('\u03d0', &['\u03b2']), ('\u03d1',
- &['\u03b8']), ('\u03d2', &['\u03a5']), ('\u03d5', &['\u03c6']), ('\u03d6', &['\u03c0']),
- ('\u03f0', &['\u03ba']), ('\u03f1', &['\u03c1']), ('\u03f2', &['\u03c2']), ('\u03f4',
- &['\u0398']), ('\u03f5', &['\u03b5']), ('\u03f9', &['\u03a3']), ('\u0587', &['\u0565',
- '\u0582']), ('\u0675', &['\u0627', '\u0674']), ('\u0676', &['\u0648', '\u0674']), ('\u0677',
- &['\u06c7', '\u0674']), ('\u0678', &['\u064a', '\u0674']), ('\u0e33', &['\u0e4d',
- '\u0e32']), ('\u0eb3', &['\u0ecd', '\u0eb2']), ('\u0edc', &['\u0eab', '\u0e99']), ('\u0edd',
- &['\u0eab', '\u0ea1']), ('\u0f0c', &['\u0f0b']), ('\u0f77', &['\u0fb2', '\u0f81']),
- ('\u0f79', &['\u0fb3', '\u0f81']), ('\u10fc', &['\u10dc']), ('\u1d2c', &['\x41']),
- ('\u1d2d', &['\xc6']), ('\u1d2e', &['\x42']), ('\u1d30', &['\x44']), ('\u1d31', &['\x45']),
- ('\u1d32', &['\u018e']), ('\u1d33', &['\x47']), ('\u1d34', &['\x48']), ('\u1d35',
- &['\x49']), ('\u1d36', &['\x4a']), ('\u1d37', &['\x4b']), ('\u1d38', &['\x4c']), ('\u1d39',
- &['\x4d']), ('\u1d3a', &['\x4e']), ('\u1d3c', &['\x4f']), ('\u1d3d', &['\u0222']),
- ('\u1d3e', &['\x50']), ('\u1d3f', &['\x52']), ('\u1d40', &['\x54']), ('\u1d41', &['\x55']),
- ('\u1d42', &['\x57']), ('\u1d43', &['\x61']), ('\u1d44', &['\u0250']), ('\u1d45',
- &['\u0251']), ('\u1d46', &['\u1d02']), ('\u1d47', &['\x62']), ('\u1d48', &['\x64']),
- ('\u1d49', &['\x65']), ('\u1d4a', &['\u0259']), ('\u1d4b', &['\u025b']), ('\u1d4c',
- &['\u025c']), ('\u1d4d', &['\x67']), ('\u1d4f', &['\x6b']), ('\u1d50', &['\x6d']),
- ('\u1d51', &['\u014b']), ('\u1d52', &['\x6f']), ('\u1d53', &['\u0254']), ('\u1d54',
- &['\u1d16']), ('\u1d55', &['\u1d17']), ('\u1d56', &['\x70']), ('\u1d57', &['\x74']),
- ('\u1d58', &['\x75']), ('\u1d59', &['\u1d1d']), ('\u1d5a', &['\u026f']), ('\u1d5b',
- &['\x76']), ('\u1d5c', &['\u1d25']), ('\u1d5d', &['\u03b2']), ('\u1d5e', &['\u03b3']),
- ('\u1d5f', &['\u03b4']), ('\u1d60', &['\u03c6']), ('\u1d61', &['\u03c7']), ('\u1d62',
- &['\x69']), ('\u1d63', &['\x72']), ('\u1d64', &['\x75']), ('\u1d65', &['\x76']), ('\u1d66',
- &['\u03b2']), ('\u1d67', &['\u03b3']), ('\u1d68', &['\u03c1']), ('\u1d69', &['\u03c6']),
- ('\u1d6a', &['\u03c7']), ('\u1d78', &['\u043d']), ('\u1d9b', &['\u0252']), ('\u1d9c',
- &['\x63']), ('\u1d9d', &['\u0255']), ('\u1d9e', &['\xf0']), ('\u1d9f', &['\u025c']),
- ('\u1da0', &['\x66']), ('\u1da1', &['\u025f']), ('\u1da2', &['\u0261']), ('\u1da3',
- &['\u0265']), ('\u1da4', &['\u0268']), ('\u1da5', &['\u0269']), ('\u1da6', &['\u026a']),
- ('\u1da7', &['\u1d7b']), ('\u1da8', &['\u029d']), ('\u1da9', &['\u026d']), ('\u1daa',
- &['\u1d85']), ('\u1dab', &['\u029f']), ('\u1dac', &['\u0271']), ('\u1dad', &['\u0270']),
- ('\u1dae', &['\u0272']), ('\u1daf', &['\u0273']), ('\u1db0', &['\u0274']), ('\u1db1',
- &['\u0275']), ('\u1db2', &['\u0278']), ('\u1db3', &['\u0282']), ('\u1db4', &['\u0283']),
- ('\u1db5', &['\u01ab']), ('\u1db6', &['\u0289']), ('\u1db7', &['\u028a']), ('\u1db8',
- &['\u1d1c']), ('\u1db9', &['\u028b']), ('\u1dba', &['\u028c']), ('\u1dbb', &['\x7a']),
- ('\u1dbc', &['\u0290']), ('\u1dbd', &['\u0291']), ('\u1dbe', &['\u0292']), ('\u1dbf',
- &['\u03b8']), ('\u1e9a', &['\x61', '\u02be']), ('\u1fbd', &['\x20', '\u0313']), ('\u1fbf',
- &['\x20', '\u0313']), ('\u1fc0', &['\x20', '\u0342']), ('\u1ffe', &['\x20', '\u0314']),
- ('\u2002', &['\x20']), ('\u2003', &['\x20']), ('\u2004', &['\x20']), ('\u2005', &['\x20']),
- ('\u2006', &['\x20']), ('\u2007', &['\x20']), ('\u2008', &['\x20']), ('\u2009', &['\x20']),
- ('\u200a', &['\x20']), ('\u2011', &['\u2010']), ('\u2017', &['\x20', '\u0333']), ('\u2024',
- &['\x2e']), ('\u2025', &['\x2e', '\x2e']), ('\u2026', &['\x2e', '\x2e', '\x2e']), ('\u202f',
- &['\x20']), ('\u2033', &['\u2032', '\u2032']), ('\u2034', &['\u2032', '\u2032', '\u2032']),
- ('\u2036', &['\u2035', '\u2035']), ('\u2037', &['\u2035', '\u2035', '\u2035']), ('\u203c',
- &['\x21', '\x21']), ('\u203e', &['\x20', '\u0305']), ('\u2047', &['\x3f', '\x3f']),
- ('\u2048', &['\x3f', '\x21']), ('\u2049', &['\x21', '\x3f']), ('\u2057', &['\u2032',
- '\u2032', '\u2032', '\u2032']), ('\u205f', &['\x20']), ('\u2070', &['\x30']), ('\u2071',
- &['\x69']), ('\u2074', &['\x34']), ('\u2075', &['\x35']), ('\u2076', &['\x36']), ('\u2077',
- &['\x37']), ('\u2078', &['\x38']), ('\u2079', &['\x39']), ('\u207a', &['\x2b']), ('\u207b',
- &['\u2212']), ('\u207c', &['\x3d']), ('\u207d', &['\x28']), ('\u207e', &['\x29']),
- ('\u207f', &['\x6e']), ('\u2080', &['\x30']), ('\u2081', &['\x31']), ('\u2082', &['\x32']),
- ('\u2083', &['\x33']), ('\u2084', &['\x34']), ('\u2085', &['\x35']), ('\u2086', &['\x36']),
- ('\u2087', &['\x37']), ('\u2088', &['\x38']), ('\u2089', &['\x39']), ('\u208a', &['\x2b']),
- ('\u208b', &['\u2212']), ('\u208c', &['\x3d']), ('\u208d', &['\x28']), ('\u208e',
- &['\x29']), ('\u2090', &['\x61']), ('\u2091', &['\x65']), ('\u2092', &['\x6f']), ('\u2093',
- &['\x78']), ('\u2094', &['\u0259']), ('\u2095', &['\x68']), ('\u2096', &['\x6b']),
- ('\u2097', &['\x6c']), ('\u2098', &['\x6d']), ('\u2099', &['\x6e']), ('\u209a', &['\x70']),
- ('\u209b', &['\x73']), ('\u209c', &['\x74']), ('\u20a8', &['\x52', '\x73']), ('\u2100',
- &['\x61', '\x2f', '\x63']), ('\u2101', &['\x61', '\x2f', '\x73']), ('\u2102', &['\x43']),
- ('\u2103', &['\xb0', '\x43']), ('\u2105', &['\x63', '\x2f', '\x6f']), ('\u2106', &['\x63',
- '\x2f', '\x75']), ('\u2107', &['\u0190']), ('\u2109', &['\xb0', '\x46']), ('\u210a',
- &['\x67']), ('\u210b', &['\x48']), ('\u210c', &['\x48']), ('\u210d', &['\x48']), ('\u210e',
- &['\x68']), ('\u210f', &['\u0127']), ('\u2110', &['\x49']), ('\u2111', &['\x49']),
- ('\u2112', &['\x4c']), ('\u2113', &['\x6c']), ('\u2115', &['\x4e']), ('\u2116', &['\x4e',
- '\x6f']), ('\u2119', &['\x50']), ('\u211a', &['\x51']), ('\u211b', &['\x52']), ('\u211c',
- &['\x52']), ('\u211d', &['\x52']), ('\u2120', &['\x53', '\x4d']), ('\u2121', &['\x54',
- '\x45', '\x4c']), ('\u2122', &['\x54', '\x4d']), ('\u2124', &['\x5a']), ('\u2128',
- &['\x5a']), ('\u212c', &['\x42']), ('\u212d', &['\x43']), ('\u212f', &['\x65']), ('\u2130',
- &['\x45']), ('\u2131', &['\x46']), ('\u2133', &['\x4d']), ('\u2134', &['\x6f']), ('\u2135',
- &['\u05d0']), ('\u2136', &['\u05d1']), ('\u2137', &['\u05d2']), ('\u2138', &['\u05d3']),
- ('\u2139', &['\x69']), ('\u213b', &['\x46', '\x41', '\x58']), ('\u213c', &['\u03c0']),
- ('\u213d', &['\u03b3']), ('\u213e', &['\u0393']), ('\u213f', &['\u03a0']), ('\u2140',
- &['\u2211']), ('\u2145', &['\x44']), ('\u2146', &['\x64']), ('\u2147', &['\x65']),
- ('\u2148', &['\x69']), ('\u2149', &['\x6a']), ('\u2150', &['\x31', '\u2044', '\x37']),
- ('\u2151', &['\x31', '\u2044', '\x39']), ('\u2152', &['\x31', '\u2044', '\x31', '\x30']),
- ('\u2153', &['\x31', '\u2044', '\x33']), ('\u2154', &['\x32', '\u2044', '\x33']), ('\u2155',
- &['\x31', '\u2044', '\x35']), ('\u2156', &['\x32', '\u2044', '\x35']), ('\u2157', &['\x33',
- '\u2044', '\x35']), ('\u2158', &['\x34', '\u2044', '\x35']), ('\u2159', &['\x31', '\u2044',
- '\x36']), ('\u215a', &['\x35', '\u2044', '\x36']), ('\u215b', &['\x31', '\u2044', '\x38']),
- ('\u215c', &['\x33', '\u2044', '\x38']), ('\u215d', &['\x35', '\u2044', '\x38']), ('\u215e',
- &['\x37', '\u2044', '\x38']), ('\u215f', &['\x31', '\u2044']), ('\u2160', &['\x49']),
- ('\u2161', &['\x49', '\x49']), ('\u2162', &['\x49', '\x49', '\x49']), ('\u2163', &['\x49',
- '\x56']), ('\u2164', &['\x56']), ('\u2165', &['\x56', '\x49']), ('\u2166', &['\x56', '\x49',
- '\x49']), ('\u2167', &['\x56', '\x49', '\x49', '\x49']), ('\u2168', &['\x49', '\x58']),
- ('\u2169', &['\x58']), ('\u216a', &['\x58', '\x49']), ('\u216b', &['\x58', '\x49', '\x49']),
- ('\u216c', &['\x4c']), ('\u216d', &['\x43']), ('\u216e', &['\x44']), ('\u216f', &['\x4d']),
- ('\u2170', &['\x69']), ('\u2171', &['\x69', '\x69']), ('\u2172', &['\x69', '\x69', '\x69']),
- ('\u2173', &['\x69', '\x76']), ('\u2174', &['\x76']), ('\u2175', &['\x76', '\x69']),
- ('\u2176', &['\x76', '\x69', '\x69']), ('\u2177', &['\x76', '\x69', '\x69', '\x69']),
- ('\u2178', &['\x69', '\x78']), ('\u2179', &['\x78']), ('\u217a', &['\x78', '\x69']),
- ('\u217b', &['\x78', '\x69', '\x69']), ('\u217c', &['\x6c']), ('\u217d', &['\x63']),
- ('\u217e', &['\x64']), ('\u217f', &['\x6d']), ('\u2189', &['\x30', '\u2044', '\x33']),
- ('\u222c', &['\u222b', '\u222b']), ('\u222d', &['\u222b', '\u222b', '\u222b']), ('\u222f',
- &['\u222e', '\u222e']), ('\u2230', &['\u222e', '\u222e', '\u222e']), ('\u2460', &['\x31']),
- ('\u2461', &['\x32']), ('\u2462', &['\x33']), ('\u2463', &['\x34']), ('\u2464', &['\x35']),
- ('\u2465', &['\x36']), ('\u2466', &['\x37']), ('\u2467', &['\x38']), ('\u2468', &['\x39']),
- ('\u2469', &['\x31', '\x30']), ('\u246a', &['\x31', '\x31']), ('\u246b', &['\x31', '\x32']),
- ('\u246c', &['\x31', '\x33']), ('\u246d', &['\x31', '\x34']), ('\u246e', &['\x31', '\x35']),
- ('\u246f', &['\x31', '\x36']), ('\u2470', &['\x31', '\x37']), ('\u2471', &['\x31', '\x38']),
- ('\u2472', &['\x31', '\x39']), ('\u2473', &['\x32', '\x30']), ('\u2474', &['\x28', '\x31',
- '\x29']), ('\u2475', &['\x28', '\x32', '\x29']), ('\u2476', &['\x28', '\x33', '\x29']),
- ('\u2477', &['\x28', '\x34', '\x29']), ('\u2478', &['\x28', '\x35', '\x29']), ('\u2479',
- &['\x28', '\x36', '\x29']), ('\u247a', &['\x28', '\x37', '\x29']), ('\u247b', &['\x28',
- '\x38', '\x29']), ('\u247c', &['\x28', '\x39', '\x29']), ('\u247d', &['\x28', '\x31',
- '\x30', '\x29']), ('\u247e', &['\x28', '\x31', '\x31', '\x29']), ('\u247f', &['\x28',
- '\x31', '\x32', '\x29']), ('\u2480', &['\x28', '\x31', '\x33', '\x29']), ('\u2481',
- &['\x28', '\x31', '\x34', '\x29']), ('\u2482', &['\x28', '\x31', '\x35', '\x29']),
- ('\u2483', &['\x28', '\x31', '\x36', '\x29']), ('\u2484', &['\x28', '\x31', '\x37',
- '\x29']), ('\u2485', &['\x28', '\x31', '\x38', '\x29']), ('\u2486', &['\x28', '\x31',
- '\x39', '\x29']), ('\u2487', &['\x28', '\x32', '\x30', '\x29']), ('\u2488', &['\x31',
- '\x2e']), ('\u2489', &['\x32', '\x2e']), ('\u248a', &['\x33', '\x2e']), ('\u248b', &['\x34',
- '\x2e']), ('\u248c', &['\x35', '\x2e']), ('\u248d', &['\x36', '\x2e']), ('\u248e', &['\x37',
- '\x2e']), ('\u248f', &['\x38', '\x2e']), ('\u2490', &['\x39', '\x2e']), ('\u2491', &['\x31',
- '\x30', '\x2e']), ('\u2492', &['\x31', '\x31', '\x2e']), ('\u2493', &['\x31', '\x32',
- '\x2e']), ('\u2494', &['\x31', '\x33', '\x2e']), ('\u2495', &['\x31', '\x34', '\x2e']),
- ('\u2496', &['\x31', '\x35', '\x2e']), ('\u2497', &['\x31', '\x36', '\x2e']), ('\u2498',
- &['\x31', '\x37', '\x2e']), ('\u2499', &['\x31', '\x38', '\x2e']), ('\u249a', &['\x31',
- '\x39', '\x2e']), ('\u249b', &['\x32', '\x30', '\x2e']), ('\u249c', &['\x28', '\x61',
- '\x29']), ('\u249d', &['\x28', '\x62', '\x29']), ('\u249e', &['\x28', '\x63', '\x29']),
- ('\u249f', &['\x28', '\x64', '\x29']), ('\u24a0', &['\x28', '\x65', '\x29']), ('\u24a1',
- &['\x28', '\x66', '\x29']), ('\u24a2', &['\x28', '\x67', '\x29']), ('\u24a3', &['\x28',
- '\x68', '\x29']), ('\u24a4', &['\x28', '\x69', '\x29']), ('\u24a5', &['\x28', '\x6a',
- '\x29']), ('\u24a6', &['\x28', '\x6b', '\x29']), ('\u24a7', &['\x28', '\x6c', '\x29']),
- ('\u24a8', &['\x28', '\x6d', '\x29']), ('\u24a9', &['\x28', '\x6e', '\x29']), ('\u24aa',
- &['\x28', '\x6f', '\x29']), ('\u24ab', &['\x28', '\x70', '\x29']), ('\u24ac', &['\x28',
- '\x71', '\x29']), ('\u24ad', &['\x28', '\x72', '\x29']), ('\u24ae', &['\x28', '\x73',
- '\x29']), ('\u24af', &['\x28', '\x74', '\x29']), ('\u24b0', &['\x28', '\x75', '\x29']),
- ('\u24b1', &['\x28', '\x76', '\x29']), ('\u24b2', &['\x28', '\x77', '\x29']), ('\u24b3',
- &['\x28', '\x78', '\x29']), ('\u24b4', &['\x28', '\x79', '\x29']), ('\u24b5', &['\x28',
- '\x7a', '\x29']), ('\u24b6', &['\x41']), ('\u24b7', &['\x42']), ('\u24b8', &['\x43']),
- ('\u24b9', &['\x44']), ('\u24ba', &['\x45']), ('\u24bb', &['\x46']), ('\u24bc', &['\x47']),
- ('\u24bd', &['\x48']), ('\u24be', &['\x49']), ('\u24bf', &['\x4a']), ('\u24c0', &['\x4b']),
- ('\u24c1', &['\x4c']), ('\u24c2', &['\x4d']), ('\u24c3', &['\x4e']), ('\u24c4', &['\x4f']),
- ('\u24c5', &['\x50']), ('\u24c6', &['\x51']), ('\u24c7', &['\x52']), ('\u24c8', &['\x53']),
- ('\u24c9', &['\x54']), ('\u24ca', &['\x55']), ('\u24cb', &['\x56']), ('\u24cc', &['\x57']),
- ('\u24cd', &['\x58']), ('\u24ce', &['\x59']), ('\u24cf', &['\x5a']), ('\u24d0', &['\x61']),
- ('\u24d1', &['\x62']), ('\u24d2', &['\x63']), ('\u24d3', &['\x64']), ('\u24d4', &['\x65']),
- ('\u24d5', &['\x66']), ('\u24d6', &['\x67']), ('\u24d7', &['\x68']), ('\u24d8', &['\x69']),
- ('\u24d9', &['\x6a']), ('\u24da', &['\x6b']), ('\u24db', &['\x6c']), ('\u24dc', &['\x6d']),
- ('\u24dd', &['\x6e']), ('\u24de', &['\x6f']), ('\u24df', &['\x70']), ('\u24e0', &['\x71']),
- ('\u24e1', &['\x72']), ('\u24e2', &['\x73']), ('\u24e3', &['\x74']), ('\u24e4', &['\x75']),
- ('\u24e5', &['\x76']), ('\u24e6', &['\x77']), ('\u24e7', &['\x78']), ('\u24e8', &['\x79']),
- ('\u24e9', &['\x7a']), ('\u24ea', &['\x30']), ('\u2a0c', &['\u222b', '\u222b', '\u222b',
- '\u222b']), ('\u2a74', &['\x3a', '\x3a', '\x3d']), ('\u2a75', &['\x3d', '\x3d']), ('\u2a76',
- &['\x3d', '\x3d', '\x3d']), ('\u2c7c', &['\x6a']), ('\u2c7d', &['\x56']), ('\u2d6f',
- &['\u2d61']), ('\u2e9f', &['\u6bcd']), ('\u2ef3', &['\u9f9f']), ('\u2f00', &['\u4e00']),
- ('\u2f01', &['\u4e28']), ('\u2f02', &['\u4e36']), ('\u2f03', &['\u4e3f']), ('\u2f04',
- &['\u4e59']), ('\u2f05', &['\u4e85']), ('\u2f06', &['\u4e8c']), ('\u2f07', &['\u4ea0']),
- ('\u2f08', &['\u4eba']), ('\u2f09', &['\u513f']), ('\u2f0a', &['\u5165']), ('\u2f0b',
- &['\u516b']), ('\u2f0c', &['\u5182']), ('\u2f0d', &['\u5196']), ('\u2f0e', &['\u51ab']),
- ('\u2f0f', &['\u51e0']), ('\u2f10', &['\u51f5']), ('\u2f11', &['\u5200']), ('\u2f12',
- &['\u529b']), ('\u2f13', &['\u52f9']), ('\u2f14', &['\u5315']), ('\u2f15', &['\u531a']),
- ('\u2f16', &['\u5338']), ('\u2f17', &['\u5341']), ('\u2f18', &['\u535c']), ('\u2f19',
- &['\u5369']), ('\u2f1a', &['\u5382']), ('\u2f1b', &['\u53b6']), ('\u2f1c', &['\u53c8']),
- ('\u2f1d', &['\u53e3']), ('\u2f1e', &['\u56d7']), ('\u2f1f', &['\u571f']), ('\u2f20',
- &['\u58eb']), ('\u2f21', &['\u5902']), ('\u2f22', &['\u590a']), ('\u2f23', &['\u5915']),
- ('\u2f24', &['\u5927']), ('\u2f25', &['\u5973']), ('\u2f26', &['\u5b50']), ('\u2f27',
- &['\u5b80']), ('\u2f28', &['\u5bf8']), ('\u2f29', &['\u5c0f']), ('\u2f2a', &['\u5c22']),
- ('\u2f2b', &['\u5c38']), ('\u2f2c', &['\u5c6e']), ('\u2f2d', &['\u5c71']), ('\u2f2e',
- &['\u5ddb']), ('\u2f2f', &['\u5de5']), ('\u2f30', &['\u5df1']), ('\u2f31', &['\u5dfe']),
- ('\u2f32', &['\u5e72']), ('\u2f33', &['\u5e7a']), ('\u2f34', &['\u5e7f']), ('\u2f35',
- &['\u5ef4']), ('\u2f36', &['\u5efe']), ('\u2f37', &['\u5f0b']), ('\u2f38', &['\u5f13']),
- ('\u2f39', &['\u5f50']), ('\u2f3a', &['\u5f61']), ('\u2f3b', &['\u5f73']), ('\u2f3c',
- &['\u5fc3']), ('\u2f3d', &['\u6208']), ('\u2f3e', &['\u6236']), ('\u2f3f', &['\u624b']),
- ('\u2f40', &['\u652f']), ('\u2f41', &['\u6534']), ('\u2f42', &['\u6587']), ('\u2f43',
- &['\u6597']), ('\u2f44', &['\u65a4']), ('\u2f45', &['\u65b9']), ('\u2f46', &['\u65e0']),
- ('\u2f47', &['\u65e5']), ('\u2f48', &['\u66f0']), ('\u2f49', &['\u6708']), ('\u2f4a',
- &['\u6728']), ('\u2f4b', &['\u6b20']), ('\u2f4c', &['\u6b62']), ('\u2f4d', &['\u6b79']),
- ('\u2f4e', &['\u6bb3']), ('\u2f4f', &['\u6bcb']), ('\u2f50', &['\u6bd4']), ('\u2f51',
- &['\u6bdb']), ('\u2f52', &['\u6c0f']), ('\u2f53', &['\u6c14']), ('\u2f54', &['\u6c34']),
- ('\u2f55', &['\u706b']), ('\u2f56', &['\u722a']), ('\u2f57', &['\u7236']), ('\u2f58',
- &['\u723b']), ('\u2f59', &['\u723f']), ('\u2f5a', &['\u7247']), ('\u2f5b', &['\u7259']),
- ('\u2f5c', &['\u725b']), ('\u2f5d', &['\u72ac']), ('\u2f5e', &['\u7384']), ('\u2f5f',
- &['\u7389']), ('\u2f60', &['\u74dc']), ('\u2f61', &['\u74e6']), ('\u2f62', &['\u7518']),
- ('\u2f63', &['\u751f']), ('\u2f64', &['\u7528']), ('\u2f65', &['\u7530']), ('\u2f66',
- &['\u758b']), ('\u2f67', &['\u7592']), ('\u2f68', &['\u7676']), ('\u2f69', &['\u767d']),
- ('\u2f6a', &['\u76ae']), ('\u2f6b', &['\u76bf']), ('\u2f6c', &['\u76ee']), ('\u2f6d',
- &['\u77db']), ('\u2f6e', &['\u77e2']), ('\u2f6f', &['\u77f3']), ('\u2f70', &['\u793a']),
- ('\u2f71', &['\u79b8']), ('\u2f72', &['\u79be']), ('\u2f73', &['\u7a74']), ('\u2f74',
- &['\u7acb']), ('\u2f75', &['\u7af9']), ('\u2f76', &['\u7c73']), ('\u2f77', &['\u7cf8']),
- ('\u2f78', &['\u7f36']), ('\u2f79', &['\u7f51']), ('\u2f7a', &['\u7f8a']), ('\u2f7b',
- &['\u7fbd']), ('\u2f7c', &['\u8001']), ('\u2f7d', &['\u800c']), ('\u2f7e', &['\u8012']),
- ('\u2f7f', &['\u8033']), ('\u2f80', &['\u807f']), ('\u2f81', &['\u8089']), ('\u2f82',
- &['\u81e3']), ('\u2f83', &['\u81ea']), ('\u2f84', &['\u81f3']), ('\u2f85', &['\u81fc']),
- ('\u2f86', &['\u820c']), ('\u2f87', &['\u821b']), ('\u2f88', &['\u821f']), ('\u2f89',
- &['\u826e']), ('\u2f8a', &['\u8272']), ('\u2f8b', &['\u8278']), ('\u2f8c', &['\u864d']),
- ('\u2f8d', &['\u866b']), ('\u2f8e', &['\u8840']), ('\u2f8f', &['\u884c']), ('\u2f90',
- &['\u8863']), ('\u2f91', &['\u897e']), ('\u2f92', &['\u898b']), ('\u2f93', &['\u89d2']),
- ('\u2f94', &['\u8a00']), ('\u2f95', &['\u8c37']), ('\u2f96', &['\u8c46']), ('\u2f97',
- &['\u8c55']), ('\u2f98', &['\u8c78']), ('\u2f99', &['\u8c9d']), ('\u2f9a', &['\u8d64']),
- ('\u2f9b', &['\u8d70']), ('\u2f9c', &['\u8db3']), ('\u2f9d', &['\u8eab']), ('\u2f9e',
- &['\u8eca']), ('\u2f9f', &['\u8f9b']), ('\u2fa0', &['\u8fb0']), ('\u2fa1', &['\u8fb5']),
- ('\u2fa2', &['\u9091']), ('\u2fa3', &['\u9149']), ('\u2fa4', &['\u91c6']), ('\u2fa5',
- &['\u91cc']), ('\u2fa6', &['\u91d1']), ('\u2fa7', &['\u9577']), ('\u2fa8', &['\u9580']),
- ('\u2fa9', &['\u961c']), ('\u2faa', &['\u96b6']), ('\u2fab', &['\u96b9']), ('\u2fac',
- &['\u96e8']), ('\u2fad', &['\u9751']), ('\u2fae', &['\u975e']), ('\u2faf', &['\u9762']),
- ('\u2fb0', &['\u9769']), ('\u2fb1', &['\u97cb']), ('\u2fb2', &['\u97ed']), ('\u2fb3',
- &['\u97f3']), ('\u2fb4', &['\u9801']), ('\u2fb5', &['\u98a8']), ('\u2fb6', &['\u98db']),
- ('\u2fb7', &['\u98df']), ('\u2fb8', &['\u9996']), ('\u2fb9', &['\u9999']), ('\u2fba',
- &['\u99ac']), ('\u2fbb', &['\u9aa8']), ('\u2fbc', &['\u9ad8']), ('\u2fbd', &['\u9adf']),
- ('\u2fbe', &['\u9b25']), ('\u2fbf', &['\u9b2f']), ('\u2fc0', &['\u9b32']), ('\u2fc1',
- &['\u9b3c']), ('\u2fc2', &['\u9b5a']), ('\u2fc3', &['\u9ce5']), ('\u2fc4', &['\u9e75']),
- ('\u2fc5', &['\u9e7f']), ('\u2fc6', &['\u9ea5']), ('\u2fc7', &['\u9ebb']), ('\u2fc8',
- &['\u9ec3']), ('\u2fc9', &['\u9ecd']), ('\u2fca', &['\u9ed1']), ('\u2fcb', &['\u9ef9']),
- ('\u2fcc', &['\u9efd']), ('\u2fcd', &['\u9f0e']), ('\u2fce', &['\u9f13']), ('\u2fcf',
- &['\u9f20']), ('\u2fd0', &['\u9f3b']), ('\u2fd1', &['\u9f4a']), ('\u2fd2', &['\u9f52']),
- ('\u2fd3', &['\u9f8d']), ('\u2fd4', &['\u9f9c']), ('\u2fd5', &['\u9fa0']), ('\u3000',
- &['\x20']), ('\u3036', &['\u3012']), ('\u3038', &['\u5341']), ('\u3039', &['\u5344']),
- ('\u303a', &['\u5345']), ('\u309b', &['\x20', '\u3099']), ('\u309c', &['\x20', '\u309a']),
- ('\u309f', &['\u3088', '\u308a']), ('\u30ff', &['\u30b3', '\u30c8']), ('\u3131',
- &['\u1100']), ('\u3132', &['\u1101']), ('\u3133', &['\u11aa']), ('\u3134', &['\u1102']),
- ('\u3135', &['\u11ac']), ('\u3136', &['\u11ad']), ('\u3137', &['\u1103']), ('\u3138',
- &['\u1104']), ('\u3139', &['\u1105']), ('\u313a', &['\u11b0']), ('\u313b', &['\u11b1']),
- ('\u313c', &['\u11b2']), ('\u313d', &['\u11b3']), ('\u313e', &['\u11b4']), ('\u313f',
- &['\u11b5']), ('\u3140', &['\u111a']), ('\u3141', &['\u1106']), ('\u3142', &['\u1107']),
- ('\u3143', &['\u1108']), ('\u3144', &['\u1121']), ('\u3145', &['\u1109']), ('\u3146',
- &['\u110a']), ('\u3147', &['\u110b']), ('\u3148', &['\u110c']), ('\u3149', &['\u110d']),
- ('\u314a', &['\u110e']), ('\u314b', &['\u110f']), ('\u314c', &['\u1110']), ('\u314d',
- &['\u1111']), ('\u314e', &['\u1112']), ('\u314f', &['\u1161']), ('\u3150', &['\u1162']),
- ('\u3151', &['\u1163']), ('\u3152', &['\u1164']), ('\u3153', &['\u1165']), ('\u3154',
- &['\u1166']), ('\u3155', &['\u1167']), ('\u3156', &['\u1168']), ('\u3157', &['\u1169']),
- ('\u3158', &['\u116a']), ('\u3159', &['\u116b']), ('\u315a', &['\u116c']), ('\u315b',
- &['\u116d']), ('\u315c', &['\u116e']), ('\u315d', &['\u116f']), ('\u315e', &['\u1170']),
- ('\u315f', &['\u1171']), ('\u3160', &['\u1172']), ('\u3161', &['\u1173']), ('\u3162',
- &['\u1174']), ('\u3163', &['\u1175']), ('\u3164', &['\u1160']), ('\u3165', &['\u1114']),
- ('\u3166', &['\u1115']), ('\u3167', &['\u11c7']), ('\u3168', &['\u11c8']), ('\u3169',
- &['\u11cc']), ('\u316a', &['\u11ce']), ('\u316b', &['\u11d3']), ('\u316c', &['\u11d7']),
- ('\u316d', &['\u11d9']), ('\u316e', &['\u111c']), ('\u316f', &['\u11dd']), ('\u3170',
- &['\u11df']), ('\u3171', &['\u111d']), ('\u3172', &['\u111e']), ('\u3173', &['\u1120']),
- ('\u3174', &['\u1122']), ('\u3175', &['\u1123']), ('\u3176', &['\u1127']), ('\u3177',
- &['\u1129']), ('\u3178', &['\u112b']), ('\u3179', &['\u112c']), ('\u317a', &['\u112d']),
- ('\u317b', &['\u112e']), ('\u317c', &['\u112f']), ('\u317d', &['\u1132']), ('\u317e',
- &['\u1136']), ('\u317f', &['\u1140']), ('\u3180', &['\u1147']), ('\u3181', &['\u114c']),
- ('\u3182', &['\u11f1']), ('\u3183', &['\u11f2']), ('\u3184', &['\u1157']), ('\u3185',
- &['\u1158']), ('\u3186', &['\u1159']), ('\u3187', &['\u1184']), ('\u3188', &['\u1185']),
- ('\u3189', &['\u1188']), ('\u318a', &['\u1191']), ('\u318b', &['\u1192']), ('\u318c',
- &['\u1194']), ('\u318d', &['\u119e']), ('\u318e', &['\u11a1']), ('\u3192', &['\u4e00']),
- ('\u3193', &['\u4e8c']), ('\u3194', &['\u4e09']), ('\u3195', &['\u56db']), ('\u3196',
- &['\u4e0a']), ('\u3197', &['\u4e2d']), ('\u3198', &['\u4e0b']), ('\u3199', &['\u7532']),
- ('\u319a', &['\u4e59']), ('\u319b', &['\u4e19']), ('\u319c', &['\u4e01']), ('\u319d',
- &['\u5929']), ('\u319e', &['\u5730']), ('\u319f', &['\u4eba']), ('\u3200', &['\x28',
- '\u1100', '\x29']), ('\u3201', &['\x28', '\u1102', '\x29']), ('\u3202', &['\x28', '\u1103',
- '\x29']), ('\u3203', &['\x28', '\u1105', '\x29']), ('\u3204', &['\x28', '\u1106', '\x29']),
- ('\u3205', &['\x28', '\u1107', '\x29']), ('\u3206', &['\x28', '\u1109', '\x29']), ('\u3207',
- &['\x28', '\u110b', '\x29']), ('\u3208', &['\x28', '\u110c', '\x29']), ('\u3209', &['\x28',
- '\u110e', '\x29']), ('\u320a', &['\x28', '\u110f', '\x29']), ('\u320b', &['\x28', '\u1110',
- '\x29']), ('\u320c', &['\x28', '\u1111', '\x29']), ('\u320d', &['\x28', '\u1112', '\x29']),
- ('\u320e', &['\x28', '\u1100', '\u1161', '\x29']), ('\u320f', &['\x28', '\u1102', '\u1161',
- '\x29']), ('\u3210', &['\x28', '\u1103', '\u1161', '\x29']), ('\u3211', &['\x28', '\u1105',
- '\u1161', '\x29']), ('\u3212', &['\x28', '\u1106', '\u1161', '\x29']), ('\u3213', &['\x28',
- '\u1107', '\u1161', '\x29']), ('\u3214', &['\x28', '\u1109', '\u1161', '\x29']), ('\u3215',
- &['\x28', '\u110b', '\u1161', '\x29']), ('\u3216', &['\x28', '\u110c', '\u1161', '\x29']),
- ('\u3217', &['\x28', '\u110e', '\u1161', '\x29']), ('\u3218', &['\x28', '\u110f', '\u1161',
- '\x29']), ('\u3219', &['\x28', '\u1110', '\u1161', '\x29']), ('\u321a', &['\x28', '\u1111',
- '\u1161', '\x29']), ('\u321b', &['\x28', '\u1112', '\u1161', '\x29']), ('\u321c', &['\x28',
- '\u110c', '\u116e', '\x29']), ('\u321d', &['\x28', '\u110b', '\u1169', '\u110c', '\u1165',
- '\u11ab', '\x29']), ('\u321e', &['\x28', '\u110b', '\u1169', '\u1112', '\u116e', '\x29']),
- ('\u3220', &['\x28', '\u4e00', '\x29']), ('\u3221', &['\x28', '\u4e8c', '\x29']), ('\u3222',
- &['\x28', '\u4e09', '\x29']), ('\u3223', &['\x28', '\u56db', '\x29']), ('\u3224', &['\x28',
- '\u4e94', '\x29']), ('\u3225', &['\x28', '\u516d', '\x29']), ('\u3226', &['\x28', '\u4e03',
- '\x29']), ('\u3227', &['\x28', '\u516b', '\x29']), ('\u3228', &['\x28', '\u4e5d', '\x29']),
- ('\u3229', &['\x28', '\u5341', '\x29']), ('\u322a', &['\x28', '\u6708', '\x29']), ('\u322b',
- &['\x28', '\u706b', '\x29']), ('\u322c', &['\x28', '\u6c34', '\x29']), ('\u322d', &['\x28',
- '\u6728', '\x29']), ('\u322e', &['\x28', '\u91d1', '\x29']), ('\u322f', &['\x28', '\u571f',
- '\x29']), ('\u3230', &['\x28', '\u65e5', '\x29']), ('\u3231', &['\x28', '\u682a', '\x29']),
- ('\u3232', &['\x28', '\u6709', '\x29']), ('\u3233', &['\x28', '\u793e', '\x29']), ('\u3234',
- &['\x28', '\u540d', '\x29']), ('\u3235', &['\x28', '\u7279', '\x29']), ('\u3236', &['\x28',
- '\u8ca1', '\x29']), ('\u3237', &['\x28', '\u795d', '\x29']), ('\u3238', &['\x28', '\u52b4',
- '\x29']), ('\u3239', &['\x28', '\u4ee3', '\x29']), ('\u323a', &['\x28', '\u547c', '\x29']),
- ('\u323b', &['\x28', '\u5b66', '\x29']), ('\u323c', &['\x28', '\u76e3', '\x29']), ('\u323d',
- &['\x28', '\u4f01', '\x29']), ('\u323e', &['\x28', '\u8cc7', '\x29']), ('\u323f', &['\x28',
- '\u5354', '\x29']), ('\u3240', &['\x28', '\u796d', '\x29']), ('\u3241', &['\x28', '\u4f11',
- '\x29']), ('\u3242', &['\x28', '\u81ea', '\x29']), ('\u3243', &['\x28', '\u81f3', '\x29']),
- ('\u3244', &['\u554f']), ('\u3245', &['\u5e7c']), ('\u3246', &['\u6587']), ('\u3247',
- &['\u7b8f']), ('\u3250', &['\x50', '\x54', '\x45']), ('\u3251', &['\x32', '\x31']),
- ('\u3252', &['\x32', '\x32']), ('\u3253', &['\x32', '\x33']), ('\u3254', &['\x32', '\x34']),
- ('\u3255', &['\x32', '\x35']), ('\u3256', &['\x32', '\x36']), ('\u3257', &['\x32', '\x37']),
- ('\u3258', &['\x32', '\x38']), ('\u3259', &['\x32', '\x39']), ('\u325a', &['\x33', '\x30']),
- ('\u325b', &['\x33', '\x31']), ('\u325c', &['\x33', '\x32']), ('\u325d', &['\x33', '\x33']),
- ('\u325e', &['\x33', '\x34']), ('\u325f', &['\x33', '\x35']), ('\u3260', &['\u1100']),
- ('\u3261', &['\u1102']), ('\u3262', &['\u1103']), ('\u3263', &['\u1105']), ('\u3264',
- &['\u1106']), ('\u3265', &['\u1107']), ('\u3266', &['\u1109']), ('\u3267', &['\u110b']),
- ('\u3268', &['\u110c']), ('\u3269', &['\u110e']), ('\u326a', &['\u110f']), ('\u326b',
- &['\u1110']), ('\u326c', &['\u1111']), ('\u326d', &['\u1112']), ('\u326e', &['\u1100',
- '\u1161']), ('\u326f', &['\u1102', '\u1161']), ('\u3270', &['\u1103', '\u1161']), ('\u3271',
- &['\u1105', '\u1161']), ('\u3272', &['\u1106', '\u1161']), ('\u3273', &['\u1107',
- '\u1161']), ('\u3274', &['\u1109', '\u1161']), ('\u3275', &['\u110b', '\u1161']), ('\u3276',
- &['\u110c', '\u1161']), ('\u3277', &['\u110e', '\u1161']), ('\u3278', &['\u110f',
- '\u1161']), ('\u3279', &['\u1110', '\u1161']), ('\u327a', &['\u1111', '\u1161']), ('\u327b',
- &['\u1112', '\u1161']), ('\u327c', &['\u110e', '\u1161', '\u11b7', '\u1100', '\u1169']),
- ('\u327d', &['\u110c', '\u116e', '\u110b', '\u1174']), ('\u327e', &['\u110b', '\u116e']),
- ('\u3280', &['\u4e00']), ('\u3281', &['\u4e8c']), ('\u3282', &['\u4e09']), ('\u3283',
- &['\u56db']), ('\u3284', &['\u4e94']), ('\u3285', &['\u516d']), ('\u3286', &['\u4e03']),
- ('\u3287', &['\u516b']), ('\u3288', &['\u4e5d']), ('\u3289', &['\u5341']), ('\u328a',
- &['\u6708']), ('\u328b', &['\u706b']), ('\u328c', &['\u6c34']), ('\u328d', &['\u6728']),
- ('\u328e', &['\u91d1']), ('\u328f', &['\u571f']), ('\u3290', &['\u65e5']), ('\u3291',
- &['\u682a']), ('\u3292', &['\u6709']), ('\u3293', &['\u793e']), ('\u3294', &['\u540d']),
- ('\u3295', &['\u7279']), ('\u3296', &['\u8ca1']), ('\u3297', &['\u795d']), ('\u3298',
- &['\u52b4']), ('\u3299', &['\u79d8']), ('\u329a', &['\u7537']), ('\u329b', &['\u5973']),
- ('\u329c', &['\u9069']), ('\u329d', &['\u512a']), ('\u329e', &['\u5370']), ('\u329f',
- &['\u6ce8']), ('\u32a0', &['\u9805']), ('\u32a1', &['\u4f11']), ('\u32a2', &['\u5199']),
- ('\u32a3', &['\u6b63']), ('\u32a4', &['\u4e0a']), ('\u32a5', &['\u4e2d']), ('\u32a6',
- &['\u4e0b']), ('\u32a7', &['\u5de6']), ('\u32a8', &['\u53f3']), ('\u32a9', &['\u533b']),
- ('\u32aa', &['\u5b97']), ('\u32ab', &['\u5b66']), ('\u32ac', &['\u76e3']), ('\u32ad',
- &['\u4f01']), ('\u32ae', &['\u8cc7']), ('\u32af', &['\u5354']), ('\u32b0', &['\u591c']),
- ('\u32b1', &['\x33', '\x36']), ('\u32b2', &['\x33', '\x37']), ('\u32b3', &['\x33', '\x38']),
- ('\u32b4', &['\x33', '\x39']), ('\u32b5', &['\x34', '\x30']), ('\u32b6', &['\x34', '\x31']),
- ('\u32b7', &['\x34', '\x32']), ('\u32b8', &['\x34', '\x33']), ('\u32b9', &['\x34', '\x34']),
- ('\u32ba', &['\x34', '\x35']), ('\u32bb', &['\x34', '\x36']), ('\u32bc', &['\x34', '\x37']),
- ('\u32bd', &['\x34', '\x38']), ('\u32be', &['\x34', '\x39']), ('\u32bf', &['\x35', '\x30']),
- ('\u32c0', &['\x31', '\u6708']), ('\u32c1', &['\x32', '\u6708']), ('\u32c2', &['\x33',
- '\u6708']), ('\u32c3', &['\x34', '\u6708']), ('\u32c4', &['\x35', '\u6708']), ('\u32c5',
- &['\x36', '\u6708']), ('\u32c6', &['\x37', '\u6708']), ('\u32c7', &['\x38', '\u6708']),
- ('\u32c8', &['\x39', '\u6708']), ('\u32c9', &['\x31', '\x30', '\u6708']), ('\u32ca',
- &['\x31', '\x31', '\u6708']), ('\u32cb', &['\x31', '\x32', '\u6708']), ('\u32cc', &['\x48',
- '\x67']), ('\u32cd', &['\x65', '\x72', '\x67']), ('\u32ce', &['\x65', '\x56']), ('\u32cf',
- &['\x4c', '\x54', '\x44']), ('\u32d0', &['\u30a2']), ('\u32d1', &['\u30a4']), ('\u32d2',
- &['\u30a6']), ('\u32d3', &['\u30a8']), ('\u32d4', &['\u30aa']), ('\u32d5', &['\u30ab']),
- ('\u32d6', &['\u30ad']), ('\u32d7', &['\u30af']), ('\u32d8', &['\u30b1']), ('\u32d9',
- &['\u30b3']), ('\u32da', &['\u30b5']), ('\u32db', &['\u30b7']), ('\u32dc', &['\u30b9']),
- ('\u32dd', &['\u30bb']), ('\u32de', &['\u30bd']), ('\u32df', &['\u30bf']), ('\u32e0',
- &['\u30c1']), ('\u32e1', &['\u30c4']), ('\u32e2', &['\u30c6']), ('\u32e3', &['\u30c8']),
- ('\u32e4', &['\u30ca']), ('\u32e5', &['\u30cb']), ('\u32e6', &['\u30cc']), ('\u32e7',
- &['\u30cd']), ('\u32e8', &['\u30ce']), ('\u32e9', &['\u30cf']), ('\u32ea', &['\u30d2']),
- ('\u32eb', &['\u30d5']), ('\u32ec', &['\u30d8']), ('\u32ed', &['\u30db']), ('\u32ee',
- &['\u30de']), ('\u32ef', &['\u30df']), ('\u32f0', &['\u30e0']), ('\u32f1', &['\u30e1']),
- ('\u32f2', &['\u30e2']), ('\u32f3', &['\u30e4']), ('\u32f4', &['\u30e6']), ('\u32f5',
- &['\u30e8']), ('\u32f6', &['\u30e9']), ('\u32f7', &['\u30ea']), ('\u32f8', &['\u30eb']),
- ('\u32f9', &['\u30ec']), ('\u32fa', &['\u30ed']), ('\u32fb', &['\u30ef']), ('\u32fc',
- &['\u30f0']), ('\u32fd', &['\u30f1']), ('\u32fe', &['\u30f2']), ('\u3300', &['\u30a2',
- '\u30d1', '\u30fc', '\u30c8']), ('\u3301', &['\u30a2', '\u30eb', '\u30d5', '\u30a1']),
- ('\u3302', &['\u30a2', '\u30f3', '\u30da', '\u30a2']), ('\u3303', &['\u30a2', '\u30fc',
- '\u30eb']), ('\u3304', &['\u30a4', '\u30cb', '\u30f3', '\u30b0']), ('\u3305', &['\u30a4',
- '\u30f3', '\u30c1']), ('\u3306', &['\u30a6', '\u30a9', '\u30f3']), ('\u3307', &['\u30a8',
- '\u30b9', '\u30af', '\u30fc', '\u30c9']), ('\u3308', &['\u30a8', '\u30fc', '\u30ab',
- '\u30fc']), ('\u3309', &['\u30aa', '\u30f3', '\u30b9']), ('\u330a', &['\u30aa', '\u30fc',
- '\u30e0']), ('\u330b', &['\u30ab', '\u30a4', '\u30ea']), ('\u330c', &['\u30ab', '\u30e9',
- '\u30c3', '\u30c8']), ('\u330d', &['\u30ab', '\u30ed', '\u30ea', '\u30fc']), ('\u330e',
- &['\u30ac', '\u30ed', '\u30f3']), ('\u330f', &['\u30ac', '\u30f3', '\u30de']), ('\u3310',
- &['\u30ae', '\u30ac']), ('\u3311', &['\u30ae', '\u30cb', '\u30fc']), ('\u3312', &['\u30ad',
- '\u30e5', '\u30ea', '\u30fc']), ('\u3313', &['\u30ae', '\u30eb', '\u30c0', '\u30fc']),
- ('\u3314', &['\u30ad', '\u30ed']), ('\u3315', &['\u30ad', '\u30ed', '\u30b0', '\u30e9',
- '\u30e0']), ('\u3316', &['\u30ad', '\u30ed', '\u30e1', '\u30fc', '\u30c8', '\u30eb']),
- ('\u3317', &['\u30ad', '\u30ed', '\u30ef', '\u30c3', '\u30c8']), ('\u3318', &['\u30b0',
- '\u30e9', '\u30e0']), ('\u3319', &['\u30b0', '\u30e9', '\u30e0', '\u30c8', '\u30f3']),
- ('\u331a', &['\u30af', '\u30eb', '\u30bc', '\u30a4', '\u30ed']), ('\u331b', &['\u30af',
- '\u30ed', '\u30fc', '\u30cd']), ('\u331c', &['\u30b1', '\u30fc', '\u30b9']), ('\u331d',
- &['\u30b3', '\u30eb', '\u30ca']), ('\u331e', &['\u30b3', '\u30fc', '\u30dd']), ('\u331f',
- &['\u30b5', '\u30a4', '\u30af', '\u30eb']), ('\u3320', &['\u30b5', '\u30f3', '\u30c1',
- '\u30fc', '\u30e0']), ('\u3321', &['\u30b7', '\u30ea', '\u30f3', '\u30b0']), ('\u3322',
- &['\u30bb', '\u30f3', '\u30c1']), ('\u3323', &['\u30bb', '\u30f3', '\u30c8']), ('\u3324',
- &['\u30c0', '\u30fc', '\u30b9']), ('\u3325', &['\u30c7', '\u30b7']), ('\u3326', &['\u30c9',
- '\u30eb']), ('\u3327', &['\u30c8', '\u30f3']), ('\u3328', &['\u30ca', '\u30ce']), ('\u3329',
- &['\u30ce', '\u30c3', '\u30c8']), ('\u332a', &['\u30cf', '\u30a4', '\u30c4']), ('\u332b',
- &['\u30d1', '\u30fc', '\u30bb', '\u30f3', '\u30c8']), ('\u332c', &['\u30d1', '\u30fc',
- '\u30c4']), ('\u332d', &['\u30d0', '\u30fc', '\u30ec', '\u30eb']), ('\u332e', &['\u30d4',
- '\u30a2', '\u30b9', '\u30c8', '\u30eb']), ('\u332f', &['\u30d4', '\u30af', '\u30eb']),
- ('\u3330', &['\u30d4', '\u30b3']), ('\u3331', &['\u30d3', '\u30eb']), ('\u3332', &['\u30d5',
- '\u30a1', '\u30e9', '\u30c3', '\u30c9']), ('\u3333', &['\u30d5', '\u30a3', '\u30fc',
- '\u30c8']), ('\u3334', &['\u30d6', '\u30c3', '\u30b7', '\u30a7', '\u30eb']), ('\u3335',
- &['\u30d5', '\u30e9', '\u30f3']), ('\u3336', &['\u30d8', '\u30af', '\u30bf', '\u30fc',
- '\u30eb']), ('\u3337', &['\u30da', '\u30bd']), ('\u3338', &['\u30da', '\u30cb', '\u30d2']),
- ('\u3339', &['\u30d8', '\u30eb', '\u30c4']), ('\u333a', &['\u30da', '\u30f3', '\u30b9']),
- ('\u333b', &['\u30da', '\u30fc', '\u30b8']), ('\u333c', &['\u30d9', '\u30fc', '\u30bf']),
- ('\u333d', &['\u30dd', '\u30a4', '\u30f3', '\u30c8']), ('\u333e', &['\u30dc', '\u30eb',
- '\u30c8']), ('\u333f', &['\u30db', '\u30f3']), ('\u3340', &['\u30dd', '\u30f3', '\u30c9']),
- ('\u3341', &['\u30db', '\u30fc', '\u30eb']), ('\u3342', &['\u30db', '\u30fc', '\u30f3']),
- ('\u3343', &['\u30de', '\u30a4', '\u30af', '\u30ed']), ('\u3344', &['\u30de', '\u30a4',
- '\u30eb']), ('\u3345', &['\u30de', '\u30c3', '\u30cf']), ('\u3346', &['\u30de', '\u30eb',
- '\u30af']), ('\u3347', &['\u30de', '\u30f3', '\u30b7', '\u30e7', '\u30f3']), ('\u3348',
- &['\u30df', '\u30af', '\u30ed', '\u30f3']), ('\u3349', &['\u30df', '\u30ea']), ('\u334a',
- &['\u30df', '\u30ea', '\u30d0', '\u30fc', '\u30eb']), ('\u334b', &['\u30e1', '\u30ac']),
- ('\u334c', &['\u30e1', '\u30ac', '\u30c8', '\u30f3']), ('\u334d', &['\u30e1', '\u30fc',
- '\u30c8', '\u30eb']), ('\u334e', &['\u30e4', '\u30fc', '\u30c9']), ('\u334f', &['\u30e4',
- '\u30fc', '\u30eb']), ('\u3350', &['\u30e6', '\u30a2', '\u30f3']), ('\u3351', &['\u30ea',
- '\u30c3', '\u30c8', '\u30eb']), ('\u3352', &['\u30ea', '\u30e9']), ('\u3353', &['\u30eb',
- '\u30d4', '\u30fc']), ('\u3354', &['\u30eb', '\u30fc', '\u30d6', '\u30eb']), ('\u3355',
- &['\u30ec', '\u30e0']), ('\u3356', &['\u30ec', '\u30f3', '\u30c8', '\u30b2', '\u30f3']),
- ('\u3357', &['\u30ef', '\u30c3', '\u30c8']), ('\u3358', &['\x30', '\u70b9']), ('\u3359',
- &['\x31', '\u70b9']), ('\u335a', &['\x32', '\u70b9']), ('\u335b', &['\x33', '\u70b9']),
- ('\u335c', &['\x34', '\u70b9']), ('\u335d', &['\x35', '\u70b9']), ('\u335e', &['\x36',
- '\u70b9']), ('\u335f', &['\x37', '\u70b9']), ('\u3360', &['\x38', '\u70b9']), ('\u3361',
- &['\x39', '\u70b9']), ('\u3362', &['\x31', '\x30', '\u70b9']), ('\u3363', &['\x31', '\x31',
- '\u70b9']), ('\u3364', &['\x31', '\x32', '\u70b9']), ('\u3365', &['\x31', '\x33',
- '\u70b9']), ('\u3366', &['\x31', '\x34', '\u70b9']), ('\u3367', &['\x31', '\x35',
- '\u70b9']), ('\u3368', &['\x31', '\x36', '\u70b9']), ('\u3369', &['\x31', '\x37',
- '\u70b9']), ('\u336a', &['\x31', '\x38', '\u70b9']), ('\u336b', &['\x31', '\x39',
- '\u70b9']), ('\u336c', &['\x32', '\x30', '\u70b9']), ('\u336d', &['\x32', '\x31',
- '\u70b9']), ('\u336e', &['\x32', '\x32', '\u70b9']), ('\u336f', &['\x32', '\x33',
- '\u70b9']), ('\u3370', &['\x32', '\x34', '\u70b9']), ('\u3371', &['\x68', '\x50', '\x61']),
- ('\u3372', &['\x64', '\x61']), ('\u3373', &['\x41', '\x55']), ('\u3374', &['\x62', '\x61',
- '\x72']), ('\u3375', &['\x6f', '\x56']), ('\u3376', &['\x70', '\x63']), ('\u3377', &['\x64',
- '\x6d']), ('\u3378', &['\x64', '\x6d', '\xb2']), ('\u3379', &['\x64', '\x6d', '\xb3']),
- ('\u337a', &['\x49', '\x55']), ('\u337b', &['\u5e73', '\u6210']), ('\u337c', &['\u662d',
- '\u548c']), ('\u337d', &['\u5927', '\u6b63']), ('\u337e', &['\u660e', '\u6cbb']), ('\u337f',
- &['\u682a', '\u5f0f', '\u4f1a', '\u793e']), ('\u3380', &['\x70', '\x41']), ('\u3381',
- &['\x6e', '\x41']), ('\u3382', &['\u03bc', '\x41']), ('\u3383', &['\x6d', '\x41']),
- ('\u3384', &['\x6b', '\x41']), ('\u3385', &['\x4b', '\x42']), ('\u3386', &['\x4d', '\x42']),
- ('\u3387', &['\x47', '\x42']), ('\u3388', &['\x63', '\x61', '\x6c']), ('\u3389', &['\x6b',
- '\x63', '\x61', '\x6c']), ('\u338a', &['\x70', '\x46']), ('\u338b', &['\x6e', '\x46']),
- ('\u338c', &['\u03bc', '\x46']), ('\u338d', &['\u03bc', '\x67']), ('\u338e', &['\x6d',
- '\x67']), ('\u338f', &['\x6b', '\x67']), ('\u3390', &['\x48', '\x7a']), ('\u3391', &['\x6b',
- '\x48', '\x7a']), ('\u3392', &['\x4d', '\x48', '\x7a']), ('\u3393', &['\x47', '\x48',
- '\x7a']), ('\u3394', &['\x54', '\x48', '\x7a']), ('\u3395', &['\u03bc', '\u2113']),
- ('\u3396', &['\x6d', '\u2113']), ('\u3397', &['\x64', '\u2113']), ('\u3398', &['\x6b',
- '\u2113']), ('\u3399', &['\x66', '\x6d']), ('\u339a', &['\x6e', '\x6d']), ('\u339b',
- &['\u03bc', '\x6d']), ('\u339c', &['\x6d', '\x6d']), ('\u339d', &['\x63', '\x6d']),
- ('\u339e', &['\x6b', '\x6d']), ('\u339f', &['\x6d', '\x6d', '\xb2']), ('\u33a0', &['\x63',
- '\x6d', '\xb2']), ('\u33a1', &['\x6d', '\xb2']), ('\u33a2', &['\x6b', '\x6d', '\xb2']),
- ('\u33a3', &['\x6d', '\x6d', '\xb3']), ('\u33a4', &['\x63', '\x6d', '\xb3']), ('\u33a5',
- &['\x6d', '\xb3']), ('\u33a6', &['\x6b', '\x6d', '\xb3']), ('\u33a7', &['\x6d', '\u2215',
- '\x73']), ('\u33a8', &['\x6d', '\u2215', '\x73', '\xb2']), ('\u33a9', &['\x50', '\x61']),
- ('\u33aa', &['\x6b', '\x50', '\x61']), ('\u33ab', &['\x4d', '\x50', '\x61']), ('\u33ac',
- &['\x47', '\x50', '\x61']), ('\u33ad', &['\x72', '\x61', '\x64']), ('\u33ae', &['\x72',
- '\x61', '\x64', '\u2215', '\x73']), ('\u33af', &['\x72', '\x61', '\x64', '\u2215', '\x73',
- '\xb2']), ('\u33b0', &['\x70', '\x73']), ('\u33b1', &['\x6e', '\x73']), ('\u33b2',
- &['\u03bc', '\x73']), ('\u33b3', &['\x6d', '\x73']), ('\u33b4', &['\x70', '\x56']),
- ('\u33b5', &['\x6e', '\x56']), ('\u33b6', &['\u03bc', '\x56']), ('\u33b7', &['\x6d',
- '\x56']), ('\u33b8', &['\x6b', '\x56']), ('\u33b9', &['\x4d', '\x56']), ('\u33ba', &['\x70',
- '\x57']), ('\u33bb', &['\x6e', '\x57']), ('\u33bc', &['\u03bc', '\x57']), ('\u33bd',
- &['\x6d', '\x57']), ('\u33be', &['\x6b', '\x57']), ('\u33bf', &['\x4d', '\x57']), ('\u33c0',
- &['\x6b', '\u03a9']), ('\u33c1', &['\x4d', '\u03a9']), ('\u33c2', &['\x61', '\x2e', '\x6d',
- '\x2e']), ('\u33c3', &['\x42', '\x71']), ('\u33c4', &['\x63', '\x63']), ('\u33c5', &['\x63',
- '\x64']), ('\u33c6', &['\x43', '\u2215', '\x6b', '\x67']), ('\u33c7', &['\x43', '\x6f',
- '\x2e']), ('\u33c8', &['\x64', '\x42']), ('\u33c9', &['\x47', '\x79']), ('\u33ca', &['\x68',
- '\x61']), ('\u33cb', &['\x48', '\x50']), ('\u33cc', &['\x69', '\x6e']), ('\u33cd', &['\x4b',
- '\x4b']), ('\u33ce', &['\x4b', '\x4d']), ('\u33cf', &['\x6b', '\x74']), ('\u33d0', &['\x6c',
- '\x6d']), ('\u33d1', &['\x6c', '\x6e']), ('\u33d2', &['\x6c', '\x6f', '\x67']), ('\u33d3',
- &['\x6c', '\x78']), ('\u33d4', &['\x6d', '\x62']), ('\u33d5', &['\x6d', '\x69', '\x6c']),
- ('\u33d6', &['\x6d', '\x6f', '\x6c']), ('\u33d7', &['\x50', '\x48']), ('\u33d8', &['\x70',
- '\x2e', '\x6d', '\x2e']), ('\u33d9', &['\x50', '\x50', '\x4d']), ('\u33da', &['\x50',
- '\x52']), ('\u33db', &['\x73', '\x72']), ('\u33dc', &['\x53', '\x76']), ('\u33dd', &['\x57',
- '\x62']), ('\u33de', &['\x56', '\u2215', '\x6d']), ('\u33df', &['\x41', '\u2215', '\x6d']),
- ('\u33e0', &['\x31', '\u65e5']), ('\u33e1', &['\x32', '\u65e5']), ('\u33e2', &['\x33',
- '\u65e5']), ('\u33e3', &['\x34', '\u65e5']), ('\u33e4', &['\x35', '\u65e5']), ('\u33e5',
- &['\x36', '\u65e5']), ('\u33e6', &['\x37', '\u65e5']), ('\u33e7', &['\x38', '\u65e5']),
- ('\u33e8', &['\x39', '\u65e5']), ('\u33e9', &['\x31', '\x30', '\u65e5']), ('\u33ea',
- &['\x31', '\x31', '\u65e5']), ('\u33eb', &['\x31', '\x32', '\u65e5']), ('\u33ec', &['\x31',
- '\x33', '\u65e5']), ('\u33ed', &['\x31', '\x34', '\u65e5']), ('\u33ee', &['\x31', '\x35',
- '\u65e5']), ('\u33ef', &['\x31', '\x36', '\u65e5']), ('\u33f0', &['\x31', '\x37',
- '\u65e5']), ('\u33f1', &['\x31', '\x38', '\u65e5']), ('\u33f2', &['\x31', '\x39',
- '\u65e5']), ('\u33f3', &['\x32', '\x30', '\u65e5']), ('\u33f4', &['\x32', '\x31',
- '\u65e5']), ('\u33f5', &['\x32', '\x32', '\u65e5']), ('\u33f6', &['\x32', '\x33',
- '\u65e5']), ('\u33f7', &['\x32', '\x34', '\u65e5']), ('\u33f8', &['\x32', '\x35',
- '\u65e5']), ('\u33f9', &['\x32', '\x36', '\u65e5']), ('\u33fa', &['\x32', '\x37',
- '\u65e5']), ('\u33fb', &['\x32', '\x38', '\u65e5']), ('\u33fc', &['\x32', '\x39',
- '\u65e5']), ('\u33fd', &['\x33', '\x30', '\u65e5']), ('\u33fe', &['\x33', '\x31',
- '\u65e5']), ('\u33ff', &['\x67', '\x61', '\x6c']), ('\ua770', &['\ua76f']), ('\ua7f8',
- &['\u0126']), ('\ua7f9', &['\u0153']), ('\ufb00', &['\x66', '\x66']), ('\ufb01', &['\x66',
- '\x69']), ('\ufb02', &['\x66', '\x6c']), ('\ufb03', &['\x66', '\x66', '\x69']), ('\ufb04',
- &['\x66', '\x66', '\x6c']), ('\ufb05', &['\u017f', '\x74']), ('\ufb06', &['\x73', '\x74']),
- ('\ufb13', &['\u0574', '\u0576']), ('\ufb14', &['\u0574', '\u0565']), ('\ufb15', &['\u0574',
- '\u056b']), ('\ufb16', &['\u057e', '\u0576']), ('\ufb17', &['\u0574', '\u056d']), ('\ufb20',
- &['\u05e2']), ('\ufb21', &['\u05d0']), ('\ufb22', &['\u05d3']), ('\ufb23', &['\u05d4']),
- ('\ufb24', &['\u05db']), ('\ufb25', &['\u05dc']), ('\ufb26', &['\u05dd']), ('\ufb27',
- &['\u05e8']), ('\ufb28', &['\u05ea']), ('\ufb29', &['\x2b']), ('\ufb4f', &['\u05d0',
- '\u05dc']), ('\ufb50', &['\u0671']), ('\ufb51', &['\u0671']), ('\ufb52', &['\u067b']),
- ('\ufb53', &['\u067b']), ('\ufb54', &['\u067b']), ('\ufb55', &['\u067b']), ('\ufb56',
- &['\u067e']), ('\ufb57', &['\u067e']), ('\ufb58', &['\u067e']), ('\ufb59', &['\u067e']),
- ('\ufb5a', &['\u0680']), ('\ufb5b', &['\u0680']), ('\ufb5c', &['\u0680']), ('\ufb5d',
- &['\u0680']), ('\ufb5e', &['\u067a']), ('\ufb5f', &['\u067a']), ('\ufb60', &['\u067a']),
- ('\ufb61', &['\u067a']), ('\ufb62', &['\u067f']), ('\ufb63', &['\u067f']), ('\ufb64',
- &['\u067f']), ('\ufb65', &['\u067f']), ('\ufb66', &['\u0679']), ('\ufb67', &['\u0679']),
- ('\ufb68', &['\u0679']), ('\ufb69', &['\u0679']), ('\ufb6a', &['\u06a4']), ('\ufb6b',
- &['\u06a4']), ('\ufb6c', &['\u06a4']), ('\ufb6d', &['\u06a4']), ('\ufb6e', &['\u06a6']),
- ('\ufb6f', &['\u06a6']), ('\ufb70', &['\u06a6']), ('\ufb71', &['\u06a6']), ('\ufb72',
- &['\u0684']), ('\ufb73', &['\u0684']), ('\ufb74', &['\u0684']), ('\ufb75', &['\u0684']),
- ('\ufb76', &['\u0683']), ('\ufb77', &['\u0683']), ('\ufb78', &['\u0683']), ('\ufb79',
- &['\u0683']), ('\ufb7a', &['\u0686']), ('\ufb7b', &['\u0686']), ('\ufb7c', &['\u0686']),
- ('\ufb7d', &['\u0686']), ('\ufb7e', &['\u0687']), ('\ufb7f', &['\u0687']), ('\ufb80',
- &['\u0687']), ('\ufb81', &['\u0687']), ('\ufb82', &['\u068d']), ('\ufb83', &['\u068d']),
- ('\ufb84', &['\u068c']), ('\ufb85', &['\u068c']), ('\ufb86', &['\u068e']), ('\ufb87',
- &['\u068e']), ('\ufb88', &['\u0688']), ('\ufb89', &['\u0688']), ('\ufb8a', &['\u0698']),
- ('\ufb8b', &['\u0698']), ('\ufb8c', &['\u0691']), ('\ufb8d', &['\u0691']), ('\ufb8e',
- &['\u06a9']), ('\ufb8f', &['\u06a9']), ('\ufb90', &['\u06a9']), ('\ufb91', &['\u06a9']),
- ('\ufb92', &['\u06af']), ('\ufb93', &['\u06af']), ('\ufb94', &['\u06af']), ('\ufb95',
- &['\u06af']), ('\ufb96', &['\u06b3']), ('\ufb97', &['\u06b3']), ('\ufb98', &['\u06b3']),
- ('\ufb99', &['\u06b3']), ('\ufb9a', &['\u06b1']), ('\ufb9b', &['\u06b1']), ('\ufb9c',
- &['\u06b1']), ('\ufb9d', &['\u06b1']), ('\ufb9e', &['\u06ba']), ('\ufb9f', &['\u06ba']),
- ('\ufba0', &['\u06bb']), ('\ufba1', &['\u06bb']), ('\ufba2', &['\u06bb']), ('\ufba3',
- &['\u06bb']), ('\ufba4', &['\u06c0']), ('\ufba5', &['\u06c0']), ('\ufba6', &['\u06c1']),
- ('\ufba7', &['\u06c1']), ('\ufba8', &['\u06c1']), ('\ufba9', &['\u06c1']), ('\ufbaa',
- &['\u06be']), ('\ufbab', &['\u06be']), ('\ufbac', &['\u06be']), ('\ufbad', &['\u06be']),
- ('\ufbae', &['\u06d2']), ('\ufbaf', &['\u06d2']), ('\ufbb0', &['\u06d3']), ('\ufbb1',
- &['\u06d3']), ('\ufbd3', &['\u06ad']), ('\ufbd4', &['\u06ad']), ('\ufbd5', &['\u06ad']),
- ('\ufbd6', &['\u06ad']), ('\ufbd7', &['\u06c7']), ('\ufbd8', &['\u06c7']), ('\ufbd9',
- &['\u06c6']), ('\ufbda', &['\u06c6']), ('\ufbdb', &['\u06c8']), ('\ufbdc', &['\u06c8']),
- ('\ufbdd', &['\u0677']), ('\ufbde', &['\u06cb']), ('\ufbdf', &['\u06cb']), ('\ufbe0',
- &['\u06c5']), ('\ufbe1', &['\u06c5']), ('\ufbe2', &['\u06c9']), ('\ufbe3', &['\u06c9']),
- ('\ufbe4', &['\u06d0']), ('\ufbe5', &['\u06d0']), ('\ufbe6', &['\u06d0']), ('\ufbe7',
- &['\u06d0']), ('\ufbe8', &['\u0649']), ('\ufbe9', &['\u0649']), ('\ufbea', &['\u0626',
- '\u0627']), ('\ufbeb', &['\u0626', '\u0627']), ('\ufbec', &['\u0626', '\u06d5']), ('\ufbed',
- &['\u0626', '\u06d5']), ('\ufbee', &['\u0626', '\u0648']), ('\ufbef', &['\u0626',
- '\u0648']), ('\ufbf0', &['\u0626', '\u06c7']), ('\ufbf1', &['\u0626', '\u06c7']), ('\ufbf2',
- &['\u0626', '\u06c6']), ('\ufbf3', &['\u0626', '\u06c6']), ('\ufbf4', &['\u0626',
- '\u06c8']), ('\ufbf5', &['\u0626', '\u06c8']), ('\ufbf6', &['\u0626', '\u06d0']), ('\ufbf7',
- &['\u0626', '\u06d0']), ('\ufbf8', &['\u0626', '\u06d0']), ('\ufbf9', &['\u0626',
- '\u0649']), ('\ufbfa', &['\u0626', '\u0649']), ('\ufbfb', &['\u0626', '\u0649']), ('\ufbfc',
- &['\u06cc']), ('\ufbfd', &['\u06cc']), ('\ufbfe', &['\u06cc']), ('\ufbff', &['\u06cc']),
- ('\ufc00', &['\u0626', '\u062c']), ('\ufc01', &['\u0626', '\u062d']), ('\ufc02', &['\u0626',
- '\u0645']), ('\ufc03', &['\u0626', '\u0649']), ('\ufc04', &['\u0626', '\u064a']), ('\ufc05',
- &['\u0628', '\u062c']), ('\ufc06', &['\u0628', '\u062d']), ('\ufc07', &['\u0628',
- '\u062e']), ('\ufc08', &['\u0628', '\u0645']), ('\ufc09', &['\u0628', '\u0649']), ('\ufc0a',
- &['\u0628', '\u064a']), ('\ufc0b', &['\u062a', '\u062c']), ('\ufc0c', &['\u062a',
- '\u062d']), ('\ufc0d', &['\u062a', '\u062e']), ('\ufc0e', &['\u062a', '\u0645']), ('\ufc0f',
- &['\u062a', '\u0649']), ('\ufc10', &['\u062a', '\u064a']), ('\ufc11', &['\u062b',
- '\u062c']), ('\ufc12', &['\u062b', '\u0645']), ('\ufc13', &['\u062b', '\u0649']), ('\ufc14',
- &['\u062b', '\u064a']), ('\ufc15', &['\u062c', '\u062d']), ('\ufc16', &['\u062c',
- '\u0645']), ('\ufc17', &['\u062d', '\u062c']), ('\ufc18', &['\u062d', '\u0645']), ('\ufc19',
- &['\u062e', '\u062c']), ('\ufc1a', &['\u062e', '\u062d']), ('\ufc1b', &['\u062e',
- '\u0645']), ('\ufc1c', &['\u0633', '\u062c']), ('\ufc1d', &['\u0633', '\u062d']), ('\ufc1e',
- &['\u0633', '\u062e']), ('\ufc1f', &['\u0633', '\u0645']), ('\ufc20', &['\u0635',
- '\u062d']), ('\ufc21', &['\u0635', '\u0645']), ('\ufc22', &['\u0636', '\u062c']), ('\ufc23',
- &['\u0636', '\u062d']), ('\ufc24', &['\u0636', '\u062e']), ('\ufc25', &['\u0636',
- '\u0645']), ('\ufc26', &['\u0637', '\u062d']), ('\ufc27', &['\u0637', '\u0645']), ('\ufc28',
- &['\u0638', '\u0645']), ('\ufc29', &['\u0639', '\u062c']), ('\ufc2a', &['\u0639',
- '\u0645']), ('\ufc2b', &['\u063a', '\u062c']), ('\ufc2c', &['\u063a', '\u0645']), ('\ufc2d',
- &['\u0641', '\u062c']), ('\ufc2e', &['\u0641', '\u062d']), ('\ufc2f', &['\u0641',
- '\u062e']), ('\ufc30', &['\u0641', '\u0645']), ('\ufc31', &['\u0641', '\u0649']), ('\ufc32',
- &['\u0641', '\u064a']), ('\ufc33', &['\u0642', '\u062d']), ('\ufc34', &['\u0642',
- '\u0645']), ('\ufc35', &['\u0642', '\u0649']), ('\ufc36', &['\u0642', '\u064a']), ('\ufc37',
- &['\u0643', '\u0627']), ('\ufc38', &['\u0643', '\u062c']), ('\ufc39', &['\u0643',
- '\u062d']), ('\ufc3a', &['\u0643', '\u062e']), ('\ufc3b', &['\u0643', '\u0644']), ('\ufc3c',
- &['\u0643', '\u0645']), ('\ufc3d', &['\u0643', '\u0649']), ('\ufc3e', &['\u0643',
- '\u064a']), ('\ufc3f', &['\u0644', '\u062c']), ('\ufc40', &['\u0644', '\u062d']), ('\ufc41',
- &['\u0644', '\u062e']), ('\ufc42', &['\u0644', '\u0645']), ('\ufc43', &['\u0644',
- '\u0649']), ('\ufc44', &['\u0644', '\u064a']), ('\ufc45', &['\u0645', '\u062c']), ('\ufc46',
- &['\u0645', '\u062d']), ('\ufc47', &['\u0645', '\u062e']), ('\ufc48', &['\u0645',
- '\u0645']), ('\ufc49', &['\u0645', '\u0649']), ('\ufc4a', &['\u0645', '\u064a']), ('\ufc4b',
- &['\u0646', '\u062c']), ('\ufc4c', &['\u0646', '\u062d']), ('\ufc4d', &['\u0646',
- '\u062e']), ('\ufc4e', &['\u0646', '\u0645']), ('\ufc4f', &['\u0646', '\u0649']), ('\ufc50',
- &['\u0646', '\u064a']), ('\ufc51', &['\u0647', '\u062c']), ('\ufc52', &['\u0647',
- '\u0645']), ('\ufc53', &['\u0647', '\u0649']), ('\ufc54', &['\u0647', '\u064a']), ('\ufc55',
- &['\u064a', '\u062c']), ('\ufc56', &['\u064a', '\u062d']), ('\ufc57', &['\u064a',
- '\u062e']), ('\ufc58', &['\u064a', '\u0645']), ('\ufc59', &['\u064a', '\u0649']), ('\ufc5a',
- &['\u064a', '\u064a']), ('\ufc5b', &['\u0630', '\u0670']), ('\ufc5c', &['\u0631',
- '\u0670']), ('\ufc5d', &['\u0649', '\u0670']), ('\ufc5e', &['\x20', '\u064c', '\u0651']),
- ('\ufc5f', &['\x20', '\u064d', '\u0651']), ('\ufc60', &['\x20', '\u064e', '\u0651']),
- ('\ufc61', &['\x20', '\u064f', '\u0651']), ('\ufc62', &['\x20', '\u0650', '\u0651']),
- ('\ufc63', &['\x20', '\u0651', '\u0670']), ('\ufc64', &['\u0626', '\u0631']), ('\ufc65',
- &['\u0626', '\u0632']), ('\ufc66', &['\u0626', '\u0645']), ('\ufc67', &['\u0626',
- '\u0646']), ('\ufc68', &['\u0626', '\u0649']), ('\ufc69', &['\u0626', '\u064a']), ('\ufc6a',
- &['\u0628', '\u0631']), ('\ufc6b', &['\u0628', '\u0632']), ('\ufc6c', &['\u0628',
- '\u0645']), ('\ufc6d', &['\u0628', '\u0646']), ('\ufc6e', &['\u0628', '\u0649']), ('\ufc6f',
- &['\u0628', '\u064a']), ('\ufc70', &['\u062a', '\u0631']), ('\ufc71', &['\u062a',
- '\u0632']), ('\ufc72', &['\u062a', '\u0645']), ('\ufc73', &['\u062a', '\u0646']), ('\ufc74',
- &['\u062a', '\u0649']), ('\ufc75', &['\u062a', '\u064a']), ('\ufc76', &['\u062b',
- '\u0631']), ('\ufc77', &['\u062b', '\u0632']), ('\ufc78', &['\u062b', '\u0645']), ('\ufc79',
- &['\u062b', '\u0646']), ('\ufc7a', &['\u062b', '\u0649']), ('\ufc7b', &['\u062b',
- '\u064a']), ('\ufc7c', &['\u0641', '\u0649']), ('\ufc7d', &['\u0641', '\u064a']), ('\ufc7e',
- &['\u0642', '\u0649']), ('\ufc7f', &['\u0642', '\u064a']), ('\ufc80', &['\u0643',
- '\u0627']), ('\ufc81', &['\u0643', '\u0644']), ('\ufc82', &['\u0643', '\u0645']), ('\ufc83',
- &['\u0643', '\u0649']), ('\ufc84', &['\u0643', '\u064a']), ('\ufc85', &['\u0644',
- '\u0645']), ('\ufc86', &['\u0644', '\u0649']), ('\ufc87', &['\u0644', '\u064a']), ('\ufc88',
- &['\u0645', '\u0627']), ('\ufc89', &['\u0645', '\u0645']), ('\ufc8a', &['\u0646',
- '\u0631']), ('\ufc8b', &['\u0646', '\u0632']), ('\ufc8c', &['\u0646', '\u0645']), ('\ufc8d',
- &['\u0646', '\u0646']), ('\ufc8e', &['\u0646', '\u0649']), ('\ufc8f', &['\u0646',
- '\u064a']), ('\ufc90', &['\u0649', '\u0670']), ('\ufc91', &['\u064a', '\u0631']), ('\ufc92',
- &['\u064a', '\u0632']), ('\ufc93', &['\u064a', '\u0645']), ('\ufc94', &['\u064a',
- '\u0646']), ('\ufc95', &['\u064a', '\u0649']), ('\ufc96', &['\u064a', '\u064a']), ('\ufc97',
- &['\u0626', '\u062c']), ('\ufc98', &['\u0626', '\u062d']), ('\ufc99', &['\u0626',
- '\u062e']), ('\ufc9a', &['\u0626', '\u0645']), ('\ufc9b', &['\u0626', '\u0647']), ('\ufc9c',
- &['\u0628', '\u062c']), ('\ufc9d', &['\u0628', '\u062d']), ('\ufc9e', &['\u0628',
- '\u062e']), ('\ufc9f', &['\u0628', '\u0645']), ('\ufca0', &['\u0628', '\u0647']), ('\ufca1',
- &['\u062a', '\u062c']), ('\ufca2', &['\u062a', '\u062d']), ('\ufca3', &['\u062a',
- '\u062e']), ('\ufca4', &['\u062a', '\u0645']), ('\ufca5', &['\u062a', '\u0647']), ('\ufca6',
- &['\u062b', '\u0645']), ('\ufca7', &['\u062c', '\u062d']), ('\ufca8', &['\u062c',
- '\u0645']), ('\ufca9', &['\u062d', '\u062c']), ('\ufcaa', &['\u062d', '\u0645']), ('\ufcab',
- &['\u062e', '\u062c']), ('\ufcac', &['\u062e', '\u0645']), ('\ufcad', &['\u0633',
- '\u062c']), ('\ufcae', &['\u0633', '\u062d']), ('\ufcaf', &['\u0633', '\u062e']), ('\ufcb0',
- &['\u0633', '\u0645']), ('\ufcb1', &['\u0635', '\u062d']), ('\ufcb2', &['\u0635',
- '\u062e']), ('\ufcb3', &['\u0635', '\u0645']), ('\ufcb4', &['\u0636', '\u062c']), ('\ufcb5',
- &['\u0636', '\u062d']), ('\ufcb6', &['\u0636', '\u062e']), ('\ufcb7', &['\u0636',
- '\u0645']), ('\ufcb8', &['\u0637', '\u062d']), ('\ufcb9', &['\u0638', '\u0645']), ('\ufcba',
- &['\u0639', '\u062c']), ('\ufcbb', &['\u0639', '\u0645']), ('\ufcbc', &['\u063a',
- '\u062c']), ('\ufcbd', &['\u063a', '\u0645']), ('\ufcbe', &['\u0641', '\u062c']), ('\ufcbf',
- &['\u0641', '\u062d']), ('\ufcc0', &['\u0641', '\u062e']), ('\ufcc1', &['\u0641',
- '\u0645']), ('\ufcc2', &['\u0642', '\u062d']), ('\ufcc3', &['\u0642', '\u0645']), ('\ufcc4',
- &['\u0643', '\u062c']), ('\ufcc5', &['\u0643', '\u062d']), ('\ufcc6', &['\u0643',
- '\u062e']), ('\ufcc7', &['\u0643', '\u0644']), ('\ufcc8', &['\u0643', '\u0645']), ('\ufcc9',
- &['\u0644', '\u062c']), ('\ufcca', &['\u0644', '\u062d']), ('\ufccb', &['\u0644',
- '\u062e']), ('\ufccc', &['\u0644', '\u0645']), ('\ufccd', &['\u0644', '\u0647']), ('\ufcce',
- &['\u0645', '\u062c']), ('\ufccf', &['\u0645', '\u062d']), ('\ufcd0', &['\u0645',
- '\u062e']), ('\ufcd1', &['\u0645', '\u0645']), ('\ufcd2', &['\u0646', '\u062c']), ('\ufcd3',
- &['\u0646', '\u062d']), ('\ufcd4', &['\u0646', '\u062e']), ('\ufcd5', &['\u0646',
- '\u0645']), ('\ufcd6', &['\u0646', '\u0647']), ('\ufcd7', &['\u0647', '\u062c']), ('\ufcd8',
- &['\u0647', '\u0645']), ('\ufcd9', &['\u0647', '\u0670']), ('\ufcda', &['\u064a',
- '\u062c']), ('\ufcdb', &['\u064a', '\u062d']), ('\ufcdc', &['\u064a', '\u062e']), ('\ufcdd',
- &['\u064a', '\u0645']), ('\ufcde', &['\u064a', '\u0647']), ('\ufcdf', &['\u0626',
- '\u0645']), ('\ufce0', &['\u0626', '\u0647']), ('\ufce1', &['\u0628', '\u0645']), ('\ufce2',
- &['\u0628', '\u0647']), ('\ufce3', &['\u062a', '\u0645']), ('\ufce4', &['\u062a',
- '\u0647']), ('\ufce5', &['\u062b', '\u0645']), ('\ufce6', &['\u062b', '\u0647']), ('\ufce7',
- &['\u0633', '\u0645']), ('\ufce8', &['\u0633', '\u0647']), ('\ufce9', &['\u0634',
- '\u0645']), ('\ufcea', &['\u0634', '\u0647']), ('\ufceb', &['\u0643', '\u0644']), ('\ufcec',
- &['\u0643', '\u0645']), ('\ufced', &['\u0644', '\u0645']), ('\ufcee', &['\u0646',
- '\u0645']), ('\ufcef', &['\u0646', '\u0647']), ('\ufcf0', &['\u064a', '\u0645']), ('\ufcf1',
- &['\u064a', '\u0647']), ('\ufcf2', &['\u0640', '\u064e', '\u0651']), ('\ufcf3', &['\u0640',
- '\u064f', '\u0651']), ('\ufcf4', &['\u0640', '\u0650', '\u0651']), ('\ufcf5', &['\u0637',
- '\u0649']), ('\ufcf6', &['\u0637', '\u064a']), ('\ufcf7', &['\u0639', '\u0649']), ('\ufcf8',
- &['\u0639', '\u064a']), ('\ufcf9', &['\u063a', '\u0649']), ('\ufcfa', &['\u063a',
- '\u064a']), ('\ufcfb', &['\u0633', '\u0649']), ('\ufcfc', &['\u0633', '\u064a']), ('\ufcfd',
- &['\u0634', '\u0649']), ('\ufcfe', &['\u0634', '\u064a']), ('\ufcff', &['\u062d',
- '\u0649']), ('\ufd00', &['\u062d', '\u064a']), ('\ufd01', &['\u062c', '\u0649']), ('\ufd02',
- &['\u062c', '\u064a']), ('\ufd03', &['\u062e', '\u0649']), ('\ufd04', &['\u062e',
- '\u064a']), ('\ufd05', &['\u0635', '\u0649']), ('\ufd06', &['\u0635', '\u064a']), ('\ufd07',
- &['\u0636', '\u0649']), ('\ufd08', &['\u0636', '\u064a']), ('\ufd09', &['\u0634',
- '\u062c']), ('\ufd0a', &['\u0634', '\u062d']), ('\ufd0b', &['\u0634', '\u062e']), ('\ufd0c',
- &['\u0634', '\u0645']), ('\ufd0d', &['\u0634', '\u0631']), ('\ufd0e', &['\u0633',
- '\u0631']), ('\ufd0f', &['\u0635', '\u0631']), ('\ufd10', &['\u0636', '\u0631']), ('\ufd11',
- &['\u0637', '\u0649']), ('\ufd12', &['\u0637', '\u064a']), ('\ufd13', &['\u0639',
- '\u0649']), ('\ufd14', &['\u0639', '\u064a']), ('\ufd15', &['\u063a', '\u0649']), ('\ufd16',
- &['\u063a', '\u064a']), ('\ufd17', &['\u0633', '\u0649']), ('\ufd18', &['\u0633',
- '\u064a']), ('\ufd19', &['\u0634', '\u0649']), ('\ufd1a', &['\u0634', '\u064a']), ('\ufd1b',
- &['\u062d', '\u0649']), ('\ufd1c', &['\u062d', '\u064a']), ('\ufd1d', &['\u062c',
- '\u0649']), ('\ufd1e', &['\u062c', '\u064a']), ('\ufd1f', &['\u062e', '\u0649']), ('\ufd20',
- &['\u062e', '\u064a']), ('\ufd21', &['\u0635', '\u0649']), ('\ufd22', &['\u0635',
- '\u064a']), ('\ufd23', &['\u0636', '\u0649']), ('\ufd24', &['\u0636', '\u064a']), ('\ufd25',
- &['\u0634', '\u062c']), ('\ufd26', &['\u0634', '\u062d']), ('\ufd27', &['\u0634',
- '\u062e']), ('\ufd28', &['\u0634', '\u0645']), ('\ufd29', &['\u0634', '\u0631']), ('\ufd2a',
- &['\u0633', '\u0631']), ('\ufd2b', &['\u0635', '\u0631']), ('\ufd2c', &['\u0636',
- '\u0631']), ('\ufd2d', &['\u0634', '\u062c']), ('\ufd2e', &['\u0634', '\u062d']), ('\ufd2f',
- &['\u0634', '\u062e']), ('\ufd30', &['\u0634', '\u0645']), ('\ufd31', &['\u0633',
- '\u0647']), ('\ufd32', &['\u0634', '\u0647']), ('\ufd33', &['\u0637', '\u0645']), ('\ufd34',
- &['\u0633', '\u062c']), ('\ufd35', &['\u0633', '\u062d']), ('\ufd36', &['\u0633',
- '\u062e']), ('\ufd37', &['\u0634', '\u062c']), ('\ufd38', &['\u0634', '\u062d']), ('\ufd39',
- &['\u0634', '\u062e']), ('\ufd3a', &['\u0637', '\u0645']), ('\ufd3b', &['\u0638',
- '\u0645']), ('\ufd3c', &['\u0627', '\u064b']), ('\ufd3d', &['\u0627', '\u064b']), ('\ufd50',
- &['\u062a', '\u062c', '\u0645']), ('\ufd51', &['\u062a', '\u062d', '\u062c']), ('\ufd52',
- &['\u062a', '\u062d', '\u062c']), ('\ufd53', &['\u062a', '\u062d', '\u0645']), ('\ufd54',
- &['\u062a', '\u062e', '\u0645']), ('\ufd55', &['\u062a', '\u0645', '\u062c']), ('\ufd56',
- &['\u062a', '\u0645', '\u062d']), ('\ufd57', &['\u062a', '\u0645', '\u062e']), ('\ufd58',
- &['\u062c', '\u0645', '\u062d']), ('\ufd59', &['\u062c', '\u0645', '\u062d']), ('\ufd5a',
- &['\u062d', '\u0645', '\u064a']), ('\ufd5b', &['\u062d', '\u0645', '\u0649']), ('\ufd5c',
- &['\u0633', '\u062d', '\u062c']), ('\ufd5d', &['\u0633', '\u062c', '\u062d']), ('\ufd5e',
- &['\u0633', '\u062c', '\u0649']), ('\ufd5f', &['\u0633', '\u0645', '\u062d']), ('\ufd60',
- &['\u0633', '\u0645', '\u062d']), ('\ufd61', &['\u0633', '\u0645', '\u062c']), ('\ufd62',
- &['\u0633', '\u0645', '\u0645']), ('\ufd63', &['\u0633', '\u0645', '\u0645']), ('\ufd64',
- &['\u0635', '\u062d', '\u062d']), ('\ufd65', &['\u0635', '\u062d', '\u062d']), ('\ufd66',
- &['\u0635', '\u0645', '\u0645']), ('\ufd67', &['\u0634', '\u062d', '\u0645']), ('\ufd68',
- &['\u0634', '\u062d', '\u0645']), ('\ufd69', &['\u0634', '\u062c', '\u064a']), ('\ufd6a',
- &['\u0634', '\u0645', '\u062e']), ('\ufd6b', &['\u0634', '\u0645', '\u062e']), ('\ufd6c',
- &['\u0634', '\u0645', '\u0645']), ('\ufd6d', &['\u0634', '\u0645', '\u0645']), ('\ufd6e',
- &['\u0636', '\u062d', '\u0649']), ('\ufd6f', &['\u0636', '\u062e', '\u0645']), ('\ufd70',
- &['\u0636', '\u062e', '\u0645']), ('\ufd71', &['\u0637', '\u0645', '\u062d']), ('\ufd72',
- &['\u0637', '\u0645', '\u062d']), ('\ufd73', &['\u0637', '\u0645', '\u0645']), ('\ufd74',
- &['\u0637', '\u0645', '\u064a']), ('\ufd75', &['\u0639', '\u062c', '\u0645']), ('\ufd76',
- &['\u0639', '\u0645', '\u0645']), ('\ufd77', &['\u0639', '\u0645', '\u0645']), ('\ufd78',
- &['\u0639', '\u0645', '\u0649']), ('\ufd79', &['\u063a', '\u0645', '\u0645']), ('\ufd7a',
- &['\u063a', '\u0645', '\u064a']), ('\ufd7b', &['\u063a', '\u0645', '\u0649']), ('\ufd7c',
- &['\u0641', '\u062e', '\u0645']), ('\ufd7d', &['\u0641', '\u062e', '\u0645']), ('\ufd7e',
- &['\u0642', '\u0645', '\u062d']), ('\ufd7f', &['\u0642', '\u0645', '\u0645']), ('\ufd80',
- &['\u0644', '\u062d', '\u0645']), ('\ufd81', &['\u0644', '\u062d', '\u064a']), ('\ufd82',
- &['\u0644', '\u062d', '\u0649']), ('\ufd83', &['\u0644', '\u062c', '\u062c']), ('\ufd84',
- &['\u0644', '\u062c', '\u062c']), ('\ufd85', &['\u0644', '\u062e', '\u0645']), ('\ufd86',
- &['\u0644', '\u062e', '\u0645']), ('\ufd87', &['\u0644', '\u0645', '\u062d']), ('\ufd88',
- &['\u0644', '\u0645', '\u062d']), ('\ufd89', &['\u0645', '\u062d', '\u062c']), ('\ufd8a',
- &['\u0645', '\u062d', '\u0645']), ('\ufd8b', &['\u0645', '\u062d', '\u064a']), ('\ufd8c',
- &['\u0645', '\u062c', '\u062d']), ('\ufd8d', &['\u0645', '\u062c', '\u0645']), ('\ufd8e',
- &['\u0645', '\u062e', '\u062c']), ('\ufd8f', &['\u0645', '\u062e', '\u0645']), ('\ufd92',
- &['\u0645', '\u062c', '\u062e']), ('\ufd93', &['\u0647', '\u0645', '\u062c']), ('\ufd94',
- &['\u0647', '\u0645', '\u0645']), ('\ufd95', &['\u0646', '\u062d', '\u0645']), ('\ufd96',
- &['\u0646', '\u062d', '\u0649']), ('\ufd97', &['\u0646', '\u062c', '\u0645']), ('\ufd98',
- &['\u0646', '\u062c', '\u0645']), ('\ufd99', &['\u0646', '\u062c', '\u0649']), ('\ufd9a',
- &['\u0646', '\u0645', '\u064a']), ('\ufd9b', &['\u0646', '\u0645', '\u0649']), ('\ufd9c',
- &['\u064a', '\u0645', '\u0645']), ('\ufd9d', &['\u064a', '\u0645', '\u0645']), ('\ufd9e',
- &['\u0628', '\u062e', '\u064a']), ('\ufd9f', &['\u062a', '\u062c', '\u064a']), ('\ufda0',
- &['\u062a', '\u062c', '\u0649']), ('\ufda1', &['\u062a', '\u062e', '\u064a']), ('\ufda2',
- &['\u062a', '\u062e', '\u0649']), ('\ufda3', &['\u062a', '\u0645', '\u064a']), ('\ufda4',
- &['\u062a', '\u0645', '\u0649']), ('\ufda5', &['\u062c', '\u0645', '\u064a']), ('\ufda6',
- &['\u062c', '\u062d', '\u0649']), ('\ufda7', &['\u062c', '\u0645', '\u0649']), ('\ufda8',
- &['\u0633', '\u062e', '\u0649']), ('\ufda9', &['\u0635', '\u062d', '\u064a']), ('\ufdaa',
- &['\u0634', '\u062d', '\u064a']), ('\ufdab', &['\u0636', '\u062d', '\u064a']), ('\ufdac',
- &['\u0644', '\u062c', '\u064a']), ('\ufdad', &['\u0644', '\u0645', '\u064a']), ('\ufdae',
- &['\u064a', '\u062d', '\u064a']), ('\ufdaf', &['\u064a', '\u062c', '\u064a']), ('\ufdb0',
- &['\u064a', '\u0645', '\u064a']), ('\ufdb1', &['\u0645', '\u0645', '\u064a']), ('\ufdb2',
- &['\u0642', '\u0645', '\u064a']), ('\ufdb3', &['\u0646', '\u062d', '\u064a']), ('\ufdb4',
- &['\u0642', '\u0645', '\u062d']), ('\ufdb5', &['\u0644', '\u062d', '\u0645']), ('\ufdb6',
- &['\u0639', '\u0645', '\u064a']), ('\ufdb7', &['\u0643', '\u0645', '\u064a']), ('\ufdb8',
- &['\u0646', '\u062c', '\u062d']), ('\ufdb9', &['\u0645', '\u062e', '\u064a']), ('\ufdba',
- &['\u0644', '\u062c', '\u0645']), ('\ufdbb', &['\u0643', '\u0645', '\u0645']), ('\ufdbc',
- &['\u0644', '\u062c', '\u0645']), ('\ufdbd', &['\u0646', '\u062c', '\u062d']), ('\ufdbe',
- &['\u062c', '\u062d', '\u064a']), ('\ufdbf', &['\u062d', '\u062c', '\u064a']), ('\ufdc0',
- &['\u0645', '\u062c', '\u064a']), ('\ufdc1', &['\u0641', '\u0645', '\u064a']), ('\ufdc2',
- &['\u0628', '\u062d', '\u064a']), ('\ufdc3', &['\u0643', '\u0645', '\u0645']), ('\ufdc4',
- &['\u0639', '\u062c', '\u0645']), ('\ufdc5', &['\u0635', '\u0645', '\u0645']), ('\ufdc6',
- &['\u0633', '\u062e', '\u064a']), ('\ufdc7', &['\u0646', '\u062c', '\u064a']), ('\ufdf0',
- &['\u0635', '\u0644', '\u06d2']), ('\ufdf1', &['\u0642', '\u0644', '\u06d2']), ('\ufdf2',
- &['\u0627', '\u0644', '\u0644', '\u0647']), ('\ufdf3', &['\u0627', '\u0643', '\u0628',
- '\u0631']), ('\ufdf4', &['\u0645', '\u062d', '\u0645', '\u062f']), ('\ufdf5', &['\u0635',
- '\u0644', '\u0639', '\u0645']), ('\ufdf6', &['\u0631', '\u0633', '\u0648', '\u0644']),
- ('\ufdf7', &['\u0639', '\u0644', '\u064a', '\u0647']), ('\ufdf8', &['\u0648', '\u0633',
- '\u0644', '\u0645']), ('\ufdf9', &['\u0635', '\u0644', '\u0649']), ('\ufdfa', &['\u0635',
- '\u0644', '\u0649', '\x20', '\u0627', '\u0644', '\u0644', '\u0647', '\x20', '\u0639',
- '\u0644', '\u064a', '\u0647', '\x20', '\u0648', '\u0633', '\u0644', '\u0645']), ('\ufdfb',
- &['\u062c', '\u0644', '\x20', '\u062c', '\u0644', '\u0627', '\u0644', '\u0647']), ('\ufdfc',
- &['\u0631', '\u06cc', '\u0627', '\u0644']), ('\ufe10', &['\x2c']), ('\ufe11', &['\u3001']),
- ('\ufe12', &['\u3002']), ('\ufe13', &['\x3a']), ('\ufe14', &['\x3b']), ('\ufe15',
- &['\x21']), ('\ufe16', &['\x3f']), ('\ufe17', &['\u3016']), ('\ufe18', &['\u3017']),
- ('\ufe19', &['\u2026']), ('\ufe30', &['\u2025']), ('\ufe31', &['\u2014']), ('\ufe32',
- &['\u2013']), ('\ufe33', &['\x5f']), ('\ufe34', &['\x5f']), ('\ufe35', &['\x28']),
- ('\ufe36', &['\x29']), ('\ufe37', &['\x7b']), ('\ufe38', &['\x7d']), ('\ufe39',
- &['\u3014']), ('\ufe3a', &['\u3015']), ('\ufe3b', &['\u3010']), ('\ufe3c', &['\u3011']),
- ('\ufe3d', &['\u300a']), ('\ufe3e', &['\u300b']), ('\ufe3f', &['\u3008']), ('\ufe40',
- &['\u3009']), ('\ufe41', &['\u300c']), ('\ufe42', &['\u300d']), ('\ufe43', &['\u300e']),
- ('\ufe44', &['\u300f']), ('\ufe47', &['\x5b']), ('\ufe48', &['\x5d']), ('\ufe49',
- &['\u203e']), ('\ufe4a', &['\u203e']), ('\ufe4b', &['\u203e']), ('\ufe4c', &['\u203e']),
- ('\ufe4d', &['\x5f']), ('\ufe4e', &['\x5f']), ('\ufe4f', &['\x5f']), ('\ufe50', &['\x2c']),
- ('\ufe51', &['\u3001']), ('\ufe52', &['\x2e']), ('\ufe54', &['\x3b']), ('\ufe55',
- &['\x3a']), ('\ufe56', &['\x3f']), ('\ufe57', &['\x21']), ('\ufe58', &['\u2014']),
- ('\ufe59', &['\x28']), ('\ufe5a', &['\x29']), ('\ufe5b', &['\x7b']), ('\ufe5c', &['\x7d']),
- ('\ufe5d', &['\u3014']), ('\ufe5e', &['\u3015']), ('\ufe5f', &['\x23']), ('\ufe60',
- &['\x26']), ('\ufe61', &['\x2a']), ('\ufe62', &['\x2b']), ('\ufe63', &['\x2d']), ('\ufe64',
- &['\x3c']), ('\ufe65', &['\x3e']), ('\ufe66', &['\x3d']), ('\ufe68', &['\x5c']), ('\ufe69',
- &['\x24']), ('\ufe6a', &['\x25']), ('\ufe6b', &['\x40']), ('\ufe70', &['\x20', '\u064b']),
- ('\ufe71', &['\u0640', '\u064b']), ('\ufe72', &['\x20', '\u064c']), ('\ufe74', &['\x20',
- '\u064d']), ('\ufe76', &['\x20', '\u064e']), ('\ufe77', &['\u0640', '\u064e']), ('\ufe78',
- &['\x20', '\u064f']), ('\ufe79', &['\u0640', '\u064f']), ('\ufe7a', &['\x20', '\u0650']),
- ('\ufe7b', &['\u0640', '\u0650']), ('\ufe7c', &['\x20', '\u0651']), ('\ufe7d', &['\u0640',
- '\u0651']), ('\ufe7e', &['\x20', '\u0652']), ('\ufe7f', &['\u0640', '\u0652']), ('\ufe80',
- &['\u0621']), ('\ufe81', &['\u0622']), ('\ufe82', &['\u0622']), ('\ufe83', &['\u0623']),
- ('\ufe84', &['\u0623']), ('\ufe85', &['\u0624']), ('\ufe86', &['\u0624']), ('\ufe87',
- &['\u0625']), ('\ufe88', &['\u0625']), ('\ufe89', &['\u0626']), ('\ufe8a', &['\u0626']),
- ('\ufe8b', &['\u0626']), ('\ufe8c', &['\u0626']), ('\ufe8d', &['\u0627']), ('\ufe8e',
- &['\u0627']), ('\ufe8f', &['\u0628']), ('\ufe90', &['\u0628']), ('\ufe91', &['\u0628']),
- ('\ufe92', &['\u0628']), ('\ufe93', &['\u0629']), ('\ufe94', &['\u0629']), ('\ufe95',
- &['\u062a']), ('\ufe96', &['\u062a']), ('\ufe97', &['\u062a']), ('\ufe98', &['\u062a']),
- ('\ufe99', &['\u062b']), ('\ufe9a', &['\u062b']), ('\ufe9b', &['\u062b']), ('\ufe9c',
- &['\u062b']), ('\ufe9d', &['\u062c']), ('\ufe9e', &['\u062c']), ('\ufe9f', &['\u062c']),
- ('\ufea0', &['\u062c']), ('\ufea1', &['\u062d']), ('\ufea2', &['\u062d']), ('\ufea3',
- &['\u062d']), ('\ufea4', &['\u062d']), ('\ufea5', &['\u062e']), ('\ufea6', &['\u062e']),
- ('\ufea7', &['\u062e']), ('\ufea8', &['\u062e']), ('\ufea9', &['\u062f']), ('\ufeaa',
- &['\u062f']), ('\ufeab', &['\u0630']), ('\ufeac', &['\u0630']), ('\ufead', &['\u0631']),
- ('\ufeae', &['\u0631']), ('\ufeaf', &['\u0632']), ('\ufeb0', &['\u0632']), ('\ufeb1',
- &['\u0633']), ('\ufeb2', &['\u0633']), ('\ufeb3', &['\u0633']), ('\ufeb4', &['\u0633']),
- ('\ufeb5', &['\u0634']), ('\ufeb6', &['\u0634']), ('\ufeb7', &['\u0634']), ('\ufeb8',
- &['\u0634']), ('\ufeb9', &['\u0635']), ('\ufeba', &['\u0635']), ('\ufebb', &['\u0635']),
- ('\ufebc', &['\u0635']), ('\ufebd', &['\u0636']), ('\ufebe', &['\u0636']), ('\ufebf',
- &['\u0636']), ('\ufec0', &['\u0636']), ('\ufec1', &['\u0637']), ('\ufec2', &['\u0637']),
- ('\ufec3', &['\u0637']), ('\ufec4', &['\u0637']), ('\ufec5', &['\u0638']), ('\ufec6',
- &['\u0638']), ('\ufec7', &['\u0638']), ('\ufec8', &['\u0638']), ('\ufec9', &['\u0639']),
- ('\ufeca', &['\u0639']), ('\ufecb', &['\u0639']), ('\ufecc', &['\u0639']), ('\ufecd',
- &['\u063a']), ('\ufece', &['\u063a']), ('\ufecf', &['\u063a']), ('\ufed0', &['\u063a']),
- ('\ufed1', &['\u0641']), ('\ufed2', &['\u0641']), ('\ufed3', &['\u0641']), ('\ufed4',
- &['\u0641']), ('\ufed5', &['\u0642']), ('\ufed6', &['\u0642']), ('\ufed7', &['\u0642']),
- ('\ufed8', &['\u0642']), ('\ufed9', &['\u0643']), ('\ufeda', &['\u0643']), ('\ufedb',
- &['\u0643']), ('\ufedc', &['\u0643']), ('\ufedd', &['\u0644']), ('\ufede', &['\u0644']),
- ('\ufedf', &['\u0644']), ('\ufee0', &['\u0644']), ('\ufee1', &['\u0645']), ('\ufee2',
- &['\u0645']), ('\ufee3', &['\u0645']), ('\ufee4', &['\u0645']), ('\ufee5', &['\u0646']),
- ('\ufee6', &['\u0646']), ('\ufee7', &['\u0646']), ('\ufee8', &['\u0646']), ('\ufee9',
- &['\u0647']), ('\ufeea', &['\u0647']), ('\ufeeb', &['\u0647']), ('\ufeec', &['\u0647']),
- ('\ufeed', &['\u0648']), ('\ufeee', &['\u0648']), ('\ufeef', &['\u0649']), ('\ufef0',
- &['\u0649']), ('\ufef1', &['\u064a']), ('\ufef2', &['\u064a']), ('\ufef3', &['\u064a']),
- ('\ufef4', &['\u064a']), ('\ufef5', &['\u0644', '\u0622']), ('\ufef6', &['\u0644',
- '\u0622']), ('\ufef7', &['\u0644', '\u0623']), ('\ufef8', &['\u0644', '\u0623']), ('\ufef9',
- &['\u0644', '\u0625']), ('\ufefa', &['\u0644', '\u0625']), ('\ufefb', &['\u0644',
- '\u0627']), ('\ufefc', &['\u0644', '\u0627']), ('\uff01', &['\x21']), ('\uff02', &['\x22']),
- ('\uff03', &['\x23']), ('\uff04', &['\x24']), ('\uff05', &['\x25']), ('\uff06', &['\x26']),
- ('\uff07', &['\x27']), ('\uff08', &['\x28']), ('\uff09', &['\x29']), ('\uff0a', &['\x2a']),
- ('\uff0b', &['\x2b']), ('\uff0c', &['\x2c']), ('\uff0d', &['\x2d']), ('\uff0e', &['\x2e']),
- ('\uff0f', &['\x2f']), ('\uff10', &['\x30']), ('\uff11', &['\x31']), ('\uff12', &['\x32']),
- ('\uff13', &['\x33']), ('\uff14', &['\x34']), ('\uff15', &['\x35']), ('\uff16', &['\x36']),
- ('\uff17', &['\x37']), ('\uff18', &['\x38']), ('\uff19', &['\x39']), ('\uff1a', &['\x3a']),
- ('\uff1b', &['\x3b']), ('\uff1c', &['\x3c']), ('\uff1d', &['\x3d']), ('\uff1e', &['\x3e']),
- ('\uff1f', &['\x3f']), ('\uff20', &['\x40']), ('\uff21', &['\x41']), ('\uff22', &['\x42']),
- ('\uff23', &['\x43']), ('\uff24', &['\x44']), ('\uff25', &['\x45']), ('\uff26', &['\x46']),
- ('\uff27', &['\x47']), ('\uff28', &['\x48']), ('\uff29', &['\x49']), ('\uff2a', &['\x4a']),
- ('\uff2b', &['\x4b']), ('\uff2c', &['\x4c']), ('\uff2d', &['\x4d']), ('\uff2e', &['\x4e']),
- ('\uff2f', &['\x4f']), ('\uff30', &['\x50']), ('\uff31', &['\x51']), ('\uff32', &['\x52']),
- ('\uff33', &['\x53']), ('\uff34', &['\x54']), ('\uff35', &['\x55']), ('\uff36', &['\x56']),
- ('\uff37', &['\x57']), ('\uff38', &['\x58']), ('\uff39', &['\x59']), ('\uff3a', &['\x5a']),
- ('\uff3b', &['\x5b']), ('\uff3c', &['\x5c']), ('\uff3d', &['\x5d']), ('\uff3e', &['\x5e']),
- ('\uff3f', &['\x5f']), ('\uff40', &['\x60']), ('\uff41', &['\x61']), ('\uff42', &['\x62']),
- ('\uff43', &['\x63']), ('\uff44', &['\x64']), ('\uff45', &['\x65']), ('\uff46', &['\x66']),
- ('\uff47', &['\x67']), ('\uff48', &['\x68']), ('\uff49', &['\x69']), ('\uff4a', &['\x6a']),
- ('\uff4b', &['\x6b']), ('\uff4c', &['\x6c']), ('\uff4d', &['\x6d']), ('\uff4e', &['\x6e']),
- ('\uff4f', &['\x6f']), ('\uff50', &['\x70']), ('\uff51', &['\x71']), ('\uff52', &['\x72']),
- ('\uff53', &['\x73']), ('\uff54', &['\x74']), ('\uff55', &['\x75']), ('\uff56', &['\x76']),
- ('\uff57', &['\x77']), ('\uff58', &['\x78']), ('\uff59', &['\x79']), ('\uff5a', &['\x7a']),
- ('\uff5b', &['\x7b']), ('\uff5c', &['\x7c']), ('\uff5d', &['\x7d']), ('\uff5e', &['\x7e']),
- ('\uff5f', &['\u2985']), ('\uff60', &['\u2986']), ('\uff61', &['\u3002']), ('\uff62',
- &['\u300c']), ('\uff63', &['\u300d']), ('\uff64', &['\u3001']), ('\uff65', &['\u30fb']),
- ('\uff66', &['\u30f2']), ('\uff67', &['\u30a1']), ('\uff68', &['\u30a3']), ('\uff69',
- &['\u30a5']), ('\uff6a', &['\u30a7']), ('\uff6b', &['\u30a9']), ('\uff6c', &['\u30e3']),
- ('\uff6d', &['\u30e5']), ('\uff6e', &['\u30e7']), ('\uff6f', &['\u30c3']), ('\uff70',
- &['\u30fc']), ('\uff71', &['\u30a2']), ('\uff72', &['\u30a4']), ('\uff73', &['\u30a6']),
- ('\uff74', &['\u30a8']), ('\uff75', &['\u30aa']), ('\uff76', &['\u30ab']), ('\uff77',
- &['\u30ad']), ('\uff78', &['\u30af']), ('\uff79', &['\u30b1']), ('\uff7a', &['\u30b3']),
- ('\uff7b', &['\u30b5']), ('\uff7c', &['\u30b7']), ('\uff7d', &['\u30b9']), ('\uff7e',
- &['\u30bb']), ('\uff7f', &['\u30bd']), ('\uff80', &['\u30bf']), ('\uff81', &['\u30c1']),
- ('\uff82', &['\u30c4']), ('\uff83', &['\u30c6']), ('\uff84', &['\u30c8']), ('\uff85',
- &['\u30ca']), ('\uff86', &['\u30cb']), ('\uff87', &['\u30cc']), ('\uff88', &['\u30cd']),
- ('\uff89', &['\u30ce']), ('\uff8a', &['\u30cf']), ('\uff8b', &['\u30d2']), ('\uff8c',
- &['\u30d5']), ('\uff8d', &['\u30d8']), ('\uff8e', &['\u30db']), ('\uff8f', &['\u30de']),
- ('\uff90', &['\u30df']), ('\uff91', &['\u30e0']), ('\uff92', &['\u30e1']), ('\uff93',
- &['\u30e2']), ('\uff94', &['\u30e4']), ('\uff95', &['\u30e6']), ('\uff96', &['\u30e8']),
- ('\uff97', &['\u30e9']), ('\uff98', &['\u30ea']), ('\uff99', &['\u30eb']), ('\uff9a',
- &['\u30ec']), ('\uff9b', &['\u30ed']), ('\uff9c', &['\u30ef']), ('\uff9d', &['\u30f3']),
- ('\uff9e', &['\u3099']), ('\uff9f', &['\u309a']), ('\uffa0', &['\u3164']), ('\uffa1',
- &['\u3131']), ('\uffa2', &['\u3132']), ('\uffa3', &['\u3133']), ('\uffa4', &['\u3134']),
- ('\uffa5', &['\u3135']), ('\uffa6', &['\u3136']), ('\uffa7', &['\u3137']), ('\uffa8',
- &['\u3138']), ('\uffa9', &['\u3139']), ('\uffaa', &['\u313a']), ('\uffab', &['\u313b']),
- ('\uffac', &['\u313c']), ('\uffad', &['\u313d']), ('\uffae', &['\u313e']), ('\uffaf',
- &['\u313f']), ('\uffb0', &['\u3140']), ('\uffb1', &['\u3141']), ('\uffb2', &['\u3142']),
- ('\uffb3', &['\u3143']), ('\uffb4', &['\u3144']), ('\uffb5', &['\u3145']), ('\uffb6',
- &['\u3146']), ('\uffb7', &['\u3147']), ('\uffb8', &['\u3148']), ('\uffb9', &['\u3149']),
- ('\uffba', &['\u314a']), ('\uffbb', &['\u314b']), ('\uffbc', &['\u314c']), ('\uffbd',
- &['\u314d']), ('\uffbe', &['\u314e']), ('\uffc2', &['\u314f']), ('\uffc3', &['\u3150']),
- ('\uffc4', &['\u3151']), ('\uffc5', &['\u3152']), ('\uffc6', &['\u3153']), ('\uffc7',
- &['\u3154']), ('\uffca', &['\u3155']), ('\uffcb', &['\u3156']), ('\uffcc', &['\u3157']),
- ('\uffcd', &['\u3158']), ('\uffce', &['\u3159']), ('\uffcf', &['\u315a']), ('\uffd2',
- &['\u315b']), ('\uffd3', &['\u315c']), ('\uffd4', &['\u315d']), ('\uffd5', &['\u315e']),
- ('\uffd6', &['\u315f']), ('\uffd7', &['\u3160']), ('\uffda', &['\u3161']), ('\uffdb',
- &['\u3162']), ('\uffdc', &['\u3163']), ('\uffe0', &['\xa2']), ('\uffe1', &['\xa3']),
- ('\uffe2', &['\xac']), ('\uffe3', &['\xaf']), ('\uffe4', &['\xa6']), ('\uffe5', &['\xa5']),
- ('\uffe6', &['\u20a9']), ('\uffe8', &['\u2502']), ('\uffe9', &['\u2190']), ('\uffea',
- &['\u2191']), ('\uffeb', &['\u2192']), ('\uffec', &['\u2193']), ('\uffed', &['\u25a0']),
- ('\uffee', &['\u25cb']), ('\U0001d400', &['\x41']), ('\U0001d401', &['\x42']),
- ('\U0001d402', &['\x43']), ('\U0001d403', &['\x44']), ('\U0001d404', &['\x45']),
- ('\U0001d405', &['\x46']), ('\U0001d406', &['\x47']), ('\U0001d407', &['\x48']),
- ('\U0001d408', &['\x49']), ('\U0001d409', &['\x4a']), ('\U0001d40a', &['\x4b']),
- ('\U0001d40b', &['\x4c']), ('\U0001d40c', &['\x4d']), ('\U0001d40d', &['\x4e']),
- ('\U0001d40e', &['\x4f']), ('\U0001d40f', &['\x50']), ('\U0001d410', &['\x51']),
- ('\U0001d411', &['\x52']), ('\U0001d412', &['\x53']), ('\U0001d413', &['\x54']),
- ('\U0001d414', &['\x55']), ('\U0001d415', &['\x56']), ('\U0001d416', &['\x57']),
- ('\U0001d417', &['\x58']), ('\U0001d418', &['\x59']), ('\U0001d419', &['\x5a']),
- ('\U0001d41a', &['\x61']), ('\U0001d41b', &['\x62']), ('\U0001d41c', &['\x63']),
- ('\U0001d41d', &['\x64']), ('\U0001d41e', &['\x65']), ('\U0001d41f', &['\x66']),
- ('\U0001d420', &['\x67']), ('\U0001d421', &['\x68']), ('\U0001d422', &['\x69']),
- ('\U0001d423', &['\x6a']), ('\U0001d424', &['\x6b']), ('\U0001d425', &['\x6c']),
- ('\U0001d426', &['\x6d']), ('\U0001d427', &['\x6e']), ('\U0001d428', &['\x6f']),
- ('\U0001d429', &['\x70']), ('\U0001d42a', &['\x71']), ('\U0001d42b', &['\x72']),
- ('\U0001d42c', &['\x73']), ('\U0001d42d', &['\x74']), ('\U0001d42e', &['\x75']),
- ('\U0001d42f', &['\x76']), ('\U0001d430', &['\x77']), ('\U0001d431', &['\x78']),
- ('\U0001d432', &['\x79']), ('\U0001d433', &['\x7a']), ('\U0001d434', &['\x41']),
- ('\U0001d435', &['\x42']), ('\U0001d436', &['\x43']), ('\U0001d437', &['\x44']),
- ('\U0001d438', &['\x45']), ('\U0001d439', &['\x46']), ('\U0001d43a', &['\x47']),
- ('\U0001d43b', &['\x48']), ('\U0001d43c', &['\x49']), ('\U0001d43d', &['\x4a']),
- ('\U0001d43e', &['\x4b']), ('\U0001d43f', &['\x4c']), ('\U0001d440', &['\x4d']),
- ('\U0001d441', &['\x4e']), ('\U0001d442', &['\x4f']), ('\U0001d443', &['\x50']),
- ('\U0001d444', &['\x51']), ('\U0001d445', &['\x52']), ('\U0001d446', &['\x53']),
- ('\U0001d447', &['\x54']), ('\U0001d448', &['\x55']), ('\U0001d449', &['\x56']),
- ('\U0001d44a', &['\x57']), ('\U0001d44b', &['\x58']), ('\U0001d44c', &['\x59']),
- ('\U0001d44d', &['\x5a']), ('\U0001d44e', &['\x61']), ('\U0001d44f', &['\x62']),
- ('\U0001d450', &['\x63']), ('\U0001d451', &['\x64']), ('\U0001d452', &['\x65']),
- ('\U0001d453', &['\x66']), ('\U0001d454', &['\x67']), ('\U0001d456', &['\x69']),
- ('\U0001d457', &['\x6a']), ('\U0001d458', &['\x6b']), ('\U0001d459', &['\x6c']),
- ('\U0001d45a', &['\x6d']), ('\U0001d45b', &['\x6e']), ('\U0001d45c', &['\x6f']),
- ('\U0001d45d', &['\x70']), ('\U0001d45e', &['\x71']), ('\U0001d45f', &['\x72']),
- ('\U0001d460', &['\x73']), ('\U0001d461', &['\x74']), ('\U0001d462', &['\x75']),
- ('\U0001d463', &['\x76']), ('\U0001d464', &['\x77']), ('\U0001d465', &['\x78']),
- ('\U0001d466', &['\x79']), ('\U0001d467', &['\x7a']), ('\U0001d468', &['\x41']),
- ('\U0001d469', &['\x42']), ('\U0001d46a', &['\x43']), ('\U0001d46b', &['\x44']),
- ('\U0001d46c', &['\x45']), ('\U0001d46d', &['\x46']), ('\U0001d46e', &['\x47']),
- ('\U0001d46f', &['\x48']), ('\U0001d470', &['\x49']), ('\U0001d471', &['\x4a']),
- ('\U0001d472', &['\x4b']), ('\U0001d473', &['\x4c']), ('\U0001d474', &['\x4d']),
- ('\U0001d475', &['\x4e']), ('\U0001d476', &['\x4f']), ('\U0001d477', &['\x50']),
- ('\U0001d478', &['\x51']), ('\U0001d479', &['\x52']), ('\U0001d47a', &['\x53']),
- ('\U0001d47b', &['\x54']), ('\U0001d47c', &['\x55']), ('\U0001d47d', &['\x56']),
- ('\U0001d47e', &['\x57']), ('\U0001d47f', &['\x58']), ('\U0001d480', &['\x59']),
- ('\U0001d481', &['\x5a']), ('\U0001d482', &['\x61']), ('\U0001d483', &['\x62']),
- ('\U0001d484', &['\x63']), ('\U0001d485', &['\x64']), ('\U0001d486', &['\x65']),
- ('\U0001d487', &['\x66']), ('\U0001d488', &['\x67']), ('\U0001d489', &['\x68']),
- ('\U0001d48a', &['\x69']), ('\U0001d48b', &['\x6a']), ('\U0001d48c', &['\x6b']),
- ('\U0001d48d', &['\x6c']), ('\U0001d48e', &['\x6d']), ('\U0001d48f', &['\x6e']),
- ('\U0001d490', &['\x6f']), ('\U0001d491', &['\x70']), ('\U0001d492', &['\x71']),
- ('\U0001d493', &['\x72']), ('\U0001d494', &['\x73']), ('\U0001d495', &['\x74']),
- ('\U0001d496', &['\x75']), ('\U0001d497', &['\x76']), ('\U0001d498', &['\x77']),
- ('\U0001d499', &['\x78']), ('\U0001d49a', &['\x79']), ('\U0001d49b', &['\x7a']),
- ('\U0001d49c', &['\x41']), ('\U0001d49e', &['\x43']), ('\U0001d49f', &['\x44']),
- ('\U0001d4a2', &['\x47']), ('\U0001d4a5', &['\x4a']), ('\U0001d4a6', &['\x4b']),
- ('\U0001d4a9', &['\x4e']), ('\U0001d4aa', &['\x4f']), ('\U0001d4ab', &['\x50']),
- ('\U0001d4ac', &['\x51']), ('\U0001d4ae', &['\x53']), ('\U0001d4af', &['\x54']),
- ('\U0001d4b0', &['\x55']), ('\U0001d4b1', &['\x56']), ('\U0001d4b2', &['\x57']),
- ('\U0001d4b3', &['\x58']), ('\U0001d4b4', &['\x59']), ('\U0001d4b5', &['\x5a']),
- ('\U0001d4b6', &['\x61']), ('\U0001d4b7', &['\x62']), ('\U0001d4b8', &['\x63']),
- ('\U0001d4b9', &['\x64']), ('\U0001d4bb', &['\x66']), ('\U0001d4bd', &['\x68']),
- ('\U0001d4be', &['\x69']), ('\U0001d4bf', &['\x6a']), ('\U0001d4c0', &['\x6b']),
- ('\U0001d4c1', &['\x6c']), ('\U0001d4c2', &['\x6d']), ('\U0001d4c3', &['\x6e']),
- ('\U0001d4c5', &['\x70']), ('\U0001d4c6', &['\x71']), ('\U0001d4c7', &['\x72']),
- ('\U0001d4c8', &['\x73']), ('\U0001d4c9', &['\x74']), ('\U0001d4ca', &['\x75']),
- ('\U0001d4cb', &['\x76']), ('\U0001d4cc', &['\x77']), ('\U0001d4cd', &['\x78']),
- ('\U0001d4ce', &['\x79']), ('\U0001d4cf', &['\x7a']), ('\U0001d4d0', &['\x41']),
- ('\U0001d4d1', &['\x42']), ('\U0001d4d2', &['\x43']), ('\U0001d4d3', &['\x44']),
- ('\U0001d4d4', &['\x45']), ('\U0001d4d5', &['\x46']), ('\U0001d4d6', &['\x47']),
- ('\U0001d4d7', &['\x48']), ('\U0001d4d8', &['\x49']), ('\U0001d4d9', &['\x4a']),
- ('\U0001d4da', &['\x4b']), ('\U0001d4db', &['\x4c']), ('\U0001d4dc', &['\x4d']),
- ('\U0001d4dd', &['\x4e']), ('\U0001d4de', &['\x4f']), ('\U0001d4df', &['\x50']),
- ('\U0001d4e0', &['\x51']), ('\U0001d4e1', &['\x52']), ('\U0001d4e2', &['\x53']),
- ('\U0001d4e3', &['\x54']), ('\U0001d4e4', &['\x55']), ('\U0001d4e5', &['\x56']),
- ('\U0001d4e6', &['\x57']), ('\U0001d4e7', &['\x58']), ('\U0001d4e8', &['\x59']),
- ('\U0001d4e9', &['\x5a']), ('\U0001d4ea', &['\x61']), ('\U0001d4eb', &['\x62']),
- ('\U0001d4ec', &['\x63']), ('\U0001d4ed', &['\x64']), ('\U0001d4ee', &['\x65']),
- ('\U0001d4ef', &['\x66']), ('\U0001d4f0', &['\x67']), ('\U0001d4f1', &['\x68']),
- ('\U0001d4f2', &['\x69']), ('\U0001d4f3', &['\x6a']), ('\U0001d4f4', &['\x6b']),
- ('\U0001d4f5', &['\x6c']), ('\U0001d4f6', &['\x6d']), ('\U0001d4f7', &['\x6e']),
- ('\U0001d4f8', &['\x6f']), ('\U0001d4f9', &['\x70']), ('\U0001d4fa', &['\x71']),
- ('\U0001d4fb', &['\x72']), ('\U0001d4fc', &['\x73']), ('\U0001d4fd', &['\x74']),
- ('\U0001d4fe', &['\x75']), ('\U0001d4ff', &['\x76']), ('\U0001d500', &['\x77']),
- ('\U0001d501', &['\x78']), ('\U0001d502', &['\x79']), ('\U0001d503', &['\x7a']),
- ('\U0001d504', &['\x41']), ('\U0001d505', &['\x42']), ('\U0001d507', &['\x44']),
- ('\U0001d508', &['\x45']), ('\U0001d509', &['\x46']), ('\U0001d50a', &['\x47']),
- ('\U0001d50d', &['\x4a']), ('\U0001d50e', &['\x4b']), ('\U0001d50f', &['\x4c']),
- ('\U0001d510', &['\x4d']), ('\U0001d511', &['\x4e']), ('\U0001d512', &['\x4f']),
- ('\U0001d513', &['\x50']), ('\U0001d514', &['\x51']), ('\U0001d516', &['\x53']),
- ('\U0001d517', &['\x54']), ('\U0001d518', &['\x55']), ('\U0001d519', &['\x56']),
- ('\U0001d51a', &['\x57']), ('\U0001d51b', &['\x58']), ('\U0001d51c', &['\x59']),
- ('\U0001d51e', &['\x61']), ('\U0001d51f', &['\x62']), ('\U0001d520', &['\x63']),
- ('\U0001d521', &['\x64']), ('\U0001d522', &['\x65']), ('\U0001d523', &['\x66']),
- ('\U0001d524', &['\x67']), ('\U0001d525', &['\x68']), ('\U0001d526', &['\x69']),
- ('\U0001d527', &['\x6a']), ('\U0001d528', &['\x6b']), ('\U0001d529', &['\x6c']),
- ('\U0001d52a', &['\x6d']), ('\U0001d52b', &['\x6e']), ('\U0001d52c', &['\x6f']),
- ('\U0001d52d', &['\x70']), ('\U0001d52e', &['\x71']), ('\U0001d52f', &['\x72']),
- ('\U0001d530', &['\x73']), ('\U0001d531', &['\x74']), ('\U0001d532', &['\x75']),
- ('\U0001d533', &['\x76']), ('\U0001d534', &['\x77']), ('\U0001d535', &['\x78']),
- ('\U0001d536', &['\x79']), ('\U0001d537', &['\x7a']), ('\U0001d538', &['\x41']),
- ('\U0001d539', &['\x42']), ('\U0001d53b', &['\x44']), ('\U0001d53c', &['\x45']),
- ('\U0001d53d', &['\x46']), ('\U0001d53e', &['\x47']), ('\U0001d540', &['\x49']),
- ('\U0001d541', &['\x4a']), ('\U0001d542', &['\x4b']), ('\U0001d543', &['\x4c']),
- ('\U0001d544', &['\x4d']), ('\U0001d546', &['\x4f']), ('\U0001d54a', &['\x53']),
- ('\U0001d54b', &['\x54']), ('\U0001d54c', &['\x55']), ('\U0001d54d', &['\x56']),
- ('\U0001d54e', &['\x57']), ('\U0001d54f', &['\x58']), ('\U0001d550', &['\x59']),
- ('\U0001d552', &['\x61']), ('\U0001d553', &['\x62']), ('\U0001d554', &['\x63']),
- ('\U0001d555', &['\x64']), ('\U0001d556', &['\x65']), ('\U0001d557', &['\x66']),
- ('\U0001d558', &['\x67']), ('\U0001d559', &['\x68']), ('\U0001d55a', &['\x69']),
- ('\U0001d55b', &['\x6a']), ('\U0001d55c', &['\x6b']), ('\U0001d55d', &['\x6c']),
- ('\U0001d55e', &['\x6d']), ('\U0001d55f', &['\x6e']), ('\U0001d560', &['\x6f']),
- ('\U0001d561', &['\x70']), ('\U0001d562', &['\x71']), ('\U0001d563', &['\x72']),
- ('\U0001d564', &['\x73']), ('\U0001d565', &['\x74']), ('\U0001d566', &['\x75']),
- ('\U0001d567', &['\x76']), ('\U0001d568', &['\x77']), ('\U0001d569', &['\x78']),
- ('\U0001d56a', &['\x79']), ('\U0001d56b', &['\x7a']), ('\U0001d56c', &['\x41']),
- ('\U0001d56d', &['\x42']), ('\U0001d56e', &['\x43']), ('\U0001d56f', &['\x44']),
- ('\U0001d570', &['\x45']), ('\U0001d571', &['\x46']), ('\U0001d572', &['\x47']),
- ('\U0001d573', &['\x48']), ('\U0001d574', &['\x49']), ('\U0001d575', &['\x4a']),
- ('\U0001d576', &['\x4b']), ('\U0001d577', &['\x4c']), ('\U0001d578', &['\x4d']),
- ('\U0001d579', &['\x4e']), ('\U0001d57a', &['\x4f']), ('\U0001d57b', &['\x50']),
- ('\U0001d57c', &['\x51']), ('\U0001d57d', &['\x52']), ('\U0001d57e', &['\x53']),
- ('\U0001d57f', &['\x54']), ('\U0001d580', &['\x55']), ('\U0001d581', &['\x56']),
- ('\U0001d582', &['\x57']), ('\U0001d583', &['\x58']), ('\U0001d584', &['\x59']),
- ('\U0001d585', &['\x5a']), ('\U0001d586', &['\x61']), ('\U0001d587', &['\x62']),
- ('\U0001d588', &['\x63']), ('\U0001d589', &['\x64']), ('\U0001d58a', &['\x65']),
- ('\U0001d58b', &['\x66']), ('\U0001d58c', &['\x67']), ('\U0001d58d', &['\x68']),
- ('\U0001d58e', &['\x69']), ('\U0001d58f', &['\x6a']), ('\U0001d590', &['\x6b']),
- ('\U0001d591', &['\x6c']), ('\U0001d592', &['\x6d']), ('\U0001d593', &['\x6e']),
- ('\U0001d594', &['\x6f']), ('\U0001d595', &['\x70']), ('\U0001d596', &['\x71']),
- ('\U0001d597', &['\x72']), ('\U0001d598', &['\x73']), ('\U0001d599', &['\x74']),
- ('\U0001d59a', &['\x75']), ('\U0001d59b', &['\x76']), ('\U0001d59c', &['\x77']),
- ('\U0001d59d', &['\x78']), ('\U0001d59e', &['\x79']), ('\U0001d59f', &['\x7a']),
- ('\U0001d5a0', &['\x41']), ('\U0001d5a1', &['\x42']), ('\U0001d5a2', &['\x43']),
- ('\U0001d5a3', &['\x44']), ('\U0001d5a4', &['\x45']), ('\U0001d5a5', &['\x46']),
- ('\U0001d5a6', &['\x47']), ('\U0001d5a7', &['\x48']), ('\U0001d5a8', &['\x49']),
- ('\U0001d5a9', &['\x4a']), ('\U0001d5aa', &['\x4b']), ('\U0001d5ab', &['\x4c']),
- ('\U0001d5ac', &['\x4d']), ('\U0001d5ad', &['\x4e']), ('\U0001d5ae', &['\x4f']),
- ('\U0001d5af', &['\x50']), ('\U0001d5b0', &['\x51']), ('\U0001d5b1', &['\x52']),
- ('\U0001d5b2', &['\x53']), ('\U0001d5b3', &['\x54']), ('\U0001d5b4', &['\x55']),
- ('\U0001d5b5', &['\x56']), ('\U0001d5b6', &['\x57']), ('\U0001d5b7', &['\x58']),
- ('\U0001d5b8', &['\x59']), ('\U0001d5b9', &['\x5a']), ('\U0001d5ba', &['\x61']),
- ('\U0001d5bb', &['\x62']), ('\U0001d5bc', &['\x63']), ('\U0001d5bd', &['\x64']),
- ('\U0001d5be', &['\x65']), ('\U0001d5bf', &['\x66']), ('\U0001d5c0', &['\x67']),
- ('\U0001d5c1', &['\x68']), ('\U0001d5c2', &['\x69']), ('\U0001d5c3', &['\x6a']),
- ('\U0001d5c4', &['\x6b']), ('\U0001d5c5', &['\x6c']), ('\U0001d5c6', &['\x6d']),
- ('\U0001d5c7', &['\x6e']), ('\U0001d5c8', &['\x6f']), ('\U0001d5c9', &['\x70']),
- ('\U0001d5ca', &['\x71']), ('\U0001d5cb', &['\x72']), ('\U0001d5cc', &['\x73']),
- ('\U0001d5cd', &['\x74']), ('\U0001d5ce', &['\x75']), ('\U0001d5cf', &['\x76']),
- ('\U0001d5d0', &['\x77']), ('\U0001d5d1', &['\x78']), ('\U0001d5d2', &['\x79']),
- ('\U0001d5d3', &['\x7a']), ('\U0001d5d4', &['\x41']), ('\U0001d5d5', &['\x42']),
- ('\U0001d5d6', &['\x43']), ('\U0001d5d7', &['\x44']), ('\U0001d5d8', &['\x45']),
- ('\U0001d5d9', &['\x46']), ('\U0001d5da', &['\x47']), ('\U0001d5db', &['\x48']),
- ('\U0001d5dc', &['\x49']), ('\U0001d5dd', &['\x4a']), ('\U0001d5de', &['\x4b']),
- ('\U0001d5df', &['\x4c']), ('\U0001d5e0', &['\x4d']), ('\U0001d5e1', &['\x4e']),
- ('\U0001d5e2', &['\x4f']), ('\U0001d5e3', &['\x50']), ('\U0001d5e4', &['\x51']),
- ('\U0001d5e5', &['\x52']), ('\U0001d5e6', &['\x53']), ('\U0001d5e7', &['\x54']),
- ('\U0001d5e8', &['\x55']), ('\U0001d5e9', &['\x56']), ('\U0001d5ea', &['\x57']),
- ('\U0001d5eb', &['\x58']), ('\U0001d5ec', &['\x59']), ('\U0001d5ed', &['\x5a']),
- ('\U0001d5ee', &['\x61']), ('\U0001d5ef', &['\x62']), ('\U0001d5f0', &['\x63']),
- ('\U0001d5f1', &['\x64']), ('\U0001d5f2', &['\x65']), ('\U0001d5f3', &['\x66']),
- ('\U0001d5f4', &['\x67']), ('\U0001d5f5', &['\x68']), ('\U0001d5f6', &['\x69']),
- ('\U0001d5f7', &['\x6a']), ('\U0001d5f8', &['\x6b']), ('\U0001d5f9', &['\x6c']),
- ('\U0001d5fa', &['\x6d']), ('\U0001d5fb', &['\x6e']), ('\U0001d5fc', &['\x6f']),
- ('\U0001d5fd', &['\x70']), ('\U0001d5fe', &['\x71']), ('\U0001d5ff', &['\x72']),
- ('\U0001d600', &['\x73']), ('\U0001d601', &['\x74']), ('\U0001d602', &['\x75']),
- ('\U0001d603', &['\x76']), ('\U0001d604', &['\x77']), ('\U0001d605', &['\x78']),
- ('\U0001d606', &['\x79']), ('\U0001d607', &['\x7a']), ('\U0001d608', &['\x41']),
- ('\U0001d609', &['\x42']), ('\U0001d60a', &['\x43']), ('\U0001d60b', &['\x44']),
- ('\U0001d60c', &['\x45']), ('\U0001d60d', &['\x46']), ('\U0001d60e', &['\x47']),
- ('\U0001d60f', &['\x48']), ('\U0001d610', &['\x49']), ('\U0001d611', &['\x4a']),
- ('\U0001d612', &['\x4b']), ('\U0001d613', &['\x4c']), ('\U0001d614', &['\x4d']),
- ('\U0001d615', &['\x4e']), ('\U0001d616', &['\x4f']), ('\U0001d617', &['\x50']),
- ('\U0001d618', &['\x51']), ('\U0001d619', &['\x52']), ('\U0001d61a', &['\x53']),
- ('\U0001d61b', &['\x54']), ('\U0001d61c', &['\x55']), ('\U0001d61d', &['\x56']),
- ('\U0001d61e', &['\x57']), ('\U0001d61f', &['\x58']), ('\U0001d620', &['\x59']),
- ('\U0001d621', &['\x5a']), ('\U0001d622', &['\x61']), ('\U0001d623', &['\x62']),
- ('\U0001d624', &['\x63']), ('\U0001d625', &['\x64']), ('\U0001d626', &['\x65']),
- ('\U0001d627', &['\x66']), ('\U0001d628', &['\x67']), ('\U0001d629', &['\x68']),
- ('\U0001d62a', &['\x69']), ('\U0001d62b', &['\x6a']), ('\U0001d62c', &['\x6b']),
- ('\U0001d62d', &['\x6c']), ('\U0001d62e', &['\x6d']), ('\U0001d62f', &['\x6e']),
- ('\U0001d630', &['\x6f']), ('\U0001d631', &['\x70']), ('\U0001d632', &['\x71']),
- ('\U0001d633', &['\x72']), ('\U0001d634', &['\x73']), ('\U0001d635', &['\x74']),
- ('\U0001d636', &['\x75']), ('\U0001d637', &['\x76']), ('\U0001d638', &['\x77']),
- ('\U0001d639', &['\x78']), ('\U0001d63a', &['\x79']), ('\U0001d63b', &['\x7a']),
- ('\U0001d63c', &['\x41']), ('\U0001d63d', &['\x42']), ('\U0001d63e', &['\x43']),
- ('\U0001d63f', &['\x44']), ('\U0001d640', &['\x45']), ('\U0001d641', &['\x46']),
- ('\U0001d642', &['\x47']), ('\U0001d643', &['\x48']), ('\U0001d644', &['\x49']),
- ('\U0001d645', &['\x4a']), ('\U0001d646', &['\x4b']), ('\U0001d647', &['\x4c']),
- ('\U0001d648', &['\x4d']), ('\U0001d649', &['\x4e']), ('\U0001d64a', &['\x4f']),
- ('\U0001d64b', &['\x50']), ('\U0001d64c', &['\x51']), ('\U0001d64d', &['\x52']),
- ('\U0001d64e', &['\x53']), ('\U0001d64f', &['\x54']), ('\U0001d650', &['\x55']),
- ('\U0001d651', &['\x56']), ('\U0001d652', &['\x57']), ('\U0001d653', &['\x58']),
- ('\U0001d654', &['\x59']), ('\U0001d655', &['\x5a']), ('\U0001d656', &['\x61']),
- ('\U0001d657', &['\x62']), ('\U0001d658', &['\x63']), ('\U0001d659', &['\x64']),
- ('\U0001d65a', &['\x65']), ('\U0001d65b', &['\x66']), ('\U0001d65c', &['\x67']),
- ('\U0001d65d', &['\x68']), ('\U0001d65e', &['\x69']), ('\U0001d65f', &['\x6a']),
- ('\U0001d660', &['\x6b']), ('\U0001d661', &['\x6c']), ('\U0001d662', &['\x6d']),
- ('\U0001d663', &['\x6e']), ('\U0001d664', &['\x6f']), ('\U0001d665', &['\x70']),
- ('\U0001d666', &['\x71']), ('\U0001d667', &['\x72']), ('\U0001d668', &['\x73']),
- ('\U0001d669', &['\x74']), ('\U0001d66a', &['\x75']), ('\U0001d66b', &['\x76']),
- ('\U0001d66c', &['\x77']), ('\U0001d66d', &['\x78']), ('\U0001d66e', &['\x79']),
- ('\U0001d66f', &['\x7a']), ('\U0001d670', &['\x41']), ('\U0001d671', &['\x42']),
- ('\U0001d672', &['\x43']), ('\U0001d673', &['\x44']), ('\U0001d674', &['\x45']),
- ('\U0001d675', &['\x46']), ('\U0001d676', &['\x47']), ('\U0001d677', &['\x48']),
- ('\U0001d678', &['\x49']), ('\U0001d679', &['\x4a']), ('\U0001d67a', &['\x4b']),
- ('\U0001d67b', &['\x4c']), ('\U0001d67c', &['\x4d']), ('\U0001d67d', &['\x4e']),
- ('\U0001d67e', &['\x4f']), ('\U0001d67f', &['\x50']), ('\U0001d680', &['\x51']),
- ('\U0001d681', &['\x52']), ('\U0001d682', &['\x53']), ('\U0001d683', &['\x54']),
- ('\U0001d684', &['\x55']), ('\U0001d685', &['\x56']), ('\U0001d686', &['\x57']),
- ('\U0001d687', &['\x58']), ('\U0001d688', &['\x59']), ('\U0001d689', &['\x5a']),
- ('\U0001d68a', &['\x61']), ('\U0001d68b', &['\x62']), ('\U0001d68c', &['\x63']),
- ('\U0001d68d', &['\x64']), ('\U0001d68e', &['\x65']), ('\U0001d68f', &['\x66']),
- ('\U0001d690', &['\x67']), ('\U0001d691', &['\x68']), ('\U0001d692', &['\x69']),
- ('\U0001d693', &['\x6a']), ('\U0001d694', &['\x6b']), ('\U0001d695', &['\x6c']),
- ('\U0001d696', &['\x6d']), ('\U0001d697', &['\x6e']), ('\U0001d698', &['\x6f']),
- ('\U0001d699', &['\x70']), ('\U0001d69a', &['\x71']), ('\U0001d69b', &['\x72']),
- ('\U0001d69c', &['\x73']), ('\U0001d69d', &['\x74']), ('\U0001d69e', &['\x75']),
- ('\U0001d69f', &['\x76']), ('\U0001d6a0', &['\x77']), ('\U0001d6a1', &['\x78']),
- ('\U0001d6a2', &['\x79']), ('\U0001d6a3', &['\x7a']), ('\U0001d6a4', &['\u0131']),
- ('\U0001d6a5', &['\u0237']), ('\U0001d6a8', &['\u0391']), ('\U0001d6a9', &['\u0392']),
- ('\U0001d6aa', &['\u0393']), ('\U0001d6ab', &['\u0394']), ('\U0001d6ac', &['\u0395']),
- ('\U0001d6ad', &['\u0396']), ('\U0001d6ae', &['\u0397']), ('\U0001d6af', &['\u0398']),
- ('\U0001d6b0', &['\u0399']), ('\U0001d6b1', &['\u039a']), ('\U0001d6b2', &['\u039b']),
- ('\U0001d6b3', &['\u039c']), ('\U0001d6b4', &['\u039d']), ('\U0001d6b5', &['\u039e']),
- ('\U0001d6b6', &['\u039f']), ('\U0001d6b7', &['\u03a0']), ('\U0001d6b8', &['\u03a1']),
- ('\U0001d6b9', &['\u03f4']), ('\U0001d6ba', &['\u03a3']), ('\U0001d6bb', &['\u03a4']),
- ('\U0001d6bc', &['\u03a5']), ('\U0001d6bd', &['\u03a6']), ('\U0001d6be', &['\u03a7']),
- ('\U0001d6bf', &['\u03a8']), ('\U0001d6c0', &['\u03a9']), ('\U0001d6c1', &['\u2207']),
- ('\U0001d6c2', &['\u03b1']), ('\U0001d6c3', &['\u03b2']), ('\U0001d6c4', &['\u03b3']),
- ('\U0001d6c5', &['\u03b4']), ('\U0001d6c6', &['\u03b5']), ('\U0001d6c7', &['\u03b6']),
- ('\U0001d6c8', &['\u03b7']), ('\U0001d6c9', &['\u03b8']), ('\U0001d6ca', &['\u03b9']),
- ('\U0001d6cb', &['\u03ba']), ('\U0001d6cc', &['\u03bb']), ('\U0001d6cd', &['\u03bc']),
- ('\U0001d6ce', &['\u03bd']), ('\U0001d6cf', &['\u03be']), ('\U0001d6d0', &['\u03bf']),
- ('\U0001d6d1', &['\u03c0']), ('\U0001d6d2', &['\u03c1']), ('\U0001d6d3', &['\u03c2']),
- ('\U0001d6d4', &['\u03c3']), ('\U0001d6d5', &['\u03c4']), ('\U0001d6d6', &['\u03c5']),
- ('\U0001d6d7', &['\u03c6']), ('\U0001d6d8', &['\u03c7']), ('\U0001d6d9', &['\u03c8']),
- ('\U0001d6da', &['\u03c9']), ('\U0001d6db', &['\u2202']), ('\U0001d6dc', &['\u03f5']),
- ('\U0001d6dd', &['\u03d1']), ('\U0001d6de', &['\u03f0']), ('\U0001d6df', &['\u03d5']),
- ('\U0001d6e0', &['\u03f1']), ('\U0001d6e1', &['\u03d6']), ('\U0001d6e2', &['\u0391']),
- ('\U0001d6e3', &['\u0392']), ('\U0001d6e4', &['\u0393']), ('\U0001d6e5', &['\u0394']),
- ('\U0001d6e6', &['\u0395']), ('\U0001d6e7', &['\u0396']), ('\U0001d6e8', &['\u0397']),
- ('\U0001d6e9', &['\u0398']), ('\U0001d6ea', &['\u0399']), ('\U0001d6eb', &['\u039a']),
- ('\U0001d6ec', &['\u039b']), ('\U0001d6ed', &['\u039c']), ('\U0001d6ee', &['\u039d']),
- ('\U0001d6ef', &['\u039e']), ('\U0001d6f0', &['\u039f']), ('\U0001d6f1', &['\u03a0']),
- ('\U0001d6f2', &['\u03a1']), ('\U0001d6f3', &['\u03f4']), ('\U0001d6f4', &['\u03a3']),
- ('\U0001d6f5', &['\u03a4']), ('\U0001d6f6', &['\u03a5']), ('\U0001d6f7', &['\u03a6']),
- ('\U0001d6f8', &['\u03a7']), ('\U0001d6f9', &['\u03a8']), ('\U0001d6fa', &['\u03a9']),
- ('\U0001d6fb', &['\u2207']), ('\U0001d6fc', &['\u03b1']), ('\U0001d6fd', &['\u03b2']),
- ('\U0001d6fe', &['\u03b3']), ('\U0001d6ff', &['\u03b4']), ('\U0001d700', &['\u03b5']),
- ('\U0001d701', &['\u03b6']), ('\U0001d702', &['\u03b7']), ('\U0001d703', &['\u03b8']),
- ('\U0001d704', &['\u03b9']), ('\U0001d705', &['\u03ba']), ('\U0001d706', &['\u03bb']),
- ('\U0001d707', &['\u03bc']), ('\U0001d708', &['\u03bd']), ('\U0001d709', &['\u03be']),
- ('\U0001d70a', &['\u03bf']), ('\U0001d70b', &['\u03c0']), ('\U0001d70c', &['\u03c1']),
- ('\U0001d70d', &['\u03c2']), ('\U0001d70e', &['\u03c3']), ('\U0001d70f', &['\u03c4']),
- ('\U0001d710', &['\u03c5']), ('\U0001d711', &['\u03c6']), ('\U0001d712', &['\u03c7']),
- ('\U0001d713', &['\u03c8']), ('\U0001d714', &['\u03c9']), ('\U0001d715', &['\u2202']),
- ('\U0001d716', &['\u03f5']), ('\U0001d717', &['\u03d1']), ('\U0001d718', &['\u03f0']),
- ('\U0001d719', &['\u03d5']), ('\U0001d71a', &['\u03f1']), ('\U0001d71b', &['\u03d6']),
- ('\U0001d71c', &['\u0391']), ('\U0001d71d', &['\u0392']), ('\U0001d71e', &['\u0393']),
- ('\U0001d71f', &['\u0394']), ('\U0001d720', &['\u0395']), ('\U0001d721', &['\u0396']),
- ('\U0001d722', &['\u0397']), ('\U0001d723', &['\u0398']), ('\U0001d724', &['\u0399']),
- ('\U0001d725', &['\u039a']), ('\U0001d726', &['\u039b']), ('\U0001d727', &['\u039c']),
- ('\U0001d728', &['\u039d']), ('\U0001d729', &['\u039e']), ('\U0001d72a', &['\u039f']),
- ('\U0001d72b', &['\u03a0']), ('\U0001d72c', &['\u03a1']), ('\U0001d72d', &['\u03f4']),
- ('\U0001d72e', &['\u03a3']), ('\U0001d72f', &['\u03a4']), ('\U0001d730', &['\u03a5']),
- ('\U0001d731', &['\u03a6']), ('\U0001d732', &['\u03a7']), ('\U0001d733', &['\u03a8']),
- ('\U0001d734', &['\u03a9']), ('\U0001d735', &['\u2207']), ('\U0001d736', &['\u03b1']),
- ('\U0001d737', &['\u03b2']), ('\U0001d738', &['\u03b3']), ('\U0001d739', &['\u03b4']),
- ('\U0001d73a', &['\u03b5']), ('\U0001d73b', &['\u03b6']), ('\U0001d73c', &['\u03b7']),
- ('\U0001d73d', &['\u03b8']), ('\U0001d73e', &['\u03b9']), ('\U0001d73f', &['\u03ba']),
- ('\U0001d740', &['\u03bb']), ('\U0001d741', &['\u03bc']), ('\U0001d742', &['\u03bd']),
- ('\U0001d743', &['\u03be']), ('\U0001d744', &['\u03bf']), ('\U0001d745', &['\u03c0']),
- ('\U0001d746', &['\u03c1']), ('\U0001d747', &['\u03c2']), ('\U0001d748', &['\u03c3']),
- ('\U0001d749', &['\u03c4']), ('\U0001d74a', &['\u03c5']), ('\U0001d74b', &['\u03c6']),
- ('\U0001d74c', &['\u03c7']), ('\U0001d74d', &['\u03c8']), ('\U0001d74e', &['\u03c9']),
- ('\U0001d74f', &['\u2202']), ('\U0001d750', &['\u03f5']), ('\U0001d751', &['\u03d1']),
- ('\U0001d752', &['\u03f0']), ('\U0001d753', &['\u03d5']), ('\U0001d754', &['\u03f1']),
- ('\U0001d755', &['\u03d6']), ('\U0001d756', &['\u0391']), ('\U0001d757', &['\u0392']),
- ('\U0001d758', &['\u0393']), ('\U0001d759', &['\u0394']), ('\U0001d75a', &['\u0395']),
- ('\U0001d75b', &['\u0396']), ('\U0001d75c', &['\u0397']), ('\U0001d75d', &['\u0398']),
- ('\U0001d75e', &['\u0399']), ('\U0001d75f', &['\u039a']), ('\U0001d760', &['\u039b']),
- ('\U0001d761', &['\u039c']), ('\U0001d762', &['\u039d']), ('\U0001d763', &['\u039e']),
- ('\U0001d764', &['\u039f']), ('\U0001d765', &['\u03a0']), ('\U0001d766', &['\u03a1']),
- ('\U0001d767', &['\u03f4']), ('\U0001d768', &['\u03a3']), ('\U0001d769', &['\u03a4']),
- ('\U0001d76a', &['\u03a5']), ('\U0001d76b', &['\u03a6']), ('\U0001d76c', &['\u03a7']),
- ('\U0001d76d', &['\u03a8']), ('\U0001d76e', &['\u03a9']), ('\U0001d76f', &['\u2207']),
- ('\U0001d770', &['\u03b1']), ('\U0001d771', &['\u03b2']), ('\U0001d772', &['\u03b3']),
- ('\U0001d773', &['\u03b4']), ('\U0001d774', &['\u03b5']), ('\U0001d775', &['\u03b6']),
- ('\U0001d776', &['\u03b7']), ('\U0001d777', &['\u03b8']), ('\U0001d778', &['\u03b9']),
- ('\U0001d779', &['\u03ba']), ('\U0001d77a', &['\u03bb']), ('\U0001d77b', &['\u03bc']),
- ('\U0001d77c', &['\u03bd']), ('\U0001d77d', &['\u03be']), ('\U0001d77e', &['\u03bf']),
- ('\U0001d77f', &['\u03c0']), ('\U0001d780', &['\u03c1']), ('\U0001d781', &['\u03c2']),
- ('\U0001d782', &['\u03c3']), ('\U0001d783', &['\u03c4']), ('\U0001d784', &['\u03c5']),
- ('\U0001d785', &['\u03c6']), ('\U0001d786', &['\u03c7']), ('\U0001d787', &['\u03c8']),
- ('\U0001d788', &['\u03c9']), ('\U0001d789', &['\u2202']), ('\U0001d78a', &['\u03f5']),
- ('\U0001d78b', &['\u03d1']), ('\U0001d78c', &['\u03f0']), ('\U0001d78d', &['\u03d5']),
- ('\U0001d78e', &['\u03f1']), ('\U0001d78f', &['\u03d6']), ('\U0001d790', &['\u0391']),
- ('\U0001d791', &['\u0392']), ('\U0001d792', &['\u0393']), ('\U0001d793', &['\u0394']),
- ('\U0001d794', &['\u0395']), ('\U0001d795', &['\u0396']), ('\U0001d796', &['\u0397']),
- ('\U0001d797', &['\u0398']), ('\U0001d798', &['\u0399']), ('\U0001d799', &['\u039a']),
- ('\U0001d79a', &['\u039b']), ('\U0001d79b', &['\u039c']), ('\U0001d79c', &['\u039d']),
- ('\U0001d79d', &['\u039e']), ('\U0001d79e', &['\u039f']), ('\U0001d79f', &['\u03a0']),
- ('\U0001d7a0', &['\u03a1']), ('\U0001d7a1', &['\u03f4']), ('\U0001d7a2', &['\u03a3']),
- ('\U0001d7a3', &['\u03a4']), ('\U0001d7a4', &['\u03a5']), ('\U0001d7a5', &['\u03a6']),
- ('\U0001d7a6', &['\u03a7']), ('\U0001d7a7', &['\u03a8']), ('\U0001d7a8', &['\u03a9']),
- ('\U0001d7a9', &['\u2207']), ('\U0001d7aa', &['\u03b1']), ('\U0001d7ab', &['\u03b2']),
- ('\U0001d7ac', &['\u03b3']), ('\U0001d7ad', &['\u03b4']), ('\U0001d7ae', &['\u03b5']),
- ('\U0001d7af', &['\u03b6']), ('\U0001d7b0', &['\u03b7']), ('\U0001d7b1', &['\u03b8']),
- ('\U0001d7b2', &['\u03b9']), ('\U0001d7b3', &['\u03ba']), ('\U0001d7b4', &['\u03bb']),
- ('\U0001d7b5', &['\u03bc']), ('\U0001d7b6', &['\u03bd']), ('\U0001d7b7', &['\u03be']),
- ('\U0001d7b8', &['\u03bf']), ('\U0001d7b9', &['\u03c0']), ('\U0001d7ba', &['\u03c1']),
- ('\U0001d7bb', &['\u03c2']), ('\U0001d7bc', &['\u03c3']), ('\U0001d7bd', &['\u03c4']),
- ('\U0001d7be', &['\u03c5']), ('\U0001d7bf', &['\u03c6']), ('\U0001d7c0', &['\u03c7']),
- ('\U0001d7c1', &['\u03c8']), ('\U0001d7c2', &['\u03c9']), ('\U0001d7c3', &['\u2202']),
- ('\U0001d7c4', &['\u03f5']), ('\U0001d7c5', &['\u03d1']), ('\U0001d7c6', &['\u03f0']),
- ('\U0001d7c7', &['\u03d5']), ('\U0001d7c8', &['\u03f1']), ('\U0001d7c9', &['\u03d6']),
- ('\U0001d7ca', &['\u03dc']), ('\U0001d7cb', &['\u03dd']), ('\U0001d7ce', &['\x30']),
- ('\U0001d7cf', &['\x31']), ('\U0001d7d0', &['\x32']), ('\U0001d7d1', &['\x33']),
- ('\U0001d7d2', &['\x34']), ('\U0001d7d3', &['\x35']), ('\U0001d7d4', &['\x36']),
- ('\U0001d7d5', &['\x37']), ('\U0001d7d6', &['\x38']), ('\U0001d7d7', &['\x39']),
- ('\U0001d7d8', &['\x30']), ('\U0001d7d9', &['\x31']), ('\U0001d7da', &['\x32']),
- ('\U0001d7db', &['\x33']), ('\U0001d7dc', &['\x34']), ('\U0001d7dd', &['\x35']),
- ('\U0001d7de', &['\x36']), ('\U0001d7df', &['\x37']), ('\U0001d7e0', &['\x38']),
- ('\U0001d7e1', &['\x39']), ('\U0001d7e2', &['\x30']), ('\U0001d7e3', &['\x31']),
- ('\U0001d7e4', &['\x32']), ('\U0001d7e5', &['\x33']), ('\U0001d7e6', &['\x34']),
- ('\U0001d7e7', &['\x35']), ('\U0001d7e8', &['\x36']), ('\U0001d7e9', &['\x37']),
- ('\U0001d7ea', &['\x38']), ('\U0001d7eb', &['\x39']), ('\U0001d7ec', &['\x30']),
- ('\U0001d7ed', &['\x31']), ('\U0001d7ee', &['\x32']), ('\U0001d7ef', &['\x33']),
- ('\U0001d7f0', &['\x34']), ('\U0001d7f1', &['\x35']), ('\U0001d7f2', &['\x36']),
- ('\U0001d7f3', &['\x37']), ('\U0001d7f4', &['\x38']), ('\U0001d7f5', &['\x39']),
- ('\U0001d7f6', &['\x30']), ('\U0001d7f7', &['\x31']), ('\U0001d7f8', &['\x32']),
- ('\U0001d7f9', &['\x33']), ('\U0001d7fa', &['\x34']), ('\U0001d7fb', &['\x35']),
- ('\U0001d7fc', &['\x36']), ('\U0001d7fd', &['\x37']), ('\U0001d7fe', &['\x38']),
- ('\U0001d7ff', &['\x39']), ('\U0001ee00', &['\u0627']), ('\U0001ee01', &['\u0628']),
- ('\U0001ee02', &['\u062c']), ('\U0001ee03', &['\u062f']), ('\U0001ee05', &['\u0648']),
- ('\U0001ee06', &['\u0632']), ('\U0001ee07', &['\u062d']), ('\U0001ee08', &['\u0637']),
- ('\U0001ee09', &['\u064a']), ('\U0001ee0a', &['\u0643']), ('\U0001ee0b', &['\u0644']),
- ('\U0001ee0c', &['\u0645']), ('\U0001ee0d', &['\u0646']), ('\U0001ee0e', &['\u0633']),
- ('\U0001ee0f', &['\u0639']), ('\U0001ee10', &['\u0641']), ('\U0001ee11', &['\u0635']),
- ('\U0001ee12', &['\u0642']), ('\U0001ee13', &['\u0631']), ('\U0001ee14', &['\u0634']),
- ('\U0001ee15', &['\u062a']), ('\U0001ee16', &['\u062b']), ('\U0001ee17', &['\u062e']),
- ('\U0001ee18', &['\u0630']), ('\U0001ee19', &['\u0636']), ('\U0001ee1a', &['\u0638']),
- ('\U0001ee1b', &['\u063a']), ('\U0001ee1c', &['\u066e']), ('\U0001ee1d', &['\u06ba']),
- ('\U0001ee1e', &['\u06a1']), ('\U0001ee1f', &['\u066f']), ('\U0001ee21', &['\u0628']),
- ('\U0001ee22', &['\u062c']), ('\U0001ee24', &['\u0647']), ('\U0001ee27', &['\u062d']),
- ('\U0001ee29', &['\u064a']), ('\U0001ee2a', &['\u0643']), ('\U0001ee2b', &['\u0644']),
- ('\U0001ee2c', &['\u0645']), ('\U0001ee2d', &['\u0646']), ('\U0001ee2e', &['\u0633']),
- ('\U0001ee2f', &['\u0639']), ('\U0001ee30', &['\u0641']), ('\U0001ee31', &['\u0635']),
- ('\U0001ee32', &['\u0642']), ('\U0001ee34', &['\u0634']), ('\U0001ee35', &['\u062a']),
- ('\U0001ee36', &['\u062b']), ('\U0001ee37', &['\u062e']), ('\U0001ee39', &['\u0636']),
- ('\U0001ee3b', &['\u063a']), ('\U0001ee42', &['\u062c']), ('\U0001ee47', &['\u062d']),
- ('\U0001ee49', &['\u064a']), ('\U0001ee4b', &['\u0644']), ('\U0001ee4d', &['\u0646']),
- ('\U0001ee4e', &['\u0633']), ('\U0001ee4f', &['\u0639']), ('\U0001ee51', &['\u0635']),
- ('\U0001ee52', &['\u0642']), ('\U0001ee54', &['\u0634']), ('\U0001ee57', &['\u062e']),
- ('\U0001ee59', &['\u0636']), ('\U0001ee5b', &['\u063a']), ('\U0001ee5d', &['\u06ba']),
- ('\U0001ee5f', &['\u066f']), ('\U0001ee61', &['\u0628']), ('\U0001ee62', &['\u062c']),
- ('\U0001ee64', &['\u0647']), ('\U0001ee67', &['\u062d']), ('\U0001ee68', &['\u0637']),
- ('\U0001ee69', &['\u064a']), ('\U0001ee6a', &['\u0643']), ('\U0001ee6c', &['\u0645']),
- ('\U0001ee6d', &['\u0646']), ('\U0001ee6e', &['\u0633']), ('\U0001ee6f', &['\u0639']),
- ('\U0001ee70', &['\u0641']), ('\U0001ee71', &['\u0635']), ('\U0001ee72', &['\u0642']),
- ('\U0001ee74', &['\u0634']), ('\U0001ee75', &['\u062a']), ('\U0001ee76', &['\u062b']),
- ('\U0001ee77', &['\u062e']), ('\U0001ee79', &['\u0636']), ('\U0001ee7a', &['\u0638']),
- ('\U0001ee7b', &['\u063a']), ('\U0001ee7c', &['\u066e']), ('\U0001ee7e', &['\u06a1']),
- ('\U0001ee80', &['\u0627']), ('\U0001ee81', &['\u0628']), ('\U0001ee82', &['\u062c']),
- ('\U0001ee83', &['\u062f']), ('\U0001ee84', &['\u0647']), ('\U0001ee85', &['\u0648']),
- ('\U0001ee86', &['\u0632']), ('\U0001ee87', &['\u062d']), ('\U0001ee88', &['\u0637']),
- ('\U0001ee89', &['\u064a']), ('\U0001ee8b', &['\u0644']), ('\U0001ee8c', &['\u0645']),
- ('\U0001ee8d', &['\u0646']), ('\U0001ee8e', &['\u0633']), ('\U0001ee8f', &['\u0639']),
- ('\U0001ee90', &['\u0641']), ('\U0001ee91', &['\u0635']), ('\U0001ee92', &['\u0642']),
- ('\U0001ee93', &['\u0631']), ('\U0001ee94', &['\u0634']), ('\U0001ee95', &['\u062a']),
- ('\U0001ee96', &['\u062b']), ('\U0001ee97', &['\u062e']), ('\U0001ee98', &['\u0630']),
- ('\U0001ee99', &['\u0636']), ('\U0001ee9a', &['\u0638']), ('\U0001ee9b', &['\u063a']),
- ('\U0001eea1', &['\u0628']), ('\U0001eea2', &['\u062c']), ('\U0001eea3', &['\u062f']),
- ('\U0001eea5', &['\u0648']), ('\U0001eea6', &['\u0632']), ('\U0001eea7', &['\u062d']),
- ('\U0001eea8', &['\u0637']), ('\U0001eea9', &['\u064a']), ('\U0001eeab', &['\u0644']),
- ('\U0001eeac', &['\u0645']), ('\U0001eead', &['\u0646']), ('\U0001eeae', &['\u0633']),
- ('\U0001eeaf', &['\u0639']), ('\U0001eeb0', &['\u0641']), ('\U0001eeb1', &['\u0635']),
- ('\U0001eeb2', &['\u0642']), ('\U0001eeb3', &['\u0631']), ('\U0001eeb4', &['\u0634']),
- ('\U0001eeb5', &['\u062a']), ('\U0001eeb6', &['\u062b']), ('\U0001eeb7', &['\u062e']),
- ('\U0001eeb8', &['\u0630']), ('\U0001eeb9', &['\u0636']), ('\U0001eeba', &['\u0638']),
- ('\U0001eebb', &['\u063a']), ('\U0001f100', &['\x30', '\x2e']), ('\U0001f101', &['\x30',
- '\x2c']), ('\U0001f102', &['\x31', '\x2c']), ('\U0001f103', &['\x32', '\x2c']),
- ('\U0001f104', &['\x33', '\x2c']), ('\U0001f105', &['\x34', '\x2c']), ('\U0001f106',
- &['\x35', '\x2c']), ('\U0001f107', &['\x36', '\x2c']), ('\U0001f108', &['\x37', '\x2c']),
- ('\U0001f109', &['\x38', '\x2c']), ('\U0001f10a', &['\x39', '\x2c']), ('\U0001f110',
- &['\x28', '\x41', '\x29']), ('\U0001f111', &['\x28', '\x42', '\x29']), ('\U0001f112',
- &['\x28', '\x43', '\x29']), ('\U0001f113', &['\x28', '\x44', '\x29']), ('\U0001f114',
- &['\x28', '\x45', '\x29']), ('\U0001f115', &['\x28', '\x46', '\x29']), ('\U0001f116',
- &['\x28', '\x47', '\x29']), ('\U0001f117', &['\x28', '\x48', '\x29']), ('\U0001f118',
- &['\x28', '\x49', '\x29']), ('\U0001f119', &['\x28', '\x4a', '\x29']), ('\U0001f11a',
- &['\x28', '\x4b', '\x29']), ('\U0001f11b', &['\x28', '\x4c', '\x29']), ('\U0001f11c',
- &['\x28', '\x4d', '\x29']), ('\U0001f11d', &['\x28', '\x4e', '\x29']), ('\U0001f11e',
- &['\x28', '\x4f', '\x29']), ('\U0001f11f', &['\x28', '\x50', '\x29']), ('\U0001f120',
- &['\x28', '\x51', '\x29']), ('\U0001f121', &['\x28', '\x52', '\x29']), ('\U0001f122',
- &['\x28', '\x53', '\x29']), ('\U0001f123', &['\x28', '\x54', '\x29']), ('\U0001f124',
- &['\x28', '\x55', '\x29']), ('\U0001f125', &['\x28', '\x56', '\x29']), ('\U0001f126',
- &['\x28', '\x57', '\x29']), ('\U0001f127', &['\x28', '\x58', '\x29']), ('\U0001f128',
- &['\x28', '\x59', '\x29']), ('\U0001f129', &['\x28', '\x5a', '\x29']), ('\U0001f12a',
- &['\u3014', '\x53', '\u3015']), ('\U0001f12b', &['\x43']), ('\U0001f12c', &['\x52']),
- ('\U0001f12d', &['\x43', '\x44']), ('\U0001f12e', &['\x57', '\x5a']), ('\U0001f130',
- &['\x41']), ('\U0001f131', &['\x42']), ('\U0001f132', &['\x43']), ('\U0001f133', &['\x44']),
- ('\U0001f134', &['\x45']), ('\U0001f135', &['\x46']), ('\U0001f136', &['\x47']),
- ('\U0001f137', &['\x48']), ('\U0001f138', &['\x49']), ('\U0001f139', &['\x4a']),
- ('\U0001f13a', &['\x4b']), ('\U0001f13b', &['\x4c']), ('\U0001f13c', &['\x4d']),
- ('\U0001f13d', &['\x4e']), ('\U0001f13e', &['\x4f']), ('\U0001f13f', &['\x50']),
- ('\U0001f140', &['\x51']), ('\U0001f141', &['\x52']), ('\U0001f142', &['\x53']),
- ('\U0001f143', &['\x54']), ('\U0001f144', &['\x55']), ('\U0001f145', &['\x56']),
- ('\U0001f146', &['\x57']), ('\U0001f147', &['\x58']), ('\U0001f148', &['\x59']),
- ('\U0001f149', &['\x5a']), ('\U0001f14a', &['\x48', '\x56']), ('\U0001f14b', &['\x4d',
- '\x56']), ('\U0001f14c', &['\x53', '\x44']), ('\U0001f14d', &['\x53', '\x53']),
- ('\U0001f14e', &['\x50', '\x50', '\x56']), ('\U0001f14f', &['\x57', '\x43']), ('\U0001f16a',
- &['\x4d', '\x43']), ('\U0001f16b', &['\x4d', '\x44']), ('\U0001f190', &['\x44', '\x4a']),
- ('\U0001f200', &['\u307b', '\u304b']), ('\U0001f201', &['\u30b3', '\u30b3']), ('\U0001f202',
- &['\u30b5']), ('\U0001f210', &['\u624b']), ('\U0001f211', &['\u5b57']), ('\U0001f212',
- &['\u53cc']), ('\U0001f213', &['\u30c7']), ('\U0001f214', &['\u4e8c']), ('\U0001f215',
- &['\u591a']), ('\U0001f216', &['\u89e3']), ('\U0001f217', &['\u5929']), ('\U0001f218',
- &['\u4ea4']), ('\U0001f219', &['\u6620']), ('\U0001f21a', &['\u7121']), ('\U0001f21b',
- &['\u6599']), ('\U0001f21c', &['\u524d']), ('\U0001f21d', &['\u5f8c']), ('\U0001f21e',
- &['\u518d']), ('\U0001f21f', &['\u65b0']), ('\U0001f220', &['\u521d']), ('\U0001f221',
- &['\u7d42']), ('\U0001f222', &['\u751f']), ('\U0001f223', &['\u8ca9']), ('\U0001f224',
- &['\u58f0']), ('\U0001f225', &['\u5439']), ('\U0001f226', &['\u6f14']), ('\U0001f227',
- &['\u6295']), ('\U0001f228', &['\u6355']), ('\U0001f229', &['\u4e00']), ('\U0001f22a',
- &['\u4e09']), ('\U0001f22b', &['\u904a']), ('\U0001f22c', &['\u5de6']), ('\U0001f22d',
- &['\u4e2d']), ('\U0001f22e', &['\u53f3']), ('\U0001f22f', &['\u6307']), ('\U0001f230',
- &['\u8d70']), ('\U0001f231', &['\u6253']), ('\U0001f232', &['\u7981']), ('\U0001f233',
- &['\u7a7a']), ('\U0001f234', &['\u5408']), ('\U0001f235', &['\u6e80']), ('\U0001f236',
- &['\u6709']), ('\U0001f237', &['\u6708']), ('\U0001f238', &['\u7533']), ('\U0001f239',
- &['\u5272']), ('\U0001f23a', &['\u55b6']), ('\U0001f240', &['\u3014', '\u672c', '\u3015']),
- ('\U0001f241', &['\u3014', '\u4e09', '\u3015']), ('\U0001f242', &['\u3014', '\u4e8c',
- '\u3015']), ('\U0001f243', &['\u3014', '\u5b89', '\u3015']), ('\U0001f244', &['\u3014',
- '\u70b9', '\u3015']), ('\U0001f245', &['\u3014', '\u6253', '\u3015']), ('\U0001f246',
- &['\u3014', '\u76d7', '\u3015']), ('\U0001f247', &['\u3014', '\u52dd', '\u3015']),
- ('\U0001f248', &['\u3014', '\u6557', '\u3015']), ('\U0001f250', &['\u5f97']), ('\U0001f251',
- &['\u53ef'])
- ];
-
static combining_class_table : &'static [(char, char, u8)] = &[
('\u0300', '\u0314', 230), ('\u0315', '\u0315', 232),
('\u0316', '\u0319', 220), ('\u031a', '\u031a', 232),
('\U0001d185', '\U0001d189', 230), ('\U0001d18a', '\U0001d18b', 220),
('\U0001d1aa', '\U0001d1ad', 230), ('\U0001d242', '\U0001d244', 230)
];
- pub fn canonical(c: char, i: |char|) { d(c, i, false); }
-
- pub fn compatibility(c: char, i: |char|) { d(c, i, true); }
pub fn canonical_combining_class(c: char) -> u8 {
bsearch_range_value_table(c, combining_class_table)
}
-
- fn d(c: char, i: |char|, k: bool) {
- use iter::Iterator;
- if c <= '\x7f' { i(c); return; }
-
- match bsearch_table(c, canonical_table) {
- Some(canon) => {
- for x in canon.iter() {
- d(*x, |b| i(b), k);
- }
- return;
- }
- None => ()
- }
-
- if !k { i(c); return; }
-
- match bsearch_table(c, compatibility_table) {
- Some(compat) => {
- for x in compat.iter() {
- d(*x, |b| i(b), k);
- }
- return;
- }
- None => ()
- }
-
- i(c);
- }
-}
-
-pub mod derived_property {
- static Alphabetic_table : &'static [(char,char)] = &[
- ('\x41', '\x5a'), ('\x61', '\x7a'),
- ('\xaa', '\xaa'), ('\xb5', '\xb5'),
- ('\xba', '\xba'), ('\xc0', '\xd6'),
- ('\xd8', '\xf6'), ('\xf8', '\u01ba'),
- ('\u01bb', '\u01bb'), ('\u01bc', '\u01bf'),
- ('\u01c0', '\u01c3'), ('\u01c4', '\u0293'),
- ('\u0294', '\u0294'), ('\u0295', '\u02af'),
- ('\u02b0', '\u02c1'), ('\u02c6', '\u02d1'),
- ('\u02e0', '\u02e4'), ('\u02ec', '\u02ec'),
- ('\u02ee', '\u02ee'), ('\u0345', '\u0345'),
- ('\u0370', '\u0373'), ('\u0374', '\u0374'),
- ('\u0376', '\u0377'), ('\u037a', '\u037a'),
- ('\u037b', '\u037d'), ('\u0386', '\u0386'),
- ('\u0388', '\u038a'), ('\u038c', '\u038c'),
- ('\u038e', '\u03a1'), ('\u03a3', '\u03f5'),
- ('\u03f7', '\u0481'), ('\u048a', '\u0527'),
- ('\u0531', '\u0556'), ('\u0559', '\u0559'),
- ('\u0561', '\u0587'), ('\u05b0', '\u05bd'),
- ('\u05bf', '\u05bf'), ('\u05c1', '\u05c2'),
- ('\u05c4', '\u05c5'), ('\u05c7', '\u05c7'),
- ('\u05d0', '\u05ea'), ('\u05f0', '\u05f2'),
- ('\u0610', '\u061a'), ('\u0620', '\u063f'),
- ('\u0640', '\u0640'), ('\u0641', '\u064a'),
- ('\u064b', '\u0657'), ('\u0659', '\u065f'),
- ('\u066e', '\u066f'), ('\u0670', '\u0670'),
- ('\u0671', '\u06d3'), ('\u06d5', '\u06d5'),
- ('\u06d6', '\u06dc'), ('\u06e1', '\u06e4'),
- ('\u06e5', '\u06e6'), ('\u06e7', '\u06e8'),
- ('\u06ed', '\u06ed'), ('\u06ee', '\u06ef'),
- ('\u06fa', '\u06fc'), ('\u06ff', '\u06ff'),
- ('\u0710', '\u0710'), ('\u0711', '\u0711'),
- ('\u0712', '\u072f'), ('\u0730', '\u073f'),
- ('\u074d', '\u07a5'), ('\u07a6', '\u07b0'),
- ('\u07b1', '\u07b1'), ('\u07ca', '\u07ea'),
- ('\u07f4', '\u07f5'), ('\u07fa', '\u07fa'),
- ('\u0800', '\u0815'), ('\u0816', '\u0817'),
- ('\u081a', '\u081a'), ('\u081b', '\u0823'),
- ('\u0824', '\u0824'), ('\u0825', '\u0827'),
- ('\u0828', '\u0828'), ('\u0829', '\u082c'),
- ('\u0840', '\u0858'), ('\u08a0', '\u08a0'),
- ('\u08a2', '\u08ac'), ('\u08e4', '\u08e9'),
- ('\u08f0', '\u08fe'), ('\u0900', '\u0902'),
- ('\u0903', '\u0903'), ('\u0904', '\u0939'),
- ('\u093a', '\u093a'), ('\u093b', '\u093b'),
- ('\u093d', '\u093d'), ('\u093e', '\u0940'),
- ('\u0941', '\u0948'), ('\u0949', '\u094c'),
- ('\u094e', '\u094f'), ('\u0950', '\u0950'),
- ('\u0955', '\u0957'), ('\u0958', '\u0961'),
- ('\u0962', '\u0963'), ('\u0971', '\u0971'),
- ('\u0972', '\u0977'), ('\u0979', '\u097f'),
- ('\u0981', '\u0981'), ('\u0982', '\u0983'),
- ('\u0985', '\u098c'), ('\u098f', '\u0990'),
- ('\u0993', '\u09a8'), ('\u09aa', '\u09b0'),
- ('\u09b2', '\u09b2'), ('\u09b6', '\u09b9'),
- ('\u09bd', '\u09bd'), ('\u09be', '\u09c0'),
- ('\u09c1', '\u09c4'), ('\u09c7', '\u09c8'),
- ('\u09cb', '\u09cc'), ('\u09ce', '\u09ce'),
- ('\u09d7', '\u09d7'), ('\u09dc', '\u09dd'),
- ('\u09df', '\u09e1'), ('\u09e2', '\u09e3'),
- ('\u09f0', '\u09f1'), ('\u0a01', '\u0a02'),
- ('\u0a03', '\u0a03'), ('\u0a05', '\u0a0a'),
- ('\u0a0f', '\u0a10'), ('\u0a13', '\u0a28'),
- ('\u0a2a', '\u0a30'), ('\u0a32', '\u0a33'),
- ('\u0a35', '\u0a36'), ('\u0a38', '\u0a39'),
- ('\u0a3e', '\u0a40'), ('\u0a41', '\u0a42'),
- ('\u0a47', '\u0a48'), ('\u0a4b', '\u0a4c'),
- ('\u0a51', '\u0a51'), ('\u0a59', '\u0a5c'),
- ('\u0a5e', '\u0a5e'), ('\u0a70', '\u0a71'),
- ('\u0a72', '\u0a74'), ('\u0a75', '\u0a75'),
- ('\u0a81', '\u0a82'), ('\u0a83', '\u0a83'),
- ('\u0a85', '\u0a8d'), ('\u0a8f', '\u0a91'),
- ('\u0a93', '\u0aa8'), ('\u0aaa', '\u0ab0'),
- ('\u0ab2', '\u0ab3'), ('\u0ab5', '\u0ab9'),
- ('\u0abd', '\u0abd'), ('\u0abe', '\u0ac0'),
- ('\u0ac1', '\u0ac5'), ('\u0ac7', '\u0ac8'),
- ('\u0ac9', '\u0ac9'), ('\u0acb', '\u0acc'),
- ('\u0ad0', '\u0ad0'), ('\u0ae0', '\u0ae1'),
- ('\u0ae2', '\u0ae3'), ('\u0b01', '\u0b01'),
- ('\u0b02', '\u0b03'), ('\u0b05', '\u0b0c'),
- ('\u0b0f', '\u0b10'), ('\u0b13', '\u0b28'),
- ('\u0b2a', '\u0b30'), ('\u0b32', '\u0b33'),
- ('\u0b35', '\u0b39'), ('\u0b3d', '\u0b3d'),
- ('\u0b3e', '\u0b3e'), ('\u0b3f', '\u0b3f'),
- ('\u0b40', '\u0b40'), ('\u0b41', '\u0b44'),
- ('\u0b47', '\u0b48'), ('\u0b4b', '\u0b4c'),
- ('\u0b56', '\u0b56'), ('\u0b57', '\u0b57'),
- ('\u0b5c', '\u0b5d'), ('\u0b5f', '\u0b61'),
- ('\u0b62', '\u0b63'), ('\u0b71', '\u0b71'),
- ('\u0b82', '\u0b82'), ('\u0b83', '\u0b83'),
- ('\u0b85', '\u0b8a'), ('\u0b8e', '\u0b90'),
- ('\u0b92', '\u0b95'), ('\u0b99', '\u0b9a'),
- ('\u0b9c', '\u0b9c'), ('\u0b9e', '\u0b9f'),
- ('\u0ba3', '\u0ba4'), ('\u0ba8', '\u0baa'),
- ('\u0bae', '\u0bb9'), ('\u0bbe', '\u0bbf'),
- ('\u0bc0', '\u0bc0'), ('\u0bc1', '\u0bc2'),
- ('\u0bc6', '\u0bc8'), ('\u0bca', '\u0bcc'),
- ('\u0bd0', '\u0bd0'), ('\u0bd7', '\u0bd7'),
- ('\u0c01', '\u0c03'), ('\u0c05', '\u0c0c'),
- ('\u0c0e', '\u0c10'), ('\u0c12', '\u0c28'),
- ('\u0c2a', '\u0c33'), ('\u0c35', '\u0c39'),
- ('\u0c3d', '\u0c3d'), ('\u0c3e', '\u0c40'),
- ('\u0c41', '\u0c44'), ('\u0c46', '\u0c48'),
- ('\u0c4a', '\u0c4c'), ('\u0c55', '\u0c56'),
- ('\u0c58', '\u0c59'), ('\u0c60', '\u0c61'),
- ('\u0c62', '\u0c63'), ('\u0c82', '\u0c83'),
- ('\u0c85', '\u0c8c'), ('\u0c8e', '\u0c90'),
- ('\u0c92', '\u0ca8'), ('\u0caa', '\u0cb3'),
- ('\u0cb5', '\u0cb9'), ('\u0cbd', '\u0cbd'),
- ('\u0cbe', '\u0cbe'), ('\u0cbf', '\u0cbf'),
- ('\u0cc0', '\u0cc4'), ('\u0cc6', '\u0cc6'),
- ('\u0cc7', '\u0cc8'), ('\u0cca', '\u0ccb'),
- ('\u0ccc', '\u0ccc'), ('\u0cd5', '\u0cd6'),
- ('\u0cde', '\u0cde'), ('\u0ce0', '\u0ce1'),
- ('\u0ce2', '\u0ce3'), ('\u0cf1', '\u0cf2'),
- ('\u0d02', '\u0d03'), ('\u0d05', '\u0d0c'),
- ('\u0d0e', '\u0d10'), ('\u0d12', '\u0d3a'),
- ('\u0d3d', '\u0d3d'), ('\u0d3e', '\u0d40'),
- ('\u0d41', '\u0d44'), ('\u0d46', '\u0d48'),
- ('\u0d4a', '\u0d4c'), ('\u0d4e', '\u0d4e'),
- ('\u0d57', '\u0d57'), ('\u0d60', '\u0d61'),
- ('\u0d62', '\u0d63'), ('\u0d7a', '\u0d7f'),
- ('\u0d82', '\u0d83'), ('\u0d85', '\u0d96'),
- ('\u0d9a', '\u0db1'), ('\u0db3', '\u0dbb'),
- ('\u0dbd', '\u0dbd'), ('\u0dc0', '\u0dc6'),
- ('\u0dcf', '\u0dd1'), ('\u0dd2', '\u0dd4'),
- ('\u0dd6', '\u0dd6'), ('\u0dd8', '\u0ddf'),
- ('\u0df2', '\u0df3'), ('\u0e01', '\u0e30'),
- ('\u0e31', '\u0e31'), ('\u0e32', '\u0e33'),
- ('\u0e34', '\u0e3a'), ('\u0e40', '\u0e45'),
- ('\u0e46', '\u0e46'), ('\u0e4d', '\u0e4d'),
- ('\u0e81', '\u0e82'), ('\u0e84', '\u0e84'),
- ('\u0e87', '\u0e88'), ('\u0e8a', '\u0e8a'),
- ('\u0e8d', '\u0e8d'), ('\u0e94', '\u0e97'),
- ('\u0e99', '\u0e9f'), ('\u0ea1', '\u0ea3'),
- ('\u0ea5', '\u0ea5'), ('\u0ea7', '\u0ea7'),
- ('\u0eaa', '\u0eab'), ('\u0ead', '\u0eb0'),
- ('\u0eb1', '\u0eb1'), ('\u0eb2', '\u0eb3'),
- ('\u0eb4', '\u0eb9'), ('\u0ebb', '\u0ebc'),
- ('\u0ebd', '\u0ebd'), ('\u0ec0', '\u0ec4'),
- ('\u0ec6', '\u0ec6'), ('\u0ecd', '\u0ecd'),
- ('\u0edc', '\u0edf'), ('\u0f00', '\u0f00'),
- ('\u0f40', '\u0f47'), ('\u0f49', '\u0f6c'),
- ('\u0f71', '\u0f7e'), ('\u0f7f', '\u0f7f'),
- ('\u0f80', '\u0f81'), ('\u0f88', '\u0f8c'),
- ('\u0f8d', '\u0f97'), ('\u0f99', '\u0fbc'),
- ('\u1000', '\u102a'), ('\u102b', '\u102c'),
- ('\u102d', '\u1030'), ('\u1031', '\u1031'),
- ('\u1032', '\u1036'), ('\u1038', '\u1038'),
- ('\u103b', '\u103c'), ('\u103d', '\u103e'),
- ('\u103f', '\u103f'), ('\u1050', '\u1055'),
- ('\u1056', '\u1057'), ('\u1058', '\u1059'),
- ('\u105a', '\u105d'), ('\u105e', '\u1060'),
- ('\u1061', '\u1061'), ('\u1062', '\u1062'),
- ('\u1065', '\u1066'), ('\u1067', '\u1068'),
- ('\u106e', '\u1070'), ('\u1071', '\u1074'),
- ('\u1075', '\u1081'), ('\u1082', '\u1082'),
- ('\u1083', '\u1084'), ('\u1085', '\u1086'),
- ('\u108e', '\u108e'), ('\u109c', '\u109c'),
- ('\u109d', '\u109d'), ('\u10a0', '\u10c5'),
- ('\u10c7', '\u10c7'), ('\u10cd', '\u10cd'),
- ('\u10d0', '\u10fa'), ('\u10fc', '\u10fc'),
- ('\u10fd', '\u1248'), ('\u124a', '\u124d'),
- ('\u1250', '\u1256'), ('\u1258', '\u1258'),
- ('\u125a', '\u125d'), ('\u1260', '\u1288'),
- ('\u128a', '\u128d'), ('\u1290', '\u12b0'),
- ('\u12b2', '\u12b5'), ('\u12b8', '\u12be'),
- ('\u12c0', '\u12c0'), ('\u12c2', '\u12c5'),
- ('\u12c8', '\u12d6'), ('\u12d8', '\u1310'),
- ('\u1312', '\u1315'), ('\u1318', '\u135a'),
- ('\u135f', '\u135f'), ('\u1380', '\u138f'),
- ('\u13a0', '\u13f4'), ('\u1401', '\u166c'),
- ('\u166f', '\u167f'), ('\u1681', '\u169a'),
- ('\u16a0', '\u16ea'), ('\u16ee', '\u16f0'),
- ('\u1700', '\u170c'), ('\u170e', '\u1711'),
- ('\u1712', '\u1713'), ('\u1720', '\u1731'),
- ('\u1732', '\u1733'), ('\u1740', '\u1751'),
- ('\u1752', '\u1753'), ('\u1760', '\u176c'),
- ('\u176e', '\u1770'), ('\u1772', '\u1773'),
- ('\u1780', '\u17b3'), ('\u17b6', '\u17b6'),
- ('\u17b7', '\u17bd'), ('\u17be', '\u17c5'),
- ('\u17c6', '\u17c6'), ('\u17c7', '\u17c8'),
- ('\u17d7', '\u17d7'), ('\u17dc', '\u17dc'),
- ('\u1820', '\u1842'), ('\u1843', '\u1843'),
- ('\u1844', '\u1877'), ('\u1880', '\u18a8'),
- ('\u18a9', '\u18a9'), ('\u18aa', '\u18aa'),
- ('\u18b0', '\u18f5'), ('\u1900', '\u191c'),
- ('\u1920', '\u1922'), ('\u1923', '\u1926'),
- ('\u1927', '\u1928'), ('\u1929', '\u192b'),
- ('\u1930', '\u1931'), ('\u1932', '\u1932'),
- ('\u1933', '\u1938'), ('\u1950', '\u196d'),
- ('\u1970', '\u1974'), ('\u1980', '\u19ab'),
- ('\u19b0', '\u19c0'), ('\u19c1', '\u19c7'),
- ('\u19c8', '\u19c9'), ('\u1a00', '\u1a16'),
- ('\u1a17', '\u1a18'), ('\u1a19', '\u1a1a'),
- ('\u1a1b', '\u1a1b'), ('\u1a20', '\u1a54'),
- ('\u1a55', '\u1a55'), ('\u1a56', '\u1a56'),
- ('\u1a57', '\u1a57'), ('\u1a58', '\u1a5e'),
- ('\u1a61', '\u1a61'), ('\u1a62', '\u1a62'),
- ('\u1a63', '\u1a64'), ('\u1a65', '\u1a6c'),
- ('\u1a6d', '\u1a72'), ('\u1a73', '\u1a74'),
- ('\u1aa7', '\u1aa7'), ('\u1b00', '\u1b03'),
- ('\u1b04', '\u1b04'), ('\u1b05', '\u1b33'),
- ('\u1b35', '\u1b35'), ('\u1b36', '\u1b3a'),
- ('\u1b3b', '\u1b3b'), ('\u1b3c', '\u1b3c'),
- ('\u1b3d', '\u1b41'), ('\u1b42', '\u1b42'),
- ('\u1b43', '\u1b43'), ('\u1b45', '\u1b4b'),
- ('\u1b80', '\u1b81'), ('\u1b82', '\u1b82'),
- ('\u1b83', '\u1ba0'), ('\u1ba1', '\u1ba1'),
- ('\u1ba2', '\u1ba5'), ('\u1ba6', '\u1ba7'),
- ('\u1ba8', '\u1ba9'), ('\u1bac', '\u1bad'),
- ('\u1bae', '\u1baf'), ('\u1bba', '\u1be5'),
- ('\u1be7', '\u1be7'), ('\u1be8', '\u1be9'),
- ('\u1bea', '\u1bec'), ('\u1bed', '\u1bed'),
- ('\u1bee', '\u1bee'), ('\u1bef', '\u1bf1'),
- ('\u1c00', '\u1c23'), ('\u1c24', '\u1c2b'),
- ('\u1c2c', '\u1c33'), ('\u1c34', '\u1c35'),
- ('\u1c4d', '\u1c4f'), ('\u1c5a', '\u1c77'),
- ('\u1c78', '\u1c7d'), ('\u1ce9', '\u1cec'),
- ('\u1cee', '\u1cf1'), ('\u1cf2', '\u1cf3'),
- ('\u1cf5', '\u1cf6'), ('\u1d00', '\u1d2b'),
- ('\u1d2c', '\u1d6a'), ('\u1d6b', '\u1d77'),
- ('\u1d78', '\u1d78'), ('\u1d79', '\u1d9a'),
- ('\u1d9b', '\u1dbf'), ('\u1e00', '\u1f15'),
- ('\u1f18', '\u1f1d'), ('\u1f20', '\u1f45'),
- ('\u1f48', '\u1f4d'), ('\u1f50', '\u1f57'),
- ('\u1f59', '\u1f59'), ('\u1f5b', '\u1f5b'),
- ('\u1f5d', '\u1f5d'), ('\u1f5f', '\u1f7d'),
- ('\u1f80', '\u1fb4'), ('\u1fb6', '\u1fbc'),
- ('\u1fbe', '\u1fbe'), ('\u1fc2', '\u1fc4'),
- ('\u1fc6', '\u1fcc'), ('\u1fd0', '\u1fd3'),
- ('\u1fd6', '\u1fdb'), ('\u1fe0', '\u1fec'),
- ('\u1ff2', '\u1ff4'), ('\u1ff6', '\u1ffc'),
- ('\u2071', '\u2071'), ('\u207f', '\u207f'),
- ('\u2090', '\u209c'), ('\u2102', '\u2102'),
- ('\u2107', '\u2107'), ('\u210a', '\u2113'),
- ('\u2115', '\u2115'), ('\u2119', '\u211d'),
- ('\u2124', '\u2124'), ('\u2126', '\u2126'),
- ('\u2128', '\u2128'), ('\u212a', '\u212d'),
- ('\u212f', '\u2134'), ('\u2135', '\u2138'),
- ('\u2139', '\u2139'), ('\u213c', '\u213f'),
- ('\u2145', '\u2149'), ('\u214e', '\u214e'),
- ('\u2160', '\u2182'), ('\u2183', '\u2184'),
- ('\u2185', '\u2188'), ('\u24b6', '\u24e9'),
- ('\u2c00', '\u2c2e'), ('\u2c30', '\u2c5e'),
- ('\u2c60', '\u2c7b'), ('\u2c7c', '\u2c7d'),
- ('\u2c7e', '\u2ce4'), ('\u2ceb', '\u2cee'),
- ('\u2cf2', '\u2cf3'), ('\u2d00', '\u2d25'),
- ('\u2d27', '\u2d27'), ('\u2d2d', '\u2d2d'),
- ('\u2d30', '\u2d67'), ('\u2d6f', '\u2d6f'),
- ('\u2d80', '\u2d96'), ('\u2da0', '\u2da6'),
- ('\u2da8', '\u2dae'), ('\u2db0', '\u2db6'),
- ('\u2db8', '\u2dbe'), ('\u2dc0', '\u2dc6'),
- ('\u2dc8', '\u2dce'), ('\u2dd0', '\u2dd6'),
- ('\u2dd8', '\u2dde'), ('\u2de0', '\u2dff'),
- ('\u2e2f', '\u2e2f'), ('\u3005', '\u3005'),
- ('\u3006', '\u3006'), ('\u3007', '\u3007'),
- ('\u3021', '\u3029'), ('\u3031', '\u3035'),
- ('\u3038', '\u303a'), ('\u303b', '\u303b'),
- ('\u303c', '\u303c'), ('\u3041', '\u3096'),
- ('\u309d', '\u309e'), ('\u309f', '\u309f'),
- ('\u30a1', '\u30fa'), ('\u30fc', '\u30fe'),
- ('\u30ff', '\u30ff'), ('\u3105', '\u312d'),
- ('\u3131', '\u318e'), ('\u31a0', '\u31ba'),
- ('\u31f0', '\u31ff'), ('\u3400', '\u4db5'),
- ('\u4e00', '\u9fcc'), ('\ua000', '\ua014'),
- ('\ua015', '\ua015'), ('\ua016', '\ua48c'),
- ('\ua4d0', '\ua4f7'), ('\ua4f8', '\ua4fd'),
- ('\ua500', '\ua60b'), ('\ua60c', '\ua60c'),
- ('\ua610', '\ua61f'), ('\ua62a', '\ua62b'),
- ('\ua640', '\ua66d'), ('\ua66e', '\ua66e'),
- ('\ua674', '\ua67b'), ('\ua67f', '\ua67f'),
- ('\ua680', '\ua697'), ('\ua69f', '\ua69f'),
- ('\ua6a0', '\ua6e5'), ('\ua6e6', '\ua6ef'),
- ('\ua717', '\ua71f'), ('\ua722', '\ua76f'),
- ('\ua770', '\ua770'), ('\ua771', '\ua787'),
- ('\ua788', '\ua788'), ('\ua78b', '\ua78e'),
- ('\ua790', '\ua793'), ('\ua7a0', '\ua7aa'),
- ('\ua7f8', '\ua7f9'), ('\ua7fa', '\ua7fa'),
- ('\ua7fb', '\ua801'), ('\ua803', '\ua805'),
- ('\ua807', '\ua80a'), ('\ua80c', '\ua822'),
- ('\ua823', '\ua824'), ('\ua825', '\ua826'),
- ('\ua827', '\ua827'), ('\ua840', '\ua873'),
- ('\ua880', '\ua881'), ('\ua882', '\ua8b3'),
- ('\ua8b4', '\ua8c3'), ('\ua8f2', '\ua8f7'),
- ('\ua8fb', '\ua8fb'), ('\ua90a', '\ua925'),
- ('\ua926', '\ua92a'), ('\ua930', '\ua946'),
- ('\ua947', '\ua951'), ('\ua952', '\ua952'),
- ('\ua960', '\ua97c'), ('\ua980', '\ua982'),
- ('\ua983', '\ua983'), ('\ua984', '\ua9b2'),
- ('\ua9b4', '\ua9b5'), ('\ua9b6', '\ua9b9'),
- ('\ua9ba', '\ua9bb'), ('\ua9bc', '\ua9bc'),
- ('\ua9bd', '\ua9bf'), ('\ua9cf', '\ua9cf'),
- ('\uaa00', '\uaa28'), ('\uaa29', '\uaa2e'),
- ('\uaa2f', '\uaa30'), ('\uaa31', '\uaa32'),
- ('\uaa33', '\uaa34'), ('\uaa35', '\uaa36'),
- ('\uaa40', '\uaa42'), ('\uaa43', '\uaa43'),
- ('\uaa44', '\uaa4b'), ('\uaa4c', '\uaa4c'),
- ('\uaa4d', '\uaa4d'), ('\uaa60', '\uaa6f'),
- ('\uaa70', '\uaa70'), ('\uaa71', '\uaa76'),
- ('\uaa7a', '\uaa7a'), ('\uaa80', '\uaaaf'),
- ('\uaab0', '\uaab0'), ('\uaab1', '\uaab1'),
- ('\uaab2', '\uaab4'), ('\uaab5', '\uaab6'),
- ('\uaab7', '\uaab8'), ('\uaab9', '\uaabd'),
- ('\uaabe', '\uaabe'), ('\uaac0', '\uaac0'),
- ('\uaac2', '\uaac2'), ('\uaadb', '\uaadc'),
- ('\uaadd', '\uaadd'), ('\uaae0', '\uaaea'),
- ('\uaaeb', '\uaaeb'), ('\uaaec', '\uaaed'),
- ('\uaaee', '\uaaef'), ('\uaaf2', '\uaaf2'),
- ('\uaaf3', '\uaaf4'), ('\uaaf5', '\uaaf5'),
- ('\uab01', '\uab06'), ('\uab09', '\uab0e'),
- ('\uab11', '\uab16'), ('\uab20', '\uab26'),
- ('\uab28', '\uab2e'), ('\uabc0', '\uabe2'),
- ('\uabe3', '\uabe4'), ('\uabe5', '\uabe5'),
- ('\uabe6', '\uabe7'), ('\uabe8', '\uabe8'),
- ('\uabe9', '\uabea'), ('\uac00', '\ud7a3'),
- ('\ud7b0', '\ud7c6'), ('\ud7cb', '\ud7fb'),
- ('\uf900', '\ufa6d'), ('\ufa70', '\ufad9'),
- ('\ufb00', '\ufb06'), ('\ufb13', '\ufb17'),
- ('\ufb1d', '\ufb1d'), ('\ufb1e', '\ufb1e'),
- ('\ufb1f', '\ufb28'), ('\ufb2a', '\ufb36'),
- ('\ufb38', '\ufb3c'), ('\ufb3e', '\ufb3e'),
- ('\ufb40', '\ufb41'), ('\ufb43', '\ufb44'),
- ('\ufb46', '\ufbb1'), ('\ufbd3', '\ufd3d'),
- ('\ufd50', '\ufd8f'), ('\ufd92', '\ufdc7'),
- ('\ufdf0', '\ufdfb'), ('\ufe70', '\ufe74'),
- ('\ufe76', '\ufefc'), ('\uff21', '\uff3a'),
- ('\uff41', '\uff5a'), ('\uff66', '\uff6f'),
- ('\uff70', '\uff70'), ('\uff71', '\uff9d'),
- ('\uff9e', '\uff9f'), ('\uffa0', '\uffbe'),
- ('\uffc2', '\uffc7'), ('\uffca', '\uffcf'),
- ('\uffd2', '\uffd7'), ('\uffda', '\uffdc'),
- ('\U00010000', '\U0001000b'), ('\U0001000d', '\U00010026'),
- ('\U00010028', '\U0001003a'), ('\U0001003c', '\U0001003d'),
- ('\U0001003f', '\U0001004d'), ('\U00010050', '\U0001005d'),
- ('\U00010080', '\U000100fa'), ('\U00010140', '\U00010174'),
- ('\U00010280', '\U0001029c'), ('\U000102a0', '\U000102d0'),
- ('\U00010300', '\U0001031e'), ('\U00010330', '\U00010340'),
- ('\U00010341', '\U00010341'), ('\U00010342', '\U00010349'),
- ('\U0001034a', '\U0001034a'), ('\U00010380', '\U0001039d'),
- ('\U000103a0', '\U000103c3'), ('\U000103c8', '\U000103cf'),
- ('\U000103d1', '\U000103d5'), ('\U00010400', '\U0001044f'),
- ('\U00010450', '\U0001049d'), ('\U00010800', '\U00010805'),
- ('\U00010808', '\U00010808'), ('\U0001080a', '\U00010835'),
- ('\U00010837', '\U00010838'), ('\U0001083c', '\U0001083c'),
- ('\U0001083f', '\U00010855'), ('\U00010900', '\U00010915'),
- ('\U00010920', '\U00010939'), ('\U00010980', '\U000109b7'),
- ('\U000109be', '\U000109bf'), ('\U00010a00', '\U00010a00'),
- ('\U00010a01', '\U00010a03'), ('\U00010a05', '\U00010a06'),
- ('\U00010a0c', '\U00010a0f'), ('\U00010a10', '\U00010a13'),
- ('\U00010a15', '\U00010a17'), ('\U00010a19', '\U00010a33'),
- ('\U00010a60', '\U00010a7c'), ('\U00010b00', '\U00010b35'),
- ('\U00010b40', '\U00010b55'), ('\U00010b60', '\U00010b72'),
- ('\U00010c00', '\U00010c48'), ('\U00011000', '\U00011000'),
- ('\U00011001', '\U00011001'), ('\U00011002', '\U00011002'),
- ('\U00011003', '\U00011037'), ('\U00011038', '\U00011045'),
- ('\U00011082', '\U00011082'), ('\U00011083', '\U000110af'),
- ('\U000110b0', '\U000110b2'), ('\U000110b3', '\U000110b6'),
- ('\U000110b7', '\U000110b8'), ('\U000110d0', '\U000110e8'),
- ('\U00011100', '\U00011102'), ('\U00011103', '\U00011126'),
- ('\U00011127', '\U0001112b'), ('\U0001112c', '\U0001112c'),
- ('\U0001112d', '\U00011132'), ('\U00011180', '\U00011181'),
- ('\U00011182', '\U00011182'), ('\U00011183', '\U000111b2'),
- ('\U000111b3', '\U000111b5'), ('\U000111b6', '\U000111be'),
- ('\U000111bf', '\U000111bf'), ('\U000111c1', '\U000111c4'),
- ('\U00011680', '\U000116aa'), ('\U000116ab', '\U000116ab'),
- ('\U000116ac', '\U000116ac'), ('\U000116ad', '\U000116ad'),
- ('\U000116ae', '\U000116af'), ('\U000116b0', '\U000116b5'),
- ('\U00012000', '\U0001236e'), ('\U00012400', '\U00012462'),
- ('\U00013000', '\U0001342e'), ('\U00016800', '\U00016a38'),
- ('\U00016f00', '\U00016f44'), ('\U00016f50', '\U00016f50'),
- ('\U00016f51', '\U00016f7e'), ('\U00016f93', '\U00016f9f'),
- ('\U0001b000', '\U0001b001'), ('\U0001d400', '\U0001d454'),
- ('\U0001d456', '\U0001d49c'), ('\U0001d49e', '\U0001d49f'),
- ('\U0001d4a2', '\U0001d4a2'), ('\U0001d4a5', '\U0001d4a6'),
- ('\U0001d4a9', '\U0001d4ac'), ('\U0001d4ae', '\U0001d4b9'),
- ('\U0001d4bb', '\U0001d4bb'), ('\U0001d4bd', '\U0001d4c3'),
- ('\U0001d4c5', '\U0001d505'), ('\U0001d507', '\U0001d50a'),
- ('\U0001d50d', '\U0001d514'), ('\U0001d516', '\U0001d51c'),
- ('\U0001d51e', '\U0001d539'), ('\U0001d53b', '\U0001d53e'),
- ('\U0001d540', '\U0001d544'), ('\U0001d546', '\U0001d546'),
- ('\U0001d54a', '\U0001d550'), ('\U0001d552', '\U0001d6a5'),
- ('\U0001d6a8', '\U0001d6c0'), ('\U0001d6c2', '\U0001d6da'),
- ('\U0001d6dc', '\U0001d6fa'), ('\U0001d6fc', '\U0001d714'),
- ('\U0001d716', '\U0001d734'), ('\U0001d736', '\U0001d74e'),
- ('\U0001d750', '\U0001d76e'), ('\U0001d770', '\U0001d788'),
- ('\U0001d78a', '\U0001d7a8'), ('\U0001d7aa', '\U0001d7c2'),
- ('\U0001d7c4', '\U0001d7cb'), ('\U0001ee00', '\U0001ee03'),
- ('\U0001ee05', '\U0001ee1f'), ('\U0001ee21', '\U0001ee22'),
- ('\U0001ee24', '\U0001ee24'), ('\U0001ee27', '\U0001ee27'),
- ('\U0001ee29', '\U0001ee32'), ('\U0001ee34', '\U0001ee37'),
- ('\U0001ee39', '\U0001ee39'), ('\U0001ee3b', '\U0001ee3b'),
- ('\U0001ee42', '\U0001ee42'), ('\U0001ee47', '\U0001ee47'),
- ('\U0001ee49', '\U0001ee49'), ('\U0001ee4b', '\U0001ee4b'),
- ('\U0001ee4d', '\U0001ee4f'), ('\U0001ee51', '\U0001ee52'),
- ('\U0001ee54', '\U0001ee54'), ('\U0001ee57', '\U0001ee57'),
- ('\U0001ee59', '\U0001ee59'), ('\U0001ee5b', '\U0001ee5b'),
- ('\U0001ee5d', '\U0001ee5d'), ('\U0001ee5f', '\U0001ee5f'),
- ('\U0001ee61', '\U0001ee62'), ('\U0001ee64', '\U0001ee64'),
- ('\U0001ee67', '\U0001ee6a'), ('\U0001ee6c', '\U0001ee72'),
- ('\U0001ee74', '\U0001ee77'), ('\U0001ee79', '\U0001ee7c'),
- ('\U0001ee7e', '\U0001ee7e'), ('\U0001ee80', '\U0001ee89'),
- ('\U0001ee8b', '\U0001ee9b'), ('\U0001eea1', '\U0001eea3'),
- ('\U0001eea5', '\U0001eea9'), ('\U0001eeab', '\U0001eebb'),
- ('\U00020000', '\U0002a6d6'), ('\U0002a700', '\U0002b734'),
- ('\U0002b740', '\U0002b81d'), ('\U0002f800', '\U0002fa1d')
- ];
-
- pub fn Alphabetic(c: char) -> bool {
- super::bsearch_range_table(c, Alphabetic_table)
- }
-
- static Lowercase_table : &'static [(char,char)] = &[
- ('\x61', '\x7a'), ('\xaa', '\xaa'),
- ('\xb5', '\xb5'), ('\xba', '\xba'),
- ('\xdf', '\xf6'), ('\xf8', '\xff'),
- ('\u0101', '\u0101'), ('\u0103', '\u0103'),
- ('\u0105', '\u0105'), ('\u0107', '\u0107'),
- ('\u0109', '\u0109'), ('\u010b', '\u010b'),
- ('\u010d', '\u010d'), ('\u010f', '\u010f'),
- ('\u0111', '\u0111'), ('\u0113', '\u0113'),
- ('\u0115', '\u0115'), ('\u0117', '\u0117'),
- ('\u0119', '\u0119'), ('\u011b', '\u011b'),
- ('\u011d', '\u011d'), ('\u011f', '\u011f'),
- ('\u0121', '\u0121'), ('\u0123', '\u0123'),
- ('\u0125', '\u0125'), ('\u0127', '\u0127'),
- ('\u0129', '\u0129'), ('\u012b', '\u012b'),
- ('\u012d', '\u012d'), ('\u012f', '\u012f'),
- ('\u0131', '\u0131'), ('\u0133', '\u0133'),
- ('\u0135', '\u0135'), ('\u0137', '\u0138'),
- ('\u013a', '\u013a'), ('\u013c', '\u013c'),
- ('\u013e', '\u013e'), ('\u0140', '\u0140'),
- ('\u0142', '\u0142'), ('\u0144', '\u0144'),
- ('\u0146', '\u0146'), ('\u0148', '\u0149'),
- ('\u014b', '\u014b'), ('\u014d', '\u014d'),
- ('\u014f', '\u014f'), ('\u0151', '\u0151'),
- ('\u0153', '\u0153'), ('\u0155', '\u0155'),
- ('\u0157', '\u0157'), ('\u0159', '\u0159'),
- ('\u015b', '\u015b'), ('\u015d', '\u015d'),
- ('\u015f', '\u015f'), ('\u0161', '\u0161'),
- ('\u0163', '\u0163'), ('\u0165', '\u0165'),
- ('\u0167', '\u0167'), ('\u0169', '\u0169'),
- ('\u016b', '\u016b'), ('\u016d', '\u016d'),
- ('\u016f', '\u016f'), ('\u0171', '\u0171'),
- ('\u0173', '\u0173'), ('\u0175', '\u0175'),
- ('\u0177', '\u0177'), ('\u017a', '\u017a'),
- ('\u017c', '\u017c'), ('\u017e', '\u0180'),
- ('\u0183', '\u0183'), ('\u0185', '\u0185'),
- ('\u0188', '\u0188'), ('\u018c', '\u018d'),
- ('\u0192', '\u0192'), ('\u0195', '\u0195'),
- ('\u0199', '\u019b'), ('\u019e', '\u019e'),
- ('\u01a1', '\u01a1'), ('\u01a3', '\u01a3'),
- ('\u01a5', '\u01a5'), ('\u01a8', '\u01a8'),
- ('\u01aa', '\u01ab'), ('\u01ad', '\u01ad'),
- ('\u01b0', '\u01b0'), ('\u01b4', '\u01b4'),
- ('\u01b6', '\u01b6'), ('\u01b9', '\u01ba'),
- ('\u01bd', '\u01bf'), ('\u01c6', '\u01c6'),
- ('\u01c9', '\u01c9'), ('\u01cc', '\u01cc'),
- ('\u01ce', '\u01ce'), ('\u01d0', '\u01d0'),
- ('\u01d2', '\u01d2'), ('\u01d4', '\u01d4'),
- ('\u01d6', '\u01d6'), ('\u01d8', '\u01d8'),
- ('\u01da', '\u01da'), ('\u01dc', '\u01dd'),
- ('\u01df', '\u01df'), ('\u01e1', '\u01e1'),
- ('\u01e3', '\u01e3'), ('\u01e5', '\u01e5'),
- ('\u01e7', '\u01e7'), ('\u01e9', '\u01e9'),
- ('\u01eb', '\u01eb'), ('\u01ed', '\u01ed'),
- ('\u01ef', '\u01f0'), ('\u01f3', '\u01f3'),
- ('\u01f5', '\u01f5'), ('\u01f9', '\u01f9'),
- ('\u01fb', '\u01fb'), ('\u01fd', '\u01fd'),
- ('\u01ff', '\u01ff'), ('\u0201', '\u0201'),
- ('\u0203', '\u0203'), ('\u0205', '\u0205'),
- ('\u0207', '\u0207'), ('\u0209', '\u0209'),
- ('\u020b', '\u020b'), ('\u020d', '\u020d'),
- ('\u020f', '\u020f'), ('\u0211', '\u0211'),
- ('\u0213', '\u0213'), ('\u0215', '\u0215'),
- ('\u0217', '\u0217'), ('\u0219', '\u0219'),
- ('\u021b', '\u021b'), ('\u021d', '\u021d'),
- ('\u021f', '\u021f'), ('\u0221', '\u0221'),
- ('\u0223', '\u0223'), ('\u0225', '\u0225'),
- ('\u0227', '\u0227'), ('\u0229', '\u0229'),
- ('\u022b', '\u022b'), ('\u022d', '\u022d'),
- ('\u022f', '\u022f'), ('\u0231', '\u0231'),
- ('\u0233', '\u0239'), ('\u023c', '\u023c'),
- ('\u023f', '\u0240'), ('\u0242', '\u0242'),
- ('\u0247', '\u0247'), ('\u0249', '\u0249'),
- ('\u024b', '\u024b'), ('\u024d', '\u024d'),
- ('\u024f', '\u0293'), ('\u0295', '\u02af'),
- ('\u02b0', '\u02b8'), ('\u02c0', '\u02c1'),
- ('\u02e0', '\u02e4'), ('\u0345', '\u0345'),
- ('\u0371', '\u0371'), ('\u0373', '\u0373'),
- ('\u0377', '\u0377'), ('\u037a', '\u037a'),
- ('\u037b', '\u037d'), ('\u0390', '\u0390'),
- ('\u03ac', '\u03ce'), ('\u03d0', '\u03d1'),
- ('\u03d5', '\u03d7'), ('\u03d9', '\u03d9'),
- ('\u03db', '\u03db'), ('\u03dd', '\u03dd'),
- ('\u03df', '\u03df'), ('\u03e1', '\u03e1'),
- ('\u03e3', '\u03e3'), ('\u03e5', '\u03e5'),
- ('\u03e7', '\u03e7'), ('\u03e9', '\u03e9'),
- ('\u03eb', '\u03eb'), ('\u03ed', '\u03ed'),
- ('\u03ef', '\u03f3'), ('\u03f5', '\u03f5'),
- ('\u03f8', '\u03f8'), ('\u03fb', '\u03fc'),
- ('\u0430', '\u045f'), ('\u0461', '\u0461'),
- ('\u0463', '\u0463'), ('\u0465', '\u0465'),
- ('\u0467', '\u0467'), ('\u0469', '\u0469'),
- ('\u046b', '\u046b'), ('\u046d', '\u046d'),
- ('\u046f', '\u046f'), ('\u0471', '\u0471'),
- ('\u0473', '\u0473'), ('\u0475', '\u0475'),
- ('\u0477', '\u0477'), ('\u0479', '\u0479'),
- ('\u047b', '\u047b'), ('\u047d', '\u047d'),
- ('\u047f', '\u047f'), ('\u0481', '\u0481'),
- ('\u048b', '\u048b'), ('\u048d', '\u048d'),
- ('\u048f', '\u048f'), ('\u0491', '\u0491'),
- ('\u0493', '\u0493'), ('\u0495', '\u0495'),
- ('\u0497', '\u0497'), ('\u0499', '\u0499'),
- ('\u049b', '\u049b'), ('\u049d', '\u049d'),
- ('\u049f', '\u049f'), ('\u04a1', '\u04a1'),
- ('\u04a3', '\u04a3'), ('\u04a5', '\u04a5'),
- ('\u04a7', '\u04a7'), ('\u04a9', '\u04a9'),
- ('\u04ab', '\u04ab'), ('\u04ad', '\u04ad'),
- ('\u04af', '\u04af'), ('\u04b1', '\u04b1'),
- ('\u04b3', '\u04b3'), ('\u04b5', '\u04b5'),
- ('\u04b7', '\u04b7'), ('\u04b9', '\u04b9'),
- ('\u04bb', '\u04bb'), ('\u04bd', '\u04bd'),
- ('\u04bf', '\u04bf'), ('\u04c2', '\u04c2'),
- ('\u04c4', '\u04c4'), ('\u04c6', '\u04c6'),
- ('\u04c8', '\u04c8'), ('\u04ca', '\u04ca'),
- ('\u04cc', '\u04cc'), ('\u04ce', '\u04cf'),
- ('\u04d1', '\u04d1'), ('\u04d3', '\u04d3'),
- ('\u04d5', '\u04d5'), ('\u04d7', '\u04d7'),
- ('\u04d9', '\u04d9'), ('\u04db', '\u04db'),
- ('\u04dd', '\u04dd'), ('\u04df', '\u04df'),
- ('\u04e1', '\u04e1'), ('\u04e3', '\u04e3'),
- ('\u04e5', '\u04e5'), ('\u04e7', '\u04e7'),
- ('\u04e9', '\u04e9'), ('\u04eb', '\u04eb'),
- ('\u04ed', '\u04ed'), ('\u04ef', '\u04ef'),
- ('\u04f1', '\u04f1'), ('\u04f3', '\u04f3'),
- ('\u04f5', '\u04f5'), ('\u04f7', '\u04f7'),
- ('\u04f9', '\u04f9'), ('\u04fb', '\u04fb'),
- ('\u04fd', '\u04fd'), ('\u04ff', '\u04ff'),
- ('\u0501', '\u0501'), ('\u0503', '\u0503'),
- ('\u0505', '\u0505'), ('\u0507', '\u0507'),
- ('\u0509', '\u0509'), ('\u050b', '\u050b'),
- ('\u050d', '\u050d'), ('\u050f', '\u050f'),
- ('\u0511', '\u0511'), ('\u0513', '\u0513'),
- ('\u0515', '\u0515'), ('\u0517', '\u0517'),
- ('\u0519', '\u0519'), ('\u051b', '\u051b'),
- ('\u051d', '\u051d'), ('\u051f', '\u051f'),
- ('\u0521', '\u0521'), ('\u0523', '\u0523'),
- ('\u0525', '\u0525'), ('\u0527', '\u0527'),
- ('\u0561', '\u0587'), ('\u1d00', '\u1d2b'),
- ('\u1d2c', '\u1d6a'), ('\u1d6b', '\u1d77'),
- ('\u1d78', '\u1d78'), ('\u1d79', '\u1d9a'),
- ('\u1d9b', '\u1dbf'), ('\u1e01', '\u1e01'),
- ('\u1e03', '\u1e03'), ('\u1e05', '\u1e05'),
- ('\u1e07', '\u1e07'), ('\u1e09', '\u1e09'),
- ('\u1e0b', '\u1e0b'), ('\u1e0d', '\u1e0d'),
- ('\u1e0f', '\u1e0f'), ('\u1e11', '\u1e11'),
- ('\u1e13', '\u1e13'), ('\u1e15', '\u1e15'),
- ('\u1e17', '\u1e17'), ('\u1e19', '\u1e19'),
- ('\u1e1b', '\u1e1b'), ('\u1e1d', '\u1e1d'),
- ('\u1e1f', '\u1e1f'), ('\u1e21', '\u1e21'),
- ('\u1e23', '\u1e23'), ('\u1e25', '\u1e25'),
- ('\u1e27', '\u1e27'), ('\u1e29', '\u1e29'),
- ('\u1e2b', '\u1e2b'), ('\u1e2d', '\u1e2d'),
- ('\u1e2f', '\u1e2f'), ('\u1e31', '\u1e31'),
- ('\u1e33', '\u1e33'), ('\u1e35', '\u1e35'),
- ('\u1e37', '\u1e37'), ('\u1e39', '\u1e39'),
- ('\u1e3b', '\u1e3b'), ('\u1e3d', '\u1e3d'),
- ('\u1e3f', '\u1e3f'), ('\u1e41', '\u1e41'),
- ('\u1e43', '\u1e43'), ('\u1e45', '\u1e45'),
- ('\u1e47', '\u1e47'), ('\u1e49', '\u1e49'),
- ('\u1e4b', '\u1e4b'), ('\u1e4d', '\u1e4d'),
- ('\u1e4f', '\u1e4f'), ('\u1e51', '\u1e51'),
- ('\u1e53', '\u1e53'), ('\u1e55', '\u1e55'),
- ('\u1e57', '\u1e57'), ('\u1e59', '\u1e59'),
- ('\u1e5b', '\u1e5b'), ('\u1e5d', '\u1e5d'),
- ('\u1e5f', '\u1e5f'), ('\u1e61', '\u1e61'),
- ('\u1e63', '\u1e63'), ('\u1e65', '\u1e65'),
- ('\u1e67', '\u1e67'), ('\u1e69', '\u1e69'),
- ('\u1e6b', '\u1e6b'), ('\u1e6d', '\u1e6d'),
- ('\u1e6f', '\u1e6f'), ('\u1e71', '\u1e71'),
- ('\u1e73', '\u1e73'), ('\u1e75', '\u1e75'),
- ('\u1e77', '\u1e77'), ('\u1e79', '\u1e79'),
- ('\u1e7b', '\u1e7b'), ('\u1e7d', '\u1e7d'),
- ('\u1e7f', '\u1e7f'), ('\u1e81', '\u1e81'),
- ('\u1e83', '\u1e83'), ('\u1e85', '\u1e85'),
- ('\u1e87', '\u1e87'), ('\u1e89', '\u1e89'),
- ('\u1e8b', '\u1e8b'), ('\u1e8d', '\u1e8d'),
- ('\u1e8f', '\u1e8f'), ('\u1e91', '\u1e91'),
- ('\u1e93', '\u1e93'), ('\u1e95', '\u1e9d'),
- ('\u1e9f', '\u1e9f'), ('\u1ea1', '\u1ea1'),
- ('\u1ea3', '\u1ea3'), ('\u1ea5', '\u1ea5'),
- ('\u1ea7', '\u1ea7'), ('\u1ea9', '\u1ea9'),
- ('\u1eab', '\u1eab'), ('\u1ead', '\u1ead'),
- ('\u1eaf', '\u1eaf'), ('\u1eb1', '\u1eb1'),
- ('\u1eb3', '\u1eb3'), ('\u1eb5', '\u1eb5'),
- ('\u1eb7', '\u1eb7'), ('\u1eb9', '\u1eb9'),
- ('\u1ebb', '\u1ebb'), ('\u1ebd', '\u1ebd'),
- ('\u1ebf', '\u1ebf'), ('\u1ec1', '\u1ec1'),
- ('\u1ec3', '\u1ec3'), ('\u1ec5', '\u1ec5'),
- ('\u1ec7', '\u1ec7'), ('\u1ec9', '\u1ec9'),
- ('\u1ecb', '\u1ecb'), ('\u1ecd', '\u1ecd'),
- ('\u1ecf', '\u1ecf'), ('\u1ed1', '\u1ed1'),
- ('\u1ed3', '\u1ed3'), ('\u1ed5', '\u1ed5'),
- ('\u1ed7', '\u1ed7'), ('\u1ed9', '\u1ed9'),
- ('\u1edb', '\u1edb'), ('\u1edd', '\u1edd'),
- ('\u1edf', '\u1edf'), ('\u1ee1', '\u1ee1'),
- ('\u1ee3', '\u1ee3'), ('\u1ee5', '\u1ee5'),
- ('\u1ee7', '\u1ee7'), ('\u1ee9', '\u1ee9'),
- ('\u1eeb', '\u1eeb'), ('\u1eed', '\u1eed'),
- ('\u1eef', '\u1eef'), ('\u1ef1', '\u1ef1'),
- ('\u1ef3', '\u1ef3'), ('\u1ef5', '\u1ef5'),
- ('\u1ef7', '\u1ef7'), ('\u1ef9', '\u1ef9'),
- ('\u1efb', '\u1efb'), ('\u1efd', '\u1efd'),
- ('\u1eff', '\u1f07'), ('\u1f10', '\u1f15'),
- ('\u1f20', '\u1f27'), ('\u1f30', '\u1f37'),
- ('\u1f40', '\u1f45'), ('\u1f50', '\u1f57'),
- ('\u1f60', '\u1f67'), ('\u1f70', '\u1f7d'),
- ('\u1f80', '\u1f87'), ('\u1f90', '\u1f97'),
- ('\u1fa0', '\u1fa7'), ('\u1fb0', '\u1fb4'),
- ('\u1fb6', '\u1fb7'), ('\u1fbe', '\u1fbe'),
- ('\u1fc2', '\u1fc4'), ('\u1fc6', '\u1fc7'),
- ('\u1fd0', '\u1fd3'), ('\u1fd6', '\u1fd7'),
- ('\u1fe0', '\u1fe7'), ('\u1ff2', '\u1ff4'),
- ('\u1ff6', '\u1ff7'), ('\u2071', '\u2071'),
- ('\u207f', '\u207f'), ('\u2090', '\u209c'),
- ('\u210a', '\u210a'), ('\u210e', '\u210f'),
- ('\u2113', '\u2113'), ('\u212f', '\u212f'),
- ('\u2134', '\u2134'), ('\u2139', '\u2139'),
- ('\u213c', '\u213d'), ('\u2146', '\u2149'),
- ('\u214e', '\u214e'), ('\u2170', '\u217f'),
- ('\u2184', '\u2184'), ('\u24d0', '\u24e9'),
- ('\u2c30', '\u2c5e'), ('\u2c61', '\u2c61'),
- ('\u2c65', '\u2c66'), ('\u2c68', '\u2c68'),
- ('\u2c6a', '\u2c6a'), ('\u2c6c', '\u2c6c'),
- ('\u2c71', '\u2c71'), ('\u2c73', '\u2c74'),
- ('\u2c76', '\u2c7b'), ('\u2c7c', '\u2c7d'),
- ('\u2c81', '\u2c81'), ('\u2c83', '\u2c83'),
- ('\u2c85', '\u2c85'), ('\u2c87', '\u2c87'),
- ('\u2c89', '\u2c89'), ('\u2c8b', '\u2c8b'),
- ('\u2c8d', '\u2c8d'), ('\u2c8f', '\u2c8f'),
- ('\u2c91', '\u2c91'), ('\u2c93', '\u2c93'),
- ('\u2c95', '\u2c95'), ('\u2c97', '\u2c97'),
- ('\u2c99', '\u2c99'), ('\u2c9b', '\u2c9b'),
- ('\u2c9d', '\u2c9d'), ('\u2c9f', '\u2c9f'),
- ('\u2ca1', '\u2ca1'), ('\u2ca3', '\u2ca3'),
- ('\u2ca5', '\u2ca5'), ('\u2ca7', '\u2ca7'),
- ('\u2ca9', '\u2ca9'), ('\u2cab', '\u2cab'),
- ('\u2cad', '\u2cad'), ('\u2caf', '\u2caf'),
- ('\u2cb1', '\u2cb1'), ('\u2cb3', '\u2cb3'),
- ('\u2cb5', '\u2cb5'), ('\u2cb7', '\u2cb7'),
- ('\u2cb9', '\u2cb9'), ('\u2cbb', '\u2cbb'),
- ('\u2cbd', '\u2cbd'), ('\u2cbf', '\u2cbf'),
- ('\u2cc1', '\u2cc1'), ('\u2cc3', '\u2cc3'),
- ('\u2cc5', '\u2cc5'), ('\u2cc7', '\u2cc7'),
- ('\u2cc9', '\u2cc9'), ('\u2ccb', '\u2ccb'),
- ('\u2ccd', '\u2ccd'), ('\u2ccf', '\u2ccf'),
- ('\u2cd1', '\u2cd1'), ('\u2cd3', '\u2cd3'),
- ('\u2cd5', '\u2cd5'), ('\u2cd7', '\u2cd7'),
- ('\u2cd9', '\u2cd9'), ('\u2cdb', '\u2cdb'),
- ('\u2cdd', '\u2cdd'), ('\u2cdf', '\u2cdf'),
- ('\u2ce1', '\u2ce1'), ('\u2ce3', '\u2ce4'),
- ('\u2cec', '\u2cec'), ('\u2cee', '\u2cee'),
- ('\u2cf3', '\u2cf3'), ('\u2d00', '\u2d25'),
- ('\u2d27', '\u2d27'), ('\u2d2d', '\u2d2d'),
- ('\ua641', '\ua641'), ('\ua643', '\ua643'),
- ('\ua645', '\ua645'), ('\ua647', '\ua647'),
- ('\ua649', '\ua649'), ('\ua64b', '\ua64b'),
- ('\ua64d', '\ua64d'), ('\ua64f', '\ua64f'),
- ('\ua651', '\ua651'), ('\ua653', '\ua653'),
- ('\ua655', '\ua655'), ('\ua657', '\ua657'),
- ('\ua659', '\ua659'), ('\ua65b', '\ua65b'),
- ('\ua65d', '\ua65d'), ('\ua65f', '\ua65f'),
- ('\ua661', '\ua661'), ('\ua663', '\ua663'),
- ('\ua665', '\ua665'), ('\ua667', '\ua667'),
- ('\ua669', '\ua669'), ('\ua66b', '\ua66b'),
- ('\ua66d', '\ua66d'), ('\ua681', '\ua681'),
- ('\ua683', '\ua683'), ('\ua685', '\ua685'),
- ('\ua687', '\ua687'), ('\ua689', '\ua689'),
- ('\ua68b', '\ua68b'), ('\ua68d', '\ua68d'),
- ('\ua68f', '\ua68f'), ('\ua691', '\ua691'),
- ('\ua693', '\ua693'), ('\ua695', '\ua695'),
- ('\ua697', '\ua697'), ('\ua723', '\ua723'),
- ('\ua725', '\ua725'), ('\ua727', '\ua727'),
- ('\ua729', '\ua729'), ('\ua72b', '\ua72b'),
- ('\ua72d', '\ua72d'), ('\ua72f', '\ua731'),
- ('\ua733', '\ua733'), ('\ua735', '\ua735'),
- ('\ua737', '\ua737'), ('\ua739', '\ua739'),
- ('\ua73b', '\ua73b'), ('\ua73d', '\ua73d'),
- ('\ua73f', '\ua73f'), ('\ua741', '\ua741'),
- ('\ua743', '\ua743'), ('\ua745', '\ua745'),
- ('\ua747', '\ua747'), ('\ua749', '\ua749'),
- ('\ua74b', '\ua74b'), ('\ua74d', '\ua74d'),
- ('\ua74f', '\ua74f'), ('\ua751', '\ua751'),
- ('\ua753', '\ua753'), ('\ua755', '\ua755'),
- ('\ua757', '\ua757'), ('\ua759', '\ua759'),
- ('\ua75b', '\ua75b'), ('\ua75d', '\ua75d'),
- ('\ua75f', '\ua75f'), ('\ua761', '\ua761'),
- ('\ua763', '\ua763'), ('\ua765', '\ua765'),
- ('\ua767', '\ua767'), ('\ua769', '\ua769'),
- ('\ua76b', '\ua76b'), ('\ua76d', '\ua76d'),
- ('\ua76f', '\ua76f'), ('\ua770', '\ua770'),
- ('\ua771', '\ua778'), ('\ua77a', '\ua77a'),
- ('\ua77c', '\ua77c'), ('\ua77f', '\ua77f'),
- ('\ua781', '\ua781'), ('\ua783', '\ua783'),
- ('\ua785', '\ua785'), ('\ua787', '\ua787'),
- ('\ua78c', '\ua78c'), ('\ua78e', '\ua78e'),
- ('\ua791', '\ua791'), ('\ua793', '\ua793'),
- ('\ua7a1', '\ua7a1'), ('\ua7a3', '\ua7a3'),
- ('\ua7a5', '\ua7a5'), ('\ua7a7', '\ua7a7'),
- ('\ua7a9', '\ua7a9'), ('\ua7f8', '\ua7f9'),
- ('\ua7fa', '\ua7fa'), ('\ufb00', '\ufb06'),
- ('\ufb13', '\ufb17'), ('\uff41', '\uff5a'),
- ('\U00010428', '\U0001044f'), ('\U0001d41a', '\U0001d433'),
- ('\U0001d44e', '\U0001d454'), ('\U0001d456', '\U0001d467'),
- ('\U0001d482', '\U0001d49b'), ('\U0001d4b6', '\U0001d4b9'),
- ('\U0001d4bb', '\U0001d4bb'), ('\U0001d4bd', '\U0001d4c3'),
- ('\U0001d4c5', '\U0001d4cf'), ('\U0001d4ea', '\U0001d503'),
- ('\U0001d51e', '\U0001d537'), ('\U0001d552', '\U0001d56b'),
- ('\U0001d586', '\U0001d59f'), ('\U0001d5ba', '\U0001d5d3'),
- ('\U0001d5ee', '\U0001d607'), ('\U0001d622', '\U0001d63b'),
- ('\U0001d656', '\U0001d66f'), ('\U0001d68a', '\U0001d6a5'),
- ('\U0001d6c2', '\U0001d6da'), ('\U0001d6dc', '\U0001d6e1'),
- ('\U0001d6fc', '\U0001d714'), ('\U0001d716', '\U0001d71b'),
- ('\U0001d736', '\U0001d74e'), ('\U0001d750', '\U0001d755'),
- ('\U0001d770', '\U0001d788'), ('\U0001d78a', '\U0001d78f'),
- ('\U0001d7aa', '\U0001d7c2'), ('\U0001d7c4', '\U0001d7c9'),
- ('\U0001d7cb', '\U0001d7cb')
- ];
-
- pub fn Lowercase(c: char) -> bool {
- super::bsearch_range_table(c, Lowercase_table)
- }
-
- static Uppercase_table : &'static [(char,char)] = &[
- ('\x41', '\x5a'), ('\xc0', '\xd6'),
- ('\xd8', '\xde'), ('\u0100', '\u0100'),
- ('\u0102', '\u0102'), ('\u0104', '\u0104'),
- ('\u0106', '\u0106'), ('\u0108', '\u0108'),
- ('\u010a', '\u010a'), ('\u010c', '\u010c'),
- ('\u010e', '\u010e'), ('\u0110', '\u0110'),
- ('\u0112', '\u0112'), ('\u0114', '\u0114'),
- ('\u0116', '\u0116'), ('\u0118', '\u0118'),
- ('\u011a', '\u011a'), ('\u011c', '\u011c'),
- ('\u011e', '\u011e'), ('\u0120', '\u0120'),
- ('\u0122', '\u0122'), ('\u0124', '\u0124'),
- ('\u0126', '\u0126'), ('\u0128', '\u0128'),
- ('\u012a', '\u012a'), ('\u012c', '\u012c'),
- ('\u012e', '\u012e'), ('\u0130', '\u0130'),
- ('\u0132', '\u0132'), ('\u0134', '\u0134'),
- ('\u0136', '\u0136'), ('\u0139', '\u0139'),
- ('\u013b', '\u013b'), ('\u013d', '\u013d'),
- ('\u013f', '\u013f'), ('\u0141', '\u0141'),
- ('\u0143', '\u0143'), ('\u0145', '\u0145'),
- ('\u0147', '\u0147'), ('\u014a', '\u014a'),
- ('\u014c', '\u014c'), ('\u014e', '\u014e'),
- ('\u0150', '\u0150'), ('\u0152', '\u0152'),
- ('\u0154', '\u0154'), ('\u0156', '\u0156'),
- ('\u0158', '\u0158'), ('\u015a', '\u015a'),
- ('\u015c', '\u015c'), ('\u015e', '\u015e'),
- ('\u0160', '\u0160'), ('\u0162', '\u0162'),
- ('\u0164', '\u0164'), ('\u0166', '\u0166'),
- ('\u0168', '\u0168'), ('\u016a', '\u016a'),
- ('\u016c', '\u016c'), ('\u016e', '\u016e'),
- ('\u0170', '\u0170'), ('\u0172', '\u0172'),
- ('\u0174', '\u0174'), ('\u0176', '\u0176'),
- ('\u0178', '\u0179'), ('\u017b', '\u017b'),
- ('\u017d', '\u017d'), ('\u0181', '\u0182'),
- ('\u0184', '\u0184'), ('\u0186', '\u0187'),
- ('\u0189', '\u018b'), ('\u018e', '\u0191'),
- ('\u0193', '\u0194'), ('\u0196', '\u0198'),
- ('\u019c', '\u019d'), ('\u019f', '\u01a0'),
- ('\u01a2', '\u01a2'), ('\u01a4', '\u01a4'),
- ('\u01a6', '\u01a7'), ('\u01a9', '\u01a9'),
- ('\u01ac', '\u01ac'), ('\u01ae', '\u01af'),
- ('\u01b1', '\u01b3'), ('\u01b5', '\u01b5'),
- ('\u01b7', '\u01b8'), ('\u01bc', '\u01bc'),
- ('\u01c4', '\u01c4'), ('\u01c7', '\u01c7'),
- ('\u01ca', '\u01ca'), ('\u01cd', '\u01cd'),
- ('\u01cf', '\u01cf'), ('\u01d1', '\u01d1'),
- ('\u01d3', '\u01d3'), ('\u01d5', '\u01d5'),
- ('\u01d7', '\u01d7'), ('\u01d9', '\u01d9'),
- ('\u01db', '\u01db'), ('\u01de', '\u01de'),
- ('\u01e0', '\u01e0'), ('\u01e2', '\u01e2'),
- ('\u01e4', '\u01e4'), ('\u01e6', '\u01e6'),
- ('\u01e8', '\u01e8'), ('\u01ea', '\u01ea'),
- ('\u01ec', '\u01ec'), ('\u01ee', '\u01ee'),
- ('\u01f1', '\u01f1'), ('\u01f4', '\u01f4'),
- ('\u01f6', '\u01f8'), ('\u01fa', '\u01fa'),
- ('\u01fc', '\u01fc'), ('\u01fe', '\u01fe'),
- ('\u0200', '\u0200'), ('\u0202', '\u0202'),
- ('\u0204', '\u0204'), ('\u0206', '\u0206'),
- ('\u0208', '\u0208'), ('\u020a', '\u020a'),
- ('\u020c', '\u020c'), ('\u020e', '\u020e'),
- ('\u0210', '\u0210'), ('\u0212', '\u0212'),
- ('\u0214', '\u0214'), ('\u0216', '\u0216'),
- ('\u0218', '\u0218'), ('\u021a', '\u021a'),
- ('\u021c', '\u021c'), ('\u021e', '\u021e'),
- ('\u0220', '\u0220'), ('\u0222', '\u0222'),
- ('\u0224', '\u0224'), ('\u0226', '\u0226'),
- ('\u0228', '\u0228'), ('\u022a', '\u022a'),
- ('\u022c', '\u022c'), ('\u022e', '\u022e'),
- ('\u0230', '\u0230'), ('\u0232', '\u0232'),
- ('\u023a', '\u023b'), ('\u023d', '\u023e'),
- ('\u0241', '\u0241'), ('\u0243', '\u0246'),
- ('\u0248', '\u0248'), ('\u024a', '\u024a'),
- ('\u024c', '\u024c'), ('\u024e', '\u024e'),
- ('\u0370', '\u0370'), ('\u0372', '\u0372'),
- ('\u0376', '\u0376'), ('\u0386', '\u0386'),
- ('\u0388', '\u038a'), ('\u038c', '\u038c'),
- ('\u038e', '\u038f'), ('\u0391', '\u03a1'),
- ('\u03a3', '\u03ab'), ('\u03cf', '\u03cf'),
- ('\u03d2', '\u03d4'), ('\u03d8', '\u03d8'),
- ('\u03da', '\u03da'), ('\u03dc', '\u03dc'),
- ('\u03de', '\u03de'), ('\u03e0', '\u03e0'),
- ('\u03e2', '\u03e2'), ('\u03e4', '\u03e4'),
- ('\u03e6', '\u03e6'), ('\u03e8', '\u03e8'),
- ('\u03ea', '\u03ea'), ('\u03ec', '\u03ec'),
- ('\u03ee', '\u03ee'), ('\u03f4', '\u03f4'),
- ('\u03f7', '\u03f7'), ('\u03f9', '\u03fa'),
- ('\u03fd', '\u042f'), ('\u0460', '\u0460'),
- ('\u0462', '\u0462'), ('\u0464', '\u0464'),
- ('\u0466', '\u0466'), ('\u0468', '\u0468'),
- ('\u046a', '\u046a'), ('\u046c', '\u046c'),
- ('\u046e', '\u046e'), ('\u0470', '\u0470'),
- ('\u0472', '\u0472'), ('\u0474', '\u0474'),
- ('\u0476', '\u0476'), ('\u0478', '\u0478'),
- ('\u047a', '\u047a'), ('\u047c', '\u047c'),
- ('\u047e', '\u047e'), ('\u0480', '\u0480'),
- ('\u048a', '\u048a'), ('\u048c', '\u048c'),
- ('\u048e', '\u048e'), ('\u0490', '\u0490'),
- ('\u0492', '\u0492'), ('\u0494', '\u0494'),
- ('\u0496', '\u0496'), ('\u0498', '\u0498'),
- ('\u049a', '\u049a'), ('\u049c', '\u049c'),
- ('\u049e', '\u049e'), ('\u04a0', '\u04a0'),
- ('\u04a2', '\u04a2'), ('\u04a4', '\u04a4'),
- ('\u04a6', '\u04a6'), ('\u04a8', '\u04a8'),
- ('\u04aa', '\u04aa'), ('\u04ac', '\u04ac'),
- ('\u04ae', '\u04ae'), ('\u04b0', '\u04b0'),
- ('\u04b2', '\u04b2'), ('\u04b4', '\u04b4'),
- ('\u04b6', '\u04b6'), ('\u04b8', '\u04b8'),
- ('\u04ba', '\u04ba'), ('\u04bc', '\u04bc'),
- ('\u04be', '\u04be'), ('\u04c0', '\u04c1'),
- ('\u04c3', '\u04c3'), ('\u04c5', '\u04c5'),
- ('\u04c7', '\u04c7'), ('\u04c9', '\u04c9'),
- ('\u04cb', '\u04cb'), ('\u04cd', '\u04cd'),
- ('\u04d0', '\u04d0'), ('\u04d2', '\u04d2'),
- ('\u04d4', '\u04d4'), ('\u04d6', '\u04d6'),
- ('\u04d8', '\u04d8'), ('\u04da', '\u04da'),
- ('\u04dc', '\u04dc'), ('\u04de', '\u04de'),
- ('\u04e0', '\u04e0'), ('\u04e2', '\u04e2'),
- ('\u04e4', '\u04e4'), ('\u04e6', '\u04e6'),
- ('\u04e8', '\u04e8'), ('\u04ea', '\u04ea'),
- ('\u04ec', '\u04ec'), ('\u04ee', '\u04ee'),
- ('\u04f0', '\u04f0'), ('\u04f2', '\u04f2'),
- ('\u04f4', '\u04f4'), ('\u04f6', '\u04f6'),
- ('\u04f8', '\u04f8'), ('\u04fa', '\u04fa'),
- ('\u04fc', '\u04fc'), ('\u04fe', '\u04fe'),
- ('\u0500', '\u0500'), ('\u0502', '\u0502'),
- ('\u0504', '\u0504'), ('\u0506', '\u0506'),
- ('\u0508', '\u0508'), ('\u050a', '\u050a'),
- ('\u050c', '\u050c'), ('\u050e', '\u050e'),
- ('\u0510', '\u0510'), ('\u0512', '\u0512'),
- ('\u0514', '\u0514'), ('\u0516', '\u0516'),
- ('\u0518', '\u0518'), ('\u051a', '\u051a'),
- ('\u051c', '\u051c'), ('\u051e', '\u051e'),
- ('\u0520', '\u0520'), ('\u0522', '\u0522'),
- ('\u0524', '\u0524'), ('\u0526', '\u0526'),
- ('\u0531', '\u0556'), ('\u10a0', '\u10c5'),
- ('\u10c7', '\u10c7'), ('\u10cd', '\u10cd'),
- ('\u1e00', '\u1e00'), ('\u1e02', '\u1e02'),
- ('\u1e04', '\u1e04'), ('\u1e06', '\u1e06'),
- ('\u1e08', '\u1e08'), ('\u1e0a', '\u1e0a'),
- ('\u1e0c', '\u1e0c'), ('\u1e0e', '\u1e0e'),
- ('\u1e10', '\u1e10'), ('\u1e12', '\u1e12'),
- ('\u1e14', '\u1e14'), ('\u1e16', '\u1e16'),
- ('\u1e18', '\u1e18'), ('\u1e1a', '\u1e1a'),
- ('\u1e1c', '\u1e1c'), ('\u1e1e', '\u1e1e'),
- ('\u1e20', '\u1e20'), ('\u1e22', '\u1e22'),
- ('\u1e24', '\u1e24'), ('\u1e26', '\u1e26'),
- ('\u1e28', '\u1e28'), ('\u1e2a', '\u1e2a'),
- ('\u1e2c', '\u1e2c'), ('\u1e2e', '\u1e2e'),
- ('\u1e30', '\u1e30'), ('\u1e32', '\u1e32'),
- ('\u1e34', '\u1e34'), ('\u1e36', '\u1e36'),
- ('\u1e38', '\u1e38'), ('\u1e3a', '\u1e3a'),
- ('\u1e3c', '\u1e3c'), ('\u1e3e', '\u1e3e'),
- ('\u1e40', '\u1e40'), ('\u1e42', '\u1e42'),
- ('\u1e44', '\u1e44'), ('\u1e46', '\u1e46'),
- ('\u1e48', '\u1e48'), ('\u1e4a', '\u1e4a'),
- ('\u1e4c', '\u1e4c'), ('\u1e4e', '\u1e4e'),
- ('\u1e50', '\u1e50'), ('\u1e52', '\u1e52'),
- ('\u1e54', '\u1e54'), ('\u1e56', '\u1e56'),
- ('\u1e58', '\u1e58'), ('\u1e5a', '\u1e5a'),
- ('\u1e5c', '\u1e5c'), ('\u1e5e', '\u1e5e'),
- ('\u1e60', '\u1e60'), ('\u1e62', '\u1e62'),
- ('\u1e64', '\u1e64'), ('\u1e66', '\u1e66'),
- ('\u1e68', '\u1e68'), ('\u1e6a', '\u1e6a'),
- ('\u1e6c', '\u1e6c'), ('\u1e6e', '\u1e6e'),
- ('\u1e70', '\u1e70'), ('\u1e72', '\u1e72'),
- ('\u1e74', '\u1e74'), ('\u1e76', '\u1e76'),
- ('\u1e78', '\u1e78'), ('\u1e7a', '\u1e7a'),
- ('\u1e7c', '\u1e7c'), ('\u1e7e', '\u1e7e'),
- ('\u1e80', '\u1e80'), ('\u1e82', '\u1e82'),
- ('\u1e84', '\u1e84'), ('\u1e86', '\u1e86'),
- ('\u1e88', '\u1e88'), ('\u1e8a', '\u1e8a'),
- ('\u1e8c', '\u1e8c'), ('\u1e8e', '\u1e8e'),
- ('\u1e90', '\u1e90'), ('\u1e92', '\u1e92'),
- ('\u1e94', '\u1e94'), ('\u1e9e', '\u1e9e'),
- ('\u1ea0', '\u1ea0'), ('\u1ea2', '\u1ea2'),
- ('\u1ea4', '\u1ea4'), ('\u1ea6', '\u1ea6'),
- ('\u1ea8', '\u1ea8'), ('\u1eaa', '\u1eaa'),
- ('\u1eac', '\u1eac'), ('\u1eae', '\u1eae'),
- ('\u1eb0', '\u1eb0'), ('\u1eb2', '\u1eb2'),
- ('\u1eb4', '\u1eb4'), ('\u1eb6', '\u1eb6'),
- ('\u1eb8', '\u1eb8'), ('\u1eba', '\u1eba'),
- ('\u1ebc', '\u1ebc'), ('\u1ebe', '\u1ebe'),
- ('\u1ec0', '\u1ec0'), ('\u1ec2', '\u1ec2'),
- ('\u1ec4', '\u1ec4'), ('\u1ec6', '\u1ec6'),
- ('\u1ec8', '\u1ec8'), ('\u1eca', '\u1eca'),
- ('\u1ecc', '\u1ecc'), ('\u1ece', '\u1ece'),
- ('\u1ed0', '\u1ed0'), ('\u1ed2', '\u1ed2'),
- ('\u1ed4', '\u1ed4'), ('\u1ed6', '\u1ed6'),
- ('\u1ed8', '\u1ed8'), ('\u1eda', '\u1eda'),
- ('\u1edc', '\u1edc'), ('\u1ede', '\u1ede'),
- ('\u1ee0', '\u1ee0'), ('\u1ee2', '\u1ee2'),
- ('\u1ee4', '\u1ee4'), ('\u1ee6', '\u1ee6'),
- ('\u1ee8', '\u1ee8'), ('\u1eea', '\u1eea'),
- ('\u1eec', '\u1eec'), ('\u1eee', '\u1eee'),
- ('\u1ef0', '\u1ef0'), ('\u1ef2', '\u1ef2'),
- ('\u1ef4', '\u1ef4'), ('\u1ef6', '\u1ef6'),
- ('\u1ef8', '\u1ef8'), ('\u1efa', '\u1efa'),
- ('\u1efc', '\u1efc'), ('\u1efe', '\u1efe'),
- ('\u1f08', '\u1f0f'), ('\u1f18', '\u1f1d'),
- ('\u1f28', '\u1f2f'), ('\u1f38', '\u1f3f'),
- ('\u1f48', '\u1f4d'), ('\u1f59', '\u1f59'),
- ('\u1f5b', '\u1f5b'), ('\u1f5d', '\u1f5d'),
- ('\u1f5f', '\u1f5f'), ('\u1f68', '\u1f6f'),
- ('\u1fb8', '\u1fbb'), ('\u1fc8', '\u1fcb'),
- ('\u1fd8', '\u1fdb'), ('\u1fe8', '\u1fec'),
- ('\u1ff8', '\u1ffb'), ('\u2102', '\u2102'),
- ('\u2107', '\u2107'), ('\u210b', '\u210d'),
- ('\u2110', '\u2112'), ('\u2115', '\u2115'),
- ('\u2119', '\u211d'), ('\u2124', '\u2124'),
- ('\u2126', '\u2126'), ('\u2128', '\u2128'),
- ('\u212a', '\u212d'), ('\u2130', '\u2133'),
- ('\u213e', '\u213f'), ('\u2145', '\u2145'),
- ('\u2160', '\u216f'), ('\u2183', '\u2183'),
- ('\u24b6', '\u24cf'), ('\u2c00', '\u2c2e'),
- ('\u2c60', '\u2c60'), ('\u2c62', '\u2c64'),
- ('\u2c67', '\u2c67'), ('\u2c69', '\u2c69'),
- ('\u2c6b', '\u2c6b'), ('\u2c6d', '\u2c70'),
- ('\u2c72', '\u2c72'), ('\u2c75', '\u2c75'),
- ('\u2c7e', '\u2c80'), ('\u2c82', '\u2c82'),
- ('\u2c84', '\u2c84'), ('\u2c86', '\u2c86'),
- ('\u2c88', '\u2c88'), ('\u2c8a', '\u2c8a'),
- ('\u2c8c', '\u2c8c'), ('\u2c8e', '\u2c8e'),
- ('\u2c90', '\u2c90'), ('\u2c92', '\u2c92'),
- ('\u2c94', '\u2c94'), ('\u2c96', '\u2c96'),
- ('\u2c98', '\u2c98'), ('\u2c9a', '\u2c9a'),
- ('\u2c9c', '\u2c9c'), ('\u2c9e', '\u2c9e'),
- ('\u2ca0', '\u2ca0'), ('\u2ca2', '\u2ca2'),
- ('\u2ca4', '\u2ca4'), ('\u2ca6', '\u2ca6'),
- ('\u2ca8', '\u2ca8'), ('\u2caa', '\u2caa'),
- ('\u2cac', '\u2cac'), ('\u2cae', '\u2cae'),
- ('\u2cb0', '\u2cb0'), ('\u2cb2', '\u2cb2'),
- ('\u2cb4', '\u2cb4'), ('\u2cb6', '\u2cb6'),
- ('\u2cb8', '\u2cb8'), ('\u2cba', '\u2cba'),
- ('\u2cbc', '\u2cbc'), ('\u2cbe', '\u2cbe'),
- ('\u2cc0', '\u2cc0'), ('\u2cc2', '\u2cc2'),
- ('\u2cc4', '\u2cc4'), ('\u2cc6', '\u2cc6'),
- ('\u2cc8', '\u2cc8'), ('\u2cca', '\u2cca'),
- ('\u2ccc', '\u2ccc'), ('\u2cce', '\u2cce'),
- ('\u2cd0', '\u2cd0'), ('\u2cd2', '\u2cd2'),
- ('\u2cd4', '\u2cd4'), ('\u2cd6', '\u2cd6'),
- ('\u2cd8', '\u2cd8'), ('\u2cda', '\u2cda'),
- ('\u2cdc', '\u2cdc'), ('\u2cde', '\u2cde'),
- ('\u2ce0', '\u2ce0'), ('\u2ce2', '\u2ce2'),
- ('\u2ceb', '\u2ceb'), ('\u2ced', '\u2ced'),
- ('\u2cf2', '\u2cf2'), ('\ua640', '\ua640'),
- ('\ua642', '\ua642'), ('\ua644', '\ua644'),
- ('\ua646', '\ua646'), ('\ua648', '\ua648'),
- ('\ua64a', '\ua64a'), ('\ua64c', '\ua64c'),
- ('\ua64e', '\ua64e'), ('\ua650', '\ua650'),
- ('\ua652', '\ua652'), ('\ua654', '\ua654'),
- ('\ua656', '\ua656'), ('\ua658', '\ua658'),
- ('\ua65a', '\ua65a'), ('\ua65c', '\ua65c'),
- ('\ua65e', '\ua65e'), ('\ua660', '\ua660'),
- ('\ua662', '\ua662'), ('\ua664', '\ua664'),
- ('\ua666', '\ua666'), ('\ua668', '\ua668'),
- ('\ua66a', '\ua66a'), ('\ua66c', '\ua66c'),
- ('\ua680', '\ua680'), ('\ua682', '\ua682'),
- ('\ua684', '\ua684'), ('\ua686', '\ua686'),
- ('\ua688', '\ua688'), ('\ua68a', '\ua68a'),
- ('\ua68c', '\ua68c'), ('\ua68e', '\ua68e'),
- ('\ua690', '\ua690'), ('\ua692', '\ua692'),
- ('\ua694', '\ua694'), ('\ua696', '\ua696'),
- ('\ua722', '\ua722'), ('\ua724', '\ua724'),
- ('\ua726', '\ua726'), ('\ua728', '\ua728'),
- ('\ua72a', '\ua72a'), ('\ua72c', '\ua72c'),
- ('\ua72e', '\ua72e'), ('\ua732', '\ua732'),
- ('\ua734', '\ua734'), ('\ua736', '\ua736'),
- ('\ua738', '\ua738'), ('\ua73a', '\ua73a'),
- ('\ua73c', '\ua73c'), ('\ua73e', '\ua73e'),
- ('\ua740', '\ua740'), ('\ua742', '\ua742'),
- ('\ua744', '\ua744'), ('\ua746', '\ua746'),
- ('\ua748', '\ua748'), ('\ua74a', '\ua74a'),
- ('\ua74c', '\ua74c'), ('\ua74e', '\ua74e'),
- ('\ua750', '\ua750'), ('\ua752', '\ua752'),
- ('\ua754', '\ua754'), ('\ua756', '\ua756'),
- ('\ua758', '\ua758'), ('\ua75a', '\ua75a'),
- ('\ua75c', '\ua75c'), ('\ua75e', '\ua75e'),
- ('\ua760', '\ua760'), ('\ua762', '\ua762'),
- ('\ua764', '\ua764'), ('\ua766', '\ua766'),
- ('\ua768', '\ua768'), ('\ua76a', '\ua76a'),
- ('\ua76c', '\ua76c'), ('\ua76e', '\ua76e'),
- ('\ua779', '\ua779'), ('\ua77b', '\ua77b'),
- ('\ua77d', '\ua77e'), ('\ua780', '\ua780'),
- ('\ua782', '\ua782'), ('\ua784', '\ua784'),
- ('\ua786', '\ua786'), ('\ua78b', '\ua78b'),
- ('\ua78d', '\ua78d'), ('\ua790', '\ua790'),
- ('\ua792', '\ua792'), ('\ua7a0', '\ua7a0'),
- ('\ua7a2', '\ua7a2'), ('\ua7a4', '\ua7a4'),
- ('\ua7a6', '\ua7a6'), ('\ua7a8', '\ua7a8'),
- ('\ua7aa', '\ua7aa'), ('\uff21', '\uff3a'),
- ('\U00010400', '\U00010427'), ('\U0001d400', '\U0001d419'),
- ('\U0001d434', '\U0001d44d'), ('\U0001d468', '\U0001d481'),
- ('\U0001d49c', '\U0001d49c'), ('\U0001d49e', '\U0001d49f'),
- ('\U0001d4a2', '\U0001d4a2'), ('\U0001d4a5', '\U0001d4a6'),
- ('\U0001d4a9', '\U0001d4ac'), ('\U0001d4ae', '\U0001d4b5'),
- ('\U0001d4d0', '\U0001d4e9'), ('\U0001d504', '\U0001d505'),
- ('\U0001d507', '\U0001d50a'), ('\U0001d50d', '\U0001d514'),
- ('\U0001d516', '\U0001d51c'), ('\U0001d538', '\U0001d539'),
- ('\U0001d53b', '\U0001d53e'), ('\U0001d540', '\U0001d544'),
- ('\U0001d546', '\U0001d546'), ('\U0001d54a', '\U0001d550'),
- ('\U0001d56c', '\U0001d585'), ('\U0001d5a0', '\U0001d5b9'),
- ('\U0001d5d4', '\U0001d5ed'), ('\U0001d608', '\U0001d621'),
- ('\U0001d63c', '\U0001d655'), ('\U0001d670', '\U0001d689'),
- ('\U0001d6a8', '\U0001d6c0'), ('\U0001d6e2', '\U0001d6fa'),
- ('\U0001d71c', '\U0001d734'), ('\U0001d756', '\U0001d76e'),
- ('\U0001d790', '\U0001d7a8'), ('\U0001d7ca', '\U0001d7ca')
- ];
-
- pub fn Uppercase(c: char) -> bool {
- super::bsearch_range_table(c, Uppercase_table)
- }
-
- static XID_Continue_table : &'static [(char,char)] = &[
- ('\x30', '\x39'), ('\x41', '\x5a'),
- ('\x5f', '\x5f'), ('\x61', '\x7a'),
- ('\xaa', '\xaa'), ('\xb5', '\xb5'),
- ('\xb7', '\xb7'), ('\xba', '\xba'),
- ('\xc0', '\xd6'), ('\xd8', '\xf6'),
- ('\xf8', '\u01ba'), ('\u01bb', '\u01bb'),
- ('\u01bc', '\u01bf'), ('\u01c0', '\u01c3'),
- ('\u01c4', '\u0293'), ('\u0294', '\u0294'),
- ('\u0295', '\u02af'), ('\u02b0', '\u02c1'),
- ('\u02c6', '\u02d1'), ('\u02e0', '\u02e4'),
- ('\u02ec', '\u02ec'), ('\u02ee', '\u02ee'),
- ('\u0300', '\u036f'), ('\u0370', '\u0373'),
- ('\u0374', '\u0374'), ('\u0376', '\u0377'),
- ('\u037b', '\u037d'), ('\u0386', '\u0386'),
- ('\u0387', '\u0387'), ('\u0388', '\u038a'),
- ('\u038c', '\u038c'), ('\u038e', '\u03a1'),
- ('\u03a3', '\u03f5'), ('\u03f7', '\u0481'),
- ('\u0483', '\u0487'), ('\u048a', '\u0527'),
- ('\u0531', '\u0556'), ('\u0559', '\u0559'),
- ('\u0561', '\u0587'), ('\u0591', '\u05bd'),
- ('\u05bf', '\u05bf'), ('\u05c1', '\u05c2'),
- ('\u05c4', '\u05c5'), ('\u05c7', '\u05c7'),
- ('\u05d0', '\u05ea'), ('\u05f0', '\u05f2'),
- ('\u0610', '\u061a'), ('\u0620', '\u063f'),
- ('\u0640', '\u0640'), ('\u0641', '\u064a'),
- ('\u064b', '\u065f'), ('\u0660', '\u0669'),
- ('\u066e', '\u066f'), ('\u0670', '\u0670'),
- ('\u0671', '\u06d3'), ('\u06d5', '\u06d5'),
- ('\u06d6', '\u06dc'), ('\u06df', '\u06e4'),
- ('\u06e5', '\u06e6'), ('\u06e7', '\u06e8'),
- ('\u06ea', '\u06ed'), ('\u06ee', '\u06ef'),
- ('\u06f0', '\u06f9'), ('\u06fa', '\u06fc'),
- ('\u06ff', '\u06ff'), ('\u0710', '\u0710'),
- ('\u0711', '\u0711'), ('\u0712', '\u072f'),
- ('\u0730', '\u074a'), ('\u074d', '\u07a5'),
- ('\u07a6', '\u07b0'), ('\u07b1', '\u07b1'),
- ('\u07c0', '\u07c9'), ('\u07ca', '\u07ea'),
- ('\u07eb', '\u07f3'), ('\u07f4', '\u07f5'),
- ('\u07fa', '\u07fa'), ('\u0800', '\u0815'),
- ('\u0816', '\u0819'), ('\u081a', '\u081a'),
- ('\u081b', '\u0823'), ('\u0824', '\u0824'),
- ('\u0825', '\u0827'), ('\u0828', '\u0828'),
- ('\u0829', '\u082d'), ('\u0840', '\u0858'),
- ('\u0859', '\u085b'), ('\u08a0', '\u08a0'),
- ('\u08a2', '\u08ac'), ('\u08e4', '\u08fe'),
- ('\u0900', '\u0902'), ('\u0903', '\u0903'),
- ('\u0904', '\u0939'), ('\u093a', '\u093a'),
- ('\u093b', '\u093b'), ('\u093c', '\u093c'),
- ('\u093d', '\u093d'), ('\u093e', '\u0940'),
- ('\u0941', '\u0948'), ('\u0949', '\u094c'),
- ('\u094d', '\u094d'), ('\u094e', '\u094f'),
- ('\u0950', '\u0950'), ('\u0951', '\u0957'),
- ('\u0958', '\u0961'), ('\u0962', '\u0963'),
- ('\u0966', '\u096f'), ('\u0971', '\u0971'),
- ('\u0972', '\u0977'), ('\u0979', '\u097f'),
- ('\u0981', '\u0981'), ('\u0982', '\u0983'),
- ('\u0985', '\u098c'), ('\u098f', '\u0990'),
- ('\u0993', '\u09a8'), ('\u09aa', '\u09b0'),
- ('\u09b2', '\u09b2'), ('\u09b6', '\u09b9'),
- ('\u09bc', '\u09bc'), ('\u09bd', '\u09bd'),
- ('\u09be', '\u09c0'), ('\u09c1', '\u09c4'),
- ('\u09c7', '\u09c8'), ('\u09cb', '\u09cc'),
- ('\u09cd', '\u09cd'), ('\u09ce', '\u09ce'),
- ('\u09d7', '\u09d7'), ('\u09dc', '\u09dd'),
- ('\u09df', '\u09e1'), ('\u09e2', '\u09e3'),
- ('\u09e6', '\u09ef'), ('\u09f0', '\u09f1'),
- ('\u0a01', '\u0a02'), ('\u0a03', '\u0a03'),
- ('\u0a05', '\u0a0a'), ('\u0a0f', '\u0a10'),
- ('\u0a13', '\u0a28'), ('\u0a2a', '\u0a30'),
- ('\u0a32', '\u0a33'), ('\u0a35', '\u0a36'),
- ('\u0a38', '\u0a39'), ('\u0a3c', '\u0a3c'),
- ('\u0a3e', '\u0a40'), ('\u0a41', '\u0a42'),
- ('\u0a47', '\u0a48'), ('\u0a4b', '\u0a4d'),
- ('\u0a51', '\u0a51'), ('\u0a59', '\u0a5c'),
- ('\u0a5e', '\u0a5e'), ('\u0a66', '\u0a6f'),
- ('\u0a70', '\u0a71'), ('\u0a72', '\u0a74'),
- ('\u0a75', '\u0a75'), ('\u0a81', '\u0a82'),
- ('\u0a83', '\u0a83'), ('\u0a85', '\u0a8d'),
- ('\u0a8f', '\u0a91'), ('\u0a93', '\u0aa8'),
- ('\u0aaa', '\u0ab0'), ('\u0ab2', '\u0ab3'),
- ('\u0ab5', '\u0ab9'), ('\u0abc', '\u0abc'),
- ('\u0abd', '\u0abd'), ('\u0abe', '\u0ac0'),
- ('\u0ac1', '\u0ac5'), ('\u0ac7', '\u0ac8'),
- ('\u0ac9', '\u0ac9'), ('\u0acb', '\u0acc'),
- ('\u0acd', '\u0acd'), ('\u0ad0', '\u0ad0'),
- ('\u0ae0', '\u0ae1'), ('\u0ae2', '\u0ae3'),
- ('\u0ae6', '\u0aef'), ('\u0b01', '\u0b01'),
- ('\u0b02', '\u0b03'), ('\u0b05', '\u0b0c'),
- ('\u0b0f', '\u0b10'), ('\u0b13', '\u0b28'),
- ('\u0b2a', '\u0b30'), ('\u0b32', '\u0b33'),
- ('\u0b35', '\u0b39'), ('\u0b3c', '\u0b3c'),
- ('\u0b3d', '\u0b3d'), ('\u0b3e', '\u0b3e'),
- ('\u0b3f', '\u0b3f'), ('\u0b40', '\u0b40'),
- ('\u0b41', '\u0b44'), ('\u0b47', '\u0b48'),
- ('\u0b4b', '\u0b4c'), ('\u0b4d', '\u0b4d'),
- ('\u0b56', '\u0b56'), ('\u0b57', '\u0b57'),
- ('\u0b5c', '\u0b5d'), ('\u0b5f', '\u0b61'),
- ('\u0b62', '\u0b63'), ('\u0b66', '\u0b6f'),
- ('\u0b71', '\u0b71'), ('\u0b82', '\u0b82'),
- ('\u0b83', '\u0b83'), ('\u0b85', '\u0b8a'),
- ('\u0b8e', '\u0b90'), ('\u0b92', '\u0b95'),
- ('\u0b99', '\u0b9a'), ('\u0b9c', '\u0b9c'),
- ('\u0b9e', '\u0b9f'), ('\u0ba3', '\u0ba4'),
- ('\u0ba8', '\u0baa'), ('\u0bae', '\u0bb9'),
- ('\u0bbe', '\u0bbf'), ('\u0bc0', '\u0bc0'),
- ('\u0bc1', '\u0bc2'), ('\u0bc6', '\u0bc8'),
- ('\u0bca', '\u0bcc'), ('\u0bcd', '\u0bcd'),
- ('\u0bd0', '\u0bd0'), ('\u0bd7', '\u0bd7'),
- ('\u0be6', '\u0bef'), ('\u0c01', '\u0c03'),
- ('\u0c05', '\u0c0c'), ('\u0c0e', '\u0c10'),
- ('\u0c12', '\u0c28'), ('\u0c2a', '\u0c33'),
- ('\u0c35', '\u0c39'), ('\u0c3d', '\u0c3d'),
- ('\u0c3e', '\u0c40'), ('\u0c41', '\u0c44'),
- ('\u0c46', '\u0c48'), ('\u0c4a', '\u0c4d'),
- ('\u0c55', '\u0c56'), ('\u0c58', '\u0c59'),
- ('\u0c60', '\u0c61'), ('\u0c62', '\u0c63'),
- ('\u0c66', '\u0c6f'), ('\u0c82', '\u0c83'),
- ('\u0c85', '\u0c8c'), ('\u0c8e', '\u0c90'),
- ('\u0c92', '\u0ca8'), ('\u0caa', '\u0cb3'),
- ('\u0cb5', '\u0cb9'), ('\u0cbc', '\u0cbc'),
- ('\u0cbd', '\u0cbd'), ('\u0cbe', '\u0cbe'),
- ('\u0cbf', '\u0cbf'), ('\u0cc0', '\u0cc4'),
- ('\u0cc6', '\u0cc6'), ('\u0cc7', '\u0cc8'),
- ('\u0cca', '\u0ccb'), ('\u0ccc', '\u0ccd'),
- ('\u0cd5', '\u0cd6'), ('\u0cde', '\u0cde'),
- ('\u0ce0', '\u0ce1'), ('\u0ce2', '\u0ce3'),
- ('\u0ce6', '\u0cef'), ('\u0cf1', '\u0cf2'),
- ('\u0d02', '\u0d03'), ('\u0d05', '\u0d0c'),
- ('\u0d0e', '\u0d10'), ('\u0d12', '\u0d3a'),
- ('\u0d3d', '\u0d3d'), ('\u0d3e', '\u0d40'),
- ('\u0d41', '\u0d44'), ('\u0d46', '\u0d48'),
- ('\u0d4a', '\u0d4c'), ('\u0d4d', '\u0d4d'),
- ('\u0d4e', '\u0d4e'), ('\u0d57', '\u0d57'),
- ('\u0d60', '\u0d61'), ('\u0d62', '\u0d63'),
- ('\u0d66', '\u0d6f'), ('\u0d7a', '\u0d7f'),
- ('\u0d82', '\u0d83'), ('\u0d85', '\u0d96'),
- ('\u0d9a', '\u0db1'), ('\u0db3', '\u0dbb'),
- ('\u0dbd', '\u0dbd'), ('\u0dc0', '\u0dc6'),
- ('\u0dca', '\u0dca'), ('\u0dcf', '\u0dd1'),
- ('\u0dd2', '\u0dd4'), ('\u0dd6', '\u0dd6'),
- ('\u0dd8', '\u0ddf'), ('\u0df2', '\u0df3'),
- ('\u0e01', '\u0e30'), ('\u0e31', '\u0e31'),
- ('\u0e32', '\u0e33'), ('\u0e34', '\u0e3a'),
- ('\u0e40', '\u0e45'), ('\u0e46', '\u0e46'),
- ('\u0e47', '\u0e4e'), ('\u0e50', '\u0e59'),
- ('\u0e81', '\u0e82'), ('\u0e84', '\u0e84'),
- ('\u0e87', '\u0e88'), ('\u0e8a', '\u0e8a'),
- ('\u0e8d', '\u0e8d'), ('\u0e94', '\u0e97'),
- ('\u0e99', '\u0e9f'), ('\u0ea1', '\u0ea3'),
- ('\u0ea5', '\u0ea5'), ('\u0ea7', '\u0ea7'),
- ('\u0eaa', '\u0eab'), ('\u0ead', '\u0eb0'),
- ('\u0eb1', '\u0eb1'), ('\u0eb2', '\u0eb3'),
- ('\u0eb4', '\u0eb9'), ('\u0ebb', '\u0ebc'),
- ('\u0ebd', '\u0ebd'), ('\u0ec0', '\u0ec4'),
- ('\u0ec6', '\u0ec6'), ('\u0ec8', '\u0ecd'),
- ('\u0ed0', '\u0ed9'), ('\u0edc', '\u0edf'),
- ('\u0f00', '\u0f00'), ('\u0f18', '\u0f19'),
- ('\u0f20', '\u0f29'), ('\u0f35', '\u0f35'),
- ('\u0f37', '\u0f37'), ('\u0f39', '\u0f39'),
- ('\u0f3e', '\u0f3f'), ('\u0f40', '\u0f47'),
- ('\u0f49', '\u0f6c'), ('\u0f71', '\u0f7e'),
- ('\u0f7f', '\u0f7f'), ('\u0f80', '\u0f84'),
- ('\u0f86', '\u0f87'), ('\u0f88', '\u0f8c'),
- ('\u0f8d', '\u0f97'), ('\u0f99', '\u0fbc'),
- ('\u0fc6', '\u0fc6'), ('\u1000', '\u102a'),
- ('\u102b', '\u102c'), ('\u102d', '\u1030'),
- ('\u1031', '\u1031'), ('\u1032', '\u1037'),
- ('\u1038', '\u1038'), ('\u1039', '\u103a'),
- ('\u103b', '\u103c'), ('\u103d', '\u103e'),
- ('\u103f', '\u103f'), ('\u1040', '\u1049'),
- ('\u1050', '\u1055'), ('\u1056', '\u1057'),
- ('\u1058', '\u1059'), ('\u105a', '\u105d'),
- ('\u105e', '\u1060'), ('\u1061', '\u1061'),
- ('\u1062', '\u1064'), ('\u1065', '\u1066'),
- ('\u1067', '\u106d'), ('\u106e', '\u1070'),
- ('\u1071', '\u1074'), ('\u1075', '\u1081'),
- ('\u1082', '\u1082'), ('\u1083', '\u1084'),
- ('\u1085', '\u1086'), ('\u1087', '\u108c'),
- ('\u108d', '\u108d'), ('\u108e', '\u108e'),
- ('\u108f', '\u108f'), ('\u1090', '\u1099'),
- ('\u109a', '\u109c'), ('\u109d', '\u109d'),
- ('\u10a0', '\u10c5'), ('\u10c7', '\u10c7'),
- ('\u10cd', '\u10cd'), ('\u10d0', '\u10fa'),
- ('\u10fc', '\u10fc'), ('\u10fd', '\u1248'),
- ('\u124a', '\u124d'), ('\u1250', '\u1256'),
- ('\u1258', '\u1258'), ('\u125a', '\u125d'),
- ('\u1260', '\u1288'), ('\u128a', '\u128d'),
- ('\u1290', '\u12b0'), ('\u12b2', '\u12b5'),
- ('\u12b8', '\u12be'), ('\u12c0', '\u12c0'),
- ('\u12c2', '\u12c5'), ('\u12c8', '\u12d6'),
- ('\u12d8', '\u1310'), ('\u1312', '\u1315'),
- ('\u1318', '\u135a'), ('\u135d', '\u135f'),
- ('\u1369', '\u1371'), ('\u1380', '\u138f'),
- ('\u13a0', '\u13f4'), ('\u1401', '\u166c'),
- ('\u166f', '\u167f'), ('\u1681', '\u169a'),
- ('\u16a0', '\u16ea'), ('\u16ee', '\u16f0'),
- ('\u1700', '\u170c'), ('\u170e', '\u1711'),
- ('\u1712', '\u1714'), ('\u1720', '\u1731'),
- ('\u1732', '\u1734'), ('\u1740', '\u1751'),
- ('\u1752', '\u1753'), ('\u1760', '\u176c'),
- ('\u176e', '\u1770'), ('\u1772', '\u1773'),
- ('\u1780', '\u17b3'), ('\u17b4', '\u17b5'),
- ('\u17b6', '\u17b6'), ('\u17b7', '\u17bd'),
- ('\u17be', '\u17c5'), ('\u17c6', '\u17c6'),
- ('\u17c7', '\u17c8'), ('\u17c9', '\u17d3'),
- ('\u17d7', '\u17d7'), ('\u17dc', '\u17dc'),
- ('\u17dd', '\u17dd'), ('\u17e0', '\u17e9'),
- ('\u180b', '\u180d'), ('\u1810', '\u1819'),
- ('\u1820', '\u1842'), ('\u1843', '\u1843'),
- ('\u1844', '\u1877'), ('\u1880', '\u18a8'),
- ('\u18a9', '\u18a9'), ('\u18aa', '\u18aa'),
- ('\u18b0', '\u18f5'), ('\u1900', '\u191c'),
- ('\u1920', '\u1922'), ('\u1923', '\u1926'),
- ('\u1927', '\u1928'), ('\u1929', '\u192b'),
- ('\u1930', '\u1931'), ('\u1932', '\u1932'),
- ('\u1933', '\u1938'), ('\u1939', '\u193b'),
- ('\u1946', '\u194f'), ('\u1950', '\u196d'),
- ('\u1970', '\u1974'), ('\u1980', '\u19ab'),
- ('\u19b0', '\u19c0'), ('\u19c1', '\u19c7'),
- ('\u19c8', '\u19c9'), ('\u19d0', '\u19d9'),
- ('\u19da', '\u19da'), ('\u1a00', '\u1a16'),
- ('\u1a17', '\u1a18'), ('\u1a19', '\u1a1a'),
- ('\u1a1b', '\u1a1b'), ('\u1a20', '\u1a54'),
- ('\u1a55', '\u1a55'), ('\u1a56', '\u1a56'),
- ('\u1a57', '\u1a57'), ('\u1a58', '\u1a5e'),
- ('\u1a60', '\u1a60'), ('\u1a61', '\u1a61'),
- ('\u1a62', '\u1a62'), ('\u1a63', '\u1a64'),
- ('\u1a65', '\u1a6c'), ('\u1a6d', '\u1a72'),
- ('\u1a73', '\u1a7c'), ('\u1a7f', '\u1a7f'),
- ('\u1a80', '\u1a89'), ('\u1a90', '\u1a99'),
- ('\u1aa7', '\u1aa7'), ('\u1b00', '\u1b03'),
- ('\u1b04', '\u1b04'), ('\u1b05', '\u1b33'),
- ('\u1b34', '\u1b34'), ('\u1b35', '\u1b35'),
- ('\u1b36', '\u1b3a'), ('\u1b3b', '\u1b3b'),
- ('\u1b3c', '\u1b3c'), ('\u1b3d', '\u1b41'),
- ('\u1b42', '\u1b42'), ('\u1b43', '\u1b44'),
- ('\u1b45', '\u1b4b'), ('\u1b50', '\u1b59'),
- ('\u1b6b', '\u1b73'), ('\u1b80', '\u1b81'),
- ('\u1b82', '\u1b82'), ('\u1b83', '\u1ba0'),
- ('\u1ba1', '\u1ba1'), ('\u1ba2', '\u1ba5'),
- ('\u1ba6', '\u1ba7'), ('\u1ba8', '\u1ba9'),
- ('\u1baa', '\u1baa'), ('\u1bab', '\u1bab'),
- ('\u1bac', '\u1bad'), ('\u1bae', '\u1baf'),
- ('\u1bb0', '\u1bb9'), ('\u1bba', '\u1be5'),
- ('\u1be6', '\u1be6'), ('\u1be7', '\u1be7'),
- ('\u1be8', '\u1be9'), ('\u1bea', '\u1bec'),
- ('\u1bed', '\u1bed'), ('\u1bee', '\u1bee'),
- ('\u1bef', '\u1bf1'), ('\u1bf2', '\u1bf3'),
- ('\u1c00', '\u1c23'), ('\u1c24', '\u1c2b'),
- ('\u1c2c', '\u1c33'), ('\u1c34', '\u1c35'),
- ('\u1c36', '\u1c37'), ('\u1c40', '\u1c49'),
- ('\u1c4d', '\u1c4f'), ('\u1c50', '\u1c59'),
- ('\u1c5a', '\u1c77'), ('\u1c78', '\u1c7d'),
- ('\u1cd0', '\u1cd2'), ('\u1cd4', '\u1ce0'),
- ('\u1ce1', '\u1ce1'), ('\u1ce2', '\u1ce8'),
- ('\u1ce9', '\u1cec'), ('\u1ced', '\u1ced'),
- ('\u1cee', '\u1cf1'), ('\u1cf2', '\u1cf3'),
- ('\u1cf4', '\u1cf4'), ('\u1cf5', '\u1cf6'),
- ('\u1d00', '\u1d2b'), ('\u1d2c', '\u1d6a'),
- ('\u1d6b', '\u1d77'), ('\u1d78', '\u1d78'),
- ('\u1d79', '\u1d9a'), ('\u1d9b', '\u1dbf'),
- ('\u1dc0', '\u1de6'), ('\u1dfc', '\u1dff'),
- ('\u1e00', '\u1f15'), ('\u1f18', '\u1f1d'),
- ('\u1f20', '\u1f45'), ('\u1f48', '\u1f4d'),
- ('\u1f50', '\u1f57'), ('\u1f59', '\u1f59'),
- ('\u1f5b', '\u1f5b'), ('\u1f5d', '\u1f5d'),
- ('\u1f5f', '\u1f7d'), ('\u1f80', '\u1fb4'),
- ('\u1fb6', '\u1fbc'), ('\u1fbe', '\u1fbe'),
- ('\u1fc2', '\u1fc4'), ('\u1fc6', '\u1fcc'),
- ('\u1fd0', '\u1fd3'), ('\u1fd6', '\u1fdb'),
- ('\u1fe0', '\u1fec'), ('\u1ff2', '\u1ff4'),
- ('\u1ff6', '\u1ffc'), ('\u203f', '\u2040'),
- ('\u2054', '\u2054'), ('\u2071', '\u2071'),
- ('\u207f', '\u207f'), ('\u2090', '\u209c'),
- ('\u20d0', '\u20dc'), ('\u20e1', '\u20e1'),
- ('\u20e5', '\u20f0'), ('\u2102', '\u2102'),
- ('\u2107', '\u2107'), ('\u210a', '\u2113'),
- ('\u2115', '\u2115'), ('\u2118', '\u2118'),
- ('\u2119', '\u211d'), ('\u2124', '\u2124'),
- ('\u2126', '\u2126'), ('\u2128', '\u2128'),
- ('\u212a', '\u212d'), ('\u212e', '\u212e'),
- ('\u212f', '\u2134'), ('\u2135', '\u2138'),
- ('\u2139', '\u2139'), ('\u213c', '\u213f'),
- ('\u2145', '\u2149'), ('\u214e', '\u214e'),
- ('\u2160', '\u2182'), ('\u2183', '\u2184'),
- ('\u2185', '\u2188'), ('\u2c00', '\u2c2e'),
- ('\u2c30', '\u2c5e'), ('\u2c60', '\u2c7b'),
- ('\u2c7c', '\u2c7d'), ('\u2c7e', '\u2ce4'),
- ('\u2ceb', '\u2cee'), ('\u2cef', '\u2cf1'),
- ('\u2cf2', '\u2cf3'), ('\u2d00', '\u2d25'),
- ('\u2d27', '\u2d27'), ('\u2d2d', '\u2d2d'),
- ('\u2d30', '\u2d67'), ('\u2d6f', '\u2d6f'),
- ('\u2d7f', '\u2d7f'), ('\u2d80', '\u2d96'),
- ('\u2da0', '\u2da6'), ('\u2da8', '\u2dae'),
- ('\u2db0', '\u2db6'), ('\u2db8', '\u2dbe'),
- ('\u2dc0', '\u2dc6'), ('\u2dc8', '\u2dce'),
- ('\u2dd0', '\u2dd6'), ('\u2dd8', '\u2dde'),
- ('\u2de0', '\u2dff'), ('\u3005', '\u3005'),
- ('\u3006', '\u3006'), ('\u3007', '\u3007'),
- ('\u3021', '\u3029'), ('\u302a', '\u302d'),
- ('\u302e', '\u302f'), ('\u3031', '\u3035'),
- ('\u3038', '\u303a'), ('\u303b', '\u303b'),
- ('\u303c', '\u303c'), ('\u3041', '\u3096'),
- ('\u3099', '\u309a'), ('\u309d', '\u309e'),
- ('\u309f', '\u309f'), ('\u30a1', '\u30fa'),
- ('\u30fc', '\u30fe'), ('\u30ff', '\u30ff'),
- ('\u3105', '\u312d'), ('\u3131', '\u318e'),
- ('\u31a0', '\u31ba'), ('\u31f0', '\u31ff'),
- ('\u3400', '\u4db5'), ('\u4e00', '\u9fcc'),
- ('\ua000', '\ua014'), ('\ua015', '\ua015'),
- ('\ua016', '\ua48c'), ('\ua4d0', '\ua4f7'),
- ('\ua4f8', '\ua4fd'), ('\ua500', '\ua60b'),
- ('\ua60c', '\ua60c'), ('\ua610', '\ua61f'),
- ('\ua620', '\ua629'), ('\ua62a', '\ua62b'),
- ('\ua640', '\ua66d'), ('\ua66e', '\ua66e'),
- ('\ua66f', '\ua66f'), ('\ua674', '\ua67d'),
- ('\ua67f', '\ua67f'), ('\ua680', '\ua697'),
- ('\ua69f', '\ua69f'), ('\ua6a0', '\ua6e5'),
- ('\ua6e6', '\ua6ef'), ('\ua6f0', '\ua6f1'),
- ('\ua717', '\ua71f'), ('\ua722', '\ua76f'),
- ('\ua770', '\ua770'), ('\ua771', '\ua787'),
- ('\ua788', '\ua788'), ('\ua78b', '\ua78e'),
- ('\ua790', '\ua793'), ('\ua7a0', '\ua7aa'),
- ('\ua7f8', '\ua7f9'), ('\ua7fa', '\ua7fa'),
- ('\ua7fb', '\ua801'), ('\ua802', '\ua802'),
- ('\ua803', '\ua805'), ('\ua806', '\ua806'),
- ('\ua807', '\ua80a'), ('\ua80b', '\ua80b'),
- ('\ua80c', '\ua822'), ('\ua823', '\ua824'),
- ('\ua825', '\ua826'), ('\ua827', '\ua827'),
- ('\ua840', '\ua873'), ('\ua880', '\ua881'),
- ('\ua882', '\ua8b3'), ('\ua8b4', '\ua8c3'),
- ('\ua8c4', '\ua8c4'), ('\ua8d0', '\ua8d9'),
- ('\ua8e0', '\ua8f1'), ('\ua8f2', '\ua8f7'),
- ('\ua8fb', '\ua8fb'), ('\ua900', '\ua909'),
- ('\ua90a', '\ua925'), ('\ua926', '\ua92d'),
- ('\ua930', '\ua946'), ('\ua947', '\ua951'),
- ('\ua952', '\ua953'), ('\ua960', '\ua97c'),
- ('\ua980', '\ua982'), ('\ua983', '\ua983'),
- ('\ua984', '\ua9b2'), ('\ua9b3', '\ua9b3'),
- ('\ua9b4', '\ua9b5'), ('\ua9b6', '\ua9b9'),
- ('\ua9ba', '\ua9bb'), ('\ua9bc', '\ua9bc'),
- ('\ua9bd', '\ua9c0'), ('\ua9cf', '\ua9cf'),
- ('\ua9d0', '\ua9d9'), ('\uaa00', '\uaa28'),
- ('\uaa29', '\uaa2e'), ('\uaa2f', '\uaa30'),
- ('\uaa31', '\uaa32'), ('\uaa33', '\uaa34'),
- ('\uaa35', '\uaa36'), ('\uaa40', '\uaa42'),
- ('\uaa43', '\uaa43'), ('\uaa44', '\uaa4b'),
- ('\uaa4c', '\uaa4c'), ('\uaa4d', '\uaa4d'),
- ('\uaa50', '\uaa59'), ('\uaa60', '\uaa6f'),
- ('\uaa70', '\uaa70'), ('\uaa71', '\uaa76'),
- ('\uaa7a', '\uaa7a'), ('\uaa7b', '\uaa7b'),
- ('\uaa80', '\uaaaf'), ('\uaab0', '\uaab0'),
- ('\uaab1', '\uaab1'), ('\uaab2', '\uaab4'),
- ('\uaab5', '\uaab6'), ('\uaab7', '\uaab8'),
- ('\uaab9', '\uaabd'), ('\uaabe', '\uaabf'),
- ('\uaac0', '\uaac0'), ('\uaac1', '\uaac1'),
- ('\uaac2', '\uaac2'), ('\uaadb', '\uaadc'),
- ('\uaadd', '\uaadd'), ('\uaae0', '\uaaea'),
- ('\uaaeb', '\uaaeb'), ('\uaaec', '\uaaed'),
- ('\uaaee', '\uaaef'), ('\uaaf2', '\uaaf2'),
- ('\uaaf3', '\uaaf4'), ('\uaaf5', '\uaaf5'),
- ('\uaaf6', '\uaaf6'), ('\uab01', '\uab06'),
- ('\uab09', '\uab0e'), ('\uab11', '\uab16'),
- ('\uab20', '\uab26'), ('\uab28', '\uab2e'),
- ('\uabc0', '\uabe2'), ('\uabe3', '\uabe4'),
- ('\uabe5', '\uabe5'), ('\uabe6', '\uabe7'),
- ('\uabe8', '\uabe8'), ('\uabe9', '\uabea'),
- ('\uabec', '\uabec'), ('\uabed', '\uabed'),
- ('\uabf0', '\uabf9'), ('\uac00', '\ud7a3'),
- ('\ud7b0', '\ud7c6'), ('\ud7cb', '\ud7fb'),
- ('\uf900', '\ufa6d'), ('\ufa70', '\ufad9'),
- ('\ufb00', '\ufb06'), ('\ufb13', '\ufb17'),
- ('\ufb1d', '\ufb1d'), ('\ufb1e', '\ufb1e'),
- ('\ufb1f', '\ufb28'), ('\ufb2a', '\ufb36'),
- ('\ufb38', '\ufb3c'), ('\ufb3e', '\ufb3e'),
- ('\ufb40', '\ufb41'), ('\ufb43', '\ufb44'),
- ('\ufb46', '\ufbb1'), ('\ufbd3', '\ufc5d'),
- ('\ufc64', '\ufd3d'), ('\ufd50', '\ufd8f'),
- ('\ufd92', '\ufdc7'), ('\ufdf0', '\ufdf9'),
- ('\ufe00', '\ufe0f'), ('\ufe20', '\ufe26'),
- ('\ufe33', '\ufe34'), ('\ufe4d', '\ufe4f'),
- ('\ufe71', '\ufe71'), ('\ufe73', '\ufe73'),
- ('\ufe77', '\ufe77'), ('\ufe79', '\ufe79'),
- ('\ufe7b', '\ufe7b'), ('\ufe7d', '\ufe7d'),
- ('\ufe7f', '\ufefc'), ('\uff10', '\uff19'),
- ('\uff21', '\uff3a'), ('\uff3f', '\uff3f'),
- ('\uff41', '\uff5a'), ('\uff66', '\uff6f'),
- ('\uff70', '\uff70'), ('\uff71', '\uff9d'),
- ('\uff9e', '\uff9f'), ('\uffa0', '\uffbe'),
- ('\uffc2', '\uffc7'), ('\uffca', '\uffcf'),
- ('\uffd2', '\uffd7'), ('\uffda', '\uffdc'),
- ('\U00010000', '\U0001000b'), ('\U0001000d', '\U00010026'),
- ('\U00010028', '\U0001003a'), ('\U0001003c', '\U0001003d'),
- ('\U0001003f', '\U0001004d'), ('\U00010050', '\U0001005d'),
- ('\U00010080', '\U000100fa'), ('\U00010140', '\U00010174'),
- ('\U000101fd', '\U000101fd'), ('\U00010280', '\U0001029c'),
- ('\U000102a0', '\U000102d0'), ('\U00010300', '\U0001031e'),
- ('\U00010330', '\U00010340'), ('\U00010341', '\U00010341'),
- ('\U00010342', '\U00010349'), ('\U0001034a', '\U0001034a'),
- ('\U00010380', '\U0001039d'), ('\U000103a0', '\U000103c3'),
- ('\U000103c8', '\U000103cf'), ('\U000103d1', '\U000103d5'),
- ('\U00010400', '\U0001044f'), ('\U00010450', '\U0001049d'),
- ('\U000104a0', '\U000104a9'), ('\U00010800', '\U00010805'),
- ('\U00010808', '\U00010808'), ('\U0001080a', '\U00010835'),
- ('\U00010837', '\U00010838'), ('\U0001083c', '\U0001083c'),
- ('\U0001083f', '\U00010855'), ('\U00010900', '\U00010915'),
- ('\U00010920', '\U00010939'), ('\U00010980', '\U000109b7'),
- ('\U000109be', '\U000109bf'), ('\U00010a00', '\U00010a00'),
- ('\U00010a01', '\U00010a03'), ('\U00010a05', '\U00010a06'),
- ('\U00010a0c', '\U00010a0f'), ('\U00010a10', '\U00010a13'),
- ('\U00010a15', '\U00010a17'), ('\U00010a19', '\U00010a33'),
- ('\U00010a38', '\U00010a3a'), ('\U00010a3f', '\U00010a3f'),
- ('\U00010a60', '\U00010a7c'), ('\U00010b00', '\U00010b35'),
- ('\U00010b40', '\U00010b55'), ('\U00010b60', '\U00010b72'),
- ('\U00010c00', '\U00010c48'), ('\U00011000', '\U00011000'),
- ('\U00011001', '\U00011001'), ('\U00011002', '\U00011002'),
- ('\U00011003', '\U00011037'), ('\U00011038', '\U00011046'),
- ('\U00011066', '\U0001106f'), ('\U00011080', '\U00011081'),
- ('\U00011082', '\U00011082'), ('\U00011083', '\U000110af'),
- ('\U000110b0', '\U000110b2'), ('\U000110b3', '\U000110b6'),
- ('\U000110b7', '\U000110b8'), ('\U000110b9', '\U000110ba'),
- ('\U000110d0', '\U000110e8'), ('\U000110f0', '\U000110f9'),
- ('\U00011100', '\U00011102'), ('\U00011103', '\U00011126'),
- ('\U00011127', '\U0001112b'), ('\U0001112c', '\U0001112c'),
- ('\U0001112d', '\U00011134'), ('\U00011136', '\U0001113f'),
- ('\U00011180', '\U00011181'), ('\U00011182', '\U00011182'),
- ('\U00011183', '\U000111b2'), ('\U000111b3', '\U000111b5'),
- ('\U000111b6', '\U000111be'), ('\U000111bf', '\U000111c0'),
- ('\U000111c1', '\U000111c4'), ('\U000111d0', '\U000111d9'),
- ('\U00011680', '\U000116aa'), ('\U000116ab', '\U000116ab'),
- ('\U000116ac', '\U000116ac'), ('\U000116ad', '\U000116ad'),
- ('\U000116ae', '\U000116af'), ('\U000116b0', '\U000116b5'),
- ('\U000116b6', '\U000116b6'), ('\U000116b7', '\U000116b7'),
- ('\U000116c0', '\U000116c9'), ('\U00012000', '\U0001236e'),
- ('\U00012400', '\U00012462'), ('\U00013000', '\U0001342e'),
- ('\U00016800', '\U00016a38'), ('\U00016f00', '\U00016f44'),
- ('\U00016f50', '\U00016f50'), ('\U00016f51', '\U00016f7e'),
- ('\U00016f8f', '\U00016f92'), ('\U00016f93', '\U00016f9f'),
- ('\U0001b000', '\U0001b001'), ('\U0001d165', '\U0001d166'),
- ('\U0001d167', '\U0001d169'), ('\U0001d16d', '\U0001d172'),
- ('\U0001d17b', '\U0001d182'), ('\U0001d185', '\U0001d18b'),
- ('\U0001d1aa', '\U0001d1ad'), ('\U0001d242', '\U0001d244'),
- ('\U0001d400', '\U0001d454'), ('\U0001d456', '\U0001d49c'),
- ('\U0001d49e', '\U0001d49f'), ('\U0001d4a2', '\U0001d4a2'),
- ('\U0001d4a5', '\U0001d4a6'), ('\U0001d4a9', '\U0001d4ac'),
- ('\U0001d4ae', '\U0001d4b9'), ('\U0001d4bb', '\U0001d4bb'),
- ('\U0001d4bd', '\U0001d4c3'), ('\U0001d4c5', '\U0001d505'),
- ('\U0001d507', '\U0001d50a'), ('\U0001d50d', '\U0001d514'),
- ('\U0001d516', '\U0001d51c'), ('\U0001d51e', '\U0001d539'),
- ('\U0001d53b', '\U0001d53e'), ('\U0001d540', '\U0001d544'),
- ('\U0001d546', '\U0001d546'), ('\U0001d54a', '\U0001d550'),
- ('\U0001d552', '\U0001d6a5'), ('\U0001d6a8', '\U0001d6c0'),
- ('\U0001d6c2', '\U0001d6da'), ('\U0001d6dc', '\U0001d6fa'),
- ('\U0001d6fc', '\U0001d714'), ('\U0001d716', '\U0001d734'),
- ('\U0001d736', '\U0001d74e'), ('\U0001d750', '\U0001d76e'),
- ('\U0001d770', '\U0001d788'), ('\U0001d78a', '\U0001d7a8'),
- ('\U0001d7aa', '\U0001d7c2'), ('\U0001d7c4', '\U0001d7cb'),
- ('\U0001d7ce', '\U0001d7ff'), ('\U0001ee00', '\U0001ee03'),
- ('\U0001ee05', '\U0001ee1f'), ('\U0001ee21', '\U0001ee22'),
- ('\U0001ee24', '\U0001ee24'), ('\U0001ee27', '\U0001ee27'),
- ('\U0001ee29', '\U0001ee32'), ('\U0001ee34', '\U0001ee37'),
- ('\U0001ee39', '\U0001ee39'), ('\U0001ee3b', '\U0001ee3b'),
- ('\U0001ee42', '\U0001ee42'), ('\U0001ee47', '\U0001ee47'),
- ('\U0001ee49', '\U0001ee49'), ('\U0001ee4b', '\U0001ee4b'),
- ('\U0001ee4d', '\U0001ee4f'), ('\U0001ee51', '\U0001ee52'),
- ('\U0001ee54', '\U0001ee54'), ('\U0001ee57', '\U0001ee57'),
- ('\U0001ee59', '\U0001ee59'), ('\U0001ee5b', '\U0001ee5b'),
- ('\U0001ee5d', '\U0001ee5d'), ('\U0001ee5f', '\U0001ee5f'),
- ('\U0001ee61', '\U0001ee62'), ('\U0001ee64', '\U0001ee64'),
- ('\U0001ee67', '\U0001ee6a'), ('\U0001ee6c', '\U0001ee72'),
- ('\U0001ee74', '\U0001ee77'), ('\U0001ee79', '\U0001ee7c'),
- ('\U0001ee7e', '\U0001ee7e'), ('\U0001ee80', '\U0001ee89'),
- ('\U0001ee8b', '\U0001ee9b'), ('\U0001eea1', '\U0001eea3'),
- ('\U0001eea5', '\U0001eea9'), ('\U0001eeab', '\U0001eebb'),
- ('\U00020000', '\U0002a6d6'), ('\U0002a700', '\U0002b734'),
- ('\U0002b740', '\U0002b81d'), ('\U0002f800', '\U0002fa1d'),
- ('\U000e0100', '\U000e01ef')
- ];
-
- pub fn XID_Continue(c: char) -> bool {
- super::bsearch_range_table(c, XID_Continue_table)
- }
-
- static XID_Start_table : &'static [(char,char)] = &[
- ('\x41', '\x5a'), ('\x61', '\x7a'),
- ('\xaa', '\xaa'), ('\xb5', '\xb5'),
- ('\xba', '\xba'), ('\xc0', '\xd6'),
- ('\xd8', '\xf6'), ('\xf8', '\u01ba'),
- ('\u01bb', '\u01bb'), ('\u01bc', '\u01bf'),
- ('\u01c0', '\u01c3'), ('\u01c4', '\u0293'),
- ('\u0294', '\u0294'), ('\u0295', '\u02af'),
- ('\u02b0', '\u02c1'), ('\u02c6', '\u02d1'),
- ('\u02e0', '\u02e4'), ('\u02ec', '\u02ec'),
- ('\u02ee', '\u02ee'), ('\u0370', '\u0373'),
- ('\u0374', '\u0374'), ('\u0376', '\u0377'),
- ('\u037b', '\u037d'), ('\u0386', '\u0386'),
- ('\u0388', '\u038a'), ('\u038c', '\u038c'),
- ('\u038e', '\u03a1'), ('\u03a3', '\u03f5'),
- ('\u03f7', '\u0481'), ('\u048a', '\u0527'),
- ('\u0531', '\u0556'), ('\u0559', '\u0559'),
- ('\u0561', '\u0587'), ('\u05d0', '\u05ea'),
- ('\u05f0', '\u05f2'), ('\u0620', '\u063f'),
- ('\u0640', '\u0640'), ('\u0641', '\u064a'),
- ('\u066e', '\u066f'), ('\u0671', '\u06d3'),
- ('\u06d5', '\u06d5'), ('\u06e5', '\u06e6'),
- ('\u06ee', '\u06ef'), ('\u06fa', '\u06fc'),
- ('\u06ff', '\u06ff'), ('\u0710', '\u0710'),
- ('\u0712', '\u072f'), ('\u074d', '\u07a5'),
- ('\u07b1', '\u07b1'), ('\u07ca', '\u07ea'),
- ('\u07f4', '\u07f5'), ('\u07fa', '\u07fa'),
- ('\u0800', '\u0815'), ('\u081a', '\u081a'),
- ('\u0824', '\u0824'), ('\u0828', '\u0828'),
- ('\u0840', '\u0858'), ('\u08a0', '\u08a0'),
- ('\u08a2', '\u08ac'), ('\u0904', '\u0939'),
- ('\u093d', '\u093d'), ('\u0950', '\u0950'),
- ('\u0958', '\u0961'), ('\u0971', '\u0971'),
- ('\u0972', '\u0977'), ('\u0979', '\u097f'),
- ('\u0985', '\u098c'), ('\u098f', '\u0990'),
- ('\u0993', '\u09a8'), ('\u09aa', '\u09b0'),
- ('\u09b2', '\u09b2'), ('\u09b6', '\u09b9'),
- ('\u09bd', '\u09bd'), ('\u09ce', '\u09ce'),
- ('\u09dc', '\u09dd'), ('\u09df', '\u09e1'),
- ('\u09f0', '\u09f1'), ('\u0a05', '\u0a0a'),
- ('\u0a0f', '\u0a10'), ('\u0a13', '\u0a28'),
- ('\u0a2a', '\u0a30'), ('\u0a32', '\u0a33'),
- ('\u0a35', '\u0a36'), ('\u0a38', '\u0a39'),
- ('\u0a59', '\u0a5c'), ('\u0a5e', '\u0a5e'),
- ('\u0a72', '\u0a74'), ('\u0a85', '\u0a8d'),
- ('\u0a8f', '\u0a91'), ('\u0a93', '\u0aa8'),
- ('\u0aaa', '\u0ab0'), ('\u0ab2', '\u0ab3'),
- ('\u0ab5', '\u0ab9'), ('\u0abd', '\u0abd'),
- ('\u0ad0', '\u0ad0'), ('\u0ae0', '\u0ae1'),
- ('\u0b05', '\u0b0c'), ('\u0b0f', '\u0b10'),
- ('\u0b13', '\u0b28'), ('\u0b2a', '\u0b30'),
- ('\u0b32', '\u0b33'), ('\u0b35', '\u0b39'),
- ('\u0b3d', '\u0b3d'), ('\u0b5c', '\u0b5d'),
- ('\u0b5f', '\u0b61'), ('\u0b71', '\u0b71'),
- ('\u0b83', '\u0b83'), ('\u0b85', '\u0b8a'),
- ('\u0b8e', '\u0b90'), ('\u0b92', '\u0b95'),
- ('\u0b99', '\u0b9a'), ('\u0b9c', '\u0b9c'),
- ('\u0b9e', '\u0b9f'), ('\u0ba3', '\u0ba4'),
- ('\u0ba8', '\u0baa'), ('\u0bae', '\u0bb9'),
- ('\u0bd0', '\u0bd0'), ('\u0c05', '\u0c0c'),
- ('\u0c0e', '\u0c10'), ('\u0c12', '\u0c28'),
- ('\u0c2a', '\u0c33'), ('\u0c35', '\u0c39'),
- ('\u0c3d', '\u0c3d'), ('\u0c58', '\u0c59'),
- ('\u0c60', '\u0c61'), ('\u0c85', '\u0c8c'),
- ('\u0c8e', '\u0c90'), ('\u0c92', '\u0ca8'),
- ('\u0caa', '\u0cb3'), ('\u0cb5', '\u0cb9'),
- ('\u0cbd', '\u0cbd'), ('\u0cde', '\u0cde'),
- ('\u0ce0', '\u0ce1'), ('\u0cf1', '\u0cf2'),
- ('\u0d05', '\u0d0c'), ('\u0d0e', '\u0d10'),
- ('\u0d12', '\u0d3a'), ('\u0d3d', '\u0d3d'),
- ('\u0d4e', '\u0d4e'), ('\u0d60', '\u0d61'),
- ('\u0d7a', '\u0d7f'), ('\u0d85', '\u0d96'),
- ('\u0d9a', '\u0db1'), ('\u0db3', '\u0dbb'),
- ('\u0dbd', '\u0dbd'), ('\u0dc0', '\u0dc6'),
- ('\u0e01', '\u0e30'), ('\u0e32', '\u0e32'),
- ('\u0e40', '\u0e45'), ('\u0e46', '\u0e46'),
- ('\u0e81', '\u0e82'), ('\u0e84', '\u0e84'),
- ('\u0e87', '\u0e88'), ('\u0e8a', '\u0e8a'),
- ('\u0e8d', '\u0e8d'), ('\u0e94', '\u0e97'),
- ('\u0e99', '\u0e9f'), ('\u0ea1', '\u0ea3'),
- ('\u0ea5', '\u0ea5'), ('\u0ea7', '\u0ea7'),
- ('\u0eaa', '\u0eab'), ('\u0ead', '\u0eb0'),
- ('\u0eb2', '\u0eb2'), ('\u0ebd', '\u0ebd'),
- ('\u0ec0', '\u0ec4'), ('\u0ec6', '\u0ec6'),
- ('\u0edc', '\u0edf'), ('\u0f00', '\u0f00'),
- ('\u0f40', '\u0f47'), ('\u0f49', '\u0f6c'),
- ('\u0f88', '\u0f8c'), ('\u1000', '\u102a'),
- ('\u103f', '\u103f'), ('\u1050', '\u1055'),
- ('\u105a', '\u105d'), ('\u1061', '\u1061'),
- ('\u1065', '\u1066'), ('\u106e', '\u1070'),
- ('\u1075', '\u1081'), ('\u108e', '\u108e'),
- ('\u10a0', '\u10c5'), ('\u10c7', '\u10c7'),
- ('\u10cd', '\u10cd'), ('\u10d0', '\u10fa'),
- ('\u10fc', '\u10fc'), ('\u10fd', '\u1248'),
- ('\u124a', '\u124d'), ('\u1250', '\u1256'),
- ('\u1258', '\u1258'), ('\u125a', '\u125d'),
- ('\u1260', '\u1288'), ('\u128a', '\u128d'),
- ('\u1290', '\u12b0'), ('\u12b2', '\u12b5'),
- ('\u12b8', '\u12be'), ('\u12c0', '\u12c0'),
- ('\u12c2', '\u12c5'), ('\u12c8', '\u12d6'),
- ('\u12d8', '\u1310'), ('\u1312', '\u1315'),
- ('\u1318', '\u135a'), ('\u1380', '\u138f'),
- ('\u13a0', '\u13f4'), ('\u1401', '\u166c'),
- ('\u166f', '\u167f'), ('\u1681', '\u169a'),
- ('\u16a0', '\u16ea'), ('\u16ee', '\u16f0'),
- ('\u1700', '\u170c'), ('\u170e', '\u1711'),
- ('\u1720', '\u1731'), ('\u1740', '\u1751'),
- ('\u1760', '\u176c'), ('\u176e', '\u1770'),
- ('\u1780', '\u17b3'), ('\u17d7', '\u17d7'),
- ('\u17dc', '\u17dc'), ('\u1820', '\u1842'),
- ('\u1843', '\u1843'), ('\u1844', '\u1877'),
- ('\u1880', '\u18a8'), ('\u18aa', '\u18aa'),
- ('\u18b0', '\u18f5'), ('\u1900', '\u191c'),
- ('\u1950', '\u196d'), ('\u1970', '\u1974'),
- ('\u1980', '\u19ab'), ('\u19c1', '\u19c7'),
- ('\u1a00', '\u1a16'), ('\u1a20', '\u1a54'),
- ('\u1aa7', '\u1aa7'), ('\u1b05', '\u1b33'),
- ('\u1b45', '\u1b4b'), ('\u1b83', '\u1ba0'),
- ('\u1bae', '\u1baf'), ('\u1bba', '\u1be5'),
- ('\u1c00', '\u1c23'), ('\u1c4d', '\u1c4f'),
- ('\u1c5a', '\u1c77'), ('\u1c78', '\u1c7d'),
- ('\u1ce9', '\u1cec'), ('\u1cee', '\u1cf1'),
- ('\u1cf5', '\u1cf6'), ('\u1d00', '\u1d2b'),
- ('\u1d2c', '\u1d6a'), ('\u1d6b', '\u1d77'),
- ('\u1d78', '\u1d78'), ('\u1d79', '\u1d9a'),
- ('\u1d9b', '\u1dbf'), ('\u1e00', '\u1f15'),
- ('\u1f18', '\u1f1d'), ('\u1f20', '\u1f45'),
- ('\u1f48', '\u1f4d'), ('\u1f50', '\u1f57'),
- ('\u1f59', '\u1f59'), ('\u1f5b', '\u1f5b'),
- ('\u1f5d', '\u1f5d'), ('\u1f5f', '\u1f7d'),
- ('\u1f80', '\u1fb4'), ('\u1fb6', '\u1fbc'),
- ('\u1fbe', '\u1fbe'), ('\u1fc2', '\u1fc4'),
- ('\u1fc6', '\u1fcc'), ('\u1fd0', '\u1fd3'),
- ('\u1fd6', '\u1fdb'), ('\u1fe0', '\u1fec'),
- ('\u1ff2', '\u1ff4'), ('\u1ff6', '\u1ffc'),
- ('\u2071', '\u2071'), ('\u207f', '\u207f'),
- ('\u2090', '\u209c'), ('\u2102', '\u2102'),
- ('\u2107', '\u2107'), ('\u210a', '\u2113'),
- ('\u2115', '\u2115'), ('\u2118', '\u2118'),
- ('\u2119', '\u211d'), ('\u2124', '\u2124'),
- ('\u2126', '\u2126'), ('\u2128', '\u2128'),
- ('\u212a', '\u212d'), ('\u212e', '\u212e'),
- ('\u212f', '\u2134'), ('\u2135', '\u2138'),
- ('\u2139', '\u2139'), ('\u213c', '\u213f'),
- ('\u2145', '\u2149'), ('\u214e', '\u214e'),
- ('\u2160', '\u2182'), ('\u2183', '\u2184'),
- ('\u2185', '\u2188'), ('\u2c00', '\u2c2e'),
- ('\u2c30', '\u2c5e'), ('\u2c60', '\u2c7b'),
- ('\u2c7c', '\u2c7d'), ('\u2c7e', '\u2ce4'),
- ('\u2ceb', '\u2cee'), ('\u2cf2', '\u2cf3'),
- ('\u2d00', '\u2d25'), ('\u2d27', '\u2d27'),
- ('\u2d2d', '\u2d2d'), ('\u2d30', '\u2d67'),
- ('\u2d6f', '\u2d6f'), ('\u2d80', '\u2d96'),
- ('\u2da0', '\u2da6'), ('\u2da8', '\u2dae'),
- ('\u2db0', '\u2db6'), ('\u2db8', '\u2dbe'),
- ('\u2dc0', '\u2dc6'), ('\u2dc8', '\u2dce'),
- ('\u2dd0', '\u2dd6'), ('\u2dd8', '\u2dde'),
- ('\u3005', '\u3005'), ('\u3006', '\u3006'),
- ('\u3007', '\u3007'), ('\u3021', '\u3029'),
- ('\u3031', '\u3035'), ('\u3038', '\u303a'),
- ('\u303b', '\u303b'), ('\u303c', '\u303c'),
- ('\u3041', '\u3096'), ('\u309d', '\u309e'),
- ('\u309f', '\u309f'), ('\u30a1', '\u30fa'),
- ('\u30fc', '\u30fe'), ('\u30ff', '\u30ff'),
- ('\u3105', '\u312d'), ('\u3131', '\u318e'),
- ('\u31a0', '\u31ba'), ('\u31f0', '\u31ff'),
- ('\u3400', '\u4db5'), ('\u4e00', '\u9fcc'),
- ('\ua000', '\ua014'), ('\ua015', '\ua015'),
- ('\ua016', '\ua48c'), ('\ua4d0', '\ua4f7'),
- ('\ua4f8', '\ua4fd'), ('\ua500', '\ua60b'),
- ('\ua60c', '\ua60c'), ('\ua610', '\ua61f'),
- ('\ua62a', '\ua62b'), ('\ua640', '\ua66d'),
- ('\ua66e', '\ua66e'), ('\ua67f', '\ua67f'),
- ('\ua680', '\ua697'), ('\ua6a0', '\ua6e5'),
- ('\ua6e6', '\ua6ef'), ('\ua717', '\ua71f'),
- ('\ua722', '\ua76f'), ('\ua770', '\ua770'),
- ('\ua771', '\ua787'), ('\ua788', '\ua788'),
- ('\ua78b', '\ua78e'), ('\ua790', '\ua793'),
- ('\ua7a0', '\ua7aa'), ('\ua7f8', '\ua7f9'),
- ('\ua7fa', '\ua7fa'), ('\ua7fb', '\ua801'),
- ('\ua803', '\ua805'), ('\ua807', '\ua80a'),
- ('\ua80c', '\ua822'), ('\ua840', '\ua873'),
- ('\ua882', '\ua8b3'), ('\ua8f2', '\ua8f7'),
- ('\ua8fb', '\ua8fb'), ('\ua90a', '\ua925'),
- ('\ua930', '\ua946'), ('\ua960', '\ua97c'),
- ('\ua984', '\ua9b2'), ('\ua9cf', '\ua9cf'),
- ('\uaa00', '\uaa28'), ('\uaa40', '\uaa42'),
- ('\uaa44', '\uaa4b'), ('\uaa60', '\uaa6f'),
- ('\uaa70', '\uaa70'), ('\uaa71', '\uaa76'),
- ('\uaa7a', '\uaa7a'), ('\uaa80', '\uaaaf'),
- ('\uaab1', '\uaab1'), ('\uaab5', '\uaab6'),
- ('\uaab9', '\uaabd'), ('\uaac0', '\uaac0'),
- ('\uaac2', '\uaac2'), ('\uaadb', '\uaadc'),
- ('\uaadd', '\uaadd'), ('\uaae0', '\uaaea'),
- ('\uaaf2', '\uaaf2'), ('\uaaf3', '\uaaf4'),
- ('\uab01', '\uab06'), ('\uab09', '\uab0e'),
- ('\uab11', '\uab16'), ('\uab20', '\uab26'),
- ('\uab28', '\uab2e'), ('\uabc0', '\uabe2'),
- ('\uac00', '\ud7a3'), ('\ud7b0', '\ud7c6'),
- ('\ud7cb', '\ud7fb'), ('\uf900', '\ufa6d'),
- ('\ufa70', '\ufad9'), ('\ufb00', '\ufb06'),
- ('\ufb13', '\ufb17'), ('\ufb1d', '\ufb1d'),
- ('\ufb1f', '\ufb28'), ('\ufb2a', '\ufb36'),
- ('\ufb38', '\ufb3c'), ('\ufb3e', '\ufb3e'),
- ('\ufb40', '\ufb41'), ('\ufb43', '\ufb44'),
- ('\ufb46', '\ufbb1'), ('\ufbd3', '\ufc5d'),
- ('\ufc64', '\ufd3d'), ('\ufd50', '\ufd8f'),
- ('\ufd92', '\ufdc7'), ('\ufdf0', '\ufdf9'),
- ('\ufe71', '\ufe71'), ('\ufe73', '\ufe73'),
- ('\ufe77', '\ufe77'), ('\ufe79', '\ufe79'),
- ('\ufe7b', '\ufe7b'), ('\ufe7d', '\ufe7d'),
- ('\ufe7f', '\ufefc'), ('\uff21', '\uff3a'),
- ('\uff41', '\uff5a'), ('\uff66', '\uff6f'),
- ('\uff70', '\uff70'), ('\uff71', '\uff9d'),
- ('\uffa0', '\uffbe'), ('\uffc2', '\uffc7'),
- ('\uffca', '\uffcf'), ('\uffd2', '\uffd7'),
- ('\uffda', '\uffdc'), ('\U00010000', '\U0001000b'),
- ('\U0001000d', '\U00010026'), ('\U00010028', '\U0001003a'),
- ('\U0001003c', '\U0001003d'), ('\U0001003f', '\U0001004d'),
- ('\U00010050', '\U0001005d'), ('\U00010080', '\U000100fa'),
- ('\U00010140', '\U00010174'), ('\U00010280', '\U0001029c'),
- ('\U000102a0', '\U000102d0'), ('\U00010300', '\U0001031e'),
- ('\U00010330', '\U00010340'), ('\U00010341', '\U00010341'),
- ('\U00010342', '\U00010349'), ('\U0001034a', '\U0001034a'),
- ('\U00010380', '\U0001039d'), ('\U000103a0', '\U000103c3'),
- ('\U000103c8', '\U000103cf'), ('\U000103d1', '\U000103d5'),
- ('\U00010400', '\U0001044f'), ('\U00010450', '\U0001049d'),
- ('\U00010800', '\U00010805'), ('\U00010808', '\U00010808'),
- ('\U0001080a', '\U00010835'), ('\U00010837', '\U00010838'),
- ('\U0001083c', '\U0001083c'), ('\U0001083f', '\U00010855'),
- ('\U00010900', '\U00010915'), ('\U00010920', '\U00010939'),
- ('\U00010980', '\U000109b7'), ('\U000109be', '\U000109bf'),
- ('\U00010a00', '\U00010a00'), ('\U00010a10', '\U00010a13'),
- ('\U00010a15', '\U00010a17'), ('\U00010a19', '\U00010a33'),
- ('\U00010a60', '\U00010a7c'), ('\U00010b00', '\U00010b35'),
- ('\U00010b40', '\U00010b55'), ('\U00010b60', '\U00010b72'),
- ('\U00010c00', '\U00010c48'), ('\U00011003', '\U00011037'),
- ('\U00011083', '\U000110af'), ('\U000110d0', '\U000110e8'),
- ('\U00011103', '\U00011126'), ('\U00011183', '\U000111b2'),
- ('\U000111c1', '\U000111c4'), ('\U00011680', '\U000116aa'),
- ('\U00012000', '\U0001236e'), ('\U00012400', '\U00012462'),
- ('\U00013000', '\U0001342e'), ('\U00016800', '\U00016a38'),
- ('\U00016f00', '\U00016f44'), ('\U00016f50', '\U00016f50'),
- ('\U00016f93', '\U00016f9f'), ('\U0001b000', '\U0001b001'),
- ('\U0001d400', '\U0001d454'), ('\U0001d456', '\U0001d49c'),
- ('\U0001d49e', '\U0001d49f'), ('\U0001d4a2', '\U0001d4a2'),
- ('\U0001d4a5', '\U0001d4a6'), ('\U0001d4a9', '\U0001d4ac'),
- ('\U0001d4ae', '\U0001d4b9'), ('\U0001d4bb', '\U0001d4bb'),
- ('\U0001d4bd', '\U0001d4c3'), ('\U0001d4c5', '\U0001d505'),
- ('\U0001d507', '\U0001d50a'), ('\U0001d50d', '\U0001d514'),
- ('\U0001d516', '\U0001d51c'), ('\U0001d51e', '\U0001d539'),
- ('\U0001d53b', '\U0001d53e'), ('\U0001d540', '\U0001d544'),
- ('\U0001d546', '\U0001d546'), ('\U0001d54a', '\U0001d550'),
- ('\U0001d552', '\U0001d6a5'), ('\U0001d6a8', '\U0001d6c0'),
- ('\U0001d6c2', '\U0001d6da'), ('\U0001d6dc', '\U0001d6fa'),
- ('\U0001d6fc', '\U0001d714'), ('\U0001d716', '\U0001d734'),
- ('\U0001d736', '\U0001d74e'), ('\U0001d750', '\U0001d76e'),
- ('\U0001d770', '\U0001d788'), ('\U0001d78a', '\U0001d7a8'),
- ('\U0001d7aa', '\U0001d7c2'), ('\U0001d7c4', '\U0001d7cb'),
- ('\U0001ee00', '\U0001ee03'), ('\U0001ee05', '\U0001ee1f'),
- ('\U0001ee21', '\U0001ee22'), ('\U0001ee24', '\U0001ee24'),
- ('\U0001ee27', '\U0001ee27'), ('\U0001ee29', '\U0001ee32'),
- ('\U0001ee34', '\U0001ee37'), ('\U0001ee39', '\U0001ee39'),
- ('\U0001ee3b', '\U0001ee3b'), ('\U0001ee42', '\U0001ee42'),
- ('\U0001ee47', '\U0001ee47'), ('\U0001ee49', '\U0001ee49'),
- ('\U0001ee4b', '\U0001ee4b'), ('\U0001ee4d', '\U0001ee4f'),
- ('\U0001ee51', '\U0001ee52'), ('\U0001ee54', '\U0001ee54'),
- ('\U0001ee57', '\U0001ee57'), ('\U0001ee59', '\U0001ee59'),
- ('\U0001ee5b', '\U0001ee5b'), ('\U0001ee5d', '\U0001ee5d'),
- ('\U0001ee5f', '\U0001ee5f'), ('\U0001ee61', '\U0001ee62'),
- ('\U0001ee64', '\U0001ee64'), ('\U0001ee67', '\U0001ee6a'),
- ('\U0001ee6c', '\U0001ee72'), ('\U0001ee74', '\U0001ee77'),
- ('\U0001ee79', '\U0001ee7c'), ('\U0001ee7e', '\U0001ee7e'),
- ('\U0001ee80', '\U0001ee89'), ('\U0001ee8b', '\U0001ee9b'),
- ('\U0001eea1', '\U0001eea3'), ('\U0001eea5', '\U0001eea9'),
- ('\U0001eeab', '\U0001eebb'), ('\U00020000', '\U0002a6d6'),
- ('\U0002a700', '\U0002b734'), ('\U0002b740', '\U0002b81d'),
- ('\U0002f800', '\U0002fa1d')
- ];
-
- pub fn XID_Start(c: char) -> bool {
- super::bsearch_range_table(c, XID_Start_table)
- }
-}
-
-pub mod property {
- static White_Space_table : &'static [(char,char)] = &[
- ('\x09', '\x0d'), ('\x20', '\x20'),
- ('\x85', '\x85'), ('\xa0', '\xa0'),
- ('\u1680', '\u1680'), ('\u2000', '\u200a'),
- ('\u2028', '\u2028'), ('\u2029', '\u2029'),
- ('\u202f', '\u202f'), ('\u205f', '\u205f'),
- ('\u3000', '\u3000')
- ];
-
- pub fn White_Space(c: char) -> bool {
- super::bsearch_range_table(c, White_Space_table)
- }
-}
-
-pub mod conversions {
- use cmp::{Equal, Less, Greater};
- use slice::ImmutableVector;
- use tuple::Tuple2;
- use option::{Option, Some, None};
-
- pub fn to_lower(c: char) -> char {
- match bsearch_case_table(c, LuLl_table) {
- None => c,
- Some(index) => LuLl_table[index].val1()
- }
- }
-
- pub fn to_upper(c: char) -> char {
- match bsearch_case_table(c, LlLu_table) {
- None => c,
- Some(index) => LlLu_table[index].val1()
- }
- }
-
- fn bsearch_case_table(c: char, table: &'static [(char, char)]) -> Option<uint> {
- table.bsearch(|&(key, _)| {
- if c == key { Equal }
- else if key < c { Less }
- else { Greater }
- })
- }
-
- static LuLl_table : &'static [(char, char)] = &[
- ('\x41', '\x61'), ('\x42', '\x62'),
- ('\x43', '\x63'), ('\x44', '\x64'),
- ('\x45', '\x65'), ('\x46', '\x66'),
- ('\x47', '\x67'), ('\x48', '\x68'),
- ('\x49', '\x69'), ('\x4a', '\x6a'),
- ('\x4b', '\x6b'), ('\x4c', '\x6c'),
- ('\x4d', '\x6d'), ('\x4e', '\x6e'),
- ('\x4f', '\x6f'), ('\x50', '\x70'),
- ('\x51', '\x71'), ('\x52', '\x72'),
- ('\x53', '\x73'), ('\x54', '\x74'),
- ('\x55', '\x75'), ('\x56', '\x76'),
- ('\x57', '\x77'), ('\x58', '\x78'),
- ('\x59', '\x79'), ('\x5a', '\x7a'),
- ('\xc0', '\xe0'), ('\xc1', '\xe1'),
- ('\xc2', '\xe2'), ('\xc3', '\xe3'),
- ('\xc4', '\xe4'), ('\xc5', '\xe5'),
- ('\xc6', '\xe6'), ('\xc7', '\xe7'),
- ('\xc8', '\xe8'), ('\xc9', '\xe9'),
- ('\xca', '\xea'), ('\xcb', '\xeb'),
- ('\xcc', '\xec'), ('\xcd', '\xed'),
- ('\xce', '\xee'), ('\xcf', '\xef'),
- ('\xd0', '\xf0'), ('\xd1', '\xf1'),
- ('\xd2', '\xf2'), ('\xd3', '\xf3'),
- ('\xd4', '\xf4'), ('\xd5', '\xf5'),
- ('\xd6', '\xf6'), ('\xd8', '\xf8'),
- ('\xd9', '\xf9'), ('\xda', '\xfa'),
- ('\xdb', '\xfb'), ('\xdc', '\xfc'),
- ('\xdd', '\xfd'), ('\xde', '\xfe'),
- ('\u0100', '\u0101'), ('\u0102', '\u0103'),
- ('\u0104', '\u0105'), ('\u0106', '\u0107'),
- ('\u0108', '\u0109'), ('\u010a', '\u010b'),
- ('\u010c', '\u010d'), ('\u010e', '\u010f'),
- ('\u0110', '\u0111'), ('\u0112', '\u0113'),
- ('\u0114', '\u0115'), ('\u0116', '\u0117'),
- ('\u0118', '\u0119'), ('\u011a', '\u011b'),
- ('\u011c', '\u011d'), ('\u011e', '\u011f'),
- ('\u0120', '\u0121'), ('\u0122', '\u0123'),
- ('\u0124', '\u0125'), ('\u0126', '\u0127'),
- ('\u0128', '\u0129'), ('\u012a', '\u012b'),
- ('\u012c', '\u012d'), ('\u012e', '\u012f'),
- ('\u0130', '\x69'), ('\u0132', '\u0133'),
- ('\u0134', '\u0135'), ('\u0136', '\u0137'),
- ('\u0139', '\u013a'), ('\u013b', '\u013c'),
- ('\u013d', '\u013e'), ('\u013f', '\u0140'),
- ('\u0141', '\u0142'), ('\u0143', '\u0144'),
- ('\u0145', '\u0146'), ('\u0147', '\u0148'),
- ('\u014a', '\u014b'), ('\u014c', '\u014d'),
- ('\u014e', '\u014f'), ('\u0150', '\u0151'),
- ('\u0152', '\u0153'), ('\u0154', '\u0155'),
- ('\u0156', '\u0157'), ('\u0158', '\u0159'),
- ('\u015a', '\u015b'), ('\u015c', '\u015d'),
- ('\u015e', '\u015f'), ('\u0160', '\u0161'),
- ('\u0162', '\u0163'), ('\u0164', '\u0165'),
- ('\u0166', '\u0167'), ('\u0168', '\u0169'),
- ('\u016a', '\u016b'), ('\u016c', '\u016d'),
- ('\u016e', '\u016f'), ('\u0170', '\u0171'),
- ('\u0172', '\u0173'), ('\u0174', '\u0175'),
- ('\u0176', '\u0177'), ('\u0178', '\xff'),
- ('\u0179', '\u017a'), ('\u017b', '\u017c'),
- ('\u017d', '\u017e'), ('\u0181', '\u0253'),
- ('\u0182', '\u0183'), ('\u0184', '\u0185'),
- ('\u0186', '\u0254'), ('\u0187', '\u0188'),
- ('\u0189', '\u0256'), ('\u018a', '\u0257'),
- ('\u018b', '\u018c'), ('\u018e', '\u01dd'),
- ('\u018f', '\u0259'), ('\u0190', '\u025b'),
- ('\u0191', '\u0192'), ('\u0193', '\u0260'),
- ('\u0194', '\u0263'), ('\u0196', '\u0269'),
- ('\u0197', '\u0268'), ('\u0198', '\u0199'),
- ('\u019c', '\u026f'), ('\u019d', '\u0272'),
- ('\u019f', '\u0275'), ('\u01a0', '\u01a1'),
- ('\u01a2', '\u01a3'), ('\u01a4', '\u01a5'),
- ('\u01a6', '\u0280'), ('\u01a7', '\u01a8'),
- ('\u01a9', '\u0283'), ('\u01ac', '\u01ad'),
- ('\u01ae', '\u0288'), ('\u01af', '\u01b0'),
- ('\u01b1', '\u028a'), ('\u01b2', '\u028b'),
- ('\u01b3', '\u01b4'), ('\u01b5', '\u01b6'),
- ('\u01b7', '\u0292'), ('\u01b8', '\u01b9'),
- ('\u01bc', '\u01bd'), ('\u01c4', '\u01c6'),
- ('\u01c7', '\u01c9'), ('\u01ca', '\u01cc'),
- ('\u01cd', '\u01ce'), ('\u01cf', '\u01d0'),
- ('\u01d1', '\u01d2'), ('\u01d3', '\u01d4'),
- ('\u01d5', '\u01d6'), ('\u01d7', '\u01d8'),
- ('\u01d9', '\u01da'), ('\u01db', '\u01dc'),
- ('\u01de', '\u01df'), ('\u01e0', '\u01e1'),
- ('\u01e2', '\u01e3'), ('\u01e4', '\u01e5'),
- ('\u01e6', '\u01e7'), ('\u01e8', '\u01e9'),
- ('\u01ea', '\u01eb'), ('\u01ec', '\u01ed'),
- ('\u01ee', '\u01ef'), ('\u01f1', '\u01f3'),
- ('\u01f4', '\u01f5'), ('\u01f6', '\u0195'),
- ('\u01f7', '\u01bf'), ('\u01f8', '\u01f9'),
- ('\u01fa', '\u01fb'), ('\u01fc', '\u01fd'),
- ('\u01fe', '\u01ff'), ('\u0200', '\u0201'),
- ('\u0202', '\u0203'), ('\u0204', '\u0205'),
- ('\u0206', '\u0207'), ('\u0208', '\u0209'),
- ('\u020a', '\u020b'), ('\u020c', '\u020d'),
- ('\u020e', '\u020f'), ('\u0210', '\u0211'),
- ('\u0212', '\u0213'), ('\u0214', '\u0215'),
- ('\u0216', '\u0217'), ('\u0218', '\u0219'),
- ('\u021a', '\u021b'), ('\u021c', '\u021d'),
- ('\u021e', '\u021f'), ('\u0220', '\u019e'),
- ('\u0222', '\u0223'), ('\u0224', '\u0225'),
- ('\u0226', '\u0227'), ('\u0228', '\u0229'),
- ('\u022a', '\u022b'), ('\u022c', '\u022d'),
- ('\u022e', '\u022f'), ('\u0230', '\u0231'),
- ('\u0232', '\u0233'), ('\u023a', '\u2c65'),
- ('\u023b', '\u023c'), ('\u023d', '\u019a'),
- ('\u023e', '\u2c66'), ('\u0241', '\u0242'),
- ('\u0243', '\u0180'), ('\u0244', '\u0289'),
- ('\u0245', '\u028c'), ('\u0246', '\u0247'),
- ('\u0248', '\u0249'), ('\u024a', '\u024b'),
- ('\u024c', '\u024d'), ('\u024e', '\u024f'),
- ('\u0370', '\u0371'), ('\u0372', '\u0373'),
- ('\u0376', '\u0377'), ('\u0386', '\u03ac'),
- ('\u0388', '\u03ad'), ('\u0389', '\u03ae'),
- ('\u038a', '\u03af'), ('\u038c', '\u03cc'),
- ('\u038e', '\u03cd'), ('\u038f', '\u03ce'),
- ('\u0391', '\u03b1'), ('\u0392', '\u03b2'),
- ('\u0393', '\u03b3'), ('\u0394', '\u03b4'),
- ('\u0395', '\u03b5'), ('\u0396', '\u03b6'),
- ('\u0397', '\u03b7'), ('\u0398', '\u03b8'),
- ('\u0399', '\u03b9'), ('\u039a', '\u03ba'),
- ('\u039b', '\u03bb'), ('\u039c', '\u03bc'),
- ('\u039d', '\u03bd'), ('\u039e', '\u03be'),
- ('\u039f', '\u03bf'), ('\u03a0', '\u03c0'),
- ('\u03a1', '\u03c1'), ('\u03a3', '\u03c3'),
- ('\u03a4', '\u03c4'), ('\u03a5', '\u03c5'),
- ('\u03a6', '\u03c6'), ('\u03a7', '\u03c7'),
- ('\u03a8', '\u03c8'), ('\u03a9', '\u03c9'),
- ('\u03aa', '\u03ca'), ('\u03ab', '\u03cb'),
- ('\u03cf', '\u03d7'), ('\u03d8', '\u03d9'),
- ('\u03da', '\u03db'), ('\u03dc', '\u03dd'),
- ('\u03de', '\u03df'), ('\u03e0', '\u03e1'),
- ('\u03e2', '\u03e3'), ('\u03e4', '\u03e5'),
- ('\u03e6', '\u03e7'), ('\u03e8', '\u03e9'),
- ('\u03ea', '\u03eb'), ('\u03ec', '\u03ed'),
- ('\u03ee', '\u03ef'), ('\u03f4', '\u03b8'),
- ('\u03f7', '\u03f8'), ('\u03f9', '\u03f2'),
- ('\u03fa', '\u03fb'), ('\u03fd', '\u037b'),
- ('\u03fe', '\u037c'), ('\u03ff', '\u037d'),
- ('\u0400', '\u0450'), ('\u0401', '\u0451'),
- ('\u0402', '\u0452'), ('\u0403', '\u0453'),
- ('\u0404', '\u0454'), ('\u0405', '\u0455'),
- ('\u0406', '\u0456'), ('\u0407', '\u0457'),
- ('\u0408', '\u0458'), ('\u0409', '\u0459'),
- ('\u040a', '\u045a'), ('\u040b', '\u045b'),
- ('\u040c', '\u045c'), ('\u040d', '\u045d'),
- ('\u040e', '\u045e'), ('\u040f', '\u045f'),
- ('\u0410', '\u0430'), ('\u0411', '\u0431'),
- ('\u0412', '\u0432'), ('\u0413', '\u0433'),
- ('\u0414', '\u0434'), ('\u0415', '\u0435'),
- ('\u0416', '\u0436'), ('\u0417', '\u0437'),
- ('\u0418', '\u0438'), ('\u0419', '\u0439'),
- ('\u041a', '\u043a'), ('\u041b', '\u043b'),
- ('\u041c', '\u043c'), ('\u041d', '\u043d'),
- ('\u041e', '\u043e'), ('\u041f', '\u043f'),
- ('\u0420', '\u0440'), ('\u0421', '\u0441'),
- ('\u0422', '\u0442'), ('\u0423', '\u0443'),
- ('\u0424', '\u0444'), ('\u0425', '\u0445'),
- ('\u0426', '\u0446'), ('\u0427', '\u0447'),
- ('\u0428', '\u0448'), ('\u0429', '\u0449'),
- ('\u042a', '\u044a'), ('\u042b', '\u044b'),
- ('\u042c', '\u044c'), ('\u042d', '\u044d'),
- ('\u042e', '\u044e'), ('\u042f', '\u044f'),
- ('\u0460', '\u0461'), ('\u0462', '\u0463'),
- ('\u0464', '\u0465'), ('\u0466', '\u0467'),
- ('\u0468', '\u0469'), ('\u046a', '\u046b'),
- ('\u046c', '\u046d'), ('\u046e', '\u046f'),
- ('\u0470', '\u0471'), ('\u0472', '\u0473'),
- ('\u0474', '\u0475'), ('\u0476', '\u0477'),
- ('\u0478', '\u0479'), ('\u047a', '\u047b'),
- ('\u047c', '\u047d'), ('\u047e', '\u047f'),
- ('\u0480', '\u0481'), ('\u048a', '\u048b'),
- ('\u048c', '\u048d'), ('\u048e', '\u048f'),
- ('\u0490', '\u0491'), ('\u0492', '\u0493'),
- ('\u0494', '\u0495'), ('\u0496', '\u0497'),
- ('\u0498', '\u0499'), ('\u049a', '\u049b'),
- ('\u049c', '\u049d'), ('\u049e', '\u049f'),
- ('\u04a0', '\u04a1'), ('\u04a2', '\u04a3'),
- ('\u04a4', '\u04a5'), ('\u04a6', '\u04a7'),
- ('\u04a8', '\u04a9'), ('\u04aa', '\u04ab'),
- ('\u04ac', '\u04ad'), ('\u04ae', '\u04af'),
- ('\u04b0', '\u04b1'), ('\u04b2', '\u04b3'),
- ('\u04b4', '\u04b5'), ('\u04b6', '\u04b7'),
- ('\u04b8', '\u04b9'), ('\u04ba', '\u04bb'),
- ('\u04bc', '\u04bd'), ('\u04be', '\u04bf'),
- ('\u04c0', '\u04cf'), ('\u04c1', '\u04c2'),
- ('\u04c3', '\u04c4'), ('\u04c5', '\u04c6'),
- ('\u04c7', '\u04c8'), ('\u04c9', '\u04ca'),
- ('\u04cb', '\u04cc'), ('\u04cd', '\u04ce'),
- ('\u04d0', '\u04d1'), ('\u04d2', '\u04d3'),
- ('\u04d4', '\u04d5'), ('\u04d6', '\u04d7'),
- ('\u04d8', '\u04d9'), ('\u04da', '\u04db'),
- ('\u04dc', '\u04dd'), ('\u04de', '\u04df'),
- ('\u04e0', '\u04e1'), ('\u04e2', '\u04e3'),
- ('\u04e4', '\u04e5'), ('\u04e6', '\u04e7'),
- ('\u04e8', '\u04e9'), ('\u04ea', '\u04eb'),
- ('\u04ec', '\u04ed'), ('\u04ee', '\u04ef'),
- ('\u04f0', '\u04f1'), ('\u04f2', '\u04f3'),
- ('\u04f4', '\u04f5'), ('\u04f6', '\u04f7'),
- ('\u04f8', '\u04f9'), ('\u04fa', '\u04fb'),
- ('\u04fc', '\u04fd'), ('\u04fe', '\u04ff'),
- ('\u0500', '\u0501'), ('\u0502', '\u0503'),
- ('\u0504', '\u0505'), ('\u0506', '\u0507'),
- ('\u0508', '\u0509'), ('\u050a', '\u050b'),
- ('\u050c', '\u050d'), ('\u050e', '\u050f'),
- ('\u0510', '\u0511'), ('\u0512', '\u0513'),
- ('\u0514', '\u0515'), ('\u0516', '\u0517'),
- ('\u0518', '\u0519'), ('\u051a', '\u051b'),
- ('\u051c', '\u051d'), ('\u051e', '\u051f'),
- ('\u0520', '\u0521'), ('\u0522', '\u0523'),
- ('\u0524', '\u0525'), ('\u0526', '\u0527'),
- ('\u0531', '\u0561'), ('\u0532', '\u0562'),
- ('\u0533', '\u0563'), ('\u0534', '\u0564'),
- ('\u0535', '\u0565'), ('\u0536', '\u0566'),
- ('\u0537', '\u0567'), ('\u0538', '\u0568'),
- ('\u0539', '\u0569'), ('\u053a', '\u056a'),
- ('\u053b', '\u056b'), ('\u053c', '\u056c'),
- ('\u053d', '\u056d'), ('\u053e', '\u056e'),
- ('\u053f', '\u056f'), ('\u0540', '\u0570'),
- ('\u0541', '\u0571'), ('\u0542', '\u0572'),
- ('\u0543', '\u0573'), ('\u0544', '\u0574'),
- ('\u0545', '\u0575'), ('\u0546', '\u0576'),
- ('\u0547', '\u0577'), ('\u0548', '\u0578'),
- ('\u0549', '\u0579'), ('\u054a', '\u057a'),
- ('\u054b', '\u057b'), ('\u054c', '\u057c'),
- ('\u054d', '\u057d'), ('\u054e', '\u057e'),
- ('\u054f', '\u057f'), ('\u0550', '\u0580'),
- ('\u0551', '\u0581'), ('\u0552', '\u0582'),
- ('\u0553', '\u0583'), ('\u0554', '\u0584'),
- ('\u0555', '\u0585'), ('\u0556', '\u0586'),
- ('\u10a0', '\u2d00'), ('\u10a1', '\u2d01'),
- ('\u10a2', '\u2d02'), ('\u10a3', '\u2d03'),
- ('\u10a4', '\u2d04'), ('\u10a5', '\u2d05'),
- ('\u10a6', '\u2d06'), ('\u10a7', '\u2d07'),
- ('\u10a8', '\u2d08'), ('\u10a9', '\u2d09'),
- ('\u10aa', '\u2d0a'), ('\u10ab', '\u2d0b'),
- ('\u10ac', '\u2d0c'), ('\u10ad', '\u2d0d'),
- ('\u10ae', '\u2d0e'), ('\u10af', '\u2d0f'),
- ('\u10b0', '\u2d10'), ('\u10b1', '\u2d11'),
- ('\u10b2', '\u2d12'), ('\u10b3', '\u2d13'),
- ('\u10b4', '\u2d14'), ('\u10b5', '\u2d15'),
- ('\u10b6', '\u2d16'), ('\u10b7', '\u2d17'),
- ('\u10b8', '\u2d18'), ('\u10b9', '\u2d19'),
- ('\u10ba', '\u2d1a'), ('\u10bb', '\u2d1b'),
- ('\u10bc', '\u2d1c'), ('\u10bd', '\u2d1d'),
- ('\u10be', '\u2d1e'), ('\u10bf', '\u2d1f'),
- ('\u10c0', '\u2d20'), ('\u10c1', '\u2d21'),
- ('\u10c2', '\u2d22'), ('\u10c3', '\u2d23'),
- ('\u10c4', '\u2d24'), ('\u10c5', '\u2d25'),
- ('\u10c7', '\u2d27'), ('\u10cd', '\u2d2d'),
- ('\u1e00', '\u1e01'), ('\u1e02', '\u1e03'),
- ('\u1e04', '\u1e05'), ('\u1e06', '\u1e07'),
- ('\u1e08', '\u1e09'), ('\u1e0a', '\u1e0b'),
- ('\u1e0c', '\u1e0d'), ('\u1e0e', '\u1e0f'),
- ('\u1e10', '\u1e11'), ('\u1e12', '\u1e13'),
- ('\u1e14', '\u1e15'), ('\u1e16', '\u1e17'),
- ('\u1e18', '\u1e19'), ('\u1e1a', '\u1e1b'),
- ('\u1e1c', '\u1e1d'), ('\u1e1e', '\u1e1f'),
- ('\u1e20', '\u1e21'), ('\u1e22', '\u1e23'),
- ('\u1e24', '\u1e25'), ('\u1e26', '\u1e27'),
- ('\u1e28', '\u1e29'), ('\u1e2a', '\u1e2b'),
- ('\u1e2c', '\u1e2d'), ('\u1e2e', '\u1e2f'),
- ('\u1e30', '\u1e31'), ('\u1e32', '\u1e33'),
- ('\u1e34', '\u1e35'), ('\u1e36', '\u1e37'),
- ('\u1e38', '\u1e39'), ('\u1e3a', '\u1e3b'),
- ('\u1e3c', '\u1e3d'), ('\u1e3e', '\u1e3f'),
- ('\u1e40', '\u1e41'), ('\u1e42', '\u1e43'),
- ('\u1e44', '\u1e45'), ('\u1e46', '\u1e47'),
- ('\u1e48', '\u1e49'), ('\u1e4a', '\u1e4b'),
- ('\u1e4c', '\u1e4d'), ('\u1e4e', '\u1e4f'),
- ('\u1e50', '\u1e51'), ('\u1e52', '\u1e53'),
- ('\u1e54', '\u1e55'), ('\u1e56', '\u1e57'),
- ('\u1e58', '\u1e59'), ('\u1e5a', '\u1e5b'),
- ('\u1e5c', '\u1e5d'), ('\u1e5e', '\u1e5f'),
- ('\u1e60', '\u1e61'), ('\u1e62', '\u1e63'),
- ('\u1e64', '\u1e65'), ('\u1e66', '\u1e67'),
- ('\u1e68', '\u1e69'), ('\u1e6a', '\u1e6b'),
- ('\u1e6c', '\u1e6d'), ('\u1e6e', '\u1e6f'),
- ('\u1e70', '\u1e71'), ('\u1e72', '\u1e73'),
- ('\u1e74', '\u1e75'), ('\u1e76', '\u1e77'),
- ('\u1e78', '\u1e79'), ('\u1e7a', '\u1e7b'),
- ('\u1e7c', '\u1e7d'), ('\u1e7e', '\u1e7f'),
- ('\u1e80', '\u1e81'), ('\u1e82', '\u1e83'),
- ('\u1e84', '\u1e85'), ('\u1e86', '\u1e87'),
- ('\u1e88', '\u1e89'), ('\u1e8a', '\u1e8b'),
- ('\u1e8c', '\u1e8d'), ('\u1e8e', '\u1e8f'),
- ('\u1e90', '\u1e91'), ('\u1e92', '\u1e93'),
- ('\u1e94', '\u1e95'), ('\u1e9e', '\xdf'),
- ('\u1ea0', '\u1ea1'), ('\u1ea2', '\u1ea3'),
- ('\u1ea4', '\u1ea5'), ('\u1ea6', '\u1ea7'),
- ('\u1ea8', '\u1ea9'), ('\u1eaa', '\u1eab'),
- ('\u1eac', '\u1ead'), ('\u1eae', '\u1eaf'),
- ('\u1eb0', '\u1eb1'), ('\u1eb2', '\u1eb3'),
- ('\u1eb4', '\u1eb5'), ('\u1eb6', '\u1eb7'),
- ('\u1eb8', '\u1eb9'), ('\u1eba', '\u1ebb'),
- ('\u1ebc', '\u1ebd'), ('\u1ebe', '\u1ebf'),
- ('\u1ec0', '\u1ec1'), ('\u1ec2', '\u1ec3'),
- ('\u1ec4', '\u1ec5'), ('\u1ec6', '\u1ec7'),
- ('\u1ec8', '\u1ec9'), ('\u1eca', '\u1ecb'),
- ('\u1ecc', '\u1ecd'), ('\u1ece', '\u1ecf'),
- ('\u1ed0', '\u1ed1'), ('\u1ed2', '\u1ed3'),
- ('\u1ed4', '\u1ed5'), ('\u1ed6', '\u1ed7'),
- ('\u1ed8', '\u1ed9'), ('\u1eda', '\u1edb'),
- ('\u1edc', '\u1edd'), ('\u1ede', '\u1edf'),
- ('\u1ee0', '\u1ee1'), ('\u1ee2', '\u1ee3'),
- ('\u1ee4', '\u1ee5'), ('\u1ee6', '\u1ee7'),
- ('\u1ee8', '\u1ee9'), ('\u1eea', '\u1eeb'),
- ('\u1eec', '\u1eed'), ('\u1eee', '\u1eef'),
- ('\u1ef0', '\u1ef1'), ('\u1ef2', '\u1ef3'),
- ('\u1ef4', '\u1ef5'), ('\u1ef6', '\u1ef7'),
- ('\u1ef8', '\u1ef9'), ('\u1efa', '\u1efb'),
- ('\u1efc', '\u1efd'), ('\u1efe', '\u1eff'),
- ('\u1f08', '\u1f00'), ('\u1f09', '\u1f01'),
- ('\u1f0a', '\u1f02'), ('\u1f0b', '\u1f03'),
- ('\u1f0c', '\u1f04'), ('\u1f0d', '\u1f05'),
- ('\u1f0e', '\u1f06'), ('\u1f0f', '\u1f07'),
- ('\u1f18', '\u1f10'), ('\u1f19', '\u1f11'),
- ('\u1f1a', '\u1f12'), ('\u1f1b', '\u1f13'),
- ('\u1f1c', '\u1f14'), ('\u1f1d', '\u1f15'),
- ('\u1f28', '\u1f20'), ('\u1f29', '\u1f21'),
- ('\u1f2a', '\u1f22'), ('\u1f2b', '\u1f23'),
- ('\u1f2c', '\u1f24'), ('\u1f2d', '\u1f25'),
- ('\u1f2e', '\u1f26'), ('\u1f2f', '\u1f27'),
- ('\u1f38', '\u1f30'), ('\u1f39', '\u1f31'),
- ('\u1f3a', '\u1f32'), ('\u1f3b', '\u1f33'),
- ('\u1f3c', '\u1f34'), ('\u1f3d', '\u1f35'),
- ('\u1f3e', '\u1f36'), ('\u1f3f', '\u1f37'),
- ('\u1f48', '\u1f40'), ('\u1f49', '\u1f41'),
- ('\u1f4a', '\u1f42'), ('\u1f4b', '\u1f43'),
- ('\u1f4c', '\u1f44'), ('\u1f4d', '\u1f45'),
- ('\u1f59', '\u1f51'), ('\u1f5b', '\u1f53'),
- ('\u1f5d', '\u1f55'), ('\u1f5f', '\u1f57'),
- ('\u1f68', '\u1f60'), ('\u1f69', '\u1f61'),
- ('\u1f6a', '\u1f62'), ('\u1f6b', '\u1f63'),
- ('\u1f6c', '\u1f64'), ('\u1f6d', '\u1f65'),
- ('\u1f6e', '\u1f66'), ('\u1f6f', '\u1f67'),
- ('\u1fb8', '\u1fb0'), ('\u1fb9', '\u1fb1'),
- ('\u1fba', '\u1f70'), ('\u1fbb', '\u1f71'),
- ('\u1fc8', '\u1f72'), ('\u1fc9', '\u1f73'),
- ('\u1fca', '\u1f74'), ('\u1fcb', '\u1f75'),
- ('\u1fd8', '\u1fd0'), ('\u1fd9', '\u1fd1'),
- ('\u1fda', '\u1f76'), ('\u1fdb', '\u1f77'),
- ('\u1fe8', '\u1fe0'), ('\u1fe9', '\u1fe1'),
- ('\u1fea', '\u1f7a'), ('\u1feb', '\u1f7b'),
- ('\u1fec', '\u1fe5'), ('\u1ff8', '\u1f78'),
- ('\u1ff9', '\u1f79'), ('\u1ffa', '\u1f7c'),
- ('\u1ffb', '\u1f7d'), ('\u2126', '\u03c9'),
- ('\u212a', '\x6b'), ('\u212b', '\xe5'),
- ('\u2132', '\u214e'), ('\u2183', '\u2184'),
- ('\u2c00', '\u2c30'), ('\u2c01', '\u2c31'),
- ('\u2c02', '\u2c32'), ('\u2c03', '\u2c33'),
- ('\u2c04', '\u2c34'), ('\u2c05', '\u2c35'),
- ('\u2c06', '\u2c36'), ('\u2c07', '\u2c37'),
- ('\u2c08', '\u2c38'), ('\u2c09', '\u2c39'),
- ('\u2c0a', '\u2c3a'), ('\u2c0b', '\u2c3b'),
- ('\u2c0c', '\u2c3c'), ('\u2c0d', '\u2c3d'),
- ('\u2c0e', '\u2c3e'), ('\u2c0f', '\u2c3f'),
- ('\u2c10', '\u2c40'), ('\u2c11', '\u2c41'),
- ('\u2c12', '\u2c42'), ('\u2c13', '\u2c43'),
- ('\u2c14', '\u2c44'), ('\u2c15', '\u2c45'),
- ('\u2c16', '\u2c46'), ('\u2c17', '\u2c47'),
- ('\u2c18', '\u2c48'), ('\u2c19', '\u2c49'),
- ('\u2c1a', '\u2c4a'), ('\u2c1b', '\u2c4b'),
- ('\u2c1c', '\u2c4c'), ('\u2c1d', '\u2c4d'),
- ('\u2c1e', '\u2c4e'), ('\u2c1f', '\u2c4f'),
- ('\u2c20', '\u2c50'), ('\u2c21', '\u2c51'),
- ('\u2c22', '\u2c52'), ('\u2c23', '\u2c53'),
- ('\u2c24', '\u2c54'), ('\u2c25', '\u2c55'),
- ('\u2c26', '\u2c56'), ('\u2c27', '\u2c57'),
- ('\u2c28', '\u2c58'), ('\u2c29', '\u2c59'),
- ('\u2c2a', '\u2c5a'), ('\u2c2b', '\u2c5b'),
- ('\u2c2c', '\u2c5c'), ('\u2c2d', '\u2c5d'),
- ('\u2c2e', '\u2c5e'), ('\u2c60', '\u2c61'),
- ('\u2c62', '\u026b'), ('\u2c63', '\u1d7d'),
- ('\u2c64', '\u027d'), ('\u2c67', '\u2c68'),
- ('\u2c69', '\u2c6a'), ('\u2c6b', '\u2c6c'),
- ('\u2c6d', '\u0251'), ('\u2c6e', '\u0271'),
- ('\u2c6f', '\u0250'), ('\u2c70', '\u0252'),
- ('\u2c72', '\u2c73'), ('\u2c75', '\u2c76'),
- ('\u2c7e', '\u023f'), ('\u2c7f', '\u0240'),
- ('\u2c80', '\u2c81'), ('\u2c82', '\u2c83'),
- ('\u2c84', '\u2c85'), ('\u2c86', '\u2c87'),
- ('\u2c88', '\u2c89'), ('\u2c8a', '\u2c8b'),
- ('\u2c8c', '\u2c8d'), ('\u2c8e', '\u2c8f'),
- ('\u2c90', '\u2c91'), ('\u2c92', '\u2c93'),
- ('\u2c94', '\u2c95'), ('\u2c96', '\u2c97'),
- ('\u2c98', '\u2c99'), ('\u2c9a', '\u2c9b'),
- ('\u2c9c', '\u2c9d'), ('\u2c9e', '\u2c9f'),
- ('\u2ca0', '\u2ca1'), ('\u2ca2', '\u2ca3'),
- ('\u2ca4', '\u2ca5'), ('\u2ca6', '\u2ca7'),
- ('\u2ca8', '\u2ca9'), ('\u2caa', '\u2cab'),
- ('\u2cac', '\u2cad'), ('\u2cae', '\u2caf'),
- ('\u2cb0', '\u2cb1'), ('\u2cb2', '\u2cb3'),
- ('\u2cb4', '\u2cb5'), ('\u2cb6', '\u2cb7'),
- ('\u2cb8', '\u2cb9'), ('\u2cba', '\u2cbb'),
- ('\u2cbc', '\u2cbd'), ('\u2cbe', '\u2cbf'),
- ('\u2cc0', '\u2cc1'), ('\u2cc2', '\u2cc3'),
- ('\u2cc4', '\u2cc5'), ('\u2cc6', '\u2cc7'),
- ('\u2cc8', '\u2cc9'), ('\u2cca', '\u2ccb'),
- ('\u2ccc', '\u2ccd'), ('\u2cce', '\u2ccf'),
- ('\u2cd0', '\u2cd1'), ('\u2cd2', '\u2cd3'),
- ('\u2cd4', '\u2cd5'), ('\u2cd6', '\u2cd7'),
- ('\u2cd8', '\u2cd9'), ('\u2cda', '\u2cdb'),
- ('\u2cdc', '\u2cdd'), ('\u2cde', '\u2cdf'),
- ('\u2ce0', '\u2ce1'), ('\u2ce2', '\u2ce3'),
- ('\u2ceb', '\u2cec'), ('\u2ced', '\u2cee'),
- ('\u2cf2', '\u2cf3'), ('\ua640', '\ua641'),
- ('\ua642', '\ua643'), ('\ua644', '\ua645'),
- ('\ua646', '\ua647'), ('\ua648', '\ua649'),
- ('\ua64a', '\ua64b'), ('\ua64c', '\ua64d'),
- ('\ua64e', '\ua64f'), ('\ua650', '\ua651'),
- ('\ua652', '\ua653'), ('\ua654', '\ua655'),
- ('\ua656', '\ua657'), ('\ua658', '\ua659'),
- ('\ua65a', '\ua65b'), ('\ua65c', '\ua65d'),
- ('\ua65e', '\ua65f'), ('\ua660', '\ua661'),
- ('\ua662', '\ua663'), ('\ua664', '\ua665'),
- ('\ua666', '\ua667'), ('\ua668', '\ua669'),
- ('\ua66a', '\ua66b'), ('\ua66c', '\ua66d'),
- ('\ua680', '\ua681'), ('\ua682', '\ua683'),
- ('\ua684', '\ua685'), ('\ua686', '\ua687'),
- ('\ua688', '\ua689'), ('\ua68a', '\ua68b'),
- ('\ua68c', '\ua68d'), ('\ua68e', '\ua68f'),
- ('\ua690', '\ua691'), ('\ua692', '\ua693'),
- ('\ua694', '\ua695'), ('\ua696', '\ua697'),
- ('\ua722', '\ua723'), ('\ua724', '\ua725'),
- ('\ua726', '\ua727'), ('\ua728', '\ua729'),
- ('\ua72a', '\ua72b'), ('\ua72c', '\ua72d'),
- ('\ua72e', '\ua72f'), ('\ua732', '\ua733'),
- ('\ua734', '\ua735'), ('\ua736', '\ua737'),
- ('\ua738', '\ua739'), ('\ua73a', '\ua73b'),
- ('\ua73c', '\ua73d'), ('\ua73e', '\ua73f'),
- ('\ua740', '\ua741'), ('\ua742', '\ua743'),
- ('\ua744', '\ua745'), ('\ua746', '\ua747'),
- ('\ua748', '\ua749'), ('\ua74a', '\ua74b'),
- ('\ua74c', '\ua74d'), ('\ua74e', '\ua74f'),
- ('\ua750', '\ua751'), ('\ua752', '\ua753'),
- ('\ua754', '\ua755'), ('\ua756', '\ua757'),
- ('\ua758', '\ua759'), ('\ua75a', '\ua75b'),
- ('\ua75c', '\ua75d'), ('\ua75e', '\ua75f'),
- ('\ua760', '\ua761'), ('\ua762', '\ua763'),
- ('\ua764', '\ua765'), ('\ua766', '\ua767'),
- ('\ua768', '\ua769'), ('\ua76a', '\ua76b'),
- ('\ua76c', '\ua76d'), ('\ua76e', '\ua76f'),
- ('\ua779', '\ua77a'), ('\ua77b', '\ua77c'),
- ('\ua77d', '\u1d79'), ('\ua77e', '\ua77f'),
- ('\ua780', '\ua781'), ('\ua782', '\ua783'),
- ('\ua784', '\ua785'), ('\ua786', '\ua787'),
- ('\ua78b', '\ua78c'), ('\ua78d', '\u0265'),
- ('\ua790', '\ua791'), ('\ua792', '\ua793'),
- ('\ua7a0', '\ua7a1'), ('\ua7a2', '\ua7a3'),
- ('\ua7a4', '\ua7a5'), ('\ua7a6', '\ua7a7'),
- ('\ua7a8', '\ua7a9'), ('\ua7aa', '\u0266'),
- ('\uff21', '\uff41'), ('\uff22', '\uff42'),
- ('\uff23', '\uff43'), ('\uff24', '\uff44'),
- ('\uff25', '\uff45'), ('\uff26', '\uff46'),
- ('\uff27', '\uff47'), ('\uff28', '\uff48'),
- ('\uff29', '\uff49'), ('\uff2a', '\uff4a'),
- ('\uff2b', '\uff4b'), ('\uff2c', '\uff4c'),
- ('\uff2d', '\uff4d'), ('\uff2e', '\uff4e'),
- ('\uff2f', '\uff4f'), ('\uff30', '\uff50'),
- ('\uff31', '\uff51'), ('\uff32', '\uff52'),
- ('\uff33', '\uff53'), ('\uff34', '\uff54'),
- ('\uff35', '\uff55'), ('\uff36', '\uff56'),
- ('\uff37', '\uff57'), ('\uff38', '\uff58'),
- ('\uff39', '\uff59'), ('\uff3a', '\uff5a'),
- ('\U00010400', '\U00010428'), ('\U00010401', '\U00010429'),
- ('\U00010402', '\U0001042a'), ('\U00010403', '\U0001042b'),
- ('\U00010404', '\U0001042c'), ('\U00010405', '\U0001042d'),
- ('\U00010406', '\U0001042e'), ('\U00010407', '\U0001042f'),
- ('\U00010408', '\U00010430'), ('\U00010409', '\U00010431'),
- ('\U0001040a', '\U00010432'), ('\U0001040b', '\U00010433'),
- ('\U0001040c', '\U00010434'), ('\U0001040d', '\U00010435'),
- ('\U0001040e', '\U00010436'), ('\U0001040f', '\U00010437'),
- ('\U00010410', '\U00010438'), ('\U00010411', '\U00010439'),
- ('\U00010412', '\U0001043a'), ('\U00010413', '\U0001043b'),
- ('\U00010414', '\U0001043c'), ('\U00010415', '\U0001043d'),
- ('\U00010416', '\U0001043e'), ('\U00010417', '\U0001043f'),
- ('\U00010418', '\U00010440'), ('\U00010419', '\U00010441'),
- ('\U0001041a', '\U00010442'), ('\U0001041b', '\U00010443'),
- ('\U0001041c', '\U00010444'), ('\U0001041d', '\U00010445'),
- ('\U0001041e', '\U00010446'), ('\U0001041f', '\U00010447'),
- ('\U00010420', '\U00010448'), ('\U00010421', '\U00010449'),
- ('\U00010422', '\U0001044a'), ('\U00010423', '\U0001044b'),
- ('\U00010424', '\U0001044c'), ('\U00010425', '\U0001044d'),
- ('\U00010426', '\U0001044e'), ('\U00010427', '\U0001044f')
- ];
-
- static LlLu_table : &'static [(char, char)] = &[
- ('\x61', '\x41'), ('\x62', '\x42'),
- ('\x63', '\x43'), ('\x64', '\x44'),
- ('\x65', '\x45'), ('\x66', '\x46'),
- ('\x67', '\x47'), ('\x68', '\x48'),
- ('\x69', '\x49'), ('\x6a', '\x4a'),
- ('\x6b', '\x4b'), ('\x6c', '\x4c'),
- ('\x6d', '\x4d'), ('\x6e', '\x4e'),
- ('\x6f', '\x4f'), ('\x70', '\x50'),
- ('\x71', '\x51'), ('\x72', '\x52'),
- ('\x73', '\x53'), ('\x74', '\x54'),
- ('\x75', '\x55'), ('\x76', '\x56'),
- ('\x77', '\x57'), ('\x78', '\x58'),
- ('\x79', '\x59'), ('\x7a', '\x5a'),
- ('\xb5', '\u039c'), ('\xe0', '\xc0'),
- ('\xe1', '\xc1'), ('\xe2', '\xc2'),
- ('\xe3', '\xc3'), ('\xe4', '\xc4'),
- ('\xe5', '\xc5'), ('\xe6', '\xc6'),
- ('\xe7', '\xc7'), ('\xe8', '\xc8'),
- ('\xe9', '\xc9'), ('\xea', '\xca'),
- ('\xeb', '\xcb'), ('\xec', '\xcc'),
- ('\xed', '\xcd'), ('\xee', '\xce'),
- ('\xef', '\xcf'), ('\xf0', '\xd0'),
- ('\xf1', '\xd1'), ('\xf2', '\xd2'),
- ('\xf3', '\xd3'), ('\xf4', '\xd4'),
- ('\xf5', '\xd5'), ('\xf6', '\xd6'),
- ('\xf8', '\xd8'), ('\xf9', '\xd9'),
- ('\xfa', '\xda'), ('\xfb', '\xdb'),
- ('\xfc', '\xdc'), ('\xfd', '\xdd'),
- ('\xfe', '\xde'), ('\xff', '\u0178'),
- ('\u0101', '\u0100'), ('\u0103', '\u0102'),
- ('\u0105', '\u0104'), ('\u0107', '\u0106'),
- ('\u0109', '\u0108'), ('\u010b', '\u010a'),
- ('\u010d', '\u010c'), ('\u010f', '\u010e'),
- ('\u0111', '\u0110'), ('\u0113', '\u0112'),
- ('\u0115', '\u0114'), ('\u0117', '\u0116'),
- ('\u0119', '\u0118'), ('\u011b', '\u011a'),
- ('\u011d', '\u011c'), ('\u011f', '\u011e'),
- ('\u0121', '\u0120'), ('\u0123', '\u0122'),
- ('\u0125', '\u0124'), ('\u0127', '\u0126'),
- ('\u0129', '\u0128'), ('\u012b', '\u012a'),
- ('\u012d', '\u012c'), ('\u012f', '\u012e'),
- ('\u0131', '\x49'), ('\u0133', '\u0132'),
- ('\u0135', '\u0134'), ('\u0137', '\u0136'),
- ('\u013a', '\u0139'), ('\u013c', '\u013b'),
- ('\u013e', '\u013d'), ('\u0140', '\u013f'),
- ('\u0142', '\u0141'), ('\u0144', '\u0143'),
- ('\u0146', '\u0145'), ('\u0148', '\u0147'),
- ('\u014b', '\u014a'), ('\u014d', '\u014c'),
- ('\u014f', '\u014e'), ('\u0151', '\u0150'),
- ('\u0153', '\u0152'), ('\u0155', '\u0154'),
- ('\u0157', '\u0156'), ('\u0159', '\u0158'),
- ('\u015b', '\u015a'), ('\u015d', '\u015c'),
- ('\u015f', '\u015e'), ('\u0161', '\u0160'),
- ('\u0163', '\u0162'), ('\u0165', '\u0164'),
- ('\u0167', '\u0166'), ('\u0169', '\u0168'),
- ('\u016b', '\u016a'), ('\u016d', '\u016c'),
- ('\u016f', '\u016e'), ('\u0171', '\u0170'),
- ('\u0173', '\u0172'), ('\u0175', '\u0174'),
- ('\u0177', '\u0176'), ('\u017a', '\u0179'),
- ('\u017c', '\u017b'), ('\u017e', '\u017d'),
- ('\u017f', '\x53'), ('\u0180', '\u0243'),
- ('\u0183', '\u0182'), ('\u0185', '\u0184'),
- ('\u0188', '\u0187'), ('\u018c', '\u018b'),
- ('\u0192', '\u0191'), ('\u0195', '\u01f6'),
- ('\u0199', '\u0198'), ('\u019a', '\u023d'),
- ('\u019e', '\u0220'), ('\u01a1', '\u01a0'),
- ('\u01a3', '\u01a2'), ('\u01a5', '\u01a4'),
- ('\u01a8', '\u01a7'), ('\u01ad', '\u01ac'),
- ('\u01b0', '\u01af'), ('\u01b4', '\u01b3'),
- ('\u01b6', '\u01b5'), ('\u01b9', '\u01b8'),
- ('\u01bd', '\u01bc'), ('\u01bf', '\u01f7'),
- ('\u01c6', '\u01c4'), ('\u01c9', '\u01c7'),
- ('\u01cc', '\u01ca'), ('\u01ce', '\u01cd'),
- ('\u01d0', '\u01cf'), ('\u01d2', '\u01d1'),
- ('\u01d4', '\u01d3'), ('\u01d6', '\u01d5'),
- ('\u01d8', '\u01d7'), ('\u01da', '\u01d9'),
- ('\u01dc', '\u01db'), ('\u01dd', '\u018e'),
- ('\u01df', '\u01de'), ('\u01e1', '\u01e0'),
- ('\u01e3', '\u01e2'), ('\u01e5', '\u01e4'),
- ('\u01e7', '\u01e6'), ('\u01e9', '\u01e8'),
- ('\u01eb', '\u01ea'), ('\u01ed', '\u01ec'),
- ('\u01ef', '\u01ee'), ('\u01f3', '\u01f1'),
- ('\u01f5', '\u01f4'), ('\u01f9', '\u01f8'),
- ('\u01fb', '\u01fa'), ('\u01fd', '\u01fc'),
- ('\u01ff', '\u01fe'), ('\u0201', '\u0200'),
- ('\u0203', '\u0202'), ('\u0205', '\u0204'),
- ('\u0207', '\u0206'), ('\u0209', '\u0208'),
- ('\u020b', '\u020a'), ('\u020d', '\u020c'),
- ('\u020f', '\u020e'), ('\u0211', '\u0210'),
- ('\u0213', '\u0212'), ('\u0215', '\u0214'),
- ('\u0217', '\u0216'), ('\u0219', '\u0218'),
- ('\u021b', '\u021a'), ('\u021d', '\u021c'),
- ('\u021f', '\u021e'), ('\u0223', '\u0222'),
- ('\u0225', '\u0224'), ('\u0227', '\u0226'),
- ('\u0229', '\u0228'), ('\u022b', '\u022a'),
- ('\u022d', '\u022c'), ('\u022f', '\u022e'),
- ('\u0231', '\u0230'), ('\u0233', '\u0232'),
- ('\u023c', '\u023b'), ('\u023f', '\u2c7e'),
- ('\u0240', '\u2c7f'), ('\u0242', '\u0241'),
- ('\u0247', '\u0246'), ('\u0249', '\u0248'),
- ('\u024b', '\u024a'), ('\u024d', '\u024c'),
- ('\u024f', '\u024e'), ('\u0250', '\u2c6f'),
- ('\u0251', '\u2c6d'), ('\u0252', '\u2c70'),
- ('\u0253', '\u0181'), ('\u0254', '\u0186'),
- ('\u0256', '\u0189'), ('\u0257', '\u018a'),
- ('\u0259', '\u018f'), ('\u025b', '\u0190'),
- ('\u0260', '\u0193'), ('\u0263', '\u0194'),
- ('\u0265', '\ua78d'), ('\u0266', '\ua7aa'),
- ('\u0268', '\u0197'), ('\u0269', '\u0196'),
- ('\u026b', '\u2c62'), ('\u026f', '\u019c'),
- ('\u0271', '\u2c6e'), ('\u0272', '\u019d'),
- ('\u0275', '\u019f'), ('\u027d', '\u2c64'),
- ('\u0280', '\u01a6'), ('\u0283', '\u01a9'),
- ('\u0288', '\u01ae'), ('\u0289', '\u0244'),
- ('\u028a', '\u01b1'), ('\u028b', '\u01b2'),
- ('\u028c', '\u0245'), ('\u0292', '\u01b7'),
- ('\u0371', '\u0370'), ('\u0373', '\u0372'),
- ('\u0377', '\u0376'), ('\u037b', '\u03fd'),
- ('\u037c', '\u03fe'), ('\u037d', '\u03ff'),
- ('\u03ac', '\u0386'), ('\u03ad', '\u0388'),
- ('\u03ae', '\u0389'), ('\u03af', '\u038a'),
- ('\u03b1', '\u0391'), ('\u03b2', '\u0392'),
- ('\u03b3', '\u0393'), ('\u03b4', '\u0394'),
- ('\u03b5', '\u0395'), ('\u03b6', '\u0396'),
- ('\u03b7', '\u0397'), ('\u03b8', '\u0398'),
- ('\u03b9', '\u0399'), ('\u03ba', '\u039a'),
- ('\u03bb', '\u039b'), ('\u03bc', '\u039c'),
- ('\u03bd', '\u039d'), ('\u03be', '\u039e'),
- ('\u03bf', '\u039f'), ('\u03c0', '\u03a0'),
- ('\u03c1', '\u03a1'), ('\u03c2', '\u03a3'),
- ('\u03c3', '\u03a3'), ('\u03c4', '\u03a4'),
- ('\u03c5', '\u03a5'), ('\u03c6', '\u03a6'),
- ('\u03c7', '\u03a7'), ('\u03c8', '\u03a8'),
- ('\u03c9', '\u03a9'), ('\u03ca', '\u03aa'),
- ('\u03cb', '\u03ab'), ('\u03cc', '\u038c'),
- ('\u03cd', '\u038e'), ('\u03ce', '\u038f'),
- ('\u03d0', '\u0392'), ('\u03d1', '\u0398'),
- ('\u03d5', '\u03a6'), ('\u03d6', '\u03a0'),
- ('\u03d7', '\u03cf'), ('\u03d9', '\u03d8'),
- ('\u03db', '\u03da'), ('\u03dd', '\u03dc'),
- ('\u03df', '\u03de'), ('\u03e1', '\u03e0'),
- ('\u03e3', '\u03e2'), ('\u03e5', '\u03e4'),
- ('\u03e7', '\u03e6'), ('\u03e9', '\u03e8'),
- ('\u03eb', '\u03ea'), ('\u03ed', '\u03ec'),
- ('\u03ef', '\u03ee'), ('\u03f0', '\u039a'),
- ('\u03f1', '\u03a1'), ('\u03f2', '\u03f9'),
- ('\u03f5', '\u0395'), ('\u03f8', '\u03f7'),
- ('\u03fb', '\u03fa'), ('\u0430', '\u0410'),
- ('\u0431', '\u0411'), ('\u0432', '\u0412'),
- ('\u0433', '\u0413'), ('\u0434', '\u0414'),
- ('\u0435', '\u0415'), ('\u0436', '\u0416'),
- ('\u0437', '\u0417'), ('\u0438', '\u0418'),
- ('\u0439', '\u0419'), ('\u043a', '\u041a'),
- ('\u043b', '\u041b'), ('\u043c', '\u041c'),
- ('\u043d', '\u041d'), ('\u043e', '\u041e'),
- ('\u043f', '\u041f'), ('\u0440', '\u0420'),
- ('\u0441', '\u0421'), ('\u0442', '\u0422'),
- ('\u0443', '\u0423'), ('\u0444', '\u0424'),
- ('\u0445', '\u0425'), ('\u0446', '\u0426'),
- ('\u0447', '\u0427'), ('\u0448', '\u0428'),
- ('\u0449', '\u0429'), ('\u044a', '\u042a'),
- ('\u044b', '\u042b'), ('\u044c', '\u042c'),
- ('\u044d', '\u042d'), ('\u044e', '\u042e'),
- ('\u044f', '\u042f'), ('\u0450', '\u0400'),
- ('\u0451', '\u0401'), ('\u0452', '\u0402'),
- ('\u0453', '\u0403'), ('\u0454', '\u0404'),
- ('\u0455', '\u0405'), ('\u0456', '\u0406'),
- ('\u0457', '\u0407'), ('\u0458', '\u0408'),
- ('\u0459', '\u0409'), ('\u045a', '\u040a'),
- ('\u045b', '\u040b'), ('\u045c', '\u040c'),
- ('\u045d', '\u040d'), ('\u045e', '\u040e'),
- ('\u045f', '\u040f'), ('\u0461', '\u0460'),
- ('\u0463', '\u0462'), ('\u0465', '\u0464'),
- ('\u0467', '\u0466'), ('\u0469', '\u0468'),
- ('\u046b', '\u046a'), ('\u046d', '\u046c'),
- ('\u046f', '\u046e'), ('\u0471', '\u0470'),
- ('\u0473', '\u0472'), ('\u0475', '\u0474'),
- ('\u0477', '\u0476'), ('\u0479', '\u0478'),
- ('\u047b', '\u047a'), ('\u047d', '\u047c'),
- ('\u047f', '\u047e'), ('\u0481', '\u0480'),
- ('\u048b', '\u048a'), ('\u048d', '\u048c'),
- ('\u048f', '\u048e'), ('\u0491', '\u0490'),
- ('\u0493', '\u0492'), ('\u0495', '\u0494'),
- ('\u0497', '\u0496'), ('\u0499', '\u0498'),
- ('\u049b', '\u049a'), ('\u049d', '\u049c'),
- ('\u049f', '\u049e'), ('\u04a1', '\u04a0'),
- ('\u04a3', '\u04a2'), ('\u04a5', '\u04a4'),
- ('\u04a7', '\u04a6'), ('\u04a9', '\u04a8'),
- ('\u04ab', '\u04aa'), ('\u04ad', '\u04ac'),
- ('\u04af', '\u04ae'), ('\u04b1', '\u04b0'),
- ('\u04b3', '\u04b2'), ('\u04b5', '\u04b4'),
- ('\u04b7', '\u04b6'), ('\u04b9', '\u04b8'),
- ('\u04bb', '\u04ba'), ('\u04bd', '\u04bc'),
- ('\u04bf', '\u04be'), ('\u04c2', '\u04c1'),
- ('\u04c4', '\u04c3'), ('\u04c6', '\u04c5'),
- ('\u04c8', '\u04c7'), ('\u04ca', '\u04c9'),
- ('\u04cc', '\u04cb'), ('\u04ce', '\u04cd'),
- ('\u04cf', '\u04c0'), ('\u04d1', '\u04d0'),
- ('\u04d3', '\u04d2'), ('\u04d5', '\u04d4'),
- ('\u04d7', '\u04d6'), ('\u04d9', '\u04d8'),
- ('\u04db', '\u04da'), ('\u04dd', '\u04dc'),
- ('\u04df', '\u04de'), ('\u04e1', '\u04e0'),
- ('\u04e3', '\u04e2'), ('\u04e5', '\u04e4'),
- ('\u04e7', '\u04e6'), ('\u04e9', '\u04e8'),
- ('\u04eb', '\u04ea'), ('\u04ed', '\u04ec'),
- ('\u04ef', '\u04ee'), ('\u04f1', '\u04f0'),
- ('\u04f3', '\u04f2'), ('\u04f5', '\u04f4'),
- ('\u04f7', '\u04f6'), ('\u04f9', '\u04f8'),
- ('\u04fb', '\u04fa'), ('\u04fd', '\u04fc'),
- ('\u04ff', '\u04fe'), ('\u0501', '\u0500'),
- ('\u0503', '\u0502'), ('\u0505', '\u0504'),
- ('\u0507', '\u0506'), ('\u0509', '\u0508'),
- ('\u050b', '\u050a'), ('\u050d', '\u050c'),
- ('\u050f', '\u050e'), ('\u0511', '\u0510'),
- ('\u0513', '\u0512'), ('\u0515', '\u0514'),
- ('\u0517', '\u0516'), ('\u0519', '\u0518'),
- ('\u051b', '\u051a'), ('\u051d', '\u051c'),
- ('\u051f', '\u051e'), ('\u0521', '\u0520'),
- ('\u0523', '\u0522'), ('\u0525', '\u0524'),
- ('\u0527', '\u0526'), ('\u0561', '\u0531'),
- ('\u0562', '\u0532'), ('\u0563', '\u0533'),
- ('\u0564', '\u0534'), ('\u0565', '\u0535'),
- ('\u0566', '\u0536'), ('\u0567', '\u0537'),
- ('\u0568', '\u0538'), ('\u0569', '\u0539'),
- ('\u056a', '\u053a'), ('\u056b', '\u053b'),
- ('\u056c', '\u053c'), ('\u056d', '\u053d'),
- ('\u056e', '\u053e'), ('\u056f', '\u053f'),
- ('\u0570', '\u0540'), ('\u0571', '\u0541'),
- ('\u0572', '\u0542'), ('\u0573', '\u0543'),
- ('\u0574', '\u0544'), ('\u0575', '\u0545'),
- ('\u0576', '\u0546'), ('\u0577', '\u0547'),
- ('\u0578', '\u0548'), ('\u0579', '\u0549'),
- ('\u057a', '\u054a'), ('\u057b', '\u054b'),
- ('\u057c', '\u054c'), ('\u057d', '\u054d'),
- ('\u057e', '\u054e'), ('\u057f', '\u054f'),
- ('\u0580', '\u0550'), ('\u0581', '\u0551'),
- ('\u0582', '\u0552'), ('\u0583', '\u0553'),
- ('\u0584', '\u0554'), ('\u0585', '\u0555'),
- ('\u0586', '\u0556'), ('\u1d79', '\ua77d'),
- ('\u1d7d', '\u2c63'), ('\u1e01', '\u1e00'),
- ('\u1e03', '\u1e02'), ('\u1e05', '\u1e04'),
- ('\u1e07', '\u1e06'), ('\u1e09', '\u1e08'),
- ('\u1e0b', '\u1e0a'), ('\u1e0d', '\u1e0c'),
- ('\u1e0f', '\u1e0e'), ('\u1e11', '\u1e10'),
- ('\u1e13', '\u1e12'), ('\u1e15', '\u1e14'),
- ('\u1e17', '\u1e16'), ('\u1e19', '\u1e18'),
- ('\u1e1b', '\u1e1a'), ('\u1e1d', '\u1e1c'),
- ('\u1e1f', '\u1e1e'), ('\u1e21', '\u1e20'),
- ('\u1e23', '\u1e22'), ('\u1e25', '\u1e24'),
- ('\u1e27', '\u1e26'), ('\u1e29', '\u1e28'),
- ('\u1e2b', '\u1e2a'), ('\u1e2d', '\u1e2c'),
- ('\u1e2f', '\u1e2e'), ('\u1e31', '\u1e30'),
- ('\u1e33', '\u1e32'), ('\u1e35', '\u1e34'),
- ('\u1e37', '\u1e36'), ('\u1e39', '\u1e38'),
- ('\u1e3b', '\u1e3a'), ('\u1e3d', '\u1e3c'),
- ('\u1e3f', '\u1e3e'), ('\u1e41', '\u1e40'),
- ('\u1e43', '\u1e42'), ('\u1e45', '\u1e44'),
- ('\u1e47', '\u1e46'), ('\u1e49', '\u1e48'),
- ('\u1e4b', '\u1e4a'), ('\u1e4d', '\u1e4c'),
- ('\u1e4f', '\u1e4e'), ('\u1e51', '\u1e50'),
- ('\u1e53', '\u1e52'), ('\u1e55', '\u1e54'),
- ('\u1e57', '\u1e56'), ('\u1e59', '\u1e58'),
- ('\u1e5b', '\u1e5a'), ('\u1e5d', '\u1e5c'),
- ('\u1e5f', '\u1e5e'), ('\u1e61', '\u1e60'),
- ('\u1e63', '\u1e62'), ('\u1e65', '\u1e64'),
- ('\u1e67', '\u1e66'), ('\u1e69', '\u1e68'),
- ('\u1e6b', '\u1e6a'), ('\u1e6d', '\u1e6c'),
- ('\u1e6f', '\u1e6e'), ('\u1e71', '\u1e70'),
- ('\u1e73', '\u1e72'), ('\u1e75', '\u1e74'),
- ('\u1e77', '\u1e76'), ('\u1e79', '\u1e78'),
- ('\u1e7b', '\u1e7a'), ('\u1e7d', '\u1e7c'),
- ('\u1e7f', '\u1e7e'), ('\u1e81', '\u1e80'),
- ('\u1e83', '\u1e82'), ('\u1e85', '\u1e84'),
- ('\u1e87', '\u1e86'), ('\u1e89', '\u1e88'),
- ('\u1e8b', '\u1e8a'), ('\u1e8d', '\u1e8c'),
- ('\u1e8f', '\u1e8e'), ('\u1e91', '\u1e90'),
- ('\u1e93', '\u1e92'), ('\u1e95', '\u1e94'),
- ('\u1e9b', '\u1e60'), ('\u1ea1', '\u1ea0'),
- ('\u1ea3', '\u1ea2'), ('\u1ea5', '\u1ea4'),
- ('\u1ea7', '\u1ea6'), ('\u1ea9', '\u1ea8'),
- ('\u1eab', '\u1eaa'), ('\u1ead', '\u1eac'),
- ('\u1eaf', '\u1eae'), ('\u1eb1', '\u1eb0'),
- ('\u1eb3', '\u1eb2'), ('\u1eb5', '\u1eb4'),
- ('\u1eb7', '\u1eb6'), ('\u1eb9', '\u1eb8'),
- ('\u1ebb', '\u1eba'), ('\u1ebd', '\u1ebc'),
- ('\u1ebf', '\u1ebe'), ('\u1ec1', '\u1ec0'),
- ('\u1ec3', '\u1ec2'), ('\u1ec5', '\u1ec4'),
- ('\u1ec7', '\u1ec6'), ('\u1ec9', '\u1ec8'),
- ('\u1ecb', '\u1eca'), ('\u1ecd', '\u1ecc'),
- ('\u1ecf', '\u1ece'), ('\u1ed1', '\u1ed0'),
- ('\u1ed3', '\u1ed2'), ('\u1ed5', '\u1ed4'),
- ('\u1ed7', '\u1ed6'), ('\u1ed9', '\u1ed8'),
- ('\u1edb', '\u1eda'), ('\u1edd', '\u1edc'),
- ('\u1edf', '\u1ede'), ('\u1ee1', '\u1ee0'),
- ('\u1ee3', '\u1ee2'), ('\u1ee5', '\u1ee4'),
- ('\u1ee7', '\u1ee6'), ('\u1ee9', '\u1ee8'),
- ('\u1eeb', '\u1eea'), ('\u1eed', '\u1eec'),
- ('\u1eef', '\u1eee'), ('\u1ef1', '\u1ef0'),
- ('\u1ef3', '\u1ef2'), ('\u1ef5', '\u1ef4'),
- ('\u1ef7', '\u1ef6'), ('\u1ef9', '\u1ef8'),
- ('\u1efb', '\u1efa'), ('\u1efd', '\u1efc'),
- ('\u1eff', '\u1efe'), ('\u1f00', '\u1f08'),
- ('\u1f01', '\u1f09'), ('\u1f02', '\u1f0a'),
- ('\u1f03', '\u1f0b'), ('\u1f04', '\u1f0c'),
- ('\u1f05', '\u1f0d'), ('\u1f06', '\u1f0e'),
- ('\u1f07', '\u1f0f'), ('\u1f10', '\u1f18'),
- ('\u1f11', '\u1f19'), ('\u1f12', '\u1f1a'),
- ('\u1f13', '\u1f1b'), ('\u1f14', '\u1f1c'),
- ('\u1f15', '\u1f1d'), ('\u1f20', '\u1f28'),
- ('\u1f21', '\u1f29'), ('\u1f22', '\u1f2a'),
- ('\u1f23', '\u1f2b'), ('\u1f24', '\u1f2c'),
- ('\u1f25', '\u1f2d'), ('\u1f26', '\u1f2e'),
- ('\u1f27', '\u1f2f'), ('\u1f30', '\u1f38'),
- ('\u1f31', '\u1f39'), ('\u1f32', '\u1f3a'),
- ('\u1f33', '\u1f3b'), ('\u1f34', '\u1f3c'),
- ('\u1f35', '\u1f3d'), ('\u1f36', '\u1f3e'),
- ('\u1f37', '\u1f3f'), ('\u1f40', '\u1f48'),
- ('\u1f41', '\u1f49'), ('\u1f42', '\u1f4a'),
- ('\u1f43', '\u1f4b'), ('\u1f44', '\u1f4c'),
- ('\u1f45', '\u1f4d'), ('\u1f51', '\u1f59'),
- ('\u1f53', '\u1f5b'), ('\u1f55', '\u1f5d'),
- ('\u1f57', '\u1f5f'), ('\u1f60', '\u1f68'),
- ('\u1f61', '\u1f69'), ('\u1f62', '\u1f6a'),
- ('\u1f63', '\u1f6b'), ('\u1f64', '\u1f6c'),
- ('\u1f65', '\u1f6d'), ('\u1f66', '\u1f6e'),
- ('\u1f67', '\u1f6f'), ('\u1f70', '\u1fba'),
- ('\u1f71', '\u1fbb'), ('\u1f72', '\u1fc8'),
- ('\u1f73', '\u1fc9'), ('\u1f74', '\u1fca'),
- ('\u1f75', '\u1fcb'), ('\u1f76', '\u1fda'),
- ('\u1f77', '\u1fdb'), ('\u1f78', '\u1ff8'),
- ('\u1f79', '\u1ff9'), ('\u1f7a', '\u1fea'),
- ('\u1f7b', '\u1feb'), ('\u1f7c', '\u1ffa'),
- ('\u1f7d', '\u1ffb'), ('\u1f80', '\u1f88'),
- ('\u1f81', '\u1f89'), ('\u1f82', '\u1f8a'),
- ('\u1f83', '\u1f8b'), ('\u1f84', '\u1f8c'),
- ('\u1f85', '\u1f8d'), ('\u1f86', '\u1f8e'),
- ('\u1f87', '\u1f8f'), ('\u1f90', '\u1f98'),
- ('\u1f91', '\u1f99'), ('\u1f92', '\u1f9a'),
- ('\u1f93', '\u1f9b'), ('\u1f94', '\u1f9c'),
- ('\u1f95', '\u1f9d'), ('\u1f96', '\u1f9e'),
- ('\u1f97', '\u1f9f'), ('\u1fa0', '\u1fa8'),
- ('\u1fa1', '\u1fa9'), ('\u1fa2', '\u1faa'),
- ('\u1fa3', '\u1fab'), ('\u1fa4', '\u1fac'),
- ('\u1fa5', '\u1fad'), ('\u1fa6', '\u1fae'),
- ('\u1fa7', '\u1faf'), ('\u1fb0', '\u1fb8'),
- ('\u1fb1', '\u1fb9'), ('\u1fb3', '\u1fbc'),
- ('\u1fbe', '\u0399'), ('\u1fc3', '\u1fcc'),
- ('\u1fd0', '\u1fd8'), ('\u1fd1', '\u1fd9'),
- ('\u1fe0', '\u1fe8'), ('\u1fe1', '\u1fe9'),
- ('\u1fe5', '\u1fec'), ('\u1ff3', '\u1ffc'),
- ('\u214e', '\u2132'), ('\u2184', '\u2183'),
- ('\u2c30', '\u2c00'), ('\u2c31', '\u2c01'),
- ('\u2c32', '\u2c02'), ('\u2c33', '\u2c03'),
- ('\u2c34', '\u2c04'), ('\u2c35', '\u2c05'),
- ('\u2c36', '\u2c06'), ('\u2c37', '\u2c07'),
- ('\u2c38', '\u2c08'), ('\u2c39', '\u2c09'),
- ('\u2c3a', '\u2c0a'), ('\u2c3b', '\u2c0b'),
- ('\u2c3c', '\u2c0c'), ('\u2c3d', '\u2c0d'),
- ('\u2c3e', '\u2c0e'), ('\u2c3f', '\u2c0f'),
- ('\u2c40', '\u2c10'), ('\u2c41', '\u2c11'),
- ('\u2c42', '\u2c12'), ('\u2c43', '\u2c13'),
- ('\u2c44', '\u2c14'), ('\u2c45', '\u2c15'),
- ('\u2c46', '\u2c16'), ('\u2c47', '\u2c17'),
- ('\u2c48', '\u2c18'), ('\u2c49', '\u2c19'),
- ('\u2c4a', '\u2c1a'), ('\u2c4b', '\u2c1b'),
- ('\u2c4c', '\u2c1c'), ('\u2c4d', '\u2c1d'),
- ('\u2c4e', '\u2c1e'), ('\u2c4f', '\u2c1f'),
- ('\u2c50', '\u2c20'), ('\u2c51', '\u2c21'),
- ('\u2c52', '\u2c22'), ('\u2c53', '\u2c23'),
- ('\u2c54', '\u2c24'), ('\u2c55', '\u2c25'),
- ('\u2c56', '\u2c26'), ('\u2c57', '\u2c27'),
- ('\u2c58', '\u2c28'), ('\u2c59', '\u2c29'),
- ('\u2c5a', '\u2c2a'), ('\u2c5b', '\u2c2b'),
- ('\u2c5c', '\u2c2c'), ('\u2c5d', '\u2c2d'),
- ('\u2c5e', '\u2c2e'), ('\u2c61', '\u2c60'),
- ('\u2c65', '\u023a'), ('\u2c66', '\u023e'),
- ('\u2c68', '\u2c67'), ('\u2c6a', '\u2c69'),
- ('\u2c6c', '\u2c6b'), ('\u2c73', '\u2c72'),
- ('\u2c76', '\u2c75'), ('\u2c81', '\u2c80'),
- ('\u2c83', '\u2c82'), ('\u2c85', '\u2c84'),
- ('\u2c87', '\u2c86'), ('\u2c89', '\u2c88'),
- ('\u2c8b', '\u2c8a'), ('\u2c8d', '\u2c8c'),
- ('\u2c8f', '\u2c8e'), ('\u2c91', '\u2c90'),
- ('\u2c93', '\u2c92'), ('\u2c95', '\u2c94'),
- ('\u2c97', '\u2c96'), ('\u2c99', '\u2c98'),
- ('\u2c9b', '\u2c9a'), ('\u2c9d', '\u2c9c'),
- ('\u2c9f', '\u2c9e'), ('\u2ca1', '\u2ca0'),
- ('\u2ca3', '\u2ca2'), ('\u2ca5', '\u2ca4'),
- ('\u2ca7', '\u2ca6'), ('\u2ca9', '\u2ca8'),
- ('\u2cab', '\u2caa'), ('\u2cad', '\u2cac'),
- ('\u2caf', '\u2cae'), ('\u2cb1', '\u2cb0'),
- ('\u2cb3', '\u2cb2'), ('\u2cb5', '\u2cb4'),
- ('\u2cb7', '\u2cb6'), ('\u2cb9', '\u2cb8'),
- ('\u2cbb', '\u2cba'), ('\u2cbd', '\u2cbc'),
- ('\u2cbf', '\u2cbe'), ('\u2cc1', '\u2cc0'),
- ('\u2cc3', '\u2cc2'), ('\u2cc5', '\u2cc4'),
- ('\u2cc7', '\u2cc6'), ('\u2cc9', '\u2cc8'),
- ('\u2ccb', '\u2cca'), ('\u2ccd', '\u2ccc'),
- ('\u2ccf', '\u2cce'), ('\u2cd1', '\u2cd0'),
- ('\u2cd3', '\u2cd2'), ('\u2cd5', '\u2cd4'),
- ('\u2cd7', '\u2cd6'), ('\u2cd9', '\u2cd8'),
- ('\u2cdb', '\u2cda'), ('\u2cdd', '\u2cdc'),
- ('\u2cdf', '\u2cde'), ('\u2ce1', '\u2ce0'),
- ('\u2ce3', '\u2ce2'), ('\u2cec', '\u2ceb'),
- ('\u2cee', '\u2ced'), ('\u2cf3', '\u2cf2'),
- ('\u2d00', '\u10a0'), ('\u2d01', '\u10a1'),
- ('\u2d02', '\u10a2'), ('\u2d03', '\u10a3'),
- ('\u2d04', '\u10a4'), ('\u2d05', '\u10a5'),
- ('\u2d06', '\u10a6'), ('\u2d07', '\u10a7'),
- ('\u2d08', '\u10a8'), ('\u2d09', '\u10a9'),
- ('\u2d0a', '\u10aa'), ('\u2d0b', '\u10ab'),
- ('\u2d0c', '\u10ac'), ('\u2d0d', '\u10ad'),
- ('\u2d0e', '\u10ae'), ('\u2d0f', '\u10af'),
- ('\u2d10', '\u10b0'), ('\u2d11', '\u10b1'),
- ('\u2d12', '\u10b2'), ('\u2d13', '\u10b3'),
- ('\u2d14', '\u10b4'), ('\u2d15', '\u10b5'),
- ('\u2d16', '\u10b6'), ('\u2d17', '\u10b7'),
- ('\u2d18', '\u10b8'), ('\u2d19', '\u10b9'),
- ('\u2d1a', '\u10ba'), ('\u2d1b', '\u10bb'),
- ('\u2d1c', '\u10bc'), ('\u2d1d', '\u10bd'),
- ('\u2d1e', '\u10be'), ('\u2d1f', '\u10bf'),
- ('\u2d20', '\u10c0'), ('\u2d21', '\u10c1'),
- ('\u2d22', '\u10c2'), ('\u2d23', '\u10c3'),
- ('\u2d24', '\u10c4'), ('\u2d25', '\u10c5'),
- ('\u2d27', '\u10c7'), ('\u2d2d', '\u10cd'),
- ('\ua641', '\ua640'), ('\ua643', '\ua642'),
- ('\ua645', '\ua644'), ('\ua647', '\ua646'),
- ('\ua649', '\ua648'), ('\ua64b', '\ua64a'),
- ('\ua64d', '\ua64c'), ('\ua64f', '\ua64e'),
- ('\ua651', '\ua650'), ('\ua653', '\ua652'),
- ('\ua655', '\ua654'), ('\ua657', '\ua656'),
- ('\ua659', '\ua658'), ('\ua65b', '\ua65a'),
- ('\ua65d', '\ua65c'), ('\ua65f', '\ua65e'),
- ('\ua661', '\ua660'), ('\ua663', '\ua662'),
- ('\ua665', '\ua664'), ('\ua667', '\ua666'),
- ('\ua669', '\ua668'), ('\ua66b', '\ua66a'),
- ('\ua66d', '\ua66c'), ('\ua681', '\ua680'),
- ('\ua683', '\ua682'), ('\ua685', '\ua684'),
- ('\ua687', '\ua686'), ('\ua689', '\ua688'),
- ('\ua68b', '\ua68a'), ('\ua68d', '\ua68c'),
- ('\ua68f', '\ua68e'), ('\ua691', '\ua690'),
- ('\ua693', '\ua692'), ('\ua695', '\ua694'),
- ('\ua697', '\ua696'), ('\ua723', '\ua722'),
- ('\ua725', '\ua724'), ('\ua727', '\ua726'),
- ('\ua729', '\ua728'), ('\ua72b', '\ua72a'),
- ('\ua72d', '\ua72c'), ('\ua72f', '\ua72e'),
- ('\ua733', '\ua732'), ('\ua735', '\ua734'),
- ('\ua737', '\ua736'), ('\ua739', '\ua738'),
- ('\ua73b', '\ua73a'), ('\ua73d', '\ua73c'),
- ('\ua73f', '\ua73e'), ('\ua741', '\ua740'),
- ('\ua743', '\ua742'), ('\ua745', '\ua744'),
- ('\ua747', '\ua746'), ('\ua749', '\ua748'),
- ('\ua74b', '\ua74a'), ('\ua74d', '\ua74c'),
- ('\ua74f', '\ua74e'), ('\ua751', '\ua750'),
- ('\ua753', '\ua752'), ('\ua755', '\ua754'),
- ('\ua757', '\ua756'), ('\ua759', '\ua758'),
- ('\ua75b', '\ua75a'), ('\ua75d', '\ua75c'),
- ('\ua75f', '\ua75e'), ('\ua761', '\ua760'),
- ('\ua763', '\ua762'), ('\ua765', '\ua764'),
- ('\ua767', '\ua766'), ('\ua769', '\ua768'),
- ('\ua76b', '\ua76a'), ('\ua76d', '\ua76c'),
- ('\ua76f', '\ua76e'), ('\ua77a', '\ua779'),
- ('\ua77c', '\ua77b'), ('\ua77f', '\ua77e'),
- ('\ua781', '\ua780'), ('\ua783', '\ua782'),
- ('\ua785', '\ua784'), ('\ua787', '\ua786'),
- ('\ua78c', '\ua78b'), ('\ua791', '\ua790'),
- ('\ua793', '\ua792'), ('\ua7a1', '\ua7a0'),
- ('\ua7a3', '\ua7a2'), ('\ua7a5', '\ua7a4'),
- ('\ua7a7', '\ua7a6'), ('\ua7a9', '\ua7a8'),
- ('\uff41', '\uff21'), ('\uff42', '\uff22'),
- ('\uff43', '\uff23'), ('\uff44', '\uff24'),
- ('\uff45', '\uff25'), ('\uff46', '\uff26'),
- ('\uff47', '\uff27'), ('\uff48', '\uff28'),
- ('\uff49', '\uff29'), ('\uff4a', '\uff2a'),
- ('\uff4b', '\uff2b'), ('\uff4c', '\uff2c'),
- ('\uff4d', '\uff2d'), ('\uff4e', '\uff2e'),
- ('\uff4f', '\uff2f'), ('\uff50', '\uff30'),
- ('\uff51', '\uff31'), ('\uff52', '\uff32'),
- ('\uff53', '\uff33'), ('\uff54', '\uff34'),
- ('\uff55', '\uff35'), ('\uff56', '\uff36'),
- ('\uff57', '\uff37'), ('\uff58', '\uff38'),
- ('\uff59', '\uff39'), ('\uff5a', '\uff3a'),
- ('\U00010428', '\U00010400'), ('\U00010429', '\U00010401'),
- ('\U0001042a', '\U00010402'), ('\U0001042b', '\U00010403'),
- ('\U0001042c', '\U00010404'), ('\U0001042d', '\U00010405'),
- ('\U0001042e', '\U00010406'), ('\U0001042f', '\U00010407'),
- ('\U00010430', '\U00010408'), ('\U00010431', '\U00010409'),
- ('\U00010432', '\U0001040a'), ('\U00010433', '\U0001040b'),
- ('\U00010434', '\U0001040c'), ('\U00010435', '\U0001040d'),
- ('\U00010436', '\U0001040e'), ('\U00010437', '\U0001040f'),
- ('\U00010438', '\U00010410'), ('\U00010439', '\U00010411'),
- ('\U0001043a', '\U00010412'), ('\U0001043b', '\U00010413'),
- ('\U0001043c', '\U00010414'), ('\U0001043d', '\U00010415'),
- ('\U0001043e', '\U00010416'), ('\U0001043f', '\U00010417'),
- ('\U00010440', '\U00010418'), ('\U00010441', '\U00010419'),
- ('\U00010442', '\U0001041a'), ('\U00010443', '\U0001041b'),
- ('\U00010444', '\U0001041c'), ('\U00010445', '\U0001041d'),
- ('\U00010446', '\U0001041e'), ('\U00010447', '\U0001041f'),
- ('\U00010448', '\U00010420'), ('\U00010449', '\U00010421'),
- ('\U0001044a', '\U00010422'), ('\U0001044b', '\U00010423'),
- ('\U0001044c', '\U00010424'), ('\U0001044d', '\U00010425'),
- ('\U0001044e', '\U00010426'), ('\U0001044f', '\U00010427')
- ];
-
}
+++ /dev/null
-// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-//! Functions for the unit type.
-
-#[cfg(not(test))]
-use default::Default;
-#[cfg(not(test))]
-use cmp::{Eq, Equal, Ord, Ordering, TotalEq, TotalOrd};
-use fmt;
-
-#[cfg(not(test))]
-impl Eq for () {
- #[inline]
- fn eq(&self, _other: &()) -> bool { true }
- #[inline]
- fn ne(&self, _other: &()) -> bool { false }
-}
-
-#[cfg(not(test))]
-impl Ord for () {
- #[inline]
- fn lt(&self, _other: &()) -> bool { false }
-}
-
-#[cfg(not(test))]
-impl TotalOrd for () {
- #[inline]
- fn cmp(&self, _other: &()) -> Ordering { Equal }
-}
-
-#[cfg(not(test))]
-impl TotalEq for () {}
-
-#[cfg(not(test))]
-impl Default for () {
- #[inline]
- fn default() -> () { () }
-}
-
-impl fmt::Show for () {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- f.pad("()")
- }
-}
+++ /dev/null
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-/*!
-The Finally trait provides a method, `finally` on
-stack closures that emulates Java-style try/finally blocks.
-
-Using the `finally` method is sometimes convenient, but the type rules
-prohibit any shared, mutable state between the "try" case and the
-"finally" case. For advanced cases, the `try_finally` function can
-also be used. See that function for more details.
-
-# Example
-
-```
-use std::unstable::finally::Finally;
-
-(|| {
- // ...
-}).finally(|| {
- // this code is always run
-})
-```
-*/
-
-use ops::Drop;
-
-#[cfg(test)] use task::failing;
-
-pub trait Finally<T> {
- fn finally(&mut self, dtor: ||) -> T;
-}
-
-impl<'a,T> Finally<T> for ||: 'a -> T {
- fn finally(&mut self, dtor: ||) -> T {
- try_finally(&mut (), self,
- |_, f| (*f)(),
- |_| dtor())
- }
-}
-
-impl<T> Finally<T> for fn() -> T {
- fn finally(&mut self, dtor: ||) -> T {
- try_finally(&mut (), (),
- |_, _| (*self)(),
- |_| dtor())
- }
-}
-
-/**
- * The most general form of the `finally` functions. The function
- * `try_fn` will be invoked first; whether or not it fails, the
- * function `finally_fn` will be invoked next. The two parameters
- * `mutate` and `drop` are used to thread state through the two
- * closures. `mutate` is used for any shared, mutable state that both
- * closures require access to; `drop` is used for any state that the
- * `try_fn` requires ownership of.
- *
- * **WARNING:** While shared, mutable state between the try and finally
- * function is often necessary, one must be very careful; the `try`
- * function could have failed at any point, so the values of the shared
- * state may be inconsistent.
- *
- * # Example
- *
- * ```
- * use std::unstable::finally::try_finally;
- *
- * struct State<'a> { buffer: &'a mut [u8], len: uint }
- * # let mut buf = [];
- * let mut state = State { buffer: buf, len: 0 };
- * try_finally(
- * &mut state, (),
- * |state, ()| {
- * // use state.buffer, state.len
- * },
- * |state| {
- * // use state.buffer, state.len to cleanup
- * })
- * ```
- */
-pub fn try_finally<T,U,R>(mutate: &mut T,
- drop: U,
- try_fn: |&mut T, U| -> R,
- finally_fn: |&mut T|)
- -> R {
- let f = Finallyalizer {
- mutate: mutate,
- dtor: finally_fn,
- };
- try_fn(&mut *f.mutate, drop)
-}
-
-struct Finallyalizer<'a,A> {
- mutate: &'a mut A,
- dtor: |&mut A|: 'a
-}
-
-#[unsafe_destructor]
-impl<'a,A> Drop for Finallyalizer<'a,A> {
- #[inline]
- fn drop(&mut self) {
- (self.dtor)(self.mutate);
- }
-}
-
-#[test]
-fn test_success() {
- let mut i = 0;
- try_finally(
- &mut i, (),
- |i, ()| {
- *i = 10;
- },
- |i| {
- assert!(!failing());
- assert_eq!(*i, 10);
- *i = 20;
- });
- assert_eq!(i, 20);
-}
-
-#[test]
-#[should_fail]
-fn test_fail() {
- let mut i = 0;
- try_finally(
- &mut i, (),
- |i, ()| {
- *i = 10;
- fail!();
- },
- |i| {
- assert!(failing());
- assert_eq!(*i, 10);
- })
-}
-
-#[test]
-fn test_retval() {
- let mut closure: || -> int = || 10;
- let i = closure.finally(|| { });
- assert_eq!(i, 10);
-}
-
-#[test]
-fn test_compact() {
- fn do_some_fallible_work() {}
- fn but_always_run_this_function() { }
- let mut f = do_some_fallible_work;
- f.finally(but_always_run_this_function);
-}
#![doc(hidden)]
-use prelude::*;
use libc::uintptr_t;
+use kinds::Send;
+
+pub use core::finally;
pub mod dynamic_lib;
-pub mod finally;
pub mod simd;
pub mod sync;
pub mod mutex;
use num;
use num::{CheckedMul, CheckedAdd};
use ops::Drop;
-use option::{None, Option, Some};
+use option::{None, Option, Some, Expect};
use ptr::RawPtr;
use ptr;
use rt::global_heap::{malloc_raw, realloc_raw};
use raw::Slice;
use slice::{ImmutableEqVector, ImmutableVector, Items, MutItems, MutableVector};
use slice::{MutableTotalOrdVector, OwnedVector, Vector};
+use slice::{MutableVectorAllocating};
/// An owned, growable vector.
///
pub enum FnStyle {
UnsafeFn, // declared with "unsafe fn"
NormalFn, // declared with "fn"
- ExternFn, // declared with "extern fn"
}
impl fmt::Show for FnStyle {
match *self {
NormalFn => "normal".fmt(f),
UnsafeFn => "unsafe".fmt(f),
- ExternFn => "extern".fmt(f),
}
}
}
use ast::{ExprMethodCall, ExprParen, ExprPath, ExprProc};
use ast::{ExprRepeat, ExprRet, ExprStruct, ExprTup, ExprUnary};
use ast::{ExprVec, ExprVstore, ExprVstoreSlice};
-use ast::{ExprVstoreMutSlice, ExprWhile, ExprForLoop, ExternFn, Field, FnDecl};
+use ast::{ExprVstoreMutSlice, ExprWhile, ExprForLoop, Field, FnDecl};
use ast::{ExprVstoreUniq, Once, Many};
use ast::{ForeignItem, ForeignItemStatic, ForeignItemFn, ForeignMod};
use ast::{Ident, NormalFn, Inherited, Item, Item_, ItemStatic};
pub fn parse_ty_bare_fn(&mut self) -> Ty_ {
/*
- [extern "ABI"] [unsafe] fn <'lt> (S) -> T
- ^~~~^ ^~~~~~~^ ^~~~^ ^~^ ^
- | | | | |
- | | | | Return type
- | | | Argument types
- | | Lifetimes
- | |
- | Function Style
- ABI
-
+ [unsafe] [extern "ABI"] fn <'lt> (S) -> T
+ ^~~~^ ^~~~^ ^~~~^ ^~^ ^
+ | | | | |
+ | | | | Return type
+ | | | Argument types
+ | | Lifetimes
+ | ABI
+ Function Style
*/
+ let fn_style = self.parse_unsafety();
let abi = if self.eat_keyword(keywords::Extern) {
self.parse_opt_abi().unwrap_or(abi::C)
} else {
abi::Rust
};
- let fn_style = self.parse_unsafety();
+ // NOTE: remove after a stage0 snapshot
+ let fn_style = match self.parse_unsafety() {
+ UnsafeFn => UnsafeFn,
+ NormalFn => fn_style,
+ };
+
self.expect_keyword(keywords::Fn);
let (decl, lifetimes) = self.parse_ty_fn_decl(true);
return TyBareFn(@BareFnTy {
self.expect_and();
self.parse_borrowed_pointee()
} else if self.is_keyword(keywords::Extern) ||
+ self.is_keyword(keywords::Unsafe) ||
self.token_is_bare_fn_keyword() {
// BARE FUNCTION
self.parse_ty_bare_fn()
// EXTERN FUNCTION ITEM
let abi = opt_abi.unwrap_or(abi::C);
let (ident, item_, extra_attrs) =
- self.parse_item_fn(ExternFn, abi);
+ self.parse_item_fn(NormalFn, abi);
let item = self.mk_item(lo,
self.last_span.hi,
ident,
&& self.look_ahead(1u, |t| *t != token::LBRACE) {
// UNSAFE FUNCTION ITEM
self.bump();
+ let abi = if self.eat_keyword(keywords::Extern) {
+ self.parse_opt_abi().unwrap_or(abi::C)
+ } else {
+ abi::Rust
+ };
self.expect_keyword(keywords::Fn);
let (ident, item_, extra_attrs) =
- self.parse_item_fn(UnsafeFn, abi::Rust);
+ self.parse_item_fn(UnsafeFn, abi);
let item = self.mk_item(lo,
self.last_span.hi,
ident,
abi: abi::Abi,
vis: ast::Visibility) -> IoResult<()> {
try!(word(&mut self.s, visibility_qualified(vis, "")));
-
+ try!(self.print_opt_fn_style(opt_fn_style));
if abi != abi::Rust {
try!(self.word_nbsp("extern"));
try!(self.word_nbsp(abi.to_str()));
-
- if opt_fn_style != Some(ast::ExternFn) {
- try!(self.print_opt_fn_style(opt_fn_style));
- }
- } else {
- try!(self.print_opt_fn_style(opt_fn_style));
}
word(&mut self.s, "fn")
match s {
ast::NormalFn => Ok(()),
ast::UnsafeFn => self.word_nbsp("unsafe"),
- ast::ExternFn => self.word_nbsp("extern")
}
}
let s: &'a str = *self.string;
s
}
-
- #[inline]
- fn into_owned(self) -> ~str {
- self.string.to_owned()
- }
}
impl fmt::Show for RcStr {
+S 2014-05-06 24f6f26
+ freebsd-x86_64 cebcfcece5676c9aea30241bf13c517ffdb37b7c
+ linux-i386 e9960c7c793ff7ae87c9d30c88cfedf7e40345f7
+ linux-x86_64 120f63393bf9071b1424dc5e6e55eb3db4fa7c8d
+ macos-i386 1973f342f19d346a7ae1e2e6079e8335edbcebe3
+ macos-x86_64 7b3dc30a2c28b546751593d5e34301fb314258c0
+ winnt-i386 1c7898079cece7d5fbc98566f6826d270a3111f5
+
S 2014-05-04 922c420
freebsd-x86_64 635f28dd48340db0c1cdc01adad18866acfc7020
linux-i386 360a40acf713e6f2d7fcde0112ae87d8336f320c
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-stage1
+// ignore-pretty
+
+#![feature(phase)]
+
+#[phase(syntax)]
+extern crate fourcc;
+
+fn main() {
+ let val = fourcc!("foo"); //~ ERROR string literal with len != 4 in fourcc!
+ let val2 = fourcc!("fooba"); //~ ERROR string literal with len != 4 in fourcc!
+}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-stage1
+// ignore-pretty
+
+#![feature(phase)]
+
+#[phase(syntax)]
+extern crate fourcc;
+
+fn main() {
+ let val = fourcc!("foo ", bork); //~ ERROR invalid endian directive in fourcc!
+}
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-stage1
+// ignore-pretty
+
+#![feature(phase)]
+
+#[phase(syntax)]
+extern crate fourcc;
+
+fn main() {
+ let v = fourcc!("fooλ"); //~ ERROR fourcc! literal character out of range 0-255
+}
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-stage1
+// ignore-pretty
+
+#![feature(phase)]
+
+#[phase(syntax)]
+extern crate fourcc;
+
+fn main() {
+ let val = fourcc!(foo); //~ ERROR non-literal in fourcc!
+}
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-stage1
+// ignore-pretty
+
+#![feature(phase)]
+
+#[phase(syntax)]
+extern crate fourcc;
+
+fn main() {
+ let val = fourcc!(45f32); //~ ERROR unsupported literal in fourcc!
+}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-stage1
+// ignore-pretty
+
+#![feature(phase)]
+
+#[phase(syntax)]
+extern crate hexfloat;
+
+fn main() {
+ hexfloat!("foo");
+ //~^ ERROR invalid hex float literal in hexfloat!: Expected '0'
+ hexfloat!("0");
+ //~^ERROR invalid hex float literal in hexfloat!: Expected 'x'
+ hexfloat!("0x");
+ //~^ERROR invalid hex float literal in hexfloat!: Expected '.'
+ hexfloat!("0x.");
+ //~^ERROR invalid hex float literal in hexfloat!: Expected digits before or after decimal point
+ hexfloat!("0x0.0");
+ //~^ERROR invalid hex float literal in hexfloat!: Expected 'p'
+ hexfloat!("0x0.0p");
+ //~^ERROR invalid hex float literal in hexfloat!: Expected exponent digits
+ hexfloat!("0x0.0p0f");
+ //~^ERROR invalid hex float literal in hexfloat!: Expected end of string
+}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-stage1
+// ignore-pretty
+
+#![feature(phase)]
+
+#[phase(syntax)]
+extern crate hexfloat;
+
+fn main() {
+ hexfloat!(foo);
+ //~^ ERROR non-literal in hexfloat!
+ hexfloat!(0);
+ //~^ ERROR unsupported literal in hexfloat!
+ hexfloat!("0x0.p0", invalid);
+ //~^ ERROR invalid floating point type in hexfloat!
+}
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// FIXME(#13725) windows needs fixing.
+// ignore-win32
+// ignore-stage1
+
+#![feature(phase)]
+
+extern crate regex;
+#[phase(syntax)] extern crate regex_macros;
+
+// Tests to make sure that `regex!` will produce a compile error when given
+// an invalid regular expression.
+// More exhaustive failure tests for the parser are done with the traditional
+// unit testing infrastructure, since both dynamic and native regexes use the
+// same parser.
+
+fn main() {
+ let _ = regex!("("); //~ ERROR Regex syntax error
+}
type Foo = Vec<u8>;
-impl Drop for Foo { //~ ERROR conflicting implementations
+impl Drop for Foo {
//~^ ERROR cannot provide an extension implementation
//~^^ ERROR multiple applicable methods
fn drop(&mut self) {
fn main() {
let x: Option<uint>;
x = 5;
- //~^ ERROR mismatched types: expected `std::option::Option<uint>`
+ //~^ ERROR mismatched types: expected `core::option::Option<uint>`
}
fn bar(x: uint) -> Option<uint> {
return x;
- //~^ ERROR mismatched types: expected `std::option::Option<uint>`
+ //~^ ERROR mismatched types: expected `core::option::Option<uint>`
}
fn main() {
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-test FIXME: #13991
+
+
// Test struct inheritance.
#![feature(struct_inherit)]
// tricked into looking up a non-existing second type parameter.
let _x: uint = match Some(1u) {
//~^ ERROR mismatched types: expected `uint` but found `<generic #0>`
- Ok(u) => u, //~ ERROR mismatched types: expected `std::option::Option<uint>`
- Err(e) => fail!(e) //~ ERROR mismatched types: expected `std::option::Option<uint>`
+ Ok(u) => u, //~ ERROR mismatched types: expected `core::option::Option<uint>`
+ Err(e) => fail!(e) //~ ERROR mismatched types: expected `core::option::Option<uint>`
};
}
fn main() {
match None {
Err(_) => ()
- //~^ ERROR mismatched types: expected `std::option::Option<<generic #1>>`
- // but found `std::result::Result<<generic #2>,<generic #3>>`
+ //~^ ERROR mismatched types: expected `core::option::Option<<generic #1>>`
+ // but found `core::result::Result<<generic #2>,<generic #3>>`
}
}
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-test FIXME: #13992
+
struct A { foo: int }
fn main() {
let x: Box<HashMap<~str, ~str>> = box HashMap::new();
let x: Box<Map<~str, ~str>> = x;
let y: Box<Map<uint, ~str>> = box x;
- //~^ ERROR failed to find an implementation of trait std::container::Map<uint,~str>
- // for ~std::container::Map<~str,~str>:Send
+ //~^ ERROR failed to find an implementation of trait core::container::Map<uint,~str>
+ // for ~core::container::Map<~str,~str>:Send
}
// because the def_id associated with the type was
// not convertible to a path.
let x: int = noexporttypelib::foo();
- //~^ ERROR expected `int` but found `std::option::Option<int>`
+ //~^ ERROR expected `int` but found `core::option::Option<int>`
}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-stage1
-// ignore-pretty
-
-#![feature(phase)]
-
-#[phase(syntax)]
-extern crate fourcc;
-
-fn main() {
- let val = fourcc!("foo"); //~ ERROR string literal with len != 4 in fourcc!
- let val2 = fourcc!("fooba"); //~ ERROR string literal with len != 4 in fourcc!
-}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-stage1
-// ignore-pretty
-
-#![feature(phase)]
-
-#[phase(syntax)]
-extern crate fourcc;
-
-fn main() {
- let val = fourcc!("foo ", bork); //~ ERROR invalid endian directive in fourcc!
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-stage1
-// ignore-pretty
-
-#![feature(phase)]
-
-#[phase(syntax)]
-extern crate fourcc;
-
-fn main() {
- let v = fourcc!("fooλ"); //~ ERROR fourcc! literal character out of range 0-255
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-stage1
-// ignore-pretty
-
-#![feature(phase)]
-
-#[phase(syntax)]
-extern crate fourcc;
-
-fn main() {
- let val = fourcc!(foo); //~ ERROR non-literal in fourcc!
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-stage1
-// ignore-pretty
-
-#![feature(phase)]
-
-#[phase(syntax)]
-extern crate fourcc;
-
-fn main() {
- let val = fourcc!(45f32); //~ ERROR unsupported literal in fourcc!
-}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-stage1
-// ignore-pretty
-
-#![feature(phase)]
-
-#[phase(syntax)]
-extern crate hexfloat;
-
-fn main() {
- hexfloat!("foo");
- //~^ ERROR invalid hex float literal in hexfloat!: Expected '0'
- hexfloat!("0");
- //~^ERROR invalid hex float literal in hexfloat!: Expected 'x'
- hexfloat!("0x");
- //~^ERROR invalid hex float literal in hexfloat!: Expected '.'
- hexfloat!("0x.");
- //~^ERROR invalid hex float literal in hexfloat!: Expected digits before or after decimal point
- hexfloat!("0x0.0");
- //~^ERROR invalid hex float literal in hexfloat!: Expected 'p'
- hexfloat!("0x0.0p");
- //~^ERROR invalid hex float literal in hexfloat!: Expected exponent digits
- hexfloat!("0x0.0p0f");
- //~^ERROR invalid hex float literal in hexfloat!: Expected end of string
-}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-stage1
-// ignore-pretty
-
-#![feature(phase)]
-
-#[phase(syntax)]
-extern crate hexfloat;
-
-fn main() {
- hexfloat!(foo);
- //~^ ERROR non-literal in hexfloat!
- hexfloat!(0);
- //~^ ERROR unsupported literal in hexfloat!
- hexfloat!("0x0.p0", invalid);
- //~^ ERROR invalid floating point type in hexfloat!
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// FIXME(#13725) windows needs fixing.
-// ignore-win32
-// ignore-stage1
-
-#![feature(phase)]
-
-extern crate regex;
-#[phase(syntax)] extern crate regex_macros;
-
-// Tests to make sure that `regex!` will produce a compile error when given
-// an invalid regular expression.
-// More exhaustive failure tests for the parser are done with the traditional
-// unit testing infrastructure, since both dynamic and native regexes use the
-// same parser.
-
-fn main() {
- let _ = regex!("("); //~ ERROR Regex syntax error
-}
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-test FIXME: #13993
// error-pattern:unsupported cast
extern crate libc;
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-win32: FIXME #13256
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-// debugger:finish
-// debugger:whatis 'basic-types-globals-metadata::B'
-// check:type = bool
-// debugger:whatis 'basic-types-globals-metadata::I'
-// check:type = int
-// debugger:whatis 'basic-types-globals-metadata::C'
-// check:type = char
-// debugger:whatis 'basic-types-globals-metadata::I8'
-// check:type = i8
-// debugger:whatis 'basic-types-globals-metadata::I16'
-// check:type = i16
-// debugger:whatis 'basic-types-globals-metadata::I32'
-// check:type = i32
-// debugger:whatis 'basic-types-globals-metadata::I64'
-// check:type = i64
-// debugger:whatis 'basic-types-globals-metadata::U'
-// check:type = uint
-// debugger:whatis 'basic-types-globals-metadata::U8'
-// check:type = u8
-// debugger:whatis 'basic-types-globals-metadata::U16'
-// check:type = u16
-// debugger:whatis 'basic-types-globals-metadata::U32'
-// check:type = u32
-// debugger:whatis 'basic-types-globals-metadata::U64'
-// check:type = u64
-// debugger:whatis 'basic-types-globals-metadata::F32'
-// check:type = f32
-// debugger:whatis 'basic-types-globals-metadata::F64'
-// check:type = f64
-// debugger:continue
-
-#![allow(unused_variable)]
-#![allow(dead_code)]
-
-
-static B: bool = false;
-static I: int = -1;
-static C: char = 'a';
-static I8: i8 = 68;
-static I16: i16 = -16;
-static I32: i32 = -32;
-static I64: i64 = -64;
-static U: uint = 1;
-static U8: u8 = 100;
-static U16: u16 = 16;
-static U32: u32 = 32;
-static U64: u64 = 64;
-static F32: f32 = 2.5;
-static F64: f64 = 3.5;
-
-fn main() {
- _zzz();
-
- let a = (B, I, C, I8, I16, I32, I64, U, U8, U16, U32, U64, F32, F64);
-}
-
-fn _zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Caveats - gdb prints any 8-bit value (meaning rust I8 and u8 values)
-// as its numerical value along with its associated ASCII char, there
-// doesn't seem to be any way around this. Also, gdb doesn't know
-// about UTF-32 character encoding and will print a rust char as only
-// its numerical value.
-
-// ignore-win32: FIXME #13256
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-// debugger:finish
-// debugger:print 'basic-types-globals::B'
-// check:$1 = false
-// debugger:print 'basic-types-globals::I'
-// check:$2 = -1
-// debugger:print 'basic-types-globals::C'
-// check:$3 = 97
-// debugger:print/d 'basic-types-globals::I8'
-// check:$4 = 68
-// debugger:print 'basic-types-globals::I16'
-// check:$5 = -16
-// debugger:print 'basic-types-globals::I32'
-// check:$6 = -32
-// debugger:print 'basic-types-globals::I64'
-// check:$7 = -64
-// debugger:print 'basic-types-globals::U'
-// check:$8 = 1
-// debugger:print/d 'basic-types-globals::U8'
-// check:$9 = 100
-// debugger:print 'basic-types-globals::U16'
-// check:$10 = 16
-// debugger:print 'basic-types-globals::U32'
-// check:$11 = 32
-// debugger:print 'basic-types-globals::U64'
-// check:$12 = 64
-// debugger:print 'basic-types-globals::F32'
-// check:$13 = 2.5
-// debugger:print 'basic-types-globals::F64'
-// check:$14 = 3.5
-// debugger:continue
-
-#![allow(unused_variable)]
-
-static B: bool = false;
-static I: int = -1;
-static C: char = 'a';
-static I8: i8 = 68;
-static I16: i16 = -16;
-static I32: i32 = -32;
-static I64: i64 = -64;
-static U: uint = 1;
-static U8: u8 = 100;
-static U16: u16 = 16;
-static U32: u32 = 32;
-static U64: u64 = 64;
-static F32: f32 = 2.5;
-static F64: f64 = 3.5;
-
-fn main() {
- _zzz();
-
- let a = (B, I, C, I8, I16, I32, I64, U, U8, U16, U32, U64, F32, F64);
-}
-
-fn _zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-// debugger:finish
-// debugger:whatis unit
-// check:type = ()
-// debugger:whatis b
-// check:type = bool
-// debugger:whatis i
-// check:type = int
-// debugger:whatis c
-// check:type = char
-// debugger:whatis i8
-// check:type = i8
-// debugger:whatis i16
-// check:type = i16
-// debugger:whatis i32
-// check:type = i32
-// debugger:whatis i64
-// check:type = i64
-// debugger:whatis u
-// check:type = uint
-// debugger:whatis u8
-// check:type = u8
-// debugger:whatis u16
-// check:type = u16
-// debugger:whatis u32
-// check:type = u32
-// debugger:whatis u64
-// check:type = u64
-// debugger:whatis f32
-// check:type = f32
-// debugger:whatis f64
-// check:type = f64
-// debugger:info functions _yyy
-// check:[...]![...]_yyy([...])([...]);
-// debugger:continue
-
-#![allow(unused_variable)]
-
-fn main() {
- let unit: () = ();
- let b: bool = false;
- let i: int = -1;
- let c: char = 'a';
- let i8: i8 = 68;
- let i16: i16 = -16;
- let i32: i32 = -32;
- let i64: i64 = -64;
- let u: uint = 1;
- let u8: u8 = 100;
- let u16: u16 = 16;
- let u32: u32 = 32;
- let u64: u64 = 64;
- let f32: f32 = 2.5;
- let f64: f64 = 3.5;
- _zzz();
- if 1 == 1 { _yyy(); }
-}
-
-fn _zzz() {()}
-fn _yyy() -> ! {fail!()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Caveats - gdb prints any 8-bit value (meaning rust I8 and u8 values)
-// as its numerical value along with its associated ASCII char, there
-// doesn't seem to be any way around this. Also, gdb doesn't know
-// about UTF-32 character encoding and will print a rust char as only
-// its numerical value.
-
-// ignore-win32: FIXME #13256
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-// debugger:finish
-
-// Check initializers
-// debugger:print 'basic-types-mut-globals::B'
-// check:$1 = false
-// debugger:print 'basic-types-mut-globals::I'
-// check:$2 = -1
-// debugger:print 'basic-types-mut-globals::C'
-// check:$3 = 97
-// debugger:print/d 'basic-types-mut-globals::I8'
-// check:$4 = 68
-// debugger:print 'basic-types-mut-globals::I16'
-// check:$5 = -16
-// debugger:print 'basic-types-mut-globals::I32'
-// check:$6 = -32
-// debugger:print 'basic-types-mut-globals::I64'
-// check:$7 = -64
-// debugger:print 'basic-types-mut-globals::U'
-// check:$8 = 1
-// debugger:print/d 'basic-types-mut-globals::U8'
-// check:$9 = 100
-// debugger:print 'basic-types-mut-globals::U16'
-// check:$10 = 16
-// debugger:print 'basic-types-mut-globals::U32'
-// check:$11 = 32
-// debugger:print 'basic-types-mut-globals::U64'
-// check:$12 = 64
-// debugger:print 'basic-types-mut-globals::F32'
-// check:$13 = 2.5
-// debugger:print 'basic-types-mut-globals::F64'
-// check:$14 = 3.5
-// debugger:continue
-
-// Check new values
-// debugger:print 'basic-types-mut-globals'::B
-// check:$15 = true
-// debugger:print 'basic-types-mut-globals'::I
-// check:$16 = 2
-// debugger:print 'basic-types-mut-globals'::C
-// check:$17 = 102
-// debugger:print/d 'basic-types-mut-globals'::I8
-// check:$18 = 78
-// debugger:print 'basic-types-mut-globals'::I16
-// check:$19 = -26
-// debugger:print 'basic-types-mut-globals'::I32
-// check:$20 = -12
-// debugger:print 'basic-types-mut-globals'::I64
-// check:$21 = -54
-// debugger:print 'basic-types-mut-globals'::U
-// check:$22 = 5
-// debugger:print/d 'basic-types-mut-globals'::U8
-// check:$23 = 20
-// debugger:print 'basic-types-mut-globals'::U16
-// check:$24 = 32
-// debugger:print 'basic-types-mut-globals'::U32
-// check:$25 = 16
-// debugger:print 'basic-types-mut-globals'::U64
-// check:$26 = 128
-// debugger:print 'basic-types-mut-globals'::F32
-// check:$27 = 5.75
-// debugger:print 'basic-types-mut-globals'::F64
-// check:$28 = 9.25
-
-// debugger:detach
-// debugger:quit
-
-#![allow(unused_variable)]
-
-static mut B: bool = false;
-static mut I: int = -1;
-static mut C: char = 'a';
-static mut I8: i8 = 68;
-static mut I16: i16 = -16;
-static mut I32: i32 = -32;
-static mut I64: i64 = -64;
-static mut U: uint = 1;
-static mut U8: u8 = 100;
-static mut U16: u16 = 16;
-static mut U32: u32 = 32;
-static mut U64: u64 = 64;
-static mut F32: f32 = 2.5;
-static mut F64: f64 = 3.5;
-
-fn main() {
- _zzz();
-
- unsafe {
- B = true;
- I = 2;
- C = 'f';
- I8 = 78;
- I16 = -26;
- I32 = -12;
- I64 = -54;
- U = 5;
- U8 = 20;
- U16 = 32;
- U32 = 16;
- U64 = 128;
- F32 = 5.75;
- F64 = 9.25;
- }
-
- _zzz();
-}
-
-fn _zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Caveats - gdb prints any 8-bit value (meaning rust i8 and u8 values)
-// as its numerical value along with its associated ASCII char, there
-// doesn't seem to be any way around this. Also, gdb doesn't know
-// about UTF-32 character encoding and will print a rust char as only
-// its numerical value.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-// debugger:finish
-// debugger:print b
-// check:$1 = false
-// debugger:print i
-// check:$2 = -1
-// debugger:print c
-// check:$3 = 97
-// debugger:print/d i8
-// check:$4 = 68
-// debugger:print i16
-// check:$5 = -16
-// debugger:print i32
-// check:$6 = -32
-// debugger:print i64
-// check:$7 = -64
-// debugger:print u
-// check:$8 = 1
-// debugger:print/d u8
-// check:$9 = 100
-// debugger:print u16
-// check:$10 = 16
-// debugger:print u32
-// check:$11 = 32
-// debugger:print u64
-// check:$12 = 64
-// debugger:print f32
-// check:$13 = 2.5
-// debugger:print f64
-// check:$14 = 3.5
-
-#![allow(unused_variable)]
-
-fn main() {
- let b: bool = false;
- let i: int = -1;
- let c: char = 'a';
- let i8: i8 = 68;
- let i16: i16 = -16;
- let i32: i32 = -32;
- let i64: i64 = -64;
- let u: uint = 1;
- let u8: u8 = 100;
- let u16: u16 = 16;
- let u32: u32 = 32;
- let u64: u64 = 64;
- let f32: f32 = 2.5;
- let f64: f64 = 3.5;
- _zzz();
-}
-
-fn _zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// Gdb doesn't know about UTF-32 character encoding and will print a rust char as only
-// its numerical value.
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-// debugger:finish
-// debugger:print *bool_ref
-// check:$1 = true
-
-// debugger:print *int_ref
-// check:$2 = -1
-
-// debugger:print *char_ref
-// check:$3 = 97
-
-// debugger:print *i8_ref
-// check:$4 = 68 'D'
-
-// debugger:print *i16_ref
-// check:$5 = -16
-
-// debugger:print *i32_ref
-// check:$6 = -32
-
-// debugger:print *i64_ref
-// check:$7 = -64
-
-// debugger:print *uint_ref
-// check:$8 = 1
-
-// debugger:print *u8_ref
-// check:$9 = 100 'd'
-
-// debugger:print *u16_ref
-// check:$10 = 16
-
-// debugger:print *u32_ref
-// check:$11 = 32
-
-// debugger:print *u64_ref
-// check:$12 = 64
-
-// debugger:print *f32_ref
-// check:$13 = 2.5
-
-// debugger:print *f64_ref
-// check:$14 = 3.5
-
-#![allow(unused_variable)]
-
-fn main() {
- let bool_val: bool = true;
- let bool_ref: &bool = &bool_val;
-
- let int_val: int = -1;
- let int_ref: &int = &int_val;
-
- let char_val: char = 'a';
- let char_ref: &char = &char_val;
-
- let i8_val: i8 = 68;
- let i8_ref: &i8 = &i8_val;
-
- let i16_val: i16 = -16;
- let i16_ref: &i16 = &i16_val;
-
- let i32_val: i32 = -32;
- let i32_ref: &i32 = &i32_val;
-
- let uint_val: i64 = -64;
- let i64_ref: &i64 = &uint_val;
-
- let uint_val: uint = 1;
- let uint_ref: &uint = &uint_val;
-
- let u8_val: u8 = 100;
- let u8_ref: &u8 = &u8_val;
-
- let u16_val: u16 = 16;
- let u16_ref: &u16 = &u16_val;
-
- let u32_val: u32 = 32;
- let u32_ref: &u32 = &u32_val;
-
- let u64_val: u64 = 64;
- let u64_ref: &u64 = &u64_val;
-
- let f32_val: f32 = 2.5;
- let f32_ref: &f32 = &f32_val;
-
- let f64_val: f64 = 3.5;
- let f64_ref: &f64 = &f64_val;
- zzz();
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-// debugger:finish
-
-// debugger:print *the_a_ref
-// check:$1 = TheA
-
-// debugger:print *the_b_ref
-// check:$2 = TheB
-
-// debugger:print *the_c_ref
-// check:$3 = TheC
-
-#![allow(unused_variable)]
-
-enum ABC { TheA, TheB, TheC }
-
-fn main() {
- let the_a = TheA;
- let the_a_ref: &ABC = &the_a;
-
- let the_b = TheB;
- let the_b_ref: &ABC = &the_b;
-
- let the_c = TheC;
- let the_c_ref: &ABC = &the_c;
-
- zzz();
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-// debugger:finish
-
-// debugger:print *the_a_ref
-// check:$1 = {{TheA, x = 0, y = 8970181431921507452}, {TheA, 0, 2088533116, 2088533116}}
-
-// debugger:print *the_b_ref
-// check:$2 = {{TheB, x = 0, y = 1229782938247303441}, {TheB, 0, 286331153, 286331153}}
-
-// debugger:print *univariant_ref
-// check:$3 = {4820353753753434}
-
-#![allow(unused_variable)]
-#![feature(struct_variant)]
-
-// The first element is to ensure proper alignment, irrespective of the machines word size. Since
-// the size of the discriminant value is machine dependent, this has be taken into account when
-// datatype layout should be predictable as in this case.
-enum ABC {
- TheA { x: i64, y: i64 },
- TheB (i64, i32, i32),
-}
-
-// This is a special case since it does not have the implicit discriminant field.
-enum Univariant {
- TheOnlyCase(i64)
-}
-
-fn main() {
-
- // 0b0111110001111100011111000111110001111100011111000111110001111100 = 8970181431921507452
- // 0b01111100011111000111110001111100 = 2088533116
- // 0b0111110001111100 = 31868
- // 0b01111100 = 124
- let the_a = TheA { x: 0, y: 8970181431921507452 };
- let the_a_ref: &ABC = &the_a;
-
- // 0b0001000100010001000100010001000100010001000100010001000100010001 = 1229782938247303441
- // 0b00010001000100010001000100010001 = 286331153
- // 0b0001000100010001 = 4369
- // 0b00010001 = 17
- let the_b = TheB (0, 286331153, 286331153);
- let the_b_ref: &ABC = &the_b;
-
- let univariant = TheOnlyCase(4820353753753434);
- let univariant_ref: &Univariant = &univariant;
-
- zzz();
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-#![feature(managed_boxes)]
-
-// Gdb doesn't know about UTF-32 character encoding and will print a rust char as only
-// its numerical value.
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-// debugger:finish
-// debugger:print *bool_ref
-// check:$1 = true
-
-// debugger:print *int_ref
-// check:$2 = -1
-
-// debugger:print *char_ref
-// check:$3 = 97
-
-// debugger:print/d *i8_ref
-// check:$4 = 68
-
-// debugger:print *i16_ref
-// check:$5 = -16
-
-// debugger:print *i32_ref
-// check:$6 = -32
-
-// debugger:print *i64_ref
-// check:$7 = -64
-
-// debugger:print *uint_ref
-// check:$8 = 1
-
-// debugger:print/d *u8_ref
-// check:$9 = 100
-
-// debugger:print *u16_ref
-// check:$10 = 16
-
-// debugger:print *u32_ref
-// check:$11 = 32
-
-// debugger:print *u64_ref
-// check:$12 = 64
-
-// debugger:print *f32_ref
-// check:$13 = 2.5
-
-// debugger:print *f64_ref
-// check:$14 = 3.5
-
-#![allow(unused_variable)]
-
-fn main() {
- let bool_box: @bool = @true;
- let bool_ref: &bool = bool_box;
-
- let int_box: @int = @-1;
- let int_ref: &int = int_box;
-
- let char_box: @char = @'a';
- let char_ref: &char = char_box;
-
- let i8_box: @i8 = @68;
- let i8_ref: &i8 = i8_box;
-
- let i16_box: @i16 = @-16;
- let i16_ref: &i16 = i16_box;
-
- let i32_box: @i32 = @-32;
- let i32_ref: &i32 = i32_box;
-
- let i64_box: @i64 = @-64;
- let i64_ref: &i64 = i64_box;
-
- let uint_box: @uint = @1;
- let uint_ref: &uint = uint_box;
-
- let u8_box: @u8 = @100;
- let u8_ref: &u8 = u8_box;
-
- let u16_box: @u16 = @16;
- let u16_ref: &u16 = u16_box;
-
- let u32_box: @u32 = @32;
- let u32_ref: &u32 = u32_box;
-
- let u64_box: @u64 = @64;
- let u64_ref: &u64 = u64_box;
-
- let f32_box: @f32 = @2.5;
- let f32_ref: &f32 = f32_box;
-
- let f64_box: @f64 = @3.5;
- let f64_ref: &f64 = f64_box;
- zzz();
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-// debugger:finish
-
-// debugger:print *stack_val_ref
-// check:$1 = {x = 10, y = 23.5}
-
-// debugger:print *stack_val_interior_ref_1
-// check:$2 = 10
-
-// debugger:print *stack_val_interior_ref_2
-// check:$3 = 23.5
-
-// debugger:print *ref_to_unnamed
-// check:$4 = {x = 11, y = 24.5}
-
-// debugger:print *managed_val_ref
-// check:$5 = {x = 12, y = 25.5}
-
-// debugger:print *managed_val_interior_ref_1
-// check:$6 = 12
-
-// debugger:print *managed_val_interior_ref_2
-// check:$7 = 25.5
-
-// debugger:print *unique_val_ref
-// check:$8 = {x = 13, y = 26.5}
-
-// debugger:print *unique_val_interior_ref_1
-// check:$9 = 13
-
-// debugger:print *unique_val_interior_ref_2
-// check:$10 = 26.5
-
-#![feature(managed_boxes)]
-#![allow(unused_variable)]
-
-struct SomeStruct {
- x: int,
- y: f64
-}
-
-fn main() {
- let stack_val: SomeStruct = SomeStruct { x: 10, y: 23.5 };
- let stack_val_ref: &SomeStruct = &stack_val;
- let stack_val_interior_ref_1: &int = &stack_val.x;
- let stack_val_interior_ref_2: &f64 = &stack_val.y;
- let ref_to_unnamed: &SomeStruct = &SomeStruct { x: 11, y: 24.5 };
-
- let managed_val = @SomeStruct { x: 12, y: 25.5 };
- let managed_val_ref: &SomeStruct = managed_val;
- let managed_val_interior_ref_1: &int = &managed_val.x;
- let managed_val_interior_ref_2: &f64 = &managed_val.y;
-
- let unique_val = box SomeStruct { x: 13, y: 26.5 };
- let unique_val_ref: &SomeStruct = unique_val;
- let unique_val_interior_ref_1: &int = &unique_val.x;
- let unique_val_interior_ref_2: &f64 = &unique_val.y;
-
- zzz();
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-#![feature(managed_boxes)]
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-// debugger:finish
-
-// debugger:print *stack_val_ref
-// check:$1 = {-14, -19}
-
-// debugger:print *ref_to_unnamed
-// check:$2 = {-15, -20}
-
-// debugger:print *managed_val_ref
-// check:$3 = {-16, -21}
-
-// debugger:print *unique_val_ref
-// check:$4 = {-17, -22}
-
-#![allow(unused_variable)]
-
-
-fn main() {
- let stack_val: (i16, f32) = (-14, -19f32);
- let stack_val_ref: &(i16, f32) = &stack_val;
- let ref_to_unnamed: &(i16, f32) = &(-15, -20f32);
-
- let managed_val: @(i16, f32) = @(-16, -21f32);
- let managed_val_ref: &(i16, f32) = managed_val;
-
- let unique_val: Box<(i16, f32)> = box() (-17, -22f32);
- let unique_val_ref: &(i16, f32) = unique_val;
-
- zzz();
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// Gdb doesn't know about UTF-32 character encoding and will print a rust char as only
-// its numerical value.
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-// debugger:finish
-// debugger:print *bool_ref
-// check:$1 = true
-
-// debugger:print *int_ref
-// check:$2 = -1
-
-// debugger:print *char_ref
-// check:$3 = 97
-
-// debugger:print/d *i8_ref
-// check:$4 = 68
-
-// debugger:print *i16_ref
-// check:$5 = -16
-
-// debugger:print *i32_ref
-// check:$6 = -32
-
-// debugger:print *i64_ref
-// check:$7 = -64
-
-// debugger:print *uint_ref
-// check:$8 = 1
-
-// debugger:print/d *u8_ref
-// check:$9 = 100
-
-// debugger:print *u16_ref
-// check:$10 = 16
-
-// debugger:print *u32_ref
-// check:$11 = 32
-
-// debugger:print *u64_ref
-// check:$12 = 64
-
-// debugger:print *f32_ref
-// check:$13 = 2.5
-
-// debugger:print *f64_ref
-// check:$14 = 3.5
-
-#![allow(unused_variable)]
-
-
-fn main() {
- let bool_box: Box<bool> = box true;
- let bool_ref: &bool = bool_box;
-
- let int_box: Box<int> = box -1;
- let int_ref: &int = int_box;
-
- let char_box: Box<char> = box 'a';
- let char_ref: &char = char_box;
-
- let i8_box: Box<i8> = box 68;
- let i8_ref: &i8 = i8_box;
-
- let i16_box: Box<i16> = box -16;
- let i16_ref: &i16 = i16_box;
-
- let i32_box: Box<i32> = box -32;
- let i32_ref: &i32 = i32_box;
-
- let i64_box: Box<i64> = box -64;
- let i64_ref: &i64 = i64_box;
-
- let uint_box: Box<uint> = box 1;
- let uint_ref: &uint = uint_box;
-
- let u8_box: Box<u8> = box 100;
- let u8_ref: &u8 = u8_box;
-
- let u16_box: Box<u16> = box 16;
- let u16_ref: &u16 = u16_box;
-
- let u32_box: Box<u32> = box 32;
- let u32_ref: &u32 = u32_box;
-
- let u64_box: Box<u64> = box 64;
- let u64_ref: &u64 = u64_box;
-
- let f32_box: Box<f32> = box 2.5;
- let f32_ref: &f32 = f32_box;
-
- let f64_box: Box<f64> = box 3.5;
- let f64_ref: &f64 = f64_box;
- zzz();
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:set print pretty off
-// debugger:rbreak zzz
-// debugger:run
-// debugger:finish
-// debugger:print *a
-// check:$1 = 1
-// debugger:print *b
-// check:$2 = {2, 3.5}
-// debugger:print c->val
-// check:$3 = 4
-// debugger:print d->val
-// check:$4 = false
-
-#![feature(managed_boxes)]
-#![allow(unused_variable)]
-
-fn main() {
- let a = box 1;
- let b = box() (2, 3.5);
- let c = @4;
- let d = @false;
- _zzz();
-}
-
-fn _zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-// debugger:finish
-
-// debugger:print *unique
-// check:$1 = {x = 99, y = 999, z = 9999, w = 99999}
-
-// debugger:print managed->val
-// check:$2 = {x = 88, y = 888, z = 8888, w = 88888}
-
-// debugger:print *unique_dtor
-// check:$3 = {x = 77, y = 777, z = 7777, w = 77777}
-
-// debugger:print managed_dtor->val
-// check:$4 = {x = 33, y = 333, z = 3333, w = 33333}
-
-#![feature(managed_boxes)]
-#![allow(unused_variable)]
-
-
-struct StructWithSomePadding {
- x: i16,
- y: i32,
- z: i32,
- w: i64
-}
-
-struct StructWithDestructor {
- x: i16,
- y: i32,
- z: i32,
- w: i64
-}
-
-impl Drop for StructWithDestructor {
- fn drop(&mut self) {}
-}
-
-fn main() {
-
- let unique = box StructWithSomePadding { x: 99, y: 999, z: 9999, w: 99999 };
- let managed = @StructWithSomePadding { x: 88, y: 888, z: 8888, w: 88888 };
-
- let unique_dtor = box StructWithDestructor { x: 77, y: 777, z: 7777, w: 77777 };
- let managed_dtor = @StructWithDestructor { x: 33, y: 333, z: 3333, w: 33333 };
-
- zzz();
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-
-// debugger:finish
-// debugger:print s
-// check:$1 = {a = 1, b = 2.5}
-// debugger:continue
-
-// debugger:finish
-// debugger:print x
-// check:$2 = {a = 3, b = 4.5}
-// debugger:print y
-// check:$3 = 5
-// debugger:print z
-// check:$4 = 6.5
-// debugger:continue
-
-// debugger:finish
-// debugger:print a
-// check:$5 = {7, 8, 9.5, 10.5}
-// debugger:continue
-
-// debugger:finish
-// debugger:print a
-// check:$6 = {11.5, 12.5, 13, 14}
-// debugger:continue
-
-// debugger:finish
-// debugger:print x
-// check:$7 = {{Case1, x = 0, y = 8970181431921507452}, {Case1, 0, 2088533116, 2088533116}}
-// debugger:continue
-
-#![feature(struct_variant)]
-
-#[deriving(Clone)]
-struct Struct {
- a: int,
- b: f64
-}
-
-#[deriving(Clone)]
-struct StructStruct {
- a: Struct,
- b: Struct
-}
-
-fn fun(s: Struct) {
- zzz();
-}
-
-fn fun_fun(StructStruct { a: x, b: Struct { a: y, b: z } }: StructStruct) {
- zzz();
-}
-
-fn tup(a: (int, uint, f64, f64)) {
- zzz();
-}
-
-struct Newtype(f64, f64, int, uint);
-
-fn new_type(a: Newtype) {
- zzz();
-}
-
-// The first element is to ensure proper alignment, irrespective of the machines word size. Since
-// the size of the discriminant value is machine dependent, this has be taken into account when
-// datatype layout should be predictable as in this case.
-enum Enum {
- Case1 { x: i64, y: i64 },
- Case2 (i64, i32, i32),
-}
-
-fn by_val_enum(x: Enum) {
- zzz();
-}
-
-fn main() {
- fun(Struct { a: 1, b: 2.5 });
- fun_fun(StructStruct { a: Struct { a: 3, b: 4.5 }, b: Struct { a: 5, b: 6.5 } });
- tup((7, 8, 9.5, 10.5));
- new_type(Newtype(11.5, 12.5, 13, 14));
-
- // 0b0111110001111100011111000111110001111100011111000111110001111100 = 8970181431921507452
- // 0b01111100011111000111110001111100 = 2088533116
- // 0b0111110001111100 = 31868
- // 0b01111100 = 124
- by_val_enum(Case1 { x: 0, y: 8970181431921507452 });
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-#![feature(managed_boxes)]
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-
-// debugger:finish
-// debugger:print self
-// check:$1 = 1111
-// debugger:continue
-
-// debugger:finish
-// debugger:print self
-// check:$2 = {x = 2222, y = 3333}
-// debugger:continue
-
-// debugger:finish
-// debugger:print self
-// check:$3 = {4444.5, 5555, 6666, 7777.5}
-// debugger:continue
-
-// debugger:finish
-// debugger:print self->val
-// check:$4 = 8888
-// debugger:continue
-
-trait Trait {
- fn method(self) -> Self;
-}
-
-impl Trait for int {
- fn method(self) -> int {
- zzz();
- self
- }
-}
-
-struct Struct {
- x: uint,
- y: uint,
-}
-
-impl Trait for Struct {
- fn method(self) -> Struct {
- zzz();
- self
- }
-}
-
-impl Trait for (f64, int, int, f64) {
- fn method(self) -> (f64, int, int, f64) {
- zzz();
- self
- }
-}
-
-impl Trait for @int {
- fn method(self) -> @int {
- zzz();
- self
- }
-}
-
-fn main() {
- let _ = (1111 as int).method();
- let _ = Struct { x: 2222, y: 3333 }.method();
- let _ = (4444.5, 5555, 6666, 7777.5).method();
- let _ = (@8888).method();
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-// debugger:finish
-
-// debugger:print tuple_interior_padding
-// check:$1 = {0, OneHundred}
-
-// debugger:print tuple_padding_at_end
-// check:$2 = {{1, OneThousand}, 2}
-
-// debugger:print tuple_different_enums
-// check:$3 = {OneThousand, MountainView, OneMillion, Vienna}
-
-// debugger:print padded_struct
-// check:$4 = {a = 3, b = OneMillion, c = 4, d = Toronto, e = 5}
-
-// debugger:print packed_struct
-// check:$5 = {a = 6, b = OneHundred, c = 7, d = Vienna, e = 8}
-
-// debugger:print non_padded_struct
-// check:$6 = {a = OneMillion, b = MountainView, c = OneThousand, d = Toronto}
-
-// debugger:print struct_with_drop
-// check:$7 = {{a = OneHundred, b = Vienna}, 9}
-
-#![allow(unused_variable)]
-
-enum AnEnum {
- OneHundred = 100,
- OneThousand = 1000,
- OneMillion = 1000000
-}
-
-enum AnotherEnum {
- MountainView,
- Toronto,
- Vienna
-}
-
-struct PaddedStruct {
- a: i16,
- b: AnEnum,
- c: i16,
- d: AnotherEnum,
- e: i16
-}
-
-#[packed]
-struct PackedStruct {
- a: i16,
- b: AnEnum,
- c: i16,
- d: AnotherEnum,
- e: i16
-}
-
-struct NonPaddedStruct {
- a: AnEnum,
- b: AnotherEnum,
- c: AnEnum,
- d: AnotherEnum
-}
-
-struct StructWithDrop {
- a: AnEnum,
- b: AnotherEnum
-}
-
-impl Drop for StructWithDrop {
- fn drop(&mut self) {()}
-}
-
-fn main() {
-
- let tuple_interior_padding = (0_i16, OneHundred);
- // It will depend on the machine architecture if any padding is actually involved here
- let tuple_padding_at_end = ((1_u64, OneThousand), 2_u64);
- let tuple_different_enums = (OneThousand, MountainView, OneMillion, Vienna);
-
- let padded_struct = PaddedStruct {
- a: 3,
- b: OneMillion,
- c: 4,
- d: Toronto,
- e: 5
- };
-
- let packed_struct = PackedStruct {
- a: 6,
- b: OneHundred,
- c: 7,
- d: Vienna,
- e: 8
- };
-
- let non_padded_struct = NonPaddedStruct {
- a: OneMillion,
- b: MountainView,
- c: OneThousand,
- d: Toronto
- };
-
- let struct_with_drop = (StructWithDrop { a: OneHundred, b: Vienna }, 9_i64);
-
- zzz();
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-win32: FIXME #13256
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:rbreak zzz
-
-// debugger:print 'c-style-enum::SINGLE_VARIANT'
-// check:$1 = TheOnlyVariant
-
-// debugger:print 'c-style-enum::AUTO_ONE'
-// check:$2 = One
-
-// debugger:print 'c-style-enum::AUTO_TWO'
-// check:$3 = One
-
-// debugger:print 'c-style-enum::AUTO_THREE'
-// check:$4 = One
-
-// debugger:print 'c-style-enum::MANUAL_ONE'
-// check:$5 = OneHundred
-
-// debugger:print 'c-style-enum::MANUAL_TWO'
-// check:$6 = OneHundred
-
-// debugger:print 'c-style-enum::MANUAL_THREE'
-// check:$7 = OneHundred
-
-// debugger:run
-// debugger:finish
-
-// debugger:print auto_one
-// check:$8 = One
-
-// debugger:print auto_two
-// check:$9 = Two
-
-// debugger:print auto_three
-// check:$10 = Three
-
-// debugger:print manual_one_hundred
-// check:$11 = OneHundred
-
-// debugger:print manual_one_thousand
-// check:$12 = OneThousand
-
-// debugger:print manual_one_million
-// check:$13 = OneMillion
-
-// debugger:print single_variant
-// check:$14 = TheOnlyVariant
-
-// debugger:print 'c-style-enum::AUTO_TWO'
-// check:$15 = Two
-
-// debugger:print 'c-style-enum::AUTO_THREE'
-// check:$16 = Three
-
-// debugger:print 'c-style-enum::MANUAL_TWO'
-// check:$17 = OneThousand
-
-// debugger:print 'c-style-enum::MANUAL_THREE'
-// check:$18 = OneMillion
-
-#![allow(unused_variable)]
-#![allow(dead_code)]
-
-enum AutoDiscriminant {
- One,
- Two,
- Three
-}
-
-enum ManualDiscriminant {
- OneHundred = 100,
- OneThousand = 1000,
- OneMillion = 1000000
-}
-
-enum SingleVariant {
- TheOnlyVariant
-}
-
-static SINGLE_VARIANT: SingleVariant = TheOnlyVariant;
-
-static mut AUTO_ONE: AutoDiscriminant = One;
-static mut AUTO_TWO: AutoDiscriminant = One;
-static mut AUTO_THREE: AutoDiscriminant = One;
-
-static mut MANUAL_ONE: ManualDiscriminant = OneHundred;
-static mut MANUAL_TWO: ManualDiscriminant = OneHundred;
-static mut MANUAL_THREE: ManualDiscriminant = OneHundred;
-
-fn main() {
-
- let auto_one = One;
- let auto_two = Two;
- let auto_three = Three;
-
- let manual_one_hundred = OneHundred;
- let manual_one_thousand = OneThousand;
- let manual_one_million = OneMillion;
-
- let single_variant = TheOnlyVariant;
-
- unsafe {
- AUTO_TWO = Two;
- AUTO_THREE = Three;
-
- MANUAL_TWO = OneThousand;
- MANUAL_THREE = OneMillion;
- };
-
- zzz();
-
- let a = SINGLE_VARIANT;
- let a = unsafe { AUTO_ONE };
- let a = unsafe { MANUAL_ONE };
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-
-// debugger:finish
-// debugger:print x
-// check:$1 = 0.5
-// debugger:print y
-// check:$2 = 10
-// debugger:continue
-
-// debugger:finish
-// debugger:print *x
-// check:$3 = 29
-// debugger:print *y
-// check:$4 = 110
-// debugger:continue
-
-fn some_generic_fun<T1, T2>(a: T1, b: T2) -> (T2, T1) {
-
- let closure = |x, y| {
- zzz();
- (y, x)
- };
-
- closure(a, b)
-}
-
-fn main() {
- some_generic_fun(0.5, 10);
- some_generic_fun(&29, box 110);
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-
-// debugger:finish
-// debugger:print a
-// check:$1 = 1
-// debugger:print b
-// check:$2 = false
-// debugger:continue
-
-// debugger:finish
-// debugger:print a
-// check:$3 = 2
-// debugger:print b
-// check:$4 = 3
-// debugger:print c
-// check:$5 = 4
-// debugger:continue
-
-// debugger:finish
-// debugger:print a
-// check:$6 = 5
-// debugger:print b
-// check:$7 = {6, 7}
-// debugger:continue
-
-// debugger:finish
-// debugger:print h
-// check:$8 = 8
-// debugger:print i
-// check:$9 = {a = 9, b = 10}
-// debugger:print j
-// check:$10 = 11
-// debugger:continue
-
-// debugger:finish
-// debugger:print k
-// check:$11 = 12
-// debugger:print l
-// check:$12 = 13
-// debugger:continue
-
-// debugger:finish
-// debugger:print m
-// check:$13 = 14
-// debugger:print n
-// check:$14 = 16
-// debugger:continue
-
-// debugger:finish
-// debugger:print o
-// check:$15 = 18
-// debugger:continue
-
-// debugger:finish
-// debugger:print p
-// check:$16 = 19
-// debugger:print q
-// check:$17 = 20
-// debugger:print r
-// check:$18 = {a = 21, b = 22}
-// debugger:continue
-
-// debugger:finish
-// debugger:print s
-// check:$19 = 24
-// debugger:print t
-// check:$20 = 23
-// debugger:continue
-
-// debugger:finish
-// debugger:print u
-// check:$21 = 25
-// debugger:print v
-// check:$22 = 26
-// debugger:print w
-// check:$23 = 27
-// debugger:print x
-// check:$24 = 28
-// debugger:print y
-// check:$25 = 29
-// debugger:print z
-// check:$26 = 30
-// debugger:print ae
-// check:$27 = 31
-// debugger:print oe
-// check:$28 = 32
-// debugger:print ue
-// check:$29 = 33
-// debugger:continue
-
-// debugger:finish
-// debugger:print aa
-// check:$30 = {34, 35}
-// debugger:continue
-
-// debugger:finish
-// debugger:print bb
-// check:$31 = {36, 37}
-// debugger:continue
-
-// debugger:finish
-// debugger:print cc
-// check:$32 = 38
-// debugger:continue
-
-// debugger:finish
-// debugger:print dd
-// check:$33 = {40, 41, 42}
-// debugger:continue
-
-// debugger:finish
-// debugger:print *ee
-// check:$34 = {43, 44, 45}
-// debugger:continue
-
-// debugger:finish
-// debugger:print *ff
-// check:$35 = 46
-// debugger:print gg
-// check:$36 = {47, 48}
-// debugger:continue
-
-// debugger:finish
-// debugger:print *hh
-// check:$37 = 50
-// debugger:continue
-
-// debugger:finish
-// debugger:print ii
-// check:$38 = 51
-// debugger:continue
-
-// debugger:finish
-// debugger:print *jj
-// check:$39 = 52
-// debugger:continue
-
-// debugger:finish
-// debugger:print kk
-// check:$40 = 53
-// debugger:print ll
-// check:$41 = 54
-// debugger:continue
-
-// debugger:finish
-// debugger:print mm
-// check:$42 = 55
-// debugger:print *nn
-// check:$43 = 56
-// debugger:continue
-
-// debugger:finish
-// debugger:print oo
-// check:$44 = 57
-// debugger:print pp
-// check:$45 = 58
-// debugger:print qq
-// check:$46 = 59
-// debugger:continue
-
-// debugger:finish
-// debugger:print rr
-// check:$47 = 60
-// debugger:print ss
-// check:$48 = 61
-// debugger:print tt
-// check:$49 = 62
-// debugger:continue
-
-#![allow(unused_variable)]
-
-
-struct Struct {
- a: i64,
- b: i32
-}
-
-enum Univariant {
- Unit(i32)
-}
-
-struct TupleStruct (f64, int);
-
-
-fn simple_tuple((a, b): (int, bool)) {
- zzz();
-}
-
-fn nested_tuple((a, (b, c)): (int, (u16, u16))) {
- zzz();
-}
-
-fn destructure_only_first_level((a, b): (int, (u32, u32))) {
- zzz();
-}
-
-fn struct_as_tuple_element((h, i, j): (i16, Struct, i16)) {
- zzz();
-}
-
-fn struct_pattern(Struct { a: k, b: l }: Struct) {
- zzz();
-}
-
-fn ignored_tuple_element((m, _, n): (int, u16, i32)) {
- zzz();
-}
-
-fn ignored_struct_field(Struct { b: o, .. }: Struct) {
- zzz();
-}
-
-fn one_struct_destructured_one_not((Struct { a: p, b: q }, r): (Struct, Struct)) {
- zzz();
-}
-
-fn different_order_of_struct_fields(Struct { b: s, a: t }: Struct ) {
- zzz();
-}
-
-fn complex_nesting(((u, v ), ((w, (x, Struct { a: y, b: z})), Struct { a: ae, b: oe }), ue ):
- ((i16, i32), ((i64, (i32, Struct, )), Struct ), u16))
-{
- zzz();
-}
-
-fn managed_box(&aa: &(int, int)) {
- zzz();
-}
-
-fn borrowed_pointer(&bb: &(int, int)) {
- zzz();
-}
-
-fn contained_borrowed_pointer((&cc, _): (&int, int)) {
- zzz();
-}
-
-fn unique_pointer(box dd: Box<(int, int, int)>) {
- zzz();
-}
-
-fn ref_binding(ref ee: (int, int, int)) {
- zzz();
-}
-
-fn ref_binding_in_tuple((ref ff, gg): (int, (int, int))) {
- zzz();
-}
-
-fn ref_binding_in_struct(Struct { b: ref hh, .. }: Struct) {
- zzz();
-}
-
-fn univariant_enum(Unit(ii): Univariant) {
- zzz();
-}
-
-fn univariant_enum_with_ref_binding(Unit(ref jj): Univariant) {
- zzz();
-}
-
-fn tuple_struct(TupleStruct(kk, ll): TupleStruct) {
- zzz();
-}
-
-fn tuple_struct_with_ref_binding(TupleStruct(mm, ref nn): TupleStruct) {
- zzz();
-}
-
-fn multiple_arguments((oo, pp): (int, int), qq : int) {
- zzz();
-}
-
-fn main() {
- simple_tuple((1, false));
- nested_tuple((2, (3, 4)));
- destructure_only_first_level((5, (6, 7)));
- struct_as_tuple_element((8, Struct { a: 9, b: 10 }, 11));
- struct_pattern(Struct { a: 12, b: 13 });
- ignored_tuple_element((14, 15, 16));
- ignored_struct_field(Struct { a: 17, b: 18 });
- one_struct_destructured_one_not((Struct { a: 19, b: 20 }, Struct { a: 21, b: 22 }));
- different_order_of_struct_fields(Struct { a: 23, b: 24 });
- complex_nesting(((25, 26), ((27, (28, Struct { a: 29, b: 30})), Struct { a: 31, b: 32 }), 33));
- managed_box(&(34, 35));
- borrowed_pointer(&(36, 37));
- contained_borrowed_pointer((&38, 39));
- unique_pointer(box() (40, 41, 42));
- ref_binding((43, 44, 45));
- ref_binding_in_tuple((46, (47, 48)));
- ref_binding_in_struct(Struct { a: 49, b: 50 });
- univariant_enum(Unit(51));
- univariant_enum_with_ref_binding(Unit(52));
- tuple_struct(TupleStruct(53.0, 54));
- tuple_struct_with_ref_binding(TupleStruct(55.0, 56));
- multiple_arguments((57, 58), 59);
-
- fn nested_function(rr: int, (ss, tt): (int, int)) {
- zzz();
- }
-
- nested_function(60, (61, 62));
-}
-
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-// debugger:finish
-
-// debugger:print a
-// check:$1 = 1
-// debugger:print b
-// check:$2 = false
-
-// debugger:print c
-// check:$3 = 2
-// debugger:print d
-// check:$4 = 3
-// debugger:print e
-// check:$5 = 4
-
-// debugger:print f
-// check:$6 = 5
-// debugger:print g
-// check:$7 = {6, 7}
-
-// debugger:print h
-// check:$8 = 8
-// debugger:print i
-// check:$9 = {a = 9, b = 10}
-// debugger:print j
-// check:$10 = 11
-
-// debugger:print k
-// check:$11 = 12
-// debugger:print l
-// check:$12 = 13
-
-// debugger:print m
-// check:$13 = 14
-// debugger:print n
-// check:$14 = 16
-
-// debugger:print o
-// check:$15 = 18
-
-// debugger:print p
-// check:$16 = 19
-// debugger:print q
-// check:$17 = 20
-// debugger:print r
-// check:$18 = {a = 21, b = 22}
-
-// debugger:print s
-// check:$19 = 24
-// debugger:print t
-// check:$20 = 23
-
-// debugger:print u
-// check:$21 = 25
-// debugger:print v
-// check:$22 = 26
-// debugger:print w
-// check:$23 = 27
-// debugger:print x
-// check:$24 = 28
-// debugger:print y
-// check:$25 = 29
-// debugger:print z
-// check:$26 = 30
-// debugger:print ae
-// check:$27 = 31
-// debugger:print oe
-// check:$28 = 32
-// debugger:print ue
-// check:$29 = 33
-
-// debugger:print aa
-// check:$30 = {34, 35}
-
-// debugger:print bb
-// check:$31 = {36, 37}
-
-// debugger:print cc
-// check:$32 = 38
-
-// debugger:print dd
-// check:$33 = {40, 41, 42}
-
-// debugger:print *ee
-// check:$34 = {43, 44, 45}
-
-// debugger:print *ff
-// check:$35 = 46
-
-// debugger:print gg
-// check:$36 = {47, 48}
-
-// debugger:print *hh
-// check:$37 = 50
-
-// debugger:print ii
-// check:$38 = 51
-
-// debugger:print *jj
-// check:$39 = 52
-
-// debugger:print kk
-// check:$40 = 53
-
-// debugger:print ll
-// check:$41 = 54
-
-// debugger:print mm
-// check:$42 = 55
-
-// debugger:print *nn
-// check:$43 = 56
-
-#![allow(unused_variable)]
-
-struct Struct {
- a: i64,
- b: i32
-}
-
-enum Univariant {
- Unit(i32)
-}
-
-struct TupleStruct (f64, int);
-
-
-fn main() {
- // simple tuple
- let (a, b) : (int, bool) = (1, false);
-
- // nested tuple
- let (c, (d, e)) : (int, (u16, u16)) = (2, (3, 4));
-
- // bind tuple-typed value to one name (destructure only first level)
- let (f, g) : (int, (u32, u32)) = (5, (6, 7));
-
- // struct as tuple element
- let (h, i, j) : (i16, Struct, i16) = (8, Struct { a: 9, b: 10 }, 11);
-
- // struct pattern
- let Struct { a: k, b: l } = Struct { a: 12, b: 13 };
-
- // ignored tuple element
- let (m, _, n) = (14, 15, 16);
-
- // ignored struct field
- let Struct { b: o, .. } = Struct { a: 17, b: 18 };
-
- // one struct destructured, one not
- let (Struct { a: p, b: q }, r) = (Struct { a: 19, b: 20 }, Struct { a: 21, b: 22 });
-
- // different order of struct fields
- let Struct { b: s, a: t } = Struct { a: 23, b: 24 };
-
- // complex nesting
- let ((u, v), ((w, (x, Struct { a: y, b: z})), Struct { a: ae, b: oe }), ue) =
- ((25, 26), ((27, (28, Struct { a: 29, b: 30})), Struct { a: 31, b: 32 }), 33);
-
- // reference
- let &aa = &(34, 35);
-
- // reference
- let &bb = &(36, 37);
-
- // contained reference
- let (&cc, _) = (&38, 39);
-
- // unique pointer
- let box dd = box() (40, 41, 42);
-
- // ref binding
- let ref ee = (43, 44, 45);
-
- // ref binding in tuple
- let (ref ff, gg) = (46, (47, 48));
-
- // ref binding in struct
- let Struct { b: ref hh, .. } = Struct { a: 49, b: 50 };
-
- // univariant enum
- let Unit(ii) = Unit(51);
-
- // univariant enum with ref binding
- let &Unit(ref jj) = &Unit(52);
-
- // tuple struct
- let &TupleStruct(kk, ll) = &TupleStruct(53.0, 54);
-
- // tuple struct with ref binding
- let &TupleStruct(mm, ref nn) = &TupleStruct(55.0, 56);
-
- zzz();
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:set print pretty off
-// debugger:rbreak zzz
-// debugger:run
-// debugger:finish
-
-// debugger:print no_padding1
-// check:$1 = {x = {0, 1, 2}, y = -3, z = {4.5, 5.5}}
-// debugger:print no_padding2
-// check:$2 = {x = {6, 7, 8}, y = {{9, 10}, {11, 12}}}
-
-// debugger:print struct_internal_padding
-// check:$3 = {x = {13, 14}, y = {15, 16}}
-
-// debugger:print single_vec
-// check:$4 = {x = {17, 18, 19, 20, 21}}
-
-// debugger:print struct_padded_at_end
-// check:$5 = {x = {22, 23}, y = {24, 25}}
-
-#![allow(unused_variable)]
-
-struct NoPadding1 {
- x: [u32, ..3],
- y: i32,
- z: [f32, ..2]
-}
-
-struct NoPadding2 {
- x: [u32, ..3],
- y: [[u32, ..2], ..2]
-}
-
-struct StructInternalPadding {
- x: [i16, ..2],
- y: [i64, ..2]
-}
-
-struct SingleVec {
- x: [i16, ..5]
-}
-
-struct StructPaddedAtEnd {
- x: [i64, ..2],
- y: [i16, ..2]
-}
-
-fn main() {
-
- let no_padding1 = NoPadding1 {
- x: [0, 1, 2],
- y: -3,
- z: [4.5, 5.5]
- };
-
- let no_padding2 = NoPadding2 {
- x: [6, 7, 8],
- y: [[9, 10], [11, 12]]
- };
-
- let struct_internal_padding = StructInternalPadding {
- x: [13, 14],
- y: [15, 16]
- };
-
- let single_vec = SingleVec {
- x: [17, 18, 19, 20, 21]
- };
-
- let struct_padded_at_end = StructPaddedAtEnd {
- x: [22, 23],
- y: [24, 25]
- };
-
- zzz();
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// This test case checks if function arguments already have the correct value when breaking at the
-// first line of the function, that is if the function prologue has already been executed at the
-// first line. Note that because of the __morestack part of the prologue GDB incorrectly breaks at
-// before the arguments have been properly loaded when setting the breakpoint via the function name.
-// Therefore the setup here sets them using line numbers (so be careful when changing this file).
-
-// compile-flags:-g
-// debugger:set print pretty off
-// debugger:break function-arg-initialization.rs:139
-// debugger:break function-arg-initialization.rs:154
-// debugger:break function-arg-initialization.rs:158
-// debugger:break function-arg-initialization.rs:162
-// debugger:break function-arg-initialization.rs:166
-// debugger:break function-arg-initialization.rs:170
-// debugger:break function-arg-initialization.rs:174
-// debugger:break function-arg-initialization.rs:178
-// debugger:break function-arg-initialization.rs:182
-// debugger:break function-arg-initialization.rs:190
-// debugger:break function-arg-initialization.rs:197
-
-
-// debugger:run
-
-// IMMEDIATE ARGS
-// debugger:print a
-// check:$1 = 1
-// debugger:print b
-// check:$2 = true
-// debugger:print c
-// check:$3 = 2.5
-// debugger:continue
-
-// NON IMMEDIATE ARGS
-// debugger:print a
-// check:$4 = {a = 3, b = 4, c = 5, d = 6, e = 7, f = 8, g = 9, h = 10}
-// debugger:print b
-// check:$5 = {a = 11, b = 12, c = 13, d = 14, e = 15, f = 16, g = 17, h = 18}
-// debugger:continue
-
-// BINDING
-// debugger:print a
-// check:$6 = 19
-// debugger:print b
-// check:$7 = 20
-// debugger:print c
-// check:$8 = 21.5
-// debugger:continue
-
-// ASSIGNMENT
-// debugger:print a
-// check:$9 = 22
-// debugger:print b
-// check:$10 = 23
-// debugger:print c
-// check:$11 = 24.5
-// debugger:continue
-
-// FUNCTION CALL
-// debugger:print x
-// check:$12 = 25
-// debugger:print y
-// check:$13 = 26
-// debugger:print z
-// check:$14 = 27.5
-// debugger:continue
-
-// EXPR
-// debugger:print x
-// check:$15 = 28
-// debugger:print y
-// check:$16 = 29
-// debugger:print z
-// check:$17 = 30.5
-// debugger:continue
-
-// RETURN EXPR
-// debugger:print x
-// check:$18 = 31
-// debugger:print y
-// check:$19 = 32
-// debugger:print z
-// check:$20 = 33.5
-// debugger:continue
-
-// ARITHMETIC EXPR
-// debugger:print x
-// check:$21 = 34
-// debugger:print y
-// check:$22 = 35
-// debugger:print z
-// check:$23 = 36.5
-// debugger:continue
-
-// IF EXPR
-// debugger:print x
-// check:$24 = 37
-// debugger:print y
-// check:$25 = 38
-// debugger:print z
-// check:$26 = 39.5
-// debugger:continue
-
-// WHILE EXPR
-// debugger:print x
-// check:$27 = 40
-// debugger:print y
-// check:$28 = 41
-// debugger:print z
-// check:$29 = 42
-// debugger:continue
-
-// LOOP EXPR
-// debugger:print x
-// check:$30 = 43
-// debugger:print y
-// check:$31 = 44
-// debugger:print z
-// check:$32 = 45
-// debugger:continue
-
-#![allow(unused_variable)]
-
-
-
-
-fn immediate_args(a: int, b: bool, c: f64) {
- ()
-}
-
-struct BigStruct {
- a: u64,
- b: u64,
- c: u64,
- d: u64,
- e: u64,
- f: u64,
- g: u64,
- h: u64
-}
-
-fn non_immediate_args(a: BigStruct, b: BigStruct) {
- ()
-}
-
-fn binding(a: i64, b: u64, c: f64) {
- let x = 0;
-}
-
-fn assignment(mut a: u64, b: u64, c: f64) {
- a = b;
-}
-
-fn function_call(x: u64, y: u64, z: f64) {
- std::io::stdio::print("Hi!")
-}
-
-fn identifier(x: u64, y: u64, z: f64) -> u64 {
- x
-}
-
-fn return_expr(x: u64, y: u64, z: f64) -> u64 {
- return x;
-}
-
-fn arithmetic_expr(x: u64, y: u64, z: f64) -> u64 {
- x + y
-}
-
-fn if_expr(x: u64, y: u64, z: f64) -> u64 {
- if x + y < 1000 {
- x
- } else {
- y
- }
-}
-
-fn while_expr(mut x: u64, y: u64, z: u64) -> u64 {
- while x + y < 1000 {
- x += z
- }
- return x;
-}
-
-fn loop_expr(mut x: u64, y: u64, z: u64) -> u64 {
- loop {
- x += z;
-
- if x + y > 1000 {
- return x;
- }
- }
-}
-
-fn main() {
- immediate_args(1, true, 2.5);
-
- non_immediate_args(
- BigStruct {
- a: 3,
- b: 4,
- c: 5,
- d: 6,
- e: 7,
- f: 8,
- g: 9,
- h: 10
- },
- BigStruct {
- a: 11,
- b: 12,
- c: 13,
- d: 14,
- e: 15,
- f: 16,
- g: 17,
- h: 18
- }
- );
-
- binding(19, 20, 21.5);
- assignment(22, 23, 24.5);
- function_call(25, 26, 27.5);
- identifier(28, 29, 30.5);
- return_expr(31, 32, 33.5);
- arithmetic_expr(34, 35, 36.5);
- if_expr(37, 38, 39.5);
- while_expr(40, 41, 42);
- loop_expr(43, 44, 45);
-}
-
-
-
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-// debugger:finish
-
-// debugger:print x
-// check:$1 = 111102
-// debugger:print y
-// check:$2 = true
-
-// debugger:continue
-// debugger:finish
-
-// debugger:print a
-// check:$3 = 2000
-// debugger:print b
-// check:$4 = 3000
-
-fn main() {
-
- fun(111102, true);
- nested(2000, 3000);
-
- fn nested(a: i32, b: i64) -> (i32, i64) {
- zzz();
- (a, b)
- }
-}
-
-fn fun(x: int, y: bool) -> (int, bool) {
- zzz();
-
- (x, y)
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// This test case checks if function arguments already have the correct value when breaking at the
-// beginning of a function. Functions with the #[no_split_stack] attribute have the same prologue as
-// regular C functions compiled with GCC or Clang and therefore are better handled by GDB. As a
-// consequence, and as opposed to regular Rust functions, we can set the breakpoints via the
-// function name (and don't have to fall back on using line numbers).
-
-// compile-flags:-g
-// debugger:set print pretty off
-// debugger:rbreak immediate_args
-// debugger:rbreak binding
-// debugger:rbreak assignment
-// debugger:rbreak function_call
-// debugger:rbreak identifier
-// debugger:rbreak return_expr
-// debugger:rbreak arithmetic_expr
-// debugger:rbreak if_expr
-// debugger:rbreak while_expr
-// debugger:rbreak loop_expr
-// debugger:run
-
-// IMMEDIATE ARGS
-// debugger:print a
-// check:$1 = 1
-// debugger:print b
-// check:$2 = true
-// debugger:print c
-// check:$3 = 2.5
-// debugger:continue
-
-// NON IMMEDIATE ARGS
-// debugger:print a
-// check:$4 = {a = 3, b = 4, c = 5, d = 6, e = 7, f = 8, g = 9, h = 10}
-// debugger:print b
-// check:$5 = {a = 11, b = 12, c = 13, d = 14, e = 15, f = 16, g = 17, h = 18}
-// debugger:continue
-
-// BINDING
-// debugger:print a
-// check:$6 = 19
-// debugger:print b
-// check:$7 = 20
-// debugger:print c
-// check:$8 = 21.5
-// debugger:continue
-
-// ASSIGNMENT
-// debugger:print a
-// check:$9 = 22
-// debugger:print b
-// check:$10 = 23
-// debugger:print c
-// check:$11 = 24.5
-// debugger:continue
-
-// FUNCTION CALL
-// debugger:print x
-// check:$12 = 25
-// debugger:print y
-// check:$13 = 26
-// debugger:print z
-// check:$14 = 27.5
-// debugger:continue
-
-// EXPR
-// debugger:print x
-// check:$15 = 28
-// debugger:print y
-// check:$16 = 29
-// debugger:print z
-// check:$17 = 30.5
-// debugger:continue
-
-// RETURN EXPR
-// debugger:print x
-// check:$18 = 31
-// debugger:print y
-// check:$19 = 32
-// debugger:print z
-// check:$20 = 33.5
-// debugger:continue
-
-// ARITHMETIC EXPR
-// debugger:print x
-// check:$21 = 34
-// debugger:print y
-// check:$22 = 35
-// debugger:print z
-// check:$23 = 36.5
-// debugger:continue
-
-// IF EXPR
-// debugger:print x
-// check:$24 = 37
-// debugger:print y
-// check:$25 = 38
-// debugger:print z
-// check:$26 = 39.5
-// debugger:continue
-
-// WHILE EXPR
-// debugger:print x
-// check:$27 = 40
-// debugger:print y
-// check:$28 = 41
-// debugger:print z
-// check:$29 = 42
-// debugger:continue
-
-// LOOP EXPR
-// debugger:print x
-// check:$30 = 43
-// debugger:print y
-// check:$31 = 44
-// debugger:print z
-// check:$32 = 45
-// debugger:continue
-
-#![allow(unused_variable)]
-
-#[no_split_stack]
-fn immediate_args(a: int, b: bool, c: f64) {
- ()
-}
-
-struct BigStruct {
- a: u64,
- b: u64,
- c: u64,
- d: u64,
- e: u64,
- f: u64,
- g: u64,
- h: u64
-}
-
-#[no_split_stack]
-fn non_immediate_args(a: BigStruct, b: BigStruct) {
- ()
-}
-
-#[no_split_stack]
-fn binding(a: i64, b: u64, c: f64) {
- let x = 0;
-}
-
-#[no_split_stack]
-fn assignment(mut a: u64, b: u64, c: f64) {
- a = b;
-}
-
-#[no_split_stack]
-fn function_call(x: u64, y: u64, z: f64) {
- std::io::stdio::print("Hi!")
-}
-
-#[no_split_stack]
-fn identifier(x: u64, y: u64, z: f64) -> u64 {
- x
-}
-
-#[no_split_stack]
-fn return_expr(x: u64, y: u64, z: f64) -> u64 {
- return x;
-}
-
-#[no_split_stack]
-fn arithmetic_expr(x: u64, y: u64, z: f64) -> u64 {
- x + y
-}
-
-#[no_split_stack]
-fn if_expr(x: u64, y: u64, z: f64) -> u64 {
- if x + y < 1000 {
- x
- } else {
- y
- }
-}
-
-#[no_split_stack]
-fn while_expr(mut x: u64, y: u64, z: u64) -> u64 {
- while x + y < 1000 {
- x += z
- }
- return x;
-}
-
-#[no_split_stack]
-fn loop_expr(mut x: u64, y: u64, z: u64) -> u64 {
- loop {
- x += z;
-
- if x + y > 1000 {
- return x;
- }
- }
-}
-
-fn main() {
- immediate_args(1, true, 2.5);
-
- non_immediate_args(
- BigStruct {
- a: 3,
- b: 4,
- c: 5,
- d: 6,
- e: 7,
- f: 8,
- g: 9,
- h: 10
- },
- BigStruct {
- a: 11,
- b: 12,
- c: 13,
- d: 14,
- e: 15,
- f: 16,
- g: 17,
- h: 18
- }
- );
-
- binding(19, 20, 21.5);
- assignment(22, 23, 24.5);
- function_call(25, 26, 27.5);
- identifier(28, 29, 30.5);
- return_expr(31, 32, 33.5);
- arithmetic_expr(34, 35, 36.5);
- if_expr(37, 38, 39.5);
- while_expr(40, 41, 42);
- loop_expr(43, 44, 45);
-}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-
-// debugger:finish
-// debugger:print *t0
-// check:$1 = 1
-// debugger:print *t1
-// check:$2 = 2.5
-// debugger:print ret
-// check:$3 = {{1, 2.5}, {2.5, 1}}
-// debugger:continue
-
-// debugger:finish
-// debugger:print *t0
-// check:$4 = 3.5
-// debugger:print *t1
-// check:$5 = 4
-// debugger:print ret
-// check:$6 = {{3.5, 4}, {4, 3.5}}
-// debugger:continue
-
-// debugger:finish
-// debugger:print *t0
-// check:$7 = 5
-// debugger:print *t1
-// check:$8 = {a = 6, b = 7.5}
-// debugger:print ret
-// check:$9 = {{5, {a = 6, b = 7.5}}, {{a = 6, b = 7.5}, 5}}
-// debugger:continue
-
-#[deriving(Clone)]
-struct Struct {
- a: int,
- b: f64
-}
-
-fn dup_tup<T0: Clone, T1: Clone>(t0: &T0, t1: &T1) -> ((T0, T1), (T1, T0)) {
- let ret = ((t0.clone(), t1.clone()), (t1.clone(), t0.clone()));
- zzz();
- ret
-}
-
-fn main() {
-
- let _ = dup_tup(&1, &2.5);
- let _ = dup_tup(&3.5, &4_u16);
- let _ = dup_tup(&5, &Struct { a: 6, b: 7.5 });
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-
-// debugger:finish
-// debugger:print x
-// check:$1 = -1
-// debugger:print y
-// check:$2 = 1
-// debugger:continue
-
-// debugger:finish
-// debugger:print x
-// check:$3 = -1
-// debugger:print y
-// check:$4 = 2.5
-// debugger:continue
-
-// debugger:finish
-// debugger:print x
-// check:$5 = -2.5
-// debugger:print y
-// check:$6 = 1
-// debugger:continue
-
-// debugger:finish
-// debugger:print x
-// check:$7 = -2.5
-// debugger:print y
-// check:$8 = 2.5
-// debugger:continue
-
-fn outer<TA: Clone>(a: TA) {
- inner(a.clone(), 1);
- inner(a.clone(), 2.5);
-
- fn inner<TX, TY>(x: TX, y: TY) {
- zzz();
- }
-}
-
-fn main() {
- outer(-1);
- outer(-2.5);
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-
-// STACK BY REF
-// debugger:finish
-// debugger:print *self
-// check:$1 = {x = {8888, -8888}}
-// debugger:print arg1
-// check:$2 = -1
-// debugger:print/d arg2
-// check:$3 = -2
-// debugger:continue
-
-// STACK BY VAL
-// debugger:finish
-// debugger:print self
-// check:$4 = {x = {8888, -8888}}
-// debugger:print arg1
-// check:$5 = -3
-// debugger:print arg2
-// check:$6 = -4
-// debugger:continue
-
-// OWNED BY REF
-// debugger:finish
-// debugger:print *self
-// check:$7 = {x = 1234.5}
-// debugger:print arg1
-// check:$8 = -5
-// debugger:print arg2
-// check:$9 = -6
-// debugger:continue
-
-// OWNED BY VAL
-// debugger:finish
-// debugger:print self
-// check:$10 = {x = 1234.5}
-// debugger:print arg1
-// check:$11 = -7
-// debugger:print arg2
-// check:$12 = -8
-// debugger:continue
-
-// OWNED MOVED
-// debugger:finish
-// debugger:print *self
-// check:$13 = {x = 1234.5}
-// debugger:print arg1
-// check:$14 = -9
-// debugger:print arg2
-// check:$15 = -10.5
-// debugger:continue
-
-struct Struct<T> {
- x: T
-}
-
-impl<T1> Struct<T1> {
-
- fn self_by_ref<T2>(&self, arg1: int, arg2: T2) -> int {
- zzz();
- arg1
- }
-
- fn self_by_val<T2>(self, arg1: int, arg2: T2) -> int {
- zzz();
- arg1
- }
-
- fn self_owned<T2>(~self, arg1: int, arg2: T2) -> int {
- zzz();
- arg1
- }
-}
-
-fn main() {
- let stack = Struct { x: (8888_u32, -8888_i32) };
- let _ = stack.self_by_ref(-1, -2_i8);
- let _ = stack.self_by_val(-3, -4_i16);
-
- let owned = box Struct { x: 1234.5 };
- let _ = owned.self_by_ref(-5, -6_i32);
- let _ = owned.self_by_val(-7, -8_i64);
- let _ = owned.self_owned(-9, -10.5_f32);
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-
-// STRUCT
-// debugger:finish
-// debugger:print arg1
-// check:$1 = 1
-// debugger:print arg2
-// check:$2 = 2
-// debugger:continue
-
-// ENUM
-// debugger:finish
-// debugger:print arg1
-// check:$3 = -3
-// debugger:print arg2
-// check:$4 = 4.5
-// debugger:print arg3
-// check:$5 = 5
-// debugger:continue
-
-#![feature(struct_variant)]
-
-struct Struct {
- x: int
-}
-
-impl Struct {
-
- fn static_method<T1, T2>(arg1: T1, arg2: T2) -> int {
- zzz();
- return 0;
- }
-}
-
-enum Enum {
- Variant1 { x: int },
- Variant2,
- Variant3(f64, int, char),
-}
-
-impl Enum {
-
- fn static_method<T1, T2, T3>(arg1: T1, arg2: T2, arg3: T3) -> int {
- zzz();
- return 1;
- }
-}
-
-fn main() {
- Struct::static_method(1, 2);
- Enum::static_method(-3, 4.5, 5);
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-tidy-linelength
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:set print union on
-// debugger:rbreak zzz
-// debugger:run
-// debugger:finish
-
-// debugger:print case1
-// check:$1 = {{Case1, a = 0, b = 31868, c = 31868, d = 31868, e = 31868}, {Case1, a = 0, b = 2088533116, c = 2088533116}, {Case1, a = 0, b = 8970181431921507452}}
-
-// debugger:print case2
-// check:$2 = {{Case2, a = 0, b = 4369, c = 4369, d = 4369, e = 4369}, {Case2, a = 0, b = 286331153, c = 286331153}, {Case2, a = 0, b = 1229782938247303441}}
-
-// debugger:print case3
-// check:$3 = {{Case3, a = 0, b = 22873, c = 22873, d = 22873, e = 22873}, {Case3, a = 0, b = 1499027801, c = 1499027801}, {Case3, a = 0, b = 6438275382588823897}}
-
-// debugger:print univariant
-// check:$4 = {a = -1}
-
-#![feature(struct_variant)]
-
-// NOTE: This is a copy of the non-generic test case. The `Txx` type parameters have to be
-// substituted with something of size `xx` bits and the same alignment as an integer type of the
-// same size.
-
-// The first element is to ensure proper alignment, irrespective of the machines word size. Since
-// the size of the discriminant value is machine dependent, this has be taken into account when
-// datatype layout should be predictable as in this case.
-enum Regular<T16, T32, T64> {
- Case1 { a: T64, b: T16, c: T16, d: T16, e: T16},
- Case2 { a: T64, b: T32, c: T32},
- Case3 { a: T64, b: T64 }
-}
-
-enum Univariant<T> {
- TheOnlyCase { a: T }
-}
-
-fn main() {
-
- // In order to avoid endianess trouble all of the following test values consist of a single
- // repeated byte. This way each interpretation of the union should look the same, no matter if
- // this is a big or little endian machine.
-
- // 0b0111110001111100011111000111110001111100011111000111110001111100 = 8970181431921507452
- // 0b01111100011111000111110001111100 = 2088533116
- // 0b0111110001111100 = 31868
- // 0b01111100 = 124
- let case1: Regular<u16, u32, i64> = Case1 { a: 0, b: 31868, c: 31868, d: 31868, e: 31868 };
-
- // 0b0001000100010001000100010001000100010001000100010001000100010001 = 1229782938247303441
- // 0b00010001000100010001000100010001 = 286331153
- // 0b0001000100010001 = 4369
- // 0b00010001 = 17
- let case2: Regular<i16, u32, i64> = Case2 { a: 0, b: 286331153, c: 286331153 };
-
- // 0b0101100101011001010110010101100101011001010110010101100101011001 = 6438275382588823897
- // 0b01011001010110010101100101011001 = 1499027801
- // 0b0101100101011001 = 22873
- // 0b01011001 = 89
- let case3: Regular<u16, i32, u64> = Case3 { a: 0, b: 6438275382588823897 };
-
- let univariant = TheOnlyCase { a: -1 };
-
- zzz();
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-
-// debugger:finish
-// debugger:print int_int
-// check:$1 = {key = 0, value = 1}
-// debugger:print int_float
-// check:$2 = {key = 2, value = 3.5}
-// debugger:print float_int
-// check:$3 = {key = 4.5, value = 5}
-// debugger:print float_int_float
-// check:$4 = {key = 6.5, value = {key = 7, value = 8.5}}
-
-struct AGenericStruct<TKey, TValue> {
- key: TKey,
- value: TValue
-}
-
-fn main() {
-
- let int_int = AGenericStruct { key: 0, value: 1 };
- let int_float = AGenericStruct { key: 2, value: 3.5 };
- let float_int = AGenericStruct { key: 4.5, value: 5 };
- let float_int_float = AGenericStruct { key: 6.5, value: AGenericStruct { key: 7, value: 8.5 } };
-
- zzz();
-}
-
-fn zzz() {()}
+++ /dev/null
-// ignore-test
-
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-
-// debugger:finish
-// debugger:print arg1
-// check:$1 = 1000
-// debugger:print *arg2
-// check:$2 = {1, 2.5}
-// debugger:continue
-
-// debugger:finish
-// debugger:print arg1
-// check:$3 = 2000
-// debugger:print *arg2
-// check:$4 = {3.5, {4, 5, 6}}
-// debugger:continue
-
-
-struct Struct {
- x: int
-}
-
-trait Trait<T1> {
- fn generic_static_default_method<T2>(arg1: int, arg2: &(T1, T2)) -> int {
- zzz();
- arg1
- }
-}
-
-impl<T> Trait<T> for Struct {}
-
-fn main() {
-
- // Is this really how to use these?
- Trait::generic_static_default_method::<int, Struct, float>(1000, &(1, 2.5));
- Trait::generic_static_default_method::<float, Struct, (int, int, int)>(2000, &(3.5, (4, 5, 6)));
-
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-tidy-linelength
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:set print union on
-// debugger:rbreak zzz
-// debugger:run
-// debugger:finish
-
-// debugger:print case1
-// check:$1 = {{Case1, 0, 31868, 31868, 31868, 31868}, {Case1, 0, 2088533116, 2088533116}, {Case1, 0, 8970181431921507452}}
-
-// debugger:print case2
-// check:$2 = {{Case2, 0, 4369, 4369, 4369, 4369}, {Case2, 0, 286331153, 286331153}, {Case2, 0, 1229782938247303441}}
-
-// debugger:print case3
-// check:$3 = {{Case3, 0, 22873, 22873, 22873, 22873}, {Case3, 0, 1499027801, 1499027801}, {Case3, 0, 6438275382588823897}}
-
-// debugger:print univariant
-// check:$4 = {-1}
-
-
-// NOTE: This is a copy of the non-generic test case. The `Txx` type parameters have to be
-// substituted with something of size `xx` bits and the same alignment as an integer type of the
-// same size.
-
-// The first element is to ensure proper alignment, irrespective of the machines word size. Since
-// the size of the discriminant value is machine dependent, this has be taken into account when
-// datatype layout should be predictable as in this case.
-enum Regular<T16, T32, T64> {
- Case1(T64, T16, T16, T16, T16),
- Case2(T64, T32, T32),
- Case3(T64, T64)
-}
-
-enum Univariant<T64> {
- TheOnlyCase(T64)
-}
-
-fn main() {
-
- // In order to avoid endianess trouble all of the following test values consist of a single
- // repeated byte. This way each interpretation of the union should look the same, no matter if
- // this is a big or little endian machine.
-
- // 0b0111110001111100011111000111110001111100011111000111110001111100 = 8970181431921507452
- // 0b01111100011111000111110001111100 = 2088533116
- // 0b0111110001111100 = 31868
- // 0b01111100 = 124
- let case1: Regular<u16, u32, u64> = Case1(0_u64, 31868_u16, 31868_u16, 31868_u16, 31868_u16);
-
- // 0b0001000100010001000100010001000100010001000100010001000100010001 = 1229782938247303441
- // 0b00010001000100010001000100010001 = 286331153
- // 0b0001000100010001 = 4369
- // 0b00010001 = 17
- let case2: Regular<i16, i32, i64> = Case2(0_i64, 286331153_i32, 286331153_i32);
-
- // 0b0101100101011001010110010101100101011001010110010101100101011001 = 6438275382588823897
- // 0b01011001010110010101100101011001 = 1499027801
- // 0b0101100101011001 = 22873
- // 0b01011001 = 89
- let case3: Regular<i16, i32, i64> = Case3(0_i64, 6438275382588823897_i64);
-
- let univariant = TheOnlyCase(-1_i64);
-
- zzz();
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-// debugger:finish
-// debugger:print string1.length
-// check:$1 = 48
-// debugger:print string2.length
-// check:$2 = 48
-// debugger:print string3.length
-// check:$3 = 48
-// debugger:continue
-
-#![allow(unused_variable)]
-
-// This test case makes sure that debug info does not ICE when include_str is
-// used multiple times (see issue #11322).
-
-fn main() {
- let string1 = include_str!("text-to-include-1.txt");
- let string2 = include_str!("text-to-include-2.txt");
- let string3 = include_str!("text-to-include-3.txt");
- zzz();
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
- let args : ~[~str] = ::std::os::args();
- ::std::io::println(args[0]);
-}
-
-
-// ignore-android: FIXME(#10381)
-
-// This test case checks whether compile unit names are set correctly, so that the correct default
-// source file can be found.
-
-// compile-flags:-g
-// debugger:list
-// check:1[...]fn main() {
-// check:2[...]let args : ~[~str] = ::std::os::args();
-// check:3[...]::std::io::println(args[0]);
-// check:4[...]}
-
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:break issue12886.rs:29
-// debugger:run
-// debugger:next
-// check:[...]30[...]s
-// debugger:continue
-
-// IF YOU MODIFY THIS FILE, BE CAREFUL TO ADAPT THE LINE NUMBERS IN THE DEBUGGER COMMANDS
-
-// This test makes sure that gdb does not set unwanted breakpoints in inlined functions. If a
-// breakpoint existed in unwrap(), then calling `next` would (when stopped at line 27) would stop
-// in unwrap() instead of stepping over the function invocation. By making sure that `s` is
-// contained in the output, after calling `next` just once, we can be sure that we did not stop in
-// unwrap(). (The testing framework doesn't allow for checking that some text is *not* contained in
-// the output, which is why we have to make the test in this kind of roundabout way)
-fn bar() -> int {
- let s = Some(5).unwrap();
- s
-}
-
-fn main() {
- let _ = bar();
-}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// aux-build:issue13213aux.rs
-extern crate issue13213aux;
-
-// compile-flags:-g
-
-// This tests make sure that we get no linker error when using a completely inlined static. Some
-// statics that are marked with AvailableExternallyLinkage in the importing crate, may actually not
-// be available because they have been optimized out from the exporting crate.
-fn main() {
- let b: issue13213aux::S = issue13213aux::A;
- zzz();
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// compile-flags:--debuginfo=1
-
-pub trait TraitWithDefaultMethod {
- fn method(self) {
- ()
- }
-}
-
-struct MyStruct;
-
-impl TraitWithDefaultMethod for MyStruct { }
-
-pub fn main() {
- MyStruct.method();
-}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-
-// FIRST ITERATION
-// debugger:finish
-// debugger:print x
-// check:$1 = 1
-// debugger:continue
-
-// debugger:finish
-// debugger:print x
-// check:$2 = -1
-// debugger:continue
-
-// SECOND ITERATION
-// debugger:finish
-// debugger:print x
-// check:$3 = 2
-// debugger:continue
-
-// debugger:finish
-// debugger:print x
-// check:$4 = -2
-// debugger:continue
-
-// THIRD ITERATION
-// debugger:finish
-// debugger:print x
-// check:$5 = 3
-// debugger:continue
-
-// debugger:finish
-// debugger:print x
-// check:$6 = -3
-// debugger:continue
-
-// AFTER LOOP
-// debugger:finish
-// debugger:print x
-// check:$7 = 1000000
-// debugger:continue
-
-fn main() {
-
- let range = [1, 2, 3];
-
- let x = 1000000; // wan meeeljen doollaars!
-
- for &x in range.iter() {
- zzz();
- sentinel();
-
- let x = -1 * x;
-
- zzz();
- sentinel();
- }
-
- zzz();
- sentinel();
-}
-
-fn zzz() {()}
-fn sentinel() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-
-// BEFORE if
-// debugger:finish
-// debugger:print x
-// check:$1 = 999
-// debugger:print y
-// check:$2 = -1
-// debugger:continue
-
-// AT BEGINNING of 'then' block
-// debugger:finish
-// debugger:print x
-// check:$3 = 999
-// debugger:print y
-// check:$4 = -1
-// debugger:continue
-
-// AFTER 1st redeclaration of 'x'
-// debugger:finish
-// debugger:print x
-// check:$5 = 1001
-// debugger:print y
-// check:$6 = -1
-// debugger:continue
-
-// AFTER 2st redeclaration of 'x'
-// debugger:finish
-// debugger:print x
-// check:$7 = 1002
-// debugger:print y
-// check:$8 = 1003
-// debugger:continue
-
-// AFTER 1st if expression
-// debugger:finish
-// debugger:print x
-// check:$9 = 999
-// debugger:print y
-// check:$10 = -1
-// debugger:continue
-
-// BEGINNING of else branch
-// debugger:finish
-// debugger:print x
-// check:$11 = 999
-// debugger:print y
-// check:$12 = -1
-// debugger:continue
-
-// BEGINNING of else branch
-// debugger:finish
-// debugger:print x
-// check:$13 = 1004
-// debugger:print y
-// check:$14 = 1005
-// debugger:continue
-
-// BEGINNING of else branch
-// debugger:finish
-// debugger:print x
-// check:$15 = 999
-// debugger:print y
-// check:$16 = -1
-// debugger:continue
-
-fn main() {
-
- let x = 999;
- let y = -1;
-
- zzz();
- sentinel();
-
- if x < 1000 {
- zzz();
- sentinel();
-
- let x = 1001;
-
- zzz();
- sentinel();
-
- let x = 1002;
- let y = 1003;
- zzz();
- sentinel();
- } else {
- unreachable!();
- }
-
- zzz();
- sentinel();
-
- if x > 1000 {
- unreachable!();
- } else {
- zzz();
- sentinel();
-
- let x = 1004;
- let y = 1005;
- zzz();
- sentinel();
- }
-
- zzz();
- sentinel();
-}
-
-fn zzz() {()}
-fn sentinel() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-
-// debugger:finish
-// debugger:print shadowed
-// check:$1 = 231
-// debugger:print not_shadowed
-// check:$2 = 232
-// debugger:continue
-
-// debugger:finish
-// debugger:print shadowed
-// check:$3 = 233
-// debugger:print not_shadowed
-// check:$4 = 232
-// debugger:print local_to_arm
-// check:$5 = 234
-// debugger:continue
-
-// debugger:finish
-// debugger:print shadowed
-// check:$6 = 236
-// debugger:print not_shadowed
-// check:$7 = 232
-// debugger:continue
-
-// debugger:finish
-// debugger:print shadowed
-// check:$8 = 237
-// debugger:print not_shadowed
-// check:$9 = 232
-// debugger:print local_to_arm
-// check:$10 = 238
-// debugger:continue
-
-// debugger:finish
-// debugger:print shadowed
-// check:$11 = 239
-// debugger:print not_shadowed
-// check:$12 = 232
-// debugger:continue
-
-// debugger:finish
-// debugger:print shadowed
-// check:$13 = 241
-// debugger:print not_shadowed
-// check:$14 = 232
-// debugger:continue
-
-// debugger:finish
-// debugger:print shadowed
-// check:$15 = 243
-// debugger:print *local_to_arm
-// check:$16 = 244
-// debugger:continue
-
-// debugger:finish
-// debugger:print shadowed
-// check:$17 = 231
-// debugger:print not_shadowed
-// check:$18 = 232
-// debugger:continue
-
-struct Struct {
- x: int,
- y: int
-}
-
-fn main() {
-
- let shadowed = 231;
- let not_shadowed = 232;
-
- zzz();
- sentinel();
-
- match (233, 234) {
- (shadowed, local_to_arm) => {
-
- zzz();
- sentinel();
- }
- }
-
- match (235, 236) {
- // with literal
- (235, shadowed) => {
-
- zzz();
- sentinel();
- }
- _ => {}
- }
-
- match Struct { x: 237, y: 238 } {
- Struct { x: shadowed, y: local_to_arm } => {
-
- zzz();
- sentinel();
- }
- }
-
- match Struct { x: 239, y: 240 } {
- // ignored field
- Struct { x: shadowed, .. } => {
-
- zzz();
- sentinel();
- }
- }
-
- match Struct { x: 241, y: 242 } {
- // with literal
- Struct { x: shadowed, y: 242 } => {
-
- zzz();
- sentinel();
- }
- _ => {}
- }
-
- match (243, 244) {
- (shadowed, ref local_to_arm) => {
-
- zzz();
- sentinel();
- }
- }
-
- zzz();
- sentinel();
-}
-
-fn zzz() {()}
-fn sentinel() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:--debuginfo=1
-// debugger:run
-
-// Nothing to do here really, just make sure it compiles. See issue #8513.
-fn main() {
- let _ = ||();
- let _ = range(1u,3).map(|_| 5);
-}
-
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-
-// debugger:finish
-// debugger:print x
-// check:$1 = false
-// debugger:continue
-
-// debugger:finish
-// debugger:print x
-// check:$2 = false
-// debugger:continue
-
-// debugger:finish
-// debugger:print x
-// check:$3 = 1000
-// debugger:continue
-
-// debugger:finish
-// debugger:print x
-// check:$4 = 2.5
-// debugger:continue
-
-// debugger:finish
-// debugger:print x
-// check:$5 = true
-// debugger:continue
-
-// debugger:finish
-// debugger:print x
-// check:$6 = false
-// debugger:continue
-
-fn main() {
-
- let x = false;
-
- zzz();
- sentinel();
-
- let stack_closure: |int| = |x| {
- zzz();
- sentinel();
-
- let x = 2.5;
-
- zzz();
- sentinel();
-
- let x = true;
-
- zzz();
- sentinel();
- };
-
- zzz();
- sentinel();
-
- stack_closure(1000);
-
- zzz();
- sentinel();
-}
-
-fn zzz() {()}
-fn sentinel() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-
-// FIRST ITERATION
-// debugger:finish
-// debugger:print x
-// check:$1 = 0
-// debugger:continue
-
-// debugger:finish
-// debugger:print x
-// check:$2 = 1
-// debugger:continue
-
-// debugger:finish
-// debugger:print x
-// check:$3 = 101
-// debugger:continue
-
-// debugger:finish
-// debugger:print x
-// check:$4 = 101
-// debugger:continue
-
-// debugger:finish
-// debugger:print x
-// check:$5 = -987
-// debugger:continue
-
-// debugger:finish
-// debugger:print x
-// check:$6 = 101
-// debugger:continue
-
-
-// SECOND ITERATION
-// debugger:finish
-// debugger:print x
-// check:$7 = 1
-// debugger:continue
-
-// debugger:finish
-// debugger:print x
-// check:$8 = 2
-// debugger:continue
-
-// debugger:finish
-// debugger:print x
-// check:$9 = 102
-// debugger:continue
-
-// debugger:finish
-// debugger:print x
-// check:$10 = 102
-// debugger:continue
-
-// debugger:finish
-// debugger:print x
-// check:$11 = -987
-// debugger:continue
-
-// debugger:finish
-// debugger:print x
-// check:$12 = 102
-// debugger:continue
-
-// debugger:finish
-// debugger:print x
-// check:$13 = 2
-// debugger:continue
-
-fn main() {
-
- let mut x = 0;
-
- loop {
- if x >= 2 {
- break;
- }
-
- zzz();
- sentinel();
-
- x += 1;
- zzz();
- sentinel();
-
- // Shadow x
- let x = x + 100;
- zzz();
- sentinel();
-
- // open scope within loop's top level scope
- {
- zzz();
- sentinel();
-
- let x = -987;
-
- zzz();
- sentinel();
- }
-
- // Check that we get the x before the inner scope again
- zzz();
- sentinel();
- }
-
- zzz();
- sentinel();
-}
-
-fn zzz() {()}
-fn sentinel() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-
-// debugger:finish
-// debugger:print x
-// check:$1 = false
-// debugger:continue
-
-// debugger:finish
-// debugger:print x
-// check:$2 = false
-// debugger:continue
-
-// debugger:finish
-// debugger:print x
-// check:$3 = 1000
-// debugger:continue
-
-// debugger:finish
-// debugger:print x
-// check:$4 = 2.5
-// debugger:continue
-
-// debugger:finish
-// debugger:print x
-// check:$5 = true
-// debugger:continue
-
-// debugger:finish
-// debugger:print x
-// check:$6 = false
-// debugger:continue
-
-fn main() {
-
- let x = false;
-
- zzz();
- sentinel();
-
- let unique_closure: proc(int) = proc(x) {
- zzz();
- sentinel();
-
- let x = 2.5;
-
- zzz();
- sentinel();
-
- let x = true;
-
- zzz();
- sentinel();
- };
-
- zzz();
- sentinel();
-
- unique_closure(1000);
-
- zzz();
- sentinel();
-}
-
-fn zzz() {()}
-fn sentinel() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-
-// FIRST ITERATION
-// debugger:finish
-// debugger:print x
-// check:$1 = 0
-// debugger:continue
-
-// debugger:finish
-// debugger:print x
-// check:$2 = 1
-// debugger:continue
-
-// debugger:finish
-// debugger:print x
-// check:$3 = 101
-// debugger:continue
-
-// debugger:finish
-// debugger:print x
-// check:$4 = 101
-// debugger:continue
-
-// debugger:finish
-// debugger:print x
-// check:$5 = -987
-// debugger:continue
-
-// debugger:finish
-// debugger:print x
-// check:$6 = 101
-// debugger:continue
-
-
-// SECOND ITERATION
-// debugger:finish
-// debugger:print x
-// check:$7 = 1
-// debugger:continue
-
-// debugger:finish
-// debugger:print x
-// check:$8 = 2
-// debugger:continue
-
-// debugger:finish
-// debugger:print x
-// check:$9 = 102
-// debugger:continue
-
-// debugger:finish
-// debugger:print x
-// check:$10 = 102
-// debugger:continue
-
-// debugger:finish
-// debugger:print x
-// check:$11 = -987
-// debugger:continue
-
-// debugger:finish
-// debugger:print x
-// check:$12 = 102
-// debugger:continue
-
-// debugger:finish
-// debugger:print x
-// check:$13 = 2
-// debugger:continue
-
-fn main() {
-
- let mut x = 0;
-
- while x < 2 {
- zzz();
- sentinel();
-
- x += 1;
- zzz();
- sentinel();
-
- // Shadow x
- let x = x + 100;
- zzz();
- sentinel();
-
- // open scope within loop's top level scope
- {
- zzz();
- sentinel();
-
- let x = -987;
-
- zzz();
- sentinel();
- }
-
- // Check that we get the x before the inner scope again
- zzz();
- sentinel();
- }
-
- zzz();
- sentinel();
-}
-
-fn zzz() {()}
-fn sentinel() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-
-// debugger:finish
-// debugger:print a
-// check:$1 = 10
-// debugger:print b
-// check:$2 = 34
-// debugger:continue
-
-// debugger:finish
-// debugger:print a
-// check:$3 = 890242
-// debugger:print b
-// check:$4 = 34
-// debugger:continue
-
-// debugger:finish
-// debugger:print a
-// check:$5 = 10
-// debugger:print b
-// check:$6 = 34
-// debugger:continue
-
-// debugger:finish
-// debugger:print a
-// check:$7 = 102
-// debugger:print b
-// check:$8 = 34
-// debugger:continue
-
-// debugger:finish
-// debugger:print a
-// check:$9 = 110
-// debugger:print b
-// check:$10 = 34
-// debugger:continue
-
-// debugger:finish
-// debugger:print a
-// check:$11 = 10
-// debugger:print b
-// check:$12 = 34
-// debugger:continue
-
-// debugger:finish
-// debugger:print a
-// check:$13 = 10
-// debugger:print b
-// check:$14 = 34
-// debugger:print c
-// check:$15 = 400
-// debugger:continue
-
-#![feature(macro_rules)]
-
-macro_rules! trivial(
- ($e1:expr) => ($e1)
-)
-
-macro_rules! no_new_scope(
- ($e1:expr) => (($e1 + 2) - 1)
-)
-
-macro_rules! new_scope(
- () => ({
- let a = 890242;
- zzz();
- sentinel();
- })
-)
-
-macro_rules! shadow_within_macro(
- ($e1:expr) => ({
- let a = $e1 + 2;
-
- zzz();
- sentinel();
-
- let a = $e1 + 10;
-
- zzz();
- sentinel();
- })
-)
-
-
-macro_rules! dup_expr(
- ($e1:expr) => (($e1) + ($e1))
-)
-
-
-fn main() {
-
- let a = trivial!(10);
- let b = no_new_scope!(33);
-
- zzz();
- sentinel();
-
- new_scope!();
-
- zzz();
- sentinel();
-
- shadow_within_macro!(100);
-
- zzz();
- sentinel();
-
- let c = dup_expr!(10 * 20);
-
- zzz();
- sentinel();
-}
-
-fn zzz() {()}
-fn sentinel() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-win32: FIXME #13256
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-
-// debugger:print 'lexical-scopes-in-block-expression::MUT_INT'
-// check:$1 = 0
-
-// STRUCT EXPRESSION
-// debugger:finish
-// debugger:print val
-// check:$2 = -1
-// debugger:print ten
-// check:$3 = 10
-// debugger:continue
-
-// debugger:finish
-// debugger:print val
-// check:$4 = 11
-// debugger:print 'lexical-scopes-in-block-expression::MUT_INT'
-// check:$5 = 1
-// debugger:print ten
-// check:$6 = 10
-// debugger:continue
-
-// debugger:finish
-// debugger:print val
-// check:$7 = -1
-// debugger:print ten
-// check:$8 = 10
-// debugger:continue
-
-// FUNCTION CALL
-// debugger:finish
-// debugger:print val
-// check:$9 = -1
-// debugger:print ten
-// check:$10 = 10
-// debugger:continue
-
-// debugger:finish
-// debugger:print val
-// check:$11 = 12
-// debugger:print 'lexical-scopes-in-block-expression::MUT_INT'
-// check:$12 = 2
-// debugger:print ten
-// check:$13 = 10
-// debugger:continue
-
-// debugger:finish
-// debugger:print val
-// check:$14 = -1
-// debugger:print ten
-// check:$15 = 10
-// debugger:continue
-
-// TUPLE EXPRESSION
-// debugger:finish
-// debugger:print val
-// check:$16 = -1
-// debugger:print ten
-// check:$17 = 10
-// debugger:continue
-
-// debugger:finish
-// debugger:print val
-// check:$18 = 13
-// debugger:print 'lexical-scopes-in-block-expression::MUT_INT'
-// check:$19 = 3
-// debugger:print ten
-// check:$20 = 10
-// debugger:continue
-
-// debugger:finish
-// debugger:print val
-// check:$21 = -1
-// debugger:print ten
-// check:$22 = 10
-// debugger:continue
-
-// VEC EXPRESSION
-// debugger:finish
-// debugger:print val
-// check:$23 = -1
-// debugger:print ten
-// check:$24 = 10
-// debugger:continue
-
-// debugger:finish
-// debugger:print val
-// check:$25 = 14
-// debugger:print 'lexical-scopes-in-block-expression::MUT_INT'
-// check:$26 = 4
-// debugger:print ten
-// check:$27 = 10
-// debugger:continue
-
-// debugger:finish
-// debugger:print val
-// check:$28 = -1
-// debugger:print ten
-// check:$29 = 10
-// debugger:continue
-
-// REPEAT VEC EXPRESSION
-// debugger:finish
-// debugger:print val
-// check:$30 = -1
-// debugger:print ten
-// check:$31 = 10
-// debugger:continue
-
-// debugger:finish
-// debugger:print val
-// check:$32 = 15
-// debugger:print 'lexical-scopes-in-block-expression::MUT_INT'
-// check:$33 = 5
-// debugger:print ten
-// check:$34 = 10
-// debugger:continue
-
-// debugger:finish
-// debugger:print val
-// check:$35 = -1
-// debugger:print ten
-// check:$36 = 10
-// debugger:continue
-
-// ASSIGNMENT EXPRESSION
-// debugger:finish
-// debugger:print val
-// check:$37 = -1
-// debugger:print ten
-// check:$38 = 10
-// debugger:continue
-
-// debugger:finish
-// debugger:print val
-// check:$39 = 16
-// debugger:print 'lexical-scopes-in-block-expression::MUT_INT'
-// check:$40 = 6
-// debugger:print ten
-// check:$41 = 10
-// debugger:continue
-
-// debugger:finish
-// debugger:print val
-// check:$42 = -1
-// debugger:print ten
-// check:$43 = 10
-// debugger:continue
-
-
-// ARITHMETIC EXPRESSION
-// debugger:finish
-// debugger:print val
-// check:$44 = -1
-// debugger:print ten
-// check:$45 = 10
-// debugger:continue
-
-// debugger:finish
-// debugger:print val
-// check:$46 = 17
-// debugger:print 'lexical-scopes-in-block-expression::MUT_INT'
-// check:$47 = 7
-// debugger:print ten
-// check:$48 = 10
-// debugger:continue
-
-// debugger:finish
-// debugger:print val
-// check:$49 = -1
-// debugger:print ten
-// check:$50 = 10
-// debugger:continue
-
-// INDEX EXPRESSION
-// debugger:finish
-// debugger:print val
-// check:$51 = -1
-// debugger:print ten
-// check:$52 = 10
-// debugger:continue
-
-// debugger:finish
-// debugger:print val
-// check:$53 = 18
-// debugger:print 'lexical-scopes-in-block-expression::MUT_INT'
-// check:$54 = 8
-// debugger:print ten
-// check:$55 = 10
-// debugger:continue
-
-// debugger:finish
-// debugger:print val
-// check:$56 = -1
-// debugger:print ten
-// check:$57 = 10
-// debugger:continue
-
-#![allow(unused_variable)]
-#![allow(dead_assignment)]
-
-static mut MUT_INT: int = 0;
-
-struct Point {
- x: int,
- y: int
-}
-
-fn a_function(x: int) -> int {
- x + 1
-}
-
-fn main() {
-
- let val = -1;
- let ten = 10;
-
- // surrounded by struct expression
- let point = Point {
- x: {
- zzz();
- sentinel();
-
- let val = ten + 1;
- unsafe {MUT_INT = 1;};
-
- zzz();
- sentinel();
-
- val
- },
- y: 10
- };
-
- zzz();
- sentinel();
-
- // surrounded by function call
- let _ = a_function({
- zzz();
- sentinel();
-
- let val = ten + 2;
- unsafe {MUT_INT = 2;};
-
- zzz();
- sentinel();
-
- val
- });
-
- zzz();
- sentinel();
-
-
- // surrounded by tup
- let _ = ({
- zzz();
- sentinel();
-
- let val = ten + 3;
- unsafe {MUT_INT = 3;};
-
- zzz();
- sentinel();
-
- val
- }, 0);
-
- zzz();
- sentinel();
-
- // surrounded by vec
- let _ = [{
- zzz();
- sentinel();
-
- let val = ten + 4;
- unsafe {MUT_INT = 4;};
-
- zzz();
- sentinel();
-
- val
- }, 0, 0];
-
- zzz();
- sentinel();
-
- // surrounded by repeat vec
- let _ = [{
- zzz();
- sentinel();
-
- let val = ten + 5;
- unsafe {MUT_INT = 5;};
-
- zzz();
- sentinel();
-
- val
- }, ..10];
-
- zzz();
- sentinel();
-
- // assignment expression
- let mut var = 0;
- var = {
- zzz();
- sentinel();
-
- let val = ten + 6;
- unsafe {MUT_INT = 6;};
-
- zzz();
- sentinel();
-
- val
- };
-
- zzz();
- sentinel();
-
- // arithmetic expression
- var = 10 + -{
- zzz();
- sentinel();
-
- let val = ten + 7;
- unsafe {MUT_INT = 7;};
-
- zzz();
- sentinel();
-
- val
- } * 5;
-
- zzz();
- sentinel();
-
- // index expression
- let a_vector = [10, ..20];
- let _ = a_vector[{
- zzz();
- sentinel();
-
- let val = ten + 8;
- unsafe {MUT_INT = 8;};
-
- zzz();
- sentinel();
-
- val as uint
- }];
-
- zzz();
- sentinel();
-}
-
-fn zzz() {()}
-fn sentinel() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:--debuginfo=1
-
-// Make sure functions have proper names
-// debugger:info functions
-// check:[...]void[...]main([...]);
-// check:[...]void[...]some_function([...]);
-// check:[...]void[...]some_other_function([...]);
-// check:[...]void[...]zzz([...]);
-
-// debugger:rbreak zzz
-// debugger:run
-
-// Make sure there is no information about locals
-// debugger:finish
-// debugger:info locals
-// check:No locals.
-// debugger:continue
-
-
-#![allow(unused_variable)]
-
-struct Struct {
- a: i64,
- b: i32
-}
-
-fn main() {
- some_function(101, 202);
- some_other_function(1, 2);
-}
-
-
-fn zzz() {()}
-
-fn some_function(a: int, b: int) {
- let some_variable = Struct { a: 11, b: 22 };
- let some_other_variable = 23;
- zzz();
-}
-
-fn some_other_function(a: int, b: int) -> bool { true }
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-// debugger:finish
-
-// debugger:print the_a->val
-// check:$1 = {{TheA, x = 0, y = 8970181431921507452}, {TheA, 0, 2088533116, 2088533116}}
-
-// debugger:print the_b->val
-// check:$2 = {{TheB, x = 0, y = 1229782938247303441}, {TheB, 0, 286331153, 286331153}}
-
-// debugger:print univariant->val
-// check:$3 = {-9747455}
-
-#![allow(unused_variable)]
-#![feature(struct_variant, managed_boxes)]
-
-// The first element is to ensure proper alignment, irrespective of the machines word size. Since
-// the size of the discriminant value is machine dependent, this has be taken into account when
-// datatype layout should be predictable as in this case.
-enum ABC {
- TheA { x: i64, y: i64 },
- TheB (i64, i32, i32),
-}
-
-// This is a special case since it does not have the implicit discriminant field.
-enum Univariant {
- TheOnlyCase(i64)
-}
-
-fn main() {
-
- // In order to avoid endianess trouble all of the following test values consist of a single
- // repeated byte. This way each interpretation of the union should look the same, no matter if
- // this is a big or little endian machine.
-
- // 0b0111110001111100011111000111110001111100011111000111110001111100 = 8970181431921507452
- // 0b01111100011111000111110001111100 = 2088533116
- // 0b0111110001111100 = 31868
- // 0b01111100 = 124
- let the_a = @TheA { x: 0, y: 8970181431921507452 };
-
- // 0b0001000100010001000100010001000100010001000100010001000100010001 = 1229782938247303441
- // 0b00010001000100010001000100010001 = 286331153
- // 0b0001000100010001 = 4369
- // 0b00010001 = 17
- let the_b = @TheB (0, 286331153, 286331153);
-
- let univariant = @TheOnlyCase(-9747455);
-
- zzz();
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-#![feature(managed_boxes)]
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-// debugger:finish
-
-// debugger:print unique.ptr[0]->val
-// check:$1 = 10
-
-// debugger:print unique.ptr[1]->val
-// check:$2 = 11
-
-// debugger:print unique.ptr[2]->val
-// check:$3 = 12
-
-// debugger:print unique.ptr[3]->val
-// check:$4 = 13
-
-#![allow(unused_variable)]
-
-fn main() {
-
- let unique: Vec<@i64> = vec!(@10, @11, @12, @13);
-
- zzz();
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-#![feature(managed_boxes)]
-
-// compile-flags:-g
-// debugger:set print pretty off
-// debugger:rbreak zzz
-// debugger:run
-// debugger:finish
-
-// debugger:print *ordinary_unique
-// check:$1 = {-1, -2}
-
-// debugger:print managed_within_unique->x
-// check:$2 = -3
-
-// debugger:print managed_within_unique->y->val
-// check:$3 = -4
-
-#![allow(unused_variable)]
-
-struct ContainsManaged {
- x: int,
- y: @int
-}
-
-fn main() {
- let ordinary_unique = box() (-1, -2);
-
- let managed_within_unique = box ContainsManaged { x: -3, y: @-4 };
-
- zzz();
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-
-// STACK BY REF
-// debugger:finish
-// debugger:print *self
-// check:$1 = {{Variant2, [...]}, {Variant2, 117901063}}
-// debugger:print arg1
-// check:$2 = -1
-// debugger:print arg2
-// check:$3 = -2
-// debugger:continue
-
-// STACK BY VAL
-// debugger:finish
-// debugger:print self
-// check:$4 = {{Variant2, [...]}, {Variant2, 117901063}}
-// debugger:print arg1
-// check:$5 = -3
-// debugger:print arg2
-// check:$6 = -4
-// debugger:continue
-
-// OWNED BY REF
-// debugger:finish
-// debugger:print *self
-// check:$7 = {{Variant1, x = 1799, y = 1799}, {Variant1, [...]}}
-// debugger:print arg1
-// check:$8 = -5
-// debugger:print arg2
-// check:$9 = -6
-// debugger:continue
-
-// OWNED BY VAL
-// debugger:finish
-// debugger:print self
-// check:$10 = {{Variant1, x = 1799, y = 1799}, {Variant1, [...]}}
-// debugger:print arg1
-// check:$11 = -7
-// debugger:print arg2
-// check:$12 = -8
-// debugger:continue
-
-// OWNED MOVED
-// debugger:finish
-// debugger:print *self
-// check:$13 = {{Variant1, x = 1799, y = 1799}, {Variant1, [...]}}
-// debugger:print arg1
-// check:$14 = -9
-// debugger:print arg2
-// check:$15 = -10
-// debugger:continue
-
-#![feature(struct_variant)]
-
-enum Enum {
- Variant1 { x: u16, y: u16 },
- Variant2 (u32)
-}
-
-impl Enum {
-
- fn self_by_ref(&self, arg1: int, arg2: int) -> int {
- zzz();
- arg1 + arg2
- }
-
- fn self_by_val(self, arg1: int, arg2: int) -> int {
- zzz();
- arg1 + arg2
- }
-
- fn self_owned(~self, arg1: int, arg2: int) -> int {
- zzz();
- arg1 + arg2
- }
-}
-
-fn main() {
- let stack = Variant2(117901063);
- let _ = stack.self_by_ref(-1, -2);
- let _ = stack.self_by_val(-3, -4);
-
- let owned = box Variant1{ x: 1799, y: 1799 };
- let _ = owned.self_by_ref(-5, -6);
- let _ = owned.self_by_val(-7, -8);
- let _ = owned.self_owned(-9, -10);
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-
-// STACK BY REF
-// debugger:finish
-// debugger:print *self
-// check:$1 = {x = {8888, -8888}}
-// debugger:print arg1
-// check:$2 = -1
-// debugger:print arg2
-// check:$3 = -2
-// debugger:continue
-
-// STACK BY VAL
-// debugger:finish
-// debugger:print self
-// check:$4 = {x = {8888, -8888}}
-// debugger:print arg1
-// check:$5 = -3
-// debugger:print arg2
-// check:$6 = -4
-// debugger:continue
-
-// OWNED BY REF
-// debugger:finish
-// debugger:print *self
-// check:$7 = {x = 1234.5}
-// debugger:print arg1
-// check:$8 = -5
-// debugger:print arg2
-// check:$9 = -6
-// debugger:continue
-
-// OWNED BY VAL
-// debugger:finish
-// debugger:print self
-// check:$10 = {x = 1234.5}
-// debugger:print arg1
-// check:$11 = -7
-// debugger:print arg2
-// check:$12 = -8
-// debugger:continue
-
-// OWNED MOVED
-// debugger:finish
-// debugger:print *self
-// check:$13 = {x = 1234.5}
-// debugger:print arg1
-// check:$14 = -9
-// debugger:print arg2
-// check:$15 = -10
-// debugger:continue
-
-struct Struct<T> {
- x: T
-}
-
-impl<T> Struct<T> {
-
- fn self_by_ref(&self, arg1: int, arg2: int) -> int {
- zzz();
- arg1 + arg2
- }
-
- fn self_by_val(self, arg1: int, arg2: int) -> int {
- zzz();
- arg1 + arg2
- }
-
- fn self_owned(~self, arg1: int, arg2: int) -> int {
- zzz();
- arg1 + arg2
- }
-}
-
-fn main() {
- let stack = Struct { x: (8888_u32, -8888_i32) };
- let _ = stack.self_by_ref(-1, -2);
- let _ = stack.self_by_val(-3, -4);
-
- let owned = box Struct { x: 1234.5 };
- let _ = owned.self_by_ref(-5, -6);
- let _ = owned.self_by_val(-7, -8);
- let _ = owned.self_owned(-9, -10);
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-
-// STACK BY REF
-// debugger:finish
-// debugger:print *self
-// check:$1 = {x = 100}
-// debugger:print arg1
-// check:$2 = -1
-// debugger:print arg2
-// check:$3 = -2
-// debugger:continue
-
-// STACK BY VAL
-// debugger:finish
-// debugger:print self
-// check:$4 = {x = 100}
-// debugger:print arg1
-// check:$5 = -3
-// debugger:print arg2
-// check:$6 = -4
-// debugger:continue
-
-// OWNED BY REF
-// debugger:finish
-// debugger:print *self
-// check:$7 = {x = 200}
-// debugger:print arg1
-// check:$8 = -5
-// debugger:print arg2
-// check:$9 = -6
-// debugger:continue
-
-// OWNED BY VAL
-// debugger:finish
-// debugger:print self
-// check:$10 = {x = 200}
-// debugger:print arg1
-// check:$11 = -7
-// debugger:print arg2
-// check:$12 = -8
-// debugger:continue
-
-// OWNED MOVED
-// debugger:finish
-// debugger:print *self
-// check:$13 = {x = 200}
-// debugger:print arg1
-// check:$14 = -9
-// debugger:print arg2
-// check:$15 = -10
-// debugger:continue
-
-struct Struct {
- x: int
-}
-
-impl Struct {
-
- fn self_by_ref(&self, arg1: int, arg2: int) -> int {
- zzz();
- self.x + arg1 + arg2
- }
-
- fn self_by_val(self, arg1: int, arg2: int) -> int {
- zzz();
- self.x + arg1 + arg2
- }
-
- fn self_owned(~self, arg1: int, arg2: int) -> int {
- zzz();
- self.x + arg1 + arg2
- }
-}
-
-fn main() {
- let stack = Struct { x: 100 };
- let _ = stack.self_by_ref(-1, -2);
- let _ = stack.self_by_val(-3, -4);
-
- let owned = box Struct { x: 200 };
- let _ = owned.self_by_ref(-5, -6);
- let _ = owned.self_by_val(-7, -8);
- let _ = owned.self_owned(-9, -10);
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-
-// STACK BY REF
-// debugger:finish
-// debugger:print *self
-// check:$1 = {x = 100}
-// debugger:print arg1
-// check:$2 = -1
-// debugger:print arg2
-// check:$3 = -2
-// debugger:continue
-
-// STACK BY VAL
-// debugger:finish
-// debugger:print self
-// check:$4 = {x = 100}
-// debugger:print arg1
-// check:$5 = -3
-// debugger:print arg2
-// check:$6 = -4
-// debugger:continue
-
-// OWNED BY REF
-// debugger:finish
-// debugger:print *self
-// check:$7 = {x = 200}
-// debugger:print arg1
-// check:$8 = -5
-// debugger:print arg2
-// check:$9 = -6
-// debugger:continue
-
-// OWNED BY VAL
-// debugger:finish
-// debugger:print self
-// check:$10 = {x = 200}
-// debugger:print arg1
-// check:$11 = -7
-// debugger:print arg2
-// check:$12 = -8
-// debugger:continue
-
-// OWNED MOVED
-// debugger:finish
-// debugger:print *self
-// check:$13 = {x = 200}
-// debugger:print arg1
-// check:$14 = -9
-// debugger:print arg2
-// check:$15 = -10
-// debugger:continue
-
-struct Struct {
- x: int
-}
-
-trait Trait {
- fn self_by_ref(&self, arg1: int, arg2: int) -> int;
- fn self_by_val(self, arg1: int, arg2: int) -> int;
- fn self_owned(~self, arg1: int, arg2: int) -> int;
-}
-
-impl Trait for Struct {
-
- fn self_by_ref(&self, arg1: int, arg2: int) -> int {
- zzz();
- self.x + arg1 + arg2
- }
-
- fn self_by_val(self, arg1: int, arg2: int) -> int {
- zzz();
- self.x + arg1 + arg2
- }
-
- fn self_owned(~self, arg1: int, arg2: int) -> int {
- zzz();
- self.x + arg1 + arg2
- }
-}
-
-fn main() {
- let stack = Struct { x: 100 };
- let _ = stack.self_by_ref(-1, -2);
- let _ = stack.self_by_val(-3, -4);
-
- let owned = box Struct { x: 200 };
- let _ = owned.self_by_ref(-5, -6);
- let _ = owned.self_by_val(-7, -8);
- let _ = owned.self_owned(-9, -10);
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-
-// STACK BY REF
-// debugger:finish
-// debugger:print *self
-// check:$1 = {100, -100.5}
-// debugger:print arg1
-// check:$2 = -1
-// debugger:print arg2
-// check:$3 = -2
-// debugger:continue
-
-// STACK BY VAL
-// debugger:finish
-// debugger:print self
-// check:$4 = {100, -100.5}
-// debugger:print arg1
-// check:$5 = -3
-// debugger:print arg2
-// check:$6 = -4
-// debugger:continue
-
-// OWNED BY REF
-// debugger:finish
-// debugger:print *self
-// check:$7 = {200, -200.5}
-// debugger:print arg1
-// check:$8 = -5
-// debugger:print arg2
-// check:$9 = -6
-// debugger:continue
-
-// OWNED BY VAL
-// debugger:finish
-// debugger:print self
-// check:$10 = {200, -200.5}
-// debugger:print arg1
-// check:$11 = -7
-// debugger:print arg2
-// check:$12 = -8
-// debugger:continue
-
-// OWNED MOVED
-// debugger:finish
-// debugger:print *self
-// check:$13 = {200, -200.5}
-// debugger:print arg1
-// check:$14 = -9
-// debugger:print arg2
-// check:$15 = -10
-// debugger:continue
-
-struct TupleStruct(int, f64);
-
-impl TupleStruct {
-
- fn self_by_ref(&self, arg1: int, arg2: int) -> int {
- zzz();
- arg1 + arg2
- }
-
- fn self_by_val(self, arg1: int, arg2: int) -> int {
- zzz();
- arg1 + arg2
- }
-
- fn self_owned(~self, arg1: int, arg2: int) -> int {
- zzz();
- arg1 + arg2
- }
-}
-
-fn main() {
- let stack = TupleStruct(100, -100.5);
- let _ = stack.self_by_ref(-1, -2);
- let _ = stack.self_by_val(-3, -4);
-
- let owned = box TupleStruct(200, -200.5);
- let _ = owned.self_by_ref(-5, -6);
- let _ = owned.self_by_val(-7, -8);
- let _ = owned.self_owned(-9, -10);
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-// debugger:finish
-
-// debugger:print abc
-// check:$1 = 10101
-// debugger:continue
-
-// debugger:finish
-// debugger:print abc
-// check:$2 = 20202
-// debugger:continue
-
-// debugger:finish
-// debugger:print abc
-// check:$3 = 30303
-
-#![allow(unused_variable)]
-
-fn function_one() {
- let abc = 10101;
- zzz();
-}
-
-fn function_two() {
- let abc = 20202;
- zzz();
-}
-
-
-fn function_three() {
- let abc = 30303;
- zzz();
-}
-
-
-fn main() {
- function_one();
- function_two();
- function_three();
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-// debugger:finish
-
-// debugger:print a
-// check:$1 = 10101
-// debugger:continue
-
-// debugger:finish
-// debugger:print b
-// check:$2 = 20202
-// debugger:continue
-
-// debugger:finish
-// debugger:print c
-// check:$3 = 30303
-
-#![allow(unused_variable)]
-
-fn function_one() {
- let a = 10101;
- zzz();
-}
-
-fn function_two() {
- let b = 20202;
- zzz();
-}
-
-
-fn function_three() {
- let c = 30303;
- zzz();
-}
-
-
-fn main() {
- function_one();
- function_two();
- function_three();
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-
-// debugger:finish
-// debugger:print x
-// check:$1 = false
-// debugger:print y
-// check:$2 = true
-// debugger:continue
-
-// debugger:finish
-// debugger:print x
-// check:$3 = 10
-// debugger:print y
-// check:$4 = true
-// debugger:continue
-
-// debugger:finish
-// debugger:print x
-// check:$5 = 10.5
-// debugger:print y
-// check:$6 = 20
-// debugger:continue
-
-// debugger:finish
-// debugger:print x
-// check:$7 = true
-// debugger:print y
-// check:$8 = 2220
-// debugger:continue
-
-// debugger:finish
-// debugger:print x
-// check:$9 = 203203.5
-// debugger:print y
-// check:$10 = 2220
-// debugger:continue
-
-// debugger:finish
-// debugger:print x
-// check:$11 = 10.5
-// debugger:print y
-// check:$12 = 20
-// debugger:continue
-
-fn main() {
- let x = false;
- let y = true;
-
- zzz();
- sentinel();
-
- let x = 10;
-
- zzz();
- sentinel();
-
- let x = 10.5;
- let y = 20;
-
- zzz();
- sentinel();
-
- {
- let x = true;
- let y = 2220;
-
- zzz();
- sentinel();
-
- let x = 203203.5;
-
- zzz();
- sentinel();
- }
-
- zzz();
- sentinel();
-}
-
-fn zzz() {()}
-fn sentinel() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-// debugger:finish
-
-// debugger:print first
-// check:$1 = {<No data fields>}
-
-// debugger:print second
-// check:$2 = {<No data fields>}
-
-#![allow(unused_variable)]
-
-enum ANilEnum {}
-enum AnotherNilEnum {}
-
-// I (mw) am not sure this test case makes much sense...
-// Also, it relies on some implementation details:
-// 1. That empty enums as well as '()' are represented as empty structs
-// 2. That gdb prints the string "{<No data fields>}" for empty structs (which may change some time)
-fn main() {
- unsafe {
- let first: ANilEnum = std::cast::transmute(());
- let second: AnotherNilEnum = std::cast::transmute(());
-
- zzz();
- }
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-// debugger:finish
-
-// debugger:print some
-// check:$1 = {0x12345678}
-
-// debugger:print none
-// check:$2 = {0x0}
-
-// debugger:print full
-// check:$3 = {454545, 0x87654321, 9988}
-
-// debugger:print empty->discr
-// check:$4 = (int *) 0x0
-
-// debugger:print droid
-// check:$5 = {id = 675675, range = 10000001, internals = 0x43218765}
-
-// debugger:print void_droid->internals
-// check:$6 = (int *) 0x0
-
-// debugger:continue
-
-#![feature(struct_variant)]
-
-// If a struct has exactly two variants, one of them is empty, and the other one
-// contains a non-nullable pointer, then this value is used as the discriminator.
-// The test cases in this file make sure that something readable is generated for
-// this kind of types.
-// Unfortunately (for these test cases) the content of the non-discriminant fields
-// in the null-case is not defined. So we just read the discriminator field in
-// this case (by casting the value to a memory-equivalent struct).
-
-enum MoreFields<'a> {
- Full(u32, &'a int, i16),
- Empty
-}
-
-struct MoreFieldsRepr<'a> {
- a: u32,
- discr: &'a int,
- b: i16
-}
-
-enum NamedFields<'a> {
- Droid { id: i32, range: i64, internals: &'a int },
- Void
-}
-
-struct NamedFieldsRepr<'a> {
- id: i32,
- range: i64,
- internals: &'a int
-}
-
-fn main() {
-
- let some: Option<&u32> = Some(unsafe { std::cast::transmute(0x12345678) });
- let none: Option<&u32> = None;
-
- let full = Full(454545, unsafe { std::cast::transmute(0x87654321) }, 9988);
-
- let int_val = 0;
- let empty: &MoreFieldsRepr = unsafe { std::cast::transmute(&Empty) };
-
- let droid = Droid {
- id: 675675,
- range: 10000001,
- internals: unsafe { std::cast::transmute(0x43218765) }
- };
-
- let void_droid: &NamedFieldsRepr = unsafe { std::cast::transmute(&Void) };
-
- zzz();
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-tidy-linelength
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:set print pretty off
-// debugger:rbreak zzz
-// debugger:run
-// debugger:finish
-
-// debugger:print packed
-// check:$1 = {x = 123, y = 234, z = 345}
-
-// debugger:print packedInPacked
-// check:$2 = {a = 1111, b = {x = 2222, y = 3333, z = 4444}, c = 5555, d = {x = 6666, y = 7777, z = 8888}}
-
-// debugger:print packedInUnpacked
-// check:$3 = {a = -1111, b = {x = -2222, y = -3333, z = -4444}, c = -5555, d = {x = -6666, y = -7777, z = -8888}}
-
-// debugger:print unpackedInPacked
-// check:$4 = {a = 987, b = {x = 876, y = 765, z = 654}, c = {x = 543, y = 432, z = 321}, d = 210}
-
-
-// debugger:print packedInPackedWithDrop
-// check:$5 = {a = 11, b = {x = 22, y = 33, z = 44}, c = 55, d = {x = 66, y = 77, z = 88}}
-
-// debugger:print packedInUnpackedWithDrop
-// check:$6 = {a = -11, b = {x = -22, y = -33, z = -44}, c = -55, d = {x = -66, y = -77, z = -88}}
-
-// debugger:print unpackedInPackedWithDrop
-// check:$7 = {a = 98, b = {x = 87, y = 76, z = 65}, c = {x = 54, y = 43, z = 32}, d = 21}
-
-// debugger:print deeplyNested
-// check:$8 = {a = {a = 1, b = {x = 2, y = 3, z = 4}, c = 5, d = {x = 6, y = 7, z = 8}}, b = {a = 9, b = {x = 10, y = 11, z = 12}, c = {x = 13, y = 14, z = 15}, d = 16}, c = {a = 17, b = {x = 18, y = 19, z = 20}, c = 21, d = {x = 22, y = 23, z = 24}}, d = {a = 25, b = {x = 26, y = 27, z = 28}, c = 29, d = {x = 30, y = 31, z = 32}}, e = {a = 33, b = {x = 34, y = 35, z = 36}, c = {x = 37, y = 38, z = 39}, d = 40}, f = {a = 41, b = {x = 42, y = 43, z = 44}, c = 45, d = {x = 46, y = 47, z = 48}}}
-
-#![allow(unused_variable)]
-
-#[packed]
-struct Packed {
- x: i16,
- y: i32,
- z: i64
-}
-
-impl Drop for Packed {
- fn drop(&mut self) {}
-}
-
-#[packed]
-struct PackedInPacked {
- a: i32,
- b: Packed,
- c: i64,
- d: Packed
-}
-
-struct PackedInUnpacked {
- a: i32,
- b: Packed,
- c: i64,
- d: Packed
-}
-
-struct Unpacked {
- x: i64,
- y: i32,
- z: i16
-}
-
-impl Drop for Unpacked {
- fn drop(&mut self) {}
-}
-
-#[packed]
-struct UnpackedInPacked {
- a: i16,
- b: Unpacked,
- c: Unpacked,
- d: i64
-}
-
-#[packed]
-struct PackedInPackedWithDrop {
- a: i32,
- b: Packed,
- c: i64,
- d: Packed
-}
-
-impl Drop for PackedInPackedWithDrop {
- fn drop(&mut self) {}
-}
-
-struct PackedInUnpackedWithDrop {
- a: i32,
- b: Packed,
- c: i64,
- d: Packed
-}
-
-impl Drop for PackedInUnpackedWithDrop {
- fn drop(&mut self) {}
-}
-
-#[packed]
-struct UnpackedInPackedWithDrop {
- a: i16,
- b: Unpacked,
- c: Unpacked,
- d: i64
-}
-
-impl Drop for UnpackedInPackedWithDrop {
- fn drop(&mut self) {}
-}
-
-struct DeeplyNested {
- a: PackedInPacked,
- b: UnpackedInPackedWithDrop,
- c: PackedInUnpacked,
- d: PackedInUnpackedWithDrop,
- e: UnpackedInPacked,
- f: PackedInPackedWithDrop
-}
-
-fn main() {
- let packed = Packed { x: 123, y: 234, z: 345 };
-
- let packedInPacked = PackedInPacked {
- a: 1111,
- b: Packed { x: 2222, y: 3333, z: 4444 },
- c: 5555,
- d: Packed { x: 6666, y: 7777, z: 8888 }
- };
-
- let packedInUnpacked = PackedInUnpacked {
- a: -1111,
- b: Packed { x: -2222, y: -3333, z: -4444 },
- c: -5555,
- d: Packed { x: -6666, y: -7777, z: -8888 }
- };
-
- let unpackedInPacked = UnpackedInPacked {
- a: 987,
- b: Unpacked { x: 876, y: 765, z: 654 },
- c: Unpacked { x: 543, y: 432, z: 321 },
- d: 210
- };
-
- let packedInPackedWithDrop = PackedInPackedWithDrop {
- a: 11,
- b: Packed { x: 22, y: 33, z: 44 },
- c: 55,
- d: Packed { x: 66, y: 77, z: 88 }
- };
-
- let packedInUnpackedWithDrop = PackedInUnpackedWithDrop {
- a: -11,
- b: Packed { x: -22, y: -33, z: -44 },
- c: -55,
- d: Packed { x: -66, y: -77, z: -88 }
- };
-
- let unpackedInPackedWithDrop = UnpackedInPackedWithDrop {
- a: 98,
- b: Unpacked { x: 87, y: 76, z: 65 },
- c: Unpacked { x: 54, y: 43, z: 32 },
- d: 21
- };
-
- let deeplyNested = DeeplyNested {
- a: PackedInPacked {
- a: 1,
- b: Packed { x: 2, y: 3, z: 4 },
- c: 5,
- d: Packed { x: 6, y: 7, z: 8 }
- },
- b: UnpackedInPackedWithDrop {
- a: 9,
- b: Unpacked { x: 10, y: 11, z: 12 },
- c: Unpacked { x: 13, y: 14, z: 15 },
- d: 16
- },
- c: PackedInUnpacked {
- a: 17,
- b: Packed { x: 18, y: 19, z: 20 },
- c: 21,
- d: Packed { x: 22, y: 23, z: 24 }
- },
- d: PackedInUnpackedWithDrop {
- a: 25,
- b: Packed { x: 26, y: 27, z: 28 },
- c: 29,
- d: Packed { x: 30, y: 31, z: 32 }
- },
- e: UnpackedInPacked {
- a: 33,
- b: Unpacked { x: 34, y: 35, z: 36 },
- c: Unpacked { x: 37, y: 38, z: 39 },
- d: 40
- },
- f: PackedInPackedWithDrop {
- a: 41,
- b: Packed { x: 42, y: 43, z: 44 },
- c: 45,
- d: Packed { x: 46, y: 47, z: 48 }
- }
- };
-
- zzz();
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-tidy-linelength
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:set print pretty off
-// debugger:rbreak zzz
-// debugger:run
-// debugger:finish
-
-// debugger:print packed
-// check:$1 = {x = 123, y = 234, z = 345}
-
-// debugger:print packedInPacked
-// check:$2 = {a = 1111, b = {x = 2222, y = 3333, z = 4444}, c = 5555, d = {x = 6666, y = 7777, z = 8888}}
-
-// debugger:print packedInUnpacked
-// check:$3 = {a = -1111, b = {x = -2222, y = -3333, z = -4444}, c = -5555, d = {x = -6666, y = -7777, z = -8888}}
-
-// debugger:print unpackedInPacked
-// check:$4 = {a = 987, b = {x = 876, y = 765, z = 654, w = 543}, c = {x = 432, y = 321, z = 210, w = 109}, d = -98}
-
-// debugger:print sizeof(packed)
-// check:$5 = 14
-
-// debugger:print sizeof(packedInPacked)
-// check:$6 = 40
-
-#![allow(unused_variable)]
-
-#[packed]
-struct Packed {
- x: i16,
- y: i32,
- z: i64
-}
-
-#[packed]
-struct PackedInPacked {
- a: i32,
- b: Packed,
- c: i64,
- d: Packed
-}
-
-// layout (64 bit): aaaa bbbb bbbb bbbb bb.. .... cccc cccc dddd dddd dddd dd..
-struct PackedInUnpacked {
- a: i32,
- b: Packed,
- c: i64,
- d: Packed
-}
-
-// layout (64 bit): xx.. yyyy zz.. .... wwww wwww
-struct Unpacked {
- x: i16,
- y: i32,
- z: i16,
- w: i64
-}
-
-// layout (64 bit): aabb bbbb bbbb bbbb bbbb bbbb bbcc cccc cccc cccc cccc cccc ccdd dddd dd
-#[packed]
-struct UnpackedInPacked {
- a: i16,
- b: Unpacked,
- c: Unpacked,
- d: i64
-}
-
-fn main() {
- let packed = Packed { x: 123, y: 234, z: 345 };
-
- let packedInPacked = PackedInPacked {
- a: 1111,
- b: Packed { x: 2222, y: 3333, z: 4444 },
- c: 5555,
- d: Packed { x: 6666, y: 7777, z: 8888 }
- };
-
- let packedInUnpacked = PackedInUnpacked {
- a: -1111,
- b: Packed { x: -2222, y: -3333, z: -4444 },
- c: -5555,
- d: Packed { x: -6666, y: -7777, z: -8888 }
- };
-
- let unpackedInPacked = UnpackedInPacked {
- a: 987,
- b: Unpacked { x: 876, y: 765, z: 654, w: 543 },
- c: Unpacked { x: 432, y: 321, z: 210, w: 109 },
- d: -98
- };
-
- zzz();
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:run
-
-// Test whether compiling a recursive enum definition crashes debug info generation. The test case
-// is taken from issue #11083.
-
-#![allow(unused_variable)]
-
-pub struct Window<'a> {
- callbacks: WindowCallbacks<'a>
-}
-
-struct WindowCallbacks<'a> {
- pos_callback: Option<WindowPosCallback<'a>>,
-}
-
-pub type WindowPosCallback<'a> = |&Window, i32, i32|: 'a;
-
-fn main() {
- let x = WindowCallbacks { pos_callback: None };
-}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-#![feature(managed_boxes)]
-
-// compile-flags:-g
-// debugger:set print pretty off
-// debugger:rbreak zzz
-// debugger:run
-// debugger:finish
-
-// debugger:print stack_unique.value
-// check:$1 = 0
-// debugger:print stack_unique.next.val->value
-// check:$2 = 1
-
-// debugger:print unique_unique->value
-// check:$3 = 2
-// debugger:print unique_unique->next.val->value
-// check:$4 = 3
-
-// debugger:print box_unique->val.value
-// check:$5 = 4
-// debugger:print box_unique->val.next.val->value
-// check:$6 = 5
-
-// debugger:print vec_unique[0].value
-// check:$7 = 6.5
-// debugger:print vec_unique[0].next.val->value
-// check:$8 = 7.5
-
-// debugger:print borrowed_unique->value
-// check:$9 = 8.5
-// debugger:print borrowed_unique->next.val->value
-// check:$10 = 9.5
-
-// MANAGED
-// debugger:print stack_managed.value
-// check:$11 = 10
-// debugger:print stack_managed.next.val->val.value
-// check:$12 = 11
-
-// debugger:print unique_managed->value
-// check:$13 = 12
-// debugger:print unique_managed->next.val->val.value
-// check:$14 = 13
-
-// debugger:print box_managed->val.value
-// check:$15 = 14
-// debugger:print box_managed->val.next.val->val.value
-// check:$16 = 15
-
-// debugger:print vec_managed[0].value
-// check:$17 = 16.5
-// debugger:print vec_managed[0].next.val->val.value
-// check:$18 = 17.5
-
-// debugger:print borrowed_managed->value
-// check:$19 = 18.5
-// debugger:print borrowed_managed->next.val->val.value
-// check:$20 = 19.5
-
-// LONG CYCLE
-// debugger:print long_cycle1.value
-// check:$21 = 20
-// debugger:print long_cycle1.next->value
-// check:$22 = 21
-// debugger:print long_cycle1.next->next->value
-// check:$23 = 22
-// debugger:print long_cycle1.next->next->next->value
-// check:$24 = 23
-
-// debugger:print long_cycle2.value
-// check:$25 = 24
-// debugger:print long_cycle2.next->value
-// check:$26 = 25
-// debugger:print long_cycle2.next->next->value
-// check:$27 = 26
-
-// debugger:print long_cycle3.value
-// check:$28 = 27
-// debugger:print long_cycle3.next->value
-// check:$29 = 28
-
-// debugger:print long_cycle4.value
-// check:$30 = 29.5
-
-// debugger:print (*****long_cycle_w_anonymous_types).value
-// check:$31 = 30
-
-// debugger:print (*****((*****long_cycle_w_anonymous_types).next.val)).value
-// check:$32 = 31
-
-// debugger:continue
-
-#![allow(unused_variable)]
-#![feature(struct_variant)]
-
-
-enum Opt<T> {
- Empty,
- Val { val: T }
-}
-
-struct UniqueNode<T> {
- next: Opt<Box<UniqueNode<T>>>,
- value: T
-}
-
-struct ManagedNode<T> {
- next: Opt<@ManagedNode<T>>,
- value: T
-}
-
-struct LongCycle1<T> {
- next: Box<LongCycle2<T>>,
- value: T,
-}
-
-struct LongCycle2<T> {
- next: Box<LongCycle3<T>>,
- value: T,
-}
-
-struct LongCycle3<T> {
- next: Box<LongCycle4<T>>,
- value: T,
-}
-
-struct LongCycle4<T> {
- next: Option<Box<LongCycle1<T>>>,
- value: T,
-}
-
-struct LongCycleWithAnonymousTypes {
- next: Opt<Box<Box<Box<Box<Box<LongCycleWithAnonymousTypes>>>>>>,
- value: uint,
-}
-
-// This test case makes sure that recursive structs are properly described. The Node structs are
-// generic so that we can have a new type (that newly needs to be described) for the different
-// cases. The potential problem with recursive types is that the DI generation algorithm gets
-// trapped in an endless loop. To make sure, we actually test this in the different cases, we have
-// to operate on a new type each time, otherwise we would just hit the DI cache for all but the
-// first case.
-
-// The different cases below (stack_*, unique_*, box_*, etc) are set up so that the type description
-// algorithm will enter the type reference cycle that is created by a recursive definition from a
-// different context each time.
-
-// The "long cycle" cases are constructed to span a longer, indirect recursion cycle between types.
-// The different locals will cause the DI algorithm to enter the type reference cycle at different
-// points.
-
-fn main() {
- let stack_unique: UniqueNode<u16> = UniqueNode {
- next: Val {
- val: box UniqueNode {
- next: Empty,
- value: 1_u16,
- }
- },
- value: 0_u16,
- };
-
- let unique_unique: Box<UniqueNode<u32>> = box UniqueNode {
- next: Val {
- val: box UniqueNode {
- next: Empty,
- value: 3,
- }
- },
- value: 2,
- };
-
- let box_unique: @UniqueNode<u64> = @UniqueNode {
- next: Val {
- val: box UniqueNode {
- next: Empty,
- value: 5,
- }
- },
- value: 4,
- };
-
- let vec_unique: [UniqueNode<f32>, ..1] = [UniqueNode {
- next: Val {
- val: box UniqueNode {
- next: Empty,
- value: 7.5,
- }
- },
- value: 6.5,
- }];
-
- let borrowed_unique: &UniqueNode<f64> = &UniqueNode {
- next: Val {
- val: box UniqueNode {
- next: Empty,
- value: 9.5,
- }
- },
- value: 8.5,
- };
-
- let stack_managed: ManagedNode<u16> = ManagedNode {
- next: Val {
- val: @ManagedNode {
- next: Empty,
- value: 11,
- }
- },
- value: 10,
- };
-
- let unique_managed: Box<ManagedNode<u32>> = box ManagedNode {
- next: Val {
- val: @ManagedNode {
- next: Empty,
- value: 13,
- }
- },
- value: 12,
- };
-
- let box_managed: @ManagedNode<u64> = @ManagedNode {
- next: Val {
- val: @ManagedNode {
- next: Empty,
- value: 15,
- }
- },
- value: 14,
- };
-
- let vec_managed: [ManagedNode<f32>, ..1] = [ManagedNode {
- next: Val {
- val: @ManagedNode {
- next: Empty,
- value: 17.5,
- }
- },
- value: 16.5,
- }];
-
- let borrowed_managed: &ManagedNode<f64> = &ManagedNode {
- next: Val {
- val: @ManagedNode {
- next: Empty,
- value: 19.5,
- }
- },
- value: 18.5,
- };
-
- // LONG CYCLE
- let long_cycle1: LongCycle1<u16> = LongCycle1 {
- next: box LongCycle2 {
- next: box LongCycle3 {
- next: box LongCycle4 {
- next: None,
- value: 23,
- },
- value: 22,
- },
- value: 21
- },
- value: 20
- };
-
- let long_cycle2: LongCycle2<u32> = LongCycle2 {
- next: box LongCycle3 {
- next: box LongCycle4 {
- next: None,
- value: 26,
- },
- value: 25,
- },
- value: 24
- };
-
- let long_cycle3: LongCycle3<u64> = LongCycle3 {
- next: box LongCycle4 {
- next: None,
- value: 28,
- },
- value: 27,
- };
-
- let long_cycle4: LongCycle4<f32> = LongCycle4 {
- next: None,
- value: 29.5,
- };
-
- // It's important that LongCycleWithAnonymousTypes is encountered only at the end of the
- // `box` chain.
- let long_cycle_w_anonymous_types = box box box box box LongCycleWithAnonymousTypes {
- next: Val {
- val: box box box box box LongCycleWithAnonymousTypes {
- next: Empty,
- value: 31,
- }
- },
- value: 30
- };
-
- zzz();
-}
-
-fn zzz() {()}
-
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-
-// STACK BY REF
-// debugger:finish
-// debugger:print *self
-// check:$1 = {x = 100}
-// debugger:print arg1
-// check:$2 = -1
-// debugger:print arg2
-// check:$3 = -2
-// debugger:continue
-
-// STACK BY VAL
-// debugger:finish
-// debugger:print self
-// check:$4 = {x = 100}
-// debugger:print arg1
-// check:$5 = -3
-// debugger:print arg2
-// check:$6 = -4
-// debugger:continue
-
-// OWNED BY REF
-// debugger:finish
-// debugger:print *self
-// check:$7 = {x = 200}
-// debugger:print arg1
-// check:$8 = -5
-// debugger:print arg2
-// check:$9 = -6
-// debugger:continue
-
-// OWNED BY VAL
-// debugger:finish
-// debugger:print self
-// check:$10 = {x = 200}
-// debugger:print arg1
-// check:$11 = -7
-// debugger:print arg2
-// check:$12 = -8
-// debugger:continue
-
-// OWNED MOVED
-// debugger:finish
-// debugger:print *self
-// check:$13 = {x = 200}
-// debugger:print arg1
-// check:$14 = -9
-// debugger:print arg2
-// check:$15 = -10
-// debugger:continue
-
-struct Struct {
- x: int
-}
-
-trait Trait {
- fn self_by_ref(&self, arg1: int, arg2: int) -> int {
- zzz();
- arg1 + arg2
- }
-
- fn self_by_val(self, arg1: int, arg2: int) -> int {
- zzz();
- arg1 + arg2
- }
-
- fn self_owned(~self, arg1: int, arg2: int) -> int {
- zzz();
- arg1 + arg2
- }
-}
-
-impl Trait for Struct {}
-
-fn main() {
- let stack = Struct { x: 100 };
- let _ = stack.self_by_ref(-1, -2);
- let _ = stack.self_by_val(-3, -4);
-
- let owned = box Struct { x: 200 };
- let _ = owned.self_by_ref(-5, -6);
- let _ = owned.self_by_val(-7, -8);
- let _ = owned.self_owned(-9, -10);
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-
-// STACK BY REF
-// debugger:finish
-// debugger:print *self
-// check:$1 = {x = 987}
-// debugger:print arg1
-// check:$2 = -1
-// debugger:print/d arg2
-// check:$3 = -2
-// debugger:continue
-
-// STACK BY VAL
-// debugger:finish
-// debugger:print self
-// check:$4 = {x = 987}
-// debugger:print arg1
-// check:$5 = -3
-// debugger:print arg2
-// check:$6 = -4
-// debugger:continue
-
-// OWNED BY REF
-// debugger:finish
-// debugger:print *self
-// check:$7 = {x = 879}
-// debugger:print arg1
-// check:$8 = -5
-// debugger:print arg2
-// check:$9 = -6
-// debugger:continue
-
-// OWNED BY VAL
-// debugger:finish
-// debugger:print self
-// check:$10 = {x = 879}
-// debugger:print arg1
-// check:$11 = -7
-// debugger:print arg2
-// check:$12 = -8
-// debugger:continue
-
-// OWNED MOVED
-// debugger:finish
-// debugger:print *self
-// check:$13 = {x = 879}
-// debugger:print arg1
-// check:$14 = -9
-// debugger:print arg2
-// check:$15 = -10.5
-// debugger:continue
-
-struct Struct {
- x: int
-}
-
-trait Trait {
-
- fn self_by_ref<T>(&self, arg1: int, arg2: T) -> int {
- zzz();
- arg1
- }
-
- fn self_by_val<T>(self, arg1: int, arg2: T) -> int {
- zzz();
- arg1
- }
-
- fn self_owned<T>(~self, arg1: int, arg2: T) -> int {
- zzz();
- arg1
- }
-}
-
-impl Trait for Struct {}
-
-fn main() {
- let stack = Struct { x: 987 };
- let _ = stack.self_by_ref(-1, -2_i8);
- let _ = stack.self_by_val(-3, -4_i16);
-
- let owned = box Struct { x: 879 };
- let _ = owned.self_by_ref(-5, -6_i32);
- let _ = owned.self_by_val(-7, -8_i64);
- let _ = owned.self_owned(-9, -10.5_f32);
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-
-// debugger:finish
-// debugger:print x
-// check:$1 = false
-// debugger:print y
-// check:$2 = true
-// debugger:continue
-
-// debugger:finish
-// debugger:print x
-// check:$3 = 10
-// debugger:print y
-// check:$4 = true
-// debugger:continue
-
-// debugger:finish
-// debugger:print x
-// check:$5 = 10.5
-// debugger:print y
-// check:$6 = 20
-// debugger:continue
-
-fn a_function(x: bool, y: bool) {
- zzz();
- sentinel();
-
- let x = 10;
-
- zzz();
- sentinel();
-
- let x = 10.5;
- let y = 20;
-
- zzz();
- sentinel();
-}
-
-fn main() {
- a_function(false, true);
-}
-
-fn zzz() {()}
-fn sentinel() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-
-// debugger:finish
-// debugger:print x
-// check:$1 = false
-// debugger:print y
-// check:$2 = true
-// debugger:continue
-
-// debugger:finish
-// debugger:print x
-// check:$3 = 10
-// debugger:print y
-// check:$4 = true
-// debugger:continue
-
-// debugger:finish
-// debugger:print x
-// check:$5 = 10.5
-// debugger:print y
-// check:$6 = 20
-// debugger:continue
-
-fn main() {
- let x = false;
- let y = true;
-
- zzz();
- sentinel();
-
- let x = 10;
-
- zzz();
- sentinel();
-
- let x = 10.5;
- let y = 20;
-
- zzz();
- sentinel();
-}
-
-fn zzz() {()}
-fn sentinel() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-
-// debugger:finish
-// debugger:print/d i8x16
-// check:$1 = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}
-// debugger:print/d i16x8
-// check:$2 = {16, 17, 18, 19, 20, 21, 22, 23}
-// debugger:print/d i32x4
-// check:$3 = {24, 25, 26, 27}
-// debugger:print/d i64x2
-// check:$4 = {28, 29}
-
-// debugger:print/d u8x16
-// check:$5 = {30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45}
-// debugger:print/d u16x8
-// check:$6 = {46, 47, 48, 49, 50, 51, 52, 53}
-// debugger:print/d u32x4
-// check:$7 = {54, 55, 56, 57}
-// debugger:print/d u64x2
-// check:$8 = {58, 59}
-
-// debugger:print f32x4
-// check:$9 = {60.5, 61.5, 62.5, 63.5}
-// debugger:print f64x2
-// check:$10 = {64.5, 65.5}
-
-// debugger:continue
-
-#![allow(experimental)]
-#![allow(unused_variable)]
-
-use std::unstable::simd::{i8x16, i16x8,i32x4,i64x2,u8x16,u16x8,u32x4,u64x2,f32x4,f64x2};
-
-fn main() {
-
- let i8x16 = i8x16(0i8, 1i8, 2i8, 3i8, 4i8, 5i8, 6i8, 7i8,
- 8i8, 9i8, 10i8, 11i8, 12i8, 13i8, 14i8, 15i8);
-
- let i16x8 = i16x8(16i16, 17i16, 18i16, 19i16, 20i16, 21i16, 22i16, 23i16);
- let i32x4 = i32x4(24i32, 25i32, 26i32, 27i32);
- let i64x2 = i64x2(28i64, 29i64);
-
- let u8x16 = u8x16(30u8, 31u8, 32u8, 33u8, 34u8, 35u8, 36u8, 37u8,
- 38u8, 39u8, 40u8, 41u8, 42u8, 43u8, 44u8, 45u8);
- let u16x8 = u16x8(46u16, 47u16, 48u16, 49u16, 50u16, 51u16, 52u16, 53u16);
- let u32x4 = u32x4(54u32, 55u32, 56u32, 57u32);
- let u64x2 = u64x2(58u64, 59u64);
-
- let f32x4 = f32x4(60.5f32, 61.5f32, 62.5f32, 63.5f32);
- let f64x2 = f64x2(64.5f64, 65.5f64);
-
- zzz();
-}
-
-#[inline(never)]
-fn zzz() { () }
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-
-// debugger:finish
-// debugger:print x
-// check:$1 = false
-// debugger:continue
-
-// debugger:finish
-// debugger:print x
-// check:$2 = false
-// debugger:continue
-
-// debugger:finish
-// debugger:print x
-// check:$3 = 10
-// debugger:continue
-
-// debugger:finish
-// debugger:print x
-// check:$4 = 10
-// debugger:continue
-
-// debugger:finish
-// debugger:print x
-// check:$5 = 10.5
-// debugger:continue
-
-// debugger:finish
-// debugger:print x
-// check:$6 = 10
-// debugger:continue
-
-// debugger:finish
-// debugger:print x
-// check:$7 = false
-// debugger:continue
-
-
-fn main() {
- let x = false;
-
- zzz();
- sentinel();
-
- {
- zzz();
- sentinel();
-
- let x = 10;
-
- zzz();
- sentinel();
-
- {
- zzz();
- sentinel();
-
- let x = 10.5;
-
- zzz();
- sentinel();
- }
-
- zzz();
- sentinel();
- }
-
- zzz();
- sentinel();
-}
-
-fn zzz() {()}
-fn sentinel() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-win32: FIXME #13256
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:set print pretty off
-// debugger:rbreak zzz
-
-// debugger:print 'simple-struct::NO_PADDING_16'
-// check:$1 = {x = 1000, y = -1001}
-
-// debugger:print 'simple-struct::NO_PADDING_32'
-// check:$2 = {x = 1, y = 2, z = 3}
-
-// debugger:print 'simple-struct::NO_PADDING_64'
-// check:$3 = {x = 4, y = 5, z = 6}
-
-// debugger:print 'simple-struct::NO_PADDING_163264'
-// check:$4 = {a = 7, b = 8, c = 9, d = 10}
-
-// debugger:print 'simple-struct::INTERNAL_PADDING'
-// check:$5 = {x = 11, y = 12}
-
-// debugger:print 'simple-struct::PADDING_AT_END'
-// check:$6 = {x = 13, y = 14}
-
-// debugger:run
-// debugger:finish
-
-// debugger:print no_padding16
-// check:$7 = {x = 10000, y = -10001}
-
-// debugger:print no_padding32
-// check:$8 = {x = -10002, y = -10003.5, z = 10004}
-
-// debugger:print no_padding64
-// check:$9 = {x = -10005.5, y = 10006, z = 10007}
-
-// debugger:print no_padding163264
-// check:$10 = {a = -10008, b = 10009, c = 10010, d = 10011}
-
-// debugger:print internal_padding
-// check:$11 = {x = 10012, y = -10013}
-
-// debugger:print padding_at_end
-// check:$12 = {x = -10014, y = 10015}
-
-// debugger:print 'simple-struct::NO_PADDING_16'
-// check:$13 = {x = 100, y = -101}
-
-// debugger:print 'simple-struct::NO_PADDING_32'
-// check:$14 = {x = -15, y = -16, z = 17}
-
-// debugger:print 'simple-struct::NO_PADDING_64'
-// check:$15 = {x = -18, y = 19, z = 20}
-
-// debugger:print 'simple-struct::NO_PADDING_163264'
-// check:$16 = {a = -21, b = 22, c = 23, d = 24}
-
-// debugger:print 'simple-struct::INTERNAL_PADDING'
-// check:$17 = {x = 25, y = -26}
-
-// debugger:print 'simple-struct::PADDING_AT_END'
-// check:$18 = {x = -27, y = 28}
-
-// debugger:print inheriting
-// check:$19 = {a = 10019, b = -10020, x = -10016, y = -10017.5, z = 10018}
-
-
-#![feature(struct_inherit)];
-#![allow(unused_variable)];
-#![allow(dead_code)];
-
-struct NoPadding16 {
- x: u16,
- y: i16
-}
-
-virtual struct NoPadding32 {
- x: i32,
- y: f32,
- z: u32
-}
-
-struct NoPadding64 {
- x: f64,
- y: i64,
- z: u64
-}
-
-struct NoPadding163264 {
- a: i16,
- b: u16,
- c: i32,
- d: u64
-}
-
-struct InternalPadding {
- x: u16,
- y: i64
-}
-
-struct PaddingAtEnd {
- x: i64,
- y: u16
-}
-
-static mut NO_PADDING_16: NoPadding16 = NoPadding16 {
- x: 1000,
- y: -1001
-};
-
-static mut NO_PADDING_32: NoPadding32 = NoPadding32 {
- x: 1,
- y: 2.0,
- z: 3
-};
-
-static mut NO_PADDING_64: NoPadding64 = NoPadding64 {
- x: 4.0,
- y: 5,
- z: 6
-};
-
-static mut NO_PADDING_163264: NoPadding163264 = NoPadding163264 {
- a: 7,
- b: 8,
- c: 9,
- d: 10
-};
-
-static mut INTERNAL_PADDING: InternalPadding = InternalPadding {
- x: 11,
- y: 12
-};
-
-static mut PADDING_AT_END: PaddingAtEnd = PaddingAtEnd {
- x: 13,
- y: 14
-};
-
-struct Inheriting : NoPadding32 {
- a: u16,
- b: i16
-}
-
-fn main() {
- let no_padding16 = NoPadding16 { x: 10000, y: -10001 };
- let no_padding32 = NoPadding32 { x: -10002, y: -10003.5, z: 10004 };
- let no_padding64 = NoPadding64 { x: -10005.5, y: 10006, z: 10007 };
- let no_padding163264 = NoPadding163264 { a: -10008, b: 10009, c: 10010, d: 10011 };
-
- let internal_padding = InternalPadding { x: 10012, y: -10013 };
- let padding_at_end = PaddingAtEnd { x: -10014, y: 10015 };
-
- let inheriting = Inheriting { a: 10019, b: -10020, x: -10016, y: -10017.5, z: 10018 };
-
- unsafe {
- NO_PADDING_16.x = 100;
- NO_PADDING_16.y = -101;
-
- NO_PADDING_32.x = -15;
- NO_PADDING_32.y = -16.0;
- NO_PADDING_32.z = 17;
-
- NO_PADDING_64.x = -18.0;
- NO_PADDING_64.y = 19;
- NO_PADDING_64.z = 20;
-
- NO_PADDING_163264.a = -21;
- NO_PADDING_163264.b = 22;
- NO_PADDING_163264.c = 23;
- NO_PADDING_163264.d = 24;
-
- INTERNAL_PADDING.x = 25;
- INTERNAL_PADDING.y = -26;
-
- PADDING_AT_END.x = -27;
- PADDING_AT_END.y = 28;
- }
-
- zzz();
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-win32: FIXME #13256
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:set print pretty off
-// debugger:rbreak zzz
-
-// debugger:print/d 'simple-tuple::NO_PADDING_8'
-// check:$1 = {-50, 50}
-// debugger:print 'simple-tuple::NO_PADDING_16'
-// check:$2 = {-1, 2, 3}
-// debugger:print 'simple-tuple::NO_PADDING_32'
-// check:$3 = {4, 5, 6}
-// debugger:print 'simple-tuple::NO_PADDING_64'
-// check:$4 = {7, 8, 9}
-
-// debugger:print 'simple-tuple::INTERNAL_PADDING_1'
-// check:$5 = {10, 11}
-// debugger:print 'simple-tuple::INTERNAL_PADDING_2'
-// check:$6 = {12, 13, 14, 15}
-
-// debugger:print 'simple-tuple::PADDING_AT_END'
-// check:$7 = {16, 17}
-
-// debugger:run
-// debugger:finish
-
-// debugger:print/d noPadding8
-// check:$8 = {-100, 100}
-// debugger:print noPadding16
-// check:$9 = {0, 1, 2}
-// debugger:print noPadding32
-// check:$10 = {3, 4.5, 5}
-// debugger:print noPadding64
-// check:$11 = {6, 7.5, 8}
-
-// debugger:print internalPadding1
-// check:$12 = {9, 10}
-// debugger:print internalPadding2
-// check:$13 = {11, 12, 13, 14}
-
-// debugger:print paddingAtEnd
-// check:$14 = {15, 16}
-
-// debugger:print/d 'simple-tuple::NO_PADDING_8'
-// check:$15 = {-127, 127}
-// debugger:print 'simple-tuple::NO_PADDING_16'
-// check:$16 = {-10, 10, 9}
-// debugger:print 'simple-tuple::NO_PADDING_32'
-// check:$17 = {14, 15, 16}
-// debugger:print 'simple-tuple::NO_PADDING_64'
-// check:$18 = {17, 18, 19}
-
-// debugger:print 'simple-tuple::INTERNAL_PADDING_1'
-// check:$19 = {110, 111}
-// debugger:print 'simple-tuple::INTERNAL_PADDING_2'
-// check:$20 = {112, 113, 114, 115}
-
-// debugger:print 'simple-tuple::PADDING_AT_END'
-// check:$21 = {116, 117}
-
-#![allow(unused_variable)]
-#![allow(dead_code)]
-
-static mut NO_PADDING_8: (i8, u8) = (-50, 50);
-static mut NO_PADDING_16: (i16, i16, u16) = (-1, 2, 3);
-
-static mut NO_PADDING_32: (i32, f32, u32) = (4, 5.0, 6);
-static mut NO_PADDING_64: (i64, f64, u64) = (7, 8.0, 9);
-
-static mut INTERNAL_PADDING_1: (i16, i32) = (10, 11);
-static mut INTERNAL_PADDING_2: (i16, i32, u32, u64) = (12, 13, 14, 15);
-
-static mut PADDING_AT_END: (i32, i16) = (16, 17);
-
-fn main() {
- let noPadding8: (i8, u8) = (-100, 100);
- let noPadding16: (i16, i16, u16) = (0, 1, 2);
- let noPadding32: (i32, f32, u32) = (3, 4.5, 5);
- let noPadding64: (i64, f64, u64) = (6, 7.5, 8);
-
- let internalPadding1: (i16, i32) = (9, 10);
- let internalPadding2: (i16, i32, u32, u64) = (11, 12, 13, 14);
-
- let paddingAtEnd: (i32, i16) = (15, 16);
-
- unsafe {
- NO_PADDING_8 = (-127, 127);
- NO_PADDING_16 = (-10, 10, 9);
-
- NO_PADDING_32 = (14, 15.0, 16);
- NO_PADDING_64 = (17, 18.0, 19);
-
- INTERNAL_PADDING_1 = (110, 111);
- INTERNAL_PADDING_2 = (112, 113, 114, 115);
-
- PADDING_AT_END = (116, 117);
- }
-
- zzz();
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-
-// STRUCT
-// debugger:finish
-// debugger:print arg1
-// check:$1 = 1
-// debugger:print arg2
-// check:$2 = 2
-// debugger:continue
-
-// ENUM
-// debugger:finish
-// debugger:print arg1
-// check:$3 = -3
-// debugger:print arg2
-// check:$4 = 4.5
-// debugger:print arg3
-// check:$5 = 5
-// debugger:continue
-
-#![feature(struct_variant)]
-
-struct Struct {
- x: int
-}
-
-impl Struct {
-
- fn static_method(arg1: int, arg2: int) -> int {
- zzz();
- arg1 + arg2
- }
-}
-
-enum Enum {
- Variant1 { x: int },
- Variant2,
- Variant3(f64, int, char),
-}
-
-impl Enum {
-
- fn static_method(arg1: int, arg2: f64, arg3: uint) -> int {
- zzz();
- arg1
- }
-}
-
-fn main() {
- Struct::static_method(1, 2);
- Enum::static_method(-3, 4.5, 5);
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-tidy-linelength
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:set print union on
-// debugger:rbreak zzz
-// debugger:run
-// debugger:finish
-
-// debugger:print case1
-// check:$1 = {{Case1, 0, {x = 2088533116, y = 2088533116, z = 31868}}, {Case1, 0, 8970181431921507452, 31868}}
-
-// debugger:print case2
-// check:$2 = {{Case2, 0, {x = 286331153, y = 286331153, z = 4369}}, {Case2, 0, 1229782938247303441, 4369}}
-
-// debugger:print univariant
-// check:$3 = {{x = 123, y = 456, z = 789}}
-
-#![allow(unused_variable)]
-
-struct Struct {
- x: u32,
- y: i32,
- z: i16
-}
-
-// The first element is to ensure proper alignment, irrespective of the machines word size. Since
-// the size of the discriminant value is machine dependent, this has be taken into account when
-// datatype layout should be predictable as in this case.
-enum Regular {
- Case1(u64, Struct),
- Case2(u64, u64, i16)
-}
-
-enum Univariant {
- TheOnlyCase(Struct)
-}
-
-fn main() {
-
- // In order to avoid endianess trouble all of the following test values consist of a single
- // repeated byte. This way each interpretation of the union should look the same, no matter if
- // this is a big or little endian machine.
-
- // 0b0111110001111100011111000111110001111100011111000111110001111100 = 8970181431921507452
- // 0b01111100011111000111110001111100 = 2088533116
- // 0b0111110001111100 = 31868
- // 0b01111100 = 124
- let case1 = Case1(0, Struct { x: 2088533116, y: 2088533116, z: 31868 });
-
- // 0b0001000100010001000100010001000100010001000100010001000100010001 = 1229782938247303441
- // 0b00010001000100010001000100010001 = 286331153
- // 0b0001000100010001 = 4369
- // 0b00010001 = 17
- let case2 = Case2(0, 1229782938247303441, 4369);
-
- let univariant = TheOnlyCase(Struct { x: 123, y: 456, z: 789 });
-
- zzz();
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:set print pretty off
-// debugger:rbreak zzz
-// debugger:run
-// debugger:finish
-
-// debugger:print three_simple_structs
-// check:$1 = {x = {x = 1}, y = {x = 2}, z = {x = 3}}
-
-// debugger:print internal_padding_parent
-// check:$2 = {x = {x = 4, y = 5}, y = {x = 6, y = 7}, z = {x = 8, y = 9}}
-
-// debugger:print padding_at_end_parent
-// check:$3 = {x = {x = 10, y = 11}, y = {x = 12, y = 13}, z = {x = 14, y = 15}}
-
-#![allow(unused_variable)]
-
-struct Simple {
- x: i32
-}
-
-struct InternalPadding {
- x: i32,
- y: i64
-}
-
-struct PaddingAtEnd {
- x: i64,
- y: i32
-}
-
-struct ThreeSimpleStructs {
- x: Simple,
- y: Simple,
- z: Simple
-}
-
-struct InternalPaddingParent {
- x: InternalPadding,
- y: InternalPadding,
- z: InternalPadding
-}
-
-struct PaddingAtEndParent {
- x: PaddingAtEnd,
- y: PaddingAtEnd,
- z: PaddingAtEnd
-}
-
-struct Mixed {
- x: PaddingAtEnd,
- y: InternalPadding,
- z: Simple,
- w: i16
-}
-
-struct Bag {
- x: Simple
-}
-
-struct BagInBag {
- x: Bag
-}
-
-struct ThatsJustOverkill {
- x: BagInBag
-}
-
-struct Tree {
- x: Simple,
- y: InternalPaddingParent,
- z: BagInBag
-}
-
-fn main() {
-
- let three_simple_structs = ThreeSimpleStructs {
- x: Simple { x: 1 },
- y: Simple { x: 2 },
- z: Simple { x: 3 }
- };
-
- let internal_padding_parent = InternalPaddingParent {
- x: InternalPadding { x: 4, y: 5 },
- y: InternalPadding { x: 6, y: 7 },
- z: InternalPadding { x: 8, y: 9 }
- };
-
- let padding_at_end_parent = PaddingAtEndParent {
- x: PaddingAtEnd { x: 10, y: 11 },
- y: PaddingAtEnd { x: 12, y: 13 },
- z: PaddingAtEnd { x: 14, y: 15 }
- };
-
- let mixed = Mixed {
- x: PaddingAtEnd { x: 16, y: 17 },
- y: InternalPadding { x: 18, y: 19 },
- z: Simple { x: 20 },
- w: 21
- };
-
- let bag = Bag { x: Simple { x: 22 } };
- let bag_in_bag = BagInBag {
- x: Bag {
- x: Simple { x: 23 }
- }
- };
-
- let tjo = ThatsJustOverkill {
- x: BagInBag {
- x: Bag {
- x: Simple { x: 24 }
- }
- }
- };
-
- let tree = Tree {
- x: Simple { x: 25 },
- y: InternalPaddingParent {
- x: InternalPadding { x: 26, y: 27 },
- y: InternalPadding { x: 28, y: 29 },
- z: InternalPadding { x: 30, y: 31 }
- },
- z: BagInBag {
- x: Bag {
- x: Simple { x: 32 }
- }
- }
- };
-
- zzz();
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-tidy-linelength
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:set print union on
-// debugger:rbreak zzz
-// debugger:run
-// debugger:finish
-
-// debugger:print case1
-// check:$1 = {{Case1, a = 0, b = 31868, c = 31868, d = 31868, e = 31868}, {Case1, a = 0, b = 2088533116, c = 2088533116}, {Case1, a = 0, b = 8970181431921507452}}
-
-// debugger:print case2
-// check:$2 = {{Case2, a = 0, b = 4369, c = 4369, d = 4369, e = 4369}, {Case2, a = 0, b = 286331153, c = 286331153}, {Case2, a = 0, b = 1229782938247303441}}
-
-// debugger:print case3
-// check:$3 = {{Case3, a = 0, b = 22873, c = 22873, d = 22873, e = 22873}, {Case3, a = 0, b = 1499027801, c = 1499027801}, {Case3, a = 0, b = 6438275382588823897}}
-
-// debugger:print univariant
-// check:$4 = {a = -1}
-
-#![allow(unused_variable)]
-#![feature(struct_variant)]
-
-// The first element is to ensure proper alignment, irrespective of the machines word size. Since
-// the size of the discriminant value is machine dependent, this has be taken into account when
-// datatype layout should be predictable as in this case.
-enum Regular {
- Case1 { a: u64, b: u16, c: u16, d: u16, e: u16},
- Case2 { a: u64, b: u32, c: u32},
- Case3 { a: u64, b: u64 }
-}
-
-enum Univariant {
- TheOnlyCase { a: i64 }
-}
-
-fn main() {
-
- // In order to avoid endianess trouble all of the following test values consist of a single
- // repeated byte. This way each interpretation of the union should look the same, no matter if
- // this is a big or little endian machine.
-
- // 0b0111110001111100011111000111110001111100011111000111110001111100 = 8970181431921507452
- // 0b01111100011111000111110001111100 = 2088533116
- // 0b0111110001111100 = 31868
- // 0b01111100 = 124
- let case1 = Case1 { a: 0, b: 31868, c: 31868, d: 31868, e: 31868 };
-
- // 0b0001000100010001000100010001000100010001000100010001000100010001 = 1229782938247303441
- // 0b00010001000100010001000100010001 = 286331153
- // 0b0001000100010001 = 4369
- // 0b00010001 = 17
- let case2 = Case2 { a: 0, b: 286331153, c: 286331153 };
-
- // 0b0101100101011001010110010101100101011001010110010101100101011001 = 6438275382588823897
- // 0b01011001010110010101100101011001 = 1499027801
- // 0b0101100101011001 = 22873
- // 0b01011001 = 89
- let case3 = Case3 { a: 0, b: 6438275382588823897 };
-
- let univariant = TheOnlyCase { a: -1 };
-
- zzz();
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-// debugger:finish
-// debugger:print simple
-// check:$1 = {x = 10, y = 20}
-
-// debugger:print noDestructor
-// check:$2 = {a = {x = 10, y = 20}, guard = -1}
-
-// debugger:print withDestructor
-// check:$3 = {a = {x = 10, y = 20}, guard = -1}
-
-// debugger:print nested
-// check:$4 = {a = {a = {x = 7890, y = 9870}}}
-
-#![allow(unused_variable)]
-
-struct NoDestructor {
- x: i32,
- y: i64
-}
-
-struct WithDestructor {
- x: i32,
- y: i64
-}
-
-impl Drop for WithDestructor {
- fn drop(&mut self) {}
-}
-
-struct NoDestructorGuarded {
- a: NoDestructor,
- guard: i64
-}
-
-struct WithDestructorGuarded {
- a: WithDestructor,
- guard: i64
-}
-
-struct NestedInner {
- a: WithDestructor
-}
-
-impl Drop for NestedInner {
- fn drop(&mut self) {}
-}
-
-struct NestedOuter {
- a: NestedInner
-}
-
-
-// The compiler adds a 'destructed' boolean field to structs implementing Drop. This field is used
-// at runtime to prevent drop() to be executed more than once (see middle::trans::adt).
-// This field must be incorporated by the debug info generation. Otherwise the debugger assumes a
-// wrong size/layout for the struct.
-fn main() {
-
- let simple = WithDestructor { x: 10, y: 20 };
-
- let noDestructor = NoDestructorGuarded {
- a: NoDestructor { x: 10, y: 20 },
- guard: -1
- };
-
- // If the destructor flag field is not incorporated into the debug info for 'WithDestructor'
- // then the debugger will have an invalid offset for the field 'guard' and thus should not be
- // able to read its value correctly (dots are padding bytes, D is the boolean destructor flag):
- //
- // 64 bit
- //
- // NoDestructorGuarded = 0000....00000000FFFFFFFF
- // <--------------><------>
- // NoDestructor guard
- //
- //
- // withDestructorGuarded = 0000....00000000D.......FFFFFFFF
- // <--------------><------> // How debug info says it is
- // WithDestructor guard
- //
- // <----------------------><------> // How it actually is
- // WithDestructor guard
- //
- // 32 bit
- //
- // NoDestructorGuarded = 000000000000FFFFFFFF
- // <----------><------>
- // NoDestructor guard
- //
- //
- // withDestructorGuarded = 000000000000D...FFFFFFFF
- // <----------><------> // How debug info says it is
- // WithDestructor guard
- //
- // <--------------><------> // How it actually is
- // WithDestructor guard
- //
- let withDestructor = WithDestructorGuarded {
- a: WithDestructor { x: 10, y: 20 },
- guard: -1
- };
-
- // expected layout (64 bit) = xxxx....yyyyyyyyD.......D...
- // <--WithDestructor------>
- // <-------NestedInner-------->
- // <-------NestedOuter-------->
- let nested = NestedOuter { a: NestedInner { a: WithDestructor { x: 7890, y: 9870 } } };
-
- zzz();
-}
-
-fn zzz() {()}
+++ /dev/null
-some text to include in another file as string 1
\ No newline at end of file
+++ /dev/null
-some text to include in another file as string 2
\ No newline at end of file
+++ /dev/null
-some text to include in another file as string 3
\ No newline at end of file
+++ /dev/null
-// ignore-test
-
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-
-// debugger:finish
-// debugger:print arg1
-// check:$1 = 1000
-// debugger:print arg2
-// check:$2 = 0.5
-// debugger:continue
-
-// debugger:finish
-// debugger:print arg1
-// check:$3 = 2000
-// debugger:print *arg2
-// check:$4 = {1, 2, 3}
-// debugger:continue
-
-
-struct Struct {
- x: int
-}
-
-trait Trait {
- fn generic_static_default_method<T>(arg1: int, arg2: T) -> int {
- zzz();
- arg1
- }
-}
-
-impl Trait for Struct {}
-
-fn main() {
-
- // Is this really how to use these?
- Trait::generic_static_default_method::<Struct, float>(1000, 0.5);
- Trait::generic_static_default_method::<Struct, &(int, int, int)>(2000, &(1, 2, 3));
-
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:run
-
-#![allow(unused_variable)]
-
-
-trait Trait {
- fn method(&self) -> int { 0 }
-}
-
-struct Struct {
- a: int,
- b: f64
-}
-
-impl Trait for Struct {}
-
-// There is no real test here yet. Just make sure that it compiles without crashing.
-fn main() {
- let stack_struct = Struct { a:0, b: 1.0 };
- let reference: &Trait = &stack_struct as &Trait;
- let unique: Box<Trait> = box Struct { a:2, b: 3.0 } as Box<Trait>;
-}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:set print pretty off
-// debugger:rbreak zzz
-// debugger:run
-// debugger:finish
-
-// debugger:print no_padding1
-// check:$1 = {x = {0, 1}, y = 2, z = {3, 4, 5}}
-// debugger:print no_padding2
-// check:$2 = {x = {6, 7}, y = {{8, 9}, 10}}
-
-// debugger:print tuple_internal_padding
-// check:$3 = {x = {11, 12}, y = {13, 14}}
-// debugger:print struct_internal_padding
-// check:$4 = {x = {15, 16}, y = {17, 18}}
-// debugger:print both_internally_padded
-// check:$5 = {x = {19, 20, 21}, y = {22, 23}}
-
-// debugger:print single_tuple
-// check:$6 = {x = {24, 25, 26}}
-
-// debugger:print tuple_padded_at_end
-// check:$7 = {x = {27, 28}, y = {29, 30}}
-// debugger:print struct_padded_at_end
-// check:$8 = {x = {31, 32}, y = {33, 34}}
-// debugger:print both_padded_at_end
-// check:$9 = {x = {35, 36, 37}, y = {38, 39}}
-
-// debugger:print mixed_padding
-// check:$10 = {x = {{40, 41, 42}, {43, 44}}, y = {45, 46, 47, 48}}
-
-#![allow(unused_variable)]
-
-struct NoPadding1 {
- x: (i32, i32),
- y: i32,
- z: (i32, i32, i32)
-}
-
-struct NoPadding2 {
- x: (i32, i32),
- y: ((i32, i32), i32)
-}
-
-struct TupleInternalPadding {
- x: (i16, i32),
- y: (i32, i64)
-}
-
-struct StructInternalPadding {
- x: (i16, i16),
- y: (i64, i64)
-}
-
-struct BothInternallyPadded {
- x: (i16, i32, i32),
- y: (i32, i64)
-}
-
-struct SingleTuple {
- x: (i16, i32, i64)
-}
-
-struct TuplePaddedAtEnd {
- x: (i32, i16),
- y: (i64, i32)
-}
-
-struct StructPaddedAtEnd {
- x: (i64, i64),
- y: (i16, i16)
-}
-
-struct BothPaddedAtEnd {
- x: (i32, i32, i16),
- y: (i64, i32)
-}
-
-// Data-layout (padding signified by dots, one column = 2 bytes):
-// [a.bbc...ddddee..ffffg.hhi...]
-struct MixedPadding {
- x: ((i16, i32, i16), (i64, i32)),
- y: (i64, i16, i32, i16)
-}
-
-
-fn main() {
- let no_padding1 = NoPadding1 {
- x: (0, 1),
- y: 2,
- z: (3, 4, 5)
- };
-
- let no_padding2 = NoPadding2 {
- x: (6, 7),
- y: ((8, 9), 10)
- };
-
- let tuple_internal_padding = TupleInternalPadding {
- x: (11, 12),
- y: (13, 14)
- };
-
- let struct_internal_padding = StructInternalPadding {
- x: (15, 16),
- y: (17, 18)
- };
-
- let both_internally_padded = BothInternallyPadded {
- x: (19, 20, 21),
- y: (22, 23)
- };
-
- let single_tuple = SingleTuple {
- x: (24, 25, 26)
- };
-
- let tuple_padded_at_end = TuplePaddedAtEnd {
- x: (27, 28),
- y: (29, 30)
- };
-
- let struct_padded_at_end = StructPaddedAtEnd {
- x: (31, 32),
- y: (33, 34)
- };
-
- let both_padded_at_end = BothPaddedAtEnd {
- x: (35, 36, 37),
- y: (38, 39)
- };
-
- let mixed_padding = MixedPadding {
- x: ((40, 41, 42), (43, 44)),
- y: (45, 46, 47, 48)
- };
-
- zzz();
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:set print pretty off
-// debugger:rbreak zzz
-// debugger:run
-// debugger:finish
-
-// debugger:print no_padding1
-// check:$1 = {{0, 1}, 2, 3}
-// debugger:print no_padding2
-// check:$2 = {4, {5, 6}, 7}
-// debugger:print no_padding3
-// check:$3 = {8, 9, {10, 11}}
-
-// debugger:print internal_padding1
-// check:$4 = {12, {13, 14}}
-// debugger:print internal_padding2
-// check:$5 = {15, {16, 17}}
-
-// debugger:print padding_at_end1
-// check:$6 = {18, {19, 20}}
-// debugger:print padding_at_end2
-// check:$7 = {{21, 22}, 23}
-
-#![allow(unused_variable)]
-
-fn main() {
- let no_padding1: ((u32, u32), u32, u32) = ((0, 1), 2, 3);
- let no_padding2: (u32, (u32, u32), u32) = (4, (5, 6), 7);
- let no_padding3: (u32, u32, (u32, u32)) = (8, 9, (10, 11));
-
- let internal_padding1: (i16, (i32, i32)) = (12, (13, 14));
- let internal_padding2: (i16, (i16, i32)) = (15, (16, 17));
-
- let padding_at_end1: (i32, (i32, i16)) = (18, (19, 20));
- let padding_at_end2: ((i32, i16), i32) = ((21, 22), 23);
-
- zzz();
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:set print pretty off
-// debugger:rbreak zzz
-// debugger:run
-// debugger:finish
-
-// debugger:print no_padding16
-// check:$1 = {10000, -10001}
-
-// debugger:print no_padding32
-// check:$2 = {-10002, -10003.5, 10004}
-
-// debugger:print no_padding64
-// check:$3 = {-10005.5, 10006, 10007}
-
-// debugger:print no_padding163264
-// check:$4 = {-10008, 10009, 10010, 10011}
-
-// debugger:print internal_padding
-// check:$5 = {10012, -10013}
-
-// debugger:print padding_at_end
-// check:$6 = {-10014, 10015}
-
-
-// This test case mainly makes sure that no field names are generated for tuple structs (as opposed
-// to all fields having the name "<unnamed_field>"). Otherwise they are handled the same a normal
-// structs.
-
-struct NoPadding16(u16, i16);
-struct NoPadding32(i32, f32, u32);
-struct NoPadding64(f64, i64, u64);
-struct NoPadding163264(i16, u16, i32, u64);
-struct InternalPadding(u16, i64);
-struct PaddingAtEnd(i64, u16);
-
-fn main() {
- let no_padding16 = NoPadding16(10000, -10001);
- let no_padding32 = NoPadding32(-10002, -10003.5, 10004);
- let no_padding64 = NoPadding64(-10005.5, 10006, 10007);
- let no_padding163264 = NoPadding163264(-10008, 10009, 10010, 10011);
-
- let internal_padding = InternalPadding(10012, -10013);
- let padding_at_end = PaddingAtEnd(-10014, 10015);
-
- zzz();
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-tidy-linelength
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:set print union on
-// debugger:rbreak zzz
-// debugger:run
-// debugger:finish
-
-// debugger:print case1
-// check:$1 = {{Case1, 0, 31868, 31868, 31868, 31868}, {Case1, 0, 2088533116, 2088533116}, {Case1, 0, 8970181431921507452}}
-
-// debugger:print case2
-// check:$2 = {{Case2, 0, 4369, 4369, 4369, 4369}, {Case2, 0, 286331153, 286331153}, {Case2, 0, 1229782938247303441}}
-
-// debugger:print case3
-// check:$3 = {{Case3, 0, 22873, 22873, 22873, 22873}, {Case3, 0, 1499027801, 1499027801}, {Case3, 0, 6438275382588823897}}
-
-// debugger:print univariant
-// check:$4 = {-1}
-
-#![allow(unused_variable)]
-
-// The first element is to ensure proper alignment, irrespective of the machines word size. Since
-// the size of the discriminant value is machine dependent, this has be taken into account when
-// datatype layout should be predictable as in this case.
-enum Regular {
- Case1(u64, u16, u16, u16, u16),
- Case2(u64, u32, u32),
- Case3(u64, u64)
-}
-
-enum Univariant {
- TheOnlyCase(i64)
-}
-
-fn main() {
-
- // In order to avoid endianess trouble all of the following test values consist of a single
- // repeated byte. This way each interpretation of the union should look the same, no matter if
- // this is a big or little endian machine.
-
- // 0b0111110001111100011111000111110001111100011111000111110001111100 = 8970181431921507452
- // 0b01111100011111000111110001111100 = 2088533116
- // 0b0111110001111100 = 31868
- // 0b01111100 = 124
- let case1 = Case1(0, 31868, 31868, 31868, 31868);
-
- // 0b0001000100010001000100010001000100010001000100010001000100010001 = 1229782938247303441
- // 0b00010001000100010001000100010001 = 286331153
- // 0b0001000100010001 = 4369
- // 0b00010001 = 17
- let case2 = Case2(0, 286331153, 286331153);
-
- // 0b0101100101011001010110010101100101011001010110010101100101011001 = 6438275382588823897
- // 0b01011001010110010101100101011001 = 1499027801
- // 0b0101100101011001 = 22873
- // 0b01011001 = 89
- let case3 = Case3(0, 6438275382588823897);
-
- let univariant = TheOnlyCase(-1);
-
- zzz();
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-// debugger:finish
-
-// debugger:print *the_a
-// check:$1 = {{TheA, x = 0, y = 8970181431921507452}, {TheA, 0, 2088533116, 2088533116}}
-
-// debugger:print *the_b
-// check:$2 = {{TheB, x = 0, y = 1229782938247303441}, {TheB, 0, 286331153, 286331153}}
-
-// debugger:print *univariant
-// check:$3 = {123234}
-
-#![allow(unused_variable)]
-#![feature(struct_variant)]
-
-// The first element is to ensure proper alignment, irrespective of the machines word size. Since
-// the size of the discriminant value is machine dependent, this has be taken into account when
-// datatype layout should be predictable as in this case.
-enum ABC {
- TheA { x: i64, y: i64 },
- TheB (i64, i32, i32),
-}
-
-// This is a special case since it does not have the implicit discriminant field.
-enum Univariant {
- TheOnlyCase(i64)
-}
-
-fn main() {
-
- // In order to avoid endianess trouble all of the following test values consist of a single
- // repeated byte. This way each interpretation of the union should look the same, no matter if
- // this is a big or little endian machine.
-
- // 0b0111110001111100011111000111110001111100011111000111110001111100 = 8970181431921507452
- // 0b01111100011111000111110001111100 = 2088533116
- // 0b0111110001111100 = 31868
- // 0b01111100 = 124
- let the_a = box TheA { x: 0, y: 8970181431921507452 };
-
- // 0b0001000100010001000100010001000100010001000100010001000100010001 = 1229782938247303441
- // 0b00010001000100010001000100010001 = 286331153
- // 0b0001000100010001 = 4369
- // 0b00010001 = 17
- let the_b = box TheB (0, 286331153, 286331153);
-
- let univariant = box TheOnlyCase(123234);
-
- zzz();
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-// debugger:finish
-
-// debugger:print variable
-// check:$1 = 1
-// debugger:print constant
-// check:$2 = 2
-// debugger:print a_struct
-// check:$3 = {a = -3, b = 4.5, c = 5}
-// debugger:print *struct_ref
-// check:$4 = {a = -3, b = 4.5, c = 5}
-// debugger:print *owned
-// check:$5 = 6
-// debugger:print managed->val
-// check:$6 = 7
-// debugger:print closure_local
-// check:$7 = 8
-// debugger:continue
-
-// debugger:finish
-// debugger:print variable
-// check:$8 = 1
-// debugger:print constant
-// check:$9 = 2
-// debugger:print a_struct
-// check:$10 = {a = -3, b = 4.5, c = 5}
-// debugger:print *struct_ref
-// check:$11 = {a = -3, b = 4.5, c = 5}
-// debugger:print *owned
-// check:$12 = 6
-// debugger:print managed->val
-// check:$13 = 7
-// debugger:print closure_local
-// check:$14 = 8
-// debugger:continue
-
-#![feature(managed_boxes)]
-#![allow(unused_variable)]
-
-struct Struct {
- a: int,
- b: f64,
- c: uint
-}
-
-fn main() {
- let mut variable = 1;
- let constant = 2;
-
- let a_struct = Struct {
- a: -3,
- b: 4.5,
- c: 5
- };
-
- let struct_ref = &a_struct;
- let owned = box 6;
- let managed = @7;
-
- let closure = || {
- let closure_local = 8;
-
- let nested_closure = || {
- zzz();
- variable = constant + a_struct.a + struct_ref.a + *owned + *managed + closure_local;
- };
-
- zzz();
-
- nested_closure();
- };
-
- closure();
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-// debugger:finish
-
-// debugger:print constant
-// check:$1 = 1
-// debugger:print a_struct
-// check:$2 = {a = -2, b = 3.5, c = 4}
-// debugger:print *owned
-// check:$3 = 5
-
-#![allow(unused_variable)]
-
-struct Struct {
- a: int,
- b: f64,
- c: uint
-}
-
-fn main() {
- let constant = 1;
-
- let a_struct = Struct {
- a: -2,
- b: 3.5,
- c: 4
- };
-
- let owned = box 5;
-
- let closure: proc() = proc() {
- zzz();
- do_something(&constant, &a_struct.a, owned);
- };
-
- closure();
-}
-
-fn do_something(_: &int, _:&int, _:&int) {
-
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-// debugger:finish
-
-// debugger:print variable
-// check:$1 = 1
-// debugger:print constant
-// check:$2 = 2
-// debugger:print a_struct
-// check:$3 = {a = -3, b = 4.5, c = 5}
-// debugger:print *struct_ref
-// check:$4 = {a = -3, b = 4.5, c = 5}
-// debugger:print *owned
-// check:$5 = 6
-// debugger:print managed->val
-// check:$6 = 7
-
-#![feature(managed_boxes)]
-#![allow(unused_variable)]
-
-struct Struct {
- a: int,
- b: f64,
- c: uint
-}
-
-fn main() {
- let mut variable = 1;
- let constant = 2;
-
- let a_struct = Struct {
- a: -3,
- b: 4.5,
- c: 5
- };
-
- let struct_ref = &a_struct;
- let owned = box 6;
- let managed = @7;
-
- let closure = || {
- zzz();
- variable = constant + a_struct.a + struct_ref.a + *owned + *managed;
- };
-
- closure();
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-win32: FIXME #13256
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:set print pretty off
-// debugger:rbreak zzz
-// debugger:run
-// debugger:finish
-// debugger:print empty.length
-// check:$1 = 0
-
-// debugger:print singleton.length
-// check:$2 = 1
-// debugger:print *((int64_t[1]*)(singleton.data_ptr))
-// check:$3 = {1}
-
-// debugger:print multiple.length
-// check:$4 = 4
-// debugger:print *((int64_t[4]*)(multiple.data_ptr))
-// check:$5 = {2, 3, 4, 5}
-
-// debugger:print slice_of_slice.length
-// check:$6 = 2
-// debugger:print *((int64_t[2]*)(slice_of_slice.data_ptr))
-// check:$7 = {3, 4}
-
-// debugger:print padded_tuple.length
-// check:$8 = 2
-// debugger:print padded_tuple.data_ptr[0]
-// check:$9 = {6, 7}
-// debugger:print padded_tuple.data_ptr[1]
-// check:$10 = {8, 9}
-
-// debugger:print padded_struct.length
-// check:$11 = 2
-// debugger:print padded_struct.data_ptr[0]
-// check:$12 = {x = 10, y = 11, z = 12}
-// debugger:print padded_struct.data_ptr[1]
-// check:$13 = {x = 13, y = 14, z = 15}
-
-// debugger:print 'vec-slices::MUT_VECT_SLICE'.length
-// check:$14 = 2
-// debugger:print *((int64_t[2]*)('vec-slices::MUT_VECT_SLICE'.data_ptr))
-// check:$15 = {64, 65}
-
-#![allow(unused_variable)]
-
-struct AStruct {
- x: i16,
- y: i32,
- z: i16
-}
-
-static VECT_SLICE: &'static [i64] = &[64, 65];
-static mut MUT_VECT_SLICE: &'static [i64] = &[32];
-
-fn main() {
- let empty: &[i64] = &[];
- let singleton: &[i64] = &[1];
- let multiple: &[i64] = &[2, 3, 4, 5];
- let slice_of_slice = multiple.slice(1,3);
-
- let padded_tuple: &[(i32, i16)] = &[(6, 7), (8, 9)];
-
- let padded_struct: &[AStruct] = &[
- AStruct { x: 10, y: 11, z: 12 },
- AStruct { x: 13, y: 14, z: 15 }
- ];
-
- unsafe {
- MUT_VECT_SLICE = VECT_SLICE;
- }
-
- zzz();
-}
-
-fn zzz() {()}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-win32: FIXME #13256
-// ignore-android: FIXME(#10381)
-
-// compile-flags:-g
-// debugger:set print pretty off
-// debugger:rbreak zzz
-// debugger:run
-// debugger:finish
-// debugger:print a
-// check:$1 = {1, 2, 3}
-// debugger:print vec::VECT
-// check:$2 = {4, 5, 6}
-
-#![allow(unused_variable)]
-
-static mut VECT: [i32, ..3] = [1, 2, 3];
-
-fn main() {
- let a = [1, 2, 3];
-
- unsafe {
- VECT[0] = 4;
- VECT[1] = 5;
- VECT[2] = 6;
- }
-
- zzz();
-}
-
-fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-win32: FIXME #13256
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+// gdb-command:finish
+// gdb-command:whatis 'basic-types-globals-metadata::B'
+// gdb-check:type = bool
+// gdb-command:whatis 'basic-types-globals-metadata::I'
+// gdb-check:type = int
+// gdb-command:whatis 'basic-types-globals-metadata::C'
+// gdb-check:type = char
+// gdb-command:whatis 'basic-types-globals-metadata::I8'
+// gdb-check:type = i8
+// gdb-command:whatis 'basic-types-globals-metadata::I16'
+// gdb-check:type = i16
+// gdb-command:whatis 'basic-types-globals-metadata::I32'
+// gdb-check:type = i32
+// gdb-command:whatis 'basic-types-globals-metadata::I64'
+// gdb-check:type = i64
+// gdb-command:whatis 'basic-types-globals-metadata::U'
+// gdb-check:type = uint
+// gdb-command:whatis 'basic-types-globals-metadata::U8'
+// gdb-check:type = u8
+// gdb-command:whatis 'basic-types-globals-metadata::U16'
+// gdb-check:type = u16
+// gdb-command:whatis 'basic-types-globals-metadata::U32'
+// gdb-check:type = u32
+// gdb-command:whatis 'basic-types-globals-metadata::U64'
+// gdb-check:type = u64
+// gdb-command:whatis 'basic-types-globals-metadata::F32'
+// gdb-check:type = f32
+// gdb-command:whatis 'basic-types-globals-metadata::F64'
+// gdb-check:type = f64
+// gdb-command:continue
+
+#![allow(unused_variable)]
+#![allow(dead_code)]
+
+
+static B: bool = false;
+static I: int = -1;
+static C: char = 'a';
+static I8: i8 = 68;
+static I16: i16 = -16;
+static I32: i32 = -32;
+static I64: i64 = -64;
+static U: uint = 1;
+static U8: u8 = 100;
+static U16: u16 = 16;
+static U32: u32 = 32;
+static U64: u64 = 64;
+static F32: f32 = 2.5;
+static F64: f64 = 3.5;
+
+fn main() {
+ _zzz();
+
+ let a = (B, I, C, I8, I16, I32, I64, U, U8, U16, U32, U64, F32, F64);
+}
+
+fn _zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Caveats - gdb prints any 8-bit value (meaning rust I8 and u8 values)
+// as its numerical value along with its associated ASCII char, there
+// doesn't seem to be any way around this. Also, gdb doesn't know
+// about UTF-32 character encoding and will print a rust char as only
+// its numerical value.
+
+// ignore-win32: FIXME #13256
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+// gdb-command:finish
+// gdb-command:print 'basic-types-globals::B'
+// gdb-check:$1 = false
+// gdb-command:print 'basic-types-globals::I'
+// gdb-check:$2 = -1
+// gdb-command:print 'basic-types-globals::C'
+// gdb-check:$3 = 97
+// gdb-command:print/d 'basic-types-globals::I8'
+// gdb-check:$4 = 68
+// gdb-command:print 'basic-types-globals::I16'
+// gdb-check:$5 = -16
+// gdb-command:print 'basic-types-globals::I32'
+// gdb-check:$6 = -32
+// gdb-command:print 'basic-types-globals::I64'
+// gdb-check:$7 = -64
+// gdb-command:print 'basic-types-globals::U'
+// gdb-check:$8 = 1
+// gdb-command:print/d 'basic-types-globals::U8'
+// gdb-check:$9 = 100
+// gdb-command:print 'basic-types-globals::U16'
+// gdb-check:$10 = 16
+// gdb-command:print 'basic-types-globals::U32'
+// gdb-check:$11 = 32
+// gdb-command:print 'basic-types-globals::U64'
+// gdb-check:$12 = 64
+// gdb-command:print 'basic-types-globals::F32'
+// gdb-check:$13 = 2.5
+// gdb-command:print 'basic-types-globals::F64'
+// gdb-check:$14 = 3.5
+// gdb-command:continue
+
+#![allow(unused_variable)]
+
+static B: bool = false;
+static I: int = -1;
+static C: char = 'a';
+static I8: i8 = 68;
+static I16: i16 = -16;
+static I32: i32 = -32;
+static I64: i64 = -64;
+static U: uint = 1;
+static U8: u8 = 100;
+static U16: u16 = 16;
+static U32: u32 = 32;
+static U64: u64 = 64;
+static F32: f32 = 2.5;
+static F64: f64 = 3.5;
+
+fn main() {
+ _zzz();
+
+ let a = (B, I, C, I8, I16, I32, I64, U, U8, U16, U32, U64, F32, F64);
+}
+
+fn _zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+// gdb-command:finish
+// gdb-command:whatis unit
+// gdb-check:type = ()
+// gdb-command:whatis b
+// gdb-check:type = bool
+// gdb-command:whatis i
+// gdb-check:type = int
+// gdb-command:whatis c
+// gdb-check:type = char
+// gdb-command:whatis i8
+// gdb-check:type = i8
+// gdb-command:whatis i16
+// gdb-check:type = i16
+// gdb-command:whatis i32
+// gdb-check:type = i32
+// gdb-command:whatis i64
+// gdb-check:type = i64
+// gdb-command:whatis u
+// gdb-check:type = uint
+// gdb-command:whatis u8
+// gdb-check:type = u8
+// gdb-command:whatis u16
+// gdb-check:type = u16
+// gdb-command:whatis u32
+// gdb-check:type = u32
+// gdb-command:whatis u64
+// gdb-check:type = u64
+// gdb-command:whatis f32
+// gdb-check:type = f32
+// gdb-command:whatis f64
+// gdb-check:type = f64
+// gdb-command:info functions _yyy
+// gdb-check:[...]![...]_yyy([...])([...]);
+// gdb-command:continue
+
+#![allow(unused_variable)]
+
+fn main() {
+ let unit: () = ();
+ let b: bool = false;
+ let i: int = -1;
+ let c: char = 'a';
+ let i8: i8 = 68;
+ let i16: i16 = -16;
+ let i32: i32 = -32;
+ let i64: i64 = -64;
+ let u: uint = 1;
+ let u8: u8 = 100;
+ let u16: u16 = 16;
+ let u32: u32 = 32;
+ let u64: u64 = 64;
+ let f32: f32 = 2.5;
+ let f64: f64 = 3.5;
+ _zzz();
+ if 1 == 1 { _yyy(); }
+}
+
+fn _zzz() {()}
+fn _yyy() -> ! {fail!()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Caveats - gdb prints any 8-bit value (meaning rust I8 and u8 values)
+// as its numerical value along with its associated ASCII char, there
+// doesn't seem to be any way around this. Also, gdb doesn't know
+// about UTF-32 character encoding and will print a rust char as only
+// its numerical value.
+
+// ignore-win32: FIXME #13256
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+// gdb-command:finish
+
+// Check initializers
+// gdb-command:print 'basic-types-mut-globals::B'
+// gdb-check:$1 = false
+// gdb-command:print 'basic-types-mut-globals::I'
+// gdb-check:$2 = -1
+// gdb-command:print 'basic-types-mut-globals::C'
+// gdb-check:$3 = 97
+// gdb-command:print/d 'basic-types-mut-globals::I8'
+// gdb-check:$4 = 68
+// gdb-command:print 'basic-types-mut-globals::I16'
+// gdb-check:$5 = -16
+// gdb-command:print 'basic-types-mut-globals::I32'
+// gdb-check:$6 = -32
+// gdb-command:print 'basic-types-mut-globals::I64'
+// gdb-check:$7 = -64
+// gdb-command:print 'basic-types-mut-globals::U'
+// gdb-check:$8 = 1
+// gdb-command:print/d 'basic-types-mut-globals::U8'
+// gdb-check:$9 = 100
+// gdb-command:print 'basic-types-mut-globals::U16'
+// gdb-check:$10 = 16
+// gdb-command:print 'basic-types-mut-globals::U32'
+// gdb-check:$11 = 32
+// gdb-command:print 'basic-types-mut-globals::U64'
+// gdb-check:$12 = 64
+// gdb-command:print 'basic-types-mut-globals::F32'
+// gdb-check:$13 = 2.5
+// gdb-command:print 'basic-types-mut-globals::F64'
+// gdb-check:$14 = 3.5
+// gdb-command:continue
+
+// Check new values
+// gdb-command:print 'basic-types-mut-globals'::B
+// gdb-check:$15 = true
+// gdb-command:print 'basic-types-mut-globals'::I
+// gdb-check:$16 = 2
+// gdb-command:print 'basic-types-mut-globals'::C
+// gdb-check:$17 = 102
+// gdb-command:print/d 'basic-types-mut-globals'::I8
+// gdb-check:$18 = 78
+// gdb-command:print 'basic-types-mut-globals'::I16
+// gdb-check:$19 = -26
+// gdb-command:print 'basic-types-mut-globals'::I32
+// gdb-check:$20 = -12
+// gdb-command:print 'basic-types-mut-globals'::I64
+// gdb-check:$21 = -54
+// gdb-command:print 'basic-types-mut-globals'::U
+// gdb-check:$22 = 5
+// gdb-command:print/d 'basic-types-mut-globals'::U8
+// gdb-check:$23 = 20
+// gdb-command:print 'basic-types-mut-globals'::U16
+// gdb-check:$24 = 32
+// gdb-command:print 'basic-types-mut-globals'::U32
+// gdb-check:$25 = 16
+// gdb-command:print 'basic-types-mut-globals'::U64
+// gdb-check:$26 = 128
+// gdb-command:print 'basic-types-mut-globals'::F32
+// gdb-check:$27 = 5.75
+// gdb-command:print 'basic-types-mut-globals'::F64
+// gdb-check:$28 = 9.25
+
+// gdb-command:detach
+// gdb-command:quit
+
+#![allow(unused_variable)]
+
+static mut B: bool = false;
+static mut I: int = -1;
+static mut C: char = 'a';
+static mut I8: i8 = 68;
+static mut I16: i16 = -16;
+static mut I32: i32 = -32;
+static mut I64: i64 = -64;
+static mut U: uint = 1;
+static mut U8: u8 = 100;
+static mut U16: u16 = 16;
+static mut U32: u32 = 32;
+static mut U64: u64 = 64;
+static mut F32: f32 = 2.5;
+static mut F64: f64 = 3.5;
+
+fn main() {
+ _zzz();
+
+ unsafe {
+ B = true;
+ I = 2;
+ C = 'f';
+ I8 = 78;
+ I16 = -26;
+ I32 = -12;
+ I64 = -54;
+ U = 5;
+ U8 = 20;
+ U16 = 32;
+ U32 = 16;
+ U64 = 128;
+ F32 = 5.75;
+ F64 = 9.25;
+ }
+
+ _zzz();
+}
+
+fn _zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Caveats - gdb prints any 8-bit value (meaning rust i8 and u8 values)
+// as its numerical value along with its associated ASCII char, there
+// doesn't seem to be any way around this. Also, gdb doesn't know
+// about UTF-32 character encoding and will print a rust char as only
+// its numerical value.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+// gdb-command:finish
+// gdb-command:print b
+// gdb-check:$1 = false
+// gdb-command:print i
+// gdb-check:$2 = -1
+// gdb-command:print c
+// gdb-check:$3 = 97
+// gdb-command:print/d i8
+// gdb-check:$4 = 68
+// gdb-command:print i16
+// gdb-check:$5 = -16
+// gdb-command:print i32
+// gdb-check:$6 = -32
+// gdb-command:print i64
+// gdb-check:$7 = -64
+// gdb-command:print u
+// gdb-check:$8 = 1
+// gdb-command:print/d u8
+// gdb-check:$9 = 100
+// gdb-command:print u16
+// gdb-check:$10 = 16
+// gdb-command:print u32
+// gdb-check:$11 = 32
+// gdb-command:print u64
+// gdb-check:$12 = 64
+// gdb-command:print f32
+// gdb-check:$13 = 2.5
+// gdb-command:print f64
+// gdb-check:$14 = 3.5
+
+#![allow(unused_variable)]
+
+fn main() {
+ let b: bool = false;
+ let i: int = -1;
+ let c: char = 'a';
+ let i8: i8 = 68;
+ let i16: i16 = -16;
+ let i32: i32 = -32;
+ let i64: i64 = -64;
+ let u: uint = 1;
+ let u8: u8 = 100;
+ let u16: u16 = 16;
+ let u32: u32 = 32;
+ let u64: u64 = 64;
+ let f32: f32 = 2.5;
+ let f64: f64 = 3.5;
+ _zzz();
+}
+
+fn _zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// Gdb doesn't know about UTF-32 character encoding and will print a rust char as only
+// its numerical value.
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+// gdb-command:finish
+// gdb-command:print *bool_ref
+// gdb-check:$1 = true
+
+// gdb-command:print *int_ref
+// gdb-check:$2 = -1
+
+// gdb-command:print *char_ref
+// gdb-check:$3 = 97
+
+// gdb-command:print *i8_ref
+// gdb-check:$4 = 68 'D'
+
+// gdb-command:print *i16_ref
+// gdb-check:$5 = -16
+
+// gdb-command:print *i32_ref
+// gdb-check:$6 = -32
+
+// gdb-command:print *i64_ref
+// gdb-check:$7 = -64
+
+// gdb-command:print *uint_ref
+// gdb-check:$8 = 1
+
+// gdb-command:print *u8_ref
+// gdb-check:$9 = 100 'd'
+
+// gdb-command:print *u16_ref
+// gdb-check:$10 = 16
+
+// gdb-command:print *u32_ref
+// gdb-check:$11 = 32
+
+// gdb-command:print *u64_ref
+// gdb-check:$12 = 64
+
+// gdb-command:print *f32_ref
+// gdb-check:$13 = 2.5
+
+// gdb-command:print *f64_ref
+// gdb-check:$14 = 3.5
+
+#![allow(unused_variable)]
+
+fn main() {
+ let bool_val: bool = true;
+ let bool_ref: &bool = &bool_val;
+
+ let int_val: int = -1;
+ let int_ref: &int = &int_val;
+
+ let char_val: char = 'a';
+ let char_ref: &char = &char_val;
+
+ let i8_val: i8 = 68;
+ let i8_ref: &i8 = &i8_val;
+
+ let i16_val: i16 = -16;
+ let i16_ref: &i16 = &i16_val;
+
+ let i32_val: i32 = -32;
+ let i32_ref: &i32 = &i32_val;
+
+ let uint_val: i64 = -64;
+ let i64_ref: &i64 = &uint_val;
+
+ let uint_val: uint = 1;
+ let uint_ref: &uint = &uint_val;
+
+ let u8_val: u8 = 100;
+ let u8_ref: &u8 = &u8_val;
+
+ let u16_val: u16 = 16;
+ let u16_ref: &u16 = &u16_val;
+
+ let u32_val: u32 = 32;
+ let u32_ref: &u32 = &u32_val;
+
+ let u64_val: u64 = 64;
+ let u64_ref: &u64 = &u64_val;
+
+ let f32_val: f32 = 2.5;
+ let f32_ref: &f32 = &f32_val;
+
+ let f64_val: f64 = 3.5;
+ let f64_ref: &f64 = &f64_val;
+ zzz();
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+// gdb-command:finish
+
+// gdb-command:print *the_a_ref
+// gdb-check:$1 = TheA
+
+// gdb-command:print *the_b_ref
+// gdb-check:$2 = TheB
+
+// gdb-command:print *the_c_ref
+// gdb-check:$3 = TheC
+
+#![allow(unused_variable)]
+
+enum ABC { TheA, TheB, TheC }
+
+fn main() {
+ let the_a = TheA;
+ let the_a_ref: &ABC = &the_a;
+
+ let the_b = TheB;
+ let the_b_ref: &ABC = &the_b;
+
+ let the_c = TheC;
+ let the_c_ref: &ABC = &the_c;
+
+ zzz();
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+// gdb-command:finish
+
+// gdb-command:print *the_a_ref
+// gdb-check:$1 = {{TheA, x = 0, y = 8970181431921507452}, {TheA, 0, 2088533116, 2088533116}}
+
+// gdb-command:print *the_b_ref
+// gdb-check:$2 = {{TheB, x = 0, y = 1229782938247303441}, {TheB, 0, 286331153, 286331153}}
+
+// gdb-command:print *univariant_ref
+// gdb-check:$3 = {4820353753753434}
+
+#![allow(unused_variable)]
+#![feature(struct_variant)]
+
+// The first element is to ensure proper alignment, irrespective of the machines word size. Since
+// the size of the discriminant value is machine dependent, this has be taken into account when
+// datatype layout should be predictable as in this case.
+enum ABC {
+ TheA { x: i64, y: i64 },
+ TheB (i64, i32, i32),
+}
+
+// This is a special case since it does not have the implicit discriminant field.
+enum Univariant {
+ TheOnlyCase(i64)
+}
+
+fn main() {
+
+ // 0b0111110001111100011111000111110001111100011111000111110001111100 = 8970181431921507452
+ // 0b01111100011111000111110001111100 = 2088533116
+ // 0b0111110001111100 = 31868
+ // 0b01111100 = 124
+ let the_a = TheA { x: 0, y: 8970181431921507452 };
+ let the_a_ref: &ABC = &the_a;
+
+ // 0b0001000100010001000100010001000100010001000100010001000100010001 = 1229782938247303441
+ // 0b00010001000100010001000100010001 = 286331153
+ // 0b0001000100010001 = 4369
+ // 0b00010001 = 17
+ let the_b = TheB (0, 286331153, 286331153);
+ let the_b_ref: &ABC = &the_b;
+
+ let univariant = TheOnlyCase(4820353753753434);
+ let univariant_ref: &Univariant = &univariant;
+
+ zzz();
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+#![feature(managed_boxes)]
+
+// Gdb doesn't know about UTF-32 character encoding and will print a rust char as only
+// its numerical value.
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+// gdb-command:finish
+// gdb-command:print *bool_ref
+// gdb-check:$1 = true
+
+// gdb-command:print *int_ref
+// gdb-check:$2 = -1
+
+// gdb-command:print *char_ref
+// gdb-check:$3 = 97
+
+// gdb-command:print/d *i8_ref
+// gdb-check:$4 = 68
+
+// gdb-command:print *i16_ref
+// gdb-check:$5 = -16
+
+// gdb-command:print *i32_ref
+// gdb-check:$6 = -32
+
+// gdb-command:print *i64_ref
+// gdb-check:$7 = -64
+
+// gdb-command:print *uint_ref
+// gdb-check:$8 = 1
+
+// gdb-command:print/d *u8_ref
+// gdb-check:$9 = 100
+
+// gdb-command:print *u16_ref
+// gdb-check:$10 = 16
+
+// gdb-command:print *u32_ref
+// gdb-check:$11 = 32
+
+// gdb-command:print *u64_ref
+// gdb-check:$12 = 64
+
+// gdb-command:print *f32_ref
+// gdb-check:$13 = 2.5
+
+// gdb-command:print *f64_ref
+// gdb-check:$14 = 3.5
+
+#![allow(unused_variable)]
+
+fn main() {
+ let bool_box: @bool = @true;
+ let bool_ref: &bool = bool_box;
+
+ let int_box: @int = @-1;
+ let int_ref: &int = int_box;
+
+ let char_box: @char = @'a';
+ let char_ref: &char = char_box;
+
+ let i8_box: @i8 = @68;
+ let i8_ref: &i8 = i8_box;
+
+ let i16_box: @i16 = @-16;
+ let i16_ref: &i16 = i16_box;
+
+ let i32_box: @i32 = @-32;
+ let i32_ref: &i32 = i32_box;
+
+ let i64_box: @i64 = @-64;
+ let i64_ref: &i64 = i64_box;
+
+ let uint_box: @uint = @1;
+ let uint_ref: &uint = uint_box;
+
+ let u8_box: @u8 = @100;
+ let u8_ref: &u8 = u8_box;
+
+ let u16_box: @u16 = @16;
+ let u16_ref: &u16 = u16_box;
+
+ let u32_box: @u32 = @32;
+ let u32_ref: &u32 = u32_box;
+
+ let u64_box: @u64 = @64;
+ let u64_ref: &u64 = u64_box;
+
+ let f32_box: @f32 = @2.5;
+ let f32_ref: &f32 = f32_box;
+
+ let f64_box: @f64 = @3.5;
+ let f64_ref: &f64 = f64_box;
+ zzz();
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+// gdb-command:finish
+
+// gdb-command:print *stack_val_ref
+// gdb-check:$1 = {x = 10, y = 23.5}
+
+// gdb-command:print *stack_val_interior_ref_1
+// gdb-check:$2 = 10
+
+// gdb-command:print *stack_val_interior_ref_2
+// gdb-check:$3 = 23.5
+
+// gdb-command:print *ref_to_unnamed
+// gdb-check:$4 = {x = 11, y = 24.5}
+
+// gdb-command:print *managed_val_ref
+// gdb-check:$5 = {x = 12, y = 25.5}
+
+// gdb-command:print *managed_val_interior_ref_1
+// gdb-check:$6 = 12
+
+// gdb-command:print *managed_val_interior_ref_2
+// gdb-check:$7 = 25.5
+
+// gdb-command:print *unique_val_ref
+// gdb-check:$8 = {x = 13, y = 26.5}
+
+// gdb-command:print *unique_val_interior_ref_1
+// gdb-check:$9 = 13
+
+// gdb-command:print *unique_val_interior_ref_2
+// gdb-check:$10 = 26.5
+
+#![feature(managed_boxes)]
+#![allow(unused_variable)]
+
+struct SomeStruct {
+ x: int,
+ y: f64
+}
+
+fn main() {
+ let stack_val: SomeStruct = SomeStruct { x: 10, y: 23.5 };
+ let stack_val_ref: &SomeStruct = &stack_val;
+ let stack_val_interior_ref_1: &int = &stack_val.x;
+ let stack_val_interior_ref_2: &f64 = &stack_val.y;
+ let ref_to_unnamed: &SomeStruct = &SomeStruct { x: 11, y: 24.5 };
+
+ let managed_val = @SomeStruct { x: 12, y: 25.5 };
+ let managed_val_ref: &SomeStruct = managed_val;
+ let managed_val_interior_ref_1: &int = &managed_val.x;
+ let managed_val_interior_ref_2: &f64 = &managed_val.y;
+
+ let unique_val = box SomeStruct { x: 13, y: 26.5 };
+ let unique_val_ref: &SomeStruct = unique_val;
+ let unique_val_interior_ref_1: &int = &unique_val.x;
+ let unique_val_interior_ref_2: &f64 = &unique_val.y;
+
+ zzz();
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+#![feature(managed_boxes)]
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+// gdb-command:finish
+
+// gdb-command:print *stack_val_ref
+// gdb-check:$1 = {-14, -19}
+
+// gdb-command:print *ref_to_unnamed
+// gdb-check:$2 = {-15, -20}
+
+// gdb-command:print *managed_val_ref
+// gdb-check:$3 = {-16, -21}
+
+// gdb-command:print *unique_val_ref
+// gdb-check:$4 = {-17, -22}
+
+#![allow(unused_variable)]
+
+
+fn main() {
+ let stack_val: (i16, f32) = (-14, -19f32);
+ let stack_val_ref: &(i16, f32) = &stack_val;
+ let ref_to_unnamed: &(i16, f32) = &(-15, -20f32);
+
+ let managed_val: @(i16, f32) = @(-16, -21f32);
+ let managed_val_ref: &(i16, f32) = managed_val;
+
+ let unique_val: Box<(i16, f32)> = box() (-17, -22f32);
+ let unique_val_ref: &(i16, f32) = unique_val;
+
+ zzz();
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// Gdb doesn't know about UTF-32 character encoding and will print a rust char as only
+// its numerical value.
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+// gdb-command:finish
+// gdb-command:print *bool_ref
+// gdb-check:$1 = true
+
+// gdb-command:print *int_ref
+// gdb-check:$2 = -1
+
+// gdb-command:print *char_ref
+// gdb-check:$3 = 97
+
+// gdb-command:print/d *i8_ref
+// gdb-check:$4 = 68
+
+// gdb-command:print *i16_ref
+// gdb-check:$5 = -16
+
+// gdb-command:print *i32_ref
+// gdb-check:$6 = -32
+
+// gdb-command:print *i64_ref
+// gdb-check:$7 = -64
+
+// gdb-command:print *uint_ref
+// gdb-check:$8 = 1
+
+// gdb-command:print/d *u8_ref
+// gdb-check:$9 = 100
+
+// gdb-command:print *u16_ref
+// gdb-check:$10 = 16
+
+// gdb-command:print *u32_ref
+// gdb-check:$11 = 32
+
+// gdb-command:print *u64_ref
+// gdb-check:$12 = 64
+
+// gdb-command:print *f32_ref
+// gdb-check:$13 = 2.5
+
+// gdb-command:print *f64_ref
+// gdb-check:$14 = 3.5
+
+#![allow(unused_variable)]
+
+
+fn main() {
+ let bool_box: Box<bool> = box true;
+ let bool_ref: &bool = bool_box;
+
+ let int_box: Box<int> = box -1;
+ let int_ref: &int = int_box;
+
+ let char_box: Box<char> = box 'a';
+ let char_ref: &char = char_box;
+
+ let i8_box: Box<i8> = box 68;
+ let i8_ref: &i8 = i8_box;
+
+ let i16_box: Box<i16> = box -16;
+ let i16_ref: &i16 = i16_box;
+
+ let i32_box: Box<i32> = box -32;
+ let i32_ref: &i32 = i32_box;
+
+ let i64_box: Box<i64> = box -64;
+ let i64_ref: &i64 = i64_box;
+
+ let uint_box: Box<uint> = box 1;
+ let uint_ref: &uint = uint_box;
+
+ let u8_box: Box<u8> = box 100;
+ let u8_ref: &u8 = u8_box;
+
+ let u16_box: Box<u16> = box 16;
+ let u16_ref: &u16 = u16_box;
+
+ let u32_box: Box<u32> = box 32;
+ let u32_ref: &u32 = u32_box;
+
+ let u64_box: Box<u64> = box 64;
+ let u64_ref: &u64 = u64_box;
+
+ let f32_box: Box<f32> = box 2.5;
+ let f32_ref: &f32 = f32_box;
+
+ let f64_box: Box<f64> = box 3.5;
+ let f64_ref: &f64 = f64_box;
+ zzz();
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:set print pretty off
+// gdb-command:rbreak zzz
+// gdb-command:run
+// gdb-command:finish
+// gdb-command:print *a
+// gdb-check:$1 = 1
+// gdb-command:print *b
+// gdb-check:$2 = {2, 3.5}
+// gdb-command:print c->val
+// gdb-check:$3 = 4
+// gdb-command:print d->val
+// gdb-check:$4 = false
+
+#![feature(managed_boxes)]
+#![allow(unused_variable)]
+
+fn main() {
+ let a = box 1;
+ let b = box() (2, 3.5);
+ let c = @4;
+ let d = @false;
+ _zzz();
+}
+
+fn _zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+// gdb-command:finish
+
+// gdb-command:print *unique
+// gdb-check:$1 = {x = 99, y = 999, z = 9999, w = 99999}
+
+// gdb-command:print managed->val
+// gdb-check:$2 = {x = 88, y = 888, z = 8888, w = 88888}
+
+// gdb-command:print *unique_dtor
+// gdb-check:$3 = {x = 77, y = 777, z = 7777, w = 77777}
+
+// gdb-command:print managed_dtor->val
+// gdb-check:$4 = {x = 33, y = 333, z = 3333, w = 33333}
+
+#![feature(managed_boxes)]
+#![allow(unused_variable)]
+
+
+struct StructWithSomePadding {
+ x: i16,
+ y: i32,
+ z: i32,
+ w: i64
+}
+
+struct StructWithDestructor {
+ x: i16,
+ y: i32,
+ z: i32,
+ w: i64
+}
+
+impl Drop for StructWithDestructor {
+ fn drop(&mut self) {}
+}
+
+fn main() {
+
+ let unique = box StructWithSomePadding { x: 99, y: 999, z: 9999, w: 99999 };
+ let managed = @StructWithSomePadding { x: 88, y: 888, z: 8888, w: 88888 };
+
+ let unique_dtor = box StructWithDestructor { x: 77, y: 777, z: 7777, w: 77777 };
+ let managed_dtor = @StructWithDestructor { x: 33, y: 333, z: 3333, w: 33333 };
+
+ zzz();
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+
+// gdb-command:finish
+// gdb-command:print s
+// gdb-check:$1 = {a = 1, b = 2.5}
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$2 = {a = 3, b = 4.5}
+// gdb-command:print y
+// gdb-check:$3 = 5
+// gdb-command:print z
+// gdb-check:$4 = 6.5
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print a
+// gdb-check:$5 = {7, 8, 9.5, 10.5}
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print a
+// gdb-check:$6 = {11.5, 12.5, 13, 14}
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$7 = {{Case1, x = 0, y = 8970181431921507452}, {Case1, 0, 2088533116, 2088533116}}
+// gdb-command:continue
+
+#![feature(struct_variant)]
+
+#[deriving(Clone)]
+struct Struct {
+ a: int,
+ b: f64
+}
+
+#[deriving(Clone)]
+struct StructStruct {
+ a: Struct,
+ b: Struct
+}
+
+fn fun(s: Struct) {
+ zzz();
+}
+
+fn fun_fun(StructStruct { a: x, b: Struct { a: y, b: z } }: StructStruct) {
+ zzz();
+}
+
+fn tup(a: (int, uint, f64, f64)) {
+ zzz();
+}
+
+struct Newtype(f64, f64, int, uint);
+
+fn new_type(a: Newtype) {
+ zzz();
+}
+
+// The first element is to ensure proper alignment, irrespective of the machines word size. Since
+// the size of the discriminant value is machine dependent, this has be taken into account when
+// datatype layout should be predictable as in this case.
+enum Enum {
+ Case1 { x: i64, y: i64 },
+ Case2 (i64, i32, i32),
+}
+
+fn by_val_enum(x: Enum) {
+ zzz();
+}
+
+fn main() {
+ fun(Struct { a: 1, b: 2.5 });
+ fun_fun(StructStruct { a: Struct { a: 3, b: 4.5 }, b: Struct { a: 5, b: 6.5 } });
+ tup((7, 8, 9.5, 10.5));
+ new_type(Newtype(11.5, 12.5, 13, 14));
+
+ // 0b0111110001111100011111000111110001111100011111000111110001111100 = 8970181431921507452
+ // 0b01111100011111000111110001111100 = 2088533116
+ // 0b0111110001111100 = 31868
+ // 0b01111100 = 124
+ by_val_enum(Case1 { x: 0, y: 8970181431921507452 });
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+#![feature(managed_boxes)]
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+
+// gdb-command:finish
+// gdb-command:print self
+// gdb-check:$1 = 1111
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print self
+// gdb-check:$2 = {x = 2222, y = 3333}
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print self
+// gdb-check:$3 = {4444.5, 5555, 6666, 7777.5}
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print self->val
+// gdb-check:$4 = 8888
+// gdb-command:continue
+
+trait Trait {
+ fn method(self) -> Self;
+}
+
+impl Trait for int {
+ fn method(self) -> int {
+ zzz();
+ self
+ }
+}
+
+struct Struct {
+ x: uint,
+ y: uint,
+}
+
+impl Trait for Struct {
+ fn method(self) -> Struct {
+ zzz();
+ self
+ }
+}
+
+impl Trait for (f64, int, int, f64) {
+ fn method(self) -> (f64, int, int, f64) {
+ zzz();
+ self
+ }
+}
+
+impl Trait for @int {
+ fn method(self) -> @int {
+ zzz();
+ self
+ }
+}
+
+fn main() {
+ let _ = (1111 as int).method();
+ let _ = Struct { x: 2222, y: 3333 }.method();
+ let _ = (4444.5, 5555, 6666, 7777.5).method();
+ let _ = (@8888).method();
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+// gdb-command:finish
+
+// gdb-command:print tuple_interior_padding
+// gdb-check:$1 = {0, OneHundred}
+
+// gdb-command:print tuple_padding_at_end
+// gdb-check:$2 = {{1, OneThousand}, 2}
+
+// gdb-command:print tuple_different_enums
+// gdb-check:$3 = {OneThousand, MountainView, OneMillion, Vienna}
+
+// gdb-command:print padded_struct
+// gdb-check:$4 = {a = 3, b = OneMillion, c = 4, d = Toronto, e = 5}
+
+// gdb-command:print packed_struct
+// gdb-check:$5 = {a = 6, b = OneHundred, c = 7, d = Vienna, e = 8}
+
+// gdb-command:print non_padded_struct
+// gdb-check:$6 = {a = OneMillion, b = MountainView, c = OneThousand, d = Toronto}
+
+// gdb-command:print struct_with_drop
+// gdb-check:$7 = {{a = OneHundred, b = Vienna}, 9}
+
+#![allow(unused_variable)]
+
+enum AnEnum {
+ OneHundred = 100,
+ OneThousand = 1000,
+ OneMillion = 1000000
+}
+
+enum AnotherEnum {
+ MountainView,
+ Toronto,
+ Vienna
+}
+
+struct PaddedStruct {
+ a: i16,
+ b: AnEnum,
+ c: i16,
+ d: AnotherEnum,
+ e: i16
+}
+
+#[packed]
+struct PackedStruct {
+ a: i16,
+ b: AnEnum,
+ c: i16,
+ d: AnotherEnum,
+ e: i16
+}
+
+struct NonPaddedStruct {
+ a: AnEnum,
+ b: AnotherEnum,
+ c: AnEnum,
+ d: AnotherEnum
+}
+
+struct StructWithDrop {
+ a: AnEnum,
+ b: AnotherEnum
+}
+
+impl Drop for StructWithDrop {
+ fn drop(&mut self) {()}
+}
+
+fn main() {
+
+ let tuple_interior_padding = (0_i16, OneHundred);
+ // It will depend on the machine architecture if any padding is actually involved here
+ let tuple_padding_at_end = ((1_u64, OneThousand), 2_u64);
+ let tuple_different_enums = (OneThousand, MountainView, OneMillion, Vienna);
+
+ let padded_struct = PaddedStruct {
+ a: 3,
+ b: OneMillion,
+ c: 4,
+ d: Toronto,
+ e: 5
+ };
+
+ let packed_struct = PackedStruct {
+ a: 6,
+ b: OneHundred,
+ c: 7,
+ d: Vienna,
+ e: 8
+ };
+
+ let non_padded_struct = NonPaddedStruct {
+ a: OneMillion,
+ b: MountainView,
+ c: OneThousand,
+ d: Toronto
+ };
+
+ let struct_with_drop = (StructWithDrop { a: OneHundred, b: Vienna }, 9_i64);
+
+ zzz();
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-win32: FIXME #13256
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+
+// gdb-command:print 'c-style-enum::SINGLE_VARIANT'
+// gdb-check:$1 = TheOnlyVariant
+
+// gdb-command:print 'c-style-enum::AUTO_ONE'
+// gdb-check:$2 = One
+
+// gdb-command:print 'c-style-enum::AUTO_TWO'
+// gdb-check:$3 = One
+
+// gdb-command:print 'c-style-enum::AUTO_THREE'
+// gdb-check:$4 = One
+
+// gdb-command:print 'c-style-enum::MANUAL_ONE'
+// gdb-check:$5 = OneHundred
+
+// gdb-command:print 'c-style-enum::MANUAL_TWO'
+// gdb-check:$6 = OneHundred
+
+// gdb-command:print 'c-style-enum::MANUAL_THREE'
+// gdb-check:$7 = OneHundred
+
+// gdb-command:run
+// gdb-command:finish
+
+// gdb-command:print auto_one
+// gdb-check:$8 = One
+
+// gdb-command:print auto_two
+// gdb-check:$9 = Two
+
+// gdb-command:print auto_three
+// gdb-check:$10 = Three
+
+// gdb-command:print manual_one_hundred
+// gdb-check:$11 = OneHundred
+
+// gdb-command:print manual_one_thousand
+// gdb-check:$12 = OneThousand
+
+// gdb-command:print manual_one_million
+// gdb-check:$13 = OneMillion
+
+// gdb-command:print single_variant
+// gdb-check:$14 = TheOnlyVariant
+
+// gdb-command:print 'c-style-enum::AUTO_TWO'
+// gdb-check:$15 = Two
+
+// gdb-command:print 'c-style-enum::AUTO_THREE'
+// gdb-check:$16 = Three
+
+// gdb-command:print 'c-style-enum::MANUAL_TWO'
+// gdb-check:$17 = OneThousand
+
+// gdb-command:print 'c-style-enum::MANUAL_THREE'
+// gdb-check:$18 = OneMillion
+
+#![allow(unused_variable)]
+#![allow(dead_code)]
+
+enum AutoDiscriminant {
+ One,
+ Two,
+ Three
+}
+
+enum ManualDiscriminant {
+ OneHundred = 100,
+ OneThousand = 1000,
+ OneMillion = 1000000
+}
+
+enum SingleVariant {
+ TheOnlyVariant
+}
+
+static SINGLE_VARIANT: SingleVariant = TheOnlyVariant;
+
+static mut AUTO_ONE: AutoDiscriminant = One;
+static mut AUTO_TWO: AutoDiscriminant = One;
+static mut AUTO_THREE: AutoDiscriminant = One;
+
+static mut MANUAL_ONE: ManualDiscriminant = OneHundred;
+static mut MANUAL_TWO: ManualDiscriminant = OneHundred;
+static mut MANUAL_THREE: ManualDiscriminant = OneHundred;
+
+fn main() {
+
+ let auto_one = One;
+ let auto_two = Two;
+ let auto_three = Three;
+
+ let manual_one_hundred = OneHundred;
+ let manual_one_thousand = OneThousand;
+ let manual_one_million = OneMillion;
+
+ let single_variant = TheOnlyVariant;
+
+ unsafe {
+ AUTO_TWO = Two;
+ AUTO_THREE = Three;
+
+ MANUAL_TWO = OneThousand;
+ MANUAL_THREE = OneMillion;
+ };
+
+ zzz();
+
+ let a = SINGLE_VARIANT;
+ let a = unsafe { AUTO_ONE };
+ let a = unsafe { MANUAL_ONE };
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$1 = 0.5
+// gdb-command:print y
+// gdb-check:$2 = 10
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print *x
+// gdb-check:$3 = 29
+// gdb-command:print *y
+// gdb-check:$4 = 110
+// gdb-command:continue
+
+fn some_generic_fun<T1, T2>(a: T1, b: T2) -> (T2, T1) {
+
+ let closure = |x, y| {
+ zzz();
+ (y, x)
+ };
+
+ closure(a, b)
+}
+
+fn main() {
+ some_generic_fun(0.5, 10);
+ some_generic_fun(&29, box 110);
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+
+// gdb-command:finish
+// gdb-command:print a
+// gdb-check:$1 = 1
+// gdb-command:print b
+// gdb-check:$2 = false
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print a
+// gdb-check:$3 = 2
+// gdb-command:print b
+// gdb-check:$4 = 3
+// gdb-command:print c
+// gdb-check:$5 = 4
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print a
+// gdb-check:$6 = 5
+// gdb-command:print b
+// gdb-check:$7 = {6, 7}
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print h
+// gdb-check:$8 = 8
+// gdb-command:print i
+// gdb-check:$9 = {a = 9, b = 10}
+// gdb-command:print j
+// gdb-check:$10 = 11
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print k
+// gdb-check:$11 = 12
+// gdb-command:print l
+// gdb-check:$12 = 13
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print m
+// gdb-check:$13 = 14
+// gdb-command:print n
+// gdb-check:$14 = 16
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print o
+// gdb-check:$15 = 18
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print p
+// gdb-check:$16 = 19
+// gdb-command:print q
+// gdb-check:$17 = 20
+// gdb-command:print r
+// gdb-check:$18 = {a = 21, b = 22}
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print s
+// gdb-check:$19 = 24
+// gdb-command:print t
+// gdb-check:$20 = 23
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print u
+// gdb-check:$21 = 25
+// gdb-command:print v
+// gdb-check:$22 = 26
+// gdb-command:print w
+// gdb-check:$23 = 27
+// gdb-command:print x
+// gdb-check:$24 = 28
+// gdb-command:print y
+// gdb-check:$25 = 29
+// gdb-command:print z
+// gdb-check:$26 = 30
+// gdb-command:print ae
+// gdb-check:$27 = 31
+// gdb-command:print oe
+// gdb-check:$28 = 32
+// gdb-command:print ue
+// gdb-check:$29 = 33
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print aa
+// gdb-check:$30 = {34, 35}
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print bb
+// gdb-check:$31 = {36, 37}
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print cc
+// gdb-check:$32 = 38
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print dd
+// gdb-check:$33 = {40, 41, 42}
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print *ee
+// gdb-check:$34 = {43, 44, 45}
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print *ff
+// gdb-check:$35 = 46
+// gdb-command:print gg
+// gdb-check:$36 = {47, 48}
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print *hh
+// gdb-check:$37 = 50
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print ii
+// gdb-check:$38 = 51
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print *jj
+// gdb-check:$39 = 52
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print kk
+// gdb-check:$40 = 53
+// gdb-command:print ll
+// gdb-check:$41 = 54
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print mm
+// gdb-check:$42 = 55
+// gdb-command:print *nn
+// gdb-check:$43 = 56
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print oo
+// gdb-check:$44 = 57
+// gdb-command:print pp
+// gdb-check:$45 = 58
+// gdb-command:print qq
+// gdb-check:$46 = 59
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print rr
+// gdb-check:$47 = 60
+// gdb-command:print ss
+// gdb-check:$48 = 61
+// gdb-command:print tt
+// gdb-check:$49 = 62
+// gdb-command:continue
+
+#![allow(unused_variable)]
+
+
+struct Struct {
+ a: i64,
+ b: i32
+}
+
+enum Univariant {
+ Unit(i32)
+}
+
+struct TupleStruct (f64, int);
+
+
+fn simple_tuple((a, b): (int, bool)) {
+ zzz();
+}
+
+fn nested_tuple((a, (b, c)): (int, (u16, u16))) {
+ zzz();
+}
+
+fn destructure_only_first_level((a, b): (int, (u32, u32))) {
+ zzz();
+}
+
+fn struct_as_tuple_element((h, i, j): (i16, Struct, i16)) {
+ zzz();
+}
+
+fn struct_pattern(Struct { a: k, b: l }: Struct) {
+ zzz();
+}
+
+fn ignored_tuple_element((m, _, n): (int, u16, i32)) {
+ zzz();
+}
+
+fn ignored_struct_field(Struct { b: o, .. }: Struct) {
+ zzz();
+}
+
+fn one_struct_destructured_one_not((Struct { a: p, b: q }, r): (Struct, Struct)) {
+ zzz();
+}
+
+fn different_order_of_struct_fields(Struct { b: s, a: t }: Struct ) {
+ zzz();
+}
+
+fn complex_nesting(((u, v ), ((w, (x, Struct { a: y, b: z})), Struct { a: ae, b: oe }), ue ):
+ ((i16, i32), ((i64, (i32, Struct, )), Struct ), u16))
+{
+ zzz();
+}
+
+fn managed_box(&aa: &(int, int)) {
+ zzz();
+}
+
+fn borrowed_pointer(&bb: &(int, int)) {
+ zzz();
+}
+
+fn contained_borrowed_pointer((&cc, _): (&int, int)) {
+ zzz();
+}
+
+fn unique_pointer(box dd: Box<(int, int, int)>) {
+ zzz();
+}
+
+fn ref_binding(ref ee: (int, int, int)) {
+ zzz();
+}
+
+fn ref_binding_in_tuple((ref ff, gg): (int, (int, int))) {
+ zzz();
+}
+
+fn ref_binding_in_struct(Struct { b: ref hh, .. }: Struct) {
+ zzz();
+}
+
+fn univariant_enum(Unit(ii): Univariant) {
+ zzz();
+}
+
+fn univariant_enum_with_ref_binding(Unit(ref jj): Univariant) {
+ zzz();
+}
+
+fn tuple_struct(TupleStruct(kk, ll): TupleStruct) {
+ zzz();
+}
+
+fn tuple_struct_with_ref_binding(TupleStruct(mm, ref nn): TupleStruct) {
+ zzz();
+}
+
+fn multiple_arguments((oo, pp): (int, int), qq : int) {
+ zzz();
+}
+
+fn main() {
+ simple_tuple((1, false));
+ nested_tuple((2, (3, 4)));
+ destructure_only_first_level((5, (6, 7)));
+ struct_as_tuple_element((8, Struct { a: 9, b: 10 }, 11));
+ struct_pattern(Struct { a: 12, b: 13 });
+ ignored_tuple_element((14, 15, 16));
+ ignored_struct_field(Struct { a: 17, b: 18 });
+ one_struct_destructured_one_not((Struct { a: 19, b: 20 }, Struct { a: 21, b: 22 }));
+ different_order_of_struct_fields(Struct { a: 23, b: 24 });
+ complex_nesting(((25, 26), ((27, (28, Struct { a: 29, b: 30})), Struct { a: 31, b: 32 }), 33));
+ managed_box(&(34, 35));
+ borrowed_pointer(&(36, 37));
+ contained_borrowed_pointer((&38, 39));
+ unique_pointer(box() (40, 41, 42));
+ ref_binding((43, 44, 45));
+ ref_binding_in_tuple((46, (47, 48)));
+ ref_binding_in_struct(Struct { a: 49, b: 50 });
+ univariant_enum(Unit(51));
+ univariant_enum_with_ref_binding(Unit(52));
+ tuple_struct(TupleStruct(53.0, 54));
+ tuple_struct_with_ref_binding(TupleStruct(55.0, 56));
+ multiple_arguments((57, 58), 59);
+
+ fn nested_function(rr: int, (ss, tt): (int, int)) {
+ zzz();
+ }
+
+ nested_function(60, (61, 62));
+}
+
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+// gdb-command:finish
+
+// gdb-command:print a
+// gdb-check:$1 = 1
+// gdb-command:print b
+// gdb-check:$2 = false
+
+// gdb-command:print c
+// gdb-check:$3 = 2
+// gdb-command:print d
+// gdb-check:$4 = 3
+// gdb-command:print e
+// gdb-check:$5 = 4
+
+// gdb-command:print f
+// gdb-check:$6 = 5
+// gdb-command:print g
+// gdb-check:$7 = {6, 7}
+
+// gdb-command:print h
+// gdb-check:$8 = 8
+// gdb-command:print i
+// gdb-check:$9 = {a = 9, b = 10}
+// gdb-command:print j
+// gdb-check:$10 = 11
+
+// gdb-command:print k
+// gdb-check:$11 = 12
+// gdb-command:print l
+// gdb-check:$12 = 13
+
+// gdb-command:print m
+// gdb-check:$13 = 14
+// gdb-command:print n
+// gdb-check:$14 = 16
+
+// gdb-command:print o
+// gdb-check:$15 = 18
+
+// gdb-command:print p
+// gdb-check:$16 = 19
+// gdb-command:print q
+// gdb-check:$17 = 20
+// gdb-command:print r
+// gdb-check:$18 = {a = 21, b = 22}
+
+// gdb-command:print s
+// gdb-check:$19 = 24
+// gdb-command:print t
+// gdb-check:$20 = 23
+
+// gdb-command:print u
+// gdb-check:$21 = 25
+// gdb-command:print v
+// gdb-check:$22 = 26
+// gdb-command:print w
+// gdb-check:$23 = 27
+// gdb-command:print x
+// gdb-check:$24 = 28
+// gdb-command:print y
+// gdb-check:$25 = 29
+// gdb-command:print z
+// gdb-check:$26 = 30
+// gdb-command:print ae
+// gdb-check:$27 = 31
+// gdb-command:print oe
+// gdb-check:$28 = 32
+// gdb-command:print ue
+// gdb-check:$29 = 33
+
+// gdb-command:print aa
+// gdb-check:$30 = {34, 35}
+
+// gdb-command:print bb
+// gdb-check:$31 = {36, 37}
+
+// gdb-command:print cc
+// gdb-check:$32 = 38
+
+// gdb-command:print dd
+// gdb-check:$33 = {40, 41, 42}
+
+// gdb-command:print *ee
+// gdb-check:$34 = {43, 44, 45}
+
+// gdb-command:print *ff
+// gdb-check:$35 = 46
+
+// gdb-command:print gg
+// gdb-check:$36 = {47, 48}
+
+// gdb-command:print *hh
+// gdb-check:$37 = 50
+
+// gdb-command:print ii
+// gdb-check:$38 = 51
+
+// gdb-command:print *jj
+// gdb-check:$39 = 52
+
+// gdb-command:print kk
+// gdb-check:$40 = 53
+
+// gdb-command:print ll
+// gdb-check:$41 = 54
+
+// gdb-command:print mm
+// gdb-check:$42 = 55
+
+// gdb-command:print *nn
+// gdb-check:$43 = 56
+
+#![allow(unused_variable)]
+
+struct Struct {
+ a: i64,
+ b: i32
+}
+
+enum Univariant {
+ Unit(i32)
+}
+
+struct TupleStruct (f64, int);
+
+
+fn main() {
+ // simple tuple
+ let (a, b) : (int, bool) = (1, false);
+
+ // nested tuple
+ let (c, (d, e)) : (int, (u16, u16)) = (2, (3, 4));
+
+ // bind tuple-typed value to one name (destructure only first level)
+ let (f, g) : (int, (u32, u32)) = (5, (6, 7));
+
+ // struct as tuple element
+ let (h, i, j) : (i16, Struct, i16) = (8, Struct { a: 9, b: 10 }, 11);
+
+ // struct pattern
+ let Struct { a: k, b: l } = Struct { a: 12, b: 13 };
+
+ // ignored tuple element
+ let (m, _, n) = (14, 15, 16);
+
+ // ignored struct field
+ let Struct { b: o, .. } = Struct { a: 17, b: 18 };
+
+ // one struct destructured, one not
+ let (Struct { a: p, b: q }, r) = (Struct { a: 19, b: 20 }, Struct { a: 21, b: 22 });
+
+ // different order of struct fields
+ let Struct { b: s, a: t } = Struct { a: 23, b: 24 };
+
+ // complex nesting
+ let ((u, v), ((w, (x, Struct { a: y, b: z})), Struct { a: ae, b: oe }), ue) =
+ ((25, 26), ((27, (28, Struct { a: 29, b: 30})), Struct { a: 31, b: 32 }), 33);
+
+ // reference
+ let &aa = &(34, 35);
+
+ // reference
+ let &bb = &(36, 37);
+
+ // contained reference
+ let (&cc, _) = (&38, 39);
+
+ // unique pointer
+ let box dd = box() (40, 41, 42);
+
+ // ref binding
+ let ref ee = (43, 44, 45);
+
+ // ref binding in tuple
+ let (ref ff, gg) = (46, (47, 48));
+
+ // ref binding in struct
+ let Struct { b: ref hh, .. } = Struct { a: 49, b: 50 };
+
+ // univariant enum
+ let Unit(ii) = Unit(51);
+
+ // univariant enum with ref binding
+ let &Unit(ref jj) = &Unit(52);
+
+ // tuple struct
+ let &TupleStruct(kk, ll) = &TupleStruct(53.0, 54);
+
+ // tuple struct with ref binding
+ let &TupleStruct(mm, ref nn) = &TupleStruct(55.0, 56);
+
+ zzz();
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:set print pretty off
+// gdb-command:rbreak zzz
+// gdb-command:run
+// gdb-command:finish
+
+// gdb-command:print no_padding1
+// gdb-check:$1 = {x = {0, 1, 2}, y = -3, z = {4.5, 5.5}}
+// gdb-command:print no_padding2
+// gdb-check:$2 = {x = {6, 7, 8}, y = {{9, 10}, {11, 12}}}
+
+// gdb-command:print struct_internal_padding
+// gdb-check:$3 = {x = {13, 14}, y = {15, 16}}
+
+// gdb-command:print single_vec
+// gdb-check:$4 = {x = {17, 18, 19, 20, 21}}
+
+// gdb-command:print struct_padded_at_end
+// gdb-check:$5 = {x = {22, 23}, y = {24, 25}}
+
+#![allow(unused_variable)]
+
+struct NoPadding1 {
+ x: [u32, ..3],
+ y: i32,
+ z: [f32, ..2]
+}
+
+struct NoPadding2 {
+ x: [u32, ..3],
+ y: [[u32, ..2], ..2]
+}
+
+struct StructInternalPadding {
+ x: [i16, ..2],
+ y: [i64, ..2]
+}
+
+struct SingleVec {
+ x: [i16, ..5]
+}
+
+struct StructPaddedAtEnd {
+ x: [i64, ..2],
+ y: [i16, ..2]
+}
+
+fn main() {
+
+ let no_padding1 = NoPadding1 {
+ x: [0, 1, 2],
+ y: -3,
+ z: [4.5, 5.5]
+ };
+
+ let no_padding2 = NoPadding2 {
+ x: [6, 7, 8],
+ y: [[9, 10], [11, 12]]
+ };
+
+ let struct_internal_padding = StructInternalPadding {
+ x: [13, 14],
+ y: [15, 16]
+ };
+
+ let single_vec = SingleVec {
+ x: [17, 18, 19, 20, 21]
+ };
+
+ let struct_padded_at_end = StructPaddedAtEnd {
+ x: [22, 23],
+ y: [24, 25]
+ };
+
+ zzz();
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// This test case checks if function arguments already have the correct value when breaking at the
+// first line of the function, that is if the function prologue has already been executed at the
+// first line. Note that because of the __morestack part of the prologue GDB incorrectly breaks at
+// before the arguments have been properly loaded when setting the breakpoint via the function name.
+// Therefore the setup here sets them using line numbers (so be careful when changing this file).
+
+// compile-flags:-g
+// gdb-command:set print pretty off
+// gdb-command:break function-arg-initialization.rs:139
+// gdb-command:break function-arg-initialization.rs:154
+// gdb-command:break function-arg-initialization.rs:158
+// gdb-command:break function-arg-initialization.rs:162
+// gdb-command:break function-arg-initialization.rs:166
+// gdb-command:break function-arg-initialization.rs:170
+// gdb-command:break function-arg-initialization.rs:174
+// gdb-command:break function-arg-initialization.rs:178
+// gdb-command:break function-arg-initialization.rs:182
+// gdb-command:break function-arg-initialization.rs:190
+// gdb-command:break function-arg-initialization.rs:197
+
+
+// gdb-command:run
+
+// IMMEDIATE ARGS
+// gdb-command:print a
+// gdb-check:$1 = 1
+// gdb-command:print b
+// gdb-check:$2 = true
+// gdb-command:print c
+// gdb-check:$3 = 2.5
+// gdb-command:continue
+
+// NON IMMEDIATE ARGS
+// gdb-command:print a
+// gdb-check:$4 = {a = 3, b = 4, c = 5, d = 6, e = 7, f = 8, g = 9, h = 10}
+// gdb-command:print b
+// gdb-check:$5 = {a = 11, b = 12, c = 13, d = 14, e = 15, f = 16, g = 17, h = 18}
+// gdb-command:continue
+
+// BINDING
+// gdb-command:print a
+// gdb-check:$6 = 19
+// gdb-command:print b
+// gdb-check:$7 = 20
+// gdb-command:print c
+// gdb-check:$8 = 21.5
+// gdb-command:continue
+
+// ASSIGNMENT
+// gdb-command:print a
+// gdb-check:$9 = 22
+// gdb-command:print b
+// gdb-check:$10 = 23
+// gdb-command:print c
+// gdb-check:$11 = 24.5
+// gdb-command:continue
+
+// FUNCTION CALL
+// gdb-command:print x
+// gdb-check:$12 = 25
+// gdb-command:print y
+// gdb-check:$13 = 26
+// gdb-command:print z
+// gdb-check:$14 = 27.5
+// gdb-command:continue
+
+// EXPR
+// gdb-command:print x
+// gdb-check:$15 = 28
+// gdb-command:print y
+// gdb-check:$16 = 29
+// gdb-command:print z
+// gdb-check:$17 = 30.5
+// gdb-command:continue
+
+// RETURN EXPR
+// gdb-command:print x
+// gdb-check:$18 = 31
+// gdb-command:print y
+// gdb-check:$19 = 32
+// gdb-command:print z
+// gdb-check:$20 = 33.5
+// gdb-command:continue
+
+// ARITHMETIC EXPR
+// gdb-command:print x
+// gdb-check:$21 = 34
+// gdb-command:print y
+// gdb-check:$22 = 35
+// gdb-command:print z
+// gdb-check:$23 = 36.5
+// gdb-command:continue
+
+// IF EXPR
+// gdb-command:print x
+// gdb-check:$24 = 37
+// gdb-command:print y
+// gdb-check:$25 = 38
+// gdb-command:print z
+// gdb-check:$26 = 39.5
+// gdb-command:continue
+
+// WHILE EXPR
+// gdb-command:print x
+// gdb-check:$27 = 40
+// gdb-command:print y
+// gdb-check:$28 = 41
+// gdb-command:print z
+// gdb-check:$29 = 42
+// gdb-command:continue
+
+// LOOP EXPR
+// gdb-command:print x
+// gdb-check:$30 = 43
+// gdb-command:print y
+// gdb-check:$31 = 44
+// gdb-command:print z
+// gdb-check:$32 = 45
+// gdb-command:continue
+
+#![allow(unused_variable)]
+
+
+
+
+fn immediate_args(a: int, b: bool, c: f64) {
+ ()
+}
+
+struct BigStruct {
+ a: u64,
+ b: u64,
+ c: u64,
+ d: u64,
+ e: u64,
+ f: u64,
+ g: u64,
+ h: u64
+}
+
+fn non_immediate_args(a: BigStruct, b: BigStruct) {
+ ()
+}
+
+fn binding(a: i64, b: u64, c: f64) {
+ let x = 0;
+}
+
+fn assignment(mut a: u64, b: u64, c: f64) {
+ a = b;
+}
+
+fn function_call(x: u64, y: u64, z: f64) {
+ std::io::stdio::print("Hi!")
+}
+
+fn identifier(x: u64, y: u64, z: f64) -> u64 {
+ x
+}
+
+fn return_expr(x: u64, y: u64, z: f64) -> u64 {
+ return x;
+}
+
+fn arithmetic_expr(x: u64, y: u64, z: f64) -> u64 {
+ x + y
+}
+
+fn if_expr(x: u64, y: u64, z: f64) -> u64 {
+ if x + y < 1000 {
+ x
+ } else {
+ y
+ }
+}
+
+fn while_expr(mut x: u64, y: u64, z: u64) -> u64 {
+ while x + y < 1000 {
+ x += z
+ }
+ return x;
+}
+
+fn loop_expr(mut x: u64, y: u64, z: u64) -> u64 {
+ loop {
+ x += z;
+
+ if x + y > 1000 {
+ return x;
+ }
+ }
+}
+
+fn main() {
+ immediate_args(1, true, 2.5);
+
+ non_immediate_args(
+ BigStruct {
+ a: 3,
+ b: 4,
+ c: 5,
+ d: 6,
+ e: 7,
+ f: 8,
+ g: 9,
+ h: 10
+ },
+ BigStruct {
+ a: 11,
+ b: 12,
+ c: 13,
+ d: 14,
+ e: 15,
+ f: 16,
+ g: 17,
+ h: 18
+ }
+ );
+
+ binding(19, 20, 21.5);
+ assignment(22, 23, 24.5);
+ function_call(25, 26, 27.5);
+ identifier(28, 29, 30.5);
+ return_expr(31, 32, 33.5);
+ arithmetic_expr(34, 35, 36.5);
+ if_expr(37, 38, 39.5);
+ while_expr(40, 41, 42);
+ loop_expr(43, 44, 45);
+}
+
+
+
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+// gdb-command:finish
+
+// gdb-command:print x
+// gdb-check:$1 = 111102
+// gdb-command:print y
+// gdb-check:$2 = true
+
+// gdb-command:continue
+// gdb-command:finish
+
+// gdb-command:print a
+// gdb-check:$3 = 2000
+// gdb-command:print b
+// gdb-check:$4 = 3000
+
+fn main() {
+
+ fun(111102, true);
+ nested(2000, 3000);
+
+ fn nested(a: i32, b: i64) -> (i32, i64) {
+ zzz();
+ (a, b)
+ }
+}
+
+fn fun(x: int, y: bool) -> (int, bool) {
+ zzz();
+
+ (x, y)
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// This test case checks if function arguments already have the correct value when breaking at the
+// beginning of a function. Functions with the #[no_split_stack] attribute have the same prologue as
+// regular C functions compiled with GCC or Clang and therefore are better handled by GDB. As a
+// consequence, and as opposed to regular Rust functions, we can set the breakpoints via the
+// function name (and don't have to fall back on using line numbers).
+
+// compile-flags:-g
+// gdb-command:set print pretty off
+// gdb-command:rbreak immediate_args
+// gdb-command:rbreak binding
+// gdb-command:rbreak assignment
+// gdb-command:rbreak function_call
+// gdb-command:rbreak identifier
+// gdb-command:rbreak return_expr
+// gdb-command:rbreak arithmetic_expr
+// gdb-command:rbreak if_expr
+// gdb-command:rbreak while_expr
+// gdb-command:rbreak loop_expr
+// gdb-command:run
+
+// IMMEDIATE ARGS
+// gdb-command:print a
+// gdb-check:$1 = 1
+// gdb-command:print b
+// gdb-check:$2 = true
+// gdb-command:print c
+// gdb-check:$3 = 2.5
+// gdb-command:continue
+
+// NON IMMEDIATE ARGS
+// gdb-command:print a
+// gdb-check:$4 = {a = 3, b = 4, c = 5, d = 6, e = 7, f = 8, g = 9, h = 10}
+// gdb-command:print b
+// gdb-check:$5 = {a = 11, b = 12, c = 13, d = 14, e = 15, f = 16, g = 17, h = 18}
+// gdb-command:continue
+
+// BINDING
+// gdb-command:print a
+// gdb-check:$6 = 19
+// gdb-command:print b
+// gdb-check:$7 = 20
+// gdb-command:print c
+// gdb-check:$8 = 21.5
+// gdb-command:continue
+
+// ASSIGNMENT
+// gdb-command:print a
+// gdb-check:$9 = 22
+// gdb-command:print b
+// gdb-check:$10 = 23
+// gdb-command:print c
+// gdb-check:$11 = 24.5
+// gdb-command:continue
+
+// FUNCTION CALL
+// gdb-command:print x
+// gdb-check:$12 = 25
+// gdb-command:print y
+// gdb-check:$13 = 26
+// gdb-command:print z
+// gdb-check:$14 = 27.5
+// gdb-command:continue
+
+// EXPR
+// gdb-command:print x
+// gdb-check:$15 = 28
+// gdb-command:print y
+// gdb-check:$16 = 29
+// gdb-command:print z
+// gdb-check:$17 = 30.5
+// gdb-command:continue
+
+// RETURN EXPR
+// gdb-command:print x
+// gdb-check:$18 = 31
+// gdb-command:print y
+// gdb-check:$19 = 32
+// gdb-command:print z
+// gdb-check:$20 = 33.5
+// gdb-command:continue
+
+// ARITHMETIC EXPR
+// gdb-command:print x
+// gdb-check:$21 = 34
+// gdb-command:print y
+// gdb-check:$22 = 35
+// gdb-command:print z
+// gdb-check:$23 = 36.5
+// gdb-command:continue
+
+// IF EXPR
+// gdb-command:print x
+// gdb-check:$24 = 37
+// gdb-command:print y
+// gdb-check:$25 = 38
+// gdb-command:print z
+// gdb-check:$26 = 39.5
+// gdb-command:continue
+
+// WHILE EXPR
+// gdb-command:print x
+// gdb-check:$27 = 40
+// gdb-command:print y
+// gdb-check:$28 = 41
+// gdb-command:print z
+// gdb-check:$29 = 42
+// gdb-command:continue
+
+// LOOP EXPR
+// gdb-command:print x
+// gdb-check:$30 = 43
+// gdb-command:print y
+// gdb-check:$31 = 44
+// gdb-command:print z
+// gdb-check:$32 = 45
+// gdb-command:continue
+
+#![allow(unused_variable)]
+
+#[no_split_stack]
+fn immediate_args(a: int, b: bool, c: f64) {
+ ()
+}
+
+struct BigStruct {
+ a: u64,
+ b: u64,
+ c: u64,
+ d: u64,
+ e: u64,
+ f: u64,
+ g: u64,
+ h: u64
+}
+
+#[no_split_stack]
+fn non_immediate_args(a: BigStruct, b: BigStruct) {
+ ()
+}
+
+#[no_split_stack]
+fn binding(a: i64, b: u64, c: f64) {
+ let x = 0;
+}
+
+#[no_split_stack]
+fn assignment(mut a: u64, b: u64, c: f64) {
+ a = b;
+}
+
+#[no_split_stack]
+fn function_call(x: u64, y: u64, z: f64) {
+ std::io::stdio::print("Hi!")
+}
+
+#[no_split_stack]
+fn identifier(x: u64, y: u64, z: f64) -> u64 {
+ x
+}
+
+#[no_split_stack]
+fn return_expr(x: u64, y: u64, z: f64) -> u64 {
+ return x;
+}
+
+#[no_split_stack]
+fn arithmetic_expr(x: u64, y: u64, z: f64) -> u64 {
+ x + y
+}
+
+#[no_split_stack]
+fn if_expr(x: u64, y: u64, z: f64) -> u64 {
+ if x + y < 1000 {
+ x
+ } else {
+ y
+ }
+}
+
+#[no_split_stack]
+fn while_expr(mut x: u64, y: u64, z: u64) -> u64 {
+ while x + y < 1000 {
+ x += z
+ }
+ return x;
+}
+
+#[no_split_stack]
+fn loop_expr(mut x: u64, y: u64, z: u64) -> u64 {
+ loop {
+ x += z;
+
+ if x + y > 1000 {
+ return x;
+ }
+ }
+}
+
+fn main() {
+ immediate_args(1, true, 2.5);
+
+ non_immediate_args(
+ BigStruct {
+ a: 3,
+ b: 4,
+ c: 5,
+ d: 6,
+ e: 7,
+ f: 8,
+ g: 9,
+ h: 10
+ },
+ BigStruct {
+ a: 11,
+ b: 12,
+ c: 13,
+ d: 14,
+ e: 15,
+ f: 16,
+ g: 17,
+ h: 18
+ }
+ );
+
+ binding(19, 20, 21.5);
+ assignment(22, 23, 24.5);
+ function_call(25, 26, 27.5);
+ identifier(28, 29, 30.5);
+ return_expr(31, 32, 33.5);
+ arithmetic_expr(34, 35, 36.5);
+ if_expr(37, 38, 39.5);
+ while_expr(40, 41, 42);
+ loop_expr(43, 44, 45);
+}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+
+// gdb-command:finish
+// gdb-command:print *t0
+// gdb-check:$1 = 1
+// gdb-command:print *t1
+// gdb-check:$2 = 2.5
+// gdb-command:print ret
+// gdb-check:$3 = {{1, 2.5}, {2.5, 1}}
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print *t0
+// gdb-check:$4 = 3.5
+// gdb-command:print *t1
+// gdb-check:$5 = 4
+// gdb-command:print ret
+// gdb-check:$6 = {{3.5, 4}, {4, 3.5}}
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print *t0
+// gdb-check:$7 = 5
+// gdb-command:print *t1
+// gdb-check:$8 = {a = 6, b = 7.5}
+// gdb-command:print ret
+// gdb-check:$9 = {{5, {a = 6, b = 7.5}}, {{a = 6, b = 7.5}, 5}}
+// gdb-command:continue
+
+#[deriving(Clone)]
+struct Struct {
+ a: int,
+ b: f64
+}
+
+fn dup_tup<T0: Clone, T1: Clone>(t0: &T0, t1: &T1) -> ((T0, T1), (T1, T0)) {
+ let ret = ((t0.clone(), t1.clone()), (t1.clone(), t0.clone()));
+ zzz();
+ ret
+}
+
+fn main() {
+
+ let _ = dup_tup(&1, &2.5);
+ let _ = dup_tup(&3.5, &4_u16);
+ let _ = dup_tup(&5, &Struct { a: 6, b: 7.5 });
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$1 = -1
+// gdb-command:print y
+// gdb-check:$2 = 1
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$3 = -1
+// gdb-command:print y
+// gdb-check:$4 = 2.5
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$5 = -2.5
+// gdb-command:print y
+// gdb-check:$6 = 1
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$7 = -2.5
+// gdb-command:print y
+// gdb-check:$8 = 2.5
+// gdb-command:continue
+
+fn outer<TA: Clone>(a: TA) {
+ inner(a.clone(), 1);
+ inner(a.clone(), 2.5);
+
+ fn inner<TX, TY>(x: TX, y: TY) {
+ zzz();
+ }
+}
+
+fn main() {
+ outer(-1);
+ outer(-2.5);
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+
+// STACK BY REF
+// gdb-command:finish
+// gdb-command:print *self
+// gdb-check:$1 = {x = {8888, -8888}}
+// gdb-command:print arg1
+// gdb-check:$2 = -1
+// gdb-command:print/d arg2
+// gdb-check:$3 = -2
+// gdb-command:continue
+
+// STACK BY VAL
+// gdb-command:finish
+// gdb-command:print self
+// gdb-check:$4 = {x = {8888, -8888}}
+// gdb-command:print arg1
+// gdb-check:$5 = -3
+// gdb-command:print arg2
+// gdb-check:$6 = -4
+// gdb-command:continue
+
+// OWNED BY REF
+// gdb-command:finish
+// gdb-command:print *self
+// gdb-check:$7 = {x = 1234.5}
+// gdb-command:print arg1
+// gdb-check:$8 = -5
+// gdb-command:print arg2
+// gdb-check:$9 = -6
+// gdb-command:continue
+
+// OWNED BY VAL
+// gdb-command:finish
+// gdb-command:print self
+// gdb-check:$10 = {x = 1234.5}
+// gdb-command:print arg1
+// gdb-check:$11 = -7
+// gdb-command:print arg2
+// gdb-check:$12 = -8
+// gdb-command:continue
+
+// OWNED MOVED
+// gdb-command:finish
+// gdb-command:print *self
+// gdb-check:$13 = {x = 1234.5}
+// gdb-command:print arg1
+// gdb-check:$14 = -9
+// gdb-command:print arg2
+// gdb-check:$15 = -10.5
+// gdb-command:continue
+
+struct Struct<T> {
+ x: T
+}
+
+impl<T1> Struct<T1> {
+
+ fn self_by_ref<T2>(&self, arg1: int, arg2: T2) -> int {
+ zzz();
+ arg1
+ }
+
+ fn self_by_val<T2>(self, arg1: int, arg2: T2) -> int {
+ zzz();
+ arg1
+ }
+
+ fn self_owned<T2>(~self, arg1: int, arg2: T2) -> int {
+ zzz();
+ arg1
+ }
+}
+
+fn main() {
+ let stack = Struct { x: (8888_u32, -8888_i32) };
+ let _ = stack.self_by_ref(-1, -2_i8);
+ let _ = stack.self_by_val(-3, -4_i16);
+
+ let owned = box Struct { x: 1234.5 };
+ let _ = owned.self_by_ref(-5, -6_i32);
+ let _ = owned.self_by_val(-7, -8_i64);
+ let _ = owned.self_owned(-9, -10.5_f32);
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+
+// STRUCT
+// gdb-command:finish
+// gdb-command:print arg1
+// gdb-check:$1 = 1
+// gdb-command:print arg2
+// gdb-check:$2 = 2
+// gdb-command:continue
+
+// ENUM
+// gdb-command:finish
+// gdb-command:print arg1
+// gdb-check:$3 = -3
+// gdb-command:print arg2
+// gdb-check:$4 = 4.5
+// gdb-command:print arg3
+// gdb-check:$5 = 5
+// gdb-command:continue
+
+#![feature(struct_variant)]
+
+struct Struct {
+ x: int
+}
+
+impl Struct {
+
+ fn static_method<T1, T2>(arg1: T1, arg2: T2) -> int {
+ zzz();
+ return 0;
+ }
+}
+
+enum Enum {
+ Variant1 { x: int },
+ Variant2,
+ Variant3(f64, int, char),
+}
+
+impl Enum {
+
+ fn static_method<T1, T2, T3>(arg1: T1, arg2: T2, arg3: T3) -> int {
+ zzz();
+ return 1;
+ }
+}
+
+fn main() {
+ Struct::static_method(1, 2);
+ Enum::static_method(-3, 4.5, 5);
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-tidy-linelength
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:set print union on
+// gdb-command:rbreak zzz
+// gdb-command:run
+// gdb-command:finish
+
+// gdb-command:print case1
+// gdb-check:$1 = {{Case1, a = 0, b = 31868, c = 31868, d = 31868, e = 31868}, {Case1, a = 0, b = 2088533116, c = 2088533116}, {Case1, a = 0, b = 8970181431921507452}}
+
+// gdb-command:print case2
+// gdb-check:$2 = {{Case2, a = 0, b = 4369, c = 4369, d = 4369, e = 4369}, {Case2, a = 0, b = 286331153, c = 286331153}, {Case2, a = 0, b = 1229782938247303441}}
+
+// gdb-command:print case3
+// gdb-check:$3 = {{Case3, a = 0, b = 22873, c = 22873, d = 22873, e = 22873}, {Case3, a = 0, b = 1499027801, c = 1499027801}, {Case3, a = 0, b = 6438275382588823897}}
+
+// gdb-command:print univariant
+// gdb-check:$4 = {a = -1}
+
+#![feature(struct_variant)]
+
+// NOTE: This is a copy of the non-generic test case. The `Txx` type parameters have to be
+// substituted with something of size `xx` bits and the same alignment as an integer type of the
+// same size.
+
+// The first element is to ensure proper alignment, irrespective of the machines word size. Since
+// the size of the discriminant value is machine dependent, this has be taken into account when
+// datatype layout should be predictable as in this case.
+enum Regular<T16, T32, T64> {
+ Case1 { a: T64, b: T16, c: T16, d: T16, e: T16},
+ Case2 { a: T64, b: T32, c: T32},
+ Case3 { a: T64, b: T64 }
+}
+
+enum Univariant<T> {
+ TheOnlyCase { a: T }
+}
+
+fn main() {
+
+ // In order to avoid endianess trouble all of the following test values consist of a single
+ // repeated byte. This way each interpretation of the union should look the same, no matter if
+ // this is a big or little endian machine.
+
+ // 0b0111110001111100011111000111110001111100011111000111110001111100 = 8970181431921507452
+ // 0b01111100011111000111110001111100 = 2088533116
+ // 0b0111110001111100 = 31868
+ // 0b01111100 = 124
+ let case1: Regular<u16, u32, i64> = Case1 { a: 0, b: 31868, c: 31868, d: 31868, e: 31868 };
+
+ // 0b0001000100010001000100010001000100010001000100010001000100010001 = 1229782938247303441
+ // 0b00010001000100010001000100010001 = 286331153
+ // 0b0001000100010001 = 4369
+ // 0b00010001 = 17
+ let case2: Regular<i16, u32, i64> = Case2 { a: 0, b: 286331153, c: 286331153 };
+
+ // 0b0101100101011001010110010101100101011001010110010101100101011001 = 6438275382588823897
+ // 0b01011001010110010101100101011001 = 1499027801
+ // 0b0101100101011001 = 22873
+ // 0b01011001 = 89
+ let case3: Regular<u16, i32, u64> = Case3 { a: 0, b: 6438275382588823897 };
+
+ let univariant = TheOnlyCase { a: -1 };
+
+ zzz();
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+
+// gdb-command:finish
+// gdb-command:print int_int
+// gdb-check:$1 = {key = 0, value = 1}
+// gdb-command:print int_float
+// gdb-check:$2 = {key = 2, value = 3.5}
+// gdb-command:print float_int
+// gdb-check:$3 = {key = 4.5, value = 5}
+// gdb-command:print float_int_float
+// gdb-check:$4 = {key = 6.5, value = {key = 7, value = 8.5}}
+
+struct AGenericStruct<TKey, TValue> {
+ key: TKey,
+ value: TValue
+}
+
+fn main() {
+
+ let int_int = AGenericStruct { key: 0, value: 1 };
+ let int_float = AGenericStruct { key: 2, value: 3.5 };
+ let float_int = AGenericStruct { key: 4.5, value: 5 };
+ let float_int_float = AGenericStruct { key: 6.5, value: AGenericStruct { key: 7, value: 8.5 } };
+
+ zzz();
+}
+
+fn zzz() {()}
--- /dev/null
+// ignore-test
+
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+
+// gdb-command:finish
+// gdb-command:print arg1
+// gdb-check:$1 = 1000
+// gdb-command:print *arg2
+// gdb-check:$2 = {1, 2.5}
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print arg1
+// gdb-check:$3 = 2000
+// gdb-command:print *arg2
+// gdb-check:$4 = {3.5, {4, 5, 6}}
+// gdb-command:continue
+
+
+struct Struct {
+ x: int
+}
+
+trait Trait<T1> {
+ fn generic_static_default_method<T2>(arg1: int, arg2: &(T1, T2)) -> int {
+ zzz();
+ arg1
+ }
+}
+
+impl<T> Trait<T> for Struct {}
+
+fn main() {
+
+ // Is this really how to use these?
+ Trait::generic_static_default_method::<int, Struct, float>(1000, &(1, 2.5));
+ Trait::generic_static_default_method::<float, Struct, (int, int, int)>(2000, &(3.5, (4, 5, 6)));
+
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-tidy-linelength
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:set print union on
+// gdb-command:rbreak zzz
+// gdb-command:run
+// gdb-command:finish
+
+// gdb-command:print case1
+// gdb-check:$1 = {{Case1, 0, 31868, 31868, 31868, 31868}, {Case1, 0, 2088533116, 2088533116}, {Case1, 0, 8970181431921507452}}
+
+// gdb-command:print case2
+// gdb-check:$2 = {{Case2, 0, 4369, 4369, 4369, 4369}, {Case2, 0, 286331153, 286331153}, {Case2, 0, 1229782938247303441}}
+
+// gdb-command:print case3
+// gdb-check:$3 = {{Case3, 0, 22873, 22873, 22873, 22873}, {Case3, 0, 1499027801, 1499027801}, {Case3, 0, 6438275382588823897}}
+
+// gdb-command:print univariant
+// gdb-check:$4 = {-1}
+
+
+// NOTE: This is a copy of the non-generic test case. The `Txx` type parameters have to be
+// substituted with something of size `xx` bits and the same alignment as an integer type of the
+// same size.
+
+// The first element is to ensure proper alignment, irrespective of the machines word size. Since
+// the size of the discriminant value is machine dependent, this has be taken into account when
+// datatype layout should be predictable as in this case.
+enum Regular<T16, T32, T64> {
+ Case1(T64, T16, T16, T16, T16),
+ Case2(T64, T32, T32),
+ Case3(T64, T64)
+}
+
+enum Univariant<T64> {
+ TheOnlyCase(T64)
+}
+
+fn main() {
+
+ // In order to avoid endianess trouble all of the following test values consist of a single
+ // repeated byte. This way each interpretation of the union should look the same, no matter if
+ // this is a big or little endian machine.
+
+ // 0b0111110001111100011111000111110001111100011111000111110001111100 = 8970181431921507452
+ // 0b01111100011111000111110001111100 = 2088533116
+ // 0b0111110001111100 = 31868
+ // 0b01111100 = 124
+ let case1: Regular<u16, u32, u64> = Case1(0_u64, 31868_u16, 31868_u16, 31868_u16, 31868_u16);
+
+ // 0b0001000100010001000100010001000100010001000100010001000100010001 = 1229782938247303441
+ // 0b00010001000100010001000100010001 = 286331153
+ // 0b0001000100010001 = 4369
+ // 0b00010001 = 17
+ let case2: Regular<i16, i32, i64> = Case2(0_i64, 286331153_i32, 286331153_i32);
+
+ // 0b0101100101011001010110010101100101011001010110010101100101011001 = 6438275382588823897
+ // 0b01011001010110010101100101011001 = 1499027801
+ // 0b0101100101011001 = 22873
+ // 0b01011001 = 89
+ let case3: Regular<i16, i32, i64> = Case3(0_i64, 6438275382588823897_i64);
+
+ let univariant = TheOnlyCase(-1_i64);
+
+ zzz();
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+// gdb-command:finish
+// gdb-command:print string1.length
+// gdb-check:$1 = 48
+// gdb-command:print string2.length
+// gdb-check:$2 = 48
+// gdb-command:print string3.length
+// gdb-check:$3 = 48
+// gdb-command:continue
+
+#![allow(unused_variable)]
+
+// This test case makes sure that debug info does not ICE when include_str is
+// used multiple times (see issue #11322).
+
+fn main() {
+ let string1 = include_str!("text-to-include-1.txt");
+ let string2 = include_str!("text-to-include-2.txt");
+ let string3 = include_str!("text-to-include-3.txt");
+ zzz();
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// This test was actually never run before because commands were only parsed up to the first
+// function definition but the test relied on the function being above the commands. Ignore for now.
+// ignore-test
+
+fn main() {
+ let args : ~[~str] = ::std::os::args();
+ ::std::io::println(args[0]);
+}
+
+// ignore-android: FIXME(#10381)
+
+// This test case checks whether compile unit names are set correctly, so that the correct default
+// source file can be found.
+
+// compile-flags:-g
+// gdb-command:list
+// gdb-check:1[...]fn main() {
+// gdb-check:2[...]let args : ~[~str] = ::std::os::args();
+// gdb-check:3[...]::std::io::println(args[0]);
+// gdb-check:4[...]}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:break issue12886.rs:29
+// gdb-command:run
+// gdb-command:next
+// gdb-check:[...]30[...]s
+// gdb-command:continue
+
+// IF YOU MODIFY THIS FILE, BE CAREFUL TO ADAPT THE LINE NUMBERS IN THE DEBUGGER COMMANDS
+
+// This test makes sure that gdb does not set unwanted breakpoints in inlined functions. If a
+// breakpoint existed in unwrap(), then calling `next` would (when stopped at line 27) would stop
+// in unwrap() instead of stepping over the function invocation. By making sure that `s` is
+// contained in the output, after calling `next` just once, we can be sure that we did not stop in
+// unwrap(). (The testing framework doesn't allow for checking that some text is *not* contained in
+// the output, which is why we have to make the test in this kind of roundabout way)
+fn bar() -> int {
+ let s = Some(5).unwrap();
+ s
+}
+
+fn main() {
+ let _ = bar();
+}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// aux-build:issue13213aux.rs
+extern crate issue13213aux;
+
+// compile-flags:-g
+
+// This tests make sure that we get no linker error when using a completely inlined static. Some
+// statics that are marked with AvailableExternallyLinkage in the importing crate, may actually not
+// be available because they have been optimized out from the exporting crate.
+fn main() {
+ let b: issue13213aux::S = issue13213aux::A;
+ zzz();
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// compile-flags:--debuginfo=1
+
+pub trait TraitWithDefaultMethod {
+ fn method(self) {
+ ()
+ }
+}
+
+struct MyStruct;
+
+impl TraitWithDefaultMethod for MyStruct { }
+
+pub fn main() {
+ MyStruct.method();
+}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+
+// FIRST ITERATION
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$1 = 1
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$2 = -1
+// gdb-command:continue
+
+// SECOND ITERATION
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$3 = 2
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$4 = -2
+// gdb-command:continue
+
+// THIRD ITERATION
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$5 = 3
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$6 = -3
+// gdb-command:continue
+
+// AFTER LOOP
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$7 = 1000000
+// gdb-command:continue
+
+fn main() {
+
+ let range = [1, 2, 3];
+
+ let x = 1000000; // wan meeeljen doollaars!
+
+ for &x in range.iter() {
+ zzz();
+ sentinel();
+
+ let x = -1 * x;
+
+ zzz();
+ sentinel();
+ }
+
+ zzz();
+ sentinel();
+}
+
+fn zzz() {()}
+fn sentinel() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+
+// BEFORE if
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$1 = 999
+// gdb-command:print y
+// gdb-check:$2 = -1
+// gdb-command:continue
+
+// AT BEGINNING of 'then' block
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$3 = 999
+// gdb-command:print y
+// gdb-check:$4 = -1
+// gdb-command:continue
+
+// AFTER 1st redeclaration of 'x'
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$5 = 1001
+// gdb-command:print y
+// gdb-check:$6 = -1
+// gdb-command:continue
+
+// AFTER 2st redeclaration of 'x'
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$7 = 1002
+// gdb-command:print y
+// gdb-check:$8 = 1003
+// gdb-command:continue
+
+// AFTER 1st if expression
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$9 = 999
+// gdb-command:print y
+// gdb-check:$10 = -1
+// gdb-command:continue
+
+// BEGINNING of else branch
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$11 = 999
+// gdb-command:print y
+// gdb-check:$12 = -1
+// gdb-command:continue
+
+// BEGINNING of else branch
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$13 = 1004
+// gdb-command:print y
+// gdb-check:$14 = 1005
+// gdb-command:continue
+
+// BEGINNING of else branch
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$15 = 999
+// gdb-command:print y
+// gdb-check:$16 = -1
+// gdb-command:continue
+
+fn main() {
+
+ let x = 999;
+ let y = -1;
+
+ zzz();
+ sentinel();
+
+ if x < 1000 {
+ zzz();
+ sentinel();
+
+ let x = 1001;
+
+ zzz();
+ sentinel();
+
+ let x = 1002;
+ let y = 1003;
+ zzz();
+ sentinel();
+ } else {
+ unreachable!();
+ }
+
+ zzz();
+ sentinel();
+
+ if x > 1000 {
+ unreachable!();
+ } else {
+ zzz();
+ sentinel();
+
+ let x = 1004;
+ let y = 1005;
+ zzz();
+ sentinel();
+ }
+
+ zzz();
+ sentinel();
+}
+
+fn zzz() {()}
+fn sentinel() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+
+// gdb-command:finish
+// gdb-command:print shadowed
+// gdb-check:$1 = 231
+// gdb-command:print not_shadowed
+// gdb-check:$2 = 232
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print shadowed
+// gdb-check:$3 = 233
+// gdb-command:print not_shadowed
+// gdb-check:$4 = 232
+// gdb-command:print local_to_arm
+// gdb-check:$5 = 234
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print shadowed
+// gdb-check:$6 = 236
+// gdb-command:print not_shadowed
+// gdb-check:$7 = 232
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print shadowed
+// gdb-check:$8 = 237
+// gdb-command:print not_shadowed
+// gdb-check:$9 = 232
+// gdb-command:print local_to_arm
+// gdb-check:$10 = 238
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print shadowed
+// gdb-check:$11 = 239
+// gdb-command:print not_shadowed
+// gdb-check:$12 = 232
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print shadowed
+// gdb-check:$13 = 241
+// gdb-command:print not_shadowed
+// gdb-check:$14 = 232
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print shadowed
+// gdb-check:$15 = 243
+// gdb-command:print *local_to_arm
+// gdb-check:$16 = 244
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print shadowed
+// gdb-check:$17 = 231
+// gdb-command:print not_shadowed
+// gdb-check:$18 = 232
+// gdb-command:continue
+
+struct Struct {
+ x: int,
+ y: int
+}
+
+fn main() {
+
+ let shadowed = 231;
+ let not_shadowed = 232;
+
+ zzz();
+ sentinel();
+
+ match (233, 234) {
+ (shadowed, local_to_arm) => {
+
+ zzz();
+ sentinel();
+ }
+ }
+
+ match (235, 236) {
+ // with literal
+ (235, shadowed) => {
+
+ zzz();
+ sentinel();
+ }
+ _ => {}
+ }
+
+ match Struct { x: 237, y: 238 } {
+ Struct { x: shadowed, y: local_to_arm } => {
+
+ zzz();
+ sentinel();
+ }
+ }
+
+ match Struct { x: 239, y: 240 } {
+ // ignored field
+ Struct { x: shadowed, .. } => {
+
+ zzz();
+ sentinel();
+ }
+ }
+
+ match Struct { x: 241, y: 242 } {
+ // with literal
+ Struct { x: shadowed, y: 242 } => {
+
+ zzz();
+ sentinel();
+ }
+ _ => {}
+ }
+
+ match (243, 244) {
+ (shadowed, ref local_to_arm) => {
+
+ zzz();
+ sentinel();
+ }
+ }
+
+ zzz();
+ sentinel();
+}
+
+fn zzz() {()}
+fn sentinel() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:--debuginfo=1
+// gdb-command:run
+
+// Nothing to do here really, just make sure it compiles. See issue #8513.
+fn main() {
+ let _ = ||();
+ let _ = range(1u,3).map(|_| 5);
+}
+
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$1 = false
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$2 = false
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$3 = 1000
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$4 = 2.5
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$5 = true
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$6 = false
+// gdb-command:continue
+
+fn main() {
+
+ let x = false;
+
+ zzz();
+ sentinel();
+
+ let stack_closure: |int| = |x| {
+ zzz();
+ sentinel();
+
+ let x = 2.5;
+
+ zzz();
+ sentinel();
+
+ let x = true;
+
+ zzz();
+ sentinel();
+ };
+
+ zzz();
+ sentinel();
+
+ stack_closure(1000);
+
+ zzz();
+ sentinel();
+}
+
+fn zzz() {()}
+fn sentinel() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+
+// FIRST ITERATION
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$1 = 0
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$2 = 1
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$3 = 101
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$4 = 101
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$5 = -987
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$6 = 101
+// gdb-command:continue
+
+
+// SECOND ITERATION
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$7 = 1
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$8 = 2
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$9 = 102
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$10 = 102
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$11 = -987
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$12 = 102
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$13 = 2
+// gdb-command:continue
+
+fn main() {
+
+ let mut x = 0;
+
+ loop {
+ if x >= 2 {
+ break;
+ }
+
+ zzz();
+ sentinel();
+
+ x += 1;
+ zzz();
+ sentinel();
+
+ // Shadow x
+ let x = x + 100;
+ zzz();
+ sentinel();
+
+ // open scope within loop's top level scope
+ {
+ zzz();
+ sentinel();
+
+ let x = -987;
+
+ zzz();
+ sentinel();
+ }
+
+ // Check that we get the x before the inner scope again
+ zzz();
+ sentinel();
+ }
+
+ zzz();
+ sentinel();
+}
+
+fn zzz() {()}
+fn sentinel() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$1 = false
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$2 = false
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$3 = 1000
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$4 = 2.5
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$5 = true
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$6 = false
+// gdb-command:continue
+
+fn main() {
+
+ let x = false;
+
+ zzz();
+ sentinel();
+
+ let unique_closure: proc(int) = proc(x) {
+ zzz();
+ sentinel();
+
+ let x = 2.5;
+
+ zzz();
+ sentinel();
+
+ let x = true;
+
+ zzz();
+ sentinel();
+ };
+
+ zzz();
+ sentinel();
+
+ unique_closure(1000);
+
+ zzz();
+ sentinel();
+}
+
+fn zzz() {()}
+fn sentinel() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+
+// FIRST ITERATION
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$1 = 0
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$2 = 1
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$3 = 101
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$4 = 101
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$5 = -987
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$6 = 101
+// gdb-command:continue
+
+
+// SECOND ITERATION
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$7 = 1
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$8 = 2
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$9 = 102
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$10 = 102
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$11 = -987
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$12 = 102
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$13 = 2
+// gdb-command:continue
+
+fn main() {
+
+ let mut x = 0;
+
+ while x < 2 {
+ zzz();
+ sentinel();
+
+ x += 1;
+ zzz();
+ sentinel();
+
+ // Shadow x
+ let x = x + 100;
+ zzz();
+ sentinel();
+
+ // open scope within loop's top level scope
+ {
+ zzz();
+ sentinel();
+
+ let x = -987;
+
+ zzz();
+ sentinel();
+ }
+
+ // Check that we get the x before the inner scope again
+ zzz();
+ sentinel();
+ }
+
+ zzz();
+ sentinel();
+}
+
+fn zzz() {()}
+fn sentinel() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+
+// gdb-command:finish
+// gdb-command:print a
+// gdb-check:$1 = 10
+// gdb-command:print b
+// gdb-check:$2 = 34
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print a
+// gdb-check:$3 = 890242
+// gdb-command:print b
+// gdb-check:$4 = 34
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print a
+// gdb-check:$5 = 10
+// gdb-command:print b
+// gdb-check:$6 = 34
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print a
+// gdb-check:$7 = 102
+// gdb-command:print b
+// gdb-check:$8 = 34
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print a
+// gdb-check:$9 = 110
+// gdb-command:print b
+// gdb-check:$10 = 34
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print a
+// gdb-check:$11 = 10
+// gdb-command:print b
+// gdb-check:$12 = 34
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print a
+// gdb-check:$13 = 10
+// gdb-command:print b
+// gdb-check:$14 = 34
+// gdb-command:print c
+// gdb-check:$15 = 400
+// gdb-command:continue
+
+#![feature(macro_rules)]
+
+macro_rules! trivial(
+ ($e1:expr) => ($e1)
+)
+
+macro_rules! no_new_scope(
+ ($e1:expr) => (($e1 + 2) - 1)
+)
+
+macro_rules! new_scope(
+ () => ({
+ let a = 890242;
+ zzz();
+ sentinel();
+ })
+)
+
+macro_rules! shadow_within_macro(
+ ($e1:expr) => ({
+ let a = $e1 + 2;
+
+ zzz();
+ sentinel();
+
+ let a = $e1 + 10;
+
+ zzz();
+ sentinel();
+ })
+)
+
+
+macro_rules! dup_expr(
+ ($e1:expr) => (($e1) + ($e1))
+)
+
+
+fn main() {
+
+ let a = trivial!(10);
+ let b = no_new_scope!(33);
+
+ zzz();
+ sentinel();
+
+ new_scope!();
+
+ zzz();
+ sentinel();
+
+ shadow_within_macro!(100);
+
+ zzz();
+ sentinel();
+
+ let c = dup_expr!(10 * 20);
+
+ zzz();
+ sentinel();
+}
+
+fn zzz() {()}
+fn sentinel() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-win32: FIXME #13256
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+
+// gdb-command:print 'lexical-scopes-in-block-expression::MUT_INT'
+// gdb-check:$1 = 0
+
+// STRUCT EXPRESSION
+// gdb-command:finish
+// gdb-command:print val
+// gdb-check:$2 = -1
+// gdb-command:print ten
+// gdb-check:$3 = 10
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print val
+// gdb-check:$4 = 11
+// gdb-command:print 'lexical-scopes-in-block-expression::MUT_INT'
+// gdb-check:$5 = 1
+// gdb-command:print ten
+// gdb-check:$6 = 10
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print val
+// gdb-check:$7 = -1
+// gdb-command:print ten
+// gdb-check:$8 = 10
+// gdb-command:continue
+
+// FUNCTION CALL
+// gdb-command:finish
+// gdb-command:print val
+// gdb-check:$9 = -1
+// gdb-command:print ten
+// gdb-check:$10 = 10
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print val
+// gdb-check:$11 = 12
+// gdb-command:print 'lexical-scopes-in-block-expression::MUT_INT'
+// gdb-check:$12 = 2
+// gdb-command:print ten
+// gdb-check:$13 = 10
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print val
+// gdb-check:$14 = -1
+// gdb-command:print ten
+// gdb-check:$15 = 10
+// gdb-command:continue
+
+// TUPLE EXPRESSION
+// gdb-command:finish
+// gdb-command:print val
+// gdb-check:$16 = -1
+// gdb-command:print ten
+// gdb-check:$17 = 10
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print val
+// gdb-check:$18 = 13
+// gdb-command:print 'lexical-scopes-in-block-expression::MUT_INT'
+// gdb-check:$19 = 3
+// gdb-command:print ten
+// gdb-check:$20 = 10
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print val
+// gdb-check:$21 = -1
+// gdb-command:print ten
+// gdb-check:$22 = 10
+// gdb-command:continue
+
+// VEC EXPRESSION
+// gdb-command:finish
+// gdb-command:print val
+// gdb-check:$23 = -1
+// gdb-command:print ten
+// gdb-check:$24 = 10
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print val
+// gdb-check:$25 = 14
+// gdb-command:print 'lexical-scopes-in-block-expression::MUT_INT'
+// gdb-check:$26 = 4
+// gdb-command:print ten
+// gdb-check:$27 = 10
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print val
+// gdb-check:$28 = -1
+// gdb-command:print ten
+// gdb-check:$29 = 10
+// gdb-command:continue
+
+// REPEAT VEC EXPRESSION
+// gdb-command:finish
+// gdb-command:print val
+// gdb-check:$30 = -1
+// gdb-command:print ten
+// gdb-check:$31 = 10
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print val
+// gdb-check:$32 = 15
+// gdb-command:print 'lexical-scopes-in-block-expression::MUT_INT'
+// gdb-check:$33 = 5
+// gdb-command:print ten
+// gdb-check:$34 = 10
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print val
+// gdb-check:$35 = -1
+// gdb-command:print ten
+// gdb-check:$36 = 10
+// gdb-command:continue
+
+// ASSIGNMENT EXPRESSION
+// gdb-command:finish
+// gdb-command:print val
+// gdb-check:$37 = -1
+// gdb-command:print ten
+// gdb-check:$38 = 10
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print val
+// gdb-check:$39 = 16
+// gdb-command:print 'lexical-scopes-in-block-expression::MUT_INT'
+// gdb-check:$40 = 6
+// gdb-command:print ten
+// gdb-check:$41 = 10
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print val
+// gdb-check:$42 = -1
+// gdb-command:print ten
+// gdb-check:$43 = 10
+// gdb-command:continue
+
+
+// ARITHMETIC EXPRESSION
+// gdb-command:finish
+// gdb-command:print val
+// gdb-check:$44 = -1
+// gdb-command:print ten
+// gdb-check:$45 = 10
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print val
+// gdb-check:$46 = 17
+// gdb-command:print 'lexical-scopes-in-block-expression::MUT_INT'
+// gdb-check:$47 = 7
+// gdb-command:print ten
+// gdb-check:$48 = 10
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print val
+// gdb-check:$49 = -1
+// gdb-command:print ten
+// gdb-check:$50 = 10
+// gdb-command:continue
+
+// INDEX EXPRESSION
+// gdb-command:finish
+// gdb-command:print val
+// gdb-check:$51 = -1
+// gdb-command:print ten
+// gdb-check:$52 = 10
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print val
+// gdb-check:$53 = 18
+// gdb-command:print 'lexical-scopes-in-block-expression::MUT_INT'
+// gdb-check:$54 = 8
+// gdb-command:print ten
+// gdb-check:$55 = 10
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print val
+// gdb-check:$56 = -1
+// gdb-command:print ten
+// gdb-check:$57 = 10
+// gdb-command:continue
+
+#![allow(unused_variable)]
+#![allow(dead_assignment)]
+
+static mut MUT_INT: int = 0;
+
+struct Point {
+ x: int,
+ y: int
+}
+
+fn a_function(x: int) -> int {
+ x + 1
+}
+
+fn main() {
+
+ let val = -1;
+ let ten = 10;
+
+ // surrounded by struct expression
+ let point = Point {
+ x: {
+ zzz();
+ sentinel();
+
+ let val = ten + 1;
+ unsafe {MUT_INT = 1;};
+
+ zzz();
+ sentinel();
+
+ val
+ },
+ y: 10
+ };
+
+ zzz();
+ sentinel();
+
+ // surrounded by function call
+ let _ = a_function({
+ zzz();
+ sentinel();
+
+ let val = ten + 2;
+ unsafe {MUT_INT = 2;};
+
+ zzz();
+ sentinel();
+
+ val
+ });
+
+ zzz();
+ sentinel();
+
+
+ // surrounded by tup
+ let _ = ({
+ zzz();
+ sentinel();
+
+ let val = ten + 3;
+ unsafe {MUT_INT = 3;};
+
+ zzz();
+ sentinel();
+
+ val
+ }, 0);
+
+ zzz();
+ sentinel();
+
+ // surrounded by vec
+ let _ = [{
+ zzz();
+ sentinel();
+
+ let val = ten + 4;
+ unsafe {MUT_INT = 4;};
+
+ zzz();
+ sentinel();
+
+ val
+ }, 0, 0];
+
+ zzz();
+ sentinel();
+
+ // surrounded by repeat vec
+ let _ = [{
+ zzz();
+ sentinel();
+
+ let val = ten + 5;
+ unsafe {MUT_INT = 5;};
+
+ zzz();
+ sentinel();
+
+ val
+ }, ..10];
+
+ zzz();
+ sentinel();
+
+ // assignment expression
+ let mut var = 0;
+ var = {
+ zzz();
+ sentinel();
+
+ let val = ten + 6;
+ unsafe {MUT_INT = 6;};
+
+ zzz();
+ sentinel();
+
+ val
+ };
+
+ zzz();
+ sentinel();
+
+ // arithmetic expression
+ var = 10 + -{
+ zzz();
+ sentinel();
+
+ let val = ten + 7;
+ unsafe {MUT_INT = 7;};
+
+ zzz();
+ sentinel();
+
+ val
+ } * 5;
+
+ zzz();
+ sentinel();
+
+ // index expression
+ let a_vector = [10, ..20];
+ let _ = a_vector[{
+ zzz();
+ sentinel();
+
+ let val = ten + 8;
+ unsafe {MUT_INT = 8;};
+
+ zzz();
+ sentinel();
+
+ val as uint
+ }];
+
+ zzz();
+ sentinel();
+}
+
+fn zzz() {()}
+fn sentinel() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:--debuginfo=1
+
+// Make sure functions have proper names
+// gdb-command:info functions
+// gdb-check:[...]void[...]main([...]);
+// gdb-check:[...]void[...]some_function([...]);
+// gdb-check:[...]void[...]some_other_function([...]);
+// gdb-check:[...]void[...]zzz([...]);
+
+// gdb-command:rbreak zzz
+// gdb-command:run
+
+// Make sure there is no information about locals
+// gdb-command:finish
+// gdb-command:info locals
+// gdb-check:No locals.
+// gdb-command:continue
+
+
+#![allow(unused_variable)]
+
+struct Struct {
+ a: i64,
+ b: i32
+}
+
+fn main() {
+ some_function(101, 202);
+ some_other_function(1, 2);
+}
+
+
+fn zzz() {()}
+
+fn some_function(a: int, b: int) {
+ let some_variable = Struct { a: 11, b: 22 };
+ let some_other_variable = 23;
+ zzz();
+}
+
+fn some_other_function(a: int, b: int) -> bool { true }
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+// gdb-command:finish
+
+// gdb-command:print the_a->val
+// gdb-check:$1 = {{TheA, x = 0, y = 8970181431921507452}, {TheA, 0, 2088533116, 2088533116}}
+
+// gdb-command:print the_b->val
+// gdb-check:$2 = {{TheB, x = 0, y = 1229782938247303441}, {TheB, 0, 286331153, 286331153}}
+
+// gdb-command:print univariant->val
+// gdb-check:$3 = {-9747455}
+
+#![allow(unused_variable)]
+#![feature(struct_variant, managed_boxes)]
+
+// The first element is to ensure proper alignment, irrespective of the machines word size. Since
+// the size of the discriminant value is machine dependent, this has be taken into account when
+// datatype layout should be predictable as in this case.
+enum ABC {
+ TheA { x: i64, y: i64 },
+ TheB (i64, i32, i32),
+}
+
+// This is a special case since it does not have the implicit discriminant field.
+enum Univariant {
+ TheOnlyCase(i64)
+}
+
+fn main() {
+
+ // In order to avoid endianess trouble all of the following test values consist of a single
+ // repeated byte. This way each interpretation of the union should look the same, no matter if
+ // this is a big or little endian machine.
+
+ // 0b0111110001111100011111000111110001111100011111000111110001111100 = 8970181431921507452
+ // 0b01111100011111000111110001111100 = 2088533116
+ // 0b0111110001111100 = 31868
+ // 0b01111100 = 124
+ let the_a = @TheA { x: 0, y: 8970181431921507452 };
+
+ // 0b0001000100010001000100010001000100010001000100010001000100010001 = 1229782938247303441
+ // 0b00010001000100010001000100010001 = 286331153
+ // 0b0001000100010001 = 4369
+ // 0b00010001 = 17
+ let the_b = @TheB (0, 286331153, 286331153);
+
+ let univariant = @TheOnlyCase(-9747455);
+
+ zzz();
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+#![feature(managed_boxes)]
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+// gdb-command:finish
+
+// gdb-command:print unique.ptr[0]->val
+// gdb-check:$1 = 10
+
+// gdb-command:print unique.ptr[1]->val
+// gdb-check:$2 = 11
+
+// gdb-command:print unique.ptr[2]->val
+// gdb-check:$3 = 12
+
+// gdb-command:print unique.ptr[3]->val
+// gdb-check:$4 = 13
+
+#![allow(unused_variable)]
+
+fn main() {
+
+ let unique: Vec<@i64> = vec!(@10, @11, @12, @13);
+
+ zzz();
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+#![feature(managed_boxes)]
+
+// compile-flags:-g
+// gdb-command:set print pretty off
+// gdb-command:rbreak zzz
+// gdb-command:run
+// gdb-command:finish
+
+// gdb-command:print *ordinary_unique
+// gdb-check:$1 = {-1, -2}
+
+// gdb-command:print managed_within_unique->x
+// gdb-check:$2 = -3
+
+// gdb-command:print managed_within_unique->y->val
+// gdb-check:$3 = -4
+
+#![allow(unused_variable)]
+
+struct ContainsManaged {
+ x: int,
+ y: @int
+}
+
+fn main() {
+ let ordinary_unique = box() (-1, -2);
+
+ let managed_within_unique = box ContainsManaged { x: -3, y: @-4 };
+
+ zzz();
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+
+// STACK BY REF
+// gdb-command:finish
+// gdb-command:print *self
+// gdb-check:$1 = {{Variant2, [...]}, {Variant2, 117901063}}
+// gdb-command:print arg1
+// gdb-check:$2 = -1
+// gdb-command:print arg2
+// gdb-check:$3 = -2
+// gdb-command:continue
+
+// STACK BY VAL
+// gdb-command:finish
+// gdb-command:print self
+// gdb-check:$4 = {{Variant2, [...]}, {Variant2, 117901063}}
+// gdb-command:print arg1
+// gdb-check:$5 = -3
+// gdb-command:print arg2
+// gdb-check:$6 = -4
+// gdb-command:continue
+
+// OWNED BY REF
+// gdb-command:finish
+// gdb-command:print *self
+// gdb-check:$7 = {{Variant1, x = 1799, y = 1799}, {Variant1, [...]}}
+// gdb-command:print arg1
+// gdb-check:$8 = -5
+// gdb-command:print arg2
+// gdb-check:$9 = -6
+// gdb-command:continue
+
+// OWNED BY VAL
+// gdb-command:finish
+// gdb-command:print self
+// gdb-check:$10 = {{Variant1, x = 1799, y = 1799}, {Variant1, [...]}}
+// gdb-command:print arg1
+// gdb-check:$11 = -7
+// gdb-command:print arg2
+// gdb-check:$12 = -8
+// gdb-command:continue
+
+// OWNED MOVED
+// gdb-command:finish
+// gdb-command:print *self
+// gdb-check:$13 = {{Variant1, x = 1799, y = 1799}, {Variant1, [...]}}
+// gdb-command:print arg1
+// gdb-check:$14 = -9
+// gdb-command:print arg2
+// gdb-check:$15 = -10
+// gdb-command:continue
+
+#![feature(struct_variant)]
+
+enum Enum {
+ Variant1 { x: u16, y: u16 },
+ Variant2 (u32)
+}
+
+impl Enum {
+
+ fn self_by_ref(&self, arg1: int, arg2: int) -> int {
+ zzz();
+ arg1 + arg2
+ }
+
+ fn self_by_val(self, arg1: int, arg2: int) -> int {
+ zzz();
+ arg1 + arg2
+ }
+
+ fn self_owned(~self, arg1: int, arg2: int) -> int {
+ zzz();
+ arg1 + arg2
+ }
+}
+
+fn main() {
+ let stack = Variant2(117901063);
+ let _ = stack.self_by_ref(-1, -2);
+ let _ = stack.self_by_val(-3, -4);
+
+ let owned = box Variant1{ x: 1799, y: 1799 };
+ let _ = owned.self_by_ref(-5, -6);
+ let _ = owned.self_by_val(-7, -8);
+ let _ = owned.self_owned(-9, -10);
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+
+// STACK BY REF
+// gdb-command:finish
+// gdb-command:print *self
+// gdb-check:$1 = {x = {8888, -8888}}
+// gdb-command:print arg1
+// gdb-check:$2 = -1
+// gdb-command:print arg2
+// gdb-check:$3 = -2
+// gdb-command:continue
+
+// STACK BY VAL
+// gdb-command:finish
+// gdb-command:print self
+// gdb-check:$4 = {x = {8888, -8888}}
+// gdb-command:print arg1
+// gdb-check:$5 = -3
+// gdb-command:print arg2
+// gdb-check:$6 = -4
+// gdb-command:continue
+
+// OWNED BY REF
+// gdb-command:finish
+// gdb-command:print *self
+// gdb-check:$7 = {x = 1234.5}
+// gdb-command:print arg1
+// gdb-check:$8 = -5
+// gdb-command:print arg2
+// gdb-check:$9 = -6
+// gdb-command:continue
+
+// OWNED BY VAL
+// gdb-command:finish
+// gdb-command:print self
+// gdb-check:$10 = {x = 1234.5}
+// gdb-command:print arg1
+// gdb-check:$11 = -7
+// gdb-command:print arg2
+// gdb-check:$12 = -8
+// gdb-command:continue
+
+// OWNED MOVED
+// gdb-command:finish
+// gdb-command:print *self
+// gdb-check:$13 = {x = 1234.5}
+// gdb-command:print arg1
+// gdb-check:$14 = -9
+// gdb-command:print arg2
+// gdb-check:$15 = -10
+// gdb-command:continue
+
+struct Struct<T> {
+ x: T
+}
+
+impl<T> Struct<T> {
+
+ fn self_by_ref(&self, arg1: int, arg2: int) -> int {
+ zzz();
+ arg1 + arg2
+ }
+
+ fn self_by_val(self, arg1: int, arg2: int) -> int {
+ zzz();
+ arg1 + arg2
+ }
+
+ fn self_owned(~self, arg1: int, arg2: int) -> int {
+ zzz();
+ arg1 + arg2
+ }
+}
+
+fn main() {
+ let stack = Struct { x: (8888_u32, -8888_i32) };
+ let _ = stack.self_by_ref(-1, -2);
+ let _ = stack.self_by_val(-3, -4);
+
+ let owned = box Struct { x: 1234.5 };
+ let _ = owned.self_by_ref(-5, -6);
+ let _ = owned.self_by_val(-7, -8);
+ let _ = owned.self_owned(-9, -10);
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+
+// STACK BY REF
+// gdb-command:finish
+// gdb-command:print *self
+// gdb-check:$1 = {x = 100}
+// gdb-command:print arg1
+// gdb-check:$2 = -1
+// gdb-command:print arg2
+// gdb-check:$3 = -2
+// gdb-command:continue
+
+// STACK BY VAL
+// gdb-command:finish
+// gdb-command:print self
+// gdb-check:$4 = {x = 100}
+// gdb-command:print arg1
+// gdb-check:$5 = -3
+// gdb-command:print arg2
+// gdb-check:$6 = -4
+// gdb-command:continue
+
+// OWNED BY REF
+// gdb-command:finish
+// gdb-command:print *self
+// gdb-check:$7 = {x = 200}
+// gdb-command:print arg1
+// gdb-check:$8 = -5
+// gdb-command:print arg2
+// gdb-check:$9 = -6
+// gdb-command:continue
+
+// OWNED BY VAL
+// gdb-command:finish
+// gdb-command:print self
+// gdb-check:$10 = {x = 200}
+// gdb-command:print arg1
+// gdb-check:$11 = -7
+// gdb-command:print arg2
+// gdb-check:$12 = -8
+// gdb-command:continue
+
+// OWNED MOVED
+// gdb-command:finish
+// gdb-command:print *self
+// gdb-check:$13 = {x = 200}
+// gdb-command:print arg1
+// gdb-check:$14 = -9
+// gdb-command:print arg2
+// gdb-check:$15 = -10
+// gdb-command:continue
+
+struct Struct {
+ x: int
+}
+
+impl Struct {
+
+ fn self_by_ref(&self, arg1: int, arg2: int) -> int {
+ zzz();
+ self.x + arg1 + arg2
+ }
+
+ fn self_by_val(self, arg1: int, arg2: int) -> int {
+ zzz();
+ self.x + arg1 + arg2
+ }
+
+ fn self_owned(~self, arg1: int, arg2: int) -> int {
+ zzz();
+ self.x + arg1 + arg2
+ }
+}
+
+fn main() {
+ let stack = Struct { x: 100 };
+ let _ = stack.self_by_ref(-1, -2);
+ let _ = stack.self_by_val(-3, -4);
+
+ let owned = box Struct { x: 200 };
+ let _ = owned.self_by_ref(-5, -6);
+ let _ = owned.self_by_val(-7, -8);
+ let _ = owned.self_owned(-9, -10);
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+
+// STACK BY REF
+// gdb-command:finish
+// gdb-command:print *self
+// gdb-check:$1 = {x = 100}
+// gdb-command:print arg1
+// gdb-check:$2 = -1
+// gdb-command:print arg2
+// gdb-check:$3 = -2
+// gdb-command:continue
+
+// STACK BY VAL
+// gdb-command:finish
+// gdb-command:print self
+// gdb-check:$4 = {x = 100}
+// gdb-command:print arg1
+// gdb-check:$5 = -3
+// gdb-command:print arg2
+// gdb-check:$6 = -4
+// gdb-command:continue
+
+// OWNED BY REF
+// gdb-command:finish
+// gdb-command:print *self
+// gdb-check:$7 = {x = 200}
+// gdb-command:print arg1
+// gdb-check:$8 = -5
+// gdb-command:print arg2
+// gdb-check:$9 = -6
+// gdb-command:continue
+
+// OWNED BY VAL
+// gdb-command:finish
+// gdb-command:print self
+// gdb-check:$10 = {x = 200}
+// gdb-command:print arg1
+// gdb-check:$11 = -7
+// gdb-command:print arg2
+// gdb-check:$12 = -8
+// gdb-command:continue
+
+// OWNED MOVED
+// gdb-command:finish
+// gdb-command:print *self
+// gdb-check:$13 = {x = 200}
+// gdb-command:print arg1
+// gdb-check:$14 = -9
+// gdb-command:print arg2
+// gdb-check:$15 = -10
+// gdb-command:continue
+
+struct Struct {
+ x: int
+}
+
+trait Trait {
+ fn self_by_ref(&self, arg1: int, arg2: int) -> int;
+ fn self_by_val(self, arg1: int, arg2: int) -> int;
+ fn self_owned(~self, arg1: int, arg2: int) -> int;
+}
+
+impl Trait for Struct {
+
+ fn self_by_ref(&self, arg1: int, arg2: int) -> int {
+ zzz();
+ self.x + arg1 + arg2
+ }
+
+ fn self_by_val(self, arg1: int, arg2: int) -> int {
+ zzz();
+ self.x + arg1 + arg2
+ }
+
+ fn self_owned(~self, arg1: int, arg2: int) -> int {
+ zzz();
+ self.x + arg1 + arg2
+ }
+}
+
+fn main() {
+ let stack = Struct { x: 100 };
+ let _ = stack.self_by_ref(-1, -2);
+ let _ = stack.self_by_val(-3, -4);
+
+ let owned = box Struct { x: 200 };
+ let _ = owned.self_by_ref(-5, -6);
+ let _ = owned.self_by_val(-7, -8);
+ let _ = owned.self_owned(-9, -10);
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+
+// STACK BY REF
+// gdb-command:finish
+// gdb-command:print *self
+// gdb-check:$1 = {100, -100.5}
+// gdb-command:print arg1
+// gdb-check:$2 = -1
+// gdb-command:print arg2
+// gdb-check:$3 = -2
+// gdb-command:continue
+
+// STACK BY VAL
+// gdb-command:finish
+// gdb-command:print self
+// gdb-check:$4 = {100, -100.5}
+// gdb-command:print arg1
+// gdb-check:$5 = -3
+// gdb-command:print arg2
+// gdb-check:$6 = -4
+// gdb-command:continue
+
+// OWNED BY REF
+// gdb-command:finish
+// gdb-command:print *self
+// gdb-check:$7 = {200, -200.5}
+// gdb-command:print arg1
+// gdb-check:$8 = -5
+// gdb-command:print arg2
+// gdb-check:$9 = -6
+// gdb-command:continue
+
+// OWNED BY VAL
+// gdb-command:finish
+// gdb-command:print self
+// gdb-check:$10 = {200, -200.5}
+// gdb-command:print arg1
+// gdb-check:$11 = -7
+// gdb-command:print arg2
+// gdb-check:$12 = -8
+// gdb-command:continue
+
+// OWNED MOVED
+// gdb-command:finish
+// gdb-command:print *self
+// gdb-check:$13 = {200, -200.5}
+// gdb-command:print arg1
+// gdb-check:$14 = -9
+// gdb-command:print arg2
+// gdb-check:$15 = -10
+// gdb-command:continue
+
+struct TupleStruct(int, f64);
+
+impl TupleStruct {
+
+ fn self_by_ref(&self, arg1: int, arg2: int) -> int {
+ zzz();
+ arg1 + arg2
+ }
+
+ fn self_by_val(self, arg1: int, arg2: int) -> int {
+ zzz();
+ arg1 + arg2
+ }
+
+ fn self_owned(~self, arg1: int, arg2: int) -> int {
+ zzz();
+ arg1 + arg2
+ }
+}
+
+fn main() {
+ let stack = TupleStruct(100, -100.5);
+ let _ = stack.self_by_ref(-1, -2);
+ let _ = stack.self_by_val(-3, -4);
+
+ let owned = box TupleStruct(200, -200.5);
+ let _ = owned.self_by_ref(-5, -6);
+ let _ = owned.self_by_val(-7, -8);
+ let _ = owned.self_owned(-9, -10);
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+// gdb-command:finish
+
+// gdb-command:print abc
+// gdb-check:$1 = 10101
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print abc
+// gdb-check:$2 = 20202
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print abc
+// gdb-check:$3 = 30303
+
+#![allow(unused_variable)]
+
+fn function_one() {
+ let abc = 10101;
+ zzz();
+}
+
+fn function_two() {
+ let abc = 20202;
+ zzz();
+}
+
+
+fn function_three() {
+ let abc = 30303;
+ zzz();
+}
+
+
+fn main() {
+ function_one();
+ function_two();
+ function_three();
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+// gdb-command:finish
+
+// gdb-command:print a
+// gdb-check:$1 = 10101
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print b
+// gdb-check:$2 = 20202
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print c
+// gdb-check:$3 = 30303
+
+#![allow(unused_variable)]
+
+fn function_one() {
+ let a = 10101;
+ zzz();
+}
+
+fn function_two() {
+ let b = 20202;
+ zzz();
+}
+
+
+fn function_three() {
+ let c = 30303;
+ zzz();
+}
+
+
+fn main() {
+ function_one();
+ function_two();
+ function_three();
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$1 = false
+// gdb-command:print y
+// gdb-check:$2 = true
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$3 = 10
+// gdb-command:print y
+// gdb-check:$4 = true
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$5 = 10.5
+// gdb-command:print y
+// gdb-check:$6 = 20
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$7 = true
+// gdb-command:print y
+// gdb-check:$8 = 2220
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$9 = 203203.5
+// gdb-command:print y
+// gdb-check:$10 = 2220
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$11 = 10.5
+// gdb-command:print y
+// gdb-check:$12 = 20
+// gdb-command:continue
+
+fn main() {
+ let x = false;
+ let y = true;
+
+ zzz();
+ sentinel();
+
+ let x = 10;
+
+ zzz();
+ sentinel();
+
+ let x = 10.5;
+ let y = 20;
+
+ zzz();
+ sentinel();
+
+ {
+ let x = true;
+ let y = 2220;
+
+ zzz();
+ sentinel();
+
+ let x = 203203.5;
+
+ zzz();
+ sentinel();
+ }
+
+ zzz();
+ sentinel();
+}
+
+fn zzz() {()}
+fn sentinel() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+// gdb-command:finish
+
+// gdb-command:print first
+// gdb-check:$1 = {<No data fields>}
+
+// gdb-command:print second
+// gdb-check:$2 = {<No data fields>}
+
+#![allow(unused_variable)]
+
+enum ANilEnum {}
+enum AnotherNilEnum {}
+
+// I (mw) am not sure this test case makes much sense...
+// Also, it relies on some implementation details:
+// 1. That empty enums as well as '()' are represented as empty structs
+// 2. That gdb prints the string "{<No data fields>}" for empty structs (which may change some time)
+fn main() {
+ unsafe {
+ let first: ANilEnum = std::cast::transmute(());
+ let second: AnotherNilEnum = std::cast::transmute(());
+
+ zzz();
+ }
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+// gdb-command:finish
+
+// gdb-command:print some
+// gdb-check:$1 = {0x12345678}
+
+// gdb-command:print none
+// gdb-check:$2 = {0x0}
+
+// gdb-command:print full
+// gdb-check:$3 = {454545, 0x87654321, 9988}
+
+// gdb-command:print empty->discr
+// gdb-check:$4 = (int *) 0x0
+
+// gdb-command:print droid
+// gdb-check:$5 = {id = 675675, range = 10000001, internals = 0x43218765}
+
+// gdb-command:print void_droid->internals
+// gdb-check:$6 = (int *) 0x0
+
+// gdb-command:continue
+
+#![feature(struct_variant)]
+
+// If a struct has exactly two variants, one of them is empty, and the other one
+// contains a non-nullable pointer, then this value is used as the discriminator.
+// The test cases in this file make sure that something readable is generated for
+// this kind of types.
+// Unfortunately (for these test cases) the content of the non-discriminant fields
+// in the null-case is not defined. So we just read the discriminator field in
+// this case (by casting the value to a memory-equivalent struct).
+
+enum MoreFields<'a> {
+ Full(u32, &'a int, i16),
+ Empty
+}
+
+struct MoreFieldsRepr<'a> {
+ a: u32,
+ discr: &'a int,
+ b: i16
+}
+
+enum NamedFields<'a> {
+ Droid { id: i32, range: i64, internals: &'a int },
+ Void
+}
+
+struct NamedFieldsRepr<'a> {
+ id: i32,
+ range: i64,
+ internals: &'a int
+}
+
+fn main() {
+
+ let some: Option<&u32> = Some(unsafe { std::cast::transmute(0x12345678) });
+ let none: Option<&u32> = None;
+
+ let full = Full(454545, unsafe { std::cast::transmute(0x87654321) }, 9988);
+
+ let int_val = 0;
+ let empty: &MoreFieldsRepr = unsafe { std::cast::transmute(&Empty) };
+
+ let droid = Droid {
+ id: 675675,
+ range: 10000001,
+ internals: unsafe { std::cast::transmute(0x43218765) }
+ };
+
+ let void_droid: &NamedFieldsRepr = unsafe { std::cast::transmute(&Void) };
+
+ zzz();
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-tidy-linelength
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:set print pretty off
+// gdb-command:rbreak zzz
+// gdb-command:run
+// gdb-command:finish
+
+// gdb-command:print packed
+// gdb-check:$1 = {x = 123, y = 234, z = 345}
+
+// gdb-command:print packedInPacked
+// gdb-check:$2 = {a = 1111, b = {x = 2222, y = 3333, z = 4444}, c = 5555, d = {x = 6666, y = 7777, z = 8888}}
+
+// gdb-command:print packedInUnpacked
+// gdb-check:$3 = {a = -1111, b = {x = -2222, y = -3333, z = -4444}, c = -5555, d = {x = -6666, y = -7777, z = -8888}}
+
+// gdb-command:print unpackedInPacked
+// gdb-check:$4 = {a = 987, b = {x = 876, y = 765, z = 654}, c = {x = 543, y = 432, z = 321}, d = 210}
+
+
+// gdb-command:print packedInPackedWithDrop
+// gdb-check:$5 = {a = 11, b = {x = 22, y = 33, z = 44}, c = 55, d = {x = 66, y = 77, z = 88}}
+
+// gdb-command:print packedInUnpackedWithDrop
+// gdb-check:$6 = {a = -11, b = {x = -22, y = -33, z = -44}, c = -55, d = {x = -66, y = -77, z = -88}}
+
+// gdb-command:print unpackedInPackedWithDrop
+// gdb-check:$7 = {a = 98, b = {x = 87, y = 76, z = 65}, c = {x = 54, y = 43, z = 32}, d = 21}
+
+// gdb-command:print deeplyNested
+// gdb-check:$8 = {a = {a = 1, b = {x = 2, y = 3, z = 4}, c = 5, d = {x = 6, y = 7, z = 8}}, b = {a = 9, b = {x = 10, y = 11, z = 12}, c = {x = 13, y = 14, z = 15}, d = 16}, c = {a = 17, b = {x = 18, y = 19, z = 20}, c = 21, d = {x = 22, y = 23, z = 24}}, d = {a = 25, b = {x = 26, y = 27, z = 28}, c = 29, d = {x = 30, y = 31, z = 32}}, e = {a = 33, b = {x = 34, y = 35, z = 36}, c = {x = 37, y = 38, z = 39}, d = 40}, f = {a = 41, b = {x = 42, y = 43, z = 44}, c = 45, d = {x = 46, y = 47, z = 48}}}
+
+#![allow(unused_variable)]
+
+#[packed]
+struct Packed {
+ x: i16,
+ y: i32,
+ z: i64
+}
+
+impl Drop for Packed {
+ fn drop(&mut self) {}
+}
+
+#[packed]
+struct PackedInPacked {
+ a: i32,
+ b: Packed,
+ c: i64,
+ d: Packed
+}
+
+struct PackedInUnpacked {
+ a: i32,
+ b: Packed,
+ c: i64,
+ d: Packed
+}
+
+struct Unpacked {
+ x: i64,
+ y: i32,
+ z: i16
+}
+
+impl Drop for Unpacked {
+ fn drop(&mut self) {}
+}
+
+#[packed]
+struct UnpackedInPacked {
+ a: i16,
+ b: Unpacked,
+ c: Unpacked,
+ d: i64
+}
+
+#[packed]
+struct PackedInPackedWithDrop {
+ a: i32,
+ b: Packed,
+ c: i64,
+ d: Packed
+}
+
+impl Drop for PackedInPackedWithDrop {
+ fn drop(&mut self) {}
+}
+
+struct PackedInUnpackedWithDrop {
+ a: i32,
+ b: Packed,
+ c: i64,
+ d: Packed
+}
+
+impl Drop for PackedInUnpackedWithDrop {
+ fn drop(&mut self) {}
+}
+
+#[packed]
+struct UnpackedInPackedWithDrop {
+ a: i16,
+ b: Unpacked,
+ c: Unpacked,
+ d: i64
+}
+
+impl Drop for UnpackedInPackedWithDrop {
+ fn drop(&mut self) {}
+}
+
+struct DeeplyNested {
+ a: PackedInPacked,
+ b: UnpackedInPackedWithDrop,
+ c: PackedInUnpacked,
+ d: PackedInUnpackedWithDrop,
+ e: UnpackedInPacked,
+ f: PackedInPackedWithDrop
+}
+
+fn main() {
+ let packed = Packed { x: 123, y: 234, z: 345 };
+
+ let packedInPacked = PackedInPacked {
+ a: 1111,
+ b: Packed { x: 2222, y: 3333, z: 4444 },
+ c: 5555,
+ d: Packed { x: 6666, y: 7777, z: 8888 }
+ };
+
+ let packedInUnpacked = PackedInUnpacked {
+ a: -1111,
+ b: Packed { x: -2222, y: -3333, z: -4444 },
+ c: -5555,
+ d: Packed { x: -6666, y: -7777, z: -8888 }
+ };
+
+ let unpackedInPacked = UnpackedInPacked {
+ a: 987,
+ b: Unpacked { x: 876, y: 765, z: 654 },
+ c: Unpacked { x: 543, y: 432, z: 321 },
+ d: 210
+ };
+
+ let packedInPackedWithDrop = PackedInPackedWithDrop {
+ a: 11,
+ b: Packed { x: 22, y: 33, z: 44 },
+ c: 55,
+ d: Packed { x: 66, y: 77, z: 88 }
+ };
+
+ let packedInUnpackedWithDrop = PackedInUnpackedWithDrop {
+ a: -11,
+ b: Packed { x: -22, y: -33, z: -44 },
+ c: -55,
+ d: Packed { x: -66, y: -77, z: -88 }
+ };
+
+ let unpackedInPackedWithDrop = UnpackedInPackedWithDrop {
+ a: 98,
+ b: Unpacked { x: 87, y: 76, z: 65 },
+ c: Unpacked { x: 54, y: 43, z: 32 },
+ d: 21
+ };
+
+ let deeplyNested = DeeplyNested {
+ a: PackedInPacked {
+ a: 1,
+ b: Packed { x: 2, y: 3, z: 4 },
+ c: 5,
+ d: Packed { x: 6, y: 7, z: 8 }
+ },
+ b: UnpackedInPackedWithDrop {
+ a: 9,
+ b: Unpacked { x: 10, y: 11, z: 12 },
+ c: Unpacked { x: 13, y: 14, z: 15 },
+ d: 16
+ },
+ c: PackedInUnpacked {
+ a: 17,
+ b: Packed { x: 18, y: 19, z: 20 },
+ c: 21,
+ d: Packed { x: 22, y: 23, z: 24 }
+ },
+ d: PackedInUnpackedWithDrop {
+ a: 25,
+ b: Packed { x: 26, y: 27, z: 28 },
+ c: 29,
+ d: Packed { x: 30, y: 31, z: 32 }
+ },
+ e: UnpackedInPacked {
+ a: 33,
+ b: Unpacked { x: 34, y: 35, z: 36 },
+ c: Unpacked { x: 37, y: 38, z: 39 },
+ d: 40
+ },
+ f: PackedInPackedWithDrop {
+ a: 41,
+ b: Packed { x: 42, y: 43, z: 44 },
+ c: 45,
+ d: Packed { x: 46, y: 47, z: 48 }
+ }
+ };
+
+ zzz();
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-tidy-linelength
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:set print pretty off
+// gdb-command:rbreak zzz
+// gdb-command:run
+// gdb-command:finish
+
+// gdb-command:print packed
+// gdb-check:$1 = {x = 123, y = 234, z = 345}
+
+// gdb-command:print packedInPacked
+// gdb-check:$2 = {a = 1111, b = {x = 2222, y = 3333, z = 4444}, c = 5555, d = {x = 6666, y = 7777, z = 8888}}
+
+// gdb-command:print packedInUnpacked
+// gdb-check:$3 = {a = -1111, b = {x = -2222, y = -3333, z = -4444}, c = -5555, d = {x = -6666, y = -7777, z = -8888}}
+
+// gdb-command:print unpackedInPacked
+// gdb-check:$4 = {a = 987, b = {x = 876, y = 765, z = 654, w = 543}, c = {x = 432, y = 321, z = 210, w = 109}, d = -98}
+
+// gdb-command:print sizeof(packed)
+// gdb-check:$5 = 14
+
+// gdb-command:print sizeof(packedInPacked)
+// gdb-check:$6 = 40
+
+#![allow(unused_variable)]
+
+#[packed]
+struct Packed {
+ x: i16,
+ y: i32,
+ z: i64
+}
+
+#[packed]
+struct PackedInPacked {
+ a: i32,
+ b: Packed,
+ c: i64,
+ d: Packed
+}
+
+// layout (64 bit): aaaa bbbb bbbb bbbb bb.. .... cccc cccc dddd dddd dddd dd..
+struct PackedInUnpacked {
+ a: i32,
+ b: Packed,
+ c: i64,
+ d: Packed
+}
+
+// layout (64 bit): xx.. yyyy zz.. .... wwww wwww
+struct Unpacked {
+ x: i16,
+ y: i32,
+ z: i16,
+ w: i64
+}
+
+// layout (64 bit): aabb bbbb bbbb bbbb bbbb bbbb bbcc cccc cccc cccc cccc cccc ccdd dddd dd
+#[packed]
+struct UnpackedInPacked {
+ a: i16,
+ b: Unpacked,
+ c: Unpacked,
+ d: i64
+}
+
+fn main() {
+ let packed = Packed { x: 123, y: 234, z: 345 };
+
+ let packedInPacked = PackedInPacked {
+ a: 1111,
+ b: Packed { x: 2222, y: 3333, z: 4444 },
+ c: 5555,
+ d: Packed { x: 6666, y: 7777, z: 8888 }
+ };
+
+ let packedInUnpacked = PackedInUnpacked {
+ a: -1111,
+ b: Packed { x: -2222, y: -3333, z: -4444 },
+ c: -5555,
+ d: Packed { x: -6666, y: -7777, z: -8888 }
+ };
+
+ let unpackedInPacked = UnpackedInPacked {
+ a: 987,
+ b: Unpacked { x: 876, y: 765, z: 654, w: 543 },
+ c: Unpacked { x: 432, y: 321, z: 210, w: 109 },
+ d: -98
+ };
+
+ zzz();
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:run
+
+// Test whether compiling a recursive enum definition crashes debug info generation. The test case
+// is taken from issue #11083.
+
+#![allow(unused_variable)]
+
+pub struct Window<'a> {
+ callbacks: WindowCallbacks<'a>
+}
+
+struct WindowCallbacks<'a> {
+ pos_callback: Option<WindowPosCallback<'a>>,
+}
+
+pub type WindowPosCallback<'a> = |&Window, i32, i32|: 'a;
+
+fn main() {
+ let x = WindowCallbacks { pos_callback: None };
+}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+#![feature(managed_boxes)]
+
+// compile-flags:-g
+// gdb-command:set print pretty off
+// gdb-command:rbreak zzz
+// gdb-command:run
+// gdb-command:finish
+
+// gdb-command:print stack_unique.value
+// gdb-check:$1 = 0
+// gdb-command:print stack_unique.next.val->value
+// gdb-check:$2 = 1
+
+// gdb-command:print unique_unique->value
+// gdb-check:$3 = 2
+// gdb-command:print unique_unique->next.val->value
+// gdb-check:$4 = 3
+
+// gdb-command:print box_unique->val.value
+// gdb-check:$5 = 4
+// gdb-command:print box_unique->val.next.val->value
+// gdb-check:$6 = 5
+
+// gdb-command:print vec_unique[0].value
+// gdb-check:$7 = 6.5
+// gdb-command:print vec_unique[0].next.val->value
+// gdb-check:$8 = 7.5
+
+// gdb-command:print borrowed_unique->value
+// gdb-check:$9 = 8.5
+// gdb-command:print borrowed_unique->next.val->value
+// gdb-check:$10 = 9.5
+
+// MANAGED
+// gdb-command:print stack_managed.value
+// gdb-check:$11 = 10
+// gdb-command:print stack_managed.next.val->val.value
+// gdb-check:$12 = 11
+
+// gdb-command:print unique_managed->value
+// gdb-check:$13 = 12
+// gdb-command:print unique_managed->next.val->val.value
+// gdb-check:$14 = 13
+
+// gdb-command:print box_managed->val.value
+// gdb-check:$15 = 14
+// gdb-command:print box_managed->val.next.val->val.value
+// gdb-check:$16 = 15
+
+// gdb-command:print vec_managed[0].value
+// gdb-check:$17 = 16.5
+// gdb-command:print vec_managed[0].next.val->val.value
+// gdb-check:$18 = 17.5
+
+// gdb-command:print borrowed_managed->value
+// gdb-check:$19 = 18.5
+// gdb-command:print borrowed_managed->next.val->val.value
+// gdb-check:$20 = 19.5
+
+// LONG CYCLE
+// gdb-command:print long_cycle1.value
+// gdb-check:$21 = 20
+// gdb-command:print long_cycle1.next->value
+// gdb-check:$22 = 21
+// gdb-command:print long_cycle1.next->next->value
+// gdb-check:$23 = 22
+// gdb-command:print long_cycle1.next->next->next->value
+// gdb-check:$24 = 23
+
+// gdb-command:print long_cycle2.value
+// gdb-check:$25 = 24
+// gdb-command:print long_cycle2.next->value
+// gdb-check:$26 = 25
+// gdb-command:print long_cycle2.next->next->value
+// gdb-check:$27 = 26
+
+// gdb-command:print long_cycle3.value
+// gdb-check:$28 = 27
+// gdb-command:print long_cycle3.next->value
+// gdb-check:$29 = 28
+
+// gdb-command:print long_cycle4.value
+// gdb-check:$30 = 29.5
+
+// gdb-command:print (*****long_cycle_w_anonymous_types).value
+// gdb-check:$31 = 30
+
+// gdb-command:print (*****((*****long_cycle_w_anonymous_types).next.val)).value
+// gdb-check:$32 = 31
+
+// gdb-command:continue
+
+#![allow(unused_variable)]
+#![feature(struct_variant)]
+
+
+enum Opt<T> {
+ Empty,
+ Val { val: T }
+}
+
+struct UniqueNode<T> {
+ next: Opt<Box<UniqueNode<T>>>,
+ value: T
+}
+
+struct ManagedNode<T> {
+ next: Opt<@ManagedNode<T>>,
+ value: T
+}
+
+struct LongCycle1<T> {
+ next: Box<LongCycle2<T>>,
+ value: T,
+}
+
+struct LongCycle2<T> {
+ next: Box<LongCycle3<T>>,
+ value: T,
+}
+
+struct LongCycle3<T> {
+ next: Box<LongCycle4<T>>,
+ value: T,
+}
+
+struct LongCycle4<T> {
+ next: Option<Box<LongCycle1<T>>>,
+ value: T,
+}
+
+struct LongCycleWithAnonymousTypes {
+ next: Opt<Box<Box<Box<Box<Box<LongCycleWithAnonymousTypes>>>>>>,
+ value: uint,
+}
+
+// This test case makes sure that recursive structs are properly described. The Node structs are
+// generic so that we can have a new type (that newly needs to be described) for the different
+// cases. The potential problem with recursive types is that the DI generation algorithm gets
+// trapped in an endless loop. To make sure, we actually test this in the different cases, we have
+// to operate on a new type each time, otherwise we would just hit the DI cache for all but the
+// first case.
+
+// The different cases below (stack_*, unique_*, box_*, etc) are set up so that the type description
+// algorithm will enter the type reference cycle that is created by a recursive definition from a
+// different context each time.
+
+// The "long cycle" cases are constructed to span a longer, indirect recursion cycle between types.
+// The different locals will cause the DI algorithm to enter the type reference cycle at different
+// points.
+
+fn main() {
+ let stack_unique: UniqueNode<u16> = UniqueNode {
+ next: Val {
+ val: box UniqueNode {
+ next: Empty,
+ value: 1_u16,
+ }
+ },
+ value: 0_u16,
+ };
+
+ let unique_unique: Box<UniqueNode<u32>> = box UniqueNode {
+ next: Val {
+ val: box UniqueNode {
+ next: Empty,
+ value: 3,
+ }
+ },
+ value: 2,
+ };
+
+ let box_unique: @UniqueNode<u64> = @UniqueNode {
+ next: Val {
+ val: box UniqueNode {
+ next: Empty,
+ value: 5,
+ }
+ },
+ value: 4,
+ };
+
+ let vec_unique: [UniqueNode<f32>, ..1] = [UniqueNode {
+ next: Val {
+ val: box UniqueNode {
+ next: Empty,
+ value: 7.5,
+ }
+ },
+ value: 6.5,
+ }];
+
+ let borrowed_unique: &UniqueNode<f64> = &UniqueNode {
+ next: Val {
+ val: box UniqueNode {
+ next: Empty,
+ value: 9.5,
+ }
+ },
+ value: 8.5,
+ };
+
+ let stack_managed: ManagedNode<u16> = ManagedNode {
+ next: Val {
+ val: @ManagedNode {
+ next: Empty,
+ value: 11,
+ }
+ },
+ value: 10,
+ };
+
+ let unique_managed: Box<ManagedNode<u32>> = box ManagedNode {
+ next: Val {
+ val: @ManagedNode {
+ next: Empty,
+ value: 13,
+ }
+ },
+ value: 12,
+ };
+
+ let box_managed: @ManagedNode<u64> = @ManagedNode {
+ next: Val {
+ val: @ManagedNode {
+ next: Empty,
+ value: 15,
+ }
+ },
+ value: 14,
+ };
+
+ let vec_managed: [ManagedNode<f32>, ..1] = [ManagedNode {
+ next: Val {
+ val: @ManagedNode {
+ next: Empty,
+ value: 17.5,
+ }
+ },
+ value: 16.5,
+ }];
+
+ let borrowed_managed: &ManagedNode<f64> = &ManagedNode {
+ next: Val {
+ val: @ManagedNode {
+ next: Empty,
+ value: 19.5,
+ }
+ },
+ value: 18.5,
+ };
+
+ // LONG CYCLE
+ let long_cycle1: LongCycle1<u16> = LongCycle1 {
+ next: box LongCycle2 {
+ next: box LongCycle3 {
+ next: box LongCycle4 {
+ next: None,
+ value: 23,
+ },
+ value: 22,
+ },
+ value: 21
+ },
+ value: 20
+ };
+
+ let long_cycle2: LongCycle2<u32> = LongCycle2 {
+ next: box LongCycle3 {
+ next: box LongCycle4 {
+ next: None,
+ value: 26,
+ },
+ value: 25,
+ },
+ value: 24
+ };
+
+ let long_cycle3: LongCycle3<u64> = LongCycle3 {
+ next: box LongCycle4 {
+ next: None,
+ value: 28,
+ },
+ value: 27,
+ };
+
+ let long_cycle4: LongCycle4<f32> = LongCycle4 {
+ next: None,
+ value: 29.5,
+ };
+
+ // It's important that LongCycleWithAnonymousTypes is encountered only at the end of the
+ // `box` chain.
+ let long_cycle_w_anonymous_types = box box box box box LongCycleWithAnonymousTypes {
+ next: Val {
+ val: box box box box box LongCycleWithAnonymousTypes {
+ next: Empty,
+ value: 31,
+ }
+ },
+ value: 30
+ };
+
+ zzz();
+}
+
+fn zzz() {()}
+
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+
+// STACK BY REF
+// gdb-command:finish
+// gdb-command:print *self
+// gdb-check:$1 = {x = 100}
+// gdb-command:print arg1
+// gdb-check:$2 = -1
+// gdb-command:print arg2
+// gdb-check:$3 = -2
+// gdb-command:continue
+
+// STACK BY VAL
+// gdb-command:finish
+// gdb-command:print self
+// gdb-check:$4 = {x = 100}
+// gdb-command:print arg1
+// gdb-check:$5 = -3
+// gdb-command:print arg2
+// gdb-check:$6 = -4
+// gdb-command:continue
+
+// OWNED BY REF
+// gdb-command:finish
+// gdb-command:print *self
+// gdb-check:$7 = {x = 200}
+// gdb-command:print arg1
+// gdb-check:$8 = -5
+// gdb-command:print arg2
+// gdb-check:$9 = -6
+// gdb-command:continue
+
+// OWNED BY VAL
+// gdb-command:finish
+// gdb-command:print self
+// gdb-check:$10 = {x = 200}
+// gdb-command:print arg1
+// gdb-check:$11 = -7
+// gdb-command:print arg2
+// gdb-check:$12 = -8
+// gdb-command:continue
+
+// OWNED MOVED
+// gdb-command:finish
+// gdb-command:print *self
+// gdb-check:$13 = {x = 200}
+// gdb-command:print arg1
+// gdb-check:$14 = -9
+// gdb-command:print arg2
+// gdb-check:$15 = -10
+// gdb-command:continue
+
+struct Struct {
+ x: int
+}
+
+trait Trait {
+ fn self_by_ref(&self, arg1: int, arg2: int) -> int {
+ zzz();
+ arg1 + arg2
+ }
+
+ fn self_by_val(self, arg1: int, arg2: int) -> int {
+ zzz();
+ arg1 + arg2
+ }
+
+ fn self_owned(~self, arg1: int, arg2: int) -> int {
+ zzz();
+ arg1 + arg2
+ }
+}
+
+impl Trait for Struct {}
+
+fn main() {
+ let stack = Struct { x: 100 };
+ let _ = stack.self_by_ref(-1, -2);
+ let _ = stack.self_by_val(-3, -4);
+
+ let owned = box Struct { x: 200 };
+ let _ = owned.self_by_ref(-5, -6);
+ let _ = owned.self_by_val(-7, -8);
+ let _ = owned.self_owned(-9, -10);
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+
+// STACK BY REF
+// gdb-command:finish
+// gdb-command:print *self
+// gdb-check:$1 = {x = 987}
+// gdb-command:print arg1
+// gdb-check:$2 = -1
+// gdb-command:print/d arg2
+// gdb-check:$3 = -2
+// gdb-command:continue
+
+// STACK BY VAL
+// gdb-command:finish
+// gdb-command:print self
+// gdb-check:$4 = {x = 987}
+// gdb-command:print arg1
+// gdb-check:$5 = -3
+// gdb-command:print arg2
+// gdb-check:$6 = -4
+// gdb-command:continue
+
+// OWNED BY REF
+// gdb-command:finish
+// gdb-command:print *self
+// gdb-check:$7 = {x = 879}
+// gdb-command:print arg1
+// gdb-check:$8 = -5
+// gdb-command:print arg2
+// gdb-check:$9 = -6
+// gdb-command:continue
+
+// OWNED BY VAL
+// gdb-command:finish
+// gdb-command:print self
+// gdb-check:$10 = {x = 879}
+// gdb-command:print arg1
+// gdb-check:$11 = -7
+// gdb-command:print arg2
+// gdb-check:$12 = -8
+// gdb-command:continue
+
+// OWNED MOVED
+// gdb-command:finish
+// gdb-command:print *self
+// gdb-check:$13 = {x = 879}
+// gdb-command:print arg1
+// gdb-check:$14 = -9
+// gdb-command:print arg2
+// gdb-check:$15 = -10.5
+// gdb-command:continue
+
+struct Struct {
+ x: int
+}
+
+trait Trait {
+
+ fn self_by_ref<T>(&self, arg1: int, arg2: T) -> int {
+ zzz();
+ arg1
+ }
+
+ fn self_by_val<T>(self, arg1: int, arg2: T) -> int {
+ zzz();
+ arg1
+ }
+
+ fn self_owned<T>(~self, arg1: int, arg2: T) -> int {
+ zzz();
+ arg1
+ }
+}
+
+impl Trait for Struct {}
+
+fn main() {
+ let stack = Struct { x: 987 };
+ let _ = stack.self_by_ref(-1, -2_i8);
+ let _ = stack.self_by_val(-3, -4_i16);
+
+ let owned = box Struct { x: 879 };
+ let _ = owned.self_by_ref(-5, -6_i32);
+ let _ = owned.self_by_val(-7, -8_i64);
+ let _ = owned.self_owned(-9, -10.5_f32);
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$1 = false
+// gdb-command:print y
+// gdb-check:$2 = true
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$3 = 10
+// gdb-command:print y
+// gdb-check:$4 = true
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$5 = 10.5
+// gdb-command:print y
+// gdb-check:$6 = 20
+// gdb-command:continue
+
+fn a_function(x: bool, y: bool) {
+ zzz();
+ sentinel();
+
+ let x = 10;
+
+ zzz();
+ sentinel();
+
+ let x = 10.5;
+ let y = 20;
+
+ zzz();
+ sentinel();
+}
+
+fn main() {
+ a_function(false, true);
+}
+
+fn zzz() {()}
+fn sentinel() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$1 = false
+// gdb-command:print y
+// gdb-check:$2 = true
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$3 = 10
+// gdb-command:print y
+// gdb-check:$4 = true
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$5 = 10.5
+// gdb-command:print y
+// gdb-check:$6 = 20
+// gdb-command:continue
+
+fn main() {
+ let x = false;
+ let y = true;
+
+ zzz();
+ sentinel();
+
+ let x = 10;
+
+ zzz();
+ sentinel();
+
+ let x = 10.5;
+ let y = 20;
+
+ zzz();
+ sentinel();
+}
+
+fn zzz() {()}
+fn sentinel() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+
+// gdb-command:finish
+// gdb-command:print/d i8x16
+// gdb-check:$1 = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}
+// gdb-command:print/d i16x8
+// gdb-check:$2 = {16, 17, 18, 19, 20, 21, 22, 23}
+// gdb-command:print/d i32x4
+// gdb-check:$3 = {24, 25, 26, 27}
+// gdb-command:print/d i64x2
+// gdb-check:$4 = {28, 29}
+
+// gdb-command:print/d u8x16
+// gdb-check:$5 = {30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45}
+// gdb-command:print/d u16x8
+// gdb-check:$6 = {46, 47, 48, 49, 50, 51, 52, 53}
+// gdb-command:print/d u32x4
+// gdb-check:$7 = {54, 55, 56, 57}
+// gdb-command:print/d u64x2
+// gdb-check:$8 = {58, 59}
+
+// gdb-command:print f32x4
+// gdb-check:$9 = {60.5, 61.5, 62.5, 63.5}
+// gdb-command:print f64x2
+// gdb-check:$10 = {64.5, 65.5}
+
+// gdb-command:continue
+
+#![allow(experimental)]
+#![allow(unused_variable)]
+
+use std::unstable::simd::{i8x16, i16x8,i32x4,i64x2,u8x16,u16x8,u32x4,u64x2,f32x4,f64x2};
+
+fn main() {
+
+ let i8x16 = i8x16(0i8, 1i8, 2i8, 3i8, 4i8, 5i8, 6i8, 7i8,
+ 8i8, 9i8, 10i8, 11i8, 12i8, 13i8, 14i8, 15i8);
+
+ let i16x8 = i16x8(16i16, 17i16, 18i16, 19i16, 20i16, 21i16, 22i16, 23i16);
+ let i32x4 = i32x4(24i32, 25i32, 26i32, 27i32);
+ let i64x2 = i64x2(28i64, 29i64);
+
+ let u8x16 = u8x16(30u8, 31u8, 32u8, 33u8, 34u8, 35u8, 36u8, 37u8,
+ 38u8, 39u8, 40u8, 41u8, 42u8, 43u8, 44u8, 45u8);
+ let u16x8 = u16x8(46u16, 47u16, 48u16, 49u16, 50u16, 51u16, 52u16, 53u16);
+ let u32x4 = u32x4(54u32, 55u32, 56u32, 57u32);
+ let u64x2 = u64x2(58u64, 59u64);
+
+ let f32x4 = f32x4(60.5f32, 61.5f32, 62.5f32, 63.5f32);
+ let f64x2 = f64x2(64.5f64, 65.5f64);
+
+ zzz();
+}
+
+#[inline(never)]
+fn zzz() { () }
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$1 = false
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$2 = false
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$3 = 10
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$4 = 10
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$5 = 10.5
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$6 = 10
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print x
+// gdb-check:$7 = false
+// gdb-command:continue
+
+
+fn main() {
+ let x = false;
+
+ zzz();
+ sentinel();
+
+ {
+ zzz();
+ sentinel();
+
+ let x = 10;
+
+ zzz();
+ sentinel();
+
+ {
+ zzz();
+ sentinel();
+
+ let x = 10.5;
+
+ zzz();
+ sentinel();
+ }
+
+ zzz();
+ sentinel();
+ }
+
+ zzz();
+ sentinel();
+}
+
+fn zzz() {()}
+fn sentinel() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-win32: FIXME #13256
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:set print pretty off
+// gdb-command:rbreak zzz
+
+// gdb-command:print 'simple-struct::NO_PADDING_16'
+// gdb-check:$1 = {x = 1000, y = -1001}
+
+// gdb-command:print 'simple-struct::NO_PADDING_32'
+// gdb-check:$2 = {x = 1, y = 2, z = 3}
+
+// gdb-command:print 'simple-struct::NO_PADDING_64'
+// gdb-check:$3 = {x = 4, y = 5, z = 6}
+
+// gdb-command:print 'simple-struct::NO_PADDING_163264'
+// gdb-check:$4 = {a = 7, b = 8, c = 9, d = 10}
+
+// gdb-command:print 'simple-struct::INTERNAL_PADDING'
+// gdb-check:$5 = {x = 11, y = 12}
+
+// gdb-command:print 'simple-struct::PADDING_AT_END'
+// gdb-check:$6 = {x = 13, y = 14}
+
+// gdb-command:run
+// gdb-command:finish
+
+// gdb-command:print no_padding16
+// gdb-check:$7 = {x = 10000, y = -10001}
+
+// gdb-command:print no_padding32
+// gdb-check:$8 = {x = -10002, y = -10003.5, z = 10004}
+
+// gdb-command:print no_padding64
+// gdb-check:$9 = {x = -10005.5, y = 10006, z = 10007}
+
+// gdb-command:print no_padding163264
+// gdb-check:$10 = {a = -10008, b = 10009, c = 10010, d = 10011}
+
+// gdb-command:print internal_padding
+// gdb-check:$11 = {x = 10012, y = -10013}
+
+// gdb-command:print padding_at_end
+// gdb-check:$12 = {x = -10014, y = 10015}
+
+// gdb-command:print 'simple-struct::NO_PADDING_16'
+// gdb-check:$13 = {x = 100, y = -101}
+
+// gdb-command:print 'simple-struct::NO_PADDING_32'
+// gdb-check:$14 = {x = -15, y = -16, z = 17}
+
+// gdb-command:print 'simple-struct::NO_PADDING_64'
+// gdb-check:$15 = {x = -18, y = 19, z = 20}
+
+// gdb-command:print 'simple-struct::NO_PADDING_163264'
+// gdb-check:$16 = {a = -21, b = 22, c = 23, d = 24}
+
+// gdb-command:print 'simple-struct::INTERNAL_PADDING'
+// gdb-check:$17 = {x = 25, y = -26}
+
+// gdb-command:print 'simple-struct::PADDING_AT_END'
+// gdb-check:$18 = {x = -27, y = 28}
+
+// gdb-command:print inheriting
+// gdb-check:$19 = {a = 10019, b = -10020, x = -10016, y = -10017.5, z = 10018}
+
+
+#![feature(struct_inherit)];
+#![allow(unused_variable)];
+#![allow(dead_code)];
+
+struct NoPadding16 {
+ x: u16,
+ y: i16
+}
+
+virtual struct NoPadding32 {
+ x: i32,
+ y: f32,
+ z: u32
+}
+
+struct NoPadding64 {
+ x: f64,
+ y: i64,
+ z: u64
+}
+
+struct NoPadding163264 {
+ a: i16,
+ b: u16,
+ c: i32,
+ d: u64
+}
+
+struct InternalPadding {
+ x: u16,
+ y: i64
+}
+
+struct PaddingAtEnd {
+ x: i64,
+ y: u16
+}
+
+static mut NO_PADDING_16: NoPadding16 = NoPadding16 {
+ x: 1000,
+ y: -1001
+};
+
+static mut NO_PADDING_32: NoPadding32 = NoPadding32 {
+ x: 1,
+ y: 2.0,
+ z: 3
+};
+
+static mut NO_PADDING_64: NoPadding64 = NoPadding64 {
+ x: 4.0,
+ y: 5,
+ z: 6
+};
+
+static mut NO_PADDING_163264: NoPadding163264 = NoPadding163264 {
+ a: 7,
+ b: 8,
+ c: 9,
+ d: 10
+};
+
+static mut INTERNAL_PADDING: InternalPadding = InternalPadding {
+ x: 11,
+ y: 12
+};
+
+static mut PADDING_AT_END: PaddingAtEnd = PaddingAtEnd {
+ x: 13,
+ y: 14
+};
+
+struct Inheriting : NoPadding32 {
+ a: u16,
+ b: i16
+}
+
+fn main() {
+ let no_padding16 = NoPadding16 { x: 10000, y: -10001 };
+ let no_padding32 = NoPadding32 { x: -10002, y: -10003.5, z: 10004 };
+ let no_padding64 = NoPadding64 { x: -10005.5, y: 10006, z: 10007 };
+ let no_padding163264 = NoPadding163264 { a: -10008, b: 10009, c: 10010, d: 10011 };
+
+ let internal_padding = InternalPadding { x: 10012, y: -10013 };
+ let padding_at_end = PaddingAtEnd { x: -10014, y: 10015 };
+
+ let inheriting = Inheriting { a: 10019, b: -10020, x: -10016, y: -10017.5, z: 10018 };
+
+ unsafe {
+ NO_PADDING_16.x = 100;
+ NO_PADDING_16.y = -101;
+
+ NO_PADDING_32.x = -15;
+ NO_PADDING_32.y = -16.0;
+ NO_PADDING_32.z = 17;
+
+ NO_PADDING_64.x = -18.0;
+ NO_PADDING_64.y = 19;
+ NO_PADDING_64.z = 20;
+
+ NO_PADDING_163264.a = -21;
+ NO_PADDING_163264.b = 22;
+ NO_PADDING_163264.c = 23;
+ NO_PADDING_163264.d = 24;
+
+ INTERNAL_PADDING.x = 25;
+ INTERNAL_PADDING.y = -26;
+
+ PADDING_AT_END.x = -27;
+ PADDING_AT_END.y = 28;
+ }
+
+ zzz();
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-win32: FIXME #13256
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:set print pretty off
+// gdb-command:rbreak zzz
+
+// gdb-command:print/d 'simple-tuple::NO_PADDING_8'
+// gdb-check:$1 = {-50, 50}
+// gdb-command:print 'simple-tuple::NO_PADDING_16'
+// gdb-check:$2 = {-1, 2, 3}
+// gdb-command:print 'simple-tuple::NO_PADDING_32'
+// gdb-check:$3 = {4, 5, 6}
+// gdb-command:print 'simple-tuple::NO_PADDING_64'
+// gdb-check:$4 = {7, 8, 9}
+
+// gdb-command:print 'simple-tuple::INTERNAL_PADDING_1'
+// gdb-check:$5 = {10, 11}
+// gdb-command:print 'simple-tuple::INTERNAL_PADDING_2'
+// gdb-check:$6 = {12, 13, 14, 15}
+
+// gdb-command:print 'simple-tuple::PADDING_AT_END'
+// gdb-check:$7 = {16, 17}
+
+// gdb-command:run
+// gdb-command:finish
+
+// gdb-command:print/d noPadding8
+// gdb-check:$8 = {-100, 100}
+// gdb-command:print noPadding16
+// gdb-check:$9 = {0, 1, 2}
+// gdb-command:print noPadding32
+// gdb-check:$10 = {3, 4.5, 5}
+// gdb-command:print noPadding64
+// gdb-check:$11 = {6, 7.5, 8}
+
+// gdb-command:print internalPadding1
+// gdb-check:$12 = {9, 10}
+// gdb-command:print internalPadding2
+// gdb-check:$13 = {11, 12, 13, 14}
+
+// gdb-command:print paddingAtEnd
+// gdb-check:$14 = {15, 16}
+
+// gdb-command:print/d 'simple-tuple::NO_PADDING_8'
+// gdb-check:$15 = {-127, 127}
+// gdb-command:print 'simple-tuple::NO_PADDING_16'
+// gdb-check:$16 = {-10, 10, 9}
+// gdb-command:print 'simple-tuple::NO_PADDING_32'
+// gdb-check:$17 = {14, 15, 16}
+// gdb-command:print 'simple-tuple::NO_PADDING_64'
+// gdb-check:$18 = {17, 18, 19}
+
+// gdb-command:print 'simple-tuple::INTERNAL_PADDING_1'
+// gdb-check:$19 = {110, 111}
+// gdb-command:print 'simple-tuple::INTERNAL_PADDING_2'
+// gdb-check:$20 = {112, 113, 114, 115}
+
+// gdb-command:print 'simple-tuple::PADDING_AT_END'
+// gdb-check:$21 = {116, 117}
+
+#![allow(unused_variable)]
+#![allow(dead_code)]
+
+static mut NO_PADDING_8: (i8, u8) = (-50, 50);
+static mut NO_PADDING_16: (i16, i16, u16) = (-1, 2, 3);
+
+static mut NO_PADDING_32: (i32, f32, u32) = (4, 5.0, 6);
+static mut NO_PADDING_64: (i64, f64, u64) = (7, 8.0, 9);
+
+static mut INTERNAL_PADDING_1: (i16, i32) = (10, 11);
+static mut INTERNAL_PADDING_2: (i16, i32, u32, u64) = (12, 13, 14, 15);
+
+static mut PADDING_AT_END: (i32, i16) = (16, 17);
+
+fn main() {
+ let noPadding8: (i8, u8) = (-100, 100);
+ let noPadding16: (i16, i16, u16) = (0, 1, 2);
+ let noPadding32: (i32, f32, u32) = (3, 4.5, 5);
+ let noPadding64: (i64, f64, u64) = (6, 7.5, 8);
+
+ let internalPadding1: (i16, i32) = (9, 10);
+ let internalPadding2: (i16, i32, u32, u64) = (11, 12, 13, 14);
+
+ let paddingAtEnd: (i32, i16) = (15, 16);
+
+ unsafe {
+ NO_PADDING_8 = (-127, 127);
+ NO_PADDING_16 = (-10, 10, 9);
+
+ NO_PADDING_32 = (14, 15.0, 16);
+ NO_PADDING_64 = (17, 18.0, 19);
+
+ INTERNAL_PADDING_1 = (110, 111);
+ INTERNAL_PADDING_2 = (112, 113, 114, 115);
+
+ PADDING_AT_END = (116, 117);
+ }
+
+ zzz();
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+
+// STRUCT
+// gdb-command:finish
+// gdb-command:print arg1
+// gdb-check:$1 = 1
+// gdb-command:print arg2
+// gdb-check:$2 = 2
+// gdb-command:continue
+
+// ENUM
+// gdb-command:finish
+// gdb-command:print arg1
+// gdb-check:$3 = -3
+// gdb-command:print arg2
+// gdb-check:$4 = 4.5
+// gdb-command:print arg3
+// gdb-check:$5 = 5
+// gdb-command:continue
+
+#![feature(struct_variant)]
+
+struct Struct {
+ x: int
+}
+
+impl Struct {
+
+ fn static_method(arg1: int, arg2: int) -> int {
+ zzz();
+ arg1 + arg2
+ }
+}
+
+enum Enum {
+ Variant1 { x: int },
+ Variant2,
+ Variant3(f64, int, char),
+}
+
+impl Enum {
+
+ fn static_method(arg1: int, arg2: f64, arg3: uint) -> int {
+ zzz();
+ arg1
+ }
+}
+
+fn main() {
+ Struct::static_method(1, 2);
+ Enum::static_method(-3, 4.5, 5);
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-tidy-linelength
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:set print union on
+// gdb-command:rbreak zzz
+// gdb-command:run
+// gdb-command:finish
+
+// gdb-command:print case1
+// gdb-check:$1 = {{Case1, 0, {x = 2088533116, y = 2088533116, z = 31868}}, {Case1, 0, 8970181431921507452, 31868}}
+
+// gdb-command:print case2
+// gdb-check:$2 = {{Case2, 0, {x = 286331153, y = 286331153, z = 4369}}, {Case2, 0, 1229782938247303441, 4369}}
+
+// gdb-command:print univariant
+// gdb-check:$3 = {{x = 123, y = 456, z = 789}}
+
+#![allow(unused_variable)]
+
+struct Struct {
+ x: u32,
+ y: i32,
+ z: i16
+}
+
+// The first element is to ensure proper alignment, irrespective of the machines word size. Since
+// the size of the discriminant value is machine dependent, this has be taken into account when
+// datatype layout should be predictable as in this case.
+enum Regular {
+ Case1(u64, Struct),
+ Case2(u64, u64, i16)
+}
+
+enum Univariant {
+ TheOnlyCase(Struct)
+}
+
+fn main() {
+
+ // In order to avoid endianess trouble all of the following test values consist of a single
+ // repeated byte. This way each interpretation of the union should look the same, no matter if
+ // this is a big or little endian machine.
+
+ // 0b0111110001111100011111000111110001111100011111000111110001111100 = 8970181431921507452
+ // 0b01111100011111000111110001111100 = 2088533116
+ // 0b0111110001111100 = 31868
+ // 0b01111100 = 124
+ let case1 = Case1(0, Struct { x: 2088533116, y: 2088533116, z: 31868 });
+
+ // 0b0001000100010001000100010001000100010001000100010001000100010001 = 1229782938247303441
+ // 0b00010001000100010001000100010001 = 286331153
+ // 0b0001000100010001 = 4369
+ // 0b00010001 = 17
+ let case2 = Case2(0, 1229782938247303441, 4369);
+
+ let univariant = TheOnlyCase(Struct { x: 123, y: 456, z: 789 });
+
+ zzz();
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:set print pretty off
+// gdb-command:rbreak zzz
+// gdb-command:run
+// gdb-command:finish
+
+// gdb-command:print three_simple_structs
+// gdb-check:$1 = {x = {x = 1}, y = {x = 2}, z = {x = 3}}
+
+// gdb-command:print internal_padding_parent
+// gdb-check:$2 = {x = {x = 4, y = 5}, y = {x = 6, y = 7}, z = {x = 8, y = 9}}
+
+// gdb-command:print padding_at_end_parent
+// gdb-check:$3 = {x = {x = 10, y = 11}, y = {x = 12, y = 13}, z = {x = 14, y = 15}}
+
+#![allow(unused_variable)]
+
+struct Simple {
+ x: i32
+}
+
+struct InternalPadding {
+ x: i32,
+ y: i64
+}
+
+struct PaddingAtEnd {
+ x: i64,
+ y: i32
+}
+
+struct ThreeSimpleStructs {
+ x: Simple,
+ y: Simple,
+ z: Simple
+}
+
+struct InternalPaddingParent {
+ x: InternalPadding,
+ y: InternalPadding,
+ z: InternalPadding
+}
+
+struct PaddingAtEndParent {
+ x: PaddingAtEnd,
+ y: PaddingAtEnd,
+ z: PaddingAtEnd
+}
+
+struct Mixed {
+ x: PaddingAtEnd,
+ y: InternalPadding,
+ z: Simple,
+ w: i16
+}
+
+struct Bag {
+ x: Simple
+}
+
+struct BagInBag {
+ x: Bag
+}
+
+struct ThatsJustOverkill {
+ x: BagInBag
+}
+
+struct Tree {
+ x: Simple,
+ y: InternalPaddingParent,
+ z: BagInBag
+}
+
+fn main() {
+
+ let three_simple_structs = ThreeSimpleStructs {
+ x: Simple { x: 1 },
+ y: Simple { x: 2 },
+ z: Simple { x: 3 }
+ };
+
+ let internal_padding_parent = InternalPaddingParent {
+ x: InternalPadding { x: 4, y: 5 },
+ y: InternalPadding { x: 6, y: 7 },
+ z: InternalPadding { x: 8, y: 9 }
+ };
+
+ let padding_at_end_parent = PaddingAtEndParent {
+ x: PaddingAtEnd { x: 10, y: 11 },
+ y: PaddingAtEnd { x: 12, y: 13 },
+ z: PaddingAtEnd { x: 14, y: 15 }
+ };
+
+ let mixed = Mixed {
+ x: PaddingAtEnd { x: 16, y: 17 },
+ y: InternalPadding { x: 18, y: 19 },
+ z: Simple { x: 20 },
+ w: 21
+ };
+
+ let bag = Bag { x: Simple { x: 22 } };
+ let bag_in_bag = BagInBag {
+ x: Bag {
+ x: Simple { x: 23 }
+ }
+ };
+
+ let tjo = ThatsJustOverkill {
+ x: BagInBag {
+ x: Bag {
+ x: Simple { x: 24 }
+ }
+ }
+ };
+
+ let tree = Tree {
+ x: Simple { x: 25 },
+ y: InternalPaddingParent {
+ x: InternalPadding { x: 26, y: 27 },
+ y: InternalPadding { x: 28, y: 29 },
+ z: InternalPadding { x: 30, y: 31 }
+ },
+ z: BagInBag {
+ x: Bag {
+ x: Simple { x: 32 }
+ }
+ }
+ };
+
+ zzz();
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-tidy-linelength
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:set print union on
+// gdb-command:rbreak zzz
+// gdb-command:run
+// gdb-command:finish
+
+// gdb-command:print case1
+// gdb-check:$1 = {{Case1, a = 0, b = 31868, c = 31868, d = 31868, e = 31868}, {Case1, a = 0, b = 2088533116, c = 2088533116}, {Case1, a = 0, b = 8970181431921507452}}
+
+// gdb-command:print case2
+// gdb-check:$2 = {{Case2, a = 0, b = 4369, c = 4369, d = 4369, e = 4369}, {Case2, a = 0, b = 286331153, c = 286331153}, {Case2, a = 0, b = 1229782938247303441}}
+
+// gdb-command:print case3
+// gdb-check:$3 = {{Case3, a = 0, b = 22873, c = 22873, d = 22873, e = 22873}, {Case3, a = 0, b = 1499027801, c = 1499027801}, {Case3, a = 0, b = 6438275382588823897}}
+
+// gdb-command:print univariant
+// gdb-check:$4 = {a = -1}
+
+#![allow(unused_variable)]
+#![feature(struct_variant)]
+
+// The first element is to ensure proper alignment, irrespective of the machines word size. Since
+// the size of the discriminant value is machine dependent, this has be taken into account when
+// datatype layout should be predictable as in this case.
+enum Regular {
+ Case1 { a: u64, b: u16, c: u16, d: u16, e: u16},
+ Case2 { a: u64, b: u32, c: u32},
+ Case3 { a: u64, b: u64 }
+}
+
+enum Univariant {
+ TheOnlyCase { a: i64 }
+}
+
+fn main() {
+
+ // In order to avoid endianess trouble all of the following test values consist of a single
+ // repeated byte. This way each interpretation of the union should look the same, no matter if
+ // this is a big or little endian machine.
+
+ // 0b0111110001111100011111000111110001111100011111000111110001111100 = 8970181431921507452
+ // 0b01111100011111000111110001111100 = 2088533116
+ // 0b0111110001111100 = 31868
+ // 0b01111100 = 124
+ let case1 = Case1 { a: 0, b: 31868, c: 31868, d: 31868, e: 31868 };
+
+ // 0b0001000100010001000100010001000100010001000100010001000100010001 = 1229782938247303441
+ // 0b00010001000100010001000100010001 = 286331153
+ // 0b0001000100010001 = 4369
+ // 0b00010001 = 17
+ let case2 = Case2 { a: 0, b: 286331153, c: 286331153 };
+
+ // 0b0101100101011001010110010101100101011001010110010101100101011001 = 6438275382588823897
+ // 0b01011001010110010101100101011001 = 1499027801
+ // 0b0101100101011001 = 22873
+ // 0b01011001 = 89
+ let case3 = Case3 { a: 0, b: 6438275382588823897 };
+
+ let univariant = TheOnlyCase { a: -1 };
+
+ zzz();
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+// gdb-command:finish
+// gdb-command:print simple
+// gdb-check:$1 = {x = 10, y = 20}
+
+// gdb-command:print noDestructor
+// gdb-check:$2 = {a = {x = 10, y = 20}, guard = -1}
+
+// gdb-command:print withDestructor
+// gdb-check:$3 = {a = {x = 10, y = 20}, guard = -1}
+
+// gdb-command:print nested
+// gdb-check:$4 = {a = {a = {x = 7890, y = 9870}}}
+
+#![allow(unused_variable)]
+
+struct NoDestructor {
+ x: i32,
+ y: i64
+}
+
+struct WithDestructor {
+ x: i32,
+ y: i64
+}
+
+impl Drop for WithDestructor {
+ fn drop(&mut self) {}
+}
+
+struct NoDestructorGuarded {
+ a: NoDestructor,
+ guard: i64
+}
+
+struct WithDestructorGuarded {
+ a: WithDestructor,
+ guard: i64
+}
+
+struct NestedInner {
+ a: WithDestructor
+}
+
+impl Drop for NestedInner {
+ fn drop(&mut self) {}
+}
+
+struct NestedOuter {
+ a: NestedInner
+}
+
+
+// The compiler adds a 'destructed' boolean field to structs implementing Drop. This field is used
+// at runtime to prevent drop() to be executed more than once (see middle::trans::adt).
+// This field must be incorporated by the debug info generation. Otherwise the debugger assumes a
+// wrong size/layout for the struct.
+fn main() {
+
+ let simple = WithDestructor { x: 10, y: 20 };
+
+ let noDestructor = NoDestructorGuarded {
+ a: NoDestructor { x: 10, y: 20 },
+ guard: -1
+ };
+
+ // If the destructor flag field is not incorporated into the debug info for 'WithDestructor'
+ // then the debugger will have an invalid offset for the field 'guard' and thus should not be
+ // able to read its value correctly (dots are padding bytes, D is the boolean destructor flag):
+ //
+ // 64 bit
+ //
+ // NoDestructorGuarded = 0000....00000000FFFFFFFF
+ // <--------------><------>
+ // NoDestructor guard
+ //
+ //
+ // withDestructorGuarded = 0000....00000000D.......FFFFFFFF
+ // <--------------><------> // How debug info says it is
+ // WithDestructor guard
+ //
+ // <----------------------><------> // How it actually is
+ // WithDestructor guard
+ //
+ // 32 bit
+ //
+ // NoDestructorGuarded = 000000000000FFFFFFFF
+ // <----------><------>
+ // NoDestructor guard
+ //
+ //
+ // withDestructorGuarded = 000000000000D...FFFFFFFF
+ // <----------><------> // How debug info says it is
+ // WithDestructor guard
+ //
+ // <--------------><------> // How it actually is
+ // WithDestructor guard
+ //
+ let withDestructor = WithDestructorGuarded {
+ a: WithDestructor { x: 10, y: 20 },
+ guard: -1
+ };
+
+ // expected layout (64 bit) = xxxx....yyyyyyyyD.......D...
+ // <--WithDestructor------>
+ // <-------NestedInner-------->
+ // <-------NestedOuter-------->
+ let nested = NestedOuter { a: NestedInner { a: WithDestructor { x: 7890, y: 9870 } } };
+
+ zzz();
+}
+
+fn zzz() {()}
--- /dev/null
+some text to include in another file as string 1
\ No newline at end of file
--- /dev/null
+some text to include in another file as string 2
\ No newline at end of file
--- /dev/null
+some text to include in another file as string 3
\ No newline at end of file
--- /dev/null
+// ignore-test
+
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+
+// gdb-command:finish
+// gdb-command:print arg1
+// gdb-check:$1 = 1000
+// gdb-command:print arg2
+// gdb-check:$2 = 0.5
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print arg1
+// gdb-check:$3 = 2000
+// gdb-command:print *arg2
+// gdb-check:$4 = {1, 2, 3}
+// gdb-command:continue
+
+
+struct Struct {
+ x: int
+}
+
+trait Trait {
+ fn generic_static_default_method<T>(arg1: int, arg2: T) -> int {
+ zzz();
+ arg1
+ }
+}
+
+impl Trait for Struct {}
+
+fn main() {
+
+ // Is this really how to use these?
+ Trait::generic_static_default_method::<Struct, float>(1000, 0.5);
+ Trait::generic_static_default_method::<Struct, &(int, int, int)>(2000, &(1, 2, 3));
+
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:run
+
+#![allow(unused_variable)]
+
+
+trait Trait {
+ fn method(&self) -> int { 0 }
+}
+
+struct Struct {
+ a: int,
+ b: f64
+}
+
+impl Trait for Struct {}
+
+// There is no real test here yet. Just make sure that it compiles without crashing.
+fn main() {
+ let stack_struct = Struct { a:0, b: 1.0 };
+ let reference: &Trait = &stack_struct as &Trait;
+ let unique: Box<Trait> = box Struct { a:2, b: 3.0 } as Box<Trait>;
+}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:set print pretty off
+// gdb-command:rbreak zzz
+// gdb-command:run
+// gdb-command:finish
+
+// gdb-command:print no_padding1
+// gdb-check:$1 = {x = {0, 1}, y = 2, z = {3, 4, 5}}
+// gdb-command:print no_padding2
+// gdb-check:$2 = {x = {6, 7}, y = {{8, 9}, 10}}
+
+// gdb-command:print tuple_internal_padding
+// gdb-check:$3 = {x = {11, 12}, y = {13, 14}}
+// gdb-command:print struct_internal_padding
+// gdb-check:$4 = {x = {15, 16}, y = {17, 18}}
+// gdb-command:print both_internally_padded
+// gdb-check:$5 = {x = {19, 20, 21}, y = {22, 23}}
+
+// gdb-command:print single_tuple
+// gdb-check:$6 = {x = {24, 25, 26}}
+
+// gdb-command:print tuple_padded_at_end
+// gdb-check:$7 = {x = {27, 28}, y = {29, 30}}
+// gdb-command:print struct_padded_at_end
+// gdb-check:$8 = {x = {31, 32}, y = {33, 34}}
+// gdb-command:print both_padded_at_end
+// gdb-check:$9 = {x = {35, 36, 37}, y = {38, 39}}
+
+// gdb-command:print mixed_padding
+// gdb-check:$10 = {x = {{40, 41, 42}, {43, 44}}, y = {45, 46, 47, 48}}
+
+#![allow(unused_variable)]
+
+struct NoPadding1 {
+ x: (i32, i32),
+ y: i32,
+ z: (i32, i32, i32)
+}
+
+struct NoPadding2 {
+ x: (i32, i32),
+ y: ((i32, i32), i32)
+}
+
+struct TupleInternalPadding {
+ x: (i16, i32),
+ y: (i32, i64)
+}
+
+struct StructInternalPadding {
+ x: (i16, i16),
+ y: (i64, i64)
+}
+
+struct BothInternallyPadded {
+ x: (i16, i32, i32),
+ y: (i32, i64)
+}
+
+struct SingleTuple {
+ x: (i16, i32, i64)
+}
+
+struct TuplePaddedAtEnd {
+ x: (i32, i16),
+ y: (i64, i32)
+}
+
+struct StructPaddedAtEnd {
+ x: (i64, i64),
+ y: (i16, i16)
+}
+
+struct BothPaddedAtEnd {
+ x: (i32, i32, i16),
+ y: (i64, i32)
+}
+
+// Data-layout (padding signified by dots, one column = 2 bytes):
+// [a.bbc...ddddee..ffffg.hhi...]
+struct MixedPadding {
+ x: ((i16, i32, i16), (i64, i32)),
+ y: (i64, i16, i32, i16)
+}
+
+
+fn main() {
+ let no_padding1 = NoPadding1 {
+ x: (0, 1),
+ y: 2,
+ z: (3, 4, 5)
+ };
+
+ let no_padding2 = NoPadding2 {
+ x: (6, 7),
+ y: ((8, 9), 10)
+ };
+
+ let tuple_internal_padding = TupleInternalPadding {
+ x: (11, 12),
+ y: (13, 14)
+ };
+
+ let struct_internal_padding = StructInternalPadding {
+ x: (15, 16),
+ y: (17, 18)
+ };
+
+ let both_internally_padded = BothInternallyPadded {
+ x: (19, 20, 21),
+ y: (22, 23)
+ };
+
+ let single_tuple = SingleTuple {
+ x: (24, 25, 26)
+ };
+
+ let tuple_padded_at_end = TuplePaddedAtEnd {
+ x: (27, 28),
+ y: (29, 30)
+ };
+
+ let struct_padded_at_end = StructPaddedAtEnd {
+ x: (31, 32),
+ y: (33, 34)
+ };
+
+ let both_padded_at_end = BothPaddedAtEnd {
+ x: (35, 36, 37),
+ y: (38, 39)
+ };
+
+ let mixed_padding = MixedPadding {
+ x: ((40, 41, 42), (43, 44)),
+ y: (45, 46, 47, 48)
+ };
+
+ zzz();
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:set print pretty off
+// gdb-command:rbreak zzz
+// gdb-command:run
+// gdb-command:finish
+
+// gdb-command:print no_padding1
+// gdb-check:$1 = {{0, 1}, 2, 3}
+// gdb-command:print no_padding2
+// gdb-check:$2 = {4, {5, 6}, 7}
+// gdb-command:print no_padding3
+// gdb-check:$3 = {8, 9, {10, 11}}
+
+// gdb-command:print internal_padding1
+// gdb-check:$4 = {12, {13, 14}}
+// gdb-command:print internal_padding2
+// gdb-check:$5 = {15, {16, 17}}
+
+// gdb-command:print padding_at_end1
+// gdb-check:$6 = {18, {19, 20}}
+// gdb-command:print padding_at_end2
+// gdb-check:$7 = {{21, 22}, 23}
+
+#![allow(unused_variable)]
+
+fn main() {
+ let no_padding1: ((u32, u32), u32, u32) = ((0, 1), 2, 3);
+ let no_padding2: (u32, (u32, u32), u32) = (4, (5, 6), 7);
+ let no_padding3: (u32, u32, (u32, u32)) = (8, 9, (10, 11));
+
+ let internal_padding1: (i16, (i32, i32)) = (12, (13, 14));
+ let internal_padding2: (i16, (i16, i32)) = (15, (16, 17));
+
+ let padding_at_end1: (i32, (i32, i16)) = (18, (19, 20));
+ let padding_at_end2: ((i32, i16), i32) = ((21, 22), 23);
+
+ zzz();
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:set print pretty off
+// gdb-command:rbreak zzz
+// gdb-command:run
+// gdb-command:finish
+
+// gdb-command:print no_padding16
+// gdb-check:$1 = {10000, -10001}
+
+// gdb-command:print no_padding32
+// gdb-check:$2 = {-10002, -10003.5, 10004}
+
+// gdb-command:print no_padding64
+// gdb-check:$3 = {-10005.5, 10006, 10007}
+
+// gdb-command:print no_padding163264
+// gdb-check:$4 = {-10008, 10009, 10010, 10011}
+
+// gdb-command:print internal_padding
+// gdb-check:$5 = {10012, -10013}
+
+// gdb-command:print padding_at_end
+// gdb-check:$6 = {-10014, 10015}
+
+
+// This test case mainly makes sure that no field names are generated for tuple structs (as opposed
+// to all fields having the name "<unnamed_field>"). Otherwise they are handled the same a normal
+// structs.
+
+struct NoPadding16(u16, i16);
+struct NoPadding32(i32, f32, u32);
+struct NoPadding64(f64, i64, u64);
+struct NoPadding163264(i16, u16, i32, u64);
+struct InternalPadding(u16, i64);
+struct PaddingAtEnd(i64, u16);
+
+fn main() {
+ let no_padding16 = NoPadding16(10000, -10001);
+ let no_padding32 = NoPadding32(-10002, -10003.5, 10004);
+ let no_padding64 = NoPadding64(-10005.5, 10006, 10007);
+ let no_padding163264 = NoPadding163264(-10008, 10009, 10010, 10011);
+
+ let internal_padding = InternalPadding(10012, -10013);
+ let padding_at_end = PaddingAtEnd(-10014, 10015);
+
+ zzz();
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-tidy-linelength
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:set print union on
+// gdb-command:rbreak zzz
+// gdb-command:run
+// gdb-command:finish
+
+// gdb-command:print case1
+// gdb-check:$1 = {{Case1, 0, 31868, 31868, 31868, 31868}, {Case1, 0, 2088533116, 2088533116}, {Case1, 0, 8970181431921507452}}
+
+// gdb-command:print case2
+// gdb-check:$2 = {{Case2, 0, 4369, 4369, 4369, 4369}, {Case2, 0, 286331153, 286331153}, {Case2, 0, 1229782938247303441}}
+
+// gdb-command:print case3
+// gdb-check:$3 = {{Case3, 0, 22873, 22873, 22873, 22873}, {Case3, 0, 1499027801, 1499027801}, {Case3, 0, 6438275382588823897}}
+
+// gdb-command:print univariant
+// gdb-check:$4 = {-1}
+
+#![allow(unused_variable)]
+
+// The first element is to ensure proper alignment, irrespective of the machines word size. Since
+// the size of the discriminant value is machine dependent, this has be taken into account when
+// datatype layout should be predictable as in this case.
+enum Regular {
+ Case1(u64, u16, u16, u16, u16),
+ Case2(u64, u32, u32),
+ Case3(u64, u64)
+}
+
+enum Univariant {
+ TheOnlyCase(i64)
+}
+
+fn main() {
+
+ // In order to avoid endianess trouble all of the following test values consist of a single
+ // repeated byte. This way each interpretation of the union should look the same, no matter if
+ // this is a big or little endian machine.
+
+ // 0b0111110001111100011111000111110001111100011111000111110001111100 = 8970181431921507452
+ // 0b01111100011111000111110001111100 = 2088533116
+ // 0b0111110001111100 = 31868
+ // 0b01111100 = 124
+ let case1 = Case1(0, 31868, 31868, 31868, 31868);
+
+ // 0b0001000100010001000100010001000100010001000100010001000100010001 = 1229782938247303441
+ // 0b00010001000100010001000100010001 = 286331153
+ // 0b0001000100010001 = 4369
+ // 0b00010001 = 17
+ let case2 = Case2(0, 286331153, 286331153);
+
+ // 0b0101100101011001010110010101100101011001010110010101100101011001 = 6438275382588823897
+ // 0b01011001010110010101100101011001 = 1499027801
+ // 0b0101100101011001 = 22873
+ // 0b01011001 = 89
+ let case3 = Case3(0, 6438275382588823897);
+
+ let univariant = TheOnlyCase(-1);
+
+ zzz();
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+// gdb-command:finish
+
+// gdb-command:print *the_a
+// gdb-check:$1 = {{TheA, x = 0, y = 8970181431921507452}, {TheA, 0, 2088533116, 2088533116}}
+
+// gdb-command:print *the_b
+// gdb-check:$2 = {{TheB, x = 0, y = 1229782938247303441}, {TheB, 0, 286331153, 286331153}}
+
+// gdb-command:print *univariant
+// gdb-check:$3 = {123234}
+
+#![allow(unused_variable)]
+#![feature(struct_variant)]
+
+// The first element is to ensure proper alignment, irrespective of the machines word size. Since
+// the size of the discriminant value is machine dependent, this has be taken into account when
+// datatype layout should be predictable as in this case.
+enum ABC {
+ TheA { x: i64, y: i64 },
+ TheB (i64, i32, i32),
+}
+
+// This is a special case since it does not have the implicit discriminant field.
+enum Univariant {
+ TheOnlyCase(i64)
+}
+
+fn main() {
+
+ // In order to avoid endianess trouble all of the following test values consist of a single
+ // repeated byte. This way each interpretation of the union should look the same, no matter if
+ // this is a big or little endian machine.
+
+ // 0b0111110001111100011111000111110001111100011111000111110001111100 = 8970181431921507452
+ // 0b01111100011111000111110001111100 = 2088533116
+ // 0b0111110001111100 = 31868
+ // 0b01111100 = 124
+ let the_a = box TheA { x: 0, y: 8970181431921507452 };
+
+ // 0b0001000100010001000100010001000100010001000100010001000100010001 = 1229782938247303441
+ // 0b00010001000100010001000100010001 = 286331153
+ // 0b0001000100010001 = 4369
+ // 0b00010001 = 17
+ let the_b = box TheB (0, 286331153, 286331153);
+
+ let univariant = box TheOnlyCase(123234);
+
+ zzz();
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+// gdb-command:finish
+
+// gdb-command:print variable
+// gdb-check:$1 = 1
+// gdb-command:print constant
+// gdb-check:$2 = 2
+// gdb-command:print a_struct
+// gdb-check:$3 = {a = -3, b = 4.5, c = 5}
+// gdb-command:print *struct_ref
+// gdb-check:$4 = {a = -3, b = 4.5, c = 5}
+// gdb-command:print *owned
+// gdb-check:$5 = 6
+// gdb-command:print managed->val
+// gdb-check:$6 = 7
+// gdb-command:print closure_local
+// gdb-check:$7 = 8
+// gdb-command:continue
+
+// gdb-command:finish
+// gdb-command:print variable
+// gdb-check:$8 = 1
+// gdb-command:print constant
+// gdb-check:$9 = 2
+// gdb-command:print a_struct
+// gdb-check:$10 = {a = -3, b = 4.5, c = 5}
+// gdb-command:print *struct_ref
+// gdb-check:$11 = {a = -3, b = 4.5, c = 5}
+// gdb-command:print *owned
+// gdb-check:$12 = 6
+// gdb-command:print managed->val
+// gdb-check:$13 = 7
+// gdb-command:print closure_local
+// gdb-check:$14 = 8
+// gdb-command:continue
+
+#![feature(managed_boxes)]
+#![allow(unused_variable)]
+
+struct Struct {
+ a: int,
+ b: f64,
+ c: uint
+}
+
+fn main() {
+ let mut variable = 1;
+ let constant = 2;
+
+ let a_struct = Struct {
+ a: -3,
+ b: 4.5,
+ c: 5
+ };
+
+ let struct_ref = &a_struct;
+ let owned = box 6;
+ let managed = @7;
+
+ let closure = || {
+ let closure_local = 8;
+
+ let nested_closure = || {
+ zzz();
+ variable = constant + a_struct.a + struct_ref.a + *owned + *managed + closure_local;
+ };
+
+ zzz();
+
+ nested_closure();
+ };
+
+ closure();
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+// gdb-command:finish
+
+// gdb-command:print constant
+// gdb-check:$1 = 1
+// gdb-command:print a_struct
+// gdb-check:$2 = {a = -2, b = 3.5, c = 4}
+// gdb-command:print *owned
+// gdb-check:$3 = 5
+
+#![allow(unused_variable)]
+
+struct Struct {
+ a: int,
+ b: f64,
+ c: uint
+}
+
+fn main() {
+ let constant = 1;
+
+ let a_struct = Struct {
+ a: -2,
+ b: 3.5,
+ c: 4
+ };
+
+ let owned = box 5;
+
+ let closure: proc() = proc() {
+ zzz();
+ do_something(&constant, &a_struct.a, owned);
+ };
+
+ closure();
+}
+
+fn do_something(_: &int, _:&int, _:&int) {
+
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:rbreak zzz
+// gdb-command:run
+// gdb-command:finish
+
+// gdb-command:print variable
+// gdb-check:$1 = 1
+// gdb-command:print constant
+// gdb-check:$2 = 2
+// gdb-command:print a_struct
+// gdb-check:$3 = {a = -3, b = 4.5, c = 5}
+// gdb-command:print *struct_ref
+// gdb-check:$4 = {a = -3, b = 4.5, c = 5}
+// gdb-command:print *owned
+// gdb-check:$5 = 6
+// gdb-command:print managed->val
+// gdb-check:$6 = 7
+
+#![feature(managed_boxes)]
+#![allow(unused_variable)]
+
+struct Struct {
+ a: int,
+ b: f64,
+ c: uint
+}
+
+fn main() {
+ let mut variable = 1;
+ let constant = 2;
+
+ let a_struct = Struct {
+ a: -3,
+ b: 4.5,
+ c: 5
+ };
+
+ let struct_ref = &a_struct;
+ let owned = box 6;
+ let managed = @7;
+
+ let closure = || {
+ zzz();
+ variable = constant + a_struct.a + struct_ref.a + *owned + *managed;
+ };
+
+ closure();
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-win32: FIXME #13256
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:set print pretty off
+// gdb-command:rbreak zzz
+// gdb-command:run
+// gdb-command:finish
+// gdb-command:print empty.length
+// gdb-check:$1 = 0
+
+// gdb-command:print singleton.length
+// gdb-check:$2 = 1
+// gdb-command:print *((int64_t[1]*)(singleton.data_ptr))
+// gdb-check:$3 = {1}
+
+// gdb-command:print multiple.length
+// gdb-check:$4 = 4
+// gdb-command:print *((int64_t[4]*)(multiple.data_ptr))
+// gdb-check:$5 = {2, 3, 4, 5}
+
+// gdb-command:print slice_of_slice.length
+// gdb-check:$6 = 2
+// gdb-command:print *((int64_t[2]*)(slice_of_slice.data_ptr))
+// gdb-check:$7 = {3, 4}
+
+// gdb-command:print padded_tuple.length
+// gdb-check:$8 = 2
+// gdb-command:print padded_tuple.data_ptr[0]
+// gdb-check:$9 = {6, 7}
+// gdb-command:print padded_tuple.data_ptr[1]
+// gdb-check:$10 = {8, 9}
+
+// gdb-command:print padded_struct.length
+// gdb-check:$11 = 2
+// gdb-command:print padded_struct.data_ptr[0]
+// gdb-check:$12 = {x = 10, y = 11, z = 12}
+// gdb-command:print padded_struct.data_ptr[1]
+// gdb-check:$13 = {x = 13, y = 14, z = 15}
+
+// gdb-command:print 'vec-slices::MUT_VECT_SLICE'.length
+// gdb-check:$14 = 2
+// gdb-command:print *((int64_t[2]*)('vec-slices::MUT_VECT_SLICE'.data_ptr))
+// gdb-check:$15 = {64, 65}
+
+#![allow(unused_variable)]
+
+struct AStruct {
+ x: i16,
+ y: i32,
+ z: i16
+}
+
+static VECT_SLICE: &'static [i64] = &[64, 65];
+static mut MUT_VECT_SLICE: &'static [i64] = &[32];
+
+fn main() {
+ let empty: &[i64] = &[];
+ let singleton: &[i64] = &[1];
+ let multiple: &[i64] = &[2, 3, 4, 5];
+ let slice_of_slice = multiple.slice(1,3);
+
+ let padded_tuple: &[(i32, i16)] = &[(6, 7), (8, 9)];
+
+ let padded_struct: &[AStruct] = &[
+ AStruct { x: 10, y: 11, z: 12 },
+ AStruct { x: 13, y: 14, z: 15 }
+ ];
+
+ unsafe {
+ MUT_VECT_SLICE = VECT_SLICE;
+ }
+
+ zzz();
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-win32: FIXME #13256
+// ignore-android: FIXME(#10381)
+
+// compile-flags:-g
+// gdb-command:set print pretty off
+// gdb-command:rbreak zzz
+// gdb-command:run
+// gdb-command:finish
+// gdb-command:print a
+// gdb-check:$1 = {1, 2, 3}
+// gdb-command:print vec::VECT
+// gdb-check:$2 = {4, 5, 6}
+
+#![allow(unused_variable)]
+
+static mut VECT: [i32, ..3] = [1, 2, 3];
+
+fn main() {
+ let a = [1, 2, 3];
+
+ unsafe {
+ VECT[0] = 4;
+ VECT[1] = 5;
+ VECT[2] = 6;
+ }
+
+ zzz();
+}
+
+fn zzz() {()}
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+unsafe extern fn foo() {}
+unsafe extern "C" fn bar() {}
+
+fn main() {
+ let _a: unsafe extern fn() = foo;
+ let _a: unsafe extern "C" fn() = foo;
+}