The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 2,163 other followers

Archive for the ‘Pascal’ Category

SEP92: A VIDEO COMPATIBILITY INTERFACE FOR TURBO DEBUGGER

Posted by jpluimers on 2020/11/26

[WayBack] SEP92: A VIDEO COMPATIBILITY INTERFACE FOR TURBO DEBUGGER

Blast from the past, which reminds me of the days that Peter Sawatzki used this interface to write a DLL that allowed Turbo Debugger for Windows (TDW) run on a secondary monochrome screen using a special TDVIDEO.DLL.

That way you could debug Windows applications without distorting the screens, highly speeding up the debugging process.

Lot’s of stuff from that era got never archived, so I wish I could have found it in my archive, but I seem to have lost it.

Found via:

–jeroen

Posted in Debugging, Development, Software Development, Turbo Pascal | Leave a Comment »

Delphi and conditional compilation

Posted by jpluimers on 2020/10/15

There are various ways for Delphi code to verify what features are available.

Historically, testing for the existence of VER### defines with $IFDEF or $IFNDEF is the oldest means, and as of Delphi 6, you can also test for the existence and values of identifiers is $IF defined, $IF not defined and, especially for CompilerVersion and RTLVersion .

My versioned PowerShell script List-Delphi-Installed-Packages.ps1 tries to keep an up to date list of versions and features starting with BDS 1 (which was C# Builder) and BDS 2 (which was Delphi 8 with VER160). One day I will make it Pascal based in stead of BDS based.

The JEDI Code Library has kept a versioned JEDI.INC up to date since Delphi 1.0.

Binding those to specific features can be a tough thing when you depend on version numbers, but less hard when you rely on feature names.

Every couple of years, people start proposing units to replace include files, usually with an argument like this:

If you forget to include it into your source code, all your IFDEFS will fail and in the worst case your workaround won’t be active (the best case is that the compiler runs into an error so you will notice the missing include).

The problem is that for such a unit to work:

  1. you have to always use it (debunking the above argument)
  2. you will need to have the very latest version, even if you use old compilers (so you can use code written for any Delphi version)
    • See the quoted below “Do you expect that the old versions will get an update to know the new constants RTLVersion_Atlantis = 99.0; too?” below
  3. you need a central place where that version is available (like JEDI.INC)
  4. it will only work with booleans
    • See the quote below “Which is also backwards compatible because the compiler (at least in XE and up, haven’t checked any older versions) just evaluates a non existing value as False.”
  5. it requires $IF, which is a pain in the ass
    • See the quote below “Using $IF is a major pita because of $IFEND or $ENDIF depending on compiler version and $LEGACYIFEND setting.”

The only good thing is what Rudy Velthuis commented:

checking for a $DEFINE like DELPHI_RIO_UP can go wrong. If you have a typo, it will simply not be recognized as defined and compile the wrong code. Checking for {$IF CompilerVersion >= some_constant} will fail to compile if some_constant is not defined

A few people tried:

JEDI.INC

You might think that JEDI.INC was only introduced in 2003, but it is in fact much older as the JEDI Code Library had its own version control system (initially called FreeVCS) before first switching to SVN and later to GIT.

So these are only part of the history:

VER### got introduced as VER40 in Turbo Pascal 4

The product naming mess now completely has disconnected people from binding it to their Delphi version.

It helps knowing that VER### is the compiler version starting with Turbo Pascal 1, and remembering that Delphi 1 had VER80, and the three digits only started with Delphi 3 which introduced VER100.

Turbo Pascal 1 through 3 did not have any VER## defined, despite some sites

The first ever VER## conditional define was VER40 was introduced in Turbo Pascal 4, as you can see in Full text of “borland :: turbo pascal :: Turbo Pascal Version 4.0 Owners Manual 1987” (or PDF via borland :: turbo pascal :: Turbo Pascal Version 4.0 Owners Manual 1987 : Free Download, Borrow, and Streaming : Internet Archive)

Related:

JEDI History:

–jeroen

Read the rest of this entry »

Posted in Delphi, Development, Software Development, Turbo Pascal | Leave a Comment »

Reverse engineering Delphi and Turbo Pascal unit interfaces (and maybe DCP files too)

Posted by jpluimers on 2020/10/07

Boy, I wish there was both an Embarcadero sanctioned grammar (see Delphi code completion fail with anonymous methods – Stack Overflow) and a DCU parser.

This might work for DCP files as well, since the PKX0 signature at the start of DCP files is in [WayBack] DCU32INT/DCP.pas at master · rfrezino/DCU32INT · GitHub.

Being able to dump DCP files makes it way easier to create documenting a matrix of all DCP files and units, to their interdependencies and containments become clear (including any unit scopes).

Right now that is only documented from the unit to the package on the page of the unit (see for instance [WayBack] System.SysUtils – RAD Studio API Documentation), not the other way around. This is a pain to select which packages you need in your project when building with packages.

The list at [WayBack] Unit List – RAD Studio API Documentation (which actually is an “Alphabetical list of unit scopes, along with miscellaneous units that have no unit scope.” is only partially helpful, especially as for instance the System unit page at [WayBack] System – RAD Studio API Documentation is 90% about the System unit scope, has the System unit itself about a 3rd down and does not mention it lives in the rtl.dcp package.

The list at [WayBack] Deciding Which Runtime Packages to Use – RAD Studio is even worse than the unit list, as it misses many useful packages (like dsnap)

For my link archive:

Johan wanted to create a compiler symbol table from the binary DCU files (unlike DelphiAST which does it from the Pascal source files).

From the pre-Delphi era, I found back some info from my own archive:

In the Turbo Pascal days, you had TW1UNA and TPUUNA by William L. Peavy, which I think led to INTRFC from Duncan Murdoch (or maybe vice versa) which got updated to Turbo/Borland Pascal 7 format by Milan Dadok (see http://sources.ru/pascal/hacker/intrfc70.htm). Since the basic format of DCU files is very similar to that, my guess is that DCU32INT built on that.

Later I found The Programmer’s Corner » TPU60C.ZIP » Pascal Source Code also by William L. Peavy and [WayBack] Duncan Murdoch’s Programs.

–jeroen

Posted in Borland Pascal, Delphi, Development, History, Pascal, Software Development, Turbo Pascal | Leave a Comment »

Crosscompiling with Lazarus 1.8 on Linux Mint 18.3 | The Programming Works

Posted by jpluimers on 2020/01/08

As I will likely need this one day: [Archive.is / WayBackCrosscompiling with Lazarus 1.8 on Linux Mint 18.3 | The Programming Works.

There are quite a few one-time manual setups to initially set this up, but after that it’s a piece of cake.

via:

–jeroen

Read the rest of this entry »

Posted in Development, FreePascal, Lazarus, Pascal, Software Development | Leave a Comment »

GitHub – Libaud/POLCLVCLISO: Pascal Object LCL and VCL ISO standards implementation for CodeTyphon, Delphi, Lazarus

Posted by jpluimers on 2020/01/02

For my link archive: GitHub – Libaud/POLCLVCLISO: Pascal Object LCL and VCL ISO standards implementation for CodeTyphon, Delphi, Lazarus

It implements these standards:

  • ISO standard 3166-1, 3166-2, 3166-3 implementation
    • (all part of the ISO 3166 – Wikipedia that “defines codes for the names of countries, dependent territories, special areas of geographical interest, and their principal subdivisions)”
  • ISO standard 4217 implementation
    • ISO 4217 – Wikipedia  “delineates currency designators, country codes (alpha and numeric)” where the country codes are the same as in ISO 3166
  • ITU E.164 standard implementation
    • E.164 – Wikipedia “E.164 defines a general format for international telephone numbers. Plan-conforming numbers are limited to a maximum of 15 digits, excluding the international call prefix.”

A library like this needs monitoring the standards changes, so hopefully Libaud will do that.

Some of my posts related to ISO 3166 are below.

–jeroen

Related:

 

Posted in Delphi, Development, FreePascal, Lazarus, Pascal, Software Development | Leave a Comment »

 
%d bloggers like this: