[ Home Page ] [ Eiffel Archive ] [ Eiffel Classes and Clusters ]

Arc de Triomphe clipart (2486 bytes)

ECIL: Eiffel Curses Interface Library


Written by James Graves.

ecil_eiffel_ncurses.tar.gz (63,009 bytes) - source code
http://www.elj.com/epan/by_author/jg/ecil/ (ECIL EPAN page)
http://www.xnet.com/~ansible/eiffel/ (James Graves' Eiffel page)
http://www.xnet.com/~ansible/ (James Graves' home page)


WARNING

ECIL is still in the works. Although this library has not been finished yet, it has been provided here just for the interest of the Eiffel community. In particular, it might not work straight out of the box. Also note that some effort has been made to port ECIL to SmallEiffel. A full-fledged version of this library might be relased sometime in the future, so visit this page once in a while.


This is an Eiffel encapsulation of the Curses library for terminal based applications.

This library is free software, and it can be used as part of a commercial application. Look at the file `LICENSE' for information on the licensing policy.

HOW TO USE WITH ISE EIFFEL:

Your ACE file must include the ECIL cluster, of course. It must also include this external block declaration at the end:

external
    Object: "-lcurses";
    C: "curses.h"

If you develop instructions for the use of this library with other compilers, please let me know and I will include them in this document.

INDENTING:

This library was written on a 4 character indent. To set this up in vi, you can put this in your ~/.exrc or the .exrc in the current directory:

set shiftwidth=4

Now you may use Ctrl-T to move to the next indent level and Ctrl-D to move to the previous indent level.

PROGRAMMING STYLE:

Almost no curses C routines are directly exported by the classes in the library. Most of them have "wrapper" functions that (at the very least) check the return status of the function, and raise an exception if the result indicates an error.

This is also necessary to follow Eiffel command/query seperation principal.

I tried to give better and more descriptive names than the ones in the curses library.

I didn't include in the interface routines that move the cursor and then do something, like wmvaddch(), which moves the cursor and then adds the character to the window. I wanted to make the interface as simple as possible. Adding those routines would have doubled the size of the interface. However, if there is a demand for this, it's easy to add in.

DEVELOPMENT NOTES:

This library was developed on a Linux box running ISE Eiffel 4.1. I've tried to keep the library as compiler independant as possible. I welcome reports of this library's use with other compilers and environments.

Not all compilers support the Precursor construct, so I couldn't use it, as much as I'd like to.

The design of the NC_CONSTANTS class may seem a little strange. I wanted this library to work with all existing compilers without modification. As it turns out, this is quite an ambitious goal.

SmallEiffel (currently the best of the freeware Eiffel compilers) doesn't understand ISE's C macro calls like:

func (p: POINTER): INTEGER is
    external "C [macro %"curses.h%" ]"
    alias "_c_func"
    end;

The upshot of this is that SmallEiffel needs all variables and constants re-defined as functions. This means a C file that has the actual functions, and then a regular external C feature declaration:

my_macro (p: POINTER): INTEGER is
    external "C"
    alias "my_c_macro"
    end;

For constants I didn't want the overhead of a function call. So we need two seperate declerations in Eiffel:

Constant_a: INTEGER is
    once
        Result := the_constant_a;
    end;

the_constant_a: INTEGER is
    external "C"
    alias "my_constant_a"
    end;

Yes, it _is_ a pain. But, at this time, it appears it is also the most portable. If there's a better way to do this, I'd be glad to hear it.

LIMITATIONS:

This library doesn't support the use of more than one terminal (tty) per application. Support for that is in the underlying curses library, but I've never seen an application use it.

Curses support for this stuff is in the works now:

Curses support for this stuff is not included yet, but may be in the future:

Curses support for this stuff is not included and may never be:

NCurses special support for this stuff is also not included:

CONTACT INFORMATION:

You may send me mail if you have problems or questions with this library. The current version of this library will be available at the web address below.

e-mail: ansible@xnet.com
WWW: http://www.xnet.com/~ansible/eiffel


[ Home Page ] [ Eiffel Archive ] [ Eiffel Classes and Clusters ]