mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 06:44:46 +00:00
Echo example in CLI
This commit is contained in:
parent
659966c878
commit
1de0918ba9
14 changed files with 59 additions and 188 deletions
|
@ -28,6 +28,14 @@ extern "C" {
|
|||
fn size_Fx_result() -> i64;
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub fn roc_fx_putChar(foo: i64) -> () {
|
||||
let character = foo as u8 as char;
|
||||
print!("{}", character);
|
||||
|
||||
()
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub fn roc_fx_putLine(line: RocStr) -> () {
|
||||
let bytes = line.as_slice();
|
||||
|
@ -78,7 +86,6 @@ pub fn rust_main() -> isize {
|
|||
let size = unsafe { roc_main_size() } as usize;
|
||||
let layout = Layout::array::<u8>(size).unwrap();
|
||||
let answer = unsafe {
|
||||
// TODO if this is 1024B or less, put it in a global scratch buffer
|
||||
let buffer = std::alloc::alloc(layout);
|
||||
|
||||
roc_main(buffer);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue