Continued with file-based stacks:
[core.git] / contrib / file_stack / format.txt
1 A file-based stack:
2 ===================
3
4 This is the format for a file-based stack which works as any Stackable class.
5
6 General made up:
7
8 Purpose: | "magic"   | separator | count    | position | separator |
9 ---------+-----------+-----------+----------+----------+-----------+
10 Bytes:   | 9         | 1         | 20 (hex) | 20 (hex) | 1         |
11 ---------+-----------+-----------+----------+----------+-----------+
12 Example: | STACKv1.0 | 00        | 00...ff  | 00...ff  | ff        |
13
14 Continued:
15
16 Purpose: | hash 0 | separator | name 0 | entry 0    | hash n | separator | name n | entry n    | EOF |
17 ---------+--------+-----------+--------+------------+--------+-----------+--------+------------+-----+
18 Bytes:   |  ???   | 1         | 10     | 1-n (pack) |  ???   | 1         | 10     | 1-n (pack) | 1   |
19 ---------+--------+-----------+--------+------------+--------+-----------+--------+------------+-----+
20 Example: | abc    |    ???    | foo    |    ...     | abc    |    ???    | bar    |     ...    | EOF |
21
22 Explanations:
23 -------------
24  magic        - Identifies the file and version of format
25  separator    - Serves to detect end of strings with unknown/flexible length
26  count        - Total amount of entries (not deleted) encoded in hexa-decimal
27  position     - Seek position of current entry (which current() will give)
28  hash X       - Hash sum of entry X
29  name X       - Name of stack the entries belongs in
30  entry X      - The actual data, compressed with pack()
31  EOF          - End-of-file character
32  ???          - Must be still found out which character/hashing algorthym fits best