whio

whio
Login

whio

See also: TableOfContents

libwhio

Welcome to the Fossil source code repository for libwhio, the WanderingHorse.net I/O library for C. whio is a C library encapsulating i/o device and stream APIs, plus many utilities based off them. It originally developed as parts of two other libraries, but was found to be generic enough to fork out into its own library. Since that time, it has grown to include a number of device implementations and utility classes, such as hashtables (whio_udb and whio_ht), the storage-side equivalent of malloc() and free() (whio_vlbm), and an embedded filesystem (whio_epfs).

This site is a Fossil source repository, containing the source code, and a bug tracker, etc., for this project. To be able to download the code or use most of the hyperlinks on this site, you must click the /login link and log in as "anonymous" with the password shown on the screen. This is to avoid that bots download every version of every file in the repository, or traverse the whole history of every source file.

This site's wiki is maintained in a separate dedicated wiki:

The old pages will be kept around (because they're already there) but will not be maintained on this site.

Author: Stephan Beal (http://wanderinghorse.net/home/stephan/)

License: Public Domain

Code status: Works for me! whio is a core component of libwhefs, is developed in close conjunction with that library, and seems to work well. It is also the basis for a set of JavaScript I/O classes based on the Google v8 JavaScript engine, and (unsurprisingly) has caused no Grief there, either.

Download: downloads page

What is whio?

This library provides an object oriented C API for interacting with abstract data stores, either via random or sequential access. On top of this interface, concrete implementations are provided for FILE and in-memory data stores (via dynamic memory or a client-supplied memory range), and clients can provide their own. All implementations have the same, fairly small, public interface.

It can essentially be used to wrap any random-access data stream, and adding wrappers for custom stream types is easy to do. For example, whio_epfs, an "embedded filesystem" API, uses a custom whio_dev implementation to provide access to "virtual" files (inside an embedded filesystem) using the same API as one can use for accessing FILEs and memory buffers.

This code was originally developed as part of libc11n, a generic serialization framework for C. It was eventually forked to become a more generic i/o framework because i needed such a creature in order to develop libwhefs. libwhefs and libwhio are developed in close conjunction, but whio also sees use outside of whefs, and is generic enough to use in many contexts. whio has become my own personal favourite library for general-purpose I/O in C.

Features:

Misfeatures

Requirements

The code is ANSI C, using some C99 features. The file-based i/o handlers, as opposed to the memory-based handlers, require some functions defined in POSIX-1.2001. All (or most) Unix systems will have the few POSIX functions the API requires.

It has been shown to compile using gcc 4.2.x on Linux x86/32, gcc 4.1 on Linux x86/64, tcc on Linux/x86, and gcc 3.4 on Solaris/Sparc, but older gcc versions explicitly require using the -std=c99 flag to enable the C99 features which whio uses.

There are some optional features which use zlib to provide gzip compression to/from whio_stream objects, and these features require zlib (which is installed by default on nearly every system on the planet). See whio_zlib.h for the routines and the macro which needs to be set to enable these functions.

Code Status

whio is used as the i/o plaform in several projects and seems to be quite stable (functionally speaking):

Potential uses

See also...

News

See the NewsPage.