[lua-torch-trepl] 01/05: New upstream version 0~20161111-gf588b72

Zhou Mo cdluminate-guest at moszumanska.debian.org
Thu Nov 17 09:19:05 UTC 2016


This is an automated email from the git hooks/post-receive script.

cdluminate-guest pushed a commit to branch master
in repository lua-torch-trepl.

commit 8b23f4555a01e2a40e80ee0567a05d56fab9ce3b
Author: Zhou Mo <cdluminate at gmail.com>
Date:   Thu Nov 17 09:06:32 2016 +0000

    New upstream version 0~20161111-gf588b72
---
 colors.lua           | 56 +++++++++++++++++++++++++++++-----------------------
 init.lua             | 17 ++++++++++++----
 readline.c           |  8 ++++++++
 th                   | 16 +++++++--------
 trepl-scm-1.rockspec | 16 +++++++++++----
 utils.c              |  2 +-
 6 files changed, 73 insertions(+), 42 deletions(-)

diff --git a/colors.lua b/colors.lua
index 9930380..76124e1 100644
--- a/colors.lua
+++ b/colors.lua
@@ -1,27 +1,33 @@
 return {
-   none = '\27[0m',
-   black = '\27[0;30m',
-   red = '\27[0;31m',
-   green = '\27[0;32m',
-   yellow = '\27[0;33m',
-   blue = '\27[0;34m',
-   magenta = '\27[0;35m',
-   cyan = '\27[0;36m',
-   white = '\27[0;37m',
-   Black = '\27[1;30m',
-   Red = '\27[1;31m',
-   Green = '\27[1;32m',
-   Yellow = '\27[1;33m',
-   Blue = '\27[1;34m',
-   Magenta = '\27[1;35m',
-   Cyan = '\27[1;36m',
-   White = '\27[1;37m',
-   _black = '\27[40m',
-   _red = '\27[41m',
-   _green = '\27[42m',
-   _yellow = '\27[43m',
-   _blue = '\27[44m',
-   _magenta = '\27[45m',
-   _cyan = '\27[46m',
-   _white = '\27[47m'
+   none      = '\27[0m',
+   bright    = '\27[1m',
+   dim       = '\27[2m',
+   underline = '\27[4m',
+   blink     = '\27[5m',
+   reverse   = '\27[7m',
+   hidden    = '\27[8m',
+   black     = '\27[0;30m',
+   red       = '\27[0;31m',
+   green     = '\27[0;32m',
+   yellow    = '\27[0;33m',
+   blue      = '\27[0;34m',
+   magenta   = '\27[0;35m',
+   cyan      = '\27[0;36m',
+   white     = '\27[0;37m',
+   Black     = '\27[1;30m',
+   Red       = '\27[1;31m',
+   Green     = '\27[1;32m',
+   Yellow    = '\27[1;33m',
+   Blue      = '\27[1;34m',
+   Magenta   = '\27[1;35m',
+   Cyan      = '\27[1;36m',
+   White     = '\27[1;37m',
+   _black    = '\27[40m',
+   _red      = '\27[41m',
+   _green    = '\27[42m',
+   _yellow   = '\27[43m',
+   _blue     = '\27[44m',
+   _magenta  = '\27[45m',
+   _cyan     = '\27[46m',
+   _white    = '\27[47m'
 }
diff --git a/init.lua b/init.lua
index 167843d..c46f675 100644
--- a/init.lua
+++ b/init.lua
@@ -46,10 +46,15 @@ local function isWindows()
       package.config:sub(1,1) == '\\'
 end
 
-if isWindows() or (not cutils.isatty()) then
+local hasTPut = true -- default true for non windows
+if isWindows() then
+  hasTPut = sys.fexecute('where tput'):find('tput')
+end
+
+if not hasTPut or not cutils.isatty() then
    noColors()
 else
-   local outp = os.execute('tput colors >/dev/null')
+   local outp = os.execute('tput colors >' .. (isWindows() and 'NUL' or '/dev/null'))
    if type(outp) == 'boolean' and not outp then
       noColors()
    elseif type(outp) == 'number' and outp ~= 0 then
@@ -474,13 +479,13 @@ function monitor_G(cb)
                report = error
             end
             if line > 0 then
-               report(colors.red .. 'atempt to read undeclared variable: '
+               report(colors.red .. 'attempt to read undeclared variable: '
                   .. colors.blue .. key .. colors.none
                   .. ' @ ' .. colors.magenta .. file .. colors.none
                   .. ':' .. colors.green .. line .. colors.none
                )
             else
-               report(colors.red .. 'atempt to read undeclared variable: '
+               report(colors.red .. 'attempt to read undeclared variable: '
                   .. colors.blue .. key .. colors.none
                   .. ' @ ' .. colors.yellow .. '[C-module]' .. colors.none
                )
@@ -520,6 +525,10 @@ local aliases = [[
    alias lla='ls -lahF';
 ]]
 
+if isWindows() then
+   aliases = ""
+end
+
 -- Penlight
 pcall(require,'pl')
 
diff --git a/readline.c b/readline.c
index e14c867..42b8c8a 100644
--- a/readline.c
+++ b/readline.c
@@ -4,8 +4,12 @@
 #include "lua.h"
 #include "lauxlib.h"
 #include "lualib.h"
+#ifndef WinEditLine
 #include <readline/readline.h>
 #include <readline/history.h>
+#else
+#include <editline/readline.h>
+#endif
 #include <ctype.h>
 
 #if LUA_VERSION_NUM == 501
@@ -260,12 +264,16 @@ static int f_setup(lua_State *L)
   /* Break words at every non-identifier character except '.' and ':'. */
   rl_completer_word_break_characters =
     "\t\r\n !\"#$%&'()*+,-/;<=>?@[\\]^`{|}~";
+#ifndef WinEditLine
   rl_completer_quote_characters = "\"'";
+#endif
 /* #if RL_READLINE_VERSION < 0x0600 */
   rl_completion_append_character = '\0';
 /* #endif */
   rl_attempted_completion_function = lua_rl_complete;
+#ifndef WinEditLine
   rl_initialize();
+#endif
 
   return 0;
 }
diff --git a/th b/th
index a5c8ee2..dfd8d50 100644
--- a/th
+++ b/th
@@ -153,11 +153,11 @@ if asyncrepl then
    print(
 [[
  
-  ______             __   ]]..col.Black[[|  Torch7                                        ]]..[[ 
+  ______             __   ]]..col.Black[[|  Torch7]]..[[ 
  /_  __/__  ________/ /   ]]..col.Black[[|  ]]..col.magenta[[Scientific computing for Lua.]]..[[ 
-  / / / _ \/ __/ __/ _ \  ]]..col.Black[[|  Type ? for help                               ]]..[[ 
- /_/  \___/_/  \__/_//_/  ]]..col.Black[[|  ]]..col.blue[[https://github.com/torch        ]]..[[ 
-                          ]]..col.Black[[|  ]]..col.blue[[http://torch.ch                 ]]..[[ 
+  / / / _ \/ __/ __/ _ \  ]]..col.Black[[|  Type ? for help]]..[[ 
+ /_/  \___/_/  \__/_//_/  ]]..col.Black[[|  ]]..col.blue[[https://github.com/torch]]..[[ 
+                          ]]..col.Black[[|  ]]..col.blue[[http://torch.ch]]..[[ 
  
 ]] .. col.red('WARNING: ') .. col.Black('you are running an experimental asynchronous interpreter for Torch.') .. [[ 
 ]] .. col.Black('Note 1: It has no support for readline/completion yet.') .. [[ 
@@ -179,11 +179,11 @@ else
    print(
 [[
  
-  ______             __   ]]..col.Black[[|  Torch7                                        ]]..[[ 
+  ______             __   ]]..col.Black[[|  Torch7]]..[[ 
  /_  __/__  ________/ /   ]]..col.Black[[|  ]]..col.magenta[[Scientific computing for Lua.]]..[[ 
-  / / / _ \/ __/ __/ _ \  ]]..col.Black[[|  Type ? for help                               ]]..[[ 
- /_/  \___/_/  \__/_//_/  ]]..col.Black[[|  ]]..col.blue[[https://github.com/torch        ]]..[[ 
-                          ]]..col.Black[[|  ]]..col.blue[[http://torch.ch                 ]]..[[ 
+  / / / _ \/ __/ __/ _ \  ]]..col.Black[[|  Type ? for help]]..[[ 
+ /_/  \___/_/  \__/_//_/  ]]..col.Black[[|  ]]..col.blue[[https://github.com/torch]]..[[ 
+                          ]]..col.Black[[|  ]]..col.blue[[http://torch.ch]]..[[ 
 ]]
 )
 
diff --git a/trepl-scm-1.rockspec b/trepl-scm-1.rockspec
index 54269b0..76fdb60 100644
--- a/trepl-scm-1.rockspec
+++ b/trepl-scm-1.rockspec
@@ -35,15 +35,23 @@ build = {
       }
    },
    platforms = {
+      freebsd = {
+             modules = {
+                  ['readline'] = {
+                    incdirs = {'/usr/local/include'},
+                    libdirs = {'/usr/local/lib'}
+                  }
+             }
+      },
       windows = {
 	     modules = {
 		    ['readline'] = {
                sources = {'readline.c'},
                libraries = {'readline'},
-			   defines = {"USE_READLINE_STATIC"},
-               incdirs = {"windows"},
-               libdirs = {"windows"},
-               libraries = {'readline-win'}
+               defines = {"WinEditLine"},
+               incdirs = {"..\\..\\win-files\\3rd\\wineditline-2.101\\include"},
+               libdirs = {"..\\..\\win-files\\3rd\\wineditline-2.101\\lib64"},
+               libraries = {'edit_static', 'user32'}
 			}
 		 }
 	  }
diff --git a/utils.c b/utils.c
index 62a3e4e..b446051 100644
--- a/utils.c
+++ b/utils.c
@@ -13,7 +13,7 @@
 
 int treplutils_isatty(lua_State *L)
 {
-  lua_pushboolean(L, 0);
+  lua_pushboolean(L, _isatty(1));
   return 1;
 }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/lua-torch-trepl.git



More information about the debian-science-commits mailing list