home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 5
/
DATAFILE_PDCD5.iso
/
utilities
/
m
/
macrolife
/
!MacroLife
/
Docs
/
FileFormat
< prev
next >
Wrap
Text File
|
1996-06-21
|
4KB
|
115 lines
MacroLife uses two file formats, one for saving Life planes and one for
saving areas of the plane as "Lifeforms".
Lifeform files can be compiled into libraries, which are loaded by
MacroLife at run time.
It can also export Life patterns as text files, which can be imported
into Life programs for other machines, such as 'xlife', which runs on
Un*x workstations, and Life and WinLife for PCs.
LifeForm (Filetype &B7C)
-------------------------
Size Description
---- -----------
8 "LifeForm"
2 Version number * 100
1 Reserved (currently always 0)
1 Compression method (0 = no compression, 1 = Squash compression)
If compression is used, the following data will be compressed
using the specified method. It will be preceded by a single word
containing the original uncompressed size of the data.
* 1/4 Title string size - currently 0 or 32 (decimal)
0/? title string, null terminated and padded with zeros
4 Width of saved area (number of cells)
4 Height of saved area (number of cells)
? a series of 32-bit words, each bit representing a cell, beginning
at the bottom left and working along each row.
Size in bytes is thus (width * height)/8, rounded up to a whole
number of words.
Life (Filetype &B7B)
--------------------
Size Description
---- -----------
8 "Life "
2 Version number * 100
1 Reserved (currently always 0)
1 Compression method (0 = no compression, 1 = Squash compression)
If compression is used, the following data will be compressed
using the specified method. It will be preceded by a single word
containing the original uncompressed size of the data.
* 1/4 Settings size - currently 0 or 96 (decimal)
0/? Current settings data
* 1/4 Plane data flag - 0 or 1
0/4 Current plane generation (if flag = 1)
0/? Current plane data (multiple of 36 bytes)
* 1/4 Start position data flag - 0 or 1
0/? Start position data (multiple of 36 bytes)
Fields marked with a * are 4 bytes when stored compressed, else 1 byte.
Plane and Start data is stored as a four-layer tree structure, with a
branching factor at each level of 256. Tree traversal is depth-first.
i.e. given that the four layers are Global, Regional, Local and Cells
a typical organisation might be GRLCCLCRLCCC, encoding the tree:
G
|
R---------R
| |
L-----L L
| | |
C---C C C--C--C
Each node consists of a 36 byte structure. The first four bytes contain
a count of occupied branches, followed by a branch map organised as
16 rows of 16 bits, beginning with the bottom row. The count word of the
first node - the Global node, contains the population, not the number
of occupied branches.
Text (Filetype &FFF)
--------------------
Life textfiles are stored as a series of "pattern blocks", each of which
has a pair of co-ordinates which define where the top left of the pattern
will appear on the Life plane. For example, a glider centred on 0,0 would
appear as:
#P -1 -1
.*
..*
***
MacroLife can read in these textfiles if they are dragged to the icon bar.
It will also recognise the 'co-ordinate' format produced by early
versions of xlife. The glider shown above would appear as follows:
-1 1
0 1
1 1
1 0
0 -1
Data (Filetype &FFD)
--------------------
MacroLife will search its internal Lifeform directories for predefined Life
patterns when it starts up. By compiling the files in these directories
into libraries, the time it takes to load the patterns can be reduced.
The format of a Life library file is as follows:
Size Description
---- -----------
8 "LifeLib "
2 Version number * 100
2 Reserved (currently always 0)
4 number of lifeforms in library
This header is followed by the number of Lifeforms specified, together
with some additional information. The format of each entry is:
4 size of leafname
? leafname of Lifeform, size specified by preceding integer
4 high byte of datestamp
4 low bytes of datestamp
4 size of Lifeform
? Lifeform file (for structure see above)