Skip to content

Commit dd38554

Browse files
committed
Merge pull request #15 from 1100110/master
minor fixes for dub
2 parents 0157641 + 9b8f416 commit dd38554

30 files changed

+363
-300
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
examples/bin
2+
examples/bin/*
3+
14
*.o
25
*.so
36
*.a
4-

.travis.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
before_install:
2-
- sudo wget https://d-apt.googlecode.com/files/d-apt.list -O /etc/apt/sources.list.d/d-apt.list
2+
- sudo curl http://netcologne.dl.sourceforge.net/project/d-apt/files/d-apt.list -o /etc/apt/sources.list.d/d-apt.list
33
- sudo apt-get update && sudo apt-get -y --allow-unauthenticated install d-apt-keyring && sudo apt-get update
4-
- sudo apt-get install dmd libncursesw5
4+
- sudo apt-get install dmd-bin libncursesw5 make
55

66
script:
77
dmd -lib -L-lncursesw -oflibncurses-d deimos/ncurses/curses.d deimos/ncurses/eti.d deimos/ncurses/form.d deimos/ncurses/menu.d deimos/ncurses/ncurses.d deimos/ncurses/panel.d deimos/ncurses/unctrl.d
8+
9+
cd examples/ && make

examples/Makefile

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
DC=rdmd -g -w --build-only -ofbin/$@ -I../ -L-lncursesw $^
2+
3+
all: init helloUnicode helloWorld simpleColor simpleKey simpleSpectrum keyCode chgat acsVars printw simplePanel winBorder.d simpleMenu.d otherBorder mouseMenu scrollMenu attribMenu printBold
4+
5+
init:
6+
@echo "building all examples..."
7+
8+
helloWorld: helloWorld.d
9+
$(DC)
10+
11+
helloUnicode: helloUnicode.d
12+
$(DC)
13+
14+
simpleColor: simpleColor.d
15+
$(DC)
16+
17+
simplePanel: simplePanel.d
18+
$(DC)
19+
20+
# TODO fix
21+
simpleKey: simpleKey.d
22+
$(DC)
23+
24+
simpleSpectrum: simpleSpectrum.d
25+
$(DC)
26+
27+
simpleMenu: simpleMenu.d
28+
$(DC)
29+
30+
acsVars: acsVars.d
31+
$(DC)
32+
33+
chgat: chgat.d
34+
$(DC)
35+
36+
keyCode: keyCode.d
37+
$(DC)
38+
39+
tempLeave: tempLeave.d
40+
$(DC)
41+
42+
printw: printw.d
43+
$(DC)
44+
45+
printBold: printBold.d
46+
$(DC)
47+
48+
winBorder: winBorder.d
49+
$(DC)
50+
51+
otherBorder: otherBorder.d
52+
$(DC)
53+
54+
mouseMenu: mouseMenu.d
55+
$(DC)
56+
57+
scrollMenu: scrollMenu.d
58+
$(DC)
59+
60+
attribMenu: attribMenu.d
61+
$(DC)
62+
63+
clean:
64+
@rm bin/*
65+
@echo "done."

examples/README

Lines changed: 0 additions & 8 deletions
This file was deleted.

examples/README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# D Ncurses Examples
2+
3+
Here are a few examples to get you started.
4+
5+
The main site where these examples were originally found is here [tldp.org](http://tldp.org/HOWTO/NCURSES-Programming-HOWTO/)
6+
These examples need some work, but they should demonstrate that most everything is in working order.
7+
8+
All of the files *should* be executable and set to link with ncursesw by default.
9+
If you have rdmd installed in /usr/bin/rdmd, then ./helloWorld.d should get you going!
10+
11+
if not, then make [filename], and the programs will be in ./bin/
12+
13+
### Requirements:
14+
- [rdmd](http://github.com/D-Programming-Language/tools)
15+
- ncursesw
16+
17+
### Files
18+
- helloWorld.d - a simple hello world example.
19+
- helloUnicode.d - a simple unicode example.
20+
- keyCode.d - returns the number code of the key you pressed.
21+
- simpleColor.d - a simple example that demonstrates color output.
22+
23+
### TODO
24+
[ ] review, and fix anything that's broken.
25+
[ ] cosmetic alterations.
26+
[ ] add to travis.
27+
[ ] fix so that examples are compilable on Windows.
28+
29+
Again, please file any bugs that you come across.
30+
Even if you don't know if it is actually a bug, we appreciate the time.
31+
We understand that sometimes it is hard to figure out.

examples/acs_vars.d renamed to examples/acsVars.d

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1-
1+
#!/usr/bin/rdmd -L-lncurses
22
import std.string: toStringz;
33
import deimos.ncurses.curses;
44

55
void main()
66
{
77
initscr();
8-
8+
scope(exit) endwin();
9+
scope(failure) endwin();
910
//Please note: you might want to maximize your terminal before you try to
1011
//run this. It does not check the size or enable scrolling.
1112
//In other word, if your terminal is <= 23 by 79, it will do weird things.
12-
//That is left as an exersize for the reader.
13-
//Plus I'm lazy and I still have to port the rest of the tutorials.. ;)
1413
//The spaces are for readability on the screen when you run the program.
1514

1615
printw(toStringz("Upper left corner "));
@@ -139,5 +138,4 @@ void main()
139138

140139
refresh();
141140
getch();
142-
endwin();
143141
}

examples/menu_attrib.d renamed to examples/attribMenu.d

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
#!/usr/bin/rdmd -L-lmenu
12
import deimos.ncurses.menu;
2-
3+
import std.conv: to;
4+
pragma(lib, "menu");
35
const int CTRLD = 4;
46

57
immutable char[][] choices = [ "Choice 1",
@@ -30,7 +32,7 @@ int main()
3032
init_pair(3, COLOR_MAGENTA, COLOR_BLACK);
3133

3234
/* Initialize items */
33-
n_choices = choices.length;
35+
n_choices = choices.length.to!int;
3436
my_items.length = n_choices + 1;
3537
for(i = 0; i < n_choices; ++i)
3638
my_items[i] = new_item((choices[i]~'\0').ptr, (choices[i]~'\0').ptr);

examples/with_chgat.d renamed to examples/chgat.d

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
1-
import std.string: toStringz;
1+
#!/usr/bin/rdmd -L-lncurses
2+
import std.string: toStringz;
3+
import std.conv: to;
24
import deimos.ncurses.ncurses;
35

46
void main()
5-
{ initscr(); //Start curses mode
7+
{
8+
initscr(); //Start curses mode
9+
scope(failure) endwin();
10+
scope(exit) endwin();
11+
612
start_color(); //Start color functionality
713

814
init_pair(1, COLOR_CYAN, COLOR_BLACK);
915
printw(toStringz("A Big string which i didn't care to type fully... "));
10-
mvchgat(0, 0, -1, cast(attr_t)A_BLINK, cast(short)1, cast(void*)null);
16+
//type attr_t
17+
mvchgat(0, 0, -1, A_BLINK.to!attr_t, 1.to!short, null.to!(void*));
1118
/*
1219
* First two parameters specify the position at which to start
1320
* Third parameter number of characters to update. -1 means till
@@ -20,5 +27,4 @@ void main()
2027
*/
2128
refresh();
2229
getch();
23-
endwin(); //End curses mode
2430
}

examples/form_attrib.d

100644100755
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
#!/usr/bin/rdmd
12
import deimos.ncurses.form;
23
import std.string;
3-
4+
//TODO fix
5+
pragma(lib, "ncursesw");
6+
pragma(lib, "form");
47

58
void main()
69
{

examples/form_simple.d

Lines changed: 0 additions & 66 deletions
This file was deleted.

0 commit comments

Comments
 (0)