Path: utzoo!attcan!uunet!husc6!mailrus!ames!oliveb!apple!keith From: keith@Apple.COM (Keith Rollin) Newsgroups: comp.sys.mac.programmer Subject: Re: Problems with XCMDs in MPW Object Pascal 3.0 Message-ID: <27155@apple.Apple.COM> Date: 12 Mar 89 07:21:25 GMT References: <4321@sdcc3.ucsd.EDU> <26942@apple.Apple.COM> <877@internal.Apple.COM> <15634@cup.portal.com> Organization: Apple Computer Inc, Cupertino, CA Lines: 74 In article <15634@cup.portal.com> Greg_Mark_Finnegan@cup.portal.com writes: > >I have one related question (and onother somewhat unrelated): > >Is it possible to create a multisegment XCMD? Let's say for example I want >to somehow shoehorn a small spreadsheet (about 90K) into an XCMD. Can I >do it (easily)? Well, I suppose that it could be done. There are two ways that you could do it, but neither qualify as being easy: 1) create a multisegmented XCMD 2) create a 90K XCMD MPW will allow you to compile and link a code segment that is 90K in size. However, there is major limitation when doing so: all intra segment calls must involve a distance no greater than 32K. This comment only applies to Pascal and C programmers. I am not an assembly language programmer so I don't know if there is a PC relative addressing mode that allows 32-bit offsets when calling subroutines. If there is, then you could write your XCMD in assembly with no problems. Creating a multisegmented XCMD is also nasty. You would have to handle the loading of the other segments by yourself. This would amount to writing several XCMDs, with the main one loading in and calling the others as needed. This could be done with small subroutines. I've heard that the LightSpeed development systems allow one to easily create multisegmented DA's. I don't know how this is done, but perhaps their techniques would apply to your problem. If I were in your situation, I would re-examine what I was trying to do. If I had 90K of code that I wanted to execute, I'd write an application, not and XCMD that runs under HyperCard. >Here's a question for the MPW compiler hacks out there: What is the most >efficient base index of arrays in MPW 3.0 Pascal 0 or 1? I just looked at the output of the following program. Neither array base seemed offer any advantage over the other. However, I seem to recal an instance where a zero-based array was better, but I can't remember what the circumstances were: VAR t1: array [0..10] of integer; t2: array [1..10] of integer; i: integer; begin t1[0] := 1; t1[1] := 2; t2[1] := 3; t2[2] := 4; i := 0; t1[i] := 5; i := 1; t1[i] := 6; t2[i] := 7; end. >Thanks in advance. > >Greg. ------------------------------------------------------------------------------ Keith Rollin --- Apple Computer, Inc. --- Developer Technical Support INTERNET: keith@apple.com UUCP: {decwrl, hoptoad, nsc, sun, amdahl}!apple!keith "Argue for your Apple, and sure enough, it's yours" - Keith Rollin, Contusions