Skip to content

Commit 929cd6c

Browse files
committed
---
yaml --- r: 7362 b: refs/heads/master c: b8840cb h: refs/heads/master v: v3
1 parent eac390a commit 929cd6c

File tree

21 files changed

+1043
-389
lines changed

21 files changed

+1043
-389
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 315e3ff8dd73418b6730451d91e0032c8abe2f49
2+
refs/heads/master: b8840cbee603786107aa627eed4edcfc1c644b93

trunk/configure

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,16 @@ then
363363
err "either clang or gcc is required"
364364
fi
365365

366+
if [ ! -z "$CFG_PERF" ]
367+
then
368+
HAVE_PERF_LOGFD=`$CFG_PERF stat --log-fd 2>&1 | grep 'unknown option'`
369+
if [ -z "$HAVE_PERF_LOGFD" ];
370+
then
371+
CFG_PERF_WITH_LOGFD=1
372+
putvar CFG_PERF_WITH_LOGFD
373+
fi
374+
fi
375+
366376
step_msg "making directories"
367377

368378
for i in \

trunk/mk/platform.mk

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,11 @@ ifneq ($(findstring linux,$(CFG_OSTYPE)),)
5858
CFG_LDENV := LD_LIBRARY_PATH
5959
CFG_DEF_SUFFIX := .linux.def
6060
ifdef CFG_PERF
61-
CFG_PERF_TOOL := $(CFG_PERF) stat -r 3
61+
ifneq ($(CFG_PERF_WITH_LOGFD),)
62+
CFG_PERF_TOOL := $(CFG_PERF) stat -r 3 --log-fd 2
63+
else
64+
CFG_PERF_TOOL := $(CFG_PERF) stat -r 3
65+
endif
6266
else
6367
ifdef CFG_VALGRIND
6468
CFG_PERF_TOOL :=\

trunk/src/comp/front/attr.rs

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ export get_meta_item_name;
2020
export get_meta_item_value_str;
2121
export get_meta_item_value_str_by_name;
2222
export get_meta_item_list;
23+
export meta_item_value_from_list;
24+
export meta_item_list_from_list;
25+
export name_value_str_pair;
2326
export mk_name_value_item_str;
2427
export mk_name_value_item;
2528
export mk_list_item;
@@ -217,6 +220,53 @@ fn native_abi(attrs: [ast::attribute]) -> either::t<str, ast::native_abi> {
217220
};
218221
}
219222

223+
fn meta_item_from_list(
224+
items: [@ast::meta_item],
225+
name: str
226+
) -> option<@ast::meta_item> {
227+
let items = attr::find_meta_items_by_name(items, name);
228+
vec::last(items)
229+
}
230+
231+
fn meta_item_value_from_list(
232+
items: [@ast::meta_item],
233+
name: str
234+
) -> option<str> {
235+
alt meta_item_from_list(items, name) {
236+
some(item) {
237+
alt attr::get_meta_item_value_str(item) {
238+
some(value) { some(value) }
239+
none. { none }
240+
}
241+
}
242+
none. { none }
243+
}
244+
}
245+
246+
fn meta_item_list_from_list(
247+
items: [@ast::meta_item],
248+
name: str
249+
) -> option<[@ast::meta_item]> {
250+
alt meta_item_from_list(items, name) {
251+
some(item) {
252+
attr::get_meta_item_list(item)
253+
}
254+
none. { none }
255+
}
256+
}
257+
258+
fn name_value_str_pair(
259+
item: @ast::meta_item
260+
) -> option<(str, str)> {
261+
alt attr::get_meta_item_value_str(item) {
262+
some(value) {
263+
let name = attr::get_meta_item_name(item);
264+
some((name, value))
265+
}
266+
none. { none }
267+
}
268+
}
269+
220270
fn span<T: copy>(item: T) -> ast::spanned<T> {
221271
ret {node: item, span: ast_util::dummy_sp()};
222272
}

trunk/src/libcore/box.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
1+
/*
2+
Module: box
3+
*/
4+
5+
16
export ptr_eq;
27

3-
#[doc(
4-
brief = "Determine if two shared boxes point to the same object"
5-
)]
8+
/*
9+
Function: ptr_eq
10+
11+
Determine if two shared boxes point to the same object
12+
*/
613
pure fn ptr_eq<T>(a: @T, b: @T) -> bool {
714
// FIXME: ptr::addr_of
815
unsafe {

trunk/src/libcore/char.rs

Lines changed: 74 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
#[doc = "Utilities for manipulating the char type"];
1+
/*
2+
Module: char
3+
4+
Utilities for manipulating the char type
5+
*/
26

37
/*
48
Lu Uppercase_Letter an uppercase letter
@@ -43,40 +47,50 @@ import is_alphabetic = unicode::derived_property::Alphabetic;
4347
import is_XID_start = unicode::derived_property::XID_Start;
4448
import is_XID_continue = unicode::derived_property::XID_Continue;
4549

50+
/*
51+
Function: is_lowercase
4652
47-
#[doc(
48-
brief = "Indicates whether a character is in lower case, defined \
49-
in terms of the Unicode General Category 'Ll'."
50-
)]
53+
Indicates whether a character is in lower case, defined in terms of the
54+
Unicode General Category 'Ll'.
55+
*/
5156
pure fn is_lowercase(c: char) -> bool {
5257
ret unicode::general_category::Ll(c);
5358
}
5459

55-
#[doc(
56-
brief = "Indicates whether a character is in upper case, defined \
57-
in terms of the Unicode General Category 'Lu'."
58-
)]
60+
/*
61+
Function: is_uppercase
62+
63+
Indicates whether a character is in upper case, defined in terms of the
64+
Unicode General Category 'Lu'.
65+
*/
5966
pure fn is_uppercase(c: char) -> bool {
6067
ret unicode::general_category::Lu(c);
6168
}
6269

63-
#[doc(
64-
brief = "Indicates whether a character is whitespace, defined in \
65-
terms of the Unicode General Categories 'Zs', 'Zl', 'Zp' \
66-
additional 'Cc'-category control codes in the range [0x09, 0x0d]"
67-
)]
70+
/*
71+
Function: is_whitespace
72+
73+
Indicates whether a character is whitespace, defined in terms of
74+
the Unicode General Categories 'Zs', 'Zl', 'Zp' and the additional
75+
'Cc'-category control codes in the range [0x09, 0x0d].
76+
77+
*/
6878
pure fn is_whitespace(c: char) -> bool {
6979
ret ('\x09' <= c && c <= '\x0d')
7080
|| unicode::general_category::Zs(c)
7181
|| unicode::general_category::Zl(c)
7282
|| unicode::general_category::Zp(c);
7383
}
7484

75-
#[doc(
76-
brief = "Indicates whether a character is alphanumeric, defined \
77-
in terms of the Unicode General Categories 'Nd', \
78-
'Nl', 'No' and the Derived Core Property 'Alphabetic'."
79-
)]
85+
/*
86+
Function: is_alphanumeric
87+
88+
Indicates whether a character is alphanumeric, defined in terms of
89+
the Unicode General Categories 'Nd', 'Nl', 'No' and the Derived
90+
Core Property 'Alphabetic'.
91+
92+
*/
93+
8094
pure fn is_alphanumeric(c: char) -> bool {
8195
ret unicode::derived_property::Alphabetic(c) ||
8296
unicode::general_category::Nd(c) ||
@@ -85,24 +99,34 @@ pure fn is_alphanumeric(c: char) -> bool {
8599
}
86100

87101

88-
#[doc(
89-
brief = "Convert a char to the corresponding digit. \
90-
Safety note: This function fails if `c` is not a valid char",
91-
return = "If `c` is between '0' and '9', the corresponding value \
92-
between 0 and 9. If `c` is 'a' or 'A', 10. If `c` is \
93-
'b' or 'B', 11, etc."
94-
)]
102+
/*
103+
Function: to_digit
104+
105+
Convert a char to the corresponding digit.
106+
107+
Parameters:
108+
c - a char, either '0' to '9', 'a' to 'z' or 'A' to 'Z'
109+
110+
Returns:
111+
If `c` is between '0' and '9', the corresponding value between 0 and 9.
112+
If `c` is 'a' or 'A', 10. If `c` is 'b' or 'B', 11, etc.
113+
114+
Safety note:
115+
This function fails if `c` is not a valid char
116+
*/
95117
pure fn to_digit(c: char) -> u8 unsafe {
96118
alt maybe_digit(c) {
97119
option::some(x) { x }
98120
option::none. { fail; }
99121
}
100122
}
101123

102-
#[doc(
103-
brief = "Convert a char to the corresponding digit. Returns none when \
104-
character is not a valid hexadecimal digit."
105-
)]
124+
/*
125+
Function: maybe_digit
126+
127+
Convert a char to the corresponding digit. Returns none when the
128+
character is not a valid hexadecimal digit.
129+
*/
106130
pure fn maybe_digit(c: char) -> option::t<u8> {
107131
alt c {
108132
'0' to '9' { option::some(c as u8 - ('0' as u8)) }
@@ -113,11 +137,12 @@ pure fn maybe_digit(c: char) -> option::t<u8> {
113137
}
114138

115139
/*
140+
Function: to_lower
141+
142+
Convert a char to the corresponding lower case.
143+
116144
FIXME: works only on ASCII
117145
*/
118-
#[doc(
119-
brief = "Convert a char to the corresponding lower case."
120-
)]
121146
pure fn to_lower(c: char) -> char {
122147
alt c {
123148
'A' to 'Z' { ((c as u8) + 32u8) as char }
@@ -126,22 +151,31 @@ pure fn to_lower(c: char) -> char {
126151
}
127152

128153
/*
154+
Function: to_upper
155+
156+
Convert a char to the corresponding upper case.
157+
129158
FIXME: works only on ASCII
130159
*/
131-
#[doc(
132-
brief = "Convert a char to the corresponding upper case."
133-
)]
134160
pure fn to_upper(c: char) -> char {
135161
alt c {
136162
'a' to 'z' { ((c as u8) - 32u8) as char }
137163
_ { c }
138164
}
139165
}
140166

141-
#[doc(
142-
brief = "Compare two chars.",
143-
return = "-1 if a&lt;b, 0 if a==b, +1 if a>b"
144-
)]
167+
/*
168+
Function: cmp
169+
170+
Compare two chars.
171+
172+
Parameters:
173+
a - a char
174+
b - a char
175+
176+
Returns:
177+
-1 if a<b, 0 if a==b, +1 if a>b
178+
*/
145179
pure fn cmp(a: char, b: char) -> int {
146180
ret if b > a { -1 }
147181
else if b < a { 1 }

0 commit comments

Comments
 (0)