lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


on 9/17/04 11:09 AM, David Given at <dg@cowlark.com> wrote:

> On Friday 17 September 2004 17:36, George Warner wrote:
> [...]
>> The bad news is that we compact our cvs system on every GM release to only
>> contain those releases (all the interim engineering builds are discarded).
>> In that process my original .lua source file got discarded. Any way to get
>> the source back? I'm sure the comments get stripped but if I could at least
>> get something close to the original source back then I could fix some bugs
>> I found and start merging some new code into the single source.
> 
> Wait --- you mean you actually discard all previous revisions out of your CVS
> repository? You can't just check out a version of the file from before you
> overwrote it?

Nope. All the changes are flattened into one revision so that when we diff
the production builds we only see what actually changed between those two
builds. All the original individual check in/out comment(s) are compressed
into a single note. Nothing is lost except anything that was changed again
before the final production build. The "final" change is the one that
counts. This works extremely well for us because it eliminates a lot of the
"noise". Also, since all check in's have to include a bug # we can always
refer to the bug database to read detailed info about any bug fixes that
actually ship (as opposed to bug fixes that get eliminated by a re-write).
This has proven to seriously raise the "signal to noise" ratio of CVS.

> That said, if you really *have* lost it, writing a decompiler shouldn't be
> that hard. Unfortunately the byte code format isn't really public, so it
> would take a fair bit of rummaging around in the source to find the format...
> the main problem is that you may well have lost all your local variable names
> and scoping information. I can't point you at anything offhand, but if you
> were to write one, I'm sure people would be grateful...

I was able to use the lua compiler to dump the tokens like this:

function <zebnig:2368> (11 instructions, 44 bytes at 0x11fc50)
1 param, 9 stacks, 0 upvalues, 5 locals, 2 constants, 0 functions
    1    [2369]    MOVE         1 0 0
    2    [2369]    LOADNIL      2 4 0
    3    [2369]    TFORPREP     1 5    ; to 9
    4    [2370]    GETGLOBAL    5 0    ; dprint
    5    [2370]    MOVE         6 3 0
    6    [2370]    LOADK        7 1    ; ":"
    7    [2370]    MOVE         8 4 0
    8    [2370]    CALL         5 4 1
    9    [2369]    TFORLOOP     1 0 1
    10    [2370]    JMP          0 -7    ; to 4
    11    [2372]    RETURN       0 1 0

But what would be the source for this function?

>> BTW: If you add goto/gosub to the language I'll never use it again.
> How do you feel about COME FROM?

Come again? ;-)

-- 
Enjoy,
George Warner,
Schizophrenic Optimization Scientist
Apple Developer Technical Support (DTS)