Skip to content

Commit 56b6159

Browse files
[[ RefactorSyntax ]] All EP references removed - but in MCExpression
1 parent 5e1164d commit 56b6159

32 files changed

Lines changed: 197 additions & 156 deletions

engine/src/aclip.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,8 +374,7 @@ void MCAudioClip::init()
374374
if (supported)
375375
{
376376
uinteger_t t_loudness;
377-
MCExecPoint ep;
378-
MCExecContext ctxt(ep);
377+
MCExecContext ctxt(nil, nil, nil);
379378
getuintprop(ctxt, 0, P_PLAY_LOUDNESS, False, t_loudness);
380379
}
381380
}

engine/src/button.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3675,8 +3675,7 @@ void MCButton::setupmenu()
36753675

36763676
bool MCButton::selectedchunk(MCStringRef& r_string)
36773677
{
3678-
MCExecPoint ep(nil, nil, nil);
3679-
MCExecContext ctxt(ep);
3678+
MCExecContext ctxt(nil, nil, nil);
36803679
uinteger_t t_number;
36813680
GetNumber(ctxt, 0, t_number);
36823681

@@ -3687,8 +3686,7 @@ bool MCButton::selectedchunk(MCStringRef& r_string)
36873686

36883687
bool MCButton::selectedline(MCStringRef& r_string)
36893688
{
3690-
MCExecPoint ep(nil, nil, nil);
3691-
MCExecContext ctxt(ep);
3689+
MCExecContext ctxt(nil, nil, nil);
36923690
uinteger_t t_number;
36933691
GetNumber(ctxt, 0, t_number);
36943692

engine/src/debug.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ void MCB_setvar(MCExecContext &ctxt, MCValueRef p_value, MCNameRef name)
304304
}
305305

306306
MCParameter p1, p2, p3;
307-
p1.setn_argument(ctxt.GetEP().getline());
307+
p1.setn_argument(ctxt . GetLine());
308308
p1.setnext(&p2);
309309
p2.setvalueref_argument(name);
310310
p2.setnext(&p3);

engine/src/deploy_windows.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,9 +1084,8 @@ static uint64_t MCWindowsVersionInfoParseVersion(MCStringRef p_string)
10841084

10851085
static bool add_version_info_entry(void *p_context, MCArrayRef p_array, MCNameRef p_key, MCValueRef p_value)
10861086
{
1087-
MCWindowsVersionInfo *t_string;
1088-
MCExecPoint ep(NULL, NULL, NULL);
1089-
MCExecContext ctxt(ep);
1087+
MCWindowsVersionInfo *t_string;
1088+
MCExecContext ctxt(nil, nil, nil);
10901089
MCAutoStringRef t_value;
10911090
/* UNCHECKED */ ctxt . ConvertToString(p_value, &t_value);
10921091
byte_t *t_bytes;
@@ -1107,8 +1106,7 @@ static bool add_version_info_entry(void *p_context, MCArrayRef p_array, MCNameRe
11071106

11081107
static bool MCWindowsResourcesAddVersionInfo(MCWindowsResources& self, MCArrayRef p_info)
11091108
{
1110-
MCExecPoint ep(NULL, NULL, NULL);
1111-
MCExecContext ctxt(ep);
1109+
MCExecContext ctxt(nil, nil, nil);
11121110

11131111
bool t_success;
11141112
t_success = true;

engine/src/dispatch.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1570,8 +1570,7 @@ MCObject *MCDispatch::getobjname(Chunk_term type, MCNameRef p_name)
15701570
if (MCU_strchr(sptr, l, ':'))
15711571
{
15721572
MCresult->clear(False);
1573-
MCExecPoint ep(MCdefaultstackptr, NULL, NULL);
1574-
MCExecContext default_ctxt(ep);
1573+
MCExecContext default_ctxt(MCdefaultstackptr, nil, nil);
15751574
MCExecContext *ctxt = MCECptr == NULL ? &default_ctxt : MCECptr;
15761575

15771576
MCAutoStringRef t_output;
@@ -1769,9 +1768,8 @@ bool MCDispatch::dopaste(MCObject*& r_objptr, bool p_explicit)
17691768
{
17701769
MCAutoDataRef t_data;
17711770
if (MCclipboarddata -> Fetch(TRANSFER_TYPE_IMAGE, &t_data))
1772-
{
1773-
MCExecPoint ep(NULL, NULL, NULL);
1774-
MCExecContext ctxt(ep);
1771+
{
1772+
MCExecContext ctxt(nil, nil, nil);
17751773

17761774
MCImage *t_image;
17771775
t_image = new MCImage;
@@ -1806,9 +1804,8 @@ bool MCDispatch::dopaste(MCObject*& r_objptr, bool p_explicit)
18061804
{
18071805
MCAutoDataRef t_data;
18081806
if (MCclipboarddata -> Fetch(TRANSFER_TYPE_IMAGE, &t_data))
1809-
{
1810-
MCExecPoint ep(NULL, NULL, NULL);
1811-
MCExecContext ctxt(ep);
1807+
{
1808+
MCExecContext ctxt(nil, nil, nil);
18121809

18131810
t_objects = new MCImage(*MCtemplateimage);
18141811
t_objects -> open();

engine/src/dsklnxmain.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,9 @@ int main(int argc, char *argv[], char *envp[])
8686

8787
if (!X_init(argc, t_argv, t_envp))
8888
{
89-
MCExecPoint ep;
9089
if (MCresult != nil)
9190
{
92-
MCExecContext ctxt(ep);
91+
MCExecContext ctxt(nil, nil, nil);
9392
MCAutoValueRef t_result;
9493
MCAutoStringRef t_string;
9594
MCresult -> eval(ctxt, &t_result);

engine/src/exec-debugging.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ void MCDebuggingGetDebugContext(MCExecContext& ctxt, MCStringRef& r_value)
215215
t_success = MCListAppend(*t_list, MCexecutioncontexts[MCdebugcontext]->GetHandler()->getname());
216216

217217
if (t_success)
218-
t_success = MCListAppendInteger(*t_list, MCexecutioncontexts[MCdebugcontext]->GetEP().getline());
218+
t_success = MCListAppendInteger(*t_list, MCexecutioncontexts[MCdebugcontext] -> GetLine());
219219

220220
if (t_success)
221221
t_success = MCListCopyAsString(*t_list, r_value);
@@ -256,7 +256,7 @@ void MCDebuggingSetDebugContext(MCExecContext& ctxt, MCStringRef p_value)
256256
for (uint2 i = 0; i < MCnexecutioncontexts; i++)
257257
{
258258
if (MCexecutioncontexts[i] -> GetObject() == t_object . object &&
259-
MCexecutioncontexts[i] -> GetEP().getline() == t_line)
259+
MCexecutioncontexts[i] -> GetLine() == t_line)
260260
{
261261
MCdebugcontext = i;
262262
break;
@@ -315,7 +315,7 @@ void MCDebuggingGetExecutionContexts(MCExecContext& ctxt, MCStringRef& r_value)
315315
if (t_success)
316316
{
317317
MCAutoStringRef t_line;
318-
t_success = MCStringFormat(&t_line, "%d", MCexecutioncontexts[i]->GetEP().getline()) &&
318+
t_success = MCStringFormat(&t_line, "%d", MCexecutioncontexts[i] -> GetLine()) &&
319319
MCListAppend(*t_context, *t_line);
320320
}
321321

@@ -354,4 +354,4 @@ void MCDebuggingSetWatchedVariables(MCExecContext& ctxt, MCStringRef p_value)
354354
MCB_parsewatches(ctxt, p_value);
355355
}
356356

357-
////////////////////////////////////////////////////////////////////////////////
357+
////////////////////////////////////////////////////////////////////////////////

engine/src/exec-engine.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1597,16 +1597,14 @@ void MCEngineGetStacksInUse(MCExecContext& ctxt, MCStringRef &r_value)
15971597

15981598
bool MCEngineEvalValueAsObject(MCValueRef p_value, bool p_strict, MCObjectPtr& r_object, bool& r_parse_error)
15991599
{
1600-
MCExecPoint ep(nil,nil,nil);
1601-
MCExecContext ctxt(ep);
1600+
MCExecContext ctxt(nil, nil, nil);
16021601
MCAutoStringRef t_string;
16031602
ctxt . ConvertToString(p_value, &t_string);
1604-
MCScriptPoint sp(*t_string);
1603+
MCScriptPoint sp(ctxt, *t_string);
16051604

16061605
MCChunk *tchunk = new MCChunk(False);
16071606
MCerrorlock++;
16081607
Symbol_type type;
1609-
Exec_stat stat;
16101608

16111609
bool t_parse_error;
16121610
bool t_success;

engine/src/exec.cpp

Lines changed: 43 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ along with LiveCode. If not see <http://www.gnu.org/licenses/>. */
3030
#include "exec.h"
3131
#include "field.h"
3232
#include "variable.h"
33+
#include "handler.h"
34+
#include "hndlrlst.h"
3335

3436
#include "osspec.h"
3537

@@ -79,7 +81,7 @@ bool MCExecContext::ConvertToString(MCValueRef p_value, MCStringRef& r_string)
7981
t_buffer_size = 0;
8082

8183
uint32_t t_length;
82-
t_length = MCU_r8tos(t_buffer, t_buffer_size, MCNumberFetchAsReal((MCNumberRef)p_value), nffw, nftrailing, nfforce);
84+
t_length = MCU_r8tos(t_buffer, t_buffer_size, MCNumberFetchAsReal((MCNumberRef)p_value), m_nffw, m_nftrailing, m_nfforce);
8385

8486
bool t_success;
8587
t_success = MCStringCreateWithNativeCharsAndRelease((char_t *)t_buffer, t_length, r_string);
@@ -109,7 +111,7 @@ bool MCExecContext::ConvertToNumber(MCValueRef p_value, MCNumberRef& r_number)
109111
double t_number;
110112
t_number = 0.0;
111113
if (MCStringGetLength(MCNameGetString((MCNameRef)p_value)) != 0)
112-
if (!MCU_stor8(MCStringGetOldString(MCNameGetString((MCNameRef)p_value)), t_number, convertoctals))
114+
if (!MCU_stor8(MCStringGetOldString(MCNameGetString((MCNameRef)p_value)), t_number, m_convertoctals))
113115
break;
114116
return MCNumberCreateWithReal(t_number, r_number);
115117
}
@@ -118,7 +120,7 @@ bool MCExecContext::ConvertToNumber(MCValueRef p_value, MCNumberRef& r_number)
118120
double t_number;
119121
t_number = 0.0;
120122
if (MCStringGetLength((MCStringRef)p_value) != 0)
121-
if (!MCU_stor8(MCStringGetOldString((MCStringRef)p_value), t_number, convertoctals))
123+
if (!MCU_stor8(MCStringGetOldString((MCStringRef)p_value), t_number, m_convertoctals))
122124
break;
123125
return MCNumberCreateWithReal(t_number, r_number);
124126
}
@@ -171,7 +173,7 @@ bool MCExecContext::ConvertToBoolean(MCValueRef p_value, MCBooleanRef &r_boolean
171173
switch(MCValueGetTypeCode(p_value))
172174
{
173175
case kMCValueTypeCodeBoolean:
174-
r_boolean = MCValueRetain((MCBooleanRef)value);
176+
r_boolean = MCValueRetain((MCBooleanRef)p_value);
175177
return true;
176178
case kMCValueTypeCodeNull:
177179
case kMCValueTypeCodeArray:
@@ -302,8 +304,20 @@ bool MCExecContext::ConvertToLegacyColor(MCValueRef p_value, MCColor& r_color)
302304

303305
bool MCExecContext::ConvertToBool(MCValueRef p_value, bool& r_bool)
304306
{
305-
bool t = ConvertToBool(p_value, r_bool);
306-
return t;
307+
if ((MCBooleanRef)p_value == kMCTrue)
308+
{
309+
r_bool = true;
310+
return true;
311+
}
312+
313+
MCAutoBooleanRef t_boolean;
314+
if (ConvertToBoolean(p_value, &t_boolean))
315+
{
316+
r_bool = *t_boolean == kMCTrue;
317+
return true;
318+
}
319+
320+
return false;
307321
}
308322

309323
bool MCExecContext::ConvertToLegacyPoint(MCValueRef p_value, MCPoint& r_point)
@@ -615,6 +629,7 @@ bool MCExecContext::EvaluateExpression(MCExpression *p_expr, MCValueRef& r_resul
615629

616630
return true;
617631
}
632+
#endif
618633

619634
bool MCExecContext::TryToEvaluateExpression(MCExpression *p_expr, uint2 line, uint2 pos, Exec_errors p_error, MCValueRef& r_result)
620635
{
@@ -640,7 +655,6 @@ bool MCExecContext::TryToEvaluateExpression(MCExpression *p_expr, uint2 line, ui
640655
LegacyThrow(p_error);
641656
return false;
642657
}
643-
#endif
644658

645659
bool MCExecContext::TryToEvaluateParameter(MCParameter *p_param, uint2 line, uint2 pos, Exec_errors p_error, MCValueRef& r_result)
646660
{
@@ -1225,7 +1239,8 @@ bool MCExecContext::EnsurePrivacyIsAllowed(void)
12251239

12261240
////////////////////////////////////////////////////////////////////////////////
12271241

1228-
void MCExecContext::GetIt() const
1242+
// MW-2013-11-08: [[ RefactorIt ]] Returns the it var for the current context.
1243+
MCVarref* MCExecContext::GetIt() const
12291244
{
12301245
// If we have a handler, then get it from there.
12311246
if (m_curhandler != nil)
@@ -1257,6 +1272,26 @@ void MCExecContext::SetItToEmpty(void)
12571272

12581273
////////////////////////////////////////////////////////////////////////////////
12591274

1275+
// MW-2011-06-22: [[ SERVER ]] Provides augmented functionality for finding
1276+
// variables if there is no handler (i.e. global server scope).
1277+
Parse_stat MCExecContext::FindVar(MCNameRef p_name, MCVarref **r_var)
1278+
{
1279+
Parse_stat t_stat;
1280+
t_stat = PS_ERROR;
1281+
1282+
if (m_curhandler != NULL)
1283+
t_stat = m_curhandler -> findvar(p_name, r_var);
1284+
else if (m_hlist != NULL)
1285+
{
1286+
// MW-2011-08-23: [[ UQL ]] We are searching in global context, so do include UQLs.
1287+
t_stat = m_hlist -> findvar(p_name, false, r_var);
1288+
}
1289+
1290+
return t_stat;
1291+
}
1292+
1293+
////////////////////////////////////////////////////////////////////////////////
1294+
12601295
void MCExecContext::LegacyThrow(Exec_errors p_error, MCValueRef p_hint)
12611296
{
12621297
MCeerror -> add(p_error, 0, 0, p_hint);

engine/src/exec.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1169,6 +1169,7 @@ class MCExecContext
11691169
m_nffw = 8;
11701170
m_nftrailing = 6;
11711171
m_cutoff = 35;
1172+
m_stat = ES_NORMAL;
11721173
}
11731174

11741175
//////////
@@ -1460,7 +1461,13 @@ class MCExecContext
14601461
void SetItToEmpty(void);
14611462
void SetItToValue(MCValueRef p_value);
14621463

1463-
//////////
1464+
//////////
1465+
1466+
// MW-2011-06-22: [[ SERVER ]] Provides augmented functionality for finding
1467+
// variables if there is no handler (i.e. global server scope).
1468+
Parse_stat FindVar(MCNameRef p_name, MCVarref** r_var);
1469+
1470+
//////////
14641471

14651472
MCHandler *GetHandler(void) const
14661473
{

0 commit comments

Comments
 (0)