🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.text
Article #4362

Re: Note on Common TeX and METAFONT

#4362
From: Chris Torek
Date: Fri, 22 Jan 1988 19:22
146 lines
4791 bytes
In article <22696@ucbvax.BERKELEY.EDU> monardo@renoir.Berkeley.EDU
(Pat Monardo) writes:
>... Pascal TeX undex UNIX requires you to do absurb things to create
>a loaded TeX. I have never worked with that version so I dont know why,

In case anyone cares, it has to do with keeping things off Berkeley
Pascal's runtime file chain.  Without the \read 0 to \blort, the
preloaded TeX winds up with a circular file chain list and never
goes anywhere.

[For Common TeX,]
>Simply kill the program and undump it:
>
>This is Common TeX (no format preloaded)
[I think there is a `**&plain' missing here]
>*^\
>Quit (core dumped)

This brings up another gripe of mine.  This procedure requires
manual intervention:  Someone must type a control-backslash to
make the undumped TeX.  There is no way to have `make' rebuild
TeX automatically.  My way is a kludge, but it gets the job done.

This is extracted from my ext.c.  The calls to pascal_runtime__main_end
are for Pastel, not Berkeley Pascal; they should simply be deleted
to make it work under the Berkeley compiler.

/*
 * The following is an internal-use-only routine that makes a core
 * dump without any sort of error status.  It is used only when
 * making a production TeX from a virtex, and is triggered by a magic
 * file name requested as \input.
 *
 * This is what is known in computing circles as a hack.
 */
funny_core_dump()
{
	int pid, w;
	union wait status;

	switch (pid = vfork()) {

	case -1:		/* failed */
		perror("vfork");
		pascal_runtime__main_end();
		exit(-1);
		/*NOTREACHED*/

	case 0:			/* child */
		pascal_runtime__main_end();
		signal(SIGQUIT, SIG_DFL);
		kill(getpid(), SIGQUIT);
		write(2, "how did we get here?\n", 21);
		_exit(1);
		/*NOTREACHED*/

	default:		/* parent */
		while ((w = wait(&status)) != pid && w != -1)
			;
		if (status.w_coredump)
			exit(0);
		write(2, "attempt to dump core failed\n", 28);
		pascal_runtime__main_end();
		exit(1);
	}
}

/*
 * Test whether or not the file whose name is in fn
 * can be opened for reading (if amode==READACCESS)
 * or writing (if amode==WRITEACCESS).
 *
 * The pathindex argument is one of the ...FILEPATH constants.
 * If the filename given in nameoffile does not begin with '/', we try 
 * prepending all the ':'-separated areanames in the appropriate path to the
 * filename until access can be made, if it ever can.
 *
 * The realfn array will contain the name that yielded an
 * access success.
 *
 * N.B.:  we test for read access with "access", write access with "creat".
 */
int
testaccess(amode, pathindex, fn, realfn)
	int amode, pathindex;
	char *fn;
	register char *realfn;
{
	register char *p, *q, *s;
	register struct pathinfo *pi;
	int f;

	if (pathindex == INPUTFILEPATH && *fn == 'H' &&
	    strncmp(fn, "HackyInputFileNameForCoreDump.tex", 33) == 0)
		funny_core_dump();

	... [remainder deleted]

The Makefile then reads, in part:

	...
TEXDIR=	/usr/local/lib/tex

TEXINPUTS=	${TEXDIR}/macros
TEXFONTS=	${TEXDIR}/fonts
TEXFORMATS=	${TEXDIR}/macros
TEXPOOL=	${TEXDIR}

LATEXINPUTS=	${TEXDIR}/latex
LATEXFONTS=	${TEXDIR}/latex
LATEXFORMATS=	${TEXDIR}/latex
	...

plain.fmt: initex ${TEXINPUTS}/plain.tex ${TEXINPUTS}/hyphen.tex
	echo ' plain \dump' | \
	TEXINPUTS=":${TEXINPUTS}" TEXFONTS=":${TEXFONTS}" \
	TEXFORMATS=":${TEXFORMATS}" TEXPOOL=":${TEXPOOL}" ./initex

lplain.fmt: initex ${LATEXINPUTS}/lplain.tex ${LATEXFONTS}/lfonts.tex
lplain.fmt: ${TEXINPUTS}/hyphen.tex
	echo ' lplain \dump' | \
	TEXINPUTS=":${LATEXINPUTS}:${TEXINPUTS}" \
	TEXFONTS=":${LATEXFONTS}:${TEXFONTS}" \
	TEXFORMATS=":${LATEXFORMATS}:${TEXFORMATS}" \
	TEXPOOL=":${TEXPOOL}" ./initex

tex: virtex plain.fmt
	echo ' &plain \input HackyInputFileNameForCoreDump.tex' | \
	TEXINPUTS=":${TEXINPUTS}" TEXFONTS=":${TEXFONTS}" \
	TEXFORMATS=":${TEXFORMATS}" TEXPOOL=":${TEXPOOL}" ./virtex
	@echo ''
	undump tex virtex core
	rm -f core

latex: virtex lplain.fmt
	echo ' &lplain \input HackyInputFileNameForCoreDump.tex' | \
	TEXINPUTS=":${LATEXINPUTS}:${TEXINPUTS}" \
	TEXFONTS=":${LATEXFONTS}:${TEXFONTS}" \
	TEXFORMATS=":${LATEXFORMATS}:${TEXFORMATS}" \
	TEXPOOL=":${TEXPOOL}" ./virtex
	@echo ''
	undump latex virtex core
	rm -f core
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris@mimsy.umd.edu	Path:	uunet!mimsy!chris
Technical Details
Message-ID: <10302@mimsy.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!cmcl2!brl-adm!umd5!mimsy!chris
References: <22696@ucbvax.BERKELEY.EDU>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!cmcl2!brl-adm!umd5!mimsy!chris
From: chris@mimsy.UUCP (Chris Torek)
Newsgroups: comp.text
Subject: Re: Note on Common TeX and METAFONT
Message-ID: <10302@mimsy.UUCP>
Date: 22 Jan 88 19:22:04 GMT
References: <22696@ucbvax.BERKELEY.EDU>
Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742
Lines: 146