コード例 #1
0
ファイル: SetName.c プロジェクト: michtw/robot
int cgiMain()
{
	/* Send the content type, letting the browser know this is HTML */
	cgiHeaderContentType("text/html");
	fprintf(cgiOut, "<HTML><HEAD>\n");
	fprintf(cgiOut, "<TITLE>Robot SetName</TITLE></HEAD>\n");
         
	if ((cgiFormSubmitClicked("send") == cgiFormSuccess)) {
            handlePlainText();
	}

	fprintf(cgiOut, "</BODY></HTML>\n");
	return 0;
}
コード例 #2
0
    void handleEscapeSequence(Rangei const &range)
    {
        // Save the previous format on the stack.
        stack << Instance::Format(stack.last());

        String const code = esc.originalText().substr(range);

        // Check the escape sequence.
        char ch = code[0].toLatin1();

        switch(ch)
        {
        case '(':
            // Sequence of tab stops effective in the entire content.
            tabs.clear();
            for(int i = 1; i < code.size() - 1; ++i)
            {
                tabs << (code[i].toLatin1() - 'a' + 1);
            }
            break;

        case '.': // pop a format off the stack
            stack.removeLast(); // ignore the one just added
            if(stack.size() > 1)
            {
                Format form = stack.takeLast();
                stack.last().tabStop = form.tabStop; // Retain tab stop.
                stack.last().markIndent = form.markIndent;
            }
            break;

        case '>':
            stack.last().markIndent = true;
            handlePlainText(Rangei(0, 0));
            break;

        case '<':
            stack.last().resetIndent = true;

            // Insert an empty range for reseting the indent.
            handlePlainText(Rangei(0, 0));
            break;

        case '\t':
            stack.last().tabStop++;
            break;

        case 'T':
            stack.last().tabStop = de::max(-1, code[1].toLatin1() - 'a');
            break;

        case 'b':
            stack.last().weight = Bold;
            break;

        case 'l':
            stack.last().weight = Light;
            break;

        case 'w':
            stack.last().weight = Normal;
            break;

        case 'r':
            stack.last().style = Regular;
            break;

        case 'i':
            stack.last().style = Italic;
            break;

        case 'm':
            stack.last().style = Monospace;
            break;

        case 's':
            stack.last().sizeFactor = .8f;
            break;

        case 't':
            stack.last().sizeFactor = .75f;
            break;

        case 'n':
            stack.last().sizeFactor = .6f;
            break;

        case 'A': // Normal color
        case 'B': // Highlight color
        case 'C': // Dimmed color
        case 'D': // Accent color
        case 'E': // Dim Accent color
        case 'F': // Alternative Accent color
            stack.last().colorIndex = ch - 'A';
            break;

        case '0':
        case '1':
        case '2':
        case '3':
        case '4':
        case '5':
        case '6':
            if(style)
            {
                style->richStyleFormat(ch - '0',
                                       stack.last().sizeFactor,
                                       stack.last().weight,
                                       stack.last().style,
                                       stack.last().colorIndex);
            }
            break;
        }
    }