Skip to content

Commit faccb07

Browse files
committed
---
yaml --- r: 136574 b: refs/heads/dist-snap c: 72841b1 h: refs/heads/master v: v3
1 parent 2985b73 commit faccb07

File tree

5 files changed

+63
-11
lines changed

5 files changed

+63
-11
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: 189b7332968972f34cdbbbd9b62d97ababf53059
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: f7693d6b85f5ab4deedf26cddc4a511fb9c209de
9+
refs/heads/dist-snap: 72841b128df8b6a4eb88b1048548e2eec5244449
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/etc/make-win-dist.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,15 @@ def make_win_dist(dist_root, target_triple):
5858
for src in rustc_dlls:
5959
shutil.copy(src, dist_bin_dir)
6060

61-
# Copy platform tools (and another copy of runtime dlls) to platform-spcific bin directory
62-
target_bin_dir = os.path.join(dist_root, "bin", "rustlib", target_triple, "bin")
61+
# Copy platform tools to platform-specific bin directory
62+
target_bin_dir = os.path.join(dist_root, "bin", "rustlib", target_triple, "gcc", "bin")
6363
if not os.path.exists(target_bin_dir):
6464
os.makedirs(target_bin_dir)
6565
for src in target_tools:
6666
shutil.copy(src, target_bin_dir)
6767

6868
# Copy platform libs to platform-spcific lib directory
69-
target_lib_dir = os.path.join(dist_root, "bin", "rustlib", target_triple, "lib")
69+
target_lib_dir = os.path.join(dist_root, "bin", "rustlib", target_triple, "gcc", "lib")
7070
if not os.path.exists(target_lib_dir):
7171
os.makedirs(target_lib_dir)
7272
for src in target_libs:

branches/dist-snap/src/librustc/driver/driver.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -560,8 +560,8 @@ pub fn phase_6_link_output(sess: &Session,
560560
trans: &CrateTranslation,
561561
outputs: &OutputFilenames) {
562562
let old_path = os::getenv("PATH").unwrap_or_else(||String::new());
563-
let mut new_path = os::split_paths(old_path.as_slice());
564-
new_path.push_all_move(sess.host_filesearch().get_tools_search_paths());
563+
let mut new_path = sess.host_filesearch().get_tools_search_paths();
564+
new_path.push_all_move(os::split_paths(old_path.as_slice()));
565565
os::setenv("PATH", os::join_paths(new_path.as_slice()).unwrap());
566566

567567
time(sess.time_passes(), "linking", (), |_|

branches/dist-snap/src/librustc/metadata/filesearch.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,12 @@ impl<'a> FileSearch<'a> {
150150
p.push(find_libdir(self.sysroot));
151151
p.push(rustlibdir());
152152
p.push(self.triple);
153-
p.push("bin");
154-
vec![p]
153+
let mut p1 = p.clone();
154+
p1.push("bin");
155+
let mut p2 = p.clone();
156+
p2.push("gcc");
157+
p2.push("bin");
158+
vec![p1, p2]
155159
}
156160
}
157161

branches/dist-snap/src/libterm/win.rs

Lines changed: 51 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,29 @@ use Terminal;
2323
/// A Terminal implementation which uses the Win32 Console API.
2424
pub struct WinConsole<T> {
2525
buf: T,
26+
def_foreground: color::Color,
27+
def_background: color::Color,
2628
foreground: color::Color,
2729
background: color::Color,
2830
}
2931

32+
#[allow(non_snake_case)]
33+
#[repr(C)]
34+
struct CONSOLE_SCREEN_BUFFER_INFO {
35+
dwSize: [libc::c_short, ..2],
36+
dwCursorPosition: [libc::c_short, ..2],
37+
wAttributes: libc::WORD,
38+
srWindow: [libc::c_short, ..4],
39+
dwMaximumWindowSize: [libc::c_short, ..2],
40+
}
41+
3042
#[allow(non_snake_case)]
3143
#[link(name = "kernel32")]
3244
extern "system" {
3345
fn SetConsoleTextAttribute(handle: libc::HANDLE, attr: libc::WORD) -> libc::BOOL;
3446
fn GetStdHandle(which: libc::DWORD) -> libc::HANDLE;
47+
fn GetConsoleScreenBufferInfo(handle: libc::HANDLE,
48+
info: *mut CONSOLE_SCREEN_BUFFER_INFO) -> libc::BOOL;
3549
}
3650

3751
fn color_to_bits(color: color::Color) -> u16 {
@@ -56,6 +70,26 @@ fn color_to_bits(color: color::Color) -> u16 {
5670
}
5771
}
5872

73+
fn bits_to_color(bits: u16) -> color::Color {
74+
let color = match bits & 0x7 {
75+
0 => color::BLACK,
76+
0x1 => color::BLUE,
77+
0x2 => color::GREEN,
78+
0x4 => color::RED,
79+
0x6 => color::YELLOW,
80+
0x5 => color::MAGENTA,
81+
0x3 => color::CYAN,
82+
0x7 => color::WHITE,
83+
_ => unreachable!()
84+
};
85+
86+
if bits >= 8 {
87+
color | 0x8
88+
} else {
89+
color
90+
}
91+
}
92+
5993
impl<T: Writer> WinConsole<T> {
6094
fn apply(&mut self) {
6195
let _unused = self.buf.flush();
@@ -91,7 +125,21 @@ impl<T: Writer> Writer for WinConsole<T> {
91125

92126
impl<T: Writer> Terminal<T> for WinConsole<T> {
93127
fn new(out: T) -> Option<WinConsole<T>> {
94-
Some(WinConsole { buf: out, foreground: color::WHITE, background: color::BLACK })
128+
let fg;
129+
let bg;
130+
unsafe {
131+
let mut buffer_info = ::std::mem::uninitialized();
132+
if GetConsoleScreenBufferInfo(GetStdHandle(-11), &mut buffer_info) != 0 {
133+
fg = bits_to_color(buffer_info.wAttributes);
134+
bg = bits_to_color(buffer_info.wAttributes >> 4);
135+
} else {
136+
fg = color::WHITE;
137+
bg = color::BLACK;
138+
}
139+
}
140+
Some(WinConsole { buf: out,
141+
def_foreground: fg, def_background: bg,
142+
foreground: fg, background: bg } )
95143
}
96144

97145
fn fg(&mut self, color: color::Color) -> IoResult<bool> {
@@ -134,8 +182,8 @@ impl<T: Writer> Terminal<T> for WinConsole<T> {
134182
}
135183

136184
fn reset(&mut self) -> IoResult<()> {
137-
self.foreground = color::WHITE;
138-
self.background = color::BLACK;
185+
self.foreground = self.def_foreground;
186+
self.background = self.def_background;
139187
self.apply();
140188

141189
Ok(())

0 commit comments

Comments
 (0)