bool CorporationDB::CreateMemberAttributeUpdate(MemberAttributeUpdate & attrib, uint32 newCorpID, uint32 charID) { // What are we doing here exactly? // Corporation gets a new member // it's new to it DBQueryResult res; DBResultRow row; if (!sDatabase.RunQuery(res, " SELECT " " title, corporationDateTime, corporationID, " " corpRole, rolesAtAll, rolesAtBase, " " rolesAtHQ, rolesAtOther " " FROM character_ " " WHERE character_.characterID = %u ", charID)) { codelog(SERVICE__ERROR, "Error in query: %s", res.error.c_str()); return false; } if (!res.GetRow(row)) { codelog(SERVICE__ERROR, "Cannot find character in database"); return false; } // this could be stored in the db #define PRN new PyNone() #define PRI(i) new PyInt(i) #define PRL(i) new PyLong(i) #define PRS(s) new PyString(s) #define PRNI(i) (row.IsNull(i) ? PRL(0) : PRL(row.GetUInt64(i))) #define F(name, o, n) \ attrib.name##Old = o; \ attrib.name##New = n //element Old Value New Value F(accountKey, PRN, PRN); // i don't even know what this could refer to F(baseID, PRN, PRN); F(characterID, PRN, PRI(charID)); F(corporationID, PRI(row.GetUInt(2)), PRI(newCorpID)); // these also have to be queried from the db F(divisionID, PRN, PRN); F(roles, PRNI(3), PRI(0)); F(grantableRoles, PRNI(4), PRI(0)); F(grantableRolesAtBase, PRNI(5), PRI(0)); F(grantableRolesAtHQ, PRNI(6), PRI(0)); F(grantableRolesAtOther, PRNI(7), PRI(0)); F(squadronID, PRN, PRN); F(startDateTime, PRL(row.GetUInt64(1)), PRL(Win32TimeNow())); // another one i have no idea F(titleMask, PRN, PRI(0)); F(baseID, PRS(row.GetText(0)), PRS("")); #undef F #undef PRN #undef PRI #undef PRS #undef PRNI return true; }
void MyFunctionRequestHandler::upload(ESP8266WebServer& server, String requestUri, HTTPUpload& upload){ //Serial.println(String(F("upload(")) + requestUri + String(F(")"))); String filename = parseFileName(upload.filename); if (filename.endsWith(".bin")) { // handle firmware upload mbRebootRequired = true; if (upload.status == UPLOAD_FILE_START) { if (mDebug) Serial.println("Update: " + upload.filename); uint32_t maxSketchSpace = (ESP.getFreeSketchSpace() - 0x1000) & 0xFFFFF000; if (!Update.begin(maxSketchSpace)) { //start with max available size if (mDebug) Update.printError(Serial); } } else if (upload.status == UPLOAD_FILE_WRITE) { if (mDebug) Serial.print("."); if (Update.write(upload.buf, upload.currentSize) != upload.currentSize) { if (mDebug) Update.printError(Serial); } } else if (upload.status == UPLOAD_FILE_END) { miUploadSize = Update.size(); if (Update.end(true)) { //true to set the size to the current progress if (mDebug) Serial.println(String(F("Update Success - uploaded: ")) + String(upload.totalSize) + String(F(".... rebooting now!"))); } else { if (mDebug) Update.printError(Serial); } if (mDebug) Serial.setDebugOutput(false); } else if (upload.status == UPLOAD_FILE_ABORTED) { miUploadSize = Update.size(); Update.end(); if (mDebug) Serial.println(F("Update was aborted")); } } else { // handle file upload mbRebootRequired = false; if (upload.status == UPLOAD_FILE_START) { if (mDebug) Serial.println(String(F("uploading to SPIFFS: /")) + filename); mUploadFile = SPIFFS.open("/" + filename, "w"); } else if (upload.status == UPLOAD_FILE_WRITE) { if (mDebug) Serial.print("."); if (mUploadFile.write(upload.buf, upload.currentSize) != upload.currentSize) { if (mDebug) Serial.println(String(F("ERROR writing file ")) + String(mUploadFile.name()) + String(F("to SPIFFS."))); mUploadFile.close(); } } else if (upload.status == UPLOAD_FILE_END) { miUploadSize = upload.totalSize; if (mUploadFile.size() == upload.totalSize) { if (mDebug) Serial.println(String(F("Upload to SPIFFS Succeeded - uploaded: ")) + String(upload.totalSize) + String(F(".... rebooting now!"))); } else { if (mDebug) Serial.println(String(F("Upload to SPIFFS FAILED: ")) + String(mUploadFile.size()) + String(F(" bytes of ")) + String(upload.totalSize)); } mUploadFile.close(); if (!upload.totalSize){ if (mDebug) Serial.println("Removing: " + filename); SPIFFS.remove("/" + filename); } } else if (upload.status == UPLOAD_FILE_ABORTED) { miUploadSize = upload.totalSize; mUploadFile.close(); if (mDebug) Serial.println(F("Upload to SPIFFS was aborted")); } } }
void MyFunctionRequestHandler::infoHandler(ESP8266WebServer& server) { String json = F("{"); json += '"'; json += F("heap"); json += '"'; json += ':'; json += '"'; json += String(ESP.getFreeHeap()); json += '"'; json += F(", "); json += '"'; json += F("ssid"); json += '"'; json += ':'; json += '"'; json += String(WiFi.SSID()); json += '"'; json += F(", "); json += '"'; json += F("ipaddress"); json += '"'; json += ':'; json += '"'; json += WiFi.localIP().toString(); json += '"'; json += F(", "); json += '"'; json += F("ipgateway"); json += '"'; json += ':'; json += '"'; json += WiFi.gatewayIP().toString(); json += '"'; json += F(", "); json += '"'; json += F("ipdns"); json += '"'; json += ':'; json += '"'; json += WiFi.dnsIP().toString(); json += '"'; json += F(", "); json += '"'; json += F("ipsubnetmask"); json += '"'; json += ':'; json += '"'; json += WiFi.subnetMask().toString(); json += '"'; json += F(", "); json += '"'; json += F("macaddress"); json += '"'; json += ':'; json += '"'; json += WiFi.macAddress(); json += '"'; json += F(", "); json += '"'; json += F("hostname"); json += '"'; json += ':'; json += '"'; json += WiFi.hostname(); json += '"'; json += F(", "); json += '"'; json += F("apipaddress"); json += '"'; json += ':'; json += '"'; json += WiFi.softAPIP().toString(); json += '"'; json += F(", "); json += '"'; json += F("apconnectedstations"); json += '"'; json += ':'; json += '"'; json += String(WiFi.softAPgetStationNum()); json += '"'; json += F(", "); json += '"'; json += F("wifiautoconnect"); json += '"'; json += ':'; json += '"'; json += String(WiFi.getAutoConnect()); json += '"'; json += F(", "); json += '"'; json += F("firmwareversion"); json += '"'; json += ':'; json += '"'; json += String(FIRMWARE_VERSION); json += '"'; json += '}'; server.sendHeader(F("cache-control"), F("private, max-age=0, no-cache, no-store")); server.send(200, F("text/json"), json); }
void Style::drawComboBox(const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget) const { ASSURE_OPTION(cmb, ComboBox); OPT_ENABLED OPT_HOVER OPT_FOCUS SAVE_PAINTER(Pen|Brush|Alias); if ( widget && widget->inherits("WebView") ) { // paints hardcoded black text bypassing the style?! grrr... const_cast<QStyleOptionComboBox*>(cmb)->palette.setColor(QPalette::Window, QColor(230,230,230,255)); widget = 0; } animStep = !widget ? MAX_STEPS*hover : Animator::Hover::step(widget); QRect ar; const QComboBox *combo = widget ? qobject_cast<const QComboBox*>(widget) : NULL; if ((cmb->subControls & SC_ComboBoxArrow) && (!combo || combo->count() > 0)) { // do we have an arrow? ar = subControlRect(CC_ComboBox, cmb, SC_ComboBoxArrow, widget); const int dx = (F(2) & ~1) / 2; ar.translate(cmb->direction == Qt::LeftToRight ? -dx : dx, 0); } const bool listShown = combo && combo->view() && ((QWidget*)(combo->view()))->isVisible(); if (listShown) { // this messes up hover hover = hover || QRect(widget->mapToGlobal(RECT.topLeft()), RECT.size()).contains(QCursor::pos()); // TODO Qt5, avoid asking for the cursor pos animStep = MAX_STEPS; } QColor c = hasFocus ? FCOLOR(Highlight) : (cmb->editable ? FCOLOR(Text) : FCOLOR(WindowText)); if (cmb->editable) { drawLineEditFrame(option, painter, widget); c = FX::blend(FCOLOR(Base), c, MAX_STEPS, 1 + 2*animStep); } else { const int icon = cmb->currentIcon.isNull() ? 0 : cmb->iconSize.width() + F(4); QFont fnt(painter->font()); fnt.setBold(true); int text = QFontMetrics(fnt).width(cmb->currentText); if (text) text += F(4); if (!(text+icon)) // webkit etc. text = ar.left() - (F(16) + RECT.x()); painter->setRenderHint(QPainter::Antialiasing, true); painter->setPen(QPen(hasFocus ? FCOLOR(Highlight) : FX::blend(FCOLOR(Window), c, 4, 1), FRAME_STROKE)); painter->setBrush(Qt::NoBrush); const int y = ar.y() + ar.height()/2; const int da = animStep * 168 / MAX_STEPS; if (option->direction == Qt::LeftToRight) { DRAW_SEGMENT(ar, 16*(120 - da/2), 16*(192+da)); painter->drawLine(RECT.x() + icon + text + F(6), y, ar.left()-F(2), y); } else { DRAW_SEGMENT(ar, 16*(30 + da/2), -16*(192+da)); painter->drawLine(RECT.right() - (icon + text + F(6)), y, ar.right()+F(2), y); } c = FX::blend(FCOLOR(Window), FCOLOR(WindowText), MAX_STEPS - animStep, 1 + animStep); } if (!isEnabled) { RESTORE_PAINTER return; }
~AutoPtr() { if (mPtr) F(mPtr); }
{ "-seed", OPT_INT, &seed, "Seed for random parameters." }, { "-points", OPT_INT, &points, "Number of points to produce." }, { "-f0", OPT_DOUBLE, &f0, "Initial fish population." }, { "-s0", OPT_DOUBLE, &s0, "Initial shark population." }, { "-a", OPT_DOUBLE, &a, "Fish growth rate." }, { "-b", OPT_DOUBLE, &b, "Shark consumption rate." }, { "-c", OPT_DOUBLE, &c, "Fish nutritional value." }, { "-d", OPT_DOUBLE, &d, "Shark death rate." }, { "-dt", OPT_DOUBLE, &dt, "Time step increment." }, { NULL, OPT_NULL, NULL, NULL } }; char help_string[] = "\ Integrates the two-species Lotka-Volterra predator-prey system, \ \ dF/dt = F(a - bS), dS/dt = S(cF - d), \ \ according to the specified parameters.\ "; /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* The two differential equations to integrate. */ void myfunc(double x, double y, double *xx, double *yy) { *xx = x * (a - b * y); *yy = y * (c * x - d); } /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
//------------------------------------------------------------------------------ void SdFatBase::errorPrint(Print* pr, char const* msg) { pr->print(F("error: ")); pr->println(msg); errorPrint(pr); }
/* * Open for reading * * Returns true on success */ boolean SimpleConfig::open(boolean write) { mlog.WARNING(F("SimpleConfig::base class called")); return false; }
/* * Close file */ boolean SimpleConfig::close() { mlog.WARNING(F("SimpleConfig::base class called")); // if writeMode, then remember to terminate file return false; }
* ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ * │ TAB │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ [ │ ] │ \ │█████│END │ * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ * │CAPSL│ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ' │▒▒▒▒▒│ENTER│█████│PG_UP│ * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ * │LSHFT│▒▒▒▒▒│ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │▒▒▒▒▒│RSHFT│ UP │PG_DN│ * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ * │LCTRL│L_ALT│L_GUI│█████│█████│█████│ SPC │█████│█████│█████│R_ALT│ FN0 │ APP │LEFT │DOWN │RIGHT│ * └─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘ */ /* 0: ANSI qwerty */ [_BL] = LAYOUT_65_ansi( KC_GESC,KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_DEL, \ KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_END, \ F(2), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGUP, \ KC_LSPO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSPC, KC_UP, KC_PGDN, \ KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RALT, MO(_FL), KC_RCTL, KC_LEFT, KC_DOWN, KC_RIGHT), /* 1: Locking arrow keys to WASD for when you need dedicated arrow keys * ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐ * │ │ │ │ │ │ │ │ │ │ │ │ │ │▒▒▒▒▒│▒▒▒▒▒│ │ * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ * │ │ │ Up │ │ │ │ │ │ │ │ │ │ │ │▒▒▒▒▒│ │ * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ * │ │Left │Down │Right│ │ │ │ │ │ │ │ │▒▒▒▒▒│ │▒▒▒▒▒│ │ * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ * │ │▒▒▒▒▒│ │ │ │ │ │ │ │ │ │ │▒▒▒▒▒│ │ │ │ * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ * │ │ │ │█████│█████│█████│ │█████│█████│█████│ │ │ │ │ │ │
Type objective_function<Type>::operator() () { DATA_INTEGER(minAge); DATA_INTEGER(maxAge); DATA_INTEGER(minYear); DATA_INTEGER(maxYear); DATA_ARRAY(catchNo); DATA_ARRAY(stockMeanWeight); DATA_ARRAY(propMature); DATA_ARRAY(M); DATA_INTEGER(minAgeS); DATA_INTEGER(maxAgeS); DATA_INTEGER(minYearS); DATA_INTEGER(maxYearS); DATA_SCALAR(surveyTime); DATA_ARRAY(Q1); PARAMETER_VECTOR(logN1Y); PARAMETER_VECTOR(logN1A); PARAMETER_VECTOR(logFY); PARAMETER_VECTOR(logFA); PARAMETER_VECTOR(logVarLogCatch); PARAMETER_VECTOR(logQ); PARAMETER(logVarLogSurvey); int na=maxAge-minAge+1; int ny=maxYear-minYear+1; int nas=maxAgeS-minAgeS+1; int nys=maxYearS-minYearS+1; // setup F matrix<Type> F(ny,na); for(int y=0; y<ny; ++y){ for(int a=0; a<na; ++a){ F(y,a)=exp(logFY(y))*exp(logFA(a)); } } // setup logN matrix<Type> logN(ny,na); for(int a=0; a<na; ++a){ logN(0,a)=logN1Y(a); } for(int y=1; y<ny; ++y){ logN(y,0)=logN1A(y-1); for(int a=1; a<na; ++a){ logN(y,a)=logN(y-1,a-1)-F(y-1,a-1)-M(y-1,a-1); if(a==(na-1)){ logN(y,a)=log(exp(logN(y,a))+exp(logN(y,a-1)-F(y-1,a)-M(y-1,a))); } } } matrix<Type> predLogC(ny,na); for(int y=0; y<ny; ++y){ for(int a=0; a<na; ++a){ predLogC(y,a)=log(F(y,a))-log(F(y,a)+M(y,a))+log(Type(1.0)-exp(-F(y,a)-M(y,a)))+logN(y,a); } } Type ans=0; for(int y=0; y<ny; ++y){ for(int a=0; a<na; ++a){ if(a==0){ ans+= -dnorm(log(catchNo(y,a)),predLogC(y,a),exp(Type(0.5)*logVarLogCatch(0)),true); }else{ ans+= -dnorm(log(catchNo(y,a)),predLogC(y,a),exp(Type(0.5)*logVarLogCatch(1)),true); } } } matrix<Type> predLogS(nys,nas); for(int y=0; y<nys; ++y){ for(int a=0; a<nas; ++a){ int sa = a+(minAgeS-minAge); int sy = y+(minYearS-minYear); predLogS(y,a) = logQ(a)-(F(sy,sa)+M(sy,sa))*surveyTime+logN(sy,sa); ans += -dnorm(log(Q1(y,a)),predLogS(y,a),exp(Type(0.5)*logVarLogSurvey),true); } } vector<Type> ssb(ny); ssb.setZero(); for(int y=0; y<=ny; ++y){ for(int a=0; a<na; ++a){ std::cout<<y<<" "<<a<<" "<<"\n"; ssb(y)+=exp(logN(y,a))*stockMeanWeight(y,a)*propMature(y,a); } } ADREPORT(ssb); return ans; }
void T(void) { affiche_balise_ouvrante(__func__, TRACE_XML); F(); Tprime(); affiche_balise_fermante(__func__, TRACE_XML); }
* ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐ * │ ESC │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │▒▒▒▒▒│BKSPC│DEL │ * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ * │ TAB │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ [ │ ] │ \ │█████│END │ * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ * │CAPSL│ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ' │▒▒▒▒▒│ENTER│█████│PG_UP│ * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ * │LSHFT│▒▒▒▒▒│ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │▒▒▒▒▒│RSHFT│ UP │PG_DN│ * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ * │LCTRL│L_ALT│L_GUI│█████│█████│█████│ SPC │█████│█████│█████│R_ALT│ FN0 │ APP │LEFT │DOWN │RIGHT│ * └─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘ */ /* 0: ANSI qwerty */ [_BL] = ANSI_KEYMAP( F(4), KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_DEL, \ KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_END, \ F(2), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGUP, \ KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_PGDN, \ KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RALT, MO(_FL), KC_RCTL, KC_LEFT, KC_DOWN, KC_RIGHT), /* 1: Locking arrow keys to WASD for when you need dedicated arrow keys * ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐ * │ │ │ │ │ │ │ │ │ │ │ │ │ │▒▒▒▒▒│▒▒▒▒▒│ │ * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ * │ │ │ Up │ │ │ │ │ │ │ │ │ │ │ │▒▒▒▒▒│ │ * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ * │ │Left │Down │Right│ │ │ │ │ │ │ │ │▒▒▒▒▒│ │▒▒▒▒▒│ │ * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ * │ │▒▒▒▒▒│ │ │ │ │ │ │ │ │ │ │▒▒▒▒▒│ │ │ │
void SocketIOClient::sendHandshake(char hostname[]) { client.println(F("GET /socket.io/1/ HTTP/1.1")); client.print(F("Host: ")); client.println(hostname); client.println(F("Origin: Arduino\r\n")); }
inline void TrtrsmLLN ( UnitOrNonUnit diag, F alpha, const Matrix<F>& L, Matrix<F>& X, bool checkIfSingular ) { #ifndef RELEASE PushCallStack("internal::TrtrsmLLN"); #endif // Matrix views Matrix<F> LTL, LTR, L00, L01, L02, LBL, LBR, L10, L11, L12, L20, L21, L22; Matrix<F> XTL, XTR, X00, X01, X02, XBL, XBR, X10, X11, X12, X20, X21, X22; Matrix<F> Z11; // Start the algorithm ScaleTrapezoid( alpha, LEFT, LOWER, 0, X ); LockedPartitionDownDiagonal ( L, LTL, LTR, LBL, LBR, 0 ); PartitionDownDiagonal ( X, XTL, XTR, XBL, XBR, 0 ); while( XBR.Height() > 0 ) { LockedRepartitionDownDiagonal ( LTL, /**/ LTR, L00, /**/ L01, L02, /*************/ /******************/ /**/ L10, /**/ L11, L12, LBL, /**/ LBR, L20, /**/ L21, L22 ); RepartitionDownDiagonal ( XTL, /**/ XTR, X00, /**/ X01, X02, /*************/ /******************/ /**/ X10, /**/ X11, X12, XBL, /**/ XBR, X20, /**/ X21, X22 ); //--------------------------------------------------------------------// Trsm( LEFT, LOWER, NORMAL, diag, F(1), L11, X10, checkIfSingular ); TrtrsmLLNUnb( diag, F(1), L11, X11 ); Gemm( NORMAL, NORMAL, F(-1), L21, X10, F(1), X20 ); Z11 = X11; MakeTrapezoidal( LEFT, LOWER, 0, Z11 ); Gemm( NORMAL, NORMAL, F(-1), L21, Z11, F(1), X21 ); //--------------------------------------------------------------------// SlideLockedPartitionDownDiagonal ( LTL, /**/ LTR, L00, L01, /**/ L02, /**/ L10, L11, /**/ L12, /*************/ /******************/ LBL, /**/ LBR, L20, L21, /**/ L22 ); SlidePartitionDownDiagonal ( XTL, /**/ XTR, X00, X01, /**/ X02, /**/ X10, X11, /**/ X12, /*************/ /******************/ XBL, /**/ XBR, X20, X21, /**/ X22 ); } #ifndef RELEASE PopCallStack(); #endif }
/* * Read one null terminated line from file to buff * * Returns line length, NULL on failure */ int SimpleConfig::readln(char *buff, int maxlen) { mlog.WARNING(F("SimpleConfig::base class called")); buff[0] = '\0'; return NULL; }
int main(int argc, char **argv) { int i, j, k, step=0, newlim; int runnum, detnum, regions, deg1, deg2, deg, limit1, limit2; double pol1[MAXDEG], pol2[MAXDEG], x1, x2, x3, f1, f2, t; char outfile[20]; FILE *fi; FILE *fo; if (argc < 2) { printf("\nPINT v1.4 (Jan 2014) - ERROR: .mcal file required as argument:\n\n"); exit(0); } fi=fopen(argv[1], "r"); sprintf(outfile, "pint_%s", argv[1]); fo=fopen(outfile, "wt"); /// version 1.3 int reg=0; int maxdeg[10]; //max 10 columns(regions) for (j=0; j<10; j++) maxdeg[j]=0; readMaxDeg(fi, maxdeg); fclose(fi); /// for (j=0; j<MAXDEG; j++) { pol1[j]=0; pol2[j]=0; } fi=fopen(argv[1], "r"); while (fscanf (fi, "%d %d %d %d", &runnum, &detnum, ®ions, °1)==4) { reg=0; fprintf(fo, "%5d%5d%3d%5d", runnum, detnum, regions, deg1); for (k=0; k<deg1; k++) { fscanf (fi, "%lf", &pol1[k]); if (k==0) fprintf(fo, "%9.3f", pol1[k]); else if (k==1) fprintf(fo, "%10.6f", pol1[k]); else fprintf(fo, "%15.6E", pol1[k]); if (k==deg1-1) { while(k+1<maxdeg[reg]) { fprintf(fo, " "); k++;} //v1.3 break; } } fscanf (fi, "%d", &limit1); reg++; for (i=0; i<regions-1; i++) { fscanf (fi, "%d", °2); for (k=0; k<deg2; k++) fscanf (fi, "%lf", &pol2[k]); fscanf (fi, "%d", &limit2); x1=limit1-RANGE; x2=limit1+RANGE; if (deg1>deg2) deg=deg1; else deg=deg2; int control=0; do { // Secant method f1=F(x1, deg, pol1, pol2); f2=F(x2, deg, pol1, pol2); x3=x2-((f2*(x2-x1))/(f2-f1)); x1=x2; x2=x3; if(f2<0) t=fabs(f2); else t=f2; control++; //version 1.4 if (control>10000000) {printf("Warning! Detector #%02d Regions %d-%d: Functions do not intersect.\n", detnum, i, i+1); break;} } while(t>EPS); newlim=(x3+0.5); ///////////// v1.2 update if (newlim<0) { newlim=0; printf("\nWarning! Detector #%02d: First limit is %0.2lf. Returned 0 in the .mcal file", detnum, x3); } ///////////// fprintf(fo, "%6d%5d", newlim, deg2); //x3 is the new limit limit1=limit2; deg1=deg2; for (j=0; j<MAXDEG; j++) pol1[j]=0; for (k=0; k<deg2; k++) { pol1[k]=pol2[k]; if (k==0) fprintf(fo, "%9.3f", pol2[k]); else if (k==1) fprintf(fo, "%10.6f", pol2[k]); else fprintf(fo, "%15.6E", pol2[k]); if (k==deg2-1) { while(k+1<maxdeg[reg]) { fprintf(fo, " "); k++; } //v1.3 break; } } for (j=0; j<MAXDEG; j++) pol2[j]=0; step++; reg++; } fprintf(fo, "%6d\n", limit2); } printf("\nPINT v1.4 (Jan 2014) - %d updated limits written in: '%s'\n\n", step, outfile); exit(0); }
/* * Test if more characters are available */ boolean SimpleConfig::available() { mlog.WARNING(F("SimpleConfig::base class called")); return false; }
static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function, u32 index, int *nent, int maxnent) { int r; unsigned f_nx = is_efer_nx() ? F(NX) : 0; #ifdef CONFIG_X86_64 unsigned f_gbpages = (kvm_x86_ops->get_lpage_level() == PT_PDPE_LEVEL) ? F(GBPAGES) : 0; unsigned f_lm = F(LM); #else unsigned f_gbpages = 0; unsigned f_lm = 0; #endif unsigned f_rdtscp = kvm_x86_ops->rdtscp_supported() ? F(RDTSCP) : 0; unsigned f_invpcid = kvm_x86_ops->invpcid_supported() ? F(INVPCID) : 0; unsigned f_mpx = kvm_x86_ops->mpx_supported() ? F(MPX) : 0; /* cpuid 1.edx */ const u32 kvm_supported_word0_x86_features = F(FPU) | F(VME) | F(DE) | F(PSE) | F(TSC) | F(MSR) | F(PAE) | F(MCE) | F(CX8) | F(APIC) | 0 /* Reserved */ | F(SEP) | F(MTRR) | F(PGE) | F(MCA) | F(CMOV) | F(PAT) | F(PSE36) | 0 /* PSN */ | F(CLFLUSH) | 0 /* Reserved, DS, ACPI */ | F(MMX) | F(FXSR) | F(XMM) | F(XMM2) | F(SELFSNOOP) | 0 /* HTT, TM, Reserved, PBE */; /* cpuid 0x80000001.edx */ const u32 kvm_supported_word1_x86_features = F(FPU) | F(VME) | F(DE) | F(PSE) | F(TSC) | F(MSR) | F(PAE) | F(MCE) | F(CX8) | F(APIC) | 0 /* Reserved */ | F(SYSCALL) | F(MTRR) | F(PGE) | F(MCA) | F(CMOV) | F(PAT) | F(PSE36) | 0 /* Reserved */ | f_nx | 0 /* Reserved */ | F(MMXEXT) | F(MMX) | F(FXSR) | F(FXSR_OPT) | f_gbpages | f_rdtscp | 0 /* Reserved */ | f_lm | F(3DNOWEXT) | F(3DNOW); /* cpuid 1.ecx */ const u32 kvm_supported_word4_x86_features = /* NOTE: MONITOR (and MWAIT) are emulated as NOP, * but *not* advertised to guests via CPUID ! */ F(XMM3) | F(PCLMULQDQ) | 0 /* DTES64, MONITOR */ | 0 /* DS-CPL, VMX, SMX, EST */ | 0 /* TM2 */ | F(SSSE3) | 0 /* CNXT-ID */ | 0 /* Reserved */ | F(FMA) | F(CX16) | 0 /* xTPR Update, PDCM */ | F(PCID) | 0 /* Reserved, DCA */ | F(XMM4_1) | F(XMM4_2) | F(X2APIC) | F(MOVBE) | F(POPCNT) | 0 /* Reserved*/ | F(AES) | F(XSAVE) | 0 /* OSXSAVE */ | F(AVX) | F(F16C) | F(RDRAND); /* cpuid 0x80000001.ecx */ const u32 kvm_supported_word6_x86_features = F(LAHF_LM) | F(CMP_LEGACY) | 0 /*SVM*/ | 0 /* ExtApicSpace */ | F(CR8_LEGACY) | F(ABM) | F(SSE4A) | F(MISALIGNSSE) | F(3DNOWPREFETCH) | F(OSVW) | 0 /* IBS */ | F(XOP) | 0 /* SKINIT, WDT, LWP */ | F(FMA4) | F(TBM); /* cpuid 0xC0000001.edx */ const u32 kvm_supported_word5_x86_features = F(XSTORE) | F(XSTORE_EN) | F(XCRYPT) | F(XCRYPT_EN) | F(ACE2) | F(ACE2_EN) | F(PHE) | F(PHE_EN) | F(PMM) | F(PMM_EN); /* cpuid 7.0.ebx */ const u32 kvm_supported_word9_x86_features = F(FSGSBASE) | F(BMI1) | F(HLE) | F(AVX2) | F(SMEP) | F(BMI2) | F(ERMS) | f_invpcid | F(RTM) | f_mpx | F(RDSEED) | F(ADX) | F(SMAP); /* all calls to cpuid_count() should be made on the same cpu */ get_cpu(); r = -E2BIG; if (*nent >= maxnent) goto out; do_cpuid_1_ent(entry, function, index); ++*nent; switch (function) { case 0: entry->eax = min(entry->eax, (u32)0xd); break; case 1: entry->edx &= kvm_supported_word0_x86_features; cpuid_mask(&entry->edx, 0); entry->ecx &= kvm_supported_word4_x86_features; cpuid_mask(&entry->ecx, 4); /* we support x2apic emulation even if host does not support * it since we emulate x2apic in software */ entry->ecx |= F(X2APIC); break; /* function 2 entries are STATEFUL. That is, repeated cpuid commands * may return different values. This forces us to get_cpu() before * issuing the first command, and also to emulate this annoying behavior * in kvm_emulate_cpuid() using KVM_CPUID_FLAG_STATE_READ_NEXT */ case 2: { int t, times = entry->eax & 0xff; entry->flags |= KVM_CPUID_FLAG_STATEFUL_FUNC; entry->flags |= KVM_CPUID_FLAG_STATE_READ_NEXT; for (t = 1; t < times; ++t) { if (*nent >= maxnent) goto out; do_cpuid_1_ent(&entry[t], function, 0); entry[t].flags |= KVM_CPUID_FLAG_STATEFUL_FUNC; ++*nent; } break; } /* function 4 has additional index. */ case 4: { int i, cache_type; entry->flags |= KVM_CPUID_FLAG_SIGNIFCANT_INDEX; /* read more entries until cache_type is zero */ for (i = 1; ; ++i) { if (*nent >= maxnent) goto out; cache_type = entry[i - 1].eax & 0x1f; if (!cache_type) break; do_cpuid_1_ent(&entry[i], function, i); entry[i].flags |= KVM_CPUID_FLAG_SIGNIFCANT_INDEX; ++*nent; } break; } case 7: { entry->flags |= KVM_CPUID_FLAG_SIGNIFCANT_INDEX; /* Mask ebx against host capability word 9 */ if (index == 0) { entry->ebx &= kvm_supported_word9_x86_features; cpuid_mask(&entry->ebx, 9); // TSC_ADJUST is emulated entry->ebx |= F(TSC_ADJUST); } else entry->ebx = 0; entry->eax = 0; entry->ecx = 0; entry->edx = 0; break; } case 9: break; case 0xa: { /* Architectural Performance Monitoring */ struct x86_pmu_capability cap; union cpuid10_eax eax; union cpuid10_edx edx; perf_get_x86_pmu_capability(&cap); /* * Only support guest architectural pmu on a host * with architectural pmu. */ if (!cap.version) memset(&cap, 0, sizeof(cap)); eax.split.version_id = min(cap.version, 2); eax.split.num_counters = cap.num_counters_gp; eax.split.bit_width = cap.bit_width_gp; eax.split.mask_length = cap.events_mask_len; edx.split.num_counters_fixed = cap.num_counters_fixed; edx.split.bit_width_fixed = cap.bit_width_fixed; edx.split.reserved = 0; entry->eax = eax.full; entry->ebx = cap.events_mask; entry->ecx = 0; entry->edx = edx.full; break; } /* function 0xb has additional index. */ case 0xb: { int i, level_type; entry->flags |= KVM_CPUID_FLAG_SIGNIFCANT_INDEX; /* read more entries until level_type is zero */ for (i = 1; ; ++i) { if (*nent >= maxnent) goto out; level_type = entry[i - 1].ecx & 0xff00; if (!level_type) break; do_cpuid_1_ent(&entry[i], function, i); entry[i].flags |= KVM_CPUID_FLAG_SIGNIFCANT_INDEX; ++*nent; } break; } case 0xd: { int idx, i; u64 supported = kvm_supported_xcr0(); entry->eax &= supported; entry->edx &= supported >> 32; entry->flags |= KVM_CPUID_FLAG_SIGNIFCANT_INDEX; for (idx = 1, i = 1; idx < 64; ++idx) { u64 mask = ((u64)1 << idx); if (*nent >= maxnent) goto out; do_cpuid_1_ent(&entry[i], function, idx); if (entry[i].eax == 0 || !(supported & mask)) continue; entry[i].flags |= KVM_CPUID_FLAG_SIGNIFCANT_INDEX; ++*nent; ++i; } break; } case KVM_CPUID_SIGNATURE: { static const char signature[12] = "KVMKVMKVM\0\0"; const u32 *sigptr = (const u32 *)signature; entry->eax = KVM_CPUID_FEATURES; entry->ebx = sigptr[0]; entry->ecx = sigptr[1]; entry->edx = sigptr[2]; break; } case KVM_CPUID_FEATURES: entry->eax = (1 << KVM_FEATURE_CLOCKSOURCE) | (1 << KVM_FEATURE_NOP_IO_DELAY) | (1 << KVM_FEATURE_CLOCKSOURCE2) | (1 << KVM_FEATURE_ASYNC_PF) | (1 << KVM_FEATURE_PV_EOI) | (1 << KVM_FEATURE_CLOCKSOURCE_STABLE_BIT) | (1 << KVM_FEATURE_PV_UNHALT); if (sched_info_on()) entry->eax |= (1 << KVM_FEATURE_STEAL_TIME); entry->ebx = 0; entry->ecx = 0; entry->edx = 0; break; case 0x80000000: entry->eax = min(entry->eax, 0x8000001a); break; case 0x80000001: entry->edx &= kvm_supported_word1_x86_features; cpuid_mask(&entry->edx, 1); entry->ecx &= kvm_supported_word6_x86_features; cpuid_mask(&entry->ecx, 6); break; case 0x80000007: /* Advanced power management */ /* invariant TSC is CPUID.80000007H:EDX[8] */ entry->edx &= (1 << 8); /* mask against host */ entry->edx &= boot_cpu_data.x86_power; entry->eax = entry->ebx = entry->ecx = 0; break; case 0x80000008: { unsigned g_phys_as = (entry->eax >> 16) & 0xff; unsigned virt_as = max((entry->eax >> 8) & 0xff, 48U); unsigned phys_as = entry->eax & 0xff; if (!g_phys_as) g_phys_as = phys_as; entry->eax = g_phys_as | (virt_as << 8); entry->ebx = entry->edx = 0; break; } case 0x80000019: entry->ecx = entry->edx = 0; break; case 0x8000001a: break; case 0x8000001d: break; /*Add support for Centaur's CPUID instruction*/ case 0xC0000000: /*Just support up to 0xC0000004 now*/ entry->eax = min(entry->eax, 0xC0000004); break; case 0xC0000001: entry->edx &= kvm_supported_word5_x86_features; cpuid_mask(&entry->edx, 5); break; case 3: /* Processor serial number */ case 5: /* MONITOR/MWAIT */ case 6: /* Thermal management */ case 0xC0000002: case 0xC0000003: case 0xC0000004: default: entry->eax = entry->ebx = entry->ecx = entry->edx = 0; break; } kvm_x86_ops->set_supported_cpuid(function, entry); r = 0; out: put_cpu(); return r; }
int SimpleConfig::writeln(const char *buff, int maxlen){ mlog.WARNING(F("SimpleConfig::base class called")); return 0; }
//------------------------------------------------------------------------------ void SdFatBase::errorPrint(Print* pr, const __FlashStringHelper* msg) { pr->print(F("error: ")); pr->println(msg); errorPrint(pr); }
void SimpleConfig::debugDefaultKey(const char *key, const char* group){ mlog.DEBUG(F("Default config key:")); mlog.DEBUG(key, false); mlog.DEBUG(F(" group:"), false); mlog.DEBUG(group, false); }
String ESP8266WebServer::_responseCodeToString(int code) { switch (code) { case 100: return F("Continue"); case 101: return F("Switching Protocols"); case 200: return F("OK"); case 201: return F("Created"); case 202: return F("Accepted"); case 203: return F("Non-Authoritative Information"); case 204: return F("No Content"); case 205: return F("Reset Content"); case 206: return F("Partial Content"); case 300: return F("Multiple Choices"); case 301: return F("Moved Permanently"); case 302: return F("Found"); case 303: return F("See Other"); case 304: return F("Not Modified"); case 305: return F("Use Proxy"); case 307: return F("Temporary Redirect"); case 400: return F("Bad Request"); case 401: return F("Unauthorized"); case 402: return F("Payment Required"); case 403: return F("Forbidden"); case 404: return F("Not Found"); case 405: return F("Method Not Allowed"); case 406: return F("Not Acceptable"); case 407: return F("Proxy Authentication Required"); case 408: return F("Request Time-out"); case 409: return F("Conflict"); case 410: return F("Gone"); case 411: return F("Length Required"); case 412: return F("Precondition Failed"); case 413: return F("Request Entity Too Large"); case 414: return F("Request-URI Too Large"); case 415: return F("Unsupported Media Type"); case 416: return F("Requested range not satisfiable"); case 417: return F("Expectation Failed"); case 500: return F("Internal Server Error"); case 501: return F("Not Implemented"); case 502: return F("Bad Gateway"); case 503: return F("Service Unavailable"); case 504: return F("Gateway Time-out"); case 505: return F("HTTP Version not supported"); default: return ""; } }
/** * converts error code to String * @param error int * @return String */ String HTTPClient::errorToString(int error) { switch(error) { case HTTPC_ERROR_CONNECTION_REFUSED: return F("connection refused"); case HTTPC_ERROR_SEND_HEADER_FAILED: return F("send header failed"); case HTTPC_ERROR_SEND_PAYLOAD_FAILED: return F("send payload failed"); case HTTPC_ERROR_NOT_CONNECTED: return F("not connected"); case HTTPC_ERROR_CONNECTION_LOST: return F("connection lost"); case HTTPC_ERROR_NO_STREAM: return F("no stream"); case HTTPC_ERROR_NO_HTTP_SERVER: return F("no HTTP server"); case HTTPC_ERROR_TOO_LESS_RAM: return F("too less ram"); case HTTPC_ERROR_ENCODING: return F("Transfer-Encoding not supported"); case HTTPC_ERROR_STREAM_WRITE: return F("Stream write error"); case HTTPC_ERROR_READ_TIMEOUT: return F("read Timeout"); default: return String(); } }
void RESTClient::printHeaders() { println(F(" HTTP/1.1")); print(F("Host: ")); println(my_host); print(F("User-Agent: RESTClient/1.0 Arduino/")); #if defined (__AVR_ATmega32U4__) println(F("atmega32u4")); #elif defined (__AVR_ATmega1280__) println(F("atmega1280")); #elif defined (__AVR_ATmega2560__) println(F("atmega2560")); #elif defined (__AVR_ATmega328P__) println(F("atmega328p")); #elif defined (__AVR_ATmega168__) println(F("atmega168")); #elif defined (__AVR_ATmega8__) println(F("atmega8")); #else println(F("unknown")); #endif println(F("Connection: close")); println(); }
void SMTP::SendEmailProcess() { #ifdef sEmail if(millis() > SMTP::mTimeout) {//we have taken longer than 10 secs to send our email - reset and resend LogLn(F("Email Reset.")); mTimeout=LONG_MAX; //dont reset again nEmailStage=0; client.println(F("QUIT")); } if (SMTP::bWaitForResponse) {//We are awaiting a response if (SMTP::WaitForReplyLine()) return; //not yet - try next time } if (SMTP::nEmailStage==0) {//Connect SMTP::mTimeout = millis() + 10000; //10 sec to send...or will resend LogLn(F("--Start SendMail--")); Log(F("Cleaning buffers..{"));while(client.available()) Log(client.read()); LogLn("}"); LogLn(F("Connecting...")); if(!client.connect(SMTP::mSMTPServerIP,25) /*|| !client.connected()*/) { LogLn(F("connection failed")); return; } LogLn(F("Confirmed Connected")); SMTP::bWaitForResponse=true; return; } if (nEmailStage==1) { LogLn(F("Sending helo")); SMTP::client.println("helo 1.2.3.4"); SMTP::bWaitForResponse=true; return; } if (nEmailStage==2) //set to 20 to test retry { LogLn(F("From..")); SMTP::client.println("MAIL From: "sEmail); //(sender) SMTP::bWaitForResponse=true; return; } if (nEmailStage==3) {//recipient address LogLn(F("To..")); SMTP::client.println("RCPT To: "sEmail); //client.println("RCPT To: <*****@*****.**>"); SMTP::bWaitForResponse=true; return; } if (nEmailStage==4) { LogLn(F("Sending DATA")); SMTP::client.println("DATA"); SMTP::bWaitForResponse=true; return; } if (nEmailStage==5) { LogLn(F("Sending message")); SMTP::client.println("To: "sEmail); SMTP::client.println("From: TheHouse <" sEmail ">"); SMTP::client.println("Subject: House Calling. Alarm.\r\n"); { SMTP::client.println("The House Alarm has gone off\r\n"); SMTP::client.println("EndLog"); } SMTP::client.println("."); SMTP::bWaitForResponse=true; return; } if (nEmailStage==6) { SMTP::mTimeout = LONG_MAX; //cancel any timeout timer LogLn(F("Sending QUIT")); SMTP::client.println("QUIT"); SMTP::bWaitForResponse=true; return; } if (nEmailStage==7) { SMTP::client.stop(); SMTP::nEmailStage=-1; LogLn(F("disconnected")); return; } #endif }
bool MyFunctionRequestHandler::handle(ESP8266WebServer& server, HTTPMethod requestMethod, String requestUri){ server.client().setNoDelay(true); requestUri.toLowerCase(); Serial.println(String(F("handle(")) + String(requestMethod) + String(F(", ")) + requestUri + String(F(")"))); if (requestMethod == HTTP_GET){ if (requestUri.equals(F("/")) || requestUri.equals(F("/index.html"))){ server.sendHeader(F("cache-control"), F("private, max-age=0, no-cache, no-store")); server.sendHeader(F("Content-Encoding"), F("gzip")); server.send_P(200, String(F("text/html")).c_str(), index_html_gz, sizeof(index_html_gz)); return true; } if (requestUri.equals(F("/font.woff"))){ server.send_P(200, String(F("text/html")).c_str(), font_woff, sizeof(font_woff)); return true; } /*if (handleStatic(server, requestUri, F("/"), F("/index_comb.html.gz"), F("text/html"), false)) return true; if (handleStatic(server, requestUri, F("/"), F("/index.html"), F("text/html"), false)) return true; if (handleStatic(server, requestUri, F("/index.html"), F("/index_comb.html.gz"), F("text/html"), false)) return true; if (handleStatic(server, requestUri, F("/index.html"), F("/index.html"), F("text/html"), false)) return true; if (handleStatic(server, requestUri, F("/phonon.min.css"), F("/phonon.min.css"), F("text/css"), true)) return true; if (handleStatic(server, requestUri, F("/phonon.min.js"), F("/phonon.min.js"), F("application/javascript"), true)) return true; if (handleStatic(server, requestUri, F("/forms.min.css"), F("/forms.min.css"), F("text/css"), true)) return true; if (handleStatic(server, requestUri, F("/forms.min.js"), F("/forms.min.js"), F("application/javascript"), true)) return true; if (handleStatic(server, requestUri, F("/icons.min.css"), F("/icons.min.css"), F("text/css"), true)) return true; if (handleStatic(server, requestUri, F("/lists.min.css"), F("/lists.min.css"), F("text/css"), true)) return true; if (handleStatic(server, requestUri, F("/phonon-base.min.css"), F("/phonon-base.min.css"), F("text/css"), true)) return true; if (handleStatic(server, requestUri, F("/phonon-core.min.js"), F("/phonon-core.min.js"), F("application/javascript"), true)) return true; if (handleStatic(server, requestUri, F("/font.woff"), F("/font.woff"), F("application/font.woff"), true)) return true; if (handleStatic(server, requestUri, F("/font.eot"), F("/font.eot"), F("application/font.eot"), true)) return true; if (handleStatic(server, requestUri, F("/font.svg"), F("/font.svg"), F("application/font.svg"), true)) return true; if (handleStatic(server, requestUri, F("/font.ttf"), F("/font.ttf"), F("application/font.ttf"), true)) return true; */ if (requestUri.startsWith(F("/api"))){ apiHandler(server); return true; } if (requestUri.startsWith(F("/info"))){ infoHandler(server); return true; } if (requestUri.startsWith(F("/dtintinfo"))){ dtIntegrationHandler(server); return true; } } else if (requestMethod == HTTP_POST){ if (requestUri.startsWith(F("/update"))){ StreamString error; if (Update.hasError()) { Update.printError(error); } if (mbRebootRequired) httpReboot(server, (Update.hasError()) ? error : String(F("Upload succeeded! ")) + String(miUploadSize) + String(F(" bytes transferred<p>"))); else{ server.sendHeader(F("location"), F("/")); server.send(302); return true; } } if (requestUri.equals(F("/dynatrace"))){ dynatracePostHandler(server); return true; } } //Now we really need to respond with 404 String message = F("File Not Found\n\n"); message += F("URI: "); message += server.uri(); message += F("\nMethod: "); message += (server.method() == HTTP_GET ) ? F("GET") : F("POST"); message += F("\nArguments: "); message += server.args(); message += F("\n"); for ( uint8_t i = 0; i < server.args(); i++ ) { message += " " + server.argName ( i ) + ": " + server.arg ( i ) + "\n"; } server.sendHeader(F("cache-control"), F("private, max-age=0, no-cache, no-store")); server.send (404, F("text/plain"), message); return true; }
inline void TrtrsmLLN ( UnitOrNonUnit diag, F alpha, const DistMatrix<F>& L, DistMatrix<F>& X, bool checkIfSingular ) { #ifndef RELEASE PushCallStack("internal::TrtrsmLLN"); #endif const Grid& g = L.Grid(); // Matrix views DistMatrix<F> LTL(g), LTR(g), L00(g), L01(g), L02(g), LBL(g), LBR(g), L10(g), L11(g), L12(g), L20(g), L21(g), L22(g); DistMatrix<F> XTL(g), XTR(g), X00(g), X01(g), X02(g), XBL(g), XBR(g), X10(g), X11(g), X12(g), X20(g), X21(g), X22(g); // Temporary distributions DistMatrix<F,STAR,STAR> L11_STAR_STAR(g); DistMatrix<F,MC, STAR> L21_MC_STAR(g); DistMatrix<F,STAR,MR > X10_STAR_MR(g); DistMatrix<F,STAR,VR > X10_STAR_VR(g); DistMatrix<F,STAR,MR > X11_STAR_MR(g); DistMatrix<F,STAR,STAR> X11_STAR_STAR(g); // Start the algorithm ScaleTrapezoid( alpha, LEFT, LOWER, 0, X ); LockedPartitionDownDiagonal ( L, LTL, LTR, LBL, LBR, 0 ); PartitionDownDiagonal ( X, XTL, XTR, XBL, XBR, 0 ); while( XBR.Height() > 0 ) { LockedRepartitionDownDiagonal ( LTL, /**/ LTR, L00, /**/ L01, L02, /*************/ /******************/ /**/ L10, /**/ L11, L12, LBL, /**/ LBR, L20, /**/ L21, L22 ); RepartitionDownDiagonal ( XTL, /**/ XTR, X00, /**/ X01, X02, /*************/ /******************/ /**/ X10, /**/ X11, X12, XBL, /**/ XBR, X20, /**/ X21, X22 ); L21_MC_STAR.AlignWith( X20 ); X10_STAR_MR.AlignWith( X20 ); X11_STAR_MR.AlignWith( X21 ); //--------------------------------------------------------------------// L11_STAR_STAR = L11; X11_STAR_STAR = X11; X10_STAR_VR = X10; LocalTrsm ( LEFT, LOWER, NORMAL, diag, F(1), L11_STAR_STAR, X10_STAR_VR, checkIfSingular ); LocalTrtrsm ( LEFT, LOWER, NORMAL, diag, F(1), L11_STAR_STAR, X11_STAR_STAR, checkIfSingular ); X11 = X11_STAR_STAR; X11_STAR_MR = X11_STAR_STAR; MakeTrapezoidal( LEFT, LOWER, 0, X11_STAR_MR ); X10_STAR_MR = X10_STAR_VR; X10 = X10_STAR_MR; L21_MC_STAR = L21; LocalGemm ( NORMAL, NORMAL, F(-1), L21_MC_STAR, X10_STAR_MR, F(1), X20 ); LocalGemm ( NORMAL, NORMAL, F(-1), L21_MC_STAR, X11_STAR_MR, F(1), X21 ); //--------------------------------------------------------------------// L21_MC_STAR.FreeAlignments(); X10_STAR_MR.FreeAlignments(); X11_STAR_MR.FreeAlignments(); SlideLockedPartitionDownDiagonal ( LTL, /**/ LTR, L00, L01, /**/ L02, /**/ L10, L11, /**/ L12, /*************/ /******************/ LBL, /**/ LBR, L20, L21, /**/ L22 ); SlidePartitionDownDiagonal ( XTL, /**/ XTR, X00, X01, /**/ X02, /**/ X10, X11, /**/ X12, /*************/ /******************/ XBL, /**/ XBR, X20, X21, /**/ X22 ); } #ifndef RELEASE PopCallStack(); #endif }
void MyFunctionRequestHandler::dtIntegrationHandler(ESP8266WebServer& server) { String json = F("{"); json += '"'; json += F("enabled"); json += '"'; json += ':'; json += mpConfig->enabled ? F("true") : F("false"); json += F(", "); json += '"'; json += F("environmentid"); json += '"'; json += ':'; json += '"'; json += mpConfig->dynatraceEnvironmentID; json += '"'; json += F(", "); json += '"'; json += F("apikey"); json += '"'; json += ':'; json += '"'; json += mpConfig->dynatraceApiKey; json += '"'; json += F(", "); json += '"'; json += F("interval"); json += '"'; json += ':'; json += '"'; json += mpConfig->pollingIntervalS; json += '"'; json += '}'; server.sendHeader(F("cache-control"), F("private, max-age=0, no-cache, no-store")); server.send(200, F("text/json"), json); }
inline void RowEchelon( DistMatrix<F>& A, DistMatrix<F>& B ) { #ifndef RELEASE CallStackEntry entry("RowEchelon"); if( A.Grid() != B.Grid() ) LogicError("{A,B} must be distributed over the same grid"); if( A.Height() != B.Height() ) LogicError("A and B must be the same height"); #endif const Grid& g = A.Grid(); // Matrix views DistMatrix<F> ATL(g), ATR(g), A00(g), A01(g), A02(g), APan(g), ABL(g), ABR(g), A10(g), A11(g), A12(g), A20(g), A21(g), A22(g); DistMatrix<F> BT(g), B0(g), BB(g), B1(g), B2(g); // Temporary distributions DistMatrix<F,STAR,STAR> A11_STAR_STAR(g); DistMatrix<F,STAR,VR > A12_STAR_VR(g); DistMatrix<F,STAR,MR > A12_STAR_MR(g); DistMatrix<F,MC, STAR> A21_MC_STAR(g); DistMatrix<F,STAR,VR > B1_STAR_VR(g); DistMatrix<F,STAR,MR > B1_STAR_MR(g); DistMatrix<Int,STAR,STAR> p1_STAR_STAR(g); // In case B's columns are not aligned with A's const bool BAligned = ( B.ColShift() == A.ColShift() ); DistMatrix<F,MC,STAR> A21_MC_STAR_B(g); // Pivot composition std::vector<Int> image, preimage; // Start the algorithm PartitionDownDiagonal ( A, ATL, ATR, ABL, ABR, 0 ); PartitionDown ( B, BT, BB, 0 ); while( ATL.Height() < A.Height() && ATL.Width() < A.Width() ) { RepartitionDownDiagonal ( ATL, /**/ ATR, A00, /**/ A01, A02, /*************/ /******************/ /**/ A10, /**/ A11, A12, ABL, /**/ ABR, A20, /**/ A21, A22 ); RepartitionDown ( BT, B0, /**/ /**/ B1, BB, B2 ); View2x1 ( APan, A12, A22 ); A12_STAR_VR.AlignWith( A22 ); A12_STAR_MR.AlignWith( A22 ); A21_MC_STAR.AlignWith( A22 ); B1_STAR_VR.AlignWith( B1 ); B1_STAR_MR.AlignWith( B1 ); if( ! BAligned ) A21_MC_STAR_B.AlignWith( B2 ); p1_STAR_STAR.ResizeTo( A11.Height(), 1 ); //--------------------------------------------------------------------// A11_STAR_STAR = A11; A21_MC_STAR = A21; lu::Panel( A11_STAR_STAR, A21_MC_STAR, p1_STAR_STAR, A00.Height() ); ComposePivots( p1_STAR_STAR, A00.Height(), image, preimage ); ApplyRowPivots( APan, image, preimage ); ApplyRowPivots( BB, image, preimage ); A12_STAR_VR = A12; B1_STAR_VR = B1; LocalTrsm ( LEFT, LOWER, NORMAL, UNIT, F(1), A11_STAR_STAR, A12_STAR_VR ); LocalTrsm( LEFT, LOWER, NORMAL, UNIT, F(1), A11_STAR_STAR, B1_STAR_VR ); A12_STAR_MR = A12_STAR_VR; B1_STAR_MR = B1_STAR_VR; LocalGemm( NORMAL, NORMAL, F(-1), A21_MC_STAR, A12_STAR_MR, F(1), A22 ); if( BAligned ) { LocalGemm ( NORMAL, NORMAL, F(-1), A21_MC_STAR, B1_STAR_MR, F(1), B2 ); } else { A21_MC_STAR_B = A21_MC_STAR; LocalGemm ( NORMAL, NORMAL, F(-1), A21_MC_STAR_B, B1_STAR_MR, F(1), B2 ); } A11 = A11_STAR_STAR; A12 = A12_STAR_MR; B1 = B1_STAR_MR; //--------------------------------------------------------------------// SlidePartitionDownDiagonal ( ATL, /**/ ATR, A00, A01, /**/ A02, /**/ A10, A11, /**/ A12, /*************/ /******************/ ABL, /**/ ABR, A20, A21, /**/ A22 ); SlidePartitionDown ( BT, B0, B1, /**/ /**/ BB, B2 ); } }