Exemplo n.º 1
0
/*!
 * \param wchars Characters in -w option, if any
 */
void ISpellChecker::initckch(char *wchars)
{
    register ichar_t c;
    char num[4];

    for(c = 0; c < static_cast< ichar_t >(SET_SIZE + m_hashheader.nstrchars); ++c)
    {
        if(iswordch(c))
        {
            if(!mylower(c))
            {
                m_Try[m_Trynum] = c;
                ++m_Trynum;
            }
        }
        else if(isboundarych(c))
        {
            m_Try[m_Trynum] = c;
            ++m_Trynum;
        }
    }
    if(wchars != NULL)
    {
        while(m_Trynum < SET_SIZE && *wchars != '\0')
        {
            if(*wchars != 'n' && *wchars != '\\')
            {
                c = *wchars;
                ++wchars;
            }
            else
            {
                ++wchars;
                num[0] = '\0';
                num[1] = '\0';
                num[2] = '\0';
                num[3] = '\0';
                if(isdigit(wchars[0]))
                {
                    num[0] = wchars[0];
                    if(isdigit(wchars[1]))
                    {
                        num[1] = wchars[1];
                        if(isdigit(wchars[2]))
                            num[2] = wchars[2];
                    }
                }
                if(wchars[-1] == 'n')
                {
                    wchars += strlen(num);
                    c = atoi(num);
                }
                else
                {
                    wchars += strlen(num);
                    c = 0;
                    if(num[0])
                        c = num[0] - '0';
                    if(num[1])
                    {
                        c <<= 3;
                        c += num[1] - '0';
                    }
                    if(num[2])
                    {
                        c <<= 3;
                        c += num[2] - '0';
                    }
                }
            }
            /*	    	c &= NOPARITY;*/
            if(!m_hashheader.wordchars[c])
            {
                m_hashheader.wordchars[c] = 1;
                m_hashheader.sortorder[c] = m_hashheader.sortval++;
                m_Try[m_Trynum] = c;
                ++m_Trynum;
            }
        }
    }
}
Exemplo n.º 2
0
/* wchars -  Characters in -w option, if any
 *           -w: may be used to specify characters other than
 *           alphabetics which may also appear in words 
 */
static void initckch(char *wchars)
{
    register ichar_t c;
    char num[4];

    for (c = 0; c < (ichar_t)(SET_SIZE + hashheader.nstrchars); ++c) {
	if (iswordch(c)) {
	    if (!mylower(c)) {
		Try[Trynum] = c;
		++Trynum;
	    }
	}
    }
    if (wchars != NULL) {
	while (Trynum < SET_SIZE && *wchars != '\0') {
	    if (*wchars != 'n' && *wchars != '\\') {
		c = *wchars;
		++wchars;
	    }
	    else {
		++wchars;
		num[0] = '\0';
		num[1] = '\0';
		num[2] = '\0';
		num[3] = '\0';
		if (isdigit (wchars[0])) {
		    num[0] = wchars[0];
		    if (isdigit (wchars[1])) {
			num[1] = wchars[1];
			if (isdigit(wchars[2]))
			    num[2] = wchars[2];
		    }
		}
		if (wchars[-1] == 'n') {
		    wchars += strlen(num);
		    c = atoi(num);
		}
		else {
		    wchars += strlen(num);
		    c = 0;
		    if (num[0])
			c = num[0] - '0';
		    if (num[1]) {
			c <<= 3;
			c += num[1] - '0';
		    }
		    if (num[2]) {
			c <<= 3;
			c += num[2] - '0';
		    }
		}
	    }
	    c &= NOPARITY;
	    if (!hashheader.wordchars[c]) {
		hashheader.wordchars[c] = 1;
		hashheader.sortorder[c] = hashheader.sortval++;
		Try[Trynum] = c;
		++Trynum;
	    }
	}
    }
}