task main() { clearLCDLine(0); clearLCDLine(1); displayLCDPos(0, 0); displayNextLCDString("Titties"); nVolume = 4; #ifndef NOSOUND PlaySoundFile(SONGNAME); #endif resetVars(); // reset all variables resetSensors(); // reset all sensors #ifndef NOAUTON AutoSelector();//run the RedFront autonomous Autonomous(); #endif AutoRedPost(); while (true) { #ifndef NOSOUND if (bSoundQueueAvailable) { PlaySoundFile(SONGNAME); } #endif RC(); // recieve inputs calcMotorValues(); //writeStream(); //beltPower = 127; RunRobot(); } }
int main(int argc, char *argv[]) { cgiSpoof(&argc, argv); if (cgiVarExists("pbt.reset")) resetVars(); /* call cartHtmlShellPbGlobal to accomodate situations that PB not entered from GB */ cartHtmlShellPbGlobal("UCSC Proteome Browser V1.1", doMiddle, hUserCookie(), excludeVars, NULL); return 0; }
/* begin() - inits I2C bus and used pins * * It enables internal pull-up resistor for the RTC interrupt pin, so as this pin is set to HIGH when init * It inits I2C bus for communicating with RTC * It reads from RTC time,date and alarms, setting the corresponding variables * * Returns nothing */ void WaspRTC::begin() { // Powers RTC UP setMode(RTC_ON, RTC_NORMAL_MODE); // Inits I2C bus if( !Wire.I2C_ON ) Wire.begin(); // initialize the variables used to store the data // from the RTC clearAlarmFlag(); resetVars(); readRTC(RTC_ALARM2_ADDRESS); }
/* * ON (void) - It opens I2C bus and powers the RTC * * * It enables internal pull-up resistor for the RTC interrupt pin, so as this * pin is set to HIGH when init * It inits I2C bus for communicating with RTC * It reads from RTC time,date and alarms, setting the corresponding variables */ void WaspRTC::ON(void) { // Powers RTC UP setMode(RTC_ON, RTC_NORMAL_MODE); // Inits I2C bus if( !Wire.I2C_ON ) Wire.begin(); // clear the alarm flags clearAlarmFlag(); // initialize the variables used to store the data from the RTC resetVars(); // read all registers related to the Time and Date and Alarms readRTC(RTC_ALARM2_ADDRESS); }
void flagLayer::setup(ofxDatGui* gui, int _index) { index = _index; flagObject::setup(); resetVars(); setupGui(gui); }
int main(int argc, const char ** argv) /*@globals pass2, fileSystem, internalState @*/ /*@modifies pass2, fileSystem, internalState @*/ { int rc; int ec = 0; poptContext optCon; const char ** rest; int help = 0; int usage = 0; #if defined(HAVE_MCHECK_H) && defined(HAVE_MTRACE) /*@-moduncon -noeffectuncon@*/ mtrace(); /* Trace malloc only if MALLOC_TRACE=mtrace-output-file. */ /*@=moduncon =noeffectuncon@*/ #endif /*@-modobserver@*/ resetVars(); /*@=modobserver@*/ /*@-temptrans@*/ optCon = poptGetContext("test1", argc, argv, options, 0); /*@=temptrans@*/ (void) poptReadConfigFile(optCon, "./test-poptrc"); #if 1 while ((rc = poptGetNextOpt(optCon)) > 0) /* Read all the options ... */ {}; poptResetContext(optCon); /* ... and then start over. */ /*@-modobserver@*/ resetVars(); /*@=modobserver@*/ #endif pass2 = 1; if ((rc = poptGetNextOpt(optCon)) < -1) { fprintf(stderr, "test1: bad argument %s: %s\n", poptBadOption(optCon, POPT_BADOPTION_NOALIAS), poptStrerror(rc)); ec = 2; goto exit; } if (help) { poptPrintHelp(optCon, stdout, 0); goto exit; } if (usage) { poptPrintUsage(optCon, stdout, 0); goto exit; } fprintf(stdout, "arg1: %d arg2: %s", arg1, arg2); if (arg3) fprintf(stdout, " arg3: %d", arg3); if (inc) fprintf(stdout, " inc: %d", inc); if (shortopt) fprintf(stdout, " short: %d", shortopt); if (aVal != bVal) fprintf(stdout, " aVal: %d", aVal); if (aFlag != bFlag) fprintf(stdout, " aFlag: %d", aFlag); if (aInt != bInt) fprintf(stdout, " aInt: %d", aInt); if (aLong != bLong) fprintf(stdout, " aLong: %ld", aLong); /*@-realcompare@*/ if (aFloat != bFloat) fprintf(stdout, " aFloat: %g", (double)aFloat); if (aDouble != bDouble) fprintf(stdout, " aDouble: %g", aDouble); /*@=realcompare@*/ if (oStr != (char *)-1) fprintf(stdout, " oStr: %s", (oStr ? oStr : "(none)")); if (singleDash) fprintf(stdout, " -"); rest = poptGetArgs(optCon); if (rest) { fprintf(stdout, " rest:"); while (*rest) { fprintf(stdout, " %s", *rest); rest++; } } fprintf(stdout, "\n"); exit: optCon = poptFreeContext(optCon); #if defined(HAVE_MCHECK_H) && defined(HAVE_MTRACE) /*@-moduncon -noeffectuncon@*/ muntrace(); /* Trace malloc only if MALLOC_TRACE=mtrace-output-file. */ /*@=moduncon =noeffectuncon@*/ #endif return ec; }
// TODO: rewrite met split() void JumpropesCommon::HttpHeader::parse( String *sHeader ) { int iPosStart; int iPosEnd; int iValStart; int iValLen; int iSpacePos; String tmp; String dbg; resetVars(); int iCrlfLen = strlen(crlf); // "HTTP/1.0 301 Moved Permanently\r\n" iPosStart = sHeader->pos( 0, httpNeedle, strlen(httpNeedle) ); if ( iPosStart != -1 ) { iPosEnd = sHeader->pos( iPosStart, crlf, iCrlfLen ); if ( iPosEnd == -1 ) { iPosEnd = sHeader->getLength(); } iValStart = iPosStart + strlen( httpNeedle ); iValLen = iPosEnd - iValStart; tmp.setValue( sHeader->getPointer( iValStart ), iValLen ); // tmp="1.0 301 Moved Permanently" char *ptr = tmp.getValue(); iSpacePos = tmp.pos( 0, space, strlen(space) ); ptr[iSpacePos] = 0; httpversion = atof( ptr ); int iStatPos = iSpacePos + 1; iSpacePos = tmp.pos( 0, space, strlen(space) ); ptr[iSpacePos] = 0; httpstatus = atoi( tmp.getPointer( iStatPos ) ); statusstring.setValue( tmp.getPointer( iSpacePos + 1 ), tmp.getLength() - iSpacePos - 1 ); } iPosStart = sHeader->pos( 0, contentLenNeedle, strlen(contentLenNeedle) ); if ( iPosStart != -1 ) { iPosEnd = sHeader->pos( iPosStart, crlf, iCrlfLen ); if ( iPosEnd == -1 ) { iPosEnd = sHeader->getLength(); } iValStart = iPosStart + strlen( contentLenNeedle ); iValLen = iPosEnd - iValStart; tmp.setValue( sHeader->getPointer( iValStart ), iValLen ); contentlength = atoi( tmp.getValue() ); } iPosStart = sHeader->pos( 0, contentTypeNeedle, strlen(contentTypeNeedle) ); if ( iPosStart != -1 ) { iPosEnd = sHeader->pos( iPosStart, crlf, iCrlfLen ); if ( iPosEnd == -1 ) { iPosEnd = sHeader->getLength(); } iValStart = iPosStart + strlen( contentTypeNeedle ); iValLen = iPosEnd - iValStart; tmp.setValue( sHeader->getPointer( iValStart ), iValLen ); contenttype.setValue( &tmp ); } iPosStart = sHeader->pos( 0, locationNeedle, strlen(locationNeedle) ); if ( iPosStart != -1 ) { iPosEnd = sHeader->pos( iPosStart, crlf, iCrlfLen ); if ( iPosEnd == -1 ) { iPosEnd = sHeader->getLength(); } iValStart = iPosStart + strlen( locationNeedle ); iValLen = iPosEnd - iValStart; tmp.setValue( sHeader->getPointer( iValStart ), iValLen ); location.setValue( &tmp ); } iPosStart = sHeader->pos( 0, connectionNeedle, strlen(connectionNeedle) ); if ( iPosStart != -1 ) { iPosEnd = sHeader->pos( iPosStart, crlf, iCrlfLen ); if ( iPosEnd == -1 ) { iPosEnd = sHeader->getLength(); } iValStart = iPosStart + strlen( connectionNeedle ); iValLen = iPosEnd - iValStart; tmp.setValue( sHeader->getPointer( iValStart ), iValLen ); connection.setValue( &tmp ); } iPosStart = sHeader->pos( 0, transferencNeedle, strlen(transferencNeedle) ); if ( iPosStart != -1 ) { iPosEnd = sHeader->pos( iPosStart, crlf, iCrlfLen ); if ( iPosEnd == -1 ) { iPosEnd = sHeader->getLength(); } iValStart = iPosStart + strlen( transferencNeedle ); iValLen = iPosEnd - iValStart; tmp.setValue( sHeader->getPointer( iValStart ), iValLen ); chunked = tmp.match( chunkedNeedle, strlen(chunkedNeedle) ); } if ( chunked ) { contentlength = -1; } int iSetCookies = 0; int iSearchPos = 0; iPosStart = 0; while ( iPosStart != -1 ) { iPosStart = sHeader->pos( iSearchPos, setcookieNeedle, strlen(setcookieNeedle) ); if ( iPosStart != -1 ) { iPosEnd = sHeader->pos( iPosStart, crlf, iCrlfLen ); if ( iPosEnd == -1 ) { iPosEnd = sHeader->getLength(); } iSearchPos = iPosEnd + strlen(crlf); iValStart = iPosStart + strlen( setcookieNeedle ); iValLen = iPosEnd - iValStart; iSetCookies++; tmp.setValue( sHeader->getPointer( iValStart ), iValLen ); String *cookie = new String(); cookie->setValue( &tmp ); cookies.addElement( cookie ); } } }
JumpropesCommon::HttpHeader::HttpHeader() : Freeable() { resetVars(); }
int main(int argc, const char ** argv) /*@globals pass2, fileSystem, internalState @*/ /*@modifies pass2, fileSystem, internalState @*/ { int rc; int ec = 0; poptContext optCon; const char ** rest; int help = 0; int usage = 0; #if defined(HAVE_MCHECK_H) && defined(HAVE_MTRACE) /*@-moduncon -noeffectuncon@*/ mtrace(); /* Trace malloc only if MALLOC_TRACE=mtrace-output-file. */ /*@=moduncon =noeffectuncon@*/ #endif /*@-modobserver@*/ resetVars(); /*@=modobserver@*/ /*@-temptrans@*/ optCon = poptGetContext("test1", argc, argv, options, 0); /*@=temptrans@*/ (void) poptReadConfigFile(optCon, "./test-poptrc"); (void) poptReadDefaultConfig(optCon, 1); poptSetExecPath(optCon, ".", 1); #if 1 while ((rc = poptGetNextOpt(optCon)) > 0) /* Read all the options ... */ {}; poptResetContext(optCon); /* ... and then start over. */ /*@-modobserver@*/ resetVars(); /*@=modobserver@*/ #endif pass2 = 1; if ((rc = poptGetNextOpt(optCon)) < -1) { fprintf(stderr, "test1: bad argument %s: %s\n", poptBadOption(optCon, POPT_BADOPTION_NOALIAS), poptStrerror(rc)); ec = 2; goto exit; } if (help) { poptPrintHelp(optCon, stdout, 0); goto exit; } if (usage) { poptPrintUsage(optCon, stdout, 0); goto exit; } fprintf(stdout, "arg1: %d arg2: %s", arg1, arg2); if (arg3) fprintf(stdout, " arg3: %d", arg3); if (inc) fprintf(stdout, " inc: %d", inc); if (shortopt) fprintf(stdout, " short: %d", shortopt); if (aVal != bVal) fprintf(stdout, " aVal: %d", aVal); if (aFlag != bFlag) fprintf(stdout, " aFlag: 0x%x", aFlag); if (aShort != bShort) fprintf(stdout, " aShort: %hd", aShort); if (aInt != bInt) fprintf(stdout, " aInt: %d", aInt); if (aLong != bLong) fprintf(stdout, " aLong: %ld", aLong); if (aLongLong != bLongLong) fprintf(stdout, " aLongLong: %lld", aLongLong); /*@-realcompare@*/ if (aFloat != bFloat) fprintf(stdout, " aFloat: %g", (double)aFloat); if (aDouble != bDouble) fprintf(stdout, " aDouble: %g", aDouble); /*@=realcompare@*/ if (aArgv != NULL) { const char **av = aArgv; const char * arg; fprintf(stdout, " aArgv:"); while ((arg = *av++) != NULL) fprintf(stdout, " %s", arg); } if (aBits) { const char * separator = " "; size_t i; fprintf(stdout, " aBits:"); for (i = 0; i < nattributes; i++) { if (!poptBitsChk(aBits, attributes[i])) continue; fprintf(stdout, "%s%s", separator, attributes[i]); separator = ","; } } /*@-nullpass@*/ if (oStr != (char *)-1) fprintf(stdout, " oStr: %s", (oStr ? oStr : "(none)")); /*@=nullpass@*/ if (singleDash) fprintf(stdout, " -"); if (poptPeekArg(optCon) != NULL) { rest = poptGetArgs(optCon); if (rest) { fprintf(stdout, " rest:"); while (*rest) { fprintf(stdout, " %s", *rest); rest++; } } } fprintf(stdout, "\n"); exit: optCon = poptFreeContext(optCon); #if defined(HAVE_MCHECK_H) && defined(HAVE_MTRACE) /*@-moduncon -noeffectuncon@*/ muntrace(); /* Trace malloc only if MALLOC_TRACE=mtrace-output-file. */ /*@=moduncon =noeffectuncon@*/ #endif return ec; }