Home > Erlang, Software > cecho – An ncurses library for Erlang

cecho – An ncurses library for Erlang

I’ve been thinking about monitoring tools lately and have been thinking about how to get nice UI’s through a terminal window. I had a project going on with the wxErlang library but I scrapped it (or rather put it aside for a little while) because the reality is that most system don’t have a window manager and you usually connect to a machine through ssh.

So I created cecho.

cecho is an ncurses library (wrapper). It works nicely on my linux machine which is as far as I have tested it so it is really pre-alfa but it seems to work. It can be found here: http://www.github.com/mazenharake/cecho

If you download it then check out the cecho_example.erl file for some simple examples on how to use it. It is intended to stay as close as possible to the ncurses API but in some cases it is impossible so I try to make it as alike as possible.

Here is a hello world example:

hello_world() ->
  cecho:move(10, 10),
  cecho:addstr("Hello world!"),

Hopefully this will become useful for someone and some cool stuff come out of it.

Important: This library does NOT support keyboard input yet… I haven’t figured out a proper way to implement it without it being a hack so therefore it will have to wait.

Important2: For some reason the Erlang VM crashes when one do a cecho:move to the max coordinates (the values of cecho:getmaxyx -1) and then add a character (or string). I don’t know why but I think it has to do with newline moving the cursor out of bounds or something… I’m still looking into it.

Have fun… I know I will 🙂

Peace out.

Categories: Erlang, Software Tags: ,
  1. Abdul Fattah
    2010/04/06 at 13:10

    Nice work Mazen 🙂

  2. Adam
    2011/02/18 at 17:20

    Wow. Great job. I hope you’ll get keyboard input working soon. This is something that the Erlang eco-system has been missing!

  3. mazenharake
    2011/02/19 at 14:11

    Thanks Adam. 🙂 The latest version of cecho now has input. If you have any feedback let me know 🙂


  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: