Lazarus

Free Pascal => Beginners => Topic started by: holalluis on August 26, 2019, 04:05:26 pm

Title: Attempt to compile a Turbo Pascal package from 1991
Post by: holalluis on August 26, 2019, 04:05:26 pm
Hi,
I'm trying to compile this program written in Turbo Pascal in 1991:
https://github.com/icra/uct-model (https://github.com/icra/uct-model)

In the console, I did:
Code: Text  [Select][+][-]
  1. fpc UCTOLD.PAS

And I got this error:
Code: Text  [Select][+][-]
  1. Free Pascal Compiler version 3.0.0+dfsg-11+deb9u1 [2017/06/10] for x86_64
  2. Copyright (c) 1993-2015 by Florian Klaempfl and others
  3. Target OS: Linux for x86-64
  4. Compiling UCTOLD.PAS
  5. UCTOLD.PAS(5,2) Warning: Unsupported switch "$N"
  6. Compiling STRINGS.PAS
  7. STRINGS.PAS(1,3) Fatal: Syntax error, "UNIT" expected but "PROCEDURE" found
  8. Fatal: Compilation aborted
  9. Error: /usr/bin/ppcx64 returned an error exitcode
  10.  

It seems that the compiler finds an error in the STRINGS.PAS file, but I'm a total novice in Pascal so, I need help to compile this program.

I posted a screenshot here:

https://github.com/icra/uct-model/issues/1
 (https://github.com/icra/uct-model/issues/1)

Thank you
Title: Re: Attempt to compile a Turbo Pascal package from 1991
Post by: valdir.marcos on August 26, 2019, 06:37:27 pm
Hi,
I'm trying to compile this program written in Turbo Pascal in 1991:
https://github.com/icra/uct-model (https://github.com/icra/uct-model)

In the console, I did:
Code: Text  [Select][+][-]
  1. fpc UCTOLD.PAS

And I got this error:
Code: Text  [Select][+][-]
  1. Free Pascal Compiler version 3.0.0+dfsg-11+deb9u1 [2017/06/10] for x86_64
  2. Copyright (c) 1993-2015 by Florian Klaempfl and others
  3. Target OS: Linux for x86-64
  4. Compiling UCTOLD.PAS
  5. UCTOLD.PAS(5,2) Warning: Unsupported switch "$N"
  6. Compiling STRINGS.PAS
  7. STRINGS.PAS(1,3) Fatal: Syntax error, "UNIT" expected but "PROCEDURE" found
  8. Fatal: Compilation aborted
  9. Error: /usr/bin/ppcx64 returned an error exitcode
  10.  

It seems that the compiler finds an error in the STRINGS.PAS file, but I'm a total novice in Pascal so, I need help to compile this program.

I posted a screenshot here:

https://github.com/icra/uct-model/issues/1
 (https://github.com/icra/uct-model/issues/1)

Thank you
It would be easier if you could contact P. Dold, or A. Billing, or M. Wentzel, or G. Ekama, or G. Marais from University of Cape Town.
Just curious.
Is this solution (theory and its formulas) still valid after almost 3 decades?
Are you on a doctorate (PhD) on Chemical or Civil Engineering?
Title: Re: Attempt to compile a Turbo Pascal package from 1991
Post by: TNoob on August 26, 2019, 06:42:03 pm
Other noob here. I gave it a very quick look and I don't think it can be simply compiled right away with FPC, not only most compiler directives will be wrong, library units and some syntax will be different, plus I guess you'd have to rewrite all the ui/graphic part. Even VirtualPascal has a lot to complain about it. The STRINGS.PAS indeed starts with a PROCEDURE declaration, I don't think this is allowed in FPC, actually I'm surprised that TP used to take it. I say your best bet, if you don't want to put your hands deep in the code, is to compile it with good old TP (Borland released version 5.5 freeware about a decade ago, now it's on http://edn.embarcadero.com/article/20803, but you can probably find some later version somewhere in the interwebs) and hope it still runs under (I assume) some Windows version, or else under some virtual machine (DosBox, Bochs, VirtualBox). Perhaps https://sourceforge.net/projects/turbopascal-wdb/ can be useful in that case.
Title: Re: Attempt to compile a Turbo Pascal package from 1991
Post by: winni on August 26, 2019, 07:01:42 pm
If no unit/interface/implementation in the source is found, it says that the code is <= Turbo Pascal 3.0. The unit concept was "stolen" from UCSD Pascal in Version 4.0.

3.0 was 1986, 4.0 was 1987. That's more than 3 decades.

Write it new again.

Winni
Title: Re: Attempt to compile a Turbo Pascal package from 1991
Post by: wp on August 26, 2019, 07:54:35 pm
I could compile it in Lazarus (just because I'm not so familiar with the old Turbo Pascal user interface of the FP GUI any more). Changes required:
Good news: With these changes the project compiles.
Bad news: The screen is only black... So, you'll have to spend many happy hours of debugging.

Is this solution (theory and its formulas) still valid after almost 3 decades?
Believe it or not: Newton's Law of Gravity is still valid after more than 300 years.

Write it new again.
Yes, I agree. But I think the conversion is easier if the old source still can be brought back to life, just for comparison of the results etc. If you don't get happy with FPC you could also thinking of using the old original Turbo Pascal versions which are free now as "Antique Software" (https://web.archive.org/web/20040203055603/http://bdn.borland.com/museum/).
Title: Re: Attempt to compile a Turbo Pascal package from 1991
Post by: winni on August 26, 2019, 09:03:48 pm
Borland BGI was implemented very early into fpc. And it still exists!

Look: https://www.freepascal.org/docs-html/current/rtl/graph/initgraph.html (https://www.freepascal.org/docs-html/current/rtl/graph/initgraph.html)

Winni
Title: Re: Attempt to compile a Turbo Pascal package from 1991
Post by: jamie on August 26, 2019, 10:55:42 pm
I can convert that code over, I've replaced old BGI stuff with a windows type in a few old Pascal
programs over to Delphi, I am sure I can use the same technique with fpc/laz
 
 I see two folders there with the files in it, what's the difference ?

I guess I could give this a goo ;)
Title: Re: Attempt to compile a Turbo Pascal package from 1991
Post by: jamie on August 27, 2019, 01:10:17 am
I got it almost converted, had a little issue with the "Strings.pas" file, seems to be a compiler conflict, it wont take that first from an Include call verses a unit in the LIBS of fpc..

 It appears the compiler is putting Include file names at a lower priority when it is closer in the tree?

 Looks like I can convert this to a windows Widget set after it get it operating via the current state.
Title: Re: Attempt to compile a Turbo Pascal package from 1991
Post by: julkas on August 27, 2019, 09:58:54 am
Borland BGI was implemented very early into fpc. And it still exists!

Look: https://www.freepascal.org/docs-html/current/rtl/graph/initgraph.html (https://www.freepascal.org/docs-html/current/rtl/graph/initgraph.html)

Winni
Yes. I use FPC 3.0.4 Graph unit for testing and it works (... with minor issues on Vista 32b).
Title: Re: Attempt to compile a Turbo Pascal package from 1991
Post by: valdir.marcos on August 27, 2019, 08:55:41 pm
Is this solution (theory and its formulas) still valid after almost 3 decades?
Believe it or not: Newton's Law of Gravity is still valid after more than 300 years.
Everybody does know that.

Studies on Microbiology had evolved it a lot in the last 3 decades.
I beg your pardon, but what Newton's Gravity Law has to do with Nitrification (Microbiology) from original poster's algorithms?
https://github.com/icra/uct-model
https://github.com/icra/uct-model/blob/master/ActivatedSludgeSimulationProgrammes_1991_.pdf
https://en.wikipedia.org/wiki/Nitrification
Title: Re: Attempt to compile a Turbo Pascal package from 1991
Post by: TNoob on August 28, 2019, 04:19:32 am
(I assume) some Windows version
Oops, "assumption is the mother of all ..." I just noticed "Target OS: Linux for x86-64". So the sf link will be irrelevant too. But a virtual machine can still be your friend, at least you'll have it running without too much work. I tried with DOSBox (on Windows XP) and after some fiddling with paths it compiled and run (despite TPX throwing 'out of memory' when trying to start it, the .exe was there). I see no reason why it wouldn't work on Linux too.
Then, I read other replies and just learned that FPC does BGI graphics (good to know), so perhaps can compile it (almost) as is after all (with {$mode tp} probably). If it's worth or not, it all depends whether you need to just run it for the calculations or you want to develop it further.
Title: Re: Attempt to compile a Turbo Pascal package from 1991
Post by: jamie on September 03, 2019, 05:59:55 pm
I  made a CRTForm and redirected the WRITE IO over to it, put in the needed calls to support the program, GotoXY,TextCOlor, BackgroundColor , ClrScr etc...

 Looks like someone's home work at UTC

 At least there are pretty colors  :D
Title: Re: Attempt to compile a Turbo Pascal package from 1991
Post by: holalluis on October 03, 2019, 04:56:27 pm
I  made a CRTForm and redirected the WRITE IO over to it, put in the needed calls to support the program, GotoXY,TextCOlor, BackgroundColor , ClrScr etc...

 Looks like someone's home work at UTC

 At least there are pretty colors  :D

wow! great news jamie! can you upload the working package somewhere so I can try it? And if it works I'll merge it with the github package. thank you!
Title: Re: Attempt to compile a Turbo Pascal package from 1991
Post by: jamie on October 04, 2019, 01:05:22 am
The best I can do to get the files down is 8 megs.

I think that is too much for here..

 Adding the Include files to the project list throughs a fork into it, it thinks there should be a UNIT heading. So using the Published option does not work because I can't indicate the include all the files that are not listed in the project but are required.

 These include files have PAS extensions on them, most likely the issue..

 But I just tried something that may work...

 I'll attached it.


 
TinyPortal © 2005-2018