Exec_stat MCMarking::exec(MCExecPoint &ep) { if (card != NULL) { MCObject *optr; uint4 parid; if (card->getobj(ep, optr, parid, True) != ES_NORMAL || optr->gettype() != CT_CARD) { MCeerror->add (EE_MARK_BADCARD, line, pos); return ES_ERROR; } ep.setboolean(mark); return optr->setprop(0, P_MARKED, ep, False); } if (tofind == NULL) MCdefaultstackptr->mark(ep, where, mark); else { if (tofind->eval(ep) != ES_NORMAL) { MCeerror->add (EE_MARK_BADSTRING, line, pos); return ES_ERROR; } MCdefaultstackptr->markfind(ep, mode, ep.getsvalue(), field, mark); } return ES_NORMAL; }
bool MCNativeControl::FormatRange(MCExecPoint &ep, uint32_t p_start, uint32_t p_length) { ep.setnvalue(p_start); ep.concatint(p_length, EC_COMMA, false); return true; }
void MCOldFontlist::getfontstyles(const char *fname, uint2 fsize, MCExecPoint &ep) { ep.clear(); if (MCnoui) return; MCOldFontnode dummynode; dummynode.buildtable(); MCOldFonttablenode *fnptr = dummynode.findtablenode(fname); if (fnptr != NULL) { uint2 i; for (i = 0 ; i < fnptr->nplain ; i++) { if (fnptr->psizes[i] == 0 || fnptr->psizes[i] == fsize) { ep.concatcstring(MCplainstring, EC_RETURN, true); if (fnptr->nbold > i && (fnptr->bsizes[i] == 0 || fnptr->bsizes[i] == fsize)) ep.concatcstring("bold", EC_RETURN, false); if (fnptr->nitalic > i && (fnptr->isizes[i] == 0 || fnptr->isizes[i] == fsize)) ep.concatcstring("italic", EC_RETURN, false); if (fnptr->nbolditalic > i && (fnptr->bisizes[i] == 0 || fnptr->bisizes[i] == fsize)) ep.concatcstring("bold-italic", EC_RETURN, false); break; } } } }
Exec_stat MCAndroidPlayerControl::Get(MCNativeControlProperty p_property, MCExecPoint &ep) { bool t_bool = false; int32_t t_integer; jobject t_view; t_view = GetView(); switch (p_property) { case kMCNativeControlPropertyContent: { ep.setsvalue(m_path); return ES_NORMAL; } case kMCNativeControlPropertyShowController: { MCAndroidObjectRemoteCall(t_view, "getShowController", "b", &t_bool); FormatBoolean(ep, t_bool); return ES_NORMAL; } case kMCNativeControlPropertyLooping: { MCAndroidObjectRemoteCall(t_view, "getLooping", "b", &t_bool); FormatBoolean(ep, t_bool); return ES_NORMAL; } case kMCNativeControlPropertyDuration: { MCAndroidObjectRemoteCall(t_view, "getDuration", "i", &t_integer); FormatInteger(ep, t_integer); return ES_NORMAL; } case kMCNativeControlPropertyCurrentTime: { MCAndroidObjectRemoteCall(t_view, "getCurrentTime", "i", &t_integer); FormatInteger(ep, t_integer); return ES_NORMAL; } case kMCNativeControlPropertyNaturalSize: { int32_t t_width = 0, t_height = 0; MCAndroidObjectRemoteCall(t_view, "getVideoWidth", "i", &t_width); MCAndroidObjectRemoteCall(t_view, "getVideoHeight", "i", &t_height); sprintf(ep.getbuffer(I2L * 2 + 3), "%d,%d", t_width, t_height); ep.setstrlen(); return ES_NORMAL; } default: break; } return MCAndroidControl::Get(p_property, ep); }
// MW-2008-03-18: [[ Bug 3300 ]] Make sure that if a file has a full path we dont' prepend // the selected folder. // MW-2008-03-18: [[ Bug 6116 ]] Make sure that we don't add an extra slash if there's already // one at the end of the folder path. static void build_path(MCExecPoint& ep, const char *p_folder, const MCString& p_file) { char *t_std_file; t_std_file = p_file . clone(); MCU_path2std(t_std_file); bool t_use_folder; if (p_folder == NULL || strlen(p_folder) == 0 || (strlen(t_std_file) > 1 && t_std_file[1] == ':') || (strlen(t_std_file) > 2 && t_std_file[0] == '/' && t_std_file[1] == '/')) t_use_folder = false; else t_use_folder = true; if (t_use_folder) { ep.appendcstring(p_folder); if (p_folder[strlen(p_folder) - 1] != '/') ep.appendchar('/'); } ep . appendcstring(t_std_file); delete t_std_file; }
bool MCServerGetSessionIdFromCookie(char *&r_id) { MCVariable *t_cookie_array; t_cookie_array = MCVariable::lookupglobal_cstring("$_COOKIE"); if (t_cookie_array == NULL) { r_id = NULL; return true; } // ensure cookie array is evaluated if (t_cookie_array->isdeferred() && ES_NORMAL != ((MCDeferredVariable*)t_cookie_array)->compute()) return false; MCExecPoint ep; if (ES_NORMAL != t_cookie_array->fetch_element(ep, MCS_get_session_name())) return false; // retrieve ID from cookie value if (ep.isempty()) r_id = NULL; else r_id = ep.getsvalue().clone(); return true; }
void MCScreenDC::getkeysdown(MCExecPoint &ep) { char kstring[U4L]; char km[32]; ep.clear(); MCmodifierstate = querymods(); XQueryKeymap(dpy, km); bool first = true; uint2 i; KeySym ksym; for (i = 0; i < 256; i++) { if (isKeyPressed(km, i)) { ksym = i; if (MCmodifierstate & MS_SHIFT || MCmodifierstate & MS_CAPS_LOCK) ksym = XKeycodeToKeysym(dpy, i, 1); else ksym = XKeycodeToKeysym(dpy, i, 0); if (ksym > 0) { ep.concatuint(ksym, EC_COMMA, first); first = false; } } } }
float android_font_measure_text(void *p_font, const char *p_text, uint32_t p_text_length, bool p_is_unicode) { MCAndroidFont *t_font = (MCAndroidFont*)p_font; SkPaint t_paint; t_paint.setTypeface(t_font->sk_typeface); t_paint.setTextSize(t_font->size); if (p_is_unicode) { t_paint.setTextEncoding(SkPaint::kUTF16_TextEncoding); return t_paint.measureText(p_text, p_text_length); } else { MCExecPoint ep; ep.setsvalue(MCString(p_text, p_text_length)); ep.nativetoutf8(); const MCString &t_utf_string = ep.getsvalue(); t_paint.setTextEncoding(SkPaint::kUTF8_TextEncoding); return t_paint.measureText(t_utf_string.getstring(), t_utf_string.getlength()); } }
Exec_stat MCQuit::exec(MCExecPoint &ep) { // MW-2011-06-22: [[ SERVER ]] Don't send messages in server-mode. #ifndef _SERVER switch(MCdefaultstackptr->getcard()->message(MCM_shut_down_request)) { case ES_PASS: case ES_NOT_HANDLED: break; default: return ES_NORMAL; } #ifndef TARGET_SUBPLATFORM_ANDROID MCdefaultstackptr->getcard()->message(MCM_shut_down); #endif #endif if (retcode != NULL && retcode->eval(ep) == ES_NORMAL && ep.ton() == ES_NORMAL) MCretcode = ep.getint4(); MCquit = True; MCquitisexplicit = True; MCexitall = True; MCtracestackptr = NULL; MCtraceabort = True; MCtracereturn = True; return ES_NORMAL; }
void MCScreenDC::getkeysdown(MCExecPoint &ep) { BYTE keystates[256]; ep.clear(); if (GetKeyboardState((PBYTE)&keystates) == 0) // should use an async function? return; MCmodifierstate = querymods(); bool first = true; KeySym ksym; uint2 i; for (i = 0; i < 256; i++) { if (keystates[i] & 0x80) { ksym = i; if (i <= VK_LAST) { if (MCmodifierstate & MS_SHIFT || GetKeyState(VK_CAPITAL) & 0x1) ksym = shift_keysyms[i]; else ksym = keysyms[i]; } if (ksym > 0) { ep.concatuint(ksym, EC_COMMA, first); first = false; } } } }
Exec_stat MCRound::eval(MCExecPoint &ep) { real8 factor = 1.0; if (digit != NULL) { if (digit->eval(ep) != ES_NORMAL || ep.ton() != ES_NORMAL) { MCeerror->add (EE_ROUND_BADSOURCE, line, pos); return ES_ERROR; } // eliminate precision error by using more than exact power of 10, // 6.0 is empirically derived on Intel. Other rounding algorithms // don't work with negative numbers and/or are very slow. factor = pow(10 + DBL_EPSILON * 6.0, ep.getnvalue()); } if (source->eval(ep) != ES_NORMAL || ep.ton() != ES_NORMAL) { MCeerror->add (EE_ROUND_BADSOURCE, line, pos); return ES_ERROR; } real8 value = ep.getnvalue() * factor; if (value < 0.0) value = ceil(value - 0.5); else value = floor(value + 0.5); ep.setnvalue(value / factor); return ES_NORMAL; }
bool MCNativeControl::ParseColor(MCExecPoint &ep, uint16_t &r_red, uint16_t &r_green, uint16_t &r_blue, uint16_t &r_alpha) { uint8_t t_r8, t_g8, t_b8, t_a8; MCColor t_color; char *t_name = nil; if (MCParseRGBA(ep.getsvalue(), false, t_r8, t_g8, t_b8, t_a8)) { r_red = (t_r8 << 8) | t_r8; r_green = (t_g8 << 8) | t_g8; r_blue = (t_b8 << 8) | t_b8; r_alpha = (t_a8 << 8) | t_a8; return true; } else if (MCscreen->parsecolor(ep.getsvalue(), &t_color, &t_name)) { delete t_name; r_red = t_color.red; r_green = t_color.green; r_blue = t_color.blue; r_alpha = 0xFFFF; return true; } else return false; }
Exec_stat MCLiteralNumber::eval(MCExecPoint &ep) { if (nvalue == BAD_NUMERIC) ep.setnameref_unsafe(value); else ep.setnvalue(nvalue); return ES_NORMAL; }
Exec_stat MCFontListLoaded(MCExecPoint& ep) { ep.clear(); for(MCLoadedFont *t_font = s_loaded_fonts; t_font != nil; t_font = t_font -> next) ep.concatcstring(t_font -> path, EC_RETURN, t_font == s_loaded_fonts); return ES_NORMAL; }
IO_stat IO_read_to_eof(IO_handle stream, MCExecPoint &ep) { uint4 nread; nread = (uint4)MCS_fsize(stream) - (uint4)MCS_tell(stream); char *dptr = ep.getbuffer(nread); MCS_read(dptr, 1, nread, stream); ep.setlength(nread); return IO_NORMAL; }
Exec_stat MCAbsFunction::eval(MCExecPoint &ep) { if (source->eval(ep) != ES_NORMAL || ep.ton() != ES_NORMAL) { MCeerror->add (EE_ABS_BADSOURCE, line, pos); return ES_ERROR; } ep.setnvalue(fabs(ep.getnvalue())); return ES_NORMAL; }
bool MCNativeControl::ParseBoolean(MCExecPoint& ep, bool& r_value) { Boolean t_bool; if (!MCU_stob(ep.getsvalue(), t_bool)) { MCeerror->add(EE_OBJECT_NAB, 0, 0, ep.getsvalue()); return false; } r_value = t_bool == True; return true; }
bool MCParseMenuString(MCString &r_string, IParseMenuCallback *p_callback, bool p_is_unicode, uint1 p_menumode) { MCString *t_lines = NULL; uint2 t_nlines = 0; MCMenuItem t_menuitem; MCU_break_string(r_string, t_lines, t_nlines, p_is_unicode); MCExecPoint ep; bool t_hastags = false; p_callback->Start(); for (int i=0; i<t_nlines; i++) { memset(&t_menuitem, 0, sizeof(MCMenuItem)); t_menuitem.is_unicode = p_is_unicode; t_menuitem.menumode = p_menumode; char *t_string; uint4 t_strlen; if (p_is_unicode) { ep.setsvalue(t_lines[i]); ep.utf16toutf8(); t_string = ep.getsvalue().clone(); t_strlen = ep.getsvalue().getlength(); } else { t_string = t_lines[i].clone(); t_strlen = t_lines[i].getlength(); } ParseMenuItemString(t_string, t_strlen, &t_menuitem); if (p_is_unicode) { ep.setsvalue(t_menuitem.label); ep.utf8toutf16(); t_menuitem.label.set(ep.getsvalue().clone(), ep.getsvalue().getlength()); } p_callback->ProcessItem(&t_menuitem); delete t_string; if (t_menuitem.tag != NULL) { delete t_menuitem.tag.getstring(); t_hastags = true; } if (p_is_unicode) delete t_menuitem.label.getstring(); } p_callback->End(t_hastags); delete t_lines; return false; }
void MCSystemListFontFamilies(MCExecPoint& ep) { ep . clear(); for (uint32_t i = 0; s_droid_fonts[i].name != nil; i++) ep.concatcstring(s_droid_fonts[i].name, EC_RETURN, ep.getsvalue().getlength() == 0); char *t_custom_font_names; t_custom_font_names = nil; MCAndroidCustomFontsList(t_custom_font_names); if (t_custom_font_names != nil) ep.concatcstring(t_custom_font_names, EC_RETURN, ep.getsvalue().getlength() == 0); /*UNCHECKED */ MCCStringFree(t_custom_font_names); }
static char *getfield(MCField *fptr, int *retval) { if (fptr == NULL) { *retval = xresFail; return NULL; } *retval = xresSucc; // MW-2012-02-21: [[ FieldExport ]] Use the new text export method. MCExecPoint ep; fptr->exportastext(0, ep, 0, INT32_MAX, false); return ep.getsvalue().clone(); }
void MCSystemListFontsForFamily(MCExecPoint& ep, const char *p_family) { uint32_t t_styles; t_styles = 0; for (uint32_t i = 0; s_droid_fonts[i].name != nil; i++) { if (MCCStringEqualCaseless(s_droid_fonts[i].name, p_family)) { t_styles = s_droid_fonts[i].styles; break; } } if (t_styles == 0) t_styles = MCAndroidCustomFontsGetStyle(p_family); ep . clear(); if (t_styles & kMCAndroidFontStyleRegular) ep.concatcstring("plain", EC_RETURN, ep.getsvalue().getlength() == 0); if (t_styles & kMCAndroidFontStyleBold) ep.concatcstring("bold", EC_RETURN, ep.getsvalue().getlength() == 0); if (t_styles & kMCAndroidFontStyleItalic) ep.concatcstring("italic", EC_RETURN, ep.getsvalue().getlength() == 0); if (t_styles & kMCAndroidFontStyleBoldItalic) ep.concatcstring("bold-italic", EC_RETURN, ep.getsvalue().getlength() == 0); }
//list ciphers and default key lengths for each void list_ciphers_cb(const OBJ_NAME *name,void *buffer) { if(!islower((unsigned char)*name->name)) return; MCExecPoint *ep = (MCExecPoint *)buffer; if (*name->name) { ep->concatcstring(name->name,EC_RETURN,isfirstcipher); isfirstcipher = false; const EVP_CIPHER *cipher=EVP_get_cipherbyname(name->name); if (cipher) ep->concatuint(EVP_CIPHER_key_length(cipher) * 8, EC_COMMA, false); } }
Exec_stat MCMD5Digest::eval(MCExecPoint &ep) { if (source->eval(ep) != ES_NORMAL) { MCeerror->add(EE_MD5DIGEST_BADSOURCE, line, pos); return ES_ERROR; } md5_state_t state; md5_byte_t digest[16]; md5_init(&state); md5_append(&state, (const md5_byte_t *)ep.getsvalue().getstring(), ep.getsvalue().getlength()); md5_finish(&state, digest); ep.copysvalue((char *)digest, 16); return ES_NORMAL; }
Exec_stat MCSHA1Digest::eval(MCExecPoint &ep) { if (source->eval(ep) != ES_NORMAL) { MCeerror->add(EE_SHA1DIGEST_BADSOURCE, line, pos); return ES_ERROR; } sha1_state_t state; uint8_t digest[20]; sha1_init(&state); sha1_append(&state, ep.getsvalue().getstring(), ep.getsvalue().getlength()); sha1_finish(&state, digest); ep.copysvalue((char *)digest, 20); return ES_NORMAL; }
static char *get_global(const char *arg1, const char *arg2, const char *arg3, int *retval) { MCVariable *tmp; tmp = MCVariable::lookupglobal_cstring(arg1); if (tmp != nil) { *retval = xresSucc; MCExecPoint ep; tmp->fetch(ep); return ep.getsvalue().clone(); } *retval = xresFail; return NULL; }
static char *set_global(const char *arg1, const char *arg2, const char *arg3, int *retval) { MCVariable *tmp; if (!MCVariable::ensureglobal_cstring(arg1, tmp)) { *retval = xresFail; return NULL; } MCExecPoint ep; *retval = xresSucc; ep.setsvalue(arg2); tmp->store(ep, False); return NULL; }
Exec_stat MCPurchaseGet(MCPurchase *p_purchase, MCPurchaseProperty p_property, MCExecPoint &ep) { //MCLog("MCPurchaseGet(%p, %d, ...)", p_purchase, p_property); MCAndroidPurchase *t_android_data = (MCAndroidPurchase*)p_purchase->platform_data; switch (p_property) { case kMCPurchasePropertyProductIdentifier: ep.copysvalue(t_android_data->product_id); return ES_NORMAL; case kMCPurchasePropertyDeveloperPayload: if (t_android_data->developer_payload == nil) ep.clear(); else ep.copysvalue(t_android_data->developer_payload); return ES_NORMAL; case kMCPurchasePropertySignedData: if (t_android_data->signed_data == nil) ep.clear(); else ep.copysvalue(t_android_data->signed_data); return ES_NORMAL; case kMCPurchasePropertySignature: if (t_android_data->signature == nil) ep.clear(); else ep.copysvalue(t_android_data->signature); return ES_NORMAL; case kMCPurchasePropertyTransactionIdentifier: if (t_android_data->order_id == nil) ep.clear(); else ep.copysvalue(t_android_data->order_id); return ES_NORMAL; case kMCPurchasePropertyPurchaseDate: ep.setint64(t_android_data->purchase_time); return ES_NORMAL; default: break; } return ES_NOT_HANDLED; }
static HRESULT append_shellitem_path_and_release(MCExecPoint& ep, IShellItem *p_item, bool p_first) { HRESULT t_hresult; t_hresult = S_OK; bool t_succeeded; t_succeeded = true; WCHAR *t_filename; t_filename = NULL; if (t_succeeded) { t_hresult = p_item -> GetDisplayName(SIGDN_FILESYSPATH, &t_filename); t_succeeded = SUCCEEDED(t_hresult); } if (t_succeeded) { char *t_rev_filename; t_rev_filename = strdup(AnsiCString(t_filename)); MCU_path2std(t_rev_filename); ep.concatcstring(t_rev_filename, EC_RETURN, p_first); delete[] t_rev_filename; } if (t_filename != NULL) CoTaskMemFree(t_filename); if (p_item != NULL) p_item -> Release(); return t_hresult; }
void MCOldFontlist::getfontsizes(const char *fname, MCExecPoint &ep) { ep.clear(); if (MCnoui) return; MCOldFontnode dummynode; dummynode.buildtable(); MCOldFonttablenode *fnptr = dummynode.findtablenode(fname); if (fnptr != NULL) { uint2 i; char buffer[U2L]; for (i = 0 ; i < fnptr->nplain ; i++) ep.concatuint(fnptr -> psizes[i], EC_RETURN, i == 0); } }
void MCOldFontlist::getfontnames(MCExecPoint &ep, char *type) { ep.clear(); if (MCnoui) return; MCOldFontnode dummynode; dummynode.buildtable(); MCOldFonttablenode *table = dummynode.gettable(); MCOldFonttablenode *tmp = table; do { ep.concatcstring(tmp->name, EC_RETURN, tmp == table); tmp = tmp->next; } while (tmp != NULL); }