Run through clang-format.
This commit is contained in:
parent
3584ddb6e9
commit
1b66b63eae
|
@ -8,7 +8,6 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -25,13 +24,11 @@
|
||||||
#include "../share/get.h"
|
#include "../share/get.h"
|
||||||
#include "ca_put.h"
|
#include "ca_put.h"
|
||||||
|
|
||||||
|
|
||||||
/* This phase transforms the Intermediate Code of the global optimizer
|
/* This phase transforms the Intermediate Code of the global optimizer
|
||||||
* to 'standard' compact assembly language, which will be processed
|
* to 'standard' compact assembly language, which will be processed
|
||||||
* by the code generator.
|
* by the code generator.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
short dlength;
|
short dlength;
|
||||||
dblock_p* dmap;
|
dblock_p* dmap;
|
||||||
|
|
||||||
|
@ -40,8 +37,6 @@ char **dnames, **pnames; /* Dynamically allocated arrays of strings.
|
||||||
* of the procedure with proc_id i.
|
* of the procedure with proc_id i.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
STATIC line_p get_ca_lines(lf, p_out)
|
STATIC line_p get_ca_lines(lf, p_out)
|
||||||
FILE* lf;
|
FILE* lf;
|
||||||
proc_p* p_out;
|
proc_p* p_out;
|
||||||
|
@ -58,34 +53,45 @@ STATIC line_p get_ca_lines(lf,p_out)
|
||||||
pp = &head;
|
pp = &head;
|
||||||
mp = &headm;
|
mp = &headm;
|
||||||
headm = (line_p)0;
|
headm = (line_p)0;
|
||||||
while (TRUE) {
|
while (TRUE)
|
||||||
|
{
|
||||||
l = read_line(p_out);
|
l = read_line(p_out);
|
||||||
if (feof(curinp)) break;
|
if (feof(curinp))
|
||||||
|
break;
|
||||||
assert(l != (line_p)0);
|
assert(l != (line_p)0);
|
||||||
if (INSTR(l) == ps_end && INSTR(head) != ps_pro) {
|
if (INSTR(l) == ps_end && INSTR(head) != ps_pro)
|
||||||
|
{
|
||||||
/* Delete end pseudo after data-unit */
|
/* Delete end pseudo after data-unit */
|
||||||
oldline(l);
|
oldline(l);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (INSTR(l) == ps_mes && l->l_a.la_arg->a_a.a_offset == ms_reg) {
|
if (INSTR(l) == ps_mes && l->l_a.la_arg->a_a.a_offset == ms_reg)
|
||||||
|
{
|
||||||
/* l is a register message */
|
/* l is a register message */
|
||||||
if (l->l_a.la_arg->a_next == (arg_p) 0) {
|
if (l->l_a.la_arg->a_next == (arg_p)0)
|
||||||
|
{
|
||||||
/* register message without arguments */
|
/* register message without arguments */
|
||||||
oldline(l);
|
oldline(l);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
*mp = l;
|
*mp = l;
|
||||||
mp = &l->l_next;
|
mp = &l->l_next;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
*pp = l;
|
*pp = l;
|
||||||
pp = &l->l_next;
|
pp = &l->l_next;
|
||||||
}
|
}
|
||||||
if (INSTR(l) == ps_end) {
|
if (INSTR(l) == ps_end)
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*pp = (line_p)0;
|
*pp = (line_p)0;
|
||||||
if (head != (line_p) 0 && INSTR(head) == ps_pro) {
|
if (head != (line_p)0 && INSTR(head) == ps_pro)
|
||||||
|
{
|
||||||
/* append register message without arguments to list */
|
/* append register message without arguments to list */
|
||||||
l = newline(OPLIST);
|
l = newline(OPLIST);
|
||||||
l->l_instr = ps_mes;
|
l->l_instr = ps_mes;
|
||||||
|
@ -94,7 +100,9 @@ STATIC line_p get_ca_lines(lf,p_out)
|
||||||
*mp = l;
|
*mp = l;
|
||||||
l->l_next = head->l_next;
|
l->l_next = head->l_next;
|
||||||
head->l_next = headm;
|
head->l_next = headm;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
assert(headm == (line_p)0);
|
assert(headm == (line_p)0);
|
||||||
}
|
}
|
||||||
return head;
|
return head;
|
||||||
|
@ -111,17 +119,17 @@ STATIC int makedmap(dbl)
|
||||||
/* determine the length of the table */
|
/* determine the length of the table */
|
||||||
|
|
||||||
cnt = 0;
|
cnt = 0;
|
||||||
for (d = dbl; d != (dblock_p) 0; d = d->d_next) cnt++;
|
for (d = dbl; d != (dblock_p)0; d = d->d_next)
|
||||||
|
cnt++;
|
||||||
dmap = (dblock_p*)newmap(cnt);
|
dmap = (dblock_p*)newmap(cnt);
|
||||||
for (d = dbl; d != (dblock_p) 0; d = d->d_next) {
|
for (d = dbl; d != (dblock_p)0; d = d->d_next)
|
||||||
|
{
|
||||||
assert(d->d_id <= cnt);
|
assert(d->d_id <= cnt);
|
||||||
dmap[d->d_id] = d;
|
dmap[d->d_id] = d;
|
||||||
}
|
}
|
||||||
return cnt;
|
return cnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
STATIC getdnames(dumpd)
|
STATIC getdnames(dumpd)
|
||||||
FILE* dumpd;
|
FILE* dumpd;
|
||||||
{
|
{
|
||||||
|
@ -133,8 +141,10 @@ STATIC getdnames(dumpd)
|
||||||
int id;
|
int id;
|
||||||
|
|
||||||
dnames = (char**)newmap(dlength);
|
dnames = (char**)newmap(dlength);
|
||||||
for (;;) {
|
for (;;)
|
||||||
if (fscanf(dumpd,"%d %s",&id,str) == EOF) return;
|
{
|
||||||
|
if (fscanf(dumpd, "%d %s", &id, str) == EOF)
|
||||||
|
return;
|
||||||
assert(id <= dlength);
|
assert(id <= dlength);
|
||||||
dnames[id] = (char*)newcore(strlen(str) + 1);
|
dnames[id] = (char*)newcore(strlen(str) + 1);
|
||||||
strcpy(dnames[id], str);
|
strcpy(dnames[id], str);
|
||||||
|
@ -152,18 +162,17 @@ STATIC getpnames(dumpp)
|
||||||
int id;
|
int id;
|
||||||
|
|
||||||
pnames = (char**)newmap(plength);
|
pnames = (char**)newmap(plength);
|
||||||
for (;;) {
|
for (;;)
|
||||||
if (fscanf(dumpp,"%d %s",&id,str) == EOF) return;
|
{
|
||||||
|
if (fscanf(dumpp, "%d %s", &id, str) == EOF)
|
||||||
|
return;
|
||||||
assert(id <= plength);
|
assert(id <= plength);
|
||||||
pnames[id] = (char*)newcore(strlen(str) + 1);
|
pnames[id] = (char*)newcore(strlen(str) + 1);
|
||||||
strcpy(pnames[id], str);
|
strcpy(pnames[id], str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
STATIC new_name(s) char** s;
|
||||||
|
|
||||||
STATIC new_name(s)
|
|
||||||
char **s;
|
|
||||||
{
|
{
|
||||||
static int nn = 0;
|
static int nn = 0;
|
||||||
char buf[20];
|
char buf[20];
|
||||||
|
@ -179,8 +188,6 @@ STATIC new_name(s)
|
||||||
strcpy(*s, buf);
|
strcpy(*s, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
STATIC uniq_names()
|
STATIC uniq_names()
|
||||||
{
|
{
|
||||||
/* The names of all internal procedures and data blocks
|
/* The names of all internal procedures and data blocks
|
||||||
|
@ -193,21 +200,23 @@ STATIC uniq_names()
|
||||||
proc_p p;
|
proc_p p;
|
||||||
dblock_p d;
|
dblock_p d;
|
||||||
|
|
||||||
for (p = fproc; p != (proc_p) 0; p = p->p_next) {
|
for (p = fproc; p != (proc_p)0; p = p->p_next)
|
||||||
if (!(p->p_flags1 & PF_EXTERNAL)) {
|
{
|
||||||
|
if (!(p->p_flags1 & PF_EXTERNAL))
|
||||||
|
{
|
||||||
new_name(&(pnames[p->p_id]));
|
new_name(&(pnames[p->p_id]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (d = fdblock; d != (dblock_p) 0; d = d->d_next) {
|
for (d = fdblock; d != (dblock_p)0; d = d->d_next)
|
||||||
if (!(d->d_flags1 & DF_EXTERNAL) && dnames[d->d_id]) {
|
{
|
||||||
|
if (!(d->d_flags1 & DF_EXTERNAL) && dnames[d->d_id])
|
||||||
|
{
|
||||||
new_name(&(dnames[d->d_id]));
|
new_name(&(dnames[d->d_id]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
main(argc, argv) int argc;
|
||||||
main(argc,argv)
|
|
||||||
int argc;
|
|
||||||
char* argv[];
|
char* argv[];
|
||||||
{
|
{
|
||||||
/* CA does not output proctable etc. files. Instead, its
|
/* CA does not output proctable etc. files. Instead, its
|
||||||
|
@ -231,7 +240,8 @@ main(argc,argv)
|
||||||
f = openfile(lname, "r");
|
f = openfile(lname, "r");
|
||||||
f2 = stdout;
|
f2 = stdout;
|
||||||
cputmagic(f2); /* write magic number */
|
cputmagic(f2); /* write magic number */
|
||||||
while ((lnp = get_ca_lines(f,&curproc)) != (line_p) 0) {
|
while ((lnp = get_ca_lines(f, &curproc)) != (line_p)0)
|
||||||
|
{
|
||||||
cputlines(lnp, f2);
|
cputlines(lnp, f2);
|
||||||
}
|
}
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
|
Loading…
Reference in a new issue