diff --git a/.entry b/.entry new file mode 100644 index 0000000..ead9c6d --- /dev/null +++ b/.entry @@ -0,0 +1 @@ +BUILD_SYSTEM_ENTRY_DIR = "./booting.c" diff --git a/booting.c b/booting.c new file mode 100644 index 0000000..cdbe206 --- /dev/null +++ b/booting.c @@ -0,0 +1,28 @@ +// File: twelve_biubiu.c +// Permission: CN-2082-2 +// Author: Li.YiYi +// Dept: PE-362, UG +// Origin: TI-352132 +// 春节十二响启动器 biu biu biu! + +#include "engine_rt.h" +#include "engine_macros.h" +#include "twelve_biubiu.h" + +int main() { + init(); + // 允许误差10秒以内 + if (unix_time() < make_unix_time(2082, 1, 28, 23, 59, 60-10)) return ERR_ENGIN_ENV; + int signal = engine_check_init(); + // after compile and before real run + if(ENGINE_FAIL(signal)) { + return signal; + } + engine_processing(processing); + signal = engine_shutdown(final); + // 异常关闭 + if(ENGINE_FAIL(signal)) { + return signal; + } + return ENGINE_SUCCESS; +} \ No newline at end of file diff --git a/twelve_biubiu.c b/twelve_biubiu.c index c67beba..66cc90a 100644 --- a/twelve_biubiu.c +++ b/twelve_biubiu.c @@ -7,14 +7,19 @@ #env "planet_engine" +#include "twelve_biubiu.h" +#include "engine_rt.h" +#include "engine_macros.h" + int init() { - set_engine_number_mask(ENGINE_ALL); + set_engine_number_mask(ENGINE_EQUATOR_ALL); set_funeral_level(FUNERAL_FULL); - // 允许误差10秒以内 - if (unix_time() < make_unix_time(2082, 1, 28, 23, 59, 60-10)) return ERR_ENGIN_ENV; - return engine_check_init(); // after compile and before real run } -int main() { + +int processing(int32_t engineStatus) { + if(ENGINE_FAIL(engineStatus)) { + return engineStatus; + } set_curve(CURVE_NATURAL); // 自然曲线耗费燃料最少 for (int i :range(0, 12, 1)) { engine_start(); @@ -26,6 +31,8 @@ int main() { } return 0; } -int final() { + +int final(int32_t lastError) { engine_ensure_shutdown(); + return lastError; } diff --git a/twelve_biubiu.h b/twelve_biubiu.h new file mode 100644 index 0000000..900edf2 --- /dev/null +++ b/twelve_biubiu.h @@ -0,0 +1,10 @@ +// File: twelve_biubiu.h +// Permission: CN-2082-2 +// Author: Li.YiYi +// Dept: PE-362, UG +// Origin: TI-352132 +// 春节十二响 biu biu biu! + +extern int init() +extern int processing(int32_t); +extern int final(int32_t); \ No newline at end of file