コード例 #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);
}