|
@@ -1,8 +1,5 @@
|
|
|
-/* TYDELYK !!!!!! */
|
|
|
-
|
|
|
#include "debug.h"
|
|
|
|
|
|
-#include <assert.h>
|
|
|
#include <em.h>
|
|
|
|
|
|
#include "LLlex.h"
|
|
@@ -11,10 +8,10 @@
|
|
|
#include "scope.h"
|
|
|
#include "type.h"
|
|
|
|
|
|
-arith cnt = 2; /* standaard input & output */
|
|
|
-int inpflag = 0; /* std input gedefinieerd of niet */
|
|
|
-int outpflag = 0; /* std output gedefinieerd of niet */
|
|
|
-label con_label;
|
|
|
+static int extflc; /* number of external files */
|
|
|
+static int inpflag = 0; /* input mentioned in heading ? */
|
|
|
+static int outpflag = 0; /* output mentioned in heading ? */
|
|
|
+static label extfl_label; /* label of array of file pointers */
|
|
|
|
|
|
set_inp()
|
|
|
{
|
|
@@ -26,46 +23,39 @@ set_outp()
|
|
|
outpflag = 1;
|
|
|
}
|
|
|
|
|
|
-set_prog(df)
|
|
|
- struct def *df;
|
|
|
-{
|
|
|
- cnt++;
|
|
|
- df->df_flags |= 0x40;
|
|
|
-}
|
|
|
-
|
|
|
-make_con()
|
|
|
+make_extfl()
|
|
|
{
|
|
|
register struct def *df;
|
|
|
|
|
|
- con_label = ++data_label;
|
|
|
- C_df_dlb(con_label);
|
|
|
- C_con_cst(cnt);
|
|
|
+ extfl_label = ++data_label;
|
|
|
+ C_df_dlb(extfl_label);
|
|
|
|
|
|
if( inpflag )
|
|
|
- C_con_dnam("input", (arith) 0);
|
|
|
+ C_con_dnam(input, (arith) 0);
|
|
|
else
|
|
|
- C_con_cst((arith) -1);
|
|
|
+ C_con_ucon("0", pointer_size);
|
|
|
|
|
|
if( outpflag )
|
|
|
- C_con_dnam("output", (arith) 0);
|
|
|
+ C_con_dnam(output, (arith) 0);
|
|
|
else
|
|
|
- C_con_cst((arith) -1);
|
|
|
+ C_con_ucon("0", pointer_size);
|
|
|
+
|
|
|
+ extflc = 2;
|
|
|
|
|
|
for( df = GlobalScope->sc_def; df; df = df->df_nextinscope )
|
|
|
- if( df->df_flags & 0x40 ) {
|
|
|
+ if( (df->df_flags & D_PROGPAR) &&
|
|
|
+ df->var_name != input && df->var_name != output) {
|
|
|
C_con_dnam(df->var_name, (arith) 0);
|
|
|
- cnt--;
|
|
|
+ extflc++;
|
|
|
}
|
|
|
-
|
|
|
- assert(cnt == 2);
|
|
|
}
|
|
|
|
|
|
call_ini()
|
|
|
{
|
|
|
C_lxl((arith) 0);
|
|
|
- C_lae_dlb(con_label, (arith) 0);
|
|
|
- C_zer(pointer_size);
|
|
|
+ C_lae_dlb(extfl_label, (arith) 0);
|
|
|
+ C_loc((arith) extflc);
|
|
|
C_lxa((arith) 0);
|
|
|
C_cal("_ini");
|
|
|
- C_asp(4 * pointer_size);
|
|
|
+ C_asp(3 * pointer_size + word_size);
|
|
|
}
|