Code Monkey home page Code Monkey logo

ncurses's Introduction

Ncurses

Description

This repository hosts D bindings for the C library ncurses, as well as some examples.

The bindings are implemented as source-only (.di files), and do not need to be compiled into a library or object files first.

Status

The main C header files are up to date with ncurses 6.3, as it is configured and packaged by Arch Linux.

C++ header files, and the termcap-related header files, are not currently translated.

Build settings

Dub configurations

Three dub configurations are made available, which select which libraries are added to be linked into your application:

  • minimal: The minimal (which is the default configuration) configurations only links the ncursesw library.

  • panels: The panels configuration additionally links the panelw library.

  • full: The full configuration additionally links the formw and menuw library.

To use a specific configuration in your projects, depend on this package by adding the following config snippet to your project's dub.sdl:

subConfiguration "ncurses" "full"

Reentrant API

ncurses provides a reentrant API. If the ncurses library you are linking against was built with the reentrant API enabled, you can enable it in the bindings by building with -version=NCURSES_REENTRANT. In dub.sdl this can be done by adding:

versions "NCURSES_REENTRANT"

Building on macOS

The stock ncurses libraries on macOS don't include the wide libraries. Thus the full ncurses version needs to be installed with Homebrew. Homebrew installs ncurses below /usr/local/opt/ncurses, where the dub configuration will pick it up.

First install Homebrew using the instructions on the web site, then you can add the ncurses package with

brew install ncurses

ncurses's People

Contributors

1100110 avatar ag0aep6g avatar anonymouscommitter avatar c0rn3j avatar cybershadow avatar dhasenan avatar gabbmariz avatar jaydg avatar kviiri avatar llammissar avatar msoucy avatar repeatedly avatar s-ludwig avatar tynukua avatar walterbright avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ncurses's Issues

Error opening terminal: screen

I have a simple watch program here that uses ncurses. It works well inside tmux screen but it can't run inside screen session

$ echo $TERM
screen
$ dzwatch df -h
Error opening terminal: screen.

As a work-around I need to tricky TERM variable

$ TERM=tmux dzwatch df -h

Do you have any ideas?

Failure to install on ppc64le

Hi,

I am trying to port ncurses package on Linux ppc64le Ubuntu VM.
But when I try to run the install command, it fails with an Unsupported Architecture Error

root@63225bb162be:/D-Programming-Deimos/ncurses# CURL_USER_AGENT="$CURL_USER_AGENT" bash install.sh dmd
Unsupported Arch ppc64le

Analysed the install.sh script, but failed to install dmd and dub in the container.

Also tried installing dub from apt-get as mentioned in the url https://www.howtoinstall.co/en/ubuntu/xenial/dub, but it failed as unrecognized package.

Reading package lists... Done
Building dependency tree
Reading state information... Done
W: Target Packages (restricted/binary-ppc64el/Packages) is configured multiple times in /etc/apt/sources.list:4 and /etc/apt/sources.list:36
W: Target Packages (restricted/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:4 and /etc/apt/sources.list:36
W: Target Packages (universe/binary-ppc64el/Packages) is configured multiple times in /etc/apt/sources.list:17 and /etc/apt/sources.list:36
W: Target Packages (universe/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:17 and /etc/apt/sources.list:36
E: Unable to locate package dub

Any pointer on what changes would be required in the install.sh to support the ppc64le architecture would be helpful.

Regards,
Archa

Problem with scanw ()

the function scanw () is not working the compiler reports error at the time of compiling the code.

Error: function deimos.ncurses.curses.scanw(char* fmt, ...) is not callable using argument types (string, int*)
source/app.d(11,14): cannot pass argument "0" of type string to parameter char* fmt
/usr/bin/dmd failed with exit code 1.

wattr_set error: missing cast

In wattr_set, we see:
int wattr_set(W:WINDOW, A:attr_t, S:short, V:void)(W* win, A attrs, S pair, V* opts)
{ return win.attrs = (attrs & ~A_COLOR) | COLOR_PAIR(pair); }

Using this, we get an error:

../.dub/packages/ncurses-master/deimos/ncurses/curses.d(832,22): Error: cannot implicitly convert expression ((*win).attrs = attrs & 18446744073709486335LU | COLOR_PAIR(pair)) of type ulong to int

The function is declared as yielding an int when attr_t is an alias for ulong. The man page says it should return the integer constant OK on success.

Package format issue.

Hello!
It is mentioned in the dub package format that it is best to use importPaths rather than or with sourcePaths in package.json. Dub is also giving me a warning while building with this due to this issue.

Package ncurses (configuration "library") defines no import paths, use {"importPaths": [...]} or the default package directory structure to fix this.

I found the best way to prevent this is to use both as suggested, like the following:

...
"sourcePaths": [
    "deimos"
],
"importPaths": [
    "deimos"
],
...

Several `nothrow` things

  1. Not all extern blocks are marked with nothrow. Namely, only curses.d has one, the rest do not.
  2. Not all function arguments and fields are nothrow. In forms API, all of the structs' fields can hold a throwing function. In curses.d, vidputs and ripoffline can accept throwing functions as well, since nothrow on the enclosing block is not applied transitively to the argument functions.

The first point is very easy to fix, and I will make a pull request shortly. The second one is not, fixing it will break existing code. Not fixing it is possibly dangerous, I'm not sure what the C side would do if a function passed to it throws.

D acs_vars example no longer shows expected characters

The acs chars I use for drawing boxes no longer appear to work. It's hard to pinpoint which upgrade caused this regression on my system (compiler, deimos/ncurses, ncurses, etc), but currently the C acs_vars example works properly and the equivalent D example doesn't.

This is what the output from the D version looks like on my system:

Upper left corner           ^A
Lower left corner           P
Lower right corner          ^@
Tee pointing right          ^@
Tee pointing left           ^@
Tee pointing up             ^@
Tee pointing down           ^@
Horizontal line              
Vertical line               ^@
Large Plus or cross over    ^@
Scan Line 1                 ^@
Scan Line 3                 ^A
Scan Line 7                 ^A
Scan Line 9                 (
Diamond                     ^@
Checker board (stipple)     ^@
Degree Symbol               ^@
Plus/Minus Symbol           ^@
Bullet                      ^@
Arrow Pointing Left         ≠
Arrow Pointing Right        +
Arrow Pointing Down         \
Arrow Pointing Up           Z
Board of squares            ^@
Lantern Symbol              ^@
Solid Square Block          ◆
Less/Equal sign             ^@
Greater/Equal sign          ^@
Pi                          ^@
Not equal                   ^@
UK pound sign               ^@

Building on Windows with MinGW

The modules requires the static library "ncursesw.lib", however, it would be great if I could use a DLL so I can use a MinGW compiled version. (This is the recommended way of compiling ncurses on Windows).

I've been successful in compiling ncursesw (both static and shared) for Windows with MinGW, all that's stopping me from some silly console madness is the fact that it tries to link "ncursesw.lib" now, which would require the Microsoft Visual C/++ toolchain.

Long integers breaks printw()

It looks like if you pass long integer as an argument to the printw, it overlaps next expected variable or something like that. I don't really know what to add. Please take a look at this code and it's output:

import deimos.ncurses;
import std.stdio;
import std.string;

void main()
{
	initscr();
	scope(exit) endwin();

	raw();
	keypad(stdscr, true);
	noecho();

	string test = "Test String";
	long l = 1231231;
	int i = 567567;

	printw("%ld - %s\n", l, test.toStringz);
	printw("%ld - %s %s\n", l, test.toStringz, "2".toStringz);
	printw("%ld - %s %s\n", l, test.toStringz);

	printw("%d - %s\n", l, test.toStringz);
	printw("%d - %s %s\n", l, test.toStringz, "2".toStringz);
	printw("%d - %s %s\n", l, test.toStringz);

	printw("%d - %s\n", i, test.toStringz);
	printw("%d - %s %s\n", i, test.toStringz, "2".toStringz);

	refresh();
	getch();
}

Output:

1231231 - (null)
1231231 - (null) Test String
1231231 - (null) Test String

1231231 - (null)
1231231 - (null) Test String
1231231 - (null) Test String

567567 - Test String
567567 - Test String 2

I'm not really familiar with D, but I still suspect that this is a problem of some kind, not expected behaviour - sorry if I'm wrong.

Duplicate symbols _COLORS, _COLOR_PAIRS, etc.

Hey, I'm compiling on OSX 10.8.5, I just installed ncursesw, and I'm trying to get the examples to work, but it doesn't quite like me:

tachyon7:examples Verdagon$ make simpleColor
rdmd -g -w --build-only -ofbin/simpleColor -I../ -L-lncursesw simpleColor.d
duplicate symbol _COLORS in:
/tmp/.rdmd-501/rdmd-simpleColor.d-9EEE0B8638A612107715C3933A16A363/objs/simpleColor.o
/usr/local/lib/libncursesw.a(lib_color.o)
duplicate symbol _COLOR_PAIRS in:
/tmp/.rdmd-501/rdmd-simpleColor.d-9EEE0B8638A612107715C3933A16A363/objs/simpleColor.o
/usr/local/lib/libncursesw.a(lib_color.o)
duplicate symbol _ESCDELAY in:
/tmp/.rdmd-501/rdmd-simpleColor.d-9EEE0B8638A612107715C3933A16A363/objs/simpleColor.o
/usr/local/lib/libncursesw.a(lib_getch.o)
duplicate symbol _ripoffline in:
/tmp/.rdmd-501/rdmd-simpleColor.d-9EEE0B8638A612107715C3933A16A363/objs/simpleColor.o
/usr/local/lib/libncursesw.a(lib_set_term.o)
duplicate symbol _acs_map in:
/tmp/.rdmd-501/rdmd-simpleColor.d-9EEE0B8638A612107715C3933A16A363/objs/simpleColor.o
/usr/local/lib/libncursesw.a(lib_acs.o)
duplicate symbol _stdscr in:
/tmp/.rdmd-501/rdmd-simpleColor.d-9EEE0B8638A612107715C3933A16A363/objs/simpleColor.o
/usr/local/lib/libncursesw.a(lib_data.o)
duplicate symbol _curscr in:
/tmp/.rdmd-501/rdmd-simpleColor.d-9EEE0B8638A612107715C3933A16A363/objs/simpleColor.o
/usr/local/lib/libncursesw.a(lib_data.o)
duplicate symbol _newscr in:
/tmp/.rdmd-501/rdmd-simpleColor.d-9EEE0B8638A612107715C3933A16A363/objs/simpleColor.o
/usr/local/lib/libncursesw.a(lib_data.o)
duplicate symbol _TABSIZE in:
/tmp/.rdmd-501/rdmd-simpleColor.d-9EEE0B8638A612107715C3933A16A363/objs/simpleColor.o
/usr/local/lib/libncursesw.a(lib_setup.o)
duplicate symbol _ttytype in:
/tmp/.rdmd-501/rdmd-simpleColor.d-9EEE0B8638A612107715C3933A16A363/objs/simpleColor.o
/usr/local/lib/libncursesw.a(lib_setup.o)
duplicate symbol _LINES in:
/tmp/.rdmd-501/rdmd-simpleColor.d-9EEE0B8638A612107715C3933A16A363/objs/simpleColor.o
/usr/local/lib/libncursesw.a(lib_setup.o)
duplicate symbol _COLS in:
/tmp/.rdmd-501/rdmd-simpleColor.d-9EEE0B8638A612107715C3933A16A363/objs/simpleColor.o
/usr/local/lib/libncursesw.a(lib_setup.o)
ld: 12 duplicate symbols for architecture x86_64
collect2: ld returned 1 exit status
--- errorlevel 1
make: *** [simpleColor] Error 1
tachyon7:examples Verdagon$

Is this a bug or am I doing something wrong? Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.