Explorar o código

change: luat_main不再传参数了

Wendal Chen %!s(int64=5) %!d(string=hai) anos
pai
achega
e31403dcce

+ 1 - 1
bsp/air001/src/app.c

@@ -12,7 +12,7 @@ int main(int argc, const char* argv[]) {
     // 初始化虚拟设备
     luat_vdev_init();
 
-    luat_main(0, (char**)NULL, 0);
+    luat_main();
 
     return 0;
 }

+ 1 - 1
bsp/air100st/rtt/applications/main.c

@@ -28,7 +28,7 @@
 static void _main(void* param) {
     rt_thread_mdelay(100); // 故意延后100ms
     luat_log_set_uart_port(1);
-    luat_main(NULL, NULL, NULL);
+    luat_main();
     while (1)
         rt_thread_delay(10000000);
 }

+ 1 - 1
bsp/air640w/rtt/applications/main.c

@@ -14,7 +14,7 @@
 
 static void _main(void* param) {
     rt_thread_mdelay(100); // 故意延后100ms
-    luat_main(NULL, NULL, NULL);
+    luat_main();
     while (1)
         rt_thread_delay(10000000);
 }

+ 1 - 1
luat/include/luat_base.h

@@ -27,7 +27,7 @@
  * LuatOS主入口函数, 从这里开始就交由LuatOS控制了.
  * 集成时,该函数应在独立的thread/task中启动
  */
-int luat_main (int argc, char **argv, int _);
+int luat_main (void);
 
 /**
  * 加载库函数. 平台实现应该根据时间情况, 加载可用的标准库和扩展库.

+ 4 - 4
luat/modules/luat_main.c

@@ -156,7 +156,7 @@ static void check_rollback(void) {
   luat_os_reboot(0); // 重启
 }
 
-int luat_main (int argc, char **argv, int _) {
+int luat_main (void) {
   if (boot_mode == 0) {
     return 0; // just nop
   }
@@ -180,9 +180,9 @@ int luat_main (int argc, char **argv, int _) {
   if (L) lua_atpanic(L, &panic);
   //print_list_mem("after lua_newstate");
   lua_pushcfunction(L, &pmain);  /* to call 'pmain' in protected mode */
-  lua_pushinteger(L, argc);  /* 1st argument */
-  lua_pushlightuserdata(L, argv); /* 2nd argument */
-  status = lua_pcall(L, 2, 1, 0);  /* do the call */
+  //lua_pushinteger(L, argc);  /* 1st argument */
+  //lua_pushlightuserdata(L, argv); /* 2nd argument */
+  status = lua_pcall(L, 0, 1, 0);  /* do the call */
   result = lua_toboolean(L, -1);  /* get result */
   report(L, status);
   lua_close(L);