static MA_FILE* openRead(const char *filename, int modeFlags) { VolumeEntry* volEntry; MA_FILE *file; if(!sRoot) { lprintfln("filesystem not initialized"); return NULL; } volEntry = findFile(filename, sRoot); if(!volEntry) { lprintfln("couldn't find file"); return NULL; } file = (MA_FILE*) malloc(sizeof(MA_FILE)); file->volEntry = volEntry; file->filePtr = volEntry->dataOffset; file->modeFlags = modeFlags; file->type = TYPE_READONLY; file->buffer = (unsigned char*) malloc(BUFFER_SIZE); file->bufferSize = BUFFER_SIZE; file->bufferStart = 0x7fffffff; file->resultFlags = 0; //maReadData(currentFileSystem, file->data, file->volEntry->dataOffset, file->volEntry->dataLength); //maReadData(currentFileSystem, file->buffer, file->volEntry->DataOffset, BUFFER_SIZE); return file; }
bool BarcodeScanner::uploadRGB888(int* img, int width, int height) { lprintfln("uploadRGB888 called\n"); if(mImageScanner == NULL) maPanic(0, "No Image Scanner"); lprintfln("We have an image scanner\n"); if(mImgData != NULL) maPanic(0, "Image already uploaded!"); lprintfln("We have an image\n"); int imgDataSize = width * height; if(mImgData != NULL) maPanic(0, "WTF!"); mImgData = (unsigned char*) malloc(imgDataSize); lprintfln("Allocated the internal image buffer ( w:%u h:%u s:%u )\n", width, height, imgDataSize); return upload(img, width, height); }
/** * \brief ReadCSV::load, * loading a CSV = Comma (Delimited) Separated Valued text file from a resource, * and store all data into a double array[][] * * @param resource, resource is pointing to a csv file * @param delim, use delimiter for separation * @param trim, trim string remove spaces. * @return bool true/false, true = success, false = failure */ bool ReadCSV::load( MAHandle resource, char delim, bool trim) { char *data = GetString(resource); // will allocate buffer if (data == 0) { lprintfln("Error ReadCSV::load failed to load resource\n"); return false; } std::string line, tmp; std::vector<std::string> lineData; char *pch = strtok(data,"\r\n"); line = pch; // lprintfln("ReadCSV::Load Line=%s",line.c_str()); lineData = Utils::split(line,delim,trim); if (lineData.size() > /*1*/0) m_db.push_back(lineData); else lprintfln("WARNING ReadCSV::load missing (First Line) lineData =%s\n",line.c_str()); for (int i=0;pch != NULL;i++) { pch = strtok(NULL, "\r\n"); line = pch; // lprintfln("ReadCSV::Load Line=%s",line.c_str()); lineData = Utils::split(line,delim,trim); if (lineData.size() > /*1*/0) m_db.push_back(lineData); else lprintfln("WARNING ReadCSV::load missing lineData from line %i => %s\n",i,line.c_str()); } delete [] data; // need to free temp buffer. return true; }
GLuint CreateTexture(MAHandle resource) { GLuint textureHandle; lprintfln("CreateTexture\n"); //Create an OpenGL 2D texture from the R_BOX resource. glGenTextures(1, &textureHandle); checkGLError("CreateTexture::glGenTextures(1, &textureHandle)"); glBindTexture(GL_TEXTURE_2D, textureHandle); checkGLError("glBindTexture"); int res = maOpenGLTexImage2D(resource); if (res < 0) { lprintfln("Error: CreateTexture => load failed = %i",res); return (GLuint)MA_GL_TEX_IMAGE_2D_INVALID_IMAGE; } lprintfln("Info: CreateTexture => loaded = %i",textureHandle); // Set texture parameters. glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); checkGLError("glTexParameteri"); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); checkGLError("glTexParameteri"); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR /* GL_NEAREST*/); checkGLError("glTexParameteri"); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR /* GL_NEAREST*/); checkGLError("glTexParameteri"); return textureHandle; }
/** * Evaluate a Lua script. * @param script String with Lua code. * @return Non-zero if successful, zero on error. */ int LuaEngine::eval(const char* script) { lua_State* L = (lua_State*) mLuaState; // Evaluate Lua script. int result = luaL_dostring(L, script); // Was there an error? if (0 != result) { MAUtil::String errorMessage; if (lua_isstring(L, -1)) { errorMessage = lua_tostring(L, -1); // Pop the error message. lua_pop(L, 1); } else { errorMessage = "There was a Lua error condition, but no error message."; } lprintfln("Lua Error: %s\n", errorMessage.c_str()); // Print size of Lua stack (debug info). lprintfln("Lua stack size: %i\n", lua_gettop(L)); reportLuaError(errorMessage.c_str()); } return result == 0; }
MAUtil::String XML::getLocalPath() { // Do this here to work around a MoRE bug. FileLister fl; fl.start("/"); MAUtil::String path, os; // Try getting the local path. int result = getSystemProperty("mosync.path.local", path); getSystemProperty("mosync.device.OS", os); lprintfln("OS: %s", MAUtil::lowerString(os).c_str()); if(MAUtil::lowerString(os).find("android", 0) != -1) { MAHandle tfile; path = "/sdcard/Magna Carta/"; tfile = maFileOpen(path.c_str(), MA_ACCESS_READ_WRITE); lprintfln("File handle: %d", tfile); lprintfln("File exists: %d", maFileExists(tfile)); if(!maFileExists(tfile)) { int result = maFileCreate(tfile); lprintfln("File create code: %d", result); } maFileClose(tfile); lprintfln("Path: %s", path.c_str()); return path; } // If it works, fine. if(result > 0) { //printf("Got local path: %i\n", result); return path; } // Otherwise, get the first root directory. fl.start(""); result = fl.next(path); //MAASSERT(result > 0); return path; }
/** * Evaluate a Lua script. * @param script String with Lua code. * @return Non-zero if successful, zero on error. */ int LuaEngine::eval(const char* script) { lua_State* L = (lua_State*) mLuaState; // Create temporary script string with an ending space. // There seems to be a bug in Lua when evaluating // statements like: // "return 10" // "x = 10" // But this works: // "return 10 " // "return (10)" // "x = 10 " int length = strlen(script); char* s = (char*) malloc(length + 2); strcpy(s, script); s[length] = ' '; s[length + 1] = 0; // Evaluate Lua script. int result = luaL_dostring(L, s); // Free temporary script string. free(s); // Was there an error? if (0 != result) { MAUtil::String errorMessage; if (lua_isstring(L, -1)) { errorMessage = lua_tostring(L, -1); // Pop the error message. lua_pop(L, 1); } else { errorMessage = "There was a Lua error condition, but no error message."; } lprintfln("Lua Error: %s\n", errorMessage.c_str()); // Print size of Lua stack (debug info). lprintfln("Lua stack size: %i\n", lua_gettop(L)); reportLuaError(errorMessage.c_str()); } return result == 0; }
MAUIMoblet::MAUIMoblet() { lprintfln("MAUIMoblet::Memory Heap %d, Free Heap %d", heapTotalMemory(), heapFreeMemory()); Engine& engine = Engine::getSingleton(); engine.setDefaultFont(Util::getFontBlack()); engine.setDefaultSkin(Util::getSkinBack()); MAExtent screenSize = maGetScrSize(); scrWidth = EXTENT_X(screenSize); scrHeight = EXTENT_Y(screenSize); feed = Feed(); String data = ""; Util::getData("fd.sav", data); if (data.length() <= 0) { data = ""; } feed.setAll(data.c_str()); Util::getData("lb.sav", data); if (data.length() <= 0) { data = ""; } feed.setAlbum(data.c_str()); data = ""; if (feed.getLoaded()) { next = new AlbumLoadScreen(&feed); next->show(); } else { next = new OptionsScreen(&feed, OptionsScreen::ST_LOGIN_OPTIONS); next->show(); } }
void BMChar::parse(std::vector<std::string> &line) { std::string key,value; for(size_t i=1; i<line.size(); i++) { GetKeyValueFrom(line[i],key,value); // lprintfln("BMCHAR::parse:%s : \'%s\'=\'%s\'",line[i].c_str(),key.c_str(),value.c_str()); if (key == "id") m_id = atoi(value.c_str()); else if (key == "x") m_x = atoi(value.c_str()); else if (key == "y") m_y = atoi(value.c_str()); else if (key == "width") m_width = atoi(value.c_str()); else if (key == "height") m_height = atoi(value.c_str()); else if (key == "xoffset") m_xoffset = atoi(value.c_str()); else if (key == "yoffset") m_yoffset = atoi(value.c_str()); else if (key == "xadvance") m_xadvance = atoi(value.c_str()); else if (key == "page") m_page = atoi(value.c_str()); else if (key == "chnl") m_chnl = atoi(value.c_str()); else lprintfln("BMChar::parse at line %d => Unknown type:%s/n",(int)i,key.c_str()); } }
void BMCommon::parse(std::vector<std::string> &line) { std::string key,value; for(size_t i=1; i<line.size(); i++) { GetKeyValueFrom(line[i],key,value); if (key == "lineHeight") m_lineHeight = atoi(value.c_str()); else if (key == "base") m_base = atoi(value.c_str()); else if (key == "scaleW") m_scaleW = atoi(value.c_str()); else if (key == "scaleH") m_scaleH = atoi(value.c_str()); else if (key == "pages") m_pages = atoi(value.c_str()); else if (key == "packed") m_packed = atoi(value.c_str()); else if (key == "alphaChnl") m_alphaChnl = atoi(value.c_str()); else if (key == "redChnl") m_redChnl = atoi(value.c_str()); else if (key == "greenChnl") m_greenChnl = atoi(value.c_str()); else if (key == "blueChnl") m_blueChnl = atoi(value.c_str()); else // debugOut << "BMCommon::parse => Unknown type:" << key.c_str() << std::endl; lprintfln("BMCommon::parse at line %d => Unknown type:%s/n",(int)i,key.c_str()); } }
AuctionListScreen::~AuctionListScreen() { lprintfln("~AuctionListScreen::Memory Heap %d, Free Heap %d", heapTotalMemory(), heapFreeMemory()); clearListBox(); listBox->clear(); delete mainLayout; mainLayout = NULL; if (next != NULL) { delete next; feed->remHttp(); next = NULL; } delete mImageCache; mImageCache = NULL; clearAuctions(); deleteAuctions(); parentTag=""; cardText=""; cardId=""; description=""; thumburl=""; categoryId=""; error_msg=""; openingBid=""; price=""; userCardId=""; auctionCardId=""; username=""; buyNowPrice=""; endDate=""; lastBidUser=""; }
/** * Debug print */ void print ( void ) { lprintfln( "{%f, %f, %f}", FIX2FLT( m_x ), FIX2FLT( m_y ), FIX2FLT( m_z ) ); }
TutorialScreen::TutorialScreen(MainScreen *previous, tutItem *items, int itemCount) :tutItems(items), itemCount(itemCount) { lprintfln("TutorialScreen::Memory Heap %d, Free Heap %d", heapTotalMemory(), heapFreeMemory()); this->previous = previous; index = 0; mainLayout = new Layout(0, 0, scrWidth, scrHeight, NULL, 1, 2); mainLayout->setSkin(Util::getSkinBack()); mainLayout->setDrawBackground(true); Widget *softKeys = Util::createSoftKeyBar(Util::getSoftKeyBarHeight(), "", "", ""); Layout *subLayout = new Layout(0, 0, scrWidth, scrHeight-(softKeys->getHeight()), mainLayout, 3, 1); subLayout->setPaddingLeft(PADDING); subLayout->setPaddingRight(PADDING); subLayout->setDrawBackground(false); /*subLayout->setSkin(Util::getSkinBack());*/ leftArrow = new Image(0, 0, ARROW_WIDTH, subLayout->getHeight(), subLayout, false, false, RES_UNSELECT_ICON); leftArrow->setDrawBackground(false); imge = new TransitionImage(0, 0, scrWidth - (ARROW_WIDTH * 2) - (PADDING*2), subLayout->getHeight(), subLayout, false, false, NULL); imge->setDrawBackground(false); imge->setResource(tutItems[0].image); rightArrow = new Image(0, 0, ARROW_WIDTH, subLayout->getHeight(), subLayout, false, false, RES_RIGHT_ARROW); rightArrow->setDrawBackground(false); mainLayout->add(softKeys); this->setMain(mainLayout); }
void NewMenuScreen::show() { shown = true; if(feed->getNoteLoaded()==false){ if(mHttp.isOpen()){ mHttp.close(); } mHttp = HttpConnection(this); int urlLength = 11 + URLSIZE; char *url = new char[urlLength+1]; memset(url,'\0',urlLength+1); sprintf(url, "%s?notedate=1", URL); lprintfln("%s", url); int res = mHttp.create(url, HTTP_GET); if(res < 0) { } else { mHttp.setRequestHeader("AUTH_USER", feed->getUsername().c_str()); mHttp.setRequestHeader("AUTH_PW", feed->getEncrypt().c_str()); feed->addHttp(); mHttp.finish(); } delete url; url = NULL; } versionChecked = 0; Screen::show(); }
void SaveScreen::keyPressEvent(int keyCode, int nativeCode) { #if DEBUG >= 1 lprintfln("Index: %d (%d / %d)", listBox->getSelectedIndex(), keyCode, nativeCode); #endif switch(keyCode) { case MAK_HASH: // Hash (#) key - ask the moblet to close the application maExit(0); break; case MAK_LEFT: case MAK_SOFTRIGHT: ScreenTransition::makeTransition(this, previous, -1, 400); break; case MAK_RIGHT: case MAK_FIRE: CheckBox * cb = (CheckBox *)((Label*)listBox->getChildren()[listBox->getSelectedIndex()])->getChildren()[0]; cb->flip(); break; case MAK_DOWN: listBox->selectNextItem(); break; case MAK_UP: listBox->selectPreviousItem(); break; } }
void EditDeckScreen::refresh() { clearListBox(); clearCards(); int urlLength = 71 + URLSIZE + strlen("deck_id") + deckId.length() + Util::intlen(scrHeight) + Util::intlen(scrWidth); char *url = new char[urlLength+1]; memset(url,'\0',urlLength+1); sprintf(url, "%s?getcardsindeck=1&deck_id=%s&height=%d&width=%d&jpg=1", URL, deckId.c_str(), Util::getMaxImageHeight(), Util::getMaxImageWidth()); lprintfln("%s", url); if(mHttp.isOpen()){ mHttp.close(); } mHttp = HttpConnection(this); int res = mHttp.create(url, HTTP_GET); if(res < 0) { busy = false; hasConnection = false; notice->setCaption(""); } else { hasConnection = true; mHttp.setRequestHeader("AUTH_USER", feed->getUsername().c_str()); mHttp.setRequestHeader("AUTH_PW", feed->getEncrypt().c_str()); feed->addHttp(); mHttp.finish(); } delete [] url; url = NULL; }
void EditDeckScreen::deleteDeck() { deleting = true; notice->setCaption("Deleting deck..."); int urlLength = 65 + URLSIZE + strlen("deck_id") + deckId.length(); char *url = new char[urlLength+1]; memset(url,'\0',urlLength+1); sprintf(url, "%s?deletedeck=1&deck_id=%s", URL, deckId.c_str()); lprintfln("%s", url); if(mHttp.isOpen()){ mHttp.close(); } mHttp = HttpConnection(this); int res = mHttp.create(url, HTTP_GET); if(res < 0) { busy = false; hasConnection = false; notice->setCaption(""); } else { hasConnection = true; mHttp.setRequestHeader("AUTH_USER", feed->getUsername().c_str()); mHttp.setRequestHeader("AUTH_PW", feed->getEncrypt().c_str()); feed->addHttp(); mHttp.finish(); } delete [] url; url = NULL; }
void BenchDBConnector::httpFinished(MAUtil::HttpConnection* http, int result) { printf("HTTP %i\n", result); if(result == 200){//everything went fine lprintfln("MoSync benchmark DONE!"); } MAUtil::String contentLengthStr; int responseBytes = mHttp.getResponseHeader("content-length", &contentLengthStr); int contentLength = 0; if(responseBytes == CONNERR_NOHEADER) printf("no content-length response header\n"); else { printf("content-length : %s\n", contentLengthStr.c_str()); contentLength = atoi(contentLengthStr.c_str()); } if(contentLength >= CONNECTION_BUFFER_SIZE || contentLength == 0) { printf("Receive in chunks..\n"); mHttp.recv(mBuffer, CONNECTION_BUFFER_SIZE); } else { mBuffer[contentLength] = 0; mHttp.read(mBuffer, contentLength); printf("response: %s\n", mBuffer); } }
void OptionsScreen::checkForGames() { connError = true; album = new Albums(); notice->setCaption("Checking games..."); if(mHttp.isOpen()){ mHttp.close(); } mHttp = HttpConnection(this); int urlLength = 38 + URLSIZE; char *url = new char[urlLength+1]; memset(url,'\0',urlLength+1); sprintf(url, "%s?getusergames=1", URL); lprintfln("%s", url); int res = mHttp.create(url, HTTP_GET); if(res < 0) { notice->setCaption("Connection Error"); } else { mHttp.setRequestHeader("AUTH_USER", feed->getUsername().c_str()); mHttp.setRequestHeader("AUTH_PW", feed->getEncrypt().c_str()); feed->addHttp(); mHttp.finish(); } delete [] url; url = NULL; }
CompareScreen::CompareScreen(Screen *previous, MAHandle img, Feed *feed, bool flip, Card *card, Card *compare) :mHttp(this), previous(previous), img(img), flip(flip), card(card), feed(feed), compare(compare) { lprintfln("CompareScreen::Memory Heap %d, Free Heap %d", heapTotalMemory(), heapFreeMemory()); busy = false; next = NULL; currentSelectedStat = -1; flipOrSelect = 0; imageCache = new ImageCache(); if (card != NULL) { mainLayout = Util::createImageLayout("", "Back", "Flip"); listBox = (ListBox*) mainLayout->getChildren()[0]; height = listBox->getHeight(); }else{ mainLayout = Util::createImageLayout("Back"); listBox = (ListBox*) mainLayout->getChildren()[0]->getChildren()[1]; height = listBox->getHeight()-70; } imge = new MobImage(0, 0, scrWidth-PADDING*2, height/2, listBox, false, false, Util::loadImageFromResource(img)); cmpge = new MobImage(0, 0, scrWidth-PADDING*2, height/2, listBox, false, false, Util::loadImageFromResource(img)); this->setMain(mainLayout); if (card != NULL && compare != NULL) { if (flip) { Util::retrieveBackFlip(imge, card, height-PADDING*2, imageCache); Util::retrieveBackFlip(cmpge, compare, height-PADDING*2, imageCache); } else { Util::retrieveFrontFlip(imge, card, height-PADDING*2, imageCache); Util::retrieveFrontFlip(cmpge, compare, height-PADDING*2, imageCache); } } else { imageCache = NULL; } }
TradeFriendDetailScreen::TradeFriendDetailScreen(MainScreen *previous, Feed *feed, Card *card) :card(card), mHttp(this) { lprintfln("TradeFriendDetailScreen::Memory Heap %d, Free Heap %d", heapTotalMemory(), heapFreeMemory()); this->previous = previous; this->feed = feed; sending = false; friendDetail = ""; methodLabel = ""; method = ""; result = ""; moved = 0; menu = NULL; currentSelectedKey = NULL; currentKeyPosition = -1; next = NULL; mainLayout = Util::createMainLayout("Continue", "Back", "", true); kinListBox = (KineticListBox*)mainLayout->getChildren()[0]->getChildren()[2]; notice = (Label*)mainLayout->getChildren()[0]->getChildren()[1]; notice->setMultiLine(true); drawMethodScreen(); this->setMain(mainLayout); }
Login::~Login() { lprintfln("~Login::Memory Heap %d, Free Heap %d", heapTotalMemory(), heapFreeMemory()); clearListBox(); kinListBox->clear(); delete mainLayout; mainLayout = NULL; error_msg = ""; parentTag=""; conCatenation=""; value=""; value1=""; value2=""; convertAsterisk=""; underscore=""; username=""; credits="0"; premium="0"; encrypt=""; error_msg=""; email=""; handle=""; touch=""; result=""; freebie=""; notedate=""; }
Login::Login(MainScreen *previous, Feed *feed, int screen) : mHttp(this), screen(screen) { lprintfln("Login::Memory Heap %d, Free Heap %d", heapTotalMemory(), heapFreeMemory()); this->previous = previous; this->feed = feed; moved = 0; changed = false; isBusy = false; result = ""; currentSelectedKey = NULL; currentKeyPosition = -1; mainLayout = Util::createMainLayout("", "", "", true); kinListBox = (KineticListBox*) mainLayout->getChildren()[0]->getChildren()[2]; notice = (Label*) mainLayout->getChildren()[0]->getChildren()[1]; notice->setMultiLine(true); switch (screen) { case S_LOGIN: drawLoginScreen(); break; case S_REGISTER: drawRegisterScreen(); break; } touch = "false"; this->setMain(mainLayout); }
WeerData::WeerData() : HttpConnection( this ) { //stel de isConnecting boolean in op 'in gebruik' this->isConnecting = true; //maak een nieuwe connectie this->url = "http://www.knmi.nl/waarschuwingen_en_verwachtingen/#meerdaagse"; int res = this->create( url, HTTP_GET ); //foutafhandeling bij connectie probleem if(res < 0) { lprintfln( "unable to connect - %i\n", res ); } else { this->finish(); } //reset de weerdata naar 0 for( int i = 0; i < 3; i++ ) { this->zonneschijn[i] = 0; this->neerslag[i] = 0; this->minimumtemperatuur[i] = 0; } }
/** * \brief AxisMgr::create3D creates default vertex buffer */ void AxisMgr::create3D() { const float v[] = { 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f }; // set up 2D axis X and Y mAxisArray[0].vertices().push_back(glm::vec3(v[0],v[1],v[2])); mAxisArray[0].vertices().push_back(glm::vec3(v[3],v[4],v[5])); mAxisArray[1].vertices().push_back(glm::vec3(v[6],v[7],v[8])); mAxisArray[1].vertices().push_back(glm::vec3(v[9],v[10],v[11])); if(mAxisArray.size()>2) // 3D Graph use a 3rd axis in Z. { mAxisArray[2].vertices().push_back(glm::vec3(v[12],v[13],v[14])); mAxisArray[2].vertices().push_back(glm::vec3(v[15],v[16],v[17])); } else { lprintfln("AxisMgr::create3d: ERROR Axis system got Graph bars can either be 2D or 3D hence 2 or 3 as input"); // error not declared. } }
RedeemScreen::RedeemScreen(Feed *feed, Screen *previous) : mHttp(this), feed(feed), prev(previous) { lprintfln("RedeemScreen::Memory Heap %d, Free Heap %d", heapTotalMemory(), heapFreeMemory()); moved = 0; isBusy = false; next = NULL; result = ""; error_msg = ""; parentTag = ""; mainLayout = Util::createMainLayout("Redeem", "Back", "", true); listBox = (KineticListBox*) mainLayout->getChildren()[0]->getChildren()[2]; notice = (Label*) mainLayout->getChildren()[0]->getChildren()[1]; notice->setMultiLine(true); label = new Label(0,0, scrWidth-PADDING*2, DEFAULT_SMALL_LABEL_HEIGHT, NULL, "Redeem code:", 0, Util::getDefaultFont()); label->setDrawBackground(false); listBox->add(label); label = Util::createEditLabel(""); editBoxRedeem = new NativeEditBox(0, 0, label->getWidth()-PADDING*2, label->getHeight()-PADDING*2, 64, MA_TB_TYPE_ANY, label, "",L"Redeem"); editBoxRedeem->setDrawBackground(false); label->addWidgetListener(this); listBox->add(label); if (feed->getUnsuccessful() != "Success") { label->setCaption(feed->getUnsuccessful()); } this->setMain(mainLayout); listBox->setSelectedIndex(1); }
/** * \brief BMInfo::parse function * @param line, contains string contains whole line of text from .fnt file * chopped up in string array from the space delimited data. */ void BMInfo::parse(std::vector<std::string> &line) { std::string key,value; lprintfln("BMInfo parse size=%d",(int)line.size()); for(size_t i=1; i<line.size(); i++) { GetKeyValueFrom(line[i],key,value); // lprintfln("BMInfo line=%s key=%s = value=%s",line[i].c_str(), key.c_str(), value.c_str()); if (key == "face") m_face = Utils::unQuote(value); else if(key == "size") m_size = atoi(value.c_str()); else if (key == "bold") m_bold = atoi(value.c_str())? true: false; else if (key == "italic") m_italic = atoi(value.c_str())? true: false; else if (key == "charset") m_charset = value; else if (key == "unicode") m_unicode = atoi(value.c_str()); else if (key == "stretchH") m_stretchH = atoi(value.c_str()); else if (key == "smooth") m_smooth = atoi(value.c_str()); else if (key == "aa") m_aa = atoi(value.c_str()); else if (key == "padding") { std::vector<std::string> padding = Utils::split(value,',',true); for(size_t j=0; j<padding.size() && j<4;j++) m_padding[j] = atoi(padding[j].c_str()); } else if (key == "spacing") { std::vector<std::string> spacing = Utils::split(value,',',true); for(size_t j=0; j<spacing.size() && j<2;j++) m_spacing[j] = atoi(spacing[j].c_str()); } else if (key == "outline") m_outline = atoi(value.c_str()); else // debugOut << "BMInfo::parse => Unknown type:" << key.c_str() << std::endl; lprintfln("BMInfo::parse at line %d => Unknown type: %s/n",(int)i,key.c_str()); } }
int MAMain(void) { int i; //Logging print, Formatted, with end of LiNe. //This function calls maWriteLog(), which logs binary data. lprintfln("Hello World."); for(i=0; i<10; i++) { lprintfln("Number %i", i); if(i > 3) { //maPanic() works similarly to maExit(), but also displays an alert to the user. maPanic(0, "i became greater than 3!"); } } return 0; }
/** * Called when the download is complete * @param downloader The downloader who finished it's operation * @param data A handle to the data that was downloaded */ void BundleDownloader::finishedDownloading(Downloader* downloader, MAHandle data) { lprintfln("Completed download"); //extract the file System mBundleListener->bundleDownloaded(data); maDestroyPlaceholder(mResourceFile); //loadSavedApp(); }
void luaD_throw (lua_State *L, int errcode) { if (L->errorJmp) { lprintfln("luaD_throw errcode: %i\n", errcode); //maPanic(0, "trhow"); L->errorJmp->status = errcode; LUAI_THROW(L, L->errorJmp); } else { lprintfln("luaD_throw exit errcode: %i\n", errcode); L->status = cast_byte(errcode); if (G(L)->panic) { resetstack(L, errcode); lua_unlock(L); G(L)->panic(L); } exit(EXIT_FAILURE); } }