Skip to content

Commit 202742d

Browse files
committed
Merge branch 'develop' into feature-lcb_foreign_types
Conflicts: libscript/libscript.xcodeproj/project.pbxproj libscript/libstdscript-modules.list toolchain/lc-compile/lc-compile.xcodeproj/project.pbxproj
2 parents ed38b56 + da1446d commit 202742d

63 files changed

Lines changed: 1228 additions & 1671 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ xcuserdata/
8686
_build/
8787
_cache/
8888
build/
89+
/_tests/
8990

9091
# SDKs #
9192
#################

Makefile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,11 @@ lc-test: libstdscript libfoundation
215215
$(MAKE) -C ./toolchain lc-test
216216

217217
########## Tests
218-
lc-test-check: lc-test
218+
lc-run-check: lc-compile lc-run
219+
$(MAKE) -C ./tests/lc-run check
220+
lc-test-check: lc-compile lc-test
219221
$(MAKE) -C ./toolchain lc-test-check
220-
.PHONY: mlc-check
222+
.PHONY: lc-run-check lc-test-check
221223

222224
###############################################################################
223225
# All Targets
@@ -239,7 +241,7 @@ thirdparty: libffi libz libjpeg libpcre libpng libgif libopenssl libskia
239241
thirdparty: libcairopdf libpq libmysql libsqlite libiodbc libxml libxslt
240242
thirdparty: libzip
241243

242-
check: lc-test-check
244+
check: lc-run-check lc-test-check
243245

244246
clean:
245247
-rm -rf _build/linux _cache/linux

contrib/TextWrangler/LiveCodeBuilder.plist

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

contrib/emacs/livecode-mode.el

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
;; Copyright (C) 2015 Runtime Revolution Ltd.
2+
3+
;; This file is part of LiveCode.
4+
5+
;; LiveCode is free software; you can redistribute it and/or modify it
6+
;; under the terms of the GNU General Public License v3 as published
7+
;; by the Free Software Foundation.
8+
9+
;; LiveCode is distributed in the hope that it will be useful, but
10+
;; WITHOUT ANY WARRANTY; without even the implied warranty of
11+
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12+
;; General Public License for more details.
13+
14+
;; You should have received a copy of the GNU General Public License
15+
;; along with LiveCode. If not see <http://www.gnu.org/licenses/>.
16+
17+
;;;###autoload
18+
(add-to-list 'auto-mode-alist '("\\.mlc\\'" . livecode-mode))
19+
20+
(defvar livecode-mode-syntax-table
21+
(let ((st (make-syntax-table)))
22+
;; Comments
23+
(modify-syntax-entry ?/ ". 14b" st)
24+
(modify-syntax-entry ?* ". 23b" st)
25+
(modify-syntax-entry ?\- "<" st)
26+
(modify-syntax-entry ?\n ">" st)
27+
;; Angle brackets
28+
(modify-syntax-entry ?< "(" st)
29+
(modify-syntax-entry ?> ")" st)
30+
st)
31+
"Syntax table for LiveCode mode")
32+
33+
(defvar livecode-keywords
34+
'("variable" "syntax" "begin" "end" "phrase" "operator"
35+
"foreign" "handler" "prefix" "postfix" "precedence" "statement"
36+
"undefined" "public" "neutral" "binds to" "optional"
37+
"any" "private" "if" "else" "then" "repeat" "metadata" "widget" "module"
38+
"version" "author" "title" "true" "false" "return" "as" "use" "type"))
39+
40+
(defvar livecode-builtins
41+
'("output" "input"
42+
"bool" "boolean"
43+
"int" "number" "real" "double" "float"
44+
"string" "data" "list" "map" "pointer" "is" "empty"))
45+
46+
(defvar livecode-font-lock-defaults
47+
(let ((symbol-regexp "\\_<\\(\\(?:\\s_\\|\\w\\)*\\)\\_>"))
48+
`((
49+
;; stuff between "
50+
("\"\\.\\*\\?" . font-lock-string-face)
51+
52+
;; Keywords and builtins
53+
( ,(regexp-opt livecode-keywords 'symbols) . font-lock-keyword-face)
54+
( ,(regexp-opt livecode-builtins 'symbols) . font-lock-builtin-face)
55+
56+
;; "as" expressions
57+
("\\_<as\\s-+\\(\\(?:\\s_\\|\\w\\)*\\)\\_>" 1 font-lock-type-face)
58+
59+
;; handler definitions including parameter names
60+
( ,(concat "^\\s-*\\(\\_<\\(public\\|foreign\\)\\_>\\s-+\\)?\\_<handler\\_>\\s-+" symbol-regexp)
61+
(3 font-lock-function-name-face nil)
62+
( ,(concat "\\(" (regexp-opt '("in" "out" "inout") 'symbols) "\\)"
63+
"\\s-+" symbol-regexp)
64+
nil nil
65+
(3 font-lock-variable-name-face)
66+
(2 font-lock-keyword-face)))
67+
68+
;; variable names
69+
( ,(concat "^\\s-*\\_<variable\\_>\\s-*" symbol-regexp)
70+
(1 font-lock-variable-name-face))
71+
72+
;; syntax definitions
73+
( ,(concat "^\\s-*\\_<syntax\\_>\\s-+" symbol-regexp)
74+
(1 font-lock-function-name-face)
75+
("\\_<is\\_>" nil nil (0 font-lock-keyword-face t)))
76+
))))
77+
78+
(define-derived-mode livecode-mode prog-mode "LiveCode builder source"
79+
"Major mode for editing LiveCode builder source files"
80+
:syntax-table livecode-mode-syntax-table
81+
82+
(setq font-lock-defaults livecode-font-lock-defaults)
83+
84+
(set (make-local-variable 'comment-start) "--")
85+
(set (make-local-variable 'comment-end) "")
86+
)
87+
88+
(provide 'livecode-mode)

engine/engine.xcodeproj/project.pbxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2451,6 +2451,7 @@
24512451
BEF9B8641A3758C000D3B706 /* pt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt; path = rsrc/pt.lproj/Localisation.strings; sourceTree = "<group>"; };
24522452
BEFE81D317B2B32800C9D14F /* dskmac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = dskmac.cpp; path = src/dskmac.cpp; sourceTree = "<group>"; };
24532453
C74D7EE51A263A2200BC7FE8 /* libffi.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libffi.a; path = /Users/peterbrett/git/livecode/thirdparty/libffi/../../_build/mac/Debug/libffi.a; sourceTree = "<absolute>"; };
2454+
C77AA9811A83868600AAE40E /* libkernel-modules.list */ = {isa = PBXFileReference; lastKnownFileType = text; path = "libkernel-modules.list"; sourceTree = "<group>"; };
24542455
E8189EB515D17E8000194F25 /* exec-logic.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = "exec-logic.cpp"; path = "src/exec-logic.cpp"; sourceTree = "<group>"; };
24552456
E82206E0184F810A00117D10 /* resolution.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = resolution.cpp; path = src/resolution.cpp; sourceTree = "<group>"; };
24562457
E864B41F15BDAB3F00F5361C /* legacy_spec.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = legacy_spec.cpp; path = src/legacy_spec.cpp; sourceTree = "<group>"; };
@@ -3145,6 +3146,7 @@
31453146
4D79B7291A275A7C00DD750C /* Modules */ = {
31463147
isa = PBXGroup;
31473148
children = (
3149+
C77AA9811A83868600AAE40E /* libkernel-modules.list */,
31483150
4DD9D7661A3B185A0006366D /* engine.mlc */,
31493151
4D79B8AA1A37104800DD750C /* widget.mlc */,
31503152
4D79B7301A275ADE00DD750C /* canvas.mlc */,

engine/src/deploy.cpp

Lines changed: 40 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ bool MCDeployWriteCapsule(const MCDeployParameters& p_params, MCDeployFileRef p_
241241

242242
// Add any redirects
243243
if (t_success)
244-
for(uint32_t i = 0; i < MCArrayGetCount(p_params.redirects) && t_success; i++)
244+
for(uindex_t i = 0; i < MCArrayGetCount(p_params.redirects) && t_success; i++)
245245
{
246246
MCValueRef t_val;
247247
/* UNCHECKED */ MCArrayFetchValueAtIndex(p_params.redirects, i + 1, t_val);
@@ -252,14 +252,11 @@ bool MCDeployWriteCapsule(const MCDeployParameters& p_params, MCDeployFileRef p_
252252

253253
// Add all the modules before the stacks, this is so that widgets can resolve
254254
// themselves on load.
255-
uindex_t t_module_file_count;
256-
MCDeployFileRef *t_module_files;
257-
t_module_file_count = 0;
258-
t_module_files = nil;
255+
MCAutoArray<MCDeployFileRef> t_module_files;
259256
if (t_success)
260-
t_success = MCMemoryNewArray(MCArrayGetCount(p_params . modules), t_module_files, t_module_file_count);
257+
t_success = t_module_files . New(MCArrayGetCount(p_params . modules));
261258
if (t_success)
262-
for(uint32_t i = 0; i < MCArrayGetCount(p_params.modules) && t_success; i++)
259+
for(uindex_t i = 0; i < MCArrayGetCount(p_params.modules) && t_success; i++)
263260
{
264261
MCValueRef t_module_filename;
265262
/* UNCHECKED */ MCArrayFetchValueAtIndex(p_params .modules, i + 1, t_module_filename);
@@ -278,11 +275,17 @@ bool MCDeployWriteCapsule(const MCDeployParameters& p_params, MCDeployFileRef p_
278275
t_iterator = 0;
279276
while(t_success && MCEngineIterateExtensionFilenames(t_iterator, t_filename))
280277
{
281-
t_success = MCMemoryResizeArray(t_module_file_count + 1, t_module_files, t_module_file_count);
282-
if (t_success && !MCDeployFileOpen(t_filename, kMCOpenFileModeRead, t_module_files[t_module_file_count - 1]))
278+
MCDeployFileRef t_file;
279+
t_file = nil;
280+
if (t_success &&
281+
!MCDeployFileOpen(t_filename, kMCOpenFileModeRead, t_file))
283282
t_success = MCDeployThrow(kMCDeployErrorNoModule);
284283
if (t_success)
285-
t_success = MCDeployCapsuleDefineFromFile(t_capsule, kMCCapsuleSectionTypeModule, t_module_files[t_module_file_count - 1]);
284+
t_success = t_module_files . Push(t_file);
285+
if (t_success)
286+
t_success = MCDeployCapsuleDefineFromFile(t_capsule, kMCCapsuleSectionTypeModule, t_file);
287+
if (!t_success && t_file != nil)
288+
MCDeployFileClose(t_file);
286289
}
287290
}
288291

@@ -293,12 +296,11 @@ bool MCDeployWriteCapsule(const MCDeployParameters& p_params, MCDeployFileRef p_
293296
t_success = MCDeployCapsuleDefineFromFile(t_capsule, kMCCapsuleSectionTypeStack, t_stackfile);
294297

295298
// Now we add the auxillary stackfiles, if any
296-
MCDeployFileRef *t_aux_stackfiles;
297-
t_aux_stackfiles = nil;
299+
MCAutoArray<MCDeployFileRef> t_aux_stackfiles;
298300
if (t_success)
299-
t_success = MCMemoryNewArray(MCArrayGetCount(p_params . auxillary_stackfiles), t_aux_stackfiles);
301+
t_success = t_aux_stackfiles . New(MCArrayGetCount(p_params . auxillary_stackfiles));
300302
if (t_success)
301-
for(uint32_t i = 0; i < MCArrayGetCount(p_params.auxillary_stackfiles) && t_success; i++)
303+
for(uindex_t i = 0; i < MCArrayGetCount(p_params.auxillary_stackfiles) && t_success; i++)
302304
{
303305
MCValueRef t_val;
304306
/* UNCHECKED */ MCArrayFetchValueAtIndex(p_params.auxillary_stackfiles, i + 1, t_val);
@@ -310,7 +312,7 @@ bool MCDeployWriteCapsule(const MCDeployParameters& p_params, MCDeployFileRef p_
310312

311313
// Now add the externals, if any
312314
if (t_success)
313-
for(uint32_t i = 0; i < MCArrayGetCount(p_params.externals) && t_success; i++)
315+
for(uindex_t i = 0; i < MCArrayGetCount(p_params.externals) && t_success; i++)
314316
{
315317
MCValueRef t_val;
316318
/* UNCHECKED */ MCArrayFetchValueAtIndex(p_params.externals, i + 1, t_val);
@@ -334,12 +336,10 @@ bool MCDeployWriteCapsule(const MCDeployParameters& p_params, MCDeployFileRef p_
334336
t_success = MCDeployCapsuleGenerate(t_capsule, p_output, t_spill, x_offset);
335337

336338
MCDeployCapsuleDestroy(t_capsule);
337-
for(uint32_t i = 0; i < MCArrayGetCount(p_params.auxillary_stackfiles); i++)
339+
for(uindex_t i = 0; i < t_aux_stackfiles . Size(); i++)
338340
MCDeployFileClose(t_aux_stackfiles[i]);
339-
MCMemoryDeleteArray(t_aux_stackfiles);
340-
for(uint32_t i = 0; i < MCArrayGetCount(p_params.modules); i++)
341-
MCDeployFileClose(t_module_files[i]);
342-
MCMemoryDeleteArray(t_module_files);
341+
for(uindex_t i = 0; i < t_module_files . Size(); i++)
342+
MCDeployFileClose(t_module_files[i]);
343343
MCDeployFileClose(t_spill);
344344
MCDeployFileClose(t_stackfile);
345345

@@ -441,6 +441,7 @@ bool MCDeployWritePayload(const MCDeployParameters& p_params, bool p_to_network,
441441
MCIdeDeploy::MCIdeDeploy(void)
442442
{
443443
m_params = NULL;
444+
m_platform = PLATFORM_NONE;
444445
}
445446

446447
MCIdeDeploy::~MCIdeDeploy(void)
@@ -565,6 +566,7 @@ void MCIdeDeploy::exec_ctxt(MCExecContext& ctxt)
565566
MCIdeSign::MCIdeSign(void)
566567
{
567568
m_params = NULL;
569+
m_platform = PLATFORM_NONE;
568570
}
569571

570572
MCIdeSign::~MCIdeSign(void)
@@ -666,6 +668,7 @@ void MCIdeSign::exec_ctxt(MCExecContext &ctxt)
666668
MCIdeDiet::MCIdeDiet(void)
667669
{
668670
m_params = NULL;
671+
m_platform = PLATFORM_NONE;
669672
}
670673

671674
MCIdeDiet::~MCIdeDiet(void)
@@ -789,8 +792,11 @@ void MCIdeDmgDump::exec_ctxt(MCExecContext &ctxt)
789792
}
790793
FILE *t_output;
791794
t_output = fopen("C:\\Users\\Mark\\Desktop\\dmg.txt", "w");
792-
MCDeployDmgDump(*temp, stdfile_log, t_output);
793-
fclose(t_output);
795+
if (t_output != nil)
796+
{
797+
MCDeployDmgDump(*temp, stdfile_log, t_output);
798+
fclose(t_output);
799+
}
794800
}
795801
}
796802

@@ -836,20 +842,15 @@ void MCIdeDmgBuild::exec_ctxt(MCExecContext& ctxt)
836842
return;
837843
}
838844

839-
MCDeployDmgItem *t_items;
840-
uint32_t t_item_count;
841-
t_items = nil;
842-
t_item_count = 0;
845+
MCAutoArray<MCDeployDmgItem> t_items;
843846
if (!ctxt . HasError())
844847
{
845-
if (MCMemoryNewArray(MCArrayGetCount(*t_array), t_items))
846-
t_item_count = MCArrayGetCount(*t_array);
847-
else
848-
ctxt . Throw();
848+
if (!t_items . New(MCArrayGetCount(*t_array)))
849+
ctxt . Throw();
849850
}
850851

851852
if (!ctxt . HasError())
852-
for(uint32_t i = 0; i < t_item_count && !ctxt . HasError(); i++)
853+
for(uindex_t i = 0; i < t_items . Size() && !ctxt . HasError(); i++)
853854
{
854855
MCValueRef t_val = nil;
855856
if (!MCArrayFetchValueAtIndex(*t_array, i + 1, t_val))
@@ -915,8 +916,8 @@ void MCIdeDmgBuild::exec_ctxt(MCExecContext& ctxt)
915916
return;
916917
}
917918
MCDeployDmgParameters t_params;
918-
t_params . items = t_items;
919-
t_params . item_count = t_item_count;
919+
t_params . items = t_items . Ptr();
920+
t_params . item_count = t_items . Size();
920921
t_params . output = *temp;
921922
if (!MCDeployDmgBuild(t_params))
922923
ctxt . Throw();
@@ -972,20 +973,18 @@ void MCIdeExtract::exec_ctxt(MCExecContext& ctxt)
972973
MCAutoStringRef t_filename;
973974
if (!ctxt . EvalExprAsStringRef(m_filename, EE_IDE_EXTRACT_BADFILENAME, &t_filename))
974975
return;
975-
976+
976977
void *t_data;
977978
uint32_t t_data_size;
978979
Exec_stat t_stat;
979-
if (!ctxt . HasError())
980-
t_stat = MCDeployExtractMacOSX(*t_filename, *t_segment, *t_section, t_data, t_data_size);
981-
982-
if (t_stat == ES_NORMAL)
983-
{
980+
t_stat = MCDeployExtractMacOSX(*t_filename, *t_segment, *t_section, t_data, t_data_size);
981+
if (t_stat == ES_NORMAL)
982+
{
984983
MCAutoStringRef t_string;
985984
/* UNCHECKED */ MCStringCreateWithNativeChars((const char_t*)t_data, t_data_size, &t_string);
986985
ctxt . SetItToValue(*t_string);
987-
}
988-
else
986+
}
987+
else
989988
ctxt . SetItToEmpty();
990989
}
991990

engine/src/deploy_dmg.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -669,10 +669,12 @@ static uint32_t unix_date_to_hfs_date(uint32_t p_date)
669669

670670
Exec_stat MCDeployDmgBuild(MCDeployDmgParameters& p_params)
671671
{
672+
return ES_NORMAL;
673+
674+
#if 0
672675
bool t_success;
673676
t_success = true;
674677

675-
#if 0
676678
// Open the output file
677679
MCDeployFileRef t_output;
678680
t_output = nil;
@@ -1282,9 +1284,9 @@ Exec_stat MCDeployDmgBuild(MCDeployDmgParameters& p_params)
12821284
MCMemoryDeleteArray(t_leaves);
12831285

12841286
MCDeployFileClose(t_output);
1285-
#endif
1286-
1287+
12871288
return t_success ? ES_NORMAL : ES_ERROR;
1289+
#endif
12881290
}
12891291

12901292
////////////////////////////////////////////////////////////////////////////////

engine/src/deploy_linux.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ static bool MCDeployToLinuxReadString(MCDeployFileRef p_file, typename T::Shdr&
621621
if (t_success)
622622
r_string = t_buffer;
623623
else
624-
delete t_buffer;
624+
free(t_buffer);
625625

626626
return t_success;
627627
}
@@ -686,7 +686,7 @@ Exec_stat MCDeployToELF(const MCDeployParameters& p_params, bool p_is_android)
686686
typename T::Shdr *t_project_section, *t_payload_section;
687687
t_project_section = NULL;
688688
t_payload_section = NULL;
689-
for(uint32_t i = 0; i < t_header . e_shnum && t_project_section == NULL && t_success; i++)
689+
for(uint32_t i = 0; i < t_success && t_header . e_shnum && t_project_section == NULL && t_success; i++)
690690
{
691691
char *t_section_name;
692692
t_success = MCDeployToLinuxReadString<T>(t_engine, t_section_headers[t_header . e_shstrndx], t_section_headers[i] . sh_name, t_section_name);
@@ -724,7 +724,7 @@ Exec_stat MCDeployToELF(const MCDeployParameters& p_params, bool p_is_android)
724724
// that segment must be the last.
725725
typename T::Phdr *t_project_segment;
726726
t_project_segment = NULL;
727-
for(uint32_t i = 0; i < t_header . e_phnum && t_success; i++)
727+
for(uint32_t i = 0; t_success && i < t_header . e_phnum; i++)
728728
if (t_project_section -> sh_addr >= t_program_headers[i] . p_vaddr &&
729729
t_project_section -> sh_addr + t_project_section -> sh_size <= t_program_headers[i] . p_vaddr + t_program_headers[i] . p_memsz)
730730
{

0 commit comments

Comments
 (0)