diff options
| author | Graydon Hoare <graydon@mozilla.com> | 2012-06-27 13:14:04 -0700 |
|---|---|---|
| committer | Graydon Hoare <graydon@mozilla.com> | 2012-06-27 13:30:49 -0700 |
| commit | d3c6119a7a68732ff95efdec356ac7abb0f6f6f4 (patch) | |
| tree | 07ade2378a2bdd2c704ddf2376dfe2c1ba24cd3b /src | |
| parent | f0565be49a4263ca0582acc64102051da1434cff (diff) | |
| download | rust-d3c6119a7a68732ff95efdec356ac7abb0f6f6f4.tar.gz rust-d3c6119a7a68732ff95efdec356ac7abb0f6f6f4.zip | |
More keyword paring and migration in runtime, docs, code modes.
Diffstat (limited to 'src')
| -rw-r--r-- | src/etc/emacs/rust-mode.el | 14 | ||||
| -rw-r--r-- | src/etc/vim/syntax/rust.vim | 14 | ||||
| -rw-r--r-- | src/libsyntax/parse/token.rs | 2 | ||||
| -rw-r--r-- | src/rt/rust_builtin.cpp | 2 | ||||
| -rw-r--r-- | src/rt/rust_task.h | 2 | ||||
| -rw-r--r-- | src/rt/rust_upcall.cpp | 4 | ||||
| -rw-r--r-- | src/rt/rust_uv.cpp | 46 |
7 files changed, 42 insertions, 42 deletions
diff --git a/src/etc/emacs/rust-mode.el b/src/etc/emacs/rust-mode.el index 412a43d796e..e8240ae7faf 100644 --- a/src/etc/emacs/rust-mode.el +++ b/src/etc/emacs/rust-mode.el @@ -52,21 +52,21 @@ (defvar rust-punc-chars "()[].,{}:;") (defvar rust-value-keywords (let ((table (make-hash-table :test 'equal))) - (dolist (word '("mod" "type" "resource" "fn" "enum" "iface" "impl")) + (dolist (word '("mod" "const" "class" "type" + "trait" "fn" "enum" "iface" + "impl")) (puthash word 'def table)) (dolist (word '("assert" - "be" "break" - "check" "claim" "class" "const" "cont" "copy" "crust" + "break" + "check" "claim" "cont" "copy" "drop" - "else" "export" + "else" "export" "extern" "fail" "for" "if" "import" "let" "log" "loop" - "mut" - "native" "new" + "new" "pure" "ret" - "trait" "unchecked" "unsafe" "while")) (puthash word t table)) diff --git a/src/etc/vim/syntax/rust.vim b/src/etc/vim/syntax/rust.vim index 94b889e010f..7c339ed0856 100644 --- a/src/etc/vim/syntax/rust.vim +++ b/src/etc/vim/syntax/rust.vim @@ -14,21 +14,21 @@ if !exists("main_syntax") let main_syntax='rust' endif -syn keyword rustKeyword alt as assert be bind break -syn keyword rustKeyword check claim cont const copy else export fail -syn keyword rustKeyword for if impl import in inline lambda let log -syn keyword rustKeyword loop mod mut mutable native note of prove pure -syn keyword rustKeyword ret self syntax to unchecked +syn keyword rustKeyword alt as assert break +syn keyword rustKeyword check claim cont const copy else export extern fail +syn keyword rustKeyword for if impl import in let log +syn keyword rustKeyword loop mod mut of pure +syn keyword rustKeyword ret self to unchecked syn keyword rustKeyword unsafe use while with " FIXME: Scoped impl's name is also fallen in this category -syn keyword rustKeyword mod iface resource class enum type nextgroup=rustIdentifier skipwhite +syn keyword rustKeyword mod iface trait class enum type nextgroup=rustIdentifier skipwhite syn keyword rustKeyword fn nextgroup=rustFuncName skipwhite syn match rustIdentifier "\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" display contained syn match rustFuncName "\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" display contained " Reserved words -syn keyword rustKeyword m32 m64 m128 f80 f16 f128 class trait +syn keyword rustKeyword m32 m64 m128 f80 f16 f128 syn keyword rustType any int uint float char bool u8 u16 u32 u64 f32 syn keyword rustType f64 i8 i16 i32 i64 str diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index 0586a3c2d52..8ab37e95d21 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -285,7 +285,7 @@ fn restricted_keyword_table() -> hashmap<str, ()> { let keys = [ "alt", "assert", - "be", "break", + "break", "check", "claim", "class", "const", "cont", "copy", "crust", "do", "drop", "else", "enum", "export", "extern", diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp index ad729494c45..38e387735f9 100644 --- a/src/rt/rust_builtin.cpp +++ b/src/rt/rust_builtin.cpp @@ -1,4 +1,4 @@ -/* Native builtins. */ +/* Foreign builtins. */ #include "rust_sched_loop.h" #include "rust_task.h" diff --git a/src/rt/rust_task.h b/src/rt/rust_task.h index 2a58725c6a4..e46b624c936 100644 --- a/src/rt/rust_task.h +++ b/src/rt/rust_task.h @@ -10,7 +10,7 @@ * Managing the dynamically resizing list of Rust stack segments * Switching between running Rust code on the Rust segmented stack and - native C code on large stacks owned by the scheduler + foreign C code on large stacks owned by the scheduler The lifetime of a rust_task object closely mirrors that of a running Rust task object, but they are not identical. In particular, the rust_task is an diff --git a/src/rt/rust_upcall.cpp b/src/rt/rust_upcall.cpp index fae3e7e2943..965d38fa70c 100644 --- a/src/rt/rust_upcall.cpp +++ b/src/rt/rust_upcall.cpp @@ -40,7 +40,7 @@ extern "C" void record_sp_limit(void *limit); /********************************************************************** * Switches to the C-stack and invokes |fn_ptr|, passing |args| as argument. - * This is used by the C compiler to call native functions and by other + * This is used by the C compiler to call foreign functions and by other * upcalls to switch to the C stack. The return value is passed through a * field in the args parameter. This upcall is specifically for switching * to the shim functions generated by rustc. @@ -58,7 +58,7 @@ upcall_call_shim_on_c_stack(void *args, void *fn_ptr) { task->call_on_c_stack(args, fn_ptr); } catch (...) { // Logging here is not reliable - assert(false && "Native code threw an exception"); + assert(false && "Foreign code threw an exception"); } task->record_stack_limit(); diff --git a/src/rt/rust_uv.cpp b/src/rt/rust_uv.cpp index 0ad59a73161..1873ae33e9c 100644 --- a/src/rt/rust_uv.cpp +++ b/src/rt/rust_uv.cpp @@ -8,11 +8,11 @@ #include "rust_log.h" #include "uv.h" -// crust fn pointers -typedef void (*crust_async_op_cb)(uv_loop_t* loop, void* data, +// extern fn pointers +typedef void (*extern_async_op_cb)(uv_loop_t* loop, void* data, uv_async_t* op_handle); -typedef void (*crust_simple_cb)(uint8_t* id_buf, void* loop_data); -typedef void (*crust_close_cb)(uint8_t* id_buf, void* handle, +typedef void (*extern_simple_cb)(uint8_t* id_buf, void* loop_data); +typedef void (*extern_close_cb)(uint8_t* id_buf, void* handle, void* data); // data types @@ -20,8 +20,8 @@ typedef void (*crust_close_cb)(uint8_t* id_buf, void* handle, struct handle_data { uint8_t id_buf[RUST_UV_HANDLE_LEN]; - crust_simple_cb cb; - crust_close_cb close_cb; + extern_simple_cb cb; + extern_close_cb close_cb; }; // helpers @@ -37,7 +37,7 @@ current_kernel_free(void* ptr) { } static handle_data* -new_handle_data_from(uint8_t* buf, crust_simple_cb cb) { +new_handle_data_from(uint8_t* buf, extern_simple_cb cb) { handle_data* data = (handle_data*)current_kernel_malloc( sizeof(handle_data), "handle_data"); @@ -48,39 +48,39 @@ new_handle_data_from(uint8_t* buf, crust_simple_cb cb) { // libuv callback impls static void -native_crust_async_op_cb(uv_async_t* handle, int status) { - crust_async_op_cb cb = (crust_async_op_cb)handle->data; +foreign_extern_async_op_cb(uv_async_t* handle, int status) { + extern_async_op_cb cb = (extern_async_op_cb)handle->data; void* loop_data = handle->loop->data; cb(handle->loop, loop_data, handle); } static void -native_async_cb(uv_async_t* handle, int status) { +foreign_async_cb(uv_async_t* handle, int status) { handle_data* handle_d = (handle_data*)handle->data; void* loop_data = handle->loop->data; handle_d->cb(handle_d->id_buf, loop_data); } static void -native_timer_cb(uv_timer_t* handle, int status) { +foreign_timer_cb(uv_timer_t* handle, int status) { handle_data* handle_d = (handle_data*)handle->data; void* loop_data = handle->loop->data; handle_d->cb(handle_d->id_buf, loop_data); } static void -native_close_cb(uv_handle_t* handle) { +foreign_close_cb(uv_handle_t* handle) { handle_data* data = (handle_data*)handle->data; data->close_cb(data->id_buf, handle, handle->loop->data); } static void -native_close_op_cb(uv_handle_t* op_handle) { +foreign_close_op_cb(uv_handle_t* op_handle) { current_kernel_free(op_handle); // uv_run() should return after this.. } -// native fns bound in rust +// foreign fns bound in rust extern "C" void rust_uv_free(void* ptr) { current_kernel_free(ptr); @@ -122,11 +122,11 @@ rust_uv_loop_set_data(uv_loop_t* loop, void* data) { } extern "C" void* -rust_uv_bind_op_cb(uv_loop_t* loop, crust_async_op_cb cb) { +rust_uv_bind_op_cb(uv_loop_t* loop, extern_async_op_cb cb) { uv_async_t* async = (uv_async_t*)current_kernel_malloc( sizeof(uv_async_t), "uv_async_t"); - uv_async_init(loop, async, native_crust_async_op_cb); + uv_async_init(loop, async, foreign_extern_async_op_cb); async->data = (void*)cb; // decrement the ref count, so that our async bind // doesn't count towards keeping the loop alive @@ -136,7 +136,7 @@ rust_uv_bind_op_cb(uv_loop_t* loop, crust_async_op_cb cb) { extern "C" void rust_uv_stop_op_cb(uv_handle_t* op_handle) { - uv_close(op_handle, native_close_op_cb); + uv_close(op_handle, foreign_close_op_cb); } extern "C" void @@ -150,10 +150,10 @@ rust_uv_close(uv_handle_t* handle, uv_close_cb cb) { } extern "C" void -rust_uv_hilvl_close(uv_handle_t* handle, crust_close_cb cb) { +rust_uv_hilvl_close(uv_handle_t* handle, extern_close_cb cb) { handle_data* data = (handle_data*)handle->data; data->close_cb = cb; - uv_close(handle, native_close_cb); + uv_close(handle, foreign_close_cb); } extern "C" void @@ -181,12 +181,12 @@ rust_uv_async_init(uv_loop_t* loop_handle, } extern "C" void* -rust_uv_hilvl_async_init(uv_loop_t* loop, crust_simple_cb cb, +rust_uv_hilvl_async_init(uv_loop_t* loop, extern_simple_cb cb, uint8_t* buf) { uv_async_t* async = (uv_async_t*)current_kernel_malloc( sizeof(uv_async_t), "uv_async_t"); - uv_async_init(loop, async, native_async_cb); + uv_async_init(loop, async, foreign_async_cb); handle_data* data = new_handle_data_from(buf, cb); async->data = data; @@ -194,7 +194,7 @@ rust_uv_hilvl_async_init(uv_loop_t* loop, crust_simple_cb cb, } extern "C" void* -rust_uv_hilvl_timer_init(uv_loop_t* loop, crust_simple_cb cb, +rust_uv_hilvl_timer_init(uv_loop_t* loop, extern_simple_cb cb, uint8_t* buf) { uv_timer_t* new_timer = (uv_timer_t*)current_kernel_malloc( sizeof(uv_timer_t), @@ -209,7 +209,7 @@ rust_uv_hilvl_timer_init(uv_loop_t* loop, crust_simple_cb cb, extern "C" void rust_uv_hilvl_timer_start(uv_timer_t* the_timer, uint32_t timeout, uint32_t repeat) { - uv_timer_start(the_timer, native_timer_cb, timeout, repeat); + uv_timer_start(the_timer, foreign_timer_cb, timeout, repeat); } extern "C" int |
