digitalmars.D.learn - Ncurses deprecated "~master" issue
- Paul (16/16) Dec 03 2014 Sorry if this is a little off-topic, I posted this in the Dub
- Matt Soucy (14/28) Dec 03 2014 ecated. I also read that it could be overriden on a per-project basis by...
- Paul (4/30) Dec 03 2014 So do I manually add those source files to my program (assuming
- Paul (10/40) Feb 10 2015 Bump!
- Meta (4/46) Feb 10 2015 I can't answer your question, but if you're just prototyping you
- ketmar (3/6) Feb 10 2015 and i daresay that with 'terminal.d' there is no need in ncurses at all=...
- Paul (19/28) Feb 10 2015 Thanks both for the replies. Terminal.d looks as though it will
- Adam D. Ruppe (8/11) Feb 10 2015 If you see 'undefined reference' it means some library wasn't
- Paul (7/18) Feb 10 2015 Thank you Adam. Yes, I noted the default values, even if I don't
- Adam D. Ruppe (11/13) Feb 10 2015 They allow overriding of the input/output files. fdIn normally
- Paul (12/25) Feb 11 2015 How do I get/process input? Looking at the source/doc it looks
- Adam D. Ruppe (25/26) Feb 11 2015 Construct the real time input struct outside your loop then use
- Paul (3/30) Feb 11 2015 Perfect, thank you again for a thorough answer.
- Meta (3/33) Feb 10 2015 Are you on Linux or Windows? That constructor is only defined on
- H. S. Teoh via Digitalmars-d-learn (8/22) Feb 10 2015 Judging by the name of the object file (test.o) and the name of the code
- Meta (3/9) Feb 10 2015 Heh, you are right. I only use D on Windows and since I mostly
- Paul (2/41) Feb 10 2015 Sorry I missed your post, I'm on Linux Mint 17.
Sorry if this is a little off-topic, I posted this in the Dub forum on 23/11/14 but have had no reply yet: --- I read that the use of a branch spec like "~master" in dub.json is deprecated. I also read that it could be overriden on a per-project basis by editing the project's dub.selections.json file but I can't find any information about what is actually required in this file and whether any corresponding changes need to be made to dub.json. I'm trying to use 'ncurses' which doesn't have a version number, only "~master". --- Also, does anyone know how 'beta' the ncurses module actually is, is anyone using it? Cheers Paul
Dec 03 2014
On 12/03/2014 07:07 AM, Paul wrote:Sorry if this is a little off-topic, I posted this in the Dub forum on =23/11/14 but have had no reply yet:=20 =20 --- I read that the use of a branch spec like "~master" in dub.json is depr=ecated. I also read that it could be overriden on a per-project basis by = editing the project's dub.selections.json file but I can't find any infor= mation about what is actually required in this file and whether any corre= sponding changes need to be made to dub.json.=20 I'm trying to use 'ncurses' which doesn't have a version number, only "=~master".--- =20 Also, does anyone know how 'beta' the ncurses module actually is, is an=yone using it?=20 Cheers =20 PaulSo, as far as I know there isn't any plan for versioning that specific li= brary. I've used it, however, and it's pretty usable (as much as ncurses = goes, at any rate). --=20 Matt Soucy http://msoucy.me/
Dec 03 2014
On Wednesday, 3 December 2014 at 17:37:18 UTC, Matt Soucy wrote:On 12/03/2014 07:07 AM, Paul wrote:So do I manually add those source files to my program (assuming the ncurses libs are installed) if compiling with dmd rather than using dub?Sorry if this is a little off-topic, I posted this in the Dub forum on 23/11/14 but have had no reply yet: --- I read that the use of a branch spec like "~master" in dub.json is deprecated. I also read that it could be overriden on a per-project basis by editing the project's dub.selections.json file but I can't find any information about what is actually required in this file and whether any corresponding changes need to be made to dub.json. I'm trying to use 'ncurses' which doesn't have a version number, only "~master". --- Also, does anyone know how 'beta' the ncurses module actually is, is anyone using it? Cheers PaulSo, as far as I know there isn't any plan for versioning that specific library. I've used it, however, and it's pretty usable (as much as ncurses goes, at any rate).
Dec 03 2014
On Wednesday, 3 December 2014 at 19:37:03 UTC, Paul wrote:On Wednesday, 3 December 2014 at 17:37:18 UTC, Matt Soucy wrote:Bump! I need to use ncurses for some quick prototyping now but I still can't get it to work. Can someone please spell out the steps I need to take to get this going? I'm using dmd on a linux mint box and have ncurses (and dev package) installed. What do I need to install and import exactly if I don't utilise Dub? TIA PaulOn 12/03/2014 07:07 AM, Paul wrote:So do I manually add those source files to my program (assuming the ncurses libs are installed) if compiling with dmd rather than using dub?Sorry if this is a little off-topic, I posted this in the Dub forum on 23/11/14 but have had no reply yet: --- I read that the use of a branch spec like "~master" in dub.json is deprecated. I also read that it could be overriden on a per-project basis by editing the project's dub.selections.json file but I can't find any information about what is actually required in this file and whether any corresponding changes need to be made to dub.json. I'm trying to use 'ncurses' which doesn't have a version number, only "~master". --- Also, does anyone know how 'beta' the ncurses module actually is, is anyone using it? Cheers PaulSo, as far as I know there isn't any plan for versioning that specific library. I've used it, however, and it's pretty usable (as much as ncurses goes, at any rate).
Feb 10 2015
On Tuesday, 10 February 2015 at 13:18:34 UTC, Paul wrote:On Wednesday, 3 December 2014 at 19:37:03 UTC, Paul wrote:I can't answer your question, but if you're just prototyping you could use Adam Ruppe's terminal.d until you get ncurses working. https://github.com/adamdruppe/arsd/blob/master/terminal.dOn Wednesday, 3 December 2014 at 17:37:18 UTC, Matt Soucy wrote:Bump! I need to use ncurses for some quick prototyping now but I still can't get it to work. Can someone please spell out the steps I need to take to get this going? I'm using dmd on a linux mint box and have ncurses (and dev package) installed. What do I need to install and import exactly if I don't utilise Dub? TIA PaulOn 12/03/2014 07:07 AM, Paul wrote:So do I manually add those source files to my program (assuming the ncurses libs are installed) if compiling with dmd rather than using dub?Sorry if this is a little off-topic, I posted this in the Dub forum on 23/11/14 but have had no reply yet: --- I read that the use of a branch spec like "~master" in dub.json is deprecated. I also read that it could be overriden on a per-project basis by editing the project's dub.selections.json file but I can't find any information about what is actually required in this file and whether any corresponding changes need to be made to dub.json. I'm trying to use 'ncurses' which doesn't have a version number, only "~master". --- Also, does anyone know how 'beta' the ncurses module actually is, is anyone using it? Cheers PaulSo, as far as I know there isn't any plan for versioning that specific library. I've used it, however, and it's pretty usable (as much as ncurses goes, at any rate).
Feb 10 2015
On Tue, 10 Feb 2015 19:37:59 +0000, Meta wrote:I can't answer your question, but if you're just prototyping you could use Adam Ruppe's terminal.d until you get ncurses working. https://github.com/adamdruppe/arsd/blob/master/terminal.dand i daresay that with 'terminal.d' there is no need in ncurses at all=20 (except if someone needs ncurses panels, but i can't imagine why).=
Feb 10 2015
On Tuesday, 10 February 2015 at 19:49:26 UTC, ketmar wrote:On Tue, 10 Feb 2015 19:37:59 +0000, Meta wrote:Thanks both for the replies. Terminal.d looks as though it will do what I want but I'm familiar with using ncurses and could do without learning to use yet another api at the minute. Nevertheless, I had a quick look, but trying to create an instance of the Terminal struct like so: Terminal myTerm = Terminal(ConsoleOutputType.cellular, 0, 1, null); (which I think is the corrct way to do it!) gives me this error: test.o: In function `_Dmain': test.d:(.text._Dmain+0x13): undefined reference to `_D8terminal8Terminal6__initZ' test.d:(.text._Dmain+0x3c): undefined reference to `_D8terminal8Terminal6__ctorMFNcE8terminal17ConsoleOutputTypeiiDFZAiZS8terminal8Terminal' test.d:(.text._Dmain+0x6a): undefined reference to `_D8terminal8Terminal6__dtorMFZv' collect2: error: ld returned 1 exit status --- errorlevel 1 I have no idea how to fix that. Any suggestions please?I can't answer your question, but if you're just prototyping you could use Adam Ruppe's terminal.d until you get ncurses working. https://github.com/adamdruppe/arsd/blob/master/terminal.dand i daresay that with 'terminal.d' there is no need in ncurses at all (except if someone needs ncurses panels, but i can't imagine why).
Feb 10 2015
On Tuesday, 10 February 2015 at 20:50:28 UTC, Paul wrote:test.o: In function `_Dmain': test.d:(.text._Dmain+0x13): undefined reference to `_D8terminal8Terminal6__initZ'If you see 'undefined reference' it means some library wasn't passed to the compiler. Easiest fix is usually to add the .d files to the command line so: dmd yourfile.d terminal.d with both passed together should build successfully. BTW only the first argument to Terminal() is required, the others have sane defaults.
Feb 10 2015
On Tuesday, 10 February 2015 at 20:57:43 UTC, Adam D. Ruppe wrote:On Tuesday, 10 February 2015 at 20:50:28 UTC, Paul wrote:Thank you Adam. Yes, I noted the default values, even if I don't understand what they do at present(!). I'm pretty sure I tried to pass both files to the compiler at one point but I had illegal characters in my source filename (test-terminal.d) which sent me off on another track! No matter, it works as expected now, so I can take it for a spin.test.o: In function `_Dmain': test.d:(.text._Dmain+0x13): undefined reference to `_D8terminal8Terminal6__initZ'If you see 'undefined reference' it means some library wasn't passed to the compiler. Easiest fix is usually to add the .d files to the command line so: dmd yourfile.d terminal.d with both passed together should build successfully. BTW only the first argument to Terminal() is required, the others have sane defaults.
Feb 10 2015
On Tuesday, 10 February 2015 at 21:11:14 UTC, Paul wrote:Yes, I noted the default values, even if I don't understand what they do at present(!).They allow overriding of the input/output files. fdIn normally refers to standard input, fdOut refers to standard output, and the getSizeOverride lets you provide a custom function instead of the default, which is to ask the operating system for the size of the terminal with ioctl. I added those options to support my detachable.d program, which is like GNU Screen - it can detach from the terminal and keep running. Instead of talking straight to the actual terminal files, it talks through a socket to a helper program which lets it be reattached on a new terminal.
Feb 10 2015
On Tuesday, 10 February 2015 at 23:39:56 UTC, Adam D. Ruppe wrote:On Tuesday, 10 February 2015 at 21:11:14 UTC, Paul wrote:How do I get/process input? Looking at the source/doc it looks like I should be doing something like this for an inifinite loop breakable with Esc but it doesn't seem to work (in urxvt or a plain xterm): dchar charIn; while(charIn != '\U0000001b') { auto myInput = RealTimeConsoleInput(&myTerm, ConsoleInputFlags.raw); charIn = myInput.getch(); }Yes, I noted the default values, even if I don't understand what they do at present(!).They allow overriding of the input/output files. fdIn normally refers to standard input, fdOut refers to standard output, and the getSizeOverride lets you provide a custom function instead of the default, which is to ask the operating system for the size of the terminal with ioctl. I added those options to support my detachable.d program, which is like GNU Screen - it can detach from the terminal and keep running. Instead of talking straight to the actual terminal files, it talks through a socket to a helper program which lets it be reattached on a new terminal.
Feb 11 2015
On Wednesday, 11 February 2015 at 18:13:10 UTC, Paul wrote:How do I get/process input?Construct the real time input struct outside your loop then use getch if you're only interested in the core keyboard ascii stuff or nextEvent if you want everything. The esc key, in particular, is considered a non-character key event by terminal.d, so it will not be there on a simple call to getch(). (this might have been a mistake but is the way it is) Search the code for "void handleEvent" to see an example function. There's various event types you can react to and to get the info, you do auto specialized_event = generic_event.get!(InputEvent.Type.TYPE HERE); and look at the members. character event has ev.character. noncharacter event has ev.key which is an enum, defined on line 2057. PasteEvent doesn't work perfectly so dont' rely on it. MouseEvent, if you opt into them, has buttons, x, y, and modifierState which might be available. See the source for each struct to see more. If you're happy with keys from the middle part of the keyboard, getch is the easiest way though, they are sent as simple dchars. You can also fetch lines at a time with terminal.getline (it is on terminal rather than real time input because it is still conceptually line buffered (though the implementation turns that off to allow editing)).
Feb 11 2015
On Wednesday, 11 February 2015 at 18:37:49 UTC, Adam D. Ruppe wrote:On Wednesday, 11 February 2015 at 18:13:10 UTC, Paul wrote:Perfect, thank you again for a thorough answer.How do I get/process input?Construct the real time input struct outside your loop then use getch if you're only interested in the core keyboard ascii stuff or nextEvent if you want everything. The esc key, in particular, is considered a non-character key event by terminal.d, so it will not be there on a simple call to getch(). (this might have been a mistake but is the way it is) Search the code for "void handleEvent" to see an example function. There's various event types you can react to and to get the info, you do auto specialized_event = generic_event.get!(InputEvent.Type.TYPE HERE); and look at the members. character event has ev.character. noncharacter event has ev.key which is an enum, defined on line 2057. PasteEvent doesn't work perfectly so dont' rely on it. MouseEvent, if you opt into them, has buttons, x, y, and modifierState which might be available. See the source for each struct to see more. If you're happy with keys from the middle part of the keyboard, getch is the easiest way though, they are sent as simple dchars. You can also fetch lines at a time with terminal.getline (it is on terminal rather than real time input because it is still conceptually line buffered (though the implementation turns that off to allow editing)).
Feb 11 2015
On Tuesday, 10 February 2015 at 20:50:28 UTC, Paul wrote:On Tuesday, 10 February 2015 at 19:49:26 UTC, ketmar wrote:Are you on Linux or Windows? That constructor is only defined on Posix-based systems.On Tue, 10 Feb 2015 19:37:59 +0000, Meta wrote:Thanks both for the replies. Terminal.d looks as though it will do what I want but I'm familiar with using ncurses and could do without learning to use yet another api at the minute. Nevertheless, I had a quick look, but trying to create an instance of the Terminal struct like so: Terminal myTerm = Terminal(ConsoleOutputType.cellular, 0, 1, null); (which I think is the corrct way to do it!) gives me this error: test.o: In function `_Dmain': test.d:(.text._Dmain+0x13): undefined reference to `_D8terminal8Terminal6__initZ' test.d:(.text._Dmain+0x3c): undefined reference to `_D8terminal8Terminal6__ctorMFNcE8terminal17ConsoleOutputTypeiiDFZAiZS8terminal8Terminal' test.d:(.text._Dmain+0x6a): undefined reference to `_D8terminal8Terminal6__dtorMFZv' collect2: error: ld returned 1 exit status --- errorlevel 1 I have no idea how to fix that. Any suggestions please?I can't answer your question, but if you're just prototyping you could use Adam Ruppe's terminal.d until you get ncurses working. https://github.com/adamdruppe/arsd/blob/master/terminal.dand i daresay that with 'terminal.d' there is no need in ncurses at all (except if someone needs ncurses panels, but i can't imagine why).
Feb 10 2015
On Tue, Feb 10, 2015 at 09:05:06PM +0000, Meta via Digitalmars-d-learn wrote:On Tuesday, 10 February 2015 at 20:50:28 UTC, Paul wrote:[...]Judging by the name of the object file (test.o) and the name of the code section (.text), I'd say this is definitely Posix. :-) So the question is why that ctor isn't defined in spite of it being Posix. T -- Some ideas are so stupid that only intellectuals could believe them. -- George Orwelltest.o: In function `_Dmain': test.d:(.text._Dmain+0x13): undefined reference to `_D8terminal8Terminal6__initZ' test.d:(.text._Dmain+0x3c): undefined reference to `_D8terminal8Terminal6__ctorMFNcE8terminal17ConsoleOutputTypeiiDFZAiZS8terminal8Terminal' test.d:(.text._Dmain+0x6a): undefined reference to `_D8terminal8Terminal6__dtorMFZv' collect2: error: ld returned 1 exit status --- errorlevel 1 I have no idea how to fix that. Any suggestions please?Are you on Linux or Windows? That constructor is only defined on Posix-based systems.
Feb 10 2015
On Tuesday, 10 February 2015 at 21:14:36 UTC, H. S. Teoh wrote:Judging by the name of the object file (test.o) and the name of the code section (.text), I'd say this is definitely Posix. :-) So the question is why that ctor isn't defined in spite of it being Posix. THeh, you are right. I only use D on Windows and since I mostly use VisualD I don't remember what the error messages look like.
Feb 10 2015
On Tuesday, 10 February 2015 at 21:05:08 UTC, Meta wrote:On Tuesday, 10 February 2015 at 20:50:28 UTC, Paul wrote:Sorry I missed your post, I'm on Linux Mint 17.On Tuesday, 10 February 2015 at 19:49:26 UTC, ketmar wrote:Are you on Linux or Windows? That constructor is only defined on Posix-based systems.On Tue, 10 Feb 2015 19:37:59 +0000, Meta wrote:Thanks both for the replies. Terminal.d looks as though it will do what I want but I'm familiar with using ncurses and could do without learning to use yet another api at the minute. Nevertheless, I had a quick look, but trying to create an instance of the Terminal struct like so: Terminal myTerm = Terminal(ConsoleOutputType.cellular, 0, 1, null); (which I think is the corrct way to do it!) gives me this error: test.o: In function `_Dmain': test.d:(.text._Dmain+0x13): undefined reference to `_D8terminal8Terminal6__initZ' test.d:(.text._Dmain+0x3c): undefined reference to `_D8terminal8Terminal6__ctorMFNcE8terminal17ConsoleOutputTypeiiDFZAiZS8terminal8Terminal' test.d:(.text._Dmain+0x6a): undefined reference to `_D8terminal8Terminal6__dtorMFZv' collect2: error: ld returned 1 exit status --- errorlevel 1 I have no idea how to fix that. Any suggestions please?I can't answer your question, but if you're just prototyping you could use Adam Ruppe's terminal.d until you get ncurses working. https://github.com/adamdruppe/arsd/blob/master/terminal.dand i daresay that with 'terminal.d' there is no need in ncurses at all (except if someone needs ncurses panels, but i can't imagine why).
Feb 10 2015