Exemplo n.º 1
0
int main() {
	printRuler();

	while ( (c = getchar()) != EOF) {
		if (c == '\n') {
			blankSpaces = 0;
			tabSpaces = 0;
			isCharReplaceQueued = 1;
			charUntilTabstop = TABSTOP_LENGTH;
			input[i] = c;
			i++;
		}
		else if (c != ' ') {
			if(isCharReplaceQueued == 0) {
				isCharReplaceQueued = 1;	
				layDownSpaces();
			}
			updateTabstop();
			input[i] = c;
			i++;
		}
		else {
			isCharReplaceQueued = 0;
			incrementSpacer();
		}
	}

	if(isCharReplaceQueued == 0) {
		isCharReplaceQueued = 1;	
		layDownSpaces();
	}
	
	printf("\n%s\n", input);
	return 0;
}
Exemplo n.º 2
0
void SanitiseTool::parseSpacers(xercesc::DOMElement * parentNode, 
                                crispr::xml::writer& xmlParser)
{
    for (xercesc::DOMElement * currentElement = parentNode->getFirstElementChild(); 
         currentElement != NULL; 
         currentElement = currentElement->getNextElementSibling()) {

        if (xercesc::XMLString::equals(currentElement->getTagName(), xmlParser.tag_Spacer())) {
            char * c_spid = tc(currentElement->getAttribute(xmlParser.attr_Spid()));
            std::string spid = c_spid;
            ST_SpacerMap[spid] = getNextSpacerS();
            xr(&c_spid);
            XMLCh * x_next_spacer_num = tc(getNextSpacerS().c_str());
            currentElement->setAttribute(xmlParser.attr_Spid(), x_next_spacer_num);
            xr(&x_next_spacer_num);
            incrementSpacer();
        }
    }
}