The rez2else utility converts the CIA World Data Bank II from REZ format
to plain ASCII and JPD formats.

Notice concerning the REZ format
================================

The binary file of the CIA world data bank II used with the older xrmap-1.x 
versions was the REZ format designed by Reza Naima for use with his
rmap program. The REZ format has a simpler encoding than the original
Cobal data of the WDB2, and is more compact than the plain ASCII version
(45MB instead of 121MB). Notice that the newer JPD format used in xrmap-2.x 
is much more compact, 12MB only without any data loss).

The REZ format is organized as follows.

All values or pointers are 32 bit integers.

A. First there's a (general) header of 3 integers:

struct header
{
  BIT32 magic;
  BIT32 segment_index_address;
  BIT32 segment_index_count;
};

The magic number identifies the format and serves as a test for the
bigendian/smallendian nature of the processor.

B. The header is followed by a number of "segment_index" chunks (the total
number of which is "segment_index_count", as defined in the general header,
and the start address is "segment_index_address"=12 (in bytes), equal to
sizeof(header)).

struct segment_index
{
  BIT32 maxlat;
  BIT32 minlat;
  BIT32 maxlong;
  BIT32 minlong;
  BIT32 segment_address;
  BIT32 continent;
  BIT32 category;
  BIT32 type;
};

The segment_address value points to the absolute address of the associated 
segment within the file. The other parameters have self-explaining values.

C. Each segment consists of a header and a sequence of points (strokes)

struct segment_header
{
  BIT32 orgx;
  BIT32 orgy;
  BIT32 nstrokes;
};

struct stroke
{
  BIT32 dx;
  BIT32 dy;
};

orgx and orgy stand for the origin of the curve, nstrokes for the number 
of subsequent points to be stroked. Those points are defined by their
difference of coordinates (dx, dy) with respect to (orgx, orgy). The
unit is one second of arc (1/3600 of degree) in longitude (x coordinate) 
and latitude (y coordinate).
