Next batch...

This commit is contained in:
Manoel Trapier
2013-03-13 18:56:03 +01:00
committed by Manoël Trapier
parent c5bfc89269
commit 41f96d5169
85 changed files with 1138 additions and 1727 deletions

View File

@@ -42,9 +42,7 @@ char **dnames, **pnames; /* Dynamically allocated arrays of strings.
STATIC line_p get_ca_lines(lf,p_out)
FILE *lf;
proc_p *p_out;
static line_p get_ca_lines(FILE *lf, proc_p *p_out)
{
/* Read lines of EM text and link them.
* Register messages are outputted immediately after the PRO.
@@ -100,8 +98,7 @@ STATIC line_p get_ca_lines(lf,p_out)
return head;
}
STATIC int makedmap(dbl)
dblock_p dbl;
static int makedmap(dblock_p dbl)
{
/* construct the dmap table */
@@ -122,8 +119,7 @@ STATIC int makedmap(dbl)
STATIC getdnames(dumpd)
FILE *dumpd;
static void getdnames(FILE *dumpd)
{
/* Read the names of the datalabels from
* the dump file.
@@ -141,8 +137,7 @@ STATIC getdnames(dumpd)
}
}
STATIC getpnames(dumpp)
FILE *dumpp;
static void getpnames(FILE *dumpp)
{
/* Read the names of the procedures from
* the dump file.
@@ -162,8 +157,7 @@ STATIC getpnames(dumpp)
STATIC new_name(s)
char **s;
static void new_name(char **s)
{
static int nn = 0;
char buf[20];
@@ -181,7 +175,7 @@ STATIC new_name(s)
STATIC uniq_names()
static void uniq_names()
{
/* The names of all internal procedures and data blocks
* are made different. As the optimizer combines several
@@ -206,9 +200,7 @@ STATIC uniq_names()
}
main(argc,argv)
int argc;
char *argv[];
int main(int argc, char *argv[])
{
/* CA does not output proctable etc. files. Instead, its
* pname2 and dname2 arguments contain the names of the
@@ -218,8 +210,8 @@ main(argc,argv)
FILE *df, *pf; /* The dump files */
line_p lnp;
fproc = getptable(pname); /* proc table */
fdblock = getdtable(dname); /* data block table */
fproc = getptable(&pname); /* proc table */
fdblock = getdtable(&dname); /* data block table */
dlength = makedmap(fdblock); /* allocate dmap table */
df = openfile(dname2,"r");
getdnames(df);

View File

@@ -20,21 +20,21 @@
FILE *outfile;
STATIC proc_p thispro;
STATIC outinst(m) {
static proc_p thispro;
static void outinst(int m)
{
outbyte( (byte) m );
}
STATIC coutshort(i) short i; {
static void coutshort(short i)
{
outbyte( (byte) (i&BMASK) );
outbyte( (byte) (i>>8) );
}
STATIC coutint(i) short i; {
static void coutint(short i)
{
if (i>= -sp_zcst0 && i< sp_ncst0-sp_zcst0)
outbyte( (byte) (i+sp_zcst0+sp_fcst0) );
else {
@@ -43,8 +43,8 @@ STATIC coutint(i) short i; {
}
}
STATIC coutoff(off) offset off; {
static void coutoff(offset off)
{
if ((short) off == off)
coutint((short) off);
else {
@@ -55,12 +55,10 @@ STATIC coutoff(off) offset off; {
}
STATIC outsym(s,t)
char *s;
int t;
static void outsym(char *s, int t)
{
register byte *p;
register unsigned num;
byte *p;
unsigned int num;
if (s[0] == '.') {
num = atoi(&s[1]);
@@ -85,22 +83,20 @@ STATIC outsym(s,t)
}
STATIC outdsym(dbl)
dblock_p dbl;
static void outdsym(dblock_p dbl)
{
if (dnames[dbl->d_id]) outsym(dnames[dbl->d_id],sp_dnam);
}
STATIC outpsym(p)
proc_p p;
static void outpsym(proc_p p)
{
outsym(pnames[p->p_id],sp_pnam);
}
STATIC outddef(id) short id; {
static void outddef(short id)
{
dblock_p dbl;
dbl = dmap[id];
@@ -111,7 +107,8 @@ STATIC outddef(id) short id; {
}
}
STATIC outpdef(p) proc_p p; {
static void outpdef(proc_p p)
{
p->p_flags2 |= PF_SYMOUT;
if (p->p_flags1 & PF_EXTERNAL) {
outinst(ps_exp);
@@ -120,7 +117,8 @@ STATIC outpdef(p) proc_p p; {
}
STATIC outdocc(obj) obj_p obj; {
static void outdocc(obj_p obj)
{
dblock_p dbl;
dbl = obj->o_dblock;
@@ -135,7 +133,8 @@ STATIC outdocc(obj) obj_p obj; {
}
STATIC outpocc(p) proc_p p; {
static void outpocc(proc_p p)
{
if ((p->p_flags2 & PF_SYMOUT) == 0) {
p->p_flags2 |= PF_SYMOUT;
if ((p->p_flags1 & PF_EXTERNAL) == 0) {
@@ -146,8 +145,7 @@ STATIC outpocc(p) proc_p p; {
}
STATIC coutobject(obj)
obj_p obj;
static void coutobject(obj_p obj)
{
/* In general, an object is defined by a global data
* label and an offset. There are two special cases:
@@ -169,9 +167,10 @@ STATIC coutobject(obj)
}
STATIC cputstr(abp) register argb_p abp; {
register argb_p tbp;
register length;
static void cputstr(argb_p abp)
{
argb_p tbp;
int length;
length = 0;
tbp = abp;
@@ -188,8 +187,7 @@ STATIC cputstr(abp) register argb_p abp; {
}
STATIC outnum(n)
int n;
static void outnum(int n)
{
if (n < 256) {
outbyte((byte) sp_ilb1);
@@ -201,8 +199,7 @@ STATIC outnum(n)
}
STATIC numlab(n)
int n;
static void numlab(int n)
{
if (n < sp_nilb0) {
outbyte((byte) (n + sp_filb0));
@@ -212,10 +209,9 @@ STATIC numlab(n)
}
STATIC cputargs(lnp)
line_p lnp;
static void cputargs(line_p lnp)
{
register arg_p ap;
arg_p ap;
int cnt = 0;
ap = ARG(lnp);
while (ap != (arg_p) 0) {
@@ -264,8 +260,7 @@ STATIC cputargs(lnp)
STATIC outoperand(lnp)
line_p lnp;
static void outoperand(line_p lnp)
{
/* Output the operand of instruction lnp */
@@ -320,8 +315,7 @@ STATIC outoperand(lnp)
}
STATIC outvisibility(lnp)
line_p lnp;
static void outvisibility(line_p lnp)
{
/* In EM names of datalabels and procedures can be made
* externally visible, so they can be used in other files.
@@ -377,9 +371,7 @@ STATIC outvisibility(lnp)
}
cputlines(l,lf)
line_p l;
FILE *lf;
void cputlines(line_p l, FILE *lf)
{
/* Output the lines in Campact assembly language
* format.
@@ -405,13 +397,12 @@ cputlines(l,lf)
oldline(lnp);
}
if (lmap != (line_p *) 0) {
oldmap(lmap,llength);
oldmap((short **)lmap,llength);
lmap = (line_p *) 0;
}
}
cputmagic(lf)
FILE *lf;
void cputmagic(FILE *lf)
{
/* write the magic number */

View File

@@ -10,5 +10,5 @@
*/
extern cputlines();
extern cputmagic();
void cputlines(line_p l, FILE *lf);
void cputmagic(FILE *lf);