mynewt-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject [01/11] incubator-mynewt-larva git commit: Change the error/message calls to use console_printf(). Remove dependency to stub libc.
Date Tue, 24 Nov 2015 20:39:47 GMT
Repository: incubator-mynewt-larva
Updated Branches:
  refs/heads/master c4017193c -> c0c77d83e


Change the error/message calls to use console_printf().
Remove dependency to stub libc.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/commit/0bc40a08
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/tree/0bc40a08
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/diff/0bc40a08

Branch: refs/heads/master
Commit: 0bc40a08ebb8b9906eea526d082d2264748db341
Parents: c401719
Author: Marko Kiiskila <marko@runtime.io>
Authored: Tue Nov 24 10:25:50 2015 -0800
Committer: Marko Kiiskila <marko@runtime.io>
Committed: Tue Nov 24 10:25:50 2015 -0800

----------------------------------------------------------------------
 libs/elua/elua_base/egg.yml       |  1 -
 libs/elua/elua_base/src/lauxlib.c |  8 ++++++++
 libs/elua/elua_base/src/lua.c     | 14 ++++++++++++++
 3 files changed, 22 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/0bc40a08/libs/elua/elua_base/egg.yml
----------------------------------------------------------------------
diff --git a/libs/elua/elua_base/egg.yml b/libs/elua/elua_base/egg.yml
index 95dfb98..3a202b1 100644
--- a/libs/elua/elua_base/egg.yml
+++ b/libs/elua/elua_base/egg.yml
@@ -5,5 +5,4 @@ egg.req_caps:
     - console
 egg.deps:
     - libs/nffs
-    - libs/libc
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/0bc40a08/libs/elua/elua_base/src/lauxlib.c
----------------------------------------------------------------------
diff --git a/libs/elua/elua_base/src/lauxlib.c b/libs/elua/elua_base/src/lauxlib.c
index 338ff43..32ec127 100644
--- a/libs/elua/elua_base/src/lauxlib.c
+++ b/libs/elua/elua_base/src/lauxlib.c
@@ -12,6 +12,9 @@
 #include <stdlib.h>
 #include <string.h>
 
+#ifdef MYNEWT
+#include <console/console.h>
+#endif
 
 /* This file uses only the official API of Lua.
 ** Any function declared here could be written as an application function.
@@ -844,8 +847,13 @@ static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize)
{
 
 static int panic (lua_State *L) {
   (void)L;  /* to avoid warnings */
+#ifndef MYNEWT
   fprintf(stderr, "PANIC: unprotected error in call to Lua API (%s)\n",
                    lua_tostring(L, -1));
+#else
+  console_printf("PANIC: unprotected error in call to Lua API (%s)\n",
+    lua_tostring(L, -1));
+#endif
   return 0;
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/0bc40a08/libs/elua/elua_base/src/lua.c
----------------------------------------------------------------------
diff --git a/libs/elua/elua_base/src/lua.c b/libs/elua/elua_base/src/lua.c
index d4797ff..835a344 100644
--- a/libs/elua/elua_base/src/lua.c
+++ b/libs/elua/elua_base/src/lua.c
@@ -9,6 +9,9 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#ifdef MYNEWT
+#include <console/console.h>
+#endif
 
 #define lua_c
 
@@ -40,7 +43,11 @@ static void laction (int i) {
 
 
 static void print_usage (void) {
+#ifndef MYNEWT
   fprintf(stderr,
+#else
+  console_printf(
+#endif
   "usage: %s [options] [script [args]].\n"
   "Available options are:\n"
   "  -e stat  execute string " LUA_QL("stat") "\n"
@@ -52,14 +59,21 @@ static void print_usage (void) {
   "  -        execute stdin and stop handling options\n"
   ,
   progname);
+#ifndef MYNEWT
   fflush(stderr);
+#endif
 }
 
 
 static void l_message (const char *pname, const char *msg) {
+#ifndef MYNEWT
   if (pname) fprintf(stderr, "%s: ", pname);
   fprintf(stderr, "%s\n", msg);
   fflush(stderr);
+#else
+  if (pname) console_printf("%s: ", pname);
+  console_printf("%s\n", msg);
+#endif
 }
 
 


Mime
View raw message