America Online APPLE II DEVELOPMENT FORUM CONFERENCE LOG Tuesday, December 14, 1993 10:00 p.m. Eastern Time Topic: ORCA/Modula-2 Special Guest: Mike Westerfield, from the Byte Works Forum Leader: Gary Jacobson (AFL GaryJ) AFL GaryJ Welcome to the Apple II Development Forum! AFL GaryJ Tonight, we're pleased to have as our special guest, Mike Westerfield from the Byte Works! AFL GaryJ Mike is here to talk about one of his latest releases, ORCA/Modula-2. AFL GaryJ Can you give us a rundown of this new product Mike? (And then we'll open up the floor for AFL GaryJ questions/answers and comments). MikeW50 Sure! ORCA/Modula-2 is our latest language -- the first major new compiler for the Apple IIGS MikeW50 since ORCA/C. Tonight I'll be answering questions about it. I'd like to start off with the MikeW50 5 minute course in Modula-2 for Pascal programmers. The, during the conference, I'll list some of the MikeW50 features of Modula-2 that aren't in Pascal (and in many cases are not in any other Apple IIGS MikeW50 language). MikeW50 So, to start with the course: Here's the things you need to change in your Pascal program to make MikeW50 it a Modula-2 program: MikeW50 1. Ise IMPLEMENTATION MODULE instead of Program to start off the program. MikeW50 2. Modula-2 (I'll use M2 from now on) doesn't use begin-end for compound statements. Instead, in MikeW50 M2, all of the statements start a compound statement, and they all get an END. For example, MikeW50 an IF-ELSE-END looks like this: MikeW50 IF condition THEN MikeW50 MikeW50 ELSE MikeW50 MikeW50 END MikeW50 3. The END at the end of a procedure and program is followed by the name of the procedure. This MikeW50 helps M2 give better error checking for mismatched ENDs than either C or Pascal can mannage. For MikeW50 example, here's the basic format for a procedure: MikeW50 PROCEDURE Foo; MikeW50 BEGIN MikeW50 END Foo; MikeW50 4. M2 is case sensitive, and all reserved words use capitol letters. MikeW50 5. Instead of Pascal's uses statement, M2 uses the statement MikeW50 FROM module IMPORT idetifiers; MikeW50 6. There are some extra goodies, and a few other obscure differences. MikeW50 There! It's not too much of a streatch to say that all of you who used to know Pascal now know enough MikeW50 M2 to take a crack at writing a program. Sort of like the Berlitz language courses for MikeW50 business travelers. :) AFL GaryJ :) MikeW50 Thats it for the course in M2! I'm ready for any questions. ga AFL GaryJ Anyone with a question or comment? AFL GaryJ It seems easy to pick up on (for a Pascal programmer)... but I presume Modula-2 offers much more AFL GaryJ in features and power? (I guess that's the next part :) MikeW50 Sure. I'll list a few of those as we wait for any questions. Feel free to stop me at any time with MikeW50 questions or comments, though. MikeW50 #1: M2 supports unsigned integers. I guess Niklaus Wirth's dictionary needed a workout. He MikeW50 calls them CARDINAL numbers in M2. :) AFL GaryJ :) AFC DYAJim cardinal??? lol MikeW50 (Niklaus Wirth, by the way, is the creator of Pascal, Modula-2, and Oberon.) MikeW50 #2: You can code numbers in octal and hexadecimal. Some Pascals support hexadecimal, but that's MikeW50 actually a non-standard extension. MikeW50 #3: You can include the ' character in a string. Strings can use either ' or " as the delimiter. MikeW50 #4: This is a big one. You can declare a type as a procedure, and then declare other types that use MikeW50 it. For example, you can create arrays of pointers to procedures, and call them indirectly. MikeW50 #5: M2 has a LOOP statement, which is a formal way to do an infinite loop. Instead of the Pascal MikeW50 repeat MikeW50 MikeW50 until HellFreezesOver; MikeW50 or the very readable C MikeW50 for (;;) { MikeW50 } MikeW50 in M2, you get: MikeW50 LOOP MikeW50 MikeW50 END; MikeW50 You break out of a loop with the EXIT statement. MikeW50 #6: M2 has a RETURN statement! That has to be one of the best things about C compared to Pascal. It MikeW50 works just like the RETURN in C, giving you a way to bail out of a procedure (returning a value if MikeW50 needed). MikeW50 #7: M2 supports "open arrays." Basically, that means you can call the same procedure with arrays MikeW50 of varying sizes. MikeW50 #8: M2 supports concurrent programming. MikeW50 That's what I consider to be the major improvements in M2 over Pascal. There are other improvelemts MikeW50 and differences, of course. DavidGS What is concurrent programming? MikeW50 Glad you asked that! Concurrent programming is a mechanism that lets you run more than one MikeW50 process at the same time. It's sort of like multitasking, but all in the same program. The best MikeW50 way to understand it is to step back a bit and look at what it is used for. While most current MikeW50 computers consist of a single CPU (with, perhaps, a few auxiliary CPUs doing specialized tasks, like MikeW50 graphics processors on the Mac), there is a lot of research going into creating computers with more MikeW50 than one CPU. To make a current computer faster, you plug in an accelerator card or replace your MikeW50 computer with one with a faster CPU. With these new computers, to make it faster, you plug in MikeW50 more CPUs. The software is designed to spool tasks off to multiple CPUs. If there are more tasks MikeW50 that CPUs, as there are on a GS with only one, then MikeW50 the various tasks get a share of the time from the CPU, like a multiprocessing operating system. DavidGS cool MikeW50 In ORCA/Modula-2, when you create a new process, it gets MikeW50 its own stack frame, local variables, and so forth. It basically becomes a second program, built by, MikeW50 and under control of, the first. You can transfer back and forth. AFC DYAJim What are some applications of concurrent processes? :) MikeW50 One of the samples shows the MikeW50 Seive running in one part of the screen while you type in the other. Another cool use would be MikeW50 a modem program that has one task watching the port, and another paying attention to you. That MikeW50 way, both you and the port get some attention each few moments. DavidGS I like that... MikeW50 So, are you all experts yet? :) Any questions? DavidGS Does each process use a lot of stack space? DavidGS Considering the limited space and with multitasking. MikeW50 Actually, when you set up the process, you decide how much stack space to give it. If you're MikeW50 making tool calls, you'll need to allocate a fair chunk. For subroutines that don't use the tools, MikeW50 you won't need as much. AFL GaryJ I presume that you must assign a task as being concurrent? AFL GaryJ (So you can have linear tasks as well?) AFA AndyW Mike, is there a way to access memory directly, by absolute/long address like AFA AndyW there is in C?? MikeW50 Yes, Gary. The mechanics, at the lowest level, require 3 calls. ALLOCATESTACK is used on the GS MikeW50 to get some stack space. That's system dependent, since all computers don't do it the way the GS MikeW50 does. On most of them, you just grab some memory. The next step is to call NEWPROCESS, which MikeW50 sets up the process. You give it the name of the procedure that is the top level of the process, MikeW50 the location and size of the stack space, and it passes back a pointer. Then, to switch from one MikeW50 process to another, you use TRANSFER. MikeW50 And yes, Andy. You can get at memory directly, pretty much like you would in C. Modula-2 is more AFC DYAJim So once you start 2 processes running, you don't have to worry about them? Or do they have to .. AFC DYAJim .. manually exit to each other so they both can be run at once?? MikeW50 flexible with pointers. Unlike Pascal, it's not a language that is designed to be 100% foolproof. MikeW50 (In full ISO Pascal with all errors caught, I don't think there is any possible way to crash. It's MikeW50 that safe.) M2 does give you rope. You can tie pretty knots or hang yourself, just like in C. M2 MikeW50 does have a few more safegards than C, though. :) MikeW50 Jim, you do need to use TRANSFER, so it's not quite like true multi-tasking. There are ways to have MikeW50 the process switch automatically, but you should code the program so it doesn't depend on it MikeW50 happening, since the implementation is not required to support true multi-tasking time stamps. I hate MikeW50 to admit it, but I'm not sure whether ORCA/Modula-2 is doing that or not. I've got a question in to MikeW50 Peter about that very fact. I'll post the answer in our area as soon as I get it. AFC DYAJim That's what I was wondering :) It's nice that it still supports it so well. AFL GaryJ Yeah, that seems like a useful and powerful feature of the language. AFC DYAJim So how many concurrent process can you set up? AFC DYAJim As many as you want? And then when they all call Transfer, M2 automatically gives each its share? MikeW50 Jim, you're limmited only by stack space. If you set things up just right, I think you can even MikeW50 share stack space among processes that run linearly, but I haven't actually done that, so MikeW50 I may be wrong. DavidGS I hate being ** limited by stack space ** :) AFC DYAJim (durn '816) MikeW50 I hear 'ya. It beats the 6502, though. :) AFL GaryJ Yep. AFA AndyW I don't know of much stack based code on the '02 though.. MikeW50 The lack of stack space is a part of the reason why you never say 6502 compilers, though. The other MikeW50 reason was just plain lack of space. :) AFA AndyW Most code I'v written that needs parameter passing on the 'c02 used the ProDOS AFA AndyW 8 style of passing parameters.. AFA AndyW JSR Routine AFA AndyW DC I'Parm1' AFA AndyW etc... AFC DYAJim I never do it that way Andy :) AFA AndyW Not on the GS.. MikeW50 Andy, that's similar to the mechanism used on the IBM 360-370. It's part of the reason that IBM MikeW50 stuck with FORTRAN and COBOL while the rest of the world moved to stack-based languages like MikeW50 Algol, Pascal and C. AFA AndyW You'd run out of stack space very fast passing parms on the stack on the 'c02 AFA AndyW though.. MikeW50 Anyway... :) Any more questions about Modula-2? AFL GaryJ I'm impressed by the features. I can see why Pascal people would want to switch to AFL GaryJ Modula-2 now. AFC DYAJim I heard that one of the most confusing things between M2 and Pascal is that they index arrays AFA AndyW If we're done with M2, maybe we can move on to other ORCA products ;) AFC DYAJim differently. Does M2 index arrays starting at 0 like C then? All arrays, or just certain ones? MikeW50 Jim, M2 arrays work just like Pascal arrays. The only place there is a dependence on the starting MikeW50 subscript is in open arrays (variable size array parameters for procedures). In that case, the MikeW50 index always starts from 0 inside the procedure. MikeW50 (Since Pascal doesn't have that feature, I don't think there _should_ be much confusion, but maybe MikeW50 it threw a few people. ) AFL GaryJ Yes, I'd like to ask Mike about his other new products too - but lets leave HyperLogo GS for two weeks AFL GaryJ from tonight (when Mike is going to be back here again to talk about that :) MikeW50 Let me do one more thing before we open it up, then. AFA AndyW Sounds like it would be similar to passing the address of an element of an AFA AndyW array (other than the first) to a function in C, then working with it as an AFA AndyW array within the function.. AFA AndyW You start with 0 within the function, but outside the function, it isn't 0.. MikeW50 Yep. Except that, as far as I know, you pass the whole array in Modula-2. There may be a way to MikeW50 pass the address of a specific element, but if so, I haven't stumbled across it yet. AFC DYAJim you pass the whole array on the stack? or do you mean you can pass the address of only the 1st AFC DYAJim element? MikeW50 Of course, the array you pass might have an initial index of -100, or have multiple dimensions. MikeW50 Inside the procedure, you still index from 0. MikeW50 As I understand it, the call would be normal, like this: MikeW50 VAR a: ARRAY [-10..10] OF INTEGER; MikeW50 Then the procedure call to a procedure with an open array: MikeW50 DoSomething(a); MikeW50 So you're not passing an address, at least not explicitly. You're just passing an array. AFA AndyW Sounds like in that case, it would end up (comparing inside/outside the proc).. MikeW50 Inside DoSomething, the valid indecies would be 0..20. (I think.) AFA AndyW 0 = -10, 1 = -9, 2 = -8, etc... For the indices.. AFC DYAJim are you passing the whole array on e stack theN? AFA AndyW I doubt that the entire array ends up on the stack.. Probably just the address MikeW50 That's the way I understand the index mapping. I assume you can still pass by VAR or value, but AFA AndyW of the lowest element is passed.. MikeW50 I would need to double check that. Assuming that's correct, you could pass the whole array or end MikeW50 up passing just the address. MikeW50 (Mechanically, Pascal would pass the address for a value array, and the procedure makes a copy. I MikeW50 think M2 actually passes the whole array on the stack.) MikeW50 Well, while you guys think up more questions, I'd like to extend a special offer to all of you who MikeW50 came. If you would like to order ORCA/Modula-2, here's the best deal you'll see anywhere! Order MikeW50 in the next 72 hours, and I'll give you an extra 10% off of the entire order. This offer is good MikeW50 for all in attendance, staff or not! The introductory price for ORCA/Modula-2 is $75 (through MikeW50 28 Feb). And, here on AOL, you can also get free US shipping until the 15th! I garantee you won't MikeW50 find a lower price anywhere. AFC Softy (Cool! :) AFC DYAJim so we have until Wednesday, err, tomorrow :) MikeW50 For the free shipping, yes. For the 10%, you have until Friday night. AFA AndyW What about the offers on the updates?? MikeW50 Andy, what offers on what updates? There hasn't been one for M2 yet. :) AFA AndyW I can't afford M2 right now, but I would like to update the other stuff I have. AFA AndyW The OTHER updates :) AFA AndyW Debugger, 6.0.1 update.. AFA AndyW (manual update that is).. MikeW50 The 10% is a promotion for Modula-2. It's only good on an order that includes M2. If you order MikeW50 M2, too, you can get 10% off of those updates as well. Otherwise, well, they're already pretty MikeW50 low prices. :) AFC DYAJim When is the 601 ref coming out Mike? AFL GaryJ It's out! AFC DYAJim Yes, the orca languages blow away the prices for languages on other platforms. AFC DYAJim Okay, then when do I get my copy? AFC Softy It is? AFA AndyW When you order it.. MikeW50 (The other updates Andy is refering to are new product announcements in our area.) AFC DYAJim I ordered it back when Orca/C 2.0.1 was released. AFC Softy AFL GaryJ It was announced today. AFC DYAJim When will the backorders ship? :) MikeW50 Jim, Programmer's Reference for System 6.0.1 is finished. It's being printed now, and will AFC Softy Jim :) MikeW50 start shipping early next week. AFC DYAJim I feel deprived by Apple :) AFA AndyW Mike, I usually order stuff COD, but I couldn't expect free shipping that way, AFC Softy (You're full of all sorts of Christmas goodies tonight Mike.. :) MikeW50 :) MikeW50 Ho ho ho. AFA AndyW and your note in your area mentioned only credit card orders.. I gather though SoftdiskGS So, if I order M2 and the 6.0.1 ref tonight, I could get 10% off both plus free shipping? AFC DYAJim so how goes GS+, Bill? AFL GaryJ "full of all sorts of Christmas goodies" - in more ways than one at this time of year. AFA AndyW that I can send a check for the updates, and still get the $20 price for both? AFL GaryJ (You should see the candy at our office :) AFC Softy (guess it was a good thing I *didn't* get that PB180 this weekend.. ;) MikeW50 Andy: Yes. MikeW50 SoftdiskGS: Yes. (Which one are you, anyway? :) AFA AndyW That's Greg.. AFA AndyW My check will go out tomorrow Mike.. AFA AndyW BTW, any comments on ORCA/Debugger vs Splat?? SoftdiskGS So, what is the price of the 6.0.1 (refresh my memory... it's been a while since anybody even SoftdiskGS disparaged Matt about it... :) AFA AndyW $10 for the update Greg.. MikeW50 Great, Andy. AFL GaryJ Great? AFC DYAJim Orca/Debugger doesn't do the 2.0 versions of the languages. Splat is therefore a different product. MikeW50 Andy: Nope. Based on past experience, you can never have too many debuggers, since each one seems MikeW50 to do something better than the others. I haven't seen Splat yet, though. AFA AndyW There's an update to the ORCA/Debugger Jim.. AFC DYAJim Oh? AFC DYAJim (I never bought it because I wasn't into high level langs when o/debug came out) AFA AndyW I'd think they wouldn't work together though.. AFL GaryJ Where does Splat come from? MikeW50 Jim: ORCA/Debugger DOES do 2.0 products. It even detects and adjusts for a but that's only in MikeW50 some versions of ORCA/Pascal. AFL GaryJ (And don't say car windshields) AFA AndyW Splat comes from Procyon.. (GNO).. MikeW50 Jim: You could use ORCA/Debugger to debug T2 modules, too. AFL GaryJ Oh yeah. AFL GaryJ (Now I remember :) AFC DYAJim Okay, cool then! :) AFC DYAJim So now I'm really lost between the differences of Splat and O/D. AFC DYAJim Someone told me it didn't do the 2.0 languages. AFA AndyW <- wondering if there's a way to switch from one to the other.. MikeW50 (...for a but... -> ...for a bug...) AFA AndyW Jim, it didn't handle the 2.0 languages, but the update, just announced today AFA AndyW does.. MikeW50 Andy, I suspect you must boot from one or the other. The both will need the same COP vector. AFC DYAJim ahh. I see AFA AndyW It would be nice to have a CDA or something to swap COP vectors from one to the AFA AndyW other! AFA AndyW Kind of hard to figure out what one is when the other has overwritten the first AFA AndyW one though! AFL GaryJ Yeah, it seems like they would be fighting each other right from bootup. AFL GaryJ (The two debuggers) AFA AndyW Well, I have most of the materials I need to start sending out OE now.. AFA AndyW Just need the documentation now, and TFSP Steve is working on that.. SoftdiskGS Except for keyboard translation, right Andy? AFA AndyW Right Greg.. AFC Softy (OE needs a better icon too. ;) AFA AndyW You got your suggestion in AFTER the feature freeze... MikeW50 Gary, I think you're right. You would have to disable one or the other. AFL GaryJ Yeah, I was thinking of the feasibility of having some kind of switcher CDA (or whatever) MikeW50 Gary, you could do it...but it would be tricky. You'd need a trio of Inits to do it. One would MikeW50 run before wither debugger, and record things. One would run between them and record things. The MikeW50 last would run after them and set up some variables the CDA could then use. You might not need that MikeW50 first one; I'm not sure. AFL GaryJ Anyone else have any questions or comments for Mike? AFL GaryJ That does sound tricky :) AFA AndyW I know what to do with the debugger problem... AFA AndyW Disable BOTH of them.. AFA AndyW Run the one you want using IR.. MikeW50 Are there any more questions/comments for me? I can hang around if there are, but if not, I need MikeW50 to go make some fudge. :) MikeW50 Well, thanks for having me here folks. I appreciated the chance, and look forward to the log! AFL GaryJ Yes, I'll get the log file up soon! :) AFL GaryJ And thank you Mike for coming! MikeW50 Bring any other questions that come up to the Byte Works area. AFL GaryJ It was our pleasure. MikeW50 Hasta-la-bye-bye, folks. AFL GaryJ We appreciate your support of the Apple IIGS development. SoftdiskGS Later, Mike. AFL GaryJ Goodnight, Mike! DavidGS bye, Mike