示例#1
0
文件: symtab.c 项目: doniexun/cc65
SymEntry* FindStructField (const Type* T, const char* Name)
/* Find a struct field in the fields list */
{
    SymEntry* Field = 0;

    /* The given type may actually be a pointer to struct */
    if (IsTypePtr (T)) {
        ++T;
    }

    /* Non-structs do not have any struct fields... */
    if (IsClassStruct (T)) {

        /* Get a pointer to the struct/union type */
        const SymEntry* Struct = GetSymEntry (T);
        CHECK (Struct != 0);

        /* Now search in the struct symbol table. Beware: The table may not
        ** exist.
        */
        if (Struct->V.S.SymTab) {
            Field = FindSymInTable (Struct->V.S.SymTab, Name, HashStr (Name));
        }
    }

    return Field;
}
示例#2
0
文件: datatype.c 项目: josch1710/cc65
void SetSymEntry (Type* T, SymEntry* S)
/* Set the SymEntry pointer for a type */
{
    /* Only structs or unions have a SymEntry attribute */
    CHECK (IsClassStruct (T));

    /* Set the attribute */
    T->A.P = S;
}
示例#3
0
文件: datatype.c 项目: josch1710/cc65
SymEntry* GetSymEntry (const Type* T)
/* Return a SymEntry pointer from a type */
{
    /* Only structs or unions have a SymEntry attribute */
    CHECK (IsClassStruct (T));

    /* Return the attribute */
    return T->A.P;
}
示例#4
0
文件: datatype.c 项目: josch1710/cc65
int TypeHasAttr (const Type* T)
/* Return true if the given type has attribute data */
{
    return IsClassStruct (T) || IsTypeArray (T) || IsClassFunc (T);
}