assda.c 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. /*
  2. * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  3. * See the copyright notice in the ACK home directory, in the file "Copyright".
  4. */
  5. #include "ass00.h"
  6. #include "assex.h"
  7. #ifndef NORCSID
  8. static char rcs_id[] = "$Id$" ;
  9. static char rcs_ass[]= RCS_ASS ;
  10. static char rcs_ex[] = RCS_EX ;
  11. #endif
  12. /*
  13. * global data
  14. */
  15. int wordsize ;
  16. int ptrsize ;
  17. cons_t maxadr ;
  18. cons_t maxint;
  19. cons_t maxdint;
  20. cons_t maxunsig;
  21. cons_t maxdunsig;
  22. /*
  23. The structure containing used for procedure environment stacking
  24. */
  25. stat_t pstate ;
  26. /*
  27. * pointers to not yet allocated storage
  28. */
  29. glob_t *mglobs; /* pointer to module symbols */
  30. glob_t *xglobs; /* pointer to extern symbols */
  31. proc_t *mprocs; /* pointer to local procs */
  32. proc_t *xprocs; /* pointer to external procs */
  33. ptab_t *proctab; /* pointer to proctab[] */
  34. /*
  35. * some array and structures of known size
  36. */
  37. FILE *ifile; /* input file buffer */
  38. FILE *tfile; /* code file buffer */
  39. FILE *dfile; /* data file buffer */
  40. FILE *rtfile; /* code file buffer */
  41. FILE *rdfile; /* data file buffer */
  42. char string[MAXSTRING];
  43. /*
  44. * some other pointers
  45. */
  46. glob_t *lastglosym; /* last global symbol */
  47. glob_t *curglosym; /* current global symbol */
  48. relc_t *f_data = (relc_t *)0 ; /* first data reloc pointer */
  49. relc_t *l_data = (relc_t *)0 ; /* last data reloc pointer */
  50. relc_t *f_text = (relc_t *)0 ; /* first text reloc pointer */
  51. relc_t *l_text = (relc_t *)0 ; /* last text reloc pointer */
  52. /*
  53. * some indices
  54. */
  55. int strlngth; /* index in string[] */
  56. FOFFSET inpoff; /* offset in current input file */
  57. FOFFSET libeof; /* ceiling for above number */
  58. /*
  59. * some other counters
  60. */
  61. int procnum; /* generic for unique proc-descr. */
  62. cons_t prog_size; /* length of current proc */
  63. int max_bytes;
  64. int pass;
  65. int line_num; /* line number for error messages */
  66. int nerrors; /* number of nonfatal errors */
  67. cons_t consiz; /* size of U,I or F value */
  68. cons_t textbytes; /* size of code file */
  69. cons_t databytes; /* highwater mark in data */
  70. FOFFSET dataoff; /* size of data file */
  71. FOFFSET textoff; /* size of text file */
  72. FOFFSET lastoff; /* previous size before last block */
  73. int datamode; /* what kind of data */
  74. int datablocks; /* number of datablocks written out */
  75. relc_t *lastheader; /* pointer into datareloc */
  76. cons_t holbase;
  77. cons_t holsize;
  78. int unresolved; /* # of unresolved references */
  79. int sourcelines; /* number of lines in source program*/
  80. int intflags = 1; /* flags for interpreter */
  81. /*
  82. * some flags
  83. */
  84. int archmode; /* reading library ? */
  85. int procflag; /* print "namelist" of procedures */
  86. #ifdef DUMP
  87. int c_flag; /* print unused opcodes */
  88. char opcnt1[256]; /* count primary opcodes */
  89. char opcnt2[256]; /* count secondary opcodes */
  90. char opcnt3[256]; /* count long opcodes */
  91. #endif
  92. int d_flag = 0; /* don't dump */
  93. int r_flag = 0; /* don't dump relocation tables */
  94. #ifdef JOHAN
  95. int jflag;
  96. #endif
  97. int wflag = 0; /* don't issue warning messages */
  98. int Uflag = 0; /* exit status 0 on unresolved refs */
  99. int eof_seen;
  100. int mod_sizes; /* Size info in current module ok? */
  101. #define BASE (sizeof (struct lines) - sizeof (addr_u))
  102. char linesize[VALLOW+1] = {
  103. BASE, /* MISSING */
  104. BASE + sizeof (cons_t), /* CONST */
  105. BASE + sizeof prp_cast, /* PROCNAME */
  106. BASE + sizeof gbp_cast, /* GLOSYM */
  107. BASE + sizeof lbp_cast, /* LOCSYM */
  108. BASE + sizeof (struct sad_df), /* GLOOFF */
  109. BASE + sizeof (struct sad_ln), /* LINES */
  110. BASE /* VALLOW */
  111. } ;
  112. /*
  113. * miscellaneous
  114. */
  115. char *progname; /* argv[0] */
  116. char *curfile = 0; /* name of current file */
  117. char *eout = "e.out";
  118. arch_t archhdr;
  119. siz_t sizes[NDEFAULT] = {
  120. /* mlab, glab,mproc,xproc, proc */
  121. { 151, 29, 31, 73, 130 }, /* small */
  122. { 307, 127, 151, 401, 460 }, /* medium */
  123. { 601, 251, 151, 401, 600 }, /* large */
  124. {1601, 1601, 1601, 1601, 2000 } /* extra large */
  125. };
  126. siz_t *oursize = &sizes[2] ; /* point to selected sizes */