Commit Graph

285 Commits

Author SHA1 Message Date
Graydon Hoare
9caca02dac Merge pull request #1827 from uasi/from-cstr
Avoid extra memory allocations in core::str::from_cstr{,_len}
2012-02-13 11:29:58 -08:00
Kevin Cantu
69834646d2 (core::str) more test cases 2012-02-13 03:07:29 -08:00
Kevin Cantu
2600db4778 (core::str) added FIXME comment 2012-02-13 02:17:19 -08:00
Kevin Cantu
07ef368c60 (core::str) rename find_chars -> find 2012-02-13 01:57:05 -08:00
Kevin Cantu
c81867474a (core::str) add find_bytes and export it... 2012-02-13 01:56:58 -08:00
Kevin Cantu
748b63f63f (core::str) add find_chars and b2c_pos functions 2012-02-13 01:56:10 -08:00
Kevin Cantu
0e61fe2eea (core::str) use slice_bytes in starts_with for a little bit less string traversal 2012-02-13 01:56:10 -08:00
Brian Anderson
8309d50ff4 core: Add iter::filter_map 2012-02-12 22:30:58 -08:00
Brian Anderson
e360ddbd65 core: Add iterable implementation for strings 2012-02-12 22:17:10 -08:00
Brian Anderson
092c244d3a core: Rename iter::reverse to iter::reversed for consistency with vec mod 2012-02-12 22:11:42 -08:00
Brian Anderson
ad2f566ff2 core: Add abs functions for signed integer types 2012-02-12 22:04:06 -08:00
Brian Anderson
acc57a44fd core: Add compl functions for the rest of the integer types 2012-02-12 21:58:06 -08:00
Tomoki Aonuma
4d788be80d from_cstr and from_cstr_len are not unsafe, I think 2012-02-13 12:44:14 +09:00
Tomoki Aonuma
8d29e87056 core::str::from_cstr uses from_cstr_len 2012-02-13 12:44:14 +09:00
Tomoki Aonuma
e5cc9193f8 Avoid extra memory allocations in core::str::from_cstr_len 2012-02-13 12:44:14 +09:00
Brian Anderson
fde719f635 core: Implement foldl/r without copying the accumulator 2012-02-12 19:24:24 -08:00
Brian Anderson
d679c0eb34 core: Add iter::foldr 2012-02-12 19:24:24 -08:00
Brian Anderson
3edad3555e core: Add iter::count 2012-02-12 19:24:24 -08:00
Brian Anderson
85175d639f core: Add iter::reverse 2012-02-12 19:24:24 -08:00
Brian Anderson
c21db3bbc2 core: Add iter::min/max 2012-02-12 19:24:24 -08:00
Kevin Cantu
f5e1108fc3 (core::str) comments and cleanup 2012-02-12 15:30:21 -08:00
Kevin Cantu
faa513b1f6 (core::str) fixed replace, fixed starts_with, and added more find/contains/replace test cases 2012-02-12 15:30:21 -08:00
Kevin Cantu
2ba44e24d5 (core::str) rename byte_len_range -> substr_len_bytes and
rename char_len_range -> substr_len_chars
2012-02-12 15:30:20 -08:00
Kevin Cantu
2b4f5136a5 (core::str) rename byte_len -> len_bytes and rename char_len -> len 2012-02-12 15:30:20 -08:00
Kevin Cantu
944f5a6598 (core::str) move push_byte, push_bytes, pop_byte, and shift_byte into str::unsafe 2012-02-12 15:30:20 -08:00
Brian Anderson
5fb0906f43 core: Formulate all unsigned max_values as 0 - 1 for consistency 2012-02-12 00:00:15 -08:00
Brian Anderson
4838d7860e core: Add min/max functions for all int types 2012-02-11 23:56:53 -08:00
Brian Anderson
3bdb627b5d core: Make uint::min/max pure 2012-02-11 23:52:40 -08:00
Brian Anderson
910c6a5df8 core: Fill out missing functions for basic types 2012-02-11 23:49:13 -08:00
Brian Anderson
87d17be846 core: Add modules for remaining scalar types 2012-02-11 23:18:26 -08:00
Tomoki Aonuma
70b04a14d1 Add a test for core::str::from_cstr_len 2012-02-12 13:28:54 +09:00
Tomoki Aonuma
6408d54c13 Implement core::str::from_cstr_len, close #1666 2012-02-12 13:25:15 +09:00
Brian Anderson
d2debed605 core: Change the argument order for vec::contains, vec::count 2012-02-11 18:00:52 -08:00
Brian Anderson
1040b47078 core: Rename vec::member to vec::contains to match str mod 2012-02-11 18:00:52 -08:00
Brian Anderson
737db5b49a Merge pull request #1812 from killerswan/indexing2
(core::str) Fixing index and rindex
2012-02-11 17:42:45 -08:00
Kevin Cantu
207bb3d2df (core::str) removed [r]index_byte 2012-02-11 17:04:08 -08:00
Kevin Cantu
0121cd5b0e (core::char) export is_digit 2012-02-11 16:50:03 -08:00
Kevin Cantu
50360873f8 (core::str) added rindex and rewrote pop_char with char_range_at_reverse 2012-02-11 16:39:39 -08:00
Kevin Cantu
27161f4415 using str::index... 2012-02-11 16:39:39 -08:00
Kevin Cantu
14baf88f89 core::str: added index (char) 2012-02-11 16:39:39 -08:00
Kevin Cantu
a131b430a0 core::str rename [r]index -> [r]index_bytes 2012-02-11 16:39:39 -08:00
Kevin Cantu
5c58dde2f8 core: added char::is_digit (matching Nd, Nl, No) 2012-02-11 16:39:19 -08:00
Kevin Cantu
b3444db161 core: added a rough char::is_ascii 2012-02-11 16:39:19 -08:00
Tomoki Aonuma
0e5922a0b1 Fix typo in either.rs 2012-02-12 03:42:11 +09:00
Niko Matsakis
fdddf8f9e1 put serializer into the build and encode full item paths 2012-02-10 20:48:28 -08:00
Brian Anderson
ae2968d10a core: Use rust_task_config_notify instead of twiddling rust_task's innards 2012-02-09 19:00:15 -08:00
Brian Anderson
9effae8413 Merge pull request #1794 from matricks/bugfix
fixed memmove. were using memcpy due to copy paste error
2012-02-09 13:47:55 -08:00
Magnus Auvinen
a422cd7ddb fixed memmove. were using memcpy due to copy paste error 2012-02-09 21:47:12 +01:00
Marijn Haverbeke
50fb4c30ed Increase precedence of as operator
Closes #1717
2012-02-09 11:58:08 +01:00
Brian Anderson
149d1d4a6e core: Add a test for blocking in native code 2012-02-08 15:42:51 -08:00
Brian Anderson
35ba9715fa core: Add task::spawn_sched
This function creates a new scheduler with a specified number of threads and
immediately executes a task on it. The scheduler is configured to terminate
when the task dies. This is the minimum API necessary to enable blocking C
calls.
2012-02-08 15:42:51 -08:00
Erick Tryzelaar
3a413aabd4 core: add str::as_bytes function
This pattern is used in a couple places, so it'd be nice
to abstract it away.
2012-02-08 10:18:36 -08:00
Brian Anderson
708f7b927c core: Export floor functions 2012-02-07 22:02:55 -08:00
Graydon Hoare
93450abb4b Make process-spawning take environments and working directories, remove procsrv task from compiletest. 2012-02-07 19:57:03 -08:00
Brian Anderson
0c13ee22ad core: Use substr in extfmt instead of slice_bytes 2012-02-07 16:34:02 -08:00
Kevin Cantu
1aa23947a6 core: add str::splitn_char and fix str::splitn_char_iter 2012-02-07 16:25:35 -08:00
Kevin Cantu
2b0396c34a core: make str::substr use char positions (and replace other uses) 2012-02-07 16:25:35 -08:00
Kevin Cantu
a3f5626ad1 String split renaming:
* Renamed str::split -> str::split_byte
* Renamed str::splitn -> str::splitn_byte
* Renamed str::split_func -> str::split
* Renamed str::split_char -> str::split_char
* Renamed str::split_chars_iter -> str::split_char_iter
* Added u8::is_ascii
* Fixed the behavior of str::split_str, so that it matches split_chars
  and split (i.e. ["", "XXX", "YYY", ""] == split_str(".XXX.YYY.", "."))
* Fixed str::split_byte and str::splitn_byte so that they handle
  splitting UTF-8 strings on a given UTF-8/ASCII byte and also handle ""
  as the others do
2012-02-07 16:25:35 -08:00
Brian Anderson
159aebc28b core: Whitespace policia 2012-02-07 15:08:54 -08:00
Magnus Auvinen
a5fc0b08de added some documentation and made the memcpy and memmove unsafe 2012-02-07 15:08:54 -08:00
Magnus Auvinen
3e9859362b made leak an intrinsic to avoid a c-call. added memmove and memcpy intrinsics 2012-02-07 15:08:54 -08:00
Erick Tryzelaar
be35893834 core: Implement str::escape with str::chars_iter. 2012-02-05 19:42:56 -08:00
Brian Anderson
c04b897cb2 core: Resolve some FIXMEs 2012-02-05 17:30:47 -08:00
Brian Anderson
91b6dc5c8e Merge remote-tracking branch 'erickt/master'
Conflicts:
	src/libcore/vec.rs
	src/libstd/getopts.rs
2012-02-05 15:15:21 -08:00
Kevin Cantu
6be25c8a0c Adding str::reserve 2012-02-05 14:56:16 -08:00
Kevin Atkinson
e127bf680f Fix byte_len in char_len_range to be what it is advertised. 2012-02-03 17:48:16 -08:00
Tom Lee
31b0d1b4bd core: rename str::lteq to str::le 2012-02-03 14:09:44 +01:00
Marijn Haverbeke
c1b075d042 Remove experimental GC code
It's been sitting unused long enough to have bitrotted completely.
2012-02-03 11:34:12 +01:00
Brian Anderson
57cad61353 rt: Remove task pinning. Does nothing 2012-02-02 18:10:24 -08:00
Brian Anderson
18de0f2aeb rt: Rename task_sleep intrinsic to task_yield. Remove usec param 2012-02-02 18:10:24 -08:00
Kevin Cantu
ae0d49aa06 Rename str::char_slice -> str::slice 2012-02-01 21:56:53 -08:00
Kevin Cantu
fc9169f09c Make the tests work, too 2012-02-01 21:56:53 -08:00
Kevin Cantu
8f367ebfeb Rename (again) str::unsafe::slice -> str::unsafe::slice_bytes and
str::unsafe::safe_slice -> str::unsafe::slice_bytes_safe_range
2012-02-01 21:56:53 -08:00
Kevin Cantu
01c01f68af Stop exporting str::slice and str::safe_slice (use unsafe instead) 2012-02-01 21:56:53 -08:00
Kevin Cantu
4e406d7fdd Make it work 1 2012-02-01 21:56:53 -08:00
Kevin Cantu
cccf9e5389 Copy str::slice -> str::unsafe::slice (and unsafe_slice) 2012-02-01 21:56:53 -08:00
Kevin Cantu
5a19bafeea Actually export the str::unsafe module for now 2012-02-01 21:56:53 -08:00
Niko Matsakis
196d69beb2 make boxes self-describing (fixes #1493)" (take 2)
this will be used to generate a new snapshot.
2012-02-01 18:52:08 -08:00
Niko Matsakis
3116643806 Revert "make boxes self-describing (fixes #1493)" until a new
snapshot is prepared.
2012-02-01 18:50:19 -08:00
Niko Matsakis
c36207bfb8 make boxes self-describing (fixes #1493) 2012-02-01 18:18:07 -08:00
Tim Chevalier
49cb3fc7df Remove remaining references to option::t outside option itself 2012-02-01 16:49:57 -08:00
Brian Anderson
d24eb58a09 core: Ignore should_fail tests on win32 2012-02-01 15:35:59 -08:00
Marijn Haverbeke
694de53d28 Make vec::pop efficient 2012-02-01 12:23:13 +01:00
Marijn Haverbeke
856a544d0c Remove native types from stdlib 2012-02-01 12:23:13 +01:00
Niko Matsakis
56db37d4c7 add iter library in preliminary form (limited syntactic support) 2012-01-31 19:21:26 -08:00
Tim Chevalier
e5d095d67e Change option::t to option
Now that core exports "option" as a synonym for option::t, search-and-
replace option::t with option.

The only place that still refers to option::t are the modules in libcore
that use option, because fixing this requires a new snapshot
(forthcoming).
2012-01-31 17:05:20 -08:00
Kevin Cantu
1f795ff3b0 Re-implementing str::to_upper and str::to_lower using str::map 2012-01-31 14:29:11 -08:00
Kevin Cantu
a8b657397a Add str::split_chars_iter and str::splitn_chars_iter 2012-01-31 14:29:11 -08:00
Kevin Cantu
ebf14cb3a9 Rename str::iter_chars -> str::chars_iter 2012-01-31 14:29:11 -08:00
Kevin Cantu
c7454f5595 Rename str::to_chars -> str::chars 2012-01-31 14:29:11 -08:00
Kevin Cantu
685a434e0a Rename str::loop_chars to str::all,
rename str::loop_chars_sub to str::substr_all, and
propagate this change to std::rope and rustdoc's calls to these
2012-01-31 14:29:11 -08:00
Kevin Cantu
be9129f556 Comment fixes in str 2012-01-31 14:29:11 -08:00
Kevin Cantu
03b8c8df01 Rename str::from_byte(s) to str::unsafe::from_byte(s),
mark them as unsafe,
make comp/driver/driver.rs use str::from_bytes...
2012-01-31 14:29:10 -08:00
Brian Anderson
b9bb58f104 core: Add ctypes::c_char 2012-01-30 22:08:57 -08:00
Paul Woolcock
e1251f7b00 Change all ternary ops to if/then/else
All the files below had at least one instance of the ternary operator
present in the source.  All have been changed to the equivalent
if/then/else expression.
2012-01-30 18:21:01 +01:00
Brian Anderson
cad4918b2a core: Remove sys::set_min_stack
This was a temporary hack with global effect. Eventually there will
be a real solution for controlling stack sizes.
2012-01-29 21:27:09 -08:00
Erick Tryzelaar
29ba196336 Adding a function to concatanate vectors with a separator 2012-01-28 15:41:53 -08:00
Erick Tryzelaar
f98210db07 core: Flesh out vec find functions. 2012-01-28 09:18:34 -08:00
Erick Tryzelaar
025e6ff158 core: add vec spliting functions. 2012-01-28 09:18:34 -08:00
Erick Tryzelaar
1be3a7c263 core: add (,r)position(,_from) functions
This is to help search through a vector better.
2012-01-28 09:18:34 -08:00