Path: utzoo!attcan!uunet!zephyr.ens.tek.com!uw-beaver!ubc-cs!alberta!myrias!ami-cg!cg From: cg@ami-cg.UUCP (Chris Gray) Newsgroups: comp.sys.amiga Subject: Re: Draco (long) Keywords: Draco programming Fish Message-ID: <0919.AA0919@ami-cg> Date: 8 Dec 89 03:52:47 GMT Followup-To: comp.sys.amiga Lines: 100 In <8912020143.AA10404@dinghy.cis.ohio-state.edu> martens@tut.cis.ohio-state.edu writes: >It seems that I've heard of Draco somewhere along the way, but really >know nothing about it. So, for people in my situation -- ignorant of >Draco, spiteful of C, and too cheap to buy a Modula-2 compiler -- >maybe you could post a quick description of Draco. > >Also, you suggested that we pick up 3 Fish disks. Am I correct in >guessing that really FF201 is enough? Or would I really want all >three? Thanks. > >Does Draco per chance run on a Sun 3 Berkeley Unix system? In the >best of possible worlds, I'd just be using one language. Glad to oblige! I describe Draco as a language with semantics similar to C (but more strongly typed) and syntax similar to Algol68 (but much less ambiguous at the syntactic level). The compiler is complete, comes with a full I/O and utility library, comes with a full set of include files for the Amiga, and comes with a number of other utility programs. It compiles fast, but still generates fairly good code. The only commercial compiler I've got is Lattice V4.0, and Draco compares well with it (files are much smaller, compiles much faster, and code runs about the same speed/size). Holding to the maxim that a picture is worth a thousand words, here's a silly little Draco program that compiles and runs: #drinc:intuition/miscellaneous.g #drinc:intuition/screen.g #drinc:intuition/window.g #drinc:graphics/gfx.g #drinc:graphics/rastport.g #drinc:libraries/dos.g uint WINDOW_WIDTH = 500, WINDOW_HEIGHT = 150; proc process(register *RastPort_t rp)void: register ulong i, j; for i from 0 upto WINDOW_WIDTH - 1 do for j from 0 upto WINDOW_HEIGHT - 1 do SetAPen(rp, if i > j then (i - j) % 4 else (i + j) % 4 fi); ignore WritePixel(rp, i + 2, j + 10); od; od; Delay(50 * 20); corp; proc main()void: *Window_t window; if OpenGraphicsLibrary(0) ~= nil then if OpenIntuitionLibrary(0) ~= nil then window := OpenWindow(&NewWindow_t( 100, 50, WINDOW_WIDTH + 4, WINDOW_HEIGHT + 12, FREEPEN, FREEPEN, 0x0, WINDOWDEPTH + WINDOWDRAG + SMART_REFRESH, nil, nil, nil, nil, nil, 0, 0, 0, 0, WBENCHSCREEN)); if window ~= nil then process(window*.w_RPort); CloseWindow(window); fi; CloseIntuitionLibrary(); fi; CloseGraphicsLibrary(); fi; corp; It opens a window on the workbench screen, draws a kind of moire pattern into it, waits 20 seconds, then exits. I compiled it by typing: draco sample and linked it by typing dr1lib2 intuition graphics sample to produce a 5100 byte object file (which, because I was lazy, mostly consists of some of the Draco I/O library, and some symbolic information that I had hanging around in my standard libraries). If I give it the '-v' flag, it tells me that the first routine was actually 120 bytes, and the second was 140. To reply to Jeff's specific questions: At a minimum you need Fish Disks 77 and 201. 77 contains all the documentation and a bunch of samples. 201 contains the latest released version of the compiler, include files, libraries, scripts, tools, etc. 76 has info, etc. on how to install the compiler, but you can probably do without it. Draco doesn't YET run on a Sun, but I've been meaning to port it for about 2 years now. Mostly so I can port my editor so I don't have to wait 10 seconds for emacs to page in and echo what I've typed on my Sun at work. I've got some time off between Christmas and New-Years - maybe then... Note, however, that a Sun version wouldn't automagically have all of the C libraries available. It would have its I/O system (replaces stdio), and interfaces to the system. There IS a kludge to make the compiler generate C-style calls, but you have to reverse the function arguments, so that's a pain. -- -- Chris Gray usenet: {uunet,alberta}!myrias!ami-cg!cg CIS: 74007,1165