More ansification.
This commit is contained in:
parent
68a72f7672
commit
b83173734d
|
@ -20,8 +20,6 @@ static char rcsid[] = "$Id$";
|
||||||
|
|
||||||
#define ENDLIB ((long)0)
|
#define ENDLIB ((long)0)
|
||||||
|
|
||||||
extern ind_t hard_alloc();
|
|
||||||
|
|
||||||
static struct ar_hdr arhdr;
|
static struct ar_hdr arhdr;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -25,15 +25,17 @@ static char rcsid[] = "$Id$";
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include <unistd.h>
|
||||||
#include <out.h>
|
#include <out.h>
|
||||||
#include "const.h"
|
#include "const.h"
|
||||||
#include "assert.h"
|
#include "assert.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
|
#include "object.h"
|
||||||
|
|
||||||
static copy_down();
|
static void copy_down(struct memory* mem, ind_t dist);
|
||||||
static copy_up();
|
static void copy_up(struct memory* mem, ind_t dist);
|
||||||
static free_saved_moduls();
|
static void free_saved_moduls(void);
|
||||||
|
|
||||||
struct memory mems[NMEMS];
|
struct memory mems[NMEMS];
|
||||||
|
|
||||||
|
@ -45,8 +47,7 @@ ind_t core_position = (ind_t)0; /* Index of current module. */
|
||||||
static char *BASE;
|
static char *BASE;
|
||||||
static ind_t refused;
|
static ind_t refused;
|
||||||
|
|
||||||
sbreak(incr)
|
static int sbreak(ind_t incr)
|
||||||
ind_t incr;
|
|
||||||
{
|
{
|
||||||
unsigned int inc;
|
unsigned int inc;
|
||||||
|
|
||||||
|
@ -69,12 +70,11 @@ sbreak(incr)
|
||||||
* Initialize some pieces of core. We hope that this will be our last
|
* Initialize some pieces of core. We hope that this will be our last
|
||||||
* real allocation, meaning we've made the right choices.
|
* real allocation, meaning we've made the right choices.
|
||||||
*/
|
*/
|
||||||
init_core()
|
void init_core(void)
|
||||||
{
|
{
|
||||||
register char *base;
|
register char *base;
|
||||||
register ind_t total_size;
|
register ind_t total_size;
|
||||||
register struct memory *mem;
|
register struct memory *mem;
|
||||||
extern char *sbrk();
|
|
||||||
|
|
||||||
#include "mach.h"
|
#include "mach.h"
|
||||||
#define ALIGN 8 /* minimum alignment for pieces */
|
#define ALIGN 8 /* minimum alignment for pieces */
|
||||||
|
@ -175,9 +175,7 @@ extern int passnumber;
|
||||||
* enough bytes, the first or the second time.
|
* enough bytes, the first or the second time.
|
||||||
*/
|
*/
|
||||||
static bool
|
static bool
|
||||||
compact(piece, incr, flag)
|
compact(int piece, ind_t incr, int flag)
|
||||||
register int piece;
|
|
||||||
register ind_t incr;
|
|
||||||
#define NORMAL 0
|
#define NORMAL 0
|
||||||
#define FREEZE 1
|
#define FREEZE 1
|
||||||
#define FORCED 2
|
#define FORCED 2
|
||||||
|
@ -315,10 +313,8 @@ compact(piece, incr, flag)
|
||||||
* overlap with the old area, but we do not want to overwrite them before they
|
* overlap with the old area, but we do not want to overwrite them before they
|
||||||
* are copied.
|
* are copied.
|
||||||
*/
|
*/
|
||||||
static
|
static void
|
||||||
copy_down(mem, dist)
|
copy_down(struct memory* mem, ind_t dist)
|
||||||
register struct memory *mem;
|
|
||||||
ind_t dist;
|
|
||||||
{
|
{
|
||||||
register char *old;
|
register char *old;
|
||||||
register char *new;
|
register char *new;
|
||||||
|
@ -338,10 +334,7 @@ copy_down(mem, dist)
|
||||||
* overlap with the old area, but we do not want to overwrite them before they
|
* overlap with the old area, but we do not want to overwrite them before they
|
||||||
* are copied.
|
* are copied.
|
||||||
*/
|
*/
|
||||||
static
|
static void copy_up(struct memory* mem, ind_t dist)
|
||||||
copy_up(mem, dist)
|
|
||||||
register struct memory *mem;
|
|
||||||
ind_t dist;
|
|
||||||
{
|
{
|
||||||
register char *old;
|
register char *old;
|
||||||
register char *new;
|
register char *new;
|
||||||
|
@ -364,10 +357,7 @@ static int alloctype = NORMAL;
|
||||||
* how many times the area is moved, because of another allocate, this offset
|
* how many times the area is moved, because of another allocate, this offset
|
||||||
* remains valid.
|
* remains valid.
|
||||||
*/
|
*/
|
||||||
ind_t
|
ind_t alloc(int piece, long size)
|
||||||
alloc(piece, size)
|
|
||||||
int piece;
|
|
||||||
register long size;
|
|
||||||
{
|
{
|
||||||
register ind_t incr = 0;
|
register ind_t incr = 0;
|
||||||
ind_t left = mems[piece].mem_left;
|
ind_t left = mems[piece].mem_left;
|
||||||
|
@ -405,9 +395,7 @@ alloc(piece, size)
|
||||||
* attempt fails, release the space occupied by other pieces and try again.
|
* attempt fails, release the space occupied by other pieces and try again.
|
||||||
*/
|
*/
|
||||||
ind_t
|
ind_t
|
||||||
hard_alloc(piece, size)
|
hard_alloc(int piece, long size)
|
||||||
register int piece;
|
|
||||||
register long size;
|
|
||||||
{
|
{
|
||||||
register ind_t ret;
|
register ind_t ret;
|
||||||
register int i;
|
register int i;
|
||||||
|
@ -452,8 +440,8 @@ hard_alloc(piece, size)
|
||||||
* at the start of the piece allocated for module contents, thereby
|
* at the start of the piece allocated for module contents, thereby
|
||||||
* overwriting the saved modules, and release its space.
|
* overwriting the saved modules, and release its space.
|
||||||
*/
|
*/
|
||||||
static
|
static void
|
||||||
free_saved_moduls()
|
free_saved_moduls(void)
|
||||||
{
|
{
|
||||||
register ind_t size;
|
register ind_t size;
|
||||||
register char *old, *new;
|
register char *old, *new;
|
||||||
|
@ -551,7 +539,7 @@ freeze_core()
|
||||||
* To transform the various pieces of the output in core to the file format,
|
* To transform the various pieces of the output in core to the file format,
|
||||||
* we must order the bytes in the unsigned shorts and longs as ACK prescribes.
|
* we must order the bytes in the unsigned shorts and longs as ACK prescribes.
|
||||||
*/
|
*/
|
||||||
write_bytes()
|
void write_bytes(void)
|
||||||
{
|
{
|
||||||
unsigned short nsect;
|
unsigned short nsect;
|
||||||
long offchar;
|
long offchar;
|
||||||
|
@ -609,10 +597,7 @@ write_bytes()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
namecpy(name, nname, offchar)
|
void namecpy(struct outname* name, unsigned nname, long offchar)
|
||||||
register struct outname *name;
|
|
||||||
register unsigned nname;
|
|
||||||
register long offchar;
|
|
||||||
{
|
{
|
||||||
while (nname--) {
|
while (nname--) {
|
||||||
if (name->on_foff)
|
if (name->on_foff)
|
||||||
|
|
|
@ -38,7 +38,10 @@ extern struct memory mems[];
|
||||||
#define int_align(sz) (((sz)+(sizeof(int)-1))&~(int)(sizeof(int)-1))
|
#define int_align(sz) (((sz)+(sizeof(int)-1))&~(int)(sizeof(int)-1))
|
||||||
|
|
||||||
extern ind_t core_position;
|
extern ind_t core_position;
|
||||||
extern ind_t hard_alloc();
|
extern void init_core(void);
|
||||||
extern ind_t alloc();
|
extern ind_t hard_alloc(int piece, long size);
|
||||||
|
extern ind_t alloc(int piece, long size);
|
||||||
extern void dealloc(int piece);
|
extern void dealloc(int piece);
|
||||||
extern void core_free(int piece, char* p);
|
extern void core_free(int piece, char* p);
|
||||||
|
extern void write_bytes(void);
|
||||||
|
extern void namecpy(struct outname* name, unsigned nname, long offchar);
|
||||||
|
|
|
@ -68,8 +68,6 @@ savechar(piece, off)
|
||||||
{
|
{
|
||||||
register long len;
|
register long len;
|
||||||
register ind_t newoff;
|
register ind_t newoff;
|
||||||
extern ind_t alloc();
|
|
||||||
extern ind_t hard_alloc();
|
|
||||||
|
|
||||||
if (off == (ind_t)0)
|
if (off == (ind_t)0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -195,7 +195,6 @@ static bool
|
||||||
all_alloc(void)
|
all_alloc(void)
|
||||||
{
|
{
|
||||||
struct outhead head;
|
struct outhead head;
|
||||||
extern ind_t hard_alloc();
|
|
||||||
|
|
||||||
if (hard_alloc(ALLOMODL, (long)sizeof(struct outhead)) == BADOFF)
|
if (hard_alloc(ALLOMODL, (long)sizeof(struct outhead)) == BADOFF)
|
||||||
fatal("no space for module header");
|
fatal("no space for module header");
|
||||||
|
@ -220,8 +219,6 @@ direct_alloc(head)
|
||||||
register struct outsect *sects;
|
register struct outsect *sects;
|
||||||
unsigned short nsect = head->oh_nsect;
|
unsigned short nsect = head->oh_nsect;
|
||||||
long size, rest;
|
long size, rest;
|
||||||
extern ind_t hard_alloc();
|
|
||||||
extern ind_t alloc();
|
|
||||||
|
|
||||||
#ifdef SYMDBUG
|
#ifdef SYMDBUG
|
||||||
rest = nsect * sizeof(ind_t) + sizeof(ind_t) + sizeof(ind_t);
|
rest = nsect * sizeof(ind_t) + sizeof(ind_t) + sizeof(ind_t);
|
||||||
|
@ -293,7 +290,6 @@ putemitindex(ind_t sectindex, ind_t emitoff, int allopiece)
|
||||||
{
|
{
|
||||||
long flen;
|
long flen;
|
||||||
ind_t emitindex;
|
ind_t emitindex;
|
||||||
extern ind_t alloc();
|
|
||||||
static long zeros[MAXSECT];
|
static long zeros[MAXSECT];
|
||||||
register long zero = zeros[allopiece - ALLOEMIT];
|
register long zero = zeros[allopiece - ALLOEMIT];
|
||||||
|
|
||||||
|
@ -332,7 +328,6 @@ static bool
|
||||||
putreloindex(ind_t relooff, long nrelobytes)
|
putreloindex(ind_t relooff, long nrelobytes)
|
||||||
{
|
{
|
||||||
ind_t reloindex;
|
ind_t reloindex;
|
||||||
extern ind_t alloc();
|
|
||||||
|
|
||||||
if ((reloindex = alloc(ALLORELO, nrelobytes)) != BADOFF) {
|
if ((reloindex = alloc(ALLORELO, nrelobytes)) != BADOFF) {
|
||||||
*(ind_t *)modulptr(relooff) = reloindex;
|
*(ind_t *)modulptr(relooff) = reloindex;
|
||||||
|
@ -348,7 +343,6 @@ static bool
|
||||||
putdbugindex(ind_t dbugoff, long ndbugbytes)
|
putdbugindex(ind_t dbugoff, long ndbugbytes)
|
||||||
{
|
{
|
||||||
ind_t dbugindex;
|
ind_t dbugindex;
|
||||||
extern ind_t alloc();
|
|
||||||
|
|
||||||
if ((dbugindex = alloc(ALLODBUG, ndbugbytes)) != BADOFF) {
|
if ((dbugindex = alloc(ALLODBUG, ndbugbytes)) != BADOFF) {
|
||||||
*(ind_t *)modulptr(dbugoff) = dbugindex;
|
*(ind_t *)modulptr(dbugoff) = dbugindex;
|
||||||
|
@ -425,7 +419,6 @@ read_modul(void)
|
||||||
unsigned short nsect, nname;
|
unsigned short nsect, nname;
|
||||||
long size;
|
long size;
|
||||||
long nchar;
|
long nchar;
|
||||||
extern ind_t hard_alloc();
|
|
||||||
|
|
||||||
assert(passnumber == SECOND);
|
assert(passnumber == SECOND);
|
||||||
assert(!incore);
|
assert(!incore);
|
||||||
|
|
|
@ -100,7 +100,6 @@ entername(name, hashval)
|
||||||
register struct symbol *sym;
|
register struct symbol *sym;
|
||||||
struct outname *newname;
|
struct outname *newname;
|
||||||
extern ind_t savechar();
|
extern ind_t savechar();
|
||||||
extern ind_t hard_alloc();
|
|
||||||
|
|
||||||
debug("entername %s %d %x %x", modulptr((ind_t)name->on_foff), hashval, name->on_type, name->on_desc);
|
debug("entername %s %d %x %x", modulptr((ind_t)name->on_foff), hashval, name->on_type, name->on_desc);
|
||||||
savindex = savechar(ALLOGCHR, (ind_t)name->on_foff);
|
savindex = savechar(ALLOGCHR, (ind_t)name->on_foff);
|
||||||
|
|
Loading…
Reference in a new issue