Path: utzoo!attcan!uunet!portal!cup.portal.com!thad From: thad@cup.portal.com (Thad P Floryan) Newsgroups: comp.sys.amiga Subject: Re: Atari ST Emulation Message-ID: <18735@cup.portal.com> Date: 24 May 89 06:15:09 GMT References: <686@xroads.UUCP> <0YN9Vay00VsfE5s3Mb@andrew.cmu.edu> <9195@super.ORG> <18653@cup.portal.com> <15986@louie.udel.EDU> Organization: The Portal System (TM) Lines: 505 Since there appears to be a lot of interest surrounding STDWIN, and since no-one's posted any details as to the nature of STDWIN, I uucp'd the stuff from osu-cis. The directory listing and contents of the ABOUT and README files are at the end of this posting. The material appears interesting and the code is "clean"; enjoy! If you wanna get the stuff from osu-cis (Ohio State University), following is the {L.sys | Systems} entry and following that are the two uucp commands to get you started. Thad Floryan [ thad@cup.portal.com (OR) ..!sun!portal!cup.portal.com!thad ] -------------------- The osu-cis extract from my /usr/lib/uucp file is (several lines are l-o-n-g): # osu-cis GNU stuff, etc. # # Micom switch 2400 baud # osu-cis Any tty000 9600 16142923124 "" \r\c Name? osu-cis GO \d\r\d\r\d\r in:--in:--in: Uanon # # use either the above or the below; the above works on MY system, the below # is what's posted by Bob Sutterfield and Karl Kleinpaste (of osu-cis) # #osu-cis Any tty000 9600 16142923124 "" \r\c Name? osu-cis nected \c GO \d\r\d\r\d\r in:--in:--in: Uanon The "official" L.sys or Systems file entry is: # # Micom switch 2400 bps # osu-cis Any ACU 2400 1-614-292-3124 "" \r\c Name? osu-cis nected \c GO \d\r\d\r\d\r in:--in:--in: Uanon # # Micom switch 1200 bps # osu-cis Any ACU 1200 1-614-292-3112 "" \r\c Name? osu-cis nected \c GO \d\r\d\r\d\r in:--in:--in: Uanon When you're ready, issue the following to get the indices: uucp -m osu-cis!~/GNU.how-to-get ~/osu-cis/ uucp -m osu-cis!~/ls-lR.Z ~/osu-cis/ -------------------- And the files that automagically appeared on one of my systems are: ksh 1/11132> ls -l /usr/spool/uucppublic/osu-cis/stdwin total 959 -rw-rw-rw- 1 uucp users 7426 May 22 02:39 ABOUT.Z -rw-rw-rw- 1 uucp users 1395 May 22 02:39 README.Z -rw-rw-rw- 1 uucp users 28322 May 22 02:41 alfa.tar.Z -rw-rw-rw- 1 uucp users 91791 May 22 02:48 any.tar.Z -rw-rw-rw- 1 uucp users 30977 May 22 02:51 atari.tar.Z -rw-rw-rw- 1 uucp users 13970 May 22 02:52 bed.tar.Z -rw-rw-rw- 1 uucp users 20648 May 22 02:53 doc.old.Z -rw-rw-rw- 1 uucp users 29598 May 22 02:56 dpv.tar.Z -rw-rw-rw- 1 uucp users 38141 May 22 02:59 mac.tar.Z -rw-rw-rw- 1 uucp users 26115 May 22 03:01 man.tar.Z -rw-rw-rw- 1 uucp users 49747 May 22 03:05 mg1.tar.Z -rw-rw-rw- 1 uucp users 21561 May 22 03:06 miniedit.tar.Z -rw-rw-rw- 1 uucp users 18110 May 22 03:08 msdos.tar.Z -rw-rw-rw- 1 uucp users 12690 May 22 03:09 qview.tar.Z -rw-rw-rw- 1 uucp users 22875 May 22 03:11 report.ms.Z -rw-rw-rw- 1 uucp users 22492 May 22 03:13 termcap.tar.Z -rw-rw-rw- 1 uucp users 50268 May 22 03:17 x11.tar.Z ksh 1/11132> ksh 1/11132> zcat /usr/spool/uucppublic/osu-cis/stdwin/README.Z [Last modified on Fri Jul 29 17:24:20 PDT 1988 by gvr] This directory contains the STDWIN distribution. The source to STDWIN is copyrighted 1988 by Stichting Mathematisch Centrum, Amsterdam. STDWIN is available for noncommercial use only, free of charge, and with no guarantees. It can be freely used and distributed provided these restrictions are honoured. The following files will eventually find their way to this directory: README this file ABOUT what is STDWIN and how do I get it report.ms source to the CWI report (ditroff -ms) doc.old some relevant (but unfortunately somewhat outdated) programmer's documentation (plain ASCII text) man.tar directory with some man pages (incomplete) any.tar source directories shared by all versions alfa.tar source directories shared by the Unix termcap and MS-DOS versions termcap.tar source directories relevant to the Unix termcap version msdos.tar source directories relevant to the MS-DOS version x11.tar source directory relevant to the X11R2 version mg1.tar source directory relevant to the Whitechapel MG-1 version (old!) mac.tar source directory relevant to the Macintosh version atari.tar source directory relevant to the Atart-ST version dpv.tar source directory for the ditroff previewer application qview.tar source directory for the line printer queue view application bed.tar source directory for the bitmap editor application miniedit.tar source directory for the mini editor application To get a complete implementation for any one target system, retrieve the any.tar and .tar files and untar them in a freshly created directory (this will create several subdirectories), e.g. with the command: tar xf any.tar Then follow the steps of configuration and compilation mentioned in the file README (found in any.tar). Some test programs are found in the subdirectory test (also on any.tar). Note that most long files will actually be found with a .Z suffix, meaning they have been compressed with BSD's compress(1) program. Use binary file transfer mode when fetching such files, and use uncompress(1) to get the original file. You can combine this with the tar step, e.g.: uncompress any.tar.Z | tar xf - If you have any problems or requests, please mail to gvr@src.dec.com. ksh 1/11132> ksh 1/11132> ksh 1/11132> zcat /usr/spool/uucppublic/osu-cis/stdwin/ABOUT.Z [Last modified on Sat Jul 30 18:04:08 PDT 1988 by gvr] 1. Target systems STDWIN is aimed at C programs. It consists of a few header files (of which only one is visible to the user) and a library. In most cases some system-provided libraries must also be used in the linking phase. Currently, full STDWIN is available for the following environments: (Note that in all cases the code is in beta test state; there may be bugs, functionality may change slightly in the future and new functionality may be added, but the basic framework isn't going to change much.) * X version 11 release 2 * Apple Macintosh using either LightspeedC (2.15) or MPW C (2.02) * Atari ST using Mark Williams C (2.1) * Whitechapel MG-1 running an old version of 4.2 BSD You may volunteer to create a version for your favourite system, or to port it to your favourite C compiler for one of the mentioned micros. A subset emulating most of STDWIN's functionality on an alphanumeric display (this excludes line drawing but includes windows, menus, text editing etc.) is available for: * Any decent Unix that has termcap (tested with 4.{2,3} BSD) * MS-DOS using the Microsoft C compiler (4.0) 2. Getting the full scoop I have written a paper about STDWIN which has been published as a CWI report (Guido van Rossum: STDWIN -- A Standard Window System Interface. Centre for Mathematics and Computer Science, report CS-R8817. Amsterdam, 1988). You might get a copy mailed to you by politely asking our secretary, Marja Hegt . You can also get a source version for any or all of the above-mentioned systems. This is essentially a directory dump of my working version, until I have the time or get some help to prepare a real distribution. It is available through anonymous ftp access to gatekeeper.dec.com, whose IP address is [128.45.9.52]. The directory is pub/stdwin; get the file README for further instructions. A version of the document you're currently reading is in the file ABOUT. Distribution outside the USA is solely by electronic mail. Be prepared to receive up to half a megabyte (in 50K pieces, tarred/ compressed/ uuencoded/ split). If you're interested, write to: gvr@src.dec.com (after October 14, 1988, try once again guido@cwi.nl.) 3. Basic functionality STDWIN allows multiple "full-function" windows, roughly in Macintosh style (title bar, grow box, close box, scroll bars). The appearance of windows is determined by the default of the underlying window manager, and so are other limitations (e.g., overlapping, maximum size, etc.). Windows are dynamically created and destroyed by the application, never directly by the user or the window manager. STDWIN uses a coordinate system derived from the display's coordinate system: (0, 0) is top left, with X pointing right and Y pointing down (these are actually called h and v). Pixel size is that of the display. There are enquiry functions to ask for the display size in pixels and in millimeters. The application is responsible for redrawing the window contents when it is exposed. This is done by associating a "draw procedure" with each window, which knows how to draw the entire window's contents. It gets passed a pointer to the window and the coordinates of the rectangle that needs to be redrawn, so it can (although it needn't) restrict itself to that area. STDWIN guarantees that a window's redraw procedure is only called while the application is waiting for an input event (most implementations simply turn exposure events into calls to the draw procedure). If the application wants to change part of the graphics it is displaying, this is usually done in a two-phase process: first, STDWIN is told that a particular area of the screen must be changed; later, when the application starts waiting for input events again, the draw procedure is called to update the indicated area (and any other area that was exposed or damaged in some way). The application defines the width and height of the area it wants to draw; this needn't bear any relation to the window or screen size. This area is called the "document" although you may also think of it as a virtual window. The actual window generally displays a sub-area of the document; the window's scroll bars indicate the position of the window with respect to the document. The application always uses the coordinates of its document; STDWIN performs the translation to window or screen coordinates are required by the window manager, and ensures clipping of all output to the window. STDWIN is event-based. An application is expected to have a main loop containing a "get event" call followed by a switch on the event type. There is no event mask; an application can simply ignore events it isn't interested in. The most important event types are: ACTIVATE: A window becomes active (keyboard attached and/or topmost) CHAR: ASCII character key pressed (except BS, TAB, CR) COMMAND: special key or function (CLOSE, TAB, RETURN, BS, CANCEL, arrow keys etc.) MOUSE: MOUSE DOWN, MOUSE MOVE (only while down), MOUSE UP; fields in the event record indicate the h, v position, the number of the button, and the "click number" if the event is potentially part of a multiple-click sequence MENU: menu id and item number of a menu selection SIZE: user has resized the window TIMER: the window's timer went off; each window has one programmable timer which can be set to go off at N/10 seconds in the future. When the timer goes off a TIMER event is returned. Currently, STDWIN draws text in a single font. The actual font used depends on the underlying window manager (and can sometimes be influenced by the application programmer and/or the end user in a system-dependent manner). The font may be proportionally spaced, and there are enquiry functions to find out the dimensions of characters and strings. There are functions to draw text and simple lines, rectangles and circles, and ways to erase, shade or invert rectangular areas. There is no way (yet) to do general bitblt operations, or to influence the pen shape. 4. Higher level functionality STDWIN provides a blinking vertical bar which can be used to indicate the text insertion point, so the application needn't use TIMER events to do the blinking. STDWIN provides Macintosh-style menus. Each window has its own set of menus, although by default all menus apply to all windows. A reasonably number of menus per window is allowed, each with a reasonable number of (textual) menu items. Menus can be changed dynamically. Items can be enabled or disabled, and a 'tick mark' can be placed in front of an item. Each menu item may have a shortcut character, which, when typed in combination with some system-defined meta key (e.g., ALT or an ESC- prefix) selects the menu item (if enabled). Menu selection is done completely "underwater"; all the application notices are MENU events. STDWIN has a few simple routines to display Mac-style "dialog boxes", e.g., to show an error message, or to ask a yes/no question or to ask for a string to be typed. There is also a predefined function to ask for a file name, which may allow the user to browse the file system in some implementations. STDWIN comes with a package built on top of the basic functionality, to edit arbitrary blocks of text (cf. Macintosh TEXTEDIT). In the future, more packages will be provided, e.g., a package to provide a simple file editor (available now!), a package to display a scrolling list of items, a package to define a list of arbitrary labeled "buttons", and a package to simplify the binding of menus to functions somewhat, and a VT100 emulator (available now!). 5. Function definitions Here follows a slightly edited listing of the header file, which more or less documents all available functions and data structures. Note that the argument lists are given here as ANSI C prototypes (untested). #define bool int void winit(); void wdone(); void wsetdefwinsize(int width, int height); void wsetdefwinpos(int h, int v); #define MENU struct menu /* The contents of a text attributes struct are disclosed here because the interface allows the programmer to declare objects of this type. (I'm not so sure anymore that this is the right thing to do!) */ struct textattr { short font; unsigned char size; unsigned char style; }; #define TEXTATTR struct textattr #ifndef WINDOW struct window { short tag; }; #define WINDOW struct window #endif WINDOW *wopen(char *title, void drawproc(); void wclose(WINDOW *win); #define wgettag(win) ((win)->tag) #define wsettag(win, newtag) ((win)->tag= newtag) void wsetactive(WINDOW *win); WINDOW *wgetactive(); void wgetwinsize(WINDOW *win, int *width, int *height); void wsetdocsize(WINDOW *win, int width, int height); void wsettitle(WINDOW *win, char *title); void wsetorigin(WINDOW *win, int h, int v); void wshow(WINDOW *win, int left, int top, int right, int bottom); void wchange(WINDOW *win, int left, int top, int right, int bottom); void wscroll(WINDOW *win, int left, int top, int right, int bottom, int dh, int dv); void wfleep(); void wmessage(char *str); void wperror(char *name); bool waskstr(char *prompt, char *buf, int buflen); int waskync(char *question, int dflt); bool waskfile(char *prompt, char *buf, int buflen, bool new); void wsetcaret(WINDOW *win, int h, int v); void wnocaret(WINDOW *win); void wsettimer(WINDOW *win, int deciseconds); MENU *wmenucreate(int id, char *title); void wmenudelete(MENU *mp); int wmenuadditem(MENU *mp, char *text, char shortcut); void wmenusetitem(MENU *mp, int i, char *text); void wmenusetdeflocal(bool local); void wmenuattach(WINDOW *win, MENU *mp); void wmenudetach(WINDOW *win, MENU *mp); /* EVENT STRUCT DEFINITION */ struct event { int type; WINDOW *window; union { /* case WE_CHAR: */ int character; /* case WE_COMMAND: */ int command; /* case WE_MENU: */ struct { int id; int item; } m; /* case WE_DRAW: */ struct { int left, top, right, bottom; } area; /* case WE_MOUSE_DOWN, WE_MOUSE_MOVE, WE_MOUSE_UP: */ struct { int v; int h; int clicks; int button; int mask; } where; } u; }; #define EVENT struct event /* Event types */ #define WE_NULL 0 /* (Used internally) */ #define WE_ACTIVATE 1 /* Window became active */ #define WE_CHAR 2 /* Character typed at keyboard */ #define WE_COMMAND 3 /* Special command, function key etc. */ #define WE_MOUSE_DOWN 4 /* Mouse button pressed */ #define WE_MOUSE_MOVE 5 /* Mouse moved with button down */ #define WE_MOUSE_UP 6 /* Mouse button released */ #define WE_MENU 7 /* Menu item selected */ #define WE_SIZE 8 /* Window size changed */ #define WE_MOVE 9 /* (Reserved) */ #define WE_DRAW 10 /* Request to redraw part of window */ #define WE_TIMER 11 /* Window's timer went off */ #define WE_DEACTIVATE 12 /* Window became inactive */ /* Command codes for WE_COMMAND. Special ways of entering these are usually available, such as clicking icons, standard menu items or special keys. Some ASCII keys are also passed back as commands since they more often than not need special processing. */ #define WC_CLOSE 1 /* Should become a separate event! */ /* The following four are arrow keys */ #define WC_LEFT 2 #define WC_RIGHT 3 #define WC_UP 4 #define WC_DOWN 5 /* ASCII keys */ #define WC_CANCEL 6 #define WC_BACKSPACE 7 #define WC_TAB 8 #define WC_RETURN 9 void wgetevent(EVENT *ep); void wungetevent(EVENT *ep); void wupdate(WINDOW *win); void wbegindrawing(WINDOW *win); void wenddrawing(WINDOW *win); void wflush(); void wdrawline(int h1, int v1, int h2, int v2); void wxorline(int h1, int v1, int h2, int v2); void wdrawcircle(int h, int v, int radius); void wdrawelarc(int h, int v, int radh, int radv, int angle1, int angle2); void wdrawbox(int left, int top, int right, int bottom); void werase(int left, int top, int right, int bottom); void wpaint(int left, int top, int right, int bottom); void winvert(int left, int top, int right, int bottom); void wshade(int left, int top, int right, int bottom, int percent); int wdrawtext(int h, int v, char *str, int len); int wdrawchar(int h, int v, char c); int wlineheight(); int wtextwidth(char *str, int len); int wcharwidth(char c); int wtextbreak(char *str, int len, int width); void wgettextattr(TEXTATTR *attr); void wsettextattr(TEXTATTR *attr); void wgetwintextattr(WINDOW *win, TEXTATTR *attr); void wsetwintextattr(WINDOW *win, TEXTATTR *attr); void wsetplain(); void wsethilite(); void wsetinverse(); void wsetitalic(); void wsetbold(); void wsetbolditalic(); void wsetunderline(); /* TEXTEDIT PACKAGE DEFINITIONS */ #define TEXTEDIT struct _textedit TEXTEDIT *tealloc(WINDOW *win, int left, int top, int width); TEXTEDIT *tecreate(WINDOW *win, int left, int top, int right, int bottom); void tefree(TEXTEDIT *tp); void tedestroy(TEXTEDIT *tp); void tedraw(TEXTEDIT *tp); void tedrawnew(TEXTEDIT *tp, int left, int top, int right, int bottom); void temove(TEXTEDIT *tp, int left, int top, int width); void temovenew(TEXTEDIT *tp, int left, int top, int right, int bottom); void tesetfocus(TEXTEDIT *tp, int foc1, int foc2); void tereplace(TEXTEDIT *tp, char *str); void tesetbuf(TEXTEDIT *tp, char *buf, int buflen); void tearrow(TEXTEDIT *tp, int code); void tebackspace(TEXTEDIT *tp); bool teclicknew(TEXTEDIT *tp, int h, int v, bool extend); bool tedoubleclick(TEXTEDIT *tp, int h, int v); bool teevent(TEXTEDIT *tp, EVENT *ep); #define teclick(tp, h, v) teclicknew(tp, h, v, FALSE) #define teclickextend(tp, h, v) teclicknew(tp, h, v, TRUE) char *tegettext(TEXTEDIT *tp); int tegetlen(TEXTEDIT *tp); int tegetnlines(TEXTEDIT *tp); int tegetfoc1(TEXTEDIT *tp); int tegetfoc2(TEXTEDIT *tp); int tegetleft(TEXTEDIT *tp); int tegettop(TEXTEDIT *tp); int tegetright(TEXTEDIT *tp); int tegetbottom(TEXTEDIT *tp); /* Text paragraph drawing functions: */ int wdrawpar(int h, int v, char *text, int width); /* Returns new v coord. */ int wparheight(char *text, int width); /* Returns height */ ksh 1/11132>