Commit graph

305 commits

Author SHA1 Message Date
Graydon Hoare
11a10c7a7b Remove redundant imports in lib (rustc doesn't like 'std' as a synonym for root within std.rc anyway) 2011-03-09 17:29:18 -08:00
Marijn Haverbeke
aed40fbcd8 Have the pretty-printer take a writer stream as argument
It now uses a string writer to also fill in for
middle.ty.ast_ty_to_str
2011-03-09 16:15:55 -08:00
Marijn Haverbeke
dddd7d8f44 Add stdout_writer and string_writer to std.io
For use by pretty-printer. string_writer API is a bit silly
right now, feel free to suggest a cleaner way to do this.
2011-03-09 16:15:52 -08:00
Marijn Haverbeke
0624f9db4a Add a pretty-printer
Adds a -pp option to the compiler which will cause it to simply
pretty-print the given file.
2011-03-07 12:58:08 -08:00
Brian Anderson
bed457d3a7 Change io.fileflag to a tag type. Remove FIXME 2011-03-06 15:13:30 -08:00
Brian Anderson
330c9c6c35 Make _str.bytes use _vec.init_fn. Remove FIXME. 2011-03-06 15:13:28 -08:00
Brian Anderson
3b7e9dc393 Rustify some comments lifted directly from the sha-1 reference implementation 2011-02-22 21:52:23 -05:00
Brian Anderson
c4df39609c Rename std._io to std.io since 'io' is no longer a keyword 2011-02-22 21:52:23 -05:00
Brian Anderson
cbe8d222a8 Implement sha-1 in standard library. Closes #228 2011-02-21 01:00:43 -05:00
Graydon Hoare
11cbbcf79e Add std.path module for pathname manipulations. 2011-01-10 18:17:24 -08:00
Graydon Hoare
b000bfeedc Fail in new_stdio_reader when libc.fopen fails. 2011-01-10 18:16:57 -08:00
Graydon Hoare
001d7bfa17 Add _str.starts_with and ends_with. 2011-01-03 20:39:33 -08:00
Graydon Hoare
c0d4e88428 Add std.dbg.trap(str msg) for help debugging. 2010-12-31 10:35:39 -08:00
Graydon Hoare
3504f4a4bf Sort methods in object types. 2010-12-21 16:43:28 -08:00
Graydon Hoare
6443179bca Add std.sort, with a simple mergesort. 2010-12-21 00:44:06 -08:00
Patrick Walton
77ff12c435 rustboot: Don't use walk to traverse statements in type.ml; fixes redundant checking, improves diagnostics. Also report untyped slots. 2010-11-18 14:19:06 -08:00
Graydon Hoare
a404e54261 Teach rustc about const tag value, begin work on trans_copy_ty, make uint's to_str routine less clever and thereby resist overflow. 2010-11-09 17:50:31 -08:00
Patrick Walton
3e482d5f69 Implement a map2() function in std._vec 2010-11-09 15:38:42 -08:00
Graydon Hoare
89946609f2 Support a special const-value refcount, use it for const strings. 2010-11-09 14:15:07 -08:00
Graydon Hoare
3e9be14757 Add a check for binding an alias. Good thing, as we had two instances in our library. 2010-11-08 15:45:30 -08:00
Patrick Walton
adb1754e4d Move the option type to its own module 2010-11-05 11:18:40 -07:00
Patrick Walton
2fcf81cc4b Revert "Move the option type to its own module" 2010-11-05 10:41:23 -07:00
Patrick Walton
1d214b4df3 Move the option type to its own module 2010-11-05 10:23:22 -07:00
Graydon Hoare
7abf6eb7c6 Shift obj, type, param decls to have strata rather than effects. 2010-11-02 17:20:57 -07:00
Graydon Hoare
7db115834f Split out stratum-checking pass, implement more-strict (overly aggressive) impure-effect checking. 2010-11-02 15:24:46 -07:00
Graydon Hoare
da13c508d8 First pass on splitting stratum and opacity off of effects. WIP. 2010-11-02 11:11:58 -07:00
Patrick Walton
67bcc70754 rustboot: Emit an error instead of asserting in trans when a T is passed by value 2010-10-28 15:07:05 -07:00
Patrick Walton
b914e0e74c Revert "rustboot: Emit an error instead of asserting in trans when a T is passed by value" due to test failures
This reverts commit ee901858a2.
2010-10-28 15:04:48 -07:00
Patrick Walton
ee901858a2 rustboot: Emit an error instead of asserting in trans when a T is passed by value 2010-10-28 15:02:00 -07:00
Patrick Walton
05a3c5c0f3 rustc: Add an "_" prefix to assembler-generated symbols on Mac 2010-10-22 16:16:02 -07:00
Graydon Hoare
dd0d255737 Add some filename helpers to os. 2010-10-22 11:46:33 -07:00
Graydon Hoare
05c9d885dd Change vec slice to use uint, add push/pop/shift/unshift. 2010-10-22 11:46:04 -07:00
Dave Herman
6421c13157 eliminated bitv.test, which now lives in test/run-pass 2010-10-21 13:34:16 -07:00
Dave Herman
dbe27199b8 line length police; moved comp.util.bits to std.bitv 2010-10-21 11:39:53 -07:00
Graydon Hoare
23a00fd092 Disable use of parametric tail call in map.rs, they don't presently work. 2010-10-18 16:04:47 -07:00
Graydon Hoare
68321b0de8 Make list.find return an option of different type than the list element. 2010-10-18 16:02:59 -07:00
Graydon Hoare
783be711f5 Flesh out the std.list module a touch. 2010-10-18 14:35:44 -07:00
Graydon Hoare
57c7e94c8f Encode and decode tag types in dwarf properly. Add list module to std. Shift rustc to use std.util.option. Fix various dependent bugs. Closes #73. 2010-10-15 22:09:09 -07:00
Graydon Hoare
b970563fe3 Patchwork of attempted fixes to effect system and gc system; eventually give up and disable it entirely in the runtime. Will need extensive reworking. 2010-09-29 17:22:13 -07:00
Graydon Hoare
4d17283371 Add 'items' iter to hashmap. 2010-09-22 17:04:08 -07:00
Graydon Hoare
2880ecd73f Reformat standard library; no code changes. 2010-09-22 15:44:13 -07:00
Graydon Hoare
e0f682e5fb Add some basic string functions: index, rindes, find, substr, split, concat, connect. 2010-09-22 15:27:40 -07:00
Graydon Hoare
b549721a2e Tighten pattern parsing on 0-ary constructors. 2010-09-21 16:18:47 -07:00
Graydon Hoare
c5f4789d5b Bind pattern slots with ?, drop parens from 0-ary tag constructors, translate 0-ary constructors as constants. Rustc loses ~300kb. 2010-09-20 23:56:43 -07:00
Graydon Hoare
a9e2327a18 Switch tags to purely nominal, removing TY_iso and TY_idx. Seems to mostly work, possibly a little bumpy. Changes a lot. 2010-09-09 15:59:29 -07:00
Roy Frostig
cf62b54028 Add a little pointer-cast helper to dbg. 2010-09-06 23:24:01 -07:00
Roy Frostig
974092c526 Test multi-ref'ed vec growth more seriously than before. 2010-09-03 16:25:56 -07:00
Roy Frostig
66b5b9567c Test the hashmap more, exercising hash collision, element removal, and a forced rehashing that actually causes elements to change buckets. In the process, find a bug in hashmap's remove() and fix it. 2010-08-26 19:44:38 -07:00
Graydon Hoare
7cfa7bdd23 Make vreg constrs per-quad, regfence on nontrivial constrs, back out workaround to _uint, add regression test. Closes #152. 2010-08-26 16:27:47 -07:00
Roy Frostig
c3c5e6c773 Workaround issue #152 in _uint.next_power_of_two 2010-08-26 11:57:48 -07:00
Roy Frostig
c40fed5804 Actually switch to using the bigger hashmap once a it finishes growing and rehashing. 2010-08-25 17:42:36 -07:00
Graydon Hoare
c2b6c27d65 Fix edge case in uint->string conversion. 2010-08-25 13:54:27 -07:00
Roy Frostig
d9fe885ba5 Comment on env var required for std.dbg to do any logging. 2010-08-24 19:55:45 -07:00
Roy Frostig
7ccdb88374 Add support in dbg.debug_obj for printing the obj body. 2010-08-24 19:49:39 -07:00
Roy Frostig
d9e3fb2c5d Add std.dbg module for inspecting rust values in memory. 2010-08-24 18:37:42 -07:00
Graydon Hoare
e846643d23 Fix mod-bug in std.map, work around bug in closure typaram capture, enable insert-tests in lib-map.rs. 2010-08-24 17:23:09 -07:00
Graydon Hoare
47501f1659 Make _str.eq suitable for map.hashmap; add _str.hash that does simple djb-hash. 2010-08-24 09:59:02 -07:00
Graydon Hoare
a2bd79a6ac Redo _uint.to_str to work with chars and only one tmp str, built left-to-right. 2010-08-20 15:37:20 -07:00
Roy Frostig
2da4fecacd Test the buffered reader and writer in _io. 2010-08-20 12:57:38 -07:00
Graydon Hoare
1db0cb208d Add ungetc and re-indent _io.rs. 2010-08-20 12:12:11 -07:00
Graydon Hoare
9fc4fc6692 Add _uint module to std, move some code around. 2010-08-20 11:42:44 -07:00
Roy Frostig
4a7aa75b5d Make _io.buf_reader read more than 0 bytes at a time. 2010-08-19 17:37:22 -07:00
Graydon Hoare
f0d4e6c511 Add stdio_reader to io, just use FILE* values for now. We have things to do. 2010-08-18 15:41:24 -07:00
Roy Frostig
6bce296d9f Address FIXME in _vec waiting on closed issue #108. 2010-08-12 13:18:10 -07:00
Roy Frostig
445d3fe39c Add vec debugging utility to _vec module. 2010-08-12 13:11:49 -07:00
Michael Bebenita
988695a96c Added support for task sleeping in the scheduler. 2010-08-11 21:24:04 -07:00
Roy Frostig
f307688bf4 Add native vec[u8] to str converter. Put in workaround for leak in str to vec[u8] converter. Add testcase exercising both. Drive-by fix a potential array-out-of-bounds write on rust_str buffers. 2010-08-11 16:06:45 -07:00
Roy Frostig
8e02a2bcb5 Fix reverse-indexing bug in _vec.init_fn. 2010-08-11 15:56:19 -07:00
Roy Frostig
75e46cc4d0 Fix a deque size bookkeeping bug. 2010-08-10 11:40:33 -07:00
Jeffrey Yasskin
3f6e8ffe64 Implement _str.len() to return the number of bytes, rename it to byte_len(),
and add a test.
2010-08-06 17:29:21 -07:00
Jeffrey Yasskin
581a95a804 Add an int->str conversion function.
The test currently fails because string equality isn't implemented.
2010-08-06 17:25:27 -07:00
Roy Frostig
80a1cd3d1e Redo yesterday's buf_writer-wrapper in a less silly and convoluted way. Add integer stringifying functions to _int module. 2010-08-06 15:48:23 -07:00
Graydon Hoare
935b4347e2 Mop up workarounds in stdlib no longer required as issue #93 is closed. 2010-08-05 10:10:39 -07:00
Roy Frostig
718c0b5963 Add to std._io some formatter/type-specific-writer mechanism. Make a few type-specific buffered writers as wrappers of buf_writer. 2010-08-04 23:09:33 -07:00
Roy Frostig
c17ea956a2 Add per-platform file-open flags to std.os. Open buffers as desired in std._io. 2010-08-04 17:14:17 -07:00
Roy Frostig
1a8d609e89 Add a buffered writer to stdlib _io module. 2010-08-04 12:59:48 -07:00
Roy Frostig
b9075c23c0 Address _io.new_buf FIXME now that issue #93 is closed. 2010-08-04 11:24:09 -07:00
Roy Frostig
299657550e Have hashmap's insert method overwrite on existing-key insertion and return true iff overwrite did not occur. 2010-08-03 18:57:54 -07:00
Roy Frostig
6277b462e9 More stdlib hashmap work. Add a simple test and XFAIL it due to a valgrind-spotted UMR. 2010-08-03 18:43:57 -07:00
Roy Frostig
5b2451c231 Address _vec.map allocation FIXME. Add test. 2010-08-03 18:18:19 -07:00
Roy Frostig
5796ebb1e7 Address _vec.grow FIXME, as issue #89 has been closed. 2010-08-03 18:10:18 -07:00
Roy Frostig
d5fd81174e Pass parametric types by-alias in various stdlib spots. 2010-08-03 18:06:31 -07:00
Roy Frostig
085790a73a More stdlib hashmap bits (plus some drive-by extras). 2010-08-03 17:52:35 -07:00
Roy Frostig
237b9d4a64 Test the deque more and fix uncovered off-by-one bug. 2010-07-28 16:34:22 -07:00
Roy Frostig
596d19e2ea Test the deque a bit. Give it a get-by-index method. Fix two uncovered state-calculation bugs --- one decently, the other with an ugly hack. Bug on the latter coming right up. 2010-07-28 14:00:44 -07:00
Graydon Hoare
8030757624 Switch machine-type lexemes to use suffixes. Remove support for foo(bar) as a cast notation. Closes #129. 2010-07-27 19:21:51 -07:00
Roy Frostig
5b6e714d05 Expose an RNG (the one used by our runtime) to Rust via std. 2010-07-25 21:45:09 -07:00
Roy Frostig
1730d2e037 Notify copy glue of dst-initialization and fix _vec.alloc issues in lib and runtime. Closes #109. 2010-07-22 17:47:32 -07:00
Roy Frostig
1ae13b3fdd Source FIXME annotations for issue #81 and a correction to STMT_bind fmt. 2010-07-22 12:45:58 -07:00
Roy Frostig
9c81889ad2 Add a (coarse, first-pass) deque implementation to stdlib. 2010-07-20 18:03:09 -07:00
Roy Frostig
fb68286700 Add incomplete hashmap implementation to stdlib. 2010-07-16 18:14:52 -07:00
Patrick Walton
1ac01e16cf Ensure that functions that should return a value do; issue 41 2010-07-16 15:34:25 -07:00
Patrick Walton
c96f0bf738 Implement the "simple typechecker", which avoids HM inference 2010-07-15 18:27:09 -07:00
Jeffrey Yasskin
765a2b3ecf Add a _vec.slice function that'll hold us over until .(a,b) syntax is
implemented.  This could actually replace .(a,b) syntax if the language grows
optional function parameters.
2010-07-16 08:13:08 +08:00
Graydon Hoare
15ef6c12d9 Modify _io's fd_buf_reader to do something slightly more useful: produce multiple buffers on demand. 2010-07-13 14:24:47 -07:00
Graydon Hoare
40d6aacb82 Add differently-typed refcount synonyms to _str and _vec. 2010-07-13 14:23:49 -07:00
Graydon Hoare
b1eeb9b825 Change from 'spawner' to 'supervisor' in rust_task, and add an unsupervise call. 2010-07-05 14:43:40 -07:00
Graydon Hoare
f360d222c8 Uint-ify various bits of _str and _vec, enrich _vec a bit. 2010-07-05 14:42:12 -07:00
Graydon Hoare
b0aba6510a Teach the dwarf readers to handle udata, so we can link with util.option; add util.rs to std.rc. 2010-07-05 14:38:02 -07:00
Graydon Hoare
ad61f02d36 Rename some stuff in lib/util.rs. 2010-07-05 14:36:39 -07:00
Roy Frostig
49656f68b8 Gut the box[m][o] family from util. 2010-07-02 11:03:33 -07:00
Roy Frostig
023e5af639 The few and proud isolated bits from stdlib-work so far that don't break everything. Note util.rs hasn't yet been declared mod in the std crate. Don't do that yet, as it breaks make check. 2010-06-28 23:18:51 -07:00
Graydon Hoare
1316312c0c Only translate or dwarf-emit items or stubs locally defined or used. Avoids instantiating O(sizeof(standard-library)) worth of imports stubs on each 'use std'. Closes issue 13. 2010-06-27 20:48:28 -07:00
Graydon Hoare
7ea416f4c3 Add callable gc method exposed to user code, use it in mlist-cycle.rs test (still not quite working; some memory corruption in the recursive tag constructors, not the GC) 2010-06-25 23:57:30 -07:00
Graydon Hoare
d6b7c96c3e Populate tree. 2010-06-23 21:03:09 -07:00