info-mac@uw-beaver (03/14/85)
From: Moderator John Mark Agosta <INFO-MAC-REQUEST@SUMEX-AIM.ARPA> INFO-MAC Digest Wednesday, 13 Mar 1985 Volume 2 : Issue 13 Today's Topics: Skeleton Mac application SKEL source MacAdvantage Possible bug in Extras V1.2 XLISP article MIDI MIDI again Reading Lisa disks ---------------------------------------------------------------------- From: Steve Maker <*k98000%d1%dartmouth.csnet@csnet-relay.arpa> Date: 06 Mar 85 12:47 Subject: Skeleton Mac application For about 9 months I have been using a skeleton Lisa Pascal program called SKEL to teach people how to write Macintosh applications. The aim of the program is to do very little (events, menus, a window with dragging and growing, desk accessories, modal dialog box, icons) but to do it well and cleanly, in a way that remains correct in larger programs. SKEL contains directions for self-study. It is easily digested, being rather short. It can be compiled under Workshop 2.0 or 3.0. You are welcome to use and abuse SKEL, so long as that use is not for commercial purposes. I would appreciate it if significant revisions were sent back to me for incorporation. I am posting to net.sources on USENET the source code SKEL, [ stored in UTILITY-SKEL.PAS ] the resource definition file SKELR, [ stored in UTILITY-SKEL.RESDEF ] and the Lisa EXEC file SKELX, [ stored in UTILITY-SKEL.EXEC -jma ] which will perform all necessary steps to produce on running program on an inserted floppy. Steve Maker USPS: Academic Computing, Dartmouth College, Hanover NH 03755 USENET: {linus|decvax|cornell|astrovax}!dartvax!maker ARPA: maker%dartmouth@csnet-relay CSNET: maker@dartmouth ------------------------------ From: Steve Maker <*k98000%d1%dartmouth.csnet@csnet-relay.arpa> Date: 06 Mar 85 12:48 Subject: SKEL source [ I have included the program header since its's so informative. As mentioned the full code resides in <info-mac>UTILITY-SKEL.PAS -jma ] {%describe 'a Skeleton demo program'} {$X-} {Turn automatic run-time stack expansion off - it's a Lisa concept.} {$R-} {Turn off range checking; it can cause crashes.} PROGRAM Skel; { By Steve Maker Academic Computing Kiewit Computation Center Dartmouth College July 14, 1984 Copyright notice: SKEL may be copied and used by anyone, so long as that use is not for commercial purposes. Please send significant changes back to me so that I may incorporate them into future versions. Why SKEL? Skel is a skeleton demo program. Its purpose is to illustrate in a clear fashion, isolated from any particular application, the basic code for handling a simple Macintosh user interface. It strives to be correct as far as it goes, without many short-cuts that would lead to trouble in larger applications. I think of SKEL as a program that does nothing, but does it well. What does SKEL do? It handles: Events, carefully handling only those which are its business, and passing the others on to their respective handlers. A Window, which is filled with Dark Gray, and can be activated or inactivated, updated, dragged and grown but NOT scrolled or closed. Menus, including the Apple Menu. An "About Skel" menu entry is provided. A File menu offers Rattle and Frighten, which just invoke dialog boxes, and Quit. Command key equivalents are supported. The Desk Accessories, supported in the Apple menu, and correctly meshed with the other features. NOT supported are Undo, Cut, Copy, Paste and Clear (and keyboard equivalents) for desk accessories. A Modal Dialog Box, used to communicate with the user. Special icons for the application and its related files. The Finder information (in the resource file). In accordance with Macintosh guidelines, everything possible is kept in the resource file: window description, menus, dialog specification, and the "About Skel" and other strings. In addition, the resource file handles the Bundle, File References, and Icons that determine what Skel's icon looks like, and other information for the Finder. How do I use SKEL? Study it. Modify it to test your knowledge. Steal working pieces of code for your own programs. Beat on it. Subject it to cruel and unusual experiments. Pay heed to its warnings. What do I study first in SKEL? Initially you should ignore several sections of SKEL, and the calls made to them. I recommend X-ing them out in your listing. The sections to ignore on the first round of study are: Report: ignore the implementation SetUpMemory: ignore all of it DrawWindow: ignore the scroll bar and grow icon handling ReSize: ignore all of it DoCommand: ignore the Desk Accessory handling in the Apple Menu MainEventLoop: MouseDown handling: ignore inSysWindow, inDrag, inGrow keyDown, autoKey handling: ignore this. In the resource definition file, SKELR: Finder information (offset by asterisks): ignore this whole section, icons and all. What should I read in Inside Macintosh? You should read the following sections of Inside Macintosh, in the order given. At first, just lightly skim the sections with parenthesized names. Read the others in some depth. Read the starred (*) ones in great detail. Eventually, you will have read all sections thoroughly, and many many times, I promise you. To start: * Inside Macintosh: A Road Map (User Interface Guidelines) Structure of a Macintosh Application * Putting Together a Macintosh Application Then, (low-level sections are listed first): * Memory Mgr Intro (Memory Mgr) * Resource Mgr (through "Using the Resource Mgr") * QuickDraw (Desk Mgr) * Event Mgr (through "Event Mgr routines") Window Mgr Menu Mgr (Dialog Mgr) How do I get SKEL to run? The best way is to use the special EXEC file SKELX, and insert a Macintosh diskette into your Lisa. SKELX will write on it with MacCom, and will set all info correctly so that the icon will appear. You may also use Apple's EXEC file, or the Dartmouth exec files T/EXEC or M/MACCOM. The first two will not set the icon correctly, while M/MACCOM will do that right, and also refrain from recompiling or repeating other steps if they are unnecessary. ------------------------------ From: <bang!crash!bwebster@Nosc> Date: Sun, 10 Mar 85 06:42:49 PST Subject: MacAdvantage Steve - I've been using MacAdvantage heavily for about 2-3 months. It's actually a very nice system to use. I've converted my Go program to it (see Nov '84 BYTE) and have added a number of bells and whistles. I've also written a 3-D star map program with it, which will show up in the July issue of BYTE. The compiler is fast (compared the the oh-so-slow multi-pass MacModula-2 compiler) and the development environment (editor, executive, resource maker, etc.) is complete. I only have one major complaint with MacAdvantage: its speed. I modified my Go program to let the computer play against you, but it takes far too much time to make even simple, stupid moves. My best guess is that it is about 10x slower than the various C compilers out for the Mac. However, it does make a good prototyping language; I suspect that I could convert my working programs to Lisa Pascal in very short order. ..bruce.. Bruce Webster/BYTE Magazine bang!crash!bwebster@nosc {ihnp4, sdcsvax!bang}!crash!bwebster ------------------------------ Date: Thu, 7 Mar 85 16:35:27 est From: Mark Vita <markv%dartmouth.csnet@csnet-relay.arpa> Subject: Possible bug in Extras V1.2 ..."Extras" was posted to USENET's net.micro.mac some time ago. [- EXTRAS.HCX has been in info-mac since Feb. -jma ] Anyway, Extras is a desk accessory which allows you to show free disk space, delete files, show free memory, and compact memory, all from within an application. It's being distributed on the "freeware" system (i.e., "if you like it, please send the author (Bob Luce) $X.00..."). I've encountered what appears to be a bug in version 1.2 of the Extras desk accessory. I had installed Extras on a MacWrite disk, on which MacWrite happened to be the startup application. I was able to open and use the DA from within MacWrite, but attempting to close it caused a system error with ID=02. One noticeably odd thing about this error was that for the first time I've seen, the "Resume" button actually worked! Clicking it brought up the Save dialog box, allowing me to save my document, and then exited to the Finder. I also found a couple other oddities. With MacWrite still the startup application, I rebooted, then quit MacWrite, and then launched it again. The Extras desk accessory then worked normally, and could be closed without causing a crash. The same was true when there was no startup application (i.e., the startup application was the Finder). I also tried setting MacPaint as the startup application; this again caused Extras to crash when closed (though this time there was no Resume option--is that some sort of MacWrite "feature"?) All this seems to indicate that you cannot close Extras without having previously loaded the Finder. Anyone out there had a similar experience, or have an explanation? ------------------------------ Date: Mon, 11 Mar 85 22:47:17 EST From: winkler@harvard.ARPA (Dan Winkler) Subject: XLISP article There's a good article by David Betz about XLISP in this month's Byte. ------------------------------ Date: Sun, 10 Mar 85 08:41:59 pst From: shebanow%ucbernie@Berkeley (Mike Shebanow) Subject: MIDI again The previous message about MIDI and time constants was not quite correct. First, MIDI's baud rate is 32000 (31.25K), not 31250. Second thee formula for calculating the time constant was missing several variables. The real equation is: tc = (clock / (2*baud_rate)) - 2 However, the "clock" variable is divided by a clock rate constant, which can be 1, 16, 32, or 64. The Mac uses a clock factor of 16. So the real Mac serial clock rate is 368400 (115200*2*16). If you change the clock factor to 1, and reapply the formula, you get a time constant of 76. This translatestrue baud rate of 31779 baud, which is within 0.69% of the desired MIDI baud rate, well within the MIDI spec. I have already built a MIDI box which translates MIDI signals into RS422 signals. I am working on a driver. The hardware box only cost me $20, including a case (and at Radio Shack, no less!). More on this when I have something working... Andrew Shebanow using (shebanow@ucbernie) (my brother's account) ------------------------------ Date: Sun, 10 Mar 85 09:16:37 pst From: shebanow%ucbernie@Berkeley (Mike Shebanow) Subject: MIDI I just want to make sure that my last note was correct. I may have misremembered. The correct "time-constant" value should be 56, not 76 (which is what I think I wrote. If you could you could also tell people that I can be reached at (415) 769-5445 during work hours (weekdays, 9-6). Thanks... Andrew G. Shebanow ------------------------------ Date: 9 March 1985 00:12-EST From: Michael C. Adler <MADLER @ MIT-MC> Subject: Reading Lisa disks Does anyone know of a program to read Lisa disks on the Mac? It would be nice to have access to some of the software supplement assembler include files, etc. Thanks, -Michael ------------------------------ End of INFO-MAC Digest **********************