101 lines
2.7 KiB
C
Generated
101 lines
2.7 KiB
C
Generated
// Lean compiler output
|
|
// Module: LakeMain
|
|
// Imports: Lake Lake.CLI
|
|
#include <lean/lean.h>
|
|
#if defined(__clang__)
|
|
#pragma clang diagnostic ignored "-Wunused-parameter"
|
|
#pragma clang diagnostic ignored "-Wunused-label"
|
|
#elif defined(__GNUC__) && !defined(__CLANG__)
|
|
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
|
#pragma GCC diagnostic ignored "-Wunused-label"
|
|
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
|
|
#endif
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
LEAN_EXPORT lean_object* _lean_main(lean_object*, lean_object*);
|
|
lean_object* l_Lake_cli(lean_object*, lean_object*);
|
|
LEAN_EXPORT lean_object* _lean_main(lean_object* x_1, lean_object* x_2) {
|
|
_start:
|
|
{
|
|
lean_object* x_3; uint8_t x_4;
|
|
x_3 = l_Lake_cli(x_1, x_2);
|
|
x_4 = !lean_is_exclusive(x_3);
|
|
if (x_4 == 0)
|
|
{
|
|
return x_3;
|
|
}
|
|
else
|
|
{
|
|
lean_object* x_5; lean_object* x_6; lean_object* x_7;
|
|
x_5 = lean_ctor_get(x_3, 0);
|
|
x_6 = lean_ctor_get(x_3, 1);
|
|
lean_inc(x_6);
|
|
lean_inc(x_5);
|
|
lean_dec(x_3);
|
|
x_7 = lean_alloc_ctor(0, 2, 0);
|
|
lean_ctor_set(x_7, 0, x_5);
|
|
lean_ctor_set(x_7, 1, x_6);
|
|
return x_7;
|
|
}
|
|
}
|
|
}
|
|
lean_object* initialize_Lake(uint8_t builtin, lean_object*);
|
|
lean_object* initialize_Lake_CLI(uint8_t builtin, lean_object*);
|
|
static bool _G_initialized = false;
|
|
LEAN_EXPORT lean_object* initialize_LakeMain(uint8_t builtin, lean_object* w) {
|
|
lean_object * res;
|
|
if (_G_initialized) return lean_io_result_mk_ok(lean_box(0));
|
|
_G_initialized = true;
|
|
res = initialize_Lake(builtin, lean_io_mk_world());
|
|
if (lean_io_result_is_error(res)) return res;
|
|
lean_dec_ref(res);
|
|
res = initialize_Lake_CLI(builtin, lean_io_mk_world());
|
|
if (lean_io_result_is_error(res)) return res;
|
|
lean_dec_ref(res);
|
|
return lean_io_result_mk_ok(lean_box(0));
|
|
}
|
|
void lean_initialize();
|
|
|
|
#if defined(WIN32) || defined(_WIN32)
|
|
#include <windows.h>
|
|
#endif
|
|
|
|
int main(int argc, char ** argv) {
|
|
#if defined(WIN32) || defined(_WIN32)
|
|
SetErrorMode(SEM_FAILCRITICALERRORS);
|
|
SetConsoleOutputCP(CP_UTF8);
|
|
#endif
|
|
lean_object* in; lean_object* res;
|
|
lean_initialize();
|
|
lean_set_panic_messages(false);
|
|
res = initialize_LakeMain(1 /* builtin */, lean_io_mk_world());
|
|
lean_set_panic_messages(true);
|
|
lean_io_mark_end_initialization();
|
|
if (lean_io_result_is_ok(res)) {
|
|
lean_dec_ref(res);
|
|
lean_init_task_manager();
|
|
in = lean_box(0);
|
|
int i = argc;
|
|
while (i > 1) {
|
|
lean_object* n;
|
|
i--;
|
|
n = lean_alloc_ctor(1,2,0); lean_ctor_set(n, 0, lean_mk_string(argv[i])); lean_ctor_set(n, 1, in);
|
|
in = n;
|
|
}
|
|
res = _lean_main(in, lean_io_mk_world());
|
|
}
|
|
lean_finalize_task_manager();
|
|
if (lean_io_result_is_ok(res)) {
|
|
int ret = lean_unbox_uint32(lean_io_result_get_value(res));
|
|
lean_dec_ref(res);
|
|
return ret;
|
|
} else {
|
|
lean_io_result_show_error(res);
|
|
lean_dec_ref(res);
|
|
return 1;
|
|
}
|
|
}
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|