Understanding LiveCode Source [BOM Issue with livecodescript URLs]
brian at milby7.com
Sat Aug 5 16:12:04 EDT 2017
Is there anything posted that gives an overview of how the source code to
LiveCode works/is organized? I know that the source is all there and I can
read it, but that would take a long time :) I'm still learning C++ (been
many years, but I learned C while in college), but following the code
doesn't seem too bad.
I'm specifically looking at the parsing of livecodescript stacks with
BOMs. I think I know where the file is ultimately processed (the stream of
it anyway), but I can only work backward so far and get stuck.
So, I guess a more specific question would be where to start on the handoff
between the IDE and the engine. As an example, I can see that when you
turn off debug mode, the message box ends up with "send script pScript to
pObject". I want to follow the problem statements through to see where
they lead and compare what works to what doesn't.
I'm using the message box (single line) to test syntax. I get the same
results whether debug mode is on or off. The local file includes the UTF8
BOM (verified by getting the first 3 bytes). The actual file I'm using is
the Scriptifier (URL from an earlier thread). I get the same results for
"binfile:/" and "https://" forms, so I've only included one below. I
observe that "url" keyword is required (will need to adjust the
documentation syntax, looks to be the same back to at least 7).
So far I've observed the following fails silently (no error message
go [to] url "binfile:/...livecodescript" --should work
The following fail with an error (LC9 gives "message" as hint, LC8 gives
the actual script line as a hint "go..."):
go [to] [stack] "https:...livecode" --missing url
go [to] [stack] "binfile:/...livecodescript" --missing url
go [to] stack url "binfile:/...livecodescript" --should work
go [to] [stack] url "https:...livecode"
go [to] [stack] "/(full path)/Scriptifier.livecodescript"
go [to] [stack] byte 4 to -1 of url "binfile:/...livecodescript"
--assumes UTF8 BOM
The current develop build has the same issues (at least for me). I can see
in the code where it looks like the BOM should be accounted for
(MCDispatch::doreadfile or MCDispatch::trytoreadscriptonlystackofsize
depending on branch).
It looks like the URL keyword will correctly parse a binary stack, but
fails on livecodescript with a BOM. I put 2 files on a server that I
control (with and without the UTF8 BOM), and the livecodescript will load
fine from https:// if no BOM is included.
Apologize for the long post, but wanting to contribute to the community if
More information about the Use-livecode