home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1999 March B / SCO_CASTOR4RRT.iso / uccs / root.14 / udk / usr / include / syms.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-19  |  6.2 KB  |  253 lines

  1. /*
  2.  * Copyright (c) 1998 The Santa Cruz Operation, Inc.. All Rights Reserved. 
  3.  *                                                                         
  4.  *        THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF THE               
  5.  *                   SANTA CRUZ OPERATION INC.                             
  6.  *                                                                         
  7.  *   The copyright notice above does not evidence any actual or intended   
  8.  *   publication of such source code.                                      
  9.  */
  10.  
  11. #ident    "@(#)sgs-head:i386/head/syms.h    2.8.1.2"
  12.  
  13. #ifndef _SYMS_H
  14. #define _SYMS_H
  15.  
  16. /*        Storage Classes are defined in storclass.h  */
  17. #include <storclass.h>
  18.  
  19. /*        Number of characters in a symbol name */
  20. #define  SYMNMLEN    8
  21. /*        Number of characters in a file name */
  22. #define  FILNMLEN    14
  23. /*        Number of array dimensions in auxiliary entry */
  24. #define  DIMNUM        4
  25.  
  26. struct syment
  27. {
  28.     union
  29.     {
  30.         char        _n_name[SYMNMLEN];    /* old COFF version */
  31.         struct
  32.         {
  33.             long    _n_zeroes;    /* new == 0 */
  34.             long    _n_offset;    /* offset into string table */
  35.         } _n_n;
  36.         char        *_n_nptr[2];    /* allows for overlaying */
  37.     } _n;
  38.     unsigned
  39.     long            n_value;    /* value of symbol */
  40.     short            n_scnum;    /* section number */
  41.     unsigned short        n_type;        /* type and derived type */
  42.     char            n_sclass;    /* storage class */
  43.     char            n_numaux;    /* number of aux. entries */
  44. #if defined(m88k)
  45.     char            n_pad1;        /* pad to 4 byte multiple */
  46.     char            n_pad2;        /* pad to 4 byte multiple */
  47. #endif
  48. };
  49.  
  50. #define n_name        _n._n_name
  51. #define n_nptr        _n._n_nptr[1]
  52. #define n_zeroes    _n._n_n._n_zeroes
  53. #define n_offset    _n._n_n._n_offset
  54.  
  55. /*
  56.    Relocatable symbols have a section number of the
  57.    section in which they are defined.  Otherwise, section
  58.    numbers have the following meanings:
  59. */
  60.         /* undefined symbol */
  61. #define  N_UNDEF    0
  62.         /* value of symbol is absolute */
  63. #define  N_ABS        -1
  64.         /* special debugging symbol -- value of symbol is meaningless */
  65. #define  N_DEBUG    -2
  66.     /* indicates symbol needs transfer vector (preload) */
  67. #define  N_TV        (unsigned short)-3
  68.  
  69.     /* indicates symbol needs transfer vector (postload) */
  70.  
  71. #define  P_TV        (unsigned short)-4
  72.  
  73. /*
  74.    The fundamental type of a symbol packed into the low 
  75.    4 bits of the word.
  76. */
  77.  
  78. #define  _EF    ".ef"
  79.  
  80. #define  T_NULL     0
  81. #define  T_ARG      1          /* function argument (only used by compiler) */
  82. #define  T_CHAR     2          /* character */
  83. #define  T_SHORT    3          /* short integer */
  84. #define  T_INT      4          /* integer */
  85. #define  T_LONG     5          /* long integer */
  86. #define  T_FLOAT    6          /* floating point */
  87. #define  T_DOUBLE   7          /* double word */
  88. #define  T_STRUCT   8          /* structure  */
  89. #define  T_UNION    9          /* union  */
  90. #define  T_ENUM     10         /* enumeration  */
  91. #define  T_MOE      11         /* member of enumeration */
  92. #define  T_UCHAR    12         /* unsigned character */
  93. #define  T_USHORT   13         /* unsigned short */
  94. #define  T_UINT     14         /* unsigned integer */
  95. #define  T_ULONG    15         /* unsigned long */
  96.  
  97. /*
  98.  * derived types are:
  99.  */
  100.  
  101. #define  DT_NON      0          /* no derived type */
  102. #define  DT_PTR      1          /* pointer */
  103. #define  DT_FCN      2          /* function */
  104. #define  DT_ARY      3          /* array */
  105.  
  106. /*
  107.  *   type packing constants
  108.  */
  109.  
  110. #define  N_BTMASK     017
  111. #define  N_TMASK      060
  112. #define  N_TMASK1     0300
  113. #define  N_TMASK2     0360
  114. #define  N_BTSHFT     4
  115. #define  N_TSHIFT     2
  116.  
  117. /*
  118.  *   MACROS
  119.  */
  120.  
  121.     /*   Basic Type of  x   */
  122.  
  123. #define  BTYPE(x)  ((x) & N_BTMASK)
  124.  
  125.     /*   Is  x  a  pointer ?   */
  126.  
  127. #define  ISPTR(x)  (((x) & N_TMASK) == (DT_PTR << N_BTSHFT))
  128.  
  129.     /*   Is  x  a  function ?  */
  130.  
  131. #define  ISFCN(x)  (((x) & N_TMASK) == (DT_FCN << N_BTSHFT))
  132.  
  133.     /*   Is  x  an  array ?   */
  134.  
  135. #define  ISARY(x)  (((x) & N_TMASK) == (DT_ARY << N_BTSHFT))
  136.  
  137.     /* Is x a structure, union, or enumeration TAG? */
  138.  
  139. #define ISTAG(x)  ((x)==C_STRTAG || (x)==C_UNTAG || (x)==C_ENTAG)
  140.  
  141. #define  INCREF(x) ((((x)&~N_BTMASK)<<N_TSHIFT)|(DT_PTR<<N_BTSHFT)|(x&N_BTMASK))
  142.  
  143. #define  DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
  144.  
  145. /*
  146.  *    AUXILIARY ENTRY FORMAT
  147.  */
  148.  
  149. union auxent
  150. {
  151.     struct
  152.     {
  153.         long        x_tagndx;    /* str, un, or enum tag indx */
  154.         union
  155.         {
  156.             struct
  157.             {
  158.                 unsigned short    x_lnno;    /* declaration line number */
  159.                 unsigned short    x_size;    /* str, union, array size */
  160.             } x_lnsz;
  161.             long    x_fsize;    /* size of function */
  162.         } x_misc;
  163.         union
  164.         {
  165.             struct            /* if ISFCN, tag, or .bb */
  166.             {
  167.                 long    x_lnnoptr;    /* ptr to fcn line # */
  168.                 long    x_endndx;    /* entry ndx past block end */
  169.             }     x_fcn;
  170.             struct            /* if ISARY, up to 4 dimen. */
  171.             {
  172.                 unsigned short    x_dimen[DIMNUM];
  173.             }     x_ary;
  174.         }        x_fcnary;
  175.         unsigned short  x_tvndx;        /* tv index */
  176. #if defined(m88k)
  177.         char x_pad1;        /* pad to 4 byte multiple */
  178.         char x_pad2;        /* pad to 4 byte multiple */
  179. #endif
  180.     }     x_sym;
  181.     struct
  182.     {
  183.         char    x_fname[FILNMLEN];
  184.     }     x_file;
  185.         struct
  186.         {
  187.                 long    x_scnlen;          /* section length */
  188.                 unsigned short  x_nreloc;  /* number of relocation entries */
  189.                 unsigned short  x_nlinno;  /* number of line numbers */
  190.         }       x_scn;
  191.  
  192.     struct
  193.     {
  194.         long        x_tvfill;    /* tv fill value */
  195.         unsigned short    x_tvlen;    /* length of .tv */
  196.         unsigned short    x_tvran[2];    /* tv range */
  197.     }    x_tv;    /* info about .tv section (in auxent of symbol .tv)) */
  198. };
  199.  
  200. #define    SYMENT    struct syment
  201. #define    AUXENT    union auxent
  202.  
  203. #if defined(m88k)
  204. #define    SYMESZ    sizeof(SYMENT)
  205. #define    AUXESZ    sizeof(AUXENT)
  206. #else
  207. #define    SYMESZ    18
  208. #define    AUXESZ    18
  209. #endif
  210.  
  211. /*    Defines for "special" symbols   */
  212.  
  213. #if defined(__STDC__)
  214.  
  215. #if #machine(m88k)
  216. #define _ETEXT    "_etext"
  217. #define    _EDATA    "_edata"
  218. #define    _END    "_end"
  219. #else
  220. #define _ETEXT    "etext"
  221. #define _EDATA    "edata"
  222. #define _END    "end"
  223. #endif
  224.  
  225. #else
  226. #if m88k
  227. /* XXX_INTERIM
  228.  * The new BCS doesn't have leading underscores!  Change this when
  229.  * we get a coff compiler that doesn't generate them.
  230.  */
  231.  
  232. #define _ETEXT    "_etext"
  233. #define    _EDATA    "_edata"
  234. #define    _END    "_end"
  235.  
  236. #else
  237. #define _ETEXT    "etext"
  238. #define _EDATA    "edata"
  239. #define _END    "end"
  240. #endif
  241.  
  242. #endif    /* __STDC__ */
  243.  
  244. #define _START    "_start"
  245.  
  246. #if defined(m88k)
  247. #define _TVORIG       "_tvorig"
  248. #define _TORIGIN      "_torigin"
  249. #define _DORIGIN      "_dorigin"
  250. #define _SORIGIN      "_sorigin"
  251. #endif
  252. #endif     /* _SYMS_H */
  253.