Recent

Author Topic: [CLOSED] TP/BP compatibility  (Read 8842 times)

Thaddy

  • Hero Member
  • *****
  • Posts: 18523
  • Here stood a man who saw the Elbe and jumped it.
Re: TP/BP compatibility
« Reply #15 on: August 03, 2019, 09:08:49 pm »
Ok, so search and replace.

WHAT are you are going to search and replace? I hope only your own code to make it compatible and not the other way around!
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: TP/BP compatibility
« Reply #16 on: August 03, 2019, 11:27:00 pm »
I found also this -  program lines have a maximum length of 126 characters.
O great old Pascal!
Who knows - why 126?

High(ShortInt) - one char. line separator?
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

julkas

  • Guest
Re: TP/BP compatibility
« Reply #17 on: August 04, 2019, 11:00:25 am »
I found also this -  program lines have a maximum length of 126 characters.
O great old Pascal!
Who knows - why 126?

High(ShortInt) - one char. line separator?
You mean (2**7-1)-1? May be. Good observation.
TP7 documentation is great. I enjoy reading.
Offtopic - Why TP7 is still closed source? What is the reason?

ASerge

  • Hero Member
  • *****
  • Posts: 2469
Re: TP/BP compatibility
« Reply #18 on: August 04, 2019, 12:32:33 pm »
Offtopic - Why TP7 is still closed source? What is the reason?
In order of succession: Borland - CodeGear - Embarcadero, this question to the last company.

440bx

  • Hero Member
  • *****
  • Posts: 5894
Re: TP/BP compatibility
« Reply #19 on: August 04, 2019, 01:01:24 pm »
Offtopic - Why TP7 is still closed source? What is the reason?
Serge is right, that question should be directed to Embarcadero (or the company who owns them.)

It occurred to me that, if Embarcadero sold the TP7 source code at a low price (ballpark $29.99), there would probably be quite a few people interested.

FPC v3.2.2 and Lazarus v4.0rc3 on Windows 7 SP1 64bit.

julkas

  • Guest
Re: TP/BP compatibility
« Reply #20 on: August 04, 2019, 03:32:18 pm »
How declare unsigned DWORD integer in TP7 ?

440bx

  • Hero Member
  • *****
  • Posts: 5894
Re: TP/BP compatibility
« Reply #21 on: August 04, 2019, 03:42:09 pm »
How declare unsigned DWORD integer in TP7 ?
TP7 does _not_ support unsigned 32bit integers.

To manipulate unsigned 32bit integers (which you are forced to declared as signed, since there is no alternative) you have to typecast them to pchar.  The typecast to pchar causes the code to use relational operators that consider the quantity unsigned.

Disclaimer: I know the above works with Delphi 2 because I routinely use it.  I don't remember if it works/worked with TP7.



FPC v3.2.2 and Lazarus v4.0rc3 on Windows 7 SP1 64bit.

julkas

  • Guest
Re: TP/BP compatibility
« Reply #22 on: August 04, 2019, 03:55:20 pm »
How declare unsigned DWORD integer in TP7 ?
TP7 does _not_ support unsigned 32bit integers.

To manipulate unsigned 32bit integers (which you are forced to declared as signed, since there is no alternative) you have to typecast them to pchar.  The typecast to pchar causes the code to use relational operators that consider the quantity unsigned.

Disclaimer: I know the above works with Delphi 2 because I routinely use it.  I don't remember if it works/worked with TP7.
Any ready to use code?

wp

  • Hero Member
  • *****
  • Posts: 13267
Re: TP/BP compatibility
« Reply #23 on: August 04, 2019, 04:00:02 pm »
Living deads: ****** ... (no idea whether this site is legal).

Moderator notice: if you don't know if a link with proprietary software is legal, then don't post it.
« Last Edit: August 04, 2019, 04:49:34 pm by marcov »

440bx

  • Hero Member
  • *****
  • Posts: 5894
Re: TP/BP compatibility
« Reply #24 on: August 04, 2019, 04:05:08 pm »
Any ready to use code?
Not TP7 code.  I don't even remember the last time I used TP7 but, I can provide an example, for instance
Code: Pascal  [Select][+][-]
  1. var
  2.   V1 : integer;
  3.   V2 : integer;
  4. ...
  5. begin
  6.   { unsigned comparison }
  7.   if pchar(V1) < pchar(V2) then <do something>
  8. end.
I know the above works with Delphi 2, I am not sure if it works with TP7.  I'd have to look at the code it generates (i.e, does it generate jl (signed) or jb (unsigned))
FPC v3.2.2 and Lazarus v4.0rc3 on Windows 7 SP1 64bit.

Thaddy

  • Hero Member
  • *****
  • Posts: 18523
  • Here stood a man who saw the Elbe and jumped it.
Re: TP/BP compatibility
« Reply #25 on: August 04, 2019, 05:28:12 pm »
I believe there's no sourcecode there. It is probably a means of running one of the free versions of TP/BP from the Borland museum in DosBox.
TP/BP are orginally written in hand-optimized TASM and is quite unreadable and not even properly documented.
I saw parts of it while working at Borland during an exchange program.

Even if it was open sourced it would not be very useful.
The Borland family and children have never been self-hosted compilers like FPC is.
Note TP mode is nearly 100% able to compile real TP code. It has more options, so the other way around is not true.
« Last Edit: August 04, 2019, 05:35:18 pm by Thaddy »
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.

julkas

  • Guest
Re: TP/BP compatibility
« Reply #26 on: August 04, 2019, 05:40:51 pm »
Any ready to use code?
Not TP7 code.  I don't even remember the last time I used TP7 but, I can provide an example, for instance
Code: Pascal  [Select][+][-]
  1. var
  2.   V1 : integer;
  3.   V2 : integer;
  4. ...
  5. begin
  6.   { unsigned comparison }
  7.   if pchar(V1) < pchar(V2) then <do something>
  8. end.
I know the above works with Delphi 2, I am not sure if it works with TP7.  I'd have to look at the code it generates (i.e, does it generate jl (signed) or jb (unsigned))
See btypes unit of  Wolfgang Ehrhardt util package.

440bx

  • Hero Member
  • *****
  • Posts: 5894
Re: TP/BP compatibility
« Reply #27 on: August 04, 2019, 05:54:12 pm »
See btypes unit of  Wolfgang Ehrhardt util package.
Thank you.  For the times I need unsigned 32bit integers, typecasting to pchar does the job.

I have no doubt that Wolfgang's units provide a lot more but, so far, I have rarely needed more.
FPC v3.2.2 and Lazarus v4.0rc3 on Windows 7 SP1 64bit.

julkas

  • Guest
Re: TP/BP compatibility
« Reply #28 on: August 04, 2019, 06:11:03 pm »
I believe there's no sourcecode there. It is probably a means of running one of the free versions of TP/BP from the Borland museum in DosBox.
TP/BP are orginally written in hand-optimized TASM and is quite unreadable and not even properly documented.
I saw parts of it while working at Borland during an exchange program.

Even if it was open sourced it would not be very useful.
The Borland family and children have never been self-hosted compilers like FPC is.
Note TP mode is nearly 100% able to compile real TP code. It has more options, so the other way around is not true.
Its your opinion. I don't think so.

Thaddy

  • Hero Member
  • *****
  • Posts: 18523
  • Here stood a man who saw the Elbe and jumped it.
Re: TP/BP compatibility
« Reply #29 on: August 04, 2019, 06:25:22 pm »
Its your opinion. I don't think so.
Prove me wrong.... You can't. End of story.

And plz do not come up with hacks that rely on compiler internals. Stick to the language supported by TP/BP.
(You could write self modifying code in TP, you are hard-pressed to do the same in FPC {$mode TP}
« Last Edit: August 04, 2019, 06:28:49 pm by Thaddy »
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.

 

TinyPortal © 2005-2018