Commit Graph

485 Commits

Author SHA1 Message Date
Brian Anderson
c01d05f18d std: Add 2 timer stress tests 2012-04-28 14:13:36 -07:00
Jeff Olson
caab57586a rt/std: whitespace cleanup + work on hl/global_loop docs 2012-04-27 22:19:30 -07:00
Jeff Olson
92e88e4e2c std: another stab at a race-free global loop implementation
seems to hold up pretty well.

uv::hl API is affected.. had to do work on tests and std::timer code that
leverages the global loop/high_level_loop API.

see test_stress_gl_uv_global_loop_high_level_global_timer for a stress
example.. it takes a while to run, but it exits cleanly (something I could
never accomplish with earlier iterations of the global loop)
2012-04-27 22:19:30 -07:00
Jeff Olson
474e7e5e0d std: get rid of some un-needed rustrt native fns for the global loop 2012-04-27 22:19:30 -07:00
Jeff Olson
fbaba0f404 std: add ll::loop_refcount binding for uv_loop_refcount 2012-04-27 22:19:30 -07:00
Brian Anderson
7eec6eb2bb std: Add FIXME about time tests 2012-04-26 13:54:01 -07:00
Ted Horst
340dbcfdc8 temporary hack to make testing std::time reliable 2012-04-26 13:52:29 -07:00
Graydon Hoare
753b683939 More slice use in vec, io, str, ebml, metadata encoder and decoder. 2012-04-25 17:19:36 -07:00
Marijn Haverbeke
9f99c3263b Rewrite exhaustiveness checker
Issue #2111
2012-04-25 09:15:17 +02:00
Marijn Haverbeke
9053f54498 Move map iface over to more for-friendly iteration methods 2012-04-23 15:18:19 +02:00
Brian Anderson
bef5cd8e45 std: Export sort::le 2012-04-21 13:45:20 -07:00
Jeff Olson
f855682bed std: ignore tests that use high_level_loop
until race issue with (most likely) refcount scheme is sorted out
2012-04-20 16:46:50 -07:00
Jeff Olson
707391edbc std: add timer::recv_timeout() and whitespace cleanup 2012-04-20 15:23:23 -07:00
Jeff Olson
7ac8c3081c std: add std::timer and timer::delayed_send and timer::sleep
.. leveraging std::uv, we have:
timer::delayed_send - send a value over a provided channel after the
timeout has passed
timer::sleep - block the current task for the specified period

both of these fns (and everything that goes in timer.rs) leverage the
uv_timer_* API
2012-04-20 15:23:23 -07:00
Jeff Olson
a1c43cc7c9 std: dump old std::uv API.. move remaining tests into uv::ll 2012-04-20 15:23:23 -07:00
Jeff Olson
791ea3466d std::uv : cleanup and an isolated test for hand-rolled high_level_loops 2012-04-20 15:23:23 -07:00
Jeff Olson
e02057c5a5 std: fail if exiting hl_loop has unref_handles at weaken_task exit 2012-04-20 15:23:23 -07:00
Jeff Olson
a9db0c9efe whitespace cleanup 2012-04-20 15:23:23 -07:00
Jeff Olson
a045e63639 std: get_monitor_task_gl() is global_loop::get() default 2012-04-20 15:23:23 -07:00
Jeff Olson
e15f1d5cad std: refactor global_loop::get.. make it reusable 2012-04-20 15:23:23 -07:00
Jeff Olson
afb35f752f fix uv_timer_t size in 32bit linux and windows
.. fixes issue, in previous commit, with global loop test hanging on
32bit linux (this was because the struct was too small, so (presumably),
the data member was garbled.. yippy)
2012-04-20 15:23:23 -07:00
Jeff Olson
83ae83c3b3 uv::hl::get_global_loop() -> uv::global_loop::get()
- moved global loop tests, as well.. will add tests in uv_hl that encompass
rolling your own high_level_loop via uv::hl::run_high_level_loop()
- also whitespace cleanups and misc warning cleanup..
- doesn't work on 32bit linux
2012-04-20 15:23:22 -07:00
Jeff Olson
253fad7788 replace impl of globa_async_handle with one using atomic compare-and-swap 2012-04-20 15:23:22 -07:00
Jeff Olson
728f92604a fix a race in global loop test; unref_handle now takes a close_cb 2012-04-20 15:23:22 -07:00
Jeff Olson
9a5d1974dc don't use ::malloc for initializing the global_async_handle in rust_kernel 2012-04-20 15:23:22 -07:00
Jeff Olson
f21d25b54c make weak task that runs libuv loop unsupervised 2012-04-20 15:23:22 -07:00
Jeff Olson
e0f110aa12 clean and trying the global loop test as two separate loop lifetimes..
.. seeing an occasional valgrind/barf spew on some invalid read/writes..
need to investigate further.. i think its related to my poor citizen
conduct, re: pointers stashed in rust_kernel..
2012-04-20 15:23:22 -07:00
Jeff Olson
31ba223c26 end-to-end impl of global loop w/ high-level ref counting.. needs work
- starting/stoping the loop based on client work is functioning, correctly
- the issue appears to be that, when the process is about to exit, the
signal to let weak tasks know that they need to exit isn't getting fired.
2012-04-20 15:23:22 -07:00
Jeff Olson
e6f6a8ced4 tweaking rust getter/setters for libuv data to use generics 2012-04-20 15:23:22 -07:00
Jeff Olson
12f2f4c15c rt: whitespace cleanup for existing libuv integration 2012-04-20 15:23:22 -07:00
Jeff Olson
e604c15df1 bindings to get/set data field on uv_loop_t* and debug log cleanup 2012-04-20 15:23:21 -07:00
Jeff Olson
bf99a3aa93 adding low-level uv_timer_* stuff to libuv bindings 2012-04-20 15:23:21 -07:00
Jeff Olson
3d004c6df8 making brson's req. cleanups in #2134 plus change printf to LOG in c++ 2012-04-20 15:23:21 -07:00
Graydon Hoare
956bc773c6 Fix [] on str to exclude the trailing null. 2012-04-18 17:50:58 -07:00
Marijn Haverbeke
a65af017ca Remove tri.rs and four.rs
Closes #1892
2012-04-18 17:21:39 +02:00
Haitao Li
39c5e06526 Revert "libstd: Handle test results in serial"
This reverts commit 828d0677c4.
2012-04-13 18:34:45 +08:00
Haitao Li
2955ecd13c Revert "libstd: Colorify test results when run in parallel"
This reverts commit 7b3cb05311.
2012-04-13 18:34:41 +08:00
Haitao Li
7b3cb05311 libstd: Colorify test results when run in parallel
Closes #782
2012-04-12 17:33:07 +08:00
Haitao Li
828d0677c4 libstd: Handle test results in serial
Issue #782
2012-04-12 17:33:01 +08:00
Jeff Olson
52e084b92a ignore tcp server/client test on linux 32bit, pending #2064
also println->log(debug,) and assorted cleanup ahead of merge to master
2012-04-06 15:35:50 -07:00
Jeff Olson
82f8d8cb2a removing some unneeded native fn mappingsin uv.rs and misc clean
.. 32bit linux issues persist.
2012-04-06 15:35:50 -07:00
Jeff Olson
6b349f3d11 experimenting with a different uv_buf_init impl to placate 32bit linux 2012-04-06 15:35:50 -07:00
Jeff Olson
6189a0814b whitespace cleanup in uv_* 2012-04-06 15:35:50 -07:00
Jeff Olson
ed3c8610c3 adding 32bit-unix struct struct size differences 2012-04-06 15:35:50 -07:00
Jeff Olson
79269ea064 fixing some libuv stuff that leaked through the rebase 2012-04-06 15:35:50 -07:00
Jeff Olson
b39a43cd5c adding uv_hl module and some doc work 2012-04-06 15:35:50 -07:00
Jeff Olson
7c0fed469f rename uv::direct:: to uv::ll:: and put into its own crate 2012-04-06 15:35:50 -07:00
Jeff Olson
f18991d900 getting rid of ip4 port byval test... 2064 workarounds in place, for now 2012-04-06 15:35:50 -07:00
Jeff Olson
b712e5e132 line length fixes for make check 2012-04-06 15:35:49 -07:00
Jeff Olson
55143bb14c docs tweak for uv module 2012-04-06 15:35:49 -07:00
Jeff Olson
26addfdd81 fix size of uv_async_t on windows. is this the cause of the libuv segfault? 2012-04-06 15:35:49 -07:00
Jeff Olson
2b606ae5f3 add libuv error msg helpers.. flushing out windows tcp issue. 2012-04-06 15:35:49 -07:00
Jeff Olson
2c26cf7f96 add low-level uv_async bindings for use in tcp test 2012-04-06 15:35:49 -07:00
Jeff Olson
7176321685 refactored the tcp request and server tests into 1 test using loopback
..plus whitespace cleanup for make check
2012-04-06 15:35:49 -07:00
Jeff Olson
922ed6f947 hello world test for a tcp server in libuv
.. im now going to refactor the tcp request and server tests to utilize
each other, so no more external network ugliness
2012-04-06 15:35:49 -07:00
Jeff Olson
85e26eff6a fixing libuv stuff in win32 (see #2064) .. pass sockaddr_in by-ref, for now 2012-04-06 15:35:49 -07:00
Jeff Olson
ab1efb900e fixed unix uv struct err from prev commit, also starting uv docs 2012-04-06 15:35:49 -07:00
Jeff Olson
fcc973b5ac massaging out struct-size differences between unix and win32 2012-04-06 15:35:49 -07:00
Jeff Olson
1eff88f434 win32 tweaks 2012-04-06 15:35:48 -07:00
Jeff Olson
9ad67e8c14 test_uv_tcp_request() fully working on linux
.. up next: windows!
.. impl'd uv::direct::read_stop() and uv::direct::close() to wrap things up
.. demonstrated sending data out of the uv_read_cb via a channel (which
we block on to recv all of it, complete w/ EOF notification) that is
read from after the loop exits.
.. helpers to read the guts of a uv_buf_t
.. an idea im kicking around: starting to pile up all of these hideous
data accessor functions in uv::direct .. I might make impl/iface pairs
for the various uv_* types that I'm using, in order to encapsulate those
data access functions and, perhaps, make the access look a little cleaner
(it still won't be straight field access, but it'll be a lot better)
.. formatting cleanup to satisfy make check
2012-04-06 15:35:48 -07:00
Jeff Olson
877747d0ac wired up uv_read_start and some helper funcs around uv_alloc_cb tasks 2012-04-06 15:35:48 -07:00
Jeff Olson
e0193dac6e uv_buf_t's for uv_write() passed by-val .. no more mallocs or ptr cop-outs
so we're now adhering the libuv C api and passing structs by-val where
it is expected, instead of pulling pointer trickery (or worse having to
malloc structs in c++ to be passed back to rust and then into C again)
2012-04-06 15:35:48 -07:00
Jeff Olson
e5ccc76bc4 fixed by-val from rust->c, use ++ sigil in native fn sig <-- NEVAR FORGET
have to use ++ sigil in rust-side extern fn decls in order to have rust
actually copy the struct, by value, onto the C stack. gotcha, indeed.

also adding a helper method to verify/remind how to pass a struct by-val
into C... check out the rust fn sig for rust_uv_ip4_test_verify_port_val()
for more infos
2012-04-06 15:35:48 -07:00
Jeff Olson
43c82bdb45 fixed passing in uv_buf_t ptr array in uv_write.. return status 0
ways to go, still..
2012-04-06 15:35:48 -07:00
Jeff Olson
f179029296 uv_write works, buffer passing still broke, can get sockaddr_in by val
.. but passing sockaddr_in by val back to C is broken, still passing by
ptr
.. the uv_write_cb is processed, but we have a status -1.. there is
also valgrind spew.. so buf passing is broken, still.
2012-04-06 15:35:48 -07:00
Jeff Olson
05e2c131c4 changing ctypes:: to libc:: and impl of uv::direct::write() 2012-04-06 15:35:48 -07:00
Jeff Olson
af08aba573 some more stuff for libuv dealing w/ 1402.. should go away soon 2012-04-06 15:35:48 -07:00
Jeff Olson
3817ba7578 adding uv::direct and beginning to work out tcp request case
lots of changes, here.. should've commited sooner.
- added uv::direct module that contains rust fns that map, neatly, to
the libuv c library as much as possible. they operate on ptrs to libuv
structs mapped in rust, as much as possible (there are some notable
exceptions). these uv::direct fns should only take inputs from rust and,
as neccesary, translate them into C-friendly types and then pass to the
C functions. We want to them to return ints, as the libuv functions do,
so we can start tracking status.
- the notable exceptions for structs above is due to ref gh-1402, which
prevents us from passing structs, by value, across the Rust<->C barrier
(they turn to garbage, pretty much). So in the cases where we get back
by-val structs from C (uv_buf_init(), uv_ip4_addr(), uv_err_t in callbacks)
, we're going to use *ctypes::void (or just errnum ints for uv_err_t) until
gh-1402 is resolved.
- using crust functions, in these uv::direct fns, for callbacks from libuv,
will eschew uv_err_t, if possible, in favor a struct int.. if at all
possible (probably isn't.. hm.. i know libuv wants to eventually move to
replace uv_err_t with an int, as well.. so hm).
- started flushing out a big, gnarly test case to exercise the tcp request
side of the uv::direct functions. I'm at the point where, after the
connection is established, we write to the stream... when the writing is
done, we will read from it, then tear the whole thing down.

overall, it turns out that doing "close to the metal" interaction with
c libraries is painful (and more chatty) when orchestrated from rust. My
understanding is that not much, at all, is written in this fashion in the
existant core/std codebase.. malloc'ing in C has been preferred, from what
I've gathered. So we're treading new ground, here!
2012-04-06 15:35:48 -07:00
Marijn Haverbeke
c902eafa14 Convert old-style for loops to new-style
Most could use the each method, but because of the hack used to
disambiguate old- and new-style loops, some had to use vec::each.

(This hack will go away soon.)

Issue #1619
2012-04-06 20:38:23 +02:00
Brian Anderson
d13c0c77a2 Explicitly use version 0.2 of crates 2012-04-05 20:29:42 -07:00
Tim Chevalier
98b07ddc82 Rename task::task_builder to task::builder
Closes #2120.
2012-04-05 14:09:32 -07:00
Erick Tryzelaar
552677e598 std: time.rs should pass all args by "&&" to rustrt. 2012-04-05 12:23:37 -07:00
Grahame Bowland
5cc050b265 Logfile output from tests; summarise in make check
Add an optional --logfile argument to std::test::test_main and to
compiletest.

Use this features and the new 'check-summary.py' script to
summarise all the tests performed by the 'check' target. This is
a short term fix for #2075.
2012-04-04 11:52:27 -07:00
Erick Tryzelaar
159d89604e std: add a pure rust strptime parser. 2012-04-03 22:43:10 -07:00
Erick Tryzelaar
ff9305cd99 std: add a pure rust strftime formatter. 2012-04-03 22:43:10 -07:00
Erick Tryzelaar
4a4889859e std: add localtime/gmtime support. 2012-04-03 22:43:10 -07:00
Erick Tryzelaar
4871f11439 std: change timeval to ns resolution timespec
This lets us use the more precise clock_gettime on posix
machines.
2012-04-03 22:43:08 -07:00
Erick Tryzelaar
7aae7320db std: change time::timeval to be {sec: i64, usec: i32}.
It's possible to have negative times if expressing time before 1970, so
we should use signed types. Other platforms can return times at a higher
resolution, so we should use 64 bits.
2012-04-03 22:43:08 -07:00
Patrick Walton
c2f28e231f stdlib: Remove the now-obsolete vec::alloc_len in favor of vec::capacity 2012-03-29 08:57:34 -07:00
Patrick Walton
166d14e42d stdlib: Actually increase arena chunk sizes by powers of two 2012-03-29 08:41:26 -07:00
Patrick Walton
b210c7ad97 stdlib: Allow the fast path of arena allocation to be CCI'd. 15% improvement on binary-trees. 2012-03-29 08:41:26 -07:00
Patrick Walton
1d25594657 rustc: Add a vec::alloc_len and fix arena logic to use it 2012-03-29 08:41:26 -07:00
Patrick Walton
5ce3d35f41 rustc: Don't zero out arena chunks with vec::from_elem; that's slow because it calls the glue. 2012-03-29 08:41:25 -07:00
Patrick Walton
6f0cbf4cd4 stdlib: Fix a pointer mistake in arenas 2012-03-29 08:41:25 -07:00
Graydon Hoare
b37d7e26fe Update crate URLs to point to interesting things. 2012-03-28 13:52:47 -07:00
Marijn Haverbeke
b5a4fa9456 Move some code over to iterator-for to see how it performs. 2012-03-27 15:46:33 +02:00
Marijn Haverbeke
eec6383771 Add vec::each, vec::eachi, and list::each
For use with the new for construct.

Issue #1619
2012-03-27 12:53:19 +02:00
Graydon Hoare
6e6798c4e1 Bulk-edit mutable -> mut. 2012-03-26 18:35:18 -07:00
Marijn Haverbeke
87e097a853 Disallow ret inside of block functions
Also adds proper checking for cont/break being inside a loop.

Closes #1854
Issue #1619
2012-03-26 12:45:47 +02:00
Niko Matsakis
042c532a08 Implement new inference algorithm. 2012-03-23 21:47:28 -07:00
Marijn Haverbeke
3e7a514521 Fix inconsistent-iteration hazard in map.rs
Closes #2049
2012-03-23 13:30:29 +01:00
Brian Anderson
f3fe85dad7 Bump version numbers to 0.2 2012-03-22 15:25:02 -07:00
Niko Matsakis
dc07280b08 make --enforce-mut-vars always on, add mut annotations to remaining files 2012-03-22 09:58:19 -07:00
Niko Matsakis
cce2751461 Adjust arena definition to be compatible with placement new 2012-03-21 05:46:31 -07:00
Patrick Walton
ba39e277e2 stdlib: Implement arenas 2012-03-20 19:08:17 -07:00
Brian Anderson
b181ea415e core: Rename unsafe::leak to unsafe::forget. Closes #2031 2012-03-20 15:20:37 -07:00
Marijn Haverbeke
cec1a9b859 Properly check kinds when instantiating types
Closes #2011
2012-03-19 10:45:29 +01:00
Brian Anderson
47d468f08c core: Store reexporting result and either. Closes #1997 2012-03-16 15:14:37 -07:00
Erick Tryzelaar
67a1c35264 std: Add a a hashmap_from_vecs function 2012-03-16 17:05:29 +01:00
Marijn Haverbeke
35fc4a4291 Check kind bounds when calling methods
Closes #1915
2012-03-16 17:05:29 +01:00
Brian Anderson
7e0fa3f852 std: Swap the argument order of list::foldl to match vec::foldl 2012-03-15 14:15:49 -07:00
Brian Anderson
5e8004d493 std: Follow conventions in bitv 2012-03-15 14:08:47 -07:00
Brian Anderson
3864d6d845 std: Rename the hashmap constructors to conform to new standards
Instead of using the new_ prefix just name them after their type
2012-03-14 18:19:08 -07:00
Niko Matsakis
a3d2882ffd fixup auto_serialize's treatment of nullary variants 2012-03-14 21:05:06 -04:00
Niko Matsakis
e702d20191 allow immut vars to be moved. enforce mut vars after stage0 in std. 2012-03-14 20:46:36 -04:00
Niko Matsakis
6b35875dca annotate libstd and start enforcing mutability 2012-03-14 20:46:36 -04:00
Niko Matsakis
1600be2c3b fix auto_serialize for enums with type parameters 2012-03-14 17:19:33 -04:00
Niko Matsakis
ffa187db25 adjust auto_serialize to generate fns named serialize_T()
We used to generate a module T with a serialize() and deserialize() fn,
but this was suboptimal for a number of reasons:

- it required moving serialization into core so that uint etc worked
- it was harder to override the serialization behavior locally
  (this is now trivial)
2012-03-14 11:49:28 -04:00
Niko Matsakis
b30cb8e43a implement deserialization, rename mk_mem_buffer() to mem_buffer() 2012-03-13 21:30:07 -04:00
Niko Matsakis
d91742294f first (functional) version of the auto_serialize syntax ext 2012-03-13 21:30:07 -04:00
Brian Anderson
b968c8e6cd Name types after their modules instead of 't' 2012-03-13 15:14:17 -07:00
Brian Anderson
cd72b1f848 Overhaul constructor naming in libs 2012-03-13 11:07:22 -07:00
Graydon Hoare
6f5853f5a1 Libc/os/run/rand/io reorganization. Close #1373. Close #1638.
- Move io, run and rand to core.
 - Remove incorrect ctypes module (use libc).
 - Remove os-specific modules for os and fs.
 - Split fs between core::path and core::os.
2012-03-12 20:08:29 -07:00
Patrick Walton
4571175568 stdlib: Make list::find do what the docs say it does.
Talked on #rust about this change, got approval from graydon and brson. Will bring up tomorrow at meeting to verify.
2012-03-12 18:28:16 -07:00
Brian Anderson
d60813146d std: Sort test failures. Closes #1929 2012-03-12 17:31:17 -07:00
Tim Chevalier
40a5c56345 Fix Windows build breakage 2012-03-10 20:44:10 -08:00
Tim Chevalier
35400e13ad Use loop instead of while(true) in libraries and compiler itself
And remove spurious fails/unreachable() calls.
2012-03-10 20:34:17 -08:00
Brian Anderson
91e5a1c8b3 core: Remove the nearly empty math module
This mod only had two functions, all of whose users have been changed
to use the uint module.
2012-03-10 17:43:19 -08:00
Brian Anderson
95521c4084 std: Convert to rustdoc 2012-03-09 22:56:53 -08:00
Tim Chevalier
321fd80219 Add an infinite loop construct
Add a loop {} construct for infinite loops, and use it in test
cases. See #1906 for details.
2012-03-09 16:40:58 -08:00
Tim Chevalier
0c5fdc8745 Rename last to last_opt, last_unsafe to last
As per discussion on IRC. I am about to file an RFC for further
discussion about the more general issue of whether to enforce
invariants through types, typestate, or dynamic checks, but for now,
removing the misleading name "last_unsafe".
2012-03-08 15:25:56 -08:00
Tim Chevalier
d048a00cf3 Change util::unreachable to core::unreachable
Closes #1931
2012-03-08 14:30:01 -08:00
Tim Chevalier
ebc1d3e704 Rename last_total to last_unsafe
See Issue 1943 for any discussion (reopen it if necessary).

Closes #1943
2012-03-08 13:07:31 -08:00
Patrick Walton
c9375fed8d stdlib: Stop incurring vtable dispatch costs when hashmaps are used
This required changing almost all users of hashmaps to import the hashmap interface first.

The `size` member in the hashmap structure was renamed to `count` to work around a name conflict.
2012-03-07 17:35:13 -08:00
Patrick Walton
c245d9e980 Revert "stdlib: Stop incurring vtable dispatch costs when hashmaps are used"
This reverts commit f0250a23d3.
2012-03-07 16:56:45 -08:00
Patrick Walton
f0250a23d3 stdlib: Stop incurring vtable dispatch costs when hashmaps are used
This required changing almost all users of hashmaps to import the hashmap interface first.

The `size` member in the hashmap structure was renamed to `count` to work around a name conflict.
2012-03-07 16:51:31 -08:00
Brian Anderson
d2135597e9 std: Use util::unreachable 2012-03-05 18:23:01 -08:00
Graydon Hoare
6c87c34277 Remove dead code from rt (debug_obj, rust_obj, rust_closure, rust_box_obj, rust_vtable) 2012-03-05 15:50:11 -08:00
Erick Tryzelaar
faccd4ac92 std: export json::error. 2012-03-05 08:47:21 -08:00
Erick Tryzelaar
6b0c4822c1 std: add a fs::remove_file function. 2012-03-02 19:15:36 -08:00
Erick Tryzelaar
f630ebdb6a comp/std: rename io::string_reader to io::str_reader. 2012-03-02 19:15:35 -08:00
Erick Tryzelaar
1404a864a4 std: add a io::with_str_reader fn to remove a str copy 2012-03-02 19:15:34 -08:00
Brian Anderson
3ed6f6520f core: Remove _mut functions from vec
Instead, use vec::to_mut/from_mut to transform vectors in place as
needed.
2012-03-02 15:49:49 -08:00
Brian Anderson
77fc4e7ee7 std: vec::to_ptr -> vec::unsafe::to_ptr 2012-03-02 12:29:40 -08:00
Brian Anderson
1471b1f3ff std: DeCamelCase fs::splitDirnameBasename 2012-02-29 23:45:51 -08:00
Tycho Sci
ecf87c3180 libstd: Skip trailing whitespaces after JSON value 2012-02-29 17:47:17 +09:00
Tycho Sci
0465d5217d libstd: Skip trailing whitespaces after outer rparen
This makes "{ \"foo\": 1 }\n" and "[ 1 ]\n" valid json string
2012-02-29 16:24:28 +09:00
Erick Tryzelaar
012dec5e57 std: rewrite json.rs to fix bugs and use readers/writers
Our json implementation did not conform to the spec, and
was missing support for escpaed characters and exponental
numbers. This fixes it, and adds support for reading/writing
json directly from/to a stream.

There are two things left unimplemented. We could use a
"to_json" iface/impl, but that really needs traits to cut
down on code duplication. The other is it wouldn't be that
not that hard to turn this implementation into a event driven
parser like YAJL, but I ran into some type-inference bugs,
so I cut that out. It'd be nice to revisit this in the future
though.
2012-02-28 18:00:50 -08:00
Erick Tryzelaar
6865df2611 core/std: whitespace fixes. 2012-02-28 18:00:50 -08:00
Erick Tryzelaar
ec51d8fd03 std: Add helpers to simplify making str io::writers 2012-02-28 18:00:50 -08:00
Brian Anderson
b9089b5335 std: Ignore uv tests on FreeBSD 2012-02-28 17:56:15 -08:00
Jeff Olson
9831ee3e67 changing rust loop to 1 thread 2012-02-28 17:56:15 -08:00
Jeff Olson
b4c88cdcec add uv::loop_delete()
because of the last change, the loop ptr is no longer cleaned up
when the loop exits. This api call addresses that. Sadly, the loop
ptr is not "reusable" across multiple calls to uv::run().
2012-02-28 17:56:15 -08:00
Jeff Olson
0b3a06ab2c correcting for libuv behavior that differs between linux & windows
net complexity increase :/
2012-02-28 17:56:15 -08:00
Jeff Olson
bb5960aa57 moving new uv stuff into uv.rs and rust_uv.cpp
- removing the remains of uvtmp.rs and rust_uvtmp.rs
- removing the displaced, low-level libuv bindings
in uv.rs and rust_uv.cpp
2012-02-28 17:56:15 -08:00
Jeff Olson
828595151c trailing whitespace fixes 2012-02-28 17:56:15 -08:00
Jeff Olson
1d3e08d8c6 finishing up simple uv_timer impl
as it stands, basic async nad timer support is added
2012-02-28 17:56:15 -08:00
Jeff Olson
b68eb507da cleaning up uv_async stuff and stubbing uv_timer 2012-02-28 17:56:14 -08:00
Jeff Olson
974c23cbeb removed hello world and added uv_async_* 2012-02-28 17:56:14 -08:00
Jeff Olson
ffad8d7f0c everything is laid out and working through a basic hw
the core impl is there, with a async handle in place
to take incoming operations from user code. No actual
uv handle/operations are implemented yet, though.
2012-02-28 17:56:14 -08:00
Niko Matsakis
5c1338a18e add ability to run multi-crate tests, run tests with --inline 2012-02-28 06:31:29 -08:00
Niko Matsakis
8cffc6f84c add debugging mode which emits more verbose info 2012-02-28 06:31:28 -08:00
Brian Anderson
61691c2428 std: Make merge_sort faster 2012-02-27 18:32:45 -08:00
Niko Matsakis
f3ca50c9ca Encode/decode AST into metadata, re-instantiate inlined items 2012-02-24 20:46:27 -08:00
Marijn Haverbeke
780f8277f4 Finish cleanup of core::str
Closes #1849
2012-02-23 17:00:19 +01:00
Marijn Haverbeke
d802c1fbd2 Various cleanups and optimizations in core::str 2012-02-23 17:00:19 +01:00
Kevin Cantu
c3318f29fe (core::str) rename substr_len_bytes to substr_len, and delete unused byte_index[_from] 2012-02-23 17:00:19 +01:00
Kevin Cantu
7782f5d692 (core::str) remove len_bytes alias 2012-02-23 17:00:19 +01:00
Kevin Cantu
1b957c0942 (core::str) replace uses of unsafe::slice_bytes; replace find[_from]_bytes with find[_from] 2012-02-23 17:00:19 +01:00
Kevin Cantu
6ea3d7935e (core::str) replace byte_index[_from] with index[_from] 2012-02-23 17:00:19 +01:00
Kevin Cantu
280633a728 (core::str) do some replacements 2012-02-23 17:00:19 +01:00
Kevin Cantu
454b53a7c2 (core::char) rename slice -> slice_chars 2012-02-23 17:00:19 +01:00
Kevin Cantu
1cd5a0945a (core::str) rename rindex -> rindex_chars 2012-02-23 17:00:19 +01:00
Kevin Cantu
98447f5236 (core::str) mostly rename len -> len_chars 2012-02-23 17:00:19 +01:00
Marijn Haverbeke
ffd50b9cdf Make the various from_str functions return options
So that they can be used with user input without causing task
failures.

Closes #1335
2012-02-22 13:18:15 +01:00
Marijn Haverbeke
ad03761a97 Remove preconditions from libraries
Closes #1805
2012-02-22 11:47:47 +01:00
Brian Anderson
4220dcf1e9 core: New task API 2012-02-20 18:58:04 -08:00
Brian Anderson
010f2abc70 core: When running tests sequentially, print the test name before running it
Useful for debugging hanging tests
2012-02-18 16:30:09 -08:00
Chris Peterson
3d202d7eae rt: rename nano_time() builtin to match time::precise_time_ns() 2012-02-18 01:39:42 -08:00
Chris Peterson
b73bc30858 std: Add tests for time module
Tested on OSX and Windows.
2012-02-18 01:32:52 -08:00
Chris Peterson
105b5f0be8 std: Expand doc comments for time module 2012-02-18 01:30:12 -08:00
Chris Peterson
94fe5011e2 std: Add some env() and getenv() tests 2012-02-17 08:47:45 +01:00
Chris Peterson
aec76d2515 std: Fix env() assert when an environment variable's value contains a '=' char 2012-02-17 08:47:44 +01:00
Marijn Haverbeke
67cc89f38d Rewrite exhaustiveness checker
Issue #352
Closes #1720

The old checker would happily accept things like 'alt x { @some(a) { a } }'.
It now properly descends into patterns, checks exhaustiveness of booleans,
and complains when number/string patterns aren't exhaustive.
2012-02-15 15:47:42 +01:00
Marijn Haverbeke
4b63826050 Replace some explicit fails with 'alt check' invocations 2012-02-15 15:47:42 +01:00
Brian Anderson
acabd821d2 Merge pull request #1831 from killerswan/str_fixes
(core::str) changes to find / find_bytes
2012-02-14 11:22:31 -08:00
Niko Matsakis
3a2f1e1876 add serialization library; convert ebml lib to use u64 internally 2012-02-13 06:50:58 -08:00
Kevin Cantu
c81867474a (core::str) add find_bytes and export it... 2012-02-13 01:56:58 -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
Kevin Cantu
e0af23b664 using str::rindex... 2012-02-11 16:39:39 -08:00
Kevin Cantu
27161f4415 using str::index... 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
Niko Matsakis
e712a47a81 create serialization lib and update serializer to use it 2012-02-10 20:48:29 -08:00
Niko Matsakis
fdddf8f9e1 put serializer into the build and encode full item paths 2012-02-10 20:48:28 -08:00
Niko Matsakis
5d57fa3403 update ebml interface 2012-02-10 20:48:28 -08:00
Marijn Haverbeke
52a741754c Remove some pointless imports 2012-02-09 15:30:27 +01:00
Marijn Haverbeke
50fb4c30ed Increase precedence of as operator
Closes #1717
2012-02-09 11:58:08 +01:00
Brian Anderson
6cf40bd0c4 std: Use correct split function in generic_os::env 2012-02-07 20:20:58 -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
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
fdf50e84b8 std: Use ctypes::c_int in path_is_dir 2012-02-05 16:21:52 -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
Tom Lee
31b0d1b4bd core: rename str::lteq to str::le 2012-02-03 14:09:44 +01:00
Tom Lee
a02f332602 std: rename sort::lteq to sort::le. 2012-02-03 12:02:57 +01:00
Graydon Hoare
c485301d21 Update libuv. 2012-02-02 17:39:47 -08:00
Graydon Hoare
6784b18303 Win32 warning police. 2012-02-02 11:35:07 -08:00
Kevin Cantu
ae0d49aa06 Rename str::char_slice -> str::slice 2012-02-01 21:56:53 -08:00