Ejemplo n.º 1
0
/**
 * local declarations
 * @param stclass
 * @return
 */
do_local_declares(int stclass) {
        int type = 0;
        blanks();
        if (type = get_type()) {
            declare_local(type, stclass);
        } else if (stclass == LSTATIC || stclass == DEFAUTO) {
            declare_local(CINT, stclass);
        } else {
            return(0);
        }
        need_semicolon();
        return(1);
}
Ejemplo n.º 2
0
/**
 * local declarations
 * @param stclass
 * @return 
 */
int do_local_declares(int stclass) {
    int type = 0;
    int otag;   // tag of struct object being declared
    int sflag;  // TRUE for struct definition, zero for union
    char sname[NAMESIZE];
    blanks();
    if ((sflag=amatch("struct", 6)) || amatch("union", 5)) {
        if (symname(sname) == 0) { // legal name ?
            illname();
        }
        if ((otag=find_tag(sname)) == -1) { // structure not previously defined
            otag = define_struct(sname, stclass, sflag);
        }
        declare_local(STRUCT, stclass, otag);
    } else if ((type = get_type()) != 0) {
        declare_local(type, stclass, -1);
    } else if (stclass == LSTATIC || stclass == DEFAUTO) {
        declare_local(CINT, stclass, -1);
    } else {
        return(0);
    }
    need_semicolon();
    return(1);
}