Skip to content

Commit 0a3ae93

Browse files
author
Ali Lloyd
committed
removed remaining getprop & setprop calls using ep
1 parent 966ecec commit 0a3ae93

19 files changed

+177
-1404
lines changed

engine/src/aclip.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,8 +370,10 @@ void MCAudioClip::init()
370370
#endif
371371
if (supported)
372372
{
373+
uinteger_t t_loudness;
373374
MCExecPoint ep;
374-
getprop(0, P_PLAY_LOUDNESS, ep, False);
375+
MCExecContext ctxt(ep);
376+
getuintprop(ctxt, 0, P_PLAY_LOUDNESS, False, t_loudness);
375377
}
376378
}
377379

engine/src/cardlst.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ bool MCCardlist::GetRecent(MCExecContext& ctxt, MCStack *stack, Properties which
104104

105105
return t_success;
106106
}
107-
107+
#ifdef LEGACY_EXEC
108108
void MCCardlist::getprop(Properties prop, MCStack *stack, MCExecPoint &ep)
109109
{
110110
trim();
@@ -137,6 +137,7 @@ void MCCardlist::getlongids(MCStack *stack, MCExecPoint &ep)
137137
{
138138
getprop(P_LONG_ID, stack, ep);
139139
}
140+
#endif
140141

141142
void MCCardlist::addcard(MCCard *card)
142143
{

engine/src/cardlst.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,11 @@ class MCCardlist
7575
~MCCardlist();
7676
void trim();
7777
bool GetRecent(MCExecContext& ctxt, MCStack *stack, Properties which, MCStringRef& r_props);
78+
#ifdef LEGACY_EXEC
7879
void getprop(Properties prop, MCStack *stack, MCExecPoint &);
7980
void getnames(MCStack *stack, MCExecPoint &);
8081
void getlongids(MCStack *stack, MCExecPoint &);
82+
#endif
8183
void addcard(MCCard *cptr);
8284
void deletecard(MCCard *cptr);
8385
void deletestack(MCStack *cptr);

engine/src/chunk.cpp

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5682,25 +5682,13 @@ bool MCChunk::getprop(MCExecContext& ctxt, Properties which, MCNameRef index, Bo
56825682
}
56835683
t_info = lookup_object_property(t_obj_chunk . object -> getpropertytable(), which, effective == True, false, true);
56845684

5685-
if (t_info != nil)
5686-
{
5687-
MCExecFetchProperty(ctxt, t_info, &t_obj_chunk, r_value);
5688-
}
5689-
else
5685+
if (t_info == nil || t_info -> getter == nil)
56905686
{
5691-
// MW-2011-11-23: [[ Array TextStyle ]] Pass the 'index' along to method to
5692-
// handle specific styles.
5693-
MCField *fptr;
5694-
fptr = static_cast<MCField *>(t_obj_chunk . object);
5695-
if (fptr->gettextatts(t_obj_chunk . part_id, which, ctxt . GetEP(), index, effective, t_obj_chunk . mark . start, t_obj_chunk . mark . finish, islinechunk()) != ES_NORMAL)
5696-
{
5697-
MCeerror->add(EE_CHUNK_CANTGETATTS, line, pos);
5698-
return false;
5699-
}
5700-
ctxt . GetEP() . copyasvalueref(r_value . valueref_value);
5701-
r_value . type = kMCExecValueTypeValueRef;
5702-
return true;
5687+
MCeerror -> add(EE_OBJECT_GETNOPROP, line, pos);
5688+
return false;
57035689
}
5690+
5691+
MCExecFetchProperty(ctxt, t_info, &t_obj_chunk, r_value);
57045692
}
57055693

57065694
return !ctxt . HasError();
@@ -5771,16 +5759,13 @@ bool MCChunk::setprop(MCExecContext& ctxt, Properties which, MCNameRef index, Bo
57715759
// the ep.
57725760
// MW-2012-01-25: [[ ParaStyles ]] Pass whether this was an explicit line chunk
57735761
// or not. This is used to disambiguate the setting of 'backColor'.
5774-
MCField *fptr;
5775-
fptr = static_cast<MCField *>(t_obj_chunk . object);
5776-
MCAutoValueRef t_value;
5777-
MCExecTypeConvertAndReleaseAlways(ctxt, p_value . type, &p_value . type + 1, kMCExecValueTypeValueRef, &(&t_value));
5778-
ctxt . GetEP() . setvalueref(*t_value);
5779-
if (fptr->settextatts(t_obj_chunk . part_id, which, ctxt . GetEP(), index, t_obj_chunk . mark . start, t_obj_chunk . mark . finish, islinechunk()) != ES_NORMAL)
5762+
if (t_info == nil || t_info -> getter == nil)
57805763
{
5781-
MCeerror->add(EE_CHUNK_CANTSETATTS, line, pos);
5782-
return true;
5764+
MCeerror -> add(EE_OBJECT_SETNOPROP, line, pos);
5765+
return false;
57835766
}
5767+
5768+
MCExecFetchProperty(ctxt, t_info, &t_obj_chunk, p_value);
57845769
}
57855770
}
57865771

engine/src/debug.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ bool MCB_unparsebreaks(MCStringRef& r_value)
384384

385385
return t_success;
386386
}
387-
387+
#ifdef LEGACY_EXEC
388388
void MCB_unparsebreaks(MCExecPoint& ep)
389389
{
390390
ep.clear();
@@ -401,7 +401,7 @@ void MCB_unparsebreaks(MCExecPoint& ep)
401401
ep.concatstringref(MCbreakpoints[i].info, EC_COMMA, false);
402402
}
403403
}
404-
404+
#endif
405405
static MCObject *getobj(MCExecPoint& ep)
406406
{
407407
MCObject *objptr = NULL;

engine/src/debug.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ extern void MCB_setvar(MCExecContext &ctxt, MCValueRef p_value, MCNameRef name);
7474
extern void MCB_parsebreaks(MCExecContext& ctxt, MCStringRef p_input);
7575
extern void MCB_parsebreaks(MCExecPoint& breaks);
7676
extern bool MCB_unparsebreaks(MCStringRef& r_value);
77+
#ifdef LEGACY_EXEC
7778
extern void MCB_unparsebreaks(MCExecPoint& breaks);
79+
#endif
7880
extern void MCB_clearbreaks(MCObject *object);
7981

8082
extern void MCB_parsewatches(MCExecContext& ctxt, MCStringRef p_input);

engine/src/dispatch.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1575,7 +1575,10 @@ MCObject *MCDispatch::getobjname(Chunk_term type, MCNameRef p_name)
15751575
{
15761576
iptr = new MCImage;
15771577
iptr->appendto(imagecache);
1578-
iptr->setprop(0, P_TEXT, *epptr, False);
1578+
MCAutoDataRef t_text;
1579+
/* UNCHECKED */ ep . copyasdataref(&t_text);
1580+
MCExecContext ctxt(*epptr);
1581+
iptr->SetText(ctxt, *t_text);
15791582
iptr->setname(*t_image_name);
15801583
return iptr;
15811584
}

engine/src/exec-interface-field.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -998,12 +998,8 @@ void MCField::SetFlaggedRanges(MCExecContext& ctxt, uint32_t p_part, const MCInt
998998
p_part = 0;
999999

10001000
// First ensure the flagged property is false along the whole range.
1001-
MCExecPoint ep(nil, nil, nil);
1002-
ep . setboolean(False);
1003-
settextatts(p_part, P_FLAGGED, ep, nil, si, ei, false);
1004-
// All remaining ranges will have flagged set to true.
1005-
ep . setboolean(True);
1006-
1001+
SetFlaggedOfCharChunk(ctxt, p_part, si, ei, false);
1002+
// All remaining ranges will have flagged set to true.
10071003
for (uindex_t i = 0; i < p_ranges . count; i++)
10081004
{
10091005
// MW-2012-02-24: [[ FieldChars ]] Convert char indices to field indices.
@@ -1014,7 +1010,7 @@ void MCField::SetFlaggedRanges(MCExecContext& ctxt, uint32_t p_part, const MCInt
10141010

10151011
// MW-2012-03-23: [[ Bug 10118 ]] Both range_start and range_end are already
10161012
// offset from the start of the field.
1017-
settextatts(p_part, P_FLAGGED, ep, nil, MCU_max(si, t_range_start), MCU_min(ei, t_range_end), false);
1013+
SetFlaggedOfCharChunk(ctxt, p_part, MCU_max(si, t_range_start), MCU_min(ei, t_range_end), true);
10181014
}
10191015
}
10201016

engine/src/exec-interface-object.cpp

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3131,7 +3131,7 @@ void MCObject::DoGetProperties(MCExecContext& ctxt, uint32_t part, bool p_effect
31313131
getarrayprop(part, (Properties)table[tablesize].value, ep, kMCEmptyName, p_effective);
31323132
else
31333133
{
3134-
MCAutoStringRef t_unicode_prop;
3134+
MCAutoStringRef t_prop;
31353135
// MERG-2013-05-07: [[ RevisedPropsProp ]] Special-case the props that could
31363136
// be either Unicode or native (ensure minimal encoding is used).
31373137
// MERG-2013-06-24: [[ RevisedPropsProp ]] Treat the short name specially to ensure
@@ -3141,36 +3141,46 @@ void MCObject::DoGetProperties(MCExecContext& ctxt, uint32_t part, bool p_effect
31413141
if (isunnamed())
31423142
ep.clear();
31433143
else
3144-
getprop(part, P_SHORT_NAME, ep, p_effective);
3144+
{
3145+
getstringprop(ctxt, part, P_SHORT_NAME, p_effective, &t_prop);
3146+
ep . setvalueref(*t_prop);
3147+
}
31453148
break;
31463149
case P_LABEL:
3147-
getstringprop(ctxt, part, P_UNICODE_LABEL, p_effective, &t_unicode_prop);
3148-
if (!MCStringIsNative(*t_unicode_prop))
3150+
getstringprop(ctxt, part, P_UNICODE_LABEL, p_effective, &t_prop);
3151+
if (!MCStringIsNative(*t_prop))
31493152
{
31503153
if (gettype() == CT_STACK)
31513154
t_token = "unicodeTitle";
31523155
else
31533156
t_token = "unicodeLabel";
31543157
}
3155-
ep . setvalueref(*t_unicode_prop);
3158+
ep . setvalueref(*t_prop);
31563159
break;
31573160
case P_TOOL_TIP:
3158-
getstringprop(ctxt, part, P_UNICODE_TOOL_TIP, p_effective, &t_unicode_prop);
3159-
if (!MCStringIsNative(*t_unicode_prop))
3161+
getstringprop(ctxt, part, P_UNICODE_TOOL_TIP, p_effective, &t_prop);
3162+
if (!MCStringIsNative(*t_prop))
31603163
t_token = "unicodeToolTip";
3161-
ep . setvalueref(*t_unicode_prop);
3164+
ep . setvalueref(*t_prop);
31623165
break;
31633166
case P_TEXT:
31643167
if (gettype() == CT_BUTTON)
31653168
{
3166-
getstringprop(ctxt, part, P_UNICODE_TEXT, p_effective, &t_unicode_prop);
3167-
if (!MCStringIsNative(*t_unicode_prop))
3169+
getstringprop(ctxt, part, P_UNICODE_TEXT, p_effective, &t_prop);
3170+
if (!MCStringIsNative(*t_prop))
31683171
t_token = "unicodeText";
3169-
ep . setvalueref(*t_unicode_prop);
3172+
ep . setvalueref(*t_prop);
31703173
break;
31713174
}
31723175
default:
3173-
getprop(part, (Properties)table[tablesize].value, ep, p_effective);
3176+
{
3177+
MCExecValue t_value;
3178+
getprop(ctxt, part, (Properties)table[tablesize].value, p_effective, t_value);
3179+
MCAutoValueRef t_value_ref;
3180+
MCExecTypeConvertAndReleaseAlways(ctxt, t_value . type, &t_value . type + 1, kMCExecValueTypeValueRef, &(&t_value_ref));
3181+
if (!ctxt . HasError())
3182+
ep . setvalueref(*t_value_ref);
3183+
}
31743184
break;
31753185
}
31763186
}

0 commit comments

Comments
 (0)