Sharkysoft home

Package lava.clib

Ports of functions from the standard C library.


Class Summary
Ctype Ports of ctype functions.
Stdio Ports of stdio functions.
Stdlib Ports of stdio functions.

Package lava.clib Description

Ports of functions from the standard C library.

Details: This package contains ports of heavily-used and well-loved functions from the standard C library. Classes in this package make it possible for programmers to preserve the "feel" of C programming while programming in Java. In many cases, the presense of this package will make it easier for C programmers to migrate to Java, especially when the C programmers are familiar with function names in C but not in Java.

In this package, each emulated C library is a class, and each function in the library represented by the class is a static method. Just as it is usually necessary to include header files for libraries in C, Java programs must import the classes representing the desired libraries. Therefore, the C preprocessor directive

#include <ctype.h>

corresponds neatly to the Java statement

import lava.clib.Ctype;

Note that although Java's import directive "feels like" C's #include directive, the effect of Java's import directive is actually more like C's #define directive:

#define Ctype lava.clib.Ctype

Very few Java programmers understand this. Now you do. Aren't you glad?

Anyway -- In a Java source file where Ctype has been imported, a call to isalpha has the following form:

Ctype.isalpha (ch);

Similarly, a call to printf has the form Stdio.printf(...), etc.

Sharkysoft home