[fpc-devel] Compiler message colour scheme

Alexander Grotewohl alex at dcclost.com
Mon Nov 23 02:23:01 CET 2020

I would probably do something like this:

ansi_colors: array[0..7] of char = ('0', '4', '2', '6', '1', '5', '3', '7');

procedure PrintColor(fg, bg: byte; s: string);
tmp: string;

PrintColor(2, 0, 'derp');

Easy enough to remember pascal style color numbers.

Alexander Grotewohl
From: fpc-devel <fpc-devel-bounces at lists.freepascal.org> on behalf of J. Gareth Moreton via fpc-devel <fpc-devel at lists.freepascal.org>
Sent: Sunday, November 22, 2020 7:59 PM
To: Ryan Joseph via fpc-devel <fpc-devel at lists.freepascal.org>
Cc: J. Gareth Moreton <gareth at moreton-family.com>
Subject: Re: [fpc-devel] Compiler message colour scheme

I'm getting there.  I keep getting distracted or lost though! Hardware
failures don't help!

I'm trying a different approach this time and writing a whitepaper like
I've done with my more major changes for Free Pascal, so I can describe
its uses and how it works etc.  It can be updated of course, but it
means I have something to refer to if I lose my way, and others can
better add to the concept.

In the case of that PrintColor example, I don't think it could be
inlined, for example, due to the call to IntToStr, among other things
(like if you call PrintColor with a non-constant actual parameter), but
if IntToStr were a pure function as well (and there's no reason why it
can't), then logically GenerateColorCode could easily be pure.

I'm glad there's still interest in pure functions.  It may be a while
though, and I'm being tempted with a bounty and Patreon pledges to
implement "static single assignment" into the Free Pascal Compiler.
That will take some research to see if it's even possible and not prone
to completely breaking things!

First things first though, I've got a bug to fix in AArch64, and on the
same platform, I'm almost finshed implementing the optimisation that
turns division by a constant into a multiplication and shift.

Gareth aka. Kit

On 22/11/2020 21:37, Ryan Joseph via fpc-devel wrote:
>> On Nov 22, 2020, at 10:09 AM, J. Gareth Moreton via fpc-devel <fpc-devel at lists.freepascal.org> wrote:
>> Personally I'd write the function as something like "function GenerateColorCode(codes: array of Byte): ansistring;", mostly in anticipation of pure functions, because then the compiler can just replace the call with the relevant string at compile time, but that's a long way off!
> That would great. Hopefully this gets finished some day.
> Regards,
>        Ryan Joseph
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

This email has been checked for viruses by Avast antivirus software.

fpc-devel maillist  -  fpc-devel at lists.freepascal.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20201123/4420657f/attachment.htm>

More information about the fpc-devel mailing list