Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2020-11

Compiler message colour scheme

38 messages · 11 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

J. Gareth Moreton

Hi everyone,

This might be me being a little bit picky, but I noticed the new colouring scheme for words like "Warning" and "Error" in the output logs.  Is there any particular reason why "Warning" is in magenta?  Normally the convention is that it's yellow (and "Error" in red).  Granted, it's purely cosmetic.

Gareth aka. Kit

This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus

Reply by email

Ryan Joseph
to J. Gareth Moreton
Show quoted text 7 lines
On Nov 22, 2020, at 7:59 AM, J. Gareth Moreton via fpc-devel wrote: Hi everyone, This might be me being a little bit picky, but I noticed the new colouring scheme for words like "Warning" and "Error" in the output logs. Is there any particular reason why "Warning" is in magenta? Normally the convention is that it's yellow (and "Error" in red). Granted, it's purely cosmetic. Gareth aka. Kit

What version of the trunk is this in and what's the flag to enable it? My trunk is maybe 30 days old and I don't see any way to get the colors.

Regards,
Ryan Joseph

Reply by email

J. Gareth Moreton
to Ryan Joseph

I'm using the latest trunk on arm-linux.  I'm pretty sure it's in the FPC source and not some quirk with the Raspian OS's terminal because the escape sequences appear in the "Console In/Output" debug window in Lazarus.

Gareth aka. Kit

Ryan Joseph wrote 17 lines
> On Nov 22, 2020, at 7:59 AM, J. Gareth Moreton via fpc-devel wrote: > > Hi everyone, > > This might be me being a little bit picky, but I noticed the new colouring scheme for words like "Warning" and "Error" in the output logs. Is there any particular reason why "Warning" is in magenta? Normally the convention is that it's yellow (and "Error" in red). Granted, it's purely cosmetic. > > Gareth aka. Kit What version of the trunk is this in and what's the flag to enable it? My trunk is maybe 30 days old and I don't see any way to get the colors. Regards, Ryan Joseph _______________________________________________ fpc-devel maillist - https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus

Reply by email

Kirinn
to J. Gareth Moreton: This might be me being a little bit picky, but I noticed the new colouring scheme for…

The feature request was here: https://bugs.freepascal.org/view.php?id=37331

It's magenta because GCC etc use magenta for warnings too. Actually, for those of us with white terminal backgrounds, yellow text would be hard to see, while green, red, and magenta appear quite well against both a black and a white background.

I hope a new FPC release happens sooner rather than later; colored output is really nice to have.

~Kirinn

J. Gareth Moreton wrote 11 lines
Hi everyone, This might be me being a little bit picky, but I noticed the new colouring scheme for words like "Warning" and "Error" in the output logs.  Is there any particular reason why "Warning" is in magenta?  Normally the convention is that it's yellow (and "Error" in red).  Granted, it's purely cosmetic. Gareth aka. Kit

Reply by email

Michael Van Canneyt
to Jonas Maebe
Jonas Maebe wrote
On 22/11/2020 16:03, Ryan Joseph via fpc-devel wrote: > What version of the trunk is this in and what's the flag to enable it? My trunk is maybe 30 days old and I don't see any way to get the colors. It's only enabled on Linux and Windows currently.

Is there a switch to disable it ?
The lazarus parser doesn't need color, it supplies it's own in the messages dialog.

I looked in the help but could not see one, maybe it was forgotten.

Michael.

Reply by email

Sven Barth
to Michael Van Canneyt

Michael Van Canneyt via fpc-devel schrieb
am So., 22. Nov. 2020, 17:03:

Show quoted text 16 lines
On Sun, 22 Nov 2020, Jonas Maebe via fpc-devel wrote: > On 22/11/2020 16:03, Ryan Joseph via fpc-devel wrote: >> What version of the trunk is this in and what's the flag to enable it? My trunk is maybe 30 days old and I don't see any way to get the colors. > > It's only enabled on Linux and Windows currently. Is there a switch to disable it ? The lazarus parser doesn't need color, it supplies it's own in the messages dialog. I looked in the help but could not see one, maybe it was forgotten.

It's only enabled if the output is to a TTY and not a pipe (analogous on Windows).

Regards,
Sven

Reply by email

Sven Barth
to J. Gareth Moreton: This might be me being a little bit picky, but I noticed the new colouring scheme for…
J. Gareth Moreton wrote 7 lines
Hi everyone, This might be me being a little bit picky, but I noticed the new colouring scheme for words like "Warning" and "Error" in the output logs.  Is there any particular reason why "Warning" is in magenta?  Normally the convention is that it's yellow (and "Error" in red).  Granted, it's purely cosmetic.

Both GCC and Clang use magenta for warnings as well. So considering that FPC follows the convention. ;)

Regards,
Sven

Reply by email

Sven Barth
to Kirinn: The feature request was here: https://bugs.freepascal.org/view.php?id=37331 It's magenta…
Kirinn wrote 10 lines
The feature request was here: https://bugs.freepascal.org/view.php?id=37331 It's magenta because GCC etc use magenta for warnings too. Actually, for those of us with white terminal backgrounds, yellow text would be hard to see, while green, red, and magenta appear quite well against both a black and a white background. I hope a new FPC release happens sooner rather than later; colored output is really nice to have.

The next major release is a year or two away. Don't know if we'll merge that back to fixes...

Regards,
Sven

Reply by email

J. Gareth Moreton
to Sven Barth: Both GCC and Clang use magenta for warnings as well. So considering that FPC follows the…

Fair enough then!  I always thought yellow was for warnings, red was for errors and white was for notes, but if GCC says otherwise, I can't argue!

Gareth aka. Kit

Sven Barth wrote 18 lines
Am 22.11.2020 um 15:59 schrieb J. Gareth Moreton via fpc-devel: > Hi everyone, > > This might be me being a little bit picky, but I noticed the new > colouring scheme for words like "Warning" and "Error" in the output > logs.  Is there any particular reason why "Warning" is in magenta?  > Normally the convention is that it's yellow (and "Error" in red).  > Granted, it's purely cosmetic. Both GCC and Clang use magenta for warnings as well. So considering that FPC follows the convention. ;) Regards, Sven _______________________________________________ fpc-devel maillist  -  https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus

Reply by email

J. Gareth Moreton
to Sven Barth: Michael Van Canneyt via fpc-devel schrieb am So., 22. Nov. 2020, 17:03: It's only…

I believe that to enable colour on a Windows console, you need to use an API function, which can get a bit clumsy because there isn't an equivalent to \e[0m to reset to default, so you have to retrieve the current console colour beforehand.  Windows 10 /might/ accept the ANSI escape sequences, but I'm not sure.

Gareth aka. Kit

Sven Barth wrote 32 lines
Michael Van Canneyt via fpc-devel < > schrieb am So., 22. Nov. 2020, 17:03: On Sun, 22 Nov 2020, Jonas Maebe via fpc-devel wrote: > On 22/11/2020 16:03, Ryan Joseph via fpc-devel wrote: >> What version of the trunk is this in and what's the flag to enable it? My trunk is maybe 30 days old and I don't see any way to get the colors. > > It's only enabled on Linux and Windows currently. Is there a switch to disable it ? The lazarus parser doesn't need color, it supplies it's own in the messages dialog. I looked in the help but could not see one, maybe it was forgotten. It's only enabled if the output is to a TTY and not a pipe (analogous on Windows). Regards, Sven _______________________________________________ fpc-devel maillist - https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus

Reply by email

Florian Klämpfl
to Ryan Joseph
Ryan Joseph wrote 7 lines
> On Nov 22, 2020, at 8:57 AM, Jonas Maebe via fpc-devel wrote: > > It's only enabled on Linux and Windows currently. Why is that? Mac has colors in the terminal also.

Because I have no Mac so I couldn't test it.

Reply by email

J. Gareth Moreton
to Florian Klämpfl

Most modern Macs are Unix-based, so the escape sequences should work, right? Granted, I think we need someone with a Mac or a Mac virtual machine to test it for sure.

Gareth aka. Kit

Florian Klämpfl wrote 15 lines
Am 22.11.2020 um 17:23 schrieb Ryan Joseph via fpc-devel: > > >> On Nov 22, 2020, at 8:57 AM, Jonas Maebe via fpc-devel >> wrote: >> >> It's only enabled on Linux and Windows currently. > > Why is that? Mac has colors in the terminal also. Because I have no Mac so I couldn't test it. _______________________________________________ fpc-devel maillist  -  https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus

Reply by email

Sven Barth
to J. Gareth Moreton: I believe that to enable colour on a Windows console, you need to use an API function,…
J. Gareth Moreton wrote 7 lines
I believe that to enable colour on a Windows console, you need to use an API function, which can get a bit clumsy because there isn't an equivalent to \e[0m to reset to default, so you have to retrieve the current console colour beforehand.  Windows 10 /might/ accept the ANSI escape sequences, but I'm not sure.

On Windows the code checks whether the VT100 compatibility is available that was introduced with some Windows 10 update and only uses the VT100 codes in that case.

Regards,
Sven

Reply by email

Sven Barth
to J. Gareth Moreton: Most modern Macs are Unix-based, so the escape sequences should work, right? Granted, I…
J. Gareth Moreton wrote
Most modern Macs are Unix-based, so the escape sequences should work, right? Granted, I think we need someone with a Mac or a Mac virtual machine to test it for sure.

Considering that Jonas doesn't support the textmode IDE on macOS because of - if I remember correctly - problems with the terminal I wouldn't be too sure that it's fully compatible. Though granted, for colored output it should be enough...

Regards,
Sven

Reply by email

Jonas Maebe
to Sven Barth
Sven Barth wrote 7 lines
Am 22.11.2020 um 17:40 schrieb J. Gareth Moreton via fpc-devel: > Most modern Macs are Unix-based, so the escape sequences should work, > right? Granted, I think we need someone with a Mac or a Mac virtual > machine to test it for sure. Considering that Jonas doesn't support the textmode IDE on macOS because of - if I remember correctly - problems with the terminal

No, the terminal works fine with it (apart from mouse support, which only works if you use Xterm). I don't support it because the IDE is not really maintained by anyone, and I don't want to maintain or debug it either (so if someone would report a bug on macOS with it, it would just sit there forever).

Jonas

Reply by email

J. Gareth Moreton
to Kirinn: The feature request was here: https://bugs.freepascal.org/view.php?id=37331 It's magenta…

That's a fair point. Good call.

Gareth aka. Kit

Kirinn wrote 30 lines
The feature request was here: https://bugs.freepascal.org/view.php?id=37331 It's magenta because GCC etc use magenta for warnings too. Actually, for those of us with white terminal backgrounds, yellow text would be hard to see, while green, red, and magenta appear quite well against both a black and a white background. I hope a new FPC release happens sooner rather than later; colored output is really nice to have. ~Kirinn On 11/22/20 2:59 PM, J. Gareth Moreton via fpc-devel wrote: > Hi everyone, > > This might be me being a little bit picky, but I noticed the new > colouring scheme for words like "Warning" and "Error" in the output > logs.  Is there any particular reason why "Warning" is in magenta?  > Normally the convention is that it's yellow (and "Error" in red).  > Granted, it's purely cosmetic. > > Gareth aka. Kit > > _______________________________________________ fpc-devel maillist  -  https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus

Reply by email

Ryan Joseph
to Florian Klämpfl: Because I have no Mac so I couldn't test it.
On Nov 22, 2020, at 9:29 AM, Florian Klämpfl via fpc-devel wrote: Because I have no Mac so I couldn't test it.

I see. It's this easy.

const
  ANSI_FORE_BLACK           = 30;
  ANSI_FORE_RED             = 31;
  ANSI_FORE_GREEN           = 32;
  ANSI_FORE_YELLOW          = 33;
  ANSI_FORE_BLUE            = 34;
  ANSI_FORE_MAGENTA         = 35;
  ANSI_FORE_CYAN            = 36;
  ANSI_FORE_WHITE           = 37;
  ANSI_FORE_RESET           = 39;
  ANSI_BACK_BLACK           = 40;
  ANSI_BACK_RED             = 41;
  ANSI_BACK_GREEN           = 42;
  ANSI_BACK_YELLOW          = 43;
  ANSI_BACK_BLUE            = 44;
  ANSI_BACK_MAGENTA         = 45;
  ANSI_BACK_CYAN            = 46;
  ANSI_BACK_WHITE           = 47;
  ANSI_BACK_RESET           = 49;
  ANSI_STYLE_BOLD           = 1;
  ANSI_STYLE_ITALIC         = 3;
  ANSI_STYLE_UNDERLINE      = 4;
  ANSI_STYLE_BLINK          = 5;
procedure PrintColor(codes: array of byte; str: ansistring);
var
  attrs: string;
  code: byte;
begin
  attrs := '';
  for code in codes do
    begin
      if attrs  '' then
        attrs += ';';
      attrs += IntToStr(code);
    end;
  writeln(#&033,'[',attrs,'m',str,#&033,'[',0,'m');
end;
// prints a blinking, bold red text on a white background
PrintColor([ANSI_BACK_WHITE, ANSI_FORE_RED, ANSI_STYLE_BLINK, ANSI_STYLE_BOLD], 'Hello World');

Regards,
Ryan Joseph

Reply by email

J. Gareth Moreton
to Ryan Joseph

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!

Gareth aka. Kit

Ryan Joseph wrote 58 lines
> On Nov 22, 2020, at 9:29 AM, Florian Klämpfl via fpc-devel wrote: > > Because I have no Mac so I couldn't test it. I see. It's this easy. const ANSI_FORE_BLACK = 30; ANSI_FORE_RED = 31; ANSI_FORE_GREEN = 32; ANSI_FORE_YELLOW = 33; ANSI_FORE_BLUE = 34; ANSI_FORE_MAGENTA = 35; ANSI_FORE_CYAN = 36; ANSI_FORE_WHITE = 37; ANSI_FORE_RESET = 39; ANSI_BACK_BLACK = 40; ANSI_BACK_RED = 41; ANSI_BACK_GREEN = 42; ANSI_BACK_YELLOW = 43; ANSI_BACK_BLUE = 44; ANSI_BACK_MAGENTA = 45; ANSI_BACK_CYAN = 46; ANSI_BACK_WHITE = 47; ANSI_BACK_RESET = 49; ANSI_STYLE_BOLD = 1; ANSI_STYLE_ITALIC = 3; ANSI_STYLE_UNDERLINE = 4; ANSI_STYLE_BLINK = 5; procedure PrintColor(codes: array of byte; str: ansistring); var attrs: string; code: byte; begin attrs := ''; for code in codes do begin if attrs '' then attrs += ';'; attrs += IntToStr(code); end; writeln(#&033,'[',attrs,'m',str,#&033,'[',0,'m'); end; // prints a blinking, bold red text on a white background PrintColor([ANSI_BACK_WHITE, ANSI_FORE_RED, ANSI_STYLE_BLINK, ANSI_STYLE_BOLD], 'Hello World'); Regards, Ryan Joseph _______________________________________________ fpc-devel maillist - https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus

Reply by email

J. Gareth Moreton
to J. Gareth Moreton

But to go back to the point I originally raised, Kirinn raised a good point about those who have white rather than black backgrounds, or any colour so long as it's /not/ black! Yellow is very hard to see against a bright white backdrop, while red, medium/dark green and magenta can be seen on most backgrounds.  Plus GCC uses the same colours for warnings.

So, my complaint is dropped!

Gareth aka. Kit

J. Gareth Moreton wrote 70 lines
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! Gareth aka. Kit On 22/11/2020 16:58, Ryan Joseph via fpc-devel wrote: > >> On Nov 22, 2020, at 9:29 AM, Florian Klämpfl via fpc-devel >> wrote: >> >> Because I have no Mac so I couldn't test it. > I see. It's this easy. > > const >    ANSI_FORE_BLACK           = 30; >    ANSI_FORE_RED             = 31; >    ANSI_FORE_GREEN           = 32; >    ANSI_FORE_YELLOW          = 33; >    ANSI_FORE_BLUE            = 34; >    ANSI_FORE_MAGENTA         = 35; >    ANSI_FORE_CYAN            = 36; >    ANSI_FORE_WHITE           = 37; >    ANSI_FORE_RESET           = 39; > >    ANSI_BACK_BLACK           = 40; >    ANSI_BACK_RED             = 41; >    ANSI_BACK_GREEN           = 42; >    ANSI_BACK_YELLOW          = 43; >    ANSI_BACK_BLUE            = 44; >    ANSI_BACK_MAGENTA         = 45; >    ANSI_BACK_CYAN            = 46; >    ANSI_BACK_WHITE           = 47; >    ANSI_BACK_RESET           = 49; > >    ANSI_STYLE_BOLD           = 1; >    ANSI_STYLE_ITALIC         = 3; >    ANSI_STYLE_UNDERLINE      = 4; >    ANSI_STYLE_BLINK          = 5; > > > procedure PrintColor(codes: array of byte; str: ansistring); > var >    attrs: string; >    code: byte; > begin >    attrs := ''; >    for code in codes do >      begin >        if attrs '' then >          attrs += ';'; >        attrs += IntToStr(code); >      end; >    writeln(#&033,'[',attrs,'m',str,#&033,'[',0,'m'); > end; > > // prints a blinking, bold red text on a white background > PrintColor([ANSI_BACK_WHITE, ANSI_FORE_RED, ANSI_STYLE_BLINK, > ANSI_STYLE_BOLD], 'Hello World'); > > Regards, >     Ryan Joseph > > _______________________________________________ > fpc-devel maillist  -  > https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel >
This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus

Reply by email

Ryan Joseph
to J. Gareth Moreton: Personally I'd write the function as something like "function GenerateColorCode(codes:…
On Nov 22, 2020, at 10:09 AM, J. Gareth Moreton via fpc-devel 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

Reply by email

J. Gareth Moreton
to Ryan Joseph

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

Ryan Joseph wrote 13 lines
> On Nov 22, 2020, at 10:09 AM, J. Gareth Moreton via fpc-devel 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 - https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus

Reply by email

Alexander Grotewohl
to J. Gareth Moreton

I would probably do something like this:

const
ansi_colors: array[0..7] of char = ('0', '4', '2', '6', '1', '5', '3', '7');
procedure PrintColor(fg, bg: byte; s: string);
var
tmp: string;
begin
tmp:=#27+'[0;3'+ansi_colors[fg]+';4'+ansi_colors[bg]+'m'+s+#27+'[0m';
writeln(tmp);
end;
begin
PrintColor(2, 0, 'derp');
end.

Easy enough to remember pascal style color numbers.

Alexander Grotewohl https://dcclost.com ________________________________
Earlier message 52 lines
From: fpc-devel on behalf of J. Gareth Moreton via fpc-devel Sent: Sunday, November 22, 2020 7:59 PM To: Ryan Joseph via fpc-devel Cc: J. Gareth Moreton 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 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 - > https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel > -- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus

Reply by email

Sven Barth
to J. Gareth Moreton: I'm getting there.  I keep getting distracted or lost though! Hardware failures don't…
J. Gareth Moreton wrote 5 lines
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!

Florian had already worked on SSA in the past. So maybe best ask him what he had done, what worked, what didn't and what is missing. (In a separate thread though)

Regards,
Sven

Reply by email

Michael Van Canneyt
to Jonas Maebe: No, the terminal works fine with it (apart from mouse support, which only works if you…
Jonas Maebe wrote 14 lines
On 22/11/2020 17:42, Sven Barth via fpc-devel wrote: > Am 22.11.2020 um 17:40 schrieb J. Gareth Moreton via fpc-devel: >> Most modern Macs are Unix-based, so the escape sequences should work, >> right? Granted, I think we need someone with a Mac or a Mac virtual >> machine to test it for sure. > > Considering that Jonas doesn't support the textmode IDE on macOS because > of - if I remember correctly - problems with the terminal No, the terminal works fine with it (apart from mouse support, which only works if you use Xterm). I don't support it because the IDE is not really maintained by anyone, and I don't want to maintain or debug it either (so if someone would report a bug on macOS with it, it would just sit there forever).

I ran the compiler on linux through a ssh session:

The colors display just fine, so I see no reason to disable on darwin except that the termio unit is not found...

Michael.

Reply by email

Ryan Joseph
to Michael Van Canneyt
Show quoted text 6 lines
On Nov 23, 2020, at 1:33 AM, Michael Van Canneyt via fpc-devel wrote: I ran the compiler on linux through a ssh session: The colors display just fine, so I see no reason to disable on darwin except that the termio unit is not found...

If Florian wants to provide some explanation as to where the colors were added I'll enable them on mac and test them myself.

Regards,
Ryan Joseph

Reply by email

J. Gareth Moreton
to Ryan Joseph

I'd say thie first port of call is "compiler/comphook.pas", line 258:

procedure WriteColoredOutput(var t: Text;color: TOutputColor;const s :
AnsiString);

It looks like a simple "$if defined".

Gareth aka. Kit

Ryan Joseph wrote 16 lines
> On Nov 23, 2020, at 1:33 AM, Michael Van Canneyt via fpc-devel wrote: > > I ran the compiler on linux through a ssh session: > > The colors display just fine, so I see no reason to disable on darwin except > that the termio unit is not found... If Florian wants to provide some explanation as to where the colors were added I'll enable them on mac and test them myself. Regards, Ryan Joseph _______________________________________________ fpc-devel maillist - https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus

Reply by email

Tomas Hajny
to J. Gareth Moreton
J. Gareth Moreton wrote 6 lines
I'd say thie first port of call is "compiler/comphook.pas", line 258: procedure WriteColoredOutput(var t: Text;color: TOutputColor;const s : AnsiString); It looks like a simple "$if defined".

Yes, and the more platforms are added, the more messy this unit gets. :-( I tried to clean it up a bit by moving the platform-specific parts to a new unit - see the attachment containing a diff for comphook.pas and the new unit. I didn't commit yet because I couldn't test it on the other platforms (my new implementation for OS/2 works OK ;-) ). If somebody tests is under Linux and WinXX, I'll committ it tomorrow.

Tomas

Reply by email

J. Gareth Moreton
to Tomas Hajny

I'm doing some optimisation development for x86_64 currently, so I can give it a test run if you like - got the Raspberry Pi for arm-linux and aarch64-linux too, but it might take more then a day.  I'll let you know.

Gareth aka. Kit

Tomas Hajny wrote 20 lines
On 2020-11-24 01:14, J. Gareth Moreton via fpc-devel wrote: > I'd say thie first port of call is "compiler/comphook.pas", line 258: > > procedure WriteColoredOutput(var t: Text;color: TOutputColor;const s : > AnsiString); > > It looks like a simple "$if defined". Yes, and the more platforms are added, the more messy this unit gets. :-( I tried to clean it up a bit by moving the platform-specific parts to a new unit - see the attachment containing a diff for comphook.pas and the new unit. I didn't commit yet because I couldn't test it on the other platforms (my new implementation for OS/2 works OK ;-) ). If somebody tests is under Linux and WinXX, I'll committ it tomorrow. Tomas _______________________________________________ fpc-devel maillist - https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus

Reply by email

J. Gareth Moreton
to J. Gareth Moreton

Sorry for being a bit slow - I've been doing my own work on x86. I gave your patch (and new file) a test run on x86_64-win64, and that seems to work fine.  At least the warning messages in the packages appear magenta.  I'll give arm-linux a test next.

Gareth aka. Kit

J. Gareth Moreton wrote 41 lines
I'm doing some optimisation development for x86_64 currently, so I can give it a test run if you like - got the Raspberry Pi for arm-linux and aarch64-linux too, but it might take more then a day.  I'll let you know. Gareth aka. Kit On 24/11/2020 01:13, Tomas Hajny via fpc-devel wrote: > On 2020-11-24 01:14, J. Gareth Moreton via fpc-devel wrote: >> I'd say thie first port of call is "compiler/comphook.pas", line 258: >> >> procedure WriteColoredOutput(var t: Text;color: TOutputColor;const s : >> AnsiString); >> >> It looks like a simple "$if defined". > > Yes, and the more platforms are added, the more messy this unit gets. > :-( I tried to clean it up a bit by moving the platform-specific > parts to a new unit - see the attachment containing a diff for > comphook.pas and the new unit. I didn't commit yet because I couldn't > test it on the other platforms (my new implementation for OS/2 works > OK ;-) ). If somebody tests is under Linux and WinXX, I'll committ it > tomorrow. > > Tomas > > _______________________________________________ > fpc-devel maillist > https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> Virus-free. www.avast.com <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2> _______________________________________________ fpc-devel maillist - https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus

Reply by email

Tomas Hajny
to J. Gareth Moreton
J. Gareth Moreton wrote
Sorry for being a bit slow - I've been doing my own work on x86. I gave your patch (and new file) a test run on x86_64-win64, and that seems to work fine.  At least the warning messages in the packages appear magenta.  I'll give arm-linux a test next.

No problem, thanks for testing. Unfortunately, it doesn't work for me under Windows (Win 10 Pro 64-bit) either with the original version or with my modifications (i.e. hopefully unrelated to my changes). It could be some configuration of the used Windows installation, whatever, no idea. I'll probably commit my changes now hoping that I didn't break anything for anybody for whom it worked correctly previously. The GO32v2 version was not compilable in the sent version, fixed now and tested to work properly (apparently, coloured output using ANSI escape codes works more reliably with 16-bit MS-DOS/PC DOS/... than with 64-bit MS Windows 10 Pro ;-) ). And BTW, no, it doesn't work under DOSBox, because DOSBox supports ANSI escape codes out of the box without signalizing that such support is available in a way compatible to the real DOS. I could add a specific check for running under DOSBox if somebody wants it (it's just a few more lines of code, no difficulties).

Tomas

Reply by email

Nikolai Zhubr
to Tomas Hajny

Hi!

25.11.2020 1:52, Tomas Hajny via fpc-devel:

Show quoted text 8 lines
On 2020-11-24 19:17, J. Gareth Moreton via fpc-devel wrote: > Sorry for being a bit slow - I've been doing my own work on x86. I > gave your patch (and new file) a test run on x86_64-win64, and that > seems to work fine. At least the warning messages in the packages > appear magenta. I'll give arm-linux a test next. No problem, thanks for testing. Unfortunately, it doesn't work for me under Windows (Win 10 Pro 64-bit) either with the original version or

Have you also checked with this registry trick for win10:

[HKEY_CURRENT_USER\Console]
"VirtualTerminalLevel"=dword:00000001

(As per https://superuser.com/a/1300251/109090)

HTH,

Regards,
Nikolai

Show quoted text 17 lines
with my modifications (i.e. hopefully unrelated to my changes). It could be some configuration of the used Windows installation, whatever, no idea. I'll probably commit my changes now hoping that I didn't break anything for anybody for whom it worked correctly previously. The GO32v2 version was not compilable in the sent version, fixed now and tested to work properly (apparently, coloured output using ANSI escape codes works more reliably with 16-bit MS-DOS/PC DOS/... than with 64-bit MS Windows 10 Pro ;-) ). And BTW, no, it doesn't work under DOSBox, because DOSBox supports ANSI escape codes out of the box without signalizing that such support is available in a way compatible to the real DOS. I could add a specific check for running under DOSBox if somebody wants it (it's just a few more lines of code, no difficulties). Tomas _______________________________________________ fpc-devel maillist - https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply by email

Tomas Hajny
to Nikolai Zhubr
Nikolai Zhubr wrote
25.11.2020 1:52, Tomas Hajny via fpc-devel:

Hi Nikolai,

Show quoted text 9 lines
> No problem, thanks for testing. Unfortunately, it doesn't work for me > under Windows (Win 10 Pro 64-bit) either with the original version or Have you also checked with this registry trick for win10: [HKEY_CURRENT_USER\Console] "VirtualTerminalLevel"=dword:00000001 (As per https://superuser.com/a/1300251/109090)

.
.

If I read the article correctly, it says that an application may enable this processing explicitly using SetConsoleMode, or that it may be enabled for all applications / consoles using the mentioned registry key. The code added to the compiler contains the mentioned SetConsoleMode setting, thus it should be sufficient according to the article. However, the call fails (here) with error 87 (invalid parameter). And btw, changing the registry key doesn't help (i.e. I still get the same error). The same call (SetConsoleMode) performed without setting the respective flag (ENABLE_VIRTUAL_TERMINAL_PROCESSING) succeeds. I'm willing to have a look at additional hints, but I won't perform additional research myself for this.

For anybody interested, the following test program reproduces the functionality in the compiler (and provides debug information):

-----------------------------
{$MODE OBJFPC}
uses
  Windows;
const
   ENABLE_VIRTUAL_TERMINAL_PROCESSING = $0004;
   CachedIsATTY : Boolean = false;
   IsATTYValue : Boolean = false;
function IsATTY(var t : text) : Boolean;
   const dwMode: dword = 0;
   begin
     if not(CachedIsATTY) then
       begin
         IsATTYValue := false;
         if GetConsoleMode(TextRec(t).handle, dwMode) then
         begin
           WriteLn ('dwMode = ', dwMode);
           if not (SetConsoleMode(TextRec(t).handle, dwMode)) then
            WriteLn ('SCM0: ', GetLastError);
           dwMode := dwMode or ENABLE_VIRTUAL_TERMINAL_PROCESSING;
           if SetConsoleMode(TextRec(t).handle, dwMode) then
             IsATTYValue := true
           else
            WriteLn ('SCM: ', GetLastError);
         end
          else
           WriteLn ('GCM: ', GetLastError);
         CachedIsATTY:=true;
       end;
     Result:=IsATTYValue;
   end;
begin
  WriteLn (IsATTY (Output));
end.
======================================

I get the following result (regardless from the registry setting):

dwMode = 3
SCM: 87
FALSE

Tomas

Reply by email

Sven Barth
to Tomas Hajny

Tomas Hajny via fpc-devel schrieb am Mi.,
25. Nov. 2020, 13:31:

Show quoted text 32 lines
On 2020-11-25 10:31, Nikolai Zhubr via fpc-devel wrote: > 25.11.2020 1:52, Tomas Hajny via fpc-devel: Hi Nikolai, >> No problem, thanks for testing. Unfortunately, it doesn't work for me >> under Windows (Win 10 Pro 64-bit) either with the original version or > > Have you also checked with this registry trick for win10: > > [HKEY_CURRENT_USER\Console] > "VirtualTerminalLevel"=dword:00000001 > > (As per https://superuser.com/a/1300251/109090) . . If I read the article correctly, it says that an application may enable this processing explicitly using SetConsoleMode, or that it may be enabled for all applications / consoles using the mentioned registry key. The code added to the compiler contains the mentioned SetConsoleMode setting, thus it should be sufficient according to the article. However, the call fails (here) with error 87 (invalid parameter). And btw, changing the registry key doesn't help (i.e. I still get the same error). The same call (SetConsoleMode) performed without setting the respective flag (ENABLE_VIRTUAL_TERMINAL_PROCESSING) succeeds. I'm willing to have a look at additional hints, but I won't perform additional research myself for this.

How current is your Windows 10? VT100 support was added only two years ago or so.

Regards,
Sven

Reply by email

Tomas Hajny
to Sven Barth
Sven Barth wrote 5 lines
Tomas Hajny via fpc-devel schrieb am Mi., 25. Nov. 2020, 13:31: > On 2020-11-25 10:31, Nikolai Zhubr via fpc-devel wrote: > > 25.11.2020 1:52, Tomas Hajny via fpc-devel:

.
.

How current is your Windows 10? VT100 support was added only two years ago or so.

I have the machine since May and it gets regular fixes (it's managed by my employer). The most recent binaries in Windows\System32 are from September the 18th and the File Version and Product Version properties show 10.0.18362.1049 (and some other .1082). Maybe it's too recent? ;-) (Sorry, I couldn't resist, making jokes about MS approach to compatibility is way too easy. ;-) ) I don't care too much, I just wanted to make sure that the compiler colouring still works on Windows after my changes.

Tomas

Reply by email

Sven Barth
to Tomas Hajny: . . I have the machine since May and it gets regular fixes (it's managed by my employer).…
Tomas Hajny wrote 21 lines
On 2020-11-25 14:40, Sven Barth via fpc-devel wrote: > Tomas Hajny via fpc-devel schrieb am > Mi., > 25. Nov. 2020, 13:31: >> On 2020-11-25 10:31, Nikolai Zhubr via fpc-devel wrote: >> > 25.11.2020 1:52, Tomas Hajny via fpc-devel:  .  . > How current is your Windows 10? VT100 support was added only two > years ago > or so. I have the machine since May and it gets regular fixes (it's managed by my employer). The most recent binaries in Windows\System32 are from September the 18th and the File Version and Product Version properties show 10.0.18362.1049 (and some other .1082). Maybe it's too recent? ;-) (Sorry, I couldn't resist, making jokes about MS approach to compatibility is way too easy. ;-) ) I don't care too much, I just wanted to make sure that the compiler colouring still works on Windows after my changes.

I just tested with a current revision and it still works correctly on Windows 10.

Regards,
Sven

Reply by email