Prospects for running Lightspeed/THINK Pascal and Codewarrior Pascal with FPC

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Prospects for running Lightspeed/THINK Pascal and Codewarrior Pascal with FPC

Jerry-40
Hi list,

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?

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.

What do you think?

Jerry
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Prospects for running Lightspeed/THINK Pascal and Codewarrior Pascal with FPC

Jonas Maebe-2
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).


Jonas
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Prospects for running Lightspeed/THINK Pascal and Codewarrior Pascal with FPC

Ingemar Ragnemalm
In reply to this post by Jerry-40
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

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Prospects for running Lightspeed/THINK Pascal and Codewarrior Pascal with FPC

Mark Morgan Lloyd-5
Ingemar Ragnemalm 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?

> 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.

I know it's not good practice, but could this- at least during initial
porting- be replaced by an exception?

--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Prospects for running Lightspeed/THINK Pascal and Codewarrior Pascal with FPC

Richard Ward-4
In reply to this post by Jerry-40

On Aug 21, 2014, at 6:00 AM,Jerry wrote:
>
> 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, …… When I moved to Codewarrior, I was somehow able to emulate that both text and drawing windows. …….I can't remember if Codewarrior offered a drawing window or if I had to make a crude one using a (now) Carbon window.

I never made the switch to CodeWarrior and until Apple came out with the Swift Playground a couple months ago, IMO there was nothing like the LSP Text, Drawing and Instant windows.  I have been using Ingemar’s Lightweight Pascal (LWP) IDE and it has worked well for me.  By the way, the TransSkel which was mentioned is a lot more fleshed out than the original one created 20 years ago.  Ingemar has supplied a lot more library routines and functionality.  If you go this route, my opinion would be to use the Cocoa based version.   You don’t have to know anything about Cocoa to use it, but it has more future potential.  I think of most benefit for you however is the QuickDraw (called QDCG “QuickDraw Core Graphics") unit available with LWP.  You have most of the calls you had with the original QD plus new capabilities based on Core Graphics routines.  The source is available and might interesting to see how Core Graphics and Cocoa graphics work.  There is a little bit of execution speed overhead but I would be surprised if you would see it.  I use it exclusively since (for me) my code is much easier to read, write and understand in QDCG than doing it in Core Graphics.  If I decide to do write any serious code in Swift, I will probably want to port QDCG to it.  -R
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Prospects for running Lightspeed/THINK Pascal and Codewarrior Pascal with FPC

Jerry-40
In reply to this post by Ingemar Ragnemalm

On Aug 21, 2014, at 12:11 PM, Ingemar Ragnemalm <[hidden email]> 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

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal