home *** CD-ROM | disk | FTP | other *** search
/ APDL Public Domain 1 / APDL_PD1A.iso / program / assembler / as / src / h / symbol < prev    next >
Encoding:
Text File  |  1992-07-20  |  1.7 KB  |  72 lines

  1.  
  2. /*
  3.  *   symbol.h
  4.  * Copyright © 1992 Niklas Röjemo
  5.  */
  6.  
  7. #ifndef _symbol_h
  8. #define _symbol_h
  9.  
  10. #include <stdio.h>
  11.  
  12. #ifndef _lex_h
  13. #include "lex.h"
  14. #endif
  15.  
  16. #ifndef _value_h
  17. #include "value.h"
  18. #endif
  19.  
  20. #define SYMBOL_LOCAL     0x01  /* Defined with local scope */
  21. #define SYMBOL_REFERENCE 0x02
  22. #define SYMBOL_GLOBAL    0x03  /* Defined with global scope */
  23.  
  24. #define SYMBOL_KIND(x)      ((x) & 0x03)
  25.  
  26. #define SYMBOL_DEFINED   0x01
  27. #define SYMBOL_EXPORT    0x02
  28.  
  29. #define SYMBOL_ABSOLUTE  0x04  /* This is a constant, (not valid if SYMBOL_REFERENCE) */
  30. #define SYMBOL_NOCASE    0x08  /* Only if SYMBOL_REFERENCE, case insesitive */
  31. #define SYMBOL_WEAK      0x10  /* Only if SYMBOL_REFERENCE, must not be resolved */
  32. #define SYMBOL_STRONG    0x20  /* Complicated ??? */
  33. #define SYMBOL_COMMON    0x40
  34.  
  35. #define SYMBOL_AREA        0x100
  36. #define SYMBOL_NOTRESOLVED 0x200
  37.  
  38. #define SYMBOL_CPUREG      0x400
  39. #define SYMBOL_FPUREG      0x800
  40. #define SYMBOL_COPREG      0xc00
  41. #define SYMBOL_GETREG(x)   ((x)&0xc00)
  42.  
  43. #define SYMBOL_TABELSIZE 1024
  44.  
  45.  
  46. typedef struct SYMBOL {
  47.   struct SYMBOL *next;
  48.   int     type;
  49.   Value   value;
  50.   union {
  51.     struct SYMBOL  *ptr;
  52.     struct AREA    *info;
  53.   } area;
  54.   int     offset;    /* Offset in stringtabel */
  55.   int     used;      /* this id is used (ie not resolved) */
  56.                      /* Later changed to index in symbol table */
  57.   int     len;       /* length of str[] */
  58.   char    str[1];    /* str[len+1] */
  59. } Symbol;
  60.  
  61.  
  62. Symbol *symbolAdd(Lex l);
  63. Symbol *symbolGet(Lex l);
  64. void symbolPrint(void);
  65.  
  66. int symbolFix(void);        /* Returns number of symbols */
  67. int symbolStringSize(void);
  68. void symbolStringOutput(FILE *outfile);
  69. void symbolSymbolOutput(FILE *outfile);
  70.  
  71. #endif
  72.