Next batch...
This commit is contained in:
committed by
Manoël Trapier
parent
c5bfc89269
commit
41f96d5169
@@ -55,15 +55,13 @@ offset mespar = UNKNOWN_SIZE;
|
||||
/* argumument of ps_par message of current procedure */
|
||||
|
||||
|
||||
extern process_lines();
|
||||
extern int readline();
|
||||
extern line_p readoperand();
|
||||
extern line_p inpseudo();
|
||||
void process_lines(FILE *fout);
|
||||
int readline(short *instr_out, line_p *lnp_out);
|
||||
line_p readoperand(short instr);
|
||||
line_p inpseudo(short n);
|
||||
|
||||
|
||||
main(argc,argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
/* The input files must be legal EM Compact
|
||||
* Assembly Language files, as produced by the EM Peephole
|
||||
@@ -128,7 +126,7 @@ main(argc,argv)
|
||||
#define DELETED_INSTR 5
|
||||
|
||||
|
||||
STATIC add_end()
|
||||
static void add_end()
|
||||
{
|
||||
/* Add an end-pseudo to the current instruction list */
|
||||
|
||||
@@ -138,8 +136,7 @@ STATIC add_end()
|
||||
}
|
||||
|
||||
|
||||
process_lines(fout)
|
||||
FILE *fout;
|
||||
void process_lines(FILE *fout)
|
||||
{
|
||||
line_p lnp;
|
||||
short instr;
|
||||
@@ -228,11 +225,9 @@ process_lines(fout)
|
||||
|
||||
|
||||
|
||||
int readline(instr_out, lnp_out)
|
||||
short *instr_out;
|
||||
line_p *lnp_out;
|
||||
int readline(short *instr_out, line_p *lnp_out)
|
||||
{
|
||||
register line_p lnp;
|
||||
line_p lnp;
|
||||
short n;
|
||||
|
||||
/* Read one line. If it is a normal EM instruction without
|
||||
@@ -295,18 +290,16 @@ int readline(instr_out, lnp_out)
|
||||
return NORMAL;
|
||||
}
|
||||
/* NOTREACHED */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
line_p readoperand(instr)
|
||||
short instr;
|
||||
line_p readoperand(short instr)
|
||||
{
|
||||
/* Read the operand of the given instruction.
|
||||
* Create a line struct and return a pointer to it.
|
||||
*/
|
||||
|
||||
|
||||
register line_p lnp;
|
||||
line_p lnp;
|
||||
short flag;
|
||||
|
||||
VI(instr);
|
||||
@@ -420,8 +413,7 @@ static char *hol_label()
|
||||
}
|
||||
|
||||
|
||||
line_p inpseudo(n)
|
||||
short n;
|
||||
line_p inpseudo(short n)
|
||||
{
|
||||
int m;
|
||||
line_p lnp;
|
||||
@@ -454,7 +446,7 @@ line_p inpseudo(n)
|
||||
curhol = hol_label();
|
||||
}
|
||||
n = ps_bss;
|
||||
/* fall through */
|
||||
/* fall through */
|
||||
case ps_bss:
|
||||
case ps_rom:
|
||||
case ps_con:
|
||||
@@ -570,4 +562,6 @@ line_p inpseudo(n)
|
||||
assert(FALSE);
|
||||
}
|
||||
/* NOTREACHED */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
* I C _ A U X . C
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <em_pseu.h>
|
||||
#include <em_spec.h>
|
||||
#include <em_mnem.h>
|
||||
@@ -24,12 +24,9 @@
|
||||
#include "../share/alloc.h"
|
||||
#include "ic_aux.h"
|
||||
|
||||
|
||||
|
||||
/* opr_size */
|
||||
|
||||
offset opr_size(instr)
|
||||
short instr;
|
||||
offset opr_size(short instr)
|
||||
{
|
||||
switch(instr) {
|
||||
case op_loe:
|
||||
@@ -49,14 +46,14 @@ offset opr_size(instr)
|
||||
error("illegal operand of opr_size: %d", instr);
|
||||
}
|
||||
/* NOTREACHED */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* dblockdef */
|
||||
|
||||
STATIC offset argsize(arg)
|
||||
arg_p arg;
|
||||
static offset argsize(arg_p arg)
|
||||
{
|
||||
/* Compute the size (in bytes) that the given initializer
|
||||
* will occupy.
|
||||
@@ -93,12 +90,11 @@ STATIC offset argsize(arg)
|
||||
assert(FALSE);
|
||||
}
|
||||
/* NOTREACHED */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
STATIC offset blocksize(pseudo,args)
|
||||
byte pseudo;
|
||||
arg_p args;
|
||||
static offset blocksize(byte pseudo, arg_p args)
|
||||
{
|
||||
/* Determine the number of bytes of a datablock */
|
||||
|
||||
@@ -124,11 +120,11 @@ STATIC offset blocksize(pseudo,args)
|
||||
assert(FALSE);
|
||||
}
|
||||
/* NOTREACHED */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
STATIC arg_p copy_arg(arg)
|
||||
arg_p arg;
|
||||
static arg_p copy_arg(arg_p arg)
|
||||
{
|
||||
/* Copy one argument */
|
||||
|
||||
@@ -142,8 +138,7 @@ STATIC arg_p copy_arg(arg)
|
||||
|
||||
|
||||
|
||||
STATIC arg_p copy_rom(args)
|
||||
arg_p args;
|
||||
static arg_p copy_rom(arg_p args)
|
||||
{
|
||||
/* Make a copy of the values of a rom,
|
||||
* provided that the rom contains only integer values,
|
||||
@@ -167,10 +162,7 @@ STATIC arg_p copy_rom(args)
|
||||
|
||||
|
||||
|
||||
dblockdef(db,n,lnp)
|
||||
dblock_p db;
|
||||
int n;
|
||||
line_p lnp;
|
||||
void dblockdef(dblock_p db, int n, line_p lnp)
|
||||
{
|
||||
/* Process a data block defining occurrence */
|
||||
|
||||
@@ -206,10 +198,7 @@ dblockdef(db,n,lnp)
|
||||
|
||||
/* combine */
|
||||
|
||||
combine(db,l1,l2,pseu)
|
||||
dblock_p db;
|
||||
line_p l1,l2;
|
||||
byte pseu;
|
||||
void combine(dblock_p db, line_p l1, line_p l2, byte pseu)
|
||||
{
|
||||
/* Combine two successive ROMs/CONs (without a data label
|
||||
* in between into a single ROM. E.g.:
|
||||
@@ -258,11 +247,8 @@ combine(db,l1,l2,pseu)
|
||||
|
||||
/* arglist */
|
||||
|
||||
STATIC arg_string(length,abp)
|
||||
offset length;
|
||||
register argb_p abp;
|
||||
static void arg_string(offset length, argb_p abp)
|
||||
{
|
||||
|
||||
while (length--) {
|
||||
if (abp->ab_index == NARGBYTES)
|
||||
abp = abp->ab_next = newargb();
|
||||
@@ -271,8 +257,7 @@ STATIC arg_string(length,abp)
|
||||
}
|
||||
|
||||
|
||||
line_p arglist(n)
|
||||
int n;
|
||||
line_p arglist(int n)
|
||||
{
|
||||
line_p lnp;
|
||||
register arg_p ap,*app;
|
||||
@@ -355,8 +340,7 @@ line_p arglist(n)
|
||||
|
||||
/* is_datalabel */
|
||||
|
||||
bool is_datalabel(l)
|
||||
line_p l;
|
||||
bool is_datalabel(line_p l)
|
||||
{
|
||||
VL(l);
|
||||
return (l->l_instr == (byte) ps_sym);
|
||||
@@ -366,8 +350,7 @@ bool is_datalabel(l)
|
||||
|
||||
/* block_of_lab */
|
||||
|
||||
dblock_p block_of_lab(ident)
|
||||
char *ident;
|
||||
dblock_p block_of_lab(char *ident)
|
||||
{
|
||||
dblock_p dbl;
|
||||
|
||||
@@ -387,10 +370,7 @@ dblock_p block_of_lab(ident)
|
||||
|
||||
/* object */
|
||||
|
||||
STATIC obj_p make_object(dbl,off,size)
|
||||
dblock_p dbl;
|
||||
offset off;
|
||||
offset size;
|
||||
static obj_p make_object(dblock_p dbl, offset off, offset size)
|
||||
{
|
||||
/* Allocate an obj struct with the given attributes
|
||||
* (if it did not exist already).
|
||||
@@ -447,10 +427,7 @@ STATIC obj_p make_object(dbl,off,size)
|
||||
|
||||
|
||||
|
||||
obj_p object(ident,off,size)
|
||||
char *ident;
|
||||
offset off;
|
||||
offset size;
|
||||
obj_p object(char *ident, offset off, offset size)
|
||||
{
|
||||
dblock_p dbl;
|
||||
|
||||
|
||||
@@ -10,35 +10,35 @@
|
||||
|
||||
|
||||
|
||||
extern offset opr_size(); /* ( short instr )
|
||||
* size of operand of given instruction.
|
||||
offset opr_size(short instr);
|
||||
/* size of operand of given instruction.
|
||||
* The operand is an object , so the
|
||||
* instruction can be loe, zre etc..
|
||||
*/
|
||||
extern dblockdef(); /* (dblock_p db, int n, line_p lnp)
|
||||
* Fill in d_pseudo, d_size and
|
||||
void dblockdef(dblock_p db, int n, line_p lnp);
|
||||
/* Fill in d_pseudo, d_size and
|
||||
* d_values fields of db.
|
||||
*/
|
||||
extern combine(); /* (dblock_p db;line_p l1,l2;byte pseu)
|
||||
* Combine two successive ROMs or CONs
|
||||
void combine(dblock_p db, line_p l1, line_p l2, byte pseu);
|
||||
/* Combine two successive ROMs or CONs
|
||||
* (with no data label in between)
|
||||
* into one ROM or CON.
|
||||
*/
|
||||
extern line_p arglist(); /* ( int m)
|
||||
* Read a list of m arguments. If m
|
||||
line_p arglist(int n);
|
||||
/* Read a list of m arguments. If m
|
||||
* is 0, then the list is of
|
||||
* undetermined length; it is
|
||||
* then terminated by a cend symbol.
|
||||
*/
|
||||
extern bool is_datalabel(); /* ( line_p l)
|
||||
* TRUE if l is a data label defining
|
||||
bool is_datalabel(line_p l);
|
||||
/* TRUE if l is a data label defining
|
||||
* occurrence (i.e. its l_instr
|
||||
* field is ps_sym).
|
||||
*/
|
||||
extern dblock_p block_of_lab(); /* (char *ident)
|
||||
* Find the datablock with
|
||||
dblock_p block_of_lab(char *ident);
|
||||
/* Find the datablock with
|
||||
* the given name.
|
||||
*/
|
||||
extern obj_p object(); /* (char *ident,offset off,short size)
|
||||
* Create an object struct.
|
||||
obj_p object(char *ident, offset off, offset size);
|
||||
/* Create an object struct.
|
||||
*/
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <em_pseu.h>
|
||||
#include <em_spec.h>
|
||||
#include <arch.h>
|
||||
@@ -22,12 +23,12 @@
|
||||
#include "ic_io.h"
|
||||
|
||||
|
||||
STATIC short libstate;
|
||||
STATIC long bytecnt;
|
||||
static short libstate;
|
||||
static long bytecnt;
|
||||
|
||||
STATIC FILE *infile; /* The current EM input file */
|
||||
static FILE *infile; /* The current EM input file */
|
||||
|
||||
STATIC int readbyte()
|
||||
static int readbyte()
|
||||
{
|
||||
if (libstate == ARCHIVE && bytecnt-- == 0L) {
|
||||
/* If we're reading from an archive file, we'll
|
||||
@@ -42,8 +43,9 @@ STATIC int readbyte()
|
||||
|
||||
|
||||
|
||||
short readshort() {
|
||||
register int l_byte, h_byte;
|
||||
short readshort()
|
||||
{
|
||||
int l_byte, h_byte;
|
||||
|
||||
l_byte = readbyte();
|
||||
h_byte = readbyte();
|
||||
@@ -52,9 +54,10 @@ short readshort() {
|
||||
}
|
||||
|
||||
#ifdef LONGOFF
|
||||
offset readoffset() {
|
||||
register long l;
|
||||
register int h_byte;
|
||||
offset readoffset()
|
||||
{
|
||||
long l;
|
||||
int h_byte;
|
||||
|
||||
l = readbyte();
|
||||
l |= ((unsigned) readbyte())*256 ;
|
||||
@@ -66,8 +69,8 @@ offset readoffset() {
|
||||
#endif
|
||||
|
||||
|
||||
short get_int() {
|
||||
|
||||
short get_int()
|
||||
{
|
||||
switch(table2()) {
|
||||
default: error("int expected");
|
||||
case CSTX1:
|
||||
@@ -82,8 +85,8 @@ char readchar()
|
||||
|
||||
|
||||
|
||||
offset get_off() {
|
||||
|
||||
offset get_off()
|
||||
{
|
||||
switch (table2()) {
|
||||
default: error("offset expected");
|
||||
case CSTX1:
|
||||
@@ -95,15 +98,16 @@ offset get_off() {
|
||||
}
|
||||
}
|
||||
|
||||
STATIC make_string(n) int n; {
|
||||
|
||||
static void make_string(int n)
|
||||
{
|
||||
sprintf(string,".%u",n);
|
||||
}
|
||||
|
||||
STATIC inident() {
|
||||
register n;
|
||||
register char *p = string;
|
||||
register c;
|
||||
static void inident()
|
||||
{
|
||||
int n;
|
||||
char *p = string;
|
||||
int c;
|
||||
|
||||
n = get_int();
|
||||
while (n--) {
|
||||
@@ -114,8 +118,8 @@ STATIC inident() {
|
||||
*p++ = 0;
|
||||
}
|
||||
|
||||
int table3(n) int n; {
|
||||
|
||||
int table3(int n)
|
||||
{
|
||||
switch (n) {
|
||||
case sp_ilb1: tabval = readbyte(); return(ILBX);
|
||||
case sp_ilb2: tabval = readshort(); return(ILBX);
|
||||
@@ -139,8 +143,9 @@ int table3(n) int n; {
|
||||
}
|
||||
}
|
||||
|
||||
int table1() {
|
||||
register n;
|
||||
int table1()
|
||||
{
|
||||
int n;
|
||||
|
||||
n = readbyte();
|
||||
if (n == EOF)
|
||||
@@ -160,8 +165,9 @@ int table1() {
|
||||
return(table3(n));
|
||||
}
|
||||
|
||||
int table2() {
|
||||
register n;
|
||||
int table2()
|
||||
{
|
||||
int n;
|
||||
|
||||
n = readbyte();
|
||||
if ((n < sp_fcst0 + sp_ncst0) && (n >= sp_fcst0)) {
|
||||
@@ -174,10 +180,7 @@ int table2() {
|
||||
|
||||
|
||||
|
||||
file_init(f,state,length)
|
||||
FILE *f;
|
||||
short state;
|
||||
long length;
|
||||
void file_init(FILE *f, short state, long length)
|
||||
{
|
||||
short n;
|
||||
|
||||
@@ -193,8 +196,7 @@ file_init(f,state,length)
|
||||
|
||||
|
||||
|
||||
arch_init(arch)
|
||||
FILE *arch;
|
||||
void arch_init(FILE *arch)
|
||||
{
|
||||
short n;
|
||||
|
||||
|
||||
@@ -9,22 +9,22 @@
|
||||
*/
|
||||
|
||||
|
||||
extern int table1(); /* ( )
|
||||
* Read an instruction from the
|
||||
int table1();
|
||||
/* Read an instruction from the
|
||||
* Compact Assembly Language input
|
||||
* file (in 'neutral state').
|
||||
*/
|
||||
extern int table2(); /* ( )
|
||||
* Read an instruction argument.
|
||||
int table2();
|
||||
/* Read an instruction argument.
|
||||
*/
|
||||
extern int table3(); /* ( int )
|
||||
* Read 'Common Table' item.
|
||||
int table3(int n);
|
||||
/* Read 'Common Table' item.
|
||||
*/
|
||||
extern short get_int(); /* ( ) */
|
||||
extern offset get_off(); /* ( ) */
|
||||
extern char readchar(); /* ( ) */
|
||||
extern file_init(); /* (FILE *f, short state, long length)
|
||||
* Input file initialization. All
|
||||
short get_int();
|
||||
offset get_off();
|
||||
char readchar();
|
||||
void file_init(FILE *f, short state, long length);
|
||||
/* Input file initialization. All
|
||||
* following read operations will read
|
||||
* from the given file f. Also checks
|
||||
* the magic number and sets global
|
||||
@@ -32,8 +32,8 @@ extern file_init(); /* (FILE *f, short state, long length)
|
||||
* If the state is ARCHIVE, length
|
||||
* specifies the length of the module.
|
||||
*/
|
||||
extern arch_init(); /* (FILE *arch)
|
||||
* Same as file_init,but opens an
|
||||
void arch_init(FILE *arch);
|
||||
/* Same as file_init,but opens an
|
||||
* archive file. So it checks the
|
||||
* magic number for archives.
|
||||
*/
|
||||
|
||||
@@ -24,18 +24,16 @@
|
||||
#include "ic_lib.h"
|
||||
|
||||
|
||||
STATIC skip_string(n)
|
||||
offset n;
|
||||
static void skip_string(offset n)
|
||||
{
|
||||
/* Read a string of length n and void it */
|
||||
|
||||
while (n--) {
|
||||
readchar();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
STATIC skip_arguments()
|
||||
static void skip_arguments()
|
||||
{
|
||||
/* Skip the arguments of a MES pseudo. The argument
|
||||
* list is terminated by a sp_cend byte.
|
||||
@@ -62,8 +60,7 @@ STATIC skip_arguments()
|
||||
|
||||
|
||||
|
||||
STATIC bool proc_wanted(name)
|
||||
char *name;
|
||||
static bool proc_wanted(char *name)
|
||||
{
|
||||
/* See if 'name' is the name of an external procedure
|
||||
* that has been used before, but for which no body
|
||||
@@ -82,8 +79,7 @@ STATIC bool proc_wanted(name)
|
||||
|
||||
|
||||
|
||||
STATIC bool data_wanted(name)
|
||||
char *name;
|
||||
static bool data_wanted(char *name)
|
||||
{
|
||||
/* See if 'name' is the name of an externally visible
|
||||
* data block that has been used before, but for which
|
||||
@@ -102,7 +98,7 @@ STATIC bool data_wanted(name)
|
||||
|
||||
|
||||
|
||||
STATIC bool wanted_names()
|
||||
static bool wanted_names()
|
||||
{
|
||||
/* Read the names of procedures and data labels,
|
||||
* appearing in a 'MES ms_ext' pseudo. Those are
|
||||
@@ -139,8 +135,8 @@ STATIC bool wanted_names()
|
||||
|
||||
|
||||
|
||||
STATIC FILE *curfile = NULL;
|
||||
STATIC bool useful()
|
||||
static FILE *curfile = NULL;
|
||||
static bool useful()
|
||||
{
|
||||
/* Determine if any entity imported by the current
|
||||
* compact EM assembly file (which will usually be
|
||||
@@ -171,8 +167,7 @@ STATIC bool useful()
|
||||
|
||||
|
||||
|
||||
STATIC bool is_archive(name)
|
||||
char *name;
|
||||
static bool is_archive(char *name)
|
||||
{
|
||||
/* See if 'name' is the name of an archive file, i.e. it
|
||||
* should end on ".ma" and should at least be four characters
|
||||
@@ -187,9 +182,9 @@ STATIC bool is_archive(name)
|
||||
|
||||
|
||||
|
||||
STATIC struct ar_hdr hdr;
|
||||
static struct ar_hdr hdr;
|
||||
|
||||
STATIC bool read_hdr()
|
||||
static bool read_hdr()
|
||||
{
|
||||
/* Read the header of an archive module */
|
||||
|
||||
@@ -220,13 +215,11 @@ STATIC bool read_hdr()
|
||||
|
||||
|
||||
|
||||
STATIC int argcnt = ARGSTART - 1;
|
||||
STATIC short arstate = NO_ARCHIVE;
|
||||
static int argcnt = ARGSTART - 1;
|
||||
static short arstate = NO_ARCHIVE;
|
||||
|
||||
|
||||
FILE *next_file(argc,argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
FILE *next_file(int argc, char *argv[])
|
||||
{
|
||||
/* See if there are more EM input files. The file names
|
||||
* are given via argv. If a file is an archive file
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
*/
|
||||
|
||||
|
||||
extern FILE *next_file(); /* (int argc, char *argv[])
|
||||
* See if there are any more EM input files.
|
||||
FILE *next_file(int argc, char *argv[]);
|
||||
/* See if there are any more EM input files.
|
||||
* 'argv' contains the names of the files
|
||||
* that are passed as arguments to ic.
|
||||
* If an argument is a library (archive
|
||||
|
||||
@@ -26,8 +26,6 @@ prc_p prochash[NPROCHASH];
|
||||
num_p numhash[NNUMHASH];
|
||||
char *lastname;
|
||||
|
||||
//extern char *strcpy();
|
||||
|
||||
#define newsym() (sym_p) newstruct(sym)
|
||||
#define newprc() (prc_p) newstruct(prc)
|
||||
#define newnum() (num_p) newstruct(num)
|
||||
@@ -41,14 +39,9 @@ char *lastname;
|
||||
|
||||
/* instr_lab */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
lab_id instr_lab(number)
|
||||
short number;
|
||||
lab_id instr_lab(short number)
|
||||
{
|
||||
register num_p *npp, np;
|
||||
num_p *npp, np;
|
||||
|
||||
/* In EM assembly language, a label is an unsigned number,
|
||||
* e.g. 120 in 'BRA *120'. In IC the labels of a procedure
|
||||
@@ -84,18 +77,17 @@ lab_id instr_lab(number)
|
||||
|
||||
/* symlookup */
|
||||
|
||||
STATIC unsigned hash(string) char *string; {
|
||||
register char *p;
|
||||
register unsigned i,sum;
|
||||
STATIC unsigned hash(char *string)
|
||||
{
|
||||
char *p;
|
||||
unsigned i,sum;
|
||||
|
||||
for (sum=i=0,p=string;*p;i += 3)
|
||||
sum ^= (*p++)<<(i&07);
|
||||
return(sum);
|
||||
}
|
||||
|
||||
dblock_p symlookup(name, status)
|
||||
char *name;
|
||||
int status;
|
||||
dblock_p symlookup(char *name, int status)
|
||||
{
|
||||
/* Look up the name of a data block. The name can appear
|
||||
* in either a defining or applied occurrence (status is
|
||||
@@ -107,8 +99,8 @@ dblock_p symlookup(name, status)
|
||||
*/
|
||||
|
||||
|
||||
register sym_p *spp, sp;
|
||||
register dblock_p dp;
|
||||
sym_p *spp, sp;
|
||||
dblock_p dp;
|
||||
|
||||
if (name == (char *) 0) {
|
||||
assert(status == DEFINING);
|
||||
@@ -182,8 +174,7 @@ dblock_p symlookup(name, status)
|
||||
|
||||
/* getsym */
|
||||
|
||||
dblock_p getsym(status)
|
||||
int status;
|
||||
dblock_p getsym(int status)
|
||||
{
|
||||
if (table2() != DLBX) {
|
||||
error("symbol expected");
|
||||
@@ -195,8 +186,7 @@ dblock_p getsym(status)
|
||||
|
||||
/* getproc */
|
||||
|
||||
proc_p getproc(status)
|
||||
int status;
|
||||
proc_p getproc(int status)
|
||||
{
|
||||
if (table2() != sp_pnam) {
|
||||
error("proc name expected");
|
||||
@@ -208,12 +198,10 @@ proc_p getproc(status)
|
||||
|
||||
/* proclookup */
|
||||
|
||||
proc_p proclookup(name, status)
|
||||
char *name;
|
||||
int status;
|
||||
proc_p proclookup(char *name, int status)
|
||||
{
|
||||
register prc_p *ppp, pp;
|
||||
register proc_p dp;
|
||||
prc_p *ppp, pp;
|
||||
proc_p dp;
|
||||
|
||||
ppp = &prochash[hash(name)%NPROCHASH];
|
||||
while (*ppp != (prc_p) 0) {
|
||||
@@ -273,7 +261,7 @@ proc_p proclookup(name, status)
|
||||
|
||||
/* cleaninstrlabs */
|
||||
|
||||
cleaninstrlabs()
|
||||
void cleaninstrlabs()
|
||||
{
|
||||
register num_p *npp, np, next;
|
||||
|
||||
@@ -292,10 +280,7 @@ cleaninstrlabs()
|
||||
|
||||
/* dump_procnames */
|
||||
|
||||
dump_procnames(hash,n,f)
|
||||
prc_p hash[];
|
||||
int n;
|
||||
FILE *f;
|
||||
void dump_procnames(prc_p hash[], int n, FILE *f)
|
||||
{
|
||||
/* Save the names of the EM procedures in file f.
|
||||
* Note that the Optimizer Intermediate Code does not
|
||||
@@ -308,7 +293,7 @@ dump_procnames(hash,n,f)
|
||||
* more than once, the PF_WRITTEN flag is used.
|
||||
*/
|
||||
|
||||
register prc_p *pp, ph;
|
||||
prc_p *pp, ph;
|
||||
proc_p p;
|
||||
|
||||
#define PF_WRITTEN 01
|
||||
@@ -330,9 +315,7 @@ dump_procnames(hash,n,f)
|
||||
|
||||
/* cleanprocs */
|
||||
|
||||
cleanprocs(hash,n,mask)
|
||||
prc_p hash[];
|
||||
int n,mask;
|
||||
void cleanprocs(prc_p hash[], int n, int mask)
|
||||
{
|
||||
/* After an EM input file has been processed, the names
|
||||
* of those procedures that are internal (i.e. not visible
|
||||
@@ -343,7 +326,7 @@ cleanprocs(hash,n,mask)
|
||||
* remaining prc structs are also removed.
|
||||
*/
|
||||
|
||||
register prc_p *pp, ph, x, next;
|
||||
prc_p *pp, ph, x, next;
|
||||
|
||||
for (pp = &hash[0]; pp < &hash[n]; pp++) {
|
||||
/* Traverse the hash table */
|
||||
@@ -374,17 +357,14 @@ cleanprocs(hash,n,mask)
|
||||
|
||||
/* dump_dblocknames */
|
||||
|
||||
dump_dblocknames(hash,n,f)
|
||||
sym_p hash[];
|
||||
int n;
|
||||
FILE *f;
|
||||
void dump_dblocknames(sym_p hash[], int n, FILE *f)
|
||||
{
|
||||
/* Save the names of the EM data blocks in file f.
|
||||
* The output consists of tuples (dblock_id, name).
|
||||
* This routine is called once for every input file.
|
||||
*/
|
||||
|
||||
register sym_p *sp, sh;
|
||||
sym_p *sp, sh;
|
||||
dblock_p d;
|
||||
|
||||
#define DF_WRITTEN 01
|
||||
@@ -406,15 +386,13 @@ dump_dblocknames(hash,n,f)
|
||||
|
||||
/* cleandblocks */
|
||||
|
||||
cleandblocks(hash,n,mask)
|
||||
sym_p hash[];
|
||||
int n,mask;
|
||||
void cleandblocks(sym_p hash[], int n, int mask)
|
||||
{
|
||||
/* After an EM input file has been processed, the names
|
||||
* of those data blocks that are internal must be removed.
|
||||
*/
|
||||
|
||||
register sym_p *sp, sh, x, next;
|
||||
sym_p *sp, sh, x, next;
|
||||
|
||||
for (sp = &hash[0]; sp < &hash[n]; sp++) {
|
||||
x = (sym_p) 0;
|
||||
|
||||
@@ -35,42 +35,42 @@ extern sym_p symhash[];
|
||||
extern prc_p prochash[];
|
||||
extern num_p numhash[];
|
||||
|
||||
extern lab_id instr_lab(); /* ( short number)
|
||||
* Maps EM labels to sequential
|
||||
lab_id instr_lab(short number);
|
||||
/* Maps EM labels to sequential
|
||||
* integers.
|
||||
*/
|
||||
extern dblock_p symlookup(); /* (char *ident, int status)
|
||||
* Look up the data block with
|
||||
dblock_p symlookup(char *name, int status);
|
||||
/* Look up the data block with
|
||||
* the given name.
|
||||
*/
|
||||
extern dblock_p getsym(); /* ( int status)
|
||||
* Read and look up a symbol.
|
||||
dblock_p getsym(int status);
|
||||
/* Read and look up a symbol.
|
||||
* If this is the first occurrence
|
||||
* of it, then make it external
|
||||
* (if status=OCCURRING) or
|
||||
* internal (if DEFINING).
|
||||
*/
|
||||
extern proc_p getproc(); /* (int status)
|
||||
* Same as getsym, but for procedure
|
||||
proc_p getproc(int status);
|
||||
/* Same as getsym, but for procedure
|
||||
* names.
|
||||
*/
|
||||
extern proc_p proclookup(); /* ( char *ident, int status)
|
||||
* Find (in the hashtable) the
|
||||
proc_p proclookup(char *name, int status);
|
||||
/* Find (in the hashtable) the
|
||||
* procedure with the given name.
|
||||
*/
|
||||
extern cleaninstrlabs(); /* ( )
|
||||
* Forget about all instruction labels.
|
||||
void cleaninstrlabs();
|
||||
/* Forget about all instruction labels.
|
||||
*/
|
||||
extern dump_procnames(); /* (prc_p hash[], int n, FILE *f)
|
||||
* Save the names of the procedures
|
||||
void dump_procnames(prc_p hash[], int n, FILE *f);
|
||||
/* Save the names of the procedures
|
||||
* in file f; hash is the hashtable
|
||||
* used and n is its length.
|
||||
*/
|
||||
extern cleanprocs(); /* (prc_p hash[], int n,mask)
|
||||
* Make the names of all procedures
|
||||
void cleanprocs(prc_p hash[], int n, int mask);
|
||||
/* Make the names of all procedures
|
||||
* for which p_flags1&mask = 0 invisible
|
||||
*/
|
||||
extern cleandblocks(); /* (sym_p hash[], int n)
|
||||
* Make the names of all data blocks
|
||||
void cleandblocks(sym_p hash[], int n, int mask);
|
||||
/* Make the names of all data blocks
|
||||
* for which d_flags1&mask = 0 invisible
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user