1984-05-17 15:51:42 +00:00
|
|
|
#ifndef NORCSID
|
1994-06-24 11:31:16 +00:00
|
|
|
static char rcsid[] = "$Id$";
|
1984-05-17 15:51:42 +00:00
|
|
|
#endif
|
|
|
|
|
2017-11-10 03:22:13 +00:00
|
|
|
#include <assert.h>
|
1984-05-17 13:42:36 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include "param.h"
|
|
|
|
#include "types.h"
|
1988-09-12 09:13:49 +00:00
|
|
|
#include <em_pseu.h>
|
|
|
|
#include <em_spec.h>
|
|
|
|
#include <em_mes.h>
|
1984-05-17 13:42:36 +00:00
|
|
|
#include "lookup.h"
|
|
|
|
#include "ext.h"
|
|
|
|
|
|
|
|
/*
|
1987-03-10 01:42:07 +00:00
|
|
|
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
|
|
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
1984-05-17 13:42:36 +00:00
|
|
|
*
|
|
|
|
* Author: Hans van Staveren
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2016-11-10 21:04:18 +00:00
|
|
|
void
|
1984-05-17 13:42:36 +00:00
|
|
|
cleanup() {
|
|
|
|
FILE *infile;
|
|
|
|
register c;
|
|
|
|
register sym_p *spp,sp;
|
|
|
|
|
|
|
|
for (spp=symhash;spp< &symhash[NSYMHASH];spp++)
|
|
|
|
for (sp = *spp; sp != (sym_p) 0; sp = sp->s_next)
|
|
|
|
if ((sp->s_flags & SYMOUT) == 0)
|
|
|
|
outdef(sp);
|
|
|
|
if(!Lflag)
|
|
|
|
return;
|
|
|
|
c=fclose(outfile);
|
|
|
|
assert(c != EOF);
|
|
|
|
outfile = stdout;
|
|
|
|
infile = fopen(template,"r");
|
|
|
|
if (infile == NULL)
|
|
|
|
error("temp file disappeared");
|
|
|
|
outshort(sp_magic);
|
1987-05-20 13:56:26 +00:00
|
|
|
/* Attempt to first output the word_size message */
|
|
|
|
while ((c = getc(infile)) != sp_cend && c != EOF) {
|
|
|
|
putc(c, outfile);
|
|
|
|
}
|
|
|
|
if (c == sp_cend) putc(c, outfile);
|
1984-05-17 13:42:36 +00:00
|
|
|
outinst(ps_mes);
|
|
|
|
outint(ms_ext);
|
|
|
|
for (spp=symhash;spp< &symhash[NSYMHASH];spp++)
|
|
|
|
for (sp = *spp; sp != (sym_p) 0; sp = sp->s_next)
|
|
|
|
if ((sp->s_flags&(SYMDEF|SYMGLOBAL)) == (SYMDEF|SYMGLOBAL))
|
|
|
|
outsym(sp);
|
|
|
|
putc(sp_cend,outfile);
|
|
|
|
while ( (c=getc(infile)) != EOF)
|
|
|
|
putc(c,outfile);
|
|
|
|
c=fclose(infile);
|
|
|
|
assert(c != EOF);
|
|
|
|
c=unlink(template);
|
|
|
|
assert(c == 0);
|
|
|
|
}
|