progs.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #include "debug.h"
  2. #include <em.h>
  3. #include "LLlex.h"
  4. #include "def.h"
  5. #include "main.h"
  6. #include "scope.h"
  7. #include "type.h"
  8. static int extflc; /* number of external files */
  9. static int inpflag = 0; /* input mentioned in heading ? */
  10. static int outpflag = 0; /* output mentioned in heading ? */
  11. static label extfl_label; /* label of array of file pointers */
  12. set_inp()
  13. {
  14. inpflag = 1;
  15. }
  16. set_outp()
  17. {
  18. outpflag = 1;
  19. }
  20. make_extfl()
  21. {
  22. register struct def *df;
  23. extfl_label = ++data_label;
  24. C_df_dlb(extfl_label);
  25. if( inpflag )
  26. C_con_dnam(input, (arith) 0);
  27. else
  28. C_con_ucon("0", pointer_size);
  29. if( outpflag )
  30. C_con_dnam(output, (arith) 0);
  31. else
  32. C_con_ucon("0", pointer_size);
  33. extflc = 2;
  34. for( df = GlobalScope->sc_def; df; df = df->df_nextinscope )
  35. if( (df->df_flags & D_PROGPAR) &&
  36. df->var_name != input && df->var_name != output) {
  37. C_con_dnam(df->var_name, (arith) 0);
  38. extflc++;
  39. }
  40. }
  41. call_ini()
  42. {
  43. C_lxl((arith) 0);
  44. C_lae_dlb(extfl_label, (arith) 0);
  45. C_loc((arith) extflc);
  46. C_lxa((arith) 0);
  47. C_cal("_ini");
  48. C_asp(3 * pointer_size + word_size);
  49. }