❌

Reading view

There are new articles available, click to refresh the page.

Lazarus and the Free Pascal Compiler Gain Dynamic Package Support

"Built with Free Pascal Lazarus" bannerIf you have developed in Pascal or Delphi in the past decades, you’re probably familiar with the Lazarus IDE that provides an interface to the Free Pascal Compiler (FPC), much like Delphi’s IDE. For users of Lazarus IDE there’s now an exciting new development, with the announcement that FPC and Lazarus now support dynamic packages.

The upshot of this is that you no longer need to rebuild the IDE if you want to add components, controls and Lazarus extensions. In addition you can use this same dynamic package feature in your own Pascal applications this way.

Naturally this is a great improvement, and it’s good to see more improvements to such a venerable programming language. Not only is it still being used today for just about anything, including web development, but there is a good case to be made for using Pascal today as it’s no longer the language it was half a decade ago.

We’d also be remiss to not mention the legacy of [Niklaus Wirth], who not only created Pascal, but was also instrumental in the development of Object Pascal together with Apple. This effort ultimately led to everything from Turbo Pascal to Delphi, FPC and so much more, making it a heartening sight to see this legacy being kept alive today.

Visualize Regular Expressions with Marbles

If you are one of those people who visualize things physically better than in the abstract, then Regex Marble Run by [bottomless] might be for you. You enter a test expression and a string, and the site generates a virtual marble machine that lets you see the regular expression pick apart the string in a physical way.

Click this link, and you’ll see the regular expression β€œ^[hH]ack.[dD][^0-9]*$” which, if you aren’t a regular expression user, might seem a bit cryptic. However, it is fairly simple if you take it bit-by-bit.

The caret character tells it to match the start of the string. So β€œ^dog” will match β€œdog” and β€œdog food” but won’t match β€œfood for a dog.” The following bit β€œ[hH]” will match either β€œh” or β€œH”. Then there is β€œack” which is just what you think it is. So a string starting with β€œhack” or β€œHack” might match (depending on the rest of the expression.

The period means match any single character. Then there’s another β€œ[]” but this time with β€œdD” to match any kind of D. The next β€œ[]” character class is a range from 0-9, but since there is a caret, the match is negated. So β€œ[^0-9]” means match anything except a digit from 0 to 9. The β€œ*” means we can have zero or more of these. So β€œHackxD” matches, but so does β€œHackxDXYZabc” for now. Trick question: Does β€œHackxDXYZabc123” match? So far, yes, but it only matches to the lowercase β€œc” character.

The final character, β€œ$” means end of string. So now β€œHackxDXYZabc123” does not match because we are still in the middle of the string. However, β€œHackxDXYZabc” will match since the previous β€œ*” β€œate” the rest of the string.

Head spinning? The site will let you see each letter of a test string as a marble that falls through the different parts of the regular expression. Balls that pass wind up in the left-hand box, while failures are in the right-hand box. Will it help you? We don’t know, but it is fun to watch.

Want a refresher on regular expressions? Or perhaps you want some practice?

Mars Pathfinder: What Really Happened?

You’ve probably heard of Mars Pathfinder, the NASA lander and its Sojourner rover that took up residence on Mars in 1997. At first, all was well, but after a few days, the lander suffered a series of total system resets. A watchdog timer detected a problem and forced reboots. [Vivek Bhageria’s] recent post looks into what happened and the eventual solution.

The root cause was priority inversion. This happens when a lower-priority task holds a resource needed by a higher-priority task and prevents the higher-priority task from executing. In this case, the operating system was VxWorks, but this can happen on any kind of priority scheduling system.

The simplified version is that there were two tasks that each used the same mutex to avoid stepping on each other. The highest priority was a data distribution task. The lowest priority task dealt with meteorology data processing. There was also a medium-priority task that handled bus maintenance.

The failure would occur when the low-priority task had the mutex and lost its time slot before releasing it. The high-priority task would then find it couldn’t take the mutex. However, the low-priority task didn’t get control again because of the medium-priority tasks waiting to run.

In effect, the high-priority task was now waiting on something that couldn’t become available until the lowest-priority task was able to run. That’s priority inversion.

Sadly, engineers noticed this happening occasionally during testing but, as we are often prone to do, they chalked it up to glitches. As one of our old bosses used to say: β€œIf you don’t know why it happened, then you don’t know that it won’t happen again.”

VxWorks, of course, understands that this might happen and, luckily, there was enough capability on the spacecraft to turn priority inheritance on for the mutex in question. This allows the low-priority task to get a boost because a higher-priority task is waiting on it.

You can read more about the details in the post. We also covered this a decade ago with our own analysis.

The EDG C++ Compiler Frontend has been Open Sourced

Recently [John Spicer] of the EDG C++ compiler front-end project announced that the project will be made open source, from now on managed by the non-profit C++ Alliance. Related source code can be found on the GitHub account.

The Edison Design Group (EDG) is a US company which has made compiler front-ends since 1988, previously also for Java and Fortran. They are used in the Intel C++ compiler, Microsoft’s VC++, NVIDIA’s CUDA compiler, as well as many other commercial products. Last year the decision was made to shutdown the company in 2026 and transition to an open source model, with the details outlined on the EDGCPP site.

Although far from the only C++ front-end, EDGCPP will be very interesting still for supporting bleeding-edge features and having been used in such wide-ranging, demanding applications by a host of commercial customers. For most of us C++ developers our contact with it will have been via the MSVC and Intel Compiler Collection tooling, but of course it’s just one part of the entire toolset.

We’re looking forward to seeing what this means for the wider open source C++ ecosystem, especially as it pertains to GCC and LLVM’s Clang.

❌