scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | README | LICENSE

syms.h (2159B)


      1 /* This file is inspired in the book "Understanding and using COFF" */
      2 
      3 #define SYMNMLEN   8
      4 
      5 struct syment {
      6 	union {
      7 		char _n_name[SYMNMLEN];  /* symbol name */
      8 		struct {
      9 			long _n_zeroes;  /* if _n_name[0-3] == 0 */
     10 			long _n_offset;  /* offset into string table */
     11 		} _n_n;
     12 	} _n;
     13 	long n_value;                    /* value of symbol */
     14 	short n_scnum;                   /* section number */
     15 	unsigned short n_type;           /* type and derived type */
     16 	char n_sclass;                   /* storage class */
     17 	char n_numaux;                   /* number of aux. entries */
     18 };
     19 
     20 #define SYMENT  struct syment
     21 #define SYMESZ  18
     22 
     23 #define n_name       _n._n_name
     24 #define n_zeroes     _n._n_n._n_zeroes
     25 #define n_offset     _n._n_n._n_offset
     26 
     27 /* Special n_scnum values */
     28 #define N_DEBUG      -2
     29 #define N_ABS        -1
     30 #define N_UNDEF       0
     31 #define N_SCNUM(x)   ((x) > 0)
     32 
     33 /* basic types */
     34 #define T_NULL        0
     35 #define T_VOID        1
     36 #define T_CHAR        2
     37 #define T_SHORT       3
     38 #define T_INT         4
     39 #define T_LONG        5
     40 #define T_FLOAT       6
     41 #define T_DOUBLE      7
     42 #define T_STRUCT      8
     43 #define T_UNION       9
     44 #define T_ENUM       10
     45 #define T_MOE        11
     46 #define T_UCHAR      12
     47 #define T_USHORT     13
     48 #define T_UINT       14
     49 #define T_ULONG      15
     50 #define T_LNGDBL     16
     51 
     52 /* derivated types */
     53 #define DT_NON       0
     54 #define DT_PTR       1
     55 #define DT_FCN       2
     56 #define DT_ARY       3
     57 
     58 /* storage class */
     59 #define C_NULL       0
     60 #define C_AUTO       1
     61 #define C_EXT        2
     62 #define C_STAT       3
     63 #define C_REG        4
     64 #define C_EXTDEF     5
     65 #define C_LABEL      6
     66 #define C_ULABEL     7
     67 #define C_MOS        8
     68 #define C_ARG        9
     69 #define C_STRTAG     10
     70 #define C_MOU        11
     71 #define C_UNTAG      12
     72 #define C_TPDEF      13
     73 #define C_USTATIC    14
     74 #define C_ENTAG      15
     75 #define C_MOE        16
     76 #define C_REGPARM    17
     77 #define C_FIELD      18
     78 #define C_AUTOARG    19
     79 #define C_LASTENT    20
     80 #define C_BLOCK      100
     81 #define C_FCN        101
     82 #define C_EOS        102
     83 #define C_FILE       103
     84 #define C_LINE       104
     85 #define C_ALIAS      105
     86 #define C_HIDDEN     106
     87 #define C_WEAKEXT    127
     88 #define C_EFCN       255