Do not use '#endif/#else xxx'; it is not allowed for ANSI C
This commit is contained in:
parent
53c4951b29
commit
df1ed9426d
|
@ -98,7 +98,7 @@ idfappfun(fun, opt)
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif IDF_DEBUG
|
||||
#endif /* IDF_DEBUG */
|
||||
|
||||
struct idf *
|
||||
str2idf(tg, cpy)
|
||||
|
|
|
@ -58,7 +58,7 @@ Now this is really ridiculous! You deserve what you get!!
|
|||
|
||||
#ifdef INP_TYPE
|
||||
extern INP_TYPE INP_VAR;
|
||||
#endif INP_TYPE
|
||||
#endif /* INP_TYPE */
|
||||
|
||||
#ifdef DEBUG
|
||||
#define INP_PRIVATE
|
||||
|
@ -73,7 +73,7 @@ struct INP_buffer_header {
|
|||
char *bh_ipp; /* current read pointer (= stacked ipp) */
|
||||
#ifdef INP_TYPE
|
||||
INP_TYPE bh_i; /* user defined */
|
||||
#endif INP_TYPE
|
||||
#endif /* INP_TYPE */
|
||||
File *bh_fd; /* A file descriptor in case of a file */
|
||||
char bh_eofreturned; /* set if we returned eof for this buffer */
|
||||
};
|
||||
|
@ -84,7 +84,7 @@ struct INP_i_buf {
|
|||
char ib_text[INP_BUFSIZE+INP_NPUSHBACK];
|
||||
};
|
||||
|
||||
# endif not INP_READ_IN_ONE
|
||||
#endif /* not INP_READ_IN_ONE */
|
||||
|
||||
char *_ipp;
|
||||
INP_PRIVATE struct INP_buffer_header *INP_head, *INP_free;
|
||||
|
@ -124,7 +124,7 @@ INP_rdfile(fd, fn, size, pbuf)
|
|||
(*pbuf)[rsize] = '\0'; /* invoke loadbuf() at end */
|
||||
return 1;
|
||||
}
|
||||
#endif INP_READ_IN_ONE
|
||||
#endif /* INP_READ_IN_ONE */
|
||||
|
||||
#ifndef INP_READ_IN_ONE
|
||||
/* Input buffer supplying routines: INP_pbuf()
|
||||
|
@ -147,7 +147,7 @@ INP_pbuf()
|
|||
*/
|
||||
return &(ib->ib_text[INP_NPUSHBACK-1]);
|
||||
}
|
||||
#endif not INP_READ_IN_ONE
|
||||
#endif /* not INP_READ_IN_ONE */
|
||||
|
||||
/* Input buffer administration: INP_push_bh() and INP_pop_bh()
|
||||
*/
|
||||
|
@ -160,7 +160,7 @@ INP_push_bh()
|
|||
bh->bh_ipp = _ipp;
|
||||
#ifdef INP_TYPE
|
||||
bh->bh_i = INP_VAR;
|
||||
#endif INP_TYPE
|
||||
#endif /* INP_TYPE */
|
||||
}
|
||||
bh = INP_free;
|
||||
if (bh) INP_free = bh->bh_next;
|
||||
|
@ -194,7 +194,7 @@ INP_pop_bh()
|
|||
_ipp = bh->bh_ipp; /* restore previous input pointer */
|
||||
#ifdef INP_TYPE
|
||||
INP_VAR = bh->bh_i;
|
||||
#endif INP_TYPE
|
||||
#endif /* INP_TYPE */
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -217,7 +217,7 @@ INP_rdblock(fd, buf, n)
|
|||
buf[*n] = '\0';
|
||||
return 1;
|
||||
}
|
||||
#endif not INP_READ_IN_ONE
|
||||
#endif /* not INP_READ_IN_ONE */
|
||||
|
||||
/* Miscellaneous routines :
|
||||
INP_mk_filename()
|
||||
|
@ -258,7 +258,7 @@ InsertFile(filnam, table, result)
|
|||
#ifdef INP_READ_IN_ONE
|
||||
char *text;
|
||||
long size;
|
||||
#endif INP_READ_IN_ONE
|
||||
#endif /* INP_READ_IN_ONE */
|
||||
File *fd = 0;
|
||||
|
||||
if (!filnam) fd = STDIN;
|
||||
|
@ -301,7 +301,7 @@ InsertFile(filnam, table, result)
|
|||
}
|
||||
bh->bh_size = size;
|
||||
_ipp = bh->bh_text = text;
|
||||
#else not INP_READ_IN_ONE
|
||||
#else /* not INP_READ_IN_ONE */
|
||||
if (
|
||||
!(_ipp = bh->bh_text = INP_pbuf())
|
||||
||
|
||||
|
@ -309,7 +309,7 @@ InsertFile(filnam, table, result)
|
|||
if (fd != STDIN) sys_close(fd);
|
||||
return 0;
|
||||
}
|
||||
#endif INP_READ_IN_ONE
|
||||
#endif /* INP_READ_IN_ONE */
|
||||
bh->bh_fd = fd; /* this is a file */
|
||||
if (result) *result = filnam;
|
||||
return 1;
|
||||
|
@ -376,7 +376,7 @@ loadbuf()
|
|||
}
|
||||
}
|
||||
|
||||
#endif not INP_READ_IN_ONE
|
||||
#endif /* not INP_READ_IN_ONE */
|
||||
if (FromFile && bh->bh_fd != STDIN) sys_close(bh->bh_fd);
|
||||
|
||||
#if INP_NPUSHBACK > 1
|
||||
|
@ -401,9 +401,9 @@ loadbuf()
|
|||
ib = i_ptr->ib_next;
|
||||
free((char *) i_ptr);
|
||||
i_ptr = ib;
|
||||
#else INP_READ_IN_ONE
|
||||
#else /* INP_READ_IN_ONE */
|
||||
free(bh->bh_text);
|
||||
#endif INP_READ_IN_ONE
|
||||
#endif /* INP_READ_IN_ONE */
|
||||
}
|
||||
bh->bh_text = buf;
|
||||
bh->bh_size = INP_NPUSHBACK - 1;
|
||||
|
|
|
@ -303,4 +303,4 @@ Error(fmt, s, ml) char *fmt, *s; mallink *ml; {
|
|||
return 0; /* to satisfy lint */
|
||||
}
|
||||
|
||||
#endif CHECK
|
||||
#endif /* CHECK */
|
||||
|
|
|
@ -49,7 +49,7 @@ typedef union _inf mallink;
|
|||
#define _this_size_of(ml) ((ml)[-4+OFF_SET]).ui
|
||||
#ifndef CHECK
|
||||
#define N_WORDS 4
|
||||
#else ifdef CHECK
|
||||
#else /* ifdef CHECK */
|
||||
#define _checksum_of(ml) ((ml)[-5+OFF_SET]).ui
|
||||
#define _print_of(ml) ((ml)[-6+OFF_SET]).ui
|
||||
#define _mark_of(ml) ((ml)[-7+OFF_SET]).ui
|
||||
|
|
|
@ -130,4 +130,4 @@ free_list_entry(i) {
|
|||
*/
|
||||
return free_list[i];
|
||||
}
|
||||
#endif CHECK
|
||||
#endif /* CHECK */
|
||||
|
|
|
@ -31,7 +31,7 @@ extern char *SBRK();
|
|||
#define MAX_SZ_IN_STORE (MAX_STORE*ALIGNMENT)
|
||||
private do_free(), sell_out();
|
||||
privatedata mallink *store[MAX_STORE];
|
||||
#endif STORE
|
||||
#endif /* STORE */
|
||||
|
||||
char *
|
||||
malloc(n)
|
||||
|
@ -57,7 +57,7 @@ malloc(n)
|
|||
return block_of_mallink(ml);
|
||||
}
|
||||
}
|
||||
#endif STORE
|
||||
#endif /* STORE */
|
||||
|
||||
check_work_empty("malloc, entry");
|
||||
|
||||
|
@ -116,7 +116,7 @@ malloc(n)
|
|||
sell_out();
|
||||
ml = first_present(min_class);
|
||||
if (ml == MAL_NULL) {
|
||||
#endif STORE
|
||||
#endif /* STORE */
|
||||
/* In this emergency we try to locate a suitable
|
||||
chunk in the free_list just below the safe
|
||||
one; some of these chunks may fit the job.
|
||||
|
@ -130,7 +130,7 @@ malloc(n)
|
|||
#ifdef STORE
|
||||
}
|
||||
else started_working_on(ml);
|
||||
#endif STORE
|
||||
#endif /* STORE */
|
||||
}
|
||||
else {
|
||||
assert((size_type)p == align((size_type)p));
|
||||
|
@ -196,7 +196,7 @@ do_free(ml)
|
|||
|
||||
#ifndef STORE
|
||||
if (free_of(ml)) return;
|
||||
#endif STORE
|
||||
#endif /* STORE */
|
||||
started_working_on(ml);
|
||||
set_free(ml, 1);
|
||||
calc_checksum(ml);
|
||||
|
@ -340,7 +340,7 @@ sell_out() {
|
|||
}
|
||||
|
||||
}
|
||||
#endif STORE
|
||||
#endif /* STORE */
|
||||
|
||||
#ifdef ASSERT
|
||||
public
|
||||
|
@ -358,4 +358,4 @@ m_assert(fn, ln)
|
|||
write(2, "\n", 1);
|
||||
maldump(1);
|
||||
}
|
||||
#endif ASSERT
|
||||
#endif /* ASSERT */
|
||||
|
|
|
@ -391,4 +391,4 @@ wr_dbug(buf, size)
|
|||
OUTWRITE(PARTDBUG, buf, size);
|
||||
}
|
||||
|
||||
#endif SYMDBUG
|
||||
#endif /* SYMDBUG */
|
||||
|
|
|
@ -52,9 +52,9 @@ checkarg(arg, typset)
|
|||
}
|
||||
return 1;
|
||||
}
|
||||
#else not CHECKING
|
||||
#else /* not CHECKING */
|
||||
#define checkarg(arg, x) 1
|
||||
#endif CHECKING
|
||||
#endif /* CHECKING */
|
||||
|
||||
/* EM_doinstr: An EM instruction
|
||||
*/
|
||||
|
@ -72,7 +72,7 @@ EM_doinstr(p)
|
|||
return;
|
||||
}
|
||||
}
|
||||
#endif CHECKING
|
||||
#endif /* CHECKING */
|
||||
switch(parametertype) {
|
||||
case PAR_NO:
|
||||
break;
|
||||
|
@ -389,7 +389,7 @@ EM_mkcalls(line)
|
|||
EM_error = "Message not ended";
|
||||
return 0;
|
||||
}
|
||||
#endif CHECKING
|
||||
#endif /* CHECKING */
|
||||
EM_error = 0;
|
||||
switch(line->em_type) {
|
||||
default:
|
||||
|
|
|
@ -92,9 +92,9 @@ static int wsize, psize; /* word size and pointer size */
|
|||
#ifdef CHECKING
|
||||
static char *argrange = "Argument range error";
|
||||
#define check(expr) (expr || EM_error || (EM_error = argrange))
|
||||
#else not CHECKING
|
||||
#else /* not CHECKING */
|
||||
#define check(x) /* nothing */
|
||||
#endif CHECKING
|
||||
#endif /* CHECKING */
|
||||
|
||||
/* Error handling
|
||||
*/
|
||||
|
@ -117,9 +117,9 @@ xfatal(s)
|
|||
}
|
||||
|
||||
#include "readk.c"
|
||||
#else not COMPACT
|
||||
#else /* not COMPACT */
|
||||
#include "reade.c"
|
||||
#endif COMPACT
|
||||
#endif /* COMPACT */
|
||||
|
||||
/* EM_open: Open input file, get magic word if COMPACT.
|
||||
*/
|
||||
|
@ -147,9 +147,9 @@ EM_open(filename)
|
|||
EM_error = "Illegal magic word";
|
||||
return 0;
|
||||
}
|
||||
#else not COMPACT
|
||||
#else /* not COMPACT */
|
||||
inithash(); /* initialize hashtable */
|
||||
#endif COMPACT
|
||||
#endif /* COMPACT */
|
||||
|
||||
EM_initialized = 1;
|
||||
return 1;
|
||||
|
@ -228,7 +228,7 @@ EM_getinstr(p)
|
|||
p->em_type = EM_FATAL;
|
||||
return 0;
|
||||
}
|
||||
#endif CHECKING
|
||||
#endif /* CHECKING */
|
||||
|
||||
if (!state) { /* All clear, get a new line */
|
||||
gethead(p);
|
||||
|
@ -247,14 +247,14 @@ EM_getinstr(p)
|
|||
}
|
||||
#ifndef COMPACT
|
||||
if (j == PAR_B) i = ptyp(sp_ilb2);
|
||||
#endif COMPACT
|
||||
#endif /* COMPACT */
|
||||
if (j != PAR_NO) getarg(i, &(p->em_arg));
|
||||
#ifndef COMPACT
|
||||
if (j == PAR_B) {
|
||||
p->em_cst = p->em_ilb;
|
||||
p->em_argtype = cst_ptyp;
|
||||
}
|
||||
#endif COMPACT
|
||||
#endif /* COMPACT */
|
||||
/* range checking
|
||||
*/
|
||||
#ifdef CHECKING
|
||||
|
@ -304,10 +304,10 @@ EM_getinstr(p)
|
|||
check(p->em_cst >= 0 && p->em_cst <= 2);
|
||||
break;
|
||||
}
|
||||
#endif CHECKING
|
||||
#endif /* CHECKING */
|
||||
#ifndef COMPACT
|
||||
checkeol();
|
||||
#endif COMPACT
|
||||
#endif /* COMPACT */
|
||||
}
|
||||
break;
|
||||
case EM_PSEU:
|
||||
|
@ -334,7 +334,7 @@ EM_getinstr(p)
|
|||
if (! EM_error)
|
||||
EM_error="Third argument of hol/bss not 0/1";
|
||||
}
|
||||
#endif CHECKING
|
||||
#endif /* CHECKING */
|
||||
break;
|
||||
case ps_exa:
|
||||
case ps_ina:
|
||||
|
@ -378,7 +378,7 @@ EM_getinstr(p)
|
|||
if (p->em_opcode != ps_con && p->em_opcode != ps_rom) {
|
||||
checkeol();
|
||||
}
|
||||
#endif COMPACT
|
||||
#endif /* COMPACT */
|
||||
break;
|
||||
case EM_STARTMES:
|
||||
startmes(p);
|
||||
|
|
|
@ -48,7 +48,7 @@ getarg(typset, ap)
|
|||
register int i = getbyte();
|
||||
#ifdef CHECKING
|
||||
int argtyp;
|
||||
#endif CHECKING
|
||||
#endif /* CHECKING */
|
||||
|
||||
ap->ema_argtype = 0;
|
||||
switch(i) {
|
||||
|
@ -75,7 +75,7 @@ getarg(typset, ap)
|
|||
EM_error = "Illegal data label";
|
||||
break;
|
||||
}
|
||||
#endif CHECKING
|
||||
#endif /* CHECKING */
|
||||
break;
|
||||
|
||||
case sp_ilb1: /* Instruction label encoded in one byte */
|
||||
|
@ -91,7 +91,7 @@ getarg(typset, ap)
|
|||
EM_error = "Illegal instruction label";
|
||||
break;
|
||||
}
|
||||
#endif CHECKING
|
||||
#endif /* CHECKING */
|
||||
break;
|
||||
|
||||
case sp_cst2: /* A cst encoded in two bytes */
|
||||
|
@ -180,11 +180,11 @@ getarg(typset, ap)
|
|||
if (argtyp == sp_cend) {
|
||||
ap->ema_argtype = 0;
|
||||
}
|
||||
#else not CHECKING
|
||||
#else /* not CHECKING */
|
||||
if (i == sp_cend) {
|
||||
ap->ema_argtype = 0;
|
||||
}
|
||||
#endif CHECKING
|
||||
#endif /* CHECKING */
|
||||
}
|
||||
|
||||
#ifdef CHECKING
|
||||
|
@ -209,7 +209,7 @@ checkident(s)
|
|||
}
|
||||
return 1;
|
||||
}
|
||||
#endif CHECKING
|
||||
#endif /* CHECKING */
|
||||
|
||||
/* getstring: read a string from the input
|
||||
*/
|
||||
|
@ -231,7 +231,7 @@ getstring(isident)
|
|||
s->length = 0;
|
||||
return s;
|
||||
}
|
||||
#endif CHECKING
|
||||
#endif /* CHECKING */
|
||||
|
||||
if (n > s->maxlen) {
|
||||
if (! s->maxlen) {
|
||||
|
@ -253,7 +253,7 @@ getstring(isident)
|
|||
EM_error = "Illegal identifier";
|
||||
}
|
||||
}
|
||||
#endif CHECKING
|
||||
#endif /* CHECKING */
|
||||
return s;
|
||||
}
|
||||
|
||||
|
@ -305,7 +305,7 @@ gethead(p)
|
|||
if (p->em_ilb > 32767 && !EM_error) {
|
||||
EM_error = "Illegal instruction label definition";
|
||||
}
|
||||
#endif CHECKING
|
||||
#endif /* CHECKING */
|
||||
break;
|
||||
|
||||
case sp_dlb1: /* Numeric data label */
|
||||
|
@ -322,7 +322,7 @@ gethead(p)
|
|||
if (p->em_dlb > 32767 && !EM_error) {
|
||||
EM_error = "Illegal data label definition";
|
||||
}
|
||||
#endif CHECKING
|
||||
#endif /* CHECKING */
|
||||
break;
|
||||
|
||||
case sp_dnam: /* Non-numeric data label */
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
# ifndef NORCSID
|
||||
static string rcsid3 = "$Header$";
|
||||
# endif NORCSID
|
||||
#endif /* NORCSID */
|
||||
|
||||
/*
|
||||
* Some codestrings used more than once
|
||||
|
@ -448,11 +448,12 @@ genprototypes(f)
|
|||
for (i = 0; i < nnonterms; i++) {
|
||||
if (! IN(f->f_used, i)) continue;
|
||||
p = &nonterms[i];
|
||||
if (!(p->n_flags & GENSTATIC)) continue;
|
||||
if (g_gettype(p->n_rule) == EORULE &&
|
||||
getntparams(p) == 0) {
|
||||
continue;
|
||||
}
|
||||
if (p->n_flags & GENSTATIC) fputs("static ", fpars);
|
||||
fputs("static ", fpars);
|
||||
genextname(i, p->n_name, fpars);
|
||||
fputs("();\n", fpars);
|
||||
}
|
||||
|
@ -1047,7 +1048,7 @@ genswhead(q, rep_kind, rep_count, safety, ispushed) register p_term q; {
|
|||
getaction(0);
|
||||
fprintf(f, ") goto L_%d;\n", hulp1);
|
||||
if (q->t_flags & NOCONF) {
|
||||
fputs("#endif ___NOCONFLICT___\n", f);
|
||||
fputs("#endif /* ___NOCONFLICT___ */\n", f);
|
||||
}
|
||||
}
|
||||
if (safeterm == 0 || (!onerror && safeterm <= SAFESCANDONE)) {
|
||||
|
|
|
@ -55,7 +55,7 @@ int ntneeded;
|
|||
int ntprint;
|
||||
# ifndef NDEBUG
|
||||
int debug;
|
||||
# endif not NDEBUG
|
||||
#endif /* not NDEBUG */
|
||||
p_file files;
|
||||
p_file maxfiles;
|
||||
p_file pfile;
|
||||
|
|
|
@ -91,7 +91,7 @@ main(argc,argv) register string argv[]; {
|
|||
}
|
||||
incl_file = ++arg;
|
||||
break;
|
||||
# endif not NDEBUG
|
||||
#endif /* not NDEBUG */
|
||||
case 'x':
|
||||
case 'X':
|
||||
ntneeded = 1;
|
||||
|
|
|
@ -765,4 +765,4 @@ enter_name(namep)
|
|||
}
|
||||
tnum++;
|
||||
}
|
||||
#endif AAL
|
||||
#endif /* AAL */
|
||||
|
|
|
@ -2,4 +2,4 @@ distr:
|
|||
echo '#ifndef lint' > Version.c
|
||||
echo 'char Version[] = "ACK C preprocessor Version XXX";' | \
|
||||
sed "s/XXX/`RC -i`/" >> Version.c
|
||||
echo '#endif lint' >> Version.c
|
||||
echo '#endif' >> Version.c
|
||||
|
|
|
@ -118,7 +118,7 @@ copyact(ch1, ch2, level)
|
|||
case ']':
|
||||
error("unbalanced parenthesis");
|
||||
break;
|
||||
#endif __MATCHING_PAR__
|
||||
#endif /* __MATCHING_PAR__ */
|
||||
|
||||
case '(':
|
||||
copyact('(', ')', level+1);
|
||||
|
@ -136,7 +136,7 @@ copyact(ch1, ch2, level)
|
|||
case '[':
|
||||
copyact('[', ']', level+1);
|
||||
break;
|
||||
#endif __MATCHING_PAR__
|
||||
#endif /* __MATCHING_PAR__ */
|
||||
|
||||
case '\n':
|
||||
LineNumber++;
|
||||
|
|
|
@ -52,4 +52,4 @@ struct tokenname tkfunny[] = { /* internal keywords */
|
|||
{ERRONEOUS, "erroneous"},
|
||||
{0, ""}
|
||||
};
|
||||
#endif ____
|
||||
#endif /* ____ */
|
||||
|
|
|
@ -149,4 +149,4 @@ OUTENTITIES()
|
|||
}
|
||||
}
|
||||
|
||||
#endif TRACE
|
||||
#endif /* TRACE */
|
||||
|
|
|
@ -855,4 +855,4 @@ FILE *file;
|
|||
} \
|
||||
while ( 0 )
|
||||
|
||||
#endif ACK_MOD
|
||||
#endif /* ACK_MOD */
|
||||
|
|
|
@ -29,7 +29,7 @@ char *Malloc(sz, descr)
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif DB_MALLOC
|
||||
#endif /* DB_MALLOC */
|
||||
|
||||
return new;
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ core_dump()
|
|||
fwrite(FRA_sh, 1, (int)(FRALimit), core_file);
|
||||
fwrite(data_sh, 1, (int)(HL), core_file);
|
||||
fwrite(stack_sh, 1, (int)(ML+1-SL), core_file);
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
|
||||
fclose(core_file);
|
||||
core_file = 0;
|
||||
|
|
|
@ -22,7 +22,7 @@ extern size maxheap; /* from main.c */
|
|||
|
||||
#ifdef LOGGING
|
||||
char *data_sh; /* shadowbytes */
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
|
||||
PRIVATE warn_dtbits();
|
||||
|
||||
|
@ -37,7 +37,7 @@ init_data(hb)
|
|||
#ifdef LOGGING
|
||||
data_sh = Malloc((size)p2i(HL), "shadowspace for data");
|
||||
dt_clear_area(i2p(0), HL);
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
}
|
||||
|
||||
|
||||
|
@ -77,14 +77,14 @@ newHP(ap)
|
|||
#ifdef LOGGING
|
||||
data_sh = Realloc(data_sh, (size)(p2i(HL) + 1),
|
||||
"shadowspace for heap");
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
}
|
||||
|
||||
#ifdef LOGGING
|
||||
if (p > HP) {
|
||||
dt_clear_area(HP, p);
|
||||
}
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
HP = p;
|
||||
}
|
||||
|
||||
|
@ -145,7 +145,7 @@ dt_stn(addr, al, n)
|
|||
#ifdef LOGGING
|
||||
/* a psize zero is ambiguous */
|
||||
int sh_flags = (l == 0 && n == psize) ? (SH_INT|SH_DATAP) : SH_INT;
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
|
||||
LOG(("@g6 dt_stn(%lu, %lu, %lu)", addr, l, n));
|
||||
ch_in_data(addr, n);
|
||||
|
@ -155,7 +155,7 @@ dt_stn(addr, al, n)
|
|||
data_loc(addr) = (char) l;
|
||||
#ifdef LOGGING
|
||||
dt_sh(addr) = sh_flags;
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
l = l>>8;
|
||||
}
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ dt_stw(addr, al)
|
|||
#ifdef LOGGING
|
||||
/* a psize zero is ambiguous */
|
||||
int sh_flags = (l == 0 && wsize == psize) ? (SH_INT|SH_DATAP) : SH_INT;
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
|
||||
LOG(("@g6 dt_stw(%lu, %lu)", addr, l));
|
||||
ch_in_data(addr, wsize);
|
||||
|
@ -179,7 +179,7 @@ dt_stw(addr, al)
|
|||
data_loc(addr) = (char) l;
|
||||
#ifdef LOGGING
|
||||
dt_sh(addr) = sh_flags;
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
l = l>>8;
|
||||
}
|
||||
}
|
||||
|
@ -207,7 +207,7 @@ dt_stf(addr, f, n)
|
|||
dt_fl(addr);
|
||||
}
|
||||
}
|
||||
#endif NOFLOAT
|
||||
#endif /* NOFLOAT */
|
||||
|
||||
/************************************************************************
|
||||
* Data load division. *
|
||||
|
@ -236,7 +236,7 @@ ptr dt_lddp(addr)
|
|||
warning(WGDPEXP);
|
||||
warn_dtbits(addr, psize);
|
||||
}
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
|
||||
p = p_in_data(addr);
|
||||
LOG(("@g6 dt_lddp() returns %lu", p));
|
||||
|
@ -257,7 +257,7 @@ ptr dt_ldip(addr)
|
|||
warning(WGIPEXP);
|
||||
warn_dtbits(addr, psize);
|
||||
}
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
|
||||
p = p_in_data(addr);
|
||||
LOG(("@g6 dt_ldip() returns %lu", p));
|
||||
|
@ -280,7 +280,7 @@ unsigned long dt_ldu(addr, n)
|
|||
warning(n == 1 ? WGCEXP : WGIEXP);
|
||||
warn_dtbits(addr, n);
|
||||
}
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
|
||||
addr += n-1;
|
||||
for (i = (int) n-1; i >= 0; i--, addr--) {
|
||||
|
@ -305,7 +305,7 @@ unsigned long dt_lduw(addr)
|
|||
warning(WGIEXP);
|
||||
warn_dtbits(addr, wsize);
|
||||
}
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
|
||||
addr += wsize-1;
|
||||
for (i = (int) wsize-1; i >= 0; i--, addr--) {
|
||||
|
@ -331,7 +331,7 @@ long dt_lds(addr, n)
|
|||
warning(n == 1 ? WGCEXP : WGIEXP);
|
||||
warn_dtbits(addr, n);
|
||||
}
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
|
||||
addr += n-2;
|
||||
l = btos(data_loc(addr + 1));
|
||||
|
@ -357,7 +357,7 @@ long dt_ldsw(addr)
|
|||
warning(WGIEXP);
|
||||
warn_dtbits(addr, wsize);
|
||||
}
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
|
||||
addr += wsize-2;
|
||||
l = btos(data_loc(addr + 1));
|
||||
|
@ -395,7 +395,7 @@ dt_mvd(d2, d1, n) /* d1 -> d2 */
|
|||
data_loc(d2) = data_loc(d1);
|
||||
#ifdef LOGGING
|
||||
dt_sh(d2) = dt_sh(d1) & ~SH_PROT;
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -416,7 +416,7 @@ dt_mvs(d, s, n) /* s -> d */
|
|||
data_loc(d) = stack_loc(s);
|
||||
#ifdef LOGGING
|
||||
dt_sh(d) = st_sh(s) & ~SH_PROT;
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -452,5 +452,5 @@ PRIVATE warn_dtbits(addr, n)
|
|||
warningcont(WWASINSP);
|
||||
}
|
||||
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
#ifndef NOFLOAT
|
||||
extern double fpop();
|
||||
#endif NOFLOAT
|
||||
#endif /* NOFLOAT */
|
||||
|
||||
PRIVATE compare_obj();
|
||||
|
||||
|
@ -45,9 +45,9 @@ DoCMF(l)
|
|||
LOG(("@T6 DoCMF(%ld)", l));
|
||||
spoilFRA();
|
||||
wpush((long)(t < s ? 1 : t > s ? -1 : 0));
|
||||
#else NOFLOAT
|
||||
#else /* NOFLOAT */
|
||||
nofloat();
|
||||
#endif NOFLOAT
|
||||
#endif /* NOFLOAT */
|
||||
}
|
||||
|
||||
DoCMU(l)
|
||||
|
@ -160,7 +160,7 @@ PRIVATE compare_obj(obj_size)
|
|||
comp_res = 1;
|
||||
break;
|
||||
}
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
if (stack_loc(addr1) != stack_loc(addr2)) {
|
||||
comp_res = 1;
|
||||
break;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
#ifndef NOFLOAT
|
||||
extern double fpop();
|
||||
#endif NOFLOAT
|
||||
#endif /* NOFLOAT */
|
||||
|
||||
DoCII()
|
||||
{
|
||||
|
@ -163,9 +163,9 @@ DoCFI()
|
|||
default:
|
||||
wtrap(WILLCONV, EILLINS);
|
||||
}
|
||||
#else NOFLOAT
|
||||
#else /* NOFLOAT */
|
||||
nofloat();
|
||||
#endif NOFLOAT
|
||||
#endif /* NOFLOAT */
|
||||
}
|
||||
|
||||
DoCIF()
|
||||
|
@ -198,9 +198,9 @@ DoCIF()
|
|||
default:
|
||||
wtrap(WILLCONV, EILLINS);
|
||||
}
|
||||
#else NOFLOAT
|
||||
#else /* NOFLOAT */
|
||||
nofloat();
|
||||
#endif NOFLOAT
|
||||
#endif /* NOFLOAT */
|
||||
}
|
||||
|
||||
DoCUF()
|
||||
|
@ -244,9 +244,9 @@ DoCUF()
|
|||
default:
|
||||
wtrap(WILLCONV, EILLINS);
|
||||
}
|
||||
#else NOFLOAT
|
||||
#else /* NOFLOAT */
|
||||
nofloat();
|
||||
#endif NOFLOAT
|
||||
#endif /* NOFLOAT */
|
||||
}
|
||||
|
||||
DoCFF()
|
||||
|
@ -271,9 +271,9 @@ DoCFF()
|
|||
default:
|
||||
wtrap(WILLCONV, EILLINS);
|
||||
}
|
||||
#else NOFLOAT
|
||||
#else /* NOFLOAT */
|
||||
nofloat();
|
||||
#endif NOFLOAT
|
||||
#endif /* NOFLOAT */
|
||||
}
|
||||
|
||||
DoCIU()
|
||||
|
@ -377,7 +377,7 @@ DoCFU()
|
|||
default:
|
||||
wtrap(WILLCONV, EILLINS);
|
||||
}
|
||||
#else NOFLOAT
|
||||
#else /* NOFLOAT */
|
||||
nofloat();
|
||||
#endif NOFLOAT
|
||||
#endif /* NOFLOAT */
|
||||
}
|
||||
|
|
|
@ -18,7 +18,16 @@
|
|||
|
||||
extern double fpop();
|
||||
|
||||
#define MAXDOUBLE 99.e999 /* IEEE infinity */ /*???*/
|
||||
#ifdef __STDC__
|
||||
#include <float.h>
|
||||
#define MAXDOUBLE DBL_MAX
|
||||
#else /* not __STDC__ */
|
||||
#if defined(vax) || defined(pdp) || defined(__vax) || defined(__pdp)
|
||||
#define MAXDOUBLE 1.701411834604692293e+38
|
||||
#else
|
||||
#define MAXDOUBLE 1.7976931348623157e+308
|
||||
#endif
|
||||
#endif /* not __STDC__ */
|
||||
#define SMALL (1.0/MAXDOUBLE)
|
||||
|
||||
PRIVATE double adf(), sbf(), mlf(), dvf();
|
||||
|
@ -26,7 +35,7 @@ PRIVATE double ttttp();
|
|||
PRIVATE double floor(), fabs();
|
||||
PRIVATE fef(), fif();
|
||||
|
||||
#endif NOFLOAT
|
||||
#endif /* NOFLOAT */
|
||||
|
||||
DoADF(l)
|
||||
register size l;
|
||||
|
@ -38,9 +47,9 @@ DoADF(l)
|
|||
LOG(("@F6 DoADF(%ld)", l));
|
||||
spoilFRA();
|
||||
fpush(adf(fpop(l), t), l);
|
||||
#else NOFLOAT
|
||||
#else /* NOFLOAT */
|
||||
nofloat();
|
||||
#endif NOFLOAT
|
||||
#endif /* NOFLOAT */
|
||||
}
|
||||
|
||||
DoSBF(l)
|
||||
|
@ -53,9 +62,9 @@ DoSBF(l)
|
|||
LOG(("@F6 DoSBF(%ld)", l));
|
||||
spoilFRA();
|
||||
fpush(sbf(fpop(l), t), l);
|
||||
#else NOFLOAT
|
||||
#else /* NOFLOAT */
|
||||
nofloat();
|
||||
#endif NOFLOAT
|
||||
#endif /* NOFLOAT */
|
||||
}
|
||||
|
||||
DoMLF(l)
|
||||
|
@ -68,9 +77,9 @@ DoMLF(l)
|
|||
LOG(("@F6 DoMLF(%ld)", l));
|
||||
spoilFRA();
|
||||
fpush(mlf(fpop(l), t), l);
|
||||
#else NOFLOAT
|
||||
#else /* NOFLOAT */
|
||||
nofloat();
|
||||
#endif NOFLOAT
|
||||
#endif /* NOFLOAT */
|
||||
}
|
||||
|
||||
DoDVF(l)
|
||||
|
@ -83,9 +92,9 @@ DoDVF(l)
|
|||
LOG(("@F6 DoDVF(%ld)", l));
|
||||
spoilFRA();
|
||||
fpush(dvf(fpop(l), t), l);
|
||||
#else NOFLOAT
|
||||
#else /* NOFLOAT */
|
||||
nofloat();
|
||||
#endif NOFLOAT
|
||||
#endif /* NOFLOAT */
|
||||
}
|
||||
|
||||
DoNGF(l)
|
||||
|
@ -98,9 +107,9 @@ DoNGF(l)
|
|||
LOG(("@F6 DoNGF(%ld)", l));
|
||||
spoilFRA();
|
||||
fpush(-t, l);
|
||||
#else NOFLOAT
|
||||
#else /* NOFLOAT */
|
||||
nofloat();
|
||||
#endif NOFLOAT
|
||||
#endif /* NOFLOAT */
|
||||
}
|
||||
|
||||
DoFIF(l)
|
||||
|
@ -113,9 +122,9 @@ DoFIF(l)
|
|||
LOG(("@F6 DoFIF(%ld)", l));
|
||||
spoilFRA();
|
||||
fif(fpop(l), t, l);
|
||||
#else NOFLOAT
|
||||
#else /* NOFLOAT */
|
||||
nofloat();
|
||||
#endif NOFLOAT
|
||||
#endif /* NOFLOAT */
|
||||
}
|
||||
|
||||
DoFEF(l)
|
||||
|
@ -126,9 +135,9 @@ DoFEF(l)
|
|||
LOG(("@F6 DoFEF(%ld)", l));
|
||||
spoilFRA();
|
||||
fef(fpop(arg_wf(l)), l);
|
||||
#else NOFLOAT
|
||||
#else /* NOFLOAT */
|
||||
nofloat();
|
||||
#endif NOFLOAT
|
||||
#endif /* NOFLOAT */
|
||||
}
|
||||
|
||||
#ifndef NOFLOAT
|
||||
|
@ -440,11 +449,11 @@ BadFloat:
|
|||
return (0.0);
|
||||
}
|
||||
|
||||
#else NOFLOAT
|
||||
#else /* NOFLOAT */
|
||||
|
||||
nofloat() {
|
||||
fatal("attempt to execute a floating point instruction on an EM machine without FP");
|
||||
}
|
||||
|
||||
#endif NOFLOAT
|
||||
#endif /* NOFLOAT */
|
||||
|
||||
|
|
|
@ -111,10 +111,10 @@ DoZRF(l)
|
|||
LOG(("@Z6 DoZRF(%ld)", l));
|
||||
spoilFRA();
|
||||
fpush(0.0, arg_wf(l));
|
||||
#else NOFLOAT
|
||||
#else /* NOFLOAT */
|
||||
arg = arg;
|
||||
nofloat();
|
||||
#endif NOFLOAT
|
||||
#endif /* NOFLOAT */
|
||||
}
|
||||
|
||||
DoZER(l)
|
||||
|
|
|
@ -223,7 +223,7 @@ PRIVATE long sli(w1, w2, nbytes) /* w1 << w2 */
|
|||
warning(WSHLARGE);
|
||||
w2 = nbytes*8 - 1;
|
||||
}
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
|
||||
if (!(IgnMask&BIT(EIOVFL))) {
|
||||
/* check overflow */
|
||||
|
@ -256,7 +256,7 @@ PRIVATE long sri(w1, w2, nbytes) /* w1 >> w2 */
|
|||
w2 = nbytes*8 - 1;
|
||||
}
|
||||
}
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
|
||||
/* calculate result */
|
||||
return (w1 >> w2);
|
||||
|
|
|
@ -17,13 +17,13 @@
|
|||
|
||||
#ifdef LOGGING
|
||||
extern int must_test;
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
|
||||
#ifdef LOGGING
|
||||
#define check_def(p,l) if (!st_sh(p) || !st_sh(p+l)) {warning(WUNLOG);}
|
||||
#else
|
||||
#define check_def(p,l)
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
|
||||
DoAND(l)
|
||||
register size l;
|
||||
|
@ -113,7 +113,7 @@ DoROL(l)
|
|||
t = l*8 - 1;
|
||||
}
|
||||
}
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
|
||||
/* calculate result */
|
||||
while (t--) {
|
||||
|
@ -146,7 +146,7 @@ DoROR(l)
|
|||
t = l*8 - 1;
|
||||
}
|
||||
}
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
|
||||
/* calculate result */
|
||||
while (t--) {
|
||||
|
|
|
@ -103,7 +103,7 @@ PRIVATE lfr(sz)
|
|||
if (sz != FRASize) {
|
||||
warning(FRASize < sz ? WRFUNSML : WRFUNLAR);
|
||||
}
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
|
||||
pushFRA(sz);
|
||||
spoilFRA();
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
#define check_seg(s1,s2,w)
|
||||
|
||||
#endif SEGCHECK
|
||||
#endif /* SEGCHECK */
|
||||
|
||||
DoADP(l)
|
||||
register long l;
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
#ifdef LOGGING
|
||||
extern int must_test;
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
|
||||
#define adu(w1,w2) (unsigned long)(w1 + w2)
|
||||
#define sbu(w1,w2) (unsigned long)(w1 - w2)
|
||||
|
@ -149,7 +149,7 @@ PRIVATE unsigned long slu(w1, w2, nbytes) /* w1 << w2 */
|
|||
w2 = nbytes*8 - 1;
|
||||
}
|
||||
}
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
|
||||
/* calculate result */
|
||||
return (w1 << w2);
|
||||
|
@ -168,7 +168,7 @@ PRIVATE unsigned long sru(w1, w2, nbytes) /* w1 >> w2 */
|
|||
w2 = nbytes*8 - 1;
|
||||
}
|
||||
}
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
|
||||
/* calculate result */
|
||||
return (w1 >> w2);
|
||||
|
|
|
@ -639,5 +639,5 @@ displ_sh(shadow, byte) /* transient */
|
|||
return (buf);
|
||||
}
|
||||
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
|
||||
|
|
|
@ -9,13 +9,13 @@
|
|||
|
||||
#ifdef LOGGING
|
||||
char *FRA_sh; /* shadowbytes */
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
|
||||
init_FRA() {
|
||||
FRA = Malloc(FRALimit, "Function Return Area");
|
||||
#ifdef LOGGING
|
||||
FRA_sh = Malloc(FRALimit, "shadowspace for Function Return Area");
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
FRA_def = UNDEFINED; /* set FRA illegal */
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ pushFRA(sz)
|
|||
stack_loc(SP + i) = FRA[i];
|
||||
#ifdef LOGGING
|
||||
st_sh(SP + i) = (i < FRASize ? FRA_sh[i] : UNDEFINED);
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ popFRA(sz)
|
|||
FRA[i] = stack_loc(SP + i);
|
||||
#ifdef LOGGING
|
||||
FRA_sh[i] = st_sh(SP + i);
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
}
|
||||
st_dec(max(sz, wsize));
|
||||
}
|
||||
|
|
|
@ -20,13 +20,13 @@ typedef unsigned long ptr; /* pointer to EM address */
|
|||
#define p2i(p) (p) /* convert pointer to index */
|
||||
#define i2p(p) (ptr)(p) /* convert index to pointer */
|
||||
|
||||
#else UNSIGNED
|
||||
#else /* UNSIGNED */
|
||||
|
||||
typedef char *ptr; /* pointer to EM address */
|
||||
#define p2i(p) (long)(p) /* convert pointer to index */
|
||||
#define i2p(p) (ptr)(p) /* convert index to pointer */
|
||||
|
||||
#endif UNSIGNED
|
||||
#endif /* UNSIGNED */
|
||||
|
||||
/* The EM size is an integer type; a cast suffices */
|
||||
typedef long size;
|
||||
|
|
|
@ -198,5 +198,5 @@ st_clear_area(from, to)
|
|||
st_undef(a);
|
||||
}
|
||||
}
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ incr_mess_id()
|
|||
|
||||
#ifdef LOGGING
|
||||
extern long inr; /* from log.c */
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
|
||||
/******** General file handling ********/
|
||||
|
||||
|
@ -102,7 +102,7 @@ init_ofiles(firsttime)
|
|||
|
||||
#ifdef LOGGING
|
||||
open_log(firsttime);
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
}
|
||||
|
||||
/*VARARGS0*/
|
||||
|
@ -146,7 +146,7 @@ close_down(rc)
|
|||
|
||||
#ifdef LOGGING
|
||||
close_log();
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
|
||||
exit(rc);
|
||||
}
|
||||
|
@ -188,9 +188,9 @@ char *position() /* transient */
|
|||
|
||||
#ifdef LOGGING
|
||||
sprintf(buff, "\"%s\", line %ld, INR = %ld", fn, getLIN(), inr);
|
||||
#else LOGGING
|
||||
#else /* LOGGING */
|
||||
sprintf(buff, "\"%s\", line %ld", fn, getLIN());
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
return buff;
|
||||
}
|
||||
|
||||
|
|
|
@ -314,5 +314,5 @@ PRIVATE long longpar(var, def)
|
|||
return (res ? atol(res) : def);
|
||||
}
|
||||
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
|
||||
|
|
|
@ -20,5 +20,5 @@ extern int logging; /* set if logging in progress */
|
|||
|
||||
#define LOG(a)
|
||||
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#define V7IOSETC (('t'<<8)|17)
|
||||
#define V7IOGETC (('t'<<8)|18)
|
||||
|
||||
#endif V7IOCTL
|
||||
#endif /* V7IOCTL */
|
||||
|
||||
|
||||
/************************************************************************
|
||||
|
@ -54,13 +54,13 @@ int do_ioctl(fd, req, addr)
|
|||
long count; /* might get ALIGNMENT problems with this one */
|
||||
int ldisc; /* might get ALIGNMENT problems with this one */
|
||||
int pgrp; /* might get ALIGNMENT problems with this one */
|
||||
#endif V7IOCTL
|
||||
#endif /* V7IOCTL */
|
||||
|
||||
struct tchars tc_buf;
|
||||
#ifndef V7IOCTL
|
||||
struct ltchars ltc_buf;
|
||||
#endif V7IOCTL
|
||||
#endif BSD_X
|
||||
#endif /* V7IOCTL */
|
||||
#endif /* BSD_X */
|
||||
|
||||
|
||||
#ifdef V7IOCTL
|
||||
|
@ -92,14 +92,14 @@ int do_ioctl(fd, req, addr)
|
|||
case V7IOGETC:
|
||||
req = TIOCGETC;
|
||||
break;
|
||||
#endif BSD_X
|
||||
#endif /* BSD_X */
|
||||
|
||||
default:
|
||||
einval(WBADIOCTL);
|
||||
return (-1); /* Fake return value */
|
||||
}
|
||||
|
||||
#endif V7IOCTL
|
||||
#endif /* V7IOCTL */
|
||||
|
||||
|
||||
switch (req) {
|
||||
|
@ -120,7 +120,7 @@ int do_ioctl(fd, req, addr)
|
|||
case TIOCSETP:
|
||||
#ifdef BSD4_1 /* from system.h */
|
||||
case TIOCSETN:
|
||||
#endif BSD4_1
|
||||
#endif /* BSD4_1 */
|
||||
/* set fd's parameters according to sgtty buffer */
|
||||
/* pointed to (addr), so first fill sg_buf properly. */
|
||||
if ( !mem2sgtty(addr, &sg_buf)
|
||||
|
@ -289,8 +289,8 @@ int do_ioctl(fd, req, addr)
|
|||
}
|
||||
break;
|
||||
|
||||
#endif V7IOCTL
|
||||
#endif BSD_X
|
||||
#endif /* V7IOCTL */
|
||||
#endif /* BSD_X */
|
||||
|
||||
default:
|
||||
einval(WBADIOCTL);
|
||||
|
|
|
@ -35,7 +35,7 @@ size maxheap; /* if set, max heap size */
|
|||
|
||||
#ifdef LOGGING
|
||||
extern long inr; /* from log.c */
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
|
||||
PRIVATE char *dflt_av[] = {"e.out", 0}; /* default arguments */
|
||||
|
||||
|
@ -95,14 +95,14 @@ main(argc, argv)
|
|||
else if (logarg(argv[i])) {
|
||||
/* interesting for the logging machine */
|
||||
}
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
else break;
|
||||
}
|
||||
|
||||
#ifdef LOGGING
|
||||
/* Initialize the logging machine */
|
||||
init_log();
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
|
||||
if (argc > i)
|
||||
init(argc - i, argv + i);
|
||||
|
@ -127,7 +127,7 @@ main(argc, argv)
|
|||
#ifdef NOFLOAT
|
||||
if (FLAGS&FB_REALS)
|
||||
warning(WFLUSED);
|
||||
#endif NOFLOAT
|
||||
#endif /* NOFLOAT */
|
||||
|
||||
if (FLAGS&FB_EXTRA)
|
||||
warning(WEXTRIGN);
|
||||
|
@ -145,7 +145,7 @@ main(argc, argv)
|
|||
/* log this instruction */
|
||||
logging = 1;
|
||||
}
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
|
||||
LOG(("@x9 PC = %lu OPCODE = %lu", PC,
|
||||
btol(text_loc(PC)) < SECONDARY ?
|
||||
|
@ -174,7 +174,7 @@ main(argc, argv)
|
|||
|
||||
#ifdef LOGGING
|
||||
log_eoi();
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
}
|
||||
|
||||
if (must_tally) {
|
||||
|
|
|
@ -25,25 +25,25 @@ extern int fd_limit; /* from io.c */
|
|||
|
||||
#ifdef BSD_X /* from system.h */
|
||||
#include <sys/timeb.h>
|
||||
#endif BSD_X
|
||||
#endif /* BSD_X */
|
||||
#ifdef SYS_V
|
||||
struct timeb { /* non-existing; we use an ad-hoc definition */
|
||||
long time;
|
||||
unsigned short millitm;
|
||||
short timezone, dstflag;
|
||||
};
|
||||
#endif SYS_V
|
||||
#endif /* SYS_V */
|
||||
|
||||
#ifdef BSD4_2 /* from system.h */
|
||||
#include <sys/time.h>
|
||||
#endif BSD4_2
|
||||
#endif /* BSD4_2 */
|
||||
|
||||
#ifdef SYS_V
|
||||
#include <sys/errno.h>
|
||||
#undef ERANGE /* collision with trap.h */
|
||||
#include <fcntl.h>
|
||||
#include <time.h>
|
||||
#endif SYS_V
|
||||
#endif /* SYS_V */
|
||||
|
||||
#include <em_abs.h>
|
||||
#include "logging.h"
|
||||
|
@ -62,7 +62,7 @@ extern long lseek();
|
|||
extern unsigned int alarm();
|
||||
extern long time();
|
||||
extern void sync();
|
||||
#endif SYS_V
|
||||
#endif /* SYS_V */
|
||||
|
||||
#define INT2SIZE max(wsize, 2L)
|
||||
#define INT4SIZE max(wsize, 4L)
|
||||
|
@ -165,14 +165,14 @@ moncall()
|
|||
|
||||
#ifdef BSD4_2 /* from system.h */
|
||||
struct timeval tv; /* private timeval buffer */
|
||||
#endif BSD4_2
|
||||
#endif /* BSD4_2 */
|
||||
|
||||
#ifdef BSD_X /* from system.h */
|
||||
time_t utimbuf[2]; /* private utime buffer */
|
||||
#endif BSD_X
|
||||
#endif /* BSD_X */
|
||||
#ifdef SYS_V /* from system.h */
|
||||
struct {time_t x, y;} utimbuf; /* private utime buffer */
|
||||
#endif SYS_V
|
||||
#endif /* SYS_V */
|
||||
|
||||
char *cp;
|
||||
int nr;
|
||||
|
@ -190,7 +190,7 @@ moncall()
|
|||
UNDEFINED : DEFINED;
|
||||
#else
|
||||
ES_def = DEFINED;
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
ES = pop_int();
|
||||
running = 0; /* stop the machine */
|
||||
LOG(("@m9 Exit: ES = %ld", ES));
|
||||
|
@ -247,7 +247,7 @@ moncall()
|
|||
LOG(("@m6 Read: char = '%c'", *(buf[0] + i)));
|
||||
}
|
||||
}
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
|
||||
if (in_gda(dsp1) && !in_gda(dsp1 + (n-1))) {
|
||||
efault(WRGDAH);
|
||||
|
@ -313,7 +313,7 @@ moncall()
|
|||
warning(in_stack(addr) ? WWLUNDEF : WWGUNDEF);
|
||||
}
|
||||
}
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
|
||||
check_buf(0, (size)nbytes);
|
||||
for ( nr = nbytes, addr = dsp1, cp = buf[0];
|
||||
|
@ -331,7 +331,7 @@ moncall()
|
|||
LOG(("@m6 write: char = '%c'", *(buf[0] + i)));
|
||||
}
|
||||
}
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
|
||||
if ((n = write(fd, buf[0], nbytes)) == -1)
|
||||
goto write_error;
|
||||
|
@ -575,9 +575,9 @@ moncall()
|
|||
if ( !savestr(0, dsp1)
|
||||
#ifndef BSD4_2 /* from system.h */
|
||||
|| umount(buf[0]) == -1
|
||||
#else BSD4_2
|
||||
#else /* BSD4_2 */
|
||||
|| unmount(buf[0]) == -1
|
||||
#endif BSD4_2
|
||||
#endif /* BSD4_2 */
|
||||
) {
|
||||
push_err();
|
||||
LOG(("@m4 Umount: failed, dsp1 = %lu, errno = %d",
|
||||
|
@ -618,11 +618,11 @@ moncall()
|
|||
tm = pop_int4();
|
||||
#ifndef BSD4_2 /* from system.h */
|
||||
rc = stime(&tm);
|
||||
#else BSD4_2
|
||||
#else /* BSD4_2 */
|
||||
tv.tv_sec = tm;
|
||||
tv.tv_usec = 0; /* zero microseconds */
|
||||
rc = settimeofday(&tv, (struct timezone *)0);
|
||||
#endif BSD4_2
|
||||
#endif /* BSD4_2 */
|
||||
if (rc == -1) {
|
||||
push_err();
|
||||
LOG(("@m4 Stime: failed, tm = %ld, errno = %d",
|
||||
|
@ -695,11 +695,11 @@ moncall()
|
|||
#ifdef BSD_X /* from system.h */
|
||||
utimbuf[0] = actime;
|
||||
utimbuf[1] = modtime;
|
||||
#endif BSD_X
|
||||
#endif /* BSD_X */
|
||||
#ifdef SYS_V /* from system.h */
|
||||
utimbuf.x = actime;
|
||||
utimbuf.y = modtime;
|
||||
#endif SYS_V
|
||||
#endif /* SYS_V */
|
||||
if (!savestr(0, dsp1) || utime(buf[0], utimbuf) == -1) {
|
||||
push_err();
|
||||
LOG(("@m4 Utime: failed, dsp1 = %lu, dsp2 = %lu, errno = %d",
|
||||
|
@ -740,13 +740,13 @@ moncall()
|
|||
dsp2 = pop_ptr();
|
||||
#ifdef BSD_X /* from system.h */
|
||||
ftime(&tb_buf);
|
||||
#endif BSD_X
|
||||
#endif /* BSD_X */
|
||||
#ifdef SYS_V /* from system.h */
|
||||
tb_buf.time = time((time_t*)0);
|
||||
tb_buf.millitm = 0;
|
||||
tb_buf.timezone = timezone / 60;
|
||||
tb_buf.dstflag = daylight;
|
||||
#endif SYS_V
|
||||
#endif /* SYS_V */
|
||||
if (!timeb2mem(dsp2, &tb_buf)) {
|
||||
push_err();
|
||||
LOG(("@m4 Ftime: failed, dsp2 = %lu, errno = %d",
|
||||
|
@ -794,7 +794,7 @@ moncall()
|
|||
}
|
||||
#ifdef BSD_X /* from system.h */
|
||||
fdnew = dup2(fd1, fdnew);
|
||||
#endif BSD_X
|
||||
#endif /* BSD_X */
|
||||
|
||||
#ifdef SYS_V /* from system.h */
|
||||
{
|
||||
|
@ -814,7 +814,7 @@ moncall()
|
|||
fdnew = fcntl(fd1, F_DUPFD, fdnew);
|
||||
}
|
||||
}
|
||||
#endif SYS_V
|
||||
#endif /* SYS_V */
|
||||
dup2_error:;
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -20,14 +20,14 @@
|
|||
|
||||
#ifdef BSD_X /* from system.h */
|
||||
#include <sys/timeb.h>
|
||||
#endif BSD_X
|
||||
#endif /* BSD_X */
|
||||
#ifdef SYS_V /* from system.h */
|
||||
struct timeb { /* non-existing; we use an ad-hoc definition */
|
||||
long time;
|
||||
unsigned short millitm;
|
||||
short timezone, dstflag;
|
||||
}
|
||||
#endif SYS_V
|
||||
#endif /* SYS_V */
|
||||
|
||||
/******** System to EM memory ********/
|
||||
|
||||
|
@ -130,8 +130,8 @@ int ltchars2mem(addr, ltcharsb)
|
|||
mem_stfld(addr, V7t_lnextc, (long) ltcharsb->t_lnextc);
|
||||
return 1;
|
||||
}
|
||||
#endif V7IOCTL
|
||||
#endif BSD_X
|
||||
#endif /* V7IOCTL */
|
||||
#endif /* BSD_X */
|
||||
|
||||
|
||||
/******** EM memory to system ********/
|
||||
|
@ -188,6 +188,6 @@ int mem2ltchars(addr, ltcharsb)
|
|||
ltcharsb->t_lnextc = (char) mem_ldfld(addr, V7t_lnextc);
|
||||
return 1;
|
||||
}
|
||||
#endif V7IOCTL
|
||||
#endif BSD_X
|
||||
#endif /* V7IOCTL */
|
||||
#endif /* BSD_X */
|
||||
|
||||
|
|
|
@ -69,6 +69,6 @@ end_init_proctab()
|
|||
LOG((" r5: proctab[%ld]: nloc = %d, ep = %lu, ff = %lu",
|
||||
p, pr->pr_nloc, pr->pr_ep, pr->pr_ff));
|
||||
}
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
}
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ trap_msg: $(SRC_DIR)/M.trap_msg $(TRAPS)
|
|||
warn_msg: $(SRC_DIR)/M.warn_msg $(APP_A)
|
||||
$(SRC_DIR)/M.warn_msg $(APP_A)
|
||||
|
||||
warn.h: $(SRC_DIR)/M.warn_h $(APP_A)
|
||||
./warn.h: $(SRC_DIR)/M.warn_h $(APP_A)
|
||||
$(SRC_DIR)/M.warn_h $(APP_A)
|
||||
|
||||
switch/DoCases:
|
||||
|
@ -142,7 +142,7 @@ test/awa.em44:
|
|||
|
||||
|
||||
# Auxiliary entries
|
||||
lint: $(CFILES) trap_msg warn_msg warn.h switch/DoCases switch/PrCases
|
||||
lint: $(CFILES) trap_msg warn_msg ./warn.h switch/DoCases switch/PrCases
|
||||
$(LINT) $(LINTFLAGS) $(CFILES)
|
||||
|
||||
tags: $(HDR) $(CFILES)
|
||||
|
@ -170,7 +170,7 @@ clean:
|
|||
bare: clean
|
||||
(cd switch; make bare)
|
||||
|
||||
depend: warn.h trap_msg warn_msg
|
||||
depend: ./warn.h trap_msg warn_msg
|
||||
sed '/^#DEPENDENCIES/,$$d' Makefile >Makefile.new
|
||||
echo '#DEPENDENCIES' >>Makefile.new
|
||||
for i in $(CFILES) ; do \
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#ifndef NOFLOAT
|
||||
extern double str2double();
|
||||
#endif NOFLOAT
|
||||
#endif /* NOFLOAT */
|
||||
|
||||
/************************************************************************
|
||||
* Read object file contents. *
|
||||
|
@ -214,7 +214,7 @@ PRIVATE ptr rd_repeat(pos, count, prev_pos)
|
|||
#ifdef LOGGING
|
||||
/* copy shadow byte, including protection bit */
|
||||
dt_sh(pos) = dt_sh(pos - diff);
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
|
@ -284,10 +284,10 @@ PRIVATE ptr rd_descr(type, count, pos)
|
|||
#ifndef NOFLOAT
|
||||
/* store the float */
|
||||
dt_stf(pos, str2double(fl_rep), j);
|
||||
#else NOFLOAT
|
||||
#else /* NOFLOAT */
|
||||
/* we cannot store the float */
|
||||
warning(WFLINIT);
|
||||
#endif NOFLOAT
|
||||
#endif /* NOFLOAT */
|
||||
pos += j;
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -77,7 +77,7 @@ int poprsb(rtt)
|
|||
if (SP > properSP)
|
||||
warning(rtt ? WRTTSTS : WRETSTS);
|
||||
}
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
|
||||
/* discard stack up to RSB */
|
||||
newSP(LB);
|
||||
|
|
|
@ -72,7 +72,7 @@ int ptr2seg(p)
|
|||
return s;
|
||||
}
|
||||
|
||||
#else SEGCHECK
|
||||
#else /* SEGCHECK */
|
||||
|
||||
init_AB_list() {}
|
||||
|
||||
|
@ -80,5 +80,5 @@ push_frame() {}
|
|||
|
||||
pop_frames() {}
|
||||
|
||||
#endif SEGCHECK
|
||||
#endif /* SEGCHECK */
|
||||
|
||||
|
|
|
@ -98,5 +98,5 @@ extern char *stackML_sh; /* stack_sh + ML (to speed up stack access) */
|
|||
#define ch_dt_prot(a)
|
||||
#define ch_st_prot(a)
|
||||
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ extern size maxstack; /* from main.c */
|
|||
#ifdef LOGGING
|
||||
char *stack_sh; /* stadowbytes */
|
||||
char *stackML_sh; /* speed up access of stadowbytes */
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
|
||||
PRIVATE warn_stbits();
|
||||
|
||||
|
@ -44,7 +44,7 @@ init_stack() {
|
|||
stack_sh = Malloc(STACKSIZE, "shadowspace for stack");
|
||||
stackML_sh = stack_sh + ML;
|
||||
st_clear_area(ML, SL);
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
}
|
||||
|
||||
|
||||
|
@ -94,12 +94,12 @@ newSP(ap)
|
|||
stack_sh = Realloc(stack_sh, (size)(stacksize),
|
||||
"shadowspace for stack");
|
||||
stackML_sh = stack_sh + ML;
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
}
|
||||
|
||||
#ifdef LOGGING
|
||||
st_clear_area(SP - 1, p);
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
}
|
||||
SP = p;
|
||||
}
|
||||
|
@ -229,7 +229,7 @@ st_stn(addr, al, n)
|
|||
stack_loc(addr) = (char) l;
|
||||
#ifdef LOGGING
|
||||
st_sh(addr) = sh_flags;
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
l = l>>8;
|
||||
}
|
||||
}
|
||||
|
@ -255,7 +255,7 @@ st_stw(addr, al)
|
|||
stack_loc(addr) = (char) l;
|
||||
#ifdef LOGGING
|
||||
st_sh(addr) = sh_flags;
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
l = l>>8;
|
||||
}
|
||||
}
|
||||
|
@ -283,7 +283,7 @@ st_stf(addr, f, n)
|
|||
st_fl(addr);
|
||||
}
|
||||
}
|
||||
#endif NOFLOAT
|
||||
#endif /* NOFLOAT */
|
||||
|
||||
/************************************************************************
|
||||
* Stack load division. *
|
||||
|
@ -313,7 +313,7 @@ ptr st_lddp(addr)
|
|||
warning(WLDPEXP);
|
||||
warn_stbits(addr, psize);
|
||||
}
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
|
||||
p = p_in_stack(addr);
|
||||
LOG(("@s6 st_lddp() returns %lu", p));
|
||||
|
@ -334,7 +334,7 @@ ptr st_ldip(addr)
|
|||
warning(WLIPEXP);
|
||||
warn_stbits(addr, psize);
|
||||
}
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
|
||||
p = p_in_stack(addr);
|
||||
LOG(("@s6 st_ldip() returns %lu", p));
|
||||
|
@ -357,7 +357,7 @@ unsigned long st_ldu(addr, n)
|
|||
warning(n == 1 ? WLCEXP : WLIEXP);
|
||||
warn_stbits(addr, n);
|
||||
}
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
|
||||
addr += n-1;
|
||||
for (i = (int) n-1; i >= 0; i--, addr--) {
|
||||
|
@ -382,7 +382,7 @@ unsigned long st_lduw(addr)
|
|||
warning(WLIEXP);
|
||||
warn_stbits(addr, wsize);
|
||||
}
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
|
||||
addr += wsize - 1;
|
||||
for (i = (int) wsize-1; i >= 0; i--, addr--) {
|
||||
|
@ -408,7 +408,7 @@ long st_lds(addr, n)
|
|||
warning(n == 1 ? WLCEXP : WLIEXP);
|
||||
warn_stbits(addr, n);
|
||||
}
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
|
||||
addr += n - 2;
|
||||
l = btos(stack_loc(addr + 1));
|
||||
|
@ -434,7 +434,7 @@ long st_ldsw(addr)
|
|||
warning(WLIEXP);
|
||||
warn_stbits(addr, wsize);
|
||||
}
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
|
||||
addr += wsize - 2;
|
||||
l = btos(stack_loc(addr+1));
|
||||
|
@ -470,7 +470,7 @@ double st_ldf(addr, n)
|
|||
warning(WLFEXP);
|
||||
warn_stbits(addr, n);
|
||||
}
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
|
||||
for (i = (int) n; i > 0; i--, addr++) {
|
||||
*(cp++) = stack_loc(addr);
|
||||
|
@ -480,7 +480,7 @@ double st_ldf(addr, n)
|
|||
}
|
||||
return (f);
|
||||
}
|
||||
#endif NOFLOAT
|
||||
#endif /* NOFLOAT */
|
||||
|
||||
/************************************************************************
|
||||
* Stack move division *
|
||||
|
@ -516,7 +516,7 @@ st_mvs(s2, s1, n) /* s1 -> s2 */
|
|||
stack_loc(s2) = stack_loc(s1);
|
||||
#ifdef LOGGING
|
||||
st_sh(s2) = st_sh(s1) & ~SH_PROT;
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -536,7 +536,7 @@ st_mvd(s, d, n) /* d -> s */
|
|||
stack_loc(s) = data_loc(d);
|
||||
#ifdef LOGGING
|
||||
st_sh(s) = dt_sh(d) & ~SH_PROT;
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -658,7 +658,7 @@ double fpop(n)
|
|||
decSP(n);
|
||||
return (d);
|
||||
}
|
||||
#endif NOFLOAT
|
||||
#endif /* NOFLOAT */
|
||||
|
||||
long wpop()
|
||||
{
|
||||
|
@ -762,7 +762,7 @@ fpush(f, n)
|
|||
incSP(n);
|
||||
st_stf(SP, f, n);
|
||||
}
|
||||
#endif NOFLOAT
|
||||
#endif /* NOFLOAT */
|
||||
|
||||
#ifdef LOGGING
|
||||
|
||||
|
@ -796,5 +796,5 @@ PRIVATE warn_stbits(addr, n)
|
|||
warningcont(WWASINSP);
|
||||
}
|
||||
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
|
||||
|
|
|
@ -9,13 +9,13 @@
|
|||
|
||||
#ifdef BSD4_1
|
||||
#define BSD_X
|
||||
#endif BSD4_1
|
||||
#endif /* BSD4_1 */
|
||||
|
||||
#ifdef BSD4_2
|
||||
#define BSD_X
|
||||
#endif BSD4_2
|
||||
#endif /* BSD4_2 */
|
||||
|
||||
#ifdef SYS_5
|
||||
#define SYS_V
|
||||
#endif SYS_5
|
||||
#endif /* SYS_5 */
|
||||
|
||||
|
|
|
@ -146,7 +146,7 @@ warningcont(nr)
|
|||
}
|
||||
}
|
||||
|
||||
#endif LOGGING
|
||||
#endif /* LOGGING */
|
||||
|
||||
set_wmask(i)
|
||||
int i;
|
||||
|
|
|
@ -42,16 +42,14 @@ In general, an object file consists of the following parts:
|
|||
.br
|
||||
The header of an object file has the following structure:
|
||||
.PP
|
||||
#define ushort unsigned\ short
|
||||
.PP
|
||||
.nf
|
||||
struct outhead {
|
||||
ushort oh_magic; /* magic number */
|
||||
ushort oh_stamp; /* version stamp */
|
||||
ushort oh_flags; /* several format flags */
|
||||
ushort oh_nsect; /* number of outsect structures */
|
||||
ushort oh_nrelo; /* number of outrelo structures */
|
||||
ushort oh_nname; /* number of outname structures */
|
||||
unsigned short oh_magic; /* magic number */
|
||||
unsigned short oh_stamp; /* version stamp */
|
||||
unsigned short oh_flags; /* several format flags */
|
||||
unsigned short oh_nsect; /* number of outsect structures */
|
||||
unsigned short oh_nrelo; /* number of outrelo structures */
|
||||
unsigned short oh_nname; /* number of outname structures */
|
||||
long oh_nemit; /* length of sections */
|
||||
long oh_nchar; /* size of string area */
|
||||
};
|
||||
|
@ -151,7 +149,7 @@ relocatable datum. The information has the following structure:
|
|||
struct outrelo {
|
||||
char or_type; /* type of reference */
|
||||
char or_sect; /* referencing section */
|
||||
ushort or_nami; /* referenced symbol index */
|
||||
unsigned short or_nami; /* referenced symbol index */
|
||||
long or_addr; /* referencing address */
|
||||
};
|
||||
.fi
|
||||
|
@ -231,8 +229,8 @@ struct outname {
|
|||
} on_u;
|
||||
#define on_mptr on_u.on_ptr
|
||||
#define on_foff on_u.on_off
|
||||
ushort on_type; /* symbol type */
|
||||
ushort on_desc; /* debug info */
|
||||
unsigned short on_type; /* symbol type */
|
||||
unsigned short on_desc; /* debug info */
|
||||
long on_valu; /* symbol value */
|
||||
};
|
||||
.fi
|
||||
|
|
|
@ -9,14 +9,14 @@
|
|||
|
||||
#define assert(ex)
|
||||
|
||||
#else NASSERT
|
||||
#else /* NASSERT */
|
||||
|
||||
#define assert(ex) \
|
||||
{if (!(ex)) fatal("Assertion failed: file %s, line %d", __FILE__, __LINE__);}
|
||||
|
||||
#endif NASSERT
|
||||
#else lint
|
||||
#endif /* NASSERT */
|
||||
#else /* lint */
|
||||
|
||||
#define assert(ex)
|
||||
|
||||
#endif lint
|
||||
#endif /* lint */
|
||||
|
|
|
@ -39,8 +39,8 @@ extract()
|
|||
skip_modul(&head);
|
||||
}
|
||||
|
||||
ushort NLocals = 0; /* Number of local names to be saved. */
|
||||
ushort NGlobals = 0; /* Number of global names. */
|
||||
unsigned short NLocals = 0; /* Number of local names to be saved. */
|
||||
unsigned short NGlobals = 0; /* Number of global names. */
|
||||
|
||||
/*
|
||||
* Walk through the nametable of this module, counting the locals that must
|
||||
|
|
|
@ -14,7 +14,7 @@ static char rcsid[] = "$Header$";
|
|||
#include "scan.h"
|
||||
|
||||
extern bool incore;
|
||||
extern ushort NLocals;
|
||||
extern unsigned short NLocals;
|
||||
extern int flagword;
|
||||
extern struct outname *searchname();
|
||||
|
||||
|
@ -47,7 +47,7 @@ finish()
|
|||
put_locals(names, head->oh_nname);
|
||||
#ifdef SYMDBUG
|
||||
put_dbug(OFF_DBUG(*head));
|
||||
#endif SYMDBUG
|
||||
#endif /* SYMDBUG */
|
||||
}
|
||||
compute_origins(sects, head->oh_nsect);
|
||||
skip_modul(head);
|
||||
|
@ -80,7 +80,7 @@ adjust_names(name, head, chars)
|
|||
|
||||
do_crs(base, count)
|
||||
struct outname *base;
|
||||
unsigned short count;
|
||||
unsigned count;
|
||||
{
|
||||
register struct outname *name = base;
|
||||
|
||||
|
@ -209,7 +209,7 @@ handle_relos(head, sects, names)
|
|||
static
|
||||
put_locals(name, nnames)
|
||||
struct outname *name;
|
||||
register ushort nnames;
|
||||
register unsigned nnames;
|
||||
{
|
||||
register struct outname *oname = name;
|
||||
register struct outname *iname = oname;
|
||||
|
@ -233,7 +233,7 @@ put_locals(name, nnames)
|
|||
static
|
||||
compute_origins(sect, nsect)
|
||||
register struct outsect *sect;
|
||||
register ushort nsect;
|
||||
register unsigned nsect;
|
||||
{
|
||||
extern struct orig relorig[];
|
||||
register struct orig *orig = relorig;
|
||||
|
@ -267,4 +267,4 @@ put_dbug(offdbug)
|
|||
dbugsize -= nbytes;
|
||||
}
|
||||
}
|
||||
#endif SYMDBUG
|
||||
#endif /* SYMDBUG */
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
mems[ALLOGCHR].mem_left = 16 * K;
|
||||
#ifdef SYMDBUG
|
||||
mems[ALLODBUG].mem_left = 32 * K;
|
||||
#endif SYMDBUG
|
||||
#endif /* SYMDBUG */
|
||||
mems[ALLOSYMB].mem_left = 8 * K;
|
||||
mems[ALLOARCH].mem_left = 4 * K;
|
||||
mems[ALLOMODL].mem_left = 64 * K;
|
||||
|
@ -43,7 +43,7 @@
|
|||
mems[ALLOGCHR].mem_left = 2 * K;
|
||||
#ifdef SYMDBUG
|
||||
mems[ALLODBUG].mem_left = 2 * K;
|
||||
#endif SYMDBUG
|
||||
#endif /* SYMDBUG */
|
||||
mems[ALLOSYMB].mem_left = 2 * K;
|
||||
mems[ALLOARCH].mem_left = 1 * K;
|
||||
mems[ALLOMODL].mem_left = 12 * K;
|
||||
|
|
|
@ -371,7 +371,7 @@ evaluate()
|
|||
change_names();
|
||||
}
|
||||
|
||||
extern ushort NGlobals, NLocals;
|
||||
extern unsigned short NGlobals, NLocals;
|
||||
|
||||
/*
|
||||
* Sect_comm[N] is the number of common bytes in section N.
|
||||
|
|
|
@ -547,14 +547,14 @@ freeze_core()
|
|||
|
||||
/*
|
||||
* To transform the various pieces of the output in core to the file format,
|
||||
* we must order the bytes in the ushorts and longs as ACK prescribes.
|
||||
* we must order the bytes in the unsigned shorts and longs as ACK prescribes.
|
||||
*/
|
||||
write_bytes()
|
||||
{
|
||||
ushort nsect;
|
||||
unsigned short nsect;
|
||||
long offchar;
|
||||
register struct memory *mem;
|
||||
extern ushort NLocals, NGlobals;
|
||||
extern unsigned short NLocals, NGlobals;
|
||||
extern long NLChars, NGChars;
|
||||
extern int flagword;
|
||||
extern struct outhead outhead;
|
||||
|
@ -603,13 +603,13 @@ write_bytes()
|
|||
wr_string(mems[ALLOGCHR].mem_base + 1, (long)NGChars);
|
||||
#ifdef SYMDBUG
|
||||
wr_dbug(mems[ALLODBUG].mem_base, mems[ALLODBUG].mem_full);
|
||||
#endif SYMDBUG
|
||||
#endif /* SYMDBUG */
|
||||
}
|
||||
}
|
||||
|
||||
namecpy(name, nname, offchar)
|
||||
register struct outname *name;
|
||||
register ushort nname;
|
||||
register unsigned nname;
|
||||
register long offchar;
|
||||
{
|
||||
while (nname--) {
|
||||
|
|
|
@ -12,9 +12,9 @@
|
|||
#define ALLOGCHR (ALLOLCHR + 1) /* Strings of global names. */
|
||||
#ifdef SYMDEBUG
|
||||
#define ALLODBUG (ALLOGCHR + 1) /* Symbolic debugging info. */
|
||||
#else SYMDEBUG
|
||||
#else /* SYMDEBUG */
|
||||
#define ALLODBUG ALLOGCHR
|
||||
#endif SYMDEBUG
|
||||
#endif /* SYMDEBUG */
|
||||
#define ALLOSYMB (ALLODBUG + 1) /* Symbol table. */
|
||||
#define ALLOARCH (ALLOSYMB + 1) /* Archive positions. */
|
||||
#define ALLOMODL (ALLOARCH + 1) /* Modules. */
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#ifdef SYMDEBUG
|
||||
Symbolic debugging information
|
||||
-----------------------------------------------
|
||||
#endif SYMDEBUG
|
||||
#endif /* SYMDEBUG */
|
||||
Symbol table *
|
||||
-----------------------------------------------
|
||||
Archive positions *
|
||||
|
|
|
@ -24,7 +24,7 @@ extern int flagword;
|
|||
*/
|
||||
beginoutput()
|
||||
{
|
||||
extern ushort NLocals, NGlobals;
|
||||
extern unsigned short NLocals, NGlobals;
|
||||
extern long NLChars, NGChars;
|
||||
extern char *outputname;
|
||||
|
||||
|
@ -35,9 +35,9 @@ beginoutput()
|
|||
generate_section_names();
|
||||
|
||||
if (!(flagword & (CFLAG|RFLAG)))
|
||||
outhead.oh_nrelo = (ushort)0;
|
||||
outhead.oh_nrelo = (unsigned short)0;
|
||||
if (flagword & SFLAG) {
|
||||
outhead.oh_nname = (ushort)0;
|
||||
outhead.oh_nname = (unsigned short)0;
|
||||
outhead.oh_nchar = (long)0;
|
||||
} else {
|
||||
outhead.oh_nname = NLocals + NGlobals + outhead.oh_nsect;
|
||||
|
@ -68,7 +68,7 @@ generate_section_names()
|
|||
for (sectindex = 0; sectindex < outhead.oh_nsect; sectindex++, name++) {
|
||||
name->on_foff = (long)0; /* No string name. */
|
||||
name->on_type = (S_MIN + sectindex) | S_SCT;
|
||||
name->on_desc = (ushort)0;
|
||||
name->on_desc = (unsigned short)0;
|
||||
name->on_valu = outsect[sectindex].os_base;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ getvalu(addr, type)
|
|||
char addr[];
|
||||
char type;
|
||||
{
|
||||
ushort word0, word1;
|
||||
unsigned short word0, word1;
|
||||
|
||||
switch (type & RELSZ) {
|
||||
case RELO1:
|
||||
|
@ -62,7 +62,7 @@ putvalu(valu, addr, type)
|
|||
char addr[];
|
||||
char type;
|
||||
{
|
||||
ushort word0, word1;
|
||||
unsigned short word0, word1;
|
||||
|
||||
switch (type & RELSZ) {
|
||||
case RELO1:
|
||||
|
@ -102,7 +102,7 @@ putvalu(valu, addr, type)
|
|||
}
|
||||
}
|
||||
|
||||
extern ushort NLocals, NGlobals;
|
||||
extern unsigned short NLocals, NGlobals;
|
||||
extern struct outsect outsect[];
|
||||
extern struct orig relorig[];
|
||||
|
||||
|
@ -118,14 +118,14 @@ extern struct orig relorig[];
|
|||
* Second case: we must update the value by the change
|
||||
* in position of the section of local.
|
||||
*/
|
||||
static ushort
|
||||
static unsigned
|
||||
addrelo(relo, names, valu_out)
|
||||
struct outrelo *relo;
|
||||
struct outname *names;
|
||||
long *valu_out; /* Out variable. */
|
||||
{
|
||||
register struct outname *local = &names[relo->or_nami];
|
||||
register ushort index = NLocals;
|
||||
register unsigned short index = NLocals;
|
||||
register long valu = *valu_out;
|
||||
|
||||
if ((local->on_type & S_SCT)) {
|
||||
|
@ -138,7 +138,7 @@ addrelo(relo, names, valu_out)
|
|||
register struct outname *name;
|
||||
extern int hash();
|
||||
extern struct outname *searchname();
|
||||
extern ushort indexof();
|
||||
extern unsigned indexof();
|
||||
extern struct outhead outhead;
|
||||
|
||||
name = searchname(local->on_mptr, hash(local->on_mptr));
|
||||
|
|
|
@ -27,7 +27,7 @@ savemagic()
|
|||
return;
|
||||
|
||||
if ((p = core_alloc(ALLOMODL, (long)sizeof(int))) != (char *)0) {
|
||||
*(ushort *)p = AALMAG;
|
||||
*(unsigned short *)p = AALMAG;
|
||||
core_position += sizeof(int);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ static char rcsid[] = "$Header$";
|
|||
#ifdef SYMDBUG
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#endif SYMDBUG
|
||||
#endif /* SYMDBUG */
|
||||
#include <arch.h>
|
||||
#include <out.h>
|
||||
#include <ranlib.h>
|
||||
|
@ -25,7 +25,7 @@ static char rcsid[] = "$Header$";
|
|||
#define IND_RELO(x) (IND_EMIT(x) + (x).oh_nsect * sizeof(ind_t))
|
||||
#ifdef SYMDBUG
|
||||
#define IND_DBUG(x) (IND_RELO(x) + sizeof(ind_t))
|
||||
#endif SYMDBUG
|
||||
#endif /* SYMDBUG */
|
||||
|
||||
extern long lseek();
|
||||
extern char *core_alloc();
|
||||
|
@ -37,7 +37,7 @@ char *archname; /* Name of archive, if reading from archive. */
|
|||
char *modulname; /* Name of object module. */
|
||||
#ifdef SYMDBUG
|
||||
long objectsize;
|
||||
#endif SYMDBUG
|
||||
#endif /* SYMDBUG */
|
||||
|
||||
static long align();
|
||||
static char *modulbase;
|
||||
|
@ -50,7 +50,7 @@ static bool putemitindex();
|
|||
static bool putreloindex();
|
||||
#ifdef SYMDBUG
|
||||
static bool putdbugindex();
|
||||
#endif SYMDBUG
|
||||
#endif /* SYMDBUG */
|
||||
static get_indirect();
|
||||
static read_modul();
|
||||
|
||||
|
@ -66,11 +66,11 @@ getfile(filename)
|
|||
{
|
||||
unsigned int rd_unsigned2();
|
||||
struct ar_hdr archive_header;
|
||||
ushort magic_number;
|
||||
unsigned short magic_number;
|
||||
#ifdef SYMDBUG
|
||||
struct stat statbuf;
|
||||
extern int fstat();
|
||||
#endif SYMDBUG
|
||||
#endif /* SYMDBUG */
|
||||
|
||||
archname = (char *)0;
|
||||
modulname = (char *)0;
|
||||
|
@ -81,7 +81,7 @@ getfile(filename)
|
|||
magic_number = rd_unsigned2(infile);
|
||||
} else {
|
||||
modulbase = modulptr((ind_t)0);
|
||||
magic_number = *(ushort *)modulbase;
|
||||
magic_number = *(unsigned short *)modulbase;
|
||||
}
|
||||
|
||||
switch (magic_number) {
|
||||
|
@ -92,7 +92,7 @@ getfile(filename)
|
|||
fatal("cannot stat");
|
||||
objectsize = statbuf.st_size;
|
||||
}
|
||||
#endif SYMDBUG
|
||||
#endif /* SYMDBUG */
|
||||
seek((long)0);
|
||||
modulname = filename;
|
||||
return PLAIN;
|
||||
|
@ -135,7 +135,7 @@ get_archive_header(archive_header)
|
|||
}
|
||||
#ifdef SYMDBUG
|
||||
objectsize = archive_header.ar_size;
|
||||
#endif SYMDBUG
|
||||
#endif /* SYMDBUG */
|
||||
}
|
||||
|
||||
get_modul()
|
||||
|
@ -175,7 +175,7 @@ scan_modul()
|
|||
ojectsize - OFF_DBUG(*head)
|
||||
);
|
||||
}
|
||||
#endif SYMDBUG
|
||||
#endif /* SYMDBUG */
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -213,16 +213,16 @@ direct_alloc(head)
|
|||
{
|
||||
ind_t sectindex = IND_SECT(*head);
|
||||
register struct outsect *sects;
|
||||
ushort nsect = head->oh_nsect;
|
||||
unsigned short nsect = head->oh_nsect;
|
||||
long size, rest;
|
||||
extern ind_t hard_alloc();
|
||||
extern ind_t alloc();
|
||||
|
||||
#ifdef SYMDBUG
|
||||
rest = nsect * sizeof(ind_t) + sizeof(ind_t) + sizeof(ind_t);
|
||||
#else SYMDBUG
|
||||
#else /* SYMDBUG */
|
||||
rest = nsect * sizeof(ind_t) + sizeof(ind_t);
|
||||
#endif SYMDBUG
|
||||
#endif /* SYMDBUG */
|
||||
/*
|
||||
* We already allocated space for the header, we now need
|
||||
* the section, name an string table.
|
||||
|
@ -251,8 +251,8 @@ indirect_alloc(head)
|
|||
struct outhead *head;
|
||||
{
|
||||
register int allopiece;
|
||||
ushort nsect = head->oh_nsect;
|
||||
ushort nrelo = head->oh_nrelo;
|
||||
unsigned short nsect = head->oh_nsect;
|
||||
unsigned short nrelo = head->oh_nrelo;
|
||||
ind_t sectindex = IND_SECT(*head);
|
||||
ind_t emitoff = IND_EMIT(*head);
|
||||
ind_t relooff = IND_RELO(*head);
|
||||
|
@ -260,7 +260,7 @@ indirect_alloc(head)
|
|||
ind_t dbugoff = IND_DBUG(*head);
|
||||
extern long objectsize;
|
||||
long dbugsize = objectsize - OFF_DBUG(*head);
|
||||
#endif SYMDBUG
|
||||
#endif /* SYMDBUG */
|
||||
|
||||
assert(incore);
|
||||
for (allopiece = ALLOEMIT; allopiece < ALLOEMIT + nsect; allopiece++) {
|
||||
|
@ -273,9 +273,9 @@ indirect_alloc(head)
|
|||
return putreloindex(relooff, (long)nrelo * sizeof(struct outrelo))
|
||||
&&
|
||||
putdbugindex(dbugoff, dbugsize);
|
||||
#else SYMDBUG
|
||||
#else /* SYMDBUG */
|
||||
return putreloindex(relooff, (long)nrelo * sizeof(struct outrelo));
|
||||
#endif SYMDBUG
|
||||
#endif /* SYMDBUG */
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -358,7 +358,7 @@ putdbugindex(dbugoff, ndbugbytes)
|
|||
}
|
||||
return FALSE;
|
||||
}
|
||||
#endif SYMDBUG
|
||||
#endif /* SYMDBUG */
|
||||
|
||||
/*
|
||||
* Compute addresses and read in. Remember that the contents of the sections
|
||||
|
@ -430,7 +430,7 @@ read_modul()
|
|||
struct outname *names;
|
||||
char *chars;
|
||||
ind_t sectindex, nameindex, charindex;
|
||||
ushort nsect, nname;
|
||||
unsigned short nsect, nname;
|
||||
long size;
|
||||
long nchar;
|
||||
extern ind_t hard_alloc();
|
||||
|
@ -446,9 +446,9 @@ read_modul()
|
|||
nchar = head->oh_nchar; charindex = IND_CHAR(*head);
|
||||
#ifdef SYMDBUG
|
||||
size = modulsize(head) - (nsect * sizeof(ind_t) + 2 * sizeof(ind_t));
|
||||
#else SYMDBUG
|
||||
#else /* SYMDBUG */
|
||||
size = modulsize(head) - (nsect * sizeof(ind_t) + sizeof(ind_t));
|
||||
#endif SYMDBUG
|
||||
#endif /* SYMDBUG */
|
||||
if (hard_alloc(ALLOMODL, size) == BADOFF)
|
||||
fatal("no space for module");
|
||||
|
||||
|
@ -490,7 +490,7 @@ align(size)
|
|||
* 5. the offset of the relocation table.
|
||||
#ifdef SYMDBUG
|
||||
* 6. the offset of the debugging information.
|
||||
#endif SYMDBUG
|
||||
#endif /* SYMDBUG */
|
||||
*/
|
||||
static long
|
||||
modulsize(head)
|
||||
|
@ -504,9 +504,9 @@ modulsize(head)
|
|||
#ifdef SYMDBUG
|
||||
sizeof(ind_t) + /* 5 */
|
||||
sizeof(ind_t); /* 6 */
|
||||
#else SYMDBUG
|
||||
#else /* SYMDBUG */
|
||||
sizeof(ind_t); /* 5 */
|
||||
#endif SYMDBUG
|
||||
#endif /* SYMDBUG */
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
|
|
@ -118,7 +118,7 @@ entername(name, hashval)
|
|||
* Return the index of `name' in the symbol table in the order in which
|
||||
* it was entered. We need a REAL index, not a byte offset.
|
||||
*/
|
||||
ushort
|
||||
unsigned
|
||||
indexof(name)
|
||||
struct outname *name;
|
||||
{
|
||||
|
|
|
@ -59,7 +59,7 @@ end_write()
|
|||
{
|
||||
register struct outname *name;
|
||||
register int sectindex;
|
||||
extern ushort NGlobals;
|
||||
extern unsigned short NGlobals;
|
||||
extern long NGChars;
|
||||
|
||||
assert(!incore);
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
#ifndef MAGIC
|
||||
#define MAGIC 07255
|
||||
#endif MAGIC
|
||||
#endif /* MAGIC */
|
||||
|
||||
FILE *load_fp;
|
||||
int eof;
|
||||
|
|
Loading…
Reference in a new issue