1988-10-26 15:21:11 +00:00
|
|
|
#include "debug.h"
|
|
|
|
|
|
|
|
#include <em.h>
|
|
|
|
|
|
|
|
#include "LLlex.h"
|
|
|
|
#include "def.h"
|
|
|
|
#include "main.h"
|
|
|
|
#include "scope.h"
|
|
|
|
#include "type.h"
|
|
|
|
|
1988-11-16 15:18:21 +00:00
|
|
|
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 */
|
1988-10-26 15:21:11 +00:00
|
|
|
|
|
|
|
set_inp()
|
|
|
|
{
|
|
|
|
inpflag = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
set_outp()
|
|
|
|
{
|
|
|
|
outpflag = 1;
|
|
|
|
}
|
|
|
|
|
1988-11-16 15:18:21 +00:00
|
|
|
make_extfl()
|
1988-10-26 15:21:11 +00:00
|
|
|
{
|
|
|
|
register struct def *df;
|
|
|
|
|
1988-11-16 15:18:21 +00:00
|
|
|
extfl_label = ++data_label;
|
|
|
|
C_df_dlb(extfl_label);
|
1988-10-26 15:21:11 +00:00
|
|
|
|
|
|
|
if( inpflag )
|
1988-11-16 15:18:21 +00:00
|
|
|
C_con_dnam(input, (arith) 0);
|
1988-10-26 15:21:11 +00:00
|
|
|
else
|
1988-11-16 15:18:21 +00:00
|
|
|
C_con_ucon("0", pointer_size);
|
1988-10-26 15:21:11 +00:00
|
|
|
|
|
|
|
if( outpflag )
|
1988-11-16 15:18:21 +00:00
|
|
|
C_con_dnam(output, (arith) 0);
|
1988-10-26 15:21:11 +00:00
|
|
|
else
|
1988-11-16 15:18:21 +00:00
|
|
|
C_con_ucon("0", pointer_size);
|
|
|
|
|
|
|
|
extflc = 2;
|
1988-10-26 15:21:11 +00:00
|
|
|
|
|
|
|
for( df = GlobalScope->sc_def; df; df = df->df_nextinscope )
|
1988-11-16 15:18:21 +00:00
|
|
|
if( (df->df_flags & D_PROGPAR) &&
|
|
|
|
df->var_name != input && df->var_name != output) {
|
1988-10-26 15:21:11 +00:00
|
|
|
C_con_dnam(df->var_name, (arith) 0);
|
1988-11-16 15:18:21 +00:00
|
|
|
extflc++;
|
1988-10-26 15:21:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
call_ini()
|
|
|
|
{
|
|
|
|
C_lxl((arith) 0);
|
1988-11-16 15:18:21 +00:00
|
|
|
C_lae_dlb(extfl_label, (arith) 0);
|
|
|
|
C_loc((arith) extflc);
|
1988-10-26 15:21:11 +00:00
|
|
|
C_lxa((arith) 0);
|
|
|
|
C_cal("_ini");
|
1988-11-16 15:18:21 +00:00
|
|
|
C_asp(3 * pointer_size + word_size);
|
1988-10-26 15:21:11 +00:00
|
|
|
}
|