Merge deletion of many undead files.

This commit is contained in:
George Koehler 2012-09-23 15:31:16 -04:00
commit c40034452e
9 changed files with 92 additions and 54 deletions

View File

@ -20,7 +20,7 @@
#include "sizes.h"
extern char options[];
extern arith full_mask[/*MAXSIZE*/]; /* cstoper.c */
extern arith full_mask[/*MAXSIZE + 1*/]; /* cstoper.c */
char *symbol2str();
ch3mon(oper, expp)

View File

@ -16,7 +16,8 @@
#include "Lpars.h"
#include "assert.h"
arith full_mask[MAXSIZE];/* full_mask[1] == 0XFF, full_mask[2] == 0XFFFF, .. */
/* full_mask[1] == 0XFF, full_mask[2] == 0XFFFF, .. */
arith full_mask[MAXSIZE + 1];
#ifndef NOCROSS
arith max_int; /* maximum integer on target machine */
arith max_unsigned; /* maximum unsigned on target machine */
@ -247,7 +248,7 @@ init_cst()
while (!(bt < 0)) {
bt = (bt << 8) + 0377, i++;
if (i == MAXSIZE)
if (i > MAXSIZE)
fatal("array full_mask too small for this machine");
full_mask[i] = bt;
}

View File

@ -353,7 +353,7 @@ C_magic()
}
/*** the compact code generating routines ***/
#define fit16i(x) ((x) >= (long)0xFFFF8000 && (x) <= (long)0x00007FFF)
#define fit16i(x) ((x) >= (long)(-0x8000) && (x) <= (long)0x7FFF)
#define fit8u(x) ((x) <= 0xFF) /* x is already unsigned */
void

View File

@ -23,7 +23,7 @@
! If you ever need to change the boot code, this needs adjusting. I recommend
! a hex editor.
PADDING = 0xB9
PADDING = 0xB7
! Some definitions.
@ -45,8 +45,8 @@ start2:
mov ax, cs
mov ds, ax
mov es, ax
mov ss, ax
! Defer setting es until after probing the drive.
! Initialise the stack, which will start at the top of our segment and work
! down.
@ -65,10 +65,13 @@ start2:
call write_string
! Probe the drive to figure out its geometry.
! This might clobber es.
push dx
mov ax, 0x0800 ! service number
int 0x13
mov ax, cs ! restore es
mov es, ax
pop ax
jc cant_boot

View File

@ -13,6 +13,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <ctype.h>
#include "ack.h"
@ -83,19 +84,26 @@ char *firstblank(str) char *str ; {
}
/* VARARGS1 */
fatal(fmt,p1,p2,p3,p4,p5,p6,p7) char *fmt ; {
void fatal(const char* fmt, ...)
{
/* Fatal internal error */
va_list ap;
va_start(ap, fmt);
fprintf(STDOUT,"%s: fatal internal error, ",progname) ;
fprintf(STDOUT,fmt,p1,p2,p3,p4,p5,p6,p7);
vfprintf(STDOUT, fmt, ap);
fprintf(STDOUT,"\n") ;
quit(-2) ;
}
/* VARARGS1 */
vprint(fmt,p1,p2,p3,p4,p5,p6,p7) char *fmt ; {
void vprint(const char* fmt, ...)
{
/* Diagnostic print, no auto NL */
fprintf(STDOUT,fmt,p1,p2,p3,p4,p5,p6,p7);
va_list ap;
va_start(ap, fmt);
vfprintf(STDOUT, fmt, ap);
va_end(ap);
}
#ifdef DEBUG
@ -108,30 +116,38 @@ prns(s) register char *s ; {
#endif
/* VARARGS1 */
fuerror(fmt,p1,p2,p3,p4,p5,p6,p7) char *fmt ; {
void fuerror(const char *fmt, ...) {
/* Fatal user error */
va_list ap;
va_start(ap, fmt);
fprintf(STDOUT,"%s: ",progname) ;
fprintf(STDOUT,fmt,p1,p2,p3,p4,p5,p6,p7);
vfprintf(STDOUT, fmt, ap);
fprintf(STDOUT,"\n") ;
quit(-1) ;
}
/* VARARGS1 */
werror(fmt,p1,p2,p3,p4,p5,p6,p7) char *fmt ; {
void werror(const char *fmt, ...) {
/* Warning user error, w_flag */
va_list ap;
if ( w_flag ) return ;
va_start(ap, fmt);
fprintf(STDOUT,"%s: warning, ",progname) ;
fprintf(STDOUT,fmt,p1,p2,p3,p4,p5,p6,p7);
vfprintf(STDOUT, fmt, ap);
fprintf(STDOUT,"\n") ;
va_end(ap);
}
/* VARARGS1 */
error(fmt,p1,p2,p3,p4,p5,p6,p7) char *fmt ; {
void error(const char *fmt, ...) {
/* User error, it is the callers responsibility to quit */
va_list ap;
va_start(ap, fmt);
fprintf(STDOUT,"%s: ",progname) ;
fprintf(STDOUT,fmt,p1,p2,p3,p4,p5,p6,p7);
vfprintf(STDOUT, fmt, ap);
fprintf(STDOUT,"\n") ;
n_error++ ;
va_end(ap);
}
do_flush() {

View File

@ -140,42 +140,29 @@ void emits(struct outsect* section)
}
void iconvert(char* buf, char* str, char* fmt)
{
register char *nf, *ni, *no ;
int last, i ;
long value ;
ni=buf ; no=str ; nf=fmt ;
while ( last = *nf++ ) {
last -= '0' ;
if ( last<1 || last >9 ) fatal("illegal out.h format string\n");
value=0 ;
i=last ;
while ( i-- ) {
value = (value<<8) + (ni[i]&0xFF) ;
}
switch ( last ) {
case 0 : break ;
case 1 : *no= value ; break ;
case 2 : *(unsigned short *)no = value ; break ;
case 4 : *(long *)no = value ; break ;
default :
fatal("illegal out.h format string\n");
}
ni += last ; no += last ;
}
}
/* Macros from modules/src/object/obj.h */
#define Xchar(ch) ((ch) & 0377)
#define uget2(c) (Xchar((c)[0]) | ((unsigned) Xchar((c)[1]) << 8))
#define get4(c) (uget2(c) | ((long) uget2((c)+2) << 16))
/* Read the ack.out file header. */
int rhead(FILE* f, struct outhead* head)
{
char buf[sizeof(struct outhead)];
char buf[SZ_HEAD], *c;
if (fread(buf, sizeof(buf), 1, f) != 1)
return 0;
iconvert(buf, (char*) head, SF_HEAD);
c = buf;
head->oh_magic = uget2(c); c += 2;
head->oh_stamp = uget2(c); c += 2;
head->oh_flags = uget2(c); c += 2;
head->oh_nsect = uget2(c); c += 2;
head->oh_nrelo = uget2(c); c += 2;
head->oh_nname = uget2(c); c += 2;
head->oh_nemit = get4(c); c += 4;
head->oh_nchar = get4(c);
return 1;
}
@ -183,12 +170,17 @@ int rhead(FILE* f, struct outhead* head)
int rsect(FILE* f, struct outsect* sect)
{
char buf[sizeof(struct outsect)];
char buf[SZ_SECT], *c;
if (fread(buf, sizeof(buf), 1, f) != 1)
return 0;
iconvert(buf, (char*) sect, SF_SECT);
c = buf;
sect->os_base = get4(c); c += 4;
sect->os_size = get4(c); c += 4;
sect->os_foff = get4(c); c += 4;
sect->os_flen = get4(c); c += 4;
sect->os_lign = get4(c);
return 1 ;
}

View File

@ -189,7 +189,13 @@ cons_t xgetarb(l,f) int l; FILE *f ; {
shift=0 ; val=0 ;
while ( l-- ) {
val += ((cons_t)(c = ctrunc(xgetc(f))))<<shift ;
// val += ((cons_t)(c = ctrunc(xgetc(f))))<<shift ;
// Bug here: shifts with too large shift counts
// get unspecified results. --Ceriel
c = ctrunc(xgetc(f));
if (shift < 8 * sizeof(cons_t)) {
val += ((cons_t)c)<<shift ;
}
shift += 8 ;
}
if (c == 0377 && shift > 8 && ((shift>>3)&1)) {

View File

@ -849,8 +849,28 @@ extxcon(header) {
return ;
}
/* Added atol() that ignores overflow. --Ceriel */
long atol(s)
register char *s;
{
register long total = 0;
register unsigned digit;
int minus = 0;
while (*s == ' ' || *s == '\t') s++;
if (*s == '+') s++;
else if (*s == '-') {
s++;
minus = 1;
}
while ((digit = *s++ - '0') < 10) {
total *= 10;
total += digit;
}
return(minus ? -total : total);
}
extvcon(header) {
extern long atol() ;
/*
* generate data for a constant initialized by a string.
*/

View File

@ -357,22 +357,22 @@ DoCFU()
wtrap(WILLCONV, EILLINS);
}
f = fpop(4L);
npush((long) f, 2L);
npush((unsigned long) f, 2L);
return;
case 44:
f = fpop(4L);
npush((long) f, 4L);
npush((unsigned long) f, 4L);
return;
case 82:
if (wsize == 4) {
wtrap(WILLCONV, EILLINS);
}
f = fpop(8L);
npush((long) f, 2L);
npush((unsigned long) f, 2L);
return;
case 84:
f = fpop(8L);
npush((long) f, 4L);
npush((unsigned long) f, 4L);
return;
default:
wtrap(WILLCONV, EILLINS);