1. Re: Euphoria on a Mac

Bernie wrote:

> Has anyone ever tried compiling Pete's
> PEU on a Macintosh "C" compiler? That
> might be a way of running Euphoria code
> on a Mac until Rob creates a Mac version.

Pete's given it a try, and not been successful. He's indicated that he'll
continue looking into it. Maybe he could take a break next semester and work
full time on a Mac port? blink

I've played a little bit with the MetroWerks C Mac compiler, and it appears
to give most of the STIDO functions automatically, so creating wrappers for
un-Mac-like programs shouldn't be that hard. [Before you suggest that I try
coding PEU for the Mac, keep in mind that (1) I have a demo-crippled version
of the compiler, (2) coding in C gives me the heebie-jeebies, and (3) I
can't really follow Pete's code.]

Wrapping the Toolbox and OS routines shouldn't be that tough - just very,
very tedious. Instead of using DLLs, calls to the Toolbox and OS are coded
as unimplemented 68000 machine instructions. When the 68000 encounters an
unimplemented instruction, it hands control over to a trap dispatcher. On
the Mac, it's a routine that routes the instruction to the Mac ROM. If the
instruction's high bits are 10101, it's a Toolbox call. If they are 10100,
it's an OS call. Otherwise, it really *is* an unimplemented instruction, and
the Mac gets unhappy. For example, the instrucion ExitToShell is coded as
#A9F4.

Linking to these routines could look a lot like the DLL linking routines.
For example:

   constant OpenResFile = trap_func( #A997, { STR255 }, INTEGER )

would define OpenResFile as taking a Pascal-style string as intput, and
returning an integer as output. Yes, the Mac uses Pascal calling conventions
and Pascal strings. Bleah. And Mac memory management can apparently be
tricky, too. For example, I think you are supposed to specify *before* your
application runs how much stack space to allocate. And heap memory gets
compacted every now and then, so most memory pointers are indirected. Yes,
you can lock them down, but then you get memory fragmentation. And
apparently the 68000 is different-endian.

How all this works on a PPC I don't really know. I know a lot of issues go
away, but there's still some leftovers from how application space was
allocated on the 68000.

Despite all this, I'm looking forward to the day that *someone* releases a
Mac version.

-- David Cuny

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu