Recent

Author Topic: Attempt to compile a Turbo Pascal package from 1991  (Read 3260 times)

holalluis

  • Newbie
  • Posts: 2
Attempt to compile a Turbo Pascal package from 1991
« 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

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


Thank you
« Last Edit: August 26, 2019, 04:07:07 pm by holalluis »

valdir.marcos

  • Hero Member
  • *****
  • Posts: 1106
Re: Attempt to compile a Turbo Pascal package from 1991
« Reply #1 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

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


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?

TNoob

  • New member
  • *
  • Posts: 9
Re: Attempt to compile a Turbo Pascal package from 1991
« Reply #2 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.

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: Attempt to compile a Turbo Pascal package from 1991
« Reply #3 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

wp

  • Hero Member
  • *****
  • Posts: 11857
Re: Attempt to compile a Turbo Pascal package from 1991
« Reply #4 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:
  • All the units having "unit" in their name (e.g. "GRAPHUNIT.PAS") are "real" units; the other files are include files - this is the reason why they simply begin with "procedure". FPC does not seem to like it. Rename these files to have the extension ".inc" instead of ".pas". Note: in many unit files there is a list of included files, e.g. {$I STRINGS.PAS} - apply the .inc here too! (--> {$I STRINGS.INC}).
  • The project links the old BGI drivers and font files. FPC does not seem to like them  (at least I don't know how to fix this). In unit "INITUNIT.PAS" remove the units Drivers and Fonts from the uses list. In "DETECT.INC" remove the blocks commented as {Register all the drivers} and {Register all the fonts} which are responsible for linking the corresponding .obj files.
  • When you intend to run the program under Linux make sure of the case of all filenames. Lazarus sets all files to lowercase while this project has everything in uppercase - this calls for trouble under Linux.
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/).
« Last Edit: October 04, 2019, 01:09:47 am by wp »

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: Attempt to compile a Turbo Pascal package from 1991
« Reply #5 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

Winni

jamie

  • Hero Member
  • *****
  • Posts: 6090
Re: Attempt to compile a Turbo Pascal package from 1991
« Reply #6 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 ;)
The only true wisdom is knowing you know nothing

jamie

  • Hero Member
  • *****
  • Posts: 6090
Re: Attempt to compile a Turbo Pascal package from 1991
« Reply #7 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.
The only true wisdom is knowing you know nothing

julkas

  • Guest
Re: Attempt to compile a Turbo Pascal package from 1991
« Reply #8 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

Winni
Yes. I use FPC 3.0.4 Graph unit for testing and it works (... with minor issues on Vista 32b).

valdir.marcos

  • Hero Member
  • *****
  • Posts: 1106
Re: Attempt to compile a Turbo Pascal package from 1991
« Reply #9 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
« Last Edit: August 28, 2019, 01:53:33 am by valdir.marcos »

TNoob

  • New member
  • *
  • Posts: 9
Re: Attempt to compile a Turbo Pascal package from 1991
« Reply #10 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.

jamie

  • Hero Member
  • *****
  • Posts: 6090
Re: Attempt to compile a Turbo Pascal package from 1991
« Reply #11 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
The only true wisdom is knowing you know nothing

holalluis

  • Newbie
  • Posts: 2
Re: Attempt to compile a Turbo Pascal package from 1991
« Reply #12 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!

jamie

  • Hero Member
  • *****
  • Posts: 6090
Re: Attempt to compile a Turbo Pascal package from 1991
« Reply #13 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.


 
The only true wisdom is knowing you know nothing

 

TinyPortal © 2005-2018