Exec_stat MCIdeDiet::exec(MCExecPoint& ep) { Exec_stat t_stat; t_stat = ES_NORMAL; // Clear the result as we return an error there MCresult -> clear(); if (t_stat == ES_NORMAL) t_stat = m_params -> eval(ep); MCVariableValue *t_array; if (t_stat == ES_NORMAL) { t_array = ep . getarray(); if (t_array == NULL) return ES_ERROR; } MCExecPoint ep2(ep); MCDeployDietParameters t_params; memset(&t_params, 0, sizeof(MCDeployDietParameters)); if (t_stat == ES_NORMAL) t_stat = fetch_filepath(ep2, t_array, "input", t_params . input); if (t_stat == ES_NORMAL) t_stat = fetch_filepath(ep2, t_array, "output", t_params . output); if (t_stat == ES_NORMAL) t_stat = fetch_opt_boolean(ep2, t_array, "keep_x86", t_params . keep_x86); if (t_stat == ES_NORMAL) t_stat = fetch_opt_boolean(ep2, t_array, "keep_x86_64", t_params . keep_x86_64); if (t_stat == ES_NORMAL) t_stat = fetch_opt_boolean(ep2, t_array, "keep_ppc", t_params . keep_ppc); if (t_stat == ES_NORMAL) t_stat = fetch_opt_boolean(ep2, t_array, "keep_ppc64", t_params . keep_ppc64); if (t_stat == ES_NORMAL) t_stat = fetch_opt_boolean(ep2, t_array, "keep_arm", t_params . keep_arm); if (t_stat == ES_NORMAL) t_stat = fetch_opt_boolean(ep2, t_array, "keep_debug_symbols", t_params . keep_debug_symbols); if (t_stat == ES_NORMAL) { if (m_platform == PLATFORM_MACOSX) MCDeployDietMacOSX(t_params); MCDeployError t_error; t_error = MCDeployCatch(); if (t_error != kMCDeployErrorNone) MCresult -> sets(MCDeployErrorToString(t_error)); } delete t_params . input; delete t_params . output; return t_stat; }
static REAL8 dEp2(REAL8 v, expnCoeffs *ak) { REAL8 energy, denergy, Energy, dEnergy, x, y; x = v*v; energy = ep2(v, ak); y = sqrt(1.+energy); Energy = sqrt(1. + 2.* ak->eta * (y - 1.)) - 1.; denergy = -1. / ((1. + ak->ePa1*x)*(1. + ak->ePa1*x)); dEnergy = v * ak->eta * denergy /((1.+Energy) * y); return(dEnergy); }
void MCDispatch::getmainstacknames(MCExecPoint &ep) { ep.clear(); MCExecPoint ep2(ep); MCStack *tstk = stacks; bool first; first = true; do { tstk->getprop(0, P_SHORT_NAME, ep2, False); ep.concatmcstring(ep2.getsvalue(), EC_RETURN, first); first = false; tstk = (MCStack *)tstk->next(); } while (tstk != stacks); }
static char *show_image_by_id(const char *arg1, const char *arg2, const char *arg3, int *retval) { MCImage *iptr; iptr = NULL; if (isdigit(arg1[0])) iptr = (MCImage *)getobj(CT_IMAGE, CT_ID, arg1, arg2); else { MCScriptPoint sp(arg1); MCChunk *t_chunk; t_chunk = new MCChunk(False); Symbol_type t_next_type; MCerrorlock++; if (t_chunk -> parse(sp, False) == PS_NORMAL && sp.next(t_next_type) == PS_EOF) { MCExecPoint ep2(nil, nil, nil); MCObject *t_object; uint32_t t_part_id; if (t_chunk -> getobj(ep2, t_object, t_part_id, False) == ES_NORMAL && t_object -> gettype() == CT_IMAGE) iptr = static_cast<MCImage *>(t_object); } MCerrorlock--; } if (iptr == NULL) *retval = xresFail; else { // MW-2011-08-18: [[ Layers ]] Invalidate the whole object. iptr->layer_redrawall(); *retval = xresSucc; } return NULL; }
void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override { const PLSQuadEdgeEffect& qe = args.fGP.cast<PLSQuadEdgeEffect>(); GrGLSLVertexBuilder* vsBuilder = args.fVertBuilder; GrGLSLVaryingHandler* varyingHandler = args.fVaryingHandler; GrGLSLUniformHandler* uniformHandler = args.fUniformHandler; // emit attributes varyingHandler->emitAttributes(qe); GrGLSLVertToFrag uv(kVec2f_GrSLType); varyingHandler->addVarying("uv", &uv, kHigh_GrSLPrecision); vsBuilder->codeAppendf("%s = %s;", uv.vsOut(), qe.inUV()->fName); GrGLSLVertToFrag ep1(kVec2f_GrSLType); varyingHandler->addVarying("endpoint1", &ep1, kHigh_GrSLPrecision); vsBuilder->codeAppendf("%s = vec2(%s.x, %s.y);", ep1.vsOut(), qe.inEndpoint1()->fName, qe.inEndpoint1()->fName); GrGLSLVertToFrag ep2(kVec2f_GrSLType); varyingHandler->addVarying("endpoint2", &ep2, kHigh_GrSLPrecision); vsBuilder->codeAppendf("%s = vec2(%s.x, %s.y);", ep2.vsOut(), qe.inEndpoint2()->fName, qe.inEndpoint2()->fName); GrGLSLVertToFrag delta(kVec2f_GrSLType); varyingHandler->addVarying("delta", &delta, kHigh_GrSLPrecision); vsBuilder->codeAppendf("%s = vec2(%s.x - %s.x, %s.y - %s.y) * 0.5;", delta.vsOut(), ep1.vsOut(), ep2.vsOut(), ep2.vsOut(), ep1.vsOut()); GrGLSLVertToFrag windings(kInt_GrSLType); varyingHandler->addFlatVarying("windings", &windings, kLow_GrSLPrecision); vsBuilder->codeAppendf("%s = %s;", windings.vsOut(), qe.inWindings()->fName); // Setup position this->setupPosition(vsBuilder, gpArgs, qe.inPosition()->fName); // emit transforms this->emitTransforms(vsBuilder, varyingHandler, uniformHandler, gpArgs->fPositionVar, qe.inPosition()->fName, qe.localMatrix(), args.fTransformsIn, args.fTransformsOut); GrGLSLFragmentBuilder* fsBuilder = args.fFragBuilder; SkAssertResult(fsBuilder->enableFeature( GrGLSLFragmentShaderBuilder::kPixelLocalStorage_GLSLFeature)); SkAssertResult(fsBuilder->enableFeature( GrGLSLFragmentShaderBuilder::kStandardDerivatives_GLSLFeature)); static const int QUAD_ARGS = 2; GrGLSLShaderVar inQuadArgs[QUAD_ARGS] = { GrGLSLShaderVar("dot", kFloat_GrSLType, 0, kHigh_GrSLPrecision), GrGLSLShaderVar("uv", kVec2f_GrSLType, 0, kHigh_GrSLPrecision) }; SkString inQuadName; const char* inQuadCode = "if (uv.x * uv.x <= uv.y) {" "return dot >= 0.0;" "} else {" "return false;" "}"; fsBuilder->emitFunction(kBool_GrSLType, "in_quad", QUAD_ARGS, inQuadArgs, inQuadCode, &inQuadName); fsBuilder->declAppendf(GR_GL_PLS_PATH_DATA_DECL); // keep the derivative instructions outside the conditional fsBuilder->codeAppendf("highp vec2 uvdX = dFdx(%s);", uv.fsIn()); fsBuilder->codeAppendf("highp vec2 uvdY = dFdy(%s);", uv.fsIn()); fsBuilder->codeAppend("highp vec2 uvIncX = uvdX * 0.45 + uvdY * -0.1;"); fsBuilder->codeAppend("highp vec2 uvIncY = uvdX * 0.1 + uvdY * 0.55;"); fsBuilder->codeAppendf("highp vec2 uv = %s.xy - uvdX * 0.35 - uvdY * 0.25;", uv.fsIn()); fsBuilder->codeAppendf("highp vec2 firstSample = %s.xy - vec2(0.25);", fsBuilder->fragmentPosition()); fsBuilder->codeAppendf("highp float d = dot(%s, (firstSample - %s).yx) * 2.0;", delta.fsIn(), ep1.fsIn()); fsBuilder->codeAppendf("pls.windings[0] += %s(d, uv) ? %s : 0;", inQuadName.c_str(), windings.fsIn()); fsBuilder->codeAppend("uv += uvIncX;"); fsBuilder->codeAppendf("d += %s.x;", delta.fsIn()); fsBuilder->codeAppendf("pls.windings[1] += %s(d, uv) ? %s : 0;", inQuadName.c_str(), windings.fsIn()); fsBuilder->codeAppend("uv += uvIncY;"); fsBuilder->codeAppendf("d += %s.y;", delta.fsIn()); fsBuilder->codeAppendf("pls.windings[2] += %s(d, uv) ? %s : 0;", inQuadName.c_str(), windings.fsIn()); fsBuilder->codeAppend("uv -= uvIncX;"); fsBuilder->codeAppendf("d -= %s.x;", delta.fsIn()); fsBuilder->codeAppendf("pls.windings[3] += %s(d, uv) ? %s : 0;", inQuadName.c_str(), windings.fsIn()); }
Exec_errors MCAnswer::exec_notify(MCExecPoint& ep, const char *p_title) { Exec_errors t_error = EE_UNDEFINED; Meta::cstring_value t_prompt, t_buttons; t_error = Meta::evaluate(ep, notify . prompt, t_prompt, EE_ANSWER_BADRESPONSE); MCresult -> clear(False); #ifndef _MOBILE if (!t_error) { MCExecPoint ep2(ep); ep . clear(); for(unsigned int t_button = 0; t_button < notify . button_count && !t_error; ++t_button) { if (notify . buttons[t_button] -> eval(ep2) == ES_NORMAL) ep . concatmcstring(ep2 . getsvalue(), EC_RETURN, t_button == 0); else t_error = EE_ANSWER_BADRESPONSE; } t_buttons = ep; } if (!t_error) t_error = exec_custom(ep, MCanswernamestring, MCdialogtypes[mode], 3, p_title, *t_prompt, *t_buttons); if (ep . getsvalue() == MCnullmcstring) MCresult -> sets(MCcancelstring); #else char **t_button_names; t_button_names = new char *[notify . button_count]; memset(t_button_names, 0, sizeof(char *) * notify . button_count); if (!t_error) { MCExecPoint ep2(ep); ep . clear(); for(unsigned int t_button = 0; t_button < notify . button_count && !t_error; ++t_button) if (notify . buttons[t_button] -> eval(ep2) == ES_NORMAL) t_button_names[t_button] = ep2 . getsvalue() . clone(); } if (!t_error) { uint32_t t_type; switch(mode) { case AT_ERROR: t_type = kMCAnswerDialogTypeError; break; case AT_QUESTION: t_type = kMCAnswerDialogTypeQuestion; break; case AT_WARNING: t_type = kMCAnswerDialogTypeWarning; break; default: t_type = kMCAnswerDialogTypeInformation; break; } int32_t t_result; t_result = MCscreen -> popupanswerdialog((const char **)t_button_names, notify . button_count, t_type, p_title, *t_prompt); ep . clear(); if (t_result == -1) MCresult -> sets(MCcancelstring); else if (notify . button_count == 0) ep . clear(); else ep . copysvalue(t_button_names[t_result]); } for(uint32_t i = 0; i < notify . button_count; i++) delete t_button_names[i]; delete[] t_button_names; #endif return t_error; }
Exec_errors MCAnswer::exec_file(MCExecPoint& ep, const char *p_title) { Exec_errors t_error = EE_UNDEFINED; Meta::cstring_value t_prompt, t_initial, t_filter; Meta::cstring_value *t_types = NULL; char **t_type_strings = NULL; uint4 t_type_count = 0; t_error = Meta::evaluate(ep, file . prompt, t_prompt, EE_ANSWER_BADQUESTION, file . initial, t_initial, EE_ANSWER_BADRESPONSE, file . filter, t_filter, EE_ANSWER_BADRESPONSE); MCresult -> clear(False); if (!t_error && file . type_count > 0) { t_types = new Meta::cstring_value[file . type_count]; for(uint4 t_type_index = 0; t_type_index < file . type_count && !t_error; ++t_type_index) { t_error = Meta::evaluate(ep, file . types[t_type_index], t_types[t_type_index], EE_ANSWER_BADRESPONSE); if (!t_error) for(char *t_type_string = strtok(*t_types[t_type_index], "\n"); t_type_string != NULL; t_type_string = strtok(NULL, "\n")) { MCU_realloc((char **)&t_type_strings, t_type_count, t_type_count + 1, sizeof(char *)); t_type_strings[t_type_count++] = t_type_string; } } } // Now we have checked all parameters, we check for access. if (!t_error && !MCSecureModeCanAccessDisk()) t_error = EE_DISK_NOPERM; if (!t_error) { if (MCsystemFS && MCscreen -> hasfeature ( PLATFORM_FEATURE_OS_FILE_DIALOGS ) ) { unsigned int t_options = 0; if (sheet) t_options |= MCA_OPTION_SHEET; if (mode == AT_FILES) t_options |= MCA_OPTION_PLURAL; if (t_types != NULL) MCA_file_with_types(ep, p_title, t_prompt, t_type_strings, t_type_count, t_initial, t_options); else MCA_file(ep, p_title, t_prompt, t_filter, t_initial, t_options); } else { MCExecPoint ep2(ep); ep2 . clear(); for(uint4 t_type = 0; t_type < t_type_count; ++t_type) ep2 . concatcstring(t_type_strings[t_type], EC_RETURN, t_type == 0); t_error = exec_custom(ep, MCfsnamestring, mode == AT_FILE ? "file" : "files", 5, p_title, *t_prompt, *t_filter, *t_initial, ep2 . getsvalue() . getstring()); } if (ep . getsvalue() == MCnullmcstring && t_types == NULL) MCresult -> sets(MCcancelstring); } delete[] t_types; delete t_type_strings; return t_error; }
Exec_stat MCIdeDmgBuild::exec(MCExecPoint& ep) { Exec_stat t_stat; t_stat = ES_NORMAL; // Clear the result as we return an error there MCresult -> clear(); ///////// if (t_stat == ES_NORMAL) t_stat = m_items -> eval(ep); if (t_stat == ES_NORMAL && ep . getformat() != VF_ARRAY) t_stat = ES_ERROR; MCVariableArray *t_array; if (t_stat == ES_NORMAL) { t_array = ep . getarray() -> get_array(); if (!t_array -> issequence()) t_stat = ES_ERROR; } MCDeployDmgItem *t_items; uint32_t t_item_count; t_items = nil; t_item_count = 0; if (t_stat == ES_NORMAL) { if (MCMemoryNewArray(t_array -> getnfilled(), t_items)) t_item_count = t_array -> getnfilled(); else t_stat = ES_ERROR; } MCExecPoint ep2(ep); if (t_stat == ES_NORMAL) for(uint32_t i = 0; i < t_item_count && t_stat == ES_NORMAL; i++) { MCHashentry *t_element; t_element = t_array -> lookupindex(i + 1, False); if (t_element == nil) t_stat = ES_ERROR; if (t_stat == ES_NORMAL) t_stat = t_element -> value . fetch(ep2); MCVariableValue *t_item_array; if (t_stat == ES_NORMAL) { t_item_array = ep2 . getarray(); if (t_item_array == nil) t_stat = ES_ERROR; } if (t_stat == ES_NORMAL) { t_stat = t_item_array -> fetch_element(ep2, "type"); if (t_stat == ES_NORMAL) { if (ep2 . getsvalue() == "folder") t_items[i] . is_folder = true; else if (ep2 . getsvalue() == "file") t_items[i] . is_folder = false; else t_stat = ES_ERROR; } } if (t_stat == ES_NORMAL) t_stat = fetch_uint32(ep2, t_item_array, "parent", t_items[i] . parent); if (t_stat == ES_NORMAL) t_stat = fetch_cstring(ep2, t_item_array, "name", t_items[i] . name); if (t_stat == ES_NORMAL) t_stat = fetch_opt_uint32(ep2, t_item_array, "owner_id", t_items[i] . owner_id); if (t_stat == ES_NORMAL) t_stat = fetch_opt_uint32(ep2, t_item_array, "group_id", t_items[i] . group_id); if (t_stat == ES_NORMAL) t_stat = fetch_opt_uint32(ep2, t_item_array, "file_mode", t_items[i] . file_mode); if (t_stat == ES_NORMAL) t_stat = fetch_opt_uint32(ep2, t_item_array, "create_date", t_items[i] . create_date); if (t_stat == ES_NORMAL) t_stat = fetch_opt_uint32(ep2, t_item_array, "content_mod_date", t_items[i] . content_mod_date); if (t_stat == ES_NORMAL) t_stat = fetch_opt_uint32(ep2, t_item_array, "attribute_mod_date", t_items[i] . attribute_mod_date); if (t_stat == ES_NORMAL) t_stat = fetch_opt_uint32(ep2, t_item_array, "access_date", t_items[i] . access_date); if (t_stat == ES_NORMAL) t_stat = fetch_opt_uint32(ep2, t_item_array, "backup_date", t_items[i] . backup_date); } ///////// if (t_stat == ES_NORMAL) t_stat = m_filename -> eval(ep); if (t_stat == ES_NORMAL) { MCDeployDmgParameters t_params; t_params . items = t_items; t_params . item_count = t_item_count; t_params . output = (char *)ep . getcstring(); if (!MCDeployDmgBuild(t_params)) t_stat = ES_ERROR; } //////// for(uint32_t i = 0; i < t_item_count; i++) MCCStringFree(t_items[i] . name); MCMemoryDeleteArray(t_items); return ES_NORMAL; }
Exec_stat MCIdeSign::exec(MCExecPoint& ep) { Exec_stat t_stat; t_stat = ES_NORMAL; // Clear the result as we return an error there MCresult -> clear(); if (t_stat == ES_NORMAL) t_stat = m_params -> eval(ep); MCVariableValue *t_array; if (t_stat == ES_NORMAL) { t_array = ep . getarray(); if (t_array == NULL) return ES_ERROR; } MCExecPoint ep2(ep); MCDeploySignParameters t_params; memset(&t_params, 0, sizeof(MCDeploySignParameters)); if (t_stat == ES_NORMAL) t_stat = fetch_opt_cstring(ep2, t_array, "passphrase", t_params . passphrase); if (t_stat == ES_NORMAL) t_stat = fetch_opt_filepath(ep2, t_array, "certificate", t_params . certificate); if (t_stat == ES_NORMAL) t_stat = fetch_opt_filepath(ep2, t_array, "privatekey", t_params . privatekey); if (t_stat == ES_NORMAL) t_stat = fetch_opt_filepath(ep2, t_array, "certstore", t_params . certstore); if (t_stat == ES_NORMAL) t_stat = fetch_opt_cstring(ep2, t_array, "timestamper", t_params . timestamper); if (t_stat == ES_NORMAL) t_stat = fetch_opt_cstring(ep2, t_array, "description", t_params . description); if (t_stat == ES_NORMAL) t_stat = fetch_opt_cstring(ep2, t_array, "url", t_params . url); if (t_stat == ES_NORMAL) t_stat = fetch_filepath(ep2, t_array, "input", t_params . input); if (t_stat == ES_NORMAL) t_stat = fetch_filepath(ep2, t_array, "output", t_params . output); if (t_stat == ES_NORMAL) if (t_params . certstore != NULL && (t_params . certificate != NULL || t_params . privatekey != NULL)) t_stat = ES_ERROR; if (t_stat == ES_NORMAL) if (t_params . certstore == NULL && (t_params . certificate == NULL || t_params . privatekey == NULL)) t_stat = ES_ERROR; bool t_can_sign; t_can_sign = true; if (t_stat == ES_NORMAL && !InitSSLCrypt()) { MCresult -> sets("could not initialize SSL"); t_can_sign = false; } if (t_can_sign && t_stat == ES_NORMAL) { if (m_platform == PLATFORM_WINDOWS) MCDeploySignWindows(t_params); MCDeployError t_error; t_error = MCDeployCatch(); if (t_error != kMCDeployErrorNone) MCresult -> sets(MCDeployErrorToString(t_error)); } delete t_params . passphrase; delete t_params . certificate; delete t_params . privatekey; delete t_params . certstore; delete t_params . timestamper; delete t_params . description; delete t_params . url; delete t_params . input; delete t_params . output; return t_stat; }
Exec_stat MCIdeDeploy::exec(MCExecPoint& ep) { Exec_stat t_stat; t_stat = ES_NORMAL; bool t_soft_error; t_soft_error = false; // Clear the result as we return an error there MCresult -> clear(); if (t_stat == ES_NORMAL) t_stat = m_params -> eval(ep); MCVariableValue *t_array; if (t_stat == ES_NORMAL) { t_array = ep . getarray(); if (t_array == NULL) return ES_ERROR; } MCExecPoint ep2(ep); MCDeployParameters t_params; memset(&t_params, 0, sizeof(MCDeployParameters)); if (t_stat == ES_NORMAL) t_stat = fetch_opt_filepath(ep2, t_array, "engine_ppc", t_params . engine_ppc); if (t_stat == ES_NORMAL) t_stat = fetch_opt_filepath(ep2, t_array, "engine_x86", t_params . engine_x86); if (t_stat == ES_NORMAL && t_params . engine_ppc == NULL && t_params . engine_x86 == NULL) t_stat = fetch_opt_filepath(ep2, t_array, "engine", t_params . engine); if (t_stat == ES_NORMAL) t_stat = fetch_filepath(ep2, t_array, "stackfile", t_params . stackfile); if (t_stat == ES_NORMAL) t_stat = fetch_filepath_array(ep2, t_array, "auxillary_stackfiles", t_params . auxillary_stackfiles, t_params . auxillary_stackfile_count); if (t_stat == ES_NORMAL) t_stat = fetch_cstring_array(ep2, t_array, "externals", t_params . externals, t_params . external_count); if (t_stat == ES_NORMAL) t_stat = fetch_opt_cstring(ep2, t_array, "startup_script", t_params . startup_script); if (t_stat == ES_NORMAL) t_stat = fetch_cstring_array(ep2, t_array, "redirects", t_params . redirects, t_params . redirect_count); if (t_stat == ES_NORMAL) t_stat = fetch_opt_filepath(ep2, t_array, "appicon", t_params . app_icon); if (t_stat == ES_NORMAL) t_stat = fetch_opt_filepath(ep2, t_array, "docicon", t_params . doc_icon); if (t_stat == ES_NORMAL) t_stat = fetch_opt_filepath(ep2, t_array, "manifest", t_params . manifest); if (t_stat == ES_NORMAL) t_stat = fetch_opt_filepath(ep2, t_array, "payload", t_params . payload); if (t_stat == ES_NORMAL) t_stat = fetch_opt_filepath(ep2, t_array, "spill", t_params . spill); if (t_stat == ES_NORMAL) t_stat = fetch_filepath(ep2, t_array, "output", t_params . output); if (t_stat == ES_NORMAL) { t_stat = t_array -> fetch_element(ep2, "version"); if (t_stat == ES_NORMAL && ep2 . getarray() != NULL) t_params . version_info = new MCVariableValue(*ep2 . getarray()); } // If platform is iOS and we are not Mac then error #ifndef _MACOSX if (t_stat == ES_NORMAL && (m_platform == PLATFORM_IOS || m_platform == PLATFORM_IOS_EMBEDDED)) { MCresult -> sets("ios deployment not supported on this platform"); t_soft_error = true; t_stat = ES_ERROR; } #endif // Now, if we are not licensed for a target, then its an error. bool t_is_licensed; t_is_licensed = false; if (m_platform == PLATFORM_WINDOWS) t_is_licensed = (MClicenseparameters . deploy_targets & kMCLicenseDeployToWindows) != 0; else if (m_platform == PLATFORM_MACOSX) t_is_licensed = (MClicenseparameters . deploy_targets & kMCLicenseDeployToMacOSX) != 0; else if (m_platform == PLATFORM_LINUX) t_is_licensed = (MClicenseparameters . deploy_targets & kMCLicenseDeployToLinux) != 0; else if (m_platform == PLATFORM_IOS) t_is_licensed = (MClicenseparameters . deploy_targets & kMCLicenseDeployToIOS) != 0; else if (m_platform == PLATFORM_ANDROID) t_is_licensed = (MClicenseparameters . deploy_targets & kMCLicenseDeployToAndroid) != 0; else if (m_platform == PLATFORM_IOS_EMBEDDED) t_is_licensed = (MClicenseparameters . deploy_targets & kMCLicenseDeployToIOSEmbedded) != 0; else if (m_platform == PLATFORM_ANDROID_EMBEDDED) t_is_licensed = (MClicenseparameters . deploy_targets & kMCLicenseDeployToAndroidEmbedded) != 0; if (!t_is_licensed) { MCresult -> sets("not licensed to deploy to target platform"); t_soft_error = true; t_stat = ES_ERROR; } if (t_stat == ES_NORMAL) { if (m_platform == PLATFORM_WINDOWS) MCDeployToWindows(t_params); else if (m_platform == PLATFORM_LINUX) MCDeployToLinux(t_params); else if (m_platform == PLATFORM_MACOSX) MCDeployToMacOSX(t_params); else if (m_platform == PLATFORM_IOS) MCDeployToIOS(t_params, false); else if (m_platform == PLATFORM_ANDROID) MCDeployToAndroid(t_params); else if (m_platform == PLATFORM_IOS_EMBEDDED) MCDeployToIOS(t_params, true); MCDeployError t_error; t_error = MCDeployCatch(); if (t_error != kMCDeployErrorNone) MCresult -> sets(MCDeployErrorToString(t_error)); else MCresult -> clear(); } delete t_params . output; delete t_params . spill; delete t_params . stackfile; MCCStringArrayFree(t_params . auxillary_stackfiles, t_params . auxillary_stackfile_count); MCCStringArrayFree(t_params . externals, t_params . external_count); delete t_params . startup_script; MCCStringArrayFree(t_params . redirects, t_params . redirect_count); delete t_params . app_icon; delete t_params . doc_icon; delete t_params . manifest; delete t_params . payload; delete t_params . engine; delete t_params . engine_ppc; delete t_params . engine_x86; delete t_params . version_info; if (t_stat == ES_ERROR && t_soft_error) return ES_NORMAL; return t_stat; }
void Bond::Render(Render2D * r) { double myangle, x1, y1, x2, y2, rise, run, lx, ly, cf = 0.02; QColor c1; if ( highlighted ) c1 = Render2D::highlightColor; else c1 = color; // for single bonds if ( order == 1 ) { if ( dashed > 0 ) r->drawLine( start->toQPoint(), end->toQPoint(), thick, c1, 1 ); else r->drawLine( start->toQPoint(), end->toQPoint(), thick, c1 ); return; } // for stereo_up bonds if ( order == 5 ) { r->drawUpLine( start->toQPoint(), end->toQPoint(), c1 ); return; } // for wavy bonds (order = 6) if ( order == 6 ) { r->drawWavyLine( start->toQPoint(), end->toQPoint(), c1 ); return; } // for stereo_down bonds if ( order == 7 ) { r->drawDownLine( start->toQPoint(), end->toQPoint(), c1 ); return; } // for double and triple bonds myangle = getAngle( start, end ); myangle += 90.0; myangle = myangle * ( M_PI / 180.0 ); //double offs = start->distanceTo(end) / 25.0; /* offs = preferences.getDoubleBondOffset(); if (order == 3) { if (thick > 2) offs += 0.5; if (thick > 3) offs += 0.4; if (thick > 4) offs += 0.3; } else { if (thick > 2) offs += 0.3; if (thick > 4) offs += 0.3; } x2 = cos(myangle) * 3.0 * offs; y2 = sin(myangle) * 3.0 * offs; // x1, y1, 3 and 4 are for use with special case 1 below x1 = cos(myangle) * 2.5 * offs; y1 = sin(myangle) * 2.5 * offs; */ /* original (does not use preferences!) double abl = 1.0; abl = (double)thick / 2.0 + 1.0; */ double abl = 1.0; abl = ( double ) thick / 2.0 + preferences.getDoubleBondOffset(); // check for order 2 special case (center double bond) bool special_case_1 = false; if ( order == 2 ) { //qDebug() << "start->element: " << start->element ; //qDebug() << "start->subst: " << start->substituents ; //qDebug() << "end->element: " << end->element ; //qDebug() << "end->subst: " << end->substituents ; if ( ( start->element == "O" ) && ( start->substituents == 2 ) ) special_case_1 = true; if ( ( end->element == "O" ) && ( end->substituents == 2 ) ) special_case_1 = true; if ( ( start->element == "C" ) && ( start->substituents == 2 ) ) special_case_1 = true; if ( ( end->element == "C" ) && ( end->substituents == 2 ) ) special_case_1 = true; if ( ( start->element == "CH2" ) && ( start->substituents == 2 ) ) special_case_1 = true; if ( ( end->element == "CH2" ) && ( end->substituents == 2 ) ) special_case_1 = true; if ( ( start->element == "N" ) && ( end->element == "N" ) ) special_case_1 = true; if ( wside == 2 ) // force centered double bond special_case_1 = true; } if ( special_case_1 ) abl = ( double ) thick / 2.0 + preferences.getDoubleBondOffset() / 4.0; else abl = ( double ) thick / 2.0 + preferences.getDoubleBondOffset() / 2.0; //qDebug() << "abl = " << abl; x2 = cos( myangle ) * abl; y2 = sin( myangle ) * abl; // x1, y1, 3 and 4 are for use with special case 1 below x1 = cos( myangle ) * abl; y1 = sin( myangle ) * abl; QPoint sp3( qRound( start->x + x1 ), qRound( start->y + y1 ) ); QPoint ep3( qRound( end->x + x1 ), qRound( end->y + y1 ) ); QPoint sp4( qRound( start->x - x1 ), qRound( start->y - y1 ) ); QPoint ep4( qRound( end->x - x1 ), qRound( end->y - y1 ) ); // shorten lines by removing from each end double bl = start->distanceTo( end ); if ( bl < 100.0 ) cf = 0.03; if ( bl < 51.0 ) cf = 0.05; if ( bl < 27.0 ) cf = 0.07; // find sp1 and ep1 rise = ( end->y + y2 ) - ( start->y + y2 ); run = ( end->x + x2 ) - ( start->x + x2 ); lx = start->x + x2 + run * cf; ly = start->y + y2 + rise * cf; QPoint sp1( ( int ) lx, ( int ) ly ); lx = start->x + x2 + run * ( 1.0 - cf ); ly = start->y + y2 + rise * ( 1.0 - cf ); QPoint ep1( ( int ) lx, ( int ) ly ); // find sp2 and ep2 rise = ( end->y - y2 ) - ( start->y - y2 ); run = ( end->x - x2 ) - ( start->x - x2 ); lx = start->x - x2 + run * cf; ly = start->y - y2 + rise * cf; QPoint sp2( ( int ) lx, ( int ) ly ); lx = start->x - x2 + run * ( 1.0 - cf ); ly = start->y - y2 + rise * ( 1.0 - cf ); QPoint ep2( ( int ) lx, ( int ) ly ); if ( special_case_1 == true ) { if ( dashed > 1 ) r->drawLine( sp3, ep3, thick, c1, 1 ); else r->drawLine( sp3, ep3, thick, c1 ); if ( dashed > 0 ) r->drawLine( sp4, ep4, thick, c1, 1 ); else r->drawLine( sp4, ep4, thick, c1 ); return; } QPoint sp, ep; if ( order == 2 ) { if ( wside == 1 ) { sp = sp1; ep = ep1; } else { sp = sp2; ep = ep2; } //qDebug() << "wside:" << wside; if ( dashed > 1 ) r->drawLine( start->toQPoint(), end->toQPoint(), thick, c1, 1 ); else r->drawLine( start->toQPoint(), end->toQPoint(), thick, c1 ); if ( dashed > 0 ) r->drawLine( sp, ep, thick, c1, 1 ); else r->drawLine( sp, ep, thick, c1 ); return; } if ( order == 3 ) { if ( dashed > 2 ) r->drawLine( start->toQPoint(), end->toQPoint(), thick, c1, 1 ); else r->drawLine( start->toQPoint(), end->toQPoint(), thick, c1 ); if ( dashed > 1 ) r->drawLine( sp1, ep1, thick, c1, 1 ); else r->drawLine( sp1, ep1, thick, c1 ); if ( dashed > 0 ) r->drawLine( sp2, ep2, thick, c1, 1 ); else r->drawLine( sp2, ep2, thick, c1 ); return; } }
Exec_stat MCRepeat::exec(MCExecPoint &ep) { real8 endn = 0.0; int4 count = 0; MCExecPoint ep2(ep); MCScriptPoint *sp = NULL; Parse_stat ps; const char *sptr; uint4 l; MCVariableValue *tvar = NULL; MCHashentry *hptr = NULL; uint4 kindex = 0; Boolean donumeric = False; Exec_stat stat; switch (form) { case RF_FOR: if (loopvar != NULL) { while ((stat = endcond->eval(ep2)) != ES_NORMAL && (MCtrace || MCnbreakpoints) && !MCtrylock && !MClockerrors) MCB_error(ep2, getline(), getpos(), EE_REPEAT_BADFORCOND); if (stat != ES_NORMAL) { MCeerror->add(EE_REPEAT_BADFORCOND, line, pos); return ES_ERROR; } if (each == FU_ELEMENT) { tvar = ep2.getarray(); if (tvar != NULL && tvar -> is_array()) { l = 1; kindex = 0; donumeric = tvar -> get_array() -> isnumeric(); hptr = tvar -> get_array() -> getnextelement(kindex, hptr, donumeric, ep); if (hptr == NULL) { kindex = 0; donumeric = False; hptr = tvar -> get_array() -> getnextelement(kindex, hptr, donumeric, ep); } } else l = 0; } else if (each == FU_KEY) { tvar = ep2.getarray(); if (tvar != NULL && tvar -> is_array()) { l = 1; kindex = 0; donumeric = False; hptr = tvar -> get_array() -> getnextkey(kindex, hptr); // [[ Bug 3871 ]] : If hptr is NULL then we are done already (this can happen // with an empty custom property set). if (hptr == NULL) l = 0; } else l = 0; } else { sptr = ep2.getsvalue().getstring(); l = ep2.getsvalue().getlength(); if (each == FU_WORD) MCU_skip_spaces(sptr, l); else if (each == FU_TOKEN) { sp = new MCScriptPoint(ep2); ps = sp->nexttoken(); if (ps == PS_ERROR || ps == PS_EOF) l = 0; } } } else { while (((stat = endcond->eval(ep)) != ES_NORMAL || (stat = ep.ton()) != ES_NORMAL) && (MCtrace || MCnbreakpoints) && !MCtrylock && !MClockerrors) MCB_error(ep, getline(), getpos(), EE_REPEAT_BADFORCOND); if (stat != ES_NORMAL) { MCeerror->add (EE_REPEAT_BADFORCOND, line, pos); return ES_ERROR; } count = MCU_max(ep.getint4(), 0); } break; case RF_WITH: if (step != NULL) { while (((stat = step->eval(ep)) != ES_NORMAL || (stat = ep.ton()) != ES_NORMAL) && (MCtrace || MCnbreakpoints) && !MCtrylock && !MClockerrors) MCB_error(ep, getline(), getpos(), EE_REPEAT_BADWITHSTEP); stepval = ep.getnvalue(); if (stat != ES_NORMAL || stepval == 0.0) { MCeerror->add (EE_REPEAT_BADWITHSTEP, line, pos); return ES_ERROR; } } while (((stat = startcond->eval(ep)) != ES_NORMAL || (stat = ep.ton()) != ES_NORMAL) && (MCtrace || MCnbreakpoints) && !MCtrylock && !MClockerrors) MCB_error(ep, getline(), getpos(), EE_REPEAT_BADWITHSTART); if (stat != ES_NORMAL) { MCeerror->add (EE_REPEAT_BADWITHSTART, line, pos); return ES_ERROR; } ep.setnvalue(ep.getnvalue() - stepval); while ((stat = loopvar->set (ep)) != ES_NORMAL && (MCtrace || MCnbreakpoints) && !MCtrylock && !MClockerrors) MCB_error(ep, getline(), getpos(), EE_REPEAT_BADWITHVAR); if (stat != ES_NORMAL) { MCeerror->add (EE_REPEAT_BADWITHVAR, line, pos); return ES_ERROR; } while (((stat = endcond->eval(ep)) != ES_NORMAL || (stat = ep.ton()) != ES_NORMAL) && (MCtrace || MCnbreakpoints) && !MCtrylock && !MClockerrors) MCB_error(ep, getline(), getpos(), EE_REPEAT_BADWITHEND); if (stat != ES_NORMAL) { MCeerror->add (EE_REPEAT_BADWITHEND, line, pos); return ES_ERROR; } endn = ep.getnvalue(); break; default: break; } MCString s; Boolean done = False; bool t_first; t_first = false; while (True) { switch (form) { case RF_FOREVER: break; case RF_FOR: if (loopvar != NULL) { if (l == 0) { done = True; // OK-2007-12-05 : Bug 5605. If there has been at least one iteration, set the loop variable to // whatever the value was in the last iteration. if (!t_first) { // MW-2011-02-08: [[ Bug ]] Make sure we don't use 's' if the repeat type is 'key' or // 'element'. if (each != FU_ELEMENT && each != FU_KEY) { ep.setsvalue(s); loopvar->set(ep); } } } else { const char *startptr; // = sptr; switch (each) { case FU_KEY: // MW-2010-12-15: [[ Bug 9218 ]] Make a copy of the key so that it can't be mutated // accidentally. ep . setstaticcstring(hptr -> string); loopvar -> set(ep); hptr = tvar -> get_array() -> getnextkey(kindex, hptr); if (hptr == NULL) l = 0; break; case FU_ELEMENT: hptr -> value . fetch(ep); loopvar -> set(ep); hptr = tvar -> get_array() -> getnextelement(kindex, hptr, donumeric, ep); if (hptr == NULL) l = 0; break; case FU_LINE: startptr = sptr; if (!MCU_strchr(sptr, l, ep.getlinedel())) { sptr += l; l = 0; } s.set(startptr, sptr - startptr); MCU_skip_char(sptr, l); break; case FU_ITEM: startptr = sptr; if (!MCU_strchr(sptr, l, ep.getitemdel())) { sptr += l; l = 0; } s.set(startptr, sptr - startptr); MCU_skip_char(sptr, l); break; case FU_WORD: startptr = sptr; if (*sptr == '\"') { MCU_skip_char(sptr, l); while (l && *sptr != '\"' && *sptr != '\n') MCU_skip_char(sptr, l); MCU_skip_char(sptr, l); } else while (l && !isspace((uint1)*sptr)) MCU_skip_char(sptr, l); s.set(startptr, sptr - startptr); MCU_skip_spaces(sptr, l); break; case FU_TOKEN: s = sp->gettoken(); ps = sp->nexttoken(); if (ps == PS_ERROR || ps == PS_EOF) l = 0; break; case FU_CHARACTER: default: startptr = sptr; s.set(startptr, 1); MCU_skip_char(sptr, l); } // MW-2010-12-15: [[ Bug 9218 ]] Added KEY to the type of repeat that already // copies the value. if (each != FU_ELEMENT && each != FU_KEY) { if (MCtrace) { ep.setsvalue(s); loopvar->set(ep); } else loopvar->sets(s); } } } else done = count-- == 0; break; case RF_UNTIL: while ((stat = endcond->eval(ep)) != ES_NORMAL && (MCtrace || MCnbreakpoints) && !MCtrylock && !MClockerrors) MCB_error(ep, getline(), getpos(), EE_REPEAT_BADUNTILCOND); if (stat != ES_NORMAL) { MCeerror->add (EE_REPEAT_BADUNTILCOND, line, pos); return ES_ERROR; } done = ep.getsvalue() == MCtruemcstring; break; case RF_WHILE: while ((stat = endcond->eval(ep)) != ES_NORMAL && (MCtrace || MCnbreakpoints) && !MCtrylock && !MClockerrors) MCB_error(ep, getline(), getpos(), EE_REPEAT_BADWHILECOND); if (stat != ES_NORMAL) { MCeerror->add (EE_REPEAT_BADWHILECOND, line, pos); return ES_ERROR; } done = ep.getsvalue() != MCtruemcstring; break; case RF_WITH: while (((stat = loopvar->eval(ep)) != ES_NORMAL || (stat = ep.ton()) != ES_NORMAL) && (MCtrace || MCnbreakpoints) && !MCtrylock && !MClockerrors) MCB_error(ep, getline(), getpos(), EE_REPEAT_BADWITHVAR); if (stat != ES_NORMAL) { MCeerror->add (EE_REPEAT_BADWITHVAR, line, pos); return ES_ERROR; } if (stepval < 0) { if (ep.getnvalue() <= endn) done = True; } else if (ep.getnvalue() >= endn) done = True; if (!done) { ep.setnvalue(ep.getnvalue() + stepval); while ((stat = loopvar->set (ep)) != ES_NORMAL && (MCtrace || MCnbreakpoints) && !MCtrylock && !MClockerrors) MCB_error(ep, getline(), getpos(), EE_REPEAT_BADWITHVAR); if (stat != ES_NORMAL) { MCeerror->add (EE_REPEAT_BADWITHVAR, line, pos); return ES_ERROR; } } break; default: break; } if (done) break; Exec_stat stat; MCStatement *tspr = statements; while (tspr != NULL) { if (MCtrace || MCnbreakpoints) { MCB_trace(ep, tspr->getline(), tspr->getpos()); if (MCexitall) break; } ep.setline(tspr->getline()); stat = tspr->exec(ep); // MW-2011-08-17: [[ Redraw ]] Flush any screen updates. MCRedrawUpdateScreen(); switch(stat) { case ES_NORMAL: if (MCexitall) { // OK-2007-12-05 : Bug 5605 : If exiting loop, set the loop variable to the value it had // in the last iteration. // MW-2011-02-08: [[ Bug ]] Make sure we don't use 's' if the repeat type is 'key' or // 'element'. if (form == RF_FOR && loopvar != NULL && each != FU_ELEMENT && each != FU_KEY) { ep.setsvalue(s); loopvar->set(ep); } delete sp; return ES_NORMAL; } tspr = tspr->getnext(); break; case ES_NEXT_REPEAT: tspr = NULL; break; case ES_EXIT_REPEAT: // OK-2007-12-05 : Bug 5605 : If exiting loop, set the loop variable to the value it had // in the last iteration. // MW-2011-02-08: [[ Bug ]] Make sure we don't use 's' if the repeat type is 'key' or // 'element'. if (form == RF_FOR && loopvar != NULL && each != FU_ELEMENT && each != FU_KEY) { ep.setsvalue(s); loopvar->set(ep); } delete sp; return ES_NORMAL; case ES_ERROR: if ((MCtrace || MCnbreakpoints) && !MCtrylock && !MClockerrors) do { MCB_error(ep, tspr->getline(), tspr->getpos(), EE_REPEAT_BADSTATEMENT); } while (MCtrace && (stat = tspr->exec(ep)) != ES_NORMAL); if (stat == ES_ERROR) { // OK-2007-12-05 : Bug 5605 : If exiting loop, set the loop variable to the value it had // in the last iteration. // MW-2011-02-08: [[ Bug ]] Make sure we don't use 's' if the repeat type is 'key' or // 'element'. if (form == RF_FOR && loopvar != NULL && each != FU_ELEMENT && each != FU_KEY) { ep.setsvalue(s); loopvar->set(ep); } delete sp; if (MCexitall) return ES_NORMAL; else { MCeerror->add(EE_REPEAT_BADSTATEMENT, line, pos); return ES_ERROR; } } else tspr = tspr->getnext(); break; default: // OK-2007-12-05 : Bug 5605 : If exiting loop, set the loop variable to the value it had // in the last iteration. // MW-2011-02-08: [[ Bug ]] Make sure we don't use 's' if the repeat type is 'key' or // 'element'. if (form == RF_FOR && loopvar != NULL && each != FU_ELEMENT && each != FU_KEY) { ep.setsvalue(s); loopvar->set(ep); } delete sp; return stat; } } if (MCscreen->abortkey()) { // OK-2007-12-05 : Bug 5605 : If exiting loop, set the loop variable to the value it had // in the last iteration. // MW-2011-02-08: [[ Bug ]] Make sure we don't use 's' if the repeat type is 'key' or // 'element'. if (form == RF_FOR && loopvar != NULL && each != FU_ELEMENT && each != FU_KEY) { ep.setsvalue(s); loopvar->set(ep); } delete sp; MCeerror->add(EE_REPEAT_ABORT, line, pos); return ES_ERROR; } if (MCtrace || MCnbreakpoints) { MCB_trace(ep, getline(), getpos()); if (MCexitall) break; } t_first = false; } delete sp; return ES_NORMAL; }
Exec_stat MCSwitch::exec(MCExecPoint &ep) { MCExecPoint ep2(ep); Exec_stat stat; if (cond != NULL) { while ((stat = cond->eval(ep2)) != ES_NORMAL && (MCtrace || MCnbreakpoints) && !MCtrylock && !MClockerrors) MCB_error(ep2, getline(), getpos(), EE_SWITCH_BADCOND); if (stat != ES_NORMAL) { MCeerror->add(EE_SWITCH_BADCOND, line, pos); return ES_ERROR; } } else ep2.setboolean(true); int2 match = defaultcase; uint2 i; for (i = 0 ; i < ncases ; i++) { while ((stat = cases[i]->eval(ep)) != ES_NORMAL && (MCtrace || MCnbreakpoints) && !MCtrylock && !MClockerrors) MCB_error(ep2, getline(), getpos(), EE_SWITCH_BADCASE); if (stat != ES_NORMAL) { MCeerror->add (EE_SWITCH_BADCASE, line, pos); return ES_ERROR; } uint4 l1 = ep.getsvalue().getlength(); uint4 l2 = ep2.getsvalue().getlength(); if (l1 == l2) { const char *s1 = ep.getsvalue().getstring(); const char *s2 = ep2.getsvalue().getstring(); if (ep.getcasesensitive() && !strncmp(s1, s2, l1) || !ep.getcasesensitive() && !MCU_strncasecmp(s1, s2, l1)) { match = caseoffsets[i]; break; } } } if (match >= 0) { MCStatement *tspr = statements; while (match--) tspr = tspr->getnext(); Exec_stat stat; while (tspr != NULL) { if (MCtrace || MCnbreakpoints) { MCB_trace(ep, tspr->getline(), tspr->getpos()); if (MCexitall) break; } ep.setline(tspr->getline()); stat = tspr->exec(ep); // MW-2011-08-17: [[ Redraw ]] Flush any screen updates. MCRedrawUpdateScreen(); switch(stat) { case ES_NORMAL: if (MCexitall) return ES_NORMAL; tspr = tspr->getnext(); break; case ES_ERROR: if ((MCtrace || MCnbreakpoints) && !MCtrylock && !MClockerrors) do { MCB_error(ep, tspr->getline(), tspr->getpos(), EE_SWITCH_BADSTATEMENT); } while (MCtrace && (stat = tspr->exec(ep)) != ES_NORMAL); if (stat == ES_ERROR) if (MCexitall) return ES_NORMAL; else { MCeerror->add (EE_SWITCH_BADSTATEMENT, line, pos); return ES_ERROR; } else tspr = tspr->getnext(); break; case ES_EXIT_SWITCH: return ES_NORMAL; default: return stat; } } } return ES_NORMAL; }