Do not use '#endif/#else xxx'; it is not allowed for ANSI C

This commit is contained in:
ceriel 1991-12-17 15:28:58 +00:00
parent 53c4951b29
commit df1ed9426d
67 changed files with 306 additions and 298 deletions

View file

@ -98,7 +98,7 @@ idfappfun(fun, opt)
} }
} }
} }
#endif IDF_DEBUG #endif /* IDF_DEBUG */
struct idf * struct idf *
str2idf(tg, cpy) str2idf(tg, cpy)

View file

@ -58,7 +58,7 @@ Now this is really ridiculous! You deserve what you get!!
#ifdef INP_TYPE #ifdef INP_TYPE
extern INP_TYPE INP_VAR; extern INP_TYPE INP_VAR;
#endif INP_TYPE #endif /* INP_TYPE */
#ifdef DEBUG #ifdef DEBUG
#define INP_PRIVATE #define INP_PRIVATE
@ -73,7 +73,7 @@ struct INP_buffer_header {
char *bh_ipp; /* current read pointer (= stacked ipp) */ char *bh_ipp; /* current read pointer (= stacked ipp) */
#ifdef INP_TYPE #ifdef INP_TYPE
INP_TYPE bh_i; /* user defined */ INP_TYPE bh_i; /* user defined */
#endif INP_TYPE #endif /* INP_TYPE */
File *bh_fd; /* A file descriptor in case of a file */ File *bh_fd; /* A file descriptor in case of a file */
char bh_eofreturned; /* set if we returned eof for this buffer */ 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]; char ib_text[INP_BUFSIZE+INP_NPUSHBACK];
}; };
# endif not INP_READ_IN_ONE #endif /* not INP_READ_IN_ONE */
char *_ipp; char *_ipp;
INP_PRIVATE struct INP_buffer_header *INP_head, *INP_free; 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 */ (*pbuf)[rsize] = '\0'; /* invoke loadbuf() at end */
return 1; return 1;
} }
#endif INP_READ_IN_ONE #endif /* INP_READ_IN_ONE */
#ifndef INP_READ_IN_ONE #ifndef INP_READ_IN_ONE
/* Input buffer supplying routines: INP_pbuf() /* Input buffer supplying routines: INP_pbuf()
@ -147,7 +147,7 @@ INP_pbuf()
*/ */
return &(ib->ib_text[INP_NPUSHBACK-1]); 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() /* Input buffer administration: INP_push_bh() and INP_pop_bh()
*/ */
@ -160,7 +160,7 @@ INP_push_bh()
bh->bh_ipp = _ipp; bh->bh_ipp = _ipp;
#ifdef INP_TYPE #ifdef INP_TYPE
bh->bh_i = INP_VAR; bh->bh_i = INP_VAR;
#endif INP_TYPE #endif /* INP_TYPE */
} }
bh = INP_free; bh = INP_free;
if (bh) INP_free = bh->bh_next; if (bh) INP_free = bh->bh_next;
@ -194,7 +194,7 @@ INP_pop_bh()
_ipp = bh->bh_ipp; /* restore previous input pointer */ _ipp = bh->bh_ipp; /* restore previous input pointer */
#ifdef INP_TYPE #ifdef INP_TYPE
INP_VAR = bh->bh_i; INP_VAR = bh->bh_i;
#endif INP_TYPE #endif /* INP_TYPE */
return 1; return 1;
} }
@ -217,7 +217,7 @@ INP_rdblock(fd, buf, n)
buf[*n] = '\0'; buf[*n] = '\0';
return 1; return 1;
} }
#endif not INP_READ_IN_ONE #endif /* not INP_READ_IN_ONE */
/* Miscellaneous routines : /* Miscellaneous routines :
INP_mk_filename() INP_mk_filename()
@ -258,7 +258,7 @@ InsertFile(filnam, table, result)
#ifdef INP_READ_IN_ONE #ifdef INP_READ_IN_ONE
char *text; char *text;
long size; long size;
#endif INP_READ_IN_ONE #endif /* INP_READ_IN_ONE */
File *fd = 0; File *fd = 0;
if (!filnam) fd = STDIN; if (!filnam) fd = STDIN;
@ -301,7 +301,7 @@ InsertFile(filnam, table, result)
} }
bh->bh_size = size; bh->bh_size = size;
_ipp = bh->bh_text = text; _ipp = bh->bh_text = text;
#else not INP_READ_IN_ONE #else /* not INP_READ_IN_ONE */
if ( if (
!(_ipp = bh->bh_text = INP_pbuf()) !(_ipp = bh->bh_text = INP_pbuf())
|| ||
@ -309,7 +309,7 @@ InsertFile(filnam, table, result)
if (fd != STDIN) sys_close(fd); if (fd != STDIN) sys_close(fd);
return 0; return 0;
} }
#endif INP_READ_IN_ONE #endif /* INP_READ_IN_ONE */
bh->bh_fd = fd; /* this is a file */ bh->bh_fd = fd; /* this is a file */
if (result) *result = filnam; if (result) *result = filnam;
return 1; 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 (FromFile && bh->bh_fd != STDIN) sys_close(bh->bh_fd);
#if INP_NPUSHBACK > 1 #if INP_NPUSHBACK > 1
@ -401,9 +401,9 @@ loadbuf()
ib = i_ptr->ib_next; ib = i_ptr->ib_next;
free((char *) i_ptr); free((char *) i_ptr);
i_ptr = ib; i_ptr = ib;
#else INP_READ_IN_ONE #else /* INP_READ_IN_ONE */
free(bh->bh_text); free(bh->bh_text);
#endif INP_READ_IN_ONE #endif /* INP_READ_IN_ONE */
} }
bh->bh_text = buf; bh->bh_text = buf;
bh->bh_size = INP_NPUSHBACK - 1; bh->bh_size = INP_NPUSHBACK - 1;

View file

@ -303,4 +303,4 @@ Error(fmt, s, ml) char *fmt, *s; mallink *ml; {
return 0; /* to satisfy lint */ return 0; /* to satisfy lint */
} }
#endif CHECK #endif /* CHECK */

View file

@ -49,7 +49,7 @@ typedef union _inf mallink;
#define _this_size_of(ml) ((ml)[-4+OFF_SET]).ui #define _this_size_of(ml) ((ml)[-4+OFF_SET]).ui
#ifndef CHECK #ifndef CHECK
#define N_WORDS 4 #define N_WORDS 4
#else ifdef CHECK #else /* ifdef CHECK */
#define _checksum_of(ml) ((ml)[-5+OFF_SET]).ui #define _checksum_of(ml) ((ml)[-5+OFF_SET]).ui
#define _print_of(ml) ((ml)[-6+OFF_SET]).ui #define _print_of(ml) ((ml)[-6+OFF_SET]).ui
#define _mark_of(ml) ((ml)[-7+OFF_SET]).ui #define _mark_of(ml) ((ml)[-7+OFF_SET]).ui

View file

@ -130,4 +130,4 @@ free_list_entry(i) {
*/ */
return free_list[i]; return free_list[i];
} }
#endif CHECK #endif /* CHECK */

View file

@ -31,7 +31,7 @@ extern char *SBRK();
#define MAX_SZ_IN_STORE (MAX_STORE*ALIGNMENT) #define MAX_SZ_IN_STORE (MAX_STORE*ALIGNMENT)
private do_free(), sell_out(); private do_free(), sell_out();
privatedata mallink *store[MAX_STORE]; privatedata mallink *store[MAX_STORE];
#endif STORE #endif /* STORE */
char * char *
malloc(n) malloc(n)
@ -57,7 +57,7 @@ malloc(n)
return block_of_mallink(ml); return block_of_mallink(ml);
} }
} }
#endif STORE #endif /* STORE */
check_work_empty("malloc, entry"); check_work_empty("malloc, entry");
@ -116,7 +116,7 @@ malloc(n)
sell_out(); sell_out();
ml = first_present(min_class); ml = first_present(min_class);
if (ml == MAL_NULL) { if (ml == MAL_NULL) {
#endif STORE #endif /* STORE */
/* In this emergency we try to locate a suitable /* In this emergency we try to locate a suitable
chunk in the free_list just below the safe chunk in the free_list just below the safe
one; some of these chunks may fit the job. one; some of these chunks may fit the job.
@ -130,7 +130,7 @@ malloc(n)
#ifdef STORE #ifdef STORE
} }
else started_working_on(ml); else started_working_on(ml);
#endif STORE #endif /* STORE */
} }
else { else {
assert((size_type)p == align((size_type)p)); assert((size_type)p == align((size_type)p));
@ -196,7 +196,7 @@ do_free(ml)
#ifndef STORE #ifndef STORE
if (free_of(ml)) return; if (free_of(ml)) return;
#endif STORE #endif /* STORE */
started_working_on(ml); started_working_on(ml);
set_free(ml, 1); set_free(ml, 1);
calc_checksum(ml); calc_checksum(ml);
@ -340,7 +340,7 @@ sell_out() {
} }
} }
#endif STORE #endif /* STORE */
#ifdef ASSERT #ifdef ASSERT
public public
@ -358,4 +358,4 @@ m_assert(fn, ln)
write(2, "\n", 1); write(2, "\n", 1);
maldump(1); maldump(1);
} }
#endif ASSERT #endif /* ASSERT */

View file

@ -391,4 +391,4 @@ wr_dbug(buf, size)
OUTWRITE(PARTDBUG, buf, size); OUTWRITE(PARTDBUG, buf, size);
} }
#endif SYMDBUG #endif /* SYMDBUG */

View file

@ -52,9 +52,9 @@ checkarg(arg, typset)
} }
return 1; return 1;
} }
#else not CHECKING #else /* not CHECKING */
#define checkarg(arg, x) 1 #define checkarg(arg, x) 1
#endif CHECKING #endif /* CHECKING */
/* EM_doinstr: An EM instruction /* EM_doinstr: An EM instruction
*/ */
@ -72,7 +72,7 @@ EM_doinstr(p)
return; return;
} }
} }
#endif CHECKING #endif /* CHECKING */
switch(parametertype) { switch(parametertype) {
case PAR_NO: case PAR_NO:
break; break;
@ -389,7 +389,7 @@ EM_mkcalls(line)
EM_error = "Message not ended"; EM_error = "Message not ended";
return 0; return 0;
} }
#endif CHECKING #endif /* CHECKING */
EM_error = 0; EM_error = 0;
switch(line->em_type) { switch(line->em_type) {
default: default:

View file

@ -92,9 +92,9 @@ static int wsize, psize; /* word size and pointer size */
#ifdef CHECKING #ifdef CHECKING
static char *argrange = "Argument range error"; static char *argrange = "Argument range error";
#define check(expr) (expr || EM_error || (EM_error = argrange)) #define check(expr) (expr || EM_error || (EM_error = argrange))
#else not CHECKING #else /* not CHECKING */
#define check(x) /* nothing */ #define check(x) /* nothing */
#endif CHECKING #endif /* CHECKING */
/* Error handling /* Error handling
*/ */
@ -117,9 +117,9 @@ xfatal(s)
} }
#include "readk.c" #include "readk.c"
#else not COMPACT #else /* not COMPACT */
#include "reade.c" #include "reade.c"
#endif COMPACT #endif /* COMPACT */
/* EM_open: Open input file, get magic word if COMPACT. /* EM_open: Open input file, get magic word if COMPACT.
*/ */
@ -147,9 +147,9 @@ EM_open(filename)
EM_error = "Illegal magic word"; EM_error = "Illegal magic word";
return 0; return 0;
} }
#else not COMPACT #else /* not COMPACT */
inithash(); /* initialize hashtable */ inithash(); /* initialize hashtable */
#endif COMPACT #endif /* COMPACT */
EM_initialized = 1; EM_initialized = 1;
return 1; return 1;
@ -228,7 +228,7 @@ EM_getinstr(p)
p->em_type = EM_FATAL; p->em_type = EM_FATAL;
return 0; return 0;
} }
#endif CHECKING #endif /* CHECKING */
if (!state) { /* All clear, get a new line */ if (!state) { /* All clear, get a new line */
gethead(p); gethead(p);
@ -247,14 +247,14 @@ EM_getinstr(p)
} }
#ifndef COMPACT #ifndef COMPACT
if (j == PAR_B) i = ptyp(sp_ilb2); if (j == PAR_B) i = ptyp(sp_ilb2);
#endif COMPACT #endif /* COMPACT */
if (j != PAR_NO) getarg(i, &(p->em_arg)); if (j != PAR_NO) getarg(i, &(p->em_arg));
#ifndef COMPACT #ifndef COMPACT
if (j == PAR_B) { if (j == PAR_B) {
p->em_cst = p->em_ilb; p->em_cst = p->em_ilb;
p->em_argtype = cst_ptyp; p->em_argtype = cst_ptyp;
} }
#endif COMPACT #endif /* COMPACT */
/* range checking /* range checking
*/ */
#ifdef CHECKING #ifdef CHECKING
@ -304,10 +304,10 @@ EM_getinstr(p)
check(p->em_cst >= 0 && p->em_cst <= 2); check(p->em_cst >= 0 && p->em_cst <= 2);
break; break;
} }
#endif CHECKING #endif /* CHECKING */
#ifndef COMPACT #ifndef COMPACT
checkeol(); checkeol();
#endif COMPACT #endif /* COMPACT */
} }
break; break;
case EM_PSEU: case EM_PSEU:
@ -334,7 +334,7 @@ EM_getinstr(p)
if (! EM_error) if (! EM_error)
EM_error="Third argument of hol/bss not 0/1"; EM_error="Third argument of hol/bss not 0/1";
} }
#endif CHECKING #endif /* CHECKING */
break; break;
case ps_exa: case ps_exa:
case ps_ina: case ps_ina:
@ -378,7 +378,7 @@ EM_getinstr(p)
if (p->em_opcode != ps_con && p->em_opcode != ps_rom) { if (p->em_opcode != ps_con && p->em_opcode != ps_rom) {
checkeol(); checkeol();
} }
#endif COMPACT #endif /* COMPACT */
break; break;
case EM_STARTMES: case EM_STARTMES:
startmes(p); startmes(p);

View file

@ -48,7 +48,7 @@ getarg(typset, ap)
register int i = getbyte(); register int i = getbyte();
#ifdef CHECKING #ifdef CHECKING
int argtyp; int argtyp;
#endif CHECKING #endif /* CHECKING */
ap->ema_argtype = 0; ap->ema_argtype = 0;
switch(i) { switch(i) {
@ -75,7 +75,7 @@ getarg(typset, ap)
EM_error = "Illegal data label"; EM_error = "Illegal data label";
break; break;
} }
#endif CHECKING #endif /* CHECKING */
break; break;
case sp_ilb1: /* Instruction label encoded in one byte */ case sp_ilb1: /* Instruction label encoded in one byte */
@ -91,7 +91,7 @@ getarg(typset, ap)
EM_error = "Illegal instruction label"; EM_error = "Illegal instruction label";
break; break;
} }
#endif CHECKING #endif /* CHECKING */
break; break;
case sp_cst2: /* A cst encoded in two bytes */ case sp_cst2: /* A cst encoded in two bytes */
@ -180,11 +180,11 @@ getarg(typset, ap)
if (argtyp == sp_cend) { if (argtyp == sp_cend) {
ap->ema_argtype = 0; ap->ema_argtype = 0;
} }
#else not CHECKING #else /* not CHECKING */
if (i == sp_cend) { if (i == sp_cend) {
ap->ema_argtype = 0; ap->ema_argtype = 0;
} }
#endif CHECKING #endif /* CHECKING */
} }
#ifdef CHECKING #ifdef CHECKING
@ -209,7 +209,7 @@ checkident(s)
} }
return 1; return 1;
} }
#endif CHECKING #endif /* CHECKING */
/* getstring: read a string from the input /* getstring: read a string from the input
*/ */
@ -231,7 +231,7 @@ getstring(isident)
s->length = 0; s->length = 0;
return s; return s;
} }
#endif CHECKING #endif /* CHECKING */
if (n > s->maxlen) { if (n > s->maxlen) {
if (! s->maxlen) { if (! s->maxlen) {
@ -253,7 +253,7 @@ getstring(isident)
EM_error = "Illegal identifier"; EM_error = "Illegal identifier";
} }
} }
#endif CHECKING #endif /* CHECKING */
return s; return s;
} }
@ -305,7 +305,7 @@ gethead(p)
if (p->em_ilb > 32767 && !EM_error) { if (p->em_ilb > 32767 && !EM_error) {
EM_error = "Illegal instruction label definition"; EM_error = "Illegal instruction label definition";
} }
#endif CHECKING #endif /* CHECKING */
break; break;
case sp_dlb1: /* Numeric data label */ case sp_dlb1: /* Numeric data label */
@ -322,7 +322,7 @@ gethead(p)
if (p->em_dlb > 32767 && !EM_error) { if (p->em_dlb > 32767 && !EM_error) {
EM_error = "Illegal data label definition"; EM_error = "Illegal data label definition";
} }
#endif CHECKING #endif /* CHECKING */
break; break;
case sp_dnam: /* Non-numeric data label */ case sp_dnam: /* Non-numeric data label */

View file

@ -26,7 +26,7 @@
# ifndef NORCSID # ifndef NORCSID
static string rcsid3 = "$Header$"; static string rcsid3 = "$Header$";
# endif NORCSID #endif /* NORCSID */
/* /*
* Some codestrings used more than once * Some codestrings used more than once
@ -448,11 +448,12 @@ genprototypes(f)
for (i = 0; i < nnonterms; i++) { for (i = 0; i < nnonterms; i++) {
if (! IN(f->f_used, i)) continue; if (! IN(f->f_used, i)) continue;
p = &nonterms[i]; p = &nonterms[i];
if (!(p->n_flags & GENSTATIC)) continue;
if (g_gettype(p->n_rule) == EORULE && if (g_gettype(p->n_rule) == EORULE &&
getntparams(p) == 0) { getntparams(p) == 0) {
continue; continue;
} }
if (p->n_flags & GENSTATIC) fputs("static ", fpars); fputs("static ", fpars);
genextname(i, p->n_name, fpars); genextname(i, p->n_name, fpars);
fputs("();\n", fpars); fputs("();\n", fpars);
} }
@ -1047,7 +1048,7 @@ genswhead(q, rep_kind, rep_count, safety, ispushed) register p_term q; {
getaction(0); getaction(0);
fprintf(f, ") goto L_%d;\n", hulp1); fprintf(f, ") goto L_%d;\n", hulp1);
if (q->t_flags & NOCONF) { if (q->t_flags & NOCONF) {
fputs("#endif ___NOCONFLICT___\n", f); fputs("#endif /* ___NOCONFLICT___ */\n", f);
} }
} }
if (safeterm == 0 || (!onerror && safeterm <= SAFESCANDONE)) { if (safeterm == 0 || (!onerror && safeterm <= SAFESCANDONE)) {

View file

@ -55,7 +55,7 @@ int ntneeded;
int ntprint; int ntprint;
# ifndef NDEBUG # ifndef NDEBUG
int debug; int debug;
# endif not NDEBUG #endif /* not NDEBUG */
p_file files; p_file files;
p_file maxfiles; p_file maxfiles;
p_file pfile; p_file pfile;

View file

@ -91,7 +91,7 @@ main(argc,argv) register string argv[]; {
} }
incl_file = ++arg; incl_file = ++arg;
break; break;
# endif not NDEBUG #endif /* not NDEBUG */
case 'x': case 'x':
case 'X': case 'X':
ntneeded = 1; ntneeded = 1;

View file

@ -765,4 +765,4 @@ enter_name(namep)
} }
tnum++; tnum++;
} }
#endif AAL #endif /* AAL */

View file

@ -2,4 +2,4 @@ distr:
echo '#ifndef lint' > Version.c echo '#ifndef lint' > Version.c
echo 'char Version[] = "ACK C preprocessor Version XXX";' | \ echo 'char Version[] = "ACK C preprocessor Version XXX";' | \
sed "s/XXX/`RC -i`/" >> Version.c sed "s/XXX/`RC -i`/" >> Version.c
echo '#endif lint' >> Version.c echo '#endif' >> Version.c

View file

@ -118,7 +118,7 @@ copyact(ch1, ch2, level)
case ']': case ']':
error("unbalanced parenthesis"); error("unbalanced parenthesis");
break; break;
#endif __MATCHING_PAR__ #endif /* __MATCHING_PAR__ */
case '(': case '(':
copyact('(', ')', level+1); copyact('(', ')', level+1);
@ -136,7 +136,7 @@ copyact(ch1, ch2, level)
case '[': case '[':
copyact('[', ']', level+1); copyact('[', ']', level+1);
break; break;
#endif __MATCHING_PAR__ #endif /* __MATCHING_PAR__ */
case '\n': case '\n':
LineNumber++; LineNumber++;

View file

@ -52,4 +52,4 @@ struct tokenname tkfunny[] = { /* internal keywords */
{ERRONEOUS, "erroneous"}, {ERRONEOUS, "erroneous"},
{0, ""} {0, ""}
}; };
#endif ____ #endif /* ____ */

View file

@ -149,4 +149,4 @@ OUTENTITIES()
} }
} }
#endif TRACE #endif /* TRACE */

View file

@ -855,4 +855,4 @@ FILE *file;
} \ } \
while ( 0 ) while ( 0 )
#endif ACK_MOD #endif /* ACK_MOD */

View file

@ -29,7 +29,7 @@ char *Malloc(sz, descr)
} }
} }
} }
#endif DB_MALLOC #endif /* DB_MALLOC */
return new; return new;
} }

View file

@ -67,7 +67,7 @@ core_dump()
fwrite(FRA_sh, 1, (int)(FRALimit), core_file); fwrite(FRA_sh, 1, (int)(FRALimit), core_file);
fwrite(data_sh, 1, (int)(HL), core_file); fwrite(data_sh, 1, (int)(HL), core_file);
fwrite(stack_sh, 1, (int)(ML+1-SL), core_file); fwrite(stack_sh, 1, (int)(ML+1-SL), core_file);
#endif LOGGING #endif /* LOGGING */
fclose(core_file); fclose(core_file);
core_file = 0; core_file = 0;

View file

@ -22,7 +22,7 @@ extern size maxheap; /* from main.c */
#ifdef LOGGING #ifdef LOGGING
char *data_sh; /* shadowbytes */ char *data_sh; /* shadowbytes */
#endif LOGGING #endif /* LOGGING */
PRIVATE warn_dtbits(); PRIVATE warn_dtbits();
@ -37,7 +37,7 @@ init_data(hb)
#ifdef LOGGING #ifdef LOGGING
data_sh = Malloc((size)p2i(HL), "shadowspace for data"); data_sh = Malloc((size)p2i(HL), "shadowspace for data");
dt_clear_area(i2p(0), HL); dt_clear_area(i2p(0), HL);
#endif LOGGING #endif /* LOGGING */
} }
@ -77,14 +77,14 @@ newHP(ap)
#ifdef LOGGING #ifdef LOGGING
data_sh = Realloc(data_sh, (size)(p2i(HL) + 1), data_sh = Realloc(data_sh, (size)(p2i(HL) + 1),
"shadowspace for heap"); "shadowspace for heap");
#endif LOGGING #endif /* LOGGING */
} }
#ifdef LOGGING #ifdef LOGGING
if (p > HP) { if (p > HP) {
dt_clear_area(HP, p); dt_clear_area(HP, p);
} }
#endif LOGGING #endif /* LOGGING */
HP = p; HP = p;
} }
@ -145,7 +145,7 @@ dt_stn(addr, al, n)
#ifdef LOGGING #ifdef LOGGING
/* a psize zero is ambiguous */ /* a psize zero is ambiguous */
int sh_flags = (l == 0 && n == psize) ? (SH_INT|SH_DATAP) : SH_INT; 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)); LOG(("@g6 dt_stn(%lu, %lu, %lu)", addr, l, n));
ch_in_data(addr, n); ch_in_data(addr, n);
@ -155,7 +155,7 @@ dt_stn(addr, al, n)
data_loc(addr) = (char) l; data_loc(addr) = (char) l;
#ifdef LOGGING #ifdef LOGGING
dt_sh(addr) = sh_flags; dt_sh(addr) = sh_flags;
#endif LOGGING #endif /* LOGGING */
l = l>>8; l = l>>8;
} }
} }
@ -169,7 +169,7 @@ dt_stw(addr, al)
#ifdef LOGGING #ifdef LOGGING
/* a psize zero is ambiguous */ /* a psize zero is ambiguous */
int sh_flags = (l == 0 && wsize == psize) ? (SH_INT|SH_DATAP) : SH_INT; 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)); LOG(("@g6 dt_stw(%lu, %lu)", addr, l));
ch_in_data(addr, wsize); ch_in_data(addr, wsize);
@ -179,7 +179,7 @@ dt_stw(addr, al)
data_loc(addr) = (char) l; data_loc(addr) = (char) l;
#ifdef LOGGING #ifdef LOGGING
dt_sh(addr) = sh_flags; dt_sh(addr) = sh_flags;
#endif LOGGING #endif /* LOGGING */
l = l>>8; l = l>>8;
} }
} }
@ -207,7 +207,7 @@ dt_stf(addr, f, n)
dt_fl(addr); dt_fl(addr);
} }
} }
#endif NOFLOAT #endif /* NOFLOAT */
/************************************************************************ /************************************************************************
* Data load division. * * Data load division. *
@ -236,7 +236,7 @@ ptr dt_lddp(addr)
warning(WGDPEXP); warning(WGDPEXP);
warn_dtbits(addr, psize); warn_dtbits(addr, psize);
} }
#endif LOGGING #endif /* LOGGING */
p = p_in_data(addr); p = p_in_data(addr);
LOG(("@g6 dt_lddp() returns %lu", p)); LOG(("@g6 dt_lddp() returns %lu", p));
@ -257,7 +257,7 @@ ptr dt_ldip(addr)
warning(WGIPEXP); warning(WGIPEXP);
warn_dtbits(addr, psize); warn_dtbits(addr, psize);
} }
#endif LOGGING #endif /* LOGGING */
p = p_in_data(addr); p = p_in_data(addr);
LOG(("@g6 dt_ldip() returns %lu", p)); LOG(("@g6 dt_ldip() returns %lu", p));
@ -280,7 +280,7 @@ unsigned long dt_ldu(addr, n)
warning(n == 1 ? WGCEXP : WGIEXP); warning(n == 1 ? WGCEXP : WGIEXP);
warn_dtbits(addr, n); warn_dtbits(addr, n);
} }
#endif LOGGING #endif /* LOGGING */
addr += n-1; addr += n-1;
for (i = (int) n-1; i >= 0; i--, addr--) { for (i = (int) n-1; i >= 0; i--, addr--) {
@ -305,7 +305,7 @@ unsigned long dt_lduw(addr)
warning(WGIEXP); warning(WGIEXP);
warn_dtbits(addr, wsize); warn_dtbits(addr, wsize);
} }
#endif LOGGING #endif /* LOGGING */
addr += wsize-1; addr += wsize-1;
for (i = (int) wsize-1; i >= 0; i--, addr--) { for (i = (int) wsize-1; i >= 0; i--, addr--) {
@ -331,7 +331,7 @@ long dt_lds(addr, n)
warning(n == 1 ? WGCEXP : WGIEXP); warning(n == 1 ? WGCEXP : WGIEXP);
warn_dtbits(addr, n); warn_dtbits(addr, n);
} }
#endif LOGGING #endif /* LOGGING */
addr += n-2; addr += n-2;
l = btos(data_loc(addr + 1)); l = btos(data_loc(addr + 1));
@ -357,7 +357,7 @@ long dt_ldsw(addr)
warning(WGIEXP); warning(WGIEXP);
warn_dtbits(addr, wsize); warn_dtbits(addr, wsize);
} }
#endif LOGGING #endif /* LOGGING */
addr += wsize-2; addr += wsize-2;
l = btos(data_loc(addr + 1)); l = btos(data_loc(addr + 1));
@ -395,7 +395,7 @@ dt_mvd(d2, d1, n) /* d1 -> d2 */
data_loc(d2) = data_loc(d1); data_loc(d2) = data_loc(d1);
#ifdef LOGGING #ifdef LOGGING
dt_sh(d2) = dt_sh(d1) & ~SH_PROT; 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); data_loc(d) = stack_loc(s);
#ifdef LOGGING #ifdef LOGGING
dt_sh(d) = st_sh(s) & ~SH_PROT; dt_sh(d) = st_sh(s) & ~SH_PROT;
#endif LOGGING #endif /* LOGGING */
} }
} }
@ -452,5 +452,5 @@ PRIVATE warn_dtbits(addr, n)
warningcont(WWASINSP); warningcont(WWASINSP);
} }
#endif LOGGING #endif /* LOGGING */

View file

@ -18,7 +18,7 @@
#ifndef NOFLOAT #ifndef NOFLOAT
extern double fpop(); extern double fpop();
#endif NOFLOAT #endif /* NOFLOAT */
PRIVATE compare_obj(); PRIVATE compare_obj();
@ -45,9 +45,9 @@ DoCMF(l)
LOG(("@T6 DoCMF(%ld)", l)); LOG(("@T6 DoCMF(%ld)", l));
spoilFRA(); spoilFRA();
wpush((long)(t < s ? 1 : t > s ? -1 : 0)); wpush((long)(t < s ? 1 : t > s ? -1 : 0));
#else NOFLOAT #else /* NOFLOAT */
nofloat(); nofloat();
#endif NOFLOAT #endif /* NOFLOAT */
} }
DoCMU(l) DoCMU(l)
@ -160,7 +160,7 @@ PRIVATE compare_obj(obj_size)
comp_res = 1; comp_res = 1;
break; break;
} }
#endif LOGGING #endif /* LOGGING */
if (stack_loc(addr1) != stack_loc(addr2)) { if (stack_loc(addr1) != stack_loc(addr2)) {
comp_res = 1; comp_res = 1;
break; break;

View file

@ -16,7 +16,7 @@
#ifndef NOFLOAT #ifndef NOFLOAT
extern double fpop(); extern double fpop();
#endif NOFLOAT #endif /* NOFLOAT */
DoCII() DoCII()
{ {
@ -163,9 +163,9 @@ DoCFI()
default: default:
wtrap(WILLCONV, EILLINS); wtrap(WILLCONV, EILLINS);
} }
#else NOFLOAT #else /* NOFLOAT */
nofloat(); nofloat();
#endif NOFLOAT #endif /* NOFLOAT */
} }
DoCIF() DoCIF()
@ -198,9 +198,9 @@ DoCIF()
default: default:
wtrap(WILLCONV, EILLINS); wtrap(WILLCONV, EILLINS);
} }
#else NOFLOAT #else /* NOFLOAT */
nofloat(); nofloat();
#endif NOFLOAT #endif /* NOFLOAT */
} }
DoCUF() DoCUF()
@ -244,9 +244,9 @@ DoCUF()
default: default:
wtrap(WILLCONV, EILLINS); wtrap(WILLCONV, EILLINS);
} }
#else NOFLOAT #else /* NOFLOAT */
nofloat(); nofloat();
#endif NOFLOAT #endif /* NOFLOAT */
} }
DoCFF() DoCFF()
@ -271,9 +271,9 @@ DoCFF()
default: default:
wtrap(WILLCONV, EILLINS); wtrap(WILLCONV, EILLINS);
} }
#else NOFLOAT #else /* NOFLOAT */
nofloat(); nofloat();
#endif NOFLOAT #endif /* NOFLOAT */
} }
DoCIU() DoCIU()
@ -377,7 +377,7 @@ DoCFU()
default: default:
wtrap(WILLCONV, EILLINS); wtrap(WILLCONV, EILLINS);
} }
#else NOFLOAT #else /* NOFLOAT */
nofloat(); nofloat();
#endif NOFLOAT #endif /* NOFLOAT */
} }

View file

@ -18,7 +18,16 @@
extern double fpop(); 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) #define SMALL (1.0/MAXDOUBLE)
PRIVATE double adf(), sbf(), mlf(), dvf(); PRIVATE double adf(), sbf(), mlf(), dvf();
@ -26,7 +35,7 @@ PRIVATE double ttttp();
PRIVATE double floor(), fabs(); PRIVATE double floor(), fabs();
PRIVATE fef(), fif(); PRIVATE fef(), fif();
#endif NOFLOAT #endif /* NOFLOAT */
DoADF(l) DoADF(l)
register size l; register size l;
@ -38,9 +47,9 @@ DoADF(l)
LOG(("@F6 DoADF(%ld)", l)); LOG(("@F6 DoADF(%ld)", l));
spoilFRA(); spoilFRA();
fpush(adf(fpop(l), t), l); fpush(adf(fpop(l), t), l);
#else NOFLOAT #else /* NOFLOAT */
nofloat(); nofloat();
#endif NOFLOAT #endif /* NOFLOAT */
} }
DoSBF(l) DoSBF(l)
@ -53,9 +62,9 @@ DoSBF(l)
LOG(("@F6 DoSBF(%ld)", l)); LOG(("@F6 DoSBF(%ld)", l));
spoilFRA(); spoilFRA();
fpush(sbf(fpop(l), t), l); fpush(sbf(fpop(l), t), l);
#else NOFLOAT #else /* NOFLOAT */
nofloat(); nofloat();
#endif NOFLOAT #endif /* NOFLOAT */
} }
DoMLF(l) DoMLF(l)
@ -68,9 +77,9 @@ DoMLF(l)
LOG(("@F6 DoMLF(%ld)", l)); LOG(("@F6 DoMLF(%ld)", l));
spoilFRA(); spoilFRA();
fpush(mlf(fpop(l), t), l); fpush(mlf(fpop(l), t), l);
#else NOFLOAT #else /* NOFLOAT */
nofloat(); nofloat();
#endif NOFLOAT #endif /* NOFLOAT */
} }
DoDVF(l) DoDVF(l)
@ -83,9 +92,9 @@ DoDVF(l)
LOG(("@F6 DoDVF(%ld)", l)); LOG(("@F6 DoDVF(%ld)", l));
spoilFRA(); spoilFRA();
fpush(dvf(fpop(l), t), l); fpush(dvf(fpop(l), t), l);
#else NOFLOAT #else /* NOFLOAT */
nofloat(); nofloat();
#endif NOFLOAT #endif /* NOFLOAT */
} }
DoNGF(l) DoNGF(l)
@ -98,9 +107,9 @@ DoNGF(l)
LOG(("@F6 DoNGF(%ld)", l)); LOG(("@F6 DoNGF(%ld)", l));
spoilFRA(); spoilFRA();
fpush(-t, l); fpush(-t, l);
#else NOFLOAT #else /* NOFLOAT */
nofloat(); nofloat();
#endif NOFLOAT #endif /* NOFLOAT */
} }
DoFIF(l) DoFIF(l)
@ -113,9 +122,9 @@ DoFIF(l)
LOG(("@F6 DoFIF(%ld)", l)); LOG(("@F6 DoFIF(%ld)", l));
spoilFRA(); spoilFRA();
fif(fpop(l), t, l); fif(fpop(l), t, l);
#else NOFLOAT #else /* NOFLOAT */
nofloat(); nofloat();
#endif NOFLOAT #endif /* NOFLOAT */
} }
DoFEF(l) DoFEF(l)
@ -126,9 +135,9 @@ DoFEF(l)
LOG(("@F6 DoFEF(%ld)", l)); LOG(("@F6 DoFEF(%ld)", l));
spoilFRA(); spoilFRA();
fef(fpop(arg_wf(l)), l); fef(fpop(arg_wf(l)), l);
#else NOFLOAT #else /* NOFLOAT */
nofloat(); nofloat();
#endif NOFLOAT #endif /* NOFLOAT */
} }
#ifndef NOFLOAT #ifndef NOFLOAT
@ -440,11 +449,11 @@ BadFloat:
return (0.0); return (0.0);
} }
#else NOFLOAT #else /* NOFLOAT */
nofloat() { nofloat() {
fatal("attempt to execute a floating point instruction on an EM machine without FP"); fatal("attempt to execute a floating point instruction on an EM machine without FP");
} }
#endif NOFLOAT #endif /* NOFLOAT */

View file

@ -111,10 +111,10 @@ DoZRF(l)
LOG(("@Z6 DoZRF(%ld)", l)); LOG(("@Z6 DoZRF(%ld)", l));
spoilFRA(); spoilFRA();
fpush(0.0, arg_wf(l)); fpush(0.0, arg_wf(l));
#else NOFLOAT #else /* NOFLOAT */
arg = arg; arg = arg;
nofloat(); nofloat();
#endif NOFLOAT #endif /* NOFLOAT */
} }
DoZER(l) DoZER(l)

View file

@ -223,7 +223,7 @@ PRIVATE long sli(w1, w2, nbytes) /* w1 << w2 */
warning(WSHLARGE); warning(WSHLARGE);
w2 = nbytes*8 - 1; w2 = nbytes*8 - 1;
} }
#endif LOGGING #endif /* LOGGING */
if (!(IgnMask&BIT(EIOVFL))) { if (!(IgnMask&BIT(EIOVFL))) {
/* check overflow */ /* check overflow */
@ -256,7 +256,7 @@ PRIVATE long sri(w1, w2, nbytes) /* w1 >> w2 */
w2 = nbytes*8 - 1; w2 = nbytes*8 - 1;
} }
} }
#endif LOGGING #endif /* LOGGING */
/* calculate result */ /* calculate result */
return (w1 >> w2); return (w1 >> w2);

View file

@ -17,13 +17,13 @@
#ifdef LOGGING #ifdef LOGGING
extern int must_test; extern int must_test;
#endif LOGGING #endif /* LOGGING */
#ifdef LOGGING #ifdef LOGGING
#define check_def(p,l) if (!st_sh(p) || !st_sh(p+l)) {warning(WUNLOG);} #define check_def(p,l) if (!st_sh(p) || !st_sh(p+l)) {warning(WUNLOG);}
#else #else
#define check_def(p,l) #define check_def(p,l)
#endif LOGGING #endif /* LOGGING */
DoAND(l) DoAND(l)
register size l; register size l;
@ -113,7 +113,7 @@ DoROL(l)
t = l*8 - 1; t = l*8 - 1;
} }
} }
#endif LOGGING #endif /* LOGGING */
/* calculate result */ /* calculate result */
while (t--) { while (t--) {
@ -146,7 +146,7 @@ DoROR(l)
t = l*8 - 1; t = l*8 - 1;
} }
} }
#endif LOGGING #endif /* LOGGING */
/* calculate result */ /* calculate result */
while (t--) { while (t--) {

View file

@ -103,7 +103,7 @@ PRIVATE lfr(sz)
if (sz != FRASize) { if (sz != FRASize) {
warning(FRASize < sz ? WRFUNSML : WRFUNLAR); warning(FRASize < sz ? WRFUNSML : WRFUNLAR);
} }
#endif LOGGING #endif /* LOGGING */
pushFRA(sz); pushFRA(sz);
spoilFRA(); spoilFRA();

View file

@ -25,7 +25,7 @@
#define check_seg(s1,s2,w) #define check_seg(s1,s2,w)
#endif SEGCHECK #endif /* SEGCHECK */
DoADP(l) DoADP(l)
register long l; register long l;

View file

@ -25,7 +25,7 @@
#ifdef LOGGING #ifdef LOGGING
extern int must_test; extern int must_test;
#endif LOGGING #endif /* LOGGING */
#define adu(w1,w2) (unsigned long)(w1 + w2) #define adu(w1,w2) (unsigned long)(w1 + w2)
#define sbu(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; w2 = nbytes*8 - 1;
} }
} }
#endif LOGGING #endif /* LOGGING */
/* calculate result */ /* calculate result */
return (w1 << w2); return (w1 << w2);
@ -168,7 +168,7 @@ PRIVATE unsigned long sru(w1, w2, nbytes) /* w1 >> w2 */
w2 = nbytes*8 - 1; w2 = nbytes*8 - 1;
} }
} }
#endif LOGGING #endif /* LOGGING */
/* calculate result */ /* calculate result */
return (w1 >> w2); return (w1 >> w2);

View file

@ -639,5 +639,5 @@ displ_sh(shadow, byte) /* transient */
return (buf); return (buf);
} }
#endif LOGGING #endif /* LOGGING */

View file

@ -9,13 +9,13 @@
#ifdef LOGGING #ifdef LOGGING
char *FRA_sh; /* shadowbytes */ char *FRA_sh; /* shadowbytes */
#endif LOGGING #endif /* LOGGING */
init_FRA() { init_FRA() {
FRA = Malloc(FRALimit, "Function Return Area"); FRA = Malloc(FRALimit, "Function Return Area");
#ifdef LOGGING #ifdef LOGGING
FRA_sh = Malloc(FRALimit, "shadowspace for Function Return Area"); FRA_sh = Malloc(FRALimit, "shadowspace for Function Return Area");
#endif LOGGING #endif /* LOGGING */
FRA_def = UNDEFINED; /* set FRA illegal */ FRA_def = UNDEFINED; /* set FRA illegal */
} }
@ -32,7 +32,7 @@ pushFRA(sz)
stack_loc(SP + i) = FRA[i]; stack_loc(SP + i) = FRA[i];
#ifdef LOGGING #ifdef LOGGING
st_sh(SP + i) = (i < FRASize ? FRA_sh[i] : UNDEFINED); 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); FRA[i] = stack_loc(SP + i);
#ifdef LOGGING #ifdef LOGGING
FRA_sh[i] = st_sh(SP + i); FRA_sh[i] = st_sh(SP + i);
#endif LOGGING #endif /* LOGGING */
} }
st_dec(max(sz, wsize)); st_dec(max(sz, wsize));
} }

View file

@ -20,13 +20,13 @@ typedef unsigned long ptr; /* pointer to EM address */
#define p2i(p) (p) /* convert pointer to index */ #define p2i(p) (p) /* convert pointer to index */
#define i2p(p) (ptr)(p) /* convert index to pointer */ #define i2p(p) (ptr)(p) /* convert index to pointer */
#else UNSIGNED #else /* UNSIGNED */
typedef char *ptr; /* pointer to EM address */ typedef char *ptr; /* pointer to EM address */
#define p2i(p) (long)(p) /* convert pointer to index */ #define p2i(p) (long)(p) /* convert pointer to index */
#define i2p(p) (ptr)(p) /* convert index to pointer */ #define i2p(p) (ptr)(p) /* convert index to pointer */
#endif UNSIGNED #endif /* UNSIGNED */
/* The EM size is an integer type; a cast suffices */ /* The EM size is an integer type; a cast suffices */
typedef long size; typedef long size;

View file

@ -198,5 +198,5 @@ st_clear_area(from, to)
st_undef(a); st_undef(a);
} }
} }
#endif LOGGING #endif /* LOGGING */

View file

@ -31,7 +31,7 @@ incr_mess_id()
#ifdef LOGGING #ifdef LOGGING
extern long inr; /* from log.c */ extern long inr; /* from log.c */
#endif LOGGING #endif /* LOGGING */
/******** General file handling ********/ /******** General file handling ********/
@ -102,7 +102,7 @@ init_ofiles(firsttime)
#ifdef LOGGING #ifdef LOGGING
open_log(firsttime); open_log(firsttime);
#endif LOGGING #endif /* LOGGING */
} }
/*VARARGS0*/ /*VARARGS0*/
@ -146,7 +146,7 @@ close_down(rc)
#ifdef LOGGING #ifdef LOGGING
close_log(); close_log();
#endif LOGGING #endif /* LOGGING */
exit(rc); exit(rc);
} }
@ -188,9 +188,9 @@ char *position() /* transient */
#ifdef LOGGING #ifdef LOGGING
sprintf(buff, "\"%s\", line %ld, INR = %ld", fn, getLIN(), inr); sprintf(buff, "\"%s\", line %ld, INR = %ld", fn, getLIN(), inr);
#else LOGGING #else /* LOGGING */
sprintf(buff, "\"%s\", line %ld", fn, getLIN()); sprintf(buff, "\"%s\", line %ld", fn, getLIN());
#endif LOGGING #endif /* LOGGING */
return buff; return buff;
} }

View file

@ -314,5 +314,5 @@ PRIVATE long longpar(var, def)
return (res ? atol(res) : def); return (res ? atol(res) : def);
} }
#endif LOGGING #endif /* LOGGING */

View file

@ -20,5 +20,5 @@ extern int logging; /* set if logging in progress */
#define LOG(a) #define LOG(a)
#endif LOGGING #endif /* LOGGING */

View file

@ -25,7 +25,7 @@
#define V7IOSETC (('t'<<8)|17) #define V7IOSETC (('t'<<8)|17)
#define V7IOGETC (('t'<<8)|18) #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 */ long count; /* might get ALIGNMENT problems with this one */
int ldisc; /* 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 */ int pgrp; /* might get ALIGNMENT problems with this one */
#endif V7IOCTL #endif /* V7IOCTL */
struct tchars tc_buf; struct tchars tc_buf;
#ifndef V7IOCTL #ifndef V7IOCTL
struct ltchars ltc_buf; struct ltchars ltc_buf;
#endif V7IOCTL #endif /* V7IOCTL */
#endif BSD_X #endif /* BSD_X */
#ifdef V7IOCTL #ifdef V7IOCTL
@ -92,14 +92,14 @@ int do_ioctl(fd, req, addr)
case V7IOGETC: case V7IOGETC:
req = TIOCGETC; req = TIOCGETC;
break; break;
#endif BSD_X #endif /* BSD_X */
default: default:
einval(WBADIOCTL); einval(WBADIOCTL);
return (-1); /* Fake return value */ return (-1); /* Fake return value */
} }
#endif V7IOCTL #endif /* V7IOCTL */
switch (req) { switch (req) {
@ -120,7 +120,7 @@ int do_ioctl(fd, req, addr)
case TIOCSETP: case TIOCSETP:
#ifdef BSD4_1 /* from system.h */ #ifdef BSD4_1 /* from system.h */
case TIOCSETN: case TIOCSETN:
#endif BSD4_1 #endif /* BSD4_1 */
/* set fd's parameters according to sgtty buffer */ /* set fd's parameters according to sgtty buffer */
/* pointed to (addr), so first fill sg_buf properly. */ /* pointed to (addr), so first fill sg_buf properly. */
if ( !mem2sgtty(addr, &sg_buf) if ( !mem2sgtty(addr, &sg_buf)
@ -289,8 +289,8 @@ int do_ioctl(fd, req, addr)
} }
break; break;
#endif V7IOCTL #endif /* V7IOCTL */
#endif BSD_X #endif /* BSD_X */
default: default:
einval(WBADIOCTL); einval(WBADIOCTL);

View file

@ -35,7 +35,7 @@ size maxheap; /* if set, max heap size */
#ifdef LOGGING #ifdef LOGGING
extern long inr; /* from log.c */ extern long inr; /* from log.c */
#endif LOGGING #endif /* LOGGING */
PRIVATE char *dflt_av[] = {"e.out", 0}; /* default arguments */ PRIVATE char *dflt_av[] = {"e.out", 0}; /* default arguments */
@ -95,14 +95,14 @@ main(argc, argv)
else if (logarg(argv[i])) { else if (logarg(argv[i])) {
/* interesting for the logging machine */ /* interesting for the logging machine */
} }
#endif LOGGING #endif /* LOGGING */
else break; else break;
} }
#ifdef LOGGING #ifdef LOGGING
/* Initialize the logging machine */ /* Initialize the logging machine */
init_log(); init_log();
#endif LOGGING #endif /* LOGGING */
if (argc > i) if (argc > i)
init(argc - i, argv + i); init(argc - i, argv + i);
@ -127,7 +127,7 @@ main(argc, argv)
#ifdef NOFLOAT #ifdef NOFLOAT
if (FLAGS&FB_REALS) if (FLAGS&FB_REALS)
warning(WFLUSED); warning(WFLUSED);
#endif NOFLOAT #endif /* NOFLOAT */
if (FLAGS&FB_EXTRA) if (FLAGS&FB_EXTRA)
warning(WEXTRIGN); warning(WEXTRIGN);
@ -145,7 +145,7 @@ main(argc, argv)
/* log this instruction */ /* log this instruction */
logging = 1; logging = 1;
} }
#endif LOGGING #endif /* LOGGING */
LOG(("@x9 PC = %lu OPCODE = %lu", PC, LOG(("@x9 PC = %lu OPCODE = %lu", PC,
btol(text_loc(PC)) < SECONDARY ? btol(text_loc(PC)) < SECONDARY ?
@ -174,7 +174,7 @@ main(argc, argv)
#ifdef LOGGING #ifdef LOGGING
log_eoi(); log_eoi();
#endif LOGGING #endif /* LOGGING */
} }
if (must_tally) { if (must_tally) {

View file

@ -25,25 +25,25 @@ extern int fd_limit; /* from io.c */
#ifdef BSD_X /* from system.h */ #ifdef BSD_X /* from system.h */
#include <sys/timeb.h> #include <sys/timeb.h>
#endif BSD_X #endif /* BSD_X */
#ifdef SYS_V #ifdef SYS_V
struct timeb { /* non-existing; we use an ad-hoc definition */ struct timeb { /* non-existing; we use an ad-hoc definition */
long time; long time;
unsigned short millitm; unsigned short millitm;
short timezone, dstflag; short timezone, dstflag;
}; };
#endif SYS_V #endif /* SYS_V */
#ifdef BSD4_2 /* from system.h */ #ifdef BSD4_2 /* from system.h */
#include <sys/time.h> #include <sys/time.h>
#endif BSD4_2 #endif /* BSD4_2 */
#ifdef SYS_V #ifdef SYS_V
#include <sys/errno.h> #include <sys/errno.h>
#undef ERANGE /* collision with trap.h */ #undef ERANGE /* collision with trap.h */
#include <fcntl.h> #include <fcntl.h>
#include <time.h> #include <time.h>
#endif SYS_V #endif /* SYS_V */
#include <em_abs.h> #include <em_abs.h>
#include "logging.h" #include "logging.h"
@ -62,7 +62,7 @@ extern long lseek();
extern unsigned int alarm(); extern unsigned int alarm();
extern long time(); extern long time();
extern void sync(); extern void sync();
#endif SYS_V #endif /* SYS_V */
#define INT2SIZE max(wsize, 2L) #define INT2SIZE max(wsize, 2L)
#define INT4SIZE max(wsize, 4L) #define INT4SIZE max(wsize, 4L)
@ -165,14 +165,14 @@ moncall()
#ifdef BSD4_2 /* from system.h */ #ifdef BSD4_2 /* from system.h */
struct timeval tv; /* private timeval buffer */ struct timeval tv; /* private timeval buffer */
#endif BSD4_2 #endif /* BSD4_2 */
#ifdef BSD_X /* from system.h */ #ifdef BSD_X /* from system.h */
time_t utimbuf[2]; /* private utime buffer */ time_t utimbuf[2]; /* private utime buffer */
#endif BSD_X #endif /* BSD_X */
#ifdef SYS_V /* from system.h */ #ifdef SYS_V /* from system.h */
struct {time_t x, y;} utimbuf; /* private utime buffer */ struct {time_t x, y;} utimbuf; /* private utime buffer */
#endif SYS_V #endif /* SYS_V */
char *cp; char *cp;
int nr; int nr;
@ -190,7 +190,7 @@ moncall()
UNDEFINED : DEFINED; UNDEFINED : DEFINED;
#else #else
ES_def = DEFINED; ES_def = DEFINED;
#endif LOGGING #endif /* LOGGING */
ES = pop_int(); ES = pop_int();
running = 0; /* stop the machine */ running = 0; /* stop the machine */
LOG(("@m9 Exit: ES = %ld", ES)); LOG(("@m9 Exit: ES = %ld", ES));
@ -247,7 +247,7 @@ moncall()
LOG(("@m6 Read: char = '%c'", *(buf[0] + i))); LOG(("@m6 Read: char = '%c'", *(buf[0] + i)));
} }
} }
#endif LOGGING #endif /* LOGGING */
if (in_gda(dsp1) && !in_gda(dsp1 + (n-1))) { if (in_gda(dsp1) && !in_gda(dsp1 + (n-1))) {
efault(WRGDAH); efault(WRGDAH);
@ -313,7 +313,7 @@ moncall()
warning(in_stack(addr) ? WWLUNDEF : WWGUNDEF); warning(in_stack(addr) ? WWLUNDEF : WWGUNDEF);
} }
} }
#endif LOGGING #endif /* LOGGING */
check_buf(0, (size)nbytes); check_buf(0, (size)nbytes);
for ( nr = nbytes, addr = dsp1, cp = buf[0]; for ( nr = nbytes, addr = dsp1, cp = buf[0];
@ -331,7 +331,7 @@ moncall()
LOG(("@m6 write: char = '%c'", *(buf[0] + i))); LOG(("@m6 write: char = '%c'", *(buf[0] + i)));
} }
} }
#endif LOGGING #endif /* LOGGING */
if ((n = write(fd, buf[0], nbytes)) == -1) if ((n = write(fd, buf[0], nbytes)) == -1)
goto write_error; goto write_error;
@ -575,9 +575,9 @@ moncall()
if ( !savestr(0, dsp1) if ( !savestr(0, dsp1)
#ifndef BSD4_2 /* from system.h */ #ifndef BSD4_2 /* from system.h */
|| umount(buf[0]) == -1 || umount(buf[0]) == -1
#else BSD4_2 #else /* BSD4_2 */
|| unmount(buf[0]) == -1 || unmount(buf[0]) == -1
#endif BSD4_2 #endif /* BSD4_2 */
) { ) {
push_err(); push_err();
LOG(("@m4 Umount: failed, dsp1 = %lu, errno = %d", LOG(("@m4 Umount: failed, dsp1 = %lu, errno = %d",
@ -618,11 +618,11 @@ moncall()
tm = pop_int4(); tm = pop_int4();
#ifndef BSD4_2 /* from system.h */ #ifndef BSD4_2 /* from system.h */
rc = stime(&tm); rc = stime(&tm);
#else BSD4_2 #else /* BSD4_2 */
tv.tv_sec = tm; tv.tv_sec = tm;
tv.tv_usec = 0; /* zero microseconds */ tv.tv_usec = 0; /* zero microseconds */
rc = settimeofday(&tv, (struct timezone *)0); rc = settimeofday(&tv, (struct timezone *)0);
#endif BSD4_2 #endif /* BSD4_2 */
if (rc == -1) { if (rc == -1) {
push_err(); push_err();
LOG(("@m4 Stime: failed, tm = %ld, errno = %d", LOG(("@m4 Stime: failed, tm = %ld, errno = %d",
@ -695,11 +695,11 @@ moncall()
#ifdef BSD_X /* from system.h */ #ifdef BSD_X /* from system.h */
utimbuf[0] = actime; utimbuf[0] = actime;
utimbuf[1] = modtime; utimbuf[1] = modtime;
#endif BSD_X #endif /* BSD_X */
#ifdef SYS_V /* from system.h */ #ifdef SYS_V /* from system.h */
utimbuf.x = actime; utimbuf.x = actime;
utimbuf.y = modtime; utimbuf.y = modtime;
#endif SYS_V #endif /* SYS_V */
if (!savestr(0, dsp1) || utime(buf[0], utimbuf) == -1) { if (!savestr(0, dsp1) || utime(buf[0], utimbuf) == -1) {
push_err(); push_err();
LOG(("@m4 Utime: failed, dsp1 = %lu, dsp2 = %lu, errno = %d", LOG(("@m4 Utime: failed, dsp1 = %lu, dsp2 = %lu, errno = %d",
@ -740,13 +740,13 @@ moncall()
dsp2 = pop_ptr(); dsp2 = pop_ptr();
#ifdef BSD_X /* from system.h */ #ifdef BSD_X /* from system.h */
ftime(&tb_buf); ftime(&tb_buf);
#endif BSD_X #endif /* BSD_X */
#ifdef SYS_V /* from system.h */ #ifdef SYS_V /* from system.h */
tb_buf.time = time((time_t*)0); tb_buf.time = time((time_t*)0);
tb_buf.millitm = 0; tb_buf.millitm = 0;
tb_buf.timezone = timezone / 60; tb_buf.timezone = timezone / 60;
tb_buf.dstflag = daylight; tb_buf.dstflag = daylight;
#endif SYS_V #endif /* SYS_V */
if (!timeb2mem(dsp2, &tb_buf)) { if (!timeb2mem(dsp2, &tb_buf)) {
push_err(); push_err();
LOG(("@m4 Ftime: failed, dsp2 = %lu, errno = %d", LOG(("@m4 Ftime: failed, dsp2 = %lu, errno = %d",
@ -794,7 +794,7 @@ moncall()
} }
#ifdef BSD_X /* from system.h */ #ifdef BSD_X /* from system.h */
fdnew = dup2(fd1, fdnew); fdnew = dup2(fd1, fdnew);
#endif BSD_X #endif /* BSD_X */
#ifdef SYS_V /* from system.h */ #ifdef SYS_V /* from system.h */
{ {
@ -814,7 +814,7 @@ moncall()
fdnew = fcntl(fd1, F_DUPFD, fdnew); fdnew = fcntl(fd1, F_DUPFD, fdnew);
} }
} }
#endif SYS_V #endif /* SYS_V */
dup2_error:; dup2_error:;
} }
else { else {

View file

@ -20,14 +20,14 @@
#ifdef BSD_X /* from system.h */ #ifdef BSD_X /* from system.h */
#include <sys/timeb.h> #include <sys/timeb.h>
#endif BSD_X #endif /* BSD_X */
#ifdef SYS_V /* from system.h */ #ifdef SYS_V /* from system.h */
struct timeb { /* non-existing; we use an ad-hoc definition */ struct timeb { /* non-existing; we use an ad-hoc definition */
long time; long time;
unsigned short millitm; unsigned short millitm;
short timezone, dstflag; short timezone, dstflag;
} }
#endif SYS_V #endif /* SYS_V */
/******** System to EM memory ********/ /******** System to EM memory ********/
@ -130,8 +130,8 @@ int ltchars2mem(addr, ltcharsb)
mem_stfld(addr, V7t_lnextc, (long) ltcharsb->t_lnextc); mem_stfld(addr, V7t_lnextc, (long) ltcharsb->t_lnextc);
return 1; return 1;
} }
#endif V7IOCTL #endif /* V7IOCTL */
#endif BSD_X #endif /* BSD_X */
/******** EM memory to system ********/ /******** EM memory to system ********/
@ -188,6 +188,6 @@ int mem2ltchars(addr, ltcharsb)
ltcharsb->t_lnextc = (char) mem_ldfld(addr, V7t_lnextc); ltcharsb->t_lnextc = (char) mem_ldfld(addr, V7t_lnextc);
return 1; return 1;
} }
#endif V7IOCTL #endif /* V7IOCTL */
#endif BSD_X #endif /* BSD_X */

View file

@ -69,6 +69,6 @@ end_init_proctab()
LOG((" r5: proctab[%ld]: nloc = %d, ep = %lu, ff = %lu", LOG((" r5: proctab[%ld]: nloc = %d, ep = %lu, ff = %lu",
p, pr->pr_nloc, pr->pr_ep, pr->pr_ff)); p, pr->pr_nloc, pr->pr_ep, pr->pr_ff));
} }
#endif LOGGING #endif /* LOGGING */
} }

View file

@ -119,7 +119,7 @@ trap_msg: $(SRC_DIR)/M.trap_msg $(TRAPS)
warn_msg: $(SRC_DIR)/M.warn_msg $(APP_A) warn_msg: $(SRC_DIR)/M.warn_msg $(APP_A)
$(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) $(SRC_DIR)/M.warn_h $(APP_A)
switch/DoCases: switch/DoCases:
@ -142,7 +142,7 @@ test/awa.em44:
# Auxiliary entries # 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) $(LINT) $(LINTFLAGS) $(CFILES)
tags: $(HDR) $(CFILES) tags: $(HDR) $(CFILES)
@ -170,7 +170,7 @@ clean:
bare: clean bare: clean
(cd switch; make bare) (cd switch; make bare)
depend: warn.h trap_msg warn_msg depend: ./warn.h trap_msg warn_msg
sed '/^#DEPENDENCIES/,$$d' Makefile >Makefile.new sed '/^#DEPENDENCIES/,$$d' Makefile >Makefile.new
echo '#DEPENDENCIES' >>Makefile.new echo '#DEPENDENCIES' >>Makefile.new
for i in $(CFILES) ; do \ for i in $(CFILES) ; do \

View file

@ -21,7 +21,7 @@
#ifndef NOFLOAT #ifndef NOFLOAT
extern double str2double(); extern double str2double();
#endif NOFLOAT #endif /* NOFLOAT */
/************************************************************************ /************************************************************************
* Read object file contents. * * Read object file contents. *
@ -214,7 +214,7 @@ PRIVATE ptr rd_repeat(pos, count, prev_pos)
#ifdef LOGGING #ifdef LOGGING
/* copy shadow byte, including protection bit */ /* copy shadow byte, including protection bit */
dt_sh(pos) = dt_sh(pos - diff); dt_sh(pos) = dt_sh(pos - diff);
#endif LOGGING #endif /* LOGGING */
pos++; pos++;
} }
} }
@ -284,10 +284,10 @@ PRIVATE ptr rd_descr(type, count, pos)
#ifndef NOFLOAT #ifndef NOFLOAT
/* store the float */ /* store the float */
dt_stf(pos, str2double(fl_rep), j); dt_stf(pos, str2double(fl_rep), j);
#else NOFLOAT #else /* NOFLOAT */
/* we cannot store the float */ /* we cannot store the float */
warning(WFLINIT); warning(WFLINIT);
#endif NOFLOAT #endif /* NOFLOAT */
pos += j; pos += j;
break; break;
default: default:

View file

@ -77,7 +77,7 @@ int poprsb(rtt)
if (SP > properSP) if (SP > properSP)
warning(rtt ? WRTTSTS : WRETSTS); warning(rtt ? WRTTSTS : WRETSTS);
} }
#endif LOGGING #endif /* LOGGING */
/* discard stack up to RSB */ /* discard stack up to RSB */
newSP(LB); newSP(LB);

View file

@ -72,7 +72,7 @@ int ptr2seg(p)
return s; return s;
} }
#else SEGCHECK #else /* SEGCHECK */
init_AB_list() {} init_AB_list() {}
@ -80,5 +80,5 @@ push_frame() {}
pop_frames() {} pop_frames() {}
#endif SEGCHECK #endif /* SEGCHECK */

View file

@ -98,5 +98,5 @@ extern char *stackML_sh; /* stack_sh + ML (to speed up stack access) */
#define ch_dt_prot(a) #define ch_dt_prot(a)
#define ch_st_prot(a) #define ch_st_prot(a)
#endif LOGGING #endif /* LOGGING */

View file

@ -26,7 +26,7 @@ extern size maxstack; /* from main.c */
#ifdef LOGGING #ifdef LOGGING
char *stack_sh; /* stadowbytes */ char *stack_sh; /* stadowbytes */
char *stackML_sh; /* speed up access of stadowbytes */ char *stackML_sh; /* speed up access of stadowbytes */
#endif LOGGING #endif /* LOGGING */
PRIVATE warn_stbits(); PRIVATE warn_stbits();
@ -44,7 +44,7 @@ init_stack() {
stack_sh = Malloc(STACKSIZE, "shadowspace for stack"); stack_sh = Malloc(STACKSIZE, "shadowspace for stack");
stackML_sh = stack_sh + ML; stackML_sh = stack_sh + ML;
st_clear_area(ML, SL); st_clear_area(ML, SL);
#endif LOGGING #endif /* LOGGING */
} }
@ -94,12 +94,12 @@ newSP(ap)
stack_sh = Realloc(stack_sh, (size)(stacksize), stack_sh = Realloc(stack_sh, (size)(stacksize),
"shadowspace for stack"); "shadowspace for stack");
stackML_sh = stack_sh + ML; stackML_sh = stack_sh + ML;
#endif LOGGING #endif /* LOGGING */
} }
#ifdef LOGGING #ifdef LOGGING
st_clear_area(SP - 1, p); st_clear_area(SP - 1, p);
#endif LOGGING #endif /* LOGGING */
} }
SP = p; SP = p;
} }
@ -229,7 +229,7 @@ st_stn(addr, al, n)
stack_loc(addr) = (char) l; stack_loc(addr) = (char) l;
#ifdef LOGGING #ifdef LOGGING
st_sh(addr) = sh_flags; st_sh(addr) = sh_flags;
#endif LOGGING #endif /* LOGGING */
l = l>>8; l = l>>8;
} }
} }
@ -255,7 +255,7 @@ st_stw(addr, al)
stack_loc(addr) = (char) l; stack_loc(addr) = (char) l;
#ifdef LOGGING #ifdef LOGGING
st_sh(addr) = sh_flags; st_sh(addr) = sh_flags;
#endif LOGGING #endif /* LOGGING */
l = l>>8; l = l>>8;
} }
} }
@ -283,7 +283,7 @@ st_stf(addr, f, n)
st_fl(addr); st_fl(addr);
} }
} }
#endif NOFLOAT #endif /* NOFLOAT */
/************************************************************************ /************************************************************************
* Stack load division. * * Stack load division. *
@ -313,7 +313,7 @@ ptr st_lddp(addr)
warning(WLDPEXP); warning(WLDPEXP);
warn_stbits(addr, psize); warn_stbits(addr, psize);
} }
#endif LOGGING #endif /* LOGGING */
p = p_in_stack(addr); p = p_in_stack(addr);
LOG(("@s6 st_lddp() returns %lu", p)); LOG(("@s6 st_lddp() returns %lu", p));
@ -334,7 +334,7 @@ ptr st_ldip(addr)
warning(WLIPEXP); warning(WLIPEXP);
warn_stbits(addr, psize); warn_stbits(addr, psize);
} }
#endif LOGGING #endif /* LOGGING */
p = p_in_stack(addr); p = p_in_stack(addr);
LOG(("@s6 st_ldip() returns %lu", p)); LOG(("@s6 st_ldip() returns %lu", p));
@ -357,7 +357,7 @@ unsigned long st_ldu(addr, n)
warning(n == 1 ? WLCEXP : WLIEXP); warning(n == 1 ? WLCEXP : WLIEXP);
warn_stbits(addr, n); warn_stbits(addr, n);
} }
#endif LOGGING #endif /* LOGGING */
addr += n-1; addr += n-1;
for (i = (int) n-1; i >= 0; i--, addr--) { for (i = (int) n-1; i >= 0; i--, addr--) {
@ -382,7 +382,7 @@ unsigned long st_lduw(addr)
warning(WLIEXP); warning(WLIEXP);
warn_stbits(addr, wsize); warn_stbits(addr, wsize);
} }
#endif LOGGING #endif /* LOGGING */
addr += wsize - 1; addr += wsize - 1;
for (i = (int) wsize-1; i >= 0; i--, addr--) { for (i = (int) wsize-1; i >= 0; i--, addr--) {
@ -408,7 +408,7 @@ long st_lds(addr, n)
warning(n == 1 ? WLCEXP : WLIEXP); warning(n == 1 ? WLCEXP : WLIEXP);
warn_stbits(addr, n); warn_stbits(addr, n);
} }
#endif LOGGING #endif /* LOGGING */
addr += n - 2; addr += n - 2;
l = btos(stack_loc(addr + 1)); l = btos(stack_loc(addr + 1));
@ -434,7 +434,7 @@ long st_ldsw(addr)
warning(WLIEXP); warning(WLIEXP);
warn_stbits(addr, wsize); warn_stbits(addr, wsize);
} }
#endif LOGGING #endif /* LOGGING */
addr += wsize - 2; addr += wsize - 2;
l = btos(stack_loc(addr+1)); l = btos(stack_loc(addr+1));
@ -470,7 +470,7 @@ double st_ldf(addr, n)
warning(WLFEXP); warning(WLFEXP);
warn_stbits(addr, n); warn_stbits(addr, n);
} }
#endif LOGGING #endif /* LOGGING */
for (i = (int) n; i > 0; i--, addr++) { for (i = (int) n; i > 0; i--, addr++) {
*(cp++) = stack_loc(addr); *(cp++) = stack_loc(addr);
@ -480,7 +480,7 @@ double st_ldf(addr, n)
} }
return (f); return (f);
} }
#endif NOFLOAT #endif /* NOFLOAT */
/************************************************************************ /************************************************************************
* Stack move division * * Stack move division *
@ -516,7 +516,7 @@ st_mvs(s2, s1, n) /* s1 -> s2 */
stack_loc(s2) = stack_loc(s1); stack_loc(s2) = stack_loc(s1);
#ifdef LOGGING #ifdef LOGGING
st_sh(s2) = st_sh(s1) & ~SH_PROT; 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); stack_loc(s) = data_loc(d);
#ifdef LOGGING #ifdef LOGGING
st_sh(s) = dt_sh(d) & ~SH_PROT; st_sh(s) = dt_sh(d) & ~SH_PROT;
#endif LOGGING #endif /* LOGGING */
} }
} }
@ -658,7 +658,7 @@ double fpop(n)
decSP(n); decSP(n);
return (d); return (d);
} }
#endif NOFLOAT #endif /* NOFLOAT */
long wpop() long wpop()
{ {
@ -762,7 +762,7 @@ fpush(f, n)
incSP(n); incSP(n);
st_stf(SP, f, n); st_stf(SP, f, n);
} }
#endif NOFLOAT #endif /* NOFLOAT */
#ifdef LOGGING #ifdef LOGGING
@ -796,5 +796,5 @@ PRIVATE warn_stbits(addr, n)
warningcont(WWASINSP); warningcont(WWASINSP);
} }
#endif LOGGING #endif /* LOGGING */

View file

@ -9,13 +9,13 @@
#ifdef BSD4_1 #ifdef BSD4_1
#define BSD_X #define BSD_X
#endif BSD4_1 #endif /* BSD4_1 */
#ifdef BSD4_2 #ifdef BSD4_2
#define BSD_X #define BSD_X
#endif BSD4_2 #endif /* BSD4_2 */
#ifdef SYS_5 #ifdef SYS_5
#define SYS_V #define SYS_V
#endif SYS_5 #endif /* SYS_5 */

View file

@ -146,7 +146,7 @@ warningcont(nr)
} }
} }
#endif LOGGING #endif /* LOGGING */
set_wmask(i) set_wmask(i)
int i; int i;

View file

@ -42,16 +42,14 @@ In general, an object file consists of the following parts:
.br .br
The header of an object file has the following structure: The header of an object file has the following structure:
.PP .PP
#define ushort unsigned\ short
.PP
.nf .nf
struct outhead { struct outhead {
ushort oh_magic; /* magic number */ unsigned short oh_magic; /* magic number */
ushort oh_stamp; /* version stamp */ unsigned short oh_stamp; /* version stamp */
ushort oh_flags; /* several format flags */ unsigned short oh_flags; /* several format flags */
ushort oh_nsect; /* number of outsect structures */ unsigned short oh_nsect; /* number of outsect structures */
ushort oh_nrelo; /* number of outrelo structures */ unsigned short oh_nrelo; /* number of outrelo structures */
ushort oh_nname; /* number of outname structures */ unsigned short oh_nname; /* number of outname structures */
long oh_nemit; /* length of sections */ long oh_nemit; /* length of sections */
long oh_nchar; /* size of string area */ long oh_nchar; /* size of string area */
}; };
@ -151,7 +149,7 @@ relocatable datum. The information has the following structure:
struct outrelo { struct outrelo {
char or_type; /* type of reference */ char or_type; /* type of reference */
char or_sect; /* referencing section */ char or_sect; /* referencing section */
ushort or_nami; /* referenced symbol index */ unsigned short or_nami; /* referenced symbol index */
long or_addr; /* referencing address */ long or_addr; /* referencing address */
}; };
.fi .fi
@ -231,8 +229,8 @@ struct outname {
} on_u; } on_u;
#define on_mptr on_u.on_ptr #define on_mptr on_u.on_ptr
#define on_foff on_u.on_off #define on_foff on_u.on_off
ushort on_type; /* symbol type */ unsigned short on_type; /* symbol type */
ushort on_desc; /* debug info */ unsigned short on_desc; /* debug info */
long on_valu; /* symbol value */ long on_valu; /* symbol value */
}; };
.fi .fi

View file

@ -9,14 +9,14 @@
#define assert(ex) #define assert(ex)
#else NASSERT #else /* NASSERT */
#define assert(ex) \ #define assert(ex) \
{if (!(ex)) fatal("Assertion failed: file %s, line %d", __FILE__, __LINE__);} {if (!(ex)) fatal("Assertion failed: file %s, line %d", __FILE__, __LINE__);}
#endif NASSERT #endif /* NASSERT */
#else lint #else /* lint */
#define assert(ex) #define assert(ex)
#endif lint #endif /* lint */

View file

@ -39,8 +39,8 @@ extract()
skip_modul(&head); skip_modul(&head);
} }
ushort NLocals = 0; /* Number of local names to be saved. */ unsigned short NLocals = 0; /* Number of local names to be saved. */
ushort NGlobals = 0; /* Number of global names. */ unsigned short NGlobals = 0; /* Number of global names. */
/* /*
* Walk through the nametable of this module, counting the locals that must * Walk through the nametable of this module, counting the locals that must

View file

@ -14,7 +14,7 @@ static char rcsid[] = "$Header$";
#include "scan.h" #include "scan.h"
extern bool incore; extern bool incore;
extern ushort NLocals; extern unsigned short NLocals;
extern int flagword; extern int flagword;
extern struct outname *searchname(); extern struct outname *searchname();
@ -47,7 +47,7 @@ finish()
put_locals(names, head->oh_nname); put_locals(names, head->oh_nname);
#ifdef SYMDBUG #ifdef SYMDBUG
put_dbug(OFF_DBUG(*head)); put_dbug(OFF_DBUG(*head));
#endif SYMDBUG #endif /* SYMDBUG */
} }
compute_origins(sects, head->oh_nsect); compute_origins(sects, head->oh_nsect);
skip_modul(head); skip_modul(head);
@ -80,7 +80,7 @@ adjust_names(name, head, chars)
do_crs(base, count) do_crs(base, count)
struct outname *base; struct outname *base;
unsigned short count; unsigned count;
{ {
register struct outname *name = base; register struct outname *name = base;
@ -209,7 +209,7 @@ handle_relos(head, sects, names)
static static
put_locals(name, nnames) put_locals(name, nnames)
struct outname *name; struct outname *name;
register ushort nnames; register unsigned nnames;
{ {
register struct outname *oname = name; register struct outname *oname = name;
register struct outname *iname = oname; register struct outname *iname = oname;
@ -233,7 +233,7 @@ put_locals(name, nnames)
static static
compute_origins(sect, nsect) compute_origins(sect, nsect)
register struct outsect *sect; register struct outsect *sect;
register ushort nsect; register unsigned nsect;
{ {
extern struct orig relorig[]; extern struct orig relorig[];
register struct orig *orig = relorig; register struct orig *orig = relorig;
@ -267,4 +267,4 @@ put_dbug(offdbug)
dbugsize -= nbytes; dbugsize -= nbytes;
} }
} }
#endif SYMDBUG #endif /* SYMDBUG */

View file

@ -26,7 +26,7 @@
mems[ALLOGCHR].mem_left = 16 * K; mems[ALLOGCHR].mem_left = 16 * K;
#ifdef SYMDBUG #ifdef SYMDBUG
mems[ALLODBUG].mem_left = 32 * K; mems[ALLODBUG].mem_left = 32 * K;
#endif SYMDBUG #endif /* SYMDBUG */
mems[ALLOSYMB].mem_left = 8 * K; mems[ALLOSYMB].mem_left = 8 * K;
mems[ALLOARCH].mem_left = 4 * K; mems[ALLOARCH].mem_left = 4 * K;
mems[ALLOMODL].mem_left = 64 * K; mems[ALLOMODL].mem_left = 64 * K;
@ -43,7 +43,7 @@
mems[ALLOGCHR].mem_left = 2 * K; mems[ALLOGCHR].mem_left = 2 * K;
#ifdef SYMDBUG #ifdef SYMDBUG
mems[ALLODBUG].mem_left = 2 * K; mems[ALLODBUG].mem_left = 2 * K;
#endif SYMDBUG #endif /* SYMDBUG */
mems[ALLOSYMB].mem_left = 2 * K; mems[ALLOSYMB].mem_left = 2 * K;
mems[ALLOARCH].mem_left = 1 * K; mems[ALLOARCH].mem_left = 1 * K;
mems[ALLOMODL].mem_left = 12 * K; mems[ALLOMODL].mem_left = 12 * K;

View file

@ -371,7 +371,7 @@ evaluate()
change_names(); change_names();
} }
extern ushort NGlobals, NLocals; extern unsigned short NGlobals, NLocals;
/* /*
* Sect_comm[N] is the number of common bytes in section N. * Sect_comm[N] is the number of common bytes in section N.

View file

@ -547,14 +547,14 @@ 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 ushorts and longs as ACK prescribes. * we must order the bytes in the unsigned shorts and longs as ACK prescribes.
*/ */
write_bytes() write_bytes()
{ {
ushort nsect; unsigned short nsect;
long offchar; long offchar;
register struct memory *mem; register struct memory *mem;
extern ushort NLocals, NGlobals; extern unsigned short NLocals, NGlobals;
extern long NLChars, NGChars; extern long NLChars, NGChars;
extern int flagword; extern int flagword;
extern struct outhead outhead; extern struct outhead outhead;
@ -603,13 +603,13 @@ write_bytes()
wr_string(mems[ALLOGCHR].mem_base + 1, (long)NGChars); wr_string(mems[ALLOGCHR].mem_base + 1, (long)NGChars);
#ifdef SYMDBUG #ifdef SYMDBUG
wr_dbug(mems[ALLODBUG].mem_base, mems[ALLODBUG].mem_full); wr_dbug(mems[ALLODBUG].mem_base, mems[ALLODBUG].mem_full);
#endif SYMDBUG #endif /* SYMDBUG */
} }
} }
namecpy(name, nname, offchar) namecpy(name, nname, offchar)
register struct outname *name; register struct outname *name;
register ushort nname; register unsigned nname;
register long offchar; register long offchar;
{ {
while (nname--) { while (nname--) {

View file

@ -12,9 +12,9 @@
#define ALLOGCHR (ALLOLCHR + 1) /* Strings of global names. */ #define ALLOGCHR (ALLOLCHR + 1) /* Strings of global names. */
#ifdef SYMDEBUG #ifdef SYMDEBUG
#define ALLODBUG (ALLOGCHR + 1) /* Symbolic debugging info. */ #define ALLODBUG (ALLOGCHR + 1) /* Symbolic debugging info. */
#else SYMDEBUG #else /* SYMDEBUG */
#define ALLODBUG ALLOGCHR #define ALLODBUG ALLOGCHR
#endif SYMDEBUG #endif /* SYMDEBUG */
#define ALLOSYMB (ALLODBUG + 1) /* Symbol table. */ #define ALLOSYMB (ALLODBUG + 1) /* Symbol table. */
#define ALLOARCH (ALLOSYMB + 1) /* Archive positions. */ #define ALLOARCH (ALLOSYMB + 1) /* Archive positions. */
#define ALLOMODL (ALLOARCH + 1) /* Modules. */ #define ALLOMODL (ALLOARCH + 1) /* Modules. */

View file

@ -24,7 +24,7 @@
#ifdef SYMDEBUG #ifdef SYMDEBUG
Symbolic debugging information Symbolic debugging information
----------------------------------------------- -----------------------------------------------
#endif SYMDEBUG #endif /* SYMDEBUG */
Symbol table * Symbol table *
----------------------------------------------- -----------------------------------------------
Archive positions * Archive positions *

View file

@ -24,7 +24,7 @@ extern int flagword;
*/ */
beginoutput() beginoutput()
{ {
extern ushort NLocals, NGlobals; extern unsigned short NLocals, NGlobals;
extern long NLChars, NGChars; extern long NLChars, NGChars;
extern char *outputname; extern char *outputname;
@ -35,9 +35,9 @@ beginoutput()
generate_section_names(); generate_section_names();
if (!(flagword & (CFLAG|RFLAG))) if (!(flagword & (CFLAG|RFLAG)))
outhead.oh_nrelo = (ushort)0; outhead.oh_nrelo = (unsigned short)0;
if (flagword & SFLAG) { if (flagword & SFLAG) {
outhead.oh_nname = (ushort)0; outhead.oh_nname = (unsigned short)0;
outhead.oh_nchar = (long)0; outhead.oh_nchar = (long)0;
} else { } else {
outhead.oh_nname = NLocals + NGlobals + outhead.oh_nsect; outhead.oh_nname = NLocals + NGlobals + outhead.oh_nsect;
@ -68,7 +68,7 @@ generate_section_names()
for (sectindex = 0; sectindex < outhead.oh_nsect; sectindex++, name++) { for (sectindex = 0; sectindex < outhead.oh_nsect; sectindex++, name++) {
name->on_foff = (long)0; /* No string name. */ name->on_foff = (long)0; /* No string name. */
name->on_type = (S_MIN + sectindex) | S_SCT; 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; name->on_valu = outsect[sectindex].os_base;
} }
} }

View file

@ -23,7 +23,7 @@ getvalu(addr, type)
char addr[]; char addr[];
char type; char type;
{ {
ushort word0, word1; unsigned short word0, word1;
switch (type & RELSZ) { switch (type & RELSZ) {
case RELO1: case RELO1:
@ -62,7 +62,7 @@ putvalu(valu, addr, type)
char addr[]; char addr[];
char type; char type;
{ {
ushort word0, word1; unsigned short word0, word1;
switch (type & RELSZ) { switch (type & RELSZ) {
case RELO1: 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 outsect outsect[];
extern struct orig relorig[]; extern struct orig relorig[];
@ -118,14 +118,14 @@ extern struct orig relorig[];
* Second case: we must update the value by the change * Second case: we must update the value by the change
* in position of the section of local. * in position of the section of local.
*/ */
static ushort static unsigned
addrelo(relo, names, valu_out) addrelo(relo, names, valu_out)
struct outrelo *relo; struct outrelo *relo;
struct outname *names; struct outname *names;
long *valu_out; /* Out variable. */ long *valu_out; /* Out variable. */
{ {
register struct outname *local = &names[relo->or_nami]; register struct outname *local = &names[relo->or_nami];
register ushort index = NLocals; register unsigned short index = NLocals;
register long valu = *valu_out; register long valu = *valu_out;
if ((local->on_type & S_SCT)) { if ((local->on_type & S_SCT)) {
@ -138,7 +138,7 @@ addrelo(relo, names, valu_out)
register struct outname *name; register struct outname *name;
extern int hash(); extern int hash();
extern struct outname *searchname(); extern struct outname *searchname();
extern ushort indexof(); extern unsigned indexof();
extern struct outhead outhead; extern struct outhead outhead;
name = searchname(local->on_mptr, hash(local->on_mptr)); name = searchname(local->on_mptr, hash(local->on_mptr));

View file

@ -27,7 +27,7 @@ savemagic()
return; return;
if ((p = core_alloc(ALLOMODL, (long)sizeof(int))) != (char *)0) { if ((p = core_alloc(ALLOMODL, (long)sizeof(int))) != (char *)0) {
*(ushort *)p = AALMAG; *(unsigned short *)p = AALMAG;
core_position += sizeof(int); core_position += sizeof(int);
} }
} }

View file

@ -9,7 +9,7 @@ static char rcsid[] = "$Header$";
#ifdef SYMDBUG #ifdef SYMDBUG
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#endif SYMDBUG #endif /* SYMDBUG */
#include <arch.h> #include <arch.h>
#include <out.h> #include <out.h>
#include <ranlib.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)) #define IND_RELO(x) (IND_EMIT(x) + (x).oh_nsect * sizeof(ind_t))
#ifdef SYMDBUG #ifdef SYMDBUG
#define IND_DBUG(x) (IND_RELO(x) + sizeof(ind_t)) #define IND_DBUG(x) (IND_RELO(x) + sizeof(ind_t))
#endif SYMDBUG #endif /* SYMDBUG */
extern long lseek(); extern long lseek();
extern char *core_alloc(); extern char *core_alloc();
@ -37,7 +37,7 @@ char *archname; /* Name of archive, if reading from archive. */
char *modulname; /* Name of object module. */ char *modulname; /* Name of object module. */
#ifdef SYMDBUG #ifdef SYMDBUG
long objectsize; long objectsize;
#endif SYMDBUG #endif /* SYMDBUG */
static long align(); static long align();
static char *modulbase; static char *modulbase;
@ -50,7 +50,7 @@ static bool putemitindex();
static bool putreloindex(); static bool putreloindex();
#ifdef SYMDBUG #ifdef SYMDBUG
static bool putdbugindex(); static bool putdbugindex();
#endif SYMDBUG #endif /* SYMDBUG */
static get_indirect(); static get_indirect();
static read_modul(); static read_modul();
@ -66,11 +66,11 @@ getfile(filename)
{ {
unsigned int rd_unsigned2(); unsigned int rd_unsigned2();
struct ar_hdr archive_header; struct ar_hdr archive_header;
ushort magic_number; unsigned short magic_number;
#ifdef SYMDBUG #ifdef SYMDBUG
struct stat statbuf; struct stat statbuf;
extern int fstat(); extern int fstat();
#endif SYMDBUG #endif /* SYMDBUG */
archname = (char *)0; archname = (char *)0;
modulname = (char *)0; modulname = (char *)0;
@ -81,7 +81,7 @@ getfile(filename)
magic_number = rd_unsigned2(infile); magic_number = rd_unsigned2(infile);
} else { } else {
modulbase = modulptr((ind_t)0); modulbase = modulptr((ind_t)0);
magic_number = *(ushort *)modulbase; magic_number = *(unsigned short *)modulbase;
} }
switch (magic_number) { switch (magic_number) {
@ -92,7 +92,7 @@ getfile(filename)
fatal("cannot stat"); fatal("cannot stat");
objectsize = statbuf.st_size; objectsize = statbuf.st_size;
} }
#endif SYMDBUG #endif /* SYMDBUG */
seek((long)0); seek((long)0);
modulname = filename; modulname = filename;
return PLAIN; return PLAIN;
@ -135,7 +135,7 @@ get_archive_header(archive_header)
} }
#ifdef SYMDBUG #ifdef SYMDBUG
objectsize = archive_header.ar_size; objectsize = archive_header.ar_size;
#endif SYMDBUG #endif /* SYMDBUG */
} }
get_modul() get_modul()
@ -175,7 +175,7 @@ scan_modul()
ojectsize - OFF_DBUG(*head) ojectsize - OFF_DBUG(*head)
); );
} }
#endif SYMDBUG #endif /* SYMDBUG */
} }
/* /*
@ -213,16 +213,16 @@ direct_alloc(head)
{ {
ind_t sectindex = IND_SECT(*head); ind_t sectindex = IND_SECT(*head);
register struct outsect *sects; register struct outsect *sects;
ushort nsect = head->oh_nsect; unsigned short nsect = head->oh_nsect;
long size, rest; long size, rest;
extern ind_t hard_alloc(); extern ind_t hard_alloc();
extern ind_t 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);
#else SYMDBUG #else /* SYMDBUG */
rest = nsect * sizeof(ind_t) + sizeof(ind_t); rest = nsect * sizeof(ind_t) + sizeof(ind_t);
#endif SYMDBUG #endif /* SYMDBUG */
/* /*
* We already allocated space for the header, we now need * We already allocated space for the header, we now need
* the section, name an string table. * the section, name an string table.
@ -251,8 +251,8 @@ indirect_alloc(head)
struct outhead *head; struct outhead *head;
{ {
register int allopiece; register int allopiece;
ushort nsect = head->oh_nsect; unsigned short nsect = head->oh_nsect;
ushort nrelo = head->oh_nrelo; unsigned short nrelo = head->oh_nrelo;
ind_t sectindex = IND_SECT(*head); ind_t sectindex = IND_SECT(*head);
ind_t emitoff = IND_EMIT(*head); ind_t emitoff = IND_EMIT(*head);
ind_t relooff = IND_RELO(*head); ind_t relooff = IND_RELO(*head);
@ -260,7 +260,7 @@ indirect_alloc(head)
ind_t dbugoff = IND_DBUG(*head); ind_t dbugoff = IND_DBUG(*head);
extern long objectsize; extern long objectsize;
long dbugsize = objectsize - OFF_DBUG(*head); long dbugsize = objectsize - OFF_DBUG(*head);
#endif SYMDBUG #endif /* SYMDBUG */
assert(incore); assert(incore);
for (allopiece = ALLOEMIT; allopiece < ALLOEMIT + nsect; allopiece++) { for (allopiece = ALLOEMIT; allopiece < ALLOEMIT + nsect; allopiece++) {
@ -273,9 +273,9 @@ indirect_alloc(head)
return putreloindex(relooff, (long)nrelo * sizeof(struct outrelo)) return putreloindex(relooff, (long)nrelo * sizeof(struct outrelo))
&& &&
putdbugindex(dbugoff, dbugsize); putdbugindex(dbugoff, dbugsize);
#else SYMDBUG #else /* SYMDBUG */
return putreloindex(relooff, (long)nrelo * sizeof(struct outrelo)); return putreloindex(relooff, (long)nrelo * sizeof(struct outrelo));
#endif SYMDBUG #endif /* SYMDBUG */
} }
/* /*
@ -358,7 +358,7 @@ putdbugindex(dbugoff, ndbugbytes)
} }
return FALSE; return FALSE;
} }
#endif SYMDBUG #endif /* SYMDBUG */
/* /*
* Compute addresses and read in. Remember that the contents of the sections * Compute addresses and read in. Remember that the contents of the sections
@ -430,7 +430,7 @@ read_modul()
struct outname *names; struct outname *names;
char *chars; char *chars;
ind_t sectindex, nameindex, charindex; ind_t sectindex, nameindex, charindex;
ushort nsect, nname; unsigned short nsect, nname;
long size; long size;
long nchar; long nchar;
extern ind_t hard_alloc(); extern ind_t hard_alloc();
@ -446,9 +446,9 @@ read_modul()
nchar = head->oh_nchar; charindex = IND_CHAR(*head); nchar = head->oh_nchar; charindex = IND_CHAR(*head);
#ifdef SYMDBUG #ifdef SYMDBUG
size = modulsize(head) - (nsect * sizeof(ind_t) + 2 * sizeof(ind_t)); 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)); size = modulsize(head) - (nsect * sizeof(ind_t) + sizeof(ind_t));
#endif SYMDBUG #endif /* SYMDBUG */
if (hard_alloc(ALLOMODL, size) == BADOFF) if (hard_alloc(ALLOMODL, size) == BADOFF)
fatal("no space for module"); fatal("no space for module");
@ -490,7 +490,7 @@ align(size)
* 5. the offset of the relocation table. * 5. the offset of the relocation table.
#ifdef SYMDBUG #ifdef SYMDBUG
* 6. the offset of the debugging information. * 6. the offset of the debugging information.
#endif SYMDBUG #endif /* SYMDBUG */
*/ */
static long static long
modulsize(head) modulsize(head)
@ -504,9 +504,9 @@ modulsize(head)
#ifdef SYMDBUG #ifdef SYMDBUG
sizeof(ind_t) + /* 5 */ sizeof(ind_t) + /* 5 */
sizeof(ind_t); /* 6 */ sizeof(ind_t); /* 6 */
#else SYMDBUG #else /* SYMDBUG */
sizeof(ind_t); /* 5 */ sizeof(ind_t); /* 5 */
#endif SYMDBUG #endif /* SYMDBUG */
} }
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */

View file

@ -118,7 +118,7 @@ entername(name, hashval)
* Return the index of `name' in the symbol table in the order in which * 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. * it was entered. We need a REAL index, not a byte offset.
*/ */
ushort unsigned
indexof(name) indexof(name)
struct outname *name; struct outname *name;
{ {

View file

@ -59,7 +59,7 @@ end_write()
{ {
register struct outname *name; register struct outname *name;
register int sectindex; register int sectindex;
extern ushort NGlobals; extern unsigned short NGlobals;
extern long NGChars; extern long NGChars;
assert(!incore); assert(!incore);

View file

@ -5,7 +5,7 @@
#ifndef MAGIC #ifndef MAGIC
#define MAGIC 07255 #define MAGIC 07255
#endif MAGIC #endif /* MAGIC */
FILE *load_fp; FILE *load_fp;
int eof; int eof;