New Stack Format Idea

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, LCMark

Locked
SirWobbyTheFirst
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 239
Joined: Tue Jun 30, 2009 11:15 pm

New Stack Format Idea

Post by SirWobbyTheFirst » Wed Jul 17, 2013 7:22 pm

Hey folks, I have an idea for when you get around to working on the newer engine and thus a newer stack format and that is, what if we could load a stack into the memory using a sequence of bytes. Now the grounds for this idea are that I believe the way a stack works is that it is effectively a data structure that is serialized to disk, I've worked with serialization in Java for University and I think this would be a great addition.

If for example, I am going to store all the files I have for a stack into a ZIP archive and have just the ZIP and the built executable on the users hard drive, it would be great if I could just read in a stack from the ZIP (Without extracting to a temporary location) and store the binary data in a variable and then pass this to the engine to be constructed into the in memory version of the stack, effectively, something akin to this:

Code: Select all

// The code that would go here would read the file from the ZIP archive and store it in a variable called tStackData
Put The Short Name Of Stack tStackData Into tStackName
The engine would then take the data and reconstruct the stack in the memory as if it had just read it in as a normal file. I think people would benefit from this, because in the example above, a ZIP file could keep the disk space occupied down if someone built a really big LiveCode app, personally I would use this sort of thing as virtual file system for Xenon, it would give me the opportunity to do things like file and folder ACLs.

monte
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1564
Joined: Fri Jan 13, 2012 1:47 am
Contact:

Re: New Stack Format Idea

Post by monte » Wed Jul 17, 2013 9:21 pm

try it, you might be pleasantly surprised by:

Code: Select all

go stack <stackdata>
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

SirWobbyTheFirst
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 239
Joined: Tue Jun 30, 2009 11:15 pm

Re: New Stack Format Idea

Post by SirWobbyTheFirst » Wed Jul 17, 2013 10:20 pm

Hmm, I noticed Go To works, but not Put The Short Name Of Stack, which is what I tend to use to load stacks into the memory, so half way there. :P

monte
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1564
Joined: Fri Jan 13, 2012 1:47 am
Contact:

Re: New Stack Format Idea

Post by monte » Thu Jul 18, 2013 3:02 am

can't you do some go invisible, close, set the visible to true trickery to get what you want?
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

SirWobbyTheFirst
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 239
Joined: Tue Jun 30, 2009 11:15 pm

Re: New Stack Format Idea

Post by SirWobbyTheFirst » Thu Jul 18, 2013 9:45 am

Hmm, i could do something like that, its just I believe the idea that the lower the number of lines of code, the better an application will run. But I've got something like this:

Code: Select all

// assuming again that the binary data is stored in tStackData.
Lock Messages // Because we don't want any execution just yet, besides Xenon and Nix have different ways of beginning execution.
Go Invisible Stack tStackData // Not sure if that would work as I'm using my phone and don't have access to LC to test.
Put The Short Name Of Stack tStackData Into tStackName // Again not sure if it would work, but Xenon needs to know the name of the stack to do some pre requisite stuff first before it can begin execution.
Close Stack tStackName
Unlock Messages
Monte do you think you could test something like this out for me please, I'm pretty much busy with people stuff all day and won't have any access to LC or my main rig.

Thanks.

EDIT: Nevermind, I got a chance to have a look but it doesn't work, it basically yields "create: no file name supplied" I know I can pull a list of stacks and just compare the difference between the two but I think it would be nicer if the engine had the functionality built in.

Locked

Return to “Engine Contributors”