digitalmars.D.learn - What is "dmd" Internal API, can I use it just like std Library
- BoQsc (11/21) Aug 20 2019 Hello everyone, again,
- Adam D. Ruppe (3/4) Aug 20 2019 These are for when you are working on the compiler's source
- Daniel Kozak (7/28) Aug 20 2019 It is internal and it is part of dmd compiler sources but it is not
- a11e99z (6/30) Aug 20 2019 yesterday was talks about terminal colors in IRC-channel:
- H. S. Teoh (6/9) Aug 20 2019 [...]
Hello everyone, again, I had an idea that I want some colors in the output of Command Line (For Windows) and the Terminal (For Linux) I found https://dlang.org/phobos/dmd_console.html and wanted to use it. But it seems I'm not being successful, and I do not understand why. Here, you can see that I'm trying to import dmd.console;import std.stdio : writeln; import dmd.console; void main() { writeln("Hello World"); }And the output says that, dmd.console; do not exist? What are these Internal APIs for?C:\Users\Juozas\Desktop>rdmd color.d color.d(2): Error: module `console` is in file 'dmd\console.d' which cannot be read
Aug 20 2019
On Tuesday, 20 August 2019 at 12:52:31 UTC, BoQsc wrote:And the output says that, dmd.console; do not exist?These are for when you are working on the compiler's source itself.
Aug 20 2019
On Tue, Aug 20, 2019 at 2:55 PM BoQsc via Digitalmars-d-learn <digitalmars-d-learn puremagic.com> wrote:Hello everyone, again, I had an idea that I want some colors in the output of Command Line (For Windows) and the Terminal (For Linux) I found https://dlang.org/phobos/dmd_console.html and wanted to use it. But it seems I'm not being successful, and I do not understand why. Here, you can see that I'm trying to import dmd.console;It is internal and it is part of dmd compiler sources but it is not supposed to be used in normal D code. If you want colors in console you can try this: https://github.com/Kripth/terminal you can use it as a dup dependency or just add terminal.d to your code baseimport std.stdio : writeln; import dmd.console; void main() { writeln("Hello World"); }And the output says that, dmd.console; do not exist? What are these Internal APIs for?C:\Users\Juozas\Desktop>rdmd color.d color.d(2): Error: module `console` is in file 'dmd\console.d' which cannot be read
Aug 20 2019
On Tuesday, 20 August 2019 at 12:52:31 UTC, BoQsc wrote:Hello everyone, again, I had an idea that I want some colors in the output of Command Line (For Windows) and the Terminal (For Linux)yesterday was talks about terminal colors in IRC-channel: u can use VT-codes for changing colors: https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences#text-formatting probably for Win10 only. idk for which Linux/Terminals it working too// Windows code import std, core.sys.windows.windows; void main() { auto hc = GetStdHandle( STD_OUTPUT_HANDLE ); assert( hc != INVALID_HANDLE_VALUE); uint mod; auto ok = GetConsoleMode( hc, &mod); assert( ok); ok = SetConsoleMode( hc, mod | ENABLE_VIRTUAL_TERMINAL_PROCESSING ); assert( ok); writeln( "\x1b[38;2;255;100;0mTRUECOLOR"); writeln( "\x1b[30;47mHello from Inversed" ); writeln( "\x1b[38;2;255;0;255mTRUECOLOR\x1b[0m" ); // last "\x1b[0m" - make colors default readln; }
Aug 20 2019
On Tue, Aug 20, 2019 at 12:52:31PM +0000, BoQsc via Digitalmars-d-learn wrote: [...]I found https://dlang.org/phobos/dmd_console.html and wanted to use it. But it seems I'm not being successful, and I do not understand why.[...] Because this is code inside the compiler, when you're compiling the compiler, not something that you can call from user code. --T
Aug 20 2019