ftp.nice.ch/pub/next/developer/languages/lisp/AKCL.1.599.s.tar.gz#/akcl-1-599/c/faslNeXT.c

This is faslNeXT.c in view mode; [Download] [Up]

#include <rld.h>

#define	MAXPATHLEN	1024

int
fasload(faslfile)
object faslfile;
{
	object memory, data;
	FILE *fp;
	char filename[MAXPATHLEN];
	char command[MAXPATHLEN * 2];
	char *object_filenames[2];
	struct mach_header *header;
	unsigned long start_address;

	object *old_vs_base = vs_base;
	object *old_vs_top = vs_top;

	coerce_to_filename(faslfile, filename);

	faslfile = open_stream(faslfile, smm_input, Cnil, Kerror);
	vs_push(faslfile);
	fp = faslfile->sm.sm_fp;

	seek_to_end_ofile(fp);

	data = read_fasl_vector(faslfile);
	vs_push(data);
	close_stream(faslfile, TRUE);

/*
	rld_address_func (my_rld_address_func);
*/
	object_filenames[0] = filename;
	object_filenames[1] = NULL;
	if (!rld_load (NULL, &header, object_filenames, NULL))
		FEerror("The linkage editor failed.", 0);

	if (!rld_lookup (NULL, "_init_code", &start_address))
		FEerror("rld_lookup: failed.", 0);

	if(symbol_value(Vload_verbose)!=Cnil) {
		printf("start address -T %x ",start_address);
		fflush(stdout);
	      }

	memory=alloc_object(t_cfdata);
	memory->cfd.cfd_self=0;
	memory->cfd.cfd_fillp=0;
	memory->cfd.cfd_size = 0;
	memory->cfd.cfd_start= start_address;

	CLEAR_CACHE
	call_init(0,memory,data);

	vs_base = old_vs_base;
	vs_top = old_vs_top;

	return(memory->cfd.cfd_size);
}

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.