示例#1
0
symentry_t * EiC_nxtTemp(int obj, int level)
{
    symentry_t *sym;
    char tmpName[50];
    sprintf(tmpName,"%s%d","__TeMp",NumTemps);

    /* There should be no need to watch out for change of level !!!!
     * It will be assumed that the compound statement routine will
     * handle it.
     */


    sym = EiC_insertLUT(EiC_work_tab,tmpName,obj);
    NumTemps++;

    CurTemp++;

    if(sym->val.ival == -1) /* needs a home */ 
	EiC_stackit(sym,level);

    /* Setting up the token information is left
     * to the caller of this routine.
     */

    sym->level = level;
    return sym;
}    
示例#2
0
文件: eicmod.c 项目: JackJone/opencv
static symentry_t *add_eicfunc(char *name, int (*func) ())
{
    symentry_t *sym;
    sym = EiC_insertLUT(eic_tab, name, t_eic);
    sym->level = 1;
    sym->val.func = func;
    return sym;
}
示例#3
0
文件: eicmod.c 项目: JackJone/opencv
symentry_t *EiC_add_builtinfunc(char *name, val_t(*vfunc) ())
{
    symentry_t *sym;
    sym = EiC_insertLUT(stand_tab, name, ID);
    EiC_freetype(sym->type);
    sym->level = 1;
    sym->val.vfunc = vfunc;
    sym->type = EiC_addtype(t_builtin,NULL);
    return sym;
}
示例#4
0
static void success(int ival)
{
    int i, size;
	
    size = (int) (lex_curpos - lex_lastpos);
    memcpy(EiC_LEXEM, &lex_buff[lex_lastpos], size);
    EiC_LEXEM[size] = '\0';
    if (Lseen) size--;
    if (Useen) size--;
    if (Fseen) size--;

    Hseen = 0;
    switch (ival) {
	case ID:
	    if ((token->Tok = EiC_iskeyword(cwords, EiC_LEXEM,
 					sizeof(cwords) / sizeof(keyword_t))) == 0) 
		{
			if(size > 64) //maks: avoid crash when enter a very long identifier
			{
				EiC_error("Identifier is too large");
				return;
			}

			token->Tok = ID;
			/* search for id in various name spaces */
			if ((token->Val.sym = EiC_lookup(EiC_work_tab, EiC_LEXEM)) == NULL)
				if(bCanInsertSymbol) token->Val.sym = EiC_insertLUT(EiC_work_tab, EiC_LEXEM, ID); //maks
				
				if (token->Val.sym)
					if (token->Val.sym->sclass == c_typedef)
						token->Tok = TYPENAME;
		}
	    break;
	case OCTAL:
	    if (Fseen)
		EiC_error("Declaration syntax error");
	    for (lexival = 0, i = 0; i < size; i++)
		lexival = lexival * 8 + getoct(EiC_LEXEM[i]);
	    Hseen = 1;
	    setintval();
	    break;
	case HEX:
	    for (lexival = 0, i = 2; i < size; i++)
		lexival = lexival * 16 + gethex(EiC_LEXEM[i]);
	    Hseen = 1;
	    setintval();
	    break;
	case TOKEN_INT:
	    for (lexival = 0, i = 0; i < size; i++)
		lexival = lexival * 10 + EiC_LEXEM[i] - '0';
	    setintval();
	    break;
	case TOKEN_FLOAT:
	    if (Useen)
		EiC_error("Declaration syntax error");
	    lexfval = atof(EiC_LEXEM);
	    setfloatval();
	    break;
	case RELOP:
	case MISC:
	    break;
    }
}