johnsonjh / pmince

pmince: Portable MINCE (MINCE is Not Complete[ly] EMACS)

Home Page:https://github.com/johnsonjh/pmince

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DIRED for MINCE

johnsonjh opened this issue · comments

21-Nov-83 08:12:56-MST,1438;000000000000
Return-Path: <Hess.Unicorn@MIT-MULTICS.ARPA>
Received: from MIT-MULTICS.ARPA by SIMTEL20.ARPA with TCP; Mon 21 Nov 83 08:12:04-MST
Date:  19 November 1983 00:55 est
From:  Hess.Unicorn at MIT-MULTICS
Subject:  Dired
To:  madler at MIT-MC
cc:  amethyst-users at SIMTEL20
In-Reply-To:  Your message of 8/26/83 to AMETHYST-USERS @ MIT-MC

Took a long time to answer, but...

The wizard of Mince tells me that yes, if you set the DMA address to
something random, it will be valid when Mince attempts to do I/O.  And
that you have chosen the only way to get Dired to work.  However, he
says "if you must" to your question about setting the modified flag to
false after writing to the buffer.  Being a purist, he feels that the
changes to the directory should not be made until you exit from Dired
mode, which should delete the buffer so that the question about modified
buffers on exiting Mince would never appear.  (Of course, when
confronted with the fact that it's a drag keeping around the information
until Dired is exited and that The FinalWord doesn't even go to such
great lengths, he relented, but only in view that there is so little
free memory for storing linked lists of files to rename/delete or code
for reparsing the buffer to catch all the deleted files upon exiting
Dired.)

I hope that somebody said that they were interested in the routine;
someone once asked for such a thing about a year ago.
28-Nov-83 08:39:51-MST,3010;000000000000
Return-Path: <MADLER@MIT-ML>
Received: from MIT-ML by SIMTEL20.ARPA with TCP; Mon 28 Nov 83 08:38:45-MST
Date: 25 November 1983 20:24 EST
From: Michael C. Adler <MADLER @ MIT-ML>
Subject:  Dired for Mince
To: ihnp4!utcsrgv!utai!mts @ UCB-VAX
cc: Hess.Unicorn @ MIT-MULTICS, amethyst-users @ SIMTEL20

Thanks to Brian Hess for answering my questions.  A while ago, I asked
about interest in Dired routines for mince.  I wrote a minimal routine
that reads the directory into a buffer and does no more.  I didn't have
the time or interest in writing a more complete Dired (I'm also not
convinced its worth the memory either).  The following is the routine I
wrote.  If anyone decides to modify it, please tell me.

/* DIRED.C - A directory reader.  This really shouldn't be called dired,
since it just reads in a directory buffer.  I suppose it can be viewed
as the beginning of a dired mode.

If you bind this routine to ^X^D it will read in the directory of the
current disk.  Binding to anything else will cause it to prompt for disk.
I have it bound to ^X^D and ^XD.

-Michael Adler (MADLER@MIT-ML) */

#include "mince.gbl"

MDired()		/* Read directory to buffer */
{
	int cnt, done, a;
	char *fcb, *dma, drive;

	arg=0;
	if ((cmnd & 0x7F) == 4) {
		*namearg = (bdos(25,0) & 0xFF) + 'a';
		}
	else {
		if (!GetArg("Drive <CR>: ",CR,namearg,BUFNAMMAX)) return;
		LowCase(namearg);
		if (*namearg < 'a' || *namearg > 'n') {
			error("Illegal Drive");
			return;
			}
		}
	if ((cnt=CFindBuff("-dired"))>0) {
		BSwitchTo(buffs[cnt].bbuff);
		BToStart();
		BMrkToPnt(mark);
		BToEnd();
		BDelToMrk(mark);
		}
	else {
		if ((cnt=CMakeBuff("-dired","DIR.DIR"))<0) return;
		*(buffs[cnt].bmodes)='\0';
		strcpy(buffs[cnt].fname,"DIR.DIR");
		BSwitchTo(buffs[cnt].bbuff);
		}

	fcb = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
       	dma = "01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567";
					/* 128 bytes */
	*fcb = *namearg - '`';		/* Disk drive */
	drive = *namearg & 0x0DF;
	strcpy(&fcb[1], "???????????");
	done = 0;
	CSwitchTo(cnt);
	bdos(0x1A, dma);		/* Set the dma address */
	a = 0x0FF & bdos(0x11, fcb);		/* Search for first */
	bdos(0x1A, 0x80);		/* DMA back to 80H for swap file */
	while (a != 0x0FF) {
		if ((dma[(a <<= 5)] != 0x0E5) && !(dma[a+10] & 0x80)) {
			if (done++ & 3) {
				BInsert(' '); BInsert(' ');
				BInsert('|');
				BInsert(' '); BInsert(' ');
				}
			else {
				BInsert(NL); BInsert(drive);
				BInsert(':'); BInsert(' ');
				}
			FNameIns(&dma[a+1]);
			}
		bdos(0x1A, dma);		/* Set the dma address */
		a = 0x0FF & bdos(0x12, fcb);
		bdos(0x1A, 0x80);	/* DMA back to 80H for swap file */
		}
	BToStart();
	BMrkToPnt(mark);
	ScrnRange();
	}

FNameIns(s)
	char s[10];
{
	int i;

	for (i=0; i<11; ) {
		BInsert(s[i] & 0x7F);
		if (i++ == 7) BInsert('.');
		}
	}