Hello World - Advanced

Mike Parker aldacron at gmail.com
Thu Aug 26 07:05:57 UTC 2021


On Thursday, 26 August 2021 at 06:53:57 UTC, Kelpalots Techance 
Network wrote:
> On Thursday, 26 August 2021 at 06:44:04 UTC, Kelpalots Techance 
> Network wrote:
>> On Thursday, 26 August 2021 at 06:28:16 UTC, Kelpalots 
>> Techance Network wrote:
>>> import std.stdio;
>>>
>>>     void main() {
>>>         printf-color="red"=("Hello, This New World!") parse;
>>>         printf-color="green"=("What's coooking for Breakfast, 
>>> Lunch, and Dinner?") parse;
>>>         printf-color="blue"=("Love you bunches, Perfect 
>>> Peace!!!") parse;
>>>     }
>>>
>>> [...]
>>
>> Oh by the way, I seem to have misused this old house. So I 
>> took out import stuffz0rs, and it didn't complain.
>>
>>     void main() {
>>         printf-color="red"=("Hello, This New World!") parse;
>>         printf-color="green"=("What's coooking for Breakfast, 
>> Lunch, and Dinner?") purse;
>>         printf-color="blue"=("Love you bunches, Perfect 
>> Peace!!!") farse;
>>     }
>
> So this time it complained, after fixing farse, purse, and 
> parse up with just plain ol' parse, because parse guys came by 
> all hoover like and made more parses happen, because we ran out 
> of "parse" and had to get creative. they also do this for 
> halt's. So I don't like that it red out's my extra halts. :P I 
> thought it could be infectious files if it didn't halt virus 
> infections with extra halts the programming didn't need. But 
> that is way advanced, and I'm good about halts after TreeServ 
> needed all the programming languages to make him because I ran 
> out of things like halts. lol Again whacky science to 
> programming languages. I thought D programming language was 
> pretty whacky science anyways in my lifetime, and suddenly 
> jumped on board after I ate all the libraries to the wrong 
> programming language, as it wasn't interesting. huah. But C 
> programmers are whacky science'd out already and dlang didn't 
> know they'd ever do that [2014 in my lifetime, groundzero].
>
>     import core.stdc.stdio;
>     void main() {
>         printf-color="red"=("Hello, This New World!"); parse;
>         printf-color="green"=("What's coooking for Breakfast, 
> Lunch, and Dinner?"); parse;
>         printf-color="blue"=("Love you bunches, Perfect 
> Peace!!!"); parse;
>     }
>
> PS C:\D\dmd2\windows\bin> dmd -run D:\FareDareisMe\Hello_World.d
> D:\FareDareisMe\Hello_World.d(3): Error: undefined identifier 
> `color`
> D:\FareDareisMe\Hello_World.d(3): Error: undefined identifier 
> `parse`
> D:\FareDareisMe\Hello_World.d(4): Error: undefined identifier 
> `color`
> D:\FareDareisMe\Hello_World.d(4): Error: undefined identifier 
> `parse`
> D:\FareDareisMe\Hello_World.d(5): Error: undefined identifier 
> `color`
> D:\FareDareisMe\Hello_World.d(5): Error: undefined identifier 
> `parse`

These symbols you're using are not defined in core.stdc.stdio. 
And the syntax you're using isn't D. It's not C either.

You can find some libraries for colorized stdio output here:

https://code.dlang.org/search?q=color

But these are going to use D's std.stdio and not the C stuff.

For strictly printf color, ANSI color codes work in many 
terminals:

https://www.theurbanpenguin.com/4184-2/

On Windows, I believe they work in the new Windows Terminal from 
Microsoft, but probably not in the stock cmd window (maybe on 
Windows 10, haven't tried) unless you go through the Win32 API 
Console IO functions.


More information about the Digitalmars-d mailing list