Exemplo n.º 1
0
static void
ClearCompatInfo(CompatInfo * info, XkbDescPtr xkb)
{
    register int i;

    if (info->name != NULL)
        uFree(info->name);
    info->name = NULL;
    info->dflt.defs.defined = 0;
    info->dflt.defs.merge = MergeAugment;
    info->dflt.interp.flags = 0;
    info->dflt.interp.virtual_mod = XkbNoModifier;
    info->dflt.interp.act.type = XkbSA_NoAction;
    for (i = 0; i < XkbAnyActionDataSize; i++)
    {
        info->dflt.interp.act.data[i] = 0;
    }
    ClearIndicatorMapInfo(xkb->dpy, &info->ledDflt);
    info->nInterps = 0;
    info->interps = (SymInterpInfo *) ClearCommonInfo(&info->interps->defs);
    bzero((char *) &info->groupCompat[0],
          XkbNumKbdGroups * sizeof(GroupCompatInfo));
    info->leds = (LEDInfo *) ClearCommonInfo(&info->leds->defs);
    /* 3/30/94 (ef) -- XXX! Should free action info here */
    ClearVModInfo(&info->vmods, xkb);
    return;
}
Exemplo n.º 2
0
Arquivo: xkbscan.c Projeto: aosm/X11
static int
yyGetIdent(int first)
{
int ch,i,found;
int	rtrn = IDENT;

    buf[0] = first; nInBuf = 1;
    while ( ((ch=getc(yyin))!=EOF) && (isalnum(ch)||(ch=='_')) ) {
	if ( nInBuf < BUFSIZE - 1 )
	    buf[nInBuf++] = ch;
    }
    buf[nInBuf++] = '\0';
    found= 0;

    for (i=0;(!found)&&(i<numKeywords);i++) {
	if (uStrCaseCmp(buf,keywords[i].keyword)==0) {
	    rtrn= keywords[i].token;
	    found= 1;
	}
    }
    if (!found) {
	if  ( scanStr )
	    uFree( scanStr );
	scanStr = (char *)uStringDup(buf);
	scanStrLine = lineNum;
	rtrn = IDENT;
    }

    if ( (ch!=EOF) && (!isspace(ch)) )
	ungetc( ch, yyin );
    else if ( ch=='\n' )
	lineNum++;

    return rtrn;
}
Exemplo n.º 3
0
static int
yyGetKeyName(void)
{
    int ch;

    nInBuf = 0;
    while (((ch = getc(yyin)) != EOF) && (ch != '>'))
    {
        if (ch == '\\')
        {
            if ((ch = getc(yyin)) != EOF)
            {
                if (ch == 'n')
                    ch = '\n';
                else if (ch == 't')
                    ch = '\t';
                else if (ch == 'v')
                    ch = '\v';
                else if (ch == 'b')
                    ch = '\b';
                else if (ch == 'r')
                    ch = '\r';
                else if (ch == 'f')
                    ch = '\f';
                else if (ch == 'e')
                    ch = '\033';
                else if (ch == '0')
                {
                    int tmp, stop;
                    ch = stop = 0;
                    if (((tmp = getc(yyin)) != EOF) && (isdigit(tmp))
                        && (tmp != '8') && (tmp != '9'))
                    {
                        ch = (ch * 8) + (tmp - '0');
                    }
                    else
                    {
                        stop = 1;
                        ungetc(tmp, yyin);
                    }
                    if ((!stop) && ((tmp = getc(yyin)) != EOF)
                        && (isdigit(tmp)) && (tmp != '8') && (tmp != '9'))
                    {
                        ch = (ch * 8) + (tmp - '0');
                    }
                    else
                    {
                        stop = 1;
                        ungetc(tmp, yyin);
                    }
                    if ((!stop) && ((tmp = getc(yyin)) != EOF)
                        && (isdigit(tmp)) && (tmp != '8') && (tmp != '9'))
                    {
                        ch = (ch * 8) + (tmp - '0');
                    }
                    else
                    {
                        stop = 1;
                        ungetc(tmp, yyin);
                    }
                }
            }
            else
                return ERROR_TOK;
        }

        if (nInBuf < BUFSIZE - 1)
            buf[nInBuf++] = ch;
    }
    if ((ch == '>') && (nInBuf < 5))
    {
        buf[nInBuf++] = '\0';
        if (scanStr)
            uFree(scanStr);
        scanStr = (char *) uStringDup(buf);
        scanStrLine = lineNum;
        return KEYNAME;
    }
    return ERROR_TOK;
}