diff options
| author | Lindsey Kuper <[email protected]> | 2011-03-24 18:20:49 -0700 |
|---|---|---|
| committer | Graydon Hoare <[email protected]> | 2011-03-25 00:15:56 -0700 |
| commit | bcc104ce79f153cd853920ff924e13f84793b61c (patch) | |
| tree | b751831c7db8f242cb1097f5e07c44cbb8556bd8 /src/rt | |
| parent | build: Generate an object file for stage0/libstd.dylib (diff) | |
| download | rust-bcc104ce79f153cd853920ff924e13f84793b61c.tar.xz rust-bcc104ce79f153cd853920ff924e13f84793b61c.zip | |
A first stab at the 'nbody' demo, with support for calling C sqrt().
Diffstat (limited to 'src/rt')
| -rw-r--r-- | src/rt/rust_builtin.cpp | 5 | ||||
| -rw-r--r-- | src/rt/rust_internal.h | 1 | ||||
| -rw-r--r-- | src/rt/rustrt.def.in | 2 |
3 files changed, 8 insertions, 0 deletions
diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp index 98333774..2de9d7f4 100644 --- a/src/rt/rust_builtin.cpp +++ b/src/rt/rust_builtin.cpp @@ -51,6 +51,11 @@ last_os_error(rust_task *task) { return st; } +extern "C" CDECL +void squareroot(rust_task *task, double *input, double *output) { + *output = sqrt(*input); +} + extern "C" CDECL size_t size_of(rust_task *task, type_desc *t) { return t->size; diff --git a/src/rt/rust_internal.h b/src/rt/rust_internal.h index 5bd62d2b..a1cc8e51 100644 --- a/src/rt/rust_internal.h +++ b/src/rt/rust_internal.h @@ -16,6 +16,7 @@ #include <stdio.h> #include <string.h> #include <fcntl.h> +#include <math.h> #include "rust.h" #include "rand.h" diff --git a/src/rt/rustrt.def.in b/src/rt/rustrt.def.in index f8ac1ed4..df9e26af 100644 --- a/src/rt/rustrt.def.in +++ b/src/rt/rustrt.def.in @@ -20,6 +20,7 @@ rust_get_stdout rust_run_program rust_start size_of +squareroot str_alloc str_buf str_byte_len @@ -39,6 +40,7 @@ upcall_get_type_desc upcall_grow_task upcall_join upcall_kill +upcall_log_double upcall_log_int upcall_log_str upcall_malloc |