Livecode under the hood

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, LCMark

Locked
MarcVanCauwenberghe
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 142
Joined: Thu Feb 21, 2013 8:47 am

Livecode under the hood

Post by MarcVanCauwenberghe » Sat Aug 17, 2013 2:41 pm

Hi,

Although not completely on topic and you can chase me off if you want to...

I would like to know how Livecode does what it does to better understand it, to make externals, etc..
Is this a secret? Or is it explained somewhere.

Best regards,
Marc

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9837
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Livecode under the hood

Post by FourthWorld » Sat Aug 17, 2013 4:25 pm

Definitely not a secret - it's open source, after all. :)

The iOS externals guide is here:
http://livecode.com/developers/guides/externals/

Not sure where the desktop externals guide is, or the status of the Android externals API, which is in the works.

The source code for LiveCode is here:
https://github.com/runrev/livecode
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

MarcVanCauwenberghe
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 142
Joined: Thu Feb 21, 2013 8:47 am

Re: Livecode under the hood

Post by MarcVanCauwenberghe » Sat Aug 17, 2013 5:29 pm

Ok, I've seen those. But me curiosity lays somewhere else. Let me explain by a few questions.

On the one hand you have The livecode language and on the other end you have 'native code' that runs on several different operating systems.
I am presuming that the standalone Livecode is producing is 'native code' aand not some web code that runs everywhere.
Are there more than one compiler to do that?
Is the basic programming language C (I mean, is the Livecode language converted to C and then compiled) ?

Another question to better understand things. In the introduction of iOS External Guide, it says that you need a lower level language like C, C++ or Objective C.
But there is a Pascal around that can produce externals how does that work?
Presuming that that the externals are a 'compiled library of sorts' that are linked by an api then every language that is able to produce a OS compatible 'compiled library
of sorts can be used, can it?

Going on the above assumptions I can make an Android external with Basic4Android, can I?

Thanks for any answer

Best regards,
Marc
Last edited by MarcVanCauwenberghe on Sun Aug 18, 2013 7:50 am, edited 1 time in total.

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

Re: Livecode under the hood

Post by monte » Sat Aug 17, 2013 11:11 pm

MarcVanCauwenberghe wrote:I am presuming that the standalone Livecode is producing is 'native code' aand not some web code that runs everywhere.
A standalone is a compiled engine attached to a stackFile. The engines are pre-compiled C++ and you can find them in the Runtime folder inside the app bundle. Scripts are still parsed on first use by the engine in a standalone.
MarcVanCauwenberghe wrote:But there is a Pascal around that can produce externals how does that work?
Look here for the pascal api. I haven't used it.
http://www.runrevplanet.com/index.php?o ... &Itemid=65

I'm not sure if Scott is planning on working out pascal support in lcidl based externals (like the iOS Externals SDK) but if so it would be good to integrate it directly into the lcidl compiler.
MarcVanCauwenberghe wrote:Presuming that that the externals are a 'compiled library of sorts' that are like by an api then every language that is able to produce a OS compatible 'compiled library of sorts can be used, can it?
I guess so. The idea is that the language bindings are all eventually included in the lcidl compiler. I've been working on the java bindings for android and hopefully eventually desktop with @runrevmark.
MarcVanCauwenberghe wrote:Going on the above assumptions I can make an Android external with Android4Basic, can I?
What does it compile the app into? C or Java? It's probably easier to use Java for externals on Android I'd think.
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

MarcVanCauwenberghe
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 142
Joined: Thu Feb 21, 2013 8:47 am

Re: Livecode under the hood

Post by MarcVanCauwenberghe » Sun Aug 18, 2013 10:24 am

Hi,
some more observations, questions. Hope you don't mind. Livecode has become my new passion the last couple of months and I want to learn as much as possible as quickly as possible so I can make some contributions ;)
monte wrote: A standalone is a compiled engine attached to a stackFile. The engines are pre-compiled C++ and you can find them in the Runtime folder inside the app bundle. Scripts are still parsed on first use by the engine in a standalone.
So its a bit like VB6. VB6 was compiled into what was called p-code that was closer to machine code but still interpreted. The runtimes were compiled so when calling build in functions were machine code.
monte wrote: Look here for the pascal api. I haven't used it.
http://www.runrevplanet.com/index.php?o ... &Itemid=65
I'm not sure if Scott is planning on working out pascal support in lcidl based externals (like the iOS Externals SDK) but if so it would be good to integrate it directly into the lcidl compiler.
I have looked at Pascal SDK, no mention of a lcidl file. So does it have its own api to the engine?
monte wrote: I guess so. The idea is that the language bindings are all eventually included in the lcidl compiler. I've been working on the java bindings for android and hopefully eventually desktop with @runrevmark.
So the status on extending Livecode is:
iOS = working
Android = in development
Windows desktop = ???
Mac OS = in development
monte wrote: What does it compile the app into? C or Java? It's probably easier to use Java for externals on Android I'd think.
Compiles to native bytecode. No runtime libraries are required. APK files are exactly the same as APK files created with Java / Eclipse

Uploaded a small png with what I think the Livecode architecture look like. Care to comment someone?

Thanks for taking the time.

Beste regards,
Marc
Attachments
Livecode_Architecture.png

MarcVanCauwenberghe
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 142
Joined: Thu Feb 21, 2013 8:47 am

Re: Livecode under the hood

Post by MarcVanCauwenberghe » Tue Aug 20, 2013 6:55 am

Any more insights, comments...

Marc

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

Re: Livecode under the hood

Post by monte » Tue Aug 20, 2013 11:58 am

I don't know enough about Basic4Android so can't comment on that

There's two externals sdks. The newer lcidl version is working for most platforms but still evolving for android
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

MarcVanCauwenberghe
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 142
Joined: Thu Feb 21, 2013 8:47 am

Re: Livecode under the hood

Post by MarcVanCauwenberghe » Tue Aug 20, 2013 12:31 pm

Thank you Monte.
monte wrote:I don't know enough about Basic4Android so can't comment on that
Basic4Adroid is just an example. I am just trying to figure out what it takes to build an external or extension to Livecode.
monte wrote:There's two externals sdks. The newer lcidl version is working for most platforms but still evolving for android
So Pascal is in effect using the older sdk. Ok good to know.

Anyone else.

Is my assessment right with regards to
- VB6?
- status making externals?
- drawing I made?


Thanks,
Marc

LCMark
Livecode Staff Member
Livecode Staff Member
Posts: 1209
Joined: Thu Apr 11, 2013 11:27 am

Re: Livecode under the hood

Post by LCMark » Tue Aug 20, 2013 12:53 pm

In regards to similarity with VB6 - then yes, that is the current situation. When you build a standalone your stackfile is embedded in a standalone version of the engine, and loaded on startup.

In terms of making externals, then as @monte has said, we currently have two methods - the old style one (which is what the Pascal API is currently written against I believe), and the new style one we introduced for making iOS externals but is gradually evolving to the other platforms. The latter using an interface description file to describe the methods which the external exports, so that stub code can be generated to make writing them easier (all type conversion concerns are handled by the stub code).

In terms of getting Basic4Android working to build LiveCode externals then this should be possible - although it depends on what a compiled Basic4Android package looks like and whether it can be wrapped in the kind of package that the current Android external support we have needs.

In terms of the diagram, then this seems like a reasonable schematic of how things work now :)

MarcVanCauwenberghe
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 142
Joined: Thu Feb 21, 2013 8:47 am

Re: Livecode under the hood

Post by MarcVanCauwenberghe » Tue Aug 20, 2013 2:46 pm

@runrevmark. Thanks!!!

That cleared up a lot.
So making a standalone will bundle all, stack + engine + ... together in much the same way like a windows packer will pack an exe and dll's and such.
VB6 has off-course always has an external run time library and is in that way different.

Is my assessment for the status of being able to make extensions to Livecode correct?

Another conclusion one can make is that externals only live as long as they are not implemented in the engine. This is not a bad thing mind, just a bit of a challenge for the developer.
But maybe this is a topic for another discussion....

If anyone else has anything to add please do.
Thank you all. In about 2 hours another Summer Camp lesson, looking forward to it.

Best regards,
Marc

Locked

Return to “Engine Contributors”