GnuDOS library version 1.0: Overview

Next: hello_gnudos, Previous: Top, Up: Top [Contents][Index]

## 1 Overview of the GnuDOS library

### About the GnuDOS library

GnuDOS package is a GNU software. It is a library designed to help new users of the GNU system, who are coming from a DOS background, fit into the picture and start using the GNU system with ease. It also addresses the console programmers of such programs that have the look and feel of old DOS system. The library is composed of core utilities and software applications: * The core library (corelib) contains four utilities: Kbd (for keyboard handling), Screen (for screen drawing), Dialogs (for dialog boxes/window drawing), and Strings (for strings functions). * The software applications are three: Prime (console file manager), Mino (console text editor), and Fog (console form designer).

### The rationale behind the GnuDOS corelib library

So, you like programming under the GNU/Linux console, right?. And you came from the DOS land where every thing was white/blue or yellow/black. You want to make users coming from DOS land feel home when switching to the powerful GNU system. Okay, That’s good. But there are some catches when programming under the console. First of all, you can’t format your output exactly the way you want in terms of color, positioning, and so on. You can go deep and use terminal escape sequences (as most GNU/Linux consoles emulate the VT100 terminal), but who can remember these?.

Next comes the problem of the terminal driver interfering with the keyboard input. You don’t get the real key scancodes sent by the keyboard. The driver gets in the way and performs a lot of steps to map the right key to the right keycode, process some special key combinations (like CTRL+ALT+DEL) and so on, before passing the result to the terminal. And in the case of XTerminal, the X terminal does more processing before sending the final result to your program. You say what difference does it make? you are taking all the pain off my head, why should I bother? Here is why:

If you want your program to be REALLY interactive, like waiting the user to press a key (press, not press and release and press ENTER!) you can’t rely on the good old getc() or getchar() functions, as they will return an input char alright, but only after the user presses ENTER!. That’s no good for us, you know. Another thing is reading special keys, like SHIFT, ALT and CTRL. You don’t get scancodes for these keys (not all times, at least).

So how to make your program get over these problems? well, you can implement your own keyboard driver, which will be very painful to construct your keymap tables and do all the calculations, or your can interfere with the input sent from the console driver before it does any further processing on it. The console-utils See Kbd. utility does this. It tells the console driver to send it raw data (with no processing), and it then looks into its own table to see what key (or key combinations) does this scancode means, and then gives you the result.

Right now, the See Kbd. utility doesn’t recognize ALL the possible keys that can be entered through a keyboard. It recognizes all the alphanumeric charset, the TAB, CAPS, ENTER, SPACE, CTRL, ALT, SHIFT, DEL, INS, HOME, ESC, and END. More keys (like function keys F1-F12) will be added with future releases.

The other thing the GnuDOS library provides is a utility for controlling the screen See Screen. It provides functions for getting the screen size (height and width), setting the screen colors, and clearing the screen.

The third utility is the See Dialogs. utility, which (as its name says) provides a ready to use class of dialog boxes under the console. It provides two types of boxes: simple dialog box (to provide the user with a messeage, or asking for confirmation, ...) and an input box (to ask the user to enter some input).

The fourth utility is the See Strings. utility. It provides some handy functions to make working with strings under C much easier for the programmer.

There are two sample programs: the See hello_gnudos. demonstrates how to use the various elements and utilities of the console-utils (GnuDOS) library (except for the strings utility). The other example is See hello_strings. which demonstrates how to use the strings utility.

Next: hello_gnudos, Previous: Top, Up: Top [Contents][Index]