Example #1
0
void CScrollBufL1::ParseEscapeBracket(char *szText, int nTextLen, ETextType *eTextType, int *nLineLen)
{
    char *pTargetChar;

    pTargetChar = mystrnstr(szText + 1, nTextLen - 1, "[DME78HgcAB0<>=\033");
    if (pTargetChar)
    {
        if (*pTargetChar == '\033')
        {
            TRACE("******* POSSIBLE PARSE PROBLEM %s\n", szText + 1);
            (*eTextType) = LINEBUF_NON_PRINTABLE;
        }
        else if (*pTargetChar == '[')
        {
            (*eTextType) = LINEBUF_ESCAPE_BRACKET;
            pTargetChar = findalpha(szText, nTextLen);
        }
        else
        {
            (*eTextType) = LINEBUF_ESCAPE_BARE;
        }
    }
    if (pTargetChar)
    {
        (*nLineLen) = ((int)pTargetChar - (int)szText) + 1;
    }
    else
    {
        (*eTextType) = LINEBUF_BROKEN_ESCAPE;
        memset(m_szEscCode, 0, sizeof(m_szEscCode));
        strncpy(m_szEscCode, szText, sizeof(m_szEscCode) - 1);
        (*nLineLen) = nTextLen;
        m_nBrokenEscLen = nTextLen;
    }
}
Example #2
0
void printalpha(char *input, char *output, int length)
{
    int i;
    for(i=0; i < length; i++)
    {
        output[i]=findalpha(toupper(input[i]));
        printf("%c", output[i]);
    }
    output[i]='\0';

    //printf("\ni=%d\n", i);
}
Example #3
0
bool CScrollBufL1::ExtractCodes(char *pText, int nLen, int *param1, int *param2, int *param3, char *command)
{
    bool bExpanded = false;
    char *p;
    VerifyCritical();

    pText = strchr(pText, '[');
    if (pText)
    {
        pText++;
        p = findalpha(pText, nLen);
        if (p)
        {
            *command = *p;
        }
        p = strchr(pText, ';');
        if ((p) && (((int)p - (int)pText) <= nLen))
        {
            *param2 = atoi(p + 1);
            p = strchr(p + 1, ';');
            if ((p) && (((int)p - (int)pText) <= nLen))
            {
                *param3 = atoi(p + 1);
            }
        }
        if (*pText == '?')
        {
            pText++;
            bExpanded = true;
        }
        if (myisnum(*pText))
        {
            *param1 = atoi(pText);
        }
    }
    return bExpanded;
}