STDWIN 0.9.5, Part 18/19
Guido van Rossum
guido at cwi.nl
Mon Mar 4 21:58:36 AEST 1991
Archive-name: stdwin/part18
#! /bin/sh
# This is a shell archive. Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file". To overwrite existing
# files, type "sh file -c". You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g.. If this archive is complete, you
# will see the following message at the end:
# "End of archive 18 (of 19)."
# Contents: Appls/dpv/dpvoutput.h Appls/dpv/r3symbol
# Appls/test/hello.c Appls/test/kuifje Appls/test/test4.c
# Appls/test/test5.c Appls/test/testlocalmenus.c
# Appls/test/testpollevent.c Appls/test/thand.c Appls/test/vtdemo.c
# Conf/proto.arch.68000 Conf/proto.arch.xxx Conf/proto.os.sony
# Conf/proto.os.sysv Conf/proto.os.xxx Conf/proto.port.xxx
# Doc/macros.ms Gen/waskfile.c H/_ARGS.h H/editwin.h H/vtrm.h
# Packs/textedit/wprintf.c Packs/vt/vtimpl.h Packs/vt/vtputs.c
# Ports/alfa/measure.c Ports/alfa/scroll.c Ports/mac/argcargv.c
# Ports/mac/fullpath.c Ports/mac_mpw/Makefile
# Ports/mac_mpw/intercept.h Ports/vtrm/vtrm.h Ports/x11/caret.c
# Ports/x11/cutbuffer.c Ports/x11/llevent.h Tools/strdup.c
# Wrapped by guido at voorn.cwi.nl on Mon Mar 4 12:37:36 1991
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'Appls/dpv/dpvoutput.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'Appls/dpv/dpvoutput.h'\"
else
echo shar: Extracting \"'Appls/dpv/dpvoutput.h'\" \(1076 characters\)
sed "s/^X//" >'Appls/dpv/dpvoutput.h' <<'END_OF_FILE'
X/* dpv -- ditroff previewer. Definitions for output. */
X
Xextern char *devname; /* Device for which output is prepared */
X
Xextern WINDOW *win; /* output window */
X
Xextern int showpage; /* internal page to show in window */
X /* defined in dpvcontrol.c */
Xextern int prevpage; /* previous page shown (for '-' command) */
X
Xextern long hscale, hdiv; /* Horizontal scaling factors */
Xextern long vscale, vdiv; /* Vertical scaling factors */
X
X/* Scaling method */
X#define HWIN(h) ((int)(((h)*hscale+hdiv/2)/hdiv))
X#define VWIN(v) ((int)(((v)*vscale+vdiv/2)/vdiv))
X#define HWINDOW HWIN(hpos)
X#define VWINDOW VWIN(vpos)
X
X/* Variables used by put1 macro below, and by recheck function */
X
Xextern int doit; /* nonzero if output makes sense */
Xextern int vwindow; /* precomputed vpos*vscale/vdiv - baseline */
Xextern int baseline; /* wbaseline() of current font */
Xextern int lineheight; /* wlineheight() of current font */
Xextern int topdraw, botdraw; /* window area to draw */
X
X/* Macro to output one character */
X
X#define put1(c) if (!doit) ; else wdrawchar(HWINDOW, vwindow, c)
END_OF_FILE
if test 1076 -ne `wc -c <'Appls/dpv/dpvoutput.h'`; then
echo shar: \"'Appls/dpv/dpvoutput.h'\" unpacked with wrong size!
fi
# end of 'Appls/dpv/dpvoutput.h'
fi
if test -f 'Appls/dpv/r3symbol' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'Appls/dpv/r3symbol'\"
else
echo shar: Extracting \"'Appls/dpv/r3symbol'\" \(1261 characters\)
sed "s/^X//" >'Appls/dpv/r3symbol' <<'END_OF_FILE'
XoA - 0x22
XoE - 0x24
Xcn - 0x27
X** - 0x2A
Xpl - 0x2B
Xmi - 0x2D
Xsl - 0x2F
Xeq - 0x3D
X=~ - 0x40
X*A - 0x41
X*B - 0x42
X*X - 0x43
X*D - 0x44
X*E - 0x45
X*F - 0x46
X*G - 0x47
X*Y - 0x48
X*I - 0x49
X*K - 0x4B
X*L - 0x4C
X*M - 0x4D
X*N - 0x4E
X*O - 0x4F
X*P - 0x50
X*H - 0x51
X*R - 0x52
X*S - 0x53
X*T - 0x54
X*U - 0x55
Xts - 0x56
X*W - 0x57
X*C - 0x58
X*Q - 0x59
X*Z - 0x5A
Xul - 0x5F
Xrn - 0x60
X*a - 0x61
X*b - 0x62
X*x - 0x63
X*d - 0x64
X*e - 0x65
X*f - 0x66
X*g - 0x67
X*y - 0x68
X*i - 0x69
X*f - 0x6A
X*k - 0x6B
X*l - 0x6C
X*m - 0x6D
X*n - 0x6E
X*o - 0x6F
X*p - 0x70
X*h - 0x71
X*r - 0x72
X*s - 0x73
X*t - 0x74
X*u - 0x75
X*w - 0x77
X*c - 0x78
X*q - 0x79
X*z - 0x7A
Xor - 0x7C
Xap - 0x7E
X
Xfm - 0xa2
X<= - 0xa3
Xsl - 0xa4
Xif - 0xa5
X$D - 0xa6
Xbs - 0xa9
Xlr - 0xaB
X<- - 0xaC
Xua - 0xaD
X-> - 0xaE
Xda - 0xaF
Xde - 0xb0
X+- - 0xb1
X>= - 0xb3
Xmu - 0xb4
Xpt - 0xb5
Xpd - 0xb6
Xbu - 0xb7
Xdi - 0xb8
X!= - 0xb9
X== - 0xbA
X~= - 0xbB
Xbr - 0xbD
XAh - 0xc0
Xc* - 0xc4
Xc+ - 0xc5
Xes - 0xc6
Xca - 0xc7
Xcu - 0xc8
Xsp - 0xc9
Xip - 0xcA
Xsb - 0xcC
Xib - 0xcD
Xmo - 0xcE
Xnm - 0xcF
Xan - 0xd0
Xgr - 0xd1
Xrg - 0xd2
Xco - 0xd3
Xsr - 0xd6
Xno - 0xd8
XAN - 0xd9
XOR - 0xdA
X<> - 0xdB
XDl - 0xdC
XDu - 0xdD
XDr - 0xdE
XDd - 0xdF
Xfo - 0xe1
Xlc - 0xe9
Xlf - 0xeB
Xlt - 0xeC
Xlk - 0xeD
Xlb - 0xeE
Xbv - 0xeF
Xbs - 0xf0
Xfc - 0xf1
Xis - 0xf2
Xrc - 0xf9
Xrf - 0xfB
Xrt - 0xfC
Xrk - 0xfD
Xrb - 0xfE
END_OF_FILE
if test 1261 -ne `wc -c <'Appls/dpv/r3symbol'`; then
echo shar: \"'Appls/dpv/r3symbol'\" unpacked with wrong size!
fi
# end of 'Appls/dpv/r3symbol'
fi
if test -f 'Appls/test/hello.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'Appls/test/hello.c'\"
else
echo shar: Extracting \"'Appls/test/hello.c'\" \(989 characters\)
sed "s/^X//" >'Appls/test/hello.c' <<'END_OF_FILE'
X/* The "Hello, world" koan according to David Rosenthal,
X recoded for STDWIN.
X Requirements: print "Hello, world" centered in a window,
X recented after window resizes, redraw after window exposures.
X Check error returns. */
X
X#include "stdwin.h"
X
Xchar *string= "Hello, world";
X
Xint text_h, text_v;
X
Xplacetext(win)
X WINDOW *win;
X{
X int width, height;
X wgetwinsize(win, &width, &height);
X text_v= (height - wlineheight()) / 2;
X text_h= (width - wtextwidth(string, -1)) / 2;
X}
X
Xdrawproc(win, left, top, right, bottom)
X WINDOW *win;
X{
X wdrawtext(text_h, text_v, string, -1);
X}
X
Xmain(argc, argv)
X int argc;
X char **argv;
X{
X WINDOW *win;
X winitargs(&argc, &argv);
X win= wopen("Hello", drawproc);
X
X if (win != 0) {
X placetext(win);
X for (;;) {
X EVENT e;
X wgetevent(&e);
X if (e.type == WE_CLOSE ||
X e.type == WE_COMMAND &&
X (e.u.command == WC_CLOSE ||
X e.u.command == WC_CANCEL))
X break;
X if (e.type == WE_SIZE)
X placetext(win);
X }
X }
X
X wdone();
X exit(0);
X}
END_OF_FILE
if test 989 -ne `wc -c <'Appls/test/hello.c'`; then
echo shar: \"'Appls/test/hello.c'\" unpacked with wrong size!
fi
# end of 'Appls/test/hello.c'
fi
if test -f 'Appls/test/kuifje' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'Appls/test/kuifje'\"
else
echo shar: Extracting \"'Appls/test/kuifje'\" \(1056 characters\)
sed "s/^X//" >'Appls/test/kuifje' <<'END_OF_FILE'
X0x0000,0x0920,0x0000,
X0x0000,0x0920,0x0000,
X0x0000,0x0930,0x0000,
X0x0000,0x0D90,0x0000,
X0x0000,0x0490,0x0000,
X0x0000,0x0490,0x0000,
X0x0000,0x05B0,0x0000,
X0x0000,0x0D20,0x0000,
X0x0000,0x0920,0x0000,
X0x0000,0x393C,0x0000,
X0x0000,0xE006,0x0000,
X0x0001,0x884B,0x0000,
X0x0003,0x4851,0x8000,
X0x0006,0x2000,0xC000,
X0x0004,0x0C6C,0x6000,
X0x000C,0x6C60,0x2000,
X0x0008,0x0000,0x3000,
X0x0008,0x0000,0x1000,
X0x0008,0x007F,0x1000,
X0x0008,0x0005,0x9000,
X0x000C,0x00FF,0x1000,
X0x0006,0x0000,0x1000,
X0x0032,0x07F0,0x3000,
X0x0193,0x03E0,0x2400,
X0x00D9,0x01C0,0x6480,
X0x0049,0x8080,0xC500,
X0x006C,0xC001,0x8000,
X0x0026,0x6003,0x06C0,
X0x0033,0x3FFF,0xFE00,
X0x0019,0x0000,0x0400,
X0x000D,0x3000,0x0400,
X0x0004,0x3000,0x0400,
X0x0004,0x0000,0x0400,
X0x0000,0x0000,0x0C00,
X0x0000,0x0000,0x0800,
X0x0000,0x0000,0x1800,
X0x0000,0x0000,0x7000,
X0x0000,0x0007,0xC000,
X0x0000,0x00FC,0x0000,
X0x0000,0x0380,0x0000,
X0x0000,0x0600,0x0000,
X0x0000,0x0400,0x0000,
X0x0000,0x0400,0x0000,
X0x0000,0x0C00,0x0000,
X0x0000,0x0800,0x0000,
X0x0000,0x0800,0x0000,
X0x0000,0x0800,0x0000,
X0x0000,0x0800,0x0000,
END_OF_FILE
if test 1056 -ne `wc -c <'Appls/test/kuifje'`; then
echo shar: \"'Appls/test/kuifje'\" unpacked with wrong size!
fi
# end of 'Appls/test/kuifje'
fi
if test -f 'Appls/test/test4.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'Appls/test/test4.c'\"
else
echo shar: Extracting \"'Appls/test/test4.c'\" \(1097 characters\)
sed "s/^X//" >'Appls/test/test4.c' <<'END_OF_FILE'
X/* Menu test - a text-edit window */
X
X#include "stdwin.h"
X
XTEXTEDIT *tb;
X
Xvoid
Xdrawproc(win, l, t, r, b)
X WINDOW *win;
X{
X tedraw(tb);
X}
X
Xmain(argc, argv)
X int argc;
X char **argv;
X{
X WINDOW *win;
X MENU *mp;
X int width, height;
X int stop= 0;
X
X winitargs(&argc, &argv);
X if (argc >= 3) {
X int h= atoi(argv[1]), v= atoi(argv[2]);
X wsetdefwinpos(h, v);
X }
X
X mp= wmenucreate(1, "File");
X wmenuadditem(mp, "Quit", 'Q');
X
X win= wopen("Menu+textedit", drawproc);
X wgetwinsize(win, &width, &height);
X wsetdocsize(win, width, height);
X
X tb= tealloc(win, 0, 0, width);
X tereplace(tb, "Hello, world\n--Guido van Rossum");
X
X do {
X EVENT e;
X wgetevent(&e);
X if (teevent(tb, &e)) {
X wsetdocsize(win, width, height= tegetbottom(tb));
X continue;
X }
X switch (e.type) {
X
X case WE_COMMAND:
X if (e.u.command == WC_CLOSE ||
X e.u.command == WC_CANCEL)
X stop= 1;
X break;
X
X case WE_CLOSE:
X stop= 1;
X break;
X
X case WE_MENU:
X if (e.u.m.id == 1 && e.u.m.item == 0)
X stop= 1;
X break;
X
X }
X } while (!stop);
X
X tefree(tb);
X wclose(win);
X wmenudelete(mp);
X wdone();
X
X exit(0);
X}
END_OF_FILE
if test 1097 -ne `wc -c <'Appls/test/test4.c'`; then
echo shar: \"'Appls/test/test4.c'\" unpacked with wrong size!
fi
# end of 'Appls/test/test4.c'
fi
if test -f 'Appls/test/test5.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'Appls/test/test5.c'\"
else
echo shar: Extracting \"'Appls/test/test5.c'\" \(1337 characters\)
sed "s/^X//" >'Appls/test/test5.c' <<'END_OF_FILE'
X/* Debugging test -- print events and details */
X
X#include "stdwin.h"
X
Xvoid
Xdrawproc(win, l, t, r, b)
X WINDOW *win;
X{
X printf("drawproc called\n");
X wdrawtext(0, 0, "Hello, world", -1);
X}
X
Xchar *evname[] = {
X "null",
X "activate",
X "char",
X "command",
X "mouse_down",
X "mouse_move",
X "mouse_up",
X "menu",
X "size",
X "(move)",
X "draw",
X "timer",
X "deactivate",
X 0
X};
X
Xchar *cmname[] = {
X "(null)",
X "close",
X "left",
X "right",
X "up",
X "down",
X "cancel",
X "backspace",
X "tab",
X "return",
X 0
X};
X
Xmain(argc, argv)
X int argc;
X char **argv;
X{
X WINDOW *win;
X winitargs(&argc, &argv);
X win= wopen("Hello test", drawproc);
X for (;;) {
X EVENT e;
X wgetevent(&e);
X switch (e.type) {
X case WE_MOUSE_DOWN:
X case WE_MOUSE_MOVE:
X case WE_MOUSE_UP:
X printf("%s event: b=%d, h=%d, v=%d\n",
X evname[e.type], e.u.where.button,
X e.u.where.h, e.u.where.v);
X break;
X case WE_COMMAND:
X printf("command event (%s)\n", cmname[e.u.command]);
X break;
X case WE_CHAR:
X printf("char event ('%c', 0x%02x)\n",
X e.u.character, e.u.character & 0xff);
X break;
X default:
X printf("%s event\n", evname[e.type]);
X break;
X }
X if (e.type == WE_CHAR && e.u.character == 'q')
X break;
X if (e.type == WE_CLOSE ||
X e.type == WE_COMMAND &&
X (e.u.command == WC_CLOSE || e.u.command == WC_CANCEL))
X break;
X }
X wclose(win);
X wdone();
X exit(0);
X}
END_OF_FILE
if test 1337 -ne `wc -c <'Appls/test/test5.c'`; then
echo shar: \"'Appls/test/test5.c'\" unpacked with wrong size!
fi
# end of 'Appls/test/test5.c'
fi
if test -f 'Appls/test/testlocalmenus.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'Appls/test/testlocalmenus.c'\"
else
echo shar: Extracting \"'Appls/test/testlocalmenus.c'\" \(1002 characters\)
sed "s/^X//" >'Appls/test/testlocalmenus.c' <<'END_OF_FILE'
X#include "stdwin.h"
X
X#include <strings.h>
X
Xmain(argc, argv)
X char **argv;
X{
X winit(&argc, &argv);
X showargs(argc, argv);
X localtest();
X wdone();
X}
X
Xshowargs(argc, argv)
X char **argv;
X{
X char buf[100];
X char *p;
X int i;
X
X sprintf(buf, "argc=%d", argc);
X p = buf;
X for (i = 0; i < argc; ++i) {
X p = strchr(p, '\0');
X sprintf(p, " argv[%d]=\"%s\"", i, argv[i]);
X }
X wmessage(buf);
X}
X
Xlocaltest()
X{
X WINDOW *u, *v, *w;
X MENU *m, *n, *o;
X int wincount = 3;
X
X wmenusetdeflocal(1);
X
X m = wmenucreate(1, "Menu1");
X wmenuadditem(m, "Item1", -1);
X n = wmenucreate(2, "Menu2");
X wmenuadditem(n, "Item2", -1);
X o = wmenucreate(3, "Menu3");
X wmenuadditem(o, "Item3", -1);
X
X u = wopen("Win1", 0L);
X v = wopen("Win2", 0L);
X w = wopen("Win3", 0L);
X
X wmenuattach(u, m);
X wmenuattach(v, n);
X wmenuattach(w, o);
X
X for (;;) {
X EVENT e;
X wgetevent(&e);
X if (e.type == WE_CLOSE ||
X e.type == WE_COMMAND && e.u.command == WC_CLOSE) {
X wclose(e.window);
X --wincount;
X if (wincount == 0)
X break;
X }
X }
X}
END_OF_FILE
if test 1002 -ne `wc -c <'Appls/test/testlocalmenus.c'`; then
echo shar: \"'Appls/test/testlocalmenus.c'\" unpacked with wrong size!
fi
# end of 'Appls/test/testlocalmenus.c'
fi
if test -f 'Appls/test/testpollevent.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'Appls/test/testpollevent.c'\"
else
echo shar: Extracting \"'Appls/test/testpollevent.c'\" \(1208 characters\)
sed "s/^X//" >'Appls/test/testpollevent.c' <<'END_OF_FILE'
X#include <stdio.h>
X#include "stdwin.h"
X
Xvoid drawproc(); /* Forward */
X
XEVENT ev;
X
Xmain(argc, argv)
X int argc;
X char **argv;
X{
X WINDOW *win;
X
X winitargs(&argc, &argv);
X win = wopen("Test poll event", drawproc);
X for (;;) {
X if (wpollevent(&ev)) {
X if (ev.type == WE_CLOSE ||
X ev.type == WE_COMMAND && ev.u.command == WC_CLOSE)
X break;
X wbegindrawing(win);
X werase(0, 0, 1000, 1000);
X drawproc(win, 0, 0, 1000, 1000);
X wenddrawing(win);
X }
X else {
X wbegindrawing(win);
X animate();
X wenddrawing(win);
X }
X }
X wdone();
X exit(0);
X}
X
Xvoid
Xdrawproc(win, left, top, right, bottom)
X WINDOW *win;
X int left, top, right, bottom;
X{
X char buf[100];
X
X switch (ev.type) {
X
X case WE_MOUSE_DOWN:
X case WE_MOUSE_MOVE:
X case WE_MOUSE_UP:
X sprintf(buf,
X "MOUSE EVENT %d, h=%d, v=%d, button=%d, clicks=%d",
X ev.type, ev.u.where.h, ev.u.where.v,
X ev.u.where.button, ev.u.where.clicks);
X break;
X
X case WE_CHAR:
X sprintf(buf, "CHAR '%c' (%d)", ev.u.character, ev.u.character);
X break;
X
X default:
X sprintf(buf, "TYPE %d", ev.type);
X break;
X
X }
X wdrawtext(0, 0, buf, -1);
X}
X
Xanimate()
X{
X static int h;
X int v = 20;
X
X werase(h, v, h+5, v+5);
X h = (h+1) % 400;
X wpaint(h, v, h+5, v+5);
X}
END_OF_FILE
if test 1208 -ne `wc -c <'Appls/test/testpollevent.c'`; then
echo shar: \"'Appls/test/testpollevent.c'\" unpacked with wrong size!
fi
# end of 'Appls/test/testpollevent.c'
fi
if test -f 'Appls/test/thand.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'Appls/test/thand.c'\"
else
echo shar: Extracting \"'Appls/test/thand.c'\" \(1033 characters\)
sed "s/^X//" >'Appls/test/thand.c' <<'END_OF_FILE'
X/* Test wungetevent from signal handler */
X
X#include "stdwin.h"
X#include <signal.h>
X
X#define SPECIAL 1000
X
XTEXTEDIT *tb;
X
Xvoid
Xdrawproc(win, l, t, r, b)
X WINDOW *win;
X{
X tedraw(tb);
X}
X
Xint
Xhandler() {
X EVENT e;
X e.type= WE_COMMAND;
X e.u.command= SPECIAL;
X wungetevent(&e);
X}
X
Xmain(argc, argv)
X int argc;
X char **argv;
X{
X WINDOW *win;
X int width, height;
X
X winit();
X signal(SIGINT, handler);
X if (argc >= 3) {
X int h= atoi(argv[1]), v= atoi(argv[2]);
X wsetdefwinpos(h, v);
X }
X
X win= wopen("Textedit", drawproc);
X wgetwinsize(win, &width, &height);
X wsetdocsize(win, width, height);
X
X tb= tealloc(win, 0, 0, width);
X tereplace(tb, "Hello, world\n--Guido van Rossum");
X
X for (;;) {
X EVENT e;
X wgetevent(&e);
X if (e.type == WE_CLOSE)
X break;
X if (e.type == WE_COMMAND) {
X if (e.u.command == WC_CLOSE ||
X e.u.command == WC_CANCEL)
X break;
X else if (e.u.command == SPECIAL) {
X wmessage("Got event from handler");
X continue;
X }
X }
X (void) teevent(tb, &e);
X }
X tefree(tb);
X wclose(win);
X wdone();
X exit(0);
X}
END_OF_FILE
if test 1033 -ne `wc -c <'Appls/test/thand.c'`; then
echo shar: \"'Appls/test/thand.c'\" unpacked with wrong size!
fi
# end of 'Appls/test/thand.c'
fi
if test -f 'Appls/test/vtdemo.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'Appls/test/vtdemo.c'\"
else
echo shar: Extracting \"'Appls/test/vtdemo.c'\" \(1027 characters\)
sed "s/^X//" >'Appls/test/vtdemo.c' <<'END_OF_FILE'
X#include "stdwin.h"
X#include "vt.h"
X
Xmain() {
X VT *vt;
X winit();
X wsetdefwinsize(80*wcharwidth('0'), 24*wlineheight());
X vt= vtopen("VT", 24, 80, 100); /* Should check outcome */
X vtautosize(vt);
X vtsetnlcr(vt, 1); /* Map LF ro CR LF */
X vtansiputs(vt, "Hello, world\n", -1);
X eventloop();
X wdone();
X exit(0);
X}
X
Xeventloop(vt) VT *vt; {
X for (;;) {
X EVENT e;
X wgetevent(&e);
X switch (e.type) {
X case WE_SIZE:
X vtautosize(vt); /* Should check outcome */
X break;
X case WE_CHAR:
X { char buf[2];
X buf[0]= e.u.character;
X vtansiputs(vt, buf, 1);
X break; }
X case WE_MOUSE_DOWN:
X vtsetcursor(vt,
X e.u.where.v / vtcheight(vt),
X e.u.where.h / vtcwidth(vt));
X break;
X case WE_COMMAND:
X switch (e.u.command) {
X case WC_CLOSE: return;
X case WC_RETURN: vtansiputs(vt, "\n", 1); break;
X case WC_BACKSPACE: vtansiputs(vt, "\b", 1); break;
X case WC_TAB: vtansiputs(vt, "\t", 1); break;
X }
X break;
X case WE_CLOSE:
X return;
X }
X }
X}
END_OF_FILE
if test 1027 -ne `wc -c <'Appls/test/vtdemo.c'`; then
echo shar: \"'Appls/test/vtdemo.c'\" unpacked with wrong size!
fi
# end of 'Appls/test/vtdemo.c'
fi
if test -f 'Conf/proto.arch.68000' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'Conf/proto.arch.68000'\"
else
echo shar: Extracting \"'Conf/proto.arch.68000'\" \(973 characters\)
sed "s/^X//" >'Conf/proto.arch.68000' <<'END_OF_FILE'
X
X#
X# Definitions for 68000 architecture
X#
X
X# Define the name of this architecture here.
X# This is used as a subdirectory name where all the objects for this
X# architecture live: $(TOP)/Build/$(ARCH)
X#
X# Note that there is the silent assumption that there is only one O.S.
X# per architecture. We'll have to invent composite architecture names,
X# or insert an extra level in the build tree, if this becomes false...
X#
XARCH= 68000
X
X# Define the name of the script used to update the dependencies in
X# the Makefile.
X# Choices are:
X# slowmkdep -- always works (as far as I know)
X# fastmkdep -- used cc -M, which isn't always available
X# makedepend -- Todd Brunhoff's superfast tool (comes with X11)
X# (This needs -Dunix because of configure.h)
X# You may also place this definition in the proto.os.* file if you
X# know a method works for every architecture supported by that OS.
X#
X#MKDEP= $(CONF)/slowmkdep
X#MKDEP= $(CONF)/fastmkdep
X#MKDEP= makedepend -Dunix
X
END_OF_FILE
if test 973 -ne `wc -c <'Conf/proto.arch.68000'`; then
echo shar: \"'Conf/proto.arch.68000'\" unpacked with wrong size!
fi
# end of 'Conf/proto.arch.68000'
fi
if test -f 'Conf/proto.arch.xxx' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'Conf/proto.arch.xxx'\"
else
echo shar: Extracting \"'Conf/proto.arch.xxx'\" \(976 characters\)
sed "s/^X//" >'Conf/proto.arch.xxx' <<'END_OF_FILE'
X
X#
X# Definitions pertaining to architecture XXX
X#
X
X# Define the name of this architecture here.
X# This is used as a subdirectory name where all the objects for this
X# architecture live: $(TOP)/Build/$(ARCH)
X#
X# Note that there is the silent assumption that there is only one O.S.
X# per architecture. We'll have to invent composite architecture names,
X# or insert an extra level in the build tree, if this becomes false...
X#
XARCH= XXX
X
X# Define the name of the script used to update the dependencies in
X# the Makefile.
X# Choices are:
X# slowmkdep -- always works (as far as I know)
X# fastmkdep -- used cc -M, which isn't always available
X# makedepend -- Todd Brunhoff's superfast tool (comes with X11)
X# (This needs -Dunix because of configure.h)
X# You may also place this definition in the proto.os.* file if you
X# know a method works for every architecture supported by that OS.
X#
XMKDEP= $(CONF)/slowmkdep
XMKDEP= $(CONF)/fastmkdep
XMKDEP= makedepend -Dunix
X
END_OF_FILE
if test 976 -ne `wc -c <'Conf/proto.arch.xxx'`; then
echo shar: \"'Conf/proto.arch.xxx'\" unpacked with wrong size!
fi
# end of 'Conf/proto.arch.xxx'
fi
if test -f 'Conf/proto.os.sony' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'Conf/proto.os.sony'\"
else
echo shar: Extracting \"'Conf/proto.os.sony'\" \(1049 characters\)
sed "s/^X//" >'Conf/proto.os.sony' <<'END_OF_FILE'
X
X#
X# Definitions for Sony News workstation
X#
X
X# The name of this O.S.
X#
XOS= sony
X
X# Choose ONE of the following definitions of RANLIB.
X# BSD-based systems will need ranlib to be called after a library is
X# changed.
X#
XRANLIB= ranlib # for BSD
X
X# Define the name of the script used to update the dependencies in
X# the Makefile.
X# Choices are:
X# slowmkdep -- always works (as far as I know)
X# fastmkdep -- uses cc -M, which isn't always available
X# makedepend -- Todd Brunhoff's superfast tool (comes with X11)
X# (This needs -Dunix because of configure.h)
X# You may also place this definition in the proto.arch.* file if no
X# method works for every architecture supported by this OS.
X#
X#MKDEP= $(CONF)/slowmkdep
XMKDEP= $(CONF)/fastmkdep
X#MKDEP= makedepend -Dunix
X
X# Define the system libraries to link with programs that use termcap and X11
X# (In some cases these are architecture-dependent)
X#
XLIBTERMCAP= -ltermcap
XLIBX11= -lX11
X
X# Other OS-specific choices (-I flags, -D flags, compiler options)
X#
XOSINCLS=
XOSDEFS=
XOSOPTS=
END_OF_FILE
if test 1049 -ne `wc -c <'Conf/proto.os.sony'`; then
echo shar: \"'Conf/proto.os.sony'\" unpacked with wrong size!
fi
# end of 'Conf/proto.os.sony'
fi
if test -f 'Conf/proto.os.sysv' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'Conf/proto.os.sysv'\"
else
echo shar: Extracting \"'Conf/proto.os.sysv'\" \(756 characters\)
sed "s/^X//" >'Conf/proto.os.sysv' <<'END_OF_FILE'
X
X#
X# Definitions pertaining to (modern versions of) System V
X#
X# Disclaimer: this was only tested on a Silicon Graphics under IRIX 3.2
X#
X
X# The name of this O.S.
X#
XOS= sysv
X
X# SYSV-based systems don't have ranlib; the value 'true' makes Make happy.
X#
XRANLIB= true # for SYSV
X
X# Defines to make various bits of code happy:
X# -DSYSV is the general test for System V.
X# -Datt is used at least by some X internal headers (and what else?)
X# And, of course, index and rindex are called strchr and strrchr.
X#
XOSDEFS= -DSYSV -Datt -Dindex=strchr -Drindex=strrchr
X
X# The mkdep using cc -M will work for any architecture (I hope)
X#
XMKDEP= $(CONF)/fastmkdep
X
X# The system libraries to link with programs that use termcap and X11
X# are in proto.arch.* instead.
X
END_OF_FILE
if test 756 -ne `wc -c <'Conf/proto.os.sysv'`; then
echo shar: \"'Conf/proto.os.sysv'\" unpacked with wrong size!
fi
# end of 'Conf/proto.os.sysv'
fi
if test -f 'Conf/proto.os.xxx' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'Conf/proto.os.xxx'\"
else
echo shar: Extracting \"'Conf/proto.os.xxx'\" \(1170 characters\)
sed "s/^X//" >'Conf/proto.os.xxx' <<'END_OF_FILE'
X
X#
X# Definitions pertaining to operating system XXX
X#
X
X# Define the name of this O.S. here.
X#
XOS= XXX
X
X# Choose ONE of the following definitions of RANLIB.
X# BSD-based systems will need ranlib to be called after a library is
X# changed.
X# SYSV-based systems don't have ranlib; the value 'true' makes Make happy.
X#
XRANLIB= ranlib # for BSD
XRANLIB= true # for SYSV
X
X# Define the name of the script used to update the dependencies in
X# the Makefile.
X# Choices are:
X# slowmkdep -- always works (as far as I know)
X# fastmkdep -- uses cc -M, which isn't always available
X# makedepend -- Todd Brunhoff's superfast tool (comes with X11)
X# (This needs -Dunix because of configure.h)
X# You may also place this definition in the proto.arch.* file if no
X# method works for every architecture supported by this OS.
X#
XMKDEP= $(CONF)/slowmkdep
XMKDEP= $(CONF)/fastmkdep
XMKDEP= makedepend -Dunix
X
X# Define the system libraries to link with programs that use termcap and X11
X# (In some cases these are architecture-dependent)
X#
XLIBTERMCAP= -ltermcap
XLIBX11= -lX11
X
X# Other OS-specific choices (-I flags, -D flags, compiler options)
X#
XOSINCLS=
XOSDEFS=
XOSOPTS=
END_OF_FILE
if test 1170 -ne `wc -c <'Conf/proto.os.xxx'`; then
echo shar: \"'Conf/proto.os.xxx'\" unpacked with wrong size!
fi
# end of 'Conf/proto.os.xxx'
fi
if test -f 'Conf/proto.port.xxx' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'Conf/proto.port.xxx'\"
else
echo shar: Extracting \"'Conf/proto.port.xxx'\" \(1032 characters\)
sed "s/^X//" >'Conf/proto.port.xxx' <<'END_OF_FILE'
X
X#
X# Definitions pertaining to the port to the XXX window system
X#
X
X# NB: You are not expected to port STDWIN -- this has already been done.
X# This prototype file is provided mostly to document the definitions
X# exported from the various proto.port.* files, and as a template for
X# the STDWIN implementer. And, of course, if you really WANT to port
X# stdwin to a new window system or look-and-feel (NeWS, or SunTools, or
X# OpenLook), you're welcome -- just check with the author of STDWIN
X# first to see if somebody else isn't planning to do the same.
X
X# Define the name of this port.
X# This is used as a subdirectory name where all the objects for this
X# port for a given architecture live: $(TOP)/Build/$(ARCH)/$(PORT)
X#
XPORT= XXX
X
X# Libraries to link with for the X11 port.
X# Most of this is boilerplate, only the PORTSYSLIBS part depends on
X# what your system requires.
X#
XPORTOWNLIBS= $(PORTBUILD)/lib/lib.a
XPORTSYSLIBS= -lXXX
XPORTLIBS= $(PORTOWNLIBS) $(PORTSYSLIBS)
X
X# NB: -lXXX is really OS- or site-specific as well, sigh.
END_OF_FILE
if test 1032 -ne `wc -c <'Conf/proto.port.xxx'`; then
echo shar: \"'Conf/proto.port.xxx'\" unpacked with wrong size!
fi
# end of 'Conf/proto.port.xxx'
fi
if test -f 'Doc/macros.ms' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'Doc/macros.ms'\"
else
echo shar: Extracting \"'Doc/macros.ms'\" \(1074 characters\)
sed "s/^X//" >'Doc/macros.ms' <<'END_OF_FILE'
X.\"
X.\" Macro definitions and other settings
X.\" ------------------------------------
X.\"
X.\" The Constant Width font is whatever is mounted at font position 5.
X.\" XXX This is not effective, -ms overrides it (in .TL?),
X.\" but the effect is the same.
X.\"
X.fp 5 CW
X.\"
X.\" Constant width font - use .cW like .I or .R or .B
X.\" When using nroff this translates to .I.
X.\"
X.de cW
X.if t \{\
X. ie \\n(.$ \&\f5\\$1\fP\\$2
X. el .ft 5
X.\}
X.if n .I \\$1 \\$2
X..
X.\"
X.\" Inline constant width macros -- use like \*<this\*> to get a
X.\" word or two in constant width. Equivalent to .cW.
X.\"
X.ds < \&\f5
X.ds > \fP
X.\"
X.\" Code segment macros -- use .sC to start a code segment and .eC
X.\" to end it. Argument to .sC (L, I or B) is passed on to .DS.
X.\" Tabs are set 8 spaces apart.
X.\"
X.de sC
X.DS \\$1 \\$2
X.cW
X.ta \w'\0\0\0\0\0\0\0\0'u +\w'\0\0\0\0\0\0\0\0'u
X..
X.de eC
X.R
X.DE
X..
X.\"
X.\" Change the point size and spacing to something more radable:
X.\"
X.nr PS 12
X.nr VS 14
X.\"
X.\" Some string definitions specific to Python documents:
X.\"
X.ds Py \f2Python\fP
X.ds Ux \s-2UNIX\s0
END_OF_FILE
if test 1074 -ne `wc -c <'Doc/macros.ms'`; then
echo shar: \"'Doc/macros.ms'\" unpacked with wrong size!
fi
# end of 'Doc/macros.ms'
fi
if test -f 'Gen/waskfile.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'Gen/waskfile.c'\"
else
echo shar: Extracting \"'Gen/waskfile.c'\" \(1241 characters\)
sed "s/^X//" >'Gen/waskfile.c' <<'END_OF_FILE'
X/* STDWIN -- UNIVERSAL WASKFILE. */
X
X#include "tools.h"
X#include "filedefs.h"
X#include "stdwin.h"
X
X/* Ask for a file name; default is initial contents of buf.
X Checks are made that the name typed is sensible:
X if 'new' is TRUE, it should be writable or creatable,
X and if it already exists confirmation is asked;
X if 'new' is FALSE, it should exist. */
X
Xbool
Xwaskfile(prompt, buf, len, new)
X char *prompt;
X char *buf;
X int len;
X bool new;
X{
X for (;;) {
X if (!waskstr(prompt, buf, len) || buf[0] == EOS)
X return FALSE;
X if (new) {
X if (access(buf, NOMODE) >= 0) { /* Existing file */
X if (access(buf, WMODE) >= 0) {
X switch (waskync("Overwrite? [ny]", 0)) {
X case -1: return FALSE;
X case 1: return TRUE;
X }
X wmessage("Try again.");
X }
X else
X wmessage("No write permission.");
X }
X else {
X char *p= strrchr(buf, SEP);
X if (p == NULL) {
X if (access(CURDIR, WMODE) >= 0)
X return TRUE;
X }
X else {
X *p= EOS;
X if (access(buf, WMODE) >= 0) {
X *p= SEP;
X return TRUE;
X }
X }
X wmessage("Can't create file.");
X }
X }
X else {
X if (access(buf, RMODE) >= 0)
X return TRUE;
X wmessage("File not found.");
X }
X wfleep();
X break;
X }
X return FALSE;
X}
END_OF_FILE
if test 1241 -ne `wc -c <'Gen/waskfile.c'`; then
echo shar: \"'Gen/waskfile.c'\" unpacked with wrong size!
fi
# end of 'Gen/waskfile.c'
fi
if test -f 'H/_ARGS.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'H/_ARGS.h'\"
else
echo shar: Extracting \"'H/_ARGS.h'\" \(1138 characters\)
sed "s/^X//" >'H/_ARGS.h' <<'END_OF_FILE'
X/* Define _ARGS(x) as either x or () depending on an educated guess
X on the presence of support for prototypes in the compiler.
X The idea is that you declare function with prototypes as follows:
X extern char *malloc _ARGS((unsigned int));
X Watch the double parentheses (you'll quickly get used to them).
X Use _ARGS((void)) to declare a function with no arguments.
X Use things like _ARGS((char *, ...)) to declare printf-like functions.
X
X As a free extra, the macro HAVE_PROTOTYPES is defined if and only if
X prototypes are supported, and the macro 'const' is defined as empty
X if prototypes are not supported (and also if THINK_C is defined).
X*/
X
X#ifndef _ARGS
X
X#ifdef __STDC__
X#define HAVE_PROTOTYPES
X#endif
X
X#ifdef THINK_C
X#undef HAVE_PROTOTYPES
X#define HAVE_PROTOTYPES
X#endif
X
X#ifdef sgi
X#ifdef mips
X#define HAVE_PROTOTYPES
X#endif
X#endif
X
X#ifdef HAVE_PROTOTYPES
X#define _ARGS(x) x
X#else
X#define _ARGS(x) ()
X#endif
X
X#ifndef HAVE_PROTOTYPES
X#define const /*empty*/
X#else /* HAVE_PROTOTYPES */
X#ifdef THINK_C
X#undef const
X#define const /*empty*/
X#endif /* THINK_C */
X#endif /* HAVE_PROTOTYPES */
X
X#endif /* _ARGS */
END_OF_FILE
if test 1138 -ne `wc -c <'H/_ARGS.h'`; then
echo shar: \"'H/_ARGS.h'\" unpacked with wrong size!
fi
# end of 'H/_ARGS.h'
fi
if test -f 'H/editwin.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'H/editwin.h'\"
else
echo shar: Extracting \"'H/editwin.h'\" \(1077 characters\)
sed "s/^X//" >'H/editwin.h' <<'END_OF_FILE'
X/* Text Edit Window Package */
X
Xtypedef struct editwin {
X /* Fields can be read by the caller but shouldn't be changed */
X WINDOW *win;
X TEXTEDIT *tp;
X char *filename;
X char /*tbool*/ saved;
X} EDITWIN;
X
XEDITWIN *ewfind _ARGS((WINDOW *));
Xint ewcount _ARGS((void));
XEDITWIN *ewcreate _ARGS((char *));
XEDITWIN *ewnew _ARGS((void));
XEDITWIN *ewopen _ARGS((void));
X/*bool*/int ewclose _ARGS((EDITWIN *));
X/*bool*/int ewsave _ARGS((EDITWIN *));
X/*bool*/int ewsaveas _ARGS((EDITWIN *));
X/*bool*/int ewsavecopy _ARGS((EDITWIN *));
X/*bool*/int ewsaveprompt _ARGS((EDITWIN *, char *, /*bool*/int));
X/*bool*/int ewrevert _ARGS((EDITWIN *));
X/*bool*/int ewreadfile _ARGS((EDITWIN *, char *));
Xvoid ewsetdimensions _ARGS((EDITWIN *));
X/*bool*/int ewwritefile _ARGS((EDITWIN *, char *));
X/*bool*/int ewevent _ARGS((EDITWIN *, EVENT *, /*bool*/int *));
X/*bool*/int ewsaveall _ARGS((void));
X/*bool*/int ewcloseall _ARGS((void));
Xvoid ewreplace _ARGS((EDITWIN *, char *));
Xvoid ewundo _ARGS((EDITWIN *)); /* Not implemented */
Xvoid ewcopy _ARGS((EDITWIN *));
Xvoid ewpaste _ARGS((EDITWIN *));
END_OF_FILE
if test 1077 -ne `wc -c <'H/editwin.h'`; then
echo shar: \"'H/editwin.h'\" unpacked with wrong size!
fi
# end of 'H/editwin.h'
fi
if test -f 'H/vtrm.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'H/vtrm.h'\"
else
echo shar: Extracting \"'H/vtrm.h'\" \(809 characters\)
sed "s/^X//" >'H/vtrm.h' <<'END_OF_FILE'
X/*
X * Terminal capabilities. These correspond to bits set by trmstart in its
X * parameter flags parameter.
X */
X
X#define HAS_STANDOUT 1 /* Terminal has inverse video or underline */
X#define CAN_SCROLL 2 /* Terminal can insert/delete lines */
X#define CAN_OPTIMISE 4 /* Terminal can insert/delete characters */
X#define CAN_SENSE 8 /* Terminal can send cursor position */
X
X/*
X * Error codes returned by trmstart.
X */
X
X#define TE_OK 0 /* No errors */
X#define TE_TWICE 1 /* Trmstart called again */
X#define TE_NOTERM 2 /* $TERM not set or empty */
X#define TE_BADTERM 3 /* $TERM not found in termcap database */
X#define TE_DUMB 4 /* Terminal too dumb */
X#define TE_NOTTY 5 /* Stdout not a tty device */
X#define TE_NOMEM 6 /* Can't get enough memory */
X#define TE_OTHER 7 /* This and higher are reserved errors */
END_OF_FILE
if test 809 -ne `wc -c <'H/vtrm.h'`; then
echo shar: \"'H/vtrm.h'\" unpacked with wrong size!
fi
# end of 'H/vtrm.h'
fi
if test -f 'Packs/textedit/wprintf.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'Packs/textedit/wprintf.c'\"
else
echo shar: Extracting \"'Packs/textedit/wprintf.c'\" \(1040 characters\)
sed "s/^X//" >'Packs/textedit/wprintf.c' <<'END_OF_FILE'
X#include "stdwin.h"
X
X/* "Printf to a window", with (h, v) and return value like wdrawtext.
X Use only in a draw procedure or between wbegindrawing/wenddrawing. */
X
Xvoid
Xwprintf(h, v, fmt, rest_of_arguments)
X int h, v;
X char *fmt;
X{
X char buf[1000];
X int len;
X int width;
X
X vsprintf(buf, fmt, &rest_of_arguments);
X len = strlen(buf);
X width = wtextwidth(buf, len);
X wdrawtext(h, v, buf, len);
X}
X
X/* "Centered printf to a window": like wprintf but allows centered text.
X The first parameter, align, is a percentage: a value of 0 prints
X at the right of h, a value of 50 centers around h, a value of 100
X aligns the end of the text at h.
X The v coordinate always indicates the top of the text.
X Return value is the h coordinate at the right end of the text. */
X
Xvoid
Xwcprintf(align, h, v, fmt, rest_of_arguments)
X int align;
X int h, v;
X char *fmt;
X{
X char buf[1000];
X int len;
X int width;
X
X vsprintf(buf, fmt, &rest_of_arguments);
X len = strlen(buf);
X width = wtextwidth(buf, len);
X wdrawtext(h - align*width/100, v, buf, len);
X}
END_OF_FILE
if test 1040 -ne `wc -c <'Packs/textedit/wprintf.c'`; then
echo shar: \"'Packs/textedit/wprintf.c'\" unpacked with wrong size!
fi
# end of 'Packs/textedit/wprintf.c'
fi
if test -f 'Packs/vt/vtimpl.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'Packs/vt/vtimpl.h'\"
else
echo shar: Extracting \"'Packs/vt/vtimpl.h'\" \(1403 characters\)
sed "s/^X//" >'Packs/vt/vtimpl.h' <<'END_OF_FILE'
X/* Assorted things used by the VT implementation */
X
X/* Include files */
X
X#include "tools.h"
X#include "stdwin.h"
X#include "vt.h"
X
X/* Names for control characters */
X
X#define ESC '\033'
X#define CR '\r'
X#define LF '\012' /* Can't use \n or EOL because of MPW on Macintosh */
X#define BS '\b'
X#define BEL '\007'
X#define TAB '\t'
X#define FF '\014'
X
X/* Macro to check for non-control character */
X
X#define PRINTABLE(c) isprint(c)
X
X/* Debugging facilities */
X
X/* If you want static functions visible for adb, pass '-DSTATIC=static'
X to the cc compiler. */
X#ifndef STATIC
X#define STATIC static
X#endif
X
X/* Macro D() to turn off code in NDEBUG mode or if debugging is off */
X#ifdef NDEBUG
X#define D(stmt) 0
X#else
X/* XXX Dependency on 'debugging' declared in calling application */
Xextern int debugging;
X#define D(stmt) if (!debugging) { } else stmt
X#endif
X
X/* In Amoeba, MON_EVENT() can be used to keep cheap performance statistics */
X#ifndef MON_EVENT
X#define MON_EVENT(msg) do { } while (0) /* Funny syntax to work inside 'if' */
X#endif
X
X/* Functions used internally */
X/* XXX Ought to have names beginning with _vt */
X
Xvoid vtcirculate _ARGS((VT *vt, int r1, int r2, int n));
Xvoid vtchange _ARGS((VT *vt, int r1, int c1, int r2, int c2));
Xvoid vtshow _ARGS((VT *vt, int r1, int c1, int r2, int c2));
Xvoid vtscroll _ARGS((VT *vt, int r1, int c1, int r2, int c2, int dr, int dc));
Xvoid vtsync _ARGS((VT *vt));
END_OF_FILE
if test 1403 -ne `wc -c <'Packs/vt/vtimpl.h'`; then
echo shar: \"'Packs/vt/vtimpl.h'\" unpacked with wrong size!
fi
# end of 'Packs/vt/vtimpl.h'
fi
if test -f 'Packs/vt/vtputs.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'Packs/vt/vtputs.c'\"
else
echo shar: Extracting \"'Packs/vt/vtputs.c'\" \(1282 characters\)
sed "s/^X//" >'Packs/vt/vtputs.c' <<'END_OF_FILE'
X/* A simple output function, emulating a "dumb tty" */
X
X#include "vtimpl.h"
X
Xvoid
Xvtputs(vt, text)
X register VT *vt;
X register char *text;
X{
X#ifndef NDEBUG
X if (text == NULL)
X vtpanic("vtputs with NULL text");
X#endif
X while (*text != EOS) {
X if (PRINTABLE(*text)) {
X register char *end = text;
X do {
X text++;
X } while (PRINTABLE(*text));
X vtputstring(vt, text, (int) (end-text));
X text = end;
X }
X else switch (*text++) {
X
X case BEL: /* Make some noise */
X wfleep();
X break;
X
X case BS: /* Move 1 left */
X /* Rely on vtsetcursor's clipping */
X vtsetcursor(vt, vt->cur_row, vt->cur_col - 1);
X /* Don't erase --
X that's part of intelligent echoing */
X break;
X
X case TAB: /* Move to next tab stop */
X /* Rely on vtsetcursor's clipping */
X vtsetcursor(vt, vt->cur_row,
X (vt->cur_col & ~7) + 8);
X /* Normalize cursor (may cause scroll!) */
X vtputstring(vt, "", 0);
X break;
X
X case LF: /* Move cursor down in same column */
X vtsetcursor(vt, vt->cur_row + 1, vt->cur_col);
X /* Normalize cursor (may cause scroll!) */
X vtputstring(vt, "", 0);
X break;
X
X case FF: /* Start over */
X vtreset(vt);
X break;
X
X case CR: /* Back to col 0 on same line */
X vtsetcursor(vt, vt->cur_row, 0);
X break;
X
X }
X }
X vtsync(vt);
X}
END_OF_FILE
if test 1282 -ne `wc -c <'Packs/vt/vtputs.c'`; then
echo shar: \"'Packs/vt/vtputs.c'\" unpacked with wrong size!
fi
# end of 'Packs/vt/vtputs.c'
fi
if test -f 'Ports/alfa/measure.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'Ports/alfa/measure.c'\"
else
echo shar: Extracting \"'Ports/alfa/measure.c'\" \(743 characters\)
sed "s/^X//" >'Ports/alfa/measure.c' <<'END_OF_FILE'
X/* STANDARD WINDOWS -- TEXT MEASURING. */
X
X#include "alfa.h"
X
Xint
Xwlineheight()
X{
X return 1;
X}
X
Xint
Xwbaseline()
X{
X return 1;
X}
X
X#define CHARWIDTH(c) ((c) < ' ' ? 2 : (c) < 0177 ? 1 : (c) < 0200 ? 2 : 4)
X
Xint
Xwtextwidth(str, len)
X char *str;
X int len;
X{
X int i;
X int w= 0;
X
X if (len < 0)
X len= strlen(str);
X for (i= 0; i < len; ++i) {
X unsigned char c= str[i];
X w += CHARWIDTH(c);
X }
X return w;
X}
X
Xint
Xwcharwidth(c)
X int c;
X{
X c &= 0xff;
X return CHARWIDTH(c);
X}
X
Xint
Xwtextbreak(str, len, width)
X char *str;
X int len;
X int width;
X{
X int i;
X
X if (len < 0)
X len= strlen(str);
X for (i= 0; i < len && width > 0; ++i) {
X unsigned char c= str[i];
X width -= CHARWIDTH(c);
X if (width < 0)
X break; /* Before incrementing i! */
X }
X return i;
X}
END_OF_FILE
if test 743 -ne `wc -c <'Ports/alfa/measure.c'`; then
echo shar: \"'Ports/alfa/measure.c'\" unpacked with wrong size!
fi
# end of 'Ports/alfa/measure.c'
fi
if test -f 'Ports/alfa/scroll.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'Ports/alfa/scroll.c'\"
else
echo shar: Extracting \"'Ports/alfa/scroll.c'\" \(1199 characters\)
sed "s/^X//" >'Ports/alfa/scroll.c' <<'END_OF_FILE'
X/* Scrolling.
X This is not meant to scroll the window with respect to the document
X (that's done with wshow), but to say that a change has occurred
X in the indicated rectangle for which a full update can be avoided
X by scrolling its content by (dh, dv).
X If we can't do such scrolls, we'll call wchange instead. */
X
X#include "alfa.h"
X
X/*ARGSUSED*/
Xvoid
Xwscroll(win, left, top, right, bottom, dh, dv)
X WINDOW *win;
X int left, top;
X int right, bottom;
X int dh, dv;
X{
X /* if (dh != 0 || left > 0 || right < columns) {
X wchange(win, left, top, right, bottom);
X return;
X }*/
X /* Convert to screen coordinates: */
X top -= win->offset;
X bottom -= win->offset;
X /* Clip to window: */
X if (top < win->top)
X top= win->top;
X if (bottom > win->bottom)
X bottom= win->bottom;
X /* Do the scroll: */
X if (top < bottom) {
X dv= -dv;
X trmscrollup(top, bottom-1, dv);
X /* Set the rectangle filled with 'empty' now: */
X if (dv < 0) {
X if (top-dv < bottom)
X bottom= top-dv;
X }
X else {
X if (bottom-dv > top)
X top= bottom-dv;
X }
X /*
X wchange(win, left, top+win->offset,
X right, bottom+win->offset);
X */
X wchange(win, left, win->top+win->offset,
X right, win->bottom+win->offset);
X }
X}
END_OF_FILE
if test 1199 -ne `wc -c <'Ports/alfa/scroll.c'`; then
echo shar: \"'Ports/alfa/scroll.c'\" unpacked with wrong size!
fi
# end of 'Ports/alfa/scroll.c'
fi
if test -f 'Ports/mac/argcargv.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'Ports/mac/argcargv.c'\"
else
echo shar: Extracting \"'Ports/mac/argcargv.c'\" \(1179 characters\)
sed "s/^X//" >'Ports/mac/argcargv.c' <<'END_OF_FILE'
X/* MAC STDWIN -- GET ARGC/ARGV. */
X
X/* Copy the arguments passed from the finder into argc/argv.
X Neither MPW nor THINK C does this, making argc/argv pretty
X useless. By using winitargs(&argc, &argv) you get the arguments
X that you expect. When called to print, a "-p" flag is passed
X before the first argument.
X*/
X
X#include "macwin.h"
X#ifdef MPW
X#include <SegLoad.h>
X#endif
X#ifdef THINK_C
X#include <SegmentLdr.h>
X#endif
X
Xvoid
Xwargs(pargc, pargv)
X int *pargc;
X char ***pargv;
X{
X L_DECLARE(argc, argv, char *);
X char apname[256];
X char buf[256];
X short aprefnum;
X Handle apparam;
X short message;
X short count;
X short i;
X
X GetAppParms(apname, &aprefnum, &apparam);
X#ifndef CLEVERGLUE
X PtoCstr(apname);
X#endif
X L_APPEND(argc, argv, char *, strdup(apname));
X
X CountAppFiles(&message, &count);
X if (message == appPrint) { /* Must have braces around L_*! */
X L_APPEND(argc, argv, char *, "-p");
X }
X
X for (i = 1; i <= count; ++i) {
X AppFile thefile;
X GetAppFiles(i, &thefile);
X fullpath(buf, thefile.vRefNum,
X p2cstr((char*)&thefile.fName));
X L_APPEND(argc, argv, char *, strdup(buf));
X }
X
X L_APPEND(argc, argv, char *, NULL);
X *pargc = argc - 1;
X *pargv = argv;
X}
END_OF_FILE
if test 1179 -ne `wc -c <'Ports/mac/argcargv.c'`; then
echo shar: \"'Ports/mac/argcargv.c'\" unpacked with wrong size!
fi
# end of 'Ports/mac/argcargv.c'
fi
if test -f 'Ports/mac/fullpath.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'Ports/mac/fullpath.c'\"
else
echo shar: Extracting \"'Ports/mac/fullpath.c'\" \(1332 characters\)
sed "s/^X//" >'Ports/mac/fullpath.c' <<'END_OF_FILE'
X/* GET FULL PATHNAME OF A FILE. */
X
X#include "macwin.h"
X
X#ifdef MPW
X#include <Files.h>
X#endif
X#ifdef THINK_C
X#include <HFS.h>
X#endif
X
X/* Mac file system parameters */
X#define MAXPATH 256 /* Max path name length+1 */
X#define SEP ':' /* Separator in path names */
X#define ROOTID 2 /* DirID of a volume's root directory */
X
X/* Macro to find out whether we can do HFS-only calls: */
X#define FSFCBLen (* (short *) 0x3f6)
X#define hfsrunning() (FSFCBLen > 0)
X
Xchar *
Xgetdirname(dir)
X int dir; /* WDRefNum */
X{
X union {
X HFileInfo f;
X DirInfo d;
X WDPBRec w;
X VolumeParam v;
X } pb;
X static char cwd[2*MAXPATH];
X unsigned char namebuf[MAXPATH];
X short err;
X long dirid= 0;
X char *next= cwd + sizeof cwd - 1;
X int len;
X
X if (!hfsrunning())
X return "";
X
X for (;;) {
X pb.d.ioNamePtr= namebuf;
X pb.d.ioVRefNum= dir;
X pb.d.ioFDirIndex= -1;
X pb.d.ioDrDirID= dirid;
X err= PBGetCatInfo(&pb.d, FALSE);
X if (err != noErr) {
X dprintf("PBCatInfo err %d", err);
X return NULL;
X }
X *--next= SEP;
X len= namebuf[0];
X /* XXX There is no overflow check on cwd here! */
X strncpy(next -= len, (char *)namebuf+1, len);
X if (pb.d.ioDrDirID == ROOTID)
X break;
X dirid= pb.d.ioDrParID;
X }
X return next;
X}
X
Xvoid
Xfullpath(buf, wdrefnum, file)
X char *buf;
X int wdrefnum;
X char *file;
X{
X strcpy(buf, getdirname(wdrefnum));
X strcat(buf, file);
X}
END_OF_FILE
if test 1332 -ne `wc -c <'Ports/mac/fullpath.c'`; then
echo shar: \"'Ports/mac/fullpath.c'\" unpacked with wrong size!
fi
# end of 'Ports/mac/fullpath.c'
fi
if test -f 'Ports/mac_mpw/Makefile' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'Ports/mac_mpw/Makefile'\"
else
echo shar: Extracting \"'Ports/mac_mpw/Makefile'\" \(909 characters\)
sed "s/^X//" >'Ports/mac_mpw/Makefile' <<'END_OF_FILE'
X# Makefile for stdwin, generated under Unix
X
XSOURCES= 6
X about.c 6
X argcargv.c 6
X caret.c 6
X cursor.c 6
X dialog.c 6
X dprintf.c 6
X draw.c 6
X event.c 6
X fullpath.c 6
X menu.c 6
X pstring.c 6
X scrap.c 6
X scroll.c 6
X stdwin.c 6
X strdup.c 6
X timer.c 6
X wtextbreak.c 6
X
X
XHEADERS= 6
X macwin.h 6
X menu.h 6
X
X
XOBJECTS= 6
X about.c.o 6
X argcargv.c.o 6
X caret.c.o 6
X cursor.c.o 6
X dialog.c.o 6
X dprintf.c.o 6
X draw.c.o 6
X event.c.o 6
X fullpath.c.o 6
X getopt.c.o 6
X menu.c.o 6
X pstring.c.o 6
X scrap.c.o 6
X scroll.c.o 6
X set_open_hook.c.o 6
X stdwin.c.o 6
X strdup.c.o 6
X timer.c.o 6
X wtextbreak.c.o 6
X
X
XCOptions= -i : -i ::h:
X
Xlib.o D {OBJECTS}
X Lib -o lib.o -sn Main=STDWIN {OBJECTS}
X
Xclean D {OBJECTS}
X delete {OBJECTS}
X
XSysLibes= 6
X {CLibraries}CInterface.o 6
X {CLibraries}CRuntime.o 6
X {CLibraries}CSANELib.o 6
X {CLibraries}StdClib.o
X
Xtest2 D test2.c.o lib.o
X Link -o test2 -t APPL -c xxxx -p test2.c.o lib.o {SysLibes}
END_OF_FILE
echo shar: 48 control characters may be missing from \"'Ports/mac_mpw/Makefile'\"
if test 909 -ne `wc -c <'Ports/mac_mpw/Makefile'`; then
echo shar: \"'Ports/mac_mpw/Makefile'\" unpacked with wrong size!
fi
# end of 'Ports/mac_mpw/Makefile'
fi
if test -f 'Ports/mac_mpw/intercept.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'Ports/mac_mpw/intercept.h'\"
else
echo shar: Extracting \"'Ports/mac_mpw/intercept.h'\" \(1250 characters\)
sed "s/^X//" >'Ports/mac_mpw/intercept.h' <<'END_OF_FILE'
X/* The structure of the 'device switch' used by the standard I/O library.
X It is possible to install your own versions of selected routines
X by storing function pointers into this table. The structure of
X the control block for the dev_write function is also given.
X
X Careful! this information was gathered by disassembling parts
X of the library. There are no guarantees that the same code will
X work in future versions of MPW.
X Part of it has been tested with versions 1.0B1 and 1.0B2. */
X
Xtypedef int (*funcptr)(); /* Pointer to integer function */
X
Xstruct device {
X long dev_name; /* 'FSYS', 'CONS' or 'SYST' */
X funcptr dev_faccess;
X funcptr dev_close;
X funcptr dev_read;
X funcptr dev_write;
X funcptr dev_ioctl;
X};
X
Xextern struct device _StdDevs[];
X
X#define DEV_FSYS 0
X#define DEV_CONS 1
X#define DEV_SYST 2
X
X/* Control block for dev_write (arg 1 is a pointer to this).
X You might guess that dev_read is similar. */
X
Xstruct controlblock {
X long io_filler1; /* Flags? */
X long io_filler2; /* Some pointer */
X long io_filler3; /* Zero */
X long io_nbytes; /* Number of bytes to write */
X /* (Reset this to zero after writing) */
X char *io_data; /* Start of data buffer */
X};
X
X#define IO_OK 0 /* Return value from dev_write */
END_OF_FILE
if test 1250 -ne `wc -c <'Ports/mac_mpw/intercept.h'`; then
echo shar: \"'Ports/mac_mpw/intercept.h'\" unpacked with wrong size!
fi
# end of 'Ports/mac_mpw/intercept.h'
fi
if test -f 'Ports/vtrm/vtrm.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'Ports/vtrm/vtrm.h'\"
else
echo shar: Extracting \"'Ports/vtrm/vtrm.h'\" \(887 characters\)
sed "s/^X//" >'Ports/vtrm/vtrm.h' <<'END_OF_FILE'
X/*
X * Terminal capabilities. These correspond to bits set by trmstart in its
X * parameter flags parameter.
X */
X
X#define HAS_STANDOUT 1 /* Terminal has inverse video or underline */
X#define CAN_SCROLL 2 /* Terminal can insert/delete lines */
X#define CAN_OPTIMISE 4 /* Terminal can insert/delete characters */
X#define CAN_SENSE 8 /* Terminal can send cursor position */
X
X/*
X * Error codes returned by trmstart.
X */
X
X#define TE_OK 0 /* No errors */
X#define TE_TWICE 1 /* Trmstart called again */
X#define TE_NOTERM 2 /* $TERM not set or empty */
X#define TE_BADTERM 3 /* $TERM not found in termcap database */
X#define TE_DUMB 4 /* Terminal too dumb */
X#define TE_NOTTY 5 /* Stdout not a tty device */
X#define TE_NOMEM 6 /* Can't get enough memory */
X#define TE_OTHER 7 /* This and higher are reserved errors */
X
X/*
X * Function to explain why trmstart() failed.
X */
X
Xextern char *trmwhy();
END_OF_FILE
if test 887 -ne `wc -c <'Ports/vtrm/vtrm.h'`; then
echo shar: \"'Ports/vtrm/vtrm.h'\" unpacked with wrong size!
fi
# end of 'Ports/vtrm/vtrm.h'
fi
if test -f 'Ports/x11/caret.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'Ports/x11/caret.c'\"
else
echo shar: Extracting \"'Ports/x11/caret.c'\" \(868 characters\)
sed "s/^X//" >'Ports/x11/caret.c' <<'END_OF_FILE'
X/* X11 STDWIN -- caret operations */
X
X#include "x11.h"
X
Xvoid
Xwsetcaret(win, h, v)
X WINDOW *win;
X int h, v;
X{
X _whidecaret(win);
X if (h < 0 || v < 0)
X h= v= -1;
X win->careth= h;
X win->caretv= v;
X _wshowcaret(win);
X}
X
Xvoid
Xwnocaret(win)
X WINDOW *win;
X{
X _whidecaret(win);
X win->careth= win->caretv= -1;
X}
X
X_wshowcaret(win)
X WINDOW *win;
X{
X if (!win->caretshown && win->careth >= 0 && win->caretv >= 0) {
X wbegindrawing(win);
X _winvertcaret(win);
X wenddrawing(win);
X win->caretshown= TRUE;
X }
X}
X
X_whidecaret(win)
X WINDOW *win;
X{
X if (win->caretshown) {
X win->caretshown= FALSE;
X wbegindrawing(win);
X _winvertcaret(win);
X wenddrawing(win);
X }
X}
X
X_winvertcaret(win)
X WINDOW *win;
X{
X /* Call this between w{begin,end}drawing only! */
X
X int left= win->careth, top= win->caretv;
X int right= left+1, bottom= top + wlineheight();
X winvert(left, top, right, bottom);
X}
END_OF_FILE
if test 868 -ne `wc -c <'Ports/x11/caret.c'`; then
echo shar: \"'Ports/x11/caret.c'\" unpacked with wrong size!
fi
# end of 'Ports/x11/caret.c'
fi
if test -f 'Ports/x11/cutbuffer.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'Ports/x11/cutbuffer.c'\"
else
echo shar: Extracting \"'Ports/x11/cutbuffer.c'\" \(867 characters\)
sed "s/^X//" >'Ports/x11/cutbuffer.c' <<'END_OF_FILE'
X/* Cut Buffer Interface */
X
X#include "x11.h"
X
Xvoid
Xwsetcutbuffer(ibuffer, data, len)
X int ibuffer;
X char *data;
X int len;
X{
X XStoreBuffer(_wd, data, len, ibuffer);
X}
X
Xchar *
Xwgetcutbuffer(ibuffer, len_return)
X int ibuffer;
X int *len_return;
X{
X static char *lastdata;
X if (lastdata != NULL)
X free(lastdata);
X lastdata= XFetchBuffer(_wd, len_return, ibuffer);
X if (lastdata != NULL) {
X lastdata= realloc(lastdata, *len_return+1);
X if (lastdata != NULL)
X lastdata[*len_return] = EOS;
X }
X return lastdata;
X}
X
Xvoid
Xwrotatecutbuffers(n)
X int n;
X{
X static int been_here;
X if (!been_here) {
X /* XRotateBuffers fails if not all 8 buffers have been
X stored into. Make sure they are all defined. */
X int i;
X for (i = 0; i < 8; i++) {
X int len;
X if (wgetcutbuffer(i, &len) == NULL)
X wsetcutbuffer(i, "", 0);
X }
X been_here = 1;
X }
X XRotateBuffers(_wd, n);
X}
END_OF_FILE
if test 867 -ne `wc -c <'Ports/x11/cutbuffer.c'`; then
echo shar: \"'Ports/x11/cutbuffer.c'\" unpacked with wrong size!
fi
# end of 'Ports/x11/cutbuffer.c'
fi
if test -f 'Ports/x11/llevent.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'Ports/x11/llevent.h'\"
else
echo shar: Extracting \"'Ports/x11/llevent.h'\" \(745 characters\)
sed "s/^X//" >'Ports/x11/llevent.h' <<'END_OF_FILE'
X/* X11 STDWIN -- Variables set by low-level event handling */
X
Xextern WINDOW *_w_new_active; /* New active window */
Xextern struct button_state _w_bs; /* Mouse button state */
Xextern KeySym _w_keysym; /* Keysym of last non-modifier key pressed */
Xextern int _w_state; /* Modifiers in effect at key press */
X
Xextern bool _w_moved; /* Set if button moved */
Xextern bool _w_bs_changed; /* Set if button up/down state changed */
Xextern bool _w_dirty; /* Set if any window needs a redraw */
Xextern bool _w_resized; /* Set if any window resized */
Xextern Time _w_lasttime; /* Set to last timestamp seen */
Xextern bool _w_focused; /* Set between FocusIn and FocsOut events */
Xextern WINDOW *_w_close_this; /* Window to close (WM_DELETE_WINDOW) */
END_OF_FILE
if test 745 -ne `wc -c <'Ports/x11/llevent.h'`; then
echo shar: \"'Ports/x11/llevent.h'\" unpacked with wrong size!
fi
# end of 'Ports/x11/llevent.h'
fi
if test -f 'Tools/strdup.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'Tools/strdup.c'\"
else
echo shar: Extracting \"'Tools/strdup.c'\" \(196 characters\)
sed "s/^X//" >'Tools/strdup.c' <<'END_OF_FILE'
X#include "tools.h"
X
Xchar *
Xstrdup(str)
X const char *str;
X{
X if (str != NULL) {
X register char *copy = malloc(strlen(str) + 1);
X if (copy != NULL)
X return strcpy(copy, str);
X }
X return NULL;
X}
END_OF_FILE
if test 196 -ne `wc -c <'Tools/strdup.c'`; then
echo shar: \"'Tools/strdup.c'\" unpacked with wrong size!
fi
# end of 'Tools/strdup.c'
fi
echo shar: End of archive 18 \(of 19\).
cp /dev/null ark18isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 ; do
if test ! -f ark${I}isdone ; then
MISSING="${MISSING} ${I}"
fi
done
if test "${MISSING}" = "" ; then
echo You have unpacked all 19 archives.
rm -f ark[1-9]isdone ark[1-9][0-9]isdone
else
echo You still need to unpack the following archives:
echo " " ${MISSING}
fi
## End of shell archive.
exit 0
More information about the Alt.sources
mailing list