koreth@ssyx.ucsc.edu (Steven Grimm) (03/03/89)
Submitted-by: sun.com!laidbak!katzung (Brian Katzung)
Posting-number: Volume 2, Issue 20
Archive-name: uw/part02
#!/bin/sh
# this is part 2 of a multipart archive
# do not concatenate these parts, unpack them in order with /bin/sh
# file KERMIT.C continued
#
CurArch=2
if test ! -r s2_seq_.tmp
then echo "Please unpack part 1 first!"
exit 1; fi
( read Scheck
if test "$Scheck" != $CurArch
then echo "Please unpack part $Scheck next!"
exit 1;
else exit 0; fi
) < s2_seq_.tmp || exit 1
sed 's/^X//' << 'SHAR_EOF' >> KERMIT.C
X numtry = 0; /* Reset try counter */
X return(state); /* Stay in Data state */
X }
X else return('A'); /* Not previous packet, "abort" */
X
X case 'Z': /* End-Of-File */
X if (num != n) return('A'); /* Must have right packet number */
X spack('Y',n,0,NULL); /* OK, ACK it. */
X fclose(fp); /* Close the file */
X n = (n+1)%64; /* Bump packet number */
X return('F'); /* Go back to Receive File state */
X
X case 'E': /* Error packet received */
X prerrpkt(recpkt); /* Print it out and */
X return('A'); /* abort */
X
X case FALSE: /* Didn't get packet */
X spack('N',n,0,NULL); /* Return a NAK */
X return(state); /* Keep trying */
X
X default: return('A'); /* Some other packet, "abort" */
X }
X}
X
X
X/*
X * KERMIT utilities.
X */
X
X
X/*
X * s p a c k
X *
X * Send a Packet
X */
X
Xspack(type,num,len,data)
Xchari type;
Xchar *data;
Xint num, len;
X{
X int i; /* Character loop counter */
X char chksum, buffer[100]; /* Checksum, packet buffer */
X register char *bufp; /* Buffer pointer */
X
X if (debug>1) /* Display outgoing packet */
X {
X printmsg(" spack type: %c\n",type);
X printmsg(" num: %d\n",num);
X printmsg(" len: %d\n",len);
X if (data != NULL)
X {
X data[len] = '\0'; /* Null-terminate data to print it */
X printmsg(" data: \"%s\"\n",data);
X }
X }
X
X bufp = buffer; /* Set up buffer pointer */
X for (i=1; i<=pad; i++) proto_out(kermport,&padchar,1); /* Issue any padding */
X
X *bufp++ = SOH; /* Packet marker, ASCII 1 (SOH) */
X *bufp++ = tochar(len+3); /* Send the character count */
X chksum = tochar(len+3); /* Initialize the checksum */
X *bufp++ = tochar(num); /* Packet number */
X chksum += tochar(num); /* Update checksum */
X *bufp++ = type; /* Packet type */
X chksum += type; /* Update checksum */
X
X for (i=0; i<len; i++) /* Loop for all data characters */
X {
X *bufp++ = data[i]; /* Get a character */
X chksum += data[i]; /* Update checksum */
X }
X chksum = (((chksum&0300) >> 6)+chksum)&077; /* Compute final checksum */
X *bufp++ = tochar(chksum); /* Put it in the packet */
X *bufp = eol; /* Extra-packet line terminator */
X proto_out(kermport, buffer, bufp-buffer+1);
X /* Send the packet */
X#ifdef EXTRADEBUG
X if (debug > 2) printmsg("Returning from spack");
X#endif
X}
X
X/*
X * r p a c k
X *
X * Read a Packet
X * This routine is called both to buffer data from the host to the kermit
X * window and to retreive those buffers once they contain a packet. This
X * routine calls the kermit state machine when it has a complete packet.
X * The kermit state machine in turn calls this routine to retreive the packet.
X * Thus, this routine is indirectly recursive to two levels. Receive timeouts
X * and bad packets cause FALSE to be returned to the state machine. The uw
X * control loop calls us with num == NULL to pass us a string of data from
X * the host. The uw control loop calls us with len == NULL if the timout
X * counter (kerm_time) exceeds timint without us reseting it.
X */
X#ifdef EXTRADEBUG
X#define getnext {t = *dptr++; \
X if (debug>2) printmsg( "char %d state %c", t, recstate);\
X if ((t & 0177) == SOH) { \
X recstate = 'L'; /* restart packet collection */\
X break; } \
X if (!image) t &= 0177; /* Handle parity */ \
X if (t == 0) break; /* end of this input buffer */ }
X#else
X#define getnext {t = *dptr++; \
X if ((t & 0177) == SOH) { \
X recstate = 'L'; /* restart packet collection */\
X break; } \
X if (!image) t &= 0177; /* Handle parity */ \
X if (t == 0) break; /* end of this input buffer */ }
X#endif
Xrpack(len,num,data)
Xint *len, *num; /* Packet length, number */
Xchar *data; /* Packet data */
X{
X static int i; /* Data character number */
X static int leng; /* length of data packet in buffer */
X static char type; /* packet type */
X static int numb; /* number of data packet in buffer */
X static int timedout = 0; /* did we time out? */
X char t; /* Current input character */
X static char cchksum, /* Our (computed) checksum */
X rchksum; /* Checksum received from other host */
X char *dptr; /* pointer to next data byte */
X static char mybuf[MAXPACKSIZ]; /* buffer used to acumulate packet */
X static char recstate = 'S'; /* start with S state */
X
X if (len == NULL) { /* timed out */
X timedout = TRUE;
X if (sflg)
X {
X if (sendsw() != GETPACK) /* Send the file(s) */
X return(kermterm());
X }
X else if (rflg)
X {
X if (recsw() != GETPACK) /* Receive the file(s) */
X return(kermterm());
X }
X return (0);
X }
X if (len != NULL && num != NULL) /* received packet or timed out */
X {
X *len = leng;
X *num = numb;
X timestamp = clock(); /* reset timer */
X if (timedout)
X {
X printmsg("Timeout.");
X timedout = 0;
X return(FALSE);
X }
X for (i=0; i<leng; i++)
X data[i] = mybuf[i];
X if (data != NULL)
X data[*len] = '\0'; /* Null-terminate data to print it */
X if (debug>1) /* Display incoming packet */
X {
X printmsg(" rpack type: %c\n",type);
X printmsg(" num: %d\n",*num);
X printmsg(" len: %d\n",*len);
X if (data != NULL)
X printmsg(" data: \"%s\"\n",data);
X }
X /* Fold in bits 7,8 to compute */
X cchksum = (((cchksum&0300) >> 6)+cchksum)&077; /* final checksum */
X
X if (cchksum != rchksum) return(FALSE);
X
X return(type); /* All OK, return packet type */
X }
X /* num == NULL so collect data for kermit */
X dptr = data;
X t = -1;
X while (t)
X {
X switch(recstate)
X {
X case 'S':
X while (1) /* Wait for packet header */
X getnext;
X break;
X case 'L': /* get packet length */
X getnext; /* get next character */
X cchksum = t; /* Start the checksum */
X leng = unchar(t)-3; /* Character count */
X if (leng > MAXPACKSIZ)
X leng = MAXPACKSIZ;
X i = 0;
X recstate = 'N';
X /* Fall Through */
X
X case 'N': /* get packet number */
X getnext
X cchksum = cchksum + t; /* Update checksum */
X numb = unchar(t); /* Packet number */
X recstate = 'T';
X /* Fall Through */
X
X case 'T': /* get packet type */
X getnext;
X cchksum = cchksum + t; /* Update checksum */
X type = t; /* Packet type */
X recstate = 'D';
X /* Fall Through */
X
X case 'D': /* get packet data */
X for (; i<leng; i++) /* The data itself, if any */
X { /* Loop for character count */
X getnext;
X cchksum = cchksum + t; /* Update checksum */
X mybuf[i] = t; /* Put it in the data buffer */
X }
X if (i == leng)
X recstate = 'C';
X break;
X
X case 'C':
X mybuf[leng] = 0; /* Mark the end of the data */
X getnext;
X rchksum = unchar(t); /* Convert to numeric */
X recstate = 'E'; /* Done with packet receipt */
X t = 0; /* Dispose of remaining data */
X }
X }
X if (recstate == 'E') {
X recstate = 'S';
X if (sflg)
X {
X if (sendsw() != GETPACK) /* Send the file(s) */
X return(kermterm());
X }
X else if (rflg)
X {
X if (recsw() != GETPACK) /* Receive the file(s) */
X return(kermterm());
X }
X }
X return(0);
X}
X
X
X/*
X * b u f i l l
X *
X * Get a bufferful of data from the file that's being sent.
X * Only control-quoting is done; 8-bit & repeat count prefixes are
X * not handled.
X */
X
Xbufill(buffer)
Xchar buffer[]; /* Buffer */
X{
X int i, /* Loop index */
X t; /* Char read from file */
X char t7; /* 7-bit version of above */
X
X i = 0; /* Init data buffer pointer */
X while((t = getc(fp)) != EOF) /* Get the next character */
X {
X t7 = t & 0177; /* Get low order 7 bits */
X
X if (t7 < SP || t7==DEL || t7==quote) /* Does this char require */
X { /* special handling? */
X if (t=='\n' && !image)
X { /* Do LF->CRLF mapping if !image */
X buffer[i++] = quote;
X buffer[i++] = ctl('\r');
X }
X buffer[i++] = quote; /* Quote the character */
X if (t7 != quote)
X {
X t = ctl(t); /* and uncontrolify */
X t7 = ctl(t7);
X }
X }
X if (image)
X buffer[i++] = t; /* Deposit the character itself */
X else
X buffer[i++] = t7;
X
X if (i >= spsiz-8) return(i); /* Check length */
X }
X if (i==0) return(EOF); /* Wind up here only on EOF */
X return(i); /* Handle partial buffer */
X}
X
X
X/*
X * b u f e m p
X *
X * Put data from an incoming packet into a file.
X */
X
Xbufemp(buffer,len)
Xchar buffer[]; /* Buffer */
Xint len; /* Length */
X{
X int i; /* Counter */
X char t; /* Character holder */
X
X#ifdef EXTRADEBUG
X if (debug > 2) printmsg("Entered bufemp");
X#endif
X for (i=0; i<len; i++) /* Loop thru the data field */
X {
X t = buffer[i]; /* Get character */
X if (t == MYQUOTE) /* Control quote? */
X { /* Yes */
X t = buffer[++i]; /* Get the quoted character */
X if ((t & 0177) != MYQUOTE) /* Low order bits match quote char? */
X t = ctl(t); /* No, uncontrollify it */
X }
X if (t==CR && !image) /* Don't pass CR if not in image mode */
X continue;
X#ifdef EXTRADEBUG
X if (debug > 2) printmsg("writing t=%c", t);
X#endif
X putc(t,fp);
X }
X}
X
X
X
X/*
X * g n x t f l
X *
X * Get next file in a file group
X */
X
Xgnxtfl()
X{
X if (filecount-- == 0) return FALSE; /* If no more, fail */
X if (debug) printmsg(" gnxtfl: filelist = \"%s\"\n",*filelist);
X filnam = *(filelist++);
X return TRUE; /* else succeed */
X}
X
X
X/*
X * s p a r
X *
X * Fill the data array with my send-init parameters
X *
X */
X
Xspar(data)
Xchar data[];
X{
X data[0] = tochar(MAXPACKSIZ); /* Biggest packet I can receive */
X data[1] = tochar(reqtimint); /* When I want to be timed out */
X data[2] = tochar(MYPAD); /* How much padding I need */
X data[3] = ctl(MYPCHAR); /* Padding character I want */
X data[4] = tochar(MYEOL); /* End-Of-Line character I want */
X data[5] = MYQUOTE; /* Control-Quote character I send */
X}
X
X
X/* r p a r
X *
X * Get the other host's send-init parameters
X *
X */
X
Xrpar(data)
Xchar data[];
X{
X spsiz = unchar(data[0]); /* Maximum send packet size */
X timint = unchar(data[1]); /* When I should time out */
X if (timint > MAXTIM) timint = MAXTIM;
X if (timint < MINTIM) timint = MINTIM;
X pad = unchar(data[2]); /* Number of pads to send */
X padchar = ctl(data[3]); /* Padding character to send */
X eol = unchar(data[4]); /* EOL character I must send */
X quote = data[5]; /* Incoming data quote character */
X}
X
X
X/*
X * Kermit printing routines:
X *
X * printmsg - like printf with "Kermit: " prepended
X * prerrpkt - print contents of error packet received from remote host
X */
X
X
X/*
X * p r i n t m s g
X *
X * Print message kermit window
X */
X
X/*VARARGS1*/
Xprintmsg(fmt, a1, a2, a3, a4, a5)
Xchar *fmt;
X{
X char *sbuf[100];
X w_output(kermwdes,"Kermit: ");
X sprintf(sbuf,fmt,a1,a2,a3,a4,a5);
X w_output(kermwdes,sbuf);
X w_output(kermwdes,"\n\r");
X}
X
X
X/*
X * p r e r r p k t
X *
X * Print contents of error packet received from remote host.
X */
Xprerrpkt(msg)
Xchar *msg;
X{
X printmsg("Kermit aborting with following error from remote host:\n%s",msg);
X return;
X}
SHAR_EOF
chmod 0600 KERMIT.C || echo "restore of KERMIT.C fails"
sed 's/^X//' << 'SHAR_EOF' > LASTCHG &&
X89 Jan 24 2.1.2
X Removed radio button and touch-exit attributes and
X added exit attribute to send/receive/cancel buttons
X in kermit parameter dialog (double-click bug fix) -- BK
X88 Sep 19 2.1.1
X Added cursor-to-bottom on font change+reshape and
X fixed set_menu_string() bug -- BK
X88 Sep 12 Version w/ latest fixes from Brad Bosch
SHAR_EOF
chmod 0600 LASTCHG || echo "restore of LASTCHG fails"
sed 's/^X//' << 'SHAR_EOF' > LCKBLK1.ICN &&
X/* GEM Icon Definition: */
X#define lckblk1_W 0x0010
X#define lckblk1_H 0x0028
X#define lckblk1SIZE 0x0028
Xshort lckblk1[lckblk1SIZE] =
X{ 0x0005, 0x0009, 0x0001, 0x0000,
X 0x0001, 0x1FF8, 0x300C, 0x67E6,
X 0x4C32, 0x581A, 0x500A, 0xDFFB,
X 0x8001, 0x8001, 0x83C1, 0x83C1,
X 0x8181, 0x8181, 0x8181, 0x8001,
X 0xFFFF, 0x0000, 0x0FF0, 0x1818,
X 0x300C, 0x2004, 0x2004, 0x2004,
X 0x7FFE, 0x7FFE, 0x7C3E, 0x7C3E,
X 0x7E7E, 0x7E7E, 0x7E7E, 0x7FFE,
X 0x0000, 0x0000, 0x0000, 0x0000
X};
SHAR_EOF
chmod 0600 LCKBLK1.ICN || echo "restore of LCKBLK1.ICN fails"
sed 's/^X//' << 'SHAR_EOF' > MAKE.BAT &&
X# This file has not been maintained and is not supported
Xcp68 -i \dric.dir\ -i %1 %1winmain.c %1winmain.i
Xc068 %1winmain.i %1winmain.1 %1winmain.2 %1winmain.3 -f
Xrm %1winmain.i
Xc168 %1winmain.1 %1winmain.2 %1winmain.s
Xrm %1winmain.1
Xrm %1winmain.2
Xas68 -l -u %1winmain.s
Xrm %1winmain.s
Xcp68 -i \dric.dir\ -i %1 %1winsubr.c %1winsubr.i
Xc068 %1winsubr.i %1winsubr.1 %1winsubr.2 %1winsubr.3 -f
Xrm %1winsubr.i
Xc168 %1winsubr.1 %1winsubr.2 %1winsubr.s
Xrm %1winsubr.1
Xrm %1winsubr.2
Xas68 -l -u %1winsubr.s
Xrm %1winsubr.s
Xlink68 [u] %1wind.68k=gemstart,%1winsubr,%1winmain,vdibind,gemlib,aesbind,osbind,libf
Xrelmod %1wind
Xrm %1wind.68k
SHAR_EOF
chmod 0600 MAKE.BAT || echo "restore of MAKE.BAT fails"
sed 's/^X//' << 'SHAR_EOF' > MAKEFILE &&
X# make file for uw compiled with mwc
X# GETSPEED, GETFLOW, and GETUCR use magic cookies to get the RS232
X# configuration. Otherwise, the configuration is not known until
X# you set it.
XCFLAGS=-O -DMWC -DLOCATE='"c:\\bin"' -DGETSPEED -DGETFLOW -DGETUCR
X
Xall: bldmform.prg mform.o win.prg startgem.prg
X echo
X
XOBJS= winmain.o winsubr.o mform.o resetaux.o winhash.o winio.o winproto.o\
X winproc.o kermit.o
X
Xwin.prg: $(OBJS)
X $(CC) $(CFLAGS) -VGEM -s -o win.prg $(OBJS)
X
Xmform.o: rmbblk1.icn lckblk1.icn
X bldmform -ndR rmbmform rmbblk1.icn > mform.c
X bldmform -ndR lckmform lckblk1.icn >> mform.c
X $(CC) $(CFLAGS) -c mform.c
X
Xbldmform.prg: bldmform.c
X $(CC) $(CFLAGS) -o bldmform.prg bldmform.c
X
Xresetaux.o: resetaux.s
X $(CC) $(CFLAGS) -c resetaux.s
X
Xstartgem.prg: startgem.s
X as -o startgem.o startgem.s
X ld -s -o startgem.prg startgem.o
X rm startgem.o
SHAR_EOF
chmod 0600 MAKEFILE || echo "restore of MAKEFILE fails"
sed 's/^X//' << 'SHAR_EOF' > MFORM.C &&
X/* GEM Icon Definition: */
X#define rmbblk1_W 0x0010
X#define rmbblk1_H 0x0028
X#define rmbblk1SIZE 0x0028
Xshort rmbmform[rmbblk1SIZE] =
X{ 0x000A, 0x0003, 0x0001, 0x0000,
X 0x0001, 0xFFFF, 0x8037, 0xB82F,
X 0xB801, 0xB82F, 0xB837, 0x803F,
X 0xBFA0, 0xBFA0, 0xBFA0, 0xBBA0,
X 0xB1A0, 0xAAA0, 0xBFA0, 0x8020,
X 0xFFE0, 0x0000, 0x7FC8, 0x47D0,
X 0x47FE, 0x47D0, 0x47C8, 0x7FC0,
X 0x4040, 0x4040, 0x4040, 0x4440,
X 0x4E40, 0x5540, 0x4040, 0x7FC0,
X 0x0000, 0x0000, 0x0000, 0x0000
X};
X/* GEM Icon Definition: */
X#define lckblk1_W 0x0010
X#define lckblk1_H 0x0028
X#define lckblk1SIZE 0x0028
Xshort lckmform[lckblk1SIZE] =
X{ 0x0005, 0x0009, 0x0001, 0x0000,
X 0x0001, 0x1FF8, 0x300C, 0x67E6,
X 0x4C32, 0x581A, 0x500A, 0xDFFB,
X 0x8001, 0x8001, 0x83C1, 0x83C1,
X 0x8181, 0x8181, 0x8181, 0x8001,
X 0xFFFF, 0x0000, 0x0FF0, 0x1818,
X 0x300C, 0x2004, 0x2004, 0x2004,
X 0x7FFE, 0x7FFE, 0x7C3E, 0x7C3E,
X 0x7E7E, 0x7E7E, 0x7E7E, 0x7FFE,
X 0x0000, 0x0000, 0x0000, 0x0000
X};
SHAR_EOF
chmod 0600 MFORM.C || echo "restore of MFORM.C fails"
sed 's/^X//' << 'SHAR_EOF' > README &&
X
X UW (Unix (tm) Windows) for the Atari ST
X
XThis program was written by Hans-Martin Mosner at the University of
XDortmund in West Germany. It has since been enhanced by Brad Bosch
Xand Brian Katzung at Lachman Associates, Inc., in Naperville, Illinois.
X
XNote that this disk represents a beta test version, and is provided on
Xa strictly as-is basis, and we assume no responsibility or liability
Xfor any aspect of this software.
X
XThis version of uw provides only adm31 emulation and the most basic
XUW protocol. The adm31 emulation has been extended slightly. See
Xthe end of the Features section for a description of the extensions.
X
XFeatures added by Brad Bosch and Brian Katzung:
X
X o Jump scrolling occurs if screen updates can't keep up with
X transmission from the host.
X
X o The input window may be different than the top window.
X
X o A printer copy of output to each window may be enabled or
X disabled on a window-by-window basis in various flavors.
X
X o <Shift><Help> sends a break.
X
X o There is a menu item to reset flow control if the Atari and
X the host get out of synchronization.
X
X o Fonts "windalt.fnt", "windoth.fnt", and "windtny.fnt" are
X supported in addition to "windstd.fnt". The "windtny" font is
X small enough to allow four 24 x 80 windows on the screen without
X overlapping.
X
X o The smaller system font is offered in addition to the larger
X one. Some of the characters in the smaller font are "improved"
X to increase readability.
X
X o The user may now select whether or not a window will be
X "topped" when a ^G (BEL) is output to it.
X
X o The user may choose to have ^G (BEL) flash the screen, ring
X the bell, neither, or both.
X
X o When not selecting an input window, pressing the right mouse
X button on the menu bar toggles the menu bar sensitivity.
X
X o The close-box works even when the UW protocol is not running.
X This is useful for changing the font size or other options.
X
X o The RTS (request to send) and DTR (data terminal ready) lines
X can be cleared and asserted.
X
X o Function keys can be used and defined up to 40 characters each.
X
X o Function keys and other global option values can be saved and
X loaded. A file called "win.cnf", if present, is read at startup
X time.
X
X o The right mouse button can be used to copy text from the screen
X and send it to a window as keyboard input. Click twice on a
X window border to send copied text. Click once on the boarder to
X select the window for input. Select text by dragging with the
X right button pressed. Inside a border, a single right button
X click selects a word and a double click selects a line.
X
X o Emulation window size can now be selected when a window is opened.
X The fixed sizes available in the menu can be changed with a resource
X editor without recompiling. Default sizes are font dependent.
X
X o A window menu item was added to allow the bottom window to be sent
X to the top even if it is competely hidden. Another item sends the
X top window to the bottom. The latter is somewhat slow due to
X shortcomings in GEM.
X
X o The main keyboard digit keys when used while the alt key is down
X will select that window number to be the top and keyboard input
X window. The first window is alt-1, the last is alt-7. Windows
X are numbered as gem numbers them. Alt-key bindings for lower
X case letters are scanned from the menu strings in the resource
X file. These bindings are indicated by the ^E (close box)
X character.
X
X o A window menu item was added to shrink the current window to an
X iconic size. The second-from-the-top non-iconic window becomes
X the current window. The fuller box is used to reverse the process.
X
X o An option is now available to cause new windows to be created
X without the sliders and arrows. The title bar (and close and
X fuller boxes) may also be eliminated by another option. Menu
X items have been added to support most of the functionality lost
X when the window controls are turned off.
X
X o Additional help information was added to the about dialog.
X
X o Startgem is now included in the distribution. This program, if
X placed in the auto folder, will attempt to start a:\bin\uw.prg
X automatically when the ST is booted up.
X
X o A variable called "locpath" contains the name of a directory to
X scan after the current directory when looking for configuration
X and font files. The string is 64 bytes long and defaults to
X c:\bin.
X
X o An RS232 configuration dialog has been added. There is no pro-
X vision for putting this information in the configuration file.
X Bug view: There is no auto-configuration. Feature view: Changes
X persist across executions.
X
X o One can now capture host output to a file on a per-window basis.
X Capture mode is terminated by setting an empty file name.
X
X o Added keyboard lock to file menu. This locks the keyboard and mouse
X until your password is reentered.
X
X o Added change working directory item to file menu. This is usefull
X for kermit and the exec command entry.
X
X o Added execute command entry. This allows uw to be suspended while
X another command is executed. Note that mwc startup for gem does not
X preserve the environment variables. The default command and
X parameters are part of the config file.
X
X o Add basic kermit functionality. Kermit can operate under the uw
X protocol in a window concurent with interactive terminal windows.
X Sending multiple files is not yet supported.
X
X
XExtensions to Adm31 emulation:
X
X o If the host sends a window the sequence ESC [18t, the window will
X respond with ESC [8;<rows>;<cols>t, where <rows> and <cols> specify
X the window's size in characters.
X
X o The insert line and delete line escape sequences (ESC E and ESC R,
X respectively) allow a repeat count (ie, ESC 5E inserts 5 lines).
X
XBugs fixed:
X
X o Exiting in "fast" mode used to leave a window open. The
X system would crash on the next run unless you had returned
X to the desktop.
X
X o Actions on windows now check that there are windows to act upon.
X
X
XKnown bugs:
X
X o Because of the extra memory used in the jump scrolling
X algorithm, the bottom row of pixels of an earlier line
X sometimes appears immediately below the title bar.
X
X o GEM doesn't let you completely eliminate the menu bar and
X increase your workspace.
X
X o Desk accessories sometimes leave damage on the screen.
X
X o GEM doesn't send "top" messages to the top window, so you
X can't use the left mouse button as a short hand to select
X the top window for input. Use the right button on the window
X title bar instead.
X
X o The rsconf() baud rates listed in the manual as 75 and 50 baud
X really result in system timer settings for 120 and 80 baud.
X The RS232 configuration dialog allows you to set these two baud
X rates, but decodes them as 300 or 200 baud, respectively.
X
X o The RS232 configuration code uses some trickery to determine the
X current port configuration. Some parts of this code may need to
X be turned off or adapted to run on other hardware or if system
X calls stop returning undocumented values.
SHAR_EOF
chmod 0600 README || echo "restore of README fails"
sed 's/^X//' << 'SHAR_EOF' > RESETAUX.S &&
X/
X/ Reset the Aux rs232 port. Usage:
X/ char *rs232_iorec = Iorec(0); /* Do this first */
X/
X/ if (rs232_reset())
X/ Cauxout(0x11); /* sent an XOFF */
X/
X/ This subroutine was written by Martin Minow, Arlington, MA
X/ and is in the public domain.
X/
X/ .shrd / Public data
X/ .globl rs232_iorec_ / -> aux io record. see below
X .shri / Public instructions
X .globl rs232_reset_
X
Xrs232_reset_:
X move.l d2,-(sp) / Save a scratch register
X clr.l -(sp) / Super(0L) switches to super mode
X move.w $0x20,-(sp) / Super opcode
X trap $1 / Call TOS
X addq.l $6,sp / Clear stack
X move.l d0,-(sp) / Save old stack for now.
X/
X/ If you don't already have the iorec as a readily-available global,
X/ uncomment the following code (which is, of course, untested)
X/
X clr.w -(sp) / Aux port is device zero
X move.w $14,-(sp) / Iorec
X trap $14 / Xbios(14)
X addq.l $4,sp / Clear stack
X/ End of "get iorec" code. We already have this information:
X/ movea rs232_iorec_,a0 / a0 -> I/O record
X movea d0,a0 / a0 -> I/O record
X move sr,-(sp) / Save cpu status
X ori $0x700,sr / Disable interrupts
X/ clr.l 6(a0) / Clear input head, tail -- crashes!
X clr.l 20(a0) / Clear output head, tail
X clr.l d2 / Clear result
X or.b 30(a0),d2 / Get old rcv xoff state
X clr.w 30(a0) / Cancel rcv, xmt xoff states
X move (sp)+,sr / Enable interrupts
X move.w $0x20,-(sp) / Super -- old_stack is still at (sp)
X trap $1 / Exit super mode
X addq $6,sp / Clean junk from stack
X move.l d2,d0 / Get result
X move.l (sp)+,d2 / Restore d2
X rts / Exit routine
SHAR_EOF
chmod 0600 RESETAUX.S || echo "restore of RESETAUX.S fails"
sed 's/^X//' << 'SHAR_EOF' > RMBBLK1.ICN &&
X/* GEM Icon Definition: */
X#define rmbblk1_W 0x0010
X#define rmbblk1_H 0x0028
X#define rmbblk1SIZE 0x0028
Xshort rmbblk1[rmbblk1SIZE] =
X{ 0x000A, 0x0003, 0x0001, 0x0000,
X 0x0001, 0xFFFF, 0x8037, 0xB82F,
X 0xB801, 0xB82F, 0xB837, 0x803F,
X 0xBFA0, 0xBFA0, 0xBFA0, 0xBBA0,
X 0xB1A0, 0xAAA0, 0xBFA0, 0x8020,
X 0xFFE0, 0x0000, 0x7FC8, 0x47D0,
X 0x47FE, 0x47D0, 0x47C8, 0x7FC0,
X 0x4040, 0x4040, 0x4040, 0x4440,
X 0x4E40, 0x5540, 0x4040, 0x7FC0,
X 0x0000, 0x0000, 0x0000, 0x0000
X};
SHAR_EOF
chmod 0600 RMBBLK1.ICN || echo "restore of RMBBLK1.ICN fails"
sed 's/^X//' << 'SHAR_EOF' > STARTGEM.S &&
X/
X/ STARTGEM.S 6-MAR-1987 by GHOST-Soft
X/
X/ This program is used to start GEM programs from within the AUTO folder.
X/
X/ The code is probably highly nonportable, as it heavily depends on the
X/ internal organisation of code in TOS/GEM.
X/ As this program works with ROM- as well as all disk-based versions
X/ of German TOS, I'm pretty sure that this program works with foreign
X/ versions of TOS, too.
X/ All addresses given in square brackets apply to the German ROM-TOS.
X/
X/ Assemble with Mark Williams assembler:
X/ as -o startgem.o startgem.s
X/ gemfix startgem.o startgem.prg
X/ strip startgem.prg
X/ _or_
X/ as -o startgem.o startgem.s
X/ ld -o startgem.prg -s startgem.o
X/
X
Xlinef= 0x2c
Xvbllist1= 0x4d2
X
Xgemdos= 1
X cconws= 0x9
X fsetdta= 0x1a
X super= 0x20
X ptermres= 0x31
X fsfirst= 0x4e
Xxbios= 14
X vsync= 0x25
X
X .shri
Xstart:
X lea basepage(pc),a0
X move.l 4(a7),(a0) / get basepage address
X
X pea msg(pc)
X move.w $cconws,-(a7) / print line
X trap $gemdos
X addq.w $6,a7
X
X moveq $70,d2 / wait 1 second = 71 vblanks
X1: move.w $vsync,-(a7) / wait for vertical blank
X trap $xbios
X addq.w $2,a7
X dbra d2,1b
X
X clr.l -(a7)
X move.w $super,-(a7) / enter super mode
X trap $gemdos
X addq.w $6,a7 / keep old super sp in d0
X
X moveq $-1,d2
X move.l d2,linef / set line-f emulator trap
X lea vblank(pc),a2
X move.l a2,vbllist1 / set vblank vector #1 {0..7}
X
X move.l d0,-(a7)
X move.w $super,-(a7) / exit super mode
X trap $gemdos
X addq.w $6,a7
X
X lea basepage(pc),a0 / compute number of bytes to keep
X suba.l basepage(pc),a0
X clr.w -(a7) / 0 = no error
X move.l a0,-(a7)
X move.w $ptermres,-(a7) / terminate and stay resident
X trap $gemdos / this call never returns
X
Xvblank:
X moveq $-1,d0
X cmp.l linef,d0
X beq.s 1f
X clr.l vbllist1 / clear vblank vector #1
X movea.l linef,a0
X lea old_lf(pc),a1
X move.l a0,(a1) / save old line-f vector (usually in low RAM)
X lea new_lf(pc),a1
X move.l a1,linef / install new one
X
X / find the address of the buffer that GEM uses for the
X / name of the program that it is going to execute
X movea.l 0x16(a0),a0 / get start of line-f table from instruction
X / [a0 = fee8bc] move.l $0xfee8bc,a0
X movea.l 0x7c8(a0),a0 / get address of routine 'f7c8' from table
X / [a0 = fd8fc4]
X movea.l 0xa(a0),a2 / get address from instruction
X / [a2 = 73e4] move.l $0x73e4,a5
X adda.w 0x10(a0),a2 / add offset 0x1f56 from instruction
X / [a2 = 933a] lea 0x1f56,a0
X lea pointer(pc),a1
X move.l a2,(a1) / save buffer address
X1: rts
X
Xnew_lf:
X movea.l 2(a7),a0 / get addr. of instr. that caused exception
X cmpi.w $0xf08c,(a0) / 'f08c' is the line-f instr. we're looking for
X bne.w exit
X move.l old_lf(pc),linef / restore old line-f vector
X
X movea.l pointer(pc),a0
X lea filename(pc),a1
X1: move.b (a1)+,(a0)+ / copy filename into GEM buffer space
X bne.s 1b
X
X pea dta
X move.w $fsetdta,-(a7) / set DTA
X trap $gemdos
X addq.l $6,a7
X move.w $0x27,-(a7) / don't look at volumes and directories
X pea filename(pc)
X move.w $fsfirst,-(a7) / search first
X trap $gemdos
X addq.l $8,a7
X tst d0 / status != 0 indicates error
X bne.s exit
X
X movea.l 2(a7),a0 / get addr. of instr. that caused exception
X / [a0 = fed188]
X2: cmpi.w $0xf4b8,(a0) / look for line-f instruction 'f4b8'
X beq.s doload
X addq.l $2,a0
X cmpa.l $0xfefffe,a0 / test for ROM end
X beq.s exit
X cmpa.l $0x078000,a0 / test for RAM end (on 512K machine)
X bne.s 2b / {RAM-TOS usually loads much lower}
X
Xexit:
X movea.l old_lf(pc),a0 / resume execution of regular line-f handler
X jmp (a0)
X
Xdoload:
X / [a0 = fe1de2]
X move.w (a7)+,d2 / pop status word
X addq.w $4,a7 / destroy addr. of instr. 'f08c'
X move.w d2,sr / restore status register
X adda.w $56,a7 / destroy parameters of instr. 'f08c'
X jmp (a0) / jump to instruction 'f4b8'
X
X .prvd
Xdta:
X .blkb 44
Xold_lf:
X .blkl 1
Xpointer:
X .blkl 1
X
Xmsg:
X .ascii "\033\105Autostart of "
Xfilename:
X .ascii "a:\\bin\\UW.PRG"
Xnulls:
X .blkb 20 / these nulls allow easy patching of code file
X
X .even
Xbasepage:
X .ascii "EOPA" / magic number indicates End Of Patch Area
SHAR_EOF
chmod 0600 STARTGEM.S || echo "restore of STARTGEM.S fails"
sed 's/^X//' << 'SHAR_EOF' > UW.H &&
X/*
X * uw command bytes
X *
X * Copyright 1985 by John D. Bruner. All rights reserved. Permission to
X * copy this program is given provided that the copy is not sold and that
X * this copyright notice is included.
X *
X *
X * Two types of information are exchanged through the 7-bit serial line:
X * ordinary data and command bytes. Command bytes are preceeded by
X * an IAC byte. IAC bytes and literal XON/XOFF characters (those which
X * are not used for flow control) are sent by a CB_FN_CTLCH command.
X * Characters with the eighth bit set (the "meta" bit) are prefixed with
X * a CB_FN_META function.
X *
X * The next most-significant bit in the byte specifies the sender and
X * recipient of the command. If this bit is clear (0), the command byte
X * was sent from the host computer to the Macintosh; if it is set (1)
X * the command byte was sent from the Macintosh to the host computer.
X * This prevents confusion in the event that the host computer
X * (incorrectly) echos a command back to the Macintosh.
X *
X * The remaining six bits are partitioned into two fields. The low-order
X * three bits specify a window number from 1-7 (window 0 is reserved for
X * other uses) or another type of command-dependent parameter. The next
X * three bits specify the operation to be performed by the recipient of
X * the command byte.
X *
X * Note that the choice of command bytes prevents the ASCII XON (021) and
X * XOFF (023) characters from being sent as commands. CB_FN_ISELW commands
X * are only sent by the Macintosh (and thus are tagged with the CB_DIR_MTOH
X * bit). Since XON and XOFF data characters are handled via CB_FN_CTLCH,
X * this allows them to be used for flow control purposes.
X */
X
X#define IAC 0001 /* interpret as command */
X#define CB_DIR 0100 /* command direction: */
X#define CB_DIR_HTOM 0000 /* from host to Mac */
X#define CB_DIR_MTOH 0100 /* from Mac to host */
X#define CB_FN 0070 /* function code: */
X#define CB_FN_NEWW 0000 /* new window */
X#define CB_FN_KILLW 0010 /* kill (delete) window */
X#define CB_FN_ISELW 0020 /* select window for input */
X#define CB_FN_OSELW 0030 /* select window for output */
X#define CB_FN_META 0050 /* add meta to next data char */
X#define CB_FN_CTLCH 0060 /* low 3 bits specify char */
X#define CB_FN_MAINT 0070 /* maintenance functions */
X#define CB_WINDOW 0007 /* window number mask */
X#define CB_CC 0007 /* control character specifier: */
X#define CB_CC_IAC 1 /* IAC */
X#define CB_CC_ON 2 /* XON */
X#define CB_CC_OFF 3 /* XOFF */
X#define CB_MF 0007 /* maintenance functions: */
X#define CB_MF_ENTRY 0 /* beginning execution */
X#define CB_MF_EXIT 7 /* execution terminating */
X#define NWINDOW 7 /* maximum number of windows */
X
X/* CB_CC_XON and CB_CC_XOFF give the same name on the DR C compiler.
X * Changed them to CB_CC_ON and CB_CC_OFF
X * hmm@unido
X */
SHAR_EOF
chmod 0600 UW.H || echo "restore of UW.H fails"
sed 's/^X//' << 'SHAR_EOF' > VERSION &&
XUW Version 2.1.2 24 Jan 1989
SHAR_EOF
chmod 0655 VERSION || echo "restore of VERSION fails"
sed 's/^X//' << 'SHAR_EOF' > WIN-.CNF &&
Xaudibell=1
Xvisibell=1
Xtopbell=0
Xfast
Xnooverstrike
Xnosliders
Xtitles
Xbufsiz=256
Xcmdpath=E:\BIN\*.*
Xcmdname=MSH.PRG
Xcmdargs=c:\src\uw\profile
Xfont=3
Xf1=at^m
Xf2=atdt5559100,,,,410,,^m
Xf3=atdt5551205^m
Xf4=atdt5551102^m
Xf5=ata^m
Xf6=ATDT5551272^m
Xf7=^A6^M
Xf8=^A7^M
Xf9=^A8^M
Xf10=ati4^m
Xf11=^A10^M
Xf12=^A11^M
Xf13=^A12^M
Xf14=^A13^M
Xf15=^A14^M
Xf16=^A15^M
Xf17=^A16^M
Xf18=^A17^M
Xf19=^A18^M
Xf20=^A19^M
Xf21=^A20^M
Xf22=^A21^M
Xf23=^A22^M
Xf24=^A23^M
Xf25=^A24^M
Xf26=^A25^M
Xf27=^A26^M
Xf28=^A27^M
Xf29=^A28^M
Xf30=^A29^M
Xf31=^A30^M
Xf32=^A31^M
Xf33=^A32^M
Xf34=^A33^M
Xf35=^A34^M
Xf36=^A35^M
Xf37=^A36^M
Xf38=^A37^M
Xf39=^A38^M
Xf40=^A39^M
SHAR_EOF
chmod 0655 WIN-.CNF || echo "restore of WIN-.CNF fails"
sed 's/^X//' << 'SHAR_EOF' > WIN.CNF &&
Xaudibell=1
Xvisibell=1
Xtopbell=0
Xfast
Xnooverstrike
Xnosliders
Xnotitles
Xbufsiz=256
Xcmdpath=E:\BIN\*.*
Xcmdname=MSH.PRG
Xcmdargs=c:\src\uw\profile
Xfont=2
Xf1=atx6d5559100,,,,,410,,,^M
Xf2=atx6d5559100,,,,,420,,,^M
Xf3=atx6d18005559848^M
Xf4=^A3^M
Xf5=atx6d14155554619^M
Xf6=atx6d14155556755^M
Xf7=atx6d14155554127^M
Xf8=atdt*70;^M
Xf9=^A8^M
Xf10=adm31^M
Xf11=^A10^M
Xf12=^A11^M
Xf13=^A12^M
Xf14=^A13^M
Xf15=^A14^M
Xf16=^A15^M
Xf17=^A16^M
Xf18=^A17^M
Xf19=^A18^M
Xf20=^A19^M
Xf21=^A20^M
Xf22=^A21^M
Xf23=^A22^M
Xf24=^A23^M
Xf25=^A24^M
Xf26=^A25^M
Xf27=^A26^M
Xf28=^A27^M
Xf29=^A28^M
Xf30=^A29^M
Xf31=^A30^M
Xf32=^A31^M
Xf33=^A32^M
Xf34=^A33^M
Xf35=^A34^M
Xf36=^A35^M
Xf37=^A36^M
Xf38=^A37^M
Xf39=^A38^M
Xf40=^A39^M
SHAR_EOF
chmod 0655 WIN.CNF || echo "restore of WIN.CNF fails"
sed 's/^X//' << 'SHAR_EOF' > WIND.H &&
X#define MENUBAR 0 /* TREE */
X#define ABOUT 1 /* TREE */
X#define NEWNAME 2 /* TREE */
X#define DABOUT 12 /* OBJECT in TREE #0 */
X#define FQUITUW 21 /* OBJECT in TREE #0 */
X#define FQUIT 26 /* OBJECT in TREE #0 */
X#define MFAST 33 /* OBJECT in TREE #0 */
X#define WRENAME 47 /* OBJECT in TREE #0 */
X#define FNTOWN 69 /* OBJECT in TREE #0 */
X#define FNTSYS 68 /* OBJECT in TREE #0 */
X#define BUTTON 5 /* OBJECT in TREE #1 */
X#define FLD1 1 /* OBJECT in TREE #2 */
X#define OKRENAME 3 /* OBJECT in TREE #2 */
X#define FNTALT 70 /* OBJECT in TREE #0 */
X#define DESK 3 /* OBJECT in TREE #0 */
X#define PRTBOTOM 74 /* OBJECT in TREE #0 */
X#define PRTSTOP 77 /* OBJECT in TREE #0 */
X#define FUNCTKEY 36 /* OBJECT in TREE #0 */
X#define PRTTOP 75 /* OBJECT in TREE #0 */
X#define RESETAUX 43 /* OBJECT in TREE #0 */
X#define AUDIBELL 37 /* OBJECT in TREE #0 */
X#define VISIBELL 38 /* OBJECT in TREE #0 */
X#define TOPONBEL 39 /* OBJECT in TREE #0 */
X#define ASSRD 40 /* OBJECT in TREE #0 */
X#define RESRD 41 /* OBJECT in TREE #0 */
X#define PRTWIND 76 /* OBJECT in TREE #0 */
X#define FUNCTEDT 3 /* TREE */
X#define FUNCEXIT 7 /* OBJECT in TREE #3 */
X#define FUNCSHOW 6 /* OBJECT in TREE #3 */
X#define FUNCPREV 5 /* OBJECT in TREE #3 */
X#define FUNCNEXT 4 /* OBJECT in TREE #3 */
X#define FUNCNAME 10 /* OBJECT in TREE #3 */
X#define FUNCBODY 12 /* OBJECT in TREE #3 */
X#define FUNCENT 16 /* OBJECT in TREE #3 */
X#define LOADCONF 23 /* OBJECT in TREE #0 */
X#define SAVECONF 24 /* OBJECT in TREE #0 */
X#define WINDSIZE 4 /* TREE */
X#define WINDROWS 7 /* OBJECT in TREE #4 */
X#define WINDCOLS 8 /* OBJECT in TREE #4 */
X#define WINDCANC 5 /* OBJECT in TREE #4 */
X#define WINDOK 6 /* OBJECT in TREE #4 */
X#define SHRNKWIN 48 /* OBJECT in TREE #0 */
X#define BOTTOMTO 50 /* OBJECT in TREE #0 */
X#define INPUTWIN 54 /* OBJECT in TREE #0 */
X#define HIDEWIN 49 /* OBJECT in TREE #0 */
X#define WINSTYLE 34 /* OBJECT in TREE #0 */
X#define MOREINF1 6 /* OBJECT in TREE #1 */
X#define INFO1 5 /* TREE */
X#define CONT1 4 /* OBJECT in TREE #5 */
X#define INFO2 6 /* TREE */
X#define CONT2 8 /* OBJECT in TREE #6 */
X#define INFO3 7 /* TREE */
X#define INFO4 8 /* TREE */
X#define INFO5 9 /* TREE */
X#define CONT3 2 /* OBJECT in TREE #7 */
X#define CONT4 2 /* OBJECT in TREE #8 */
X#define CONT5 2 /* OBJECT in TREE #9 */
X#define FNTBIG 67 /* OBJECT in TREE #0 */
X#define FNTTINY 71 /* OBJECT in TREE #0 */
X#define FNTUNKNW 72 /* OBJECT in TREE #0 */
X#define OSIZEWIN 51 /* OBJECT in TREE #0 */
X#define MOVEWIN 52 /* OBJECT in TREE #0 */
X#define CLOSEWIN 53 /* OBJECT in TREE #0 */
X#define WINTITLE 35 /* OBJECT in TREE #0 */
X#define PASTE 55 /* OBJECT in TREE #0 */
X#define CAPTURE 25 /* OBJECT in TREE #0 */
X#define RSCONF 10 /* TREE */
X#define BB1920 7 /* OBJECT in TREE #10 */
X#define BB960 8 /* OBJECT in TREE #10 */
X#define BB480 9 /* OBJECT in TREE #10 */
X#define BB360 10 /* OBJECT in TREE #10 */
X#define BB240 11 /* OBJECT in TREE #10 */
X#define BB200 12 /* OBJECT in TREE #10 */
X#define BB180 13 /* OBJECT in TREE #10 */
X#define BB120 14 /* OBJECT in TREE #10 */
X#define BB60 15 /* OBJECT in TREE #10 */
X#define BB30 16 /* OBJECT in TREE #10 */
X#define BB20 17 /* OBJECT in TREE #10 */
X#define BB15 18 /* OBJECT in TREE #10 */
X#define BB13 19 /* OBJECT in TREE #10 */
X#define BB11 20 /* OBJECT in TREE #10 */
X#define BB7 21 /* OBJECT in TREE #10 */
X#define BB5 22 /* OBJECT in TREE #10 */
X#define BCB5 24 /* OBJECT in TREE #10 */
X#define BCB6 25 /* OBJECT in TREE #10 */
X#define BCB7 26 /* OBJECT in TREE #10 */
X#define BCB8 27 /* OBJECT in TREE #10 */
X#define PBNONE 30 /* OBJECT in TREE #10 */
X#define PBEVEN 31 /* OBJECT in TREE #10 */
X#define PBODD 32 /* OBJECT in TREE #10 */
X#define FCBNONE 40 /* OBJECT in TREE #10 */
X#define FCBXON 41 /* OBJECT in TREE #10 */
X#define FCBRTS 42 /* OBJECT in TREE #10 */
X#define RCCAN 1 /* OBJECT in TREE #10 */
X#define RCOK 2 /* OBJECT in TREE #10 */
X#define SBB1 36 /* OBJECT in TREE #10 */
X#define SBB15 37 /* OBJECT in TREE #10 */
X#define SBB2 38 /* OBJECT in TREE #10 */
X#define SETCONF 42 /* OBJECT in TREE #0 */
X#define BUFSIZ1 44 /* OBJECT in TREE #10 */
X#define BUFSIZ2 45 /* OBJECT in TREE #10 */
X#define BUFSIZ32 46 /* OBJECT in TREE #10 */
X#define LOCKINFO 11 /* TREE */
X#define FLOCKKEY 27 /* OBJECT in TREE #0 */
X#define COMMAND 28 /* OBJECT in TREE #0 */
X#define SETPATH 29 /* OBJECT in TREE #0 */
X#define PARAM 12 /* TREE */
X#define PARAMSTR 3 /* OBJECT in TREE #12 */
X#define OKEXEC 1 /* OBJECT in TREE #12 */
X#define KERMIT 30 /* OBJECT in TREE #0 */
X#define KERMPARM 13 /* TREE */
X#define DEBUGENA 10 /* OBJECT in TREE #13 */
X#define DEBUG1 11 /* OBJECT in TREE #13 */
X#define DEBUG2 13 /* OBJECT in TREE #13 */
X#define DEBUG3 12 /* OBJECT in TREE #13 */
X#define IMAGEMOD 7 /* OBJECT in TREE #13 */
X#define ASCIIMOD 8 /* OBJECT in TREE #13 */
X#define CONVNAME 9 /* OBJECT in TREE #13 */
X#define SENDFILE 2 /* OBJECT in TREE #13 */
X#define RECFILE 3 /* OBJECT in TREE #13 */
X#define KERMEXIT 4 /* OBJECT in TREE #13 */
X#define REMSHELL 59 /* OBJECT in TREE #0 */
X#define SHELL32 60 /* OBJECT in TREE #0 */
X#define SHELL24 61 /* OBJECT in TREE #0 */
X#define SHELL12 62 /* OBJECT in TREE #0 */
X#define SHELL8 63 /* OBJECT in TREE #0 */
X#define SHELLOTH 64 /* OBJECT in TREE #0 */
X#define WINRESIZ 57 /* OBJECT in TREE #0 */
X#define WINCLEAR 56 /* OBJECT in TREE #0 */
X#define LOCCOPY 65 /* OBJECT in TREE #0 */
X#define OVERSTRI 45 /* OBJECT in TREE #0 */
X#define MFREE 31 /* OBJECT in TREE #0 */
SHAR_EOF
chmod 0600 WIND.H || echo "restore of WIND.H fails"
sed 's/^X//' << 'SHAR_EOF' > WINDEFS.H &&
X/* header file with various definitions
X */
X
X/* this one should really be in stdio.h ...
X */
X
X#ifndef NULL
X#define NULL ((char *) 0)
X#endif
X
X#define TRUE 1
X#define FALSE 0
X
X/* constants
X */
X
X#define ALTINDICATOR '\05'
X#define MAXFUNCLEN 41 /* Maximum length of function key string */
X#define BREAK_TICKS 20 /* length of break in clock() ticks (5ms * 20 = .1s) */
X#define MAXSCROLLED 8
X#define MAX_WIND 8
X#define NFSTRINGS 42 /* number of function keys */
X#define WI_WITHSLD (SIZER|UPARROW|DNARROW|VSLIDE|LFARROW|RTARROW|HSLIDE)
X#define WI_NOSLD (NAME|MOVER|CLOSER|FULLER)
X
X
X#define WI_ROWS 80
X#define WI_LINES 24
X#define WI_WCHAR 8
X#define WI_HCHAR 16
X#define WI_WPIX (WI_ROWS*WI_WCHAR+16)
X#define WI_WWORDS ((WI_WPIX+15)/16)
X#define WI_HPIX (WI_LINES*WI_HCHAR)
X#define WI_SIZE ((long)WI_WWORDS*WI_HPIX*2)
X#define XON '\021'
X#define XOFF '\023'
X
X#define xmitcmd(x) { Bconout(1, IAC); Bconout(1, CB_DIR_MTOH|x); }
X
X#define MINMAX(x, y, z) ( x<y ? y : (x>z ? z :x) )
X
X#define HASHBITS 9 /* number of bits of hash for character lookup*/
X
X#define FM_INVERT 12 /* logic parameter to copy_fm */
X#define FM_COPY 3 /* copy source to dest */
X
X#define X0 1
X#define Y0 1
X
X/* emulation FSM states
X */
X
X#define S_NORMAL 0
X#define S_ESC 1
X#define S_ESC1 2
X#define S_ESC2 3
X#define S_ESC3 4
X#define S_STATUS 5
X#define S_ESCA 6
X
X#define min(a,b) ( a < b ? a : b )
X#define max(a,b) ( a > b ? a : b )
X/* data types used
X */
X
Xtypedef struct mfdb {
X short *ptr; /* ptr to memory holding the image */
X short wpix; /* width in pixels */
X short hpix; /* height in pixels */
X short wwords; /* width in words */
X short format; /* 0 for machine-dependent */
X short planes; /* 1 for hires screen */
X} MFDB;
X
Xtypedef struct {
X unsigned char h_t[1<<HASHBITS]; /* hash table */
X struct {
X char h_try; /* try this character next */
X char h_next; /* index of next entry in table */
X } h_colision[128]; /* colision lists formed here */
X} HTBL;
X
Xtypedef struct fnt {
X int inc_x, inc_y; /* real size of one char */
X int def_win_x, def_win_y; /* default window size in chars for this font */
X HTBL f_hash; /* hash table for this font */
X char f_data[2048]; /* character data */
SHAR_EOF
echo "End of part 2, continue with part 3"
echo "3" > s2_seq_.tmp
exit 0