Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Patch to "fix" Lua binding's debug.debug
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  7 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Rob Hoelz  
View profile  
 More options Sep 12 2011, 1:03 pm
From: Rob Hoelz <r...@hoelz.ro>
Date: Mon, 12 Sep 2011 12:03:34 -0500
Local: Mon, Sep 12 2011 1:03 pm
Subject: Patch to "fix" Lua binding's debug.debug

Hello Vim developers,

I noticed that Vim currently uses the stock implementation of Lua's
debug.debug() function in if_lua.c, which will cause Vim to seemingly
hang if called. I've written and attached a new implementation for
debug.debug() that will make it more usable in Vim if Lua scripters
want to make use of it.

Thanks,
Rob Hoelz

  vim-debug-debug.patch
2K Download

  signature.asc
< 1K Download

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rob Hoelz  
View profile  
 More options Sep 19 2011, 11:07 am
From: Rob Hoelz <rdho...@gmail.com>
Date: Mon, 19 Sep 2011 08:07:10 -0700 (PDT)
Local: Mon, Sep 19 2011 11:07 am
Subject: Re: Patch to "fix" Lua binding's debug.debug
On Sep 12, 12:03 pm, Rob Hoelz <r...@hoelz.ro> wrote:

Hello again,

It's been a week since I posted this patch, and I haven't seen any
response.  If you guys don't want to incorporate my patch into Vim,
that's ok; I'd just like to know if I need to fix anything up, or if
it needs to get vetted or something.

Thanks,
Rob


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dominique Pellé  
View profile  
 More options Sep 19 2011, 11:20 am
From: Dominique Pellé <dominique.pe...@gmail.com>
Date: Mon, 19 Sep 2011 17:20:51 +0200
Local: Mon, Sep 19 2011 11:20 am
Subject: Re: Patch to "fix" Lua binding's debug.debug

Hi Rob

Thanks for the patch.  I just checked ":help todo.txt" in Vim-7.3.315
and it includes a comment about your patch:

==== [ :help todo.txt ] ====
Patch for Lua debug(). (Rob Hoelz, 2011 Sep 12).
====

It's also near the top of the TODO list so chances are it will
be included soon.

Regards
-- Dominique


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rob Hoelz  
View profile   Translate to Translated (View Original)
 More options Sep 19 2011, 11:31 am
From: Rob Hoelz <rdho...@gmail.com>
Date: Mon, 19 Sep 2011 08:31:23 -0700 (PDT)
Local: Mon, Sep 19 2011 11:31 am
Subject: Re: Patch to "fix" Lua binding's debug.debug
On Sep 19, 10:20 am, Dominique Pellé <dominique.pe...@gmail.com>
wrote:

Ah, thanks for the clarfication!

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Luis Carvalho  
View profile  
 More options Sep 19 2011, 12:12 pm
From: Luis Carvalho <lexcarva...@gmail.com>
Date: Mon, 19 Sep 2011 12:12:37 -0400
Local: Mon, Sep 19 2011 12:12 pm
Subject: Re: Patch to "fix" Lua binding's debug.debug
Hi Rob,

> It's been a week since I posted this patch, and I haven't seen any
> response.  If you guys don't want to incorporate my patch into Vim,
> that's ok; I'd just like to know if I need to fix anything up, or if
> it needs to get vetted or something.

Sorry for the delay in checking your patch. Can you please check if this
luaV_debug works instead of your luaV_debug_debug? It's simpler and more in
line with Lua's original debug.debug:

    static int
luaV_debug (lua_State *L)
{
    lua_settop(L, 0);
    lua_getglobal(L, "vim");
    lua_getfield(L, -1, "eval");
    lua_remove(L, -2); /* vim.eval at position 1 */
    for (;;)
    {
        const char *input;
        size_t l;
        lua_pushvalue(L, 1); /* vim.eval */
        lua_pushliteral(L, "input('lua_debug> ')");
        lua_call(L, 1, 1, 0); /* return string */
        input = lua_tolstring(L, -1, &l);
        if (l == 0 || strcmp(input, "cont") == 0)
            return 0;
        if (luaL_loadbuffer(L, input, l, "=(debug command)") ||
                lua_pcall(L, 0, 0, 0))
            luaV_emsg(L);
        lua_settop(L, 1); /* remove eventual returns, but keep vim.eval */
    }

}

If it works, can you please also product a patch?

Cheers,
Luis

--
Computers are useless. They can only give you answers.
                -- Pablo Picasso

--
Luis Carvalho (Kozure)
lua -e 'print((("lexcarva...@NO.gmail.SPAM.com"):gsub("(%u+%.)","")))'


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rob Hoelz  
View profile  
 More options Sep 20 2011, 2:59 pm
From: Rob Hoelz <rdho...@gmail.com>
Date: Tue, 20 Sep 2011 11:59:48 -0700 (PDT)
Local: Tues, Sep 20 2011 2:59 pm
Subject: Re: Patch to "fix" Lua binding's debug.debug
On Sep 19, 11:12 am, Luis Carvalho <lexcarva...@gmail.com> wrote:

Hi Luis,

Thanks for your improvement to my patch; it works fine, except the
output from each command appears on the same line as the input.  The
following patch is based on yours,
but includes a fix for the same line behavior.

diff -r 15b934a16641 src/if_lua.c
--- a/src/if_lua.c      Wed Sep 14 19:04:40 2011 +0200
+++ b/src/if_lua.c      Tue Sep 20 13:58:15 2011 -0500
@@ -1069,6 +1069,31 @@
     {NULL, NULL}
 };

+  static int
+luaV_debug (lua_State *L)
+{
+    lua_settop(L, 0);
+    lua_getglobal(L, "vim");
+    lua_getfield(L, -1, "eval");
+    lua_remove(L, -2); /* vim.eval at position 1 */
+    for (;;)
+    {
+        const char *input;
+        size_t l;
+        lua_pushvalue(L, 1); /* vim.eval */
+        lua_pushliteral(L, "input('lua_debug> ')");
+        lua_call(L, 1, 1); /* return string */
+        msg_putchar('\n');
+        input = lua_tolstring(L, -1, &l);
+        if (l == 0 || strcmp(input, "cont") == 0)
+            return 0;
+        if (luaL_loadbuffer(L, input, l, "=(debug command)") ||
+                lua_pcall(L, 0, 0, 0))
+            luaV_emsg(L);
+        lua_settop(L, 1); /* remove eventual returns, but keep
vim.eval */
+    }
+}
+
     static int
 luaopen_vim(lua_State *L)
 {
@@ -1082,6 +1107,11 @@
     /* print */
     lua_pushcfunction(L, luaV_print);
     lua_setglobal(L, "print");
+    /* debug.debug */
+    lua_getglobal(L, "debug");
+    lua_pushcfunction(L, luaV_debug);
+    lua_setfield(L, -2, "debug");
+    lua_pop(L, 1);
     /* free */
     lua_pushlightuserdata(L, (void *) LUAVIM_FREE);
     lua_pushcfunction(L, luaV_free);

Thanks,
Rob


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Luis Carvalho  
View profile  
 More options Sep 20 2011, 6:16 pm
From: Luis Carvalho <lexcarva...@gmail.com>
Date: Tue, 20 Sep 2011 18:16:05 -0400
Local: Tues, Sep 20 2011 6:16 pm
Subject: Re: Patch to "fix" Lua binding's debug.debug

Hi Rob,

> Thanks for your improvement to my patch; it works fine, except the
> output from each command appears on the same line as the input.  The
> following patch is based on yours,
> but includes a fix for the same line behavior.

Ok, great. We still need to define lua_remove for the dynamic version of the
interpreter, so I'm updating the patch. I've also added a comment to
msg_putchar and moved the function definition closer to luaV_print.

Thanks,
Luis

--
Computers are useless. They can only give you answers.
                -- Pablo Picasso

--
Luis Carvalho (Kozure)
lua -e 'print((("lexcarva...@NO.gmail.SPAM.com"):gsub("(%u+%.)","")))'

  if-lua-debug.diff
2K Download

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »