Commit graph

869 commits

Author SHA1 Message Date
Niko Matsakis
25bc37cef9 refactor all unix types 2011-11-16 15:24:08 -08:00
Niko Matsakis
26b0662fb8 fix alignment for chan_handle structs; rust equiv is translated
to char[16], not struct{long,long}
2011-11-16 15:16:42 -08:00
Niko Matsakis
0cea1095b1 change u32 to uint. maybe we want an intptr_t built-in type. 2011-11-16 15:16:41 -08:00
Brian Anderson
b655fb9ea7 Replace 'mutable?' with 'const' 2011-11-16 14:41:32 -08:00
Brian Anderson
f157d0b32c Fix S_IRUSR/S_IWUSR constants on mac. Closes #726 2011-11-16 12:18:15 -08:00
Haitao Li
88f29aab27 Use attributes for native module ABI and link name
This patch changes how to specify ABI and link name of a native module.

Before:
  native "cdecl" mod llvm = "rustllvm" {...}

After:
  #[abi = "cdecl"]
  #[link_name = "rustllvm"]
  native mod llvm {...}

The old optional syntax for ABI and link name is no longer supported.

Fixes issue #547
2011-11-16 11:35:13 -08:00
Haitao Li
3b683f5205 rustc: Use link_name attribute for native function
Fixes issue #906
2011-11-16 23:45:07 +08:00
Brian Anderson
a7fc5decab stdlib: Turn function calls into constants. Fix win32 breakage 2011-11-15 18:14:13 -08:00
Stefan Plantikow
378652f885 Fixed typo in constant value #1165 2011-11-15 18:02:45 -08:00
Stefan Plantikow
d335d1a169 Replaced constant functions with actual constants in std and updated tests
Fixes issue #1165
2011-11-15 18:02:45 -08:00
Marijn Haverbeke
a09dcd94c5 Fix some indentation and idioms in rope.rs
Sorry for the pedantry. I was handling a compilation bug related to this code,
and it just jumped out at me.
2011-11-15 13:32:35 +01:00
Brian Anderson
5b9f76eb7c stdlib: Run cleanups on data that fails to send 2011-11-14 14:07:52 -08:00
Brian Anderson
58e923de6e rt: Perform task notification before killing the parent task 2011-11-13 16:36:47 -08:00
Brian Anderson
138d9ca5d5 Drop enqueued elements when a port is destructed. Closes #1155 2011-11-13 15:43:58 -08:00
Brian Anderson
5e0e32faac rt: Remove drop_port. Unused 2011-11-11 12:11:21 -08:00
Elly Jones
24b6645156 str: add escape()
Signed-off-by: Elly Jones <elly@leptoquark.net>
2011-11-10 19:53:28 -08:00
Haitao Li
5a7249c935 Cleanup unused imports 2011-11-10 19:19:40 -08:00
Brian Anderson
6c108aade9 stdlib: Remove sio and aio. Bitrotted. 2011-11-10 17:59:26 -08:00
Brian Anderson
2e8ebb7c27 stdlib: Update the example in std::comm
Due to a bug in channel destructors this examples fails when logging is off

Issue #1155
2011-11-10 15:18:01 -08:00
Josh Matthews
43cb74b830 Add float support to #fmt. Fix #1014. 2011-11-10 11:40:34 -08:00
Brian Anderson
0d9e32d70d Rename "c-stack-stdcall" ABI to "stdcall" 2011-11-09 18:45:25 -08:00
Brian Anderson
b7ab28b50f Rename "c-stack-cdecl" ABI to "cdecl" 2011-11-09 18:44:12 -08:00
Brian Anderson
dec6b53761 Convert last use of "x86stdcall" ABI to "c-stack-stdcall" 2011-11-09 16:47:43 -08:00
Brian Anderson
d536bc2c10 Clean up std::task 2011-11-08 17:16:46 -08:00
Brian Anderson
061d2c2f77 Make task_sleep an intrinsic. 2011-11-08 15:58:08 -08:00
Brian Anderson
68f82de817 rt: Remove task_yield builtin
This is just a special case of task_sleep
2011-11-08 14:28:41 -08:00
Brian Anderson
2f8b695344 start_task can run on the C stack 2011-11-08 14:05:42 -08:00
Brian Anderson
0f1af17a60 Remove all uses of native cdecl except for those that yield 2011-11-08 11:29:10 -08:00
Brian Anderson
06d14f3a1c Fix long lines 2011-11-07 15:46:00 -08:00
Elly Jones
656a2af989 json: betterify for brson
Signed-off-by: Elly Jones <ellyjones@google.com>
2011-11-07 15:44:43 -08:00
Elly Jones
bd7262624c stdlib: add json.
Add a json serializer and deserializer.

Signed-off-by: Elly Jones <ellyjones@google.com>
2011-11-07 15:44:43 -08:00
Brian Anderson
fcd39b1191 Remove native "llvm" ABI 2011-11-07 15:29:05 -08:00
David Rajchenbach-Teller
05c9c73756 [Stdlib] rope.rs: improved doc, code readability 2011-11-06 18:10:23 +01:00
David Rajchenbach-Teller
bc1316aaf4 [Stdlib] rope.rs: concat, now attempts to preserve balance 2011-11-06 18:10:22 +01:00
David Rajchenbach-Teller
cefa97dc2e [Stdlib doc] char.rs: documented to_digit, cmp 2011-11-06 18:10:22 +01:00
David Rajchenbach-Teller
2dedcc8aa2 [stdlib optim] rope::node improved balancing strategy 2011-11-06 18:10:22 +01:00
David Rajchenbach-Teller
1087f4b7b0 [Docfix] lib/str.rs: Applied review suggestions, took the opportunity to improve doc of my new functions. 2011-11-05 13:04:35 -07:00
David Rajchenbach-Teller
b17847b232 [Docfixes + feature] lib/uint.rs: Applied review suggesions, took the opportunity to add function loop 2011-11-05 13:04:34 -07:00
David Rajchenbach-Teller
57425b575c [Docfix + Renaming] lib/rope.rs: Applied review suggestions, mostly docfixes. 2011-11-05 13:04:34 -07:00
David Rajchenbach-Teller
a5dcf66ad3 stdlib: Added a small rope library 2011-11-05 13:04:34 -07:00
David Rajchenbach-Teller
07574363ef char.rs: Added a function cmp 2011-11-05 13:04:34 -07:00
David Rajchenbach-Teller
07ffe68ad9 uint.rs: added functions div_ceil, div_floor, div_round 2011-11-05 13:04:34 -07:00
David Rajchenbach-Teller
f4399063fc str.rs: Added functions loop_chars, loop_chars_sub, char_len_range, byte_len_range. 2011-11-05 13:04:34 -07:00
Elly Jones
b0278f5315 vec: take [mutable? T] instead of [T] 2011-11-04 17:30:03 -07:00
Marijn Haverbeke
1a68a98824 Disallow writing to function arguments again
Remove implicit copying hack.

Closes #1118
2011-11-03 10:57:54 +01:00
Matt Brubeck
5970e9c117 Add vec::permute to the standard library (#1013) 2011-11-02 15:35:10 -07:00
Marijn Haverbeke
d8d35e7c40 Rename car/cdr to head/tail in std::list
Closes #1086
2011-11-02 14:23:49 +01:00
Marijn Haverbeke
0a20eed2db Make ptr::addr_of return an immutable vec, add mut_addr_of 2011-11-02 12:20:12 +01:00
Brian Anderson
4b01d11f92 Organize std.rc and make exports explicit 2011-11-01 20:48:44 -07:00
Matt Brubeck
76077a9fb7 Add should_fail annotation for unit tests
This allows test cases to assert that a function is expected to fail.
Tests annotated with "should_fail" will succeed only if the function
fails.
2011-11-01 16:55:39 -07:00
Matt Brubeck
80c926c5e2 Add a char::to_digit function 2011-10-31 16:15:36 +01:00
Matt Brubeck
4739942e74 Correct handling of non-numeric chars in parse_buf
Without this fix, int::parse_buf and uint::parse_buf return incorrect results
for any strings that contain non-numeric characters.  Fixes #1102.
2011-10-31 16:15:32 +01:00
Marijn Haverbeke
6f37accb29 Rename std::str::chars to iter_chars 2011-10-31 15:41:52 +01:00
Marijn Haverbeke
b0d60a7108 Add a way to iterate over a str's chars to std::str 2011-10-31 14:52:08 +01:00
Matt Brubeck
7080ac15fb Fix int::parse_buf for negative numbers (#1102) 2011-10-30 13:40:59 -07:00
Matt Brubeck
8c51d4b002 Make float::from_str ignore whitespace (#1089)
Discard leading and trailing whitespace, for consistency with C/JS/Java/etc.
Also, don't allow floating point numbers that start or end with 'e'.
2011-10-30 13:40:59 -07:00
Brian Anderson
8befdd08a3 stdlib: Fix type in docs for result::chan 2011-10-29 20:16:44 -07:00
Brian Anderson
2e0593d999 stdlib: Add vec::concat to concatenate a vector of vectors
Compare to str::concat
2011-10-29 18:14:08 -07:00
Brian Anderson
2cebef095e stdlib: Make io failures recoverable by returning a result 2011-10-29 01:25:11 -07:00
Brian Anderson
2b62a80202 stdlib: Add result::chain for composing results 2011-10-29 01:25:11 -07:00
Brian Anderson
c1092fb6d8 stdlib: Add result module
This contains a result tag with ok(T) and error(U) variants. I expect
to use it for error handling on functions that can recover from errors,
like in the io module.
2011-10-29 01:25:06 -07:00
Brian Anderson
802deac323 stdlib: Add fs::splitext
Splits a path into the filename + extension
2011-10-28 23:34:01 -07:00
Brian Anderson
a2377ccf91 stdlib: Add vec::init. Returns all but the last element.
Per haskell, to go with head/tail, and last.
2011-10-28 22:42:38 -07:00
Matt Brubeck
45d7777991 Change behavior of float::nonpositive/nonnegative
Rather than being defined as !positive and !negative, these should act the
same as negative and positive (respectively).  The only effect of this change
should be that all four functions will now return false for NaN.
2011-10-28 14:44:39 -07:00
Matt Brubeck
000b2fe9a6 Use IEEE 754 semantics for NaN (Issue #1084) 2011-10-28 14:44:39 -07:00
Matt Brubeck
7e064deacf +0.0 should be positive and -0.0 should be negative. 2011-10-28 14:44:39 -07:00
Brian Anderson
54ddb553c2 stdlib: Replace an unsafe cast with ptr::null 2011-10-28 14:25:40 -07:00
Brian Anderson
f96ad30dfc stdlib: Make reinterpret_cast and leak unsafe 2011-10-28 14:19:17 -07:00
Brian Anderson
ad66d72e6c stdlib: Make merge_sort take [mutable? T] 2011-10-28 13:56:01 -07:00
Brian Anderson
39b729e36f stdlib: Fix the list::foldl implementation 2011-10-28 13:45:32 -07:00
Brian Anderson
49e8ffa34f stdlib: Rename list::length to list::len to match vec::len 2011-10-28 13:37:19 -07:00
Brian Anderson
2e8a8390d5 stdlib: Rename the 'ls_' param in list functions to 'ls' 2011-10-28 13:34:17 -07:00
Brian Anderson
1da99cdf68 stdlib: Make list::from_vec more efficient 2011-10-28 13:32:11 -07:00
Brian Anderson
d53a253dca stdlib: make list::from_vec take [mutable? T] 2011-10-28 13:24:39 -07:00
Marijn Haverbeke
7dacccde94 Make shared kind the default only for generic functions
You almost never want a function with pinned type params. For
types, objects, resources, and tags, pinned types are actually often
more sane. For most of these, shared rarely makes sense. Only tricky
case is objs -- you'll have to think about the kinds you want there.

Issue #1076
2011-10-28 17:00:14 +02:00
Marijn Haverbeke
7a0aee74bf Move to short type parameter keywords
Issue #1076
2011-10-28 15:25:33 +02:00
Brian Anderson
d96c419b14 Add std::vec::foldr 2011-10-27 21:34:16 -07:00
Brian Anderson
7a7940daca Add reverse iterators to std::vec 2011-10-27 21:09:02 -07:00
Brian Anderson
f1f0e6c06c Remove std::vec::eachi. Same function as iter2. 2011-10-27 20:50:10 -07:00
Brian Anderson
1a89e589a4 Implement vec::foldl without recursion 2011-10-27 20:47:06 -07:00
Brian Anderson
b5ed1c46c0 Add std::vec::iter 2011-10-27 20:30:06 -07:00
Brian Anderson
9c097d19e4 Remove std::int::eq_alias
This is the exact same function as int::eq
2011-10-27 18:23:06 -07:00
Brian Anderson
b16d9019a8 Make option::is_some option::is_none pure 2011-10-27 18:15:58 -07:00
Brian Anderson
91997e79aa Make vec::reversed take [mutable? T] 2011-10-27 17:49:13 -07:00
Brian Anderson
74a1e054eb Make std:vec::grow_fn take an init_op type 2011-10-27 17:06:49 -07:00
Brian Anderson
506ae934f8 Reorder std::vec so the documentation renders better
Put all types first, then predicates, then functions
2011-10-27 17:03:38 -07:00
Brian Anderson
2b85817af8 Convert various functions in std to take lambda blocks 2011-10-27 16:27:47 -07:00
Brian Anderson
cf2624106c Document std::bitv 2011-10-27 15:35:56 -07:00
Brian Anderson
e0715380dc Add more std docs 2011-10-27 14:54:18 -07:00
Matt Brubeck
5d6fe1a533 Remove uint::max/min in favor if math::max/min 2011-10-27 13:37:53 -07:00
Matt Brubeck
50d99ec32c Add documentation to std::uint 2011-10-27 13:37:53 -07:00
Matt Brubeck
a9f9227a1c Add std documentation for float and u8 functions 2011-10-27 13:37:53 -07:00
Matt Brubeck
9e4c2b6bc6 Mark uint add/sub/mul/div/rem functions as pure 2011-10-27 13:37:53 -07:00
Matt Brubeck
8dba51b87c Add function aliases for float operators 2011-10-27 13:37:53 -07:00
Brian Anderson
26d839216b Add more std docs 2011-10-27 13:25:20 -07:00
Brian Anderson
00404ebe62 Cleanup in std::task 2011-10-27 11:29:04 -07:00
Brian Anderson
20e4f793e2 More std docs 2011-10-27 11:17:23 -07:00
Brian Anderson
17c651b3b0 Remove task::join_id
This is the old, racy way of joining to a task. It is no longer used.
2011-10-26 20:43:47 -07:00
Brian Anderson
4d669036f3 Add more std documentation 2011-10-26 18:32:34 -07:00
Brian Anderson
197c8543fe Add more std documentation 2011-10-26 11:47:42 -07:00