KCL for unixpc

Alex S. Crain alex at umbc3.UMD.EDU
Sat Oct 15 03:38:49 AEST 1988


	I got some many requests for this that I decided to post it. For
those folks who I sent diffs out to, be aware that there are 2 minor problems
that have been fixed. First is the problems with ths shar file, which was 
slightly corroded, and second is that undump needs -DUNIXPC to be defined,
but this was not reflected in the makefile. Again, both are fixed here.

	Heres the stuff to get KCL on a 3b1. This file will create a 
directory ./3b1port, which should live at the top level of the kcl tree,
next to unixport, attport, etc.

	See the file ./3b1port/Install for instructions.

	This is pretty raw lisp, without fancy additives. I will be adding
enhancements like AKCL and PCL if I can make them work, so what I would 
like is this: If you install KCL and use it, please contact me, so that I 
can build a mailing list for updates.

	KCL can be sort of a nightmare to build because of its size and 
complexity. let me know if you have problems, and I will do my best to 
answer them.

					:alex.
					Systems Programmer
nerwin!alex at umbc3.umd.edu		UMBC
alex at umbc3.umd.edu


--------------------------Snip, Snip----------------------------------------
/bin/mkdir 3b1port
/bin/mkdir 3b1port/diffs
#!/bin/sh
# shar:	Shell Archiver  (v1.22)
#
#	Run the following text with /bin/sh to create:
#	  3b1port/Install
#	  3b1port/ild.c
#	  3b1port/init_kclc.lsp
#	  3b1port/init_kcli.lsp
#	  3b1port/kcl.c
#	  3b1port/kcl.ifile
#	  3b1port/lc.c
#	  3b1port/makefile
#	  3b1port/sys_kclc.c
#	  3b1port/sys_kcli.c
#	  3b1port/undump.1
#	  3b1port/undump.c
#
sed 's/^X//' << 'SHAR_EOF' > 3b1port/Install &&
XInstallation procedure..
X
X#1) install source tree in /usr/local/lisp (or wherever), cd there.
X	install the 3b1port directory as ./3b1port
X
X#2) edit ./makefile to set PORTDIR = 3b1port
X
X#3) patch source files with the files in 3b1port/diffs/*
X	bin/dpp.c	-	fix the syntax of the # line directives
X	h/include.h	-	add a new machine type ATT3b1
X	h/cmpinclude.h	-	replace this with 3b1port/diffs/cmpinclude.h
X	c/alloc.c	-	use sbrk() for dynamic memory allocation.
X	c/earith.c	-	add SGS assembly routines
X	c/bitop.c	-	add SGS assembly routines
X	c/main.c	-	set default *features*
X	c/unixsave.c	-	remove the lisp (save) function (doesn't work)
X	c/3b1_chtab.s	-	New file
X
X	The diff files are the result of diff -c, and work with tha patch 
Xprogram. In any case, the changes are not large, so patching by hand would not
Xbe unreasonable. The files that do not end in .diff (3b1_chtab.s and 
Xcmpinclude.h) are direct replacements, not diffs.
X	
X#4) edit o/makefile to set
X	MACHINE = ATT3b1
X	CHTAB	= 3b1_chtab.s	
X	DEFS	= -D$(MACHINE) -DMAXPAGE=1532 -DVSSIZE=8152
X
X#5) If you do not like things in /usr/local/bin and /usr/local/lib, 
Xedit 3b1port/makefile and change the DESTDIR and LIBDIR declaration
Xto something appropriate (like /usr/bin and /usr/lib).
X
X#6) Delete the file c/include.h, because this file shadows h/include.h, 
Xwhich we have changed. (This should probably be a link anyway)
X
X#7) Build the system. first, su and install cmpinclude.h in the /usr/include
Xdirectory. Make sure to install our cmpinclude.h instead of the stock one.
XThe top level makefile depends on this being installed.
X
X	from the top level directory (/usr/local/lisp here) and type
X
X	% make 
X
Xand go away for about 3 hours.
X
X#8) cd to the 3b1port directory. At this point (Hopefully) you will have
Xseveral binaries:
X	kcli_s	- a partially loaded kcl interpreter
X	kclc_s	- a partially loaded kcl compiler
X	kcl	- a driver program for the interpreter
X	lc	- a driver program for the compiler
X	undump	- a program to convert a core file to an executable binary.
X
XThe idea here is to fire up kcli_s, load in the neccessary lisp code and then
Xsave the running image like a snapshot. There are several ways to do this, the
Xeasiast being undump. This also has the advantage of providing the undump
Xprogram, with which you can undump other things (see undump(1))
X
X	Here's how it works:
X
X	% kcli_s
X	Koyto Common Lisp....
X	> (load "init_kcli.lsp")
X	initializing predlib...
X	...
X	> ^\				# this is a keyboard interrupt
X	kcli_s: Quit -- core dumped.
X	% undump kcli kcli_s core
X	%
X
Xyou now have an executable kcli. repeat this for kclc, and then type:
X
X	% make install
X
X(su if neccessary) 
X
XYou are done.
SHAR_EOF
chmod 0644 3b1port/Install || echo "restore of 3b1port/Install fails"
sed 's/^X//' << 'SHAR_EOF' > 3b1port/ild.c &&
X/*
X	ild: incremental linker/loader on System V
X
X				(C) Masami Hagiya, 1986
X
X	Usage:
X		% ild loading_object start_address \
X		      loaded_object output_file
X	
X	The start address is in decimal.
X
X	How to Create:
X
X	To compile this file (ild.c) and make ild, do the following.
X
X		% cc -o ild ild.c -lld
X
X	
X	Problem:
X	This program only supports the simplest linear search for symbols.
X
X*/
X
X#include <stdio.h>
X#include <filehdr.h>
X#include <aouthdr.h>
X#include <scnhdr.h>
X#include <reloc.h>
X#include <syms.h>
X#include <storclass.h>
X#include <ldfcn.h>
X
Xstruct filehdr my_header;
Xstruct syment *my_symbol_table;
Xchar *my_string_table;
X
Xstruct filehdr header;
Xstruct scnhdr section[9];
Xchar *text;
Xstruct syment *symbol_table;
Xchar *string_table;
X
Xchar *start_address;
X
Xstruct reloc relocation_info;
X
Xmain(argc, argv)
Xint argc;
Xchar *argv[];
X{
X	if (argc < 5) {
X		fprintf(stderr, "Arg count.\n");
X		exit(1);
X	}
X	/*
X	printf("ild %s %s %s %s\n", argv[1], argv[2], argv[3], argv[4]);
X	fflush(stdout);
X	*/
X	get_myself(argv[1]);
X	/*
X	printf("Myself got.\n");
X	fflush(stdout);
X	*/
X	start_address = (char *)atoi(argv[2]);
X	fasload(argv[3], argv[4]);
X	exit(0);
X}
X
Xget_myself(fname)
Xchar *fname;
X{
X	int i;
X	LDFILE *ldptr;
X	extern char *malloc();
X	char * filename = malloc(strlen(fname)+3);
X	strcpy(filename, fname);
X	strcat(filename, "_s");
X	ldptr = ldopen(filename, NULL);
X	if (ldptr == NULL) {
X		fprintf(stderr, "Can't open %s\n", filename);
X		exit(1);
X	}
X
X	ldfhread(ldptr, &my_header);
X
X	ldtbseek(ldptr);
X	my_symbol_table
X	= (struct syment *)malloc(sizeof(struct syment) * my_header.f_nsyms);
X	/*
X	sizeof(struct syment) and SYMESZ are not always the same.
X	*/
X	for (i = 0;  i < my_header.f_nsyms;  i++)
X		FREAD(&my_symbol_table[i], SYMESZ, 1, ldptr);
X	/*
X	If the string table is not empty,
X	its length is stored after the symbol table,
X	This is not described in the manual, and may change in the future.
X	*/
X	if (FREAD(&i, 4, 1, ldptr) > 0)	{
X		my_string_table = malloc(i);
X		FSEEK(ldptr, -4, 1);
X		FREAD(my_string_table, 1, i, ldptr);
X	}
X
X	ldclose(ldptr);
X}
X
Xfasload(filename, outputfilename)
Xchar *filename, *outputfilename;
X{
X	register struct syment *sym, *end;
X	int i, n;
X	LDFILE *ldptr;
X	FILE *fp;
X
X	extern char *malloc();
X
X	ldptr = ldopen(filename, "r");
X	if (ldptr == NULL) {
X		fprintf(stderr, "Can't open %s\n", filename);
X		exit(1);
X	}
X
X	ldfhread(ldptr, &header);
X	if (header.f_opthdr != 0) {
X		fprintf(stderr, "Unexpected optional header.\n");
X		exit(1);
X	}
X
X	if (header.f_nscns < 3 || header.f_nscns > 8) {
X		fprintf(stderr, "Illegal number of sections.\n");
X		exit(1);
X	}
X
X	for (i = 1;  i <= header.f_nscns;  i++)
X		ldshread(ldptr, i, &section[i]);
X
X	if (strcmp(section[1].s_name, ".text") != 0) {
X		fprintf(stderr, ".text not found.\n");
X		exit(1);
X	}
X	if (strcmp(section[2].s_name, ".data") != 0) {
X		fprintf(stderr, ".data not found.\n");
X		exit(1);
X	}
X	/*
X	The bss segment need not exist.
X	*/
X	/*
X	if (strcmp(section[3].s_name, ".bss") != 0) {
X		fprintf(stderr, ".bss not found.\n");
X		exit(1);
X	}
X	*/
X
X	if (section[1].s_size > 0 &&
X	    section[1].s_scnptr !=
X	    sizeof(struct filehdr) +
X	    header.f_nscns*sizeof(struct scnhdr)) {
X		fprintf(stderr, "Contradictory text start.\n");
X		exit(1);
X	}
X	if (section[1].s_size > 0 && section[2].s_size > 0 &&
X	    section[1].s_scnptr + section[1].s_size !=
X	    section[2].s_scnptr) {
X		fprintf(stderr, "Contradictory data start.\n");
X		exit(1);
X	}
X
X	text = malloc(section[1].s_size + section[2].s_size);
X
X	FSEEK(ldptr, section[1].s_scnptr, 0);
X	FREAD(text, 1, section[1].s_size + section[2].s_size, ldptr);
X
X	ldtbseek(ldptr);
X	symbol_table
X	= (struct syment *)malloc(sizeof(struct syment) * header.f_nsyms);
X	/*
X	sizeof(struct syment) and SYMESZ are not always the same.
X	*/
X	for (i = 0;  i < header.f_nsyms;  i++)
X		FREAD(&symbol_table[i], SYMESZ, 1, ldptr);
X	/*
X	If the string table is not empty,
X	its length is stored after the symbol table,
X	This is not described in the manual, and may change in the future.
X	*/
X	if (FREAD(&i, 4, 1, ldptr) > 0)	{
X		string_table = malloc(i);
X		FSEEK(ldptr, -4, 1);
X		FREAD(string_table, 1, i, ldptr);
X	}
X
X	end = symbol_table + header.f_nsyms;
X	for (sym = symbol_table; sym < end; sym++) {
X		switch (sym->n_scnum)	{
X		case 1: case 2: case 3:
X			/*
X			If the section number of the symbol is 1, 2, or 3,
X			the start address of the text is stored.
X			This is not described in the manual,
X			and may depend on CPU or may change in the future.
X			*/
X			sym->n_value = (int)start_address;
X			break;
X		case N_UNDEF:
X			search_symbol(sym);
X			break;
X		default:
X			/*
X			Does nothing. Is it OK?
X			*/
X			break;
X		}
X		sym += sym->n_numaux;
X	}
X
X	ldrseek(ldptr, 1);
X	for (i = 0; i < section[1].s_nreloc; i++) {
X		/*
X		FREAD(&relocation_info, sizeof(struct reloc), 1, ldptr);
X		*/
X		FREAD(&relocation_info, 10, 1, ldptr);
X		relocate();
X	}
X
X	ldrseek(ldptr, 2);
X	for (i = 0; i < section[2].s_nreloc; i++) {
X		/*
X		FREAD(&relocation_info, sizeof(struct reloc), 1, ldptr);
X		*/
X		FREAD(&relocation_info, 10, 1, ldptr);
X		relocate();
X	}
X
X	fp = fopen(outputfilename, "w");
X	if (fp == NULL)	{
X		fprintf(stderr, "Can't creat %s.\n", outputfilename);
X		exit(1);
X	}
X	fwrite(&header, sizeof(struct filehdr), 1, fp);
X	for (i = 1;  i <= header.f_nscns;  i++)
X		fwrite(&section[i], sizeof(struct scnhdr), 1, fp);
X	fwrite(text, 1, section[1].s_size + section[2].s_size, fp);
X
X	fclose(fp);
X	ldclose(ldptr);
X}
X
Xsearch_symbol(sym)
Xregister struct syment *sym;
X{
X	register struct syment *p, *end;
X
X	end = my_symbol_table + my_header.f_nsyms;
X	for (p = my_symbol_table; p < end; p++)	{
X		/*
X		Is the following check enough?
X		*/
X		if (1 <= p->n_scnum && p->n_scnum <= 3 &&
X		    p->n_sclass == C_EXT &&
X		    (sym->n_zeroes == 0
X		    ? (p->n_zeroes == 0 &&
X		       strcmp(&my_string_table[p->n_offset],
X			      &string_table[sym->n_offset]) == 0)
X		    : (p->n_zeroes != 0 &&
X		       strncmp(p->n_name, sym->n_name, SYMNMLEN) == 0)))
X				goto FOUND;
X		p += p->n_numaux;
X	}
X
X	sym->n_name[SYMNMLEN] = '\0';
X	fprintf(stderr, "%s: undefined symbol.\n",
X		(sym->n_zeroes ? sym->n_name : &string_table[sym->n_offset]));
X	exit(1);
X
XFOUND:
X	/*
X	Subtract the original value.
X	This is not described in the manual,
X	and I don't understand why.
X	*/
X	sym->n_value = p->n_value - sym->n_value;
X}
X
Xrelocate()
X{
X	char *where, *p;
X	int value;
X
X	where = text + relocation_info.r_vaddr;
X	if (relocation_info.r_type == R_ABS)
X		return;
X	/*
X	The following code depends on CPU.
X	*/
X
X	if (relocation_info.r_type == R_RELBYTE ||
X	    relocation_info.r_type == R_RELWORD ||
X	    relocation_info.r_type == R_RELLONG) 
X	 {
X	   p = (char *)(&value);
X	   p[3] = where[3];
X	   p[2] = where[2];
X	   p[1] = where[1];
X	   p[0] = where[0];
X	   value += symbol_table[relocation_info.r_symndx].n_value;
X	   where[0] = p[0];
X	   where[1] = p[1];
X	   where[2] = p[2];
X	   where[3] = p[3];
X	}
X	else if (relocation_info.r_type == R_DIR32S) 
X	 {
X	    fprintf(stderr, "%d: unsupported relocation type.",
X		    relocation_info.r_type);
X	    exit(1);
X	 }
X	else 
X	 {
X	   p = (char *)(&value);
X	   p[3] = where[0];
X	   p[2] = where[1];
X	   p[1] = where[2];
X	   p[0] = where[3];
X	   value += symbol_table[relocation_info.r_symndx].n_value;
X	   where[0] = p[3];
X	   where[1] = p[2];
X	   where[2] = p[1];
X	   where[3] = p[0];
X	}
X}
SHAR_EOF
chmod 0644 3b1port/ild.c || echo "restore of 3b1port/ild.c fails"
sed 's/^X//' << 'SHAR_EOF' > 3b1port/init_kclc.lsp &&
X(in-package "COMPILER")
X(in-package "SYSTEM")
X(in-package "USER")
X(in-package "LISP")
X(in-package "USER")
X(progn (allocate 'cons 90) (system:init-system) (gbc t)
X (load #"../cmpnew/cmpmain.lsp") (gbc t) (load #"../cmpnew/lfun_list.lsp")
X (gbc t) (load #"../cmpnew/cmpopt.lsp") (gbc t)
X (defun compile-file
X  (&rest system::args &aux (*print-pretty* nil) (*package* *package*))
X  (compiler::init-env) (apply 'compiler::compile-file1 system::args))
X (defun compile (&rest system::args &aux (*print-pretty* nil))
X  (apply 'compiler::compile1 system::args))
X (defun disassemble (&rest system::args &aux (*print-pretty* nil))
X  (apply 'compiler::disassemble1 system::args))
X (setq system::*old-top-level* (symbol-function 'system:top-level))
X (defun system::kcl-top-level nil
X  (when (> (system:argc) 1)
X        (setq system:*system-directory* (system:argv 1)))
X  (when (>= (system:argc) 5)
X        (let ((system::*quit-tag* (cons nil nil))
X              (system::*quit-tags* nil) (system::*break-level* '())
X              (system::*break-env* nil) (system::*ihs-base* 1)
X              (system::*ihs-top* 1) (system::*current-ihs* 1)
X              (*break-enable* nil))
X             (system:error-set
X              '(let ((system::flags (system:argv 4)))
X                    (setq system:*system-directory*
X                          (pathname (system:argv 1)))
X                    (compile-file (system:argv 2) :output-file
X                     (system:argv 3) :o-file
X                     (case (schar system::flags 1) (#\0 nil) (#\1 t)
X                           (t (system:argv 5)))
X                     :c-file
X                     (case (schar system::flags 2) (#\0 nil) (#\1 t)
X                           (t (system:argv 6)))
X                     :h-file
X                     (case (schar system::flags 3) (#\0 nil) (#\1 t)
X                           (t (system:argv 7)))
X                     :data-file
X                     (case (schar system::flags 4) (#\0 nil) (#\1 t)
X                           (t (system:argv 8)))
X                     :system-p
X                     (if (char-equal (schar system::flags 0) #\S) t
X                         nil))))
X             (bye)))
X  (format t "KCl (Kyoto Common Lisp)  ~A~%" "Feburary 13, 1986")
X  (in-package 'system::user) (funcall system::*old-top-level*))
X (defun lisp-implementation-version nil "Feburary 13, 1986")
X (setq *modules* nil) (gbc t) (system:reset-gbc-count)
X (allocate 'cons 200)
X (defun system:top-level nil (system::kcl-top-level))
X )
SHAR_EOF
chmod 0644 3b1port/init_kclc.lsp || echo "restore of 3b1port/init_kclc.lsp fails"
sed 's/^X//' << 'SHAR_EOF' > 3b1port/init_kcli.lsp &&
X(in-package "COMPILER")
X(in-package "SYSTEM")
X(in-package "USER")
X(in-package "LISP")
X(in-package "USER")
X(progn (allocate 'cons 90) (system:init-system) (gbc t)
X (setq system::*old-top-level* (symbol-function 'system:top-level))
X (defun system::kcl-top-level nil
X  (when (> (system:argc) 1)
X        (setq system:*system-directory* (system:argv 1)))
X  (format t "KCl (Kyoto Common Lisp)  ~A~%" "Feburary 13, 1986")
X  (in-package 'system::user) (funcall system::*old-top-level*))
X (defun lisp-implementation-version nil "Feburary 13, 1986")
X (setq *modules* nil) (gbc t) (system:reset-gbc-count)
X (allocate 'cons 200)
X (defun system:top-level nil (system::kcl-top-level))
X )
SHAR_EOF
chmod 0644 3b1port/init_kcli.lsp || echo "restore of 3b1port/init_kcli.lsp fails"
sed 's/^X//' << 'SHAR_EOF' > 3b1port/kcl.c &&
X#include <stdio.h>
X#include <signal.h>
X
X#define	COMSIZ	1024
X
Xmain()
X{
X	int in[2];
X	int out[2];
X	char command[COMSIZ];
X	char buf[4];
X
X	pipe(in);
X	pipe(out);
X	if (in[1] != 4 || out[0] != 5) {
X		fprintf(stderr, "Can't get a pipe.\n");
X		exit(1);
X	}
X	fflush(stdout);
X	if (fork() != 0) {
X		close(in[0]);
X		close(out[1]);
X		if (execl(KCLI_SELF, KCLI_SELF, SYSTEM_DIRECTORY, 0) < 0) {
X			fprintf(stderr, "Can't exec KCL.\n");
X			exit(1);
X		}
X	}
X	signal(SIGINT, SIG_IGN);
X	close(in[1]);
X	close(out[0]);
X	for (;;) {
X		if (read(in[0], command, COMSIZ) <= 0)
X			exit(0);
X		else if (! strncmp(command, "cd ", 3)) {
X			char *s, *p = &command[3];
X			while(*p == ' ') p++;
X			for (s=p; *s && *s != ' '; s++);
X			*s = '\0';
X			buf[0] = chdir(p);
X		}
X		else
X			buf[0] = system(command);
X		write(out[1], buf, 1);
X	}
X}
SHAR_EOF
chmod 0644 3b1port/kcl.c || echo "restore of 3b1port/kcl.c fails"
sed 's/^X//' << 'SHAR_EOF' > 3b1port/kcl.ifile &&
X/*
X#sccs	"@(#)shlib:ifile.0413s	1.2"
X*/
X
XMEMORY {
X	user_mem : origin = 0x80000 , length = 0x37ff000
X}
X
XSECTIONS {
X	.text 0x80000 BLOCK(1024) : {}
X	GROUP ALIGN(65536) BLOCK(1024) : {
X		.data : {}
X		.bss  : {}
X		.lib  :	{}
X	}
X}
X
Xtimezone = 0x00300000;
Xtzname = 0x00300004;
Xpatblack = 0x00300014;
Xpatwhite = 0x00300034;
Xpatgray = 0x00300054;
Xpatltgray = 0x00300074;
X_iob = 0x0030009c;
X_bufendtab = 0x003001b8;
X_ctype = 0x0030020c;
Xsys_errlist = 0x0030030e;
X_iob2 = 0x00300bc0;
X_buf2endtab = 0x00300f0c;
X_dbase = 0x00301000;
Xerrno = _dbase + 0x0;
Xenviron = _dbase + 0x4;
XPC = _dbase + 0x8;
XBC = _dbase + 0xc;
XUP = _dbase + 0x10;
Xospeed = _dbase + 0x14;
XLINES = _dbase + 0x18;
XCOLS = _dbase + 0x1c;
Xwncur = _dbase + 0x20;
Xoptind = _dbase + 0x22;
Xoptarg = _dbase + 0x26;
Xopterr = _dbase + 0x2a;
Xoptopt = _dbase + 0x2e;
Xsys_nerr = _dbase + 0x32;
XFPA_flag = _dbase + 0x36;
XFPA_s = _dbase + 0x3a;
XFPA_d = _dbase + 0x3e;
X_sibuf = 0x00306000;
X_sobuf = 0x00306408;
X_tbase = 0x00310000;
Xshlbat = _tbase + 0x0;
Xshlbatid = _tbase + 0x6;
Xaccess = _tbase + 0xc;
Xalarm = _tbase + 0x12;
Xbrk = _tbase + 0x18;
Xibrk = _tbase + 0x1e;
Xsbrk = _tbase + 0x24;
Xchdir = _tbase + 0x2a;
Xchmod = _tbase + 0x30;
Xchown = _tbase + 0x36;
Xchroot = _tbase + 0x3c;
Xclose = _tbase + 0x42;
Xcreat = _tbase + 0x48;
Xdup = _tbase + 0x4e;
Xexecl = _tbase + 0x54;
Xexecv = _tbase + 0x5a;
Xexecle = _tbase + 0x60;
Xexecve = _tbase + 0x66;
Xexeclp = _tbase + 0x6c;
Xexecvp = _tbase + 0x72;
Xexit = _tbase + 0x78;
X_exit = _tbase + 0x7e;
Xfcntl = _tbase + 0x84;
Xfork = _tbase + 0x8a;
Xgetpid = _tbase + 0x90;
Xgetpgrp = _tbase + 0x96;
Xgetppid = _tbase + 0x9c;
Xgetuid = _tbase + 0xa2;
Xgeteuid = _tbase + 0xa8;
Xgetgid = _tbase + 0xae;
Xgetegid = _tbase + 0xb4;
Xgtty = _tbase + 0xba;
Xioctl = _tbase + 0xc0;
Xkill = _tbase + 0xc6;
Xlink = _tbase + 0xcc;
Xlocking = _tbase + 0xd2;
Xlseek = _tbase + 0xd8;
Xmknod = _tbase + 0xde;
Xmount = _tbase + 0xe4;
Xmsgctl = _tbase + 0xea;
Xmsgget = _tbase + 0xf0;
Xmsgsnd = _tbase + 0xf6;
Xmsgrcv = _tbase + 0xfc;
Xnice = _tbase + 0x102;
Xopen = _tbase + 0x108;
Xopeni = _tbase + 0x10e;
Xpause = _tbase + 0x114;
Xpipe = _tbase + 0x11a;
Xprofil = _tbase + 0x120;
Xptrace = _tbase + 0x126;
Xread = _tbase + 0x12c;
Xsemctl = _tbase + 0x132;
Xsemget = _tbase + 0x138;
Xsemop = _tbase + 0x13e;
Xsetpgrp = _tbase + 0x144;
Xsetuid = _tbase + 0x14a;
Xsetgid = _tbase + 0x150;
Xshmctl = _tbase + 0x156;
Xshmget = _tbase + 0x15c;
Xshmat = _tbase + 0x162;
Xshmdt = _tbase + 0x168;
Xsignal = _tbase + 0x16e;
Xstat = _tbase + 0x174;
Xstty = _tbase + 0x17a;
Xfstat = _tbase + 0x180;
Xstime = _tbase + 0x186;
Xswrite = _tbase + 0x18c;
Xsync = _tbase + 0x192;
Xsyslocal = _tbase + 0x198;
Xtime = _tbase + 0x19e;
Xtimes = _tbase + 0x1a4;
Xulimit = _tbase + 0x1aa;
Xumask = _tbase + 0x1b0;
Xumount = _tbase + 0x1b6;
Xuname = _tbase + 0x1bc;
Xunlink = _tbase + 0x1c2;
Xustat = _tbase + 0x1c8;
Xutime = _tbase + 0x1ce;
Xwait = _tbase + 0x1d4;
Xwrite = _tbase + 0x1da;
Xabort = _tbase + 0x1e0;
Xabs = _tbase + 0x1e6;
Xatof = _tbase + 0x1ec;
Xclock = _tbase + 0x1f2;
Xcrypt = _tbase + 0x1f8;
Xsetkey = _tbase + 0x1fe;
Xencrypt = _tbase + 0x204;
Xctermid = _tbase + 0x20a;
Xctime = _tbase + 0x210;
Xlocaltime = _tbase + 0x216;
Xgmtime = _tbase + 0x21c;
Xasctime = _tbase + 0x222;
Xtzset = _tbase + 0x228;
Xcuserid = _tbase + 0x22e;
Xecvt = _tbase + 0x234;
Xfcvt = _tbase + 0x23a;
Xgcvt = _tbase + 0x240;
Xfclose = _tbase + 0x246;
Xfflush = _tbase + 0x24c;
Xfopen = _tbase + 0x252;
Xfreopen = _tbase + 0x258;
Xfdopen = _tbase + 0x25e;
Xfread = _tbase + 0x264;
Xfwrite = _tbase + 0x26a;
Xfrexp = _tbase + 0x270;
Xldexp = _tbase + 0x276;
Xmodf = _tbase + 0x27c;
Xfseek = _tbase + 0x282;
Xrewind = _tbase + 0x288;
Xftell = _tbase + 0x28e;
Xftw = _tbase + 0x294;
Xfgetc = _tbase + 0x29a;
Xgetw = _tbase + 0x2a0;
Xgetcwd = _tbase + 0x2a6;
Xgetenv = _tbase + 0x2ac;
Xgetgrent = _tbase + 0x2b2;
Xgetgrgid = _tbase + 0x2b8;
Xgetgrnam = _tbase + 0x2be;
Xsetgrent = _tbase + 0x2c4;
Xendgrent = _tbase + 0x2ca;
Xgetlogin = _tbase + 0x2d0;
Xgetopt = _tbase + 0x2d6;
Xgetpass = _tbase + 0x2dc;
Xgetpw = _tbase + 0x2e2;
Xgetpwent = _tbase + 0x2e8;
Xgetpwuid = _tbase + 0x2ee;
Xgetpwnam = _tbase + 0x2f4;
Xsetpwent = _tbase + 0x2fa;
Xendpwent = _tbase + 0x300;
Xgets = _tbase + 0x306;
Xgetchar = _tbase + 0x30c;
Xfgets = _tbase + 0x312;
Xgetutent = _tbase + 0x318;
Xgetutid = _tbase + 0x31e;
Xgetutline = _tbase + 0x324;
Xpututline = _tbase + 0x32a;
Xsetutent = _tbase + 0x330;
Xendutent = _tbase + 0x336;
Xutmpname = _tbase + 0x33c;
X
X
X
X
X
Xmemccpy = _tbase + 0x360;
Xmemchr = _tbase + 0x366;
Xmemcmp = _tbase + 0x36c;
Xmemcpy = _tbase + 0x372;
Xmemset = _tbase + 0x378;
Xmktemp = _tbase + 0x37e;
Xmonitor = _tbase + 0x384;
Xperror = _tbase + 0x38a;
Xpopen = _tbase + 0x390;
Xpclose = _tbase + 0x396;
Xprintf = _tbase + 0x39c;
Xfprintf = _tbase + 0x3a2;
Xsprintf = _tbase + 0x3a8;
Xfputc = _tbase + 0x3ae;
Xputw = _tbase + 0x3b4;
Xputpwent = _tbase + 0x3ba;
Xputs = _tbase + 0x3c0;
Xputchar = _tbase + 0x3c6;
Xfputs = _tbase + 0x3cc;
Xscanf = _tbase + 0x3d2;
Xfscanf = _tbase + 0x3d8;
Xsscanf = _tbase + 0x3de;
Xsetbuf = _tbase + 0x3e4;
Xsleep = _tbase + 0x3ea;
Xssignal = _tbase + 0x3f0;
Xgsignal = _tbase + 0x3f6;
Xstrcat = _tbase + 0x3fc;
Xstrncat = _tbase + 0x402;
Xstrcmp = _tbase + 0x408;
Xstrncmp = _tbase + 0x40e;
Xstrcpy = _tbase + 0x414;
Xstrncpy = _tbase + 0x41a;
Xstrlen = _tbase + 0x420;
Xstrchr = _tbase + 0x426;
Xstrrchr = _tbase + 0x42c;
Xstrpbrk = _tbase + 0x432;
Xstrspn = _tbase + 0x438;
Xstrcspn = _tbase + 0x43e;
Xstrtok = _tbase + 0x444;
Xstrtol = _tbase + 0x44a;
Xatol = _tbase + 0x450;
Xatoi = _tbase + 0x456;
Xswab = _tbase + 0x45c;
X
Xtmpfile = _tbase + 0x468;
Xtmpnam = _tbase + 0x46e;
Xtempnam = _tbase + 0x474;
Xttyname = _tbase + 0x47a;
Xisatty = _tbase + 0x480;
Xttyslot = _tbase + 0x486;
Xungetc = _tbase + 0x48c;
X_filbuf = _tbase + 0x492;
X_flsbuf = _tbase + 0x498;
Xlmul__ = _tbase + 0x49e;
Xlmul = _tbase + 0x4a4;
Xldiv__ = _tbase + 0x4aa;
Xldiv = _tbase + 0x4b0;
Xlrem__ = _tbase + 0x4b6;
Xlrem = _tbase + 0x4bc;
Xaldiv = _tbase + 0x4c2;
Xalmul = _tbase + 0x4c8;
Xalrem = _tbase + 0x4ce;
Xulmul = _tbase + 0x4d4;
Xuldiv__ = _tbase + 0x4da;
Xuldiv = _tbase + 0x4e0;
Xulrem__ = _tbase + 0x4e6;
Xulrem = _tbase + 0x4ec;
Xqsort = _tbase + 0x4f2;
Xl3tol = _tbase + 0x4f8;
Xltol3 = _tbase + 0x4fe;
Xtgetflag = _tbase + 0x504;
Xtgetent = _tbase + 0x50a;
Xtgetstr = _tbase + 0x510;
Xtgetnum = _tbase + 0x516;
Xtgoto = _tbase + 0x51c;
Xtputs = _tbase + 0x522;
Xform = _tbase + 0x528;
Xmenu = _tbase + 0x52e;
Xmessage = _tbase + 0x534;
Xsetattr = _tbase + 0x53a;
Xpb_open = _tbase + 0x540;
Xadf_gtxcd = _tbase + 0x546;
Xadf_gtwrd = _tbase + 0x54c;
Xpb_gets = _tbase + 0x552;
Xpb_check = _tbase + 0x558;
Xpb_weof = _tbase + 0x55e;
Xpb_seek = _tbase + 0x564;
Xpb_puts = _tbase + 0x56a;
Xpb_name = _tbase + 0x570;
Xpb_empty = _tbase + 0x576;
Xpb_gbuf = _tbase + 0x57c;
Xadf_gttok = _tbase + 0x582;
Xwrefresh = _tbase + 0x588;
Xtrack = _tbase + 0x58e;
Xwcreate = _tbase + 0x594;
Xinitscr = _tbase + 0x59a;
Xcbreak = _tbase + 0x5a0;
Xattroff = _tbase + 0x5a6;
Xnl = _tbase + 0x5ac;
Xattron = _tbase + 0x5b2;
Xflushinp = _tbase + 0x5b8;
Xnoecho = _tbase + 0x5be;
Xinch = _tbase + 0x5c4;
Xgetch = _tbase + 0x5ca;
Xsavetty = _tbase + 0x5d0;
Xresetty = _tbase + 0x5d6;
Xecho = _tbase + 0x5dc;
Xnocbreak = _tbase + 0x5e2;
Xnonl = _tbase + 0x5e8;
Xwdelete = _tbase + 0x5ee;
Xwprexec = _tbase + 0x5f4;
Xwpostwait = _tbase + 0x5fa;
Xwgetc = _tbase + 0x600;
Xkcodemap = _tbase + 0x606;
Xkeypad = _tbase + 0x60c;
Xwsigintr = _tbase + 0x612;
Xwind = _tbase + 0x618;
Xwsigcatch = _tbase + 0x61e;
Xwinit = _tbase + 0x624;
Xwsetbuf = _tbase + 0x62a;
Xiswind = _tbase + 0x630;
Xwexit = _tbase + 0x636;
Xendwin = _tbase + 0x63c;
Xwgetpos = _tbase + 0x642;
Xwgoto = _tbase + 0x648;
Xwinstr = _tbase + 0x64e;
Xwreadmouse = _tbase + 0x654;
Xwsetmouse = _tbase + 0x65a;
Xwgetmouse = _tbase + 0x660;
Xwnl = _tbase + 0x666;
Xwndelay = _tbase + 0x66c;
Xwprompt = _tbase + 0x672;
Xwguser = _tbase + 0x678;
Xwcmd = _tbase + 0x67e;
Xwslk = _tbase + 0x684;
Xwlabel = _tbase + 0x68a;
Xwuser = _tbase + 0x690;
Xwprintf = _tbase + 0x696;
Xprintw = _tbase + 0x69c;
Xwputc = _tbase + 0x6a2;
Xwputs = _tbase + 0x6a8;
Xwrastop = _tbase + 0x6ae;
Xwselect = _tbase + 0x6b4;
Xwgetsel = _tbase + 0x6ba;
Xwsetstat = _tbase + 0x6c0;
Xwgetstat = _tbase + 0x6c6;
Xsetty = _tbase + 0x6cc;
Xfixterm = _tbase + 0x6d2;
Xphysclr = _tbase + 0x6d8;
Xresetterm = _tbase + 0x6de;
Xsetterm = _tbase + 0x6e4;
Xgetterm = _tbase + 0x6ea;
Xbaudrate = _tbase + 0x6f0;
Xparseline = _tbase + 0x6f6;
Xslkcol = _tbase + 0x6fc;
Xsetjmp = _tbase + 0x702;
Xlongjmp = _tbase + 0x708;
Xafmulf = _tbase + 0x70e;
Xafdivf = _tbase + 0x714;
Xafaddf = _tbase + 0x71a;
X_cvfd = _tbase + 0x720;
X_cvif = _tbase + 0x726;
Xfltused = _tbase + 0x72c;
Xnlist = _tbase + 0x732;
Xfmul = _tbase + 0x738;
Xfdiv = _tbase + 0x73e;
Xfadd = _tbase + 0x744;
Xfsub = _tbase + 0x74a;
X_cvdf = _tbase + 0x750;
X_cvdi = _tbase + 0x756;
X_cvid = _tbase + 0x75c;
X_cvfi = _tbase + 0x762;
Xafadd = _tbase + 0x768;
Xafsub = _tbase + 0x76e;
Xafsubf = _tbase + 0x774;
Xafmul = _tbase + 0x77a;
Xexhelp = _tbase + 0x780;
Xtolower = _tbase + 0x786;
Xwicon = _tbase + 0x78c;
Xwicoff = _tbase + 0x792;
Xtoupper = _tbase + 0x798;
Xl64a = _tbase + 0x79e;
Xa64l = _tbase + 0x7a4;
X_bufsync = _tbase + 0x7aa;
Xsetuname = _tbase + 0x7b0;
Xauldiv = _tbase + 0x7b6;
Xeprintf = _tbase + 0x7bc;
Xdbsub__ = _tbase + 0x7c2;
Xdbadd__ = _tbase + 0x7c8;
Xdbdiv__ = _tbase + 0x7ce;
Xdbmul__ = _tbase + 0x7d4;
Xltodb__ = _tbase + 0x7da;
Xdbtol__ = _tbase + 0x7e0;
Xdbtofl__ = _tbase + 0x7e6;
Xfltodb__ = _tbase + 0x7ec;
Xltofl__ = _tbase + 0x7f2;
Xfltol__ = _tbase + 0x7f8;
Xultodb__ = _tbase + 0x7fe;
Xultofl__ = _tbase + 0x804;
Xaulmul = _tbase + 0x80a;
Xafdiv = _tbase + 0x810;
Xdbtst__ = _tbase + 0x816;
Xfltst__ = _tbase + 0x81c;
Xplock = _tbase + 0x822;
Xdial = _tbase + 0x828;
Xcallout = _tbase + 0x82e;
Xundial = _tbase + 0x834;
Xdrand48 = _tbase + 0x83a;
Xerand48 = _tbase + 0x840;
Xlrand48 = _tbase + 0x846;
Xmrand48 = _tbase + 0x84c;
Xsrand48 = _tbase + 0x852;
Xjrand48 = _tbase + 0x858;
Xseed48 = _tbase + 0x85e;
Xlcong48 = _tbase + 0x864;
Xrand = _tbase + 0x86a;
Xsrand = _tbase + 0x870;
Xftok = _tbase + 0x876;
Xputenv = _tbase + 0x87c;
Xtargets = _tbase + 0x882;
Xn_targets = _tbase + 0x888;
Xwtargeton = _tbase + 0x88e;
Xw_target = _tbase + 0x894;
X_fpachk = _tbase + 0x89a;
X_assert = _tbase + 0x8a0;
Xbsearch = _tbase + 0x8a6;
Xhcreate = _tbase + 0x8ac;
Xhsearch = _tbase + 0x8b2;
Xhdestroy = _tbase + 0x8b8;
Xtsearch = _tbase + 0x8be;
Xtdelete = _tbase + 0x8c4;
Xtwalk = _tbase + 0x8ca;
Xnrand48 = _tbase + 0x8d0;
SHAR_EOF
chmod 0644 3b1port/kcl.ifile || echo "restore of 3b1port/kcl.ifile fails"
sed 's/^X//' << 'SHAR_EOF' > 3b1port/lc.c &&
X#include <stdio.h>
X#include <signal.h>
X
X#define	COMSIZ	1024
X
Xmain(argc, argv)
Xint argc;
Xchar *argv[];
X{
X	int in[2];
X	int out[2];
X	char command[COMSIZ];
X	char buf[4];
X	char * cargs = "U1000";
X
X	if (argc != 2) {
X		fprintf(stderr, "Arg count.\n");
X		exit(1);
X	}
X
X	if (! strcmp(argv[0], "lc1"))
X	    cargs = "U1111";
X	else if (! strcmp(argv[0], "lcs1"))
X	    cargs = "S1111";
X
X	pipe(in);
X	pipe(out);
X	if (in[1] != 4 || out[0] != 5) {
X		fprintf(stderr, "Can't get a pipe.\n");
X		exit(1);
X	}
X	fflush(stdout);
X	if (fork() != 0) {
X		close(in[0]);
X		close(out[1]);
X		if (execl(KCLC_SELF, KCLC_SELF,
X			  SYSTEM_DIRECTORY,
X			  argv[1], argv[1], cargs,
X			  0) < 0) {
X			fprintf(stderr, "Can't exec KCL.\n");
X			exit(1);
X		}
X	}
X	signal(SIGINT, SIG_IGN);
X	close(in[1]);
X	close(out[0]);
X	for (;;) {
X		if (read(in[0], command, COMSIZ) <= 0)
X			exit(0);
X		buf[0] = system(command);
X		write(out[1], buf, 1);
X	}
X}
SHAR_EOF
chmod 0644 3b1port/lc.c || echo "restore of 3b1port/lc.c fails"
sed 's/^X//' << 'SHAR_EOF' > 3b1port/makefile &&
XMACHINE = ATT3b1
X#	Select 'VAX', 'SUN', 'SUN2R3', 'SUN3', 'ISI', 'SEQ', 'IBMRT',
X#	or 'NEWS'.
X
X
XHDIR	= ../h
XODIR	= ../o
XLSPDIR	= ../lsp
XCMPDIR	= ../cmpnew
XPORTDIR	= ../3b1port
XDESTDIR = /usr/local/bin
XLIBDIR	= /usr/local/lib
XMV	= /bin/mv
XLN	= /bin/ln
XCC	= /bin/cc
XLD	= /bin/ld
X
XDEFS	= -D$(MACHINE) -DMAXPAGE=1532 -DVSSIZE=8152	\
X	-DKCLC_SELF=\"$(LIBDIR)/kclc\" 			\
X	-DKCLI_SELF=\"$(LIBDIR)/kcli\" 			\
X	-DSYSTEM_DIRECTORY=\"$(LIBDIR)/\" -DUNIXPC
X
XCFLAGS	= -O $(DEFS) -I$(HDIR)
XLIBS	= -lm
X
XOBJS	= $(ODIR)/main.o $(ODIR)/alloc.o $(ODIR)/gbc.o \
X	$(ODIR)/bitop.o $(ODIR)/typespec.o $(ODIR)/eval.o \
X	$(ODIR)/macros.o $(ODIR)/lex.o $(ODIR)/bds.o \
X	$(ODIR)/frame.o $(ODIR)/predicate.o $(ODIR)/reference.o \
X	$(ODIR)/assignment.o $(ODIR)/bind.o $(ODIR)/let.o \
X	$(ODIR)/conditional.o $(ODIR)/block.o $(ODIR)/iteration.o \
X	$(ODIR)/mapfun.o $(ODIR)/prog.o $(ODIR)/multival.o \
X	$(ODIR)/catch.o $(ODIR)/symbol.o $(ODIR)/cfun.o \
X	$(ODIR)/cmpaux.o $(ODIR)/package.o $(ODIR)/big.o \
X	$(ODIR)/number.o $(ODIR)/num_pred.o $(ODIR)/num_comp.o \
X	$(ODIR)/num_arith.o $(ODIR)/num_sfun.o $(ODIR)/num_co.o \
X	$(ODIR)/num_log.o $(ODIR)/num_rand.o $(ODIR)/earith.o \
X	$(ODIR)/character.o $(ODIR)/char_table.o $(ODIR)/sequence.o \
X	$(ODIR)/list.o $(ODIR)/hash.o $(ODIR)/array.o \
X	$(ODIR)/string.o $(ODIR)/structure.o $(ODIR)/toplevel.o \
X	$(ODIR)/file.o $(ODIR)/read.o $(ODIR)/backq.o \
X	$(ODIR)/print.o $(ODIR)/format.o $(ODIR)/pathname.o \
X	$(ODIR)/unixfsys.o $(ODIR)/unixfasl.o $(ODIR)/error.o \
X	$(ODIR)/unixtime.o $(ODIR)/unixsys.o $(ODIR)/unixsave.o \
X	$(ODIR)/unixint.o
X
XLSPOBJS	= $(LSPDIR)/defmacro.o $(LSPDIR)/evalmacros.o $(LSPDIR)/top.o \
X	$(LSPDIR)/module.o $(LSPDIR)/predlib.o $(LSPDIR)/setf.o \
X	$(LSPDIR)/arraylib.o $(LSPDIR)/assert.o $(LSPDIR)/defstruct.o \
X	$(LSPDIR)/describe.o $(LSPDIR)/iolib.o $(LSPDIR)/listlib.o \
X	$(LSPDIR)/mislib.o $(LSPDIR)/numlib.o $(LSPDIR)/packlib.o \
X	$(LSPDIR)/seq.o $(LSPDIR)/seqlib.o $(LSPDIR)/trace.o
X
XCMPOBJS	= $(CMPDIR)/cmpinline.o $(CMPDIR)/cmputil.o $(CMPDIR)/cmptype.o \
X	$(CMPDIR)/cmpbind.o $(CMPDIR)/cmpblock.o $(CMPDIR)/cmpcall.o \
X	$(CMPDIR)/cmpcatch.o $(CMPDIR)/cmpenv.o $(CMPDIR)/cmpeval.o \
X	$(CMPDIR)/cmpflet.o $(CMPDIR)/cmpfun.o $(CMPDIR)/cmpif.o \
X	$(CMPDIR)/cmplabel.o $(CMPDIR)/cmplam.o $(CMPDIR)/cmplet.o \
X	$(CMPDIR)/cmploc.o $(CMPDIR)/cmpmap.o $(CMPDIR)/cmpmulti.o \
X	$(CMPDIR)/cmpspecial.o $(CMPDIR)/cmptag.o $(CMPDIR)/cmptop.o \
X	$(CMPDIR)/cmpvar.o $(CMPDIR)/cmpvs.o $(CMPDIR)/cmpwt.o
X
Xall:	kcli_s kclc_s kcl lc ild	\
X	$(CMPDIR)/cmpmain.lsp		\
X	$(CMPDIR)/lfun_list.lsp		\
X	$(CMPDIR)/cmpopt.lsp		\
X	undump
X
Xkcli_s:	$(OBJS) sys_kcli.o $(LSPOBJS)
X	$(LD) /lib/crt0s.o kcl.ifile -o kcli_s $(OBJS) sys_kcli.o $(LSPOBJS) $(LIBS)
X
Xkclc_s:	$(OBJS) sys_kclc.o $(LSPOBJS) $(CMPOBJS)
X	$(LD) /lib/crt0s.o kcl.ifile -o kclc_s $(OBJS) sys_kclc.o $(LSPOBJS) $(CMPOBJS) $(LIBS)
X
Xsys_kcli.o:	sys_kcli.c
X	$(CC) $(CFLAGS) -c sys_kcli.c
X
Xsys_kclc.o:	sys_kclc.c
X	$(CC) $(CFLAGS) -c sys_kclc.c
X
Xkcl:	kcl.c
X	$(CC) $(CFLAGS) -c kcl.c
X	$(LD) /lib/crt0s.o /lib/shlib.ifile -s -o kcl kcl.o
X
Xlc:	lc.c
X	$(CC) $(CFLAGS) -c lc.c
X	$(LD) /lib/crt0s.o /lib/shlib.ifile -s -o lc lc.o
X
Xild:	ild.c
X	$(CC) $(CFLAGS) -c ild.c
X	$(LD) /lib/crt0s.o /lib/shlib.ifile -s -o ild ild.o -lld
X
Xundump: undump.c
X	$(CC) $(CFLAGS) -c undump.c
X	$(LD) /lib/crt0s.o /lib/shlib.ifile -s -o undump undump.o -lld
X
Xclean:
X	rm -f kcli_s kclc_s kcli kclc kcl lc *.o core a.out
X
Xinstall: all
X	$(MV) kcl $(DESTDIR)
X	$(LN) lc lc1
X	$(LN) lc lcs1
X	$(MV) lc $(DESTDIR)
X	$(MV) lc1 $(DESTDIR)
X	$(MV) lcs1 $(DESTDIR)
X	$(MV) kcli $(LIBDIR)/kcli
X	$(MV) kclc $(LIBDIR)/kclc
X	$(MV) kcli_s $(LIBDIR)/kcli_s
X	$(MV) kclc_s $(LIBDIR)/kclc_s
X	$(MV) ild $(LIBDIR)/ild
X	$(MV) undump $(DESTDIR)/undump
SHAR_EOF
chmod 0644 3b1port/makefile || echo "restore of 3b1port/makefile fails"
sed 's/^X//' << 'SHAR_EOF' > 3b1port/sys_kclc.c &&
X#include "include.h"
X
Xstatic object fasl_data;
X
Xinit_init()
X{
X	enter_mark_origin(&fasl_data);
X	fasl_data = Cnil;
X
X	load("../lsp/export.lsp");
X	fasl_data = read_fasl_data("../lsp/defmacro.o");
X	init_defmacro(NULL, 0, fasl_data);
X	fasl_data = read_fasl_data("../lsp/evalmacros.o");
X	init_evalmacros(NULL, 0, fasl_data);
X	fasl_data = read_fasl_data("../lsp/top.o");
X	init_top(NULL, 0, fasl_data);
X	fasl_data = read_fasl_data("../lsp/module.o");
X	init_module(NULL, 0, fasl_data);
X	load("../lsp/autoload.lsp");
X}
X
Xinit_system()
X{
X	printf("Initializing predlib...  ");  fflush(stdout);
X	fasl_data = read_fasl_data("../lsp/predlib.o");
X	init_predlib(NULL, 0, fasl_data);
X	printf("\n");  fflush(stdout);
X	printf("Initializing setf...  ");  fflush(stdout);
X	fasl_data = read_fasl_data("../lsp/setf.o");
X	init_setf(NULL, 0, fasl_data);
X	printf("\n");  fflush(stdout);
X	printf("Initializing arraylib...  ");  fflush(stdout);
X	fasl_data = read_fasl_data("../lsp/arraylib.o");
X	init_arraylib(NULL, 0, fasl_data);
X	printf("\n");  fflush(stdout);
X	printf("Initializing assert...  ");  fflush(stdout);
X	fasl_data = read_fasl_data("../lsp/assert.o");
X	init_assert(NULL, 0, fasl_data);
X	printf("\n");  fflush(stdout);
X	printf("Initializing defstruct...  ");  fflush(stdout);
X	fasl_data = read_fasl_data("../lsp/defstruct.o");
X	init_defstruct(NULL, 0, fasl_data);
X	printf("\n");  fflush(stdout);
X	printf("Initializing describe...  ");  fflush(stdout);
X	fasl_data = read_fasl_data("../lsp/describe.o");
X	init_describe(NULL, 0, fasl_data);
X	printf("\n");  fflush(stdout);
X	printf("Initializing iolib...  ");  fflush(stdout);
X	fasl_data = read_fasl_data("../lsp/iolib.o");
X	init_iolib(NULL, 0, fasl_data);
X	printf("\n");  fflush(stdout);
X	printf("Initializing listlib...  ");  fflush(stdout);
X	fasl_data = read_fasl_data("../lsp/listlib.o");
X	init_listlib(NULL, 0, fasl_data);
X	printf("\n");  fflush(stdout);
X	printf("Initializing mislib...  ");  fflush(stdout);
X	fasl_data = read_fasl_data("../lsp/mislib.o");
X	init_mislib(NULL, 0, fasl_data);
X	printf("\n");  fflush(stdout);
X	printf("Initializing numlib...  ");  fflush(stdout);
X	fasl_data = read_fasl_data("../lsp/numlib.o");
X	init_numlib(NULL, 0, fasl_data);
X	printf("\n");  fflush(stdout);
X	printf("Initializing packlib...  ");  fflush(stdout);
X	fasl_data = read_fasl_data("../lsp/packlib.o");
X	init_packlib(NULL, 0, fasl_data);
X	printf("\n");  fflush(stdout);
X	printf("Initializing seq...  ");  fflush(stdout);
X	fasl_data = read_fasl_data("../lsp/seq.o");
X	init_seq(NULL, 0, fasl_data);
X	printf("\n");  fflush(stdout);
X	printf("Initializing seqlib...  ");  fflush(stdout);
X	fasl_data = read_fasl_data("../lsp/seqlib.o");
X	init_seqlib(NULL, 0, fasl_data);
X	printf("\n");  fflush(stdout);
X	printf("Initializing trace...  ");  fflush(stdout);
X	fasl_data = read_fasl_data("../lsp/trace.o");
X	init_trace(NULL, 0, fasl_data);
X	printf("\n");  fflush(stdout);
X
X	printf("Initializing cmpinline...  ");  fflush(stdout);
X	Vpackage->s.s_dbind = user_package;
X	fasl_data = read_fasl_data("../cmpnew/cmpinline.o");
X	init_cmpinline(NULL, 0, fasl_data);
X	printf("\n");  fflush(stdout);
X	printf("Initializing cmputil...  ");  fflush(stdout);
X	Vpackage->s.s_dbind = user_package;
X	fasl_data = read_fasl_data("../cmpnew/cmputil.o");
X	init_cmputil(NULL, 0, fasl_data);
X	printf("\n");  fflush(stdout);
X	printf("Initializing cmptype...  ");  fflush(stdout);
X	Vpackage->s.s_dbind = user_package;
X	fasl_data = read_fasl_data("../cmpnew/cmptype.o");
X	init_cmptype(NULL, 0, fasl_data);
X	printf("\n");  fflush(stdout);
X	printf("Initializing cmpbind...  ");  fflush(stdout);
X	Vpackage->s.s_dbind = user_package;
X	fasl_data = read_fasl_data("../cmpnew/cmpbind.o");
X	init_cmpbind(NULL, 0, fasl_data);
X	printf("\n");  fflush(stdout);
X	printf("Initializing cmpblock...  ");  fflush(stdout);
X	Vpackage->s.s_dbind = user_package;
X	fasl_data = read_fasl_data("../cmpnew/cmpblock.o");
X	init_cmpblock(NULL, 0, fasl_data);
X	printf("\n");  fflush(stdout);
X	printf("Initializing cmpcall...  ");  fflush(stdout);
X	Vpackage->s.s_dbind = user_package;
X	fasl_data = read_fasl_data("../cmpnew/cmpcall.o");
X	init_cmpcall(NULL, 0, fasl_data);
X	printf("\n");  fflush(stdout);
X	printf("Initializing cmpcatch...  ");  fflush(stdout);
X	Vpackage->s.s_dbind = user_package;
X	fasl_data = read_fasl_data("../cmpnew/cmpcatch.o");
X	init_cmpcatch(NULL, 0, fasl_data);
X	printf("\n");  fflush(stdout);
X	printf("Initializing cmpenv...  ");  fflush(stdout);
X	Vpackage->s.s_dbind = user_package;
X	fasl_data = read_fasl_data("../cmpnew/cmpenv.o");
X	init_cmpenv(NULL, 0, fasl_data);
X	printf("\n");  fflush(stdout);
X	printf("Initializing cmpeval...  ");  fflush(stdout);
X	Vpackage->s.s_dbind = user_package;
X	fasl_data = read_fasl_data("../cmpnew/cmpeval.o");
X	init_cmpeval(NULL, 0, fasl_data);
X	printf("\n");  fflush(stdout);
X	printf("Initializing cmpflet...  ");  fflush(stdout);
X	Vpackage->s.s_dbind = user_package;
X	fasl_data = read_fasl_data("../cmpnew/cmpflet.o");
X	init_cmpflet(NULL, 0, fasl_data);
X	printf("\n");  fflush(stdout);
X	printf("Initializing cmpfun...  ");  fflush(stdout);
X	Vpackage->s.s_dbind = user_package;
X	fasl_data = read_fasl_data("../cmpnew/cmpfun.o");
X	init_cmpfun(NULL, 0, fasl_data);
X	printf("\n");  fflush(stdout);
X	printf("Initializing cmpif...  ");  fflush(stdout);
X	Vpackage->s.s_dbind = user_package;
X	fasl_data = read_fasl_data("../cmpnew/cmpif.o");
X	init_cmpif(NULL, 0, fasl_data);
X	printf("\n");  fflush(stdout);
X	printf("Initializing cmplabel...  ");  fflush(stdout);
X	Vpackage->s.s_dbind = user_package;
X	fasl_data = read_fasl_data("../cmpnew/cmplabel.o");
X	init_cmplabel(NULL, 0, fasl_data);
X	printf("\n");  fflush(stdout);
X	printf("Initializing cmplam...  ");  fflush(stdout);
X	Vpackage->s.s_dbind = user_package;
X	fasl_data = read_fasl_data("../cmpnew/cmplam.o");
X	init_cmplam(NULL, 0, fasl_data);
X	printf("\n");  fflush(stdout);
X	printf("Initializing cmplet...  ");  fflush(stdout);
X	Vpackage->s.s_dbind = user_package;
X	fasl_data = read_fasl_data("../cmpnew/cmplet.o");
X	init_cmplet(NULL, 0, fasl_data);
X	printf("\n");  fflush(stdout);
X	printf("Initializing cmploc...  ");  fflush(stdout);
X	Vpackage->s.s_dbind = user_package;
X	fasl_data = read_fasl_data("../cmpnew/cmploc.o");
X	init_cmploc(NULL, 0, fasl_data);
X	printf("\n");  fflush(stdout);
X	printf("Initializing cmpmap...  ");  fflush(stdout);
X	Vpackage->s.s_dbind = user_package;
X	fasl_data = read_fasl_data("../cmpnew/cmpmap.o");
X	init_cmpmap(NULL, 0, fasl_data);
X	printf("\n");  fflush(stdout);
X	printf("Initializing cmpmulti...  ");  fflush(stdout);
X	Vpackage->s.s_dbind = user_package;
X	fasl_data = read_fasl_data("../cmpnew/cmpmulti.o");
X	init_cmpmulti(NULL, 0, fasl_data);
X	printf("\n");  fflush(stdout);
X	printf("Initializing cmpspecial...  ");  fflush(stdout);
X	Vpackage->s.s_dbind = user_package;
X	fasl_data = read_fasl_data("../cmpnew/cmpspecial.o");
X	init_cmpspecial(NULL, 0, fasl_data);
X	printf("\n");  fflush(stdout);
X	printf("Initializing cmptag...  ");  fflush(stdout);
X	Vpackage->s.s_dbind = user_package;
X	fasl_data = read_fasl_data("../cmpnew/cmptag.o");
X	init_cmptag(NULL, 0, fasl_data);
X	printf("\n");  fflush(stdout);
X	printf("Initializing cmptop...  ");  fflush(stdout);
X	Vpackage->s.s_dbind = user_package;
X	fasl_data = read_fasl_data("../cmpnew/cmptop.o");
X	init_cmptop(NULL, 0, fasl_data);
X	printf("\n");  fflush(stdout);
X	printf("Initializing cmpvar...  ");  fflush(stdout);
X	Vpackage->s.s_dbind = user_package;
X	fasl_data = read_fasl_data("../cmpnew/cmpvar.o");
X	init_cmpvar(NULL, 0, fasl_data);
X	printf("\n");  fflush(stdout);
X	printf("Initializing cmpvs...  ");  fflush(stdout);
X	Vpackage->s.s_dbind = user_package;
X	fasl_data = read_fasl_data("../cmpnew/cmpvs.o");
X	init_cmpvs(NULL, 0, fasl_data);
X	printf("\n");  fflush(stdout);
X	printf("Initializing cmpwt...  ");  fflush(stdout);
X	Vpackage->s.s_dbind = user_package;
X	fasl_data = read_fasl_data("../cmpnew/cmpwt.o");
X	init_cmpwt(NULL, 0, fasl_data);
X	printf("\n");  fflush(stdout);
X
X	Vpackage->s.s_dbind = user_package;
X}
SHAR_EOF
chmod 0644 3b1port/sys_kclc.c || echo "restore of 3b1port/sys_kclc.c fails"
sed 's/^X//' << 'SHAR_EOF' > 3b1port/sys_kcli.c &&
X#include "include.h"
X
Xstatic object fasl_data;
X
Xinit_init()
X{
X	enter_mark_origin(&fasl_data);
X	fasl_data = Cnil;
X
X	load("../lsp/export.lsp");
X	fasl_data = read_fasl_data("../lsp/defmacro.o");
X	init_defmacro(NULL, 0, fasl_data);
X	fasl_data = read_fasl_data("../lsp/evalmacros.o");
X	init_evalmacros(NULL, 0, fasl_data);
X	fasl_data = read_fasl_data("../lsp/top.o");
X	init_top(NULL, 0, fasl_data);
X	fasl_data = read_fasl_data("../lsp/module.o");
X	init_module(NULL, 0, fasl_data);
X	load("../lsp/autoload.lsp");
X}
X
Xinit_system()
X{
X	printf("Initializing predlib...  ");  fflush(stdout);
X	fasl_data = read_fasl_data("../lsp/predlib.o");
X	init_predlib(NULL, 0, fasl_data);
X	printf("\n");  fflush(stdout);
X	printf("Initializing setf...  ");  fflush(stdout);
X	fasl_data = read_fasl_data("../lsp/setf.o");
X	init_setf(NULL, 0, fasl_data);
X	printf("\n");  fflush(stdout);
X	printf("Initializing arraylib...  ");  fflush(stdout);
X	fasl_data = read_fasl_data("../lsp/arraylib.o");
X	init_arraylib(NULL, 0, fasl_data);
X	printf("\n");  fflush(stdout);
X	printf("Initializing assert...  ");  fflush(stdout);
X	fasl_data = read_fasl_data("../lsp/assert.o");
X	init_assert(NULL, 0, fasl_data);
X	printf("\n");  fflush(stdout);
X	printf("Initializing defstruct...  ");  fflush(stdout);
X	fasl_data = read_fasl_data("../lsp/defstruct.o");
X	init_defstruct(NULL, 0, fasl_data);
X	printf("\n");  fflush(stdout);
X	printf("Initializing describe...  ");  fflush(stdout);
X	fasl_data = read_fasl_data("../lsp/describe.o");
X	init_describe(NULL, 0, fasl_data);
X	printf("\n");  fflush(stdout);
X	printf("Initializing iolib...  ");  fflush(stdout);
X	fasl_data = read_fasl_data("../lsp/iolib.o");
X	init_iolib(NULL, 0, fasl_data);
X	printf("\n");  fflush(stdout);
X	printf("Initializing listlib...  ");  fflush(stdout);
X	fasl_data = read_fasl_data("../lsp/listlib.o");
X	init_listlib(NULL, 0, fasl_data);
X	printf("\n");  fflush(stdout);
X	printf("Initializing mislib...  ");  fflush(stdout);
X	fasl_data = read_fasl_data("../lsp/mislib.o");
X	init_mislib(NULL, 0, fasl_data);
X	printf("\n");  fflush(stdout);
X	printf("Initializing numlib...  ");  fflush(stdout);
X	fasl_data = read_fasl_data("../lsp/numlib.o");
X	init_numlib(NULL, 0, fasl_data);
X	printf("\n");  fflush(stdout);
X	printf("Initializing packlib...  ");  fflush(stdout);
X	fasl_data = read_fasl_data("../lsp/packlib.o");
X	init_packlib(NULL, 0, fasl_data);
X	printf("\n");  fflush(stdout);
X	printf("Initializing seq...  ");  fflush(stdout);
X	fasl_data = read_fasl_data("../lsp/seq.o");
X	init_seq(NULL, 0, fasl_data);
X	printf("\n");  fflush(stdout);
X	printf("Initializing seqlib...  ");  fflush(stdout);
X	fasl_data = read_fasl_data("../lsp/seqlib.o");
X	init_seqlib(NULL, 0, fasl_data);
X	printf("\n");  fflush(stdout);
X	printf("Initializing trace...  ");  fflush(stdout);
X	fasl_data = read_fasl_data("../lsp/trace.o");
X	init_trace(NULL, 0, fasl_data);
X	printf("\n");  fflush(stdout);
X
X	Vpackage->s.s_dbind = user_package;
X}
SHAR_EOF
chmod 0644 3b1port/sys_kcli.c || echo "restore of 3b1port/sys_kcli.c fails"
sed 's/^X//' << 'SHAR_EOF' > 3b1port/undump.1 &&
X.TH UNDUMP 1 "University of Utah"
X.SH NAME
Xundump \- convert a core dump to an executable a.out file
X.SH SYNOPSIS
Xundump new-a.out-file [old-a.out-file] [core-file]
X.SH DESCRIPTION
XUndump takes a core dump file and the executable "a.out" file which
Xcaused it and produces a new executable file with all static
Xvariables initialized to the values they held at the time of the
Xcore dump.  It is primarily useful for programs which take a long time
Xto initialize themselves, e.g., Emacs.  The idea is to go through all of
Xthe initializations and then create a core dump (e.g., with the abort()
Xcall).  One then uses undump to make a new executable file with all of it
Xdone.  This usually implies the use of a global flag variable which says
Xwhether or not initialization has been done.
X.PP
XUndump's arguments, old-a.out-file and core-file, default to "a.out" and
X"core", respectively.
X.PP
XA few things to keep in mind about undump:
X.IP
XIt doesn't preserve open files.
X.IP
XThe program will be re-entered at the beginning of main(), not at the point
Xwhere the core dump occurred.
X.SH BUGS
XProbably should have an option to not require
Xold-a.out-file if the core came from a 407 file.
X.PP
XThe UNIXpc version of undump strips all line number, symbol table and
Xstring table information from the resulting executable.
X
SHAR_EOF
chmod 0644 3b1port/undump.1 || echo "restore of 3b1port/undump.1 fails"
sed 's/^X//' << 'SHAR_EOF' > 3b1port/undump.c &&
X/*
X * undump - resurrect a core file into a runnable program.
X *
X *	for UNIX System V on a 3Bx
X *	that uses the Common Object File Format
X *
X * Author:
X *	Lou Salkind
X *	New York University
X *	Tue Mar  3 13:18:25 EST 1987
X *
X * Adapted from:
X *	Spencer Thomas's undump and the file unexec.c in GNU emacs
X *
X * Modified:
X *	Brant Cheikes
X *	University of Pennsylvania
X *	Department of Computer and Information Science
X *	ARPA: brant at linc.cis.upenn.edu, UUCP: ...drexel!manta!brant
X *	Wed Jun  1 00:57:16 EDT 1988
X *	Patched to make it fly on an AT&T UNIXpc (aka PC7300, 3b1).
X *	Bug: undump currently won't dump out line numbers, symbol
X *	table entries, or the string table.  Thus the resulting
X *	a.out looks like the result of an ld with the -s (strip)
X *	option.
X */
X
X#include <sys/param.h>
X#include <sys/types.h>
X#include <sys/signal.h>
X#include <sys/user.h>
X
X#include <stdio.h>
X#include <sys/stat.h>
X
X#include <aouthdr.h>
X#include <filehdr.h>
X#include <scnhdr.h>
X#ifndef UNIXPC
X#include <syms.h>
X#endif /* not UNIXPC */
X
X#define	PAGE_SIZE	NBPC	/* size of a page in bytes */
X
Xstruct filehdr fh;		/* file header */
XAOUTHDR aout;			/* optional header */
Xstruct scnhdr tsc;		/* text section header */
Xstruct scnhdr dsc;		/* data section header */
Xstruct scnhdr bsc;		/* bss section header */
X#ifdef UNIXPC
Xstruct scnhdr lsc;		/* shared lib section header */
X#endif /* UNIXPC */
X
Xlong text_scnptr;
Xlong data_scnptr;
X#ifndef UNIXPC
Xlong bias;
Xlong lnnoptr;
Xlong symlocptr;
X#endif /* not UNIXPC */
X
Xmain(argc, argv)
X     char **argv;
X{
X  FILE *afp, *cfp, *nfp;
X  struct user u;
X  long off, size;
X  struct scnhdr sc;
X  int i;
X  char *a_out_name = "a.out";
X  char *core_name = "core";
X  char *new_name;
X  
X  if (argc < 2 || argc > 4) {
X    fprintf(stderr,"Usage: %s new [a.out [core]]\n", argv[0]);
X    exit(1);
X  }
X  new_name = argv[1];
X  if (argc > 2)
X    a_out_name = argv[2];
X  if (argc > 3)
X    core_name = argv[3];
X  afp = fopen(a_out_name, "r");
X  if (afp == 0)
X    Perror(a_out_name);
X  cfp = fopen(core_name, "r");
X  if (cfp == 0)
X    Perror(core_name);
X  nfp = fopen(new_name, "w");
X  if (nfp == 0)
X    Perror(new_name);
X  
X  /*
X   * Read in the file header and optional file header from
X   * the a.out file.
X   */
X  if (fread(&fh, sizeof(fh), 1, afp) != 1)
X    Perror("fh read");
X  if (fread(&aout, sizeof(aout), 1, afp) != 1)
X    Perror("aout read");
X  
X  /*
X   * Read in the various section headers.
X   */
X  for (i = 0; i < fh.f_nscns; i++) {
X    if (fread(&sc, sizeof(sc), 1, afp) != 1)
X      Perror("scnhdr read");
X    if (strcmp(sc.s_name, ".text") == 0) {
X      tsc = sc;
X    } else if (strcmp(sc.s_name, ".data") == 0) {
X      dsc = sc;
X    } else if (strcmp(sc.s_name, ".bss") == 0) {
X      bsc = sc;
X#ifdef UNIXPC
X    } else if (strcmp(sc.s_name, ".lib") == 0) {
X      lsc = sc;
X#endif /* UNIXPC */
X    }
X  }
X  
X#ifdef UNIXPC
X  /*
X   * The kernel stack (I think) takes up the first U_OFFSET
X   * bytes of the core file, followed by the user structure.
X   * Skip past that junk and get down to the nitty-gritty.
X   */
X  fseek(cfp, (long)U_OFFSET, 0);
X#endif /* UNIXPC */
X  
X  /*
X   * Read in the user structure from the core file and perform
X   * a sanity check.
X   */
X  if (fread(&u, sizeof(u), 1, cfp) != 1)
X    Perror("core read");
X  if (u.u_exdata.ux_tsize != aout.tsize ||
X      u.u_exdata.ux_dsize != aout.dsize ||
X      u.u_exdata.ux_bsize != aout.bsize) {
X    fprintf(stderr,"mismatch between %s and %s sizes\n",a_out_name, core_name);
X    exit(1);
X  }
X  
X  /*
X   * off = offset to start of actual mem dump data in core file.
X   * size = size of new .data section.
X   */
X  off = USIZE*PAGE_SIZE;
X  size = u.u_dsize * PAGE_SIZE;
X  
X  fh.f_flags |= F_RELFLG | F_EXEC;
X  /*
X   * .data section size of new a.out = data size at time of
X   * core dump.  .bss size is now zero (no uninitialized data).
X   */
X  aout.dsize = size;
X  aout.bsize = 0;
X  
X  /*
X   * text size same as text size of a.out.
X   */
X  tsc.s_size = aout.tsize;
X#ifndef UNIXPC
X  /*
X   * I'm commenting out the following code, since I believe we can use
X   * unmodified the scnptr of the text section stored in the original
X   * a.out.  Nothing we have done needs to alter its starting point.
X   * In fact, we arguably SHOULDN'T alter the text starting point, since
X   * certain kinds of files require special alignments of text and data
X   * sections, both in memory and in the file.  If it ain't broke, don't
X   * fix it.
X   */
X  tsc.s_scnptr = sizeof(fh) + sizeof(aout);
X  tsc.s_scnptr += fh.f_nscns * sizeof (struct scnhdr);
X#endif /* not UNIXPC */
X  text_scnptr = tsc.s_scnptr;
X
X#ifndef UNIXPC
X  lnnoptr = tsc.s_lnnoptr;
X  symlocptr = fh.f_symptr;
X#endif /* not UNIXPC */
X  
X#ifndef UNIXPC
X  /*
X   * I'm going to assume that the .text section size never
X   * grows.  Thus, we need not tweak the paddr and vaddr of
X   * the .data section, since its start point has not moved.
X   */
X  dsc.s_paddr = dsc.s_vaddr = aout.data_start;
X#endif /* not UNIXPC */
X  
X  /*
X   * New .data size is computed from core dump.
X   * Initialize pointer to raw .data section in the file.
X   */
X  dsc.s_size = size;
X  dsc.s_scnptr = tsc.s_scnptr + tsc.s_size;
X#ifdef UNIXPC
X  /*
X   * Magic 0413 files require that the .data section be aligned
X   * on a 1024 byte boundary IN THE FILE.
X   */
X  if (u.u_exdata.ux_mag == 0413)
X    dsc.s_scnptr = (dsc.s_scnptr + 0x400) & ~0x3ff;
X#endif /* UNIXPC */
X  data_scnptr = dsc.s_scnptr;
X  
X  /*
X   * Tweak .bss header values.
X   */
X  bsc.s_paddr = bsc.s_vaddr = aout.data_start + aout.dsize;
X  bsc.s_size = aout.bsize;
X  bsc.s_scnptr = 0L;
X  
X#ifdef UNIXPC
X  /*
X   * Adjust the physical/virtual addresses of the shared lib,
X   * if present.  Basically, since the .bss section has just
X   * disappeared, the shlib and .bss end up with the same addresses.
X   */
X  if (fh.f_nscns > 3) {
X    lsc.s_paddr = lsc.s_vaddr = aout.data_start + aout.dsize;
X    lsc.s_size = lsc.s_scnptr = 0L;
X  }
X#endif /* UNIXPC */
X  
X#ifndef UNIXPC
X  bias = dsc.s_scnptr + dsc.s_size - lnnoptr;
X  if (fh.f_symptr > 0L)
X    fh.f_symptr += bias;
X  if (tsc.s_lnnoptr > 0L)
X    tsc.s_lnnoptr += bias;
X#endif /* not UNIXPC */
X  
X  /*
X   * Write out the file header, optional file header, and the
X   * various section headers.
X   */
X  if (fwrite(&fh, sizeof(fh), 1, nfp) != 1)
X    Perror("fh write");
X  if (fwrite(&aout, sizeof(aout), 1, nfp) != 1)
X    Perror("aout write");
X  if (fwrite(&tsc, sizeof(tsc), 1, nfp) != 1)
X    Perror("ts hdr write");
X  if (fwrite(&dsc, sizeof(dsc), 1, nfp) != 1)
X    Perror("ds hdr write");
X  if (fwrite(&bsc, sizeof(bsc), 1, nfp) != 1)
X    Perror("bs hdr write");
X#ifdef UNIXPC
X  /*
X   * Dump out shared lib section header, if it was present
X   * in the old a.out.
X   */
X  if (fh.f_nscns > 3)
X    if (fwrite(&lsc, sizeof(lsc), 1, nfp) != 1)
X      Perror("lib hdr write");
X#endif /* UNIXPC */
X  
X  /*
X   * Hokay, set position in core file to right after user structure.
X   * Position in new a.out to where text_scnptr says.
X   */
X  fseek(cfp, off, 0);
X  fseek(nfp, text_scnptr, 0);
X#ifdef UNIXPC
X  /*
X   * If we have a 0407 file, then we have to copy the text from
X   * the core file.  If not, we copy the text from the original
X   * a.out.
X   */
X  if (u.u_exdata.ux_mag == 0407)
X    copy(cfp, nfp, aout.tsize);
X  else {
X    fseek(afp, text_scnptr, 0);
X    copy(afp, nfp, aout.tsize);
X  }
X#else
X  copy(afp, nfp, aout.tsize);
X#endif
X  fseek(nfp, data_scnptr, 0);
X  copy(cfp, nfp, size);
X#ifndef UNIXPC
X  copy_syms(afp, nfp);
X#endif /* not UNIXPC */
X  fclose(nfp);
X  fclose(afp);
X  fclose(cfp);
X  mark_x(new_name);
X  exit(0);
X}
X
X#ifndef UNIXPC
Xcopy_syms(afp, nfp)
X     register FILE *afp, *nfp;
X{
X  char page[BUFSIZ];
X  register int n;
X  register int nsyms;
X  struct syment symentry;
X  AUXENT auxentry;
X  
X  /* if there are line numbers, copy them */
X  if (lnnoptr) {
X    if (fseek(afp, lnnoptr, 0) == -1L)
X      Perror("ln fseek");
X    copy(afp, nfp, symlocptr - lnnoptr);
X  }
X  
X  /* now write the symbol table */
X  if (fseek(nfp, fh.f_symptr, 0) == -1L)
X    Perror("symtbl fseek");
X  for (nsyms = 0; nsyms < fh.f_nsyms; nsyms++) {
X    if (fread(&symentry, SYMESZ, 1, afp) != 1)
X      Perror("sym fread");
X    if (fwrite(&symentry, SYMESZ, 1, nfp) != 1)
X      Perror("sym fwrite");
X    /*
X     * adjust relative offsets of line numbers for
X     * function definitions
X     */
X    if (symentry.n_numaux) {
X      if (fread(&auxentry, AUXESZ, 1, afp) != 1)
X	Perror("aux fread");
X      nsyms++;
X      if (ISFCN (symentry.n_type))
X	auxentry.x_sym.x_fcnary.x_fcn.x_lnnoptr += bias;
X      if (fwrite(&auxentry, AUXESZ, 1, nfp) != 1)
X	Perror("aux fwrite");
X    }
X  }
X  
X  /* finally write the string table, if any */
X  while ((n = fread(page, 1, sizeof(page), afp)) > 0) {
X    if (fwrite(page, 1, n, nfp) != n)
X      Perror("sym write");
X  }
X  if (n < 0)
X    Perror("sym read");
X}
X#endif /* not UNIXPC */
X
X/*
X * After succesfully building the new a.out, mark it executable
X */
Xmark_x(name)
X     char *name;
X{
X  struct stat sbuf;
X  int um;
X  
X  um = umask(777);
X  umask(um);
X  if (stat(name, &sbuf) == -1) {
X    perror ("Can't stat new a.out");
X    fprintf(stderr, "Setting protection to %o\n", 0777 & ~um);
X    sbuf.st_mode = 0777;
X  }
X  sbuf.st_mode |= 0111 & ~um;
X  if (chmod(name, sbuf.st_mode) == -1)
X    Perror("Couldn't mark new a.out executable");
X  
X}
X
Xcopy(a, b, size)
X     register FILE *a, *b;
X     long size;
X{
X  char buf[BUFSIZ];
X  register int i, n;
X  
X  while (size > 0) {
X    i = size;
X    if (i > sizeof(buf))
X      i = sizeof(buf);
X    if ((n = fread(buf, 1, i, a)) <= 0)
X      Perror("copy read");
X    if (fwrite(buf, 1, n, b) != n)
X      Perror("copy write");
X    size -= n;
X  }
X}
X
XPerror(s)
X     char *s;
X{
X  perror(s);
X  exit(1);
X}
SHAR_EOF
chmod 0644 3b1port/undump.c || echo "restore of 3b1port/undump.c fails"
#!/bin/sh
# shar:	Shell Archiver  (v1.22)
#
#	Run the following text with /bin/sh to create:
#	  3b1port/diffs/3b1_chtab.s
#	  3b1port/diffs/alloc.c.diff
#	  3b1port/diffs/bitop.c.diff
#	  3b1port/diffs/cmpinclude.h
#	  3b1port/diffs/dpp.c.diff
#	  3b1port/diffs/earith.c.c.dif
#	  3b1port/diffs/earith.c.diff
#	  3b1port/diffs/include.h.diff
#	  3b1port/diffs/main.c.diff
#	  3b1port/diffs/unixsave.c.dif
#
sed 's/^X//' << 'SHAR_EOF' > 3b1port/diffs/3b1_chtab.s &&
X	data
X	even
X	space 1024
X	global	character_table
Xcharacter_table:
X	space 2048
X
SHAR_EOF
chmod 0644 3b1port/diffs/3b1_chtab.s || echo "restore of 3b1port/diffs/3b1_chtab.s fails"
sed 's/^X//' << 'SHAR_EOF' > 3b1port/diffs/alloc.c.diff &&
X*** alloc.c.orig	Sat Oct  8 18:37:24 1988
X--- alloc.c	Sat Oct  8 18:44:17 1988
X***************
X*** 74,80
X  	if (n <= m)
X  		return(e);
X  
X! #ifdef BSD
X  	if (core_end != sbrk(0))
X  		error("Someone allocated my memory!");
X  	if (core_end != sbrk(PAGESIZE*(n - m)))
X
X--- 74,80 -----
X  	if (n <= m)
X  		return(e);
X  
X! #if defined(BSD) || defined(ATT3b1)
X  	if (core_end != sbrk(0))
X  		error("Someone allocated my memory!");
X  	if (core_end != sbrk(PAGESIZE*(n - m)))
X***************
X*** 79,86
X  		error("Someone allocated my memory!");
X  	if (core_end != sbrk(PAGESIZE*(n - m)))
X  		error("Can't allocate.  Good-bye!");
X! #endif
X! 
X  #ifdef ATT
X  	if (PAGESIZE*(n - m) > pagetochar(MAXPAGE) - core_end)
X  		error("Can't allocate.  Good-bye!");
X
X--- 79,85 -----
X  		error("Someone allocated my memory!");
X  	if (core_end != sbrk(PAGESIZE*(n - m)))
X  		error("Can't allocate.  Good-bye!");
X! #else
X  #ifdef ATT
X  	if (PAGESIZE*(n - m) > pagetochar(MAXPAGE) - core_end)
X  		error("Can't allocate.  Good-bye!");
X***************
X*** 85,91
X  	if (PAGESIZE*(n - m) > pagetochar(MAXPAGE) - core_end)
X  		error("Can't allocate.  Good-bye!");
X  #endif
X! 
X  #ifdef E15
X  	if (PAGESIZE*(n - m) > pagetochar(MAXPAGE) - core_end)
X  		error("Can't allocate.  Good-bye!");
X
X--- 84,90 -----
X  	if (PAGESIZE*(n - m) > pagetochar(MAXPAGE) - core_end)
X  		error("Can't allocate.  Good-bye!");
X  #endif
X! #endif
X  #ifdef E15
X  	if (PAGESIZE*(n - m) > pagetochar(MAXPAGE) - core_end)
X  		error("Can't allocate.  Good-bye!");
X***************
X*** 510,516
X  
X  	set_maxpage();
X  
X! #ifdef UNIX
X  	heap_end = sbrk(0);
X  	if (i = ((int)heap_end & (PAGESIZE - 1)))
X  		sbrk(PAGESIZE - i);
X
X--- 509,515 -----
X  
X  	set_maxpage();
X  
X! #if defined(UNIX) || defined(ATT3b1)
X  	heap_end = sbrk(0);
X  	if (i = ((int)heap_end & (PAGESIZE - 1)))
X  		sbrk(PAGESIZE - i);
X***************
X*** 515,522
X  	if (i = ((int)heap_end & (PAGESIZE - 1)))
X  		sbrk(PAGESIZE - i);
X  	heap_end = core_end = sbrk(0);
X! #endif
X! 
X  #ifdef ATT
X  	if (brk(pagetochar(MAXPAGE)) < 0)
X  		error("Can't allocate.  Good-bye!.");
X
X--- 514,520 -----
X  	if (i = ((int)heap_end & (PAGESIZE - 1)))
X  		sbrk(PAGESIZE - i);
X  	heap_end = core_end = sbrk(0);
X! #else
X  #ifdef ATT
X  	if (brk(pagetochar(MAXPAGE)) < 0)
X  		error("Can't allocate.  Good-bye!.");
X***************
X*** 521,527
X  	if (brk(pagetochar(MAXPAGE)) < 0)
X  		error("Can't allocate.  Good-bye!.");
X  #endif
X! 
X  #ifdef E15
X  	if (brk(pagetochar(MAXPAGE)) < 0)
X  		error("Can't allocate.  Good-bye!.");
X
X--- 519,525 -----
X  	if (brk(pagetochar(MAXPAGE)) < 0)
X  		error("Can't allocate.  Good-bye!.");
X  #endif
X! #endif
X  #ifdef E15
X  	if (brk(pagetochar(MAXPAGE)) < 0)
X  		error("Can't allocate.  Good-bye!.");
SHAR_EOF
chmod 0644 3b1port/diffs/alloc.c.diff || echo "restore of 3b1port/diffs/alloc.c.diff fails"
sed 's/^X//' << 'SHAR_EOF' > 3b1port/diffs/bitop.c.diff &&
X*** bitop.c.orig	Sat Oct  8 18:45:32 1988
X--- bitop.c	Sat Oct  8 18:50:59 1988
X***************
X*** 385,387
X  }
X  
X  #endif
X
X--- 385,428 -----
X  }
X  
X  #endif
X+ 
X+ #ifdef SGS68K
X+ 
X+ get_mark_bit(x)
X+ int *x;
X+ {
X+ 	asm("	mov.l	8(%fp),%d0");
X+ 	asm("	lsr.l	&2,%d0");
X+ 	asm("	mov.l	%d0,%d1");
X+ 	asm("	lsr.l	&3,%d1");
X+ 	asm("	mov.l	mark_table,%a0");
X+ 	asm("	btst	%d0,0(%a0,%d1.l)");
X+ 	asm("	sne	%d0");
X+ 	asm("	and.l	&1,%d0");
X+ }
X+ 
X+ set_mark_bit(x)
X+ int *x;
X+ {
X+ 	asm("	mov.l	8(%fp),%d0");
X+ 	asm("	lsr.l	&2,%d0");
X+ 	asm("	mov.l	%d0,%d1");
X+ 	asm("	lsr.l	&3,%d1");
X+ 	asm("	mov.l	mark_table,%a0");
X+ 	asm("	bset	%d0,0(%a0,%d1.l)");
X+ }
X+ 
X+ get_set_mark_bit(x)
X+ int *x;
X+ {
X+ 	asm("	mov.l	8(%fp),%d0");
X+ 	asm("	lsr.l	&2,%d0");
X+ 	asm("	mov.l	%d0,%d1");
X+ 	asm("	lsr.l	&3,%d1");
X+ 	asm("	mov.l	mark_table,%a0");
X+ 	asm("	bset	%d0,0(%a0,%d1.l)");
X+ 	asm("	sne	%d0");
X+ 	asm("	and.l	&1,%d0");
X+ }
X+ 
X+ #endif
SHAR_EOF
chmod 0644 3b1port/diffs/bitop.c.diff || echo "restore of 3b1port/diffs/bitop.c.diff fails"
sed 's/^X//' << 'SHAR_EOF' > 3b1port/diffs/cmpinclude.h &&
X/*
X(c) Copyright Taiichi Yuasa and Masami Hagiya, 1984.  All rights reserved.
XCopying of this file is authorized to users who have executed the true and
Xproper "License Agreement for Kyoto Common LISP" with SIGLISP.
X*/
X#include <stdio.h>
X#include <setjmp.h>
X#define	TRUE	1
X#define	FALSE	0
Xtypedef int bool;
Xtypedef int fixnum;
Xtypedef float shortfloat;
Xtypedef double longfloat;
Xtypedef union lispunion *object;
X#define	OBJNULL	((object)NULL)
Xstruct fixnum_struct {
X	short	t, m;
X	fixnum	FIXVAL;
X};
X#define	fix(x)	(x)->FIX.FIXVAL
X#define	SMALL_FIXNUM_LIMIT	1024
Xstruct fixnum_struct small_fixnum_table[];
X#define	small_fixnum(i)	(object)(small_fixnum_table+SMALL_FIXNUM_LIMIT+(i))
Xstruct shortfloat_struct {
X	short		t, m;
X	shortfloat	SFVAL;
X};
X#define	sf(x)	(x)->SF.SFVAL
Xstruct longfloat_struct {
X	short		t, m;
X	longfloat	LFVAL;
X};
X#define	lf(x)	(x)->LF.LFVAL
Xstruct character {
X	short		t, m;
X	unsigned short	ch_code;
X	unsigned char	ch_font;
X	unsigned char	ch_bits;
X};
Xextern struct character character_table[];
X#define	code_char(c)	(object)(character_table+(c))
X#define	char_code(x)	(x)->ch.ch_code
X#define	char_font(x)	(x)->ch.ch_font
X#define	char_bits(x)	(x)->ch.ch_bits
Xenum stype {
X	stp_ordinary,
X	stp_constant,
X        stp_special
X};
Xstruct symbol {
X	short	t, m;
X	object	s_dbind;
X	int	(*s_sfdef)();
X#define	s_fillp		st_fillp
X#define	s_self		st_self
X	int	s_fillp;
X	char	*s_self;
X	object	s_gfdef;
X	object	s_plist;
X	object	s_hpack;
X	short	s_stype;
X	short	s_mflag;
X};
Xstruct cons {
X	short	t, m;
X	object	c_cdr;
X	object	c_car;
X};
Xstruct array {
X	short	t, m;
X	short	a_rank;
X	short	a_adjustable;
X	int	a_dim;
X	int	*a_dims;
X	object	*a_self;
X	object	a_displaced;
X	short	a_elttype;
X	short	a_offset;
X};
Xstruct vector {
X	short	t, m;
X	short	v_hasfillp;
X	short	v_adjustable;
X	int	v_dim;
X	int	v_fillp;
X	object	*v_self;
X	object	v_displaced;
X	short	v_elttype;
X	short	v_offset;
X};
Xstruct string {
X	short	t, m;
X	short	st_hasfillp;
X	short	st_adjustable;
X	int	st_dim;
X	int	st_fillp;
X	char	*st_self;
X	object	st_displaced;
X};
Xstruct ustring {
X	short	t, m;
X	short	ust_hasfillp;
X	short	ust_adjustable;
X	int	ust_dim;
X	int	ust_fillp;
X	unsigned char
X		*ust_self;
X	object	ust_displaced;
X};
Xstruct bitvector {
X	short	t, m;
X	short	bv_hasfillp;
X	short	bv_adjustable;
X	int	bv_dim;
X	int	bv_fillp;
X	char	*bv_self;
X	object	bv_displaced;
X	short	bv_elttype;
X	short	bv_offset;
X};
Xstruct fixarray {
X	short	t, m;
X	short	fixa_rank;
X	short	fixa_adjustable;
X	int	fixa_dim;
X	int	*fixa_dims;
X	fixnum	*fixa_self;
X	object	fixa_displaced;
X	short	fixa_elttype;
X	short	fixa_offset;
X};
Xstruct sfarray {
X	short	t, m;
X	short	sfa_rank;
X	short	sfa_adjustable;
X	int	sfa_dim;
X	int	*sfa_dims;
X	shortfloat
X		*sfa_self;
X	object	sfa_displaced;
X	short	sfa_elttype;
X	short	sfa_offset;
X};
Xstruct lfarray {
X	short	t, m;
X	short	lfa_rank;
X	short	lfa_adjustable;
X	int	lfa_dim;
X	int	*lfa_dims;
X	longfloat
X		*lfa_self;
X	object	lfa_displaced;
X	short	lfa_elttype;
X	short	lfa_offset;
X};
Xstruct structure {
X	short	t, m;
X	object	str_name;
X	object	*str_self;
X	int	str_length;
X};
Xstruct cfun {
X	short	t, m;
X	object	cf_name;
X	int	(*cf_self)();
X	object	cf_data;
X	char	*cf_start;
X	int	cf_size;
X};
Xstruct cclosure {
X	short	t, m;
X	object	cc_name;
X	int	(*cc_self)();
X	object	cc_env;
X	object	cc_data;
X	char	*cc_start;
X	int	cc_size;
X	object	*cc_turbo;
X};
Xstruct dummy {
X	short	t, m;
X};
Xunion lispunion {
X	struct fixnum_struct
X			FIX;
X	struct shortfloat_struct
X			SF;
X	struct longfloat_struct
X			LF;
X	struct character
X			ch;
X	struct symbol	s;
X	struct cons	c;
X	struct array	a;
X	struct vector	v;
X	struct string	st;
X	struct ustring	ust;
X	struct bitvector
X			bv;
X	struct structure
X			str;
X	struct cfun	cf;
X	struct cclosure	cc;
X	struct dummy	d;
X	struct fixarray	fixa;
X	struct sfarray	sfa;
X	struct lfarray	lfa;
X};
Xenum type {
X	t_cons = 0,
X	t_start = t_cons,
X	t_fixnum,
X	t_bignum,
X	t_ratio,
X	t_shortfloat,
X	t_longfloat,
X	t_complex,
X	t_character,
X	t_symbol,
X	t_package,
X	t_hashtable,
X	t_array,
X	t_vector,
X	t_string,
X	t_bitvector,
X	t_structure,
X	t_stream,
X	t_random,
X	t_readtable,
X	t_pathname,
X	t_cfun,
X	t_cclosure,
X	t_spice,
X	t_end,
X	t_contiguous,
X	t_relocatable,
X	t_other
X};
X#define	type_of(obje)	((enum type)(((object)(obje))->d.t))
X#define	endp(obje)	endp1(obje)
Xextern object value_stack[];
X#define	vs_org		value_stack
Xextern object *vs_limit;
Xextern object *vs_base;
Xextern object *vs_top;
X#define	vs_push(obje)	(*vs_top++ = (obje))
X#define	vs_pop		(*--vs_top)
X#define	vs_head		vs_top[-1]
X#define	vs_mark		object *old_vs_top = vs_top
X#define	vs_reset	vs_top = old_vs_top
X#define	vs_check	if (vs_top >= vs_limit)  \
X				vs_overflow();
X#define	vs_check_push(obje)  \
X			(vs_top >= vs_limit ?  \
X			 (object)vs_overflow() : (*vs_top++ = (obje)))
X#define	check_arg(n)  \
X			if (vs_top - vs_base != (n))  \
X				check_arg_failed(n)
X#define	MMcheck_arg(n)  \
X			if (vs_top - vs_base < (n))  \
X				too_few_arguments();  \
X			else if (vs_top - vs_base > (n))  \
X				too_many_arguments()
X#define vs_reserve(x)	if(vs_base+(x) >= vs_limit)  \
X				vs_overflow();
Xstruct bds_bd {
X	object	bds_sym;
X	object	bds_val;
X};
Xextern struct bds_bd bind_stack[];
X#define bds_org		bind_stack
Xtypedef struct bds_bd *bds_ptr;
Xextern bds_ptr bds_limit;
Xextern bds_ptr bds_top;
X#define	bds_check  \
X	if (bds_top >= bds_limit)  \
X		bds_overflow()
X#define	bds_bind(sym, val)  \
X	((++bds_top)->bds_sym = (sym),  \
X	bds_top->bds_val = (sym)->s.s_dbind,  \
X	(sym)->s.s_dbind = (val))
X#define	bds_unwind1  \
X	((bds_top->bds_sym)->s.s_dbind = bds_top->bds_val, --bds_top)
Xtypedef struct invocation_history {
X	object	ihs_function;
X	object	*ihs_base;
X} *ihs_ptr;
Xextern struct invocation_history ihs_stack[];
X#define ihs_org		ihs_stack
Xextern ihs_ptr ihs_limit;
Xextern ihs_ptr ihs_top;
X#define	ihs_check  \
X	if (ihs_top >= ihs_limit)  \
X		ihs_overflow()
X#define ihs_push(function)  \
X	(++ihs_top)->ihs_function = (function);  \
X	ihs_top->ihs_base = vs_base
X#define ihs_pop() 	(ihs_top--)
Xenum fr_class {
X	FRS_CATCH,
X	FRS_CATCHALL,
X	FRS_PROTECT
X};
Xstruct frame {
X	jmp_buf		frs_jmpbuf;
X	object		*frs_lex;
X	bds_ptr		frs_bds_top;
X	enum fr_class	frs_class;
X	object		frs_val;
X	ihs_ptr		frs_ihs;
X};
Xtypedef struct frame *frame_ptr;
X#define	alloc_frame_id()	alloc_object(t_spice)
Xextern struct frame frame_stack[];
X#define frs_org		frame_stack
Xextern frame_ptr frs_limit;
Xextern frame_ptr frs_top;
X#define frs_push(class, val)  \
X	if (++frs_top >= frs_limit)  \
X		frs_overflow();  \
X	frs_top->frs_lex = lex_env;\
X	frs_top->frs_bds_top = bds_top;  \
X	frs_top->frs_class = (class);  \
X	frs_top->frs_val = (val);  \
X	frs_top->frs_ihs = ihs_top;  \
X        setjmp(frs_top->frs_jmpbuf)
X#define frs_pop()	frs_top--
Xextern bool nlj_active;
Xextern frame_ptr nlj_fr;
Xextern object nlj_tag;
Xextern object *lex_env;
Xobject caar();
Xobject cadr();
Xobject cdar();
Xobject cddr();
Xobject caaar();
Xobject caadr();
Xobject cadar();
Xobject caddr();
Xobject cdaar();
Xobject cdadr();
Xobject cddar();
Xobject cdddr();
Xobject caaaar();
Xobject caaadr();
Xobject caadar();
Xobject caaddr();
Xobject cadaar();
Xobject cadadr();
Xobject caddar();
Xobject cadddr();
Xobject cdaaar();
Xobject cdaadr();
Xobject cdadar();
Xobject cdaddr();
Xobject cddaar();
Xobject cddadr();
Xobject cdddar();
Xobject cddddr();
X#define MMcons(a,d)	make_cons((a),(d))
X#define MMcar(x)	(x)->c.c_car
X#define MMcdr(x)	(x)->c.c_cdr
X#define CMPcar(x)	(x)->c.c_car
X#define CMPcdr(x)	(x)->c.c_cdr
X#define CMPcaar(x)	(x)->c.c_car->c.c_car
X#define CMPcadr(x)	(x)->c.c_cdr->c.c_car
X#define CMPcdar(x)	(x)->c.c_car->c.c_cdr
X#define CMPcddr(x)	(x)->c.c_cdr->c.c_cdr
X#define CMPcaaar(x)	(x)->c.c_car->c.c_car->c.c_car
X#define CMPcaadr(x)	(x)->c.c_cdr->c.c_car->c.c_car
X#define CMPcadar(x)	(x)->c.c_car->c.c_cdr->c.c_car
X#define CMPcaddr(x)	(x)->c.c_cdr->c.c_cdr->c.c_car
X#define CMPcdaar(x)	(x)->c.c_car->c.c_car->c.c_cdr
X#define CMPcdadr(x)	(x)->c.c_cdr->c.c_car->c.c_cdr
X#define CMPcddar(x)	(x)->c.c_car->c.c_cdr->c.c_cdr
X#define CMPcdddr(x)	(x)->c.c_cdr->c.c_cdr->c.c_cdr
X#define CMPcaaaar(x)	(x)->c.c_car->c.c_car->c.c_car->c.c_car
X#define CMPcaaadr(x)	(x)->c.c_cdr->c.c_car->c.c_car->c.c_car
X#define CMPcaadar(x)	(x)->c.c_car->c.c_cdr->c.c_car->c.c_car
X#define CMPcaaddr(x)	(x)->c.c_cdr->c.c_cdr->c.c_car->c.c_car
X#define CMPcadaar(x)	(x)->c.c_car->c.c_car->c.c_cdr->c.c_car
X#define CMPcadadr(x)	(x)->c.c_cdr->c.c_car->c.c_cdr->c.c_car
X#define CMPcaddar(x)	(x)->c.c_car->c.c_cdr->c.c_cdr->c.c_car
X#define CMPcadddr(x)	(x)->c.c_cdr->c.c_cdr->c.c_cdr->c.c_car
X#define CMPcdaaar(x)	(x)->c.c_car->c.c_car->c.c_car->c.c_cdr
X#define CMPcdaadr(x)	(x)->c.c_cdr->c.c_car->c.c_car->c.c_cdr
X#define CMPcdadar(x)	(x)->c.c_car->c.c_cdr->c.c_car->c.c_cdr
X#define CMPcdaddr(x)	(x)->c.c_cdr->c.c_cdr->c.c_car->c.c_cdr
X#define CMPcddaar(x)	(x)->c.c_car->c.c_car->c.c_cdr->c.c_cdr
X#define CMPcddadr(x)	(x)->c.c_cdr->c.c_car->c.c_cdr->c.c_cdr
X#define CMPcdddar(x)	(x)->c.c_car->c.c_cdr->c.c_cdr->c.c_cdr
X#define CMPcddddr(x)	(x)->c.c_cdr->c.c_cdr->c.c_cdr->c.c_cdr
X#define CMPfuncall	funcall
X#define	cclosure_call	funcall
Xobject simple_lispcall();
Xobject simple_lispcall_no_event();
Xobject simple_symlispcall();
Xobject simple_symlispcall_no_event();
Xextern object CMPtemp;
Xextern object CMPtemp1;
Xextern object CMPtemp2;
Xextern object CMPtemp3;
X#define	Cnil	((object)&Cnil_body)
X#define	Ct	((object)&Ct_body)
Xextern struct symbol Cnil_body, Ct_body;
Xobject MF();
Xobject MM();
Xextern object Scons;
Xextern object siSfunction_documentation;
Xextern object siSvariable_documentation;
Xextern object siSpretty_print_format;
Xextern object Slist;
Xextern object keyword_package;
Xobject alloc_object();
Xobject car();
Xobject cdr();
Xobject list();
Xobject listA();
Xobject coerce_to_string();
Xobject elt();
Xobject elt_set();
Xframe_ptr frs_sch();
Xframe_ptr frs_sch_catch();
Xobject make_cclosure();
Xobject nth();
Xobject nthcdr();
Xobject make_cons();
Xobject append();
Xobject nconc();
Xobject reverse();
Xobject nreverse();
Xobject number_expt();
Xobject number_minus();
Xobject number_negate();
Xobject number_plus();
Xobject number_times();
Xobject one_minus();
Xobject one_plus();
Xobject get();
Xobject getf();
Xobject putprop();
Xobject remprop();
Xobject string_to_object();
Xobject symbol_function();
Xobject symbol_value();
Xobject make_fixnum();
Xobject make_shortfloat();
Xobject make_longfloat();
Xobject structure_ref();
Xobject structure_set();
Xobject princ();
Xobject prin1();
Xobject print();
Xobject terpri();
Xobject aref();
Xobject aset();
Xobject aref1();
Xobject aset1();
Xchar object_to_char();
Xint object_to_int();
Xfloat object_to_float();
Xdouble object_to_double();
Xextern int FIXtemp;
X#define	CMPmake_fixnum(x) \
X((((FIXtemp=(x))+1024)&-2048)==0?small_fixnum(FIXtemp):make_fixnum(FIXtemp))
X#define Creturn(v) return((vs_top=vs,(v)))
X#define Cexit return((vs_top=vs,0))
Xdouble sin(), cos(), tan();
SHAR_EOF
chmod 0644 3b1port/diffs/cmpinclude.h || echo "restore of 3b1port/diffs/cmpinclude.h fails"
sed 's/^X//' << 'SHAR_EOF' > 3b1port/diffs/dpp.c.diff &&
X*** dpp.c.orig	Sat Oct  8 21:39:44 1988
X--- dpp.c	Sat Oct  8 21:35:11 1988
X***************
X*** 571,577
X  
X  LOOP:
X  	reset();
X! 	fprintf(out, "\n#line %d %s\n", line, filename);
X  	while ((c = readc()) != '@')
X  		putc(c, out);
X  	if (readc() != '(')
X
X--- 571,577 -----
X  
X  LOOP:
X  	reset();
X! 	fprintf(out, "\n#line %d \"%s\"\n", line, filename);
X  	while ((c = readc()) != '@')
X  		putc(c, out);
X  	if (readc() != '(')
X***************
X*** 581,587
X  		get_function();
X  		get_lambda_list();
X  		put_fhead();
X! 		fprintf(out, "\n#line %d %s\n", line, filename);
X  		while ((c = readc()) != '@')
X  			putc(c, out);
X  		put_declaration();
X
X--- 581,587 -----
X  		get_function();
X  		get_lambda_list();
X  		put_fhead();
X! 		fprintf(out, "\n#line %d \"%s\"\n", line, filename);
X  		while ((c = readc()) != '@')
X  			putc(c, out);
X  		put_declaration();
X***************
X*** 587,593
X  		put_declaration();
X  
X  	BODY:
X! 		fprintf(out, "\n#line %d %s\n", line, filename);
X  		while ((c = readc()) != '@')
X  			putc(c, out);
X  		if ((c = readc()) == ')') {
X
X--- 587,593 -----
X  		put_declaration();
X  
X  	BODY:
X! 		fprintf(out, "\n#line %d \"%s\"\n", line, filename);
X  		while ((c = readc()) != '@')
X  			putc(c, out);
X  		if ((c = readc()) == ')') {
SHAR_EOF
chmod 0644 3b1port/diffs/dpp.c.diff || echo "restore of 3b1port/diffs/dpp.c.diff fails"
sed 's/^X//' << 'SHAR_EOF' > 3b1port/diffs/earith.c.c.dif &&
SHAR_EOF
chmod 0644 3b1port/diffs/earith.c.c.dif || echo "restore of 3b1port/diffs/earith.c.c.dif fails"
sed 's/^X//' << 'SHAR_EOF' > 3b1port/diffs/earith.c.diff &&
X*** earith.c.orig	Sat Oct  8 18:44:36 1988
X--- earith.c	Sat Oct  8 18:49:46 1988
X***************
X*** 463,465
X  }
X  
X  #endif
X
X--- 463,525 -----
X  }
X  
X  #endif
X+ 
X+ #ifdef SGS68K
X+ extended_mul(d, q, r, hp, lp)
X+ int d, q, r;
X+ int *hp, *lp;
X+ {
X+ 	asm("	mov.l	%d2,-(%a7)");
X+ 	asm("	mov.w	8(%a6),%d0");
X+ 	asm("	mulu.w	14(%a6),%d0");
X+ 	asm("	mov.w	10(%a6),%d1");
X+ 	asm("	mulu.w	12(%a6),%d1");
X+ 	asm("	add.l	%d1,%d0");
X+ 	asm("	mov.w	8(%a6),%d1");
X+ 	asm("	mulu.w	12(%a6),%d1");
X+ 	asm("	mov.w	10(%a6),%d2");
X+ 	asm("	mulu.w	14(%a6),%d2");
X+ 	asm("	swap.w	%d2");
X+ 	asm("	add.w	%d0,%d2");
X+ 	asm("	swap.w	%d2");
X+ 	asm("	swap.w	%d0");
X+ 	asm("	addx.w	%d0,%d1");
X+ 	asm("	clr.l	%d0");
X+ 	asm("	swap.w	%d1");
X+ 	asm("	addx.w	%d0,%d1");
X+ 	asm("	swap.w	%d1");
X+ 	asm("	add.l	16(%a6),%d2");
X+ 	asm("	addx.l	%d0,%d1");
X+ 	asm("	lsl.l	&1,%d2");
X+ 	asm("	roxl.l	&1,%d1");
X+ 	asm("	lsr.l	&1,%d2");
X+ 	asm("	mov.l	20(%a6),%a0");
X+ 	asm("	mov.l	%d1,(%a0)");
X+ 	asm("	mov.l	24(%a6),%a0");
X+ 	asm("	mov.l	%d2,(%a0)");
X+ 	asm("	mov.l	(%a7)+,%d2");
X+ }
X+ 
X+ extended_div(d, h, l, qp, rp)
X+ int d, h, l;
X+ int *qp, *rp;
X+ {
X+ 	asm("	movm.l	&0x3000,-(%a7)");
X+ 	asm("	movm.l	8(%a6),&0x307");
X+ 	asm("	lsl.l	&1,%d2");
X+ 	asm("	addq.l	&1,%d2");
X+ 	asm("	mov.w	&31,%d3");
X+ 	asm("label2:	sub.l	%d0,%d1");
X+ 	asm("	bcs	label1");
X+ 	asm("	add.l	%d0,%d1");
X+ 	asm("label1:	roxl.l	&1,%d2");
X+ 	asm("	roxl.l	&1,%d1");
X+ 	asm("	dbf	%d3,label2");
X+ 	asm("	roxr.l	&1,%d1");
X+ 	asm("	not.l	%d2");
X+ 	asm("	mov.l	%d2,(%a0)");
X+ 	asm("	mov.l	%d1,(%a1)");
X+ 	asm("	movm.l	(%a7)+,&0xc");
X+ }
X+ 
X+ #endif
SHAR_EOF
chmod 0644 3b1port/diffs/earith.c.diff || echo "restore of 3b1port/diffs/earith.c.diff fails"
sed 's/^X//' << 'SHAR_EOF' > 3b1port/diffs/include.h.diff &&
X*** include.h.orig	Sat Oct  8 18:18:32 1988
X--- include.h	Sat Oct  8 18:25:32 1988
X***************
X*** 75,80
X  #define	ATT
X  #endif
X  
X  #ifdef S3000
X  #define	AV
X  #define	UNIX
X
X--- 75,88 -----
X  #define	ATT
X  #endif
X  
X+ #ifdef ATT3b1
X+ #define	AV
X+ #define	IEEEFLOAT
X+ #define	UNIX
X+ #define	ATT
X+ #define SGS68K
X+ #endif
X+ 
X  #ifdef S3000
X  #define	AV
X  #define	UNIX
SHAR_EOF
chmod 0644 3b1port/diffs/include.h.diff || echo "restore of 3b1port/diffs/include.h.diff fails"
sed 's/^X//' << 'SHAR_EOF' > 3b1port/diffs/main.c.diff &&
X*** main.c.orig	Sat Oct  8 18:53:12 1988
X--- main.c	Sat Oct  8 18:56:25 1988
X***************
X*** 863,868
X  		     make_cons(make_ordinary("KCL"), Cnil)))))));
X  #endif
X  
X  #ifdef S3000
X  	make_special("*FEATURES*",
X  		     make_cons(make_ordinary("S3300"),
X
X--- 863,879 -----
X  		     make_cons(make_ordinary("KCL"), Cnil)))))));
X  #endif
X  
X+ #ifdef ATT3b1
X+ 	make_special("*FEATURES*",
X+ 		     make_cons(make_ordinary("ATT3b1"),
X+ 		     make_cons(make_ordinary("IEEE-FLOATING-POINT"),
X+ 		     make_cons(make_ordinary("UNIX"),
X+ 		     make_cons(make_ordinary("SYSTEM-V"),
X+ 		     make_cons(make_ordinary("COMMON"),
X+ 		     make_cons(make_ordinary("SGS68K"),
X+ 		     make_cons(make_ordinary("KCL"), Cnil))))))));
X+ #endif
X+ 
X  #ifdef S3000
X  	make_special("*FEATURES*",
X  		     make_cons(make_ordinary("S3300"),
SHAR_EOF
chmod 0644 3b1port/diffs/main.c.diff || echo "restore of 3b1port/diffs/main.c.diff fails"
sed 's/^X//' << 'SHAR_EOF' > 3b1port/diffs/unixsave.c.dif &&
X*** unixsave.c.orig	Sun Oct  9 12:53:25 1988
X--- unixsave.c	Sun Oct  9 13:01:37 1988
X***************
X*** 11,17
X  #include "include.h"
X  
X  /* When MACHINE is S3000, use fcntl.h */
X! #ifdef S3000
X  #include <fcntl.h>
X  #else
X  #include <sys/file.h>
X
X--- 11,17 -----
X  #include "include.h"
X  
X  /* When MACHINE is S3000, use fcntl.h */
X! #if defined(S3000) || defined(ATT3b1)
X  #include <fcntl.h>
X  #else
X  #include <sys/file.h>
X***************
X*** 340,345
X  
X  init_unixsave()
X  {
X  	make_function("SAVE", Lsave);
X  }
X  
X
X--- 340,346 -----
X  
X  init_unixsave()
X  {
X+ #ifndef ATT3b1
X  	make_function("SAVE", Lsave);
X  #endif
X  }
X***************
X*** 341,346
X  init_unixsave()
X  {
X  	make_function("SAVE", Lsave);
X  }
X  
X  #ifdef ISI
X
X--- 342,348 -----
X  {
X  #ifndef ATT3b1
X  	make_function("SAVE", Lsave);
X+ #endif
X  }
X  
X  #ifdef ISI
SHAR_EOF
chmod 0644 3b1port/diffs/unixsave.c.dif || echo "restore of 3b1port/diffs/unixsave.c.dif fails"
exit 0

-- 
					:alex.
					Systems Programmer
nerwin!alex at umbc3.umd.edu		UMBC
alex at umbc3.umd.edu



More information about the Comp.sys.att mailing list