void TextContent::handleSpec( const InputEvent &e) { _inp.setEvent(e); switch(_inp.lastSpec) { case KEY_UPARROW: moveToLine(_loc.line-1); break; case KEY_DOWNARROW: moveToLine(_loc.line+1); break; case KEY_LEFTARROW: moveToChar(_loc.chr-1 ); break; case KEY_RIGHTARROW: moveToChar(_loc.chr+1 ); break; case KEY_F2: parse(); } if ( !_inp.shiftDown ) _markLoc = _loc; _markSpan = TextSpan(_loc, _markLoc ); _buf->closeEdit(); }
void logoScreen() { int copywrite[] = { 128,159,145,149,151,149,145,159 }; // (c) symbol defineCharacter(1, copywrite); // screen one. lcd.clear(); moveToChar(1,0); lcd.printIn("PerLCD v1.0"); moveToChar(2,0); lcd.print(1); lcd.printIn(" kevin montuori"); delay(2000); lcd.clear(); }
//Gets the key/value pairs of the atributes until it //gets to the end of the encapsulating tag. void getAttributes(XMLNode *xmlNode) { //Clear the white space clearWhiteSpace(); //Loop until we get to the end of the current tag we are in while(xmlArray[chrPtr] != '>') { //The attributes end with an equals sign and can not contain spaces int textLength = 0; while(xmlArray[chrPtr] != ' ' && xmlArray[chrPtr] != '=') { chrPtr++; textLength++; } //read the attribute char* attribute = readFromXML(textLength); //The value starts after a quotation mark after the equals sign moveToChar('='); moveToChar('"'); chrPtr++; //Loop until we get to the end of the quotation mark textLength =0; while(xmlArray[chrPtr] != '"') { chrPtr++; textLength++; } //read the value char * value = readFromXML(textLength); //Add the attribute/value pair to the attributes of the node xmlAddAttribute(xmlNode, attribute, value); //clean up the buffers free(attribute); free(value); //Continue moving on chrPtr++; clearWhiteSpace(); } }
void writeString(char *data) { char *tokens[MAX_DATA_SIZE]; int toks = tokenizeData(tokens); if (toks == 3) { moveToChar(atoi(tokens[0]), atoi(tokens[1])); lcd.printIn(tokens[2]); } }
void printMoveList(MoveList* moveList){ char charMove[6]; for(int i=0;i<moveList->nextFree;i++){ moveToChar(&moveList->array[i],charMove); printf("%d. %s - ",i,charMove); } }
void printMoveListFromOffset(MoveList* moveList, int fromOffset){ char charMove[6]; for(int i=fromOffset;i<moveList->nextFree;i++){ moveToChar(&moveList->array[i],charMove); printf("%d. %s - ",i,charMove); } printf("\n"); }
void TextContent::setLoc(TextLoc n, bool mark ) { moveToLine(n.line); moveToChar(n.chr ); if ( mark ) { _markSpan.end = _loc; _markSpan.close(); _markLoc = _markSpan.end; } }
void printDebugChar(char someChar) { moveToChar(2, 15); lcd.print(someChar); }
void writeCharAt(int row, int col, char character) { moveToChar(row, col); lcd.print(character); }
//Passes through the xml array and adds children to currently passed in node void parseNode(XMLNode *node) { //Save off the previous chr ptr in case white spaces should be part of the text value int prevChrPtr = chrPtr; clearWhiteSpace(); //Loop until the end of the file while(xmlArray[chrPtr] != '\0'){ //Check if war are at the beginning of a tag if(xmlArray[chrPtr] == '<' && xmlArray[chrPtr + 1] != '/'){ //Check if we are reading an xml decleration node chrPtr++; if(xmlArray[chrPtr] == '?'){ //This muse be an xml decleration monde. Move passed the //question mark just read in and get the decleration part. chrPtr++; xmlAddChildNode(node, readXMLDeclerationNode()); //Move to the end tab moveToChar('>'); //Move past the end tab and fall off chrPtr++; clearWhiteSpace(); } else{ //This must be a regular element node. Read the element node XMLNode* childNode = xmlAddChildNode(node, readXMLElementNode()); //Get the attributes for the element getAttributes(childNode); //Move to the closing tab moveToChar('>'); chrPtr++; //Recursivley call up and see if the current node has any children parseNode(childNode); //Now that we have all of its children, move past our closing tag. clearWhiteSpace(); if(xmlArray[chrPtr] == '<'){ moveToChar('>'); if(xmlArray[chrPtr] == '>'){ chrPtr++; } } //Now are are passed our closing tag. See if we were are not at our //parents closing tag and, if so, fall off. clearWhiteSpace(); if(xmlArray[chrPtr] == '<' && xmlArray[chrPtr + 1] == '/') break; //We were not the last sub element of our parent. Loop again and add the next one as a child. } } else{ //move back to the beginning of this section chrPtr = prevChrPtr; //printf("About to make text node, next 3 char are '%c%c%c'", xmlArray[chrPtr], xmlArray[chrPtr + 1], xmlArray[chrPtr + 2]); //We are not at the beginning of a tag, so we must be in the text //the node. Read its text and fall off. xmlAddChildNode(node, readXMLTextNode()); break; } } }