[fpc-pascal] Prospects for running Lightspeed/THINK Pascal and Codewarrior Pascal with FPC
Jerry
lanceboyle at qwest.net
Tue Aug 26 06:49:54 CEST 2014
On Aug 21, 2014, at 12:11 PM, Ingemar Ragnemalm <ingemar at ragnemalm.se> wrote:
> On 21/08/14 07:41, Jerry wrote:
>>> I have a lot of old Pascal that I am getting interested in reviving. It was originally written in Lightspeed/THINK Pascal (did I mention it is old?) and around 2000-2002 I converted it to Codewarrior Pascal. These are both Macintosh dialects.
>>>
>>> What are the prospects of running each of these dialects under FPC? Are there compatibility flags to set? Would there be much rewriting?
>>>
>>
>> The compatibility flag to set is the compiler directive {$mode macpas} (at the top of the file), or the command line switch -Mmacpas. I don't know how much there would be to rewrite, but in general that switch should make the accepted syntax at least quite compatible to CodeWarrior's.
>>
>>
>>> One of the things that I recall being possibly unique and possibly troublesome now is that under THINK Pascal, there was a built-in text I/O window and a built-in graphics drawing window, both of which I used. In the latter case, it was mainly MoveTo(x, y) and LineTo(x, y) stuff. When I moved to Codewarrior, I was somehow able to emulate that both text and drawing windows. I suppose the text window became a normal terminal (whatever Codewarrior offered). I can't remember if Codewarrior offered a drawing window or if I had to make a crude one using a (now) Carbon window.
>>>
>>
>> Maybe you could rewrite your code on top of TransSkel: http://ragnemalm.se/lightweight/ (click on it in the navigation bar on the left).
>>
>
> Thanks, Jonas!
>
> I am very comfortable in porting old Mac code to FPC. FPC implements a very nice and modern Pascal that handles most (but not all) old code. The only problem I have had is with multiply nested code that does "exit" on the enclosing function, which FPC can't do.
>
> You have to make your own text/drawing windows, but that is fairly easy. If you program for Carbon, your code can be pretty close to the old one, and you can even use QuickDraw, but if you want to be a bit more future safe, TransSkel 5 targets Cocoa, includes a partial replacement for much of the Mac Toolbox GUI and a future safe QuickDraw layer, QDCG, where all those MoveTo/LineTo should work just fine.
>
> And if you want an IDE that is somewhat similar to Think, Lightweight IDE is aiming in that direction. The debugger needs more work but we are quite active right now so the plan is to fix the remaining limitations during the coming months. (The latest upload was today.)
>
>
> /Ingemar
Great to know that I seem to have a good shot. I'm looking into TransSkel5 now.
Thanks for the help!
Jerry
More information about the fpc-pascal
mailing list