Skip to content

Commit dab061f

Browse files
author
Fraser J. Gordon
committed
Merge remote-tracking branch 'upstream/refactor-syntax_unicode' into refactor-syntax_unicode_fetch
Conflicts: engine/src/deploy_sign.cpp
2 parents f06e1d2 + 4a22fdc commit dab061f

42 files changed

Lines changed: 330 additions & 374 deletions

Some content is hidden

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

engine/src/cmdse.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1168,6 +1168,7 @@ Exec_stat MCDispatchCmd::exec(MCExecPoint& ep)
11681168

11691169
return stat;
11701170
#endif /* MCDispatchCmd */
1171+
11711172
MCNewAutoNameRef t_message;
11721173
if (message -> eval(ep) != ES_NORMAL)
11731174
{
@@ -1203,9 +1204,10 @@ Exec_stat MCDispatchCmd::exec(MCExecPoint& ep)
12031204

12041205
if (t_var == NULL)
12051206
{
1207+
MCExecContext ctxt(ep);
12061208
tptr -> clear_argument();
12071209
while ((stat = tptr->eval(ep)) != ES_NORMAL && (MCtrace || MCnbreakpoints) && !MCtrylock && !MClockerrors)
1208-
MCB_error(ep, line, pos, EE_STATEMENT_BADPARAM);
1210+
MCB_error(ctxt, line, pos, EE_STATEMENT_BADPARAM);
12091211
if (stat != ES_NORMAL)
12101212
{
12111213
MCeerror->add(EE_STATEMENT_BADPARAM, line, pos);

engine/src/debug.cpp

Lines changed: 44 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ along with LiveCode. If not see <http://www.gnu.org/licenses/>. */
4444

4545
////////////////////////////////////////////////////////////////////////////////
4646

47-
MCExecPoint *MCEPptr;
47+
MCExecContext *MCECptr;
4848
MCStack *MCtracestackptr;
4949
Window MCtracewindow;
5050
Boolean MCtrace;
@@ -63,7 +63,7 @@ uint2 MCnbreakpoints = 0;
6363
Watchvar *MCwatchedvars = nil;
6464
uint2 MCnwatchedvars = 0;
6565

66-
MCExecPoint *MCexecutioncontexts[MAX_CONTEXTS];
66+
MCExecContext *MCexecutioncontexts[MAX_CONTEXTS];
6767
uint2 MCnexecutioncontexts = 0;
6868
uint2 MCdebugcontext = MAXUINT2;
6969
Boolean MCmessagemessages = False;
@@ -76,30 +76,25 @@ static int2 depth;
7676

7777
#include "srvdebug.h"
7878

79-
void MCB_setmsg(MCExecContext& ctxt, MCStringRef p_msg)
80-
{
81-
82-
}
83-
84-
void MCB_setmsg(MCExecPoint& ep)
79+
void MCB_setmsg(MCExecContext& ctxt, MCStringRef p_string)
8580
{
8681
// At some point we will add the ability to manipulate/look at the 'message box' in a
8782
// remote debugging session.
8883
}
8984

90-
void MCB_trace(MCExecPoint &ep, uint2 line, uint2 pos)
85+
void MCB_trace(MCExecContext &ctxt, uint2 line, uint2 pos)
9186
{
92-
MCServerDebugTrace(ep, line, pos);
87+
MCServerDebugTrace(ctxt, line, pos);
9388
}
9489

95-
void MCB_break(MCExecPoint &ep, uint2 line, uint2 pos)
90+
void MCB_break(MCExecContext &ctxt, uint2 line, uint2 pos)
9691
{
97-
MCServerDebugBreak(ep, line, pos);
92+
MCServerDebugBreak(ctxt, line, pos);
9893
}
9994

100-
void MCB_error(MCExecPoint &ep, uint2 line, uint2 pos, uint2 id)
95+
void MCB_error(MCExecContext &ctxt, uint2 line, uint2 pos, uint2 id)
10196
{
102-
MCServerDebugError(ep, line, pos, id);
97+
MCServerDebugError(ctct, line, pos, id);
10398

10499
// Increasing the error lock means that more MCB_error invocations won't occur as
105100
// we step back up the (script) call stack.
@@ -110,37 +105,25 @@ void MCB_done(MCExecPoint &ep)
110105
{
111106
}
112107

113-
void MCB_setvar(MCExecPoint &ep, MCNameRef name)
114-
{
115-
MCServerDebugVariableChanged(ep, name);
116-
}
117-
118108
void MCB_setvar(MCExecContext &ctxt, MCValueRef p_value, MCNameRef name)
119109
{
120-
110+
MCServerDebugVariableChanged(ctxt, p_value, name);
121111
}
122112

123113
#else
124114

125-
void MCB_setmsg(MCExecContext& ctxt, MCStringRef p_msg)
126-
{
127-
ctxt . GetEP() . setvalueref(p_msg);
128-
MCB_setmsg(ctxt . GetEP());
129-
}
130-
131-
void MCB_setmsg(MCExecPoint &ep)
115+
void MCB_setmsg(MCExecContext &ctxt, MCStringRef p_string)
132116
{
133117
if (MCnoui)
134118
{
135-
MCS_write(ep.getsvalue().getstring(), sizeof(char),
136-
ep.getsvalue().getlength(), IO_stdout);
137-
uint4 length = ep.getsvalue().getlength();
138-
if (length && ep.getsvalue().getstring()[length - 1] != '\n')
119+
MCS_write(MCStringGetCString(p_string), sizeof(char), MCStringGetLength(p_string), IO_stdout);
120+
uint4 length = MCStringGetLength(p_string);
121+
if (length && MCStringGetCharAtIndex(p_string, length - 1) != '\n')
139122
MCS_write("\n", sizeof(char), 1, IO_stdout);
140123
return;
141124
}
142125

143-
if (!MCModeHandleMessageBoxChanged(ep))
126+
if (!MCModeHandleMessageBoxChanged(ctxt, p_string))
144127
{
145128
// MW-2004-11-17: Now use global 'MCmbstackptr' instead
146129
if (MCmbstackptr == NULL)
@@ -162,16 +145,12 @@ void MCB_setmsg(MCExecPoint &ep)
162145
MCCard *cptr = MCmbstackptr->getchild(CT_THIS, kMCEmptyString, CT_CARD);
163146
MCField *fptr = (MCField *)cptr->getchild(CT_FIRST, kMCEmptyString, CT_FIELD, CT_CARD);
164147
if (fptr != NULL)
165-
{
166-
MCAutoStringRef t_string;
167-
ep . copyasstringref(&t_string);
168-
fptr->settext(0, *t_string, False);
169-
}
148+
fptr->settext(0, p_string, False);
170149
}
171150
}
172151
}
173152

174-
void MCB_message(MCExecPoint &ep, MCNameRef mess, MCParameter *p)
153+
void MCB_message(MCExecContext &ctxt, MCNameRef mess, MCParameter *p)
175154
{
176155
Boolean exitall = MCexitall;
177156
MCSaveprops sp;
@@ -182,7 +161,7 @@ void MCB_message(MCExecPoint &ep, MCNameRef mess, MCParameter *p)
182161
if (MCtracestackptr != NULL)
183162
MCtracewindow = MCtracestackptr->getw();
184163
else
185-
MCtracewindow = ep.getobj()->getw();
164+
MCtracewindow = ctxt.GetObject()->getw();
186165
MCVariable *oldresult = MCresult;
187166
/* UNCHECKED */ MCVariable::createwithname(MCNAME("MCdebugresult"), MCresult);
188167
MCtracereturn = False;
@@ -197,7 +176,7 @@ void MCB_message(MCExecPoint &ep, MCNameRef mess, MCParameter *p)
197176

198177
// OK-2008-11-28: [[Bug 7491]] - It seems that using the "send" parameter causes problems with the MetaCard debugger
199178
// So instead of doing that, I've added a new optional parameter to MCObject::send, called p_force, and used this instead.
200-
if (ep . getobj() -> message(mess, p, True, False, True) == ES_NORMAL)
179+
if (ctxt.GetObject() -> message(mess, p, True, False, True) == ES_NORMAL)
201180
{
202181
MCcheckstack = oldcheck;
203182
// if (depth++ > 1)
@@ -209,7 +188,7 @@ void MCB_message(MCExecPoint &ep, MCNameRef mess, MCParameter *p)
209188
}
210189
// depth--;
211190
if (MCtracedobject == NULL)
212-
MCtracedobject = ep.getobj();
191+
MCtracedobject = ctxt.GetObject();
213192
if (MCtraceabort)
214193
{
215194
MCtraceabort = False;
@@ -227,17 +206,17 @@ void MCB_message(MCExecPoint &ep, MCNameRef mess, MCParameter *p)
227206
MCexitall = exitall;
228207
}
229208

230-
void MCB_prepmessage(MCExecPoint &ep, MCNameRef mess, uint2 line, uint2 pos, uint2 id, MCStringRef p_info)
209+
void MCB_prepmessage(MCExecContext &ctxt, MCNameRef mess, uint2 line, uint2 pos, uint2 id, MCStringRef p_info)
231210
{
232211
Boolean added = False;
233212
if (MCnexecutioncontexts < MAX_CONTEXTS)
234213
{
235-
ep.setline(line);
236-
MCexecutioncontexts[MCnexecutioncontexts++] = &ep;
214+
ctxt.GetEP().setline(line);
215+
MCexecutioncontexts[MCnexecutioncontexts++] = &ctxt;
237216
added = True;
238217
}
239218
MCParameter p1, p2, p3, p4;
240-
p1.setvalueref_argument(ep.gethandler()->getname());
219+
p1.setvalueref_argument(ctxt.GetHandler()->getname());
241220
p1.setnext(&p2);
242221
p2.setn_argument((real8)line);
243222
p2.setnext(&p3);
@@ -247,30 +226,31 @@ void MCB_prepmessage(MCExecPoint &ep, MCNameRef mess, uint2 line, uint2 pos, uin
247226
p3.setnext(&p4);
248227
MCeerror->add(id, line, pos);
249228

250-
ep.getobj()->getprop(0, P_LONG_ID, ep, False);
251-
MCeerror->add(EE_OBJECT_NAME, 0, 0, ep.getsvalue());
229+
MCAutoValueRef t_val;
230+
ctxt.GetObject()->getvariantprop(ctxt, 0, P_LONG_ID, False, &t_val);
231+
MCeerror->add(EE_OBJECT_NAME, 0, 0, *t_val);
252232
p4.sets_argument(MCeerror->getsvalue());
253233
}
254234
else if (!MCStringIsEmpty(p_info))
255235
{
256236
p3.setnext(&p4);
257237
p4.setvalueref_argument(p_info);
258238
}
259-
MCB_message(ep, mess, &p1);
239+
MCB_message(ctxt, mess, &p1);
260240
if (id != 0)
261241
MCeerror->clear();
262242
if (added)
263243
MCnexecutioncontexts--;
264244
}
265245

266-
void MCB_trace(MCExecPoint &ep, uint2 line, uint2 pos)
246+
void MCB_trace(MCExecContext &ctxt, uint2 line, uint2 pos)
267247
{
268248
uint2 i;
269249

270250
if (MCtrace && (MCtraceuntil == MAXUINT2 || MCnexecutioncontexts == MCtraceuntil))
271251
{
272252
MCtraceuntil = MAXUINT2;
273-
MCB_prepmessage(ep, MCM_trace, line, pos, 0);
253+
MCB_prepmessage(ctxt, MCM_trace, line, pos, 0);
274254
}
275255
else
276256
{
@@ -281,80 +261,56 @@ void MCB_trace(MCExecPoint &ep, uint2 line, uint2 pos)
281261
if (MCbreakpoints[i].line == line)
282262
{
283263
MCParentScriptUse *t_parentscript;
284-
t_parentscript = ep . getparentscript();
285-
if (t_parentscript == NULL && MCbreakpoints[i].object == ep.getobj() ||
264+
t_parentscript = ctxt . GetParentScript();
265+
if (t_parentscript == NULL && MCbreakpoints[i].object == ctxt.GetObject() ||
286266
t_parentscript != NULL && MCbreakpoints[i].object == t_parentscript -> GetParent() -> GetObject())
287-
MCB_prepmessage(ep, MCM_trace_break, line, pos, 0, MCbreakpoints[i].info);
267+
MCB_prepmessage(ctxt, MCM_trace_break, line, pos, 0, MCbreakpoints[i].info);
288268
}
289269
}
290270
}
291271

292-
void MCB_break(MCExecPoint &ep, uint2 line, uint2 pos)
272+
void MCB_break(MCExecContext &ctxt, uint2 line, uint2 pos)
293273
{
294-
MCB_prepmessage(ep, MCM_trace_break, line, pos, 0);
274+
MCB_prepmessage(ctxt, MCM_trace_break, line, pos, 0);
295275
}
296276

297277
bool s_in_trace_error = false;
298278

299-
void MCB_error(MCExecPoint &ep, uint2 line, uint2 pos, uint2 id)
279+
void MCB_error(MCExecContext &ctxt, uint2 line, uint2 pos, uint2 id)
300280
{
301281
// OK-2009-03-25: [[Bug 7517]] - The crash described in this bug report is probably caused by a stack overflow. This overflow is due to
302282
// errors being thrown in the IDE (or in this case GLX2) component of the debugger. This should prevent traceError from recursing.
303283
if (s_in_trace_error)
304284
return;
305285

306286
s_in_trace_error = true;
307-
MCB_prepmessage(ep, MCM_trace_error, line, pos, id);
287+
MCB_prepmessage(ctxt, MCM_trace_error, line, pos, id);
308288
MCerrorlock++; // suppress errors as stack unwinds
309289
s_in_trace_error = false;
310290
}
311291

312-
void MCB_done(MCExecPoint &ep)
292+
void MCB_done(MCExecContext &ctxt)
313293
{
314-
MCB_message(ep, MCM_trace_done, NULL);
315-
}
316-
317-
void MCB_setvar(MCExecPoint &ep, MCNameRef name)
318-
{
319-
Boolean added = False;
320-
if (MCnexecutioncontexts < MAX_CONTEXTS)
321-
{
322-
MCexecutioncontexts[MCnexecutioncontexts++] = &ep;
323-
added = True;
324-
}
325-
MCParameter p1, p2, p3;
326-
p1.setn_argument(ep.getline());
327-
p1.setnext(&p2);
328-
p2.setvalueref_argument(name);
329-
p2.setnext(&p3);
330-
p3.sets_argument(ep.getsvalue());
331-
MCB_message(ep, MCM_update_var, &p1);
332-
if (added)
333-
MCnexecutioncontexts--;
294+
MCB_message(ctxt, MCM_trace_done, NULL);
334295
}
335296

336297
void MCB_setvar(MCExecContext &ctxt, MCValueRef p_value, MCNameRef name)
337298
{
338-
MCExecPoint& ep = ctxt . GetEP();
339-
340299
Boolean added = False;
341300
if (MCnexecutioncontexts < MAX_CONTEXTS)
342301
{
343-
MCexecutioncontexts[MCnexecutioncontexts++] = &ep;
302+
MCexecutioncontexts[MCnexecutioncontexts++] = &ctxt;
344303
added = True;
345304
}
305+
346306
MCParameter p1, p2, p3;
347-
p1.setn_argument(ep.getline());
307+
p1.setn_argument(ctxt.GetEP().getline());
348308
p1.setnext(&p2);
349309
p2.setvalueref_argument(name);
350310
p2.setnext(&p3);
351-
352-
MCValueRef t_value;
353-
MCValueCopy(p_value, t_value);
311+
p3.setvalueref_argument(p_value);
312+
MCB_message(ctxt, MCM_update_var, &p1);
354313

355-
p3.setvalueref_argument(t_value);
356-
357-
MCB_message(ep, MCM_update_var, &p1);
358314
if (added)
359315
MCnexecutioncontexts--;
360316
}

engine/src/debug.h

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ struct Watchvar
4040

4141
#define MAX_CONTEXTS 100
4242

43-
extern MCExecPoint *MCEPptr;
43+
extern MCExecContext *MCECptr;
4444
extern MCStack *MCtracestackptr;
4545
extern Window MCtracewindow;
4646
extern Boolean MCtrace;
@@ -57,20 +57,18 @@ extern Breakpoint *MCbreakpoints;
5757
extern uint2 MCnwatchedvars;
5858
extern Watchvar *MCwatchedvars;
5959

60-
extern MCExecPoint *MCexecutioncontexts[MAX_CONTEXTS];
60+
extern MCExecContext *MCexecutioncontexts[MAX_CONTEXTS];
6161
extern uint2 MCnexecutioncontexts;
6262
extern uint2 MCdebugcontext;
6363
extern Boolean MCmessagemessages;
6464

65-
extern void MCB_setmsg(MCExecContext& ctxt, MCStringRef p_msg);
66-
extern void MCB_setmsg(MCExecPoint &ep);
67-
extern void MCB_message(MCExecPoint &ep, MCNameRef message, MCParameter *p);
68-
extern void MCB_prepmessage(MCExecPoint &ep, MCNameRef message, uint2 line, uint2 pos, uint2 id, MCStringRef p_info = kMCEmptyString);
69-
extern void MCB_break(MCExecPoint &ep, uint2 line, uint2 pos);
70-
extern void MCB_trace(MCExecPoint &ep, uint2 line, uint2 pos);
71-
extern void MCB_error(MCExecPoint &ep, uint2 line, uint2 pos, uint2 id);
72-
extern void MCB_done(MCExecPoint &ep);
73-
extern void MCB_setvar(MCExecPoint &ep, MCNameRef name);
65+
extern void MCB_setmsg(MCExecContext &ctxt, MCStringRef p_string);
66+
extern void MCB_message(MCExecContext &ctxt, MCNameRef message, MCParameter *p);
67+
extern void MCB_prepmessage(MCExecContext &ctxt, MCNameRef message, uint2 line, uint2 pos, uint2 id, MCStringRef p_info = kMCEmptyString);
68+
extern void MCB_break(MCExecContext &ctxt, uint2 line, uint2 pos);
69+
extern void MCB_trace(MCExecContext &ctxt, uint2 line, uint2 pos);
70+
extern void MCB_error(MCExecContext &ctxt, uint2 line, uint2 pos, uint2 id);
71+
extern void MCB_done(MCExecContext &ctxt);
7472
extern void MCB_setvar(MCExecContext &ctxt, MCValueRef p_value, MCNameRef name);
7573

7674
extern void MCB_parsebreaks(MCExecContext& ctxt, MCStringRef p_input);

0 commit comments

Comments
 (0)