luac -l -l

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

luac -l -l

Farmbuyer
I keep forgetting about the handy "-l -l" behavior when producing
bytecode listings.  It doesn't appear to be documented anywhere for
5.1, unless I'm badly overlooking something (always a possibility).

The current lua-5.2.0-beta.tar.gz doesn't include the luac.1 *roff
source, so I couldn't check if it's been added there, but I was hoping
something simple could be added to the man page and to the usage
output, e.g.,

--- luac.c.orig
+++ luac.c
@@ -53,7 +53,7 @@
  fprintf(stderr,
   "usage: %s [options] [filenames]\n"
   "Available options are:\n"
-  "  -l       list\n"
+  "  -l       list (use \"-l -l\" for full listing)\n"
   "  -o name  output to file " LUA_QL("name") " (default is \"%s\")\n"
   "  -p       parse only\n"
   "  -s       strip debug information\n"

Reply | Threaded
Open this post in threaded view
|

Re: luac -l -l

Patrick Donnelly
On Fri, Oct 28, 2011 at 8:29 PM, Farmbuyer <[hidden email]> wrote:

> I keep forgetting about the handy "-l -l" behavior when producing
> bytecode listings.  It doesn't appear to be documented anywhere for
> 5.1, unless I'm badly overlooking something (always a possibility).
>
> The current lua-5.2.0-beta.tar.gz doesn't include the luac.1 *roff
> source, so I couldn't check if it's been added there, but I was hoping
> something simple could be added to the man page and to the usage
> output, e.g.,
>
> --- luac.c.orig
> +++ luac.c
> @@ -53,7 +53,7 @@
>  fprintf(stderr,
>   "usage: %s [options] [filenames]\n"
>   "Available options are:\n"
> -  "  -l       list\n"
> +  "  -l       list (use \"-l -l\" for full listing)\n"
>   "  -o name  output to file " LUA_QL("name") " (default is \"%s\")\n"
>   "  -p       parse only\n"
>   "  -s       strip debug information\n"

Wow. I've combed through most of the Lua source in my time here and
had no idea this existed. What a nifty feature.

It's not in the man page either. "-l -l" seems very weird from a unix
program standpoint. Perhaps a new option letter should be used. In any
case, documenting it would be great :).


--
- Patrick Donnelly

Reply | Threaded
Open this post in threaded view
|

Re: luac -l -l

David Manura
On Fri, Oct 28, 2011 at 10:18 PM, Patrick Donnelly <[hidden email]> wrote:
> On Fri, Oct 28, 2011 at 8:29 PM, Farmbuyer <[hidden email]> wrote:
>> I keep forgetting about the handy "-l -l" behavior when producing
>> bytecode listings.  It doesn't appear to be documented anywhere [...]
> Wow. I've combed through most of the Lua source in my time here and
> had no idea this existed. What a nifty feature.

Me and others too [1].

[1] http://lua-users.org/lists/lua-l/2011-07/msg00222.html

Reply | Threaded
Open this post in threaded view
|

Re: luac -l -l

Dirk Laurie-2
In reply to this post by Farmbuyer
2011/10/29 Farmbuyer <[hidden email]>:
> I keep forgetting about the handy "-l -l" behavior when producing
> bytecode listings.  It doesn't appear to be documented anywhere for
> 5.1, unless I'm badly overlooking something (always a possibility).
>
> The current lua-5.2.0-beta.tar.gz doesn't include the luac.1 *roff
> source, so I couldn't check if it's been added there,

Not shown by `luac-5.2 -h`.

D.

Reply | Threaded
Open this post in threaded view
|

Re: luac -l -l

Rena
In reply to this post by Patrick Donnelly
On Fri, Oct 28, 2011 at 20:18, Patrick Donnelly <[hidden email]> wrote:

> On Fri, Oct 28, 2011 at 8:29 PM, Farmbuyer <[hidden email]> wrote:
>> I keep forgetting about the handy "-l -l" behavior when producing
>> bytecode listings.  It doesn't appear to be documented anywhere for
>> 5.1, unless I'm badly overlooking something (always a possibility).
>>
>> The current lua-5.2.0-beta.tar.gz doesn't include the luac.1 *roff
>> source, so I couldn't check if it's been added there, but I was hoping
>> something simple could be added to the man page and to the usage
>> output, e.g.,
>>
>> --- luac.c.orig
>> +++ luac.c
>> @@ -53,7 +53,7 @@
>>  fprintf(stderr,
>>   "usage: %s [options] [filenames]\n"
>>   "Available options are:\n"
>> -  "  -l       list\n"
>> +  "  -l       list (use \"-l -l\" for full listing)\n"
>>   "  -o name  output to file " LUA_QL("name") " (default is \"%s\")\n"
>>   "  -p       parse only\n"
>>   "  -s       strip debug information\n"
>
> Wow. I've combed through most of the Lua source in my time here and
> had no idea this existed. What a nifty feature.
>
> It's not in the man page either. "-l -l" seems very weird from a unix
> program standpoint. Perhaps a new option letter should be used. In any
> case, documenting it would be great :).
>
>
> --
> - Patrick Donnelly
>
>

Well, I've seen a number of programs that have an option like "-v
verbose (repeat for more verbosity), but they usually write that as
-vv rather than -v -v...

--
Sent from my toaster.

Reply | Threaded
Open this post in threaded view
|

Re: luac -l -l

Luiz Henrique de Figueiredo
In reply to this post by Patrick Donnelly
> It's not in the man page either. "-l -l" seems very weird from a unix
> program standpoint.

Several programs do that for debug options. For example, ssh has

     -v      Verbose mode.  Causes ssh to print debugging messages about its
             progress.  This is helpful in debugging connection, authentica-
             tion, and configuration problems.  Multiple -v options increase
             the verbosity.  The maximum is 3.


Reply | Threaded
Open this post in threaded view
|

Re: luac -l -l

Farmbuyer
In reply to this post by Rena
On Sat, Oct 29, 2011 at 1:28 AM, HyperHacker <[hidden email]> wrote:
> Well, I've seen a number of programs that have an option like "-v
> verbose (repeat for more verbosity), but they usually write that as
> -vv rather than -v -v...

Same here.  Unfortunately, the option parsing for luac is extremely
simple, and cannot handle multiple-character options.  Moving to
something like getopt(3) would potentially limit portability, and
probably bloat the resulting program as well.  It's a tradeoff.

In any case, documentation of -l -l would be enough to make me happy.
(If the double letter thing bothers too many people, maybe consider
adding -L, with the same meaning as -l -l.)

Reply | Threaded
Open this post in threaded view
|

Re: luac -l -l

Matthew Wild
On 30 October 2011 16:29, Farmbuyer <[hidden email]> wrote:

> On Sat, Oct 29, 2011 at 1:28 AM, HyperHacker <[hidden email]> wrote:
>> Well, I've seen a number of programs that have an option like "-v
>> verbose (repeat for more verbosity), but they usually write that as
>> -vv rather than -v -v...
>
> Same here.  Unfortunately, the option parsing for luac is extremely
> simple, and cannot handle multiple-character options.  Moving to
> something like getopt(3) would potentially limit portability, and
> probably bloat the resulting program as well.  It's a tradeoff.
>

While we're on the subject (and no, I didn't know about -l -l either,
I'll be using it a lot now)...

Why does -l not imply -p? Is it really a common case that you want to
list /and/ compile? Maybe it's just me.

Regards,
Matthew

Reply | Threaded
Open this post in threaded view
|

Re: luac -l -l

Luiz Henrique de Figueiredo
> Why does -l not imply -p? Is it really a common case that you want to
> list /and/ compile? Maybe it's just me.

It does only when used without a filename, as in "luac -l".