From: "Sergey Ostanevich" <sergos@tarantool.org>
To: tarantool-patches@freelists.org
Cc: "Konstantin Osipov" <kostja@tarantool.org>,
"Alexander Turenko" <alexander.turenko@tarantool.org>,
"Cyrill Gorcunov" <gorcunov@gmail.com>
Subject: [tarantool-patches] Re: [tarantool-patches] [PATCH 1/6] box/console: Add mapping for direct symbols
Date: Mon, 09 Sep 2019 18:11:44 +0300 [thread overview]
Message-ID: <1568041904.757717225@f509.i.mail.ru> (raw)
In-Reply-To: <20190905212815.7311-2-gorcunov@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1536 bytes --]
Cyrill,
Why not to move the map_direct_symbols to the module level, so that creation and
fill of the table will happens only once and not at every call to the output handler?
>Пятница, 6 сентября 2019, 0:28 +03:00 от Cyrill Gorcunov <gorcunov@gmail.com>:
>
>Sole symbols (such as box.NULL) are not processed
>by serpent "custom" symbols feature, since they
>are not in table.
>
>Thus we should process them separately. Without it
>we have
>
> > require('console').set_default_output("lua,block")
> > ;
> > box.NULL
> > "cdata<void %*>: NULL";
>
>instead of
>
> > box.NULL
> > box.NULL;
>
>as it should be.
>
>Part-of #3834
>---
> src/box/lua/console.lua | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
>diff --git a/src/box/lua/console.lua b/src/box/lua/console.lua
>index 64086cf5b..22bafab3a 100644
>--- a/src/box/lua/console.lua
>+++ b/src/box/lua/console.lua
>@@ -46,6 +46,17 @@ output_handlers["lua"] = function(status, opts, ...)
> if not ... then
> return ""
> end
>+ -- Map internal symbols in case if they are
>+ -- not inside tables and serpent won't handle
>+ -- them properly.
>+ local map_direct_symbols = {
>+ [box.NULL] = 'box.NULL',
>+ }
>+ for k,v in pairs(map_direct_symbols) do
>+ if k == ... then
>+ return v
>+ end
>+ end
> --
> -- Map internal symbols which serpent doesn't know
> -- about to a known representation.
>--
>2.20.1
>
>
--
Sergey Ostanevich
[-- Attachment #2: Type: text/html, Size: 2268 bytes --]
next prev parent reply other threads:[~2019-09-09 15:11 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-05 21:28 [tarantool-patches] [PATCH v3 0/6] box/console: Improve lua mode for remote console Cyrill Gorcunov
2019-09-05 21:28 ` [tarantool-patches] [PATCH 1/6] box/console: Add mapping for direct symbols Cyrill Gorcunov
2019-09-09 15:11 ` Sergey Ostanevich [this message]
2019-09-09 15:54 ` [tarantool-patches] " Cyrill Gorcunov
2019-09-10 3:59 ` [tarantool-patches] Re[2]: [tarantool-patches] " Sergey Ostanevich
2019-09-05 21:28 ` [tarantool-patches] [PATCH 2/6] box/console: Add explicit output EOS mapping Cyrill Gorcunov
2019-09-05 21:28 ` [tarantool-patches] [PATCH 3/6] box/console: Refactor command handling Cyrill Gorcunov
2019-09-05 21:28 ` [tarantool-patches] [PATCH 4/6] box/console: Fix hang in remote console lua mode Cyrill Gorcunov
2019-09-05 21:28 ` [tarantool-patches] [PATCH 5/6] box/console: Provide console.eos() api Cyrill Gorcunov
2019-09-05 21:28 ` [tarantool-patches] [PATCH 6/6] box/console: Rename output_parse to parse_output Cyrill Gorcunov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1568041904.757717225@f509.i.mail.ru \
--to=sergos@tarantool.org \
--cc=alexander.turenko@tarantool.org \
--cc=gorcunov@gmail.com \
--cc=kostja@tarantool.org \
--cc=tarantool-patches@freelists.org \
--subject='[tarantool-patches] Re: [tarantool-patches] [PATCH 1/6] box/console: Add mapping for direct symbols' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox