ncurses的API用D编程语言 [英] ncurses api with the D Programming Language

查看:229
本文介绍了ncurses的API用D编程语言的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图教自己的AI利用神经网络。
长话短说,我想创建一个简单的图形,将显示的内容是使用的ncurses在我的计划发生。
我使用本教程这里发现

I am trying to teach myself AI using neural networks. Long story short, I wanted to create a simple graphic that would display what is happening in my program using ncurses. The tutorial that I am using is found here.

我是IM pression下了D组兼容C,我可以在理论上比较容易地调用C函数。

I was under the impression that D was compatible with C and I could theoretically call C functions relatively easily.

我发现,不是这种情况。
我是一个比较新手程序员,所以即使是简单的解释是在我头顶一点点。
我发现这个
这里

I find that not to be the case. I am a relatively novice programmer, so even the simplistic explanations are a little above my head. I found this here.

D设计与C编译器对目标系统合身舒适。 ð弥补了不依靠目标环境的C运行时库有它自己的虚拟机。这将是毫无意义的尝试移植到D或写ð包装可用广大列C的API。它是如何更容易的只是直接调用它们。

D is designed to fit comfortably with a C compiler for the target system. D makes up for not having its own VM by relying on the target environment's C runtime library. It would be senseless to attempt to port to D or write D wrappers for the vast array of C APIs available. How much easier it is to just call them directly.

这是通过匹配C编译器的数据类型,布局和函数调用/返回序列来完成。

This is done by matching the C compiler's data types, layouts, and function call/return sequences.

这听起来很美妙。在我头上一点点。
我测试并得到了简单的C程序的工作:

That sounds wonderful. A little bit over my head. I tested and got a simple C program working:

#include <curses.h>

int main(void) {
    int ch;

    initscr();
    noecho();
    cbreak();
    printw("Hit Ctrl+C to exit ...\n\n");
    for (;;) {
      ch = getch();
      printw("Value of char: %d (%02x)\n", ch, ch);
    }
    endwin();
    return 0;
}

无耻复制,并从另一个问题上的SO粘贴。
至少我做功课。

shamelessly copied and pasted from another question on SO. At least I did my homework.

我想基本上是同样的事情,从一个简单的D程序。
我得到这个错误:

I tried basically the same thing from a simple D program. I got this error:

Error: module curses is in file 'curses.d' which cannot be read

我绝对肯定的,我尝试一些非常愚蠢的。

I am absolutely positive that I am trying something really stupid.

有没有在D程序中使用ncurses的一个简单的方法?

Is there an easy way to use ncurses in a D program?

我零睡眠和咖啡因的运行,所以请温柔!
甚至到一个网站的链接将是极大的AP preciated!

I'm running on zero sleep and caffeine, so please be gentle! Even a link to a website would be greatly appreciated!

我可能没有包括我应该拥有的一切,所以AMA。

I probably didn't include everything that I should have, so AMA.

和随意侮辱我的智商。

推荐答案

好吧,我觉得我一直在垃圾邮件了一点,但我希望所有的信息都将在未来有用的。

Ok, I feel I have been spamming a little, but I hope that all of the info will be useful in the future.

我发现了一个项目名称ycurses。
我发现了TLS的问题是特定于D2。
我改变了文件,D2工作。 DMD,GDC,这一切的作品。
我终于有以D我ncurses的!它只是把马拉松式的编码和研发的长周末。

I found a project name ycurses. I discovered the problem with TLS is specific to D2. I changed the files to work with D2. dmd, gdc, it all works. I finally have my ncurses using D! It just took a long weekend of marathon coding and researching.

由于code,我发现是旧的,似乎被抛弃,我
现在主持它 github上

Since the code I found is old and appears to be abandoned, I am now hosting it on github

虽然code状态将与探戈的工作,也不会。
我可能会修复一些时间这个星期。

Even though the code states it will work with Tango, IT WILL NOT. I'll probably fix that some time this week.

在code的包括一个漂亮的小教程,以及对如何链接指令。
不客气。我觉得很有造诣突然。

The code has a nice little tutorial included, as well as instruction on how to link. Your welcome. I feel very accomplished all of a sudden.

这篇关于ncurses的API用D编程语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆