⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 c.h

📁 CC386 is a general-purpose 32-bit C compiler. It is not an optimizing compiler but given that the co
💻 H
📖 第 1 页 / 共 2 页
字号:
        long i; /* int val */
        unsigned long u; /* nsigned val */
        long double f; /* float val */
        char *s; /* string val */

            struct cdat
            {
                int i; /* int val = member offset */
                int size; /* duplicates the type entry */
                int vtabindex; /* which vtab entry this symbol is */
                int vtaboffs; /* offset to the vtab for this symbol */
                long cppflags; /* flags */
                struct sym *memptrclass; /* member pointer referenece class */
                struct _classlist *baseclass; /* Parent class list */
                struct _classlist *enclosedclass; /* list of enclosed classes */
                /*         struct stab    overlist; overload table */
                struct stab memberptrs; /* pointers to members */
                struct ifunc *inlinefunc; /* inline functions-> to statement */
                ENODE *consbuild; /* constructor build tree */
                struct defvalue *defalt; /* Default for function params */
                /* Also name for CPP overload lists */
                ENODE *eofdest; /* destructor tree for end of function */
                struct sym *gdeclare; /* pointer to the global version of
                    static class members */
                struct _namespace *parentns; /* pointer to enclosing namespace
                    */
                struct template  *templatedata; /* data for template types */
                struct sym *templateparent; /* uninstantiated version of the
                    template class */
                LIST *templateargs; /* arguments used when instantiating a
                    template class */
                int conslabel; /* constructor label #, or xcpt tab label # for
                    functions */
                int destlabel; /* destructor label # or label following
                    _InitExceptBlock for functions */
                struct sym *xtsym; /* xception tags symbol */
                LIST *throwlist; /* list of throwable types */
				int virtualstructdatasize; /* size of appended virtual structures */
            } classdata;
    }
    value;
    /* Type declarations */
    struct typ
    {
        enum e_bt type; /* the type */
        #define NORMARRAY 1
        #define VARARRAY 2				
        char val_flag; /* set if is an array */
        char uflags; /* Track usage */
        char bits; /* -1 for not a bit val, else bit field len */
        char startbit; /* start of bit field */
        long size; /* total size of type */
        int cflags; /* C & C++ flags */
        struct typ *btp; /* pointer to next type (pointers & arrays */
        struct sym *sp; /* pointer to a symbol which describes the type */
        /* local symbol tables */
        struct stab lst; /* Symbol table for structs & functions, also tail =
            type table for template placeholders */
        int *typeindex; /* type index for debugger */
        struct sym *enumlist; /* enumeration list for enums */
        struct typ *reclone; /* clone list for things that have been cloned
            before the full declaration came into effect (circular) */
        int alignment; /* alignment pref for this structure/class/union   */
        ENODE *esize; /* enode version of size */
        int esizeindex; /* index into the vararray */
    }
    *tp;
    struct decldata
    {
        struct decldata *link;
        enum
        {
            dd_bool, dd_byte, dd_word, dd_enum, dd_int, dd_long, dd_longlong, dd_float, dd_double,
                dd_ldouble, dd_fcomplex, dd_rcomplex, dd_lrcomplex, dd_pcname,
                dd_dataname, dd_storage, dd_label, dd_farpointer
        } mode;
        union
        {
            LLONG_TYPE i;
            long double f[2];
            struct sym *sp;
        }
        val;
        long offset;
    }
     *init;
};

#define SYM     struct sym
#define TYP     struct typ
#define TABLE   struct stab

#define MAX_STRLEN      16384
#define MAX_STLP1       (MAX_STRLEN + 1)

/* struct for preprocessor if tracking */
typedef struct ifstruct
{
    struct ifstruct *link; /* link */
    short iflevel;
    short elsetaken;
} IFSTRUCT;

/* #define tracking */
typedef struct
{
    char *string;
    short argcount;
    char **args;
    int flags ;
#define DS_VARARGS 1
#define DS_PERMANENT 2
} DEFSTRUCT;

/* used for #pragma aux */
typedef struct _auxlist
{
    struct _auxlist *link;
    char *name;
    char *alias;
} AUXLIST;
/* error list */
struct errl
{
    struct errl *link;
    short errornumber;
    void *data;
};

/* used for error skimming */
#define BALANCE struct balance
#define BAL_PAREN   0
#define BAL_BRACKET 1
#define BAL_BEGIN 2
#define ERRORS struct errl

struct balance
{
    struct balance *back;
    short type;
    short count;
};

/* Global symbol table is a hash table */
#define HASHTABLESIZE 9973

typedef struct defvalue
{
    ENODE *ep;
    ENODE *cons;
    ENODE *dest;
} DEFVALUE;

typedef struct _hashrec_
{
    struct _hashrec_ *link; /* Link to next element in list */
    char *key; /* Full key */
} HASHREC;

typedef struct
{
    char *word;
    short atype;
    short amode;
    struct _opcode *data;
} ASMNAME;
typedef struct kwblk
{
    struct kwblk *next;
    char *word;
    short stype;
    enum
    {
        KW_CPLUSPLUS = 1, KW_INLINEASM = 2, KW_NONANSI = 4, KW_C99 = 8
    } flags;
    ASMNAME *data;
}

//-------------------------------------------------------------------------

KEYWORDS;
typedef struct intrinsblk
{
    struct intrinsblk *next;
    char *word;
    short val;
} INTRINSICS;

typedef struct
{
    char *word;
    short regtype;
    char regnum;
    char size;
} ASMREG;

/* we use C++ name spaces for the gsyms, but it is transparent if C++
 * is not enabled
 */
typedef struct _namespace
{
    struct _namespace *next;
    short anonymous;
    short guardian;
    LIST **using_list,  **tag_using_list;
    SYM *sp;
    HASHREC **table;
    HASHREC **tagtable;
} NAMESPACE;

struct template 
{
    struct stab classes; /* the template's class declarations */
    int lineno; /* line number template starts at */
    char *filename; /* file template is in */
    short argcount;
    short tplargcount;
    short partials;
    short *lines;
    int linemax, linelen;
    char hasbody; /* has a body? */
};

typedef struct ifunc
{
    SNODE *stmt;
    LIST *syms;
} INLINEFUNC;

typedef struct _filelist
{
    struct _filelist *link;
    char *data;
    int hascode;
} FILELIST;

typedef struct _classlist
{
    struct _classlist *link;
    SYM *data; /* pointer to class def */
    int offset; /* offset to this subclass */
    int vtabsize; /* size of vtab */
    struct sym *vtabsp; /* vtab name for classes */
    LIST *vtablist; /* list of vtab entries for the subclass */
    int vtaboffs; /* offset into the actual vtab of this base */
    int flags;
    #define CL_PRIMARY 1          /* a base class */
    #define CL_SECONDARY 2        /* class directly included in this class */
    #define CL_VTAB 4             /* class has vtab */
    #define CL_TOPCLASS 8         /* a class at offset 0 */
    int mode; /* include mode for class */
} CLASSLIST;

typedef struct _templatelist
{
    struct _templatelist *next;
    char *name; /* we fake out as a SYM for hash tables, so first two fields
        have to match */
    char *prefixname;
    SYM *finalsp;
    SYM *sp;
    LIST *oldtypes;
    LIST *newtypes;
    int partialcount;
};
typedef struct ilist
{
    struct ilist *next;
    SYM *sp;
    SYM *dc;
} ILIST;

typedef struct lastdest
{
    struct lastdst *last;
    struct lastdst *chain;
    ENODE *block;
} LASTDEST;

typedef struct catchblock
{
    struct catchblock *next;
    int label; /* label to execute at */
    ENODE *dummy; /* dummy var to load data to */
    TYP *xtcatch; /* type descriptor */
} CATCHBLOCK;

typedef struct tryblock
{
    struct tryblock *next;
    struct catchblock *catchit;
    int startlab;
    int endlab;
    int catchendlab;
} TRYBLOCK;

typedef struct rtti_list
{
    struct rtti *next;
    SYM *label;
    TYP *tp;
} RTTI_LIST;

typedef struct _blk_
{
    struct _blk_ *next;
    long blksize;
    char m[1]; /* memory area */
} BLK;


#include "cc.p"

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -