mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 23:31:12 +00:00
Make happy again with trunk
This commit is contained in:
parent
0d4ef43470
commit
ddef6ab0f8
3 changed files with 10 additions and 14 deletions
|
@ -21,10 +21,9 @@ app "false"
|
||||||
|
|
||||||
InterpreterErrors : [ BadUtf8, DivByZero, EmptyStack, InvalidBooleanValue, InvalidChar Str, MaxInputNumber, NoLambdaOnStack, NoNumberOnStack, NoVariableOnStack, NoScope, OutOfBounds, UnexpectedEndOfData ]
|
InterpreterErrors : [ BadUtf8, DivByZero, EmptyStack, InvalidBooleanValue, InvalidChar Str, MaxInputNumber, NoLambdaOnStack, NoNumberOnStack, NoVariableOnStack, NoScope, OutOfBounds, UnexpectedEndOfData ]
|
||||||
|
|
||||||
main : List Str -> Task {} []
|
main : Str -> Task {} []
|
||||||
main = \filenames ->
|
main = \filename ->
|
||||||
filenames
|
interpretFile filename
|
||||||
|> List.walk (\filename, task -> Task.await task (\_ -> (interpretFile filename))) (Task.succeed {})
|
|
||||||
|> Task.await (\_ -> Stdout.line "Completed all tasks successfully")
|
|> Task.await (\_ -> Stdout.line "Completed all tasks successfully")
|
||||||
|> Task.onFail (\StringErr e -> Stdout.line "Ran into problem:\n\(e)\n")
|
|> Task.onFail (\StringErr e -> Stdout.line "Ran into problem:\n\(e)\n")
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
platform examples/cli
|
platform examples/cli
|
||||||
requires {}{ main : List Str -> Task {} [] } # TODO FIXME
|
requires {}{ main : Str -> Task {} [] } # TODO FIXME
|
||||||
exposes []
|
exposes []
|
||||||
packages {}
|
packages {}
|
||||||
imports [ Task.{ Task } ]
|
imports [ Task.{ Task } ]
|
||||||
|
@ -18,5 +18,5 @@ platform examples/cli
|
||||||
getChar : Effect U8
|
getChar : Effect U8
|
||||||
}
|
}
|
||||||
|
|
||||||
mainForHost : List Str -> Task {} [] as Fx
|
mainForHost : Str -> Task {} [] as Fx
|
||||||
mainForHost = \list -> main list
|
mainForHost = \file -> main file
|
||||||
|
|
|
@ -13,7 +13,7 @@ use std::os::raw::c_char;
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#[link_name = "roc__mainForHost_1_exposed"]
|
#[link_name = "roc__mainForHost_1_exposed"]
|
||||||
fn roc_main(args: RocList<RocStr>, output: *mut u8) -> ();
|
fn roc_main(args: RocStr, output: *mut u8) -> ();
|
||||||
|
|
||||||
#[link_name = "roc__mainForHost_size"]
|
#[link_name = "roc__mainForHost_size"]
|
||||||
fn roc_main_size() -> i64;
|
fn roc_main_size() -> i64;
|
||||||
|
@ -64,11 +64,8 @@ pub unsafe fn roc_panic(c_ptr: *mut c_void, tag_id: u32) {
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn rust_main() -> i32 {
|
pub fn rust_main() -> i32 {
|
||||||
let args: Vec<RocStr> = env::args()
|
let arg = env::args().skip(1).next().unwrap();
|
||||||
.skip(1)
|
let arg = RocStr::from_slice(arg.as_bytes());
|
||||||
.map(|arg| RocStr::from_slice(arg.as_bytes()))
|
|
||||||
.collect();
|
|
||||||
let args = RocList::<RocStr>::from_slice(&args);
|
|
||||||
|
|
||||||
let size = unsafe { roc_main_size() } as usize;
|
let size = unsafe { roc_main_size() } as usize;
|
||||||
let layout = Layout::array::<u8>(size).unwrap();
|
let layout = Layout::array::<u8>(size).unwrap();
|
||||||
|
@ -77,7 +74,7 @@ pub fn rust_main() -> i32 {
|
||||||
// TODO allocate on the stack if it's under a certain size
|
// TODO allocate on the stack if it's under a certain size
|
||||||
let buffer = std::alloc::alloc(layout);
|
let buffer = std::alloc::alloc(layout);
|
||||||
|
|
||||||
roc_main(args, buffer);
|
roc_main(arg, buffer);
|
||||||
|
|
||||||
let result = call_the_closure(buffer);
|
let result = call_the_closure(buffer);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue