The CTIO Colour Text Input/Output Library

CTIO is a free, Open Source, C library that provides colour text, keyboard and mouse under MSDOS and the Linux console.

Written for and tested on DJGPP under DOS and gcc under Linux. Programs that use this interface behave identically under both platforms. Small enough to bundle with your own source (about 100k source with comments, compiled lib size about 50k).

CTIO provides:

Note: CTIO does not provide an interface to console windows running within X windows (eg. Xterm). It is designed for producing a text editor and widgets suitable for the console, for people with cheap PCs too slow to run X.


The purpose of the library

The purpose of CTIO is to assist in the production of a text editor for the Linux console. There are plenty of easy-to-use editors for DOS, but not Linux. I believe it is because screen output and mouse/keyboard input is so complicated at the Linux console, that no decent console editors exist, with mouse selection, mouseable menus etc.

I wanted to write my own editor, so I tried Slang and ncurses. I found them both difficult to learn and limited in a couple of annoying, little ways. I decided to write my own interface library, to be what I always wished for as a programmer: something smaller and simpler than Slang or ncurses, that required little learning and overcame the limitations suffered under those two libraries.

And I believe I have done that. Unlike Slang and ncurses, CTIO enables shift-PageDown, represents the screen as a flat array and reports shift state and mouse movement. I have covered over the complexity and made access to the mouse, keyboard and screen as simple under Linux as it ever was under DOS. I have spread comments liberally over the source in case you want to hack it, written a full set of instructions and provided three demo programs.

Are you a C/C++ programmer looking for a project? The Linux console really needs a mouse-sensitive editor with normal menus. See my inspiring page on the subject for a stirring pep-talk.

Download the latest version (2.00)

(The same source is provided in different formats for your convenience.)


Versions

The latest version is version 2.00. It is backwardly compatable, so programs written for previous versions will still work.

Version 2.0

Changes in version 2.0: (17th March 2003)

Version 1.01

Changes in version 1.01: (13th March 2003)

Version 1.0

Changes in version 1.0: (5th March 2003)

Note: I apologize to anyone who downloaded version 1 between March 5th and March 8th, 2003. There was a bug in it which prevented the DOS version from compiling. Sorry, but with limited access to a computer, I was rushed.


Read the story of My Struggle to write CTIO: here


Use the guestbook to communicate with other visitors to this page, mention anything you have made with CTIO or report bugs you have found.


Guestbook of ctio
 
13-05-2008 - 22:43
 
Communicate with other CTIO users
 
Total messages: 12 - Messages viewed: 100
 
Sign the Guestbook
 
NameComments
MNZ
 mnzaki@gmail.com
03-03-2007 - 10:35
Rest is peace. I promise, someday, I will try to improve ctio and use it in my own applications. You shall be remembered.

May God have mercy on your soul.
Ethan Lamoreaux
 spamshredder@yahoo.com
11-10-2004 - 05:18
While I haven't tried out the library yet, it looks like something I could use. This has been needed for a long time. Thank you for taking the effort, and hopefully someday someone (if not myself) will write this simple editor which I have been wanting for some time.

"Note: CTIO does not provide an interface to console windows running within X windows (eg. Xterm). It is designed for producing a text editor and widgets suitable for the console, for people with cheap PCs too slow to run X."

I believe this quote from above explains the problems mentioned by the previous signer. One should not expect to have full functionality within X windows. I suppose someone who cares could write an addition to the library to make it work.
Sergey A. Galin
 ctio@sageshome.net
 http://http://sageshome.net/?id=ctio
22-06-2003 - 17:43
Hello Stephen,

I've just tested CTIO on my system (ASP Linux 9 (based on Red Hat 9); XFree86 4.3). Here are the results:

Problems under X11 (KDE 3.1.2, Konsole):

- Pseudographic borders don't work under X11. This may be related to console settings (I have UNICODE font and ru_RU.KOI8-R locale).
- It needs to catch mouse wheel signals. By default, mouse wheel scrolls contents of the console.
- The worst thing is that mod keys (Shift, Alt, Ctrl) don't work at all (under X11).
- There should be some event when console is resized.

Also, when keyboard switched to alternate (Russian) layout mod keys don't work properly (under text-mode console).

This means that CTIO is not actually ready for real usage in most programs yet :(

I believe you did a great and very important job. CTIO may be used to ease porting of some DOS applications to Linux. Did you think about Win95 console support? It could be a great library to create cross-platform text-mode GUI applications working under Linux, DOS, Windows and probably more unixes.
Cooler19-06-2003 - 07:33
????? ??????!!!!
Pilot18-06-2003 - 12:15
Hi.
If you can freelance, you can try www.rentacoder.com to earn some more as I do.
Yarik
 http://Russia.land
17-06-2003 - 18:07
Stephen! I wish you to find a great job an' good LUCK!
Stay HI! :-)
Sergey Galin
 http://sageshome.net/
17-06-2003 - 17:17
PS Why don't you get a Sourceforge.net account? lycos is pretty slow an often inaccessible :)
Sergey Galin
 http://sageshome.net/
17-06-2003 - 17:16
I think you did a great work! I am going to use it to port some small stuff from DOS to Linux.
Jim Elliott
 James.Elliott@att.net
27-02-2003 - 03:18
I am just starting with linux. I enjoyed the article, it might be a first project for me. Thanks
DS18-02-2003 - 23:11
why are you homeless?
Ninja Alex
 http://ninjacoder.com/
12-02-2003 - 00:36
Your heart's in the right place, and I agree to what you're saying, for the most part. However, newbies and many "experts" don't want to do development in a console/xterm. It's simply too constricting.

I think backing one of the big IDE projects is best for now (Anjuta, Eclipse, etc). I myself, shall stick to my elitist gvim :)
The Author of CTIO
 ctio@lycos.co.uk
 http://members.lycos.co.uk/ctio/
30-11-2002 - 06:29
Because I am homeless, I might not reply to your emails. Sorry. I go long periods without access to a computer.
 
Sign the Guestbook